Live data from Hacker News

The Haskell user experience

rickdzekman.com

41–50 of 50 posts

Re: The Haskell user experience

#41

My experience with learning Haskell was: When it works, it's magical. Finally realising that monads allow little bubbles of cause-and-effect. STM, which is utterly magical. Realising that not having side effects is freeing, not restricting. Collapsing huge chunks of code into little bits of pattern matching. Finding myself casually using a higher-order type because it was the easiest way to solve a problem. When it's…

Totally agree on the runtime exception issue. I feel like even Java with it's typed exceptions are better. With a Haskell function I have no idea what exceptions it will through and worse, if it's in IO, I have no idea what async exceptions it could throw.

Re: The Haskell user experience

#42

My experience with learning Haskell was: When it works, it's magical. Finally realising that monads allow little bubbles of cause-and-effect. STM, which is utterly magical. Realising that not having side effects is freeing, not restricting. Collapsing huge chunks of code into little bits of pattern matching. Finding myself casually using a higher-order type because it was the easiest way to solve a problem. When it's…

> A billion little unmemorable functions with symbolic names Pretty much. If you though Common Lisp was bad, this is much worse. And that makes for a major (re-)learning curve every time you stop programming in Haskell for a couple of months.

I actually like the symbolic function names. They're a pattern and method to them that once you learn it, it's super convenient. Perhaps it just needs more obvious documentation.

Re: The Haskell user experience

#43

Earlier quoted context omitted.

Personally, I've been spending a lot of my recent time trying to debug a Parsec parser (it seems to be going into loops of backtracking, but I can't figure out where and why ), and it's been a clusterfuck. * `trace` and `traceM` don't actually get evaluated, so I can't use printing to find my bugs. * Even putting `trace "..." True` as a guard to my parser combinators doesn't seem to actually print anything. * `seq` a…

Note that trace is implemented in terms of unsafePerformIO (which is fine for debugging). To get a trace message, you need to attach the trace to something that does get evaluated. I mostly define a somewhat simpler helper like this: tt :: Show a => a -> a tt x = trace (show x) x So you surround your expressions with it and see there values, when those values get evaluated of course. Eg: myParser = (\_ code -> tt cod…

Note: I just looked at the docs linked in creichert's sibling post, and I noticed that Debug.Trace provides traceShow as a helper.

Re: The Haskell user experience

#44
Agreed about the SEO of the documentation... I'm learning Haskell, and just last week I was trying to parse binary files using Data.Binary.Get. I spent a fair amount of time looking for a way to handle parse errors outside an IO monad. It turns out that the function I needed exists (runGetOrFail), but I couldn't find it because the first Google hit for "Data.Binary.Get" was for an old version of the package.

I don't know how one would tell Google to prefer the latest docs, but it would certainly help if the Hackage documentation page header warned you if you were not looking at the latest version of the docs.

Re: The Haskell user experience

#45

There is... certainly a learning curve. The Haskell community is still tiny. Per capita, it's one of the best language communities out there. It just hasn't had the thousands or millions of person-hours necessary to make everything pretty and intuitive. I generally say that, all else equal, and if I were to use a GC'd language-- obviously, there are projects that mandate C or other low-level languages-- then I would…

"You don't find yourself needing static typing if you're doing a small, self-contained, line-of-business task like a script. You start to really want it for multi-developer programs and for infrastructural jobs that'll take months to complete (and, at age 32-- that's ancient in programming years-- the only programming challenges that really interest me are the hard ones where Haskell's type discipline pays off in a major way)."

IME, this seems to be roughly, "What are the odds you'll need to refactor significantly because the world changed around you?"

Re: The Haskell user experience

#46

My experience with learning Haskell was: When it works, it's magical. Finally realising that monads allow little bubbles of cause-and-effect. STM, which is utterly magical. Realising that not having side effects is freeing, not restricting. Collapsing huge chunks of code into little bits of pattern matching. Finding myself casually using a higher-order type because it was the easiest way to solve a problem. When it's…

> A billion little unmemorable functions with symbolic names Pretty much. If you though Common Lisp was bad, this is much worse. And that makes for a major (re-)learning curve every time you stop programming in Haskell for a couple of months.

That's why I like Scheme.

Re: The Haskell user experience

#47
post #37

Earlier quoted context omitted.

It'd be nice to be able to search by type declaration

Hoogle lets you do exactly that, with fuzzy matching: https://www.haskell.org/hoogle/?hoogle=a+-%3E+[b] It's as useful as you might hope!

I am not a Haskeller, but you can use "!h searchterm" on Duck Duck Go.

Re: The Haskell user experience

#48
post #47

Earlier quoted context omitted.

Hoogle lets you do exactly that, with fuzzy matching: https://www.haskell.org/hoogle/?hoogle=a+-%3E+[b] It's as useful as you might hope!

I am not a Haskeller, but you can use "!h searchterm" on Duck Duck Go.

OMG thank you, this was the thing that got me to finally permanently set my toolbar search in FF to Duck Duck Go...

Re: The Haskell user experience

#49

Haskell has all the features of languages that become mainstream and mandated top-down on workplaces. I wouldn't be much surprised if in a decade people start complaining about Haskell-shops they way we complain about Java-shops now. (But then, no language could get there without a marketing budget...) Haskell lets big teams collaborate very well, makes it hard to bad coders to destroy an entire project, consist in a…

I ran into the lack of HTTPS client support this spring; my workaround was to use the libcurl bindings.

Re: The Haskell user experience

#50
post #17

My experience with learning Haskell was: When it works, it's magical. Finally realising that monads allow little bubbles of cause-and-effect. STM, which is utterly magical. Realising that not having side effects is freeing, not restricting. Collapsing huge chunks of code into little bits of pattern matching. Finding myself casually using a higher-order type because it was the easiest way to solve a problem. When it's…

> Even BASIC would at least give me a line number! You can get line numbers and even stack traces if you compile your program (assuming you use GHC) with `-prof` and execute it with `+RTS -xc`. But most libraries try their best to avoid using exceptions altogether and it's generally discouraged to use the non-total functions from Prelude like `head` or `!!` and use safer alternatives instead.

I do remember trying to use -prof, and being unable to make it work --- but it's too long ago to remember the details. I think it was something about being unable to find a prof version of one of the libraries I was linking to?

I did also try the ghci interactive debugger, and couldn't make that work either. Now, I like command line debuggers, but I found the ghci one utterly opaque. I did eventually get it to catch the exception... but then it wouldn't tell me where it happened.

In general, trying to track down the exception was an utterly miserable experience. I do understand that Haskell has special needs when it comes to order of evaluation, due to the way that thunks are unwound, which means that traditional stepping and stack frames are of little use; but this desperately needs to be better. And work out of the box.

Regarding avoiding exceptions... yeah, I'd love to, but it wasn't my code which was throwing the exception.

Post reply on HN