VD
Maybe реализует
Read a => Read (Maybe a)Однако код
Prelude> read "123" :: Maybe Int
*** Exception: Prelude.read: no parse
Бросает исключение.
Что я делаю не так?
λ> read "Just 123" :: Maybe Int
Just 123
Size: a a a
VD
Read a => Read (Maybe a)Prelude> read "123" :: Maybe Int
*** Exception: Prelude.read: no parse
λ> read "Just 123" :: Maybe Int
Just 123
VD
λ> read "Nothing" :: Maybe Int
Nothing
VD
λ> :i readMaybe
readMaybe :: Read a => String -> Maybe a -- Defined in ‘Text.Read’
G
λ> read "Just 123" :: Maybe Int
Just 123
G
λ> :i readMaybe
readMaybe :: Read a => String -> Maybe a -- Defined in ‘Text.Read’
VD
LO
24h?A
AA
LO
A
YR
YR
AT
AV
VD
IK