[Haskell-beginners] Syntax error using where with guards.

Francesco Ariis fa-ml at ariis.it
Fri Sep 15 23:49:00 UTC 2017


On Fri, Sep 15, 2017 at 06:53:54PM -0400, Manuel Vázquez Acosta wrote:
>     $ ghc xoutil/dim/meta.hs
>     [1 of 1] Compiling Meta             ( xoutil/dim/meta.hs, xoutil/dim/meta.o )
> 
>     xoutil/dim/meta.hs:19:3: parse error on input ‘|’

Hello Manuel,
    `where` scopes over several guarded equations (and this is the main
difference with `let`). This should do the trick:

    | a == 1 = let x = 10
               in x + a
    | a == 2 = let x = 3
               in x + a



More information about the Beginners mailing list