precedence bug with derived instances

2002-10-17 Thread Dean Herington
In GHC 5.04.1, derived instances of Show mishandle precedence:

Prelude putStrLn (showsPrec 10 (Just 0) )
Just 0
Prelude

The result should be:

(Just 0)


___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs



RE: Using Bison as Haskell parser generator

2002-10-17 Thread Simon Marlow
 (I am currently not on this list, so replies, please cc me.)
 
 The later versions of the GNU parser generator Bison, like
   ftp://ftp.gnu.org/gnu/bison/bison-1.75.tar.gz   (959 KB)
   ftp://ftp.gnu.org/gnu/bison/bison-1.75.tar.bz2  (759 KB)
 use the macro processing program M4 to produce the source code output.
 
 This should make it real easy to write parser generator 
 (skeleton) files
 designed for special languages.
 
 So I wonder if somebody may want to make an attempt to produce such
 skeleton files for Haskell. Bison has now not only an LALR(1) parser
 algorithm, but also a GLR parser, and more is to come.

Note that Happy has support for some Haskellish things which you won't
get if you use bison to generate Haskell.  For example: type signatures
on productions, and support for threading a monad around the parser.

Nevertheless, doing this sounds entirely feasible.  The parser tables
generated by bison are very similar to those generated by Happy (I
peeked at bison's source when I wrote the table-generation code in
Happy), so looking at Happy's LALR(1) machine might be a good place to
start.

Cheers,
Simon
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell



RE: Using Bison as Haskell parser generator

2002-10-17 Thread Martin Norbäck
tor 2002-10-17 klockan 17.32 skrev Simon Marlow:
 Note that Happy has support for some Haskellish things which you won't
 get if you use bison to generate Haskell.  For example: type signatures
 on productions, and support for threading a monad around the parser.

Another feature which I would love to have in Happy is support for more
EBNF stuff, like repetition and alternative.

Repetition maps to Haskell lists and alternative maps to haskell Maybe.

Since there exists a transformation from EBNF to BNF this should be
possible. Also, the transformation can take certain things into account,
like that parsing a list of things is best done like this (due to the
parser being LALR)

list_of_things ::=
  empty | list_of_things thing

instead of this more natural way

list_of_things
  empty | thing list_of_things

Regards,

Martin

___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell



RE: Using Bison as Haskell parser generator

2002-10-17 Thread Hans Aberg
At 16:32 +0100 2002/10/17, Simon Marlow wrote:
 So I wonder if somebody may want to make an attempt to produce such
 skeleton files for Haskell. Bison has now not only an LALR(1) parser
 algorithm, but also a GLR parser, and more is to come.

Note that Happy has support for some Haskellish things which you won't
get if you use bison to generate Haskell.  For example: type signatures
on productions, and support for threading a monad around the parser.

I am not sure what these type signature are:

But Bison has a typing feature currently only used with the implementation
of unions. It is easy to tweak to become only a typing feature (not tied to
C union in implementation). By macros, one can then write out a suitable
form of the semantic variables to extract the correct typing.

I am not sure what exactly this threading a monad around the parser means:

But under C++, I am now wrapping C++ namespaces around my parser. I have
suggested that Bison should get a construct
  %define name definition
producing a suitable macro handed over to M4. Thus, I should be able to write
  %defined namespace name
and exploit that to create a suitable namespace around the parser.

Such a procedure is sufficiently general that it ought to be able to handle
your monad wrapping as well. -- But one can only know for sure by actually
trying, and the feedback from such a try might be interesting.

Nevertheless, doing this sounds entirely feasible.  The parser tables
generated by bison are very similar to those generated by Happy (I
peeked at bison's source when I wrote the table-generation code in
Happy), so looking at Happy's LALR(1) machine might be a good place to
start.

Then interaction between Happy and Bison might turn out to be interesting.
The Bison people may also want parser generator sources in other languages,
functional like LISP (Scheme), SML, as well as others.

I am not myself actively programming in Haskell now, so that is one reason
I posted it.

