
f should be Nothing if k is negative and otherwise k should be toEnum k...?! -------- Original-Nachricht --------
Datum: Sun, 21 Feb 2010 16:28:58 +0100 Von: Daniel Fischer
An: beginners@haskell.org CC: kane96@gmx.de Betreff: Re: [Haskell-beginners] list of integers to list of nats
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?
-- Sicherer, schneller und einfacher. Die aktuellen Internet-Browser - jetzt kostenlos herunterladen! http://portal.gmx.net/de/go/atbrowser