After spending most of a year doing Elm I have now been doing haskell for a few weeks. I wanted to share my first impressions after about a month of haskell. I have to say that compared to elm I have been rather frustrated. I think the experience for new users in Haskell involves a much steeper learning curve than is needed.
I should point out that this is written from the point of view of someone who is new to haskell joining an existing project.
Problems with auto import
Auto Import by default. If you do something like “import Module” it will import everything from that Module into your namespace. This can lead to very confusing issues of “Where did this function come from?” Yes a good editor/IDE can help you on that but it would be so much easier to have it so that the function (Or type) is called with a module name or explicity imported.
To many infix operators
Two many infix operators. The problem here is that each package
imports their own. and that they are imported by default. If you come
to a new code base you will find that suddenly you have something that
$=*=> and what in the world does that mean? And for that
matter where was it even defined.
I find both of these means that code can get very hard to read for someone who is new to a project eco system
Too many Strings
Too many string types. I think I have run into String, Text, ByteString, Lazy ByteString and a few more. Really why can’t this be easier? I get that some of this is the result of 20+ years of evolution, but even with overloaded stings it seems a pain. Ifyou are using three different libraries and one wants lazy bytestrings and another wants tex thtere ends up being a lot of glue code.
Type over complexity
Types get too complex, I realize that having this level of complexity enables some real power but it comes at the cost of a learning curve.
For a language that claims to be all about type safety it seems very
odd to me that a function as simple as
List.head can crash a program
when passed an empty list. There are a number of other standard
functions (foldr/foldl?) that seem to suffer from similar issues.
Right and Left?
Arbitrary Convertions. There are a number of things that return
a on success and
Left b on failure. (or is it the other way around)
why not have success and failure be called well
Err). To someone new to a code base a
has an obvious meaning while
Left does not.
First something simple, if you go to the docs for an out of date version of a package then having a simple banner pop up on the top of the page and say “Hey the current version is X” with a link would go a long way to making things more user friendly.
In addition more examples would make many packages more user friendly.
In addition types like “Compare a c q v d” or the like are rather hard to figure out. What are “a” “c” “q” “v” and “d”?