Copyright | (c) 2018 Francisco Vallarino |
---|---|
License | BSD-3-Clause (see the LICENSE file) |
Maintainer | fjvallarino@gmail.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Helper functions used across the library. They do not belong to any specific module and are not directly exported.
Synopsis
- maybeConcat :: Monoid a => [a] -> Maybe a
- collectJustM :: MonadIO m => m (Maybe a) -> m [a]
- seqLast :: Seq a -> a
- seqStartsWith :: Eq a => Seq a -> Seq a -> Bool
- seqCatMaybes :: Seq (Maybe a) -> Seq a
- applyFnList :: [a -> a] -> a -> a
- minNumericValue :: RealFloat a => a
- maxNumericValue :: RealFloat a => a
- clamp :: Ord a => a -> a -> a -> a
- catchAny :: IO a -> (SomeException -> IO a) -> IO a
- headMay :: [a] -> Maybe a
- putStrLnErr :: String -> IO ()
- isGhciRunning :: IO Bool
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
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.