Early thoughts on Haskell
I’m only a month in, and it hasn’t been the type drive oasis I had hoped — that said it’s not all bad.
Unsafe functions in the standard prelude —
head throws an exception if called with an empty list!
Libraries throwing exceptions if there is IO, rather using the type system to indicate the possibility of errors.
Compile time — after Scala it is blindingly quick.
I’m using Microsoft’s Visual Studio Code with the Haskell Language Server which is provides a wrapper around HIE and it’s mostly wonderful. I said mostly as sometimes it just stops. The shutdown / startup is so quick that I haven’t looked into why and just restart.
Cabal is helpful
$ cabal build Warning: The package list for 'hackage.haskell.org' is 19 days old. Run 'cabal update' to get the latest list of available packages.
A concise and helpful message with a clear path to resolution.
cabal gen-bounds1 is wonderful, it will attempt to suggest a set of dependency versions for your project. Which means you can add dependencies to your project and not worry immediately what version is needed.
I am in a privileged position of knowing wonderfully smart and helpful people who have been able to share their experience with the ecosystem. Their learning can be distilled to:
- Shim libraries to lift errors out of exceptions and into types. A nice example of this being Ambiata’s shimming of
http-clientso as not to throw an exception for a non 200 response,
- Use a custom prelude — such as protolude, and
- Deferring IO as far as possible.
So with my first application in production I’m off to learn about custom preludes and Freer monads.