RE: PolyKinds, Control.Category and GHC 7.6.1

2012-08-14 Thread Simon Peyton-Jones
| FWIW PolyKinds in 7.4 is rough, and I had experiences where enabling it
| led to compile failures in downstream modules, so this wouldn't
| necessarily have been painless. Hopefully with 7.6 it will be.

PolyKinds is not an advertised feature of 7.4, so you should absolutely not 
rely on it working in 7.4.  But it IS an advertised feature for 7.6 and should 
work flawlessly.  (If not, yell.)

Simon


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


PolyKinds, Control.Category and GHC 7.6.1

2012-08-13 Thread Edward Kmett
Would it be possible to add something like

{-# LANGUAGE CPP #-}
#if defined(__GLASGOW_HASKELL__)  __GLASGOW_HASKELL__ = 704
{-# LANGUAGE PolyKinds #-}
#endif

to the top of Control.Category before the 7.6.1 final release?

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.

I only noticed that it wasn't there in the release candidate just now.

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


Re: PolyKinds, Control.Category and GHC 7.6.1

2012-08-13 Thread Dan Burton

 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?

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


Re: PolyKinds, Control.Category and GHC 7.6.1

2012-08-13 Thread Edward Kmett
On Mon, Aug 13, 2012 at 9:55 AM, Dan Burton danburton.em...@gmail.comwrote:

 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
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users