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
> 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
> 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
| 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
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
| 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
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
| 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
| 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
> 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
10 matches
Mail list logo