Hacker News new | past | comments | ask | show | jobs | submit login

It's readable because we know what we're expecting. Had the logic been just a tad more complex (e.g validation of input, login flows etc.), it would quickly become unreadable and unmaintainable to anyone not familiar with FP, or specifically Haskell:

- there are fifteen LANGUAGE directives (what do they all bring?)

- there's an ungodly amount of ASCII-art: What do any of these do, and in which contexts: ! @ :> :<|>

And so on: just three things that caught my eyes looking at the code on my phone




> just a tad more complex (e.g validation of input, login flows etc.)

Servant (the routing library being used here) has pretty great and clean authentication support. https://docs.servant.dev/en/stable/tutorial/Authentication.h...

As for validation of input, what do you mean? Haskell tends to excel there as well, with the availability of parser combinator libraries like Attoparsec.

> LANGUAGE directives (what do they all bring?)

In a real project you hide these in a config file for your project. They're usually well documented, and you can usually guess what they're doing from the name once you have some context.

> What do any of these do, and in which contexts: ! @ :> :<|>

All of those except @ are just functions or types. You can look up what they do in the same way you would look up what any other function does. @ is the only one that's a syntactic operator, and it has 2 meanings depending on context. It's either specifying what a type variable should be, or it's pattern matching and binding a name at the same time.


> has pretty great and clean authentication support. https://docs.servant.dev/en/stable/tutorial/Authentication... > with the availability of parser combinator libraries like Attoparsec. > you hide these in a config file for your project.

etc. etc.

You're not helping the cause of "this is 99% readable" ;) If you add proper authentication and parser combinators [1], and configs, and.... It becomes anything but readable to a person without specific Haskell and very specific library knowledge.

And yes, I do have exposure to FP having worked with Erlang for a number of years.

I also seriously detest the unexplained love for ASCII art among many lib authors in the FP space. Servant is one such example: :> :. :<|> ! At this point, why not use J :)

[1] By the way, unless I'm mistaken, there's next to zero useful documentation on Attoparsec, there's only barebones package documentation. And no, you don't validate data using parser combinators unless your data is only strings that resolve to some DSL.


Why would Haskell need to be readable by people who don't know Haskell?


Well, it does lower the barrier for entry.


I want to use J, but I can't unlearn the symmetry of {}. On the other hand, I feel k/q is just too barebones.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: