Modulerebase-1.21.2Haskell2010
Rebase.Prelude
This module reexports the non-conflicting definitions from the modules exported by this package, providing a much more featureful alternative to the standard Prelude.
For details check out the source.
- 64 types
- 28 classes
- 251 values
- Packagerebase-1.21.2
- Exports345
- LanguageHaskell2010
- LicenceMIT
- SourcePrelude.hs
module Rebase.Control.Applicative
module Rebase.Control.Category
module Rebase.Control.Comonad
module Rebase.Control.Concurrent
module Rebase.Control.DeepSeq
module Rebase.Control.Exception
module Rebase.Control.Monad
module Rebase.Control.Monad.Cont.Class
module Rebase.Control.Monad.Error.Class
module Rebase.Control.Monad.Fail
module Rebase.Control.Monad.Fix
module Rebase.Control.Monad.IO.Class
module Rebase.Control.Monad.Reader.Class
module Rebase.Control.Monad.ST
module Rebase.Control.Monad.State.Class
module Rebase.Control.Monad.Trans.Class
module Rebase.Control.Monad.Writer.Class
module Rebase.Data.Bifunctor
module Rebase.Data.Bifunctor.Apply
module Rebase.Data.Bits
module Rebase.Data.Bool
module Rebase.Data.Char
module Rebase.Data.Coerce
module Rebase.Data.Complex
module Rebase.Data.Data
module Rebase.Data.Dynamic
module Rebase.Data.Either
module Rebase.Data.Fixed
module Rebase.Data.Functor.Classes
module Rebase.Data.Functor.Compose
module Rebase.Data.Functor.Contravariant
module Rebase.Data.Functor.Contravariant.Divisible
module Rebase.Data.Functor.Extend
module Rebase.Data.Functor.Identity
module Rebase.Data.Functor.Invariant
module Rebase.Data.Group
module Rebase.Data.Groupoid
module Rebase.Data.Hashable
module Rebase.Data.IORef
module Rebase.Data.Int
module Rebase.Data.Ix
module Rebase.Data.List
module Rebase.Data.Maybe
module Rebase.Data.Ord
module Rebase.Data.Profunctor.Adjunction
module Rebase.Data.Profunctor.Cayley
module Rebase.Data.Profunctor.Choice
module Rebase.Data.Profunctor.Closed
module Rebase.Data.Profunctor.Composition
module Rebase.Data.Profunctor.Mapping
module Rebase.Data.Profunctor.Monad
module Rebase.Data.Profunctor.Ran
module Rebase.Data.Profunctor.Rep
module Rebase.Data.Profunctor.Sieve
module Rebase.Data.Profunctor.Strong
module Rebase.Data.Profunctor.Traversing
module Rebase.Data.Profunctor.Unsafe
module Rebase.Data.Profunctor.Yoneda
module Rebase.Data.Proxy
module Rebase.Data.Ratio
module Rebase.Data.STRef
module Rebase.Data.Semigroup
module Rebase.Data.Semigroup.Bifoldable
module Rebase.Data.Semigroup.Bitraversable
module Rebase.Data.Semigroup.Foldable
module Rebase.Data.Semigroup.Traversable
module Rebase.Data.Semigroupoid
module Rebase.Data.String
module Rebase.Data.Time
module Rebase.Data.Time.Clock.POSIX
module Rebase.Data.Time.Clock.System
module Rebase.Data.Traversable
module Rebase.Data.Tuple
module Rebase.Data.Unique
module Rebase.Data.Vector.Instances
module Rebase.Data.Version
module Rebase.Data.Void
module Rebase.Data.Void.Unsafe
module Rebase.Data.Word
module Rebase.Debug.Trace
module Rebase.Foreign.ForeignPtr
module Rebase.Foreign.Ptr
module Rebase.Foreign.StablePtr
module Rebase.Foreign.Storable
module Rebase.GHC.IO.Exception
module Rebase.GHC.OverloadedLabels
module Rebase.GHC.Records
module Rebase.Numeric
module Rebase.Numeric.Natural
module Rebase.System.Environment
module Rebase.System.Exit
module Rebase.System.IO.Error
module Rebase.System.IO.Unsafe
module Rebase.System.Mem
module Rebase.System.Mem.StableName
module Rebase.System.Timeout
module Rebase.Unsafe.Coerce
The basic arrow class.
Instances should satisfy the following laws:
arr id = idarr (f >>> g) = arr f >>> arr gfirst (arr f) = arr (first f)first (f >>> g) = first f >>> first gfirst f >>> arr fst = arr fst >>> ffirst f >>> arr (id *** g) = arr (id *** g) >>> first ffirst (first f) >>> arr assoc = arr assoc >>> first f
where
assoc ((a,b),c) = (a,(b,c))The other combinators have sensible default definitions, which may be overridden for efficiency.
Methods
arr :: (b -> c) -> a b cLift a function to an arrow.
(***) :: a b c -> a b' c' -> a (b, b') (c, c')infixr 3Split the input between the two argument arrows and combine their output. Note that this is in general not a functor.
The default definition may be overridden with a more efficient version if desired.
(&&&) :: a b c -> a b c' -> a b (c, c')infixr 3Fanout: send the input to both argument arrows and combine their output.
The default definition may be overridden with a more efficient version if desired.
Instances11Arrow, …
Applicative f => Arrow (Static f)Defined in semigroupoids-6.0.1 · Data.Semigroupoid.StaticMonad m => Arrow (Kleisli m)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowArrow p => Arrow (Closure p)Defined in profunctors-5.6.3 · Data.Profunctor.ClosedArrow p => Arrow (Tambara p)Defined in profunctors-5.6.3 · Data.Profunctor.StrongComonad w => Arrow (Cokleisli w)Defined in comonad-5.0.9 · Control.ComonadArrow (->)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowArrow p => Arrow (WrappedProfunctor p)Defined in invariant-0.6.4 · Data.Functor.InvariantArrow p => Arrow (WrappedArrow p)Defined in profunctors-5.6.3 · Data.Profunctor.Types(Arrow p, Arrow q) => Arrow (Product p q)Defined in bifunctors-5.6.2 · Data.Bifunctor.Product(Applicative f, Arrow p) => Arrow (Tannen f p)Defined in bifunctors-5.6.2 · Data.Bifunctor.Tannen(Applicative f, Arrow p) => Arrow (Cayley f p)Defined in profunctors-5.6.3 · Data.Profunctor.Cayley
A monad supporting atomic memory transactions.
Instances20Monad, Functor, MonadFix, Applicative, Alternative, MonadPlus, …
Monad STMDefined in ghc-internal-9.1003.0 · GHC.Internal.Conc.SyncFunctor STMDefined in ghc-internal-9.1003.0 · GHC.Internal.Conc.SyncMonadFix STMDefined in stm-2.5.3.1 · Control.Monad.STM · orphanApplicative STMDefined in ghc-internal-9.1003.0 · GHC.Internal.Conc.SyncAlternative STMDefined in ghc-internal-9.1003.0 · GHC.Internal.Conc.SyncMonadPlus STMDefined in ghc-internal-9.1003.0 · GHC.Internal.Conc.SyncMonadCatch STMDefined in exceptions-0.10.9 · Control.Monad.CatchMonadThrow STMDefined in exceptions-0.10.9 · Control.Monad.CatchInvariant STMDefined in invariant-0.6.4 · Data.Functor.Invariantfrom the
stmpackageSelective STMDefined in selective-0.7.0.1 · Control.SelectivePointed STMDefined in pointed-5.0.4 · Data.PointedMonadBase STM STMDefined in transformers-base-0.4.6 · Control.Monad.BaseMArray TArray e STMDefined in stm-2.5.3.1 · Control.Concurrent.STM.TArraySemigroup a => Semigroup (STM a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Conc.SyncMonoid a => Monoid (STM a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Conc.SyncRandomGen g => StatefulGen (TGenM g) STMDefined in random-1.2.1.3 · System.Random.StatefulRandomGen g => FrozenGen (TGen g) STMDefined in random-1.2.1.3 · System.Random.StatefulHasGetter (STM a) aDefined in StateVar-1.2.2 · Data.StateVarRandomGen r => RandomGenM (TGenM r) r STMDefined in random-1.2.1.3 · System.Random.Statefultype MutableGen (TGen g) STM = TGenM gDefined in random-1.2.1.3 · System.Random.Stateful
TBQueue is an abstract type representing a bounded FIFO channel.
TChan is an abstract type representing an unbounded FIFO channel.
A TMVar is a synchronising variable, used for communication between concurrent threads. It can be thought of as a box, which may be empty or full.
TQueue is an abstract type representing an unbounded FIFO channel.
Shared memory locations that support atomic memory transactions.
Continuation monad.
Cont r a is a CPS ("continuation-passing style") 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.
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.
Selective applicative functors. You can think of select as a selective
function application: when given a value of type Left a, you must apply
the given function, but when given a Right b, you may skip the
function and associated effects, and simply return the b.
Note that it is not a requirement for selective functors to skip unnecessary effects. It may be counterintuitive, but this makes them more useful. Why? Typically, when executing a selective computation, you would want to skip the effects (saving work); but on the other hand, if your goal is to statically analyse a given selective computation and extract the set of all possible effects (without actually executing them), then you do not want to skip any effects, because that defeats the purpose of static analysis.
The type signature of select is reminiscent of both <*> and >>=, and indeed a selective functor is in some sense a composition of an applicative functor and the Either monad.
Laws:
Identity:
x <*? pure id = either id id <$> x
Distributivity; note that
yandzhave the same typef (a -> b):
pure x <*? (y *> z) = (pure x <*? y) *> (pure x <*? z)
Associativity:
x <*? (y <*? z) = (f <$> x) <*? (g <$> y) <*? (h <$> z)
where
f x = Right <$> x
g y = a -> bimap (,a) ($a) y
h z = uncurry z
Monadic select (for selective functors that are also monads):
select = selectM
There are also a few useful theorems:
Apply a pure function to the result:
f <$> select x y = select (fmap f <$> x) (fmap f <$> y)
Apply a pure function to the
Leftcase of the first argument:
select (first f <$> x) y = select x ((. f) <$> y)
Apply a pure function to the second argument:
select x (f <$> y) = select (first (flip f) <$> x) ((&) <$> y)
Generalised identity:
x <*? pure y = either y id <$> x
A selective functor is rigid if it satisfies <*>
=apS. The following interchange law holds for rigid selective functors:
x *> (y <*? z) = (x *> y) <*? z
If f is also a Monad, we require that select = selectM, from which one
can prove <*> = apS.
Instances37Selective, …
Selective NonEmptyDefined in selective-0.7.0.1 · Control.SelectiveSelective STMDefined in selective-0.7.0.1 · Control.SelectiveSelective IdentityDefined in selective-0.7.0.1 · Control.SelectiveSelective ZipListDefined in selective-0.7.0.1 · Control.SelectiveSelective MaybeDefined in selective-0.7.0.1 · Control.SelectiveSelective IODefined in selective-0.7.0.1 · Control.SelectiveSelective []Defined in selective-0.7.0.1 · Control.SelectiveApplicative f => Selective (SelectA f)Defined in selective-0.7.0.1 · Control.SelectiveFunctor f => Selective (Select f)Defined in selective-0.7.0.1 · Control.Selective.Rigid.FreeMonad f => Selective (SelectM f)Defined in selective-0.7.0.1 · Control.SelectiveMonad m => Selective (MaybeT m)Defined in selective-0.7.0.1 · Control.SelectiveMonoid a => Selective (Tuple2 a)Defined in selective-0.7.0.1 · Control.SelectiveMonoid m => Selective (Over m)Defined in selective-0.7.0.1 · Control.SelectiveMonoid m => Selective (Under m)Defined in selective-0.7.0.1 · Control.SelectiveSemigroup e => Selective (Validation e)Defined in selective-0.7.0.1 · Control.SelectiveArrowChoice a => Selective (ArrowMonad a)Defined in selective-0.7.0.1 · Control.SelectiveSelective ProxyDefined in selective-0.7.0.1 · Control.SelectiveSelective (Either e)Defined in selective-0.7.0.1 · Control.SelectiveSelective (ST s)Defined in selective-0.7.0.1 · Control.SelectiveSelective (Select f)Defined in selective-0.7.0.1 · Control.Selective.FreeSelective (Select f)Defined in selective-0.7.0.1 · Control.Selective.Rigid.FreerSelective f => Selective (Lift f)Defined in selective-0.7.0.1 · Control.SelectiveMonad m => Selective (StateT s m)Defined in selective-0.7.0.1 · Control.SelectiveMonad m => Selective (StateT s m)Defined in selective-0.7.0.1 · Control.SelectiveSelective f => Selective (ComposeEither f e)Defined in selective-0.7.0.1 · Control.SelectiveSelective f => Selective (ExceptT e f)Defined in selective-0.7.0.1 · Control.Selective.Trans.ExceptSelective f => Selective (IdentityT f)Defined in selective-0.7.0.1 · Control.SelectiveSelective f => Selective (ReaderT env f)Defined in selective-0.7.0.1 · Control.Selective(Monoid w, Selective f) => Selective (WriterT w f)Defined in selective-0.7.0.1 · Control.Selective(Monoid w, Selective f) => Selective (WriterT w f)Defined in selective-0.7.0.1 · Control.Selective(Selective f, Applicative g, Traversable g) => Selective (ComposeTraversable f g)Defined in selective-0.7.0.1 · Control.SelectiveSelective (ContT r m)Defined in selective-0.7.0.1 · Control.SelectiveSelective ((->) a)Defined in selective-0.7.0.1 · Control.Selective(Selective f, Selective g) => Selective (Product f g)Defined in selective-0.7.0.1 · Control.Selective(Applicative f, Selective g) => Selective (Compose f g)Defined in selective-0.7.0.1 · Control.Selective(Monoid w, Monad m) => Selective (RWST r w s m)Defined in selective-0.7.0.1 · Control.Selective(Monoid w, Monad m) => Selective (RWST r w s m)Defined in selective-0.7.0.1 · Control.Selective
A strong lax semi-monoidal endofunctor. This is equivalent to an Applicative without pure.
Laws:
(.) <$> u <.> v <.> w = u <.> (v <.> w)
x <.> (f <$> y) = (. f) <$> x <.> y
f <$> (x <.> y) = (f .) <$> x <.> y
The laws imply that .> and <. really ignore their left and right results, respectively, and really return their right and left results, respectively. Specifically,
(mf <$> m) .> (nf <$> n) = nf <$> (m .> n)
(mf <$> m) <. (nf <$> n) = mf <$> (m <. n)
Instances96Apply, …
Apply ComplexDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply FirstDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply LastDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply MaxDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply MinDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply IntMapDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassAn IntMap is not Applicative, but it is an instance of Apply
Apply SeqDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply TreeDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply NonEmptyDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply IdentityDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply FirstDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply LastDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply DownDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply DualDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply ProductDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply SumDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply ZipListDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply Par1Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply MaybeDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply IODefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply QDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply VectorDefined in vector-instances-3.4.2 · Data.Vector.Instances · orphanApply []Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassRepresentable f => Apply (Co f)Defined in adjunctions-4.4.3 · Data.Functor.RepApplicative f => Apply (WrappedApplicative f)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassFunctor f => Apply (Free f)Defined in free-5.2 · Control.Monad.FreeMonad m => Apply (WrappedMonad m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassMonad m => Apply (IterT m)Defined in free-5.2 · Control.Monad.Trans.IterSemigroup e => Apply (Validation e)Defined in either-5.0.3 · Data.Either.ValidationSemigroup m => Apply (Tuple2 m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassA
is not Applicative unless its(,)mmis a Monoid, but it is an instance of ApplyOrd k => Apply (Map k)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassA 'Map k' is not Applicative, but it is an instance of Apply
Apply ProxyDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply U1Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply V1Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassA V1 is not Applicative, but it is an instance of Apply
Apply (Alt f)Defined in free-5.2 · Control.Alternative.FreeApply (Alt f)Defined in free-5.2 · Control.Alternative.Free.FinalApply (Ap f)Defined in free-5.2 · Control.Applicative.FreeApply (Ap f)Defined in free-5.2 · Control.Applicative.Free.FastApply (Ap f)Defined in free-5.2 · Control.Applicative.Free.FinalApply (F f)Defined in free-5.2 · Control.Monad.Free.ChurchApply (Either a)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply f => Apply (Cofree f)Defined in free-5.2 · Control.Comonad.CofreeApply f => Apply (Free f)Defined in free-5.2 · Control.Monad.Free.ApApply f => Apply (Coyoneda f)Defined in kan-extensions-5.2.7 · Data.Functor.CoyonedaApply f => Apply (Yoneda f)Defined in kan-extensions-5.2.7 · Data.Functor.YonedaApply f => Apply (MaybeApply f)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply f => Apply (Lift f)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.Class(Functor m, Monad m) => Apply (MaybeT m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.Class(Hashable k, Eq k) => Apply (HashMap k)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassA 'HashMap k' is not Applicative, but it is an instance of Apply
Applicative g => Apply (ApF f g)Defined in free-5.2 · Control.Applicative.Trans.FreeApplicative g => Apply (ApT f g)Defined in free-5.2 · Control.Applicative.Trans.FreeSemigroup f => Apply (Constant f)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassA
Constant fis not Applicative unless itsfis a Monoid, but it is an instance of ApplySemigroup m => Apply (Const m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassA
Const mis not Applicative unless itsmis a Monoid, but it is an instance of ApplyArrow a => Apply (WrappedArrow a b)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply (FT f m)Defined in free-5.2 · Control.Monad.Trans.Free.ChurchApply (Tagged a)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply f => Apply (Alt f)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply f => Apply (Rec1 f)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply f => Apply (Density f)Defined in kan-extensions-5.2.7 · Control.Comonad.DensityApply f => Apply (Static f a)Defined in semigroupoids-6.0.1 · Data.Semigroupoid.StaticApply f => Apply (Backwards f)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply f => Apply (Reverse f)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply m => Apply (ReaderT e m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply w => Apply (TracedT m w)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply w => Apply (IdentityT w)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBiapply p => Apply (Join p)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind m => Apply (StateT s m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind m => Apply (StateT s m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind m => Apply (WriterT w m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.Class(Representable f, Apply m) => Apply (ReaderT f m)Defined in adjunctions-4.4.3 · Control.Monad.Representable.Reader(Representable g, Bind m) => Apply (StateT g m)Defined in adjunctions-4.4.3 · Control.Monad.Representable.State(Functor f, Monad m) => Apply (FreeT f m)Defined in free-5.2 · Control.Monad.Trans.Free(Functor g, g ~ h) => Apply (Curried g h)Defined in kan-extensions-5.2.7 · Data.Functor.Day.Curried(Functor m, Monad m) => Apply (ExceptT e m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.Class(Semigroup e, Apply w) => Apply (EnvT e w)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassAn
EnvT e wis not Applicative unless itseis a Monoid, but it is an instance of Apply(Apply f, Apply m) => Apply (FreeT f m)Defined in free-5.2 · Control.Monad.Trans.Free.Ap(Apply m, Semigroup w) => Apply (WriterT w m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassA
WriterT w mis not Applicative unless itswis a Monoid, but it is an instance of Apply(Apply m, Semigroup w) => Apply (WriterT w m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassA
WriterT w mis not Applicative unless itswis a Monoid, but it is an instance of Apply(Apply w, Semigroup (Rep g), Representable g) => Apply (StoreT g w)Defined in adjunctions-4.4.3 · Control.Comonad.Representable.Store(Apply w, Semigroup s) => Apply (StoreT s w)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassA
StoreT s wis not Applicative unless itssis a Monoid, but it is an instance of ApplyComonad w => Apply (ContsT r w m)Defined in adjunctions-4.4.3 · Control.Monad.Trans.ContsSemigroup c => Apply (K1 i c)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassA
K1 i cis not Applicative unless itscis a Monoid, but it is an instance of ApplyApply (Cokleisli w a)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply (Codensity f)Defined in kan-extensions-5.2.7 · Control.Monad.CodensityApply (ContT r m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply ((->) m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassExtend w => Apply (CoT w m)Defined in kan-extensions-5.2.7 · Control.Monad.Co(Functor g, Apply h) => Apply (Lan g h)Defined in kan-extensions-5.2.7 · Data.Functor.Kan.Lan(Apply f, Apply g) => Apply (Product f g)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.Class(Apply f, Apply g) => Apply (f :*: g)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply f => Apply (M1 i t f)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind m => Apply (RWST r w s m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.Class(Apply f, Apply g) => Apply (Compose f g)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.Class(Apply f, Apply g) => Apply (f :.: g)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.Class(Bind m, Semigroup w) => Apply (RWST r w s m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassAn
RWST r w s mis not Applicative unless itswis a Monoid, but it is an instance of Apply(Bind m, Semigroup w) => Apply (RWST r w s m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassAn
RWST r w s mis not Applicative unless itswis a Monoid, but it is an instance of Apply
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.
Instances14IsList, Eq, Data, Ord, Read, Show, …
IsList ByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Internal.TypeEq ByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Internal.TypeData ByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Internal.TypeOrd ByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Internal.TypeRead ByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Internal.TypeShow ByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Internal.TypeIsString ByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Internal.TypeBeware: fromString truncates multi-byte characters to octets. e.g. "枯朶に烏のとまりけり秋の暮" becomes �6k�nh~�Q��n�
Semigroup ByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Internal.TypeMonoid ByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Internal.TypeNFData ByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Internal.TypeBinary ByteStringDefined in binary-0.8.9.3 · Data.Binary.ClassHashable ByteStringDefined in hashable-1.4.7.0 · Data.Hashable.ClassLift ByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Internal.Typetype Item ByteString = Word8Defined in bytestring-0.12.2.0 · Data.ByteString.Internal.Type
An arbitrary-precision number represented using scientific notation.
This type describes the set of all Reals which have a finite
decimal expansion.
A scientific number with coefficient c and base10Exponent e
corresponds to the Fractional number: fromInteger c * 10 ^^ e
Instances13Eq, Fractional, Data, Num, Ord, Read, …
Eq ScientificDefined in scientific-0.3.8.0 · Data.ScientificScientific numbers can be safely compared for equality. No magnitude
10^eis calculated so there's no risk of a blowup in space or time when comparing scientific numbers coming from untrusted sources.Fractional ScientificDefined in scientific-0.3.8.0 · Data.ScientificWARNING: recip and / will throw an error when their outputs are repeating decimals.
These methods also compute Integer magnitudes (
10^e). If these methods are applied to arguments which have huge exponents this could fill up all space and crash your program! So don't apply these methods to scientific numbers coming from untrusted sources.fromRational will throw an error when the input Rational is a repeating decimal. Consider using fromRationalRepetend for these rationals which will detect the repetition and indicate where it starts.
Data ScientificDefined in scientific-0.3.8.0 · Data.ScientificNum ScientificDefined in scientific-0.3.8.0 · Data.ScientificWARNING: + and - compute the Integer magnitude:
10^ewhereeis the difference between thebase10Exponentsof the arguments. If these methods are applied to arguments which have huge exponents this could fill up all space and crash your program! So don't apply these methods to scientific numbers coming from untrusted sources. The other methods can be used safely.Ord ScientificDefined in scientific-0.3.8.0 · Data.ScientificScientific numbers can be safely compared for ordering. No magnitude
10^eis calculated so there's no risk of a blowup in space or time when comparing scientific numbers coming from untrusted sources.Read ScientificDefined in scientific-0.3.8.0 · Data.ScientificSupports the skipping of parentheses and whitespaces. Example:
> read " ( (( -1.0e+3 ) ))" :: Scientific -1000.0(Note: This
Readinstance makes internal use of scientificP to parse the floating-point number.)Real ScientificDefined in scientific-0.3.8.0 · Data.ScientificWARNING: toRational needs to compute the Integer magnitude:
10^e. If applied to a huge exponent this could fill up all space and crash your program!Avoid applying toRational (or realToFrac) to scientific numbers coming from an untrusted source and use toRealFloat instead. The latter guards against excessive space usage.
RealFrac ScientificDefined in scientific-0.3.8.0 · Data.ScientificWARNING: the methods of the
RealFracinstance need to compute the magnitude10^e. If applied to a huge exponent this could take a long time. Even worse, when the destination type is unbounded (i.e. Integer) it could fill up all space and crash your program!Show ScientificDefined in scientific-0.3.8.0 · Data.ScientificSee formatScientific if you need more control over the rendering.
NFData ScientificDefined in scientific-0.3.8.0 · Data.ScientificBinary ScientificDefined in scientific-0.3.8.0 · Data.ScientificNote that in the future I intend to change the type of the base10Exponent from
InttoInteger. To be forward compatible theBinaryinstance already encodes the exponent as Integer.Hashable ScientificDefined in scientific-0.3.8.0 · Data.ScientificA hash can be safely calculated from a
Scientific. No magnitude10^eis calculated so there's no risk of a blowup in space or time when hashing scientific numbers coming from untrusted sources.Example4 expressions import Data.Hashable (hash)let x = scientific 1 2let y = scientific 100 0(x == y, hash x == hash y)(True,True)
Lift ScientificDefined in scientific-0.3.8.0 · Data.Scientific
Instances18Monad, Functor, MonadFail, Applicative, Foldable, Traversable, …
Monad DListDefined in dlist-1.0 · Data.DList.InternalFunctor DListDefined in dlist-1.0 · Data.DList.InternalMonadFail DListDefined in dlist-1.0 · Data.DList.InternalApplicative DListDefined in dlist-1.0 · Data.DList.InternalFoldable DListDefined in dlist-1.0 · Data.DList.InternalTraversable DListDefined in dlist-1.0 · Data.DList.InternalAlternative DListDefined in dlist-1.0 · Data.DList.InternalMonadPlus DListDefined in dlist-1.0 · Data.DList.InternalIsList (DList a)Defined in dlist-1.0 · Data.DList.InternalEq a => Eq (DList a)Defined in dlist-1.0 · Data.DList.InternalOrd a => Ord (DList a)Defined in dlist-1.0 · Data.DList.InternalRead a => Read (DList a)Defined in dlist-1.0 · Data.DList.InternalShow a => Show (DList a)Defined in dlist-1.0 · Data.DList.Internala ~ Char => IsString (DList a)Defined in dlist-1.0 · Data.DList.InternalSemigroup (DList a)Defined in dlist-1.0 · Data.DList.InternalMonoid (DList a)Defined in dlist-1.0 · Data.DList.InternalNFData a => NFData (DList a)Defined in dlist-1.0 · Data.DList.Internaltype Item (DList a) = aDefined in dlist-1.0 · Data.DList.Internal
Selective instance for the standard applicative functor Validation. This is a good example of a non-trivial selective functor which is not a monad.
Instances6Functor, Applicative, Selective, Eq, Ord, Show
Functor (Validation e)Defined in selective-0.7.0.1 · Control.SelectiveSemigroup e => Applicative (Validation e)Defined in selective-0.7.0.1 · Control.SelectiveSemigroup e => Selective (Validation e)Defined in selective-0.7.0.1 · Control.Selective(Eq e, Eq a) => Eq (Validation e a)Defined in selective-0.7.0.1 · Control.Selective(Ord e, Ord a) => Ord (Validation e a)Defined in selective-0.7.0.1 · Control.Selective(Show e, Show a) => Show (Validation e a)Defined in selective-0.7.0.1 · Control.Selective
The Eq class defines equality (==) and inequality (/=). All the basic datatypes exported by the Prelude are instances of Eq, and Eq may be derived for any datatype whose constituents are also instances of Eq.
The Haskell Report defines no laws for Eq. However, instances are encouraged to follow these properties:
Instances449Eq, …
Eq ByteArrayDefined in base-4.20.2.0 · Data.Array.ByteEq TimeoutDefined in base-4.20.2.0 · System.TimeoutEq BiFunDefined in bifunctors-5.6.2 · Data.Bifunctor.THEq OptionsDefined in bifunctors-5.6.2 · Data.Bifunctor.THEq StarKindStatusDefined in bifunctors-5.6.2 · Data.Bifunctor.TH.InternalEq FloatingDecimalDefined in bytestring-0.12.2.0 · Data.ByteString.Builder.RealFloat.D2SEq FloatingDecimalDefined in bytestring-0.12.2.0 · Data.ByteString.Builder.RealFloat.F2SEq ByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Internal.TypeEq ByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Lazy.InternalEq ShortByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Short.InternalEq IntSetDefined in containers-0.7 · Data.IntSet.InternalEq BigNatDefined in ghc-bignum-1.3 · GHC.Num.BigNatEq IntegerDefined in ghc-bignum-1.3 · GHC.Num.IntegerEq NaturalDefined in ghc-bignum-1.3 · GHC.Num.NaturalEq ForeignSrcLangDefined in ghc-boot-th-9.10.3 · GHC.ForeignSrcLang.TypeEq ExtensionDefined in ghc-boot-th-9.10.3 · GHC.LanguageExtensions.TypeEq VoidDefined in ghc-internal-9.1003.0 · GHC.Internal.BaseEq ByteOrderDefined in ghc-internal-9.1003.0 · GHC.Internal.ByteOrderEq ClosureTypeDefined in ghc-internal-9.1003.0 · GHC.Internal.ClosureTypesEq BlockReasonDefined in ghc-internal-9.1003.0 · GHC.Internal.Conc.SyncEq ThreadIdDefined in ghc-internal-9.1003.0 · GHC.Internal.Conc.SyncEq ThreadStatusDefined in ghc-internal-9.1003.0 · GHC.Internal.Conc.SyncEq ConstrDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.DataEquality of constructors
Eq ConstrRepDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.DataEq DataRepDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.DataEq FixityDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.DataEq AllDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalEq AnyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalEq SomeTypeRepDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Typeable.InternalEq UniqueDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.UniqueEq VersionDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.VersionEq ControlMessageDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.ControlEq EPollFdDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.EPollEq EventTypeDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.EPollEq EventDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Internal.TypesEq EventLifetimeDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Internal.TypesEq LifetimeDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Internal.TypesEq FdKeyDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.ManagerEq StateDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.ManagerEq EventDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.PollEq TimeoutKeyDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.TimeOutEq StateDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.TimerManagerEq UniqueDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.UniqueEq ErrorCallDefined in ghc-internal-9.1003.0 · GHC.Internal.ExceptionEq ArithExceptionDefined in ghc-internal-9.1003.0 · GHC.Internal.Exception.TypeEq SpecConstrAnnotationDefined in ghc-internal-9.1003.0 · GHC.Internal.ExtsEq FingerprintDefined in ghc-internal-9.1003.0 · GHC.Internal.Fingerprint.TypeEq ErrnoDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.ErrorEq CBoolDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CClockDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CDoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CFloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CIntMaxDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CIntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CLLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CPtrdiffDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CSCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CSUSecondsDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CShortDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CSigAtomicDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CSizeDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CTimeDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CUCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CUIntMaxDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CUIntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CULLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CULongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CUSecondsDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CUShortDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CWcharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq IntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.PtrEq WordPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.PtrEq AssociativityDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsEq DecidedStrictnessDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsEq FixityDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsEq SourceStrictnessDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsEq SourceUnpackednessDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsEq MaskingStateDefined in ghc-internal-9.1003.0 · GHC.Internal.IOEq BufferStateDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.BufferEq IODeviceTypeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.DeviceEq SeekModeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.DeviceEq CodingProgressDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.Encoding.TypesEq ArrayExceptionDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.ExceptionEq AsyncExceptionDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.ExceptionEq ExitCodeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.ExceptionEq IOErrorTypeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.ExceptionEq IOExceptionDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.ExceptionEq HandlePosnDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.HandleEq BufferModeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.Handle.TypesEq HandleDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.Handle.TypesEq NewlineDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.Handle.TypesEq NewlineModeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.Handle.TypesEq IOModeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.IOModeEq InfoProvDefined in ghc-internal-9.1003.0 · GHC.Internal.InfoProv.TypesEq Int16Defined in ghc-internal-9.1003.0 · GHC.Internal.IntEq Int32Defined in ghc-internal-9.1003.0 · GHC.Internal.IntEq Int64Defined in ghc-internal-9.1003.0 · GHC.Internal.IntEq Int8Defined in ghc-internal-9.1003.0 · GHC.Internal.IntEq IoSubSystemDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsEq StackEntryDefined in ghc-internal-9.1003.0 · GHC.Internal.Stack.CloneStackEq SrcLocDefined in ghc-internal-9.1003.0 · GHC.Internal.Stack.TypesEq CBlkCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEq CBlkSizeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEq CCcDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEq CClockIdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEq CDevDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEq CFsBlkCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEq CFsFilCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEq CGidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEq CIdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEq CInoDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEq CKeyDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEq CModeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEq CNfdsDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEq CNlinkDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEq COffDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEq CPidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEq CRLimDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEq CSocklenDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEq CSpeedDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEq CSsizeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEq CTcflagDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEq CTimerDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEq CUidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEq FdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEq LexemeDefined in ghc-internal-9.1003.0 · GHC.Internal.Text.Read.LexEq NumberDefined in ghc-internal-9.1003.0 · GHC.Internal.Text.Read.LexEq SomeCharDefined in ghc-internal-9.1003.0 · GHC.Internal.TypeLitsEq SomeSymbolDefined in ghc-internal-9.1003.0 · GHC.Internal.TypeLitsEq SomeNatDefined in ghc-internal-9.1003.0 · GHC.Internal.TypeNatsEq GeneralCategoryDefined in ghc-internal-9.1003.0 · GHC.Internal.UnicodeEq Word16Defined in ghc-internal-9.1003.0 · GHC.Internal.WordEq Word32Defined in ghc-internal-9.1003.0 · GHC.Internal.WordEq Word64Defined in ghc-internal-9.1003.0 · GHC.Internal.WordEq Word8Defined in ghc-internal-9.1003.0 · GHC.Internal.WordEq BoolDefined in ghc-prim-0.12.0 · GHC.ClassesEq CharDefined in ghc-prim-0.12.0 · GHC.ClassesEq DoubleDefined in ghc-prim-0.12.0 · GHC.ClassesEq FloatDefined in ghc-prim-0.12.0 · GHC.ClassesEq IntDefined in ghc-prim-0.12.0 · GHC.ClassesEq ModuleDefined in ghc-prim-0.12.0 · GHC.ClassesEq OrderingDefined in ghc-prim-0.12.0 · GHC.ClassesEq TrNameDefined in ghc-prim-0.12.0 · GHC.ClassesEq TyConDefined in ghc-prim-0.12.0 · GHC.ClassesEq WordDefined in ghc-prim-0.12.0 · GHC.ClassesEq OptionsDefined in invariant-0.6.4 · Data.Functor.Invariant.THEq InvariantClassDefined in invariant-0.6.4 · Data.Functor.Invariant.TH.InternalEq StarKindStatusDefined in invariant-0.6.4 · Data.Functor.Invariant.TH.InternalEq EncodingExceptionDefined in os-string-2.0.7 · System.OsString.Encoding.InternalEq OsCharDefined in os-string-2.0.7 · System.OsString.Internal.TypesByte equality of the internal representation.
Eq OsStringDefined in os-string-2.0.7 · System.OsString.Internal.TypesByte equality of the internal representation.
Eq PosixCharDefined in os-string-2.0.7 · System.OsString.Internal.TypesEq PosixStringDefined in os-string-2.0.7 · System.OsString.Internal.TypesEq WindowsCharDefined in os-string-2.0.7 · System.OsString.Internal.TypesEq WindowsStringDefined in os-string-2.0.7 · System.OsString.Internal.TypesEq ModeDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJEq StyleDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJEq TextDetailsDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJEq PrettyLevelDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJClassEq DocDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJEq PrettyLevelDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClassEq CardinalityDefined in random-1.2.1.3 · System.Random.GFiniteEq StdGenDefined in random-1.2.1.3 · System.Random.InternalEq ScientificDefined in scientific-0.3.8.0 · Data.ScientificScientific numbers can be safely compared for equality. No magnitude
10^eis calculated so there's no risk of a blowup in space or time when comparing scientific numbers coming from untrusted sources.Eq TSemDefined in stm-2.5.3.1 · Control.Concurrent.STM.TSemEq AnnLookupDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq AnnTargetDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq BangDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq BndrVisDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq BodyDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq BytesDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq CallconvDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq ClauseDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq ConDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq DecDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq DecidedStrictnessDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq DerivClauseDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq DerivStrategyDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq DocLocDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq ExpDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq FamilyResultSigDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq FixityDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq FixityDirectionDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq ForeignDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq FunDepDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq GuardDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq InfoDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq InjectivityAnnDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq InlineDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq LitDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq LocDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq MatchDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq ModNameDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq ModuleDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq ModuleInfoDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq NameDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq NameFlavourDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq NameSpaceDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq NamespaceSpecifierDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq OccNameDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq OverlapDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq PatDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq PatSynArgsDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq PatSynDirDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq PhasesDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq PkgNameDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq PragmaDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq RangeDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq RoleDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq RuleBndrDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq RuleMatchDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq SafetyDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq SourceStrictnessDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq SourceUnpackednessDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq SpecificityDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq StmtDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq TyLitDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq TySynEqnDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq TypeDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq TypeFamilyHeadDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq UnicodeExceptionDefined in text-2.1.3 · Data.Text.Encoding.ErrorEq I8Defined in text-2.1.3 · Data.Text.ForeignEq TextDefined in text-2.1.3 · Data.Text · orphanEq BuilderDefined in text-2.1.3 · Data.Text.Internal.BuilderEq PartialUtf8CodePointDefined in text-2.1.3 · Data.Text.Internal.EncodingEq Utf8StateDefined in text-2.1.3 · Data.Text.Internal.EncodingEq DecoderStateDefined in text-2.1.3 · Data.Text.Internal.Encoding.Utf8Eq SizeDefined in text-2.1.3 · Data.Text.Internal.Fusion.SizeEq TextDefined in text-2.1.3 · Data.Text.Lazy · orphanEq ConstructorInfoDefined in th-abstraction-0.7.1.0 · Language.Haskell.TH.DatatypeEq ConstructorVariantDefined in th-abstraction-0.7.1.0 · Language.Haskell.TH.DatatypeEq DatatypeInfoDefined in th-abstraction-0.7.1.0 · Language.Haskell.TH.DatatypeEq DatatypeVariantDefined in th-abstraction-0.7.1.0 · Language.Haskell.TH.DatatypeEq FieldStrictnessDefined in th-abstraction-0.7.1.0 · Language.Haskell.TH.DatatypeEq StrictnessDefined in th-abstraction-0.7.1.0 · Language.Haskell.TH.DatatypeEq UnpackednessDefined in th-abstraction-0.7.1.0 · Language.Haskell.TH.DatatypeEq CalendarDiffDaysDefined in time-1.12.2 · Data.Time.Calendar.CalendarDiffDaysEq DayDefined in time-1.12.2 · Data.Time.Calendar.DaysEq MonthDefined in time-1.12.2 · Data.Time.Calendar.MonthEq QuarterDefined in time-1.12.2 · Data.Time.Calendar.QuarterEq QuarterOfYearDefined in time-1.12.2 · Data.Time.Calendar.QuarterEq DayOfWeekDefined in time-1.12.2 · Data.Time.Calendar.WeekEq FirstWeekTypeDefined in time-1.12.2 · Data.Time.Calendar.WeekDateEq AbsoluteTimeDefined in time-1.12.2 · Data.Time.Clock.Internal.AbsoluteTimeEq DiffTimeDefined in time-1.12.2 · Data.Time.Clock.Internal.DiffTimeEq NominalDiffTimeDefined in time-1.12.2 · Data.Time.Clock.Internal.NominalDiffTimeEq SystemTimeDefined in time-1.12.2 · Data.Time.Clock.Internal.SystemTimeEq UTCTimeDefined in time-1.12.2 · Data.Time.Clock.Internal.UTCTimeEq UniversalTimeDefined in time-1.12.2 · Data.Time.Clock.Internal.UniversalTimeEq TimeLocaleDefined in time-1.12.2 · Data.Time.Format.LocaleEq CalendarDiffTimeDefined in time-1.12.2 · Data.Time.LocalTime.Internal.CalendarDiffTimeEq LocalTimeDefined in time-1.12.2 · Data.Time.LocalTime.Internal.LocalTimeEq TimeOfDayDefined in time-1.12.2 · Data.Time.LocalTime.Internal.TimeOfDayEq TimeZoneDefined in time-1.12.2 · Data.Time.LocalTime.Internal.TimeZoneEq SubHashPathDefined in unordered-containers-0.2.21 · Data.HashMap.Internal.DebugEq UUIDDefined in uuid-types-1.0.6 · Data.UUID.Types.InternalEq UnpackedUUIDDefined in uuid-types-1.0.6 · Data.UUID.Types.InternalEq SizeDefined in vector-0.13.2.0 · Data.Vector.Fusion.Bundle.SizeEq ChecksDefined in vector-0.13.2.0 · Data.Vector.Internal.CheckEq ()Defined in ghc-prim-0.12.0 · GHC.ClassesEq (Chan a)Defined in base-4.20.2.0 · Control.Concurrent.ChanEq (MutableByteArray s)Defined in base-4.20.2.0 · Data.Array.ByteEq (TVar a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Conc.SyncEq (ConstPtr a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.ConstPtrEq (ForeignPtr a)Defined in ghc-internal-9.1003.0 · GHC.Internal.ForeignPtrEq (IOPort a)Defined in ghc-internal-9.1003.0 · GHC.Internal.IOPortEq (IORef a)Defined in ghc-internal-9.1003.0 · GHC.Internal.IORefPointer equality.
Eq (MVar a)Defined in ghc-internal-9.1003.0 · GHC.Internal.MVarCompares the underlying pointers.
Eq (FunPtr a)Defined in ghc-internal-9.1003.0 · GHC.Internal.PtrEq (Ptr a)Defined in ghc-internal-9.1003.0 · GHC.Internal.PtrEq (StablePtr a)Defined in ghc-internal-9.1003.0 · GHC.Internal.StableEq (StableName a)Defined in ghc-internal-9.1003.0 · GHC.Internal.StableNameEq (SChar c)Defined in ghc-internal-9.1003.0 · GHC.Internal.TypeLitsEq (SSymbol s)Defined in ghc-internal-9.1003.0 · GHC.Internal.TypeLitsEq (SNat n)Defined in ghc-internal-9.1003.0 · GHC.Internal.TypeNatsEq (Doc a)Defined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJEq (TBQueue a)Defined in stm-2.5.3.1 · Control.Concurrent.STM.TBQueueEq (TChan a)Defined in stm-2.5.3.1 · Control.Concurrent.STM.TChanEq (TMVar a)Defined in stm-2.5.3.1 · Control.Concurrent.STM.TMVarEq (TQueue a)Defined in stm-2.5.3.1 · Control.Concurrent.STM.TQueueEq (TVar a)Defined in stm-2.5.3.1 · Control.Sequential.STMEq a => Eq (Complex a)Defined in base-4.20.2.0 · Data.ComplexEq a => Eq (First a)Defined in base-4.20.2.0 · Data.SemigroupEq a => Eq (Last a)Defined in base-4.20.2.0 · Data.SemigroupEq a => Eq (Max a)Defined in base-4.20.2.0 · Data.SemigroupEq a => Eq (Min a)Defined in base-4.20.2.0 · Data.SemigroupEq a => Eq (IntMap a)Defined in containers-0.7 · Data.IntMap.InternalEq a => Eq (Seq a)Defined in containers-0.7 · Data.Sequence.InternalEq a => Eq (ViewL a)Defined in containers-0.7 · Data.Sequence.InternalEq a => Eq (ViewR a)Defined in containers-0.7 · Data.Sequence.InternalEq a => Eq (Intersection a)Defined in containers-0.7 · Data.Set.InternalEq a => Eq (Set a)Defined in containers-0.7 · Data.Set.InternalEq a => Eq (Tree a)Defined in containers-0.7 · Data.TreeEq a => Eq (DNonEmpty a)Defined in dlist-1.0 · Data.DList.DNonEmpty.InternalEq a => Eq (DList a)Defined in dlist-1.0 · Data.DList.InternalEq a => Eq (NonEmpty a)Defined in ghc-internal-9.1003.0 · GHC.Internal.BaseEq a => Eq (And a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsEq a => Eq (Iff a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsEq a => Eq (Ior a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsEq a => Eq (Xor a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsEq a => Eq (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityEq a => Eq (First a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidEq a => Eq (Last a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidEq a => Eq (Down a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.OrdEq a => Eq (Dual a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalEq a => Eq (Product a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalEq a => Eq (Sum a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalEq a => Eq (ZipList a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Functor.ZipListEq a => Eq (Maybe a)Defined in ghc-internal-9.1003.0 · GHC.Internal.MaybeEq a => Eq (Ratio a)Defined in ghc-internal-9.1003.0 · GHC.Internal.RealEq a => Eq (Hashed a)Defined in hashable-1.4.7.0 · Data.Hashable.ClassUses precomputed hash to detect inequality faster
Eq a => Eq (AnnotDetails a)Defined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJEq a => Eq (Span a)Defined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJEq a => Eq (Array a)Defined in primitive-0.9.1.0 · Data.Primitive.ArrayEq a => Eq (SmallArray a)Defined in primitive-0.9.1.0 · Data.Primitive.SmallArrayEq a => Eq (Stream a)Defined in text-2.1.3 · Data.Text.Internal.Fusion.TypesEq a => Eq (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.InternalNote that, in the presence of hash collisions, equal
HashSets may behave differently, i.e. extensionality may be violated:Example2 expressions data D = A | B deriving (Eq, Show)instance Hashable D where hashWithSalt salt _d = salt
Example2 expressions x = fromList [A, B]y = fromList [B, A]
Example3 expressions x == yTruetoList x[A,B]toList y[B,A]
In general, the lack of extensionality can be observed with any function that depends on the key ordering, such as folds and traversals.
Eq a => Eq (Vector a)Defined in vector-0.13.2.0 · Data.VectorEq a => Eq (Vector a)Defined in vector-0.13.2.0 · Data.Vector.StrictEq a => Eq (a)Defined in ghc-prim-0.12.0 · GHC.ClassesEq a => Eq [a]Defined in ghc-prim-0.12.0 · GHC.ClassesEq flag => Eq (TyVarBndr flag)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxEq g => Eq (StateGen g)Defined in random-1.2.1.3 · System.Random.InternalEq g => Eq (AtomicGen g)Defined in random-1.2.1.3 · System.Random.StatefulEq g => Eq (IOGen g)Defined in random-1.2.1.3 · System.Random.StatefulEq g => Eq (STGen g)Defined in random-1.2.1.3 · System.Random.StatefulEq g => Eq (TGen g)Defined in random-1.2.1.3 · System.Random.StatefulEq k => Eq (Error k)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal.DebugEq k => Eq (Validity k)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal.DebugEq m => Eq (WrappedMonoid m)Defined in base-4.20.2.0 · Data.SemigroupEq p => Eq (Par1 p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsEq vertex => Eq (SCC vertex)Defined in containers-0.7 · Data.Graph(Storable a, Eq a) => Eq (Vector a)Defined in vector-0.13.2.0 · Data.Vector.Storable(Eq a, Prim a) => Eq (PrimArray a)Defined in primitive-0.9.1.0 · Data.Primitive.PrimArray(Prim a, Eq a) => Eq (Vector a)Defined in vector-0.13.2.0 · Data.Vector.Primitive(Unbox a, Eq a) => Eq (Vector a)Defined in vector-0.13.2.0 · Data.Vector.Unboxed · orphanEq (IOUArray i e)Defined in array-0.5.8.0 · Data.Array.IO.InternalsEq (Fixed a)Defined in base-4.20.2.0 · Data.FixedEq (Proxy s)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.ProxyEq (TypeRep a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Typeable.InternalEq (U1 p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsEq (V1 p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsEq (IOArray i e)Defined in ghc-internal-9.1003.0 · GHC.Internal.IOArrayEq (STRef s a)Defined in ghc-internal-9.1003.0 · GHC.Internal.STRefPointer equality.
Eq (MutableArray s a)Defined in primitive-0.9.1.0 · Data.Primitive.ArrayEq (MVar s a)Defined in primitive-0.9.1.0 · Data.Primitive.MVarEq (MutVar s a)Defined in primitive-0.9.1.0 · Data.Primitive.MutVarEq (MutablePrimArray s a)Defined in primitive-0.9.1.0 · Data.Primitive.PrimArrayEq (PrimVar s a)Defined in primitive-0.9.1.0 · Data.Primitive.PrimVarEq (SmallMutableArray s a)Defined in primitive-0.9.1.0 · Data.Primitive.SmallArrayEq a => Eq (Arg a b)Defined in base-4.20.2.0 · Data.SemigroupEq m => Eq (Over m a)Defined in selective-0.7.0.1 · Control.SelectiveEq m => Eq (Under m a)Defined in selective-0.7.0.1 · Control.SelectiveEq m => Eq (Over m a)Defined in selective-0.7.0.1 · Control.Selective.MultiEq m => Eq (Under m a)Defined in selective-0.7.0.1 · Control.Selective.Multi(Eq1 f, Eq a) => Eq (Ap f a)Defined in free-5.2 · Control.Applicative.Free(Eq1 f, Eq a) => Eq (Cofree f a)Defined in free-5.2 · Control.Comonad.Cofree(Eq1 f, Eq a) => Eq (Free f a)Defined in free-5.2 · Control.Monad.Free(Eq1 f, Eq a) => Eq (Free f a)Defined in free-5.2 · Control.Monad.Free.Ap(Eq1 f, Eq a) => Eq (Coyoneda f a)Defined in kan-extensions-5.2.7 · Data.Functor.Coyoneda(Eq1 f, Eq a) => Eq (Yoneda f a)Defined in kan-extensions-5.2.7 · Data.Functor.Yoneda(Eq1 f, Eq a) => Eq (Lift f a)Defined in transformers-0.6.1.1 · Control.Applicative.Lift(Eq1 m, Eq a) => Eq (IterT m a)Defined in free-5.2 · Control.Monad.Trans.Iter(Eq1 m, Eq a) => Eq (MaybeT m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Maybe(Eq1 w, Eq a) => Eq (CoiterT w a)Defined in free-5.2 · Control.Comonad.Trans.Coiter(Ix i, Eq e) => Eq (Array i e)Defined in ghc-internal-9.1003.0 · GHC.Internal.Arr(Ix ix, Eq e, IArray UArray e) => Eq (UArray ix e)Defined in array-0.5.8.0 · Data.Array.Base(Eq a, Eq b) => Eq (Either a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Either(Eq a, Eq b) => Eq (a, b)Defined in ghc-prim-0.12.0 · GHC.Classes(Eq e, Eq a) => Eq (Validation e a)Defined in either-5.0.3 · Data.Either.Validation(Eq e, Eq a) => Eq (Validation e a)Defined in selective-0.7.0.1 · Control.Selective(Eq i, Eq e) => Eq (TArray i e)Defined in stm-2.5.3.1 · Control.Concurrent.STM.TArray(Eq k, Eq a) => Eq (Map k a)Defined in containers-0.7 · Data.Map.Internal(Eq k, Eq v) => Eq (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalNote that, in the presence of hash collisions, equal
HashMaps may behave differently, i.e. extensionality may be violated:Example2 expressions data D = A | B deriving (Eq, Show)instance Hashable D where hashWithSalt salt _d = salt
Example2 expressions x = fromList [(A,1), (B,2)]y = fromList [(B,2), (A,1)]
Example3 expressions x == yTruetoList x[(A,1),(B,2)]toList y[(B,2),(A,1)]
In general, the lack of extensionality can be observed with any function that depends on the key ordering, such as folds and traversals.
(Eq k, Eq v) => Eq (Leaf k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal(GEq (Rep1 f a), Generic1 f) => Eq (FunctorClassesDefault f a)Defined in transformers-compat-0.7.2 · Data.Functor.Classes.Generic.InternalEq (STUArray s i e)Defined in array-0.5.8.0 · Data.Array.BaseEq (STArray s i e)Defined in ghc-internal-9.1003.0 · GHC.Internal.ArrEq (Coercion a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.CoercionEq (OrderingI a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.OrdEq (URec Char p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsEq (URec Double p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsEq (URec Float p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsEq (URec Int p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsEq (URec Word p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsEq (URec (Ptr ()) p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsEq (a :~: b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.EqualityEq (bi a b) => Eq (Biap bi a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.BiapEq (f a) => Eq (Ap f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidEq (f a) => Eq (Alt f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalEq (f a) => Eq (WrappedContravariant f a)Defined in invariant-0.6.4 · Data.Functor.InvariantEq (f a) => Eq (WrappedFunctor f a)Defined in invariant-0.6.4 · Data.Functor.InvariantEq (f p) => Eq (Rec1 f p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsEq (p (Fix p a) a) => Eq (Fix p a)Defined in bifunctors-5.6.2 · Data.Bifunctor.FixEq (p a a) => Eq (Join p a)Defined in bifunctors-5.6.2 · Data.Bifunctor.JoinEq (w (CofreeF f a (CofreeT f w a))) => Eq (CofreeT f w a)Defined in free-5.2 · Control.Comonad.Trans.CofreeEq a => Eq (Const a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.ConstEq a => Eq (Constant a b)Defined in transformers-0.6.1.1 · Data.Functor.ConstantEq a => Eq (Bundle Id v a)Defined in vector-0.13.2.0 · Data.Vector.Fusion.Bundle · orphanEq b => Eq (Tagged s b)Defined in tagged-0.8.9 · Data.Tagged(Eq1 f, Eq1 m, Eq a) => Eq (FreeT f m a)Defined in free-5.2 · Control.Monad.Trans.Free(Eq1 f, Eq1 m, Eq a) => Eq (FreeT f m a)Defined in free-5.2 · Control.Monad.Trans.Free.Ap(Eq1 f, Eq a) => Eq (Backwards f a)Defined in transformers-0.6.1.1 · Control.Applicative.Backwards(Eq1 f, Eq a) => Eq (IdentityT f a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Identity(Eq1 f, Eq a) => Eq (Reverse f a)Defined in transformers-0.6.1.1 · Data.Functor.Reverse(Eq1 f, Eq e, Eq a) => Eq (ExceptT e f a)Defined in selective-0.7.0.1 · Control.Selective.Trans.Except(Functor f, Monad m, Eq1 f, Eq1 m, Eq a) => Eq (FT f m a)Defined in free-5.2 · Control.Monad.Trans.Free.Church(Generic1 f, Eq (Rep1 f a)) => Eq (Generically1 f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics(Eq a, Eq (f b)) => Eq (CofreeF f a b)Defined in free-5.2 · Control.Comonad.Trans.Cofree(Eq a, Eq (f b)) => Eq (FreeF f a b)Defined in free-5.2 · Control.Monad.Trans.Free(Eq a, Eq (f b)) => Eq (FreeF f a b)Defined in free-5.2 · Control.Monad.Trans.Free.Ap(Eq a, Eq b, Eq c) => Eq (a, b, c)Defined in ghc-prim-0.12.0 · GHC.Classes(Eq e, Eq1 m, Eq a) => Eq (ExceptT e m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Except(Eq w, Eq1 m, Eq a) => Eq (WriterT w m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Lazy(Eq w, Eq1 m, Eq a) => Eq (WriterT w m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.StrictEq (a :~~: b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.EqualityEq c => Eq (K1 i c p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics(Eq (f a), Eq (g a)) => Eq (Product f g a)Defined in base-4.20.2.0 · Data.Functor.Product(Eq (f a), Eq (g a)) => Eq (Sum f g a)Defined in base-4.20.2.0 · Data.Functor.Sum(Eq (f p), Eq (g p)) => Eq ((:*:) f g p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics(Eq (f p), Eq (g p)) => Eq ((:+:) f g p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics(Eq a, Eq b, Eq c, Eq d) => Eq (a, b, c, d)Defined in ghc-prim-0.12.0 · GHC.ClassesEq (f (g a)) => Eq (Compose f g a)Defined in base-4.20.2.0 · Data.Functor.ComposeEq (f (g p)) => Eq ((:.:) f g p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsEq (f a) => Eq (Clown f a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.ClownEq (f p) => Eq (M1 i c f p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsEq (g b) => Eq (Joker g a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.JokerEq (p a b) => Eq (WrappedBifunctor p a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.WrappedEq (p a b) => Eq (WrappedProfunctor p a b)Defined in invariant-0.6.4 · Data.Functor.InvariantEq (p b a) => Eq (Flip p a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.Flip(Eq a, Eq b, Eq c, Eq d, Eq e) => Eq (a, b, c, d, e)Defined in ghc-prim-0.12.0 · GHC.Classes(Eq (f a b), Eq (g a b)) => Eq (Product f g a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.Product(Eq (p a b), Eq (q a b)) => Eq (Sum p q a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.Sum(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => Eq (a, b, c, d, e, f)Defined in ghc-prim-0.12.0 · GHC.ClassesEq (f (p a b)) => Eq (Tannen f p a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.Tannen(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g) => Eq (a, b, c, d, e, f, g)Defined in ghc-prim-0.12.0 · GHC.Classes(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h) => Eq (a, b, c, d, e, f, g, h)Defined in ghc-prim-0.12.0 · GHC.ClassesEq (p (f a) (g b)) => Eq (Biff p f g a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.Biff(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i) => Eq (a, b, c, d, e, f, g, h, i)Defined in ghc-prim-0.12.0 · GHC.Classes(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j) => Eq (a, b, c, d, e, f, g, h, i, j)Defined in ghc-prim-0.12.0 · GHC.Classes(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k) => Eq (a, b, c, d, e, f, g, h, i, j, k)Defined in ghc-prim-0.12.0 · GHC.Classes(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l) => Eq (a, b, c, d, e, f, g, h, i, j, k, l)Defined in ghc-prim-0.12.0 · GHC.Classes(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m)Defined in ghc-prim-0.12.0 · GHC.Classes(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n)Defined in ghc-prim-0.12.0 · GHC.Classes(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n, Eq o) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)Defined in ghc-prim-0.12.0 · GHC.Classes
The Foldable class represents data structures that can be reduced to a summary value one element at a time. Strict left-associative folds are a good fit for space-efficient reduction, while lazy right-associative folds are a good fit for corecursive iteration, or for folds that short-circuit after processing an initial subsequence of the structure's elements.
Instances can be derived automatically by enabling the DeriveFoldable
extension. For example, a derived instance for a binary tree might be:
{-# LANGUAGE DeriveFoldable #-}
data Tree a = Empty
| Leaf a
| Node (Tree a) a (Tree a)
deriving FoldableA more detailed description can be found in the Overview section of
Data.Foldable#overview.
For the class laws see the Laws section of Data.Foldable#laws.
Methods
fold :: Monoid m => t m -> mGiven a structure with elements whose type is a Monoid, combine them via the monoid's
(<>)operator. This fold is right-associative and lazy in the accumulator. When you need a strict left-associative fold, use foldMap' instead, with id as the map.Examples
Basic usage:
Example1 expression fold [[1, 2, 3], [4, 5], [6], []][1,2,3,4,5,6]
Example1 expression fold $ Node (Leaf (Sum 1)) (Sum 3) (Leaf (Sum 5))Sum {getSum = 9}
Folds of unbounded structures do not terminate when the monoid's
(<>)operator is strict:Example1 expression fold (repeat Nothing)* Hangs forever *
Lazy corecursive folds of unbounded structures are fine:
Example2 expressions take 12 $ fold $ map (\i -> [i..i+2]) [0..][0,1,2,1,2,3,2,3,4,3,4,5]sum $ take 4000000 $ fold $ map (\i -> [i..i+2]) [0..]2666668666666
foldMap :: Monoid m => (a -> m) -> t a -> mMap each element of the structure into a monoid, and combine the results with
(<>). This fold is right-associative and lazy in the accumulator. For strict left-associative folds consider foldMap' instead.Examples
Basic usage:
Example1 expression foldMap Sum [1, 3, 5]Sum {getSum = 9}
Example1 expression foldMap Product [1, 3, 5]Product {getProduct = 15}
Example1 expression foldMap (replicate 3) [1, 2, 3][1,1,1,2,2,2,3,3,3]
When a Monoid's
(<>)is lazy in its second argument, foldMap can return a result even from an unbounded structure. For example, lazy accumulation enables Data.ByteString.Builder to efficiently serialise large data structures and produce the output incrementally:Example5 expressions import qualified Data.ByteString.Lazy as Limport qualified Data.ByteString.Builder as Blet bld :: Int -> B.Builder; bld i = B.intDec i <> B.word8 0x20let lbs = B.toLazyByteString $ foldMap bld [0..]L.take 64 lbs"0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24"
foldMap' :: Monoid m => (a -> m) -> t a -> mA left-associative variant of foldMap that is strict in the accumulator. Use this method for strict reduction when partial results are merged via
(<>).Examples
Define a Monoid over finite bit strings under
xor. Use it to strictly compute thexorof a list of Int values.Example11 expressions :set -XGeneralizedNewtypeDerivingimport Data.Bits (Bits, FiniteBits, xor, zeroBits)import Data.Foldable (foldMap')import Numeric (showHex)newtype X a = X a deriving (Eq, Bounded, Enum, Bits, FiniteBits)instance Bits a => Semigroup (X a) where X a <> X b = X (a `xor` b)instance Bits a => Monoid (X a) where mempty = X zeroBitslet bits :: [Int]; bits = [0xcafe, 0xfeed, 0xdeaf, 0xbeef, 0x5411](\ (X a) -> showString "0x" . showHex a $ "") $ foldMap' X bits"0x42"
foldr' :: (a -> b -> b) -> b -> t a -> bfoldr' is a variant of foldr that performs strict reduction from right to left, i.e. starting with the right-most element. The input structure must be finite, otherwise foldr' runs out of space (diverges).
If you want a strict right fold in constant space, you need a structure that supports faster than O(n) access to the right-most element, such as
Seqfrom thecontainerspackage.This method does not run in constant space for structures such as lists that don't support efficient right-to-left iteration and so require O(n) space to perform right-to-left reduction. Use of this method with such a structure is a hint that the chosen structure may be a poor fit for the task at hand. If the order in which the elements are combined is not important, use foldl' instead.
Instances112Foldable, …
Foldable ComplexDefined in base-4.20.2.0 · Data.ComplexFoldable FirstDefined in base-4.20.2.0 · Data.SemigroupFoldable LastDefined in base-4.20.2.0 · Data.SemigroupFoldable MaxDefined in base-4.20.2.0 · Data.SemigroupFoldable MinDefined in base-4.20.2.0 · Data.SemigroupFoldable SCCDefined in containers-0.7 · Data.GraphFoldable IntMapDefined in containers-0.7 · Data.IntMap.InternalFolds in order of increasing key.
Foldable DigitDefined in containers-0.7 · Data.Sequence.InternalFoldable ElemDefined in containers-0.7 · Data.Sequence.InternalFoldable FingerTreeDefined in containers-0.7 · Data.Sequence.InternalFoldable NodeDefined in containers-0.7 · Data.Sequence.InternalFoldable SeqDefined in containers-0.7 · Data.Sequence.InternalFoldable ViewLDefined in containers-0.7 · Data.Sequence.InternalFoldable ViewRDefined in containers-0.7 · Data.Sequence.InternalFoldable SetDefined in containers-0.7 · Data.Set.InternalFolds in order of increasing key.
Foldable TreeDefined in containers-0.7 · Data.TreeFolds in preorder
Foldable MaybeSDefined in containers-0.7 · Utils.Containers.Internal.StrictMaybeFoldable DNonEmptyDefined in dlist-1.0 · Data.DList.DNonEmpty.InternalFoldable DListDefined in dlist-1.0 · Data.DList.InternalFoldable NonEmptyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable IdentityDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityFoldable FirstDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable LastDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable DownDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable DualDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable ProductDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable SumDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable ZipListDefined in ghc-internal-9.1003.0 · GHC.Internal.Functor.ZipListFoldable Par1Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable MaybeDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable SoloDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable HashedDefined in hashable-1.4.7.0 · Data.Hashable.ClassFoldable ArrayDefined in primitive-0.9.1.0 · Data.Primitive.ArrayFoldable SmallArrayDefined in primitive-0.9.1.0 · Data.Primitive.SmallArrayFoldable TyVarBndrDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxFoldable HashSetDefined in unordered-containers-0.2.21 · Data.HashSet.InternalFoldable VectorDefined in vector-0.13.2.0 · Data.VectorFoldable VectorDefined in vector-0.13.2.0 · Data.Vector.StrictFoldable []Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable ProxyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable U1Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable UAddrDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable UCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable UDoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable UFloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable UIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable UWordDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable V1Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable (Arg a)Defined in base-4.20.2.0 · Data.SemigroupFoldable (Map k)Defined in containers-0.7 · Data.Map.InternalFolds in order of increasing key.
Foldable (Validation e)Defined in either-5.0.3 · Data.Either.ValidationFoldable (Array i)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable (Either a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable (Tuple2 a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable (Under m)Defined in selective-0.7.0.1 · Control.SelectiveFoldable (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalFoldable f => Foldable (Ap f)Defined in free-5.2 · Control.Applicative.FreeFoldable f => Foldable (Cofree f)Defined in free-5.2 · Control.Comonad.CofreeFoldable f => Foldable (Free f)Defined in free-5.2 · Control.Monad.FreeFoldable f => Foldable (Free f)Defined in free-5.2 · Control.Monad.Free.ApFoldable f => Foldable (F f)Defined in free-5.2 · Control.Monad.Free.ChurchFoldable f => Foldable (Coyoneda f)Defined in kan-extensions-5.2.7 · Data.Functor.CoyonedaFoldable f => Foldable (Yoneda f)Defined in kan-extensions-5.2.7 · Data.Functor.YonedaFoldable f => Foldable (Lift f)Defined in transformers-0.6.1.1 · Control.Applicative.LiftFoldable f => Foldable (MaybeT f)Defined in transformers-0.6.1.1 · Control.Monad.Trans.MaybeFoldable m => Foldable (CatchT m)Defined in exceptions-0.10.9 · Control.Monad.Catch.PureFoldable m => Foldable (IterT m)Defined in free-5.2 · Control.Monad.Trans.IterFoldable w => Foldable (CoiterT w)Defined in free-5.2 · Control.Comonad.Trans.CoiterBifoldable p => Foldable (Fix p)Defined in bifunctors-5.6.2 · Data.Bifunctor.FixBifoldable p => Foldable (Join p)Defined in bifunctors-5.6.2 · Data.Bifunctor.JoinFoldable (Const m)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.ConstFoldable (Baz t b)Defined in profunctors-5.6.3 · Data.Profunctor.TraversingFoldable (Tagged s)Defined in tagged-0.8.9 · Data.TaggedFoldable (Constant a)Defined in transformers-0.6.1.1 · Data.Functor.ConstantFoldable (bi a) => Foldable (Biap bi a)Defined in bifunctors-5.6.2 · Data.Bifunctor.BiapFoldable f => Foldable (CofreeF f a)Defined in free-5.2 · Control.Comonad.Trans.CofreeFoldable f => Foldable (FreeF f a)Defined in free-5.2 · Control.Monad.Trans.FreeFoldable f => Foldable (FreeF f a)Defined in free-5.2 · Control.Monad.Trans.Free.ApFoldable f => Foldable (Ap f)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable f => Foldable (Alt f)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable f => Foldable (Rec1 f)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable f => Foldable (WrappedFunctor f)Defined in invariant-0.6.4 · Data.Functor.InvariantFoldable f => Foldable (ExceptT e f)Defined in selective-0.7.0.1 · Control.Selective.Trans.ExceptFoldable f => Foldable (Backwards f)Defined in transformers-0.6.1.1 · Control.Applicative.BackwardsDerived instance.
Foldable f => Foldable (ExceptT e f)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ExceptFoldable f => Foldable (IdentityT f)Defined in transformers-0.6.1.1 · Control.Monad.Trans.IdentityFoldable f => Foldable (WriterT w f)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.LazyFoldable f => Foldable (WriterT w f)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.StrictFoldable f => Foldable (Reverse f)Defined in transformers-0.6.1.1 · Data.Functor.ReverseFold from right to left.
Foldable w => Foldable (EnvT e w)Defined in comonad-5.0.9 · Control.Comonad.Trans.Env(Foldable f, Foldable m) => Foldable (ReaderT f m)Defined in adjunctions-4.4.3 · Control.Monad.Representable.Reader(Foldable f, Foldable m, Monad m) => Foldable (FT f m)Defined in free-5.2 · Control.Monad.Trans.Free.Church(Foldable f, Foldable w) => Foldable (CofreeT f w)Defined in free-5.2 · Control.Comonad.Trans.Cofree(Foldable m, Foldable f) => Foldable (FreeT f m)Defined in free-5.2 · Control.Monad.Trans.Free(Foldable m, Foldable f) => Foldable (FreeT f m)Defined in free-5.2 · Control.Monad.Trans.Free.ApFoldable (K1 i c)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable (Forget r a)Defined in profunctors-5.6.3 · Data.Profunctor.Types(Foldable f, Foldable g) => Foldable (Product f g)Defined in base-4.20.2.0 · Data.Functor.Product(Foldable f, Foldable g) => Foldable (Sum f g)Defined in base-4.20.2.0 · Data.Functor.Sum(Foldable f, Foldable g) => Foldable (f :*: g)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Foldable(Foldable f, Foldable g) => Foldable (f :+: g)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableBifoldable p => Foldable (Flip p a)Defined in bifunctors-5.6.2 · Data.Bifunctor.FlipBifoldable p => Foldable (WrappedBifunctor p a)Defined in bifunctors-5.6.2 · Data.Bifunctor.WrappedFoldable (Clown f a)Defined in bifunctors-5.6.2 · Data.Bifunctor.ClownFoldable f => Foldable (M1 i c f)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableFoldable g => Foldable (Joker g a)Defined in bifunctors-5.6.2 · Data.Bifunctor.Joker(Foldable f, Foldable g) => Foldable (Compose f g)Defined in base-4.20.2.0 · Data.Functor.Compose(Foldable f, Foldable g) => Foldable (f :.: g)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Foldable(Foldable (f a), Foldable (g a)) => Foldable (Product f g a)Defined in bifunctors-5.6.2 · Data.Bifunctor.Product(Foldable (f a), Foldable (g a)) => Foldable (Sum f g a)Defined in bifunctors-5.6.2 · Data.Bifunctor.Sum(Foldable f, Bifoldable p) => Foldable (Tannen f p a)Defined in bifunctors-5.6.2 · Data.Bifunctor.Tannen(Bifoldable p, Foldable g) => Foldable (Biff p f g a)Defined in bifunctors-5.6.2 · Data.Bifunctor.Biff
Laws:
<!> is associative: (a <!> b) <!> c = a <!> (b <!> c)
<$> left-distributes over <!>: f <$> (a <!> b) = (f <$> a) <!> (f <$> b)If extended to an Alternative then <!> should equal <|>.
Ideally, an instance of Alt also satisfies the "left distribution" law of MonadPlus with respect to <.>:
<.> right-distributes over <!>: (a <!> b) <.> c = (a <.> c) <!> (b <.> c)IO, Either a, ExceptT e m and GHC.Conc.STM instead satisfy the
"left catch" law:
pure a <!> b = pure aMaybe and Identity satisfy both "left distribution" and "left catch".
These variations cannot be stated purely in terms of the dependencies of Alt.
When and if MonadPlus is successfully refactored, this class should also be refactored to remove these instances.
The right distributive law should extend in the cases where the a Bind or Monad is
provided to yield variations of the right distributive law:
(m <!> n) >>- f = (m >>- f) <!> (m >>- f)
(m <!> n) >>= f = (m >>= f) <!> (m >>= f)Instances50Alt, …
Alt FirstDefined in semigroupoids-6.0.1 · Data.Functor.AltAlt LastDefined in semigroupoids-6.0.1 · Data.Functor.AltAlt IntMapDefined in semigroupoids-6.0.1 · Data.Functor.AltAlt SeqDefined in semigroupoids-6.0.1 · Data.Functor.AltAlt NonEmptyDefined in semigroupoids-6.0.1 · Data.Functor.AltAlt IdentityDefined in semigroupoids-6.0.1 · Data.Functor.AltChoose the first option every time. While 'choose the last option' every time is also valid, this instance satisfies more laws.
Alt FirstDefined in semigroupoids-6.0.1 · Data.Functor.AltAlt LastDefined in semigroupoids-6.0.1 · Data.Functor.AltAlt MaybeDefined in semigroupoids-6.0.1 · Data.Functor.AltAlt IODefined in semigroupoids-6.0.1 · Data.Functor.AltThis instance does not actually satisfy the (<.>) right distributive law It instead satisfies the "left catch" law
Alt VectorDefined in vector-instances-3.4.2 · Data.Vector.Instances · orphanAlt []Defined in semigroupoids-6.0.1 · Data.Functor.AltAlternative f => Alt (WrappedApplicative f)Defined in semigroupoids-6.0.1 · Data.Functor.AltMonadPlus m => Alt (WrappedMonad m)Defined in semigroupoids-6.0.1 · Data.Functor.AltSemigroup e => Alt (Validation e)Defined in either-5.0.3 · Data.Either.ValidationFor two errors, this instance reports both of them.
Ord k => Alt (Map k)Defined in semigroupoids-6.0.1 · Data.Functor.AltAlt ProxyDefined in semigroupoids-6.0.1 · Data.Functor.AltAlt U1Defined in semigroupoids-6.0.1 · Data.Functor.AltAlt V1Defined in semigroupoids-6.0.1 · Data.Functor.AltAlt (Alt f)Defined in free-5.2 · Control.Alternative.FreeAlt (Alt f)Defined in free-5.2 · Control.Alternative.Free.FinalAlt (Either a)Defined in semigroupoids-6.0.1 · Data.Functor.AltAlt f => Alt (Coyoneda f)Defined in kan-extensions-5.2.7 · Data.Functor.CoyonedaAlt f => Alt (Yoneda f)Defined in kan-extensions-5.2.7 · Data.Functor.YonedaAlt f => Alt (Lift f)Defined in semigroupoids-6.0.1 · Data.Functor.Alt(Functor f, Monad f) => Alt (MaybeT f)Defined in semigroupoids-6.0.1 · Data.Functor.Alt(Hashable k, Eq k) => Alt (HashMap k)Defined in semigroupoids-6.0.1 · Data.Functor.AltArrowPlus a => Alt (WrappedArrow a b)Defined in semigroupoids-6.0.1 · Data.Functor.AltAlt f => Alt (Rec1 f)Defined in semigroupoids-6.0.1 · Data.Functor.AltAlt f => Alt (Static f a)Defined in semigroupoids-6.0.1 · Data.Semigroupoid.StaticAlt f => Alt (Backwards f)Defined in semigroupoids-6.0.1 · Data.Functor.AltAlt f => Alt (IdentityT f)Defined in semigroupoids-6.0.1 · Data.Functor.AltAlt f => Alt (ReaderT e f)Defined in semigroupoids-6.0.1 · Data.Functor.AltAlt f => Alt (StateT e f)Defined in semigroupoids-6.0.1 · Data.Functor.AltAlt f => Alt (StateT e f)Defined in semigroupoids-6.0.1 · Data.Functor.AltAlt f => Alt (WriterT w f)Defined in semigroupoids-6.0.1 · Data.Functor.AltAlt f => Alt (WriterT w f)Defined in semigroupoids-6.0.1 · Data.Functor.AltAlt f => Alt (WriterT w f)Defined in semigroupoids-6.0.1 · Data.Functor.AltAlt f => Alt (Reverse f)Defined in semigroupoids-6.0.1 · Data.Functor.Alt(Functor f, Monad f, Semigroup e) => Alt (ExceptT e f)Defined in semigroupoids-6.0.1 · Data.Functor.AltSemigroup c => Alt (K1 i c)Defined in semigroupoids-6.0.1 · Data.Functor.Altsince 5.3.8(Alt f, Alt g) => Alt (Product f g)Defined in semigroupoids-6.0.1 · Data.Functor.Alt(Alt f, Alt g) => Alt (f :*: g)Defined in semigroupoids-6.0.1 · Data.Functor.Alt(v ~~ v', Alt v') => Alt (Codensity v)Defined in kan-extensions-5.2.7 · Control.Monad.CodensityAlt f => Alt (M1 i c f)Defined in semigroupoids-6.0.1 · Data.Functor.AltAlt f => Alt (RWST r w s f)Defined in semigroupoids-6.0.1 · Data.Functor.AltAlt f => Alt (RWST r w s f)Defined in semigroupoids-6.0.1 · Data.Functor.AltAlt f => Alt (RWST r w s f)Defined in semigroupoids-6.0.1 · Data.Functor.Alt(Alt f, Functor g) => Alt (Compose f g)Defined in semigroupoids-6.0.1 · Data.Functor.Alt(Alt f, Functor g) => Alt (f :.: g)Defined in semigroupoids-6.0.1 · Data.Functor.Alt
Minimal definition: Either join or >>-
If defining both, then the following laws (the default definitions) must hold:
join = (>>- id)
m >>- f = join (fmap f m)Laws:
induced definition of <.>: f <.> x = f >>- (<$> x)Finally, there are two associativity conditions:
associativity of (>>-): (m >>- f) >>- g == m >>- (\x -> f x >>- g)
associativity of join: join . join = join . fmap joinThese can both be seen as special cases of the constraint that
associativity of (->-): (f ->- g) ->- h = f ->- (g ->- h)Methods
(>>-) :: m a -> (a -> m b) -> m binfixl 1
Instances63Bind, …
Bind ComplexDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind FirstDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind LastDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind MaxDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind MinDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind IntMapDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind SeqDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind TreeDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind NonEmptyDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind IdentityDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind FirstDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind LastDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind DownDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind DualDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind ProductDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind SumDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind Par1Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind MaybeDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind IODefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind QDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind VectorDefined in vector-instances-3.4.2 · Data.Vector.Instances · orphanBind []Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassRepresentable f => Bind (Co f)Defined in adjunctions-4.4.3 · Data.Functor.RepFunctor f => Bind (Free f)Defined in free-5.2 · Control.Monad.FreeMonad m => Bind (WrappedMonad m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassMonad m => Bind (IterT m)Defined in free-5.2 · Control.Monad.Trans.IterSemigroup m => Bind (Tuple2 m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassOrd k => Bind (Map k)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply f => Bind (Free f)Defined in free-5.2 · Control.Monad.Free.ApBind ProxyDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind U1Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind V1Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind (F f)Defined in free-5.2 · Control.Monad.Free.ChurchBind (Either a)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind m => Bind (Coyoneda m)Defined in kan-extensions-5.2.7 · Data.Functor.CoyonedaBind m => Bind (Yoneda m)Defined in kan-extensions-5.2.7 · Data.Functor.Yoneda(Functor m, Monad m) => Bind (MaybeT m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.Class(Hashable k, Eq k) => Bind (HashMap k)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind (FT f m)Defined in free-5.2 · Control.Monad.Trans.Free.ChurchBind (Tagged a)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind f => Bind (Alt f)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind m => Bind (Rec1 m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind m => Bind (IdentityT m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind m => Bind (ReaderT e m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind m => Bind (StateT s m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind m => Bind (StateT s m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind m => Bind (WriterT w m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.Class(Representable f, Bind m) => Bind (ReaderT f m)Defined in adjunctions-4.4.3 · Control.Monad.Representable.Reader(Representable g, Bind m) => Bind (StateT g m)Defined in adjunctions-4.4.3 · Control.Monad.Representable.State(Functor f, Monad m) => Bind (FreeT f m)Defined in free-5.2 · Control.Monad.Trans.Free(Functor m, Monad m) => Bind (ExceptT e m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.Class(Apply f, Apply m, Monad m) => Bind (FreeT f m)Defined in free-5.2 · Control.Monad.Trans.Free.Ap(Bind m, Semigroup w) => Bind (WriterT w m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.Class(Bind m, Semigroup w) => Bind (WriterT w m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind (ContT r m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind ((->) m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassExtend w => Bind (CoT w m)Defined in kan-extensions-5.2.7 · Control.Monad.Co(Bind f, Bind g) => Bind (Product f g)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.Class(Bind f, Bind g) => Bind (f :*: g)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind f => Bind (M1 i c f)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind m => Bind (RWST r w s m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.Class(Bind m, Semigroup w) => Bind (RWST r w s m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.Class(Bind m, Semigroup w) => Bind (RWST r w s m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.Class
Methods
zero :: f a
Instances41Plus, …
Plus IntMapDefined in semigroupoids-6.0.1 · Data.Functor.PlusPlus SeqDefined in semigroupoids-6.0.1 · Data.Functor.PlusPlus FirstDefined in semigroupoids-6.0.1 · Data.Functor.PlusPlus LastDefined in semigroupoids-6.0.1 · Data.Functor.PlusPlus MaybeDefined in semigroupoids-6.0.1 · Data.Functor.PlusPlus IODefined in semigroupoids-6.0.1 · Data.Functor.PlusPlus VectorDefined in vector-instances-3.4.2 · Data.Vector.Instances · orphanPlus []Defined in semigroupoids-6.0.1 · Data.Functor.PlusAlternative f => Plus (WrappedApplicative f)Defined in semigroupoids-6.0.1 · Data.Functor.PlusMonadPlus m => Plus (WrappedMonad m)Defined in semigroupoids-6.0.1 · Data.Functor.PlusOrd k => Plus (Map k)Defined in semigroupoids-6.0.1 · Data.Functor.PlusPlus ProxyDefined in semigroupoids-6.0.1 · Data.Functor.PlusPlus U1Defined in semigroupoids-6.0.1 · Data.Functor.PlusPlus f => Plus (Coyoneda f)Defined in kan-extensions-5.2.7 · Data.Functor.CoyonedaPlus f => Plus (Yoneda f)Defined in kan-extensions-5.2.7 · Data.Functor.YonedaPlus f => Plus (Lift f)Defined in semigroupoids-6.0.1 · Data.Functor.Plus(Functor f, Monad f) => Plus (MaybeT f)Defined in semigroupoids-6.0.1 · Data.Functor.Plus(Hashable k, Eq k) => Plus (HashMap k)Defined in semigroupoids-6.0.1 · Data.Functor.PlusArrowPlus a => Plus (WrappedArrow a b)Defined in semigroupoids-6.0.1 · Data.Functor.PlusPlus f => Plus (Rec1 f)Defined in semigroupoids-6.0.1 · Data.Functor.PlusPlus f => Plus (Static f a)Defined in semigroupoids-6.0.1 · Data.Semigroupoid.StaticPlus f => Plus (Backwards f)Defined in semigroupoids-6.0.1 · Data.Functor.PlusPlus f => Plus (IdentityT f)Defined in semigroupoids-6.0.1 · Data.Functor.PlusPlus f => Plus (ReaderT e f)Defined in semigroupoids-6.0.1 · Data.Functor.PlusPlus f => Plus (StateT e f)Defined in semigroupoids-6.0.1 · Data.Functor.PlusPlus f => Plus (StateT e f)Defined in semigroupoids-6.0.1 · Data.Functor.PlusPlus f => Plus (WriterT w f)Defined in semigroupoids-6.0.1 · Data.Functor.PlusPlus f => Plus (WriterT w f)Defined in semigroupoids-6.0.1 · Data.Functor.PlusPlus f => Plus (WriterT w f)Defined in semigroupoids-6.0.1 · Data.Functor.PlusPlus f => Plus (Reverse f)Defined in semigroupoids-6.0.1 · Data.Functor.Plus(Functor f, Monad f, Semigroup e, Monoid e) => Plus (ExceptT e f)Defined in semigroupoids-6.0.1 · Data.Functor.PlusMonoid c => Plus (K1 i c)Defined in semigroupoids-6.0.1 · Data.Functor.Plus(Plus f, Plus g) => Plus (Product f g)Defined in semigroupoids-6.0.1 · Data.Functor.Plus(Plus f, Plus g) => Plus (f :*: g)Defined in semigroupoids-6.0.1 · Data.Functor.Plus(v ~~ v', Plus v') => Plus (Codensity v)Defined in kan-extensions-5.2.7 · Control.Monad.CodensityPlus f => Plus (M1 i c f)Defined in semigroupoids-6.0.1 · Data.Functor.PlusPlus f => Plus (RWST r w s f)Defined in semigroupoids-6.0.1 · Data.Functor.PlusPlus f => Plus (RWST r w s f)Defined in semigroupoids-6.0.1 · Data.Functor.PlusPlus f => Plus (RWST r w s f)Defined in semigroupoids-6.0.1 · Data.Functor.Plus(Plus f, Functor g) => Plus (Compose f g)Defined in semigroupoids-6.0.1 · Data.Functor.Plus(Plus f, Functor g) => Plus (f :.: g)Defined in semigroupoids-6.0.1 · Data.Functor.Plus
A set of values. A set cannot contain duplicate values.
Instances18Foldable, Eq1, Ord1, Show1, NFData1, Hashable1, …
Foldable HashSetDefined in unordered-containers-0.2.21 · Data.HashSet.InternalEq1 HashSetDefined in unordered-containers-0.2.21 · Data.HashSet.InternalOrd1 HashSetDefined in unordered-containers-0.2.21 · Data.HashSet.InternalShow1 HashSetDefined in unordered-containers-0.2.21 · Data.HashSet.InternalNFData1 HashSetDefined in unordered-containers-0.2.21 · Data.HashSet.InternalHashable1 HashSetDefined in unordered-containers-0.2.21 · Data.HashSet.InternalLift a => Lift (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.InternalHashable a => IsList (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.InternalEq a => Eq (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.InternalNote that, in the presence of hash collisions, equal
HashSets may behave differently, i.e. extensionality may be violated:Example2 expressions data D = A | B deriving (Eq, Show)instance Hashable D where hashWithSalt salt _d = salt
Example2 expressions x = fromList [A, B]y = fromList [B, A]
Example3 expressions x == yTruetoList x[A,B]toList y[B,A]
In general, the lack of extensionality can be observed with any function that depends on the key ordering, such as folds and traversals.
(Data a, Hashable a) => Data (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.InternalOrd a => Ord (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.Internal(Hashable a, Read a) => Read (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.InternalShow a => Show (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.InternalHashable a => Semigroup (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.InternalHashable a => Monoid (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.InternalNFData a => NFData (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.InternalHashable a => Hashable (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.Internaltype Item (HashSet a) = aDefined in unordered-containers-0.2.21 · Data.HashSet.Internal
A map of integers to values a.
Instances39Functor, Foldable, Traversable, Eq1, Ord1, Read1, …
Functor IntMapDefined in containers-0.7 · Data.IntMap.InternalFoldable IntMapDefined in containers-0.7 · Data.IntMap.InternalFolds in order of increasing key.
Traversable IntMapDefined in containers-0.7 · Data.IntMap.InternalTraverses in order of increasing key.
Eq1 IntMapDefined in containers-0.7 · Data.IntMap.InternalOrd1 IntMapDefined in containers-0.7 · Data.IntMap.InternalRead1 IntMapDefined in containers-0.7 · Data.IntMap.InternalShow1 IntMapDefined in containers-0.7 · Data.IntMap.InternalHashable1 IntMapDefined in hashable-1.4.7.0 · Data.Hashable.ClassAlt IntMapDefined in semigroupoids-6.0.1 · Data.Functor.AltApply IntMapDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassAn IntMap is not Applicative, but it is an instance of Apply
Bind IntMapDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassPlus IntMapDefined in semigroupoids-6.0.1 · Data.Functor.PlusInvariant IntMapDefined in invariant-0.6.4 · Data.Functor.Invariantfrom the
containerspackageAdjustable IntMapDefined in keys-3.12.3 · Data.KeyFoldableWithKey IntMapDefined in keys-3.12.3 · Data.KeyIndexable IntMapDefined in keys-3.12.3 · Data.KeyKeyed IntMapDefined in keys-3.12.3 · Data.KeyLookup IntMapDefined in keys-3.12.3 · Data.KeyTraversableWithKey IntMapDefined in keys-3.12.3 · Data.KeyZip IntMapDefined in keys-3.12.3 · Data.KeyZipWithKey IntMapDefined in keys-3.12.3 · Data.KeyFoldableWithIndex Int IntMapDefined in indexed-traversable-0.1.4 · WithIndexFunctorWithIndex Int IntMapDefined in indexed-traversable-0.1.4 · WithIndexTraversableWithIndex Int IntMapDefined in indexed-traversable-0.1.4 · WithIndexLift a => Lift (IntMap a)Defined in containers-0.7 · Data.IntMap.InternalIsList (IntMap a)Defined in containers-0.7 · Data.IntMap.InternalEq a => Eq (IntMap a)Defined in containers-0.7 · Data.IntMap.InternalData a => Data (IntMap a)Defined in containers-0.7 · Data.IntMap.InternalOrd a => Ord (IntMap a)Defined in containers-0.7 · Data.IntMap.InternalRead e => Read (IntMap e)Defined in containers-0.7 · Data.IntMap.InternalShow a => Show (IntMap a)Defined in containers-0.7 · Data.IntMap.InternalSemigroup (IntMap a)Defined in containers-0.7 · Data.IntMap.InternalMonoid (IntMap a)Defined in containers-0.7 · Data.IntMap.InternalNFData a => NFData (IntMap a)Defined in containers-0.7 · Data.IntMap.InternalBinary e => Binary (IntMap e)Defined in binary-0.8.9.3 · Data.Binary.ClassHashable v => Hashable (IntMap v)Defined in hashable-1.4.7.0 · Data.Hashable.ClassDefault (IntMap v)Defined in data-default-0.8.0.1 · Data.Default.Internaltype Item (IntMap a) = (Key, a)Defined in containers-0.7 · Data.IntMap.Internaltype Key IntMap = IntDefined in keys-3.12.3 · Data.Key
A set of integers.
Instances14IsList, Eq, Data, Ord, Read, Show, …
IsList IntSetDefined in containers-0.7 · Data.IntSet.InternalEq IntSetDefined in containers-0.7 · Data.IntSet.InternalData IntSetDefined in containers-0.7 · Data.IntSet.InternalOrd IntSetDefined in containers-0.7 · Data.IntSet.InternalRead IntSetDefined in containers-0.7 · Data.IntSet.InternalShow IntSetDefined in containers-0.7 · Data.IntSet.InternalSemigroup IntSetDefined in containers-0.7 · Data.IntSet.InternalMonoid IntSetDefined in containers-0.7 · Data.IntSet.InternalNFData IntSetDefined in containers-0.7 · Data.IntSet.InternalBinary IntSetDefined in binary-0.8.9.3 · Data.Binary.ClassHashable IntSetDefined in hashable-1.4.7.0 · Data.Hashable.ClassDefault IntSetDefined in data-default-0.8.0.1 · Data.Default.InternalLift IntSetDefined in containers-0.7 · Data.IntSet.Internaltype Item IntSet = KeyDefined in containers-0.7 · Data.IntSet.Internal
Non-empty (and non-strict) list type.
Constructors
a :| [a]infixr 5
Instances57Monad, Functor, MonadFix, Applicative, Foldable, Traversable, …
Monad NonEmptyDefined in ghc-internal-9.1003.0 · GHC.Internal.BaseFunctor NonEmptyDefined in ghc-internal-9.1003.0 · GHC.Internal.BaseMonadFix NonEmptyDefined in ghc-internal-9.1003.0 · GHC.Internal.Control.Monad.FixApplicative NonEmptyDefined in ghc-internal-9.1003.0 · GHC.Internal.BaseFoldable NonEmptyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableTraversable NonEmptyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.TraversableMonadZip NonEmptyDefined in base-4.20.2.0 · Control.Monad.ZipFoldable1 NonEmptyDefined in base-4.20.2.0 · Data.Foldable1Eq1 NonEmptyDefined in base-4.20.2.0 · Data.Functor.ClassesOrd1 NonEmptyDefined in base-4.20.2.0 · Data.Functor.ClassesRead1 NonEmptyDefined in base-4.20.2.0 · Data.Functor.ClassesShow1 NonEmptyDefined in base-4.20.2.0 · Data.Functor.ClassesNFData1 NonEmptyDefined in deepseq-1.5.0.0 · Control.DeepSeqHashable1 NonEmptyDefined in hashable-1.4.7.0 · Data.Hashable.ClassComonad NonEmptyDefined in comonad-5.0.9 · Control.ComonadComonadApply NonEmptyDefined in comonad-5.0.9 · Control.ComonadAlt NonEmptyDefined in semigroupoids-6.0.1 · Data.Functor.AltApply NonEmptyDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind NonEmptyDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassExtend NonEmptyDefined in semigroupoids-6.0.1 · Data.Functor.ExtendTraversable1 NonEmptyDefined in semigroupoids-6.0.1 · Data.Semigroup.Traversable.ClassInvariant NonEmptyDefined in invariant-0.6.4 · Data.Functor.Invariantfrom Data.List.NonEmpty
Selective NonEmptyDefined in selective-0.7.0.1 · Control.SelectiveAdjustable NonEmptyDefined in keys-3.12.3 · Data.KeyFoldableWithKey NonEmptyDefined in keys-3.12.3 · Data.KeyFoldableWithKey1 NonEmptyDefined in keys-3.12.3 · Data.KeyIndexable NonEmptyDefined in keys-3.12.3 · Data.KeyKeyed NonEmptyDefined in keys-3.12.3 · Data.KeyLookup NonEmptyDefined in keys-3.12.3 · Data.KeyTraversableWithKey NonEmptyDefined in keys-3.12.3 · Data.KeyTraversableWithKey1 NonEmptyDefined in keys-3.12.3 · Data.KeyZip NonEmptyDefined in keys-3.12.3 · Data.KeyZipWithKey NonEmptyDefined in keys-3.12.3 · Data.KeyCopointed NonEmptyDefined in pointed-5.0.4 · Data.CopointedPointed NonEmptyDefined in pointed-5.0.4 · Data.PointedGeneric1 NonEmptyDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsFoldableWithIndex Int NonEmptyDefined in indexed-traversable-0.1.4 · WithIndexFoldable1WithIndex Int NonEmptyDefined in indexed-traversable-0.1.4 · WithIndexFunctorWithIndex Int NonEmptyDefined in indexed-traversable-0.1.4 · WithIndexTraversableWithIndex Int NonEmptyDefined in indexed-traversable-0.1.4 · WithIndexComonadCofree Maybe NonEmptyDefined in free-5.2 · Control.Comonad.Cofree.ClassLift a => Lift (NonEmpty a)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxIsList (NonEmpty a)Defined in ghc-internal-9.1003.0 · GHC.Internal.IsListEq a => Eq (NonEmpty a)Defined in ghc-internal-9.1003.0 · GHC.Internal.BaseData a => Data (NonEmpty a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.DataOrd a => Ord (NonEmpty a)Defined in ghc-internal-9.1003.0 · GHC.Internal.BaseRead a => Read (NonEmpty a)Defined in ghc-internal-9.1003.0 · GHC.Internal.ReadShow a => Show (NonEmpty a)Defined in ghc-internal-9.1003.0 · GHC.Internal.ShowGeneric (NonEmpty a)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsSemigroup (NonEmpty a)Defined in ghc-internal-9.1003.0 · GHC.Internal.BaseNFData a => NFData (NonEmpty a)Defined in deepseq-1.5.0.0 · Control.DeepSeqBinary a => Binary (NonEmpty a)Defined in binary-0.8.9.3 · Data.Binary.ClassHashable a => Hashable (NonEmpty a)Defined in hashable-1.4.7.0 · Data.Hashable.Classtype Rep (NonEmpty a) = D1 ('MetaDataDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics"NonEmpty"
"GHC.Internal.Base"
"ghc-internal"
'False) (C1 ('MetaCons":|"
('InfixI 'RightAssociative5
) 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [a])))type Rep1 NonEmpty = D1 ('MetaDataDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics"NonEmpty"
"GHC.Internal.Base"
"ghc-internal"
'False) (C1 ('MetaCons":|"
('InfixI 'RightAssociative5
) 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1 :*: S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 [])))type Item (NonEmpty a) = aDefined in ghc-internal-9.1003.0 · GHC.Internal.IsListtype Key NonEmpty = IntDefined in keys-3.12.3 · Data.Key
Instances45Bifoldable, Eq2, Ord2, Show2, Hashable2, FoldableWithIndex, …
Bifoldable MapDefined in containers-0.7 · Data.Map.InternalEq2 MapDefined in containers-0.7 · Data.Map.InternalOrd2 MapDefined in containers-0.7 · Data.Map.InternalShow2 MapDefined in containers-0.7 · Data.Map.InternalHashable2 MapDefined in hashable-1.4.7.0 · Data.Hashable.ClassFoldableWithIndex k (Map k)Defined in indexed-traversable-0.1.4 · WithIndexFunctorWithIndex k (Map k)Defined in indexed-traversable-0.1.4 · WithIndexTraversableWithIndex k (Map k)Defined in indexed-traversable-0.1.4 · WithIndex(Lift k, Lift a) => Lift (Map k a)Defined in containers-0.7 · Data.Map.InternalFunctor (Map k)Defined in containers-0.7 · Data.Map.InternalFoldable (Map k)Defined in containers-0.7 · Data.Map.InternalFolds in order of increasing key.
Traversable (Map k)Defined in containers-0.7 · Data.Map.InternalTraverses in order of increasing key.
Eq k => Eq1 (Map k)Defined in containers-0.7 · Data.Map.InternalOrd k => Ord1 (Map k)Defined in containers-0.7 · Data.Map.Internal(Ord k, Read k) => Read1 (Map k)Defined in containers-0.7 · Data.Map.InternalShow k => Show1 (Map k)Defined in containers-0.7 · Data.Map.InternalHashable k => Hashable1 (Map k)Defined in hashable-1.4.7.0 · Data.Hashable.ClassOrd k => Alt (Map k)Defined in semigroupoids-6.0.1 · Data.Functor.AltOrd k => Apply (Map k)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassA 'Map k' is not Applicative, but it is an instance of Apply
Ord k => Bind (Map k)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassOrd k => Plus (Map k)Defined in semigroupoids-6.0.1 · Data.Functor.PlusInvariant (Map k)Defined in invariant-0.6.4 · Data.Functor.Invariantfrom the
containerspackageOrd k => Adjustable (Map k)Defined in keys-3.12.3 · Data.KeyFoldableWithKey (Map k)Defined in keys-3.12.3 · Data.KeyOrd k => Indexable (Map k)Defined in keys-3.12.3 · Data.KeyKeyed (Map k)Defined in keys-3.12.3 · Data.KeyOrd k => Lookup (Map k)Defined in keys-3.12.3 · Data.KeyTraversableWithKey (Map k)Defined in keys-3.12.3 · Data.KeyOrd k => Zip (Map k)Defined in keys-3.12.3 · Data.KeyOrd k => ZipWithKey (Map k)Defined in keys-3.12.3 · Data.KeyDefault k => Pointed (Map k)Defined in pointed-5.0.4 · Data.PointedOrd k => IsList (Map k v)Defined in containers-0.7 · Data.Map.Internal(Eq k, Eq a) => Eq (Map k a)Defined in containers-0.7 · Data.Map.Internal(Data k, Data a, Ord k) => Data (Map k a)Defined in containers-0.7 · Data.Map.Internal(Ord k, Ord v) => Ord (Map k v)Defined in containers-0.7 · Data.Map.Internal(Ord k, Read k, Read e) => Read (Map k e)Defined in containers-0.7 · Data.Map.Internal(Show k, Show a) => Show (Map k a)Defined in containers-0.7 · Data.Map.InternalOrd k => Semigroup (Map k v)Defined in containers-0.7 · Data.Map.InternalOrd k => Monoid (Map k v)Defined in containers-0.7 · Data.Map.Internal(NFData k, NFData a) => NFData (Map k a)Defined in containers-0.7 · Data.Map.Internal(Binary k, Binary e) => Binary (Map k e)Defined in binary-0.8.9.3 · Data.Binary.Class(Hashable k, Hashable v) => Hashable (Map k v)Defined in hashable-1.4.7.0 · Data.Hashable.ClassDefault (Map k v)Defined in data-default-0.8.0.1 · Data.Default.Internaltype Item (Map k v) = (k, v)Defined in containers-0.7 · Data.Map.Internaltype Key (Map k) = kDefined in keys-3.12.3 · Data.Key
The class of monoids (types with an associative binary operation that has an identity). Instances should satisfy the following:
- Right identity
- Left identity
- Associativity
(
law)
- Concatenation
You can alternatively define mconcat instead of mempty, in which case the laws are:
- Unit
- Multiplication
- Subclass
The method names refer to the monoid of lists under concatenation, but there are many other instances.
Some types can be viewed as a monoid in more than one way,
e.g. both addition and multiplication on numbers.
In such cases we often define newtypes and make those instances
of Monoid, e.g. Data.Semigroup.Sum and Data.Semigroup.Product.
NOTE: Semigroup is a superclass of Monoid since base-4.11.0.0.
Methods
mempty :: aIdentity of mappend
Examples
Example1 expression "Hello world" <> mempty"Hello world"
Example1 expression mempty <> [1, 2, 3][1,2,3]
mappend :: a -> a -> aAn associative operation
NOTE: This method is redundant and has the default implementation
mappend = (<>)since base-4.11.0.0. Should it be implemented manually, since mappend is a synonym for (<>), it is expected that the two functions are defined the same way. In a future GHC release mappend will be removed from Monoid.mconcat :: [a] -> aFold a list using the monoid.
For most types, the default definition for mconcat will be used, but the function is included in the class definition so that an optimized version can be provided for specific types.
Example1 expression mconcat ["Hello", " ", "Haskell", "!"]"Hello Haskell!"
Instances103Monoid, …
Monoid ByteArrayDefined in base-4.20.2.0 · Data.Array.ByteMonoid BuilderDefined in bytestring-0.12.2.0 · Data.ByteString.Builder.InternalMonoid ByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Internal.TypeMonoid ByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Lazy.InternalMonoid ShortByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Short.InternalMonoid IntSetDefined in containers-0.7 · Data.IntSet.InternalMonoid AllDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalMonoid AnyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalMonoid EventDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Internal.TypesMonoid EventLifetimeDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Internal.TypesMonoid LifetimeDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Internal.Typesmappendtakes the longer of two lifetimes.Monoid ExceptionContextDefined in ghc-internal-9.1003.0 · GHC.Internal.Exception.ContextMonoid OrderingDefined in ghc-internal-9.1003.0 · GHC.Internal.BaseMonoid OsStringDefined in os-string-2.0.7 · System.OsString.Internal.Types"String-Concatenation" for OsString. This is not the same as
(</>).Monoid PosixStringDefined in os-string-2.0.7 · System.OsString.Internal.TypesMonoid WindowsStringDefined in os-string-2.0.7 · System.OsString.Internal.TypesMonoid DocDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJMonoid TextDefined in text-2.1.3 · Data.Text · orphanMonoid BuilderDefined in text-2.1.3 · Data.Text.Internal.BuilderMonoid TextDefined in text-2.1.3 · Data.Text.Lazy · orphanMonoid StrictTextBuilderDefined in text-2.1.3 · Data.Text.Internal.StrictBuilderMonoid CalendarDiffDaysDefined in time-1.12.2 · Data.Time.Calendar.CalendarDiffDaysAdditive
Monoid CalendarDiffTimeDefined in time-1.12.2 · Data.Time.LocalTime.Internal.CalendarDiffTimeAdditive
Monoid ()Defined in ghc-internal-9.1003.0 · GHC.Internal.BaseMonoid (Comparison a)Defined in base-4.20.2.0 · Data.Functor.ContravariantMonoid (Equivalence a)Defined in base-4.20.2.0 · Data.Functor.ContravariantMonoid (Predicate a)Defined in base-4.20.2.0 · Data.Functor.ContravariantMonoid (PutM ())Defined in binary-0.8.9.3 · Data.Binary.PutMonoid (IntMap a)Defined in containers-0.7 · Data.IntMap.InternalMonoid (Seq a)Defined in containers-0.7 · Data.Sequence.InternalMonoid (MergeSet a)Defined in containers-0.7 · Data.Set.InternalMonoid (DList a)Defined in dlist-1.0 · Data.DList.InternalMonoid (First a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidMonoid (Last a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidMonoid (Endo a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalMonoid (Doc a)Defined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJMonoid (Array a)Defined in primitive-0.9.1.0 · Data.Primitive.ArrayMonoid (PrimArray a)Defined in primitive-0.9.1.0 · Data.Primitive.PrimArrayMonoid (SmallArray a)Defined in primitive-0.9.1.0 · Data.Primitive.SmallArrayMonoid (Validity k)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal.DebugMonoid (Vector a)Defined in vector-0.13.2.0 · Data.VectorMonoid (Vector a)Defined in vector-0.13.2.0 · Data.Vector.StrictMonoid [a]Defined in ghc-internal-9.1003.0 · GHC.Internal.BaseMonoid a => Monoid (STM a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Conc.SyncMonoid a => Monoid (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityMonoid a => Monoid (Down a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.OrdMonoid a => Monoid (Dual a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalMonoid a => Monoid (IO a)Defined in ghc-internal-9.1003.0 · GHC.Internal.BaseMonoid a => Monoid (Q a)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxMonoid a => Monoid (a)Defined in ghc-internal-9.1003.0 · GHC.Internal.BaseMonoid m => Monoid (WrappedMonoid m)Defined in base-4.20.2.0 · Data.SemigroupMonoid p => Monoid (Par1 p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsSemigroup a => Monoid (Maybe a)Defined in ghc-internal-9.1003.0 · GHC.Internal.BaseLift a semigroup into Maybe forming a Monoid according to http://en.wikipedia.org/wiki/Monoid: "Any semigroup
Smay be turned into a monoid simply by adjoining an elementenot inSand defininge*e = eande*s = s = s*efor alls ∈ S."Since 4.11.0: constraint on inner
avalue generalised from Monoid to Semigroup.Bits a => Monoid (Ior a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsBits a => Monoid (Xor a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsFiniteBits a => Monoid (And a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsThis constraint is arguably too strong. However, as some types (such as
Natural) have undefined complement, this is the only safe choice.FiniteBits a => Monoid (Iff a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsThis constraint is arguably too strong. However, as some types (such as
Natural) have undefined complement, this is the only safe choice.Storable a => Monoid (Vector a)Defined in vector-0.13.2.0 · Data.Vector.StorableNum a => Monoid (Product a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalNum a => Monoid (Sum a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalOrd a => Monoid (Set a)Defined in containers-0.7 · Data.Set.InternalOrd a => Monoid (Max a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.UtilsOrd a => Monoid (Min a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.UtilsHashable a => Monoid (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.InternalPrim a => Monoid (Vector a)Defined in vector-0.13.2.0 · Data.Vector.PrimitiveUnbox a => Monoid (Vector a)Defined in vector-0.13.2.0 · Data.Vector.Unboxed · orphan(Generic a, Monoid (Rep a ())) => Monoid (Generically a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics(Generic a, GMonoid (Rep a)) => Monoid (GenericSemigroupMonoid a)Defined in semigroups-0.20 · Data.Semigroup.Generic(Ord a, Bounded a) => Monoid (Max a)Defined in base-4.20.2.0 · Data.Semigroup(Ord a, Bounded a) => Monoid (Min a)Defined in base-4.20.2.0 · Data.SemigroupMonoid (Alt f a)Defined in free-5.2 · Control.Alternative.FreeMonoid (Alt f a)Defined in free-5.2 · Control.Alternative.Free.FinalMonoid (Proxy s)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.ProxyMonoid (U1 p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsMonoid a => Monoid (Op a b)Defined in base-4.20.2.0 · Data.Functor.Contravariantmempty @(Op a b)without newtypes ismempty @(b->a)=_ -> mempty.mempty :: Op a b mempty = Op _ -> memptyMonoid a => Monoid (ST s a)Defined in ghc-internal-9.1003.0 · GHC.Internal.STMonoid b => Monoid (a -> b)Defined in ghc-internal-9.1003.0 · GHC.Internal.BaseMonoid e => Monoid (Validation e a)Defined in either-5.0.3 · Data.Either.ValidationOrd k => Monoid (Map k v)Defined in containers-0.7 · Data.Map.InternalHashable k => Monoid (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal(Monad m, Semigroup a, Monoid a) => Monoid (IterT m a)Defined in free-5.2 · Control.Monad.Trans.Iter(Monoid a, Monoid b) => Monoid (a, b)Defined in ghc-internal-9.1003.0 · GHC.Internal.BaseAlternative f => Monoid (Alt f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalApplicative f => Monoid (Traversed a f)Defined in indexed-traversable-0.1.4 · WithIndexMonad m => Monoid (Sequenced a m)Defined in indexed-traversable-0.1.4 · WithIndexMonoid (f p) => Monoid (Rec1 f p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsMonoid a => Monoid (Const a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.ConstMonoid a => Monoid (Constant a b)Defined in transformers-0.6.1.1 · Data.Functor.ConstantArrowPlus p => Monoid (Tambara p a b)Defined in profunctors-5.6.3 · Data.Profunctor.Strong(Biapplicative bi, Monoid a, Monoid b) => Monoid (Biap bi a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.Biap(Applicative f, Monoid a) => Monoid (Ap f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Monoid(Monoid a, Monoid b, Monoid c) => Monoid (a, b, c)Defined in ghc-internal-9.1003.0 · GHC.Internal.Base(Semigroup a, Monoid a) => Monoid (Tagged s a)Defined in tagged-0.8.9 · Data.Tagged(Profunctor p, Arrow p, Semigroup b, Monoid b) => Monoid (Closure p a b)Defined in profunctors-5.6.3 · Data.Profunctor.ClosedMonoid c => Monoid (K1 i c p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsMonoid r => Monoid (Forget r a b)Defined in profunctors-5.6.3 · Data.Profunctor.TypesVia
Monoid r => (a -> r)(Monoid (f a), Monoid (g a)) => Monoid (Product f g a)Defined in base-4.20.2.0 · Data.Functor.Product(Monoid (f p), Monoid (g p)) => Monoid ((:*:) f g p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics(Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d)Defined in ghc-internal-9.1003.0 · GHC.Internal.BaseMonoid (f (g a)) => Monoid (Compose f g a)Defined in base-4.20.2.0 · Data.Functor.ComposeMonoid (f (g p)) => Monoid ((:.:) f g p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsMonoid (f p) => Monoid (M1 i c f p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics(Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e)Defined in ghc-internal-9.1003.0 · GHC.Internal.Base
A set of values a.
Instances20Foldable, Eq1, Ord1, Show1, Hashable1, Pointed, …
Foldable SetDefined in containers-0.7 · Data.Set.InternalFolds in order of increasing key.
Eq1 SetDefined in containers-0.7 · Data.Set.InternalOrd1 SetDefined in containers-0.7 · Data.Set.InternalShow1 SetDefined in containers-0.7 · Data.Set.InternalHashable1 SetDefined in hashable-1.4.7.0 · Data.Hashable.ClassPointed SetDefined in pointed-5.0.4 · Data.PointedLift a => Lift (Set a)Defined in containers-0.7 · Data.Set.InternalOrd a => IsList (Set a)Defined in containers-0.7 · Data.Set.InternalEq a => Eq (Set a)Defined in containers-0.7 · Data.Set.Internal(Data a, Ord a) => Data (Set a)Defined in containers-0.7 · Data.Set.InternalOrd a => Ord (Set a)Defined in containers-0.7 · Data.Set.Internal(Read a, Ord a) => Read (Set a)Defined in containers-0.7 · Data.Set.InternalShow a => Show (Set a)Defined in containers-0.7 · Data.Set.InternalOrd a => Semigroup (Set a)Defined in containers-0.7 · Data.Set.InternalOrd a => Monoid (Set a)Defined in containers-0.7 · Data.Set.InternalNFData a => NFData (Set a)Defined in containers-0.7 · Data.Set.InternalBinary a => Binary (Set a)Defined in binary-0.8.9.3 · Data.Binary.ClassHashable v => Hashable (Set v)Defined in hashable-1.4.7.0 · Data.Hashable.ClassDefault (Set v)Defined in data-default-0.8.0.1 · Data.Default.Internaltype Item (Set a) = aDefined in containers-0.7 · Data.Set.Internal
A space efficient, packed, unboxed Unicode text type.
Instances15IsList, Eq, Data, Ord, Read, Show, …
IsList TextDefined in text-2.1.3 · Data.Text · orphanPerforms replacement on invalid scalar values:
Example2 expressions :set -XOverloadedLists['\55555'] :: Text"\65533"
Eq TextDefined in text-2.1.3 · Data.Text · orphanData TextDefined in text-2.1.3 · Data.Text · orphanThis 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 andData.Map.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
Data.Map.Mapis archived here: Proposal: Allow gunfold for Data.Map, ...Ord TextDefined in text-2.1.3 · Data.Text · orphanRead TextDefined in text-2.1.3 · Data.Text · orphanShow TextDefined in text-2.1.3 · Data.Text.Show · orphanIsString TextDefined in text-2.1.3 · Data.Text · orphanPerforms replacement on invalid scalar values:
Example2 expressions :set -XOverloadedStrings"\55555" :: Text"\65533"
Semigroup TextDefined in text-2.1.3 · Data.Text · orphanBeware:
stimeswill crash if the given number does not fit into anInt.Monoid TextDefined in text-2.1.3 · Data.Text · orphanPrintfArg TextDefined in text-2.1.3 · Data.Text · orphanNFData TextDefined in text-2.1.3 · Data.Text · orphanBinary TextDefined in text-2.1.3 · Data.Text · orphanHashable TextDefined in hashable-1.4.7.0 · Data.Hashable.ClassLift TextDefined in text-2.1.3 · Data.Text · orphantype Item Text = CharDefined in text-2.1.3 · Data.Text · orphan
A value of type IO a is a computation which, when performed,
does some I/O before returning a value of type a.
There is really only one way to "perform" an I/O action: bind it to
Main.main in your program. When your program is run, the I/O will
be performed. It isn't possible to perform I/O from an arbitrary
function, unless that function is itself in the IO monad and called
at some point, directly or indirectly, from Main.main.
IO is a monad, so IO actions can be combined using either the do-notation
or the Prelude.>> and Prelude.>>= operations from the Prelude.Monad
class.
Instances51Monad, Functor, MonadFix, MonadFail, Applicative, GHCiSandboxIO, …
Monad IODefined in ghc-internal-9.1003.0 · GHC.Internal.BaseFunctor IODefined in ghc-internal-9.1003.0 · GHC.Internal.BaseMonadFix IODefined in ghc-internal-9.1003.0 · GHC.Internal.Control.Monad.FixMonadFail IODefined in ghc-internal-9.1003.0 · GHC.Internal.Control.Monad.FailApplicative IODefined in ghc-internal-9.1003.0 · GHC.Internal.BaseGHCiSandboxIO IODefined in ghc-internal-9.1003.0 · GHC.Internal.GHCiQuote IODefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxAlternative IODefined in ghc-internal-9.1003.0 · GHC.Internal.BaseMonadPlus IODefined in ghc-internal-9.1003.0 · GHC.Internal.BaseMonadIO IODefined in base-4.20.2.0 · Control.Monad.IO.ClassQuasi IODefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxMonadCatch IODefined in exceptions-0.10.9 · Control.Monad.CatchMonadMask IODefined in exceptions-0.10.9 · Control.Monad.CatchMonadThrow IODefined in exceptions-0.10.9 · Control.Monad.CatchPrimBase IODefined in primitive-0.9.1.0 · Control.Monad.PrimitivePrimMonad IODefined in primitive-0.9.1.0 · Control.Monad.PrimitiveAlt IODefined in semigroupoids-6.0.1 · Data.Functor.AltThis instance does not actually satisfy the (<.>) right distributive law It instead satisfies the "left catch" law
Apply IODefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind IODefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassPlus IODefined in semigroupoids-6.0.1 · Data.Functor.PlusInvariant IODefined in invariant-0.6.4 · Data.Functor.InvariantSelective IODefined in selective-0.7.0.1 · Control.SelectivePointed IODefined in pointed-5.0.4 · Data.PointedMonadError IOException IODefined in mtl-2.3.1 · Control.Monad.Error.ClassMonadBase IO IODefined in transformers-base-0.4.6 · Control.Monad.BaseMArray IOUArray Int16 IODefined in array-0.5.8.0 · Data.Array.IO.InternalsMArray IOUArray Int32 IODefined in array-0.5.8.0 · Data.Array.IO.InternalsMArray IOUArray Int64 IODefined in array-0.5.8.0 · Data.Array.IO.InternalsMArray IOUArray Int8 IODefined in array-0.5.8.0 · Data.Array.IO.InternalsMArray IOUArray Word16 IODefined in array-0.5.8.0 · Data.Array.IO.InternalsMArray IOUArray Word32 IODefined in array-0.5.8.0 · Data.Array.IO.InternalsMArray IOUArray Word64 IODefined in array-0.5.8.0 · Data.Array.IO.InternalsMArray IOUArray Word8 IODefined in array-0.5.8.0 · Data.Array.IO.InternalsMArray IOUArray Bool IODefined in array-0.5.8.0 · Data.Array.IO.InternalsMArray IOUArray Char IODefined in array-0.5.8.0 · Data.Array.IO.InternalsMArray IOUArray Double IODefined in array-0.5.8.0 · Data.Array.IO.InternalsMArray IOUArray Float IODefined in array-0.5.8.0 · Data.Array.IO.InternalsMArray IOUArray Int IODefined in array-0.5.8.0 · Data.Array.IO.InternalsMArray IOUArray Word IODefined in array-0.5.8.0 · Data.Array.IO.InternalsMArray IOArray e IODefined in array-0.5.8.0 · Data.Array.BaseMArray TArray e IODefined in stm-2.5.3.1 · Control.Concurrent.STM.TArrayWrites are slow in IO.
Storable e => MArray StorableArray e IODefined in array-0.5.8.0 · Data.Array.Storable.InternalsMArray IOUArray (FunPtr a) IODefined in array-0.5.8.0 · Data.Array.IO.InternalsMArray IOUArray (Ptr a) IODefined in array-0.5.8.0 · Data.Array.IO.InternalsMArray IOUArray (StablePtr a) IODefined in array-0.5.8.0 · Data.Array.IO.InternalsSemigroup a => Semigroup (IO a)Defined in ghc-internal-9.1003.0 · GHC.Internal.BaseMonoid a => Monoid (IO a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Basea ~ () => HPrintfType (IO a)Defined in base-4.20.2.0 · Text.Printfa ~ () => PrintfType (IO a)Defined in base-4.20.2.0 · Text.PrintfHasGetter (IO a) aDefined in StateVar-1.2.2 · Data.StateVartype PrimState IO = RealWorldDefined in primitive-0.9.1.0 · Control.Monad.Primitive
Efficient, machine-independent access to the components of a floating-point number.
Methods
floatRadix :: a -> Integera constant function, returning the radix of the representation (often
2)floatDigits :: a -> Inta constant function, returning the number of digits of floatRadix in the significand
floatRange :: a -> (Int, Int)a constant function, returning the lowest and highest values the exponent may assume
decodeFloat :: a -> (Integer, Int)The function decodeFloat applied to a real floating-point number returns the significand expressed as an Integer and an appropriately scaled exponent (an Int). If
decodeFloat xyields(m,n), thenxis equal in value tom*b^^n, wherebis the floating-point radix, and furthermore, eithermandnare both zero or elseb^(d-1) <= abs m < b^d, wheredis the value offloatDigits x. In particular,decodeFloat 0 = (0,0). If the type contains a negative zero, alsodecodeFloat (-0.0) = (0,0). The result ofdecodeFloat xis unspecified if either ofisNaN xorisInfinite xis True.encodeFloat :: Integer -> Int -> aencodeFloat performs the inverse of decodeFloat in the sense that for finite
xwith the exception of-0.0,.Prelude.uncurryencodeFloat (decodeFloat x) = xencodeFloat m nis one of the two closest representable floating-point numbers tom*b^^n(or±Infinityif overflow occurs); usually the closer, but ifmcontains too many bits, the result may be rounded in the wrong direction.exponent :: a -> Intexponent corresponds to the second component of decodeFloat.
exponent 0 = 0and for finite nonzerox,exponent x = snd (decodeFloat x) + floatDigits x. Ifxis a finite floating-point number, it is equal in value tosignificand x * b ^^ exponent x, wherebis the floating-point radix. The behaviour is unspecified on infinite orNaNvalues.significand :: a -> aThe first component of decodeFloat, scaled to lie in the open interval (
-1,1), either0.0or of absolute value>= 1/b, wherebis the floating-point radix. The behaviour is unspecified on infinite orNaNvalues.scaleFloat :: Int -> a -> amultiplies a floating-point number by an integer power of the radix
isNaN :: a -> BoolTrue if the argument is an IEEE "not-a-number" (NaN) value
isInfinite :: a -> BoolTrue if the argument is an IEEE infinity or negative infinity
isDenormalized :: a -> BoolTrue if the argument is too small to be represented in normalized format
isNegativeZero :: a -> BoolTrue if the argument is an IEEE negative zero
isIEEE :: a -> BoolTrue if the argument is an IEEE floating point number
atan2 :: a -> a -> aa version of arctangent taking two real floating-point arguments. For real floating
xandy,atan2 y xcomputes the angle (from the positive x-axis) of the vector from the origin to the point(x,y).atan2 y xreturns a value in the range [-pi,pi]. It follows the Common Lisp semantics for the origin when signed zeroes are supported.atan2 y 1, withyin a type that is RealFloat, should return the same value asatan y. A default definition of atan2 is provided, but implementors can provide a more accurate implementation.
Instances9RealFloat, …
RealFloat CDoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRealFloat CFloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRealFloat DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.FloatRealFloat FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.FloatRealFloat a => RealFloat (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityRealFloat a => RealFloat (Down a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.OrdRealFloat a => RealFloat (Const a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.ConstRealFloat a => RealFloat (Tagged s a)Defined in tagged-0.8.9 · Data.TaggedRealFloat (f (g a)) => RealFloat (Compose f g a)Defined in base-4.20.2.0 · Data.Functor.Compose
Parsing of Strings, producing values.
Derived instances of Read make the following assumptions, which
derived instances of Text.Show.Show obey:
If the constructor is defined to be an infix operator, then the derived Read instance will parse only infix applications of the constructor (not the prefix form).
Associativity is not used to reduce the occurrence of parentheses, although precedence may be.
If the constructor is defined using record syntax, the derived Read will parse only the record-syntax form, and furthermore, the fields must be given in the same order as the original declaration.
The derived Read instance allows arbitrary Haskell whitespace between tokens of the input string. Extra parentheses are also allowed.
For example, given the declarations
infixr 5 :^:
data Tree a = Leaf a | Tree a :^: Tree athe derived instance of Read in Haskell 2010 is equivalent to
instance (Read a) => Read (Tree a) where
readsPrec d r = readParen (d > app_prec)
(\r -> [(Leaf m,t) |
("Leaf",s) <- lex r,
(m,t) <- readsPrec (app_prec+1) s]) r
++ readParen (d > up_prec)
(\r -> [(u:^:v,w) |
(u,s) <- readsPrec (up_prec+1) r,
(":^:",t) <- lex s,
(v,w) <- readsPrec (up_prec+1) t]) r
where app_prec = 10
up_prec = 5Note that right-associativity of :^: is unused.
The derived instance in GHC is equivalent to
instance (Read a) => Read (Tree a) where
readPrec = parens $ (prec app_prec $ do
Ident "Leaf" <- lexP
m <- step readPrec
return (Leaf m))
+++ (prec up_prec $ do
u <- step readPrec
Symbol ":^:" <- lexP
v <- step readPrec
return (u :^: v))
where app_prec = 10
up_prec = 5
readListPrec = readListPrecDefaultWhy do both readsPrec and readPrec exist, and why does GHC opt to implement readPrec in derived Read instances instead of readsPrec? The reason is that readsPrec is based on the ReadS type, and although ReadS is mentioned in the Haskell 2010 Report, it is not a very efficient parser data structure.
readPrec, on the other hand, is based on a much more efficient ReadPrec
datatype (a.k.a "new-style parsers"), but its definition relies on the use
of the RankNTypes language extension. Therefore, readPrec (and its
cousin, readListPrec) are marked as GHC-only. Nevertheless, it is
recommended to use readPrec instead of readsPrec whenever possible
for the efficiency improvements it brings.
As mentioned above, derived Read instances in GHC will implement readPrec instead of readsPrec. The default implementations of readsPrec (and its cousin, readList) will simply use readPrec under the hood. If you are writing a Read instance by hand, it is recommended to write it like so:
instance Read T where
readPrec = ...
readListPrec = readListPrecDefault
Methods
readsPrec :: Int -> ReadS aattempts to parse a value from the front of the string, returning a list of (parsed value, remaining string) pairs. If there is no successful parse, the returned list is empty.
Derived instances of Read and
Text.Show.Showsatisfy the following:That is, readsPrec parses the string produced by showsPrec, and delivers the value that showsPrec started with.
readList :: ReadS [a]readPrec :: ReadPrec aProposed replacement for readsPrec using new-style parsers (GHC only).
readListPrec :: ReadPrec [a]Proposed replacement for readList using new-style parsers (GHC only). The default definition uses readList. Instances that define readPrec should also define readListPrec as readListPrecDefault.
Instances240Read, …
Read OptionsDefined in bifunctors-5.6.2 · Data.Bifunctor.THRead ByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Internal.TypeRead ByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Lazy.InternalRead ShortByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Short.InternalRead IntSetDefined in containers-0.7 · Data.IntSet.InternalRead IntegerDefined in ghc-internal-9.1003.0 · GHC.Internal.ReadRead NaturalDefined in ghc-internal-9.1003.0 · GHC.Internal.ReadRead VoidDefined in ghc-internal-9.1003.0 · GHC.Internal.ReadRead ByteOrderDefined in ghc-internal-9.1003.0 · GHC.Internal.ByteOrderRead AllDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalRead AnyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalRead VersionDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.VersionRead CBoolDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CClockDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CDoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CFloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CIntMaxDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CIntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CLLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CPtrdiffDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CSCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CSUSecondsDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CShortDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CSigAtomicDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CSizeDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CTimeDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CUCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CUIntMaxDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CUIntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CULLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CULongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CUSecondsDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CUShortDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CWcharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead IntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.PtrRead WordPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.PtrRead AssociativityDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsRead DecidedStrictnessDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsRead FixityDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsRead SourceStrictnessDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsRead SourceUnpackednessDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsRead SeekModeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.DeviceRead ExitCodeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.ExceptionRead BufferModeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.Handle.TypesRead NewlineDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.Handle.TypesRead NewlineModeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.Handle.TypesRead IOModeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.IOModeRead Int16Defined in ghc-internal-9.1003.0 · GHC.Internal.IntRead Int32Defined in ghc-internal-9.1003.0 · GHC.Internal.IntRead Int64Defined in ghc-internal-9.1003.0 · GHC.Internal.IntRead Int8Defined in ghc-internal-9.1003.0 · GHC.Internal.IntRead GCDetailsDefined in ghc-internal-9.1003.0 · GHC.Internal.StatsRead RTSStatsDefined in ghc-internal-9.1003.0 · GHC.Internal.StatsRead CBlkCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesRead CBlkSizeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesRead CCcDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesRead CClockIdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesRead CDevDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesRead CFsBlkCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesRead CFsFilCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesRead CGidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesRead CIdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesRead CInoDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesRead CKeyDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesRead CModeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesRead CNfdsDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesRead CNlinkDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesRead COffDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesRead CPidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesRead CRLimDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesRead CSocklenDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesRead CSpeedDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesRead CSsizeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesRead CTcflagDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesRead CUidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesRead FdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesRead LexemeDefined in ghc-internal-9.1003.0 · GHC.Internal.ReadRead SomeCharDefined in ghc-internal-9.1003.0 · GHC.Internal.TypeLitsRead SomeSymbolDefined in ghc-internal-9.1003.0 · GHC.Internal.TypeLitsRead SomeNatDefined in ghc-internal-9.1003.0 · GHC.Internal.TypeNatsRead GeneralCategoryDefined in ghc-internal-9.1003.0 · GHC.Internal.ReadRead Word16Defined in ghc-internal-9.1003.0 · GHC.Internal.ReadRead Word32Defined in ghc-internal-9.1003.0 · GHC.Internal.ReadRead Word64Defined in ghc-internal-9.1003.0 · GHC.Internal.ReadRead Word8Defined in ghc-internal-9.1003.0 · GHC.Internal.ReadRead BoolDefined in ghc-internal-9.1003.0 · GHC.Internal.ReadRead CharDefined in ghc-internal-9.1003.0 · GHC.Internal.ReadRead DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.ReadRead FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.ReadRead IntDefined in ghc-internal-9.1003.0 · GHC.Internal.ReadRead OrderingDefined in ghc-internal-9.1003.0 · GHC.Internal.ReadRead WordDefined in ghc-internal-9.1003.0 · GHC.Internal.ReadRead OptionsDefined in invariant-0.6.4 · Data.Functor.Invariant.THRead ScientificDefined in scientific-0.3.8.0 · Data.ScientificSupports the skipping of parentheses and whitespaces. Example:
> read " ( (( -1.0e+3 ) ))" :: Scientific -1000.0(Note: This
Readinstance makes internal use of scientificP to parse the floating-point number.)Read SMGenDefined in splitmix-0.1.3.1 · System.Random.SplitMixExample1 expression readMaybe "SMGen 1 1" :: Maybe SMGenJust (SMGen 1 1)
Example1 expression readMaybe "SMGen 1 2" :: Maybe SMGenNothing
Example1 expression readMaybe (show (mkSMGen 42)) :: Maybe SMGenJust (SMGen 9297814886316923340 13679457532755275413)
Read SMGenDefined in splitmix-0.1.3.1 · System.Random.SplitMix32Example1 expression readMaybe "SMGen 1 1" :: Maybe SMGenJust (SMGen 1 1)
Example1 expression readMaybe "SMGen 1 2" :: Maybe SMGenNothing
Example1 expression readMaybe (show (mkSMGen 42)) :: Maybe SMGenJust (SMGen 142593372 1604540297)
Read I8Defined in text-2.1.3 · Data.Text.ForeignRead TextDefined in text-2.1.3 · Data.Text · orphanRead TextDefined in text-2.1.3 · Data.Text.Lazy · orphanRead FPFormatDefined in text-2.1.3 · Data.Text.Lazy.Builder.RealFloatRead DatatypeVariantDefined in th-abstraction-0.7.1.0 · Language.Haskell.TH.DatatypeRead DayDefined in time-1.12.2 · Data.Time.Format.Parse · orphanRead MonthDefined in time-1.12.2 · Data.Time.Calendar.MonthRead as
yyyy-mm.Read QuarterDefined in time-1.12.2 · Data.Time.Calendar.QuarterRead as
yyyy-Qn.Read QuarterOfYearDefined in time-1.12.2 · Data.Time.Calendar.QuarterRead DayOfWeekDefined in time-1.12.2 · Data.Time.Calendar.WeekRead DiffTimeDefined in time-1.12.2 · Data.Time.Clock.Internal.DiffTimeRead NominalDiffTimeDefined in time-1.12.2 · Data.Time.Clock.Internal.NominalDiffTimeRead UTCTimeDefined in time-1.12.2 · Data.Time.Format.Parse · orphanRead UniversalTimeDefined in time-1.12.2 · Data.Time.Format.Parse · orphanRead LocalTimeDefined in time-1.12.2 · Data.Time.Format.Parse · orphanRead TimeOfDayDefined in time-1.12.2 · Data.Time.Format.Parse · orphanRead TimeZoneDefined in time-1.12.2 · Data.Time.Format.Parse · orphanThis only works for
±HHMMformat, single-letter military time-zones, and these time-zones: "UTC", "UT", "GMT", "EST", "EDT", "CST", "CDT", "MST", "MDT", "PST", "PDT", per RFC 822 section 5.Read ZonedTimeDefined in time-1.12.2 · Data.Time.Format.Parse · orphanThis only works for a zonedTimeZone in
±HHMMformat, single-letter military time-zones, and these time-zones: "UTC", "UT", "GMT", "EST", "EDT", "CST", "CDT", "MST", "MDT", "PST", "PDT", per RFC 822 section 5.Read UUIDDefined in uuid-types-1.0.6 · Data.UUID.Types.InternalRead UnpackedUUIDDefined in uuid-types-1.0.6 · Data.UUID.Types.InternalRead ()Defined in ghc-internal-9.1003.0 · GHC.Internal.ReadRead a => Read (Complex a)Defined in base-4.20.2.0 · Data.ComplexRead a => Read (First a)Defined in base-4.20.2.0 · Data.SemigroupRead a => Read (Last a)Defined in base-4.20.2.0 · Data.SemigroupRead a => Read (Max a)Defined in base-4.20.2.0 · Data.SemigroupRead a => Read (Min a)Defined in base-4.20.2.0 · Data.SemigroupRead a => Read (Seq a)Defined in containers-0.7 · Data.Sequence.InternalRead a => Read (ViewL a)Defined in containers-0.7 · Data.Sequence.InternalRead a => Read (ViewR a)Defined in containers-0.7 · Data.Sequence.InternalRead a => Read (Tree a)Defined in containers-0.7 · Data.TreeRead a => Read (DNonEmpty a)Defined in dlist-1.0 · Data.DList.DNonEmpty.InternalRead a => Read (DList a)Defined in dlist-1.0 · Data.DList.InternalRead a => Read (NonEmpty a)Defined in ghc-internal-9.1003.0 · GHC.Internal.ReadRead a => Read (And a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsRead a => Read (Iff a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsRead a => Read (Ior a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsRead a => Read (Xor a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsRead a => Read (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityThis instance would be equivalent to the derived instances of the Identity newtype if the runIdentity field were removed
Read a => Read (First a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidRead a => Read (Last a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidRead a => Read (Down a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.OrdRead a => Read (Dual a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalRead a => Read (Product a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalRead a => Read (Sum a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalRead a => Read (ZipList a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Functor.ZipListRead a => Read (Maybe a)Defined in ghc-internal-9.1003.0 · GHC.Internal.ReadRead a => Read (Array a)Defined in primitive-0.9.1.0 · Data.Primitive.ArrayRead a => Read (SmallArray a)Defined in primitive-0.9.1.0 · Data.Primitive.SmallArrayRead a => Read (Vector a)Defined in vector-0.13.2.0 · Data.VectorRead a => Read (Vector a)Defined in vector-0.13.2.0 · Data.Vector.StrictRead a => Read (a)Defined in ghc-internal-9.1003.0 · GHC.Internal.ReadRead a => Read [a]Defined in ghc-internal-9.1003.0 · GHC.Internal.ReadRead e => Read (IntMap e)Defined in containers-0.7 · Data.IntMap.InternalRead m => Read (WrappedMonoid m)Defined in base-4.20.2.0 · Data.SemigroupRead p => Read (Par1 p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsRead vertex => Read (SCC vertex)Defined in containers-0.7 · Data.Graph(Read a, Storable a) => Read (Vector a)Defined in vector-0.13.2.0 · Data.Vector.Storable(Read a, Ord a) => Read (Set a)Defined in containers-0.7 · Data.Set.Internal(Read a, Prim a) => Read (Vector a)Defined in vector-0.13.2.0 · Data.Vector.Primitive(Read a, Unbox a) => Read (Vector a)Defined in vector-0.13.2.0 · Data.Vector.Unboxed · orphan(Integral a, Read a) => Read (Ratio a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Read(Hashable a, Read a) => Read (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.InternalHasResolution a => Read (Fixed a)Defined in base-4.20.2.0 · Data.FixedRead (Proxy t)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.ProxyRead (U1 p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsRead (V1 p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsRead (f a) => Read (Coyoneda f a)Defined in kan-extensions-5.2.7 · Data.Functor.Coyoneda(Read1 f, Read a) => Read (Cofree f a)Defined in free-5.2 · Control.Comonad.Cofree(Read1 f, Read a) => Read (Free f a)Defined in free-5.2 · Control.Monad.Free(Read1 f, Read a) => Read (Free f a)Defined in free-5.2 · Control.Monad.Free.Ap(Read1 f, Read a) => Read (Lift f a)Defined in transformers-0.6.1.1 · Control.Applicative.Lift(Read1 m, Read a) => Read (IterT m a)Defined in free-5.2 · Control.Monad.Trans.Iter(Read1 m, Read a) => Read (MaybeT m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Maybe(Read1 w, Read a) => Read (CoiterT w a)Defined in free-5.2 · Control.Comonad.Trans.Coiter(Functor f, Read (f a)) => Read (Yoneda f a)Defined in kan-extensions-5.2.7 · Data.Functor.Yoneda(Ix a, Read a, Read b) => Read (Array a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Read(Ix ix, Read ix, Read e, IArray UArray e) => Read (UArray ix e)Defined in array-0.5.8.0 · Data.Array.Base(Read a, Read b) => Read (Arg a b)Defined in base-4.20.2.0 · Data.Semigroup(Read a, Read b) => Read (Either a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Either(Read a, Read b) => Read (a, b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Read(Ord k, Read k, Read e) => Read (Map k e)Defined in containers-0.7 · Data.Map.Internal(Hashable k, Read k, Read e) => Read (HashMap k e)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal(GRead (Rep1 f a), Generic1 f) => Read (FunctorClassesDefault f a)Defined in transformers-compat-0.7.2 · Data.Functor.Classes.Generic.InternalRead (bi a b) => Read (Biap bi a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.BiapRead (f a) => Read (Ap f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidRead (f a) => Read (Alt f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalRead (f a) => Read (WrappedContravariant f a)Defined in invariant-0.6.4 · Data.Functor.InvariantRead (f a) => Read (WrappedFunctor f a)Defined in invariant-0.6.4 · Data.Functor.InvariantRead (f p) => Read (Rec1 f p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsRead (p (Fix p a) a) => Read (Fix p a)Defined in bifunctors-5.6.2 · Data.Bifunctor.FixRead (p a a) => Read (Join p a)Defined in bifunctors-5.6.2 · Data.Bifunctor.JoinRead (w (CofreeF f a (CofreeT f w a))) => Read (CofreeT f w a)Defined in free-5.2 · Control.Comonad.Trans.CofreeRead a => Read (Const a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.ConstRead a => Read (Constant a b)Defined in transformers-0.6.1.1 · Data.Functor.ConstantRead b => Read (Tagged s b)Defined in tagged-0.8.9 · Data.TaggedCoercible a b => Read (Coercion a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Coercion(Read1 f, Read1 m, Read a) => Read (FreeT f m a)Defined in free-5.2 · Control.Monad.Trans.Free(Read1 f, Read1 m, Read a) => Read (FreeT f m a)Defined in free-5.2 · Control.Monad.Trans.Free.Ap(Read1 f, Read a) => Read (Backwards f a)Defined in transformers-0.6.1.1 · Control.Applicative.Backwards(Read1 f, Read a) => Read (IdentityT f a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Identity(Read1 f, Read a) => Read (Reverse f a)Defined in transformers-0.6.1.1 · Data.Functor.Reverse(Read1 f, Read e, Read a) => Read (ExceptT e f a)Defined in selective-0.7.0.1 · Control.Selective.Trans.Except(Read a, Read (f b)) => Read (CofreeF f a b)Defined in free-5.2 · Control.Comonad.Trans.Cofree(Read a, Read (f b)) => Read (FreeF f a b)Defined in free-5.2 · Control.Monad.Trans.Free(Read a, Read (f b)) => Read (FreeF f a b)Defined in free-5.2 · Control.Monad.Trans.Free.Ap(Read a, Read b, Read c) => Read (a, b, c)Defined in ghc-internal-9.1003.0 · GHC.Internal.Read(Read e, Read1 m, Read a) => Read (ExceptT e m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Except(Read w, Read1 m, Read a) => Read (WriterT w m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Lazy(Read w, Read1 m, Read a) => Read (WriterT w m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Stricta ~ b => Read (a :~: b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.EqualityRead c => Read (K1 i c p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics(Read (f a), Read (g a)) => Read (Product f g a)Defined in base-4.20.2.0 · Data.Functor.Product(Read (f a), Read (g a)) => Read (Sum f g a)Defined in base-4.20.2.0 · Data.Functor.Sum(Read (f p), Read (g p)) => Read ((:*:) f g p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics(Read (f p), Read (g p)) => Read ((:+:) f g p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics(Read a, Read b, Read c, Read d) => Read (a, b, c, d)Defined in ghc-internal-9.1003.0 · GHC.Internal.Reada ~~ b => Read (a :~~: b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.EqualityRead (f (g a)) => Read (Compose f g a)Defined in base-4.20.2.0 · Data.Functor.ComposeRead (f (g p)) => Read ((:.:) f g p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsRead (f a) => Read (Clown f a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.ClownRead (f p) => Read (M1 i c f p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsRead (g b) => Read (Joker g a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.JokerRead (p a b) => Read (WrappedBifunctor p a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.WrappedRead (p a b) => Read (WrappedProfunctor p a b)Defined in invariant-0.6.4 · Data.Functor.InvariantRead (p b a) => Read (Flip p a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.Flip(Read a, Read b, Read c, Read d, Read e) => Read (a, b, c, d, e)Defined in ghc-internal-9.1003.0 · GHC.Internal.Read(Read (f a b), Read (g a b)) => Read (Product f g a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.Product(Read (p a b), Read (q a b)) => Read (Sum p q a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.Sum(Read a, Read b, Read c, Read d, Read e, Read f) => Read (a, b, c, d, e, f)Defined in ghc-internal-9.1003.0 · GHC.Internal.ReadRead (f (p a b)) => Read (Tannen f p a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.Tannen(Read a, Read b, Read c, Read d, Read e, Read f, Read g) => Read (a, b, c, d, e, f, g)Defined in ghc-internal-9.1003.0 · GHC.Internal.Read(Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h) => Read (a, b, c, d, e, f, g, h)Defined in ghc-internal-9.1003.0 · GHC.Internal.ReadRead (p (f a) (g b)) => Read (Biff p f g a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.Biff(Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h, Read i) => Read (a, b, c, d, e, f, g, h, i)Defined in ghc-internal-9.1003.0 · GHC.Internal.Read(Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h, Read i, Read j) => Read (a, b, c, d, e, f, g, h, i, j)Defined in ghc-internal-9.1003.0 · GHC.Internal.Read(Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h, Read i, Read j, Read k) => Read (a, b, c, d, e, f, g, h, i, j, k)Defined in ghc-internal-9.1003.0 · GHC.Internal.Read(Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h, Read i, Read j, Read k, Read l) => Read (a, b, c, d, e, f, g, h, i, j, k, l)Defined in ghc-internal-9.1003.0 · GHC.Internal.Read(Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h, Read i, Read j, Read k, Read l, Read m) => Read (a, b, c, d, e, f, g, h, i, j, k, l, m)Defined in ghc-internal-9.1003.0 · GHC.Internal.Read(Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h, Read i, Read j, Read k, Read l, Read m, Read n) => Read (a, b, c, d, e, f, g, h, i, j, k, l, m, n)Defined in ghc-internal-9.1003.0 · GHC.Internal.Read(Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h, Read i, Read j, Read k, Read l, Read m, Read n, Read o) => Read (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)Defined in ghc-internal-9.1003.0 · GHC.Internal.Read
Methods
iso8601Format :: Format tThe most commonly used ISO 8601 format for this type.
Instances8ISO8601, …
ISO8601 CalendarDiffDaysDefined in time-1.12.2 · Data.Time.Format.ISO8601PyYmMdD(ISO 8601:2004(E) sec. 4.4.3.2)ISO8601 DayDefined in time-1.12.2 · Data.Time.Format.ISO8601yyyy-mm-dd(ISO 8601:2004(E) sec. 4.1.2.2 extended format)ISO8601 UTCTimeDefined in time-1.12.2 · Data.Time.Format.ISO8601yyyy-mm-ddThh:mm:ss[.sss]Z(ISO 8601:2004(E) sec. 4.3.2 extended format)ISO8601 CalendarDiffTimeDefined in time-1.12.2 · Data.Time.Format.ISO8601PyYmMdDThHmMs[.sss]S(ISO 8601:2004(E) sec. 4.4.3.2)ISO8601 LocalTimeDefined in time-1.12.2 · Data.Time.Format.ISO8601yyyy-mm-ddThh:mm:ss[.sss](ISO 8601:2004(E) sec. 4.3.2 extended format)ISO8601 TimeOfDayDefined in time-1.12.2 · Data.Time.Format.ISO8601hh:mm:ss[.sss](ISO 8601:2004(E) sec. 4.2.2.2, 4.2.2.4(a) extended format)ISO8601 TimeZoneDefined in time-1.12.2 · Data.Time.Format.ISO8601±hh:mm(ISO 8601:2004(E) sec. 4.2.5.1 extended format)ISO8601 ZonedTimeDefined in time-1.12.2 · Data.Time.Format.ISO8601yyyy-mm-ddThh:mm:ss[.sss]±hh:mm(ISO 8601:2004(E) sec. 4.3.2 extended format)
Type representing Universally Unique Identifiers (UUID) as specified in RFC 4122.
Instances12Eq, Data, Ord, Read, Show, Storable, …
Eq UUIDDefined in uuid-types-1.0.6 · Data.UUID.Types.InternalData UUIDDefined in uuid-types-1.0.6 · Data.UUID.Types.InternalOrd UUIDDefined in uuid-types-1.0.6 · Data.UUID.Types.InternalRead UUIDDefined in uuid-types-1.0.6 · Data.UUID.Types.InternalShow UUIDDefined in uuid-types-1.0.6 · Data.UUID.Types.InternalStorable UUIDDefined in uuid-types-1.0.6 · Data.UUID.Types.InternalNFData UUIDDefined in uuid-types-1.0.6 · Data.UUID.Types.InternalRandom UUIDDefined in uuid-types-1.0.6 · Data.UUID.Types.InternalUniform UUIDDefined in uuid-types-1.0.6 · Data.UUID.Types.InternalBinary UUIDDefined in uuid-types-1.0.6 · Data.UUID.Types.InternalHashable UUIDDefined in uuid-types-1.0.6 · Data.UUID.Types.InternalLift UUIDDefined in uuid-types-1.0.6 · Data.UUID.Types.Internal
Instances44Monad, Functor, MonadFix, MonadFail, Applicative, Foldable, …
Monad VectorDefined in vector-0.13.2.0 · Data.VectorFunctor VectorDefined in vector-0.13.2.0 · Data.VectorMonadFix VectorDefined in vector-0.13.2.0 · Data.VectorMonadFail VectorDefined in vector-0.13.2.0 · Data.VectorApplicative VectorDefined in vector-0.13.2.0 · Data.VectorFoldable VectorDefined in vector-0.13.2.0 · Data.VectorTraversable VectorDefined in vector-0.13.2.0 · Data.VectorAlternative VectorDefined in vector-0.13.2.0 · Data.VectorMonadPlus VectorDefined in vector-0.13.2.0 · Data.VectorMonadZip VectorDefined in vector-0.13.2.0 · Data.VectorEq1 VectorDefined in vector-0.13.2.0 · Data.VectorOrd1 VectorDefined in vector-0.13.2.0 · Data.VectorRead1 VectorDefined in vector-0.13.2.0 · Data.VectorShow1 VectorDefined in vector-0.13.2.0 · Data.VectorNFData1 VectorDefined in vector-0.13.2.0 · Data.VectorHashable1 VectorDefined in vector-instances-3.4.2 · Data.Vector.Instances · orphanAlt VectorDefined in vector-instances-3.4.2 · Data.Vector.Instances · orphanApply VectorDefined in vector-instances-3.4.2 · Data.Vector.Instances · orphanBind VectorDefined in vector-instances-3.4.2 · Data.Vector.Instances · orphanExtend VectorDefined in vector-instances-3.4.2 · Data.Vector.Instances · orphanPlus VectorDefined in vector-instances-3.4.2 · Data.Vector.Instances · orphanAdjustable VectorDefined in vector-instances-3.4.2 · Data.Vector.Instances · orphanFoldableWithKey VectorDefined in vector-instances-3.4.2 · Data.Vector.Instances · orphanIndexable VectorDefined in vector-instances-3.4.2 · Data.Vector.Instances · orphanKeyed VectorDefined in vector-instances-3.4.2 · Data.Vector.Instances · orphanLookup VectorDefined in vector-instances-3.4.2 · Data.Vector.Instances · orphanTraversableWithKey VectorDefined in vector-instances-3.4.2 · Data.Vector.Instances · orphanZip VectorDefined in vector-instances-3.4.2 · Data.Vector.Instances · orphanZipWithKey VectorDefined in vector-instances-3.4.2 · Data.Vector.Instances · orphanPointed VectorDefined in vector-instances-3.4.2 · Data.Vector.Instances · orphanVector Vector aDefined in vector-0.13.2.0 · Data.VectorIsList (Vector a)Defined in vector-0.13.2.0 · Data.VectorEq a => Eq (Vector a)Defined in vector-0.13.2.0 · Data.VectorData a => Data (Vector a)Defined in vector-0.13.2.0 · Data.VectorOrd a => Ord (Vector a)Defined in vector-0.13.2.0 · Data.VectorRead a => Read (Vector a)Defined in vector-0.13.2.0 · Data.VectorShow a => Show (Vector a)Defined in vector-0.13.2.0 · Data.VectorSemigroup (Vector a)Defined in vector-0.13.2.0 · Data.VectorMonoid (Vector a)Defined in vector-0.13.2.0 · Data.VectorNFData a => NFData (Vector a)Defined in vector-0.13.2.0 · Data.VectorHashable a => Hashable (Vector a)Defined in vector-instances-3.4.2 · Data.Vector.Instances · orphantype Item (Vector a) = aDefined in vector-0.13.2.0 · Data.Vectortype Mutable Vector = MVectorDefined in vector-0.13.2.0 · Data.Vectortype Key Vector = IntDefined in vector-instances-3.4.2 · Data.Vector.Instances · orphan
Instances227Generic, …
Generic ShortByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Short.InternalGeneric ForeignSrcLangDefined in ghc-boot-th-9.10.3 · GHC.ForeignSrcLang.TypeGeneric ExtensionDefined in ghc-boot-th-9.10.3 · GHC.LanguageExtensions.TypeGeneric VoidDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric ByteOrderDefined in ghc-internal-9.1003.0 · GHC.Internal.ByteOrderGeneric ClosureTypeDefined in ghc-internal-9.1003.0 · GHC.Internal.ClosureTypesGeneric AllDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalGeneric AnyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalGeneric VersionDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.VersionGeneric FingerprintDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric AssociativityDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric DecidedStrictnessDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric FixityDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric SourceStrictnessDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric SourceUnpackednessDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric ExitCodeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.ExceptionGeneric CCFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric ConcFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric DebugFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric DoCostCentresDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric DoHeapProfileDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric DoTraceDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric GCFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric GiveGCStatsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric HpcFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric MiscFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric ParFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric ProfFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric RTSFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric TickyFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric TraceFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric SrcLocDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric GCDetailsDefined in ghc-internal-9.1003.0 · GHC.Internal.StatsGeneric RTSStatsDefined in ghc-internal-9.1003.0 · GHC.Internal.StatsGeneric GeneralCategoryDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric BoolDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric OrderingDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric OsCharDefined in os-string-2.0.7 · System.OsString.Internal.TypesGeneric OsStringDefined in os-string-2.0.7 · System.OsString.Internal.TypesGeneric PosixCharDefined in os-string-2.0.7 · System.OsString.Internal.TypesGeneric PosixStringDefined in os-string-2.0.7 · System.OsString.Internal.TypesGeneric WindowsCharDefined in os-string-2.0.7 · System.OsString.Internal.TypesGeneric WindowsStringDefined in os-string-2.0.7 · System.OsString.Internal.TypesGeneric ModeDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJGeneric StyleDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJGeneric TextDetailsDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJGeneric DocDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJGeneric AnnLookupDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric AnnTargetDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric BangDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric BndrVisDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric BodyDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric BytesDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric CallconvDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric ClauseDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric ConDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric DecDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric DecidedStrictnessDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric DerivClauseDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric DerivStrategyDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric DocLocDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric ExpDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric FamilyResultSigDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric FixityDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric FixityDirectionDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric ForeignDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric FunDepDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric GuardDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric InfoDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric InjectivityAnnDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric InlineDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric LitDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric LocDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric MatchDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric ModNameDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric ModuleDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric ModuleInfoDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric NameDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric NameFlavourDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric NameSpaceDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric NamespaceSpecifierDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric OccNameDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric OverlapDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric PatDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric PatSynArgsDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric PatSynDirDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric PhasesDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric PkgNameDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric PragmaDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric RangeDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric RoleDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric RuleBndrDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric RuleMatchDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric SafetyDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric SourceStrictnessDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric SourceUnpackednessDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric SpecificityDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric StmtDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric TyLitDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric TySynEqnDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric TypeDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric TypeFamilyHeadDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric ConstructorInfoDefined in th-abstraction-0.7.1.0 · Language.Haskell.TH.DatatypeGeneric ConstructorVariantDefined in th-abstraction-0.7.1.0 · Language.Haskell.TH.DatatypeGeneric DatatypeInfoDefined in th-abstraction-0.7.1.0 · Language.Haskell.TH.DatatypeGeneric DatatypeVariantDefined in th-abstraction-0.7.1.0 · Language.Haskell.TH.DatatypeGeneric FieldStrictnessDefined in th-abstraction-0.7.1.0 · Language.Haskell.TH.DatatypeGeneric StrictnessDefined in th-abstraction-0.7.1.0 · Language.Haskell.TH.DatatypeGeneric UnpackednessDefined in th-abstraction-0.7.1.0 · Language.Haskell.TH.DatatypeGeneric CalendarDiffDaysDefined in time-compat-1.9.8 · Data.Time.Orphans · orphanGeneric DayDefined in time-compat-1.9.8 · Data.Time.Orphans · orphanGeneric QuarterDefined in time-compat-1.9.8 · Data.Time.Orphans · orphanGeneric UTCTimeDefined in time-compat-1.9.8 · Data.Time.Orphans · orphanGeneric UniversalTimeDefined in time-compat-1.9.8 · Data.Time.Orphans · orphanGeneric CalendarDiffTimeDefined in time-compat-1.9.8 · Data.Time.Orphans · orphanGeneric LocalTimeDefined in time-compat-1.9.8 · Data.Time.Orphans · orphanGeneric TimeOfDayDefined in time-compat-1.9.8 · Data.Time.Orphans · orphanGeneric TimeZoneDefined in time-compat-1.9.8 · Data.Time.Orphans · orphanGeneric ZonedTimeDefined in time-compat-1.9.8 · Data.Time.Orphans · orphanGeneric ()Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (Complex a)Defined in base-4.20.2.0 · Data.ComplexGeneric (First a)Defined in base-4.20.2.0 · Data.SemigroupGeneric (Last a)Defined in base-4.20.2.0 · Data.SemigroupGeneric (Max a)Defined in base-4.20.2.0 · Data.SemigroupGeneric (Min a)Defined in base-4.20.2.0 · Data.SemigroupGeneric (WrappedMonoid m)Defined in base-4.20.2.0 · Data.SemigroupGeneric (SCC vertex)Defined in containers-0.7 · Data.GraphGeneric (Digit a)Defined in containers-0.7 · Data.Sequence.InternalGeneric (Elem a)Defined in containers-0.7 · Data.Sequence.InternalGeneric (FingerTree a)Defined in containers-0.7 · Data.Sequence.InternalGeneric (Node a)Defined in containers-0.7 · Data.Sequence.InternalGeneric (ViewL a)Defined in containers-0.7 · Data.Sequence.InternalGeneric (ViewR a)Defined in containers-0.7 · Data.Sequence.InternalGeneric (Tree a)Defined in containers-0.7 · Data.TreeGeneric (NonEmpty a)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityGeneric (First a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidGeneric (Last a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidGeneric (Down a)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (Dual a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalGeneric (Endo a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalGeneric (Product a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalGeneric (Sum a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalGeneric (ZipList a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Functor.ZipListGeneric (Par1 p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (Maybe a)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (Doc a)Defined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJGeneric (TyVarBndr flag)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric (a)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric [a]Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (WrappedMonad m a)Defined in base-4.20.2.0 · Control.ApplicativeGeneric (Arg a b)Defined in base-4.20.2.0 · Data.SemigroupGeneric (Cofree f a)Defined in free-5.2 · Control.Comonad.CofreeGeneric (Free f a)Defined in free-5.2 · Control.Monad.FreeGeneric (Free f a)Defined in free-5.2 · Control.Monad.Free.ApGeneric (Either a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (Proxy t)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (U1 p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (V1 p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (Lift f a)Defined in transformers-0.6.1.1 · Control.Applicative.LiftGeneric (MaybeT m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.MaybeGeneric (a, b)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (WrappedArrow a b c)Defined in base-4.20.2.0 · Control.ApplicativeGeneric (Biap bi a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.BiapGeneric (Fix p a)Defined in bifunctors-5.6.2 · Data.Bifunctor.FixGeneric (Join p a)Defined in bifunctors-5.6.2 · Data.Bifunctor.JoinGeneric (CofreeF f a b)Defined in free-5.2 · Control.Comonad.Trans.CofreeGeneric (FreeF f a b)Defined in free-5.2 · Control.Monad.Trans.FreeGeneric (FreeF f a b)Defined in free-5.2 · Control.Monad.Trans.Free.ApGeneric (Kleisli m a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowGeneric (Const a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.ConstGeneric (Ap f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidGeneric (Alt f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalGeneric (Rec1 f p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (URec Char p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (URec Double p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (URec Float p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (URec Int p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (URec Word p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (URec (Ptr ()) p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (Tagged s b)Defined in tagged-0.8.9 · Data.TaggedGeneric (Backwards f a)Defined in transformers-0.6.1.1 · Control.Applicative.BackwardsGeneric (AccumT w m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.AccumGeneric (ExceptT e m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ExceptGeneric (IdentityT f a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.IdentityGeneric (ReaderT r m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ReaderGeneric (SelectT r m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.SelectGeneric (StateT s m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.State.LazyGeneric (StateT s m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.State.StrictGeneric (WriterT w m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.CPSGeneric (WriterT w m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.LazyGeneric (WriterT w m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.StrictGeneric (Constant a b)Defined in transformers-0.6.1.1 · Data.Functor.ConstantGeneric (Reverse f a)Defined in transformers-0.6.1.1 · Data.Functor.ReverseGeneric (a, b, c)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (Product f g a)Defined in base-4.20.2.0 · Data.Functor.ProductGeneric (Sum f g a)Defined in base-4.20.2.0 · Data.Functor.SumGeneric (K1 i c p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (ContT r m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ContGeneric ((:*:) f g p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric ((:+:) f g p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (a, b, c, d)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (Compose f g a)Defined in base-4.20.2.0 · Data.Functor.ComposeGeneric (Clown f a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.ClownGeneric (Flip p a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.FlipGeneric (Joker g a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.JokerGeneric (WrappedBifunctor p a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.WrappedGeneric (M1 i c f p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (RWST r w s m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.CPSGeneric (RWST r w s m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.LazyGeneric (RWST r w s m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.StrictGeneric ((:.:) f g p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (a, b, c, d, e)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (Product f g a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.ProductGeneric (Sum p q a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.SumGeneric (a, b, c, d, e, f)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (Tannen f p a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.TannenGeneric (a, b, c, d, e, f, g)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (a, b, c, d, e, f, g, h)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (Biff p f g a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.BiffGeneric (a, b, c, d, e, f, g, h, i)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (a, b, c, d, e, f, g, h, i, j)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (a, b, c, d, e, f, g, h, i, j, k)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (a, b, c, d, e, f, g, h, i, j, k, l)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (a, b, c, d, e, f, g, h, i, j, k, l, m)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (a, b, c, d, e, f, g, h, i, j, k, l, m, n)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
Class Enum defines operations on sequentially ordered types.
The enumFrom... methods are used in Haskell's translation of
arithmetic sequences.
Instances of Enum may be derived for any enumeration type (types
whose constructors have no fields). The nullary constructors are
assumed to be numbered left-to-right by fromEnum from 0 through n-1.
See Chapter 10 of the Haskell Report for more details.
For any type that is an instance of class Bounded as well as Enum, the following should hold:
The calls
succ maxBoundandpred minBoundshould result in a runtime error.fromEnum and toEnum should give a runtime error if the result value is not representable in the result type. For example,
toEnum 7 :: Boolis an error.enumFrom and enumFromThen should be defined with an implicit bound, thus:
enumFrom x = enumFromTo x maxBound
enumFromThen x y = enumFromThenTo x y bound
where
bound | fromEnum y >= fromEnum x = maxBound
| otherwise = minBoundMethods
succ :: a -> aSuccessor of a value. For numeric types, succ adds 1.
pred :: a -> aPredecessor of a value. For numeric types, pred subtracts 1.
toEnum :: Int -> aConvert from an Int.
fromEnum :: a -> IntenumFrom :: a -> [a]Used in Haskell's translation of
[n..]with[n..] = enumFrom n, a possible implementation beingenumFrom n = n : enumFrom (succ n).Examples
enumFrom 4 :: [Integer] = [4,5,6,7,...]enumFrom 6 :: [Int] = [6,7,8,9,...,maxBound :: Int]
enumFromThen :: a -> a -> [a]Used in Haskell's translation of
[n,n'..]with[n,n'..] = enumFromThen n n', a possible implementation beingenumFromThen n n' = n : n' : worker (f x) (f x n'),worker s v = v : worker s (s v),x = fromEnum n' - fromEnum nandf n y | n > 0 = f (n - 1) (succ y) | n < 0 = f (n + 1) (pred y) | otherwise = yExamples
enumFromThen 4 6 :: [Integer] = [4,6,8,10...]enumFromThen 6 2 :: [Int] = [6,2,-2,-6,...,minBound :: Int]
enumFromTo :: a -> a -> [a]Used in Haskell's translation of
[n..m]with[n..m] = enumFromTo n m, a possible implementation beingenumFromTo n m | n <= m = n : enumFromTo (succ n) m | otherwise = []Examples
enumFromTo 6 10 :: [Int] = [6,7,8,9,10]enumFromTo 42 1 :: [Integer] = []
enumFromThenTo :: a -> a -> a -> [a]Used in Haskell's translation of
[n,n'..m]with[n,n'..m] = enumFromThenTo n n' m, a possible implementation beingenumFromThenTo n n' m = worker (f x) (c x) n m,x = fromEnum n' - fromEnum n,c x = bool (>=) ((x 0)f n y | n > 0 = f (n - 1) (succ y) | n < 0 = f (n + 1) (pred y) | otherwise = yand
worker s c v m | c v m = v : worker s c (s v) m | otherwise = []Examples
enumFromThenTo 4 2 -6 :: [Integer] = [4,2,0,-2,-4,-6]enumFromThenTo 6 8 2 :: [Int] = []
Instances122Enum, …
Enum IntegerDefined in ghc-internal-9.1003.0 · GHC.Internal.EnumEnum NaturalDefined in ghc-internal-9.1003.0 · GHC.Internal.EnumEnum ExtensionDefined in ghc-boot-th-9.10.3 · GHC.LanguageExtensions.TypeEnum ByteOrderDefined in ghc-internal-9.1003.0 · GHC.Internal.ByteOrderEnum ClosureTypeDefined in ghc-internal-9.1003.0 · GHC.Internal.ClosureTypesEnum CBoolDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CClockDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CDoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CFloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CIntMaxDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CIntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CLLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CPtrdiffDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CSCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CSUSecondsDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CShortDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CSigAtomicDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CSizeDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CTimeDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CUCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CUIntMaxDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CUIntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CULLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CULongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CUSecondsDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CUShortDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CWcharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum IntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.PtrEnum WordPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.PtrEnum AssociativityDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsEnum DecidedStrictnessDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsEnum SourceStrictnessDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsEnum SourceUnpackednessDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsEnum SeekModeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.DeviceEnum IOModeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.IOModeEnum Int16Defined in ghc-internal-9.1003.0 · GHC.Internal.IntEnum Int32Defined in ghc-internal-9.1003.0 · GHC.Internal.IntEnum Int64Defined in ghc-internal-9.1003.0 · GHC.Internal.IntEnum Int8Defined in ghc-internal-9.1003.0 · GHC.Internal.IntEnum DoCostCentresDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsEnum DoHeapProfileDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsEnum DoTraceDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsEnum GiveGCStatsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsEnum IoSubSystemDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsEnum CBlkCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEnum CBlkSizeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEnum CCcDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEnum CClockIdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEnum CDevDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEnum CFsBlkCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEnum CFsFilCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEnum CGidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEnum CIdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEnum CInoDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEnum CKeyDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEnum CModeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEnum CNfdsDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEnum CNlinkDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEnum COffDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEnum CPidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEnum CRLimDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEnum CSocklenDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEnum CSpeedDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEnum CSsizeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEnum CTcflagDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEnum CUidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEnum FdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesEnum GeneralCategoryDefined in ghc-internal-9.1003.0 · GHC.Internal.UnicodeEnum Word16Defined in ghc-internal-9.1003.0 · GHC.Internal.WordEnum Word32Defined in ghc-internal-9.1003.0 · GHC.Internal.WordEnum Word64Defined in ghc-internal-9.1003.0 · GHC.Internal.WordEnum Word8Defined in ghc-internal-9.1003.0 · GHC.Internal.WordEnum BoolDefined in ghc-internal-9.1003.0 · GHC.Internal.EnumEnum CharDefined in ghc-internal-9.1003.0 · GHC.Internal.EnumEnum DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphanfromEnum just truncates its argument, beware of all sorts of overflows.
List generators have extremely peculiar behavior, mandated by Haskell Report 2010:
Example1 expression [0..1.5][0.0,1.0,2.0]
Enum FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphanfromEnum just truncates its argument, beware of all sorts of overflows.
List generators have extremely peculiar behavior, mandated by Haskell Report 2010:
Example1 expression [0..1.5 :: Float][0.0,1.0,2.0]
Enum IntDefined in ghc-internal-9.1003.0 · GHC.Internal.EnumEnum LevityDefined in ghc-internal-9.1003.0 · GHC.Internal.EnumEnum OrderingDefined in ghc-internal-9.1003.0 · GHC.Internal.EnumEnum VecCountDefined in ghc-internal-9.1003.0 · GHC.Internal.EnumEnum VecElemDefined in ghc-internal-9.1003.0 · GHC.Internal.EnumEnum WordDefined in ghc-internal-9.1003.0 · GHC.Internal.EnumEnum InvariantClassDefined in invariant-0.6.4 · Data.Functor.Invariant.TH.InternalEnum CardinalityDefined in random-1.2.1.3 · System.Random.GFiniteThis is needed only as a superclass of Integral.
Enum I8Defined in text-2.1.3 · Data.Text.ForeignEnum FPFormatDefined in text-2.1.3 · Data.Text.Lazy.Builder.RealFloatEnum DayDefined in time-1.12.2 · Data.Time.Calendar.DaysEnum MonthDefined in time-1.12.2 · Data.Time.Calendar.MonthEnum QuarterDefined in time-1.12.2 · Data.Time.Calendar.QuarterEnum QuarterOfYearDefined in time-1.12.2 · Data.Time.Calendar.Quartermaps Q1..Q4 to 1..4
Enum DayOfWeekDefined in time-1.12.2 · Data.Time.Calendar.WeekEnum DiffTimeDefined in time-1.12.2 · Data.Time.Clock.Internal.DiffTimeEnum NominalDiffTimeDefined in time-1.12.2 · Data.Time.Clock.Internal.NominalDiffTimeEnum ()Defined in ghc-internal-9.1003.0 · GHC.Internal.EnumEnum a => Enum (First a)Defined in base-4.20.2.0 · Data.SemigroupEnum a => Enum (Last a)Defined in base-4.20.2.0 · Data.SemigroupEnum a => Enum (Max a)Defined in base-4.20.2.0 · Data.SemigroupEnum a => Enum (Min a)Defined in base-4.20.2.0 · Data.SemigroupEnum a => Enum (WrappedMonoid a)Defined in base-4.20.2.0 · Data.SemigroupEnum a => Enum (And a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsEnum a => Enum (Iff a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsEnum a => Enum (Ior a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsEnum a => Enum (Xor a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsEnum a => Enum (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityEnum a => Enum (a)Defined in ghc-internal-9.1003.0 · GHC.Internal.EnumIntegral a => Enum (Ratio a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Real(Enum a, Bounded a, Eq a) => Enum (Down a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.OrdEnum (Fixed a)Defined in base-4.20.2.0 · Data.FixedRecall that, for numeric types, succ and pred typically add and subtract
1, respectively. This is not true in the case of Fixed, whose successor and predecessor functions intuitively return the "next" and "previous" values in the enumeration. The results of these functions thus depend on the resolution of the Fixed value. For example, when enumerating values of resolution10^-3oftype Milli = Fixed E3,Example1 expression succ (0.000 :: Milli)0.001
and likewise
Example1 expression pred (0.000 :: Milli)-0.001
In other words, succ and pred increment and decrement a fixed-precision value by the least amount such that the value's resolution is unchanged. For example,
10^-12is the smallest (positive) amount that can be added to a value oftype Pico = Fixed E12without changing its resolution, and soExample1 expression succ (0.000000000000 :: Pico)0.000000000001
and similarly
Example1 expression pred (0.000000000000 :: Pico)-0.000000000001
This is worth bearing in mind when defining Fixed arithmetic sequences. In particular, you may be forgiven for thinking the sequence
[1..10] :: [Pico]evaluates to
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10] :: [Pico].However, this is not true. On the contrary, similarly to the above implementations of succ and pred,
enumFromTo :: Pico -> Pico -> [Pico]has a "step size" of10^-12. Hence, the list[1..10] :: [Pico]has the form[1.000000000000, 1.00000000001, 1.00000000002, ..., 10.000000000000]and contains
9 * 10^12 + 1values.Enum (Proxy s)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.ProxyEnum (bi a b) => Enum (Biap bi a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.BiapEnum (f a) => Enum (Ap f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidEnum (f a) => Enum (Alt f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalEnum a => Enum (Const a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.ConstEnum a => Enum (Tagged s a)Defined in tagged-0.8.9 · Data.TaggedCoercible a b => Enum (Coercion a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Coerciona ~ b => Enum (a :~: b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Equalitya ~~ b => Enum (a :~~: b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.EqualityEnum (f (g a)) => Enum (Compose f g a)Defined in base-4.20.2.0 · Data.Functor.Compose
Single-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE single-precision type.
Instances43Enum, Floating, Fractional, Data, Num, Read, …
Enum FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphanfromEnum just truncates its argument, beware of all sorts of overflows.
List generators have extremely peculiar behavior, mandated by Haskell Report 2010:
Example1 expression [0..1.5 :: Float][0.0,1.0,2.0]
Eq FloatDefined in ghc-prim-0.12.0 · GHC.ClassesFloating FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.FloatFractional FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphanThis instance implements IEEE 754 standard with all its usual pitfalls about NaN, infinities and negative zero.
Example4 expressions 0 == (-0 :: Float)Truerecip 0 == recip (-0 :: Float)Falsemap (/ 0) [-1, 0, 1 :: Float][-Infinity,NaN,Infinity]map (* 0) $ map (/ 0) [-1, 0, 1 :: Float][NaN,NaN,NaN]
Data FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.DataNum FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphanThis instance implements IEEE 754 standard with all its usual pitfalls about NaN, infinities and negative zero. Neither addition nor multiplication are associative or distributive:
Example3 expressions (0.1 + 0.1 :: Float) + 0.5 == 0.1 + (0.1 + 0.5)False(0.1 + 0.2 :: Float) * 0.9 == 0.1 * 0.9 + 0.2 * 0.9False(0.1 * 0.1 :: Float) * 0.9 == 0.1 * (0.1 * 0.9)False
Ord FloatDefined in ghc-prim-0.12.0 · GHC.ClassesRead FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.ReadReal FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphanBeware that toRational generates garbage for non-finite arguments:
Example2 expressions toRational (1/0 :: Float)340282366920938463463374607431768211456 % 1toRational (0/0 :: Float)510423550381407695195061911147652317184 % 1
RealFloat FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.FloatRealFrac FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphanBeware that results for non-finite arguments are garbage:
Example2 expressions [ f x | f <- [round, floor, ceiling], x <- [-1/0, 0/0, 1/0 :: Float] ] :: [Int][0,0,0,0,0,0,0,0,0]map properFraction [-1/0, 0/0, 1/0] :: [(Int, Float)][(0,0.0),(0,0.0),(0,0.0)]
and get even more non-sensical if you ask for Integer instead of Int.
Show FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphanStorable FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.StorablePrintfArg FloatDefined in base-4.20.2.0 · Text.PrintfNFData FloatDefined in deepseq-1.5.0.0 · Control.DeepSeqPretty FloatDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJClassPretty FloatDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClassRandom FloatDefined in random-1.2.1.3 · System.RandomNote - random produces values in the closed range
[0,1].UniformRange FloatDefined in random-1.2.1.3 · System.Random.InternalBinary FloatDefined in binary-0.8.9.3 · Data.Binary.ClassUses non-IEEE754 encoding. Does not round-trip NaN.
Hashable FloatDefined in hashable-1.4.7.0 · Data.Hashable.ClassNote: prior to
hashable-1.3.0.0,hash 0.0 /= hash (-0.0)The hash of NaN is not well defined.
Prim FloatDefined in primitive-0.9.1.0 · Data.Primitive.TypesUnbox FloatDefined in vector-0.13.2.0 · Data.Vector.Unboxed.BaseDefault FloatDefined in data-default-0.8.0.1 · Data.Default.InternalLift FloatDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxIArray UArray FloatDefined in array-0.5.8.0 · Data.Array.BaseVector Vector FloatDefined in vector-0.13.2.0 · Data.Vector.Unboxed.BaseMVector MVector FloatDefined in vector-0.13.2.0 · Data.Vector.Unboxed.BaseMArray IOUArray Float IODefined in array-0.5.8.0 · Data.Array.IO.InternalsGeneric1 (URec Float)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsFoldable UFloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableTraversable UFloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.TraversableMArray (STUArray s) Float (ST s)Defined in array-0.5.8.0 · Data.Array.BaseFunctor (URec Float)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsEq (URec Float p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsOrd (URec Float p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsShow (URec Float p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (URec Float p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Genericstype Rep (URec Float p) = D1 ('MetaDataDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics"URec"
"GHC.Internal.Generics"
"ghc-internal"
'False) (C1 ('MetaCons"UFloat"
'PrefixI 'True) (S1 ('MetaSel ('Just"uFloat#"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) UFloat))type Rep1 (URec Float) = D1 ('MetaDataDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics"URec"
"GHC.Internal.Generics"
"ghc-internal"
'False) (C1 ('MetaCons"UFloat"
'PrefixI 'True) (S1 ('MetaSel ('Just"uFloat#"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) UFloat))data URec FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsUsed for marking occurrences of Float#
data MVector s FloatDefined in vector-0.13.2.0 · Data.Vector.Unboxed.Basedata Vector FloatDefined in vector-0.13.2.0 · Data.Vector.Unboxed.Base
Haskell defines operations to read and write characters from and to files,
represented by values of type Handle. Each value of this type is a
handle: a record used by the Haskell run-time system to manage I/O
with file system objects. A handle has at least the following properties:
whether it manages input or output or both;
whether it is open, closed or semi-closed;
whether the object is seekable;
whether buffering is disabled, or enabled on a line or block basis;
a buffer (whose length may be zero).
Most handles will also have a current I/O position indicating where the next input or output operation will occur. A handle is readable if it manages only input or both input and output; likewise, it is writable if it manages only output or both input and output. A handle is open when first allocated. Once it is closed it can no longer be used for either input or output, though an implementation cannot re-use its storage while references remain to it. Handles are in the Show and Eq classes. The string produced by showing a handle is system dependent; it should include enough information to identify the handle for debugging. A handle is equal according to == only to itself; no attempt is made to compare the internal state of different handles for equality.
Basic numeric class.
The Haskell Report defines no laws for Num. However, (+) and (*) are
customarily expected to define a ring and have the following properties:
- Associativity of
(+) (x + y) + z=
x + (y + z)- Commutativity of
(+) x + y=
y + xfromInteger 0is the additive identityx + fromInteger 0=
x- negate gives the additive inverse
x + negate x=
fromInteger 0- Associativity of
(*) (x * y) * z=
x * (y * z)fromInteger 1is the multiplicative identityx * fromInteger 1=
xand
fromInteger 1 * x=
x- Distributivity of
(*)with respect to(+) a * (b + c)=
(a * b) + (a * c)and
(b + c) * a=
(b * a) + (c * a)- Coherence with
toInteger if the type also implements
GHC.Real.Integral, then
is a left inverse for
, i.e.
fromInteger (toInteger i) == i
Note that it isn't customarily expected that a type instance of both Num
and Ord implement an ordered ring. Indeed, in base only Integer and
Rational do.
Methods
(+) :: a -> a -> ainfixl 6(-) :: a -> a -> ainfixl 6(*) :: a -> a -> ainfixl 7negate :: a -> aUnary negation.
abs :: a -> aAbsolute value.
signum :: a -> afromInteger :: Integer -> aConversion from an Integer. An integer literal represents the application of the function fromInteger to the appropriate value of type Integer, so such literals have type
(Num a) => a.
Instances91Num, …
Num IntegerDefined in ghc-internal-9.1003.0 · GHC.Internal.NumNum NaturalDefined in ghc-internal-9.1003.0 · GHC.Internal.NumNum EventTypeDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.EPollNum EventDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.PollNum UniqueDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.UniqueNum CBoolDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CClockDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CDoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CFloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CIntMaxDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CIntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CLLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CPtrdiffDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CSCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CSUSecondsDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CShortDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CSigAtomicDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CSizeDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CTimeDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CUCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CUIntMaxDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CUIntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CULLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CULongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CUSecondsDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CUShortDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CWcharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum IntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.PtrNum WordPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.PtrNum Int16Defined in ghc-internal-9.1003.0 · GHC.Internal.IntNum Int32Defined in ghc-internal-9.1003.0 · GHC.Internal.IntNum Int64Defined in ghc-internal-9.1003.0 · GHC.Internal.IntNum Int8Defined in ghc-internal-9.1003.0 · GHC.Internal.IntNum CBlkCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesNum CBlkSizeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesNum CCcDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesNum CClockIdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesNum CDevDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesNum CFsBlkCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesNum CFsFilCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesNum CGidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesNum CIdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesNum CInoDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesNum CKeyDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesNum CModeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesNum CNfdsDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesNum CNlinkDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesNum COffDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesNum CPidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesNum CRLimDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesNum CSocklenDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesNum CSpeedDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesNum CSsizeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesNum CTcflagDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesNum CUidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesNum FdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesNum Word16Defined in ghc-internal-9.1003.0 · GHC.Internal.WordNum Word32Defined in ghc-internal-9.1003.0 · GHC.Internal.WordNum Word64Defined in ghc-internal-9.1003.0 · GHC.Internal.WordNum Word8Defined in ghc-internal-9.1003.0 · GHC.Internal.WordNum DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphanThis instance implements IEEE 754 standard with all its usual pitfalls about NaN, infinities and negative zero. Neither addition nor multiplication are associative or distributive:
Example3 expressions (0.1 + 0.1) + 0.4 == 0.1 + (0.1 + 0.4)False(0.1 + 0.2) * 0.3 == 0.1 * 0.3 + 0.2 * 0.3False(0.1 * 0.1) * 0.3 == 0.1 * (0.1 * 0.3)False
Num FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphanThis instance implements IEEE 754 standard with all its usual pitfalls about NaN, infinities and negative zero. Neither addition nor multiplication are associative or distributive:
Example3 expressions (0.1 + 0.1 :: Float) + 0.5 == 0.1 + (0.1 + 0.5)False(0.1 + 0.2 :: Float) * 0.9 == 0.1 * 0.9 + 0.2 * 0.9False(0.1 * 0.1 :: Float) * 0.9 == 0.1 * (0.1 * 0.9)False
Num IntDefined in ghc-internal-9.1003.0 · GHC.Internal.NumNum WordDefined in ghc-internal-9.1003.0 · GHC.Internal.NumNum CardinalityDefined in random-1.2.1.3 · System.Random.GFiniteNum ScientificDefined in scientific-0.3.8.0 · Data.ScientificWARNING: + and - compute the Integer magnitude:
10^ewhereeis the difference between thebase10Exponentsof the arguments. If these methods are applied to arguments which have huge exponents this could fill up all space and crash your program! So don't apply these methods to scientific numbers coming from untrusted sources. The other methods can be used safely.Num I8Defined in text-2.1.3 · Data.Text.ForeignNum SizeDefined in text-2.1.3 · Data.Text.Internal.Fusion.SizeNum DiffTimeDefined in time-1.12.2 · Data.Time.Clock.Internal.DiffTimeNum NominalDiffTimeDefined in time-1.12.2 · Data.Time.Clock.Internal.NominalDiffTimeNum SizeDefined in vector-0.13.2.0 · Data.Vector.Fusion.Bundle.SizeRealFloat a => Num (Complex a)Defined in base-4.20.2.0 · Data.ComplexNum a => Num (Max a)Defined in base-4.20.2.0 · Data.SemigroupNum a => Num (Min a)Defined in base-4.20.2.0 · Data.SemigroupNum a => Num (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityNum a => Num (Down a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.OrdNum a => Num (Product a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalNum a => Num (Sum a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalIntegral a => Num (Ratio a)Defined in ghc-internal-9.1003.0 · GHC.Internal.RealHasResolution a => Num (Fixed a)Defined in base-4.20.2.0 · Data.FixedMultiplication is not associative or distributive:
Example1 expression (0.2 * 0.6 :: Deci) * 0.9 == 0.2 * (0.6 * 0.9)False
Example1 expression (0.1 + 0.1 :: Deci) * 0.5 == 0.1 * 0.5 + 0.1 * 0.5False
Num a => Num (Op a b)Defined in base-4.20.2.0 · Data.Functor.ContravariantNum (f a) => Num (Alt f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalNum a => Num (Const a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.ConstNum a => Num (Tagged s a)Defined in tagged-0.8.9 · Data.Tagged(Biapplicative bi, Num a, Num b) => Num (Biap bi a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.Biap(Applicative f, Num a) => Num (Ap f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidNote that even if the underlying Num and Applicative instances are lawful, for most Applicatives, this instance will not be lawful. If you use this instance with the list Applicative, the following customary laws will not hold:
Commutativity:
Example2 expressions Ap [10,20] + Ap [1,2]Ap {getAp = [11,12,21,22]}Ap [1,2] + Ap [10,20]Ap {getAp = [11,21,12,22]}
Additive inverse:
Example2 expressions Ap [] + negate (Ap [])Ap {getAp = []}fromInteger 0 :: Ap [] IntAp {getAp = [0]}
Distributivity:
Example2 expressions Ap [1,2] * (3 + 4)Ap {getAp = [7,14]}(Ap [1,2] * 3) + (Ap [1,2] * 4)Ap {getAp = [7,11,10,14]}
Num (f (g a)) => Num (Compose f g a)Defined in base-4.20.2.0 · Data.Functor.Compose
Real numbers.
The Haskell report defines no laws for Real, however Real instances are customarily expected to adhere to the following law:
- Coherence with fromRational
if the type also implements
, then
is a left inverse for
, i.e.
fromRational (toRational i) = i
The law does not hold for Float, Double, CFloat, CDouble, etc., because these types contain non-finite values, which cannot be roundtripped through Rational.
Methods
toRational :: a -> RationalRational equivalent of its real argument with full precision.
Instances77Real, …
Real IntegerDefined in ghc-internal-9.1003.0 · GHC.Internal.RealReal NaturalDefined in ghc-internal-9.1003.0 · GHC.Internal.RealReal CBoolDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CClockDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CDoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CFloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CIntMaxDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CIntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CLLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CPtrdiffDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CSCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CSUSecondsDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CShortDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CSigAtomicDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CSizeDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CTimeDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CUCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CUIntMaxDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CUIntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CULLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CULongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CUSecondsDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CUShortDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CWcharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal IntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.PtrReal WordPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.PtrReal Int16Defined in ghc-internal-9.1003.0 · GHC.Internal.IntReal Int32Defined in ghc-internal-9.1003.0 · GHC.Internal.IntReal Int64Defined in ghc-internal-9.1003.0 · GHC.Internal.IntReal Int8Defined in ghc-internal-9.1003.0 · GHC.Internal.IntReal CBlkCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesReal CBlkSizeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesReal CCcDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesReal CClockIdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesReal CDevDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesReal CFsBlkCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesReal CFsFilCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesReal CGidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesReal CIdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesReal CInoDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesReal CKeyDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesReal CModeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesReal CNfdsDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesReal CNlinkDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesReal COffDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesReal CPidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesReal CRLimDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesReal CSocklenDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesReal CSpeedDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesReal CSsizeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesReal CTcflagDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesReal CUidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesReal FdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesReal Word16Defined in ghc-internal-9.1003.0 · GHC.Internal.WordReal Word32Defined in ghc-internal-9.1003.0 · GHC.Internal.WordReal Word64Defined in ghc-internal-9.1003.0 · GHC.Internal.WordReal Word8Defined in ghc-internal-9.1003.0 · GHC.Internal.WordReal DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphanBeware that toRational generates garbage for non-finite arguments:
Example2 expressions toRational (1/0)179769313 (and 300 more digits...) % 1toRational (0/0)269653970 (and 300 more digits...) % 1
Real FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphanBeware that toRational generates garbage for non-finite arguments:
Example2 expressions toRational (1/0 :: Float)340282366920938463463374607431768211456 % 1toRational (0/0 :: Float)510423550381407695195061911147652317184 % 1
Real IntDefined in ghc-internal-9.1003.0 · GHC.Internal.RealReal WordDefined in ghc-internal-9.1003.0 · GHC.Internal.RealReal CardinalityDefined in random-1.2.1.3 · System.Random.GFiniteThis is needed only as a superclass of Integral.
Real ScientificDefined in scientific-0.3.8.0 · Data.ScientificWARNING: toRational needs to compute the Integer magnitude:
10^e. If applied to a huge exponent this could fill up all space and crash your program!Avoid applying toRational (or realToFrac) to scientific numbers coming from an untrusted source and use toRealFloat instead. The latter guards against excessive space usage.
Real I8Defined in text-2.1.3 · Data.Text.ForeignReal DiffTimeDefined in time-1.12.2 · Data.Time.Clock.Internal.DiffTimeReal NominalDiffTimeDefined in time-1.12.2 · Data.Time.Clock.Internal.NominalDiffTimeIntegral a => Real (Ratio a)Defined in ghc-internal-9.1003.0 · GHC.Internal.RealReal a => Real (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityReal a => Real (Down a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.OrdHasResolution a => Real (Fixed a)Defined in base-4.20.2.0 · Data.FixedReal a => Real (Const a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.ConstReal a => Real (Tagged s a)Defined in tagged-0.8.9 · Data.TaggedReal (f (g a)) => Real (Compose f g a)Defined in base-4.20.2.0 · Data.Functor.Compose
Conversion of values to readable Strings.
Derived instances of Show have the following properties, which
are compatible with derived instances of Text.Read.Read:
The result of show is a syntactically correct Haskell expression containing only constants, given the fixity declarations in force at the point where the type is declared. It contains only the constructor names defined in the data type, parentheses, and spaces. When labelled constructor fields are used, braces, commas, field names, and equal signs are also used.
If the constructor is defined to be an infix operator, then showsPrec will produce infix applications of the constructor.
the representation will be enclosed in parentheses if the precedence of the top-level constructor in
xis less thand(associativity is ignored). Thus, ifdis0then the result is never surrounded in parentheses; ifdis11it is always surrounded in parentheses, unless it is an atomic expression.If the constructor is defined using record syntax, then show will produce the record-syntax form, with the fields given in the same order as the original declaration.
For example, given the declarations
infixr 5 :^:
data Tree a = Leaf a | Tree a :^: Tree athe derived instance of Show is equivalent to
instance (Show a) => Show (Tree a) where
showsPrec d (Leaf m) = showParen (d > app_prec) $
showString "Leaf " . showsPrec (app_prec+1) m
where app_prec = 10
showsPrec d (u :^: v) = showParen (d > up_prec) $
showsPrec (up_prec+1) u .
showString " :^: " .
showsPrec (up_prec+1) v
where up_prec = 5Note that right-associativity of :^: is ignored. For example,
show (Leaf 1 :^: Leaf 2 :^: Leaf 3)produces the string"Leaf 1 :^: (Leaf 2 :^: Leaf 3)".
Methods
Instances480Show, …
Show ByteArrayDefined in base-4.20.2.0 · Data.Array.ByteShow TimeoutDefined in base-4.20.2.0 · System.TimeoutShow OptionsDefined in bifunctors-5.6.2 · Data.Bifunctor.THShow BuilderDefined in bytestring-0.12.2.0 · Data.ByteString.Builder · orphanShow FormatModeDefined in bytestring-0.12.2.0 · Data.ByteString.Builder.RealFloatShow FloatingDecimalDefined in bytestring-0.12.2.0 · Data.ByteString.Builder.RealFloat.D2SShow FloatingDecimalDefined in bytestring-0.12.2.0 · Data.ByteString.Builder.RealFloat.F2SShow ByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Internal.TypeShow SizeOverflowExceptionDefined in bytestring-0.12.2.0 · Data.ByteString.Internal.TypeShow ByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Lazy.InternalShow ShortByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Short.InternalShow IntSetDefined in containers-0.7 · Data.IntSet.InternalShow BitQueueDefined in containers-0.7 · Utils.Containers.Internal.BitQueueShow BitQueueBDefined in containers-0.7 · Utils.Containers.Internal.BitQueueShow ArgDefined in free-5.2 · Control.Monad.Free.THShow IntegerDefined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow NaturalDefined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow ForeignSrcLangDefined in ghc-boot-th-9.10.3 · GHC.ForeignSrcLang.TypeShow ExtensionDefined in ghc-boot-th-9.10.3 · GHC.LanguageExtensions.TypeShow VoidDefined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow ByteOrderDefined in ghc-internal-9.1003.0 · GHC.Internal.ByteOrderShow ClosureTypeDefined in ghc-internal-9.1003.0 · GHC.Internal.ClosureTypesShow BlockReasonDefined in ghc-internal-9.1003.0 · GHC.Internal.Conc.SyncShow ThreadIdDefined in ghc-internal-9.1003.0 · GHC.Internal.Conc.SyncShow ThreadStatusDefined in ghc-internal-9.1003.0 · GHC.Internal.Conc.SyncShow NestedAtomicallyDefined in ghc-internal-9.1003.0 · GHC.Internal.Control.Exception.BaseShow NoMatchingContinuationPromptDefined in ghc-internal-9.1003.0 · GHC.Internal.Control.Exception.BaseShow NoMethodErrorDefined in ghc-internal-9.1003.0 · GHC.Internal.Control.Exception.BaseShow NonTerminationDefined in ghc-internal-9.1003.0 · GHC.Internal.Control.Exception.BaseShow PatternMatchFailDefined in ghc-internal-9.1003.0 · GHC.Internal.Control.Exception.BaseShow RecConErrorDefined in ghc-internal-9.1003.0 · GHC.Internal.Control.Exception.BaseShow RecSelErrorDefined in ghc-internal-9.1003.0 · GHC.Internal.Control.Exception.BaseShow RecUpdErrorDefined in ghc-internal-9.1003.0 · GHC.Internal.Control.Exception.BaseShow TypeErrorDefined in ghc-internal-9.1003.0 · GHC.Internal.Control.Exception.BaseShow ConstrDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.DataShow ConstrRepDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.DataShow DataRepDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.DataShow DataTypeDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.DataShow FixityDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.DataShow DynamicDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.DynamicShow AllDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalShow AnyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalShow SomeTypeRepDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Typeable.InternalShow VersionDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.VersionShow ControlMessageDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.ControlShow EPollFdDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.EPollShow EventDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.EPollShow EventTypeDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.EPollShow EventDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Internal.TypesShow EventLifetimeDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Internal.TypesShow LifetimeDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Internal.TypesShow TimeoutDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Internal.TypesShow FdKeyDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.ManagerShow StateDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.ManagerShow EventDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.PollShow PollFdDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.PollShow StateDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.TimerManagerShow UniqueDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.UniqueShow ErrorCallDefined in ghc-internal-9.1003.0 · GHC.Internal.ExceptionShow ArithExceptionDefined in ghc-internal-9.1003.0 · GHC.Internal.Exception.TypeShow SomeExceptionDefined in ghc-internal-9.1003.0 · GHC.Internal.Exception.TypeShow FingerprintDefined in ghc-internal-9.1003.0 · GHC.Internal.Fingerprint.TypeShow CBoolDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CClockDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CDoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CFloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CIntMaxDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CIntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CLLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CPtrdiffDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CSCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CSUSecondsDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CShortDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CSigAtomicDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CSizeDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CTimeDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CUCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CUIntMaxDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CUIntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CULLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CULongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CUSecondsDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CUShortDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CWcharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow IntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.PtrShow WordPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.PtrShow AssociativityDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsShow DecidedStrictnessDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsShow FixityDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsShow SourceStrictnessDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsShow SourceUnpackednessDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsShow MaskingStateDefined in ghc-internal-9.1003.0 · GHC.Internal.IOShow SeekModeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.DeviceShow CodingFailureModeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.Encoding.FailureShow CodingProgressDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.Encoding.TypesShow TextEncodingDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.Encoding.TypesShow AllocationLimitExceededDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.ExceptionShow ArrayExceptionDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.ExceptionShow AssertionFailedDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.ExceptionShow AsyncExceptionDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.ExceptionShow BlockedIndefinitelyOnMVarDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.ExceptionShow BlockedIndefinitelyOnSTMDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.ExceptionShow CompactionFailedDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.ExceptionShow DeadlockDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.ExceptionShow ExitCodeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.ExceptionShow FixIOExceptionDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.ExceptionShow IOErrorTypeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.ExceptionShow IOExceptionDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.ExceptionShow SomeAsyncExceptionDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.ExceptionShow FDDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.FDShow HandlePosnDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.HandleShow FileLockingNotSupportedDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.Handle.Lock.CommonShow BufferModeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.Handle.TypesShow HandleDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.Handle.TypesShow HandleTypeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.Handle.TypesShow NewlineDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.Handle.TypesShow NewlineModeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.Handle.TypesShow IOModeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.IOModeShow IOPortExceptionDefined in ghc-internal-9.1003.0 · GHC.Internal.IOPortShow InfoProvDefined in ghc-internal-9.1003.0 · GHC.Internal.InfoProv.TypesShow Int16Defined in ghc-internal-9.1003.0 · GHC.Internal.IntShow Int32Defined in ghc-internal-9.1003.0 · GHC.Internal.IntShow Int64Defined in ghc-internal-9.1003.0 · GHC.Internal.IntShow Int8Defined in ghc-internal-9.1003.0 · GHC.Internal.IntShow CCFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsShow ConcFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsShow DebugFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsShow DoCostCentresDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsShow DoHeapProfileDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsShow DoTraceDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsShow GCFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsShow GiveGCStatsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsShow HpcFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsShow IoSubSystemDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsShow MiscFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsShow ParFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsShow ProfFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsShow RTSFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsShow TickyFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsShow TraceFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsShow FractionalExponentBaseDefined in ghc-internal-9.1003.0 · GHC.Internal.RealShow StackEntryDefined in ghc-internal-9.1003.0 · GHC.Internal.Stack.CloneStackShow CallStackDefined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow SrcLocDefined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow StaticPtrInfoDefined in ghc-internal-9.1003.0 · GHC.Internal.StaticPtrShow GCDetailsDefined in ghc-internal-9.1003.0 · GHC.Internal.StatsShow RTSStatsDefined in ghc-internal-9.1003.0 · GHC.Internal.StatsShow CBlkCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesShow CBlkSizeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesShow CCcDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesShow CClockIdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesShow CDevDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesShow CFsBlkCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesShow CFsFilCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesShow CGidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesShow CIdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesShow CInoDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesShow CKeyDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesShow CModeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesShow CNfdsDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesShow CNlinkDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesShow COffDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesShow CPidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesShow CRLimDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesShow CSocklenDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesShow CSpeedDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesShow CSsizeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesShow CTcflagDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesShow CTimerDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesShow CUidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesShow FdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesShow LexemeDefined in ghc-internal-9.1003.0 · GHC.Internal.Text.Read.LexShow NumberDefined in ghc-internal-9.1003.0 · GHC.Internal.Text.Read.LexShow SomeCharDefined in ghc-internal-9.1003.0 · GHC.Internal.TypeLitsShow SomeSymbolDefined in ghc-internal-9.1003.0 · GHC.Internal.TypeLitsShow SomeNatDefined in ghc-internal-9.1003.0 · GHC.Internal.TypeNatsShow GeneralCategoryDefined in ghc-internal-9.1003.0 · GHC.Internal.UnicodeShow Word16Defined in ghc-internal-9.1003.0 · GHC.Internal.WordShow Word32Defined in ghc-internal-9.1003.0 · GHC.Internal.WordShow Word64Defined in ghc-internal-9.1003.0 · GHC.Internal.WordShow Word8Defined in ghc-internal-9.1003.0 · GHC.Internal.WordShow BoolDefined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow CharDefined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphanShow FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphanShow IntDefined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow KindRepDefined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow LevityDefined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow ModuleDefined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow OrderingDefined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow RuntimeRepDefined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow TrNameDefined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow TyConDefined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow TypeLitSortDefined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow VecCountDefined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow VecElemDefined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow WordDefined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow OptionsDefined in invariant-0.6.4 · Data.Functor.Invariant.THShow EncodingExceptionDefined in os-string-2.0.7 · System.OsString.Encoding.InternalShow OsCharDefined in os-string-2.0.7 · System.OsString.Internal.TypesShow OsStringDefined in os-string-2.0.7 · System.OsString.Internal.TypesOn windows, decodes as UCS-2. On unix prints the raw bytes without decoding.
Show PosixCharDefined in os-string-2.0.7 · System.OsString.Internal.TypesShow PosixStringDefined in os-string-2.0.7 · System.OsString.Internal.TypesPrints the raw bytes without decoding.
Show WindowsCharDefined in os-string-2.0.7 · System.OsString.Internal.TypesShow WindowsStringDefined in os-string-2.0.7 · System.OsString.Internal.TypesDecodes as UCS-2.
Show ModeDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJShow StyleDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJShow TextDetailsDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJShow PrettyLevelDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJClassShow DocDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJShow PrettyLevelDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClassShow CardinalityDefined in random-1.2.1.3 · System.Random.GFiniteShow StdGenDefined in random-1.2.1.3 · System.Random.InternalShow ScientificDefined in scientific-0.3.8.0 · Data.ScientificSee formatScientific if you need more control over the rendering.
Show SMGenDefined in splitmix-0.1.3.1 · System.Random.SplitMixShow SMGenDefined in splitmix-0.1.3.1 · System.Random.SplitMix32Show ForallVisFlagDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.PprShow DocDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.PprLibShow AnnLookupDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow AnnTargetDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow BangDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow BndrVisDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow BodyDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow BytesDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow CallconvDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow ClauseDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow ConDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow DecDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow DecidedStrictnessDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow DerivClauseDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow DerivStrategyDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow DocLocDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow ExpDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow FamilyResultSigDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow FixityDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow FixityDirectionDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow ForeignDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow FunDepDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow GuardDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow InfoDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow InjectivityAnnDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow InlineDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow LitDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow LocDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow MatchDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow ModNameDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow ModuleDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow ModuleInfoDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow NameDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow NameFlavourDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow NameSpaceDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow NamespaceSpecifierDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow OccNameDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow OverlapDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow PatDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow PatSynArgsDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow PatSynDirDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow PhasesDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow PkgNameDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow PragmaDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow RangeDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow RoleDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow RuleBndrDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow RuleMatchDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow SafetyDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow SourceStrictnessDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow SourceUnpackednessDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow SpecificityDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow StmtDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow TyLitDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow TySynEqnDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow TypeDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow TypeFamilyHeadDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow DecodingDefined in text-2.1.3 · Data.Text.EncodingShow UnicodeExceptionDefined in text-2.1.3 · Data.Text.Encoding.ErrorShow I8Defined in text-2.1.3 · Data.Text.ForeignShow TextDefined in text-2.1.3 · Data.Text.Show · orphanShow BuilderDefined in text-2.1.3 · Data.Text.Internal.BuilderShow PartialUtf8CodePointDefined in text-2.1.3 · Data.Text.Internal.EncodingShow Utf8StateDefined in text-2.1.3 · Data.Text.Internal.EncodingShow DecoderStateDefined in text-2.1.3 · Data.Text.Internal.Encoding.Utf8Show SizeDefined in text-2.1.3 · Data.Text.Internal.Fusion.SizeShow TextDefined in text-2.1.3 · Data.Text.Lazy · orphanShow FPFormatDefined in text-2.1.3 · Data.Text.Lazy.Builder.RealFloatShow IterDefined in text-2.1.3 · Data.Text.UnsafeShow ConstructorInfoDefined in th-abstraction-0.7.1.0 · Language.Haskell.TH.DatatypeShow ConstructorVariantDefined in th-abstraction-0.7.1.0 · Language.Haskell.TH.DatatypeShow DatatypeInfoDefined in th-abstraction-0.7.1.0 · Language.Haskell.TH.DatatypeShow DatatypeVariantDefined in th-abstraction-0.7.1.0 · Language.Haskell.TH.DatatypeShow FieldStrictnessDefined in th-abstraction-0.7.1.0 · Language.Haskell.TH.DatatypeShow StrictnessDefined in th-abstraction-0.7.1.0 · Language.Haskell.TH.DatatypeShow UnpackednessDefined in th-abstraction-0.7.1.0 · Language.Haskell.TH.DatatypeShow CalendarDiffDaysDefined in time-1.12.2 · Data.Time.Calendar.CalendarDiffDaysShow DayDefined in time-1.12.2 · Data.Time.Calendar.Gregorian · orphanShow MonthDefined in time-1.12.2 · Data.Time.Calendar.MonthShow as
yyyy-mm.Show QuarterDefined in time-1.12.2 · Data.Time.Calendar.QuarterShow as
yyyy-Qn.Show QuarterOfYearDefined in time-1.12.2 · Data.Time.Calendar.QuarterShow DayOfWeekDefined in time-1.12.2 · Data.Time.Calendar.WeekShow AbsoluteTimeDefined in time-1.12.2 · Data.Time.Clock.TAI · orphanShow DiffTimeDefined in time-1.12.2 · Data.Time.Clock.Internal.DiffTimeShow NominalDiffTimeDefined in time-1.12.2 · Data.Time.Clock.Internal.NominalDiffTimeShow SystemTimeDefined in time-1.12.2 · Data.Time.Clock.Internal.SystemTimeShow UTCTimeDefined in time-1.12.2 · Data.Time.LocalTime.Internal.ZonedTime · orphanShow UniversalTimeDefined in time-1.12.2 · Data.Time.LocalTime.Internal.LocalTime · orphanShow TimeLocaleDefined in time-1.12.2 · Data.Time.Format.LocaleShow CalendarDiffTimeDefined in time-1.12.2 · Data.Time.LocalTime.Internal.CalendarDiffTimeShow LocalTimeDefined in time-1.12.2 · Data.Time.LocalTime.Internal.LocalTimeShow TimeOfDayDefined in time-1.12.2 · Data.Time.LocalTime.Internal.TimeOfDayShow TimeZoneDefined in time-1.12.2 · Data.Time.LocalTime.Internal.TimeZoneThis only shows the time zone name, or offset if the name is empty.
Show ZonedTimeDefined in time-1.12.2 · Data.Time.LocalTime.Internal.ZonedTimeFor the time zone, this only shows the name, or offset if the name is empty.
Show SubHashPathDefined in unordered-containers-0.2.21 · Data.HashMap.Internal.DebugShow UUIDDefined in uuid-types-1.0.6 · Data.UUID.Types.InternalShow UnpackedUUIDDefined in uuid-types-1.0.6 · Data.UUID.Types.InternalShow SizeDefined in vector-0.13.2.0 · Data.Vector.Fusion.Bundle.SizeShow ()Defined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow (ConstPtr a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.ConstPtrShow (ForeignPtr a)Defined in ghc-internal-9.1003.0 · GHC.Internal.ForeignPtrShow (FunPtr a)Defined in ghc-internal-9.1003.0 · GHC.Internal.PtrShow (Ptr a)Defined in ghc-internal-9.1003.0 · GHC.Internal.PtrShow (SChar c)Defined in ghc-internal-9.1003.0 · GHC.Internal.TypeLitsShow (SSymbol s)Defined in ghc-internal-9.1003.0 · GHC.Internal.TypeLitsShow (SNat n)Defined in ghc-internal-9.1003.0 · GHC.Internal.TypeNatsShow (Doc a)Defined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJShow a => Show (Complex a)Defined in base-4.20.2.0 · Data.ComplexShow a => Show (First a)Defined in base-4.20.2.0 · Data.SemigroupShow a => Show (Last a)Defined in base-4.20.2.0 · Data.SemigroupShow a => Show (Max a)Defined in base-4.20.2.0 · Data.SemigroupShow a => Show (Min a)Defined in base-4.20.2.0 · Data.SemigroupShow a => Show (Decoder a)Defined in binary-0.8.9.3 · Data.Binary.Get.InternalShow a => Show (IntMap a)Defined in containers-0.7 · Data.IntMap.InternalShow a => Show (Seq a)Defined in containers-0.7 · Data.Sequence.InternalShow a => Show (ViewL a)Defined in containers-0.7 · Data.Sequence.InternalShow a => Show (ViewR a)Defined in containers-0.7 · Data.Sequence.InternalShow a => Show (Intersection a)Defined in containers-0.7 · Data.Set.InternalShow a => Show (Set a)Defined in containers-0.7 · Data.Set.InternalShow a => Show (Tree a)Defined in containers-0.7 · Data.TreeShow a => Show (DNonEmpty a)Defined in dlist-1.0 · Data.DList.DNonEmpty.InternalShow a => Show (DList a)Defined in dlist-1.0 · Data.DList.InternalShow a => Show (ExitCase a)Defined in exceptions-0.10.9 · Control.Monad.CatchShow a => Show (NonEmpty a)Defined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow a => Show (And a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsShow a => Show (Iff a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsShow a => Show (Ior a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsShow a => Show (Xor a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsShow a => Show (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityThis instance would be equivalent to the derived instances of the Identity newtype if the runIdentity field were removed
Show a => Show (First a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidShow a => Show (Last a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidShow a => Show (Down a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.OrdShow a => Show (Dual a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalShow a => Show (Product a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalShow a => Show (Sum a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalShow a => Show (ExceptionWithContext a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Exception.TypeShow a => Show (ZipList a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Functor.ZipListShow a => Show (Maybe a)Defined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow a => Show (Ratio a)Defined in ghc-internal-9.1003.0 · GHC.Internal.RealShow a => Show (Hashed a)Defined in hashable-1.4.7.0 · Data.Hashable.ClassShow a => Show (AnnotDetails a)Defined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJShow a => Show (Span a)Defined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJShow a => Show (Array a)Defined in primitive-0.9.1.0 · Data.Primitive.ArrayShow a => Show (SmallArray a)Defined in primitive-0.9.1.0 · Data.Primitive.SmallArrayShow a => Show (Array a)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal.ArrayShow a => Show (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.InternalShow a => Show (Vector a)Defined in vector-0.13.2.0 · Data.VectorShow a => Show (Vector a)Defined in vector-0.13.2.0 · Data.Vector.StrictShow a => Show (a)Defined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow a => Show [a]Defined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow e => Show (NoBacktrace e)Defined in ghc-internal-9.1003.0 · GHC.Internal.Exception.TypeShow flag => Show (TyVarBndr flag)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxShow g => Show (StateGen g)Defined in random-1.2.1.3 · System.Random.InternalShow g => Show (AtomicGen g)Defined in random-1.2.1.3 · System.Random.StatefulShow g => Show (IOGen g)Defined in random-1.2.1.3 · System.Random.StatefulShow g => Show (STGen g)Defined in random-1.2.1.3 · System.Random.StatefulShow g => Show (TGen g)Defined in random-1.2.1.3 · System.Random.StatefulShow k => Show (Error k)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal.DebugShow k => Show (Validity k)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal.DebugShow m => Show (WrappedMonoid m)Defined in base-4.20.2.0 · Data.SemigroupShow p => Show (Par1 p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsShow vertex => Show (SCC vertex)Defined in containers-0.7 · Data.Graph(Show a, Storable a) => Show (Vector a)Defined in vector-0.13.2.0 · Data.Vector.Storable(Show a, Prim a) => Show (PrimArray a)Defined in primitive-0.9.1.0 · Data.Primitive.PrimArray(Show a, Prim a) => Show (Vector a)Defined in vector-0.13.2.0 · Data.Vector.Primitive(Show a, Unbox a) => Show (Vector a)Defined in vector-0.13.2.0 · Data.Vector.Unboxed · orphanHasResolution a => Show (Fixed a)Defined in base-4.20.2.0 · Data.FixedShow (Proxy s)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.ProxyShow (TypeRep a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Typeable.InternalShow (U1 p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsShow (UAddr p)Defined in base-orphans-0.9.3 · Data.Orphans · orphanShow (V1 p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsShow (ST s a)Defined in ghc-internal-9.1003.0 · GHC.Internal.STShow (a -> b)Defined in base-4.20.2.0 · Text.Show.Functions · orphanShow (f a) => Show (Yoneda f a)Defined in kan-extensions-5.2.7 · Data.Functor.YonedaShow m => Show (Over m a)Defined in selective-0.7.0.1 · Control.SelectiveShow m => Show (Under m a)Defined in selective-0.7.0.1 · Control.SelectiveShow m => Show (Over m a)Defined in selective-0.7.0.1 · Control.Selective.MultiShow m => Show (Under m a)Defined in selective-0.7.0.1 · Control.Selective.Multi(Show1 f, Show a) => Show (Cofree f a)Defined in free-5.2 · Control.Comonad.Cofree(Show1 f, Show a) => Show (Free f a)Defined in free-5.2 · Control.Monad.Free(Show1 f, Show a) => Show (Free f a)Defined in free-5.2 · Control.Monad.Free.Ap(Show1 f, Show a) => Show (Lift f a)Defined in transformers-0.6.1.1 · Control.Applicative.Lift(Show1 m, Show a) => Show (IterT m a)Defined in free-5.2 · Control.Monad.Trans.Iter(Show1 m, Show a) => Show (MaybeT m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Maybe(Show1 w, Show a) => Show (CoiterT w a)Defined in free-5.2 · Control.Comonad.Trans.Coiter(Functor f, Show1 f, Show a) => Show (Coyoneda f a)Defined in kan-extensions-5.2.7 · Data.Functor.Coyoneda(Ix a, Show a, Show b) => Show (Array a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Arr(Ix ix, Show ix, Show e, IArray UArray e) => Show (UArray ix e)Defined in array-0.5.8.0 · Data.Array.Base(Show a, Show b) => Show (Arg a b)Defined in base-4.20.2.0 · Data.Semigroup(Show a, Show b) => Show (Either a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Either(Show a, Show b) => Show (a, b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Show(Show e, Show a) => Show (Validation e a)Defined in either-5.0.3 · Data.Either.Validation(Show e, Show a) => Show (Validation e a)Defined in selective-0.7.0.1 · Control.Selective(Show k, Show a) => Show (Map k a)Defined in containers-0.7 · Data.Map.Internal(Show k, Show v) => Show (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal(GShow (Rep1 f a), Generic1 f) => Show (FunctorClassesDefault f a)Defined in transformers-compat-0.7.2 · Data.Functor.Classes.Generic.InternalShow (Coercion a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.CoercionShow (OrderingI a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.OrdShow (URec Char p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsShow (URec Double p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsShow (URec Float p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsShow (URec Int p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsShow (URec Word p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsShow (a :~: b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.EqualityShow (bi a b) => Show (Biap bi a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.BiapShow (f a) => Show (Ap f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidShow (f a) => Show (Alt f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalShow (f a) => Show (WrappedContravariant f a)Defined in invariant-0.6.4 · Data.Functor.InvariantShow (f a) => Show (WrappedFunctor f a)Defined in invariant-0.6.4 · Data.Functor.InvariantShow (f p) => Show (Rec1 f p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsShow (p (Fix p a) a) => Show (Fix p a)Defined in bifunctors-5.6.2 · Data.Bifunctor.FixShow (p a a) => Show (Join p a)Defined in bifunctors-5.6.2 · Data.Bifunctor.JoinShow (w (CofreeF f a (CofreeT f w a))) => Show (CofreeT f w a)Defined in free-5.2 · Control.Comonad.Trans.CofreeShow a => Show (Const a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.ConstShow a => Show (Constant a b)Defined in transformers-0.6.1.1 · Data.Functor.ConstantShow b => Show (Tagged s b)Defined in tagged-0.8.9 · Data.Tagged(Show1 f, Show1 m, Show a) => Show (FreeT f m a)Defined in free-5.2 · Control.Monad.Trans.Free(Show1 f, Show1 m, Show a) => Show (FreeT f m a)Defined in free-5.2 · Control.Monad.Trans.Free.Ap(Show1 f, Show a) => Show (Backwards f a)Defined in transformers-0.6.1.1 · Control.Applicative.Backwards(Show1 f, Show a) => Show (IdentityT f a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Identity(Show1 f, Show a) => Show (Reverse f a)Defined in transformers-0.6.1.1 · Data.Functor.Reverse(Show1 f, Show e, Show a) => Show (ExceptT e f a)Defined in selective-0.7.0.1 · Control.Selective.Trans.Except(Show a, Show (f b)) => Show (CofreeF f a b)Defined in free-5.2 · Control.Comonad.Trans.Cofree(Show a, Show (f b)) => Show (FreeF f a b)Defined in free-5.2 · Control.Monad.Trans.Free(Show a, Show (f b)) => Show (FreeF f a b)Defined in free-5.2 · Control.Monad.Trans.Free.Ap(Show a, Show b, Show c) => Show (a, b, c)Defined in ghc-internal-9.1003.0 · GHC.Internal.Show(Show e, Show1 m, Show a) => Show (ExceptT e m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Except(Show w, Show1 m, Show a) => Show (WriterT w m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Lazy(Show w, Show1 m, Show a) => Show (WriterT w m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.StrictShow (a :~~: b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.EqualityShow c => Show (K1 i c p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics(Show (f a), Show (g a)) => Show (Product f g a)Defined in base-4.20.2.0 · Data.Functor.Product(Show (f a), Show (g a)) => Show (Sum f g a)Defined in base-4.20.2.0 · Data.Functor.Sum(Show (f p), Show (g p)) => Show ((:*:) f g p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics(Show (f p), Show (g p)) => Show ((:+:) f g p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics(Show a, Show b, Show c, Show d) => Show (a, b, c, d)Defined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow (f (g a)) => Show (Compose f g a)Defined in base-4.20.2.0 · Data.Functor.ComposeShow (f (g p)) => Show ((:.:) f g p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsShow (f a) => Show (Clown f a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.ClownShow (f p) => Show (M1 i c f p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsShow (g b) => Show (Joker g a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.JokerShow (p a b) => Show (WrappedBifunctor p a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.WrappedShow (p a b) => Show (WrappedProfunctor p a b)Defined in invariant-0.6.4 · Data.Functor.InvariantShow (p b a) => Show (Flip p a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.Flip(Show a, Show b, Show c, Show d, Show e) => Show (a, b, c, d, e)Defined in ghc-internal-9.1003.0 · GHC.Internal.Show(Show (f a b), Show (g a b)) => Show (Product f g a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.Product(Show (p a b), Show (q a b)) => Show (Sum p q a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.Sum(Show a, Show b, Show c, Show d, Show e, Show f) => Show (a, b, c, d, e, f)Defined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow (f (p a b)) => Show (Tannen f p a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.Tannen(Show a, Show b, Show c, Show d, Show e, Show f, Show g) => Show (a, b, c, d, e, f, g)Defined in ghc-internal-9.1003.0 · GHC.Internal.Show(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h) => Show (a, b, c, d, e, f, g, h)Defined in ghc-internal-9.1003.0 · GHC.Internal.ShowShow (p (f a) (g b)) => Show (Biff p f g a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.Biff(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i) => Show (a, b, c, d, e, f, g, h, i)Defined in ghc-internal-9.1003.0 · GHC.Internal.Show(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j) => Show (a, b, c, d, e, f, g, h, i, j)Defined in ghc-internal-9.1003.0 · GHC.Internal.Show(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k) => Show (a, b, c, d, e, f, g, h, i, j, k)Defined in ghc-internal-9.1003.0 · GHC.Internal.Show(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l) => Show (a, b, c, d, e, f, g, h, i, j, k, l)Defined in ghc-internal-9.1003.0 · GHC.Internal.Show(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m) => Show (a, b, c, d, e, f, g, h, i, j, k, l, m)Defined in ghc-internal-9.1003.0 · GHC.Internal.Show(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n) => Show (a, b, c, d, e, f, g, h, i, j, k, l, m, n)Defined in ghc-internal-9.1003.0 · GHC.Internal.Show(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n, Show o) => Show (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)Defined in ghc-internal-9.1003.0 · GHC.Internal.Show
The IsList class and its methods are intended to be used in conjunction with the OverloadedLists extension.
Associated types
Methods
Instances29IsList, …
IsList ByteArrayDefined in base-4.20.2.0 · Data.Array.ByteIsList BuilderDefined in bytestring-0.12.2.0 · Data.ByteString.Builder.InternalIsList ByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Internal.TypeIsList ByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Lazy.InternalIsList ShortByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Short.InternalIsList IntSetDefined in containers-0.7 · Data.IntSet.InternalIsList VersionDefined in ghc-internal-9.1003.0 · GHC.Internal.IsListIsList CallStackDefined in ghc-internal-9.1003.0 · GHC.Internal.IsListIsList TextDefined in text-2.1.3 · Data.Text · orphanPerforms replacement on invalid scalar values:
Example2 expressions :set -XOverloadedLists['\55555'] :: Text"\65533"
IsList TextDefined in text-2.1.3 · Data.Text.Lazy · orphanPerforms replacement on invalid scalar values:
Example2 expressions :set -XOverloadedLists['\55555'] :: Data.Text.Lazy.Text"\65533"
Storable a => IsList (Vector a)Defined in vector-0.13.2.0 · Data.Vector.StorableIsList (IntMap a)Defined in containers-0.7 · Data.IntMap.InternalIsList (Seq a)Defined in containers-0.7 · Data.Sequence.InternalIsList (DNonEmpty a)Defined in dlist-1.0 · Data.DList.DNonEmpty.InternalIsList (DList a)Defined in dlist-1.0 · Data.DList.InternalIsList (NonEmpty a)Defined in ghc-internal-9.1003.0 · GHC.Internal.IsListIsList (ZipList a)Defined in ghc-internal-9.1003.0 · GHC.Internal.IsListIsList (Array a)Defined in primitive-0.9.1.0 · Data.Primitive.ArrayIsList (SmallArray a)Defined in primitive-0.9.1.0 · Data.Primitive.SmallArrayIsList (Vector a)Defined in vector-0.13.2.0 · Data.VectorIsList (Vector a)Defined in vector-0.13.2.0 · Data.Vector.StrictIsList [a]Defined in ghc-internal-9.1003.0 · GHC.Internal.IsListOrd a => IsList (Set a)Defined in containers-0.7 · Data.Set.InternalHashable a => IsList (HashSet a)Defined in unordered-containers-0.2.21 · Data.HashSet.InternalPrim a => IsList (PrimArray a)Defined in primitive-0.9.1.0 · Data.Primitive.PrimArrayPrim a => IsList (Vector a)Defined in vector-0.13.2.0 · Data.Vector.PrimitiveUnbox e => IsList (Vector e)Defined in vector-0.13.2.0 · Data.Vector.Unboxed · orphanOrd k => IsList (Map k v)Defined in containers-0.7 · Data.Map.InternalHashable k => IsList (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal
Return the first Right value. If both are Left's, accumulate errors.
A monad transformer that adds exceptions to other monads.
ExceptT constructs a monad parameterized over two things:
e - The exception type.
m - The inner monad.
The return function yields a computation that produces the given
value, while >>= sequences two subcomputations, exiting on the
first exception.
Instances48MonadRWS, Generic1, MonadAccum, MonadError, MonadReader, MonadState, …
MonadRWS r w s m => MonadRWS r w s (ExceptT e m)Defined in mtl-2.3.1 · Control.Monad.RWS.ClassFunctor m => Generic1 (ExceptT e m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ExceptMonadAccum w m => MonadAccum w (ExceptT e m)Defined in mtl-2.3.1 · Control.Monad.AccumThe accumulated value 'survives' an exception: even if the computation fails to deliver a result, we still have an accumulated value.
Monad m => MonadError e (ExceptT e m)Defined in mtl-2.3.1 · Control.Monad.Error.ClassMonadReader r m => MonadReader r (ExceptT e m)Defined in mtl-2.3.1 · Control.Monad.Reader.ClassMonadState s m => MonadState s (ExceptT e m)Defined in mtl-2.3.1 · Control.Monad.State.ClassMonadWriter w m => MonadWriter w (ExceptT e m)Defined in mtl-2.3.1 · Control.Monad.Writer.ClassMonadSelect r m => MonadSelect r (ExceptT e m)Defined in mtl-2.3.1 · Control.Monad.SelectMonadBase b m => MonadBase b (ExceptT e m)Defined in transformers-base-0.4.6 · Control.Monad.Base(Functor f, MonadFree f m) => MonadFree f (ExceptT e m)Defined in free-5.2 · Control.Monad.Free.ClassMonadTrans (ExceptT e)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ExceptMonad m => Monad (ExceptT e m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ExceptFunctor m => Functor (ExceptT e m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ExceptMonadFix m => MonadFix (ExceptT e m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ExceptMonadFail m => MonadFail (ExceptT e m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Except(Functor m, Monad m) => Applicative (ExceptT e m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ExceptFoldable f => Foldable (ExceptT e f)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ExceptTraversable f => Traversable (ExceptT e f)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Except(Functor m, Monad m, Monoid e) => Alternative (ExceptT e m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Except(Monad m, Monoid e) => MonadPlus (ExceptT e m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ExceptMonadIO m => MonadIO (ExceptT e m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ExceptMonadZip m => MonadZip (ExceptT e m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Except(Eq e, Eq1 m) => Eq1 (ExceptT e m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Except(Ord e, Ord1 m) => Ord1 (ExceptT e m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Except(Read e, Read1 m) => Read1 (ExceptT e m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Except(Show e, Show1 m) => Show1 (ExceptT e m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ExceptContravariant m => Contravariant (ExceptT e m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ExceptMonadCont m => MonadCont (ExceptT e m)Defined in mtl-2.3.1 · Control.Monad.Cont.ClassMonadCatch m => MonadCatch (ExceptT e m)Defined in exceptions-0.10.9 · Control.Monad.CatchCatches exceptions from the base monad.
MonadMask m => MonadMask (ExceptT e m)Defined in exceptions-0.10.9 · Control.Monad.CatchMonadThrow m => MonadThrow (ExceptT e m)Defined in exceptions-0.10.9 · Control.Monad.CatchThrows exceptions into the base monad.
PrimMonad m => PrimMonad (ExceptT e m)Defined in primitive-0.9.1.0 · Control.Monad.PrimitiveDivisible m => Divisible (ExceptT e m)Defined in contravariant-1.5.5 · Data.Functor.Contravariant.Divisible(Functor f, Monad f, Semigroup e) => Alt (ExceptT e f)Defined in semigroupoids-6.0.1 · Data.Functor.Alt(Functor m, Monad m) => Apply (ExceptT e m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.Class(Functor m, Monad m) => Bind (ExceptT e m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassDivise m => Divise (ExceptT e m)Defined in semigroupoids-6.0.1 · Data.Functor.Contravariant.Divise(Functor f, Monad f, Semigroup e, Monoid e) => Plus (ExceptT e f)Defined in semigroupoids-6.0.1 · Data.Functor.PlusInvariant m => Invariant (ExceptT e m)Defined in invariant-0.6.4 · Data.Functor.Invariantfrom the
transformerspackagePointed m => Pointed (ExceptT e m)Defined in pointed-5.0.4 · Data.Pointed(Eq e, Eq1 m, Eq a) => Eq (ExceptT e m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Except(Ord e, Ord1 m, Ord a) => Ord (ExceptT e m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Except(Read e, Read1 m, Read a) => Read (ExceptT e m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Except(Show e, Show1 m, Show a) => Show (ExceptT e m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ExceptGeneric (ExceptT e m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Excepttype Rep (ExceptT e m a) = D1 ('MetaDataDefined in transformers-0.6.1.1 · Control.Monad.Trans.Except"ExceptT"
"Control.Monad.Trans.Except"
"transformers-0.6.1.1-a11a"
'True) (C1 ('MetaCons"ExceptT"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (m (Either e a)))))type Rep1 (ExceptT e m) = D1 ('MetaDataDefined in transformers-0.6.1.1 · Control.Monad.Trans.Except"ExceptT"
"Control.Monad.Trans.Except"
"transformers-0.6.1.1-a11a"
'True) (C1 ('MetaCons"ExceptT"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (m :.: Rec1 (Either e))))type PrimState (ExceptT e m) = PrimState mDefined in primitive-0.9.1.0 · Control.Monad.Primitive
Constructor for computations in the exception monad. (The inverse of runExcept).
Map the unwrapped computation using the given function.
runExceptT (mapExceptT f m) = f (runExceptT m)
Extractor for computations in the exception monad. (The inverse of except).
The inverse of ExceptT.
Transform any exceptions thrown by the computation using the given function (a specialization of withExceptT).
Transform any exceptions thrown by the computation using the given function.
Instances52MonadTrans, MonadRWS, Generic1, MonadAccum, MonadError, MonadReader, …
MonadTrans MaybeTDefined in transformers-0.6.1.1 · Control.Monad.Trans.MaybeMonadRWS r w s m => MonadRWS r w s (MaybeT m)Defined in mtl-2.3.1 · Control.Monad.RWS.ClassFunctor m => Generic1 (MaybeT m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.MaybeMonadAccum w m => MonadAccum w (MaybeT m)Defined in mtl-2.3.1 · Control.Monad.AccumThe accumulated value 'survives' an error: even if the computation fails to deliver a result, we still have an accumulated value.
MonadError e m => MonadError e (MaybeT m)Defined in mtl-2.3.1 · Control.Monad.Error.ClassMonadReader r m => MonadReader r (MaybeT m)Defined in mtl-2.3.1 · Control.Monad.Reader.ClassMonadState s m => MonadState s (MaybeT m)Defined in mtl-2.3.1 · Control.Monad.State.ClassMonadWriter w m => MonadWriter w (MaybeT m)Defined in mtl-2.3.1 · Control.Monad.Writer.ClassMonadSelect r m => MonadSelect r (MaybeT m)Defined in mtl-2.3.1 · Control.Monad.SelectMonadBase b m => MonadBase b (MaybeT m)Defined in transformers-base-0.4.6 · Control.Monad.Base(Functor f, MonadFree f m) => MonadFree f (MaybeT m)Defined in free-5.2 · Control.Monad.Free.ClassMonad m => Monad (MaybeT m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.MaybeFunctor m => Functor (MaybeT m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.MaybeMonadFix m => MonadFix (MaybeT m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.MaybeMonad m => MonadFail (MaybeT m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Maybe(Functor m, Monad m) => Applicative (MaybeT m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.MaybeFoldable f => Foldable (MaybeT f)Defined in transformers-0.6.1.1 · Control.Monad.Trans.MaybeTraversable f => Traversable (MaybeT f)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Maybe(Functor m, Monad m) => Alternative (MaybeT m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.MaybeMonad m => MonadPlus (MaybeT m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.MaybeMonadIO m => MonadIO (MaybeT m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.MaybeMonadZip m => MonadZip (MaybeT m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.MaybeEq1 m => Eq1 (MaybeT m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.MaybeOrd1 m => Ord1 (MaybeT m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.MaybeRead1 m => Read1 (MaybeT m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.MaybeShow1 m => Show1 (MaybeT m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.MaybeContravariant m => Contravariant (MaybeT m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.MaybeMonadCont m => MonadCont (MaybeT m)Defined in mtl-2.3.1 · Control.Monad.Cont.ClassMonadCatch m => MonadCatch (MaybeT m)Defined in exceptions-0.10.9 · Control.Monad.CatchCatches exceptions from the base monad.
MonadMask m => MonadMask (MaybeT m)Defined in exceptions-0.10.9 · Control.Monad.CatchMonadThrow m => MonadThrow (MaybeT m)Defined in exceptions-0.10.9 · Control.Monad.CatchThrows exceptions into the base monad.
PrimMonad m => PrimMonad (MaybeT m)Defined in primitive-0.9.1.0 · Control.Monad.PrimitiveDivisible m => Decidable (MaybeT m)Defined in contravariant-1.5.5 · Data.Functor.Contravariant.DivisibleDivisible m => Divisible (MaybeT m)Defined in contravariant-1.5.5 · Data.Functor.Contravariant.Divisible(Functor f, Monad f) => Alt (MaybeT f)Defined in semigroupoids-6.0.1 · Data.Functor.Alt(Functor m, Monad m) => Apply (MaybeT m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.Class(Functor m, Monad m) => Bind (MaybeT m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.Class(Divisible m, Divise m) => Conclude (MaybeT m)Defined in semigroupoids-6.0.1 · Data.Functor.Contravariant.ConcludeThis instance is only available if the
+contravariantcabalflag is enabled.Divise m => Decide (MaybeT m)Defined in semigroupoids-6.0.1 · Data.Functor.Contravariant.DecideDivise m => Divise (MaybeT m)Defined in semigroupoids-6.0.1 · Data.Functor.Contravariant.Divise(Functor f, Monad f) => Plus (MaybeT f)Defined in semigroupoids-6.0.1 · Data.Functor.PlusInvariant m => Invariant (MaybeT m)Defined in invariant-0.6.4 · Data.Functor.Invariantfrom the
transformerspackageMonad m => Selective (MaybeT m)Defined in selective-0.7.0.1 · Control.SelectivePointed m => Pointed (MaybeT m)Defined in pointed-5.0.4 · Data.Pointed(Eq1 m, Eq a) => Eq (MaybeT m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Maybe(Ord1 m, Ord a) => Ord (MaybeT m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Maybe(Read1 m, Read a) => Read (MaybeT m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Maybe(Show1 m, Show a) => Show (MaybeT m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.MaybeGeneric (MaybeT m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Maybetype Rep (MaybeT m a) = D1 ('MetaDataDefined in transformers-0.6.1.1 · Control.Monad.Trans.Maybe"MaybeT"
"Control.Monad.Trans.Maybe"
"transformers-0.6.1.1-a11a"
'True) (C1 ('MetaCons"MaybeT"
'PrefixI 'True) (S1 ('MetaSel ('Just"runMaybeT"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (m (Maybe a)))))type Rep1 (MaybeT m) = D1 ('MetaDataDefined in transformers-0.6.1.1 · Control.Monad.Trans.Maybe"MaybeT"
"Control.Monad.Trans.Maybe"
"transformers-0.6.1.1-a11a"
'True) (C1 ('MetaCons"MaybeT"
'PrefixI 'True) (S1 ('MetaSel ('Just"runMaybeT"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (m :.: Rec1 Maybe)))type PrimState (MaybeT m) = PrimState mDefined in primitive-0.9.1.0 · Control.Monad.Primitive
The reader monad transformer, which adds a read-only environment to the given monad.
The return function ignores the environment, while m >>= k
passes the inherited environment to both subcomputations:
Constructors
ReaderTrunReaderT :: r -> m a
Instances53Generic1, MonadAccum, MonadError, MonadReader, MonadState, MonadWriter, …
Generic1 (ReaderT r m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ReaderMonadAccum w m => MonadAccum w (ReaderT r m)Defined in mtl-2.3.1 · Control.Monad.AccumMonadError e m => MonadError e (ReaderT r m)Defined in mtl-2.3.1 · Control.Monad.Error.ClassMonad m => MonadReader r (ReaderT r m)Defined in mtl-2.3.1 · Control.Monad.Reader.ClassMonadState s m => MonadState s (ReaderT r m)Defined in mtl-2.3.1 · Control.Monad.State.ClassMonadWriter w m => MonadWriter w (ReaderT r m)Defined in mtl-2.3.1 · Control.Monad.Writer.ClassMonadSelect r' m => MonadSelect r' (ReaderT r m)Defined in mtl-2.3.1 · Control.Monad.SelectProvides a read-only environment of type
rto the 'strategy' function. However, the 'ranking' function (or more accurately, representation) has no access tor. Put another way, you can influence what values get chosen by changingr, but not how solutions are ranked.MonadBase b m => MonadBase b (ReaderT r m)Defined in transformers-base-0.4.6 · Control.Monad.Base(Functor f, MonadFree f m) => MonadFree f (ReaderT e m)Defined in free-5.2 · Control.Monad.Free.ClassMonadTrans (ReaderT r)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ReaderBindTrans (ReaderT e)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.TransMonad m => Monad (ReaderT r m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ReaderFunctor m => Functor (ReaderT r m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ReaderMonadFix m => MonadFix (ReaderT r m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ReaderMonadFail m => MonadFail (ReaderT r m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ReaderApplicative m => Applicative (ReaderT r m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ReaderAlternative m => Alternative (ReaderT r m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ReaderMonadPlus m => MonadPlus (ReaderT r m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ReaderMonadIO m => MonadIO (ReaderT r m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ReaderMonadZip m => MonadZip (ReaderT r m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ReaderContravariant m => Contravariant (ReaderT r m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ReaderMonadCont m => MonadCont (ReaderT r m)Defined in mtl-2.3.1 · Control.Monad.Cont.ClassMonadCatch m => MonadCatch (ReaderT r m)Defined in exceptions-0.10.9 · Control.Monad.CatchMonadMask m => MonadMask (ReaderT r m)Defined in exceptions-0.10.9 · Control.Monad.CatchMonadThrow m => MonadThrow (ReaderT r m)Defined in exceptions-0.10.9 · Control.Monad.CatchPrimMonad m => PrimMonad (ReaderT r m)Defined in primitive-0.9.1.0 · Control.Monad.PrimitiveDistributive g => Distributive (ReaderT e g)Defined in distributive-0.6.2.1 · Data.DistributiveDecidable m => Decidable (ReaderT r m)Defined in contravariant-1.5.5 · Data.Functor.Contravariant.DivisibleDivisible m => Divisible (ReaderT r m)Defined in contravariant-1.5.5 · Data.Functor.Contravariant.DivisibleAlt f => Alt (ReaderT e f)Defined in semigroupoids-6.0.1 · Data.Functor.AltApply m => Apply (ReaderT e m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind m => Bind (ReaderT e m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassConclude m => Conclude (ReaderT r m)Defined in semigroupoids-6.0.1 · Data.Functor.Contravariant.ConcludeDecide m => Decide (ReaderT r m)Defined in semigroupoids-6.0.1 · Data.Functor.Contravariant.DecideDivise m => Divise (ReaderT r m)Defined in semigroupoids-6.0.1 · Data.Functor.Contravariant.DivisePlus f => Plus (ReaderT e f)Defined in semigroupoids-6.0.1 · Data.Functor.PlusRepresentable m => Representable (ReaderT e m)Defined in adjunctions-4.4.3 · Data.Functor.RepInvariant m => Invariant (ReaderT r m)Defined in invariant-0.6.4 · Data.Functor.Invariantfrom the
transformerspackageSelective f => Selective (ReaderT env f)Defined in selective-0.7.0.1 · Control.SelectiveIndexable m => Indexable (ReaderT e m)Defined in keys-3.12.3 · Data.KeyKeyed m => Keyed (ReaderT e m)Defined in keys-3.12.3 · Data.KeyLookup m => Lookup (ReaderT e m)Defined in keys-3.12.3 · Data.KeyZip m => Zip (ReaderT e m)Defined in keys-3.12.3 · Data.KeyZipWithKey m => ZipWithKey (ReaderT e m)Defined in keys-3.12.3 · Data.KeyPointed m => Pointed (ReaderT r m)Defined in pointed-5.0.4 · Data.PointedFunctorWithIndex i m => FunctorWithIndex (e, i) (ReaderT e m)Defined in indexed-traversable-0.1.4 · WithIndexAdjunction w m => Adjunction (EnvT e w) (ReaderT e m)Defined in adjunctions-4.4.3 · Data.Functor.AdjunctionGeneric (ReaderT r m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Readertype Rep (ReaderT r m a) = D1 ('MetaDataDefined in transformers-0.6.1.1 · Control.Monad.Trans.Reader"ReaderT"
"Control.Monad.Trans.Reader"
"transformers-0.6.1.1-a11a"
'True) (C1 ('MetaCons"ReaderT"
'PrefixI 'True) (S1 ('MetaSel ('Just"runReaderT"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (r -> m a))))type Rep1 (ReaderT r m) = D1 ('MetaDataDefined in transformers-0.6.1.1 · Control.Monad.Trans.Reader"ReaderT"
"Control.Monad.Trans.Reader"
"transformers-0.6.1.1-a11a"
'True) (C1 ('MetaCons"ReaderT"
'PrefixI 'True) (S1 ('MetaSel ('Just"runReaderT"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (FUN 'Many r :.: Rec1 m)))type PrimState (ReaderT r m) = PrimState mDefined in primitive-0.9.1.0 · Control.Monad.Primitivetype Rep (ReaderT e m) = (e, Rep m)Defined in adjunctions-4.4.3 · Data.Functor.Reptype Key (ReaderT e m) = (e, Key m)Defined in keys-3.12.3 · Data.Key
Transform the computation inside a ReaderT.
runReaderT (mapReaderT f m) = f . runReaderT m
Runs a Reader and extracts the final value from it.
(The inverse of reader.)
withReader Execute a computation in a modified environment (a specialization of withReaderT).
runReader (withReader f m) = runReader m . f
withReaderT Execute a computation in a modified environment (a more general version of local).
runReaderT (withReaderT f m) = runReaderT m . f
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.
Instances39MonadAccum, MonadError, MonadReader, MonadState, MonadWriter, MonadSelect, …
MonadAccum w m => MonadAccum w (StateT s m)Defined in mtl-2.3.1 · Control.Monad.AccumMonadError e m => MonadError e (StateT s m)Defined in mtl-2.3.1 · Control.Monad.Error.ClassMonadReader r m => MonadReader r (StateT s m)Defined in mtl-2.3.1 · Control.Monad.Reader.ClassMonad m => MonadState s (StateT s m)Defined in mtl-2.3.1 · Control.Monad.State.ClassMonadWriter w m => MonadWriter w (StateT s m)Defined in mtl-2.3.1 · Control.Monad.Writer.ClassMonadSelect w m => MonadSelect w (StateT s m)Defined in mtl-2.3.1 · Control.Monad.Select'Readerizes' the state: the 'ranking' function can see a value of type
s, but not modify it. Effectively, can be thought of as 'extending' the 'ranking' by all values ins, but whichsgets given to any rank calls is predetermined by the 'outer state' (and cannot change).MonadBase b m => MonadBase b (StateT s m)Defined in transformers-base-0.4.6 · Control.Monad.Base(Functor f, MonadFree f m) => MonadFree f (StateT s m)Defined in free-5.2 · Control.Monad.Free.ClassMonadTrans (StateT s)Defined in transformers-0.6.1.1 · Control.Monad.Trans.State.StrictBindTrans (StateT s)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.TransMonad m => Monad (StateT s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.State.StrictFunctor m => Functor (StateT s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.State.StrictMonadFix m => MonadFix (StateT s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.State.StrictMonadFail m => MonadFail (StateT s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.State.Strict(Functor m, Monad m) => Applicative (StateT s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.State.Strict(Functor m, MonadPlus m) => Alternative (StateT s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.State.StrictMonadPlus m => MonadPlus (StateT s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.State.StrictMonadIO m => MonadIO (StateT s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.State.StrictContravariant m => Contravariant (StateT s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.State.StrictMonadCont m => MonadCont (StateT s m)Defined in mtl-2.3.1 · Control.Monad.Cont.ClassMonadCatch m => MonadCatch (StateT s m)Defined in exceptions-0.10.9 · Control.Monad.CatchMonadMask m => MonadMask (StateT s m)Defined in exceptions-0.10.9 · Control.Monad.CatchMonadThrow m => MonadThrow (StateT s m)Defined in exceptions-0.10.9 · Control.Monad.CatchPrimMonad m => PrimMonad (StateT s m)Defined in primitive-0.9.1.0 · Control.Monad.PrimitiveDecidable m => Decidable (StateT s m)Defined in contravariant-1.5.5 · Data.Functor.Contravariant.DivisibleDivisible m => Divisible (StateT s m)Defined in contravariant-1.5.5 · Data.Functor.Contravariant.DivisibleAlt f => Alt (StateT e f)Defined in semigroupoids-6.0.1 · Data.Functor.AltBind m => Apply (StateT s m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind m => Bind (StateT s m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassConclude m => Conclude (StateT s m)Defined in semigroupoids-6.0.1 · Data.Functor.Contravariant.ConcludeDecide m => Decide (StateT s m)Defined in semigroupoids-6.0.1 · Data.Functor.Contravariant.DecideDivise m => Divise (StateT s m)Defined in semigroupoids-6.0.1 · Data.Functor.Contravariant.DivisePlus f => Plus (StateT e f)Defined in semigroupoids-6.0.1 · Data.Functor.PlusInvariant m => Invariant (StateT s m)Defined in invariant-0.6.4 · Data.Functor.Invariantfrom the
transformerspackageMonad m => Selective (StateT s m)Defined in selective-0.7.0.1 · Control.SelectivePointed m => Pointed (StateT s m)Defined in pointed-5.0.4 · Data.PointedGeneric (StateT s m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.State.Stricttype Rep (StateT s m a) = D1 ('MetaDataDefined in transformers-0.6.1.1 · Control.Monad.Trans.State.Strict"StateT"
"Control.Monad.Trans.State.Strict"
"transformers-0.6.1.1-a11a"
'True) (C1 ('MetaCons"StateT"
'PrefixI 'True) (S1 ('MetaSel ('Just"runStateT"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (s -> m (a, s)))))type PrimState (StateT s m) = PrimState mDefined in primitive-0.9.1.0 · Control.Monad.Primitive
Evaluate a state computation with the given initial state and return the final value, discarding the final state.
evalStateT m s = liftM fst (runStateT m s)
Evaluate a state computation with the given initial state and return the final state, discarding the final value.
execStateT m s = liftM snd (runStateT m s)
runState :: State s astate-passing computation to execute
-> sinitial state
-> (a, s)return value and final state
Unwrap a state monad computation as a function. (The inverse of state.)
withStateT f m executes action m on a state modified by
applying f.
withStateT f m = modify f >> m
A writer monad parameterized by:
w- the output to accumulate.m- The inner monad.
The return function produces the output mempty, while m >>= k
combines the outputs of the subcomputations using mappend (also
known as <>):
Constructors
WriterTrunWriterT :: m (a, w)
Instances51MonadAccum, MonadError, MonadReader, MonadState, MonadWriter, MonadSelect, …
(MonadAccum w' m, Monoid w) => MonadAccum w' (WriterT w m)Defined in mtl-2.3.1 · Control.Monad.Accum(Monoid w, MonadError e m) => MonadError e (WriterT w m)Defined in mtl-2.3.1 · Control.Monad.Error.Class(Monoid w, MonadReader r m) => MonadReader r (WriterT w m)Defined in mtl-2.3.1 · Control.Monad.Reader.Class(Monoid w, MonadState s m) => MonadState s (WriterT w m)Defined in mtl-2.3.1 · Control.Monad.State.Class(Monoid w, Monad m) => MonadWriter w (WriterT w m)Defined in mtl-2.3.1 · Control.Monad.Writer.Class(MonadSelect w' m, Monoid w) => MonadSelect w' (WriterT w m)Defined in mtl-2.3.1 · Control.Monad.Select'Readerizes' the writer: the 'ranking' function can see the value that's been accumulated (of type
w), but can't add anything to the log. Effectively, can be thought of as 'extending' the 'ranking' by all values ofw, but whichwgets given to any rank calls is predetermined by the 'outer writer' (and cannot change).(Monoid w, MonadBase b m) => MonadBase b (WriterT w m)Defined in transformers-base-0.4.6 · Control.Monad.Base(Functor f, MonadFree f m, Monoid w) => MonadFree f (WriterT w m)Defined in free-5.2 · Control.Monad.Free.ClassMonoid w => MonadTrans (WriterT w)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.StrictMonoid w => BindTrans (WriterT w)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.Trans(Monoid w, Monad m) => Monad (WriterT w m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.StrictFunctor m => Functor (WriterT w m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Strict(Monoid w, MonadFix m) => MonadFix (WriterT w m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Strict(Monoid w, MonadFail m) => MonadFail (WriterT w m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Strict(Monoid w, Applicative m) => Applicative (WriterT w m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.StrictFoldable f => Foldable (WriterT w f)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.StrictTraversable f => Traversable (WriterT w f)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Strict(Monoid w, Alternative m) => Alternative (WriterT w m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Strict(Monoid w, MonadPlus m) => MonadPlus (WriterT w m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Strict(Monoid w, MonadIO m) => MonadIO (WriterT w m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Strict(Monoid w, MonadZip m) => MonadZip (WriterT w m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Strict(Eq w, Eq1 m) => Eq1 (WriterT w m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Strict(Ord w, Ord1 m) => Ord1 (WriterT w m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Strict(Read w, Read1 m) => Read1 (WriterT w m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Strict(Show w, Show1 m) => Show1 (WriterT w m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.StrictContravariant m => Contravariant (WriterT w m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Strict(Monoid w, MonadCont m) => MonadCont (WriterT w m)Defined in mtl-2.3.1 · Control.Monad.Cont.Class(MonadCatch m, Monoid w) => MonadCatch (WriterT w m)Defined in exceptions-0.10.9 · Control.Monad.Catch(MonadMask m, Monoid w) => MonadMask (WriterT w m)Defined in exceptions-0.10.9 · Control.Monad.Catch(MonadThrow m, Monoid w) => MonadThrow (WriterT w m)Defined in exceptions-0.10.9 · Control.Monad.Catch(Monoid w, PrimMonad m) => PrimMonad (WriterT w m)Defined in primitive-0.9.1.0 · Control.Monad.PrimitiveDecidable m => Decidable (WriterT w m)Defined in contravariant-1.5.5 · Data.Functor.Contravariant.DivisibleDivisible m => Divisible (WriterT w m)Defined in contravariant-1.5.5 · Data.Functor.Contravariant.DivisibleAlt f => Alt (WriterT w f)Defined in semigroupoids-6.0.1 · Data.Functor.Alt(Apply m, Semigroup w) => Apply (WriterT w m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassA
WriterT w mis not Applicative unless itswis a Monoid, but it is an instance of Apply(Bind m, Semigroup w) => Bind (WriterT w m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassConclude m => Conclude (WriterT w m)Defined in semigroupoids-6.0.1 · Data.Functor.Contravariant.ConcludeDecide m => Decide (WriterT w m)Defined in semigroupoids-6.0.1 · Data.Functor.Contravariant.DecideDivise m => Divise (WriterT w m)Defined in semigroupoids-6.0.1 · Data.Functor.Contravariant.DivisePlus f => Plus (WriterT w f)Defined in semigroupoids-6.0.1 · Data.Functor.PlusInvariant m => Invariant (WriterT w m)Defined in invariant-0.6.4 · Data.Functor.Invariantfrom the
transformerspackage(Monoid w, Selective f) => Selective (WriterT w f)Defined in selective-0.7.0.1 · Control.SelectiveCopointed m => Copointed (WriterT w m)Defined in pointed-5.0.4 · Data.Copointed(Default w, Pointed m) => Pointed (WriterT w m)Defined in pointed-5.0.4 · Data.Pointed(Eq w, Eq1 m, Eq a) => Eq (WriterT w m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Strict(Ord w, Ord1 m, Ord a) => Ord (WriterT w m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Strict(Read w, Read1 m, Read a) => Read (WriterT w m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Strict(Show w, Show1 m, Show a) => Show (WriterT w m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.StrictGeneric (WriterT w m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Stricttype Rep (WriterT w m a) = D1 ('MetaDataDefined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Strict"WriterT"
"Control.Monad.Trans.Writer.Strict"
"transformers-0.6.1.1-a11a"
'True) (C1 ('MetaCons"WriterT"
'PrefixI 'True) (S1 ('MetaSel ('Just"runWriterT"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (m (a, w)))))type PrimState (WriterT w m) = PrimState mDefined in primitive-0.9.1.0 · Control.Monad.Primitive
Extract the output from a writer computation.
execWriter m = snd (runWriter m)
Extract the output from a writer computation.
execWriterT m = liftM snd (runWriterT m)
Map both the return value and output of a computation using the given function.
runWriterT (mapWriterT f m) = f (runWriterT m)
Unwrap a writer computation as a (result, output) pair. (The inverse of writer.)
A compact representation of a Word8 vector.
It has a lower memory overhead than a ByteString and does not contribute to heap fragmentation. It can be converted to or from a ByteString (at the cost of copying the string data). It supports very few other operations.
Instances16IsList, Eq, Data, Ord, Read, Show, …
IsList ShortByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Short.InternalEq ShortByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Short.InternalData ShortByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Short.InternalOrd ShortByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Short.InternalLexicographic order.
Read ShortByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Short.InternalShow ShortByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Short.InternalIsString ShortByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Short.InternalBeware: fromString truncates multi-byte characters to octets. e.g. "枯朶に烏のとまりけり秋の暮" becomes �6k�nh~�Q��n�
Generic ShortByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Short.InternalSemigroup ShortByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Short.InternalMonoid ShortByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Short.InternalNFData ShortByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Short.InternalBinary ShortByteStringDefined in binary-0.8.9.3 · Data.Binary.ClassHashable ShortByteStringDefined in hashable-1.4.7.0 · Data.Hashable.ClassLift ShortByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Short.Internaltype Rep ShortByteString = D1 ('MetaDataDefined in bytestring-0.12.2.0 · Data.ByteString.Short.Internal"ShortByteString"
"Data.ByteString.Short.Internal"
"bytestring-0.12.2.0-e345"
'True) (C1 ('MetaCons"ShortByteString"
'PrefixI 'True) (S1 ('MetaSel ('Just"unShortByteString"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteArray)))type Item ShortByteString = Word8Defined in bytestring-0.12.2.0 · Data.ByteString.Short.Internal
A map from keys to values. A map cannot contain duplicate keys; each key can map to at most one value.
Instances41Bifoldable, Eq2, Ord2, Show2, NFData2, Hashable2, …
Bifoldable HashMapDefined in unordered-containers-0.2.21 · Data.HashMap.InternalEq2 HashMapDefined in unordered-containers-0.2.21 · Data.HashMap.InternalOrd2 HashMapDefined in unordered-containers-0.2.21 · Data.HashMap.InternalShow2 HashMapDefined in unordered-containers-0.2.21 · Data.HashMap.InternalNFData2 HashMapDefined in unordered-containers-0.2.21 · Data.HashMap.InternalHashable2 HashMapDefined in unordered-containers-0.2.21 · Data.HashMap.Internal(Lift k, Lift v) => Lift (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalFunctor (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalFoldable (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalTraversable (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalEq k => Eq1 (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalOrd k => Ord1 (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal(Hashable k, Read k) => Read1 (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalShow k => Show1 (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalNFData k => NFData1 (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalHashable k => Hashable1 (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal(Hashable k, Eq k) => Alt (HashMap k)Defined in semigroupoids-6.0.1 · Data.Functor.Alt(Hashable k, Eq k) => Apply (HashMap k)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassA 'HashMap k' is not Applicative, but it is an instance of Apply
(Hashable k, Eq k) => Bind (HashMap k)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.Class(Hashable k, Eq k) => Plus (HashMap k)Defined in semigroupoids-6.0.1 · Data.Functor.PlusInvariant (HashMap k)Defined in invariant-0.6.4 · Data.Functor.Invariantfrom the
unordered-containerspackageFoldableWithKey (HashMap k)Defined in keys-3.12.3 · Data.Key(Eq k, Hashable k) => Indexable (HashMap k)Defined in keys-3.12.3 · Data.KeyKeyed (HashMap k)Defined in keys-3.12.3 · Data.Key(Eq k, Hashable k) => Lookup (HashMap k)Defined in keys-3.12.3 · Data.KeyTraversableWithKey (HashMap k)Defined in keys-3.12.3 · Data.Key(Eq k, Hashable k) => Zip (HashMap k)Defined in keys-3.12.3 · Data.Key(Eq k, Hashable k) => ZipWithKey (HashMap k)Defined in keys-3.12.3 · Data.Key(Default k, Hashable k) => Pointed (HashMap k)Defined in pointed-5.0.4 · Data.PointedHashable k => IsList (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal(Eq k, Eq v) => Eq (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalNote that, in the presence of hash collisions, equal
HashMaps may behave differently, i.e. extensionality may be violated:Example2 expressions data D = A | B deriving (Eq, Show)instance Hashable D where hashWithSalt salt _d = salt
Example2 expressions x = fromList [(A,1), (B,2)]y = fromList [(B,2), (A,1)]
Example3 expressions x == yTruetoList x[(A,1),(B,2)]toList y[(B,2),(A,1)]
In general, the lack of extensionality can be observed with any function that depends on the key ordering, such as folds and traversals.
(Data k, Data v, Hashable k) => Data (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal(Ord k, Ord v) => Ord (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalThe ordering is total and consistent with the Eq instance. However, nothing else about the ordering is specified, and it may change from version to version of either this package or of
hashable.(Hashable k, Read k, Read e) => Read (HashMap k e)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal(Show k, Show v) => Show (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalHashable k => Semigroup (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalHashable k => Monoid (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal(NFData k, NFData v) => NFData (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal(Hashable k, Hashable v) => Hashable (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internaltype Item (HashMap k v) = (k, v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internaltype Key (HashMap k) = kDefined in keys-3.12.3 · Data.Key
General-purpose finite sequences.
Instances49Monad, Functor, MonadFix, Applicative, Foldable, Traversable, …
Monad SeqDefined in containers-0.7 · Data.Sequence.InternalFunctor SeqDefined in containers-0.7 · Data.Sequence.InternalMonadFix SeqDefined in containers-0.7 · Data.Sequence.InternalApplicative SeqDefined in containers-0.7 · Data.Sequence.InternalFoldable SeqDefined in containers-0.7 · Data.Sequence.InternalTraversable SeqDefined in containers-0.7 · Data.Sequence.InternalAlternative SeqDefined in containers-0.7 · Data.Sequence.InternalMonadPlus SeqDefined in containers-0.7 · Data.Sequence.InternalMonadZip SeqDefined in containers-0.7 · Data.Sequence.InternalEq1 SeqDefined in containers-0.7 · Data.Sequence.InternalOrd1 SeqDefined in containers-0.7 · Data.Sequence.InternalRead1 SeqDefined in containers-0.7 · Data.Sequence.InternalShow1 SeqDefined in containers-0.7 · Data.Sequence.InternalUnzipWith SeqDefined in containers-0.7 · Data.Sequence.InternalHashable1 SeqDefined in hashable-1.4.7.0 · Data.Hashable.ClassAlt SeqDefined in semigroupoids-6.0.1 · Data.Functor.AltApply SeqDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind SeqDefined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassExtend SeqDefined in semigroupoids-6.0.1 · Data.Functor.ExtendPlus SeqDefined in semigroupoids-6.0.1 · Data.Functor.PlusInvariant SeqDefined in invariant-0.6.4 · Data.Functor.Invariantfrom the
containerspackageAdjustable SeqDefined in keys-3.12.3 · Data.KeyFoldableWithKey SeqDefined in keys-3.12.3 · Data.KeyIndexable SeqDefined in keys-3.12.3 · Data.KeyKeyed SeqDefined in keys-3.12.3 · Data.KeyLookup SeqDefined in keys-3.12.3 · Data.KeyTraversableWithKey SeqDefined in keys-3.12.3 · Data.KeyZip SeqDefined in keys-3.12.3 · Data.KeyZipWithKey SeqDefined in keys-3.12.3 · Data.KeyPointed SeqDefined in pointed-5.0.4 · Data.PointedFoldableWithIndex Int SeqDefined in indexed-traversable-0.1.4 · WithIndexFunctorWithIndex Int SeqDefined in indexed-traversable-0.1.4 · WithIndexThe position in the Seq is available as the index.
TraversableWithIndex Int SeqDefined in indexed-traversable-0.1.4 · WithIndexLift a => Lift (Seq a)Defined in containers-0.7 · Data.Sequence.InternalIsList (Seq a)Defined in containers-0.7 · Data.Sequence.InternalEq a => Eq (Seq a)Defined in containers-0.7 · Data.Sequence.InternalData a => Data (Seq a)Defined in containers-0.7 · Data.Sequence.InternalOrd a => Ord (Seq a)Defined in containers-0.7 · Data.Sequence.InternalRead a => Read (Seq a)Defined in containers-0.7 · Data.Sequence.InternalShow a => Show (Seq a)Defined in containers-0.7 · Data.Sequence.Internala ~ Char => IsString (Seq a)Defined in containers-0.7 · Data.Sequence.InternalSemigroup (Seq a)Defined in containers-0.7 · Data.Sequence.InternalMonoid (Seq a)Defined in containers-0.7 · Data.Sequence.InternalNFData a => NFData (Seq a)Defined in containers-0.7 · Data.Sequence.InternalBinary e => Binary (Seq e)Defined in binary-0.8.9.3 · Data.Binary.ClassHashable v => Hashable (Seq v)Defined in hashable-1.4.7.0 · Data.Hashable.ClassDefault (Seq a)Defined in data-default-0.8.0.1 · Data.Default.Internaltype Item (Seq a) = aDefined in containers-0.7 · Data.Sequence.Internaltype Key Seq = IntDefined in keys-3.12.3 · Data.Key
Parse the most commonly used ISO 8601 format.
Show in the most commonly used ISO 8601 format.
The groupWith function uses the user supplied function which projects an element out of every list element in order to first sort the input list and then to form groups by equality on these projected elements
The call inline f arranges that f is inlined, regardless of
its size. More precisely, the call inline f rewrites to the
right-hand side of f's definition. This allows the programmer to
control inlining from a particular call site rather than the
definition site of the function (c.f. INLINE pragmas).
This inlining occurs regardless of the argument to the call or the
size of f's definition; it is unconditional. The main caveat is
that f's definition must be visible to the compiler; it is
therefore recommended to mark the function with an INLINABLE
pragma at its definition so that GHC guarantees to record its
unfolding regardless of size.
If no inlining takes place, the inline function expands to the identity function in Phase zero, so its use imposes no overhead.
The lazy function restrains strictness analysis a little. The
call lazy e means the same as e, but lazy has a magical
property so far as strictness analysis is concerned: it is lazy in
its first argument, even though its semantics is strict. After
strictness analysis has run, calls to lazy are inlined to be the
identity function.
This behaviour is occasionally useful when controlling evaluation
order. Notably, lazy is used in the library definition of
par:
par :: a -> b -> b
par x y = case (par# x) of _ -> lazy yIf lazy were not lazy, par would look strict in
y which would defeat the whole purpose of par.
The sortWith function sorts a list of elements using the user supplied function to project something out of each element
In general if the user supplied function is expensive to compute then you should probably be using sortOn, as it only needs to compute it once for each element. sortWith, on the other hand must compute the mapping function for every comparison that it performs.
Computation hClose hdl makes handle hdl closed. Before the
computation finishes, if hdl is writable its buffer is flushed as
for hFlush.
Performing hClose on a handle that has already been closed has no effect;
doing so is not an error. All other operations on a closed handle will fail.
If hClose fails for any reason, any further operations (apart from
hClose) on the handle will still fail as if hdl had been successfully
closed.
hClose is an interruptible operation in the sense described in Control.Exception. If hClose is interrupted by an asynchronous exception in the process of flushing its buffers, then the I/O device (e.g., file) will be closed anyway.
Instances7Monad, Functor, MonadFail, Applicative, Alternative, MonadPlus, …
Monad ReadPrecDefined in ghc-internal-9.1003.0 · GHC.Internal.Text.ParserCombinators.ReadPrecFunctor ReadPrecDefined in ghc-internal-9.1003.0 · GHC.Internal.Text.ParserCombinators.ReadPrecMonadFail ReadPrecDefined in ghc-internal-9.1003.0 · GHC.Internal.Text.ParserCombinators.ReadPrecApplicative ReadPrecDefined in ghc-internal-9.1003.0 · GHC.Internal.Text.ParserCombinators.ReadPrecAlternative ReadPrecDefined in ghc-internal-9.1003.0 · GHC.Internal.Text.ParserCombinators.ReadPrecMonadPlus ReadPrecDefined in ghc-internal-9.1003.0 · GHC.Internal.Text.ParserCombinators.ReadPrecInvariant ReadPrecDefined in invariant-0.6.4 · Data.Functor.Invariant
Format a variable number of arguments with the C-style formatting string.
printf "%s, %d, %.4f" "hello" 123 pihello, 123, 3.1416
The return value is either String or (IO a) (which
should be (IO ()), but Haskell's type system
makes this hard).
The format string consists of ordinary characters and
conversion specifications, which specify how to format
one of the arguments to printf in the output string. A
format specification is introduced by the % character;
this character can be self-escaped into the format string
using %%. A format specification ends with a
format character that provides the primary information about
how to format the value. The rest of the conversion
specification is optional. In order, one may have flag
characters, a width specifier, a precision specifier, and
type-specific modifier characters.
Unlike C printf(3), the formatting of this printf
is driven by the argument type; formatting is type specific. The
types formatted by printf "out of the box" are:
printf is also extensible to support other types: see below.
A conversion specification begins with the
character %, followed by zero or more of the following flags:
- left adjust (default is right adjust)
+ always use a sign (+ or -) for signed conversions
space leading space for positive numbers in signed conversions
0 pad with zeros rather than spaces
# use an \"alternate form\": see belowWhen both flags are given, - overrides 0 and + overrides space.
A negative width specifier in a * conversion is treated as
positive but implies the left adjust flag.
The "alternate form" for unsigned radix conversions is
as in C printf(3):
%o prefix with a leading 0 if needed
%x prefix with a leading 0x if nonzero
%X prefix with a leading 0X if nonzero
%b prefix with a leading 0b if nonzero
%[eEfFgG] ensure that the number contains a decimal pointAny flags are followed optionally by a field width:
num field width
* as num, but taken from argument listThe field width is a minimum, not a maximum: it will be expanded as needed to avoid mutilating a value.
Any field width is followed optionally by a precision:
.num precision
. same as .0
.* as num, but taken from argument listNegative precision is taken as 0. The meaning of the precision depends on the conversion type.
Integral minimum number of digits to show
RealFloat number of digits after the decimal point
String maximum number of charactersThe precision for Integral types is accomplished by zero-padding. If both precision and zero-pad are given for an Integral field, the zero-pad is ignored.
Any precision is followed optionally for Integral types by a width modifier; the only use of this modifier being to set the implicit size of the operand for conversion of a negative operand to unsigned:
hh Int8
h Int16
l Int32
ll Int64
L Int64The specification ends with a format character:
c character Integral
d decimal Integral
o octal Integral
x hexadecimal Integral
X hexadecimal Integral
b binary Integral
u unsigned decimal Integral
f floating point RealFloat
F floating point RealFloat
g general format float RealFloat
G general format float RealFloat
e exponent format float RealFloat
E exponent format float RealFloat
s string String
v default format any typeThe "%v" specifier is provided for all built-in types, and should be provided for user-defined type formatters as well. It picks a "best" representation for the given type. For the built-in types the "%v" specifier is converted as follows:
c Char
u other unsigned Integral
d other signed Integral
g RealFloat
s StringMismatch between the argument types and the format string, as well as any other syntactic or semantic errors in the format string, will cause an exception to be thrown at runtime.
Note that the formatting for RealFloat types is
currently a bit different from that of C printf(3),
conforming instead to showEFloat,
showFFloat and showGFloat (and their
alternate versions showFFloatAlt and
showGFloatAlt). This is hard to fix: the fixed
versions would format in a backward-incompatible way.
In any case the Haskell behavior is generally more
sensible than the C behavior. A brief summary of some
key differences:
Haskell printf never uses the default "6-digit" precision used by C printf.
Haskell printf treats the "precision" specifier as indicating the number of digits after the decimal point.
Haskell printf prints the exponent of e-format numbers without a gratuitous plus sign, and with the minimum possible number of digits.
Haskell printf will place a zero after a decimal point when possible.
Parse a string using the Read instance. Succeeds if there is exactly one valid result.
readMaybe "123" :: Maybe IntJust 123
readMaybe "hello" :: Maybe IntNothing
The maximum number of elements the queue can hold.
Efficiently read the entire contents of a TBQueue into a list. This function never retries.
Return the length of a TBQueue.
Builds and returns a new instance of TBQueue.
IO version of newTBQueue. This is useful for creating top-level
TBQueues using unsafePerformIO, because using
atomically inside unsafePerformIO isn't
possible.
Get the next value from the TBQueue without removing it,
retrying if the channel is empty.
Read the next value from the TBQueue.
A version of peekTBQueue which does not retry. Instead it
returns Nothing if no value is available.
A version of readTBQueue which does not retry. Instead it
returns Nothing if no value is available.
Put a data item back onto a channel, where it will be the next item read. Blocks if the queue is full.
Write a value to a TBQueue; blocks if the queue is full.
Clone a TChan: similar to dupTChan, but the cloned channel starts with the same content available as the original channel.
Duplicate a TChan: the duplicate channel begins empty, but data written to either channel from then on will be available from both. Hence this creates a kind of broadcast channel, where data written by anyone is seen by everyone else.
Create a write-only TChan. More precisely, readTChan will retry even after items have been written to the channel. The only way to read a broadcast channel is to duplicate it with dupTChan.
Consider a server that broadcasts messages to clients:
serve :: TChan Message -> Client -> IO loop
serve broadcastChan client = do
myChan <- dupTChan broadcastChan
forever $ do
message <- readTChan myChan
send client messageThe problem with using newTChan to create the broadcast channel is that if it is only written to and never read, items will pile up in memory. By using newBroadcastTChan to create the broadcast channel, items can be garbage collected after clients have seen them.
IO version of newBroadcastTChan.
Build and return a new instance of TChan
IO version of newTChan. This is useful for creating top-level
TChans using unsafePerformIO, because using
atomically inside unsafePerformIO isn't
possible.
Get the next value from the TChan without removing it,
retrying if the channel is empty.
Read the next value from the TChan.
A version of peekTChan which does not retry. Instead it
returns Nothing if no value is available.
A version of readTChan which does not retry. Instead it
returns Nothing if no value is available.
Put a data item back onto a channel, where it will be the next item read.
Write a value to a TChan.
Check whether a given TMVar is empty.
Create a TMVar which is initially empty.
IO version of newEmptyTMVar. This is useful for creating top-level
TMVars using unsafePerformIO, because using
atomically inside unsafePerformIO isn't
possible.
Create a TMVar which contains the supplied value.
IO version of newTMVar. This is useful for creating top-level
TMVars using unsafePerformIO, because using
atomically inside unsafePerformIO isn't
possible.
Swap the contents of a TMVar for a new value.
A version of readTMVar which does not retry. Instead it
returns Nothing if no value is available.
A version of takeTMVar that does not retry. The tryTakeTMVar
function returns Nothing if the TMVar was empty, or Just a if
the TMVar was full with contents a. After tryTakeTMVar, the
TMVar is left empty.
Non-blocking write of a new value to a TMVar Puts if empty. Replaces if populated.
Efficiently read the entire contents of a TQueue into a list. This function never retries.
Methods
zeroArrow :: a b c
Instances9ArrowZero, …
Alternative f => ArrowZero (Static f)Defined in semigroupoids-6.0.1 · Data.Semigroupoid.StaticMonadPlus m => ArrowZero (Kleisli m)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowArrowZero p => ArrowZero (Closure p)Defined in profunctors-5.6.3 · Data.Profunctor.ClosedArrowZero p => ArrowZero (Tambara p)Defined in profunctors-5.6.3 · Data.Profunctor.StrongArrowZero p => ArrowZero (WrappedProfunctor p)Defined in invariant-0.6.4 · Data.Functor.InvariantArrowZero p => ArrowZero (WrappedArrow p)Defined in profunctors-5.6.3 · Data.Profunctor.Types(ArrowZero p, ArrowZero q) => ArrowZero (Product p q)Defined in bifunctors-5.6.2 · Data.Bifunctor.Product(Applicative f, ArrowZero p) => ArrowZero (Tannen f p)Defined in bifunctors-5.6.2 · Data.Bifunctor.Tannen(Applicative f, ArrowZero p) => ArrowZero (Cayley f p)Defined in profunctors-5.6.3 · Data.Profunctor.Cayley
A monoid on arrows.
Instances8ArrowPlus, …
Alternative f => ArrowPlus (Static f)Defined in semigroupoids-6.0.1 · Data.Semigroupoid.StaticMonadPlus m => ArrowPlus (Kleisli m)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowArrowPlus p => ArrowPlus (Closure p)Defined in profunctors-5.6.3 · Data.Profunctor.ClosedArrowPlus p => ArrowPlus (Tambara p)Defined in profunctors-5.6.3 · Data.Profunctor.StrongArrowPlus p => ArrowPlus (WrappedProfunctor p)Defined in invariant-0.6.4 · Data.Functor.Invariant(ArrowPlus p, ArrowPlus q) => ArrowPlus (Product p q)Defined in bifunctors-5.6.2 · Data.Bifunctor.Product(Applicative f, ArrowPlus p) => ArrowPlus (Tannen f p)Defined in bifunctors-5.6.2 · Data.Bifunctor.Tannen(Applicative f, ArrowPlus p) => ArrowPlus (Cayley f p)Defined in profunctors-5.6.3 · Data.Profunctor.Cayley
const x y always evaluates to x, ignoring its second argument.
const x = \_ -> xThis function might seem useless at first glance, but it can be very useful in a higher order context.
Examples
const 42 "hello"42
map (const 42) [0..3][42,42,42,42]
Instances24MonadAccum, MonadReader, MonadState, MonadSelect, MonadBase, MonadFree, …
MonadAccum w m => MonadAccum w (ContT r m)Defined in mtl-2.3.1 · Control.Monad.AccumThe continuation can see, and interact with, the accumulated value.
MonadReader r' m => MonadReader r' (ContT r m)Defined in mtl-2.3.1 · Control.Monad.Reader.ClassMonadState s m => MonadState s (ContT r m)Defined in mtl-2.3.1 · Control.Monad.State.ClassMonadSelect r' m => MonadSelect r' (ContT r m)Defined in mtl-2.3.1 · Control.Monad.SelectThe continuation describes a way of choosing a 'search' or 'ranking' strategy for
r, based on a 'ranking' usingr', given anya. We then get a 'search' strategy forr.MonadBase b m => MonadBase b (ContT r m)Defined in transformers-base-0.4.6 · Control.Monad.Base(Functor f, MonadFree f m) => MonadFree f (ContT r m)Defined in free-5.2 · Control.Monad.Free.ClassMonadTrans (ContT r)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ContBindTrans (ContT r)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.TransMonad (ContT r m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ContFunctor (ContT r m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ContMonadFail m => MonadFail (ContT r m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ContApplicative (ContT r m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ContMonadIO m => MonadIO (ContT r m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ContMonadCont (ContT r m)Defined in mtl-2.3.1 · Control.Monad.Cont.ClassMonadThrow m => MonadThrow (ContT r m)Defined in exceptions-0.10.9 · Control.Monad.CatchPrimMonad m => PrimMonad (ContT r m)Defined in primitive-0.9.1.0 · Control.Monad.PrimitiveApply (ContT r m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassBind (ContT r m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassInvariant (ContT r m)Defined in invariant-0.6.4 · Data.Functor.Invariantfrom the
transformerspackageSelective (ContT r m)Defined in selective-0.7.0.1 · Control.SelectivePointed (ContT r m)Defined in pointed-5.0.4 · Data.PointedGeneric (ContT r m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Conttype Rep (ContT r m a) = D1 ('MetaDataDefined in transformers-0.6.1.1 · Control.Monad.Trans.Cont"ContT"
"Control.Monad.Trans.Cont"
"transformers-0.6.1.1-a11a"
'True) (C1 ('MetaCons"ContT"
'PrefixI 'True) (S1 ('MetaSel ('Just"runContT"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ((a -> m r) -> m r))))type PrimState (ContT r m) = PrimState mDefined in primitive-0.9.1.0 · Control.Monad.Primitive
Double-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE double-precision type.
Instances43Enum, Floating, Fractional, Data, Num, Read, …
Enum DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphanfromEnum just truncates its argument, beware of all sorts of overflows.
List generators have extremely peculiar behavior, mandated by Haskell Report 2010:
Example1 expression [0..1.5][0.0,1.0,2.0]
Eq DoubleDefined in ghc-prim-0.12.0 · GHC.ClassesFloating DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.FloatFractional DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphanThis instance implements IEEE 754 standard with all its usual pitfalls about NaN, infinities and negative zero.
Example4 expressions 0 == (-0 :: Double)Truerecip 0 == recip (-0 :: Double)Falsemap (/ 0) [-1, 0, 1][-Infinity,NaN,Infinity]map (* 0) $ map (/ 0) [-1, 0, 1][NaN,NaN,NaN]
Data DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.DataNum DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphanThis instance implements IEEE 754 standard with all its usual pitfalls about NaN, infinities and negative zero. Neither addition nor multiplication are associative or distributive:
Example3 expressions (0.1 + 0.1) + 0.4 == 0.1 + (0.1 + 0.4)False(0.1 + 0.2) * 0.3 == 0.1 * 0.3 + 0.2 * 0.3False(0.1 * 0.1) * 0.3 == 0.1 * (0.1 * 0.3)False
Ord DoubleDefined in ghc-prim-0.12.0 · GHC.ClassesIEEE 754 Double-precision type includes not only numbers, but also positive and negative infinities and a special element called
NaN(which can be quiet or signal).IEEE 754-2008, section 5.11 requires that if at least one of arguments of <=, <, >, >= is
NaNthen the result of the comparison is False, andinstanceOrd Double complies with this requirement. This violates the reflexivity: bothNaN<=NaNandNaN>=NaNare False.IEEE 754-2008, section 5.10 defines
totalOrderpredicate. Unfortunately, compare on Doubles violates the IEEE standard and does not define a total order. More specifically, both compareNaNxand comparexNaNalways return GT.Thus, users must be extremely cautious when using
instanceOrd Double. For instance, one should avoid ordered containers with keys represented by Double, because data loss and corruption may happen. An IEEE-compliant compare is available infp-ieeepackage asTotallyOrderednewtype.Moving further, the behaviour of min and max with regards to
NaNis also non-compliant. IEEE 754-2008, section 5.3.1 defines that quietNaNshould be treated as a missing data byminNumandmaxNumfunctions, for example,minNum(NaN, 1) = minNum(1, NaN) = 1. Some languages such as Java deviate from the standard implementingminNum(NaN, 1) = minNum(1, NaN) = NaN. However, min / max inbaseare even worse: minNaN1 is 1, but min 1NaNisNaN.IEEE 754-2008 compliant min / max can be found in
ieee754package underminNum/maxNumnames. Implementations compliant withminimumNumber/maximumNumberfrom a newer IEEE 754-2019, section 9.6 are available fromfp-ieeepackage.Read DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.ReadReal DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphanBeware that toRational generates garbage for non-finite arguments:
Example2 expressions toRational (1/0)179769313 (and 300 more digits...) % 1toRational (0/0)269653970 (and 300 more digits...) % 1
RealFloat DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.FloatRealFrac DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphanBeware that results for non-finite arguments are garbage:
Example2 expressions [ f x | f <- [round, floor, ceiling], x <- [-1/0, 0/0, 1/0] ] :: [Int][0,0,0,0,0,0,0,0,0]map properFraction [-1/0, 0/0, 1/0] :: [(Int, Double)][(0,0.0),(0,0.0),(0,0.0)]
and get even more non-sensical if you ask for Integer instead of Int.
Show DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphanStorable DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.StorablePrintfArg DoubleDefined in base-4.20.2.0 · Text.PrintfNFData DoubleDefined in deepseq-1.5.0.0 · Control.DeepSeqPretty DoubleDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJClassPretty DoubleDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClassRandom DoubleDefined in random-1.2.1.3 · System.RandomNote - random produces values in the closed range
[0,1].UniformRange DoubleDefined in random-1.2.1.3 · System.Random.InternalBinary DoubleDefined in binary-0.8.9.3 · Data.Binary.ClassUses non-IEEE754 encoding. Does not round-trip NaN.
Hashable DoubleDefined in hashable-1.4.7.0 · Data.Hashable.ClassNote: prior to
hashable-1.3.0.0,hash 0.0 /= hash (-0.0)The hash of NaN is not well defined.
Prim DoubleDefined in primitive-0.9.1.0 · Data.Primitive.TypesUnbox DoubleDefined in vector-0.13.2.0 · Data.Vector.Unboxed.BaseDefault DoubleDefined in data-default-0.8.0.1 · Data.Default.InternalLift DoubleDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxIArray UArray DoubleDefined in array-0.5.8.0 · Data.Array.BaseVector Vector DoubleDefined in vector-0.13.2.0 · Data.Vector.Unboxed.BaseMVector MVector DoubleDefined in vector-0.13.2.0 · Data.Vector.Unboxed.BaseMArray IOUArray Double IODefined in array-0.5.8.0 · Data.Array.IO.InternalsGeneric1 (URec Double)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsFoldable UDoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableTraversable UDoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.TraversableMArray (STUArray s) Double (ST s)Defined in array-0.5.8.0 · Data.Array.BaseFunctor (URec Double)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsEq (URec Double p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsOrd (URec Double p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsShow (URec Double p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (URec Double p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Genericstype Rep (URec Double p) = D1 ('MetaDataDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics"URec"
"GHC.Internal.Generics"
"ghc-internal"
'False) (C1 ('MetaCons"UDouble"
'PrefixI 'True) (S1 ('MetaSel ('Just"uDouble#"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) UDouble))type Rep1 (URec Double) = D1 ('MetaDataDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics"URec"
"GHC.Internal.Generics"
"ghc-internal"
'False) (C1 ('MetaCons"UDouble"
'PrefixI 'True) (S1 ('MetaSel ('Just"uDouble#"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) UDouble))data URec DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsUsed for marking occurrences of Double#
data MVector s DoubleDefined in vector-0.13.2.0 · Data.Vector.Unboxed.Basedata Vector DoubleDefined in vector-0.13.2.0 · Data.Vector.Unboxed.Base
Some arrows allow application of arrow inputs to other inputs. Instances should satisfy the following laws:
first (arr (\x -> arr (\y -> (x,y)))) >>> app = idfirst (arr (g >>>)) >>> app = second g >>> appfirst (arr (>>> h)) >>> app = app >>> h
Such arrows are equivalent to monads (see ArrowMonad).
Methods
app :: a (a b c, b) c
Instances5ArrowApply
Monad m => ArrowApply (Kleisli m)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowArrowApply p => ArrowApply (Tambara p)Defined in profunctors-5.6.3 · Data.Profunctor.StrongComonad w => ArrowApply (Cokleisli w)Defined in comonad-5.0.9 · Control.ComonadArrowApply (->)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowArrowApply p => ArrowApply (WrappedArrow p)Defined in profunctors-5.6.3 · Data.Profunctor.Types
Choice, for arrows that support it. This class underlies the
if and case constructs in arrow notation.
Instances should satisfy the following laws:
left (arr f) = arr (left f)left (f >>> g) = left f >>> left gf >>> arr Left = arr Left >>> left fleft f >>> arr (id +++ g) = arr (id +++ g) >>> left fleft (left f) >>> arr assocsum = arr assocsum >>> left f
where
assocsum (Left (Left x)) = Left x
assocsum (Left (Right y)) = Right (Left y)
assocsum (Right z) = Right (Right z)The other combinators have sensible default definitions, which may be overridden for efficiency.
Methods
left :: a b c -> a (Either b d) (Either c d)Feed marked inputs through the argument arrow, passing the rest through unchanged to the output.
right :: a b c -> a (Either d b) (Either d c)A mirror image of left.
The default definition may be overridden with a more efficient version if desired.
(+++) :: a b c -> a b' c' -> a (Either b b') (Either c c')infixr 2Split the input between the two argument arrows, retagging and merging their outputs. Note that this is in general not a functor.
The default definition may be overridden with a more efficient version if desired.
(|||) :: a b d -> a c d -> a (Either b c) dinfixr 2Fanin: Split the input between the two argument arrows and merge their outputs.
The default definition may be overridden with a more efficient version if desired.
Instances10ArrowChoice, …
Applicative f => ArrowChoice (Static f)Defined in semigroupoids-6.0.1 · Data.Semigroupoid.StaticMonad m => ArrowChoice (Kleisli m)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowArrowChoice p => ArrowChoice (Tambara p)Defined in profunctors-5.6.3 · Data.Profunctor.StrongComonad w => ArrowChoice (Cokleisli w)Defined in comonad-5.0.9 · Control.ComonadArrowChoice (->)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowArrowChoice p => ArrowChoice (WrappedProfunctor p)Defined in invariant-0.6.4 · Data.Functor.InvariantArrowChoice p => ArrowChoice (WrappedArrow p)Defined in profunctors-5.6.3 · Data.Profunctor.Types(ArrowChoice p, ArrowChoice q) => ArrowChoice (Product p q)Defined in bifunctors-5.6.2 · Data.Bifunctor.Product(Applicative f, ArrowChoice p) => ArrowChoice (Tannen f p)Defined in bifunctors-5.6.2 · Data.Bifunctor.Tannen(Applicative f, ArrowChoice p) => ArrowChoice (Cayley f p)Defined in profunctors-5.6.3 · Data.Profunctor.Cayley
Any instance of ArrowApply can be made into an instance of ArrowChoice by defining left = leftApp.
The loop operator expresses computations in which an output value
is fed back as input, although the computation occurs only once.
It underlies the rec value recursion construct in arrow notation.
loop should satisfy the following laws:
- extension
- left tightening
- right tightening
- sliding
- vanishing
- superposing
second (loop f) = loop (arr assoc >>> second f >>> arr unassoc)
where
assoc ((a,b),c) = (a,(b,c))
unassoc (a,(b,c)) = ((a,b),c)Methods
loop :: a (b, d) (c, d) -> a b c
Instances10ArrowLoop, …
ArrowLoop p => ArrowLoop (Closure p)Defined in profunctors-5.6.3 · Data.Profunctor.ClosedArrowLoop p => ArrowLoop (Tambara p)Defined in profunctors-5.6.3 · Data.Profunctor.StrongMonadFix m => ArrowLoop (Kleisli m)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowComonadApply w => ArrowLoop (Cokleisli w)Defined in comonad-5.0.9 · Control.ComonadArrowLoop (->)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowArrowLoop p => ArrowLoop (WrappedProfunctor p)Defined in invariant-0.6.4 · Data.Functor.InvariantArrowLoop p => ArrowLoop (WrappedArrow p)Defined in profunctors-5.6.3 · Data.Profunctor.Types(ArrowLoop p, ArrowLoop q) => ArrowLoop (Product p q)Defined in bifunctors-5.6.2 · Data.Bifunctor.Product(Applicative f, ArrowLoop p) => ArrowLoop (Tannen f p)Defined in bifunctors-5.6.2 · Data.Bifunctor.Tannen(Applicative f, ArrowLoop p) => ArrowLoop (Cayley f p)Defined in profunctors-5.6.3 · Data.Profunctor.Cayley
closeFdWith Close a file descriptor in a concurrency-safe way (GHC only). If you are using threadWaitRead or threadWaitWrite to perform blocking I/O, you must use this function to close file descriptors, or blocked threads may not be woken.
Any threads that are blocked on the file descriptor via threadWaitRead or threadWaitWrite will be unblocked by having IO exceptions thrown.
Lifted, homogeneous equality. By lifted, we mean that it
can be bogus (deferred type error). By homogeneous, the two
types a and b must have the same kinds.
Precomposition with a pure function (right-to-left variant).
Postcomposition with a pure function.
Postcomposition with a pure function (right-to-left variant).
Precomposition with a pure function.
The identity arrow, which plays the role of return in arrow notation.
The ArrowApply class is equivalent to Monad: any monad gives rise to a Kleisli arrow, and any instance of ArrowApply defines a monad.
Constructors
ArrowMonad (a () b)
Instances7Monad, Functor, Applicative, Alternative, MonadPlus, Invariant, …
ArrowApply a => Monad (ArrowMonad a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowArrow a => Functor (ArrowMonad a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowArrow a => Applicative (ArrowMonad a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowArrowPlus a => Alternative (ArrowMonad a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.Arrow(ArrowApply a, ArrowPlus a) => MonadPlus (ArrowMonad a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowArrow a => Invariant (ArrowMonad a)Defined in invariant-0.6.4 · Data.Functor.Invariantfrom Control.Arrow
ArrowChoice a => Selective (ArrowMonad a)Defined in selective-0.7.0.1 · Control.Selective
Kleisli arrows of a monad.
Constructors
KleislirunKleisli :: a -> m b
Instances30Category, Semigroupoid, Ob, Generic1, Arrow, ArrowApply, …
Monad m => Category (Kleisli m)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowBind m => Semigroupoid (Kleisli m)Defined in semigroupoids-6.0.1 · Data.Semigroupoid(Bind m, Monad m) => Ob (Kleisli m) aDefined in semigroupoids-6.0.1 · Data.Semigroupoid.ObGeneric1 (Kleisli m a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowMonad m => Arrow (Kleisli m)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowMonad m => ArrowApply (Kleisli m)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowMonad m => ArrowChoice (Kleisli m)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowMonadFix m => ArrowLoop (Kleisli m)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowMonadPlus m => ArrowPlus (Kleisli m)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowMonadPlus m => ArrowZero (Kleisli m)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowMonad m => Choice (Kleisli m)Defined in profunctors-5.6.3 · Data.Profunctor.Choice(Distributive f, Monad f) => Closed (Kleisli f)Defined in profunctors-5.6.3 · Data.Profunctor.Closed(Monad m, Distributive m) => Mapping (Kleisli m)Defined in profunctors-5.6.3 · Data.Profunctor.MappingMonadFix m => Costrong (Kleisli m)Defined in profunctors-5.6.3 · Data.Profunctor.StrongMonad m => Strong (Kleisli m)Defined in profunctors-5.6.3 · Data.Profunctor.StrongMonad m => Profunctor (Kleisli m)Defined in profunctors-5.6.3 · Data.Profunctor.UnsafeMonad m => Traversing (Kleisli m)Defined in profunctors-5.6.3 · Data.Profunctor.Traversing(Monad m, Functor m) => Representable (Kleisli m)Defined in profunctors-5.6.3 · Data.Profunctor.RepInvariant m => Invariant2 (Kleisli m)Defined in invariant-0.6.4 · Data.Functor.Invariantfrom Control.Arrow
(Monad m, Functor m) => Sieve (Kleisli m) mDefined in profunctors-5.6.3 · Data.Profunctor.SieveMonad m => Monad (Kleisli m a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowFunctor m => Functor (Kleisli m a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowApplicative m => Applicative (Kleisli m a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowAlternative m => Alternative (Kleisli m a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowMonadPlus m => MonadPlus (Kleisli m a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowInvariant m => Invariant (Kleisli m a)Defined in invariant-0.6.4 · Data.Functor.Invariantfrom Control.Arrow
Generic (Kleisli m a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.Arrowtype Rep (Kleisli m a b) = D1 ('MetaDataDefined in ghc-internal-9.1003.0 · GHC.Internal.Control.Arrow"Kleisli"
"GHC.Internal.Control.Arrow"
"ghc-internal"
'True) (C1 ('MetaCons"Kleisli"
'PrefixI 'True) (S1 ('MetaSel ('Just"runKleisli"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (a -> m b))))type Rep1 (Kleisli m a) = D1 ('MetaDataDefined in ghc-internal-9.1003.0 · GHC.Internal.Control.Arrow"Kleisli"
"GHC.Internal.Control.Arrow"
"ghc-internal"
'True) (C1 ('MetaCons"Kleisli"
'PrefixI 'True) (S1 ('MetaSel ('Just"runKleisli"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (FUN 'Many a :.: Rec1 m)))type Rep (Kleisli m) = mDefined in profunctors-5.6.3 · Data.Profunctor.Rep
Arbitrary precision integers. In contrast with fixed-size integral types such as Int, the Integer type represents the entire infinite range of integers.
Integers are stored in a kind of sign-magnitude form, hence do not expect two's complement form when using bit operations.
If the value is small (i.e., fits into an Int), the IS constructor is used. Otherwise IP and IN constructors are used to store a BigNat representing the positive or the negative value magnitude, respectively.
Invariant: IP and IN are used iff the value does not fit in IS.
Instances24Enum, Eq, Integral, Data, Num, Ord, …
Enum IntegerDefined in ghc-internal-9.1003.0 · GHC.Internal.EnumEq IntegerDefined in ghc-bignum-1.3 · GHC.Num.IntegerIntegral IntegerDefined in ghc-internal-9.1003.0 · GHC.Internal.RealData IntegerDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.DataNum IntegerDefined in ghc-internal-9.1003.0 · GHC.Internal.NumOrd IntegerDefined in ghc-bignum-1.3 · GHC.Num.IntegerRead IntegerDefined in ghc-internal-9.1003.0 · GHC.Internal.ReadReal IntegerDefined in ghc-internal-9.1003.0 · GHC.Internal.RealShow IntegerDefined in ghc-internal-9.1003.0 · GHC.Internal.ShowIx IntegerDefined in ghc-internal-9.1003.0 · GHC.Internal.IxBits IntegerDefined in ghc-internal-9.1003.0 · GHC.Internal.BitsPrintfArg IntegerDefined in base-4.20.2.0 · Text.PrintfNFData IntegerDefined in deepseq-1.5.0.0 · Control.DeepSeqPretty IntegerDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJClassPretty IntegerDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClassRandom IntegerDefined in random-1.2.1.3 · System.RandomUniformRange IntegerDefined in random-1.2.1.3 · System.Random.InternalBinary IntegerDefined in binary-0.8.9.3 · Data.Binary.ClassHashable IntegerDefined in hashable-1.4.7.0 · Data.Hashable.ClassDayPeriod YearDefined in time-1.12.2 · Data.Time.Calendar.Gregorian · orphanShowPadded IntegerDefined in time-1.12.2 · Data.Time.Calendar.PrivateShowPadded IntegerDefined in time-compat-1.9.8 · Data.Time.Calendar.PrivateDefault IntegerDefined in data-default-0.8.0.1 · Data.Default.InternalLift IntegerDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.Syntax
A variant of error that does not produce a stack trace.
Build and returns a new instance of TQueue
IO version of newTQueue. This is useful for creating top-level
TQueues using unsafePerformIO, because using
atomically inside unsafePerformIO isn't
possible.
Get the next value from the TQueue without removing it,
retrying if the channel is empty.
Read the next value from the TQueue.
A version of peekTQueue which does not retry. Instead it
returns Nothing if no value is available.
A version of readTQueue which does not retry. Instead it
returns Nothing if no value is available.
Put a data item back onto a channel, where it will be the next item read.
Write a value to a TQueue.
Mutate the contents of a TVar. N.B., this version is non-strict.
Strict version of modifyTVar.
Like modifyTVar' but the function is a simple state transition that can return a side value which is passed on as the result of the STM.
Swap the contents of a TVar for a new value.
Check that the boolean condition is true and, if not, retry.
In other words, check b = unless b retry.
Switch the value of returned TVar from initial value False to True after a given number of microseconds. The caveats associated with threadDelay also apply.
Be careful not to exceed maxBound :: Int, which on 32-bit machines is only
2147483647 μs, less than 36 minutes.
Perform a series of STM actions atomically.
Using atomically inside an unsafePerformIO or unsafeInterleaveIO subverts some of guarantees that STM provides. It makes it possible to run a transaction inside of another transaction, depending on when the thunk is evaluated. If a nested transaction is attempted, an exception is thrown by the runtime. It is possible to safely use atomically inside unsafePerformIO or unsafeInterleaveIO, but the typechecker does not rule out programs that may attempt nested transactions, meaning that the programmer must take special care to prevent these.
However, there are functions for creating transactional variables that can always be safely called in unsafePerformIO. See: newTVarIO, newTChanIO, newBroadcastTChanIO, newTQueueIO, newTBQueueIO, and newTMVarIO.
Using unsafePerformIO inside of atomically is also dangerous but for different reasons. See unsafeIOToSTM for more on this.
Create a new TVar holding a value supplied
IO version of newTVar. This is useful for creating top-level
TVars using unsafePerformIO, because using
atomically inside unsafePerformIO isn't
possible.
Return the current value stored in a TVar.
Retry execution of the current memory transaction because it has seen values in TVars which mean that it should not continue (e.g. the TVars represent a shared buffer that is now empty). The implementation may block the thread until one of the TVars that it has read from has been updated. (GHC only)
A variant of throw that can only be used within the STM monad.
Throwing an exception in STM aborts the transaction and propagates the
exception. If the exception is caught via catchSTM, only the changes
enclosed by the catch are rolled back; changes made outside of catchSTM
persist.
If the exception is not caught inside of the STM, it is re-thrown by atomically, and the entire STM is rolled back.
Although throwSTM has a type that is an instance of the type of throw, the two functions are subtly different:
throw e `seq` x ===> throw e
throwSTM e `seq` x ===> xThe first example will cause the exception e to be raised,
whereas the second one won't. In fact, throwSTM will only cause
an exception to be raised when it is used within the STM monad.
The throwSTM variant should be used in preference to throw to
raise an exception within the STM monad because it guarantees
ordering with respect to other STM operations, whereas throw
does not.
Write the supplied value into a TVar.
is the function application operator.($)
Applying to a function ($)f and an argument x gives the same result as applying f to x directly. The definition is akin to this:
($) :: (a -> b) -> a -> b
($) f x = f x
This is id specialized from a -> a to (a -> b) -> (a -> b) which by the associativity of (->)
is the same as (a -> b) -> a -> b.
On the face of it, this may appear pointless! But it's actually one of the most useful and important operators in Haskell.
The order of operations is very different between ($) and normal function application. Normal function application has precedence 10 - higher than any operator - and associates to the left. So these two definitions are equivalent:
expr = min 5 1 + 5
expr = ((min 5) 1) + 5
($) has precedence 0 (the lowest) and associates to the right, so these are equivalent:
expr = min 5 $ 1 + 5
expr = (min 5) (1 + 5)
Examples
A common use cases of ($) is to avoid parentheses in complex expressions.
For example, instead of using nested parentheses in the following Haskell function:
-- | Sum numbers in a string: strSum "100 5 -7" == 98
strSum :: String -> Int
strSum s = sum (mapMaybe readMaybe (words s))
we can deploy the function application operator:
-- | Sum numbers in a string: strSum "100 5 -7" == 98
strSum :: String -> Int
strSum s = sum $ mapMaybe readMaybe $ words s
($) is also used as a section (a partially applied operator), in order to indicate that we wish to apply some yet-unspecified function to a given value. For example, to apply the argument 5 to a list of functions:
applyFive :: [Int]
applyFive = map ($ 5) [(+1), (2^)]
>>> [6, 32]
Technical Remark (Representation Polymorphism)
($) is fully representation-polymorphic. This allows it to also be used with arguments of unlifted and even unboxed kinds, such as unboxed integers:
fastMod :: Int -> Int -> Int
fastMod (I# x) (I# m) = I# $ remInt# x m
error stops execution and displays an error message.
Integral numbers, supporting integer division.
The Haskell Report defines no laws for Integral. However, Integral
instances are customarily expected to define a Euclidean domain and have the
following properties for the div/mod and quot/rem pairs, given
suitable Euclidean functions f and g:
x=y * quot x y + rem x ywithrem x y=fromInteger 0org (rem x y)<g yx=y * div x y + mod x ywithmod x y=fromInteger 0orf (mod x y)<f y
An example of a suitable Euclidean function, for Integer's instance, is abs.
In addition, toInteger should be total, and fromInteger should be a left
inverse for it, i.e. fromInteger (toInteger i) = i.
Methods
quot :: a -> a -> ainfixl 7Integer division truncated toward zero.
WARNING: This function is partial (because it throws when 0 is passed as the divisor) for all the integer types in
base.rem :: a -> a -> ainfixl 7Integer remainder, satisfying
(x `quot` y)*y + (x `rem` y) == xWARNING: This function is partial (because it throws when 0 is passed as the divisor) for all the integer types in
base.div :: a -> a -> ainfixl 7Integer division truncated toward negative infinity.
WARNING: This function is partial (because it throws when 0 is passed as the divisor) for all the integer types in
base.mod :: a -> a -> ainfixl 7Integer modulus, satisfying
(x `div` y)*y + (x `mod` y) == xWARNING: This function is partial (because it throws when 0 is passed as the divisor) for all the integer types in
base.quotRem :: a -> a -> (a, a)divMod :: a -> a -> (a, a)toInteger :: a -> IntegerConversion to Integer.
Instances61Integral, …
Integral IntegerDefined in ghc-internal-9.1003.0 · GHC.Internal.RealIntegral NaturalDefined in ghc-internal-9.1003.0 · GHC.Internal.RealIntegral CBoolDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesIntegral CCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesIntegral CIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesIntegral CIntMaxDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesIntegral CIntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesIntegral CLLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesIntegral CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesIntegral CPtrdiffDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesIntegral CSCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesIntegral CShortDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesIntegral CSigAtomicDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesIntegral CSizeDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesIntegral CUCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesIntegral CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesIntegral CUIntMaxDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesIntegral CUIntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesIntegral CULLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesIntegral CULongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesIntegral CUShortDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesIntegral CWcharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesIntegral IntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.PtrIntegral WordPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.PtrIntegral Int16Defined in ghc-internal-9.1003.0 · GHC.Internal.IntIntegral Int32Defined in ghc-internal-9.1003.0 · GHC.Internal.IntIntegral Int64Defined in ghc-internal-9.1003.0 · GHC.Internal.IntIntegral Int8Defined in ghc-internal-9.1003.0 · GHC.Internal.IntIntegral CBlkCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesIntegral CBlkSizeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesIntegral CClockIdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesIntegral CDevDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesIntegral CFsBlkCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesIntegral CFsFilCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesIntegral CGidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesIntegral CIdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesIntegral CInoDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesIntegral CKeyDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesIntegral CModeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesIntegral CNfdsDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesIntegral CNlinkDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesIntegral COffDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesIntegral CPidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesIntegral CRLimDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesIntegral CSocklenDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesIntegral CSsizeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesIntegral CTcflagDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesIntegral CUidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesIntegral FdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesIntegral Word16Defined in ghc-internal-9.1003.0 · GHC.Internal.WordIntegral Word32Defined in ghc-internal-9.1003.0 · GHC.Internal.WordIntegral Word64Defined in ghc-internal-9.1003.0 · GHC.Internal.WordIntegral Word8Defined in ghc-internal-9.1003.0 · GHC.Internal.WordIntegral IntDefined in ghc-internal-9.1003.0 · GHC.Internal.RealIntegral WordDefined in ghc-internal-9.1003.0 · GHC.Internal.RealIntegral CardinalityDefined in random-1.2.1.3 · System.Random.GFiniteIntegral I8Defined in text-2.1.3 · Data.Text.ForeignIntegral a => Integral (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityIntegral a => Integral (Const a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.ConstIntegral a => Integral (Tagged s a)Defined in tagged-0.8.9 · Data.TaggedIntegral (f (g a)) => Integral (Compose f g a)Defined in base-4.20.2.0 · Data.Functor.Compose
Strict (call-by-value) application operator. It takes a function and an argument, evaluates the argument to weak head normal form (WHNF), then calls the function with that value.
flip f takes its (first) two arguments in the reverse order of f.
flip f x y = f y xflip . flip = idExamples
flip (++) "hello" "world""worldhello"
let (.>) = flip (.) in (+1) .> show $ 5"6"
until p f yields the result of applying f until p holds.
General coercion to Fractional types.
WARNING: This function goes through the Rational type, which does not have values for NaN for example.
This means it does not round-trip.
For Double it also behaves differently with or without -O0:
Prelude> realToFrac nan -- With -O0
-Infinity
Prelude> realToFrac nan
NaNGeneral coercion from Integral types.
WARNING: This function performs silent truncation if the result type is not at least as big as the argument's type.
Fractional numbers, supporting real division.
The Haskell Report defines no laws for Fractional. However, (+) and
(*) are customarily expected to define a division ring and have the
following properties:
- recip gives the multiplicative inverse
x * recip x=
recip x * x=
fromInteger 1- Totality of toRational
is total
- Coherence with toRational
if the type also implements
, then
is a left inverse for
, i.e.
fromRational (toRational i) = i
Note that it isn't customarily expected that a type instance of
Fractional implement a field. However, all instances in base do.
Methods
(/) :: a -> a -> ainfixl 7Fractional division.
recip :: a -> aReciprocal fraction.
fromRational :: Rational -> aConversion from a Rational (that is
Ratio Integer). A floating literal stands for an application of fromRational to a value of type Rational, so such literals have type(Fractional a) => a.
Instances16Fractional, …
Fractional CDoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesFractional CFloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesFractional DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphanThis instance implements IEEE 754 standard with all its usual pitfalls about NaN, infinities and negative zero.
Example4 expressions 0 == (-0 :: Double)Truerecip 0 == recip (-0 :: Double)Falsemap (/ 0) [-1, 0, 1][-Infinity,NaN,Infinity]map (* 0) $ map (/ 0) [-1, 0, 1][NaN,NaN,NaN]
Fractional FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphanThis instance implements IEEE 754 standard with all its usual pitfalls about NaN, infinities and negative zero.
Example4 expressions 0 == (-0 :: Float)Truerecip 0 == recip (-0 :: Float)Falsemap (/ 0) [-1, 0, 1 :: Float][-Infinity,NaN,Infinity]map (* 0) $ map (/ 0) [-1, 0, 1 :: Float][NaN,NaN,NaN]
Fractional ScientificDefined in scientific-0.3.8.0 · Data.ScientificWARNING: recip and / will throw an error when their outputs are repeating decimals.
These methods also compute Integer magnitudes (
10^e). If these methods are applied to arguments which have huge exponents this could fill up all space and crash your program! So don't apply these methods to scientific numbers coming from untrusted sources.fromRational will throw an error when the input Rational is a repeating decimal. Consider using fromRationalRepetend for these rationals which will detect the repetition and indicate where it starts.
Fractional DiffTimeDefined in time-1.12.2 · Data.Time.Clock.Internal.DiffTimeFractional NominalDiffTimeDefined in time-1.12.2 · Data.Time.Clock.Internal.NominalDiffTimeRealFloat a => Fractional (Complex a)Defined in base-4.20.2.0 · Data.ComplexFractional a => Fractional (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityFractional a => Fractional (Down a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.OrdIntegral a => Fractional (Ratio a)Defined in ghc-internal-9.1003.0 · GHC.Internal.RealHasResolution a => Fractional (Fixed a)Defined in base-4.20.2.0 · Data.FixedFractional a => Fractional (Op a b)Defined in base-4.20.2.0 · Data.Functor.ContravariantFractional a => Fractional (Const a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.ConstFractional a => Fractional (Tagged s a)Defined in tagged-0.8.9 · Data.TaggedFractional (f (g a)) => Fractional (Compose f g a)Defined in base-4.20.2.0 · Data.Functor.Compose
Extracting components of fractions.
Methods
properFraction :: Integral b => a -> (b, a)The function properFraction takes a real fractional number
xand returns a pair(n,f)such thatx = n+f, and:nis an integral number with the same sign asx; andfis a fraction with the same type and sign asx, and with absolute value less than1.
The default definitions of the ceiling, floor, truncate and round functions are in terms of properFraction.
truncate :: Integral b => a -> btruncate xreturns the integer nearestxbetween zero andxround :: Integral b => a -> bround xreturns the nearest integer tox; the even integer ifxis equidistant between two integersceiling :: Integral b => a -> bceiling xreturns the least integer not less thanxfloor :: Integral b => a -> bfloor xreturns the greatest integer not greater thanx
Instances14RealFrac, …
RealFrac CDoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRealFrac CFloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRealFrac DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphanBeware that results for non-finite arguments are garbage:
Example2 expressions [ f x | f <- [round, floor, ceiling], x <- [-1/0, 0/0, 1/0] ] :: [Int][0,0,0,0,0,0,0,0,0]map properFraction [-1/0, 0/0, 1/0] :: [(Int, Double)][(0,0.0),(0,0.0),(0,0.0)]
and get even more non-sensical if you ask for Integer instead of Int.
RealFrac FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphanBeware that results for non-finite arguments are garbage:
Example2 expressions [ f x | f <- [round, floor, ceiling], x <- [-1/0, 0/0, 1/0 :: Float] ] :: [Int][0,0,0,0,0,0,0,0,0]map properFraction [-1/0, 0/0, 1/0] :: [(Int, Float)][(0,0.0),(0,0.0),(0,0.0)]
and get even more non-sensical if you ask for Integer instead of Int.
RealFrac ScientificDefined in scientific-0.3.8.0 · Data.ScientificWARNING: the methods of the
RealFracinstance need to compute the magnitude10^e. If applied to a huge exponent this could take a long time. Even worse, when the destination type is unbounded (i.e. Integer) it could fill up all space and crash your program!RealFrac DiffTimeDefined in time-1.12.2 · Data.Time.Clock.Internal.DiffTimeRealFrac NominalDiffTimeDefined in time-1.12.2 · Data.Time.Clock.Internal.NominalDiffTimeIntegral a => RealFrac (Ratio a)Defined in ghc-internal-9.1003.0 · GHC.Internal.RealRealFrac a => RealFrac (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityRealFrac a => RealFrac (Down a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.OrdHasResolution a => RealFrac (Fixed a)Defined in base-4.20.2.0 · Data.FixedRealFrac a => RealFrac (Const a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.ConstRealFrac a => RealFrac (Tagged s a)Defined in tagged-0.8.9 · Data.TaggedRealFrac (f (g a)) => RealFrac (Compose f g a)Defined in base-4.20.2.0 · Data.Functor.Compose
raise a number to a non-negative integral power
utility function converting a Char to a show function that simply prepends the character unchanged.
utility function converting a String to a show function that simply prepends the string unchanged.
The Bounded class is used to name the upper and lower limits of a type. Ord is not a superclass of Bounded since types that are not totally ordered may also have upper and lower bounds.
The Bounded class may be derived for any enumeration type;
minBound is the first constructor listed in the data declaration
and maxBound is the last.
Bounded may also be derived for single-constructor datatypes whose
constituent types are in Bounded.
Instances110Bounded, …
Bounded ExtensionDefined in ghc-boot-th-9.10.3 · GHC.LanguageExtensions.TypeBounded ByteOrderDefined in ghc-internal-9.1003.0 · GHC.Internal.ByteOrderBounded AllDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalBounded AnyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalBounded CBoolDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesBounded CCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesBounded CIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesBounded CIntMaxDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesBounded CIntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesBounded CLLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesBounded CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesBounded CPtrdiffDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesBounded CSCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesBounded CShortDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesBounded CSigAtomicDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesBounded CSizeDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesBounded CUCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesBounded CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesBounded CUIntMaxDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesBounded CUIntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesBounded CULLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesBounded CULongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesBounded CUShortDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesBounded CWcharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesBounded IntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.PtrBounded WordPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.PtrBounded AssociativityDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsBounded DecidedStrictnessDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsBounded SourceStrictnessDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsBounded SourceUnpackednessDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsBounded Int16Defined in ghc-internal-9.1003.0 · GHC.Internal.IntBounded Int32Defined in ghc-internal-9.1003.0 · GHC.Internal.IntBounded Int64Defined in ghc-internal-9.1003.0 · GHC.Internal.IntBounded Int8Defined in ghc-internal-9.1003.0 · GHC.Internal.IntBounded CBlkCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesBounded CBlkSizeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesBounded CClockIdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesBounded CDevDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesBounded CFsBlkCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesBounded CFsFilCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesBounded CGidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesBounded CIdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesBounded CInoDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesBounded CKeyDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesBounded CModeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesBounded CNfdsDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesBounded CNlinkDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesBounded COffDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesBounded CPidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesBounded CRLimDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesBounded CSocklenDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesBounded CSsizeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesBounded CTcflagDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesBounded CUidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesBounded FdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.TypesBounded GeneralCategoryDefined in ghc-internal-9.1003.0 · GHC.Internal.UnicodeBounded Word16Defined in ghc-internal-9.1003.0 · GHC.Internal.WordBounded Word32Defined in ghc-internal-9.1003.0 · GHC.Internal.WordBounded Word64Defined in ghc-internal-9.1003.0 · GHC.Internal.WordBounded Word8Defined in ghc-internal-9.1003.0 · GHC.Internal.WordBounded BoolDefined in ghc-internal-9.1003.0 · GHC.Internal.EnumBounded CharDefined in ghc-internal-9.1003.0 · GHC.Internal.EnumBounded IntDefined in ghc-internal-9.1003.0 · GHC.Internal.EnumBounded LevityDefined in ghc-internal-9.1003.0 · GHC.Internal.EnumBounded OrderingDefined in ghc-internal-9.1003.0 · GHC.Internal.EnumBounded VecCountDefined in ghc-internal-9.1003.0 · GHC.Internal.EnumBounded VecElemDefined in ghc-internal-9.1003.0 · GHC.Internal.EnumBounded WordDefined in ghc-internal-9.1003.0 · GHC.Internal.EnumBounded I8Defined in text-2.1.3 · Data.Text.ForeignBounded FPFormatDefined in text-2.1.3 · Data.Text.Lazy.Builder.RealFloatBounded QuarterOfYearDefined in time-1.12.2 · Data.Time.Calendar.QuarterBounded ()Defined in ghc-internal-9.1003.0 · GHC.Internal.EnumBounded a => Bounded (First a)Defined in base-4.20.2.0 · Data.SemigroupBounded a => Bounded (Last a)Defined in base-4.20.2.0 · Data.SemigroupBounded a => Bounded (Max a)Defined in base-4.20.2.0 · Data.SemigroupBounded a => Bounded (Min a)Defined in base-4.20.2.0 · Data.SemigroupBounded a => Bounded (And a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsBounded a => Bounded (Iff a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsBounded a => Bounded (Ior a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsBounded a => Bounded (Xor a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.BitsBounded a => Bounded (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityBounded a => Bounded (Down a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.OrdBounded a => Bounded (Dual a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalBounded a => Bounded (Product a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalBounded a => Bounded (Sum a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalBounded a => Bounded (a)Defined in ghc-internal-9.1003.0 · GHC.Internal.EnumBounded m => Bounded (WrappedMonoid m)Defined in base-4.20.2.0 · Data.SemigroupBounded (Proxy t)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Proxy(Bounded a, Bounded b) => Bounded (a, b)Defined in ghc-internal-9.1003.0 · GHC.Internal.EnumBounded a => Bounded (Const a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.ConstBounded b => Bounded (Tagged s b)Defined in tagged-0.8.9 · Data.TaggedCoercible a b => Bounded (Coercion a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Coercion(Biapplicative bi, Bounded a, Bounded b) => Bounded (Biap bi a b)Defined in bifunctors-5.6.2 · Data.Bifunctor.Biap(Applicative f, Bounded a) => Bounded (Ap f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Monoid(Bounded a, Bounded b, Bounded c) => Bounded (a, b, c)Defined in ghc-internal-9.1003.0 · GHC.Internal.Enuma ~ b => Bounded (a :~: b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Equality(Bounded a, Bounded b, Bounded c, Bounded d) => Bounded (a, b, c, d)Defined in ghc-internal-9.1003.0 · GHC.Internal.Enuma ~~ b => Bounded (a :~~: b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.EqualityBounded (f (g a)) => Bounded (Compose f g a)Defined in base-4.20.2.0 · Data.Functor.Compose(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e) => Bounded (a, b, c, d, e)Defined in ghc-internal-9.1003.0 · GHC.Internal.Enum(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f) => Bounded (a, b, c, d, e, f)Defined in ghc-internal-9.1003.0 · GHC.Internal.Enum(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g) => Bounded (a, b, c, d, e, f, g)Defined in ghc-internal-9.1003.0 · GHC.Internal.Enum(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h) => Bounded (a, b, c, d, e, f, g, h)Defined in ghc-internal-9.1003.0 · GHC.Internal.Enum(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i) => Bounded (a, b, c, d, e, f, g, h, i)Defined in ghc-internal-9.1003.0 · GHC.Internal.Enum(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j) => Bounded (a, b, c, d, e, f, g, h, i, j)Defined in ghc-internal-9.1003.0 · GHC.Internal.Enum(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k) => Bounded (a, b, c, d, e, f, g, h, i, j, k)Defined in ghc-internal-9.1003.0 · GHC.Internal.Enum(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l) => Bounded (a, b, c, d, e, f, g, h, i, j, k, l)Defined in ghc-internal-9.1003.0 · GHC.Internal.Enum(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l, Bounded m) => Bounded (a, b, c, d, e, f, g, h, i, j, k, l, m)Defined in ghc-internal-9.1003.0 · GHC.Internal.Enum(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l, Bounded m, Bounded n) => Bounded (a, b, c, d, e, f, g, h, i, j, k, l, m, n)Defined in ghc-internal-9.1003.0 · GHC.Internal.Enum(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l, Bounded m, Bounded n, Bounded o) => Bounded (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)Defined in ghc-internal-9.1003.0 · GHC.Internal.Enum
Make a StablePtr that can be passed to the C function
hs_try_putmvar(). The RTS wants a StablePtr to the
underlying MVar#, but a StablePtr# can only refer to
lifted types, so we have to cheat by coercing.
Constructors
BlockedOnMVarblocked on MVar
BlockedOnBlackHoleblocked on a computation in progress by another thread
BlockedOnExceptionblocked in throwTo
BlockedOnSTMblocked in retry in an STM transaction
BlockedOnForeignCallcurrently in a foreign call
BlockedOnOtherblocked on some other resource. Without
-threaded, I/O and threadDelay show up as BlockedOnOther, with-threadedthey show up as BlockedOnMVar.
Instances3Eq, Ord, Show
Eq BlockReasonDefined in ghc-internal-9.1003.0 · GHC.Internal.Conc.SyncOrd BlockReasonDefined in ghc-internal-9.1003.0 · GHC.Internal.Conc.SyncShow BlockReasonDefined in ghc-internal-9.1003.0 · GHC.Internal.Conc.Sync
The current status of a thread
Constructors
ThreadRunningthe thread is currently runnable or running
ThreadFinishedthe thread has finished
ThreadBlocked BlockReasonthe thread is blocked on some resource
ThreadDiedthe thread received an uncaught exception
Instances3Eq, Ord, Show
Eq ThreadStatusDefined in ghc-internal-9.1003.0 · GHC.Internal.Conc.SyncOrd ThreadStatusDefined in ghc-internal-9.1003.0 · GHC.Internal.Conc.SyncShow ThreadStatusDefined in ghc-internal-9.1003.0 · GHC.Internal.Conc.Sync
Returns the number of CPUs that the machine has
labelThread stores a string as identifier for this thread. This identifier will be used in the debugging output to make distinction of different threads easier (otherwise you only have the thread state object's address in the heap). It also emits an event to the RTS eventlog.
List the Haskell threads of the current process.
the value passed to the +RTS -N flag. This is the number of
Haskell threads that can run truly simultaneously at any given
time, and is typically set to the number of physical processor cores on
the machine.
Strictly speaking it is better to use getNumCapabilities, because the number of capabilities might vary at runtime.
Returns the number of sparks currently in the local spark pool
Internal function used by the RTS to run sparks.
Query the current execution status of a thread.
Unsafely performs IO in the STM monad. Beware: this is a highly dangerous thing to do.
The STM implementation will often run transactions multiple times, so you need to be prepared for this if your IO has any side effects.
The STM implementation will abort transactions that are known to be invalid and need to be restarted. This may happen in the middle of unsafeIOToSTM, so make sure you don't acquire any resources that need releasing (exception handlers are ignored when aborting the transaction). That includes doing any IO using Handles, for example. Getting this wrong will probably lead to random deadlocks.
The transaction may have seen an inconsistent view of memory when the IO runs. Invariants that you expect to be true throughout your program may not be true inside a transaction, due to the way transactions are implemented. Normally this wouldn't be visible to the programmer, but using unsafeIOToSTM can expose it.
This data type witnesses the lifting of a Monoid into an Applicative pointwise.
Examples
Ap (Just [1, 2, 3]) <> Ap NothingAp {getAp = Nothing}
Ap [Sum 10, Sum 20] <> Ap [Sum 1, Sum 2]Ap {getAp = [Sum {getSum = 11},Sum {getSum = 12},Sum {getSum = 21},Sum {getSum = 22}]}
Instances24Generic1, Monad, Functor, MonadFix, MonadFail, Applicative, …
Generic1 (Ap f)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidMonad f => Monad (Ap f)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidFunctor f => Functor (Ap f)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidMonadFix f => MonadFix (Ap f)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.Monad.FixMonadFail f => MonadFail (Ap f)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidApplicative f => Applicative (Ap f)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidFoldable f => Foldable (Ap f)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableTraversable f => Traversable (Ap f)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.TraversableAlternative f => Alternative (Ap f)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidMonadPlus f => MonadPlus (Ap f)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidFoldable1 f => Foldable1 (Ap f)Defined in base-4.20.2.0 · Data.Foldable1(Applicative f, Bounded a) => Bounded (Ap f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidEnum (f a) => Enum (Ap f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidEq (f a) => Eq (Ap f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Monoid(Data (f a), Data a, Typeable f) => Data (Ap f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Data(Applicative f, Num a) => Num (Ap f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidNote that even if the underlying Num and Applicative instances are lawful, for most Applicatives, this instance will not be lawful. If you use this instance with the list Applicative, the following customary laws will not hold:
Commutativity:
Example2 expressions Ap [10,20] + Ap [1,2]Ap {getAp = [11,12,21,22]}Ap [1,2] + Ap [10,20]Ap {getAp = [11,21,12,22]}
Additive inverse:
Example2 expressions Ap [] + negate (Ap [])Ap {getAp = []}fromInteger 0 :: Ap [] IntAp {getAp = [0]}
Distributivity:
Example2 expressions Ap [1,2] * (3 + 4)Ap {getAp = [7,14]}(Ap [1,2] * 3) + (Ap [1,2] * 4)Ap {getAp = [7,11,10,14]}
Ord (f a) => Ord (Ap f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidRead (f a) => Read (Ap f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidShow (f a) => Show (Ap f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidGeneric (Ap f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Monoid(Applicative f, Semigroup a) => Semigroup (Ap f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Monoid(Applicative f, Monoid a) => Monoid (Ap f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Monoidtype Rep (Ap f a) = D1 ('MetaDataDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Monoid"Ap"
"GHC.Internal.Data.Monoid"
"ghc-internal"
'True) (C1 ('MetaCons"Ap"
'PrefixI 'True) (S1 ('MetaSel ('Just"getAp"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f a))))type Rep1 (Ap f) = D1 ('MetaDataDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Monoid"Ap"
"GHC.Internal.Data.Monoid"
"ghc-internal"
'True) (C1 ('MetaCons"Ap"
'PrefixI 'True) (S1 ('MetaSel ('Just"getAp"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 f)))
Left-to-right monadic fold over the elements of a structure.
Given a structure t with elements (a, b, ..., w, x, y), the result of
a fold with an operator function f is equivalent to:
foldlM f z t = do
aa <- f z a
bb <- f aa b
...
xx <- f ww x
yy <- f xx y
return yy -- Just @return z@ when the structure is emptyFor a Monad m, given two functions f1 :: a -> m b and f2 :: b -> m c,
their Kleisli composition (f1 >=> f2) :: a -> m c is defined by:
(f1 >=> f2) a = f1 a >>= f2Another way of thinking about foldlM is that it amounts to an application
to z of a Kleisli composition:
foldlM f z t =
flip f a >=> flip f b >=> ... >=> flip f x >=> flip f y $ zThe monadic effects of foldlM are sequenced from left to right.
If at some step the bind operator (>>=) short-circuits (as with, e.g.,
mzero in a MonadPlus), the evaluated effects will be from an initial
segment of the element sequence. If you want to evaluate the monadic
effects in right-to-left order, or perhaps be able to short-circuit after
processing a tail of the sequence of elements, you'll need to use foldrM
instead.
If the monadic effects don't short-circuit, the outermost application of
f is to the rightmost element y, so that, ignoring effects, the result
looks like a left fold:
((((z `f` a) `f` b) ... `f` w) `f` x) `f` yExamples
Basic usage:
let f a e = do { print e ; return $ e : a }foldlM f [] [0..3]0123[3,2,1,0]
Right-to-left monadic fold over the elements of a structure.
Given a structure t with elements (a, b, c, ..., x, y), the result of
a fold with an operator function f is equivalent to:
foldrM f z t = do
yy <- f y z
xx <- f x yy
...
bb <- f b cc
aa <- f a bb
return aa -- Just @return z@ when the structure is emptyFor a Monad m, given two functions f1 :: a -> m b and f2 :: b -> m c,
their Kleisli composition (f1 >=> f2) :: a -> m c is defined by:
(f1 >=> f2) a = f1 a >>= f2Another way of thinking about foldrM is that it amounts to an application
to z of a Kleisli composition:
foldrM f z t = f y >=> f x >=> ... >=> f b >=> f a $ zThe monadic effects of foldrM are sequenced from right to left, and e.g.
folds of infinite lists will diverge.
If at some step the bind operator (>>=) short-circuits (as with, e.g.,
mzero in a MonadPlus), the evaluated effects will be from a tail of the
element sequence. If you want to evaluate the monadic effects in
left-to-right order, or perhaps be able to short-circuit after an initial
sequence of elements, you'll need to use foldlM instead.
If the monadic effects don't short-circuit, the outermost application of
f is to the leftmost element a, so that, ignoring effects, the result
looks like a right fold:
a `f` (b `f` (c `f` (... (x `f` (y `f` z))))).Examples
Basic usage:
let f i acc = do { print i ; return $ i : acc }foldrM f [] [0..3]3210[0,1,2,3]
for_ is traverse_ with its arguments flipped. For a version that doesn't ignore the results see for. This is forM_ generalised to Applicative actions.
for_ is just like forM_, but generalised to Applicative actions.
Examples
Basic usage:
for_ [1..4] print1234
Evaluate each action in the structure from left to right, and ignore the results. For a version that doesn't ignore the results see sequenceA.
sequenceA_ is just like sequence_, but generalised to Applicative actions.
Examples
Basic usage:
sequenceA_ [print "Hello", print "world", print "!"]"Hello""world""!"
Map each element of a structure to an Applicative action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see traverse.
traverse_ is just like mapM_, but generalised to Applicative actions.
Examples
Basic usage:
traverse_ print ["Hello", "world", "!"]"Hello""world""!"
The lex function reads a single lexeme from the input, discarding
initial white space, and returning the characters that constitute the
lexeme. If the input string contains only white space, lex returns a
single successful `lexeme' consisting of the empty string. (Thus
lex "" = [("","")].) If there is no legal lexeme at the
beginning of the input string, lex fails (i.e. returns []).
This lexer is not completely faithful to the Haskell lexical syntax in the following respects:
Qualified names are not handled properly
Octal and hexadecimal numerics are not recognized as a single token
Comments are not treated properly
Construct a continuation-passing computation from a function. (The inverse of runCont)
equivalent to showsPrec with a precedence of 0.
The print function outputs a value of any printable type to the standard output device. Printable types are those that are instances of class Show; print converts values to strings for output using the show operation and adds a newline.
For example, a program to print the first 20 integers and their powers of 2 could be written as:
main = print ([(n, 2^n) | n <- [0..19]])& 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
5 & (+1) & show"6"
sqrt $ [1 / n^2 | n <- [1..1000]] & sum & (*6)3.1406380562059946
on b u x y runs the binary function b on the results of applying
unary function u to two arguments x and y. From the opposite
perspective, it transforms two inputs and combines the outputs.
(op `on` f) x y = f x `op` f yExamples
sortBy (compare `on` length) [[0, 1, 2], [0, 1], [], [0]][[],[0],[0,1],[0,1,2]]
((+) `on` length) [1, 2, 3] [-1]4
((,) `on` (*2)) 2 3(4,6)
Algebraic properties
applyWhen applies a function to a value if a condition is true, otherwise, it returns the value unchanged.
It is equivalent to flip (bool id).
Examples
map (\x -> applyWhen (odd x) (*2) x) [1..10][2,2,6,4,10,6,14,8,18,10]
map (\x -> applyWhen (length x > 6) ((++ "...") . take 3) x) ["Hi!", "This is amazing", "Hope you're doing well today!", ":D"]["Hi!","Thi...","Hop...",":D"]
Algebraic properties
runCont The result of running a CPS computation with a given final continuation. (The inverse of cont)
File and directory names are values of type String, whose precise meaning is operating system dependent. Files can be opened, yielding a handle which can then be used to operate on the contents of that file.
An operator alias for select, which is sometimes convenient. It tries to follow the notational convention for Applicative operators. The angle bracket pointing to the left means we always use the corresponding value. The value on the right, however, may be skipped, hence the question mark.
Instances6Functor, Applicative, Selective, Eq, Ord, Show
Functor (Over m)Defined in selective-0.7.0.1 · Control.SelectiveMonoid m => Applicative (Over m)Defined in selective-0.7.0.1 · Control.SelectiveMonoid m => Selective (Over m)Defined in selective-0.7.0.1 · Control.SelectiveEq m => Eq (Over m a)Defined in selective-0.7.0.1 · Control.SelectiveOrd m => Ord (Over m a)Defined in selective-0.7.0.1 · Control.SelectiveShow m => Show (Over m a)Defined in selective-0.7.0.1 · Control.Selective
Instances8Functor, Applicative, Foldable, Traversable, Selective, Eq, …
Functor (Under m)Defined in selective-0.7.0.1 · Control.SelectiveMonoid m => Applicative (Under m)Defined in selective-0.7.0.1 · Control.SelectiveFoldable (Under m)Defined in selective-0.7.0.1 · Control.SelectiveTraversable (Under m)Defined in selective-0.7.0.1 · Control.SelectiveMonoid m => Selective (Under m)Defined in selective-0.7.0.1 · Control.SelectiveEq m => Eq (Under m a)Defined in selective-0.7.0.1 · Control.SelectiveOrd m => Ord (Under m a)Defined in selective-0.7.0.1 · Control.SelectiveShow m => Show (Under m a)Defined in selective-0.7.0.1 · Control.Selective
Composition of a selective functor f with the Either monad.
Constructors
ComposeEither (f (Either e a))
Instances4Functor, Applicative, Alternative, Selective
Functor f => Functor (ComposeEither f e)Defined in selective-0.7.0.1 · Control.SelectiveSelective f => Applicative (ComposeEither f e)Defined in selective-0.7.0.1 · Control.Selective(Selective f, Monoid e) => Alternative (ComposeEither f e)Defined in selective-0.7.0.1 · Control.SelectiveSelective f => Selective (ComposeEither f e)Defined in selective-0.7.0.1 · Control.Selective
Composition of a selective functor f and an applicative traversable
functor g.
Constructors
ComposeTraversable (f (g a))
Instances3Functor, Applicative, Selective
(Functor f, Functor g) => Functor (ComposeTraversable f g)Defined in selective-0.7.0.1 · Control.Selective(Applicative f, Applicative g) => Applicative (ComposeTraversable f g)Defined in selective-0.7.0.1 · Control.Selective(Selective f, Applicative g, Traversable g) => Selective (ComposeTraversable f g)Defined in selective-0.7.0.1 · Control.Selective
Any applicative functor can be given a Selective instance by defining
select = selectA. This data type captures this pattern, so you can use
it in combination with the DerivingVia extension as follows:
newtype Over m a = Over m
deriving (Functor, Applicative, Selective) via SelectA (Const m)
Constructors
SelectAgetSelectA :: f a
Instances3Functor, Applicative, Selective
Functor f => Functor (SelectA f)Defined in selective-0.7.0.1 · Control.SelectiveApplicative f => Applicative (SelectA f)Defined in selective-0.7.0.1 · Control.SelectiveApplicative f => Selective (SelectA f)Defined in selective-0.7.0.1 · Control.Selective
Any monad can be given a Selective instance by defining
select = selectM. This data type captures this pattern, so you can use
it in combination with the DerivingVia extension as follows:
newtype V1 a = V1 a
deriving (Functor, Applicative, Selective, Monad) via SelectM Identity
Constructors
SelectMgetSelectM :: f a
Instances4Monad, Functor, Applicative, Selective
Monad f => Monad (SelectM f)Defined in selective-0.7.0.1 · Control.SelectiveFunctor f => Functor (SelectM f)Defined in selective-0.7.0.1 · Control.SelectiveApplicative f => Applicative (SelectM f)Defined in selective-0.7.0.1 · Control.SelectiveMonad f => Selective (SelectM f)Defined in selective-0.7.0.1 · Control.Selective
A lifted version of lazy Boolean AND.
A lifted version of lazy Boolean OR.
A lifted version of all. Retains the short-circuiting behaviour.
Accumulate the Right values, or return the first Left.
A lifted version of any. Retains the short-circuiting behaviour.
Recover the application operator <*> from select. Rigid selective
functors satisfy the law <*> = apS and furthermore, the resulting
applicative functor satisfies all laws of Applicative:
Identity:
pure id <*> v = vHomomorphism:
pure f <*> pure x = pure (f x)Interchange:
u <*> pure y = pure ($y) <*> uComposition:
(.) <$> u <*> v <*> w = u <*> (v <*> w)
The branch function is a natural generalisation of select: instead of skipping an unnecessary effect, it chooses which of the two given effectful functions to apply to a given argument; the other effect is unnecessary. It is possible to implement branch in terms of select, which is a good puzzle (give it a try!).
We can also implement select via branch:
selectB :: Selective f => f (Either a b) -> f (a -> b) -> f b
selectB x y = branch x y (pure id)
The list of all possible values of an enumerable data type.
Generalised folding with the short-circuiting behaviour.
A lifted version of fromMaybe.
Branch on a Boolean value, skipping unnecessary effects.
Eliminate all specified values a from f (Either a b) by replacing each
of them with a given f a.
Eliminate all specified values a from f (Either a b) by replacing each
of them with a given f a.
We can write a function with the type signature of select using the Applicative type class, but it will always execute the effects associated with the second argument, hence being potentially less efficient.
Keep running an effectful computation until it returns a Right value,
collecting the Left's using a supplied Monoid instance.
Conditionally perform an effect.
Keep checking an effectful condition while it holds.
A list of values, equipped with a fast membership test.
The computation writeFile file str function writes the string str,
to the file file.
The Item type function returns the type of items of the structure
l.
Instances29Item, …
type Item ByteArray = Word8Defined in base-4.20.2.0 · Data.Array.Bytetype Item Builder = Word8Defined in bytestring-0.12.2.0 · Data.ByteString.Builder.Internaltype Item ByteString = Word8Defined in bytestring-0.12.2.0 · Data.ByteString.Internal.Typetype Item ByteString = Word8Defined in bytestring-0.12.2.0 · Data.ByteString.Lazy.Internaltype Item ShortByteString = Word8Defined in bytestring-0.12.2.0 · Data.ByteString.Short.Internaltype Item IntSet = KeyDefined in containers-0.7 · Data.IntSet.Internaltype Item Version = IntDefined in ghc-internal-9.1003.0 · GHC.Internal.IsListtype Item CallStack = (String, SrcLoc)Defined in ghc-internal-9.1003.0 · GHC.Internal.IsListtype Item Text = CharDefined in text-2.1.3 · Data.Text · orphantype Item Text = CharDefined in text-2.1.3 · Data.Text.Lazy · orphantype Item (IntMap a) = (Key, a)Defined in containers-0.7 · Data.IntMap.Internaltype Item (Map k v) = (k, v)Defined in containers-0.7 · Data.Map.Internaltype Item (Seq a) = aDefined in containers-0.7 · Data.Sequence.Internaltype Item (Set a) = aDefined in containers-0.7 · Data.Set.Internaltype Item (DNonEmpty a) = aDefined in dlist-1.0 · Data.DList.DNonEmpty.Internaltype Item (DList a) = aDefined in dlist-1.0 · Data.DList.Internaltype Item (NonEmpty a) = aDefined in ghc-internal-9.1003.0 · GHC.Internal.IsListtype Item (ZipList a) = aDefined in ghc-internal-9.1003.0 · GHC.Internal.IsListtype Item (Array a) = aDefined in primitive-0.9.1.0 · Data.Primitive.Arraytype Item (PrimArray a) = aDefined in primitive-0.9.1.0 · Data.Primitive.PrimArraytype Item (SmallArray a) = aDefined in primitive-0.9.1.0 · Data.Primitive.SmallArraytype Item (HashMap k v) = (k, v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internaltype Item (HashSet a) = aDefined in unordered-containers-0.2.21 · Data.HashSet.Internaltype Item (Vector a) = aDefined in vector-0.13.2.0 · Data.Vectortype Item (Vector a) = aDefined in vector-0.13.2.0 · Data.Vector.Primitivetype Item (Vector a) = aDefined in vector-0.13.2.0 · Data.Vector.Storabletype Item (Vector a) = aDefined in vector-0.13.2.0 · Data.Vector.Stricttype Item (Vector e) = eDefined in vector-0.13.2.0 · Data.Vector.Unboxed · orphantype Item [a] = aDefined in ghc-internal-9.1003.0 · GHC.Internal.IsList
Apply a possibly-empty-with-unit container of functions to a non-empty container of values.
Apply a non-empty container of functions to a possibly-empty-with-unit container of values.
Wrap an Applicative to be used as a member of Apply
Constructors
Instances8Functor, Applicative, Alternative, Alt, Apply, Plus, …
Functor f => Functor (WrappedApplicative f)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApplicative f => Applicative (WrappedApplicative f)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassAlternative f => Alternative (WrappedApplicative f)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassAlternative f => Alt (WrappedApplicative f)Defined in semigroupoids-6.0.1 · Data.Functor.AltApplicative f => Apply (WrappedApplicative f)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassAlternative f => Plus (WrappedApplicative f)Defined in semigroupoids-6.0.1 · Data.Functor.PlusCopointed f => Copointed (WrappedApplicative f)Defined in pointed-5.0.4 · Data.CopointedPointed f => Pointed (WrappedApplicative f)Defined in pointed-5.0.4 · Data.Pointed
Transform an Apply into an Applicative by adding a unit.
Constructors
MaybeApplyrunMaybeApply :: Either (f a) a
Instances7Functor, Applicative, Comonad, Apply, Extend, Copointed, …
Functor f => Functor (MaybeApply f)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply f => Applicative (MaybeApply f)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassComonad f => Comonad (MaybeApply f)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassApply f => Apply (MaybeApply f)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassExtend f => Extend (MaybeApply f)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassCopointed f => Copointed (MaybeApply f)Defined in pointed-5.0.4 · Data.CopointedPointed (MaybeApply f)Defined in pointed-5.0.4 · Data.Pointed
A variant of <.> with the arguments reversed.
Lift a ternary function into a comonad with zipping
Generic (>>-). Caveats:
Will not compile if
mis a sum type.Will not compile if
mcontains fields that do not mention its type variable.Will not compile if
mcontains fields where the type variable appears underneath the composition of type constructors (e.g.,f (g a)).May do redundant work, due to the nature of the Bind instance for (:*:)
type (:->) (p :: k -> k1 -> Type) (q :: k -> k1 -> Type) = forall (a :: k) (b :: k1). p a b -> q a b(:->) has a polymorphic kind since 5.6.
The computation appendFile file str function appends the string str,
to the file file.
Note that writeFile and appendFile write a literal string to a file. To write a value of any printable type, as with print, use the show function to convert the value to a string first.
main = appendFile "squares" (show [(x,x*x) | x <- [0,0.1..2]])The getContents operation returns all user input as a single string, which is read lazily as it is needed (same as hGetContents stdin).
The interact function takes a function of type String->String
as its argument. The entire input from the standard input device is
passed to this function as its argument, and the resulting string is
output on the standard output device.
The readFile function reads a file and returns the contents of the file as a string. The file is read lazily, on demand, as with getContents.
The same as putStr, but adds a newline character.
equivalent to readsPrec with a precedence of 0.
Lift a Functor into a Profunctor (backwards).
Costar has a polymorphic kind since 5.6.
Instances13Cochoice, Closed, Costrong, Profunctor, Corepresentable, Invariant2, …
Applicative f => Cochoice (Costar f)Defined in profunctors-5.6.3 · Data.Profunctor.ChoiceFunctor f => Closed (Costar f)Defined in profunctors-5.6.3 · Data.Profunctor.ClosedFunctor f => Costrong (Costar f)Defined in profunctors-5.6.3 · Data.Profunctor.StrongFunctor f => Profunctor (Costar f)Defined in profunctors-5.6.3 · Data.Profunctor.TypesFunctor f => Corepresentable (Costar f)Defined in profunctors-5.6.3 · Data.Profunctor.RepInvariant f => Invariant2 (Costar f)Defined in invariant-0.6.4 · Data.Functor.Invariantfrom the
profunctorspackageFunctor f => Cosieve (Costar f) fDefined in profunctors-5.6.3 · Data.Profunctor.SieveMonad (Costar f a)Defined in profunctors-5.6.3 · Data.Profunctor.TypesFunctor (Costar f a)Defined in profunctors-5.6.3 · Data.Profunctor.TypesApplicative (Costar f a)Defined in profunctors-5.6.3 · Data.Profunctor.TypesDistributive (Costar f d)Defined in profunctors-5.6.3 · Data.Profunctor.TypesInvariant (Costar f a)Defined in invariant-0.6.4 · Data.Functor.Invariantfrom the
profunctorspackagetype Corep (Costar f) = fDefined in profunctors-5.6.3 · Data.Profunctor.Rep
Instances16Choice, Cochoice, Strong, Profunctor, Traversing, Representable, …
Monoid r => Choice (Forget r)Defined in profunctors-5.6.3 · Data.Profunctor.ChoiceCochoice (Forget r)Defined in profunctors-5.6.3 · Data.Profunctor.ChoiceStrong (Forget r)Defined in profunctors-5.6.3 · Data.Profunctor.StrongProfunctor (Forget r)Defined in profunctors-5.6.3 · Data.Profunctor.TypesMonoid m => Traversing (Forget m)Defined in profunctors-5.6.3 · Data.Profunctor.TraversingRepresentable (Forget r)Defined in profunctors-5.6.3 · Data.Profunctor.RepInvariant2 (Forget r)Defined in invariant-0.6.4 · Data.Functor.Invariantfrom the
profunctorspackageSieve (Forget r) (Const r)Defined in profunctors-5.6.3 · Data.Profunctor.SieveFunctor (Forget r a)Defined in profunctors-5.6.3 · Data.Profunctor.TypesFoldable (Forget r a)Defined in profunctors-5.6.3 · Data.Profunctor.TypesTraversable (Forget r a)Defined in profunctors-5.6.3 · Data.Profunctor.TypesContravariant (Forget r a)Defined in profunctors-5.6.3 · Data.Profunctor.TypesInvariant (Forget r a)Defined in invariant-0.6.4 · Data.Functor.Invariantfrom the
profunctorspackageSemigroup r => Semigroup (Forget r a b)Defined in profunctors-5.6.3 · Data.Profunctor.TypesVia
Semigroup r => (a -> r)Monoid r => Monoid (Forget r a b)Defined in profunctors-5.6.3 · Data.Profunctor.TypesVia
Monoid r => (a -> r)type Rep (Forget r) = Const rDefined in profunctors-5.6.3 · Data.Profunctor.Rep
Lift a Functor into a Profunctor (forwards).
Star has a polymorphic kind since 5.6.
Instances20Category, Choice, Cochoice, Closed, Mapping, Strong, …
Monad f => Category (Star f)Defined in profunctors-5.6.3 · Data.Profunctor.TypesApplicative f => Choice (Star f)Defined in profunctors-5.6.3 · Data.Profunctor.ChoiceTraversable f => Cochoice (Star f)Defined in profunctors-5.6.3 · Data.Profunctor.ChoiceDistributive f => Closed (Star f)Defined in profunctors-5.6.3 · Data.Profunctor.Closed(Applicative m, Distributive m) => Mapping (Star m)Defined in profunctors-5.6.3 · Data.Profunctor.MappingFunctor m => Strong (Star m)Defined in profunctors-5.6.3 · Data.Profunctor.StrongFunctor f => Profunctor (Star f)Defined in profunctors-5.6.3 · Data.Profunctor.TypesApplicative m => Traversing (Star m)Defined in profunctors-5.6.3 · Data.Profunctor.TraversingFunctor f => Representable (Star f)Defined in profunctors-5.6.3 · Data.Profunctor.RepInvariant f => Invariant2 (Star f)Defined in invariant-0.6.4 · Data.Functor.Invariantfrom the
profunctorspackageFunctor f => Sieve (Star f) fDefined in profunctors-5.6.3 · Data.Profunctor.SieveMonad f => Monad (Star f a)Defined in profunctors-5.6.3 · Data.Profunctor.TypesFunctor f => Functor (Star f a)Defined in profunctors-5.6.3 · Data.Profunctor.TypesApplicative f => Applicative (Star f a)Defined in profunctors-5.6.3 · Data.Profunctor.TypesAlternative f => Alternative (Star f a)Defined in profunctors-5.6.3 · Data.Profunctor.TypesMonadPlus f => MonadPlus (Star f a)Defined in profunctors-5.6.3 · Data.Profunctor.TypesContravariant f => Contravariant (Star f a)Defined in profunctors-5.6.3 · Data.Profunctor.TypesDistributive f => Distributive (Star f a)Defined in profunctors-5.6.3 · Data.Profunctor.TypesInvariant f => Invariant (Star f a)Defined in invariant-0.6.4 · Data.Functor.Invariantfrom the
profunctorspackagetype Rep (Star f) = fDefined in profunctors-5.6.3 · Data.Profunctor.Rep
The sum of a collection of actions, generalizing concat.
psum [Just "Hello", Nothing, Just "World"]Just "Hello"
The read function reads input from a string, which must be completely consumed by the input process. read fails with an error if the parse is unsuccessful, and it is therefore discouraged from being used in real applications. Use readMaybe or readEither for safe alternatives.
read "123" :: Int123
read "hello" :: Int*** Exception: Prelude.read: no parse
raise a number to an integral power
gcd x y is the non-negative factor of both x and y of which
every common factor of x and y is also a factor; for example
gcd 4 2 = 2, gcd (-4) 6 = 2, gcd 0 4 = 4. gcd 0 0 = 0.
(That is, the common divisor that is "greatest" in the divisibility
preordering.)
Note: Since for signed fixed-width integer types, abs minBound < 0,
the result may be negative if one of the arguments is minBound (and
necessarily is if the other is 0 or minBound) for such types.
lcm x y is the smallest positive integer that both x and y divide.
The value of is bottom if seq a ba is bottom, and
otherwise equal to b. In other words, it evaluates the first
argument a to weak head normal form (WHNF). seq is usually
introduced to improve performance by avoiding unneeded laziness.
A note on evaluation order: the expression does
not guarantee that seq a ba will be evaluated before b.
The only guarantee given by seq is that the both a
and b will be evaluated before seq returns a value.
In particular, this means that b may be evaluated before
a. If you need to guarantee a specific order of evaluation,
you must use the function pseq from the "parallel" package.
Generalize Either e as MonadError e m.
If the argument has form Left e, an error is produced in the monad via
throwError. Otherwise, the Right a part is forwarded.
Extracts the element out of a Right and
throws an error if its argument take the form Left _.
Using Control.Lens:
fromRight' x ≡ x^?!_Right
fromRight' (Right 12)12
Maybe get the Left side of an Either.
leftToMaybe ≡ either Just (const Nothing)
Using Control.Lens:
leftToMaybe ≡ preview _Left
leftToMaybe x ≡ x^?_Left
leftToMaybe (Left 12)Just 12
leftToMaybe (Right 12)Nothing
The mapBoth function takes two functions and applies the first if iff the value
takes the form Left _ and the second if the value takes the form Right _.
Using Data.Bifunctor:
mapBoth = bimap
Using Control.Arrow:
mapBoth = (+++)
mapBoth (*2) (*3) (Left 4)Left 8
mapBoth (*2) (*3) (Right 4)Right 12
Maybe get the Right side of an Either.
rightToMaybe ≡ either (const Nothing) Just
Using Control.Lens:
rightToMaybe ≡ preview _Right
rightToMaybe x ≡ x^?_Right
rightToMaybe (Left 12)Nothing
rightToMaybe (Right 12)Just 12
A synonym of whenRight.
A synonym of whenLeft.
The whenRight function takes an Either value and a function which returns a monad.
The monad is only executed when the given argument takes the form Right _, otherwise
it does nothing.
Using Data.Foldable:
whenRight ≡ forM_
Using Control.Lens:
whenRight ≡ forOf_ _Right
whenRight (Right 12) print12