Open danfishgold opened 3 years ago
I agree. Coming from a more loosely typed language, it was difficult for me to wrap my head around what is the constructor, and what is the type.
I suggest giving an example of how a Bool
would be defined with an algebraic type system like Elm has, since everybody knows what a boolean is, regardless of programming background, and showing that you construct it with one of either True
or False
.
Then, showing beginners how similar a Bool
and a Maybe
are may help them grasp the concept more easily.
Something that I've seen a couple of times with beginners is writing
Maybe 123
instead ofJust 123
. Currently (0.19.1) when you write that in the repl (or when you useMaybe
outside of type definitions), this is the error you get:This could be a great opportunity to mention the difference between
Maybe
andJust
(and more generally the difference between type variables and associated data)