I should have mentioned that more info about Bison can be found on its
mailing lists:
  [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/help-bison
  [EMAIL PROTECTED]  http://mail.gnu.org/mailman/listinfo/bug-bison

  Hans Aberg


___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell



The Implementation of Functional Programming Languages

2002-10-17 Thread Jose Romildo Malaquias
Hello.

Is the book The Implementation of Functional
Programming Languages, by Simon Peyton Jones,
available in the internet? This book is out
of print.

Romildo
-- 
Prof. José Romildo Malaquias[EMAIL PROTECTED]
Departamento de Computação   [EMAIL PROTECTED]
Univ. Federal de Ouro Preto  http://uber.com.br/romildo
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell



Re: The Implementation of Functional Programming Languages

2002-10-17 Thread Deling Ren
I remember I downloaded from his homepage. Good luck.

On Thu, 17 Oct 2002, Jose Romildo Malaquias wrote:

 Hello.

 Is the book The Implementation of Functional
 Programming Languages, by Simon Peyton Jones,
 available in the internet? This book is out
 of print.

 Romildo
 --
 Prof. José Romildo Malaquias[EMAIL PROTECTED]
 Departamento de Computação   [EMAIL PROTECTED]
 Univ. Federal de Ouro Preto  http://uber.com.br/romildo
 ___
 Haskell mailing list
 [EMAIL PROTECTED]
 http://www.haskell.org/mailman/listinfo/haskell


___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell



Re: The Implementation of Functional Programming Languages

2002-10-17 Thread Jose Romildo Malaquias
On Thu, Oct 17, 2002 at 12:49:01PM -0700, Deling Ren wrote:
 I remember I downloaded from his homepage. Good luck.

I could not find it in his homepage. The only related
book I found there is Implementing functional languages:
a tutorial, by Peyton Jones and Lester:

http://research.microsoft.com/Users/simonpj/Papers/pj-lester-book/

Would you remember the url you have used to tell me?

 On Thu, 17 Oct 2002, Jose Romildo Malaquias wrote:
 
  Is the book The Implementation of Functional
  Programming Languages, by Simon Peyton Jones,
  available in the internet? This book is out
  of print.

Romildo
-- 
Prof. José Romildo Malaquias[EMAIL PROTECTED]
Departamento de Computação   [EMAIL PROTECTED]
Univ. Federal de Ouro Preto  http://uber.com.br/romildo
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell



representation getting verbose...

2002-10-17 Thread haskell-cafe-admin
Greetings Haskellers,

I'm running into a problem representing some fairly complicated types,
and I'll try to put together a simpler example to get your
suggestions.

In Paul Hudak's SOE, I find a definition of expression:

data Expr = C Float | V String | Expr :+ Expr | Expr :- Expr 
| Expr :* Expr | Expr :/ Expr

Now this is compelling, but sometimes, I might want to have a function
that takes a variable only, not just any kind of expression.  I could
write something like:

typeOfVariable :: Expression - Type
typeOfVariable (V s) = ...
_= error...

But thats not very satisfying from a type-checking perspective.  So it
makes sense to create a constructor:

data Variable = VVariable String

data Expr = C Float | V Variable | Expr :+ Expr
 | Expr :- Expr  | Expr :* Expr | Expr :/ Expr

and make typeOfVariable :: Variable - Type.  But then when I want to
match or create a variable expression, things are starting to get
verbose:

case expr of
  C f - ...
  V (Variable (VVariable s)) - ...
  ...

And if I want a still more accurate hierarchy, the construction and
destruction of Variables can really become cumbersome.  For an
interpreter I'm writing, I found myself writing a function
constructVarExpr :: String - Expr just to make it easier.  This all
seems very inelegant, and I get the feeling that there's a better way
to do this.

Any suggestions on how I could better represent Expressions or
Variables to keep the type-checking but decrease the verbosity?


peace,

Isaac Jones
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe



Re: Wiki problems

2002-10-17 Thread Shae Matijs Erisson
John C. Peterson [EMAIL PROTECTED] writes:

 We're aware of the wiki problems.  We've got out wiki guy working on
 it and I hope everything will be working again soon.  We won't lose
 anything that's been posted to the wiki.  Please be patient!

At one point in the distant past there was the idea of switching to another
wiki flavor such as MoinMoin. I'd be willing to translate the content from
pywiki to MoinMoin if there's still interest.

That could be a permanent fix to the continuing missing pages problem.
-- 
Shae Matijs Erisson - 2 days older than RFC0226


___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe