3 ms·
I found ocaml to be a more flexible alternative -- I can sprinkle printf for quick debugging without having to alter types. (I think this is what you mean by "h
by bstpierre 12y ago
I found ocaml to be a more flexible alternative -- I can sprinkle printf for quick debugging without having to alter types. (I think this is what you mean by "having to use the IO monad". I didn't work with haskell much, so it's possible there's an easy way around this there.) And stack traces in ocaml are reasonable, though not quite as verbose as python's.
But your point about needing to install extra packages stands for either language.
- kxs 12y agoYou should look into Debug.Trace for quick printf-like debugging. Usage: trace ("error occurs here") (f x)
- gnuvince 12y agoOCaml is currently my language of choice. I love functional programming, been doing it for a while now, but it's nice to know that if I read an algorithm in a textbook, I can just implement it as-is instead of doing a translation to be purely functional (and sometimes having to fight to get back the asymptotic complexity). The module system is also absolutely great, and should be copied shamelessly by more languages.
- Peaker 12y agoHaskell doesn't ban imperative programming, it simply distinguishes it in the types.
- gnuvince 12y agoTrue, what I mean is that I can be "messy" in OCaml for the sake of expediency. In principle, I prefer Haskell's clean approach, in practice I'm a bad programmer who sometimes does naughty things.
- Peaker 12y agoWell, Haskell does force you to go and update your types about your effects, and fix the use sites to do proper lifting. I don't feel this costs much, though, so even in quick&dirty mode, I feel that Haskell is quite productive enough.