
18 Dec
2009
18 Dec
'09
12:06 p.m.
2009/12/17
Hi, I have data Nat = Z | S Nat deriving (Eq,Ord,Show)
toEnum should return Z for negative numbers. I did something like this but the problem is I don't know how to set "less than". I tried > and lt:
instance Enum Nat where toEnum (gt 0) = S Z toEnum (lt 1) = Z -- GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01 _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
Fill in the gaps: instance Enum Nat where toEnum x | x <= 0 = ... | otherwise = ... -- Deniz Dogan