I\'m reading Learn You a Haskell, and in the monad chapters, it seems to me that ()
is being treated as a sort of \"null\" for every type. When I check
It is called the Unit
type, usually used to represent side effects. You can think of it vaguely as Void
in Java. Read more here and here etc. What can be confusing is that ()
syntactically represents both the type and its only value literal. Also note that it is not similar to null
in Java which means an undefined reference - ()
is just effectively a 0-sized tuple.