RE: ConstraintKinds and default associated empty constraints

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

Re: ConstraintKinds and default associated empty constraints

2012-01-09 Thread Nicolas Frisby
or and Exofunctor...) > > Again, I have no problem at all with the Empty class, it's the same > solution I've used. It's even kind polymorphic if you turn that > extension on. The syntax isn't superficially as nice, but it's nice > enough, does the job, and I d

Re: ConstraintKinds and default associated empty constraints

2012-01-09 Thread Gábor Lehel
ce enough, does the job, and I don't see how you could do better short of adding type-level lambdas (so you can write type C f = \_ -> ()). [1] http://hackage.haskell.org/trac/ghc/ticket/2893 > > | -Original Message- > | From: glasgow-haskell-users-boun...@haskell.org [mailto:g

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 wrote: > On 23 December 2011 17:44, Simon Peyton-Jones > 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 s

RE: ConstraintKinds and default associated empty constraints

2012-01-09 Thread Simon Peyton-Jones
Of Andres Löh | 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 :: Con

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

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

Re: ConstraintKinds and default associated empty constraints

2012-01-08 Thread Antoine Latter
On Mon, Jan 9, 2012 at 12:30 AM, Antoine Latter wrote: > On Sun, Jan 8, 2012 at 11:21 PM, wren ng thornton 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 e

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 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 :: * -> Constraint

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-Jones 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

Re: ConstraintKinds and default associated empty constraints

2012-01-08 Thread Bas van Dijk
On 23 December 2011 17:44, Simon Peyton-Jones 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 *  -> > Constraint So am I

RE: ConstraintKinds and default associated empty constraints

2011-12-23 Thread Simon Peyton-Jones
011 16:41 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 mailto:simo...@microsoft.com>> wrote: Right now it seems it is either * or Constrai

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 wrote: > 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, that agrees

RE: ConstraintKinds and default associated empty constraints

2011-12-23 Thread Simon Peyton-Jones
figure out which is intended from context. S From: Edward Kmett [mailto:ekm...@gmail.com] Sent: 23 December 2011 15:05 To: Simon Peyton-Jones Cc: Bas van Dijk; glasgow-haskell-users@haskell.org Subject: Re: ConstraintKinds and default associated empty constraints Fair enough. So if I understand y

Re: ConstraintKinds and default associated empty constraints

2011-12-23 Thread Edward Kmett
to: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 empty constraints > > On Wed, Dec 21, 2011 at 6:45 PM, Bas van

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-22 Thread Edward Kmett
On Wed, Dec 21, 2011 at 6:45 PM, Bas van Dijk 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 wonder if the trick wi

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 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 wonder if the trick wi

Re: ConstraintKinds and default associated empty constraints

2011-12-22 Thread Bas van Dijk
On 22 December 2011 09:31, Simon Peyton-Jones 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 `* -> Constraint` but () has

Re: ConstraintKinds and default associated empty constraints

2011-12-22 Thread Bas van Dijk
On 22 December 2011 01:58, wrote: > Quoting Bas van Dijk : > >> 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

RE: ConstraintKinds and default associated empty constraints

2011-12-22 Thread Simon Peyton-Jones
alf Of Bas van Dijk | Sent: 21 December 2011 23:46 | To: glasgow-haskell-users@haskell.org | Subject: ConstraintKinds and default associated empty constraints | | 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

Re: ConstraintKinds and default associated empty constraints

2011-12-21 Thread wagnerdm
Quoting Bas van Dijk : 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 a; instance Empty a,

ConstraintKinds and default associated empty constraints

2011-12-21 Thread Bas van Dijk
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 a; instance Empty a, is the recommended way to