Today, I thought I had discovered a bug in ghc. Then I tried hbc
and Hugs, and they also rejected my program with the same error.
nhc98 alone accepts it without complaint. I looked up the Report,
and it seems that the program is indeed incorrect.
Quick quiz: without running this through a
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
Malcolm Wallace writes:
Quick quiz: without running this through a compiler, who can spot
the mistake? :-)
module Main where
import Char
f x = y
where
y | isSpace x = True
y | otherwise = False-- ** The problem line?
main = print (f 'x')
Without running this
f x = y
where
y | isSpace x = True
y | otherwise = False-- ** The problem line?
Correct. Here y is a pattern binding, and multiple pattern bindings of
the same variable are not permitted.
f x = y ()
where
y _ | isSpace x = True
y _ | otherwise = False
Wim-Jan Hilgenbos wrote:
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:
open text editor, type
hash :: [Char] - Int
hash = (foldl (+) 0) . (map ord)
save as hash.hs
load script, type:
hash "MSDOS 6.000"
or
hash "SYSTEM 7.0"
:-)
Ronald
___
Haskell mailing list
[EMAIL PROTECTED]
Ronald Kuwawi wrote:
open text editor, type
hash :: [Char] - Int
hash = (foldl (+) 0) . (map ord)
save as hash.hs
load script, type:
hash "MSDOS 6.000"
or
hash "SYSTEM 7.0"
or
hash "HASKELL%98"
:-)
-- Zhanyong Wan
___
Haskell
Head to http://www.cafepress.com/haskell for your holiday shopping.
Thanks to Conal Elliott and Fritz Ruehr for their artwork. Conal's
design was produced by Pan so this shirt is in fact powered by
Haskell!
I'll be glad to add more designs in the future. Once cafepress lets
me put more than
On Fri, 1 Dec 2000, Zhanyong Wan wrote:
Ronald Kuwawi wrote:
open text editor, type
hash :: [Char] - Int
hash = (foldl (+) 0) . (map ord)
hash "HASKELL%98"
hash "Haskell Ninety Eight !!"
surely?
--
Jón Fairbairn [EMAIL PROTECTED]
On Sat, 2 Dec 2000, Jon Fairbairn wrote:
hash "HASKELL%98"
hash "Haskell Ninety Eight !!"
Here's the who;e truth:
hash "Turing!"
Kili
--
Nunja! Wenn man erst einmal anfängt zu denken, dann ist es wie
eine Sucht. Man kommt nicht mehr los davon.
[WoKo in dag°, 28.11.2000]
10 matches
Mail list logo