Live data from Hacker News

Why Not Haskell?

neugierig.org

111–120 of 134 posts

Re: Why Not Haskell?

#111
post #21

In the end the author seems to be using Go for a lot more development. Are people here finding it to be a good solution? It seems like it might be the language that could bridge the iOS and Android systems for app development.

>could bridge the iOS and Android systems for app development.

How would it do that? Can it compile to Dalvik and iOS or something? Not very familiar with Go yet...

Re: Why Not Haskell?

#112
post #42

Agreed that Haskell might not be to perfect fit for most of the enterprise projects out there, BUT nevertheless it is worth learning and mastering. The perceived difficulty comes from decades of teaching of imperative programming. I'm myself the product of C/C++/Java and it's amazing how I've manage to deal with so many peculiarities of theses languages. After having learned Haskell, I realize that it's much more coh…

Yes, I actually started learning Haskell recently b/c I thought it would help me better grok Scala, which seems to borrow mostly from the ML family.

Scala is definitely a better Java imho, and you get to keep the JVM and all its libraries, and the Lift web framework is superb, and you can even build Android apps with Scala.

But ironically I've found myself falling in love with Haskell and not wanting to use anything else. For the first time ever I know what a real type system is and what it's for, and Haskell basically pulls a Steve Jobs in completely rethinking how to do parallelism (strictly control global state and side effects by eliminating them by default, enabled only via monad).

Mind expanding indeed.

Re: Why Not Haskell?

#113

I've been using Haskell on and off for a few years and have written a few (small) projects in it. Every time I end up turned off of it, though. First, I don't like how it makes side effects such a PITA. Fact of the matter is, computing is only useful for the side effects. A computation is useless if the result isn't printed to the screen, saved to a file, sent over the network, or used in some other way. So why make…

I don't know if this was the intent or a side effect, but one reason for strictly controlling side effects is that it improves parallelization of the code. Global state, mutable vars, other side effects are some of the biggest obstacles to code parallelization, and that's one of Haskell's solutions to it. Haskell and Erlang seem to be the only two languages that seem designed from the ground up for massive concurrency and parallelism.

Re: Why Not Haskell?

#114
post #21

In the end the author seems to be using Go for a lot more development. Are people here finding it to be a good solution? It seems like it might be the language that could bridge the iOS and Android systems for app development.

>could bridge the iOS and Android systems for app development. How would it do that? Can it compile to Dalvik and iOS or something? Not very familiar with Go yet...

Compile to native code. Android has the NDK; they support C/C++.

Re: Why Not Haskell?

#115
post #17

I've been spending time learning Haskell lately, as part of an investigation into tools which are amenable to static analysis at work. To learn about the situation, I've put together similar programs in Lisp, OCaml, and Haskell, as well as installed compilers for Haskell & Ocaml on the PPC. Well - I've coded for over a decade, and I've never encountered such a difficult to use language and jargony community & documen…

Does the lack of multithreading in Ocaml matter for your applications, I think that is the only thing that would push me towards Haskell over Ocaml.

In this particular domain, not very much, due to the amount of IO interaction. In my opinion, the Ocaml threads library would be sufficient, at least for a while.

Re: Why Not Haskell?

#116

Earlier quoted context omitted.

Hmm, as long as you do randomness in the IO monad, it's not any harder to do random numbers than it is to print to the screen. http://hackage.haskell.org/packages/archive/random/1.0.0.2/d... getStdRandom :: (StdGen -> (a, StdGen)) -> IO aSource Uses the supplied function to get a value from the current global random generator, and updates the global generator with the new generator returned by the function. For examp…

This is a fair point, but I'd generally prefer not to use the IO monad to generate random numbers because it feels "wrong", just like using IORef for mutable data when there are more "right" types feels wrong. Strictly speaking, pseudo-randomness isn't doing IO unless the source of randomness is considered something to which one is I/Oing.

You have to get the randomness out of IO, because referential transparency and randomness of any kind (psuedo or otherwise) are fundamentally in opposition, but once you have the random source in hand, you can use it any way you like in otherwise pure code. The Random support in Haskell is set up to permit and to some extent support this usage, with the ability to "split" a random generator into something you use now and something you pass along. After that it's your responsibility to properly split & use, but I haven't yet found it to be a big problem in practice.

