[Haskell-cafe] Is there a better way to subtyping?

John Meacham john at repetae.net
Wed Mar 14 02:24:17 CET 2012


Why not

data Super
        = SuperA {
                commonFields :: ()
                aFields :: ()
                }
        | SuperB {
                commonFields :: ()
                bFields :: ()
                }
        | SuperC {
                commonFields :: ()
                cFields :: ()
                }

reusing the common field names between constructors like this is a-okay.

   John



More information about the Haskell-Cafe mailing list