I have these statements:
data SL a = SR (Integer -> (a, Integer))
deriving(Show)
instance Monad SL where
return k = SR (\st -> (k, st))
xx::SL Integer
xx = return 4
Then I do:
let SR f = xx
Now I have:
xx :: SL Integer
f :: Integer -> (Integer, Integer)
but I cannot understand why. Maybe I’m missing the syntactic meaning of let DATACONSTRUCTOR ...
Can you help?
let SR f = xxmeans thatSR fshould be equal toxx. So,and thus
which, in this context, is of type
Integer -> (Integer, Integer)because ofSR :: a -> Integer -> (a, Integer)andxx :: SL Integer.