I have to extract user name and email from Either of AuthResponse.
I use case of construct for it:
let (uname, uemail) =
case getUserResponseJSON creds of
Right (GoogleUserResponse uname uemail) -> (uname, uemail)
_ -> ("", "")
But I have this warning for both uname and uemail:
This binding for ‘uname’ shadows the existing binding
bound at src/Foundation.hs:240:12
|
242 | Right (GoogleUserResponse uname uemail) -> (uname, uemail)
|
I expect that let (uname, uemail) is out of the scope of case of block.
How is it possible to have this warning from the case block if uname and uemail are not yet defined?
Haskell's let is actually letrec.
In let x = x in ..., the x on the right refers to the x on the left.
The scope of x, y and z in
let
x = ...
y = ...
z = ...
in ...
are all the code areas indicated with ....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With