module OAlg.Data.Maybe
( module M
, just
, exstJust
)
where
import Data.Maybe as M
exstJust :: [Maybe v] -> Maybe [v]
exstJust :: forall v. [Maybe v] -> Maybe [v]
exstJust [Maybe v]
mvs = case forall a. [Maybe a] -> [a]
catMaybes [Maybe v]
mvs of
[] -> forall a. Maybe a
Nothing
[v]
vs -> forall a. a -> Maybe a
Just [v]
vs
just :: (a -> Bool) -> a -> Maybe a
just :: forall a. (a -> Bool) -> a -> Maybe a
just a -> Bool
p a
a = if a -> Bool
p a
a then forall a. a -> Maybe a
Just a
a else forall a. Maybe a
Nothing