On Mon, Feb 13, 2012 at 3:27 PM, Simon Marlow <marlowsd@gmail.com> wrote:
On 13/02/12 18:16, Edward Kmett wrote:Simon's version has this:
You could probably get away with something like
data Proxy = Proxy a
class Typeable a where
typeOfProxy :: Proxy a -> TypeRep
typeOf :: forall a. Typeable a => a -> TypeRep
typeOf = typeOfProxy (Proxy :: Proxy a)
which being outside of the class won't contribute to the inference of
'a's kind.
This would let you retain the existing functionality.
typeOf x = typeRep (getType x) where
typeOf :: forall a. Typeable a => a -> TypeRep
getType :: a -> Proxy a
getType _ = Proxy
(your version is clearer, though)
I'm assuming there's no significance behind your renaming of 'typeRep' to 'typeOfProxy'?