Proxy and new-typeable
José Pedro Magalhães
jpm at cs.uu.nl
Thu Feb 7 16:02:15 CET 2013
Yes, it's entirely unproblematic, and a good suggestion.
On Sat, Jan 26, 2013 at 6:36 PM, Simon Peyton-Jones
<simonpj at microsoft.com>wrote:
> Good idea! Simple, and I see no downsides.
> Pedro is putting in place a new Typeable library (using kind polymorphism)
> for GHC 7.8. Pedro, might you incorporate this?
> | -----Original Message-----
> | From: libraries-bounces at haskell.org [mailto:
> libraries-bounces at haskell.org] On
> | Behalf Of Shachaf Ben-Kiki
> | Sent: 26 January 2013 04:07
> | To: libraries at haskell.org
> | Subject: Proxy and new-typeable
> | I see that the new-typeable branch in GHC is using "typeRep :: forall a.
> | Typeable a => Proxy a -> TypeRep" rather than "typeOf :: forall a.
> Typeable a
> | => a -> TypeRep". This is clearly a big improvement over using undefined
> | everywhere.
> | I'd like to suggest a small change, if it hasn't been brought up before
> | "typeRep :: forall proxy a. Typeable a => proxy a -> TypeRep". This
> | typeRep compatible with any other Proxy type, since it doesn't use any
> | properties of the concrete type -- it just uses it to pass information
> | the "a". Things that consume a Proxy don't ever need to refer to Proxy
> | explicitly.
> | This would make Typeable compatible with other Proxy libraries, like
> the one in
> | "tagged". It would also make it compatible with any other type of kind
> * -> *
> | -- for example, "typeRep ( :: [Int])" would be a valid, and arguable
> | convenient, syntax for using typeRep. "Nothing :: Maybe Int" and so on
> | work too. So things that produce a "proxy" don't need to refer to Proxy
> | explicitly either.
> | Possibly this would make the Proxy type entirely unnecessary. If it
> | though, I suggest that it belongs in a module other than
> | -- it's a useful type for many other things, and as long as it's in
> base and
> | exposed to users, it might as well be treated as a type in its own
> right. It's
> | also a monad, can provide a variant of `asTypeOf`, and so on.
> | Shachaf
> | _______________________________________________
> | Libraries mailing list
> | Libraries at haskell.org
> | http://www.haskell.org/mailman/listinfo/libraries
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libraries