Cleanup
This commit is contained in:
+15
-4
@@ -3,13 +3,24 @@
|
||||
module MaybeHelp where
|
||||
import Control.Lens
|
||||
|
||||
-- | Strict maybe
|
||||
data Maybe' a
|
||||
= Just' {__Just' :: a }
|
||||
| Nothing'
|
||||
data Maybe' a = Just' {__Just' :: a} | Nothing'
|
||||
deriving (Eq,Ord,Show)
|
||||
|
||||
fromJust' :: Maybe' a -> a
|
||||
fromJust' mx = case mx of
|
||||
Just' x -> x
|
||||
Nothing' -> error "no fromJust'"
|
||||
|
||||
isJust' :: Maybe' a -> Bool
|
||||
isJust' Just' {} = True
|
||||
isJust' Nothing' = False
|
||||
|
||||
isNothing' :: Maybe' a -> Bool
|
||||
isNothing' Just' {} = False
|
||||
isNothing' Nothing' = True
|
||||
|
||||
strictify :: Maybe a -> Maybe' a
|
||||
strictify Nothing = Nothing'
|
||||
strictify (Just x) = Just' x
|
||||
|
||||
makeLenses ''Maybe'
|
||||
|
||||
Reference in New Issue
Block a user