This commit is contained in:
2022-06-07 21:34:34 +01:00
parent d2c3d14e46
commit e85bd36fe4
28 changed files with 222 additions and 232 deletions
+15 -4
View File
@@ -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'