Hoogle Search
Within LTS Haskell 24.6 (ghc-9.10.2)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
maybeOption :: a -> Bool -> (a -> a) -> Maybe a -> Maybe aconfiguration-tools Configuration.Utils.Maybe Command line parser for record Maybe values
Example:
data Setting = Setting { _setA ∷ !Int , _setB ∷ !String } deriving (Show, Read, Eq, Ord, Typeable) $(makeLenses ''Setting) defaultSetting ∷ Setting defaultSetting = Setting { _setA = 0 , _setB = 1 } instance ToJSON Setting where toJSON setting = object [ "a" .= _setA setting , "b" .= _setB setting ] instance FromJSON (Setting → Setting) where parseJSON = withObject "Setting" $ \o → id <$< setA ..: "a" % o <*< setB ..: "b" % o instance FromJSON Setting where parseJSON v = parseJSON v <*> pure defaultSetting pSetting ∷ MParser Setting pSetting = id <$< setA .:: option auto % short 'a' <> metavar "INT" <> help "set a" <*< setB .:: option auto % short 'b' <> metavar "INT" <> help "set b" -- | Use 'Setting' as 'Maybe' in a configuration: -- data Config = Config { _maybeSetting ∷ !(Maybe Setting) } deriving (Show, Read, Eq, Ord, Typeable) $(makeLenses ''Config) defaultConfig ∷ Config defaultConfig = Config { _maybeSetting = defaultSetting } instance ToJSON Config where toJSON config = object [ "setting" .= maybeSetting ] instance FromJSON (Config → Config) where parseJSON = withObject "Config" $ \o → id <$< maybeSetting %.: "setting" % o pConfig ∷ MParser Config pConfig = id <$< maybeSetting %:: (maybeOption defaultSetting <$> pEnableSetting <*> pSetting) where pEnableSetting = boolOption % long "setting-enable" <> value False <> help "Enable configuration flags for setting"
maybeHolds :: Property p v => p -> v -> Maybe vdata-checked Data.Checked maybeHolds :: Property p v => p -> v -> Maybe vdata-checked Data.Checked.Strict maybeM :: Monad m => m b -> (a -> m b) -> m (Maybe a) -> m bdistribution-opensuse OpenSuse.Prelude Monadic generalisation of maybe.
-
dunai Control.Monad.Trans.MSF.Except Converts an MSF in MaybeT to an MSF in ExceptT. Whenever Nothing is thrown, throw () instead.
maybeExit :: forall (m :: Type -> Type) a . Monad m => MSF (MaybeT m) (Maybe a) adunai Control.Monad.Trans.MSF.Maybe Just a is passed along, Nothing causes the whole MSF to exit.
-
dunai Control.Monad.Trans.MSF.Maybe Converts an MSF in MaybeT to an MSF in ExceptT. Whenever Nothing is thrown, throw () instead.
maybeToExceptT :: forall (m :: Type -> Type) e a . Functor m => e -> MaybeT m a -> ExceptT e m adunai Control.Monad.Trans.MSF.Maybe Convert a MaybeT computation to ExceptT, with a default exception value.
maybeModTime :: FilePath -> IO (Maybe UTCTime)dyre Config.Dyre.Paths Check if a file exists. If it exists, return Just the modification time. If it doesn't exist, return Nothing.
maybeEither :: Maybe a -> Either () aerrors-ext Control.Error.Extensions Converts Maybe to Either. Specialization of maybe.
maybeEither . eitherMaybe = id