[Haskell-cafe] pythags

Greg Fitzgerald garious at gmail.com
Mon Feb 12 11:05:58 EST 2007


Check out Hoogle:  http://haskell.org/hoogle/?q=guard

import Control.Monad

-Greg



On 2/12/07, phiroc at free.fr <phiroc at free.fr> wrote:
>
> Hello,
>
> the "Advanced Monads" page in the Haskell Wikibook
> (http://en.wikibooks.org/wiki/Haskell/Advanced_monads) contains the
> following
> 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?
>
> Thanks.
>
> phiroc
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070212/bfa1c458/attachment-0001.htm


More information about the Haskell-Cafe mailing list