[Haskell-cafe] The where-clause and guards

Nicolas Wu nicolas.wu at gmail.com
Wed Jul 21 03:13:25 EDT 2010


There's nothing wrong with the use of your example, I'm guessing it's
something in your ... that's leading to the parse error. This compiles
just fine:

f a b
 | c > 1      = 1
 | c < 1      = 2
 | otherwise  = 3
 where c = a+b

Nick


On Wed, Jul 21, 2010 at 8:01 AM, Eitan Goldshtrom
<thesourceofx at gmail.com> wrote:
> I'm trying to fit a where clause to some guards I'm using. I have the
> following
>
> f a b
>  | c > 1      = ...
>  | c < 1      = ...
>  | otherwise  = ...
>  where c = a+b
>
> yet I'm getting a parsing error. Is this not the correct way to combine
> "where" with "guards"?
>
> -Eitan
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


More information about the Haskell-Cafe mailing list