sindre-0.1: A programming language for simple GUIs

Portabilityportable
Stabilitystable

Sindre.Util

Description

Various utility bits and pieces.

Synopsis

Documentation

io :: MonadIO m => IO a -> m aSource

Short-hand for liftIO

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

Short-hand for fromIntegral

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

Short-hand for 'liftIO . hPutStrLn stderr'

upcase :: String -> StringSource

Short-hand for 'map toUpper'

downcase :: String -> StringSource

Short-hand for 'map toLower'

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

Conversion scheme as in http:en.wikipedia.orgwikiHSV_color_space

wrap :: String -> String -> StringSource

Prepend and append first argument to second argument.

quote :: String -> StringSource

Put double quotes around the given string.

clamp :: Ord a => a -> a -> a -> aSource

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 aSource

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