robdockins at fastmail.fm
Mon Feb 12 11:14:39 EST 2007
On Feb 12, 2007, at 11:02 AM, phiroc at free.fr wrote:
> the "Advanced Monads" page in the Haskell Wikibook
> (http://en.wikibooks.org/wiki/Haskell/Advanced_monads) contains the
> example of a List Monad
> pythags = do
> x <- [1..]
> y <- [x..]
> z <- [y..]
> guard (x^2 + y^2 == z^2)
> return (x, y, z)
> However, whenever you load that function definition into Hugs or
> GHCi, you get a
> message saying that "guard" is an undefined variable.
> Does anyone know why?
Add the line
to the beginning of your program. The 'guard' function is not
automatically in scope.
Speak softly and drive a Sherman tank.
Laugh hard; it's a long way to the bank.
More information about the Haskell-Cafe