projects
/
ghc-base.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fd73317
)
untabify
author
Don Stewart
<dons@galois.com>
Mon, 18 Feb 2008 06:54:11 +0000
(06:54 +0000)
committer
Don Stewart
<dons@galois.com>
Mon, 18 Feb 2008 06:54:11 +0000
(06:54 +0000)
Data/Maybe.hs
patch
|
blob
|
history
diff --git
a/Data/Maybe.hs
b/Data/Maybe.hs
index
ea16a9a
..
4a71772
100644
(file)
--- a/
Data/Maybe.hs
+++ b/
Data/Maybe.hs
@@
-16,18
+16,18
@@
module Data.Maybe
(
Maybe(Nothing,Just)-- instance of: Eq, Ord, Show, Read,
module Data.Maybe
(
Maybe(Nothing,Just)-- instance of: Eq, Ord, Show, Read,
- -- Functor, Monad, MonadPlus
+ -- Functor, Monad, MonadPlus
- , maybe -- :: b -> (a -> b) -> Maybe a -> b
+ , maybe -- :: b -> (a -> b) -> Maybe a -> b
- , isJust -- :: Maybe a -> Bool
- , isNothing -- :: Maybe a -> Bool
- , fromJust -- :: Maybe a -> a
- , fromMaybe -- :: a -> Maybe a -> a
+ , isJust -- :: Maybe a -> Bool
+ , isNothing -- :: Maybe a -> Bool
+ , fromJust -- :: Maybe a -> a
+ , fromMaybe -- :: a -> Maybe a -> a
, listToMaybe -- :: [a] -> Maybe a
, listToMaybe -- :: [a] -> Maybe a
- , maybeToList -- :: Maybe a -> [a]
- , catMaybes -- :: [Maybe a] -> [a]
- , mapMaybe -- :: (a -> Maybe b) -> [a] -> [b]
+ , maybeToList -- :: Maybe a -> [a]
+ , catMaybes -- :: [Maybe a] -> [a]
+ , mapMaybe -- :: (a -> Maybe b) -> [a] -> [b]
) where
#ifdef __GLASGOW_HASKELL__
) where
#ifdef __GLASGOW_HASKELL__
@@
-43,7
+43,7
@@
import Maybe
, fromJust
, fromMaybe
, listToMaybe
, fromJust
, fromMaybe
, listToMaybe
- , maybeToList
+ , maybeToList
, catMaybes
, mapMaybe
)
, catMaybes
, mapMaybe
)
@@
-63,7
+63,7
@@
import Maybe
-- monad, where all errors are represented by 'Nothing'. A richer
-- error monad can be built using the 'Data.Either.Either' type.
-- monad, where all errors are represented by 'Nothing'. A richer
-- error monad can be built using the 'Data.Either.Either' type.
-data Maybe a = Nothing | Just a
+data Maybe a = Nothing | Just a
deriving (Eq, Ord)
instance Functor Maybe where
deriving (Eq, Ord)
instance Functor Maybe where
@@
-78,7
+78,7
@@
instance Monad Maybe where
Nothing >> _ = Nothing
return = Just
Nothing >> _ = Nothing
return = Just
- fail _ = Nothing
+ fail _ = Nothing
-- ---------------------------------------------------------------------------
-- Functions over Maybe
-- ---------------------------------------------------------------------------
-- Functions over Maybe