Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- alphabet :: String
- alphaNumerics :: String
- onNothing :: Applicative m => Maybe a -> m a -> m a
- onNothingM :: Monad m => m (Maybe a) -> m a -> m a
- onJust :: Applicative m => Maybe a -> (a -> m ()) -> m ()
- withJust :: Applicative m => Maybe a -> (a -> m (Maybe b)) -> m (Maybe b)
- maybeToEither :: a -> Maybe b -> Either a b
- eitherToMaybe :: Either a b -> Maybe b
- onLeft :: Applicative m => Either e a -> (e -> m a) -> m a
- mapLeft :: (e1 -> e2) -> Either e1 a -> Either e2 a
- whenMaybe :: Applicative m => Bool -> m a -> m (Maybe a)
- choice :: Alternative f => [f a] -> f a
- afold :: (Foldable t, Alternative f) => t a -> f a
- bsToTxt :: ByteString -> Text
- lbsToTxt :: ByteString -> Text
- txtToBs :: Text -> ByteString
- base64Decode :: Text -> ByteString
- liftEitherM :: MonadError e m => m (Either e a) -> m a
- spanMaybeM :: (Foldable f, Monad m) => (a -> m (Maybe b)) -> f a -> m ([b], [a])
- findWithIndex :: (a -> Bool) -> [a] -> Maybe (a, Int)
- mapFromL :: (Eq k, Hashable k) => (a -> k) -> [a] -> HashMap k a
- oMapFromL :: (Eq k, Hashable k) => (a -> k) -> [a] -> InsOrdHashMap k a
- withElapsedTime :: MonadIO m => m a -> m (DiffTime, a)
- startTimer :: (MonadIO m, MonadIO n) => m (n DiffTime)
- hoistMaybe :: Applicative m => Maybe b -> MaybeT m b
- hoistEither :: Applicative m => Either e a -> ExceptT e m a
- tshow :: Show a => a -> Text
- readJson :: FromJSON a => String -> Either String a
- hasuraJSON :: Options
- ltrace :: Show a => String -> a -> a
- ltraceM :: Applicative m => Show a => String -> a -> m ()
- traceToFile :: Show a => FilePath -> a -> a
- traceToFileM :: Applicative m => Show a => FilePath -> a -> m ()
- hashNub :: (Hashable a, Eq a) => [a] -> [a]
- nonEmptySeqToNonEmptyList :: NESeq a -> NonEmpty a
Documentation
onNothing :: Applicative m => Maybe a -> m a -> m a Source #
onNothingM :: Monad m => m (Maybe a) -> m a -> m a Source #
onJust :: Applicative m => Maybe a -> (a -> m ()) -> m () Source #
maybeToEither :: a -> Maybe b -> Either a b Source #
eitherToMaybe :: Either a b -> Maybe b Source #
onLeft :: Applicative m => Either e a -> (e -> m a) -> m a Source #
choice :: Alternative f => [f a] -> f a Source #
afold :: (Foldable t, Alternative f) => t a -> f a Source #
bsToTxt :: ByteString -> Text Source #
lbsToTxt :: ByteString -> Text Source #
txtToBs :: Text -> ByteString Source #
base64Decode :: Text -> ByteString Source #
liftEitherM :: MonadError e m => m (Either e a) -> m a Source #
withElapsedTime :: MonadIO m => m a -> m (DiffTime, a) Source #
Time an IO action, returning the time with microsecond precision. The result of the input action will be evaluated to WHNF.
The result DiffTime
is guarenteed to be >= 0.
startTimer :: (MonadIO m, MonadIO n) => m (n DiffTime) Source #
Start timing and return an action to return the elapsed time since startTimer
was called.
timer <- startTimer someStuffToTime elapsed <- timer moreStuff elapsedBoth <- timer
hoistMaybe :: Applicative m => Maybe b -> MaybeT m b Source #
hoistEither :: Applicative m => Either e a -> ExceptT e m a Source #
hasuraJSON :: Options Source #
Customized Options
which apply "snake case" to Generic or Template
Haskell JSON derivations.
For example, a Haskell field fooBar
would be deserialized fromto JSON as
foo_bar
.
ltrace :: Show a => String -> a -> a Source #
Warning: ltrace left in code
Labeled, prettified traceShowId
ltraceM :: Applicative m => Show a => String -> a -> m () Source #
Warning: ltraceM left in code
Labeled, prettified traceShowM
traceToFile :: Show a => FilePath -> a -> a Source #
Warning: traceToFile left in code
Trace a prettified value to a file
traceToFileM :: Applicative m => Show a => FilePath -> a -> m () Source #
Warning: traceToFileM left in code
Trace a prettified value to a file in an Applicative context
hashNub :: (Hashable a, Eq a) => [a] -> [a] Source #
Remove duplicates from a list. Like nub
but runs in O(n * log_16(n))
time and requires Hashable
and Eq
instances. hashNub is faster than
ordNub when there're not so many different values in the list.
>>>
hashNub [1,3,2,9,4,1,5,7,3,3,1,2,5,4,3,2,1,0]
[0,1,2,3,4,5,7,9]
nonEmptySeqToNonEmptyList :: NESeq a -> NonEmpty a Source #
Convert a non-empty sequence to a non-empty list.