sindre-0.6: A programming language for simple GUIs
LicenseMIT-style (see LICENSE)
Stabilitystable
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Sindre.Util

Description

Various utility bits and pieces.

Synopsis

Documentation

io :: MonadIO m => IO a -> m a Source #

Short-hand for liftIO

fi :: (Integral a, Num b) => a -> b Source #

Short-hand for fromIntegral

err :: MonadIO m => String -> m () Source #

Short-hand for 'liftIO . hPutStrLn stderr'

upcase :: String -> String Source #

Short-hand for 'map toUpper'

downcase :: String -> String Source #

Short-hand for 'map toLower'

hsv2rgb :: Fractional a => (Integer, a, a) -> (a, a, a) Source #

wrap :: String -> String -> String Source #

Prepend and append first argument to second argument.

quote :: String -> String Source #

Put double quotes around the given string.

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

Bound a value by minimum and maximum values.

mapAccumLM :: Monad m => (acc -> x -> m (acc, y)) -> acc -> [x] -> m (acc, [y]) Source #

The mapAccumLM function behaves like a combination of mapM and foldlM; it applies a monadic function to each element of a list, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new list.

ifM :: Monad m => m Bool -> m a -> m a -> m a Source #

Like when, but with two branches. A lifted if.

divide :: Integral a => a -> a -> [a] Source #

x divide n splits the interval [0..x] into n non-overlapping chunks that together form the entire interval. For example:

>>> 10 `divide` 3
[3,3,4]