PolyKinds, Control.Category and GHC 7.6.1
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
> 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)
(|-) :: 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
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libraries