On 13/02/12 18:16, Edward Kmett wrote:
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.

Simon's version has this:

typeOf :: forall a. Typeable a => a -> TypeRep
typeOf x = typeRep (getType x) where
  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'?

Cheers,
        Simon


On Mon, Feb 13, 2012 at 8:33 AM, Simon Marlow <marlo...@gmail.com
<mailto:marlo...@gmail.com>> wrote:

    On 10/02/2012 16:03, Simon Peyton-Jones wrote:

        Friends

        The page describes an improved implementation of the Typeable
        class, making use of polymorphic kinds. Technically it is
        straightforward, but it represents a non-backward-compatible
        change to a widely used library, so we need to make a plan for
        the transition.

        http://hackage.haskell.org/__trac/ghc/wiki/GhcKinds/__PolyTypeable
        <http://hackage.haskell.org/trac/ghc/wiki/GhcKinds/PolyTypeable>

        Comments?  You can fix typos or add issues directly in the wiki
        page, or discuss by email


    I've no objections to the plan itself, except that typeOf itself
    seems useful, so is there any need to deprecate it?

    Cheers,

            Simon

    _________________________________________________
    Glasgow-haskell-users mailing list
    Glasgow-haskell-users@haskell.__org
    <mailto:Glasgow-haskell-users@haskell.org>
    http://www.haskell.org/__mailman/listinfo/glasgow-__haskell-users
    <http://www.haskell.org/mailman/listinfo/glasgow-haskell-users>




_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to