I am a bit confused by the choice of Haskell syntax for type definitions, like in
data Foo = Bar
Namely: does the equality sign here really mean an equality in some subtle sense, or is it just a random notation choice?
For example, in
foo x y = bar y x
the equality is really an equality: if this line is present, foo a b
and bar b a
can be used more or less interchangeably in the program. However, data Foo
and Bar
probably cannot be used interchangeably after data Foo = Bar
.
Whenever i resume my attempts to learn Haskell, i am a bit confused by this IMO counter-intuitive syntax and need to look up the documentation to recall the formats of the LHS and the RHS. Are there any alternative syntaxes for type definitions by any chance?