2010/9/8 Gábor Lehel <[email protected]>:
> Oh. Hmm. That makes sense. So I gather there's absolutely no way to
> specify which instance you mean, and hence to use `value` as any
> concrete type?
Here's one way to indicate which value you are referring to.
Anthony
{-# LANGUAGE EmptyDataDecls, TypeFamilies #-}
data True
data False
class TypeValue a where
type ValueTypeOf a
value :: a -> ValueTypeOf a
instance TypeValue True where
type ValueTypeOf True = Bool
value _ = True
instance TypeValue False where
type ValueTypeOf False = Bool
value _ = False
main = print (value (undefined::True))
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe