5 ms·
I was curious about the code so I went to check it, it's written in Haskell, never seen Haskell before, it's really hard to follow for someone not used to it: h
by Thaxll 7y ago
I was curious about the code so I went to check it, it's written in Haskell, never seen Haskell before, it's really hard to follow for someone not used to it: https://github.com/hasura/graphql-engine/blob/master/server/src-lib/Hasura/Server/App.hs https://github.com/hasura/graphql-engine/blob/master/server/...
Not sure how people enjoy FP.
- mrkurt 7y agoIt's worth writing something in an ML or Haskell sometime. Functional programming is great, and it makes my code in things like JavaScript much more robust.
- lpage 7y agoHaskell and ML languages look like symbol soup when you're used to mainstream/C style languages. Once you understand some of the basic syntax they become quite readable and easy to reason about as a series of transformations. Step one, which applies to most functional languages, is knowing how to read a Hindley-Milner type signature [1]. Armed with that you can often gain a surface level understanding of what some function does - and what the program does in aggregate - just by reading type signatures and seeing what calls what. Hoogle [2] is a good resource for figuring out Haskell syntax, like what's up with all of those $ signs. Converting OCaml to ReasonML syntax with sketch or reason-tools [3] makes OCaml less foreign. With basic knowledge of Haskell and ML syntax you'll find many FP languages readable. [1] https://drboolean.gitbooks.io/mostly-adequate-guide-old/content/ch7.html#tales-from-the-cryptic https://drboolean.gitbooks.io/mostly-adequate-guide-old/cont... [2] https://hoogle.haskell.org/ https://hoogle.haskell.org/ [3] https://reasonml.github.io/docs/en/extra-goodies https://reasonml.github.io/docs/en/extra-goodies
- jakear 7y ago“Quite readable” is a stretch... I know of no other language that needs a hoogle equivalent. That being said, my experience with Haskell is limited to working on some meta-meta-programming research in college, where every file used at minimum 3 different GHC extensions. So I may be biased.
- mlevental 7y ago>at minimum 3 different GHC extensions. So I may be biased. are you kidding? most files i see have all of these http://dev.stephendiehl.com/hask/#the-benign http://dev.stephendiehl.com/hask/#the-benign
- jakear 7y agoAgain, I don’t have a clue what I’m talking about. But I seem to remember seeing a lot of those “dangerous” ones. If that’s just the state of Haskell, my bad.
- whateveracct 7y agoYou don't need hoogle -.- It is a very cool tool tho
- FridgeSeal 7y agoI find Haskell less of a “needs” a hoogle, and more of a “nothing else has this, this is so useful”. The number of times I have wished for something like Hoogle when writing Python...
- SomeOldThrow 7y agoScala could definitely use hoogle, as can c++/boost. My lesson from all this is to never ever overload an operator except, maybe, the comparison operators. Exception: apl.
- seer 7y agoThank you so much for the reference to “mostly adequate guide to FP” book. It looks incredibly easy to read. As someone who is fluent in JS and dabbled in FP this is right down my alley, and the style of text itself is actually quite funny and conversational - I love that. I’ve noticed that a _a lot of_ stuff written about FP tries to emulate this fun and easy going style - I wonder why that is. I still refer to clojure’s “re-frame” docs as the epitome of technical literature - a text so good you can read it in its own right just for the fun of it. I don’t want to diminish other languages’ communities of course, as this is totally anecdotal. I’ve found awesome prose in other places as well (mostly ruby/python) but I just encounter those funny gems more often reading about FP.
- coldtea 7y ago>it's really hard to follow for someone not used to it So like anything else? >Not sure how people enjoy FP. By virtue of actually having tried it?
- bishala 7y agoNot really. Some other functional languages (eg. F#) don't seem as arcane as Haskell.
- robotmay 7y agoI've said it a few times on HN in the past but Haskell is by far and away the hardest language I've tried to learn. I have no formal grounding in maths/CS and I think a lot of the people who enjoy it really struggle to communicate with those of us who don't come from that sort of background. In contrast I picked up Rust and Elixir in a couple of weeks apiece, so I don't feel like I'm particularly dense; I just suspect that it needs a certain way of thinking to get the best from Haskell :)
- andy_ppp 7y agoI’m along the same opinions, if there was a language as complex as Haskell that gave more consideration to beginners above terseness [naming concepts better] I’d be able to accept more of it. The guy next to me is determined to hatchet in all of the functional paradigms into Typescript and he gets to decide this. I can’t help think you’re average JS dev is going to look at Maybe.may2 and be completely bemused...
- hota_mazi 7y agoAnd FP developers in general tend to push conciseness to an extreme, especially with this kind of shenanigan (from the very source you linked): import qualified Data.ByteString.Lazy as BL It's ironic that after all this obfuscation, the author of the source still finds it useful to do ASCII art and align everything neatly. Talk about misplaced effort.
- stoksc 7y agoPretty sure that’s done automatically like go-fmt or other similar tools. It’s zero effort and makes it easily to read. Also lots of languages have that import syntax (python import pandas as pd).
- deleted 7y ago[deleted]
- deleted 7y ago[deleted]
- tirumaraiselvan 7y ago> Not sure how people enjoy FP. See The Blub Paradox [0] 0 : http://www.paulgraham.com/avg.html http://www.paulgraham.com/avg.html
- jose_zap 7y agoAnything you are unfamiliar with will obviously look alien and difficult. I actually find their code quite readable, but that’s because I have experience writing Haskell.