{-# OPTIONS_GHC -fno-warn-tabs #-}
module Utility.Data where
firstJust :: Eq a => [Maybe a] -> Maybe a
firstJust :: forall a. Eq a => [Maybe a] -> Maybe a
firstJust [Maybe a]
ms = case forall a. (a -> Bool) -> [a] -> [a]
dropWhile (forall a. Eq a => a -> a -> Bool
== forall a. Maybe a
Nothing) [Maybe a]
ms of
[] -> forall a. Maybe a
Nothing
(Maybe a
md:[Maybe a]
_) -> Maybe a
md
eitherToMaybe :: Either a b -> Maybe b
eitherToMaybe :: forall a b. Either a b -> Maybe b
eitherToMaybe = forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either (forall a b. a -> b -> a
const forall a. Maybe a
Nothing) forall a. a -> Maybe a
Just