RE: ConstraintKinds and default associated empty constraints

2012-01-09 Thread Simon Peyton-Jones
-users@haskell.org | Subject: Re: ConstraintKinds and default associated empty constraints | | Hi. | | The definitions are accepted by GHC: | |   class Functor f where |       type FC f a :: Constraint |       type FC f a = () | |       fmap :: (FC f a, FC f b) = (a - b) - f a - f b

Re: ConstraintKinds and default associated empty constraints

2012-01-09 Thread Edward Kmett
On Sun, Jan 8, 2012 at 8:32 AM, Bas van Dijk v.dijk@gmail.com wrote: On 23 December 2011 17:44, Simon Peyton-Jones simo...@microsoft.com wrote: My attempt at forming a new understanding was driven by your example. class Functor f where type C f :: * - Constraint type C f =

Re: ConstraintKinds and default associated empty constraints

2012-01-09 Thread Gábor Lehel
| Sent: 09 January 2012 07:28 | To: Antoine Latter | Cc: glasgow-haskell-users@haskell.org | Subject: Re: ConstraintKinds and default associated empty constraints | | Hi. | | The definitions are accepted by GHC: | |   class Functor f where |       type FC f a :: Constraint

Re: ConstraintKinds and default associated empty constraints

2012-01-09 Thread Nicolas Frisby
07:28 | To: Antoine Latter | Cc: glasgow-haskell-users@haskell.org | Subject: Re: ConstraintKinds and default associated empty constraints | | Hi. | | The definitions are accepted by GHC: | |   class Functor f where |       type FC f a :: Constraint |       type FC f

RE: ConstraintKinds and default associated empty constraints

2012-01-09 Thread Simon Peyton-Jones
| Subject: Re: ConstraintKinds and default associated empty constraints | | On Mon, Jan 9, 2012 at 4:53 PM, Simon Peyton-Jones | simo...@microsoft.com wrote: | Three things about this ConstraintKinds thread: | | First, about |  class Functor f where |    type C f a :: Constraint |    type C f

Re: ConstraintKinds and default associated empty constraints

2012-01-08 Thread Bas van Dijk
On 23 December 2011 17:44, Simon Peyton-Jones simo...@microsoft.com wrote: My attempt at forming a new understanding was driven by your example. class Functor f where    type C f :: * - Constraint    type C f = () sorry -- that was simply type incorrect.  () does not have kind *  -

Re: ConstraintKinds and default associated empty constraints

2012-01-08 Thread wren ng thornton
On 1/8/12 8:32 AM, Bas van Dijk wrote: On 23 December 2011 17:44, Simon Peyton-Jonessimo...@microsoft.com wrote: My attempt at forming a new understanding was driven by your example. class Functor f where type C f :: * - Constraint type C f = () sorry -- that was simply type

Re: ConstraintKinds and default associated empty constraints

2012-01-08 Thread Antoine Latter
On Sun, Jan 8, 2012 at 11:21 PM, wren ng thornton w...@freegeek.org wrote: Couldn't the following work?    class Functor f where        type C f :: * - Constraint        type C f _ = () I get a parse error from that. The equivalent: class Functor f where type FC f :: * -

Re: ConstraintKinds and default associated empty constraints

2012-01-08 Thread Antoine Latter
On Mon, Jan 9, 2012 at 12:30 AM, Antoine Latter aslat...@gmail.com wrote: On Sun, Jan 8, 2012 at 11:21 PM, wren ng thornton w...@freegeek.org wrote: Couldn't the following work?    class Functor f where        type C f :: * - Constraint        type C f _ = () I get a parse error from

Re: ConstraintKinds and default associated empty constraints

2012-01-08 Thread Bas van Dijk
That would be nice. It would also be nice to be able to use _ in type signatures as in: const :: a - _ - a const x _ = x During type checking each _ could be replaced by a new unique type variable. Visa versa should also be possible: during type inferencing each unique type variable could be

Re: ConstraintKinds and default associated empty constraints

