[Haskell-beginners] 1=2

Francesco Ariis fa-ml at ariis.it
Tue Dec 15 01:29:12 UTC 2020


Il 14 dicembre 2020 alle 20:05 amindfv at mailbox.org ha scritto:
> It's the same in do-blocks:
> 
> main :: IO ()
> main = do
>    let 3 = 2 + 2
>    putStrLn "Oh fiddlesticks"

What happens exactly when I type this?

    λ> "prova" = "foo"
    λ> 'c' = 'd'
    λ> 'c'
    'c'

>From the Report I read:

    lexp  → let decls in exp
    decls → { decl1 ; … ; decln }       (n ≥ 0)
    ⁝
    decl  → (funlhs | pat) rhs
    ⁝

Am I correct in saying `pat rhs` is the rule being used here? I do not
understand how/when it comes useful in a let
—F




More information about the Beginners mailing list