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: Records in Haskell

2012-01-08 Thread wren ng thornton
On 12/30/11 10:58 PM, Matthew Farkas-Dyck wrote: On 30/12/2011, Andriy Polischuk wrote: Consider this example: quux (y . (foo>.< bar).baz (f . g)) moo It's not that easy to distinguish from quux (y . (foo>.< bar) . baz (f . g)) moo Yeah, that's why I dislike dot as compose operator (^_~)

Re: Records in Haskell

2012-01-08 Thread wren ng thornton
On 12/28/11 1:34 PM, Donn Cave wrote: Quoth Greg Weber, On Wed, Dec 28, 2011 at 2:12 PM, Donn Cave wrote: ... I would think row polymorphism is a must-have. Perhaps if you want *extensible* records. If you would like to make some progress with records in the near future rather than keeping

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: Unit unboxed tuples

2012-01-08 Thread wren ng thornton
On 12/23/11 12:57 PM, Tyson Whitehead wrote: On December 23, 2011 09:37:04 Ganesh Sittampalam wrote: On 23/12/2011 13:46, Ian Lynagh wrote: On Fri, Dec 23, 2011 at 01:34:49PM +, Simon Peyton-Jones wrote: Arguments Boxed Unboxed 3 ( , , )(# , , #) 2 ( , )

Re: Unit unboxed tuples

2012-01-08 Thread wren ng thornton
On 12/23/11 8:34 AM, Simon Peyton-Jones wrote: More uniform! If you the singleton-unboxed-tuple data constructor in source code, as a function, you'd write (\x -> (# x #)). In a pattern, or applied, you'd write (# x #). Shouldn't (# T #) be identical to T? I know that a putative (T) woul

Re: 7.4.1-pre: Show & Integral

2012-01-08 Thread wren ng thornton
On 12/22/11 2:28 PM, J. Garrett Morris wrote: 2011/12/22 Edward Kmett: The change, however, was a deliberate _break_ with the standard that passed through the library review process a few months ago, and is now making its way out into the wild. Is it reasonable to enquire how many standard-com

Re: Records in Haskell

2012-01-08 Thread Matthew Farkas-Dyck
On 08/01/2012, Gábor Lehel wrote: > 2012/1/8 Greg Weber : >> >> >> 2012/1/8 Gábor Lehel >>> >>> Thank you. I have a few questions/comments. >>> >>> >>> >>> "The module/record ambiguity is dealt with in Frege by preferring >>> modules and requiring a module prefix for the record if there is >>> am

Re: Records in Haskell

2012-01-08 Thread Gábor Lehel
2012/1/8 Greg Weber : > > > 2012/1/8 Gábor Lehel >> >> > >> >> >> >> >> >> >> >> Later on you write that the names of record fields are only accessible >> >> from the record's namespace and via record syntax, but not from the >> >> global scope. For Haskell I think it would make sense to reverse t

Re: Records in Haskell

2012-01-08 Thread Ingo Wechsung
2012/1/8 Gábor Lehel > 2012/1/8 Ingo Wechsung : > > > > > > 2012/1/8 Gábor Lehel > > > >> > >> The second is that only the author of the datatype could put functions > >> into its namespace; the 'data.foo' notation would only be available > >> for functions written by the datatype's author, whil

Re: Records in Haskell

2012-01-08 Thread Greg Weber
2012/1/8 Gábor Lehel > > > > >> > >> > >> > >> Later on you write that the names of record fields are only accessible > >> from the record's namespace and via record syntax, but not from the > >> global scope. For Haskell I think it would make sense to reverse this > >> decision. On the one hand,

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: Records in Haskell

2012-01-08 Thread Gábor Lehel
2012/1/8 Ingo Wechsung : > > > 2012/1/8 Gábor Lehel > >> >> The second is that only the author of the datatype could put functions >> into its namespace; the 'data.foo' notation would only be available >> for functions written by the datatype's author, while for every other >> function you would h

Re: Records in Haskell

2012-01-08 Thread Ingo Wechsung
2012/1/8 Gábor Lehel > The second is that only the author of the datatype could put functions > into its namespace; the 'data.foo' notation would only be available > for functions written by the datatype's author, while for every other > function you would have to use 'foo data'. I dislike this

Re: Records in Haskell

2012-01-08 Thread Gábor Lehel
2012/1/8 Gábor Lehel : > 2012/1/8 Greg Weber : >> >> >> 2012/1/8 Gábor Lehel >>> >>> Thank you. I have a few questions/comments. >>> >>> >>> >>> "The module/record ambiguity is dealt with in Frege by preferring >>> modules and requiring a module prefix for the record if there is >>> ambiguity." >>

Re: Records in Haskell

2012-01-08 Thread Gábor Lehel
2012/1/8 Greg Weber : > > > 2012/1/8 Gábor Lehel >> >> Thank you. I have a few questions/comments. >> >> >> >> "The module/record ambiguity is dealt with in Frege by preferring >> modules and requiring a module prefix for the record if there is >> ambiguity." >> >> I think I see why they do it thi