2012-01-08 Thread Andres Löh
Hi. The definitions are accepted by GHC:   class Functor f where       type FC f a :: Constraint       type FC f a = ()       fmap :: (FC f a, FC f b) = (a - b) - f a - f b   instance Functor [] where       fmap = map Yes. This is what I would have expected to work. But I don't like

RE: ConstraintKinds and default associated empty constraints

2011-12-23 Thread Simon Peyton-Jones
it’s a bug. I’m fixing it. Simon From: glasgow-haskell-users-boun...@haskell.org [mailto:glasgow-haskell-users-boun...@haskell.org] On Behalf Of Edward Kmett Sent: 22 December 2011 17:03 To: Bas van Dijk Cc: glasgow-haskell-users@haskell.org Subject: Re: ConstraintKinds and default associated

Re: ConstraintKinds and default associated empty constraints

2011-12-23 Thread Edward Kmett
...@haskell.org] On Behalf Of Edward Kmett Sent: 22 December 2011 17:03 To: Bas van Dijk Cc: glasgow-haskell-users@haskell.org Subject: Re: ConstraintKinds and default associated empty constraints On Wed, Dec 21, 2011 at 6:45 PM, Bas van Dijk v.dijk@gmail.com wrote: I'm playing a bit

Re: ConstraintKinds and default associated empty constraints

2011-12-23 Thread Edward Kmett
On Fri, Dec 23, 2011 at 10:17 AM, Simon Peyton-Jones simo...@microsoft.comwrote: Right now it seems it is either * or Constraint depending on context. *** * ** ** Correct. Tuple bracket are used for both types and Constraints, and we have to decide which from context. ** Whew,

RE: ConstraintKinds and default associated empty constraints

2011-12-23 Thread Simon Peyton-Jones
To: Simon Peyton-Jones Cc: Bas van Dijk; glasgow-haskell-users@haskell.org Subject: Re: ConstraintKinds and default associated empty constraints On Fri, Dec 23, 2011 at 10:17 AM, Simon Peyton-Jones simo...@microsoft.commailto:simo...@microsoft.com wrote: Right now it seems it is either

Re: ConstraintKinds and default associated empty constraints

2011-12-22 Thread Bas van Dijk
On 22 December 2011 01:58, wagne...@seas.upenn.edu wrote: Quoting Bas van Dijk v.dijk@gmail.com: I'm playing a bit with the new ConstraintKinds feature in GHC 7.4.1-rc1. I'm trying to give the Functor class an associated constraint so that we can make Set an instance of Functor. The

Re: ConstraintKinds and default associated empty constraints

2011-12-22 Thread Bas van Dijk
On 22 December 2011 09:31, Simon Peyton-Jones simo...@microsoft.com wrote: What about class Functor f where    type C f :: * - Constraint    type C f = () After all, just as (Ord a, Show a) is a contraint, so is (). But there's a kind mis-match there. `C f` should have kind `* -

Re: ConstraintKinds and default associated empty constraints

2011-12-22 Thread Gábor Lehel
On Thu, Dec 22, 2011 at 12:45 AM, Bas van Dijk v.dijk@gmail.com wrote: I'm playing a bit with the new ConstraintKinds feature in GHC 7.4.1-rc1. I'm trying to give the Functor class an associated constraint so that we can make Set an instance of Functor. The following code works but I

Re: ConstraintKinds and default associated empty constraints

2011-12-22 Thread Edward Kmett
On Wed, Dec 21, 2011 at 6:45 PM, Bas van Dijk v.dijk@gmail.com wrote: I'm playing a bit with the new ConstraintKinds feature in GHC 7.4.1-rc1. I'm trying to give the Functor class an associated constraint so that we can make Set an instance of Functor. The following code works but I

Re: ConstraintKinds and default associated empty constraints

2011-12-21 Thread wagnerdm
Quoting Bas van Dijk v.dijk@gmail.com: I'm playing a bit with the new ConstraintKinds feature in GHC 7.4.1-rc1. I'm trying to give the Functor class an associated constraint so that we can make Set an instance of Functor. The following code works but I wonder if the trick with: class Empty