[Haskell-beginners] Adding 1 to Just 9
50295 at web.de
Mon May 14 12:15:31 UTC 2018
Chapter 14 of LYH appears to suggest that a Just value can be added to
an Int. Quote from
"For instance, say we have Just 9 and the function \x -> Just (x+1). If
we map this function over Just 9, we're left with Just (Just 10)."
I've tried the following in ghci but got the error:
• Non type-variable argument in the constraint: Num (Maybe a)
(Use FlexibleContexts to permit this)
• When checking the inferred type
it :: forall a. (Num (Maybe a), Num a) => Maybe a
Am I reading the quote wrong? Is Just (Just 10) a hypothetical?
More information about the Beginners