PolyKinds, Control.Category and GHC 7.6.1

Edward Kmett ekmett at gmail.com
Mon Aug 13 16:12:26 CEST 2012


On Mon, Aug 13, 2012 at 9:55 AM, Dan Burton <danburton.email at gmail.com>wrote:

> Control.Category.Category is pretty much the only type in base that
>> directly benefits from PolyKinds without any code changes, but without
>> enabling the extension there nobody can define categories for kinds other
>> than *, and most interesting categories actually have more exotic
>> kinds.
>
>
> What, precisely, is the benefit of turning on PolyKinds for that file
> without changing the code? If we're cpp'ing it in, then are there further
> benefits that we could also reap by cpp'ing some code changes?
>

The benefit is that the kind of Category changes to

Category :: (x -> x -> *) -> Constraint

This means I can do things like make

data Dict p where
   Dict :: p => Dict p

newtype a |- b = Sub (a => Dict b)

and then

(|-) :: Constraint -> Constraint -> *

is a valid candidate to become a Category.

Moreover, PolyKinds + DataKinds finally enable us to write product and sum
categories, make categories for natural transformations, and generally
finally put Category to work. These were all disallowed by the previous
simpler kind.

No code changes need be applied beyond permitting the type of Category to
generalize and existing code continues to work.

This change actually could have been applied in 7.4.1.

-Edward Kmett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20120813/b5d67040/attachment.htm>


More information about the Glasgow-haskell-users mailing list