
Hello,
On Mon, Feb 13, 2012 at 5:32 PM, Edward Kmett
There are fewer combinators from commonly used classes for working with the left argument of a bifunctor, however.
I think that the bifunctor part of Bas's version is a bit of a red herring. What I like about it is that it overloads exactly what needs to be overloaded---the representation of the type---without the need for any fake parameters. To make things concrete, here is some code:
newtype TypeRepT t = TR TypeRep
class Typeable t where typeRep :: TypeRepT t
instacne Typeable Int where typeRep = TR type_rep_for_int instance Typeable [] where typeRep = TR type_rep_for_list
The two formulations support exactly the same interface (you can define `Proxy` and the proxied `typeRep` in terms of this class) so I wouldn't say that the one is easier to use that the other, but I think that this formulation is slightly simpler because it avoids the dummy parameter to typeRep. -Iavor

On Tue, Feb 14, 2012 at 11:18 AM, Iavor Diatchki
Hello,
On Mon, Feb 13, 2012 at 5:32 PM, Edward Kmett
wrote: There are fewer combinators from commonly used classes for working with the left argument of a bifunctor, however.
I think that the bifunctor part of Bas's version is a bit of a red herring. What I like about it is that it overloads exactly what needs to be overloaded---the representation of the type---without the need for any fake parameters. To make things concrete, here is some code:
newtype TypeRepT t = TR TypeRep
class Typeable t where typeRep :: TypeRepT t
instacne Typeable Int where typeRep = TR type_rep_for_int instance Typeable [] where typeRep = TR type_rep_for_list
I have no problem with this version either, although the Proxy type is useful for a lot of other purposes, while this type is single use. -Edward

Proxy also has the advantage that it almost exactly mirrors what it
ends up looking
like in core. The application to proxy is the user visible type application.
John
On Tue, Feb 14, 2012 at 8:18 AM, Iavor Diatchki
Hello,
On Mon, Feb 13, 2012 at 5:32 PM, Edward Kmett
wrote: There are fewer combinators from commonly used classes for working with the left argument of a bifunctor, however.
I think that the bifunctor part of Bas's version is a bit of a red herring. What I like about it is that it overloads exactly what needs to be overloaded---the representation of the type---without the need for any fake parameters. To make things concrete, here is some code:
newtype TypeRepT t = TR TypeRep
class Typeable t where typeRep :: TypeRepT t
instacne Typeable Int where typeRep = TR type_rep_for_int instance Typeable [] where typeRep = TR type_rep_for_list
The two formulations support exactly the same interface (you can define `Proxy` and the proxied `typeRep` in terms of this class) so I wouldn't say that the one is easier to use that the other, but I think that this formulation is slightly simpler because it avoids the dummy parameter to typeRep.
-Iavor
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries
participants (3)
-
Edward Kmett
-
Iavor Diatchki
-
John Meacham