Hi,

I've been trying some examples in functional programming. Most things
work fine,
but I have trouble with expressions with 'where' clauses that define
more then one
local definition.
(I work with hugs98 version september 1999 under Linux)

For example:

----------[ Mydiff.hs ]----------------------
module Mydiff where

mydiff f = f'
        where f' x = ( f (x+h) - f x) / h
                    h = 0.0001

----------[ end Mydiff.hs ]-------------------

When I try to load this module I get
    ERROR "Mydiff.hs" (line 5): Syntax error in input (unexpected `=')
line 5 is the line h = 0.0001

I tried other examples like this one, played around with line-breaks
white-space etc.
Rewriting the f' line to f' x = (f (x+0.0001) - f x) / 0.0001 does the
trick, but is not very
satisfying.

Can anyone help?
WJ

PS. I attached above example


-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Disclaimer:
"These opinions are my own, though for a small fee they be
 yours too."
 -- Dave Haynie


module Mydiff where

mydiff f = f'
        where f' x = ( f (x+h) - f x) / h
                         h = 0.0001

Reply via email to