Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Void
- absurd :: Void -> a
- data Bool
- not :: Bool -> Bool
- data Int
- type String = [Char]
- data ByteString
- data Text
- class Show a where
- class Semigroup a where
- (<>) :: a -> a -> a
- class Semigroup a => Monoid a where
- mempty :: a
- class Eq a where
- class Eq a => Ord a where
- ($) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b
- (&) :: a -> (a -> b) -> b
- data IO a
- data Maybe a
- maybe :: b -> (a -> b) -> Maybe a -> b
- data Either a b
- either :: (a -> c) -> (b -> c) -> Either a b -> c
- data NonEmpty a = a :| [a]
- data Map k a
- fst :: (a, b) -> a
- snd :: (a, b) -> b
- const :: a -> b -> a
- curry :: ((a, b) -> c) -> a -> b -> c
- uncurry :: (a -> b -> c) -> (a, b) -> c
- class Foldable (t :: Type -> Type) where
- class Functor (f :: Type -> Type) where
- ($>) :: Functor f => f a -> b -> f b
- (<$>) :: Functor f => (a -> b) -> f a -> f b
- void :: Functor f => f a -> f ()
- class Functor f => Applicative (f :: Type -> Type) where
- when :: Applicative f => Bool -> f () -> f ()
- unless :: Applicative f => Bool -> f () -> f ()
- whenM :: Monad m => m Bool -> m () -> m ()
- whenJust :: Applicative m => Maybe a -> (a -> m ()) -> m ()
- class (Functor t, Foldable t) => Traversable (t :: Type -> Type) where
- traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f ()
- for_ :: (Foldable t, Applicative f) => t a -> (a -> f b) -> f ()
- filterM :: Applicative m => (a -> m Bool) -> [a] -> m [a]
- class Applicative m => Monad (m :: Type -> Type) where
- join :: Monad m => m (m a) -> m a
- forM_ :: (Foldable t, Monad m) => t a -> (a -> m b) -> m ()
- forM :: (Traversable t, Monad m) => t a -> (a -> m b) -> m (t b)
- mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()
- sequence_ :: (Foldable t, Monad m) => t (m a) -> m ()
- (=<<) :: Monad m => (a -> m b) -> m a -> m b
- (>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
- class Contravariant (f :: Type -> Type) where
- contramap :: (a -> b) -> f b -> f a
- (>$<) :: Contravariant f => (a -> b) -> f b -> f a
- data Predicate a
- data Equivalence a
- data Comparison a
- data Op a b
- class Functor g => Distributive (g :: Type -> Type) where
- distribute :: Functor f => f (g a) -> g (f a)
- class Functor w => Comonad (w :: Type -> Type) where
- (=>=) :: Comonad w => (w a -> b) -> (w b -> c) -> w a -> c
- (<<=) :: Comonad w => (w a -> b) -> w a -> w b
- class Profunctor (p :: Type -> Type -> Type) where
- class Profunctor p => Strong (p :: Type -> Type -> Type) where
- class Profunctor p => Choice (p :: Type -> Type -> Type) where
- class Category (cat :: k -> k -> Type) where
- class Category a => Arrow (a :: Type -> Type -> Type) where
- data Kleisli (m :: Type -> Type) a b
- (>>>) :: forall k cat (a :: k) (b :: k) (c :: k). Category cat => cat a b -> cat b c -> cat a c
- (<<<) :: forall k cat (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c
- type Env e = EnvT e Identity
- data EnvT e (w :: Type -> Type) a = EnvT e (w a)
- env :: e -> a -> Env e a
- runEnv :: Env e a -> (e, a)
- runEnvT :: EnvT e w a -> (e, w a)
- data Rec (a :: u -> Type) (b :: [u]) where
- class RMap (rs :: [u])
- rtraverse :: forall u h f g (rs :: [u]). Applicative h => (forall (x :: u). f x -> h (g x)) -> Rec f rs -> h (Rec g rs)
- rcast :: forall k1 k2 (rs :: [k1]) (ss :: [k1]) (f :: k2 -> Type) record (is :: [Nat]). (RecSubset record rs ss is, RecSubsetFCtx record f) => record f ss -> record f rs
- data CoRec (a :: u -> Type) (b :: [u]) where
- type (∈) (r :: k) (rs :: [k]) = RElem r rs (RIndex r rs)
- type (:.) (f :: l -> Type) (g :: k -> l) = Compose f g
- data Compose (f :: l -> Type) (g :: k -> l) (x :: k)
- onCompose :: forall l1 k1 l2 f (g :: k1 -> l1) (a :: k1) h (k2 :: k1 -> l2). (f (g a) -> h (k2 a)) -> (f :. g) a -> (h :. k2) a
- class Generic a
- data UTCTime
- data Path b t
- data Rel
- data Abs
- data File
- data Dir
- mkRelDir :: FilePath -> Q Exp
- mkRelFile :: FilePath -> Q Exp
- mkAbsDir :: FilePath -> Q Exp
- mkAbsFile :: FilePath -> Q Exp
- (</>) :: Path b Dir -> Path Rel t -> Path b t
- flip :: (a -> b -> c) -> b -> a -> c
- rights :: [Either a b] -> [b]
- type Type = Type
- data Constraint
- type Exp a = a -> Type
- type family Eval (e :: Exp a) :: a
- type FMap = Map :: (a -> Exp b) -> f a -> f b -> Type
- class (Typeable e, Show e) => Exception e where
- displayException :: e -> String
- data SomeException
Void
Uninhabited data type
Since: base-4.8.0.0
Instances
Eq Void | Since: base-4.8.0.0 |
Data Void | Since: base-4.8.0.0 |
Defined in Data.Void gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Void -> c Void # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Void # dataTypeOf :: Void -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Void) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Void) # gmapT :: (forall b. Data b => b -> b) -> Void -> Void # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Void -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Void -> r # gmapQ :: (forall d. Data d => d -> u) -> Void -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Void -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Void -> m Void # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Void -> m Void # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Void -> m Void # | |
Ord Void | Since: base-4.8.0.0 |
Read Void | Reading a Since: base-4.8.0.0 |
Show Void | Since: base-4.8.0.0 |
Ix Void | Since: base-4.8.0.0 |
Generic Void | Since: base-4.8.0.0 |
Semigroup Void | Since: base-4.9.0.0 |
Hashable Void | |
Defined in Data.Hashable.Class | |
Exception Void | Since: base-4.8.0.0 |
Defined in Data.Void toException :: Void -> SomeException # fromException :: SomeException -> Maybe Void # displayException :: Void -> String # | |
Lift Void | Since: template-haskell-2.15.0.0 |
type Rep Void | |
Since Void
values logically don't exist, this witnesses the
logical reasoning tool of "ex falso quodlibet".
>>>
let x :: Either Void Int; x = Right 5
>>>
:{
case x of Right r -> r Left l -> absurd l :} 5
Since: base-4.8.0.0
Bool
Instances
Numbers
A fixed-precision integer type with at least the range [-2^29 .. 2^29-1]
.
The exact range for a given implementation can be determined by using
minBound
and maxBound
from the Bounded
class.
Instances
StringTextByteString
data ByteString #
A space-efficient representation of a Word8
vector, supporting many
efficient operations.
A ByteString
contains 8-bit bytes, or by using the operations from
Data.ByteString.Char8 it can be interpreted as containing 8-bit
characters.
Instances
A space efficient, packed, unboxed Unicode text type.
Instances
Hashable Text | |
Defined in Data.Hashable.Class | |
Chunk Text | |
Defined in Data.Attoparsec.Internal.Types | |
Ixed Text | |
Defined in Control.Lens.At | |
type State Text | |
Defined in Data.Attoparsec.Internal.Types | |
type ChunkElem Text | |
Defined in Data.Attoparsec.Internal.Types | |
type Item Text | |
type Index Text | |
Defined in Control.Lens.At | |
type IxValue Text | |
Defined in Control.Lens.At |
Conversion of values to readable String
s.
Derived instances of Show
have the following properties, which
are compatible with derived instances of 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
x
is less thand
(associativity is ignored). Thus, ifd
is0
then the result is never surrounded in parentheses; ifd
is11
it 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 a
the 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 = 5
Note that right-associativity of :^:
is ignored. For example,
produces the stringshow
(Leaf 1 :^: Leaf 2 :^: Leaf 3)"Leaf 1 :^: (Leaf 2 :^: Leaf 3)"
.
Instances
Classic Algebra
The class of semigroups (types with an associative binary operation).
Instances should satisfy the following:
Since: base-4.9.0.0
Instances
class Semigroup a => Monoid a where #
The class of monoids (types with an associative binary operation that has an identity). Instances should satisfy the following:
- Right identity
x
<>
mempty
= x- Left identity
mempty
<>
x = x- Associativity
x
(<>
(y<>
z) = (x<>
y)<>
zSemigroup
law)- Concatenation
mconcat
=foldr
(<>
)mempty
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 newtype
s and make those instances
of Monoid
, e.g. Sum
and Product
.
NOTE: Semigroup
is a superclass of Monoid
since base-4.11.0.0.
Instances
Monoid Ordering | Since: base-2.1 |
Monoid () | Since: base-2.1 |
Monoid ByteString | |
Defined in Data.ByteString.Internal mempty :: ByteString # mappend :: ByteString -> ByteString -> ByteString # mconcat :: [ByteString] -> ByteString # | |
Monoid More | |
Monoid IntSet | |
Monoid Doc | |
Monoid ByteArray | |
Monoid [a] | Since: base-2.1 |
Semigroup a => Monoid (Maybe a) | Lift a semigroup into Since 4.11.0: constraint on inner Since: base-2.1 |
Monoid a => Monoid (IO a) | Since: base-4.9.0.0 |
Monoid p => Monoid (Par1 p) | Since: base-4.12.0.0 |
Monoid (IResult a) | |
Monoid (Result a) | |
Monoid (Parser a) | |
Monoid (Predicate a) | |
Monoid (Comparison a) | |
Defined in Data.Functor.Contravariant mempty :: Comparison a # mappend :: Comparison a -> Comparison a -> Comparison a # mconcat :: [Comparison a] -> Comparison a # | |
Monoid (Equivalence a) | |
Defined in Data.Functor.Contravariant mempty :: Equivalence a # mappend :: Equivalence a -> Equivalence a -> Equivalence a # mconcat :: [Equivalence a] -> Equivalence a # | |
(Ord a, Bounded a) => Monoid (Min a) | Since: base-4.9.0.0 |
(Ord a, Bounded a) => Monoid (Max a) | Since: base-4.9.0.0 |
Monoid m => Monoid (WrappedMonoid m) | Since: base-4.9.0.0 |
Defined in Data.Semigroup mempty :: WrappedMonoid m # mappend :: WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m # mconcat :: [WrappedMonoid m] -> WrappedMonoid m # | |
Semigroup a => Monoid (Option a) | Since: base-4.9.0.0 |
Monoid (IntMap a) | |
Monoid (Seq a) | |
Ord a => Monoid (Set a) | |
Monoid (DList a) | |
Prim a => Monoid (Vector a) | |
Storable a => Monoid (Vector a) | |
(Hashable a, Eq a) => Monoid (HashSet a) | O(n+m) To obtain good performance, the smaller set must be presented as the first argument. Examples
|
Monoid (Vector a) | |
Monoid (Doc a) | |
Monoid (PrimArray a) | Since: primitive-0.6.4.0 |
Monoid (SmallArray a) | |
Defined in Data.Primitive.SmallArray mempty :: SmallArray a # mappend :: SmallArray a -> SmallArray a -> SmallArray a # mconcat :: [SmallArray a] -> SmallArray a # | |
Monoid (Array a) | |
Semigroup a => Monoid (Maybe a) | |
(KnownSymbol s, Monoid t) => Monoid (ElField '(s, t)) | |
Monoid (MergeSet a) | |
Monoid b => Monoid (a -> b) | Since: base-2.1 |
Monoid (U1 p) | Since: base-4.12.0.0 |
(Monoid a, Monoid b) => Monoid (a, b) | Since: base-2.1 |
Monoid a => Monoid (Op a b) | |
(Eq k, Hashable k) => Monoid (HashMap k v) | If a key occurs in both maps, the mapping from the first will be the mapping in the result. Examples
|
Ord k => Monoid (Map k v) | |
Monoid (Parser i a) | |
Monoid a => Monoid (s :-> a) | |
Monoid (ReifiedFold s a) | |
Defined in Control.Lens.Reified mempty :: ReifiedFold s a # mappend :: ReifiedFold s a -> ReifiedFold s a -> ReifiedFold s a # mconcat :: [ReifiedFold s a] -> ReifiedFold s a # | |
Monoid (f a) => Monoid (Indexing f a) |
|
(Monoid a, Monoid b) => Monoid (Pair a b) | |
Monoid (f p) => Monoid (Rec1 f p) | Since: base-4.12.0.0 |
(Monoid a, Monoid b, Monoid c) => Monoid (a, b, c) | Since: base-2.1 |
Monoid (Rec f ('[] :: [u])) | |
(Monoid (f r), Monoid (Rec f rs)) => Monoid (Rec f (r ': rs)) | |
(Semigroup a, Monoid a) => Monoid (Tagged s a) | |
Monoid (ReifiedIndexedFold i s a) | |
Defined in Control.Lens.Reified mempty :: ReifiedIndexedFold i s a # mappend :: ReifiedIndexedFold i s a -> ReifiedIndexedFold i s a -> ReifiedIndexedFold i s a # mconcat :: [ReifiedIndexedFold i s a] -> ReifiedIndexedFold i s a # | |
ArrowPlus p => Monoid (Tambara p a b) | |
Reifies s (ReifiedMonoid a) => Monoid (ReflectedMonoid a s) | |
Defined in Data.Reflection mempty :: ReflectedMonoid a s # mappend :: ReflectedMonoid a s -> ReflectedMonoid a s -> ReflectedMonoid a s # mconcat :: [ReflectedMonoid a s] -> ReflectedMonoid a s # | |
Monoid c => Monoid (K1 i c p) | Since: base-4.12.0.0 |
(Monoid (f p), Monoid (g p)) => Monoid ((f :*: g) p) | Since: base-4.12.0.0 |
(Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d) | Since: base-2.1 |
Monoid (f p) => Monoid (M1 i c f p) | Since: base-4.12.0.0 |
Monoid (f (g p)) => Monoid ((f :.: g) p) | Since: base-4.12.0.0 |
(Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e) | Since: base-2.1 |
Monoid (f (g a)) => Monoid (Compose f g a) | |
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, ==
is customarily
expected to implement an equivalence relationship where two values comparing
equal are indistinguishable by "public" functions, with a "public" function
being one not allowing to see implementation details. For example, for a
type representing non-normalised natural numbers modulo 100, a "public"
function doesn't make the difference between 1 and 201. It is expected to
have the following properties: