termonad-4.5.0.0: Terminal emulator configurable in Haskell

Safe Haskell | None
Language | Haskell2010

Termonad.Prelude

Synopsis

- module ClassyPrelude
- module Data.Proxy
- (&) :: a -> (a -> b) -> b
- newtype MaybeT (m :: Type -> Type) a = MaybeT {
  - runMaybeT :: m (Maybe a)
  }
- hPutStrLn :: MonadIO m => Handle -> Text -> m ()
- whenJust :: Monoid m => Maybe a -> (a -> m) -> m

# Documentation

module ClassyPrelude

module Data.Proxy

(&) :: a -> (a -> b) -> b infixl 1 Source #

`&` is a reverse application operator. This provides notational convenience. Its precedence is one higher than that of the forward application operator `$`, which allows `&` to be nested in `$`.

This is a version of ``flip` `id``, where `id` is specialized from `a -> a` to `(a -> b) -> (a -> b)` which by the associativity of `(->)` is `(a -> b) -> a -> b`. flipping this yields `a -> (a -> b) -> b` which is the type signature of `&`

#### Examples

Expand

    >>> 5 & (+1) & show
    "6"

    >>> sqrt $ [1 / n^2 | n <- [1..1000]] & sum & (*6)
    3.1406380562059946

Since: base-4.8.0.0

newtype MaybeT (m :: Type -> Type) a Source #

The parameterizable maybe monad, obtained by composing an arbitrary monad with the `Maybe` monad.

Computations are actions that may produce a value or exit.

The `return` function yields a computation that produces that value, while `>>=` sequences two subcomputations, exiting if either computation does.

Constructors

MaybeT |

Fields

- runMaybeT :: m (Maybe a)

#### Instances

Instances details

MonadTrans MaybeT |
Instance details Defined in Control.Monad.Trans.Maybe Methods lift :: Monad m => m a -> MaybeT m a Source #
Read1 m => Lifting Read (MaybeT m :: Type -> Type) |
Instance details Defined in Data.Constraint.Lifting Methods lifting :: Read a :- Read (MaybeT m a) Source #
Show1 m => Lifting Show (MaybeT m :: Type -> Type) |
Instance details Defined in Data.Constraint.Lifting Methods lifting :: Show a :- Show (MaybeT m a) Source #
Eq1 m => Lifting Eq (MaybeT m :: Type -> Type) |
Instance details Defined in Data.Constraint.Lifting Methods lifting :: Eq a :- Eq (MaybeT m a) Source #
Ord1 m => Lifting Ord (MaybeT m :: Type -> Type) |
Instance details Defined in Data.Constraint.Lifting Methods lifting :: Ord a :- Ord (MaybeT m a) Source #
Functor m => Generic1 (MaybeT m :: Type -> Type) |

Instance details

Defined in Control.Monad.Trans.Maybe

Associated Types

type Rep1 (MaybeT m :: Type -> Type) |
Instance details Defined in Control.Monad.Trans.Maybe type Rep1 (MaybeT m :: Type -> Type) = D1 ('MetaData "MaybeT" "Control.Monad.Trans.Maybe" "transformers-0.6.1.1-inplace" 'True) (C1 ('MetaCons "MaybeT" 'PrefixI 'True) (S1 ('MetaSel ('Just "runMaybeT") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (m :.: Rec1 Maybe)))

Methods

from1 :: MaybeT m a -> Rep1 (MaybeT m) a Source #

to1 :: Rep1 (MaybeT m) a -> MaybeT m a Source #

MonadReader r m => MonadReader r (MaybeT m) |
Instance details Defined in Control.Monad.Reader.Class Methods ask :: MaybeT m r Source # local :: (r -> r) -> MaybeT m a -> MaybeT m a Source # reader :: (r -> a) -> MaybeT m a Source #
MonadIO m => MonadIO (MaybeT m) |
Instance details Defined in Control.Monad.Trans.Maybe Methods liftIO :: IO a -> MaybeT m a Source #
MonadZip m => MonadZip (MaybeT m) |
Instance details Defined in Control.Monad.Trans.Maybe Methods mzip :: MaybeT m a -> MaybeT m b -> MaybeT m (a, b) Source # mzipWith :: (a -> b -> c) -> MaybeT m a -> MaybeT m b -> MaybeT m c Source # munzip :: MaybeT m (a, b) -> (MaybeT m a, MaybeT m b) Source #
Eq1 m => Eq1 (MaybeT m) |
Instance details Defined in Control.Monad.Trans.Maybe Methods liftEq :: (a -> b -> Bool) -> MaybeT m a -> MaybeT m b -> Bool Source #
Ord1 m => Ord1 (MaybeT m) |
Instance details Defined in Control.Monad.Trans.Maybe Methods liftCompare :: (a -> b -> Ordering) -> MaybeT m a -> MaybeT m b -> Ordering Source #
Read1 m => Read1 (MaybeT m) |
Instance details Defined in Control.Monad.Trans.Maybe Methods liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (MaybeT m a) Source # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [MaybeT m a] Source # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (MaybeT m a) Source # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [MaybeT m a] Source #
Show1 m => Show1 (MaybeT m) |
Instance details Defined in Control.Monad.Trans.Maybe Methods liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> MaybeT m a -> ShowS Source # liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [MaybeT m a] -> ShowS Source #
Contravariant m => Contravariant (MaybeT m) |
Instance details Defined in Control.Monad.Trans.Maybe Methods contramap :: (a' -> a) -> MaybeT m a -> MaybeT m a' Source # (>$) :: b -> MaybeT m b -> MaybeT m a Source #
MonadCatch m => MonadCatch (MaybeT m) | Catches exceptions from the base monad.
Instance details Defined in Control.Monad.Catch Methods catch :: (HasCallStack, Exception e) => MaybeT m a -> (e -> MaybeT m a) -> MaybeT m a Source #
MonadMask m => MonadMask (MaybeT m) | Since: exceptions-0.10.0
Instance details Defined in Control.Monad.Catch Methods mask :: HasCallStack => ((forall a. MaybeT m a -> MaybeT m a) -> MaybeT m b) -> MaybeT m b Source # uninterruptibleMask :: HasCallStack => ((forall a. MaybeT m a -> MaybeT m a) -> MaybeT m b) -> MaybeT m b Source # generalBracket :: HasCallStack => MaybeT m a -> (a -> ExitCase b -> MaybeT m c) -> (a -> MaybeT m b) -> MaybeT m (b, c) Source #
MonadThrow m => MonadThrow (MaybeT m) | Throws exceptions into the base monad.
Instance details Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> MaybeT m a Source #
(Functor m, Monad m) => Alternative (MaybeT m) |
Instance details Defined in Control.Monad.Trans.Maybe Methods empty :: MaybeT m a Source # (<|>) :: MaybeT m a -> MaybeT m a -> MaybeT m a Source # some :: MaybeT m a -> MaybeT m [a] Source # many :: MaybeT m a -> MaybeT m [a] Source #
(Functor m, Monad m) => Applicative (MaybeT m) |
Instance details Defined in Control.Monad.Trans.Maybe Methods pure :: a -> MaybeT m a Source # (<*>) :: MaybeT m (a -> b) -> MaybeT m a -> MaybeT m b Source # liftA2 :: (a -> b -> c) -> MaybeT m a -> MaybeT m b -> MaybeT m c Source # (*>) :: MaybeT m a -> MaybeT m b -> MaybeT m b Source # (<*) :: MaybeT m a -> MaybeT m b -> MaybeT m a Source #
Functor m => Functor (MaybeT m) |
Instance details Defined in Control.Monad.Trans.Maybe Methods fmap :: (a -> b) -> MaybeT m a -> MaybeT m b Source # (<$) :: a -> MaybeT m b -> MaybeT m a Source #
Monad m => Monad (MaybeT m) |
Instance details Defined in Control.Monad.Trans.Maybe Methods (>>=) :: MaybeT m a -> (a -> MaybeT m b) -> MaybeT m b Source # (>>) :: MaybeT m a -> MaybeT m b -> MaybeT m b Source # return :: a -> MaybeT m a Source #
Monad m => MonadPlus (MaybeT m) |
Instance details Defined in Control.Monad.Trans.Maybe Methods mzero :: MaybeT m a Source # mplus :: MaybeT m a -> MaybeT m a -> MaybeT m a Source #
Monad m => MonadFail (MaybeT m) |
Instance details Defined in Control.Monad.Trans.Maybe Methods fail :: String -> MaybeT m a Source #
MonadFix m => MonadFix (MaybeT m) |
Instance details Defined in Control.Monad.Trans.Maybe Methods mfix :: (a -> MaybeT m a) -> MaybeT m a Source #
Foldable f => Foldable (MaybeT f) |

Instance details

Defined in Control.Monad.Trans.Maybe

Methods

fold :: Monoid m => MaybeT f m -> m Source #

foldMap :: Monoid m => (a -> m) -> MaybeT f a -> m Source #

foldMap' :: Monoid m => (a -> m) -> MaybeT f a -> m Source #

foldr :: (a -> b -> b) -> b -> MaybeT f a -> b Source #

foldr' :: (a -> b -> b) -> b -> MaybeT f a -> b Source #

foldl :: (b -> a -> b) -> b -> MaybeT f a -> b Source #

foldl' :: (b -> a -> b) -> b -> MaybeT f a -> b Source #

foldr1 :: (a -> a -> a) -> MaybeT f a -> a Source #

foldl1 :: (a -> a -> a) -> MaybeT f a -> a Source #

toList :: MaybeT f a -> [a] Source #

null :: MaybeT f a -> Bool Source #

length :: MaybeT f a -> Int Source #

elem :: Eq a => a -> MaybeT f a -> Bool Source #

maximum :: Ord a => MaybeT f a -> a Source #

minimum :: Ord a => MaybeT f a -> a Source #

sum :: Num a => MaybeT f a -> a Source #

product :: Num a => MaybeT f a -> a Source #

Traversable f => Traversable (MaybeT f) |
Instance details Defined in Control.Monad.Trans.Maybe Methods traverse :: Applicative f0 => (a -> f0 b) -> MaybeT f a -> f0 (MaybeT f b) Source # sequenceA :: Applicative f0 => MaybeT f (f0 a) -> f0 (MaybeT f a) Source # mapM :: Monad m => (a -> m b) -> MaybeT f a -> m (MaybeT f b) Source # sequence :: Monad m => MaybeT f (m a) -> m (MaybeT f a) Source #
PrimMonad m => PrimMonad (MaybeT m) |

Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (MaybeT m) |
Instance details Defined in Control.Monad.Primitive type PrimState (MaybeT m) = PrimState m

Methods

primitive :: (State# (PrimState (MaybeT m)) -> (# State# (PrimState (MaybeT m)), a #)) -> MaybeT m a

MonadResource m => MonadResource (MaybeT m) |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods liftResourceT :: ResourceT IO a -> MaybeT m a
Zoom m n s t => Zoom (MaybeT m) (MaybeT n) s t |
Instance details Defined in Control.Lens.Zoom Methods zoom :: LensLike' (Zoomed (MaybeT m) c) t s -> MaybeT m c -> MaybeT n c Source #
Generic (MaybeT m a) |

Instance details

Defined in Control.Monad.Trans.Maybe

Associated Types

type Rep (MaybeT m a) |
Instance details Defined in Control.Monad.Trans.Maybe type Rep (MaybeT m a) = D1 ('MetaData "MaybeT" "Control.Monad.Trans.Maybe" "transformers-0.6.1.1-inplace" 'True) (C1 ('MetaCons "MaybeT" 'PrefixI 'True) (S1 ('MetaSel ('Just "runMaybeT") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (m (Maybe a)))))

Methods

from :: MaybeT m a -> Rep (MaybeT m a) x Source #

to :: Rep (MaybeT m a) x -> MaybeT m a Source #

(Read1 m, Read a) => Read (MaybeT m a) |
Instance details Defined in Control.Monad.Trans.Maybe Methods readsPrec :: Int -> ReadS (MaybeT m a) Source # readList :: ReadS [MaybeT m a] Source # readPrec :: ReadPrec (MaybeT m a) Source # readListPrec :: ReadPrec [MaybeT m a] Source #
(Show1 m, Show a) => Show (MaybeT m a) |
Instance details Defined in Control.Monad.Trans.Maybe Methods showsPrec :: Int -> MaybeT m a -> ShowS Source # show :: MaybeT m a -> String Source # showList :: [MaybeT m a] -> ShowS Source #
(Eq1 m, Eq a) => Eq (MaybeT m a) |
Instance details Defined in Control.Monad.Trans.Maybe Methods (==) :: MaybeT m a -> MaybeT m a -> Bool Source # (/=) :: MaybeT m a -> MaybeT m a -> Bool Source #
(Ord1 m, Ord a) => Ord (MaybeT m a) |

Instance details

Defined in Control.Monad.Trans.Maybe

Methods

compare :: MaybeT m a -> MaybeT m a -> Ordering Source #

(<) :: MaybeT m a -> MaybeT m a -> Bool Source #

(<=) :: MaybeT m a -> MaybeT m a -> Bool Source #

(>) :: MaybeT m a -> MaybeT m a -> Bool Source #

(>=) :: MaybeT m a -> MaybeT m a -> Bool Source #

max :: MaybeT m a -> MaybeT m a -> MaybeT m a Source #

min :: MaybeT m a -> MaybeT m a -> MaybeT m a Source #

Wrapped (MaybeT m a) |

Instance details

Defined in Control.Lens.Wrapped

Associated Types

type Unwrapped (MaybeT m a) |
Instance details Defined in Control.Lens.Wrapped type Unwrapped (MaybeT m a) = m (Maybe a)

Methods

_Wrapped' :: Iso' (MaybeT m a) (Unwrapped (MaybeT m a)) Source #

Foldable f => MonoFoldable (MaybeT f a) |

Instance details

Defined in Data.MonoTraversable

Methods

ofoldMap :: Monoid m => (Element (MaybeT f a) -> m) -> MaybeT f a -> m Source #

ofoldr :: (Element (MaybeT f a) -> b -> b) -> b -> MaybeT f a -> b Source #

ofoldl' :: (a0 -> Element (MaybeT f a) -> a0) -> a0 -> MaybeT f a -> a0 Source #

otoList :: MaybeT f a -> [Element (MaybeT f a)] Source #

oall :: (Element (MaybeT f a) -> Bool) -> MaybeT f a -> Bool Source #

oany :: (Element (MaybeT f a) -> Bool) -> MaybeT f a -> Bool Source #

onull :: MaybeT f a -> Bool Source #

olength :: MaybeT f a -> Int Source #

olength64 :: MaybeT f a -> Int64 Source #

ocompareLength :: Integral i => MaybeT f a -> i -> Ordering Source #

otraverse_ :: Applicative f0 => (Element (MaybeT f a) -> f0 b) -> MaybeT f a -> f0 () Source #

ofor_ :: Applicative f0 => MaybeT f a -> (Element (MaybeT f a) -> f0 b) -> f0 () Source #

omapM_ :: Applicative m => (Element (MaybeT f a) -> m ()) -> MaybeT f a -> m () Source #

oforM_ :: Applicative m => MaybeT f a -> (Element (MaybeT f a) -> m ()) -> m () Source #

ofoldlM :: Monad m => (a0 -> Element (MaybeT f a) -> m a0) -> a0 -> MaybeT f a -> m a0 Source #

ofoldMap1Ex :: Semigroup m => (Element (MaybeT f a) -> m) -> MaybeT f a -> m Source #

ofoldr1Ex :: (Element (MaybeT f a) -> Element (MaybeT f a) -> Element (MaybeT f a)) -> MaybeT f a -> Element (MaybeT f a) Source #

ofoldl1Ex' :: (Element (MaybeT f a) -> Element (MaybeT f a) -> Element (MaybeT f a)) -> MaybeT f a -> Element (MaybeT f a) Source #

headEx :: MaybeT f a -> Element (MaybeT f a) Source #

lastEx :: MaybeT f a -> Element (MaybeT f a) Source #

unsafeHead :: MaybeT f a -> Element (MaybeT f a) Source #

unsafeLast :: MaybeT f a -> Element (MaybeT f a) Source #

maximumByEx :: (Element (MaybeT f a) -> Element (MaybeT f a) -> Ordering) -> MaybeT f a -> Element (MaybeT f a) Source #

minimumByEx :: (Element (MaybeT f a) -> Element (MaybeT f a) -> Ordering) -> MaybeT f a -> Element (MaybeT f a) Source #

oelem :: Element (MaybeT f a) -> MaybeT f a -> Bool Source #

onotElem :: Element (MaybeT f a) -> MaybeT f a -> Bool Source #

Functor m => MonoFunctor (MaybeT m a) |
Instance details Defined in Data.MonoTraversable Methods omap :: (Element (MaybeT m a) -> Element (MaybeT m a)) -> MaybeT m a -> MaybeT m a Source #
Applicative f => MonoPointed (MaybeT f a) |
Instance details Defined in Data.MonoTraversable Methods opoint :: Element (MaybeT f a) -> MaybeT f a Source #
Traversable f => MonoTraversable (MaybeT f a) |
Instance details Defined in Data.MonoTraversable Methods otraverse :: Applicative f0 => (Element (MaybeT f a) -> f0 (Element (MaybeT f a))) -> MaybeT f a -> f0 (MaybeT f a) Source # omapM :: Applicative m => (Element (MaybeT f a) -> m (Element (MaybeT f a))) -> MaybeT f a -> m (MaybeT f a) Source #
t ~ MaybeT n b => Rewrapped (MaybeT m a) t |
Instance details Defined in Control.Lens.Wrapped
Lifting MonadIO MaybeT |
Instance details Defined in Data.Constraint.Lifting Methods lifting :: forall (a :: Type -> Type). MonadIO a :- MonadIO (MaybeT a) Source #
Lifting Eq1 MaybeT |
Instance details Defined in Data.Constraint.Lifting Methods lifting :: forall (a :: Type -> Type). Eq1 a :- Eq1 (MaybeT a) Source #
Lifting Ord1 MaybeT |
Instance details Defined in Data.Constraint.Lifting Methods lifting :: forall (a :: Type -> Type). Ord1 a :- Ord1 (MaybeT a) Source #
Lifting Read1 MaybeT |
Instance details Defined in Data.Constraint.Lifting Methods lifting :: forall (a :: Type -> Type). Read1 a :- Read1 (MaybeT a) Source #
Lifting Show1 MaybeT |
Instance details Defined in Data.Constraint.Lifting Methods lifting :: forall (a :: Type -> Type). Show1 a :- Show1 (MaybeT a) Source #
Lifting Functor MaybeT |
Instance details Defined in Data.Constraint.Lifting Methods lifting :: forall (a :: Type -> Type). Functor a :- Functor (MaybeT a) Source #
Lifting Monad MaybeT |
Instance details Defined in Data.Constraint.Lifting Methods lifting :: forall (a :: Type -> Type). Monad a :- Monad (MaybeT a) Source #
Lifting MonadPlus MaybeT |
Instance details Defined in Data.Constraint.Lifting Methods lifting :: forall (a :: Type -> Type). MonadPlus a :- MonadPlus (MaybeT a) Source #
Lifting Foldable MaybeT |
Instance details Defined in Data.Constraint.Lifting Methods lifting :: forall (a :: Type -> Type). Foldable a :- Foldable (MaybeT a) Source #
Lifting Traversable MaybeT |
Instance details Defined in Data.Constraint.Lifting Methods lifting :: forall (a :: Type -> Type). Traversable a :- Traversable (MaybeT a) Source #
Lifting MonadCont MaybeT |
Instance details Defined in Data.Constraint.Lifting Methods lifting :: forall (a :: Type -> Type). MonadCont a :- MonadCont (MaybeT a) Source #
Lifting (MonadError e :: (Type -> Type) -> Constraint) MaybeT |
Instance details Defined in Data.Constraint.Lifting Methods lifting :: forall (a :: Type -> Type). MonadError e a :- MonadError e (MaybeT a) Source #
Lifting (MonadReader r :: (Type -> Type) -> Constraint) MaybeT |
Instance details Defined in Data.Constraint.Lifting Methods lifting :: forall (a :: Type -> Type). MonadReader r a :- MonadReader r (MaybeT a) Source #
Lifting (MonadState s :: (Type -> Type) -> Constraint) MaybeT |
Instance details Defined in Data.Constraint.Lifting Methods lifting :: forall (a :: Type -> Type). MonadState s a :- MonadState s (MaybeT a) Source #
Lifting (MonadRWS r w s :: (Type -> Type) -> Constraint) MaybeT |
Instance details Defined in Data.Constraint.Lifting Methods lifting :: forall (a :: Type -> Type). MonadRWS r w s a :- MonadRWS r w s (MaybeT a) Source #
type Rep1 (MaybeT m :: Type -> Type) |
Instance details Defined in Control.Monad.Trans.Maybe type Rep1 (MaybeT m :: Type -> Type) = D1 ('MetaData "MaybeT" "Control.Monad.Trans.Maybe" "transformers-0.6.1.1-inplace" 'True) (C1 ('MetaCons "MaybeT" 'PrefixI 'True) (S1 ('MetaSel ('Just "runMaybeT") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (m :.: Rec1 Maybe)))
type Zoomed (MaybeT m) |
Instance details Defined in Control.Lens.Zoom type Zoomed (MaybeT m) = FocusingMay (Zoomed m)
type PrimState (MaybeT m) |
Instance details Defined in Control.Monad.Primitive type PrimState (MaybeT m) = PrimState m
type Rep (MaybeT m a) |
Instance details Defined in Control.Monad.Trans.Maybe type Rep (MaybeT m a) = D1 ('MetaData "MaybeT" "Control.Monad.Trans.Maybe" "transformers-0.6.1.1-inplace" 'True) (C1 ('MetaCons "MaybeT" 'PrefixI 'True) (S1 ('MetaSel ('Just "runMaybeT") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (m (Maybe a)))))
type Unwrapped (MaybeT m a) |
Instance details Defined in Control.Lens.Wrapped type Unwrapped (MaybeT m a) = m (Maybe a)
type Element (MaybeT m a) |
Instance details Defined in Data.MonoTraversable type Element (MaybeT m a) = a

hPutStrLn :: MonadIO m => Handle -> Text -> m () Source #

whenJust :: Monoid m => Maybe a -> (a -> m) -> m Source #