Re: [Haskell-cafe] reifying typeclasses (resend)

2013-09-15 Thread Timon Gehr
On 09/15/2013 09:38 AM, Evan Laforge wrote: ... It seems to me like I should be able to replace a typeclass with arbitrary methods with just two, to reify the type and back. This seems to work when the typeclass dispatches on an argument, but not on a return value. E.g.: ... Say m_argument

Re: [Haskell-cafe] reifying typeclasses (resend)

2013-09-15 Thread Bas van Dijk
You can indeed use GADTs to solve this: {-# LANGUAGE GADTs #-} data Universe a where UInt :: Int - Universe Int UChar :: Char - Universe Char class Universal a where universe :: a - Universe a instance Universal Int where universe = UInt instance Universal Char where