Pure File Reading (was: Dealing with configuration data)

2002-09-25 Thread Koen Claessen
Dear all, At the moment, a discussion on haskell-cafe is going on about how to neatly program the fact that an entire program depends on a number of parameters that are read in once at the beginning of a program. The suggestion that many people came up with was using unsafePerformIO in the begin

RE: Haskell 98

2002-09-25 Thread Simon Marlow
> Out of curiousity, it's a bit strange that > > > data D = D !Int > > myD = D {} > > in invalid, but > > > newtype N = N !Int > > myN = N {} > > is not. The second example is also invalid: the newtype declaration is disallowed by the grammar. (incedentally, it looks like this example tr

RE: Haskell 98

2002-09-25 Thread Hal Daume III
> Blargh. Excellent point. I had totally forgotten that. I withdraw all > suggested changes except a cross-ref to the section you mention. Sigh. > My brain is getting soft. Actually the rules referenced appear immediately above, so no reference is necessary. My original message was not sugges

RE: Haskell 98

2002-09-25 Thread Simon Peyton-Jones
| I think the sentence in question (end of 3.15.2) is just a clarification; | the preceding 4 rules are sufficient and clear: F{}, S{} and S{x=3} are | all illegal because they omit a value for a strict field. That is, it's | correct, though not strictly necessary, nor does it cover all the cases

Re: Haskell 98

2002-09-25 Thread Ross Paterson
On Wed, Sep 25, 2002 at 12:34:53PM +0100, Simon Peyton-Jones wrote: > I spoke too soon. Consider > > data F = F Int !Int > > data S = S { x::Int, y::!Int } > > According to the words above > F {} is illegal > but what about this one? > S {} I think the sentence in question (end of

Haskell 98

2002-09-25 Thread Simon Peyton-Jones
| The report says "The expression F {}, where F is a data constructor, is | legal whether or not F was declared with record syntax, provided F has no | strict fields: it denotes F _|_1 ... _|_n where n is the arity of F." | | It unclear to me why there needs to be this provision for records with

Re: Behaviour of div & mod with negative arguments?

2002-09-25 Thread Lennart Augustsson
Dr Mark H Phillips wrote: >Hi, > >Does Haskell specify how div and mod should behave when >given one or both arguments negative? > Yes, section 6.4.2 gives an exact definition. >P.S. I notice in hugs if I type "-1 `div` 3" the `div` >binds to the 1 and 3 first, and only applies the "-" >at the

RE: empty field label constructor infelicity

2002-09-25 Thread Simon Peyton-Jones
| The report says "The expression F {}, where F is a data constructor, is | legal whether or not F was declared with record syntax, provided F has no | strict fields: it denotes F _|_1 ... _|_n where n is the arity of F." | | It unclear to me why there needs to be this provision for records with

RE: report definition of field names

2002-09-25 Thread Simon Peyton-Jones
| Replace: | "A datatype declaration may optionally include field labels for some | or all of the components of the type." | With: | "A datatype declaration may optionally include field labels. Each | constructor must use either labelled fields or unlabelled fields, | b

RE: Behaviour of div & mod with negative arguments?

2002-09-25 Thread Simon Marlow
> Does Haskell specify how div and mod should behave when > given one or both arguments negative? > > Eg, in hugs we get: > > div 13 = 0 > div (-1) 3 = -1 > div 1 (-3) = -1 > div (-1) (-3) = 0 > > and so on. We usually describe div as the version of division that "truncates toward