Consider:

--
data T a = T
--

Is there anything in the Prelude or a standard library that looks like 
this? Should there be? What should it be called? 'Singleton'? 'Reified'? 
'T'?

I looked but couldn't find anything. Such a simple type constructor is in 
fact very useful when you need to pass types around to disambiguate class 
instances. For instance:

--
class HasTypeName t where
                getTypeName             :: T t -> String
        
instance HasTypeName Int where
                getTypeName T = "Int"
        
instance HasTypeName () where
                getTypeName T = "()"

intName = getTypeName (T :: T Int)
--


-- 
Ashley Yakeley, Seattle WA


_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to