> Beginners: the onboarding experience must be our benchmark for usability
OK, so I put this into Gemini: "show me a non-trivial haskell function and type signature with at least five distinct arguments"
And I get:
---
processRecord :: (a -> b) -> Maybe c -> [d] -> (e -> Bool) -> (b, c, [d], e) -> Either String (b, c, [d], e)
processRecord transform mVal items pred (bVal, cVal, dList, eVal)
| pred eVal = Right (transform (const bVal undefined) mVal, cVal, dList, eVal) -- simplified example logic
| otherwise = Left "Predicate failed on the fifth argument"
---My brain just crashes after the "::".
For the beginner, there isn't enough syntax on offer to discern who's doing what to whom here.
Is there a "function signatures for dummys" somewhere?
Huh? How would that be a good criteria - how many languages exist where a non-user can easily grok non trivial functions with at least five distinct arguments?
If someone told me German was easy to learn, I wouldn’t get an LLM to generate me a complex sentence with two clauses and three adjectives and then be like “sure about that?”
`processRecord :: (a -> b) -> Maybe c -> [d] -> (e -> Bool) -> (b, c, [d], e) -> Either String (b, c, [d], e)`
Says: “ give me: 1) a function of a to b, 2) a ‘c’ wrapped in a Maybe, 3) a list of d’s, 4) a function of e to a Bool, 5) a 4 tuple of a, b, list of d’s, and an e
And I will give you either a String or your original tuple back”
It doesn’t really do anything so there’s not much more to explain
If you read the most introductory guide of Haskell, or ask your LLM to explain, you'll find there's nothing mystifying about the syntax you quoted. You're just unfamiliar with it because you didn't do the bare minimum effort.
If I ask my grandma what she thinks of the supposedly easy Python syntax, or C-style curly braces, her brain would similarly crash. Unless she read an intro to Python or C first.
In other words, do not confuse "I'm unfamiliar with this because it doesn't resemble what I know" with "hard to understand".
> For the beginner, there isn't enough syntax on offer to discern who's doing what to whom here.
If you throw a beginner at any non-trivial code in any language without teaching them anything about the language, then, yeah, it'll be hard for them to figure it out. That says nothing about the language itself, though. That's pretty obvious to everybody.
> Is there a "function signatures for dummys" somewhere?
Yeah, of course. There's actual beginner material, here's one example:
https://learnyouahaskell.github.io/types-and-typeclasses.htm...
Not hard to find, and not the only introduction to the language that covers this material. I guess you never bothered to look, or even to ask Gemini.
-- Show me a non-trivial function
-- Here you go
-- Oh my god, it's non-trivial
Your brain crashes just because of unfamiliarity with the syntax. Just mentally translate it into C++ or Rust syntax.
This familiarity can be gained in frankly a day or two of trying, and afterwards you’ll find it to be clear and information dense. The example doesn’t even involve anything truly mind blowing for a beginner yet, like the Traversable class, the lens/traversal/prism signatures, or polymorphic recursion.