Haskell as a first timer - Am I missing something ?
Tags: haskell, functional
Published: 2021-02-03 08:59:50

<center>
*NB: This is also commented [on reddit](https://www.reddit.com/r/haskell/comments/lbk51h/haskell_as_a_first_timer_am_i_missing_something/)*
</center>
<hr>

So... I've been toying a lot with Haskell lately.

But I feel a bit schizophrenic about my first impressions. There 
 is something both very right, and very wrong about it.

While addressing most of my top concerns about other languages, and giving me hope to discover a language that I could love, the Haskell ecosystem seems in the meantime broken where I expected it the least to be. It is sooo frustrating, and leaves a bitter taste of unachievement :(

Have I missed a crucial step ? Or is there really something broken in its ecosystem ? (may it be a victim of its age × lack of wide adoption ?)

Let me elaborate a bit.

# 💖 First looks - The (very) good parts

I wont dive into details, since this is widely documented, but in short, I loved:
- Its world-class type system 😱 so smooth.
- Immutablility, Pure FP, all that good stuff.
- Its syntax. Not the most beginner friendly, but if feels smart and concise when you get it. Other languages then tend to feel verbose.
- That it looks like maths
- The simplifications the compiler hints at
- The depth of this language. I only got a glimpse of its abstraction power, and it is definitely not playing in the same league as others. It is so exciting not to feel that a compiler is forcing you to write dumb things just because language designers felt like "this" or "that" abstraction was not part of the language.
- TDD as in Type-Driven-Development 😁 If you've ever searched for a type signature on [Hoogle](https://hoogle.haskell.org/), you'll [get what I mean](https://hoogle.haskell.org/?hoogle=Ord%20b%20%20%3D%3E%20(a%20-%3E%20b)%20-%3E%20%20%5Ba%5D%20-%3E%20a).
- Great learning resources such as [learn you a haskell](http://learnyouahaskell.com/chapters) or [fp complete](https://www.fpcomplete.com/haskell/learn/)


You get the picture, I think that Haskell in itself is neat. But seriously, WTF is wrong with its ecosystem ?
Once you're done toying, and start to get like "okay, now lets do real world shit", everything seems to fall apart.

# 🥪 Frustration 1 - Stack configuration

If I understood right, [stack](https://docs.haskellstack.org/) was supposed to bring to Haskell a decent all-inclusive CLI equivalent to those that you have with Dotnet, Deno, Elm, and whatnot. 
Okay. It kind of seems to be (or at least a huge improvement over not having it).

But when npm and friends set a standard of having one file which defines your package (dependencies, and such), why deviate from it introducing `package.yaml` and `stack.yaml` ? How the f*** am I supposed to guess that I must [read a random part](https://docs.haskellstack.org/en/stable/GUIDE/#extra-deps) of the Stack documentation to understand that yea, you can install packages by adding them in `package.yaml`, but for some of them, you must also add them in `stack.yaml` ... wait ... what ??! Okay, it makes kinda sense once you know why, but why not stick to the "expected" way to go by default ?

When learning a new language or framework, I usually spend minutes trying to understand how the associated CLI & package manager works. I had to spend frustrating **hours** on stack to understand that it just dont work as others do. What's even more confusing is that it **almost** does ! Why not ? And why not a "stack install xxx" command which writes yaml files ? 

# 💥 Frustration 2 - Stack error messages

Is it just me ? Or does installing a library though stack is just like playing russian roulette ?

I think everyone who's been a solo Haskell learner might at one point or another felt that sentiment of hoplessness, despair, and self doubt when Haskell tooling just keeps throwing at you thousands of giberrish error lines for no appearant reason, just because you tried to install a package or such (especially if you're already mastering several other ecosystems which behave "as you would expect")


For instance, how the hell am I supposed to make sense of [this kind of error logs](https://gist.github.com/oguimbal/0ef39d890eed2328b8f5f9d619fc324e#file-dev-to-stack-persistent-install-errlog-L122-L124) without getting a headache reading usless stuff ? (for the record, I just added a very widely used package to package.yaml... nothing fancy !)

- I would expect Stack not to  tell me "please scroll up an unkown number of lines to find the error yourself". Especially since there are a lot of things that look like errors between me and the actual error. I guess one can get used to it, but if the point of a nice build tool isnt to help you, what is ?
- I would expect the luxry of a colorized console output, somehow ?
- The actual error does not even mention the word "error" 😩 Pretty hard to find the error by yourself when you dont know what you're looking for.
- If a native dependency is required, isnt it the toolchains' job to abstract that away, and to install it, or at least tell me how to install it (hint: for my error, I guess that a 600MB `apt-get install pg` is not the answer)

Most of the significant libraries I tried just failed miserably to install for one reason or another. Which leads me to my second frustration.


# 🤼 Frustration 3 - Maintainers ?

Is it just me ? Or most packages are just abandonned, even sometimes left in a state that is no longer compatible with newer versions of the GHC, with nobody left to answer 3 years old issues and pull requests ?

I am definitely okay (even a bit excited by) trying to adhere to a fringe ecosystem. I dont need millions of downloads to feel safe about a piece of code I'm using. But I fear dead communities, and it has been a bit puzzling to see how inactive most of the repos I encountered are... 

Dont get me wrong: I am [trying to contribute to opensource as well](https://github.com/oguimbal/pg-mem), so I get that supporting small projects can be demanding. There's nothing wrong in not spending your weekends on OS. But not asking for help, nor specifying that a project is unmaintained, nor even answering issues & pull requests for years feels just wrong.

nb: I dont think too much finger pointing will solve anything, so I wont name any specific library, but you dont have to search very long to find such libs on hackage.

# 📚 Frustration 4 - Documentawhat ?

I wont moann too much about it because I'm definitely not the first one to point that out.

I get that the holly Types are enough. I get that. But I could argue that even if you could theorically learn gibberish  by reading a dictionary on a smartwatch, its usually more pleasant to read, watch or listen to actual people, producing actual sentences.

I dont understand. When you're willing to sacrifice your time to opensource... Why not writing 10 lines targetting mere mortals willing to use your code to tell the general idea behind your work ? Not doing so just feels a bit like "go fuck yourself & read the types, you dumb monkeys" 😯


# 👉 Conclusion - Please enlighten me

That's where I stand. I am very excited by Haskell, while really puzzled to find myself not willing to try to write actual production stuff with it, for absurd reasons.

These are just small glitches, in the sense that they feel just like superficial flaws, which have been overcome in almost all decent language communities... but they are crippling enough to me so I dont see how I could not have problems working with Haskell.

Still, I will continue to fiddle around with this awesome language, but I gave up my short term plans to build something real with it.

But I'm very open to someone willing to change my mind... What do you think ? Is Haskell dying, or in a status quo, being okay mid distance from a research language to a widely adoptable & production ready thing ? Or is it still a passionate community it seems to have been ? Are those flaws a temporary thing, or the symptoms of something rotten ? Have you had recent production successes with Haskell ? What's your reciepe to onboard people ? How do you see the future for Haskell ? What do you think of Purescript ?

ps: Sorry if my English is off, I'm french :)