Re: Why Not Haskell?

#117

Earlier quoted context omitted.

Really? Try harder :) Remember that the "inputs" in non-pure languages are not only the function arguments, but can be global variables, objects (singleton or otherwise), external files, and so on. These are all inputs. Plus, Java's type system is a toy compared to Haskell.

Try harder what? Not seeing bugs I don't see? Yes, I'm aware what "inputs" are. One property of what I consider well written software is the absence of global state. "External files, and so on." are, unfortunately, necessary for any program, even Haskell ones, to do anything useful. > Plus, Java's type system is a toy compared to Haskell. Plus, so what? I'm not even beginning to compare Java with Haskell.

'"External files, and so on." are, unfortunately, necessary for any program, even Haskell ones, to do anything useful.'

I would point out that Haskell can in fact do useful things, so these problems must have been solved. It is a common misconception that Haskell has "problems" with external state, when in fact what it has a way of explicitly managing such state where almost any other language does not. It isn't so much that Haskell is lacking the ability to manage external state as that other languages lack the ability to manage external state, and end up with a solution that from the Haskell point of view looks like a punt rather than a great solution.

But it's difficult to explain how that works in an HN comment; I'd suggest Learn You a Haskell up through the Monad chapter, then spending some time with STM until you grok how and why the type system actually manages to guarantee proper use of STM at compile time. This is interesting because STM has proved effectively intractable in languages that can't maintain the STM constraints at the type level. While the course I've just recommended may take a week of education, that's about all it would take; it's not months, and it's actually a very valuable perspective to gain on the problem of creating quality code I'd recommend to anyone.

Re: Why Not Haskell?

#118

I've been doing a whole lot of scientific Python lately, and every time I let my program run for like an hour only to crash on an array of the wrong dimensions, or pass in a scalar where an array is expected or vice versa, I swear and wish I was using a strongly typed language like Haskell. If only it had the same tools as SciPy I'd be all over doing my scientific work in Haskell. (Not to mention it would have faster…

I think strong type systems for arrays are very much an open problem (as soon as you stick integers in there you go into dependent types land), so for dimension matching you'd probably end up with runtime type errors even in Haskell.

Re: Why Not Haskell?

#119

For those interested in learning Haskell, I can recommend the lesser known "Haskell Road to Logic, Maths, and Programming": http://www.amazon.com/Haskell-Logic-Maths-Programming-Comput... It's great to go over old and new math concepts and do so while exploring Haskell.

I don't know. For me this sounds like a very bad idea. What is putting me off (tried building small things in Haskell a couple of times) is the already heavily buzzword compliant community, throwing not only a new language with new concept at me, but adding words that at first seem to be made up on the spot. Additionally, as others have said here, I'm having most troubles interacting with the world (IO!). Pure functi…

I think you raise a good point and I wouldn't want to put others off if this isn't commensurate with their learning style. I suspect the overlap between math geeks and haskell learners is pretty big, but one should, as you are, evaluate one's own preferred learning style against this approach.

I find human languages are the same for me. I have always liked to approach them from a bottom up linguistic direction, but this means largely self-structured study.

Re: Why Not Haskell?

#120
post #96

Earlier quoted context omitted.

Special operators out the wazzoo...Google doesn't help here - I don't even know the verbal names for some of them. Operators are just functions, so try Hoogle: http://www.haskell.org/hoogle/?hoogle=%3E%3E%3D

FYI: Hoogle dies on :: and `, and gives a wrong result for =>. Please note that this is just a simple problem, with a solution of printing out the right reference cheatsheet. The real difficulty comes (IMO) when looking at piles of symbols in code and trying to determine what kind of meaning is coming from the symbol soup (C++ and Perl are notorious for this too). Quite often (usually?), of course, public Haskell is…

You won't find :: and => in Hoogle because they're keywords, not functions. For keywords, see the the wiki page that gtani posted:

http://haskell.org/haskellwiki/Keywords

I recommend reading Learn You a Haskell instead; the keywords were second nature to me by the time I finished.

I agree that there's too much "symbol soup" Haskell out there that uses infix functions excessively. Even if you recognize all of the functions, you still need to have their precedences memorized to decode the soup.

Post reply on HN