0

why in definition of Maybe is :

data Maybe a = Nothing | Just a 

Why definition isn't like this:

data Maybe a = Nothing | a

Why we use Just, isn't be simple wihout this ?

evan.oman
  • 5,922
  • 22
  • 43
  • 1
    This is a duplicate, I'll see if I can find it. Long story short, you need a constructor to differentiate types. `a` would just be an unwrapped type, not a type wrapped in `Maybe`. – Carcigenicate Dec 25 '16 at 16:12
  • This is the difference between [tagged](https://en.wikipedia.org/wiki/Tagged_union) and untagged unions. Haskell uses the latter. – Alec Dec 25 '16 at 16:17
  • 2
    The former, not the latter. – amalloy Dec 25 '16 at 20:43

0 Answers0