pregame-0.1.4.1: Prelude counterpart

Safe HaskellNone
LanguageHaskell2010

Pregame

Synopsis

Documentation

module Data.Char

module Data.Maybe

module Data.List

module Data.Tuple

module GHC.Base

module GHC.Enum

module GHC.Num

module GHC.Real

module GHC.Float

module GHC.Show

module System.IO

module Safe

module Safe.Exact

type Cont r = ContT r Identity

Continuation monad. Cont r a is a CPS computation that produces an intermediate result of type a within a CPS computation whose final result type is r.

The return function simply creates a continuation which passes the value on.

The >>= operator adds the bound function into the continuation chain.

data ContT r m a :: * -> (* -> *) -> * -> *

The continuation monad transformer. Can be used to add continuation handling to other monads.

Instances

MonadTrans (ContT r) 
Monad (ContT r m) 
Functor (ContT r m) 
Applicative (ContT r m) 
MonadIO m => MonadIO (ContT r m) 
Wrapped (ContT r m a) 
(~) * t (ContT r' m' a') => Rewrapped (ContT r m a) t 
type Unwrapped (ContT r m a) = (a -> m r) -> m r 

class Error a

An exception to be thrown.

Minimal complete definition: noMsg or strMsg.

Instances

Error IOException 
ErrorList a => Error [a]

A string can be thrown as an error.

data ErrorT e m a :: * -> (* -> *) -> * -> *

The error monad transformer. It can be used to add error handling to other monads.

The ErrorT Monad structure is parameterized over two things:

  • e - The error type.
  • m - The inner monad.

The return function yields a successful computation, while >>= sequences two subcomputations, failing on the first error.

Instances

Error e => MonadTrans (ErrorT e) 
(Functor m, Monad m, Error e) => Alternative (ErrorT e m) 
(Monad m, Error e) => Monad (ErrorT e m) 
Functor m => Functor (ErrorT e m) 
(MonadFix m, Error e) => MonadFix (ErrorT e m) 
(Monad m, Error e) => MonadPlus (ErrorT e m) 
(Functor m, Monad m) => Applicative (ErrorT e m) 
Foldable f => Foldable (ErrorT e f) 
Traversable f => Traversable (ErrorT e f) 
(Error e, MonadIO m) => MonadIO (ErrorT e m) 
(Eq e, Eq1 m) => Eq1 (ErrorT e m) 
(Ord e, Ord1 m) => Ord1 (ErrorT e m) 
(Read e, Read1 m) => Read1 (ErrorT e m) 
(Show e, Show1 m) => Show1 (ErrorT e m) 
(Eq e, Eq1 m, Eq a) => Eq (ErrorT e m a) 
(Ord e, Ord1 m, Ord a) => Ord (ErrorT e m a) 
(Read e, Read1 m, Read a) => Read (ErrorT e m a) 
(Show e, Show1 m, Show a) => Show (ErrorT e m a) 
Wrapped (ErrorT e m a) 
(~) * t (ErrorT e' m' a') => Rewrapped (ErrorT e m a) t 
type Zoomed (ErrorT e m) = FocusingErr e (Zoomed m) 
type Unwrapped (ErrorT e m a) = m (Either e a) 

data IdentityT m a :: (* -> *) -> * -> *

The trivial monad transformer, which maps a monad to an equivalent monad.

Instances

type State s = StateT s Identity

A state monad parameterized by the type s of the state to carry.

The return function leaves the state unchanged, while >>= uses the final state of the first computation as the initial state of the second.

data StateT s m a :: * -> (* -> *) -> * -> *

A state transformer monad parameterized by:

  • s - The state.
  • m - The inner monad.

The return function leaves the state unchanged, while >>= uses the final state of the first computation as the initial state of the second.

Instances

MonadTrans (StateT s) 
(Functor m, MonadPlus m) => Alternative (StateT s m) 
Monad m => Monad (StateT s m) 
Functor m => Functor (StateT s m) 
MonadFix m => MonadFix (StateT s m) 
MonadPlus m => MonadPlus (StateT s m) 
(Functor m, Monad m) => Applicative (StateT s m) 
MonadIO m => MonadIO (StateT s m) 
Wrapped (StateT s m a) 
(~) * t (StateT s' m' a') => Rewrapped (StateT s m a) t 
type Zoomed (StateT s z) = Focusing z 
type Unwrapped (StateT s m a) = s -> m (a, s) 

data ListT m a :: (* -> *) -> * -> *

Parameterizable list monad, with an inner monad.

Note: this does not yield a monad unless the argument monad is commutative.

Instances

MonadTrans ListT 
Applicative m => Alternative (ListT m) 
Monad m => Monad (ListT m) 
Functor m => Functor (ListT m) 
Monad m => MonadPlus (ListT m) 
Applicative m => Applicative (ListT m) 
Foldable f => Foldable (ListT f) 
Traversable f => Traversable (ListT f) 
MonadIO m => MonadIO (ListT m) 
Eq1 m => Eq1 (ListT m) 
Ord1 m => Ord1 (ListT m) 
Read1 m => Read1 (ListT m) 
Show1 m => Show1 (ListT m) 
(Eq1 m, Eq a) => Eq (ListT m a) 
(Ord1 m, Ord a) => Ord (ListT m a) 
(Read1 m, Read a) => Read (ListT m a) 
(Show1 m, Show a) => Show (ListT m a) 
Wrapped (ListT m a) 
(~) * t (ListT n b) => Rewrapped (ListT m a) t 
type Zoomed (ListT m) = FocusingOn [] (Zoomed m) 
type Unwrapped (ListT m a) = m [a] 

data MaybeT m a :: (* -> *) -> * -> *

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

Computations are actions that may produce a value or fail.

The return function yields a successful computation, while >>= sequences two subcomputations, failing on the first error.

Instances

MonadTrans MaybeT 
(Functor m, Monad m) => Alternative (MaybeT m) 
Monad m => Monad (MaybeT m) 
Functor m => Functor (MaybeT m) 
MonadFix m => MonadFix (MaybeT m) 
Monad m => MonadPlus (MaybeT m) 
(Functor m, Monad m) => Applicative (MaybeT m) 
Foldable f => Foldable (MaybeT f) 
Traversable f => Traversable (MaybeT f) 
MonadIO m => MonadIO (MaybeT m) 
Eq1 m => Eq1 (MaybeT m) 
Ord1 m => Ord1 (MaybeT m) 
Read1 m => Read1 (MaybeT m) 
Show1 m => Show1 (MaybeT m) 
(Eq1 m, Eq a) => Eq (MaybeT m a) 
(Ord1 m, Ord a) => Ord (MaybeT m a) 
(Read1 m, Read a) => Read (MaybeT m a) 
(Show1 m, Show a) => Show (MaybeT m a) 
Wrapped (MaybeT m a) 
(~) * t (MaybeT n b) => Rewrapped (MaybeT m a) t 
type Zoomed (MaybeT m) = FocusingMay (Zoomed m) 
type Unwrapped (MaybeT m a) = m (Maybe a) 

type Reader r = ReaderT r Identity

The parameterizable reader monad.

Computations are functions of a shared environment.

The return function ignores the environment, while >>= passes the inherited environment to both subcomputations.

data ReaderT r m a :: * -> (* -> *) -> * -> *

The reader monad transformer, which adds a read-only environment to the given monad.

The return function ignores the environment, while >>= passes the inherited environment to both subcomputations.

Instances

MonadTrans (ReaderT r) 
Alternative m => Alternative (ReaderT r m) 
Monad m => Monad (ReaderT r m) 
Functor m => Functor (ReaderT r m) 
MonadFix m => MonadFix (ReaderT r m) 
MonadPlus m => MonadPlus (ReaderT r m) 
Applicative m => Applicative (ReaderT r m) 
MonadIO m => MonadIO (ReaderT r m) 
Wrapped (ReaderT r m a) 
(~) * t (ReaderT r n b) => Rewrapped (ReaderT r m a) t 
type Zoomed (ReaderT e m) = Zoomed m 
type Magnified (ReaderT b m) = Effect m 
type Unwrapped (ReaderT r m a) = r -> m a 

type RWS r w s = RWST r w s Identity

A monad containing an environment of type r, output of type w and an updatable state of type s.

data RWST r w s m a :: * -> * -> * -> (* -> *) -> * -> *

A monad transformer adding reading an environment of type r, collecting an output of type w and updating a state of type s to an inner monad m.

Instances

Monoid w => MonadTrans (RWST r w s) 
(Monoid w, Functor m, MonadPlus m) => Alternative (RWST r w s m) 
(Monoid w, Monad m) => Monad (RWST r w s m) 
Functor m => Functor (RWST r w s m) 
(Monoid w, MonadFix m) => MonadFix (RWST r w s m) 
(Monoid w, MonadPlus m) => MonadPlus (RWST r w s m) 
(Monoid w, Functor m, Monad m) => Applicative (RWST r w s m) 
(Monoid w, MonadIO m) => MonadIO (RWST r w s m) 
Wrapped (RWST r w s m a) 
(~) * t (RWST r' w' s' m' a') => Rewrapped (RWST r w s m a) t 
type Zoomed (RWST r w s z) = FocusingWith w z 
type Magnified (RWST a w s m) = EffectRWS w s m 
type Unwrapped (RWST r w s m a) = r -> s -> m (a, s, w) 

type Writer w = WriterT w Identity

A writer monad parameterized by the type w of output to accumulate.

The return function produces the output mempty, while >>= combines the outputs of the subcomputations using mappend.

data WriterT w m a :: * -> (* -> *) -> * -> *

A writer monad parameterized by:

  • w - the output to accumulate.
  • m - The inner monad.

The return function produces the output mempty, while >>= combines the outputs of the subcomputations using mappend.

Instances

Monoid w => MonadTrans (WriterT w) 
(Monoid w, Alternative m) => Alternative (WriterT w m) 
(Monoid w, Monad m) => Monad (WriterT w m) 
Functor m => Functor (WriterT w m) 
(Monoid w, MonadFix m) => MonadFix (WriterT w m) 
(Monoid w, MonadPlus m) => MonadPlus (WriterT w m) 
(Monoid w, Applicative m) => Applicative (WriterT w m) 
Foldable f => Foldable (WriterT w f) 
Traversable f => Traversable (WriterT w f) 
(Monoid w, MonadIO m) => MonadIO (WriterT w m) 
(Eq w, Eq1 m) => Eq1 (WriterT w m) 
(Ord w, Ord1 m) => Ord1 (WriterT w m) 
(Read w, Read1 m) => Read1 (WriterT w m) 
(Show w, Show1 m) => Show1 (WriterT w m) 
(Eq w, Eq1 m, Eq a) => Eq (WriterT w m a) 
(Ord w, Ord1 m, Ord a) => Ord (WriterT w m a) 
(Read w, Read1 m, Read a) => Read (WriterT w m a) 
(Show w, Show1 m, Show a) => Show (WriterT w m a) 
Wrapped (WriterT w m a) 
(~) * t (WriterT w' m' a') => Rewrapped (WriterT w m a) t 
type Zoomed (WriterT w m) = FocusingPlus w (Zoomed m) 
type Unwrapped (WriterT w m a) = m (a, w) 

data Map k a :: * -> * -> *

A Map from keys k to values a.

Instances

Functor (Map k) 
Foldable (Map k) 
Traversable (Map k) 
(Eq k, Eq a) => Eq (Map k a) 
(Data k, Data a, Ord k) => Data (Map k a) 
(Ord k, Ord v) => Ord (Map k v) 
(Ord k, Read k, Read e) => Read (Map k e) 
(Show k, Show a) => Show (Map k a) 
Ord k => Monoid (Map k v) 
Default (Map k v) 
(NFData k, NFData a) => NFData (Map k a) 
Ord k => Semigroup (Map k v) 
Ord k => Ixed (Map k a) 
Ord k => At (Map k a) 
Ord k => Wrapped (Map k a) 
Typeable (* -> * -> *) Map 
((~) * t (Map k' a'), Ord k) => Rewrapped (Map k a) t

Use wrapping fromList. unwrapping returns a sorted list.

type Index (Map k a) = k 
type IxValue (Map k a) = a 
type Unwrapped (Map k a) = [(k, a)] 

data Seq a :: * -> *

General-purpose finite sequences.

Instances

Alternative Seq 
Monad Seq 
Functor Seq 
MonadPlus Seq 
Applicative Seq 
Foldable Seq 
Traversable Seq 
Eq a => Eq (Seq a) 
Data a => Data (Seq a) 
Ord a => Ord (Seq a) 
Read a => Read (Seq a) 
Show a => Show (Seq a) 
Monoid (Seq a) 
Default (Seq a) 
NFData a => NFData (Seq a) 
Semigroup (Seq a) 
Ixed (Seq a) 
Wrapped (Seq a) 
(~) * t (Seq a') => Rewrapped (Seq a) t 
Typeable (* -> *) Seq 
type Index (Seq a) = Int 
type IxValue (Seq a) = a 
type Unwrapped (Seq a) = [a] 

data Set a :: * -> *

A set of values a.

Instances

Foldable Set 
Eq a => Eq (Set a) 
(Data a, Ord a) => Data (Set a) 
Ord a => Ord (Set a) 
(Read a, Ord a) => Read (Set a) 
Show a => Show (Set a) 
Ord a => Monoid (Set a) 
Default (Set v) 
NFData a => NFData (Set a) 
Ord a => Semigroup (Set a) 
Ord a => Contains (Set a) 
Ord k => Ixed (Set k) 
Ord k => At (Set k) 
Ord a => Wrapped (Set a) 
((~) * t (Set a'), Ord a) => Rewrapped (Set a) t

Use wrapping fromList. unwrapping returns a sorted list.

Typeable (* -> *) Set 
type Index (Set a) = a 
type IxValue (Set k) = () 
type Unwrapped (Set a) = [a] 

data Text :: *

A space efficient, packed, unboxed Unicode text type.

Instances

IsList Text 
Eq Text 
Data Text

This instance preserves data abstraction at the cost of inefficiency. We omit reflection services for the sake of data abstraction.

This instance was created by copying the updated behavior of Data.Set.Set and Data.Map.Map. If you feel a mistake has been made, please feel free to submit improvements.

The original discussion is archived here: could we get a Data instance for Data.Text.Text?

The followup discussion that changed the behavior of Set and Map is archived here: Proposal: Allow gunfold for Data.Map, ...

Ord Text 
Read Text 
Show Text 
IsString Text 
Monoid Text 
NFData Text 
Semigroup Text 
Ixed Text 
Typeable * Text 
type Item Text = Char 
type Index Text = Int 
type IxValue Text = Char 

data Tree a :: * -> *

Multi-way trees, also known as rose trees.

Constructors

Node 

Fields

rootLabel :: a

label value

subForest :: Forest a

zero or more child trees

Instances

Monad Tree 
Functor Tree 
Applicative Tree 
Foldable Tree 
Traversable Tree 
Comonad Tree 
ComonadApply Tree 
Eq a => Eq (Tree a) 
Data a => Data (Tree a) 
Read a => Read (Tree a) 
Show a => Show (Tree a) 
Default a => Default (Tree a) 
NFData a => NFData (Tree a) 
Ixed (Tree a) 
Typeable (* -> *) Tree 
type Index (Tree a) = [Int] 
type IxValue (Tree a) = a 

type Forest a = [Tree a]

data ByteString :: *

A space-efficient representation of a Word8 vector, supporting many efficient operations.

A ByteString contains 8-bit bytes, or by using the operations from Data.ByteString.Char8 it can be interpreted as containing 8-bit characters.

data Vector a :: * -> *

Boxed vectors, supporting efficient slicing.

Instances

Alternative Vector 
Monad Vector 
Functor Vector 
MonadPlus Vector 
Applicative Vector 
Foldable Vector 
Traversable Vector 
Vector Vector a 
IsList (Vector a) 
Eq a => Eq (Vector a) 
Data a => Data (Vector a) 
Ord a => Ord (Vector a) 
Read a => Read (Vector a) 
Show a => Show (Vector a) 
Monoid (Vector a) 
NFData a => NFData (Vector a) 
Ixed (Vector a) 
Wrapped (Vector a) 
(~) * t (Vector a') => Rewrapped (Vector a) t 
Typeable (* -> *) Vector 
type Mutable Vector = MVector 
type Item (Vector a) = a 
type Index (Vector a) = Int 
type IxValue (Vector a) = a 
type Unwrapped (Vector a) = [a] 

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

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

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

done :: Monad m => m () Source

eq :: Eq a => a -> a -> Bool Source

ne :: Eq a => a -> a -> Bool Source

lt :: Ord a => a -> a -> Bool Source

lte :: Ord a => a -> a -> Bool Source

gt :: Ord a => a -> a -> Bool Source

gte :: Ord a => a -> a -> Bool Source