[Haskell-beginners] Type constructors sharing a common field
edwards.benj at gmail.com
Tue Apr 29 10:45:00 UTC 2014
In addition to the comments made by Daniel, as a general rule, you don’t
want a sum type with selectors functions as your example stands, because
you can end up with compiling programs like this:
module Main where
main :: IO ()main =
let p = Child 10
age = adultAge p
in print age
this craps out with an error at runtime.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners