[project @ 1999-01-14 18:12:47 by sof]
[ghc-hetmet.git] / ghc / lib / std / PrelMaybe.lhs
index 974e5de..20de4cc 100644 (file)
@@ -15,28 +15,23 @@ import PrelBase
 data  Maybe a  =  Nothing | Just a     deriving (Eq, Ord, Show {- Read -})
 
 maybe :: b -> (a -> b) -> Maybe a -> b
-maybe n f Nothing  = n
-maybe n f (Just x) = f x
+maybe n _ Nothing  = n
+maybe _ f (Just x) = f x
 
 instance  Functor Maybe  where
-    map f Nothing       = Nothing
-    map f (Just a)      = Just (f a)
+    fmap _ Nothing       = Nothing
+    fmap f (Just a)      = Just (f a)
 
 instance  Monad Maybe  where
     (Just x) >>= k      = k x
-    Nothing  >>= k      = Nothing
+    Nothing  >>= _      = Nothing
 
-    (Just x) >>  k      = k
-    Nothing  >>  k      = Nothing
+    (Just _) >>  k      = k
+    Nothing  >>  _      = Nothing
 
     return              = Just
+    fail _             = Nothing
 
-instance  MonadZero Maybe  where
-    zero                = Nothing
-
-instance  MonadPlus Maybe  where
-    Nothing ++ ys       = ys
-    xs      ++ ys       = xs
 \end{code}