
21 Feb
2010
21 Feb
'10
3:28 p.m.
Am Sonntag 21 Februar 2010 15:57:09 schrieb kane96@gmx.de:
I tried: map toEnum [1,2,3,4]) :: [Nat] which works normally, but not for Maybe in: mapIntsToNats :: [Int] -> Maybe [Nat]
To use mapM, you need a function of type (f :: Int -> Maybe Nat). toEnum has type (Int -> Nat), so you can't use that directly. Think: when should f k be Nothing and what should f k be in the other cases?