[Haskell-cafe] Re: Has anyone looked into adding subtyping to Haskell?

Tomasz Zielonka tomasz.zielonka at gmail.com
Thu May 31 15:13:24 EDT 2007


On Thu, May 31, 2007 at 09:04:30PM +0200, Tomasz Zielonka wrote:
> On Thu, May 31, 2007 at 06:16:20PM +0100, Jon Harrop wrote:
> > > I can't think of a lightweight way to encode overlapping enumerations in
> > > Haskell. 
> > 
> > I'd like to know if this is possible in Haskell.
> 
> Maybe this way using GADTs and typeclasses? I haven't used such code in
> practice - there may be some hidden traps.

Let me be the first one to admit that this approach is highly unmodular
- you have to define all cases in one place, or at least each group of
overlapping enum types.

Best regards
Tomek


More information about the Haskell-Cafe mailing list