protolude-0.2: A small prelude.

Safe Haskell | Trustworthy
Language | Haskell2010

Protolude

Synopsis

- ($!) :: (a -> b) -> a -> b
- identity :: a -> a
- map :: Functor f => (a -> b) -> f a -> f b
- uncons :: [a] -> Maybe (a, [a])
- unsnoc :: [x] -> Maybe ([x], x)
- applyN :: Int -> (a -> a) -> a -> a
- print :: (MonadIO m, Show a) => a -> m ()
- throwIO :: (MonadIO m, Exception e) => e -> m a
- throwTo :: (MonadIO m, Exception e) => ThreadId -> e -> m ()
- foreach :: Functor f => f a -> (a -> b) -> f b
- (<&>) :: Functor f => f a -> (a -> b) -> f b
- show :: (Show a, StringConv String b) => a -> b
- pass :: Applicative f => f ()
- guarded :: Alternative f => (a -> Bool) -> a -> f a
- guardedA :: (Functor f, Alternative t) => (a -> f Bool) -> a -> f (t a)
- type LText = Text
- type LByteString = ByteString
- liftIO1 :: MonadIO m => (a -> IO b) -> a -> m b
- liftIO2 :: MonadIO m => (a -> b -> IO c) -> a -> b -> m c
- die :: Text -> IO a

# Documentation

($!) :: (a -> b) -> a -> b infixr 0 #

identity :: a -> a #

map :: Functor f => (a -> b) -> f a -> f b #

uncons :: [a] -> Maybe (a, [a]) #

unsnoc :: [x] -> Maybe ([x], x) #

applyN :: Int -> (a -> a) -> a -> a #

print :: (MonadIO m, Show a) => a -> m () #

throwIO :: (MonadIO m, Exception e) => e -> m a #

throwTo :: (MonadIO m, Exception e) => ThreadId -> e -> m () #

foreach :: Functor f => f a -> (a -> b) -> f b #

(<&>) :: Functor f => f a -> (a -> b) -> f b infixl 4 #

Infix version of foreach.

`&` is to `<$>` what `&` is to `$`.

show :: (Show a, StringConv String b) => a -> b #

pass :: Applicative f => f () #

Do nothing returning unit inside applicative.

guarded :: Alternative f => (a -> Bool) -> a -> f a #

guardedA :: (Functor f, Alternative t) => (a -> f Bool) -> a -> f (t a) #

type LText = Text #

type LByteString = ByteString #

liftIO1 :: MonadIO m => (a -> IO b) -> a -> m b #

Lift an `IO` operation with 1 argument into another monad

liftIO2 :: MonadIO m => (a -> b -> IO c) -> a -> b -> m c #

Lift an `IO` operation with 2 arguments into another monad

die :: Text -> IO a #