@@ -1,12 +1,10 @@
1module prelude.maybe
1module prelude.maybe
3import builtins
3import builtins
7data Maybe a
5data Maybe a
11--------------------------------------------------------------------------------
9--------------------------------------------------------------------------------
12-- Syntactic tests
10-- Syntactic tests
@@ -20,18 +18,6 @@ isJust : Maybe a -> Bool
20isJust Nothing = False
18isJust Nothing = False
21isJust (Just j) = True
19isJust (Just j) = True
23−--------------------------------------------------------------------------------
25−--------------------------------------------------------------------------------
27−maybeToList : Maybe a -> List a
28−maybeToList Nothing = []
29−maybeToList (Just j) = [j]
31−listToMaybe : List a -> Maybe a
32−listToMaybe [] = Nothing
33−listToMaybe (x::xs) = Just x
35--------------------------------------------------------------------------------
21--------------------------------------------------------------------------------
37--------------------------------------------------------------------------------
23--------------------------------------------------------------------------------
@@ -48,20 +34,6 @@ toMaybe : Bool -> a -> Maybe a
48toMaybe True j = Just j
34toMaybe True j = Just j
49toMaybe False j = Nothing
35toMaybe False j = Nothing
51−catMaybes : List (Maybe a) -> List a
55− Nothing => catMaybes xs
56− Just j => j :: catMaybes xs
58−mapMaybe : (a -> Maybe b) -> List a -> List b
62− Nothing => mapMaybe f xs
63− Just j => j :: mapMaybe f xs
65--------------------------------------------------------------------------------
37--------------------------------------------------------------------------------
66-- Class instances
38-- Class instances
67--------------------------------------------------------------------------------
39--------------------------------------------------------------------------------