monomer-1.6.0.1: A GUI library for writing native Haskell applications.
Copyright(c) 2018 Francisco Vallarino
LicenseBSD-3-Clause (see the LICENSE file)
Maintainerfjvallarino@gmail.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Monomer.Helper

Description

Helper functions used across the library. They do not belong to any specific module and are not directly exported.

Synopsis

Documentation

maybeConcat :: Monoid a => [a] -> Maybe a Source #

Concats a list of Monoids or returns Nothing if empty.

collectJustM :: MonadIO m => m (Maybe a) -> m [a] Source #

Runs an action until Nothing is returned, collecting the results in a list.

seqLast :: Seq a -> a Source #

Returns the last item in a sequence. Unsafe, fails if sequence is empty.

seqStartsWith :: Eq a => Seq a -> Seq a -> Bool Source #

Checks if the first sequence is a prefix of the second.

seqCatMaybes :: Seq (Maybe a) -> Seq a Source #

Filters Nothing instances out of a Seq, and removes the Just wrapper.

applyFnList :: [a -> a] -> a -> a Source #

Folds a list of functions over an initial value.

minNumericValue :: RealFloat a => a Source #

Returns the minimum value of a given floating type.

Copied from: https://hackage.haskell.org/package/numeric-limits

maxNumericValue :: RealFloat a => a Source #

Returns the maximum value of a given floating type.

Copied from: https://hackage.haskell.org/package/numeric-limits

clamp :: Ord a => a -> a -> a -> a Source #

Restricts a value to a given range.

catchAny :: IO a -> (SomeException -> IO a) -> IO a Source #

Catches any exception thrown by the provided action

headMay :: [a] -> Maybe a Source #

Returns Just the first item if the list is not empty, Nothing otherwise.

putStrLnErr :: String -> IO () Source #

Attempts to print on stderr, with fallback to stdout on failure.

isGhciRunning :: IO Bool Source #

Checks if the application is running in ghci.