[Haskell-beginners] list of integers to list of nats
kane96 at gmx.de
kane96 at gmx.de
Sun Feb 21 11:28:41 EST 2010
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 <daniel.is.fischer at web.de>
> An: beginners at haskell.org
> CC: kane96 at gmx.de
> Betreff: Re: [Haskell-beginners] list of integers to list of nats
> Am Sonntag 21 Februar 2010 15:57:09 schrieb kane96 at 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
More information about the Beginners
mailing list