
27 Jun
2013
27 Jun
'13
11:24 a.m.
Hey Haskellers, I noticed that ghci lets me do this:
data Foo = Int Int | Float :t Int Int :: Int -> Foo :t Float Float :: Foo :t Int 4 Int 4 :: Foo
It's confusing to have type constructors that use names of existing types. It's not intuitive that the name "Int" could refer to two different things, which brings me to:
data Bar = Bar Int :t Bar Bar :: Int -> Bar
Yay? I can have a simple type with one constructor named the same as the type. Why is this allowed? Is it useful somehow? --Patrick