Re: [Haskell-cafe] advanced class constraints in Haskell 98?

2009-01-08 Thread Ross Paterson
On Thu, Jan 08, 2009 at 09:59:19PM +0100, Henning Thielemann wrote:
>
> GHC accepts a class declaration like
>   class Monad (m Maybe) => C m where
>  ...
>  without having any language extension switched on. But it isn't Haskell  
> 98, is it? Hugs 2005 also accepts this.

Yes, it is.  The Report is a good reference for questions like this.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] advanced class constraints in Haskell 98?

2009-01-08 Thread Miguel Mitrofanov


On 8 Jan 2009, at 23:59, Henning Thielemann wrote:



GHC accepts a class declaration like
 class Monad (m Maybe) => C m where
...
without having any language extension switched on. But it isn't  
Haskell 98, is it?


It is.

From Report:



A class assertion has form qtycls tyvar, and indicates the membership  
of the type tyvar in the class qtycls. A class identifier begins with  
an uppercase letter. A context consists of zero or more class  
assertions, and has the general form


( C1 u1, ..., Cn un )

where C1, ..., Cn are class identifiers, and each of the u1, ..., un  
is either a type variable, or the application of type variable to one  
or more types.




"atype" is defined as



atype-> gtycon
|   tyvar
|   ( type1 , ... , typek ) (tuple type, k>=2)
|   [ type ](list type)
|   ( type )(parenthesised constructor)




Hugs 2005 also accepts this.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] advanced class constraints in Haskell 98?

2009-01-08 Thread Henning Thielemann


On Fri, 9 Jan 2009, Miguel Mitrofanov wrote:


On 8 Jan 2009, at 23:59, Henning Thielemann wrote:



GHC accepts a class declaration like
class Monad (m Maybe) => C m where
   ...
without having any language extension switched on. But it isn't Haskell 98, 
is it?


It is.

From Report:



A class assertion has form qtycls tyvar, and indicates the membership of the 
type tyvar in the class qtycls. A class identifier begins with an uppercase 
letter. A context consists of zero or more class assertions, and has the 
general form


( C1 u1, ..., Cn un )

where C1, ..., Cn are class identifiers, and each of the u1, ..., un is 
either a type variable, or the application of type variable to one or more 
types.


A nice. I jumped into 4.3 and found

§ §  R  32  ©
¦   6  
©  ¦ 32   ¢ R ¨ © ¥


7

  ¤ ¢¨ 7

5© ¥   ¦
class 
=>where

   ¢

§   § §  §
   ¥   ¦ ¡ 2 §
6 
© R©

 7
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] advanced class constraints in Haskell 98?

2009-01-08 Thread Henning Thielemann


On Thu, 8 Jan 2009, Henning Thielemann wrote:


On Fri, 9 Jan 2009, Miguel Mitrofanov wrote:


On 8 Jan 2009, at 23:59, Henning Thielemann wrote:



GHC accepts a class declaration like
class Monad (m Maybe) => C m where
   ...
without having any language extension switched on. But it isn't Haskell 
98, is it?


It is.

From Report:



A class assertion has form qtycls tyvar, and indicates the membership of 
the type tyvar in the class qtycls. A class identifier begins with an 
uppercase letter. A context consists of zero or more class assertions, and 
has the general form


( C1 u1, ..., Cn un )

where C1, ..., Cn are class identifiers, and each of the u1, ..., un is 
either a type variable, or the application of type variable to one or more 
types.


A nice. I jumped into 4.3 and found

§ §  R  32  ©


... copying from Haskell 98 report did not only insert rubbish, but also 
triggered sending the e-mail. I hope it did not more damage ...



scontext -> simpleclass
 | (simpleclass_1, ..., simpleclass_n)

simpleclass -> qtycls tyvar

So it must be 'atype' instead of 'tyvar'? Haskell 98 is really mighty.___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] advanced class constraints in Haskell 98?

2009-01-08 Thread Ross Paterson
On Thu, Jan 08, 2009 at 10:27:59PM +0100, Henning Thielemann wrote:
> A nice. I jumped into 4.3 and found
>
> scontext -> simpleclass
>  | (simpleclass_1, ..., simpleclass_n)
>
> simpleclass -> qtycls tyvar
>
> So it must be 'atype' instead of 'tyvar'? Haskell 98 is really mighty.

Oh.  Don't I look silly?  You were absolutely right, it's not Haskell 98.

Actually Hugs does reject it without flags.  Maybe you have a -98 stored
somewhere?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] advanced class constraints in Haskell 98?

2009-01-08 Thread Miguel Mitrofanov


On 9 Jan 2009, at 02:47, Ross Paterson wrote:


On Thu, Jan 08, 2009 at 10:27:59PM +0100, Henning Thielemann wrote:

A nice. I jumped into 4.3 and found

scontext -> simpleclass
| (simpleclass_1, ..., simpleclass_n)

simpleclass -> qtycls tyvar

So it must be 'atype' instead of 'tyvar'? Haskell 98 is really  
mighty.


Oh.  Don't I look silly?  You were absolutely right, it's not  
Haskell 98.


Me too. I've looked at the type declaration syntax instead of instance  
declaration one.





Actually Hugs does reject it without flags.  Maybe you have a -98  
stored

somewhere?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] advanced class constraints in Haskell 98?

2009-01-08 Thread Henning Thielemann


On Fri, 9 Jan 2009, Miguel Mitrofanov wrote:


On 9 Jan 2009, at 02:47, Ross Paterson wrote:


On Thu, Jan 08, 2009 at 10:27:59PM +0100, Henning Thielemann wrote:

A nice. I jumped into 4.3 and found

scontext -> simpleclass
   | (simpleclass_1, ..., simpleclass_n)

simpleclass -> qtycls tyvar

So it must be 'atype' instead of 'tyvar'? Haskell 98 is really mighty.


Oh.  Don't I look silly?  You were absolutely right, it's not Haskell 98.


Me too. I've looked at the type declaration syntax instead of instance 
declaration one.


Maybe the report is not complete? I mean, the current behaviour of Hugs 
and GHC (as I observed it) is more consistent, and maybe that's what the 
designers had in mind.



Actually Hugs does reject it without flags.  Maybe you have a -98 stored
somewhere?


When starting, my Hugs tells

Haskell 98 mode: Restart with command line option -98 to enable extensions
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] advanced class constraints in Haskell 98?

2009-01-08 Thread Ross Paterson
On Fri, Jan 09, 2009 at 01:11:12AM +0100, Henning Thielemann wrote:
> Maybe the report is not complete? I mean, the current behaviour of Hugs  
> and GHC (as I observed it) is more consistent, and maybe that's what the  
> designers had in mind.

I'm puzzled by the Hugs behaviour.  The current version rejects it, and
I downloaded and built the Mar2005 version just to check, and it also
rejected it, saying

Illegal Haskell 98 class constraint in class declaration

I think the GHC behaviour is connected with GHC's deferred context
reduction, which also does not conform to Haskell 98.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] advanced class constraints in Haskell 98?

2009-01-08 Thread Henning Thielemann


On Fri, 9 Jan 2009, Ross Paterson wrote:


On Fri, Jan 09, 2009 at 01:11:12AM +0100, Henning Thielemann wrote:

Maybe the report is not complete? I mean, the current behaviour of Hugs
and GHC (as I observed it) is more consistent, and maybe that's what the
designers had in mind.


I'm puzzled by the Hugs behaviour.  The current version rejects it, and
I downloaded and built the Mar2005 version just to check, and it also
rejected it, saying

Illegal Haskell 98 class constraint in class declaration


You are right. I don't know, what I made different before. Btw. 2005 was 
the copyright year, Hugs' version is September 2006:


__   __ __  __     ___  _
||   || ||  || ||  || ||__  Hugs 98: Based on the Haskell 98 standard
||___|| ||__|| ||__||  __|| Copyright (c) 1994-2005
||---|| ___||   World Wide Web: http://haskell.org/hugs
||   || Bugs: http://hackage.haskell.org/trac/hugs
||   || Version: September 2006 _

Haskell 98 mode: Restart with command line option -98 to enable extensions

ERROR "src/Data/Spreadsheet/CharSource.hs":14 - Illegal Haskell 98 class 
constraint in class declaration

*** Constraint : Monad (a Maybe)
*** Context: (Monad (a Maybe), Monad (a Identity))


So, since GHC allows this extension without an option - how can I tell 
Cabal, which extension I'm using? Has it a name anyway?

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] advanced class constraints in Haskell 98?

2009-01-09 Thread Joachim Breitner
Hi,

Am Donnerstag, den 08.01.2009, 22:22 +0100 schrieb Henning Thielemann:
> > On 8 Jan 2009, at 23:59, Henning Thielemann wrote:
> > From Report:
> A nice. I jumped into 4.3 and found
> 
> § §  R  32  ©
>  ¦   6  
> ©  ¦ 32   ¢ R ¨ © ¥
> 
> 7
> 
>   ¤ ¢¨ 7
> 
> 5© ¥   ¦
>  class 
> =>where
> ¢
> 
> §   § §  §
> ¥   ¦ ¡ 2 §
>  6 
> © R©
>   7

now how about this for a good argument that Haskell is just line
noise. :-)

Greetings,
Joachim

-- 
Joachim "nomeata" Breitner
  mail: m...@joachim-breitner.de | ICQ# 74513189 | GPG-Key: 4743206C
  JID: nome...@joachim-breitner.de | http://www.joachim-breitner.de/
  Debian Developer: nome...@debian.org


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe