News for hackers. Stuff that matters.
Re:Class Hierarchies? Don't Do That by brentshields on Sunday March 30, 2014 @05:01PM (#7497893)
You can use GADTs for this. For example:

  data Showable where
    Showable :: Show a => a -> Showable
This allows you to create a polymorphic container like [Showable 5, Showable "hello"] where the polymorphic type is constrained to be a member of the Show typeclass.
Re:Class Hierarchies? Don't Do That by tel on Sunday March 30, 2014 @06:24PM (#7498236)
Note that GADTs are a bit overkill for this. All you really need is ExistentialQuantification. GADTs are ExistentialQuantification + TypeEqualities.