License | BSD-style |
---|---|
Maintainer | Vincent Hanquez <vincent@snarc.org> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Basement.Compat.Base
Description
internal re-export of all the good base bits
- ($) :: (a -> b) -> a -> b
- ($!) :: (a -> b) -> a -> b
- (&&) :: Bool -> Bool -> Bool
- (||) :: Bool -> Bool -> Bool
- (.) :: Category k cat => forall (b :: k) (c :: k) (a :: k). cat b c -> cat a b -> cat a c
- (<$>) :: Functor f => (a -> b) -> f a -> f b
- not :: Bool -> Bool
- otherwise :: Bool
- fst :: (a, b) -> a
- snd :: (a, b) -> b
- id :: Category k cat => forall (a :: k). cat a a
- maybe :: b -> (a -> b) -> Maybe a -> b
- either :: (a -> c) -> (b -> c) -> Either a b -> c
- flip :: (a -> b -> c) -> b -> a -> c
- const :: a -> b -> a
- error :: HasCallStack => [Char] -> a
- and :: Foldable t => t Bool -> Bool
- undefined :: HasCallStack => a
- seq :: a -> b -> b
- class Show a where
- class Eq a => Ord a where
- class Eq a where
- class Bounded a where
- class Enum a where
- class Functor (f :: * -> *) where
- class Functor f => Applicative (f :: * -> *) where
- class Applicative m => Monad (m :: * -> *) where
- data Maybe a :: * -> *
- data Ordering :: *
- data Bool :: *
- data Int :: *
- data Integer :: *
- data Char :: *
- class Integral a where
- class Fractional a where
- class HasNegation a where
- data Int8 :: *
- data Int16 :: *
- data Int32 :: *
- data Int64 :: *
- data Word8 :: *
- data Word16 :: *
- data Word32 :: *
- data Word64 :: *
- data Word :: *
- data Double :: *
- data Float :: *
- data IO a :: * -> *
- class IsList l where
- class IsString a where
- class Generic a
- data Either a b :: * -> * -> *
- class Typeable * a => Data a where
- mkNoRepType :: String -> DataType
- data DataType :: *
- class Typeable k (a :: k)
- class Monoid a where
- (<>) :: Monoid m => m -> m -> m
- class (Typeable * e, Show e) => Exception e
- throw :: Exception e => e -> a
- throwIO :: Exception e => e -> IO a
- data Ptr a :: * -> * = Ptr Addr#
- ifThenElse :: Bool -> a -> a -> a
- internalError :: [Char] -> a
Documentation
($) :: (a -> b) -> a -> b infixr 0 #
Application operator. This operator is redundant, since ordinary
application (f x)
means the same as (f
. However, $
x)$
has
low, right-associative binding precedence, so it sometimes allows
parentheses to be omitted; for example:
f $ g $ h x = f (g (h x))
It is also useful in higher-order situations, such as
,
or map
($
0) xs
.zipWith
($
) fs xs
($!) :: (a -> b) -> a -> b infixr 0 #
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.
(.) :: Category k cat => forall (b :: k) (c :: k) (a :: k). cat b c -> cat a b -> cat a c infixr 9 #
morphism composition
(<$>) :: Functor f => (a -> b) -> f a -> f b infixl 4 #
An infix synonym for fmap
.
The name of this operator is an allusion to $
.
Note the similarities between their types:
($) :: (a -> b) -> a -> b (<$>) :: Functor f => (a -> b) -> f a -> f b
Whereas $
is function application, <$>
is function
application lifted over a Functor
.
Examples
Convert from a
to a Maybe
Int
using Maybe
String
show
:
>>>
show <$> Nothing
Nothing>>>
show <$> Just 3
Just "3"
Convert from an
to an Either
Int
Int
Either
Int
String
using show
:
>>>
show <$> Left 17
Left 17>>>
show <$> Right 17
Right "17"
Double each element of a list:
>>>
(*2) <$> [1,2,3]
[2,4,6]
Apply even
to the second element of a pair:
>>>
even <$> (2,2)
(2,True)
maybe :: b -> (a -> b) -> Maybe a -> b #
The maybe
function takes a default value, a function, and a Maybe
value. If the Maybe
value is Nothing
, the function returns the
default value. Otherwise, it applies the function to the value inside
the Just
and returns the result.
Examples
Basic usage:
>>>
maybe False odd (Just 3)
True
>>>
maybe False odd Nothing
False
Read an integer from a string using readMaybe
. If we succeed,
return twice the integer; that is, apply (*2)
to it. If instead
we fail to parse an integer, return 0
by default:
>>>
import Text.Read ( readMaybe )
>>>
maybe 0 (*2) (readMaybe "5")
10>>>
maybe 0 (*2) (readMaybe "")
0
Apply show
to a Maybe Int
. If we have Just n
, we want to show
the underlying Int
n
. But if we have Nothing
, we return the
empty string instead of (for example) "Nothing":
>>>
maybe "" show (Just 5)
"5">>>
maybe "" show Nothing
""
either :: (a -> c) -> (b -> c) -> Either a b -> c #
Case analysis for the Either
type.
If the value is
, apply the first function to Left
aa
;
if it is
, apply the second function to Right
bb
.
Examples
We create two values of type
, one using the
Either
String
Int
Left
constructor and another using the Right
constructor. Then
we apply "either" the length
function (if we have a String
)
or the "times-two" function (if we have an Int
):
>>>
let s = Left "foo" :: Either String Int
>>>
let n = Right 3 :: Either String Int
>>>
either length (*2) s
3>>>
either length (*2) n
6
flip :: (a -> b -> c) -> b -> a -> c #
takes its (first) two arguments in the reverse order of flip
ff
.
const x
is a unary function which evaluates to x
for all inputs.
For instance,
>>>
map (const 42) [0..3]
[42,42,42,42]
error :: HasCallStack => [Char] -> a #
error
stops execution and displays an error message.
undefined :: HasCallStack => a #
The value of seq a b
is bottom if a
is bottom, and
otherwise equal to b
. seq
is usually introduced to
improve performance by avoiding unneeded laziness.
A note on evaluation order: the expression seq a b
does
not guarantee that a
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.
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)"
.
Methods
Arguments
:: Int | the operator precedence of the enclosing
context (a number from |
-> a | the value to be converted to a |
-> ShowS |
Convert a value to a readable String
.
showsPrec
should satisfy the law
showsPrec d x r ++ s == showsPrec d x (r ++ s)
Derived instances of Read
and Show
satisfy the following:
That is, readsPrec
parses the string produced by
showsPrec
, and delivers the value that showsPrec
started with.
Instances
Show Bool | |
Show Char | Since: 2.1 |
Show Int | Since: 2.1 |
Show Int8 | Since: 2.1 |
Show Int16 | Since: 2.1 |
Show Int32 | Since: 2.1 |
Show Int64 | Since: 2.1 |
Show Integer | Since: 2.1 |
Show Natural | Since: 4.8.0.0 |
Show Ordering | |
Show Word | Since: 2.1 |
Show Word8 | Since: 2.1 |
Show Word16 | Since: 2.1 |
Show Word32 | Since: 2.1 |
Show Word64 | Since: 2.1 |
Show CallStack | Since: 4.9.0.0 |
Show SomeTypeRep | Since: 4.10.0.0 |
Show () | |
Show TyCon | Since: 2.1 |
Show Module | Since: 4.9.0.0 |
Show TrName | Since: 4.9.0.0 |
Show Void | Since: 4.8.0.0 |
Show DataType | |
Show Constr | Since: 4.0.0.0 |
Show DataRep | |
Show ConstrRep | |
Show Fixity | |
Show Version | |
Show CDev | |
Show CIno | |
Show CMode | |
Show COff | |
Show CPid | |
Show CSsize | |
Show CGid | |
Show CNlink | |
Show CUid | |
Show CCc | |
Show CSpeed | |
Show CTcflag | |
Show CRLim | |
Show CBlkSize | |
Show CBlkCnt | |
Show CClockId | |
Show CFsBlkCnt | |
Show CFsFilCnt | |
Show CId | |
Show CKey | |
Show CTimer | |
Show Fd | |
Show BlockedIndefinitelyOnMVar | Since: 4.1.0.0 |
Show BlockedIndefinitelyOnSTM | Since: 4.1.0.0 |
Show Deadlock | Since: 4.1.0.0 |
Show AllocationLimitExceeded | Since: 4.7.1.0 |
Show CompactionFailed | Since: 4.10.0.0 |
Show AssertionFailed | Since: 4.1.0.0 |
Show SomeAsyncException | Since: 4.7.0.0 |
Show AsyncException | Since: 4.1.0.0 |
Show ArrayException | Since: 4.1.0.0 |
Show ExitCode | |
Show IOErrorType | Since: 4.1.0.0 |
Show MaskingState | |
Show IOException | Since: 4.1.0.0 |
Show ErrorCall | Since: 4.0.0.0 |
Show ArithException | Since: 4.0.0.0 |
Show All | |
Show Any | |
Show Fixity | |
Show Associativity | |
Show SourceUnpackedness | |
Show SourceStrictness | |
Show DecidedStrictness | |
Show SomeSymbol | Since: 4.7.0.0 |
Show SomeNat | Since: 4.7.0.0 |
Show CChar | |
Show CSChar | |
Show CUChar | |
Show CShort | |
Show CUShort | |
Show CInt | |
Show CUInt | |
Show CLong | |
Show CULong | |
Show CLLong | |
Show CULLong | |
Show CBool | |
Show CFloat | |
Show CDouble | |
Show CPtrdiff | |
Show CSize | |
Show CWchar | |
Show CSigAtomic | |
Show CClock | |
Show CTime | |
Show CUSeconds | |
Show CSUSeconds | |
Show CIntPtr | |
Show CUIntPtr | |
Show CIntMax | |
Show CUIntMax | |
Show WordPtr | |
Show IntPtr | |
Show GeneralCategory | |
Show SomeException | Since: 3.0 |
Show SrcLoc | |
Show Endianness # | |
Show Char7 # | |
Show Word128 # | |
Show Word256 # | |
Show FileSize # | |
Show NonEmptyCollectionIsEmpty # | |
Show InvalidRecast # | |
Show RecastDestinationSize # | |
Show RecastSourceSize # | |
Show OutOfBound # | |
Show OutOfBoundOperation # | |
Show AsciiString # | |
Show ValidationFailure # | |
Show String # | |
Show Encoding # | |
Show a => Show [a] | Since: 2.1 |
Show a => Show (Maybe a) | |
Show a => Show (Ratio a) | Since: 2.0.1 |
Show (Ptr a) | Since: 2.1 |
Show (FunPtr a) | Since: 2.1 |
Show p => Show (Par1 p) | |
Show a => Show (Min a) | |
Show a => Show (Max a) | |
Show a => Show (First a) | |
Show a => Show (Last a) | |
Show m => Show (WrappedMonoid m) | |
Show a => Show (Option a) | |
Show a => Show (NonEmpty a) | |
Show a => Show (ZipList a) | |
Show a => Show (Identity a) | This instance would be equivalent to the derived instances of the
Since: 4.8.0.0 |
Show (ForeignPtr a) | Since: 2.1 |
Show a => Show (Dual a) | |
Show a => Show (Sum a) | |
Show a => Show (Product a) | |
Show a => Show (First a) | |
Show a => Show (Last a) | |
Show a => Show (BE a) # | |
Show a => Show (LE a) # | |
Show (FinalPtr a) # | |
Show (Zn n) # | |
Show (Zn64 n) # | |
Show (CountOf ty) # | |
Show (Offset ty) # | |
Show a => Show (NonEmpty a) # | |
(PrimType ty, Show ty) => Show (Block ty) # | |
(PrimType ty, Show ty) => Show (UArray ty) # | |
Show a => Show (Array a) # | |
(Show b, Show a) => Show (Either a b) | |
Show (V1 k p) | |
Show (U1 k p) | Since: 4.9.0.0 |
Show (TypeRep k a) | |
(Show a, Show b) => Show (a, b) | Since: 2.1 |
(Show b, Show a) => Show (Arg a b) | |
Show (Proxy k s) | Since: 4.7.0.0 |
Show (ST s a) | Since: 2.1 |
(Show b, Show a) => Show (These a b) # | |
Show a => Show (ListN n a) # | |
(Show a, PrimType a) => Show (BlockN n a) # | |
Show a => Show (Vect n a) # | |
(Show a, PrimType a) => Show (UVect n a) # | |
Show (f p) => Show (Rec1 k f p) | |
Show (URec k Char p) | |
Show (URec k Double p) | |
Show (URec k Float p) | |
Show (URec k Int p) | |
Show (URec k Word p) | |
(Show a, Show b, Show c) => Show (a, b, c) | Since: 2.1 |
Show a => Show (Const k a b) | This instance would be equivalent to the derived instances of the
Since: 4.8.0.0 |
Show (f a) => Show (Alt k f a) | |
Show ((:~:) k a b) | |
Show c => Show (K1 k i c p) | |
(Show (g p), Show (f p)) => Show ((:+:) k f g p) | |
(Show (g p), Show (f p)) => Show ((:*:) k f g p) | |
(Show a, Show b, Show c, Show d) => Show (a, b, c, d) | Since: 2.1 |
Show ((:~~:) k1 k2 a b) | Since: 4.10.0.0 |
Show (f p) => Show (M1 k i c f p) | |
Show (f (g p)) => Show ((:.:) k2 k1 f g p) | |
(Show a, Show b, Show c, Show d, Show e) => Show (a, b, c, d, e) | Since: 2.1 |
(Show a, Show b, Show c, Show d, Show e, Show f) => Show (a, b, c, d, e, f) | Since: 2.1 |
(Show a, Show b, Show c, Show d, Show e, Show f, Show g) => Show (a, b, c, d, e, f, g) | Since: 2.1 |
(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) | Since: 2.1 |
(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) | Since: 2.1 |
(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) | Since: 2.1 |
(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) | Since: 2.1 |
(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) | Since: 2.1 |
(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) | Since: 2.1 |
(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) | Since: 2.1 |
(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) | Since: 2.1 |
The Ord
class is used for totally ordered datatypes.
Instances of Ord
can be derived for any user-defined
datatype whose constituent types are in Ord
. The declared order
of the constructors in the data declaration determines the ordering
in derived Ord
instances. The Ordering
datatype allows a single
comparison to determine the precise ordering of two objects.
Minimal complete definition: either compare
or <=
.
Using compare
can be more efficient for complex types.
Methods
compare :: a -> a -> Ordering #
(<) :: a -> a -> Bool infix 4 #
(<=) :: a -> a -> Bool infix 4 #
(>) :: a -> a -> Bool infix 4 #
Instances
Ord Bool | |
Ord Char | |
Ord Double | |
Ord Float | |
Ord Int | |
Ord Int8 | Since: 2.1 |
Ord Int16 | Since: 2.1 |
Ord Int32 | Since: 2.1 |
Ord Int64 | Since: 2.1 |
Ord Integer | |
Ord Natural | |
Ord Ordering | |
Ord Word | |
Ord Word8 | Since: 2.1 |
Ord Word16 | Since: 2.1 |
Ord Word32 | Since: 2.1 |
Ord Word64 | Since: 2.1 |
Ord SomeTypeRep | |
Ord () | |
Ord TyCon | |
Ord BigNat | |
Ord Void | Since: 4.8.0.0 |
Ord Version | Since: 2.1 |
Ord CDev | |
Ord CIno | |
Ord CMode | |
Ord COff | |
Ord CPid | |
Ord CSsize | |
Ord CGid | |
Ord CNlink | |
Ord CUid | |
Ord CCc | |
Ord CSpeed | |
Ord CTcflag | |
Ord CRLim | |
Ord CBlkSize | |
Ord CBlkCnt | |
Ord CClockId | |
Ord CFsBlkCnt | |
Ord CFsFilCnt | |
Ord CId | |
Ord CKey | |
Ord CTimer | |
Ord Fd | |
Ord AsyncException | |
Ord ArrayException | |
Ord ExitCode | |
Ord ErrorCall | |
Ord ArithException | |
Ord All | |
Ord Any | |
Ord Fixity | |
Ord Associativity | |
Ord SourceUnpackedness | |
Ord SourceStrictness | |
Ord DecidedStrictness | |
Ord SomeSymbol | Since: 4.7.0.0 |
Ord SomeNat | Since: 4.7.0.0 |
Ord CChar | |
Ord CSChar | |
Ord CUChar | |
Ord CShort | |
Ord CUShort | |
Ord CInt | |
Ord CUInt | |
Ord CLong | |
Ord CULong | |
Ord CLLong | |
Ord CULLong | |
Ord CBool | |
Ord CFloat | |
Ord CDouble | |
Ord CPtrdiff | |
Ord CSize | |
Ord CWchar | |
Ord CSigAtomic | |
Ord CClock | |
Ord CTime | |
Ord CUSeconds | |
Ord CSUSeconds | |
Ord CIntPtr | |
Ord CUIntPtr | |
Ord CIntMax | |
Ord CUIntMax | |
Ord WordPtr | |
Ord IntPtr | |
Ord GeneralCategory | |
Ord Char7 # | |
Ord Word128 # | |
Ord Word256 # | |
Ord FileSize # | |
Ord Addr # | |
Ord AsciiString # | |
Ord String # | |
Ord Encoding # | |
Ord a => Ord [a] | |
Ord a => Ord (Maybe a) | |
Integral a => Ord (Ratio a) | Since: 2.0.1 |
Ord (Ptr a) | |
Ord (FunPtr a) | |
Ord p => Ord (Par1 p) | |
Ord a => Ord (Min a) | |
Ord a => Ord (Max a) | |
Ord a => Ord (First a) | |
Ord a => Ord (Last a) | |
Ord m => Ord (WrappedMonoid m) | |
Ord a => Ord (Option a) | |
Ord a => Ord (NonEmpty a) | |
Ord a => Ord (ZipList a) | |
Ord a => Ord (Identity a) | |
Ord (ForeignPtr a) | Since: 2.1 |
Ord a => Ord (Dual a) | |
Ord a => Ord (Sum a) | |
Ord a => Ord (Product a) | |
Ord a => Ord (First a) | |
Ord a => Ord (Last a) | |
(ByteSwap a, Ord a) => Ord (BE a) # | |
(ByteSwap a, Ord a) => Ord (LE a) # | |
Ord (FinalPtr a) # | |
Ord (Zn n) # | |
Ord (Zn64 n) # | |
Ord (CountOf ty) # | |
Ord (Offset ty) # | |
(PrimType ty, Ord ty) => Ord (Block ty) # | |
(PrimType ty, Ord ty) => Ord (UArray ty) # | |
Ord a => Ord (Array a) # | |
(Ord b, Ord a) => Ord (Either a b) | |
Ord (V1 k p) | |
Ord (U1 k p) | Since: 4.9.0.0 |
Ord (TypeRep k a) | Since: 4.4.0.0 |
(Ord a, Ord b) => Ord (a, b) | |
Ord a => Ord (Arg a b) | Since: 4.9.0.0 |
Ord (Proxy k s) | Since: 4.7.0.0 |
(Ord b, Ord a) => Ord (These a b) # | |
Ord a => Ord (ListN n a) # | |
Ord (f p) => Ord (Rec1 k f p) | |
Ord (URec k (Ptr ()) p) | |
Ord (URec k Char p) | |
Ord (URec k Double p) | |
Ord (URec k Float p) | |
Ord (URec k Int p) | |
Ord (URec k Word p) | |
(Ord a, Ord b, Ord c) => Ord (a, b, c) | |
Ord a => Ord (Const k a b) | |
Ord (f a) => Ord (Alt k f a) | |
Ord ((:~:) k a b) | |
Ord c => Ord (K1 k i c p) | |
(Ord (g p), Ord (f p)) => Ord ((:+:) k f g p) | |
(Ord (g p), Ord (f p)) => Ord ((:*:) k f g p) | |
(Ord a, Ord b, Ord c, Ord d) => Ord (a, b, c, d) | |
Ord ((:~~:) k1 k2 a b) | Since: 4.10.0.0 |
Ord (f p) => Ord (M1 k i c f p) | |
Ord (f (g p)) => Ord ((:.:) k2 k1 f g p) | |
(Ord a, Ord b, Ord c, Ord d, Ord e) => Ord (a, b, c, d, e) | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f) => Ord (a, b, c, d, e, f) | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g) => Ord (a, b, c, d, e, f, g) | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h) => Ord (a, b, c, d, e, f, g, h) | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i) => Ord (a, b, c, d, e, f, g, h, i) | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j) => Ord (a, b, c, d, e, f, g, h, i, j) | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k) => Ord (a, b, c, d, e, f, g, h, i, j, k) | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l) => Ord (a, b, c, d, e, f, g, h, i, j, k, l) | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m) => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m) | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m, Ord n) => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m, n) | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m, Ord n, Ord o) => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) | |
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
.
Instances
Eq Bool | |
Eq Char | |
Eq Double | |
Eq Float | |
Eq Int | |
Eq Int8 | Since: 2.1 |
Eq Int16 | Since: 2.1 |
Eq Int32 | Since: 2.1 |
Eq Int64 | Since: 2.1 |
Eq Integer | |
Eq Natural | |
Eq Ordering | |
Eq Word | |
Eq Word8 | Since: 2.1 |
Eq Word16 | Since: 2.1 |
Eq Word32 | Since: 2.1 |
Eq Word64 | Since: 2.1 |
Eq SomeTypeRep | |
Eq () | |
Eq TyCon | |
Eq Module | |
Eq TrName | |
Eq BigNat | |
Eq Void | Since: 4.8.0.0 |
Eq SpecConstrAnnotation | |
Eq Constr | Equality of constructors Since: 4.0.0.0 |
Eq DataRep | |
Eq ConstrRep | |
Eq Fixity | |
Eq Version | Since: 2.1 |
Eq CDev | |
Eq CIno | |
Eq CMode | |
Eq COff | |
Eq CPid | |
Eq CSsize | |
Eq CGid | |
Eq CNlink | |
Eq CUid | |
Eq CCc | |
Eq CSpeed | |
Eq CTcflag | |
Eq CRLim | |
Eq CBlkSize | |
Eq CBlkCnt | |
Eq CClockId | |
Eq CFsBlkCnt | |
Eq CFsFilCnt | |
Eq CId | |
Eq CKey | |
Eq CTimer | |
Eq Fd | |
Eq AsyncException | |
Eq ArrayException | |
Eq ExitCode | |
Eq IOErrorType | Since: 4.1.0.0 |
Eq MaskingState | |
Eq IOException | Since: 4.1.0.0 |
Eq ErrorCall | |
Eq ArithException | |
Eq All | |
Eq Any | |
Eq Fixity | |
Eq Associativity | |
Eq SourceUnpackedness | |
Eq SourceStrictness | |
Eq DecidedStrictness | |
Eq SomeSymbol | Since: 4.7.0.0 |
Eq SomeNat | Since: 4.7.0.0 |
Eq CChar | |
Eq CSChar | |
Eq CUChar | |
Eq CShort | |
Eq CUShort | |
Eq CInt | |
Eq CUInt | |
Eq CLong | |
Eq CULong | |
Eq CLLong | |
Eq CULLong | |
Eq CBool | |
Eq CFloat | |
Eq CDouble | |
Eq CPtrdiff | |
Eq CSize | |
Eq CWchar | |
Eq CSigAtomic | |
Eq CClock | |
Eq CTime | |
Eq CUSeconds | |
Eq CSUSeconds | |
Eq CIntPtr | |
Eq CUIntPtr | |
Eq CIntMax | |
Eq CUIntMax | |
Eq WordPtr | |
Eq IntPtr | |
Eq GeneralCategory | |
Eq SrcLoc | |
Eq PinnedStatus # | |
Eq Endianness # | |
Eq Char7 # | |
Eq Word128 # | |
Eq Word256 # | |
Eq FileSize # | |
Eq Addr # | |
Eq RecastDestinationSize # | |
Eq RecastSourceSize # | |
Eq OutOfBoundOperation # | |
Eq AsciiString # | |
Eq ValidationFailure # | |
Eq String # | |
Eq Encoding # | |
Eq a => Eq [a] | |
Eq a => Eq (Maybe a) | |
Eq a => Eq (Ratio a) | |
Eq (Ptr a) | |
Eq (FunPtr a) | |
Eq p => Eq (Par1 p) | |
Eq a => Eq (Min a) | |
Eq a => Eq (Max a) | |
Eq a => Eq (First a) | |
Eq a => Eq (Last a) | |
Eq m => Eq (WrappedMonoid m) | |
Eq a => Eq (Option a) | |
Eq a => Eq (NonEmpty a) | |
Eq a => Eq (ZipList a) | |
Eq a => Eq (Identity a) | |
Eq (ForeignPtr a) | Since: 2.1 |
Eq (IORef a) | Since: 4.1.0.0 |
Eq a => Eq (Dual a) | |
Eq a => Eq (Sum a) | |
Eq a => Eq (Product a) | |
Eq a => Eq (First a) | |
Eq a => Eq (Last a) | |
Eq a => Eq (BE a) # | |
Eq a => Eq (LE a) # | |
Eq (FinalPtr a) # | |
Eq (Zn n) # | |
Eq (Zn64 n) # | |
Eq (CountOf ty) # | |
Eq (Offset ty) # | |
Eq a => Eq (NonEmpty a) # | |
(PrimType ty, Eq ty) => Eq (Block ty) # | |
(PrimType ty, Eq ty) => Eq (UArray ty) # | |
Eq a => Eq (Array a) # | |
(Eq b, Eq a) => Eq (Either a b) | |
Eq (V1 k p) | |
Eq (U1 k p) | Since: 4.9.0.0 |
Eq (TypeRep k a) | Since: 2.1 |
(Eq a, Eq b) => Eq (a, b) | |
Eq a => Eq (Arg a b) | Since: 4.9.0.0 |
Eq (Proxy k s) | Since: 4.7.0.0 |
Eq (STRef s a) | Since: 2.1 |
(Eq b, Eq a) => Eq (These a b) # | |
Eq a => Eq (ListN n a) # | |
PrimType a => Eq (BlockN n a) # | |
Eq a => Eq (Vect n a) # | |
PrimType a => Eq (UVect n a) # | |
Eq (f p) => Eq (Rec1 k f p) | |
Eq (URec k (Ptr ()) p) | |
Eq (URec k Char p) | |
Eq (URec k Double p) | |
Eq (URec k Float p) | |
Eq (URec k Int p) | |
Eq (URec k Word p) | |
(Eq a, Eq b, Eq c) => Eq (a, b, c) | |
Eq a => Eq (Const k a b) | |
Eq (f a) => Eq (Alt k f a) | |
Eq ((:~:) k a b) | |
Eq c => Eq (K1 k i c p) | |
(Eq (g p), Eq (f p)) => Eq ((:+:) k f g p) | |
(Eq (g p), Eq (f p)) => Eq ((:*:) k f g p) | |
(Eq a, Eq b, Eq c, Eq d) => Eq (a, b, c, d) | |
Eq ((:~~:) k1 k2 a b) | Since: 4.10.0.0 |
Eq (f p) => Eq (M1 k i c f p) | |
Eq (f (g p)) => Eq ((:.:) k2 k1 f g p) | |
(Eq a, Eq b, Eq c, Eq d, Eq e) => Eq (a, b, c, d, e) | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => Eq (a, b, c, d, e, f) | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g) => Eq (a, b, c, d, e, f, g) | |
(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) | |
(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) | |
(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) | |
(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) | |
(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) | |
(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) | |
(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) | |
(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) | |
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
.
Instances
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
andsucc
maxBound
should result in a runtime error.pred
minBound
fromEnum
andtoEnum
should give a runtime error if the result value is not representable in the result type. For example,
is an error.toEnum
7 ::Bool
enumFrom
andenumFromThen
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 = minBound
Methods
the successor of a value. For numeric types, succ
adds 1.
the predecessor of a value. For numeric types, pred
subtracts 1.
Convert from an Int
.
Convert to an Int
.
It is implementation-dependent what fromEnum
returns when
applied to a value that is too large to fit in an Int
.
Used in Haskell's translation of [n..]
.
enumFromThen :: a -> a -> [a] #
Used in Haskell's translation of [n,n'..]
.
enumFromTo :: a -> a -> [a] #
Used in Haskell's translation of [n..m]
.
enumFromThenTo :: a -> a -> a -> [a] #
Used in Haskell's translation of [n,n'..m]
.
Instances
class Functor (f :: * -> *) where #
The Functor
class is used for types that can be mapped over.
Instances of Functor
should satisfy the following laws:
fmap id == id fmap (f . g) == fmap f . fmap g
The instances of Functor
for lists, Maybe
and IO
satisfy these laws.
Minimal complete definition
Instances
class Functor f => Applicative (f :: * -> *) where #
A functor with application, providing operations to
A minimal complete definition must include implementations of pure
and of either <*>
or liftA2
. If it defines both, then they must behave
the same as their default definitions:
(
<*>
) = liftA2
id
liftA2
f x y = f <$>
x <*>
y
Further, any definition must satisfy the following:
- identity
pure
id
<*>
v = v- composition
pure
(.)<*>
u<*>
v<*>
w = u<*>
(v<*>
w)- homomorphism
pure
f<*>
pure
x =pure
(f x)- interchange
u
<*>
pure
y =pure
($
y)<*>
u
The other methods have the following default definitions, which may be overridden with equivalent specialized implementations:
As a consequence of these laws, the Functor
instance for f
will satisfy
It may be useful to note that supposing
forall x y. p (q x y) = f x . g y
it follows from the above that
liftA2
p (liftA2
q u v) =liftA2
f u .liftA2
g v
If f
is also a Monad
, it should satisfy
(which implies that pure
and <*>
satisfy the applicative functor laws).
Methods
Lift a value.
(<*>) :: f (a -> b) -> f a -> f b infixl 4 #
Sequential application.
A few functors support an implementation of <*>
that is more
efficient than the default one.
liftA2 :: (a -> b -> c) -> f a -> f b -> f c #
Lift a binary function to actions.
Some functors support an implementation of liftA2
that is more
efficient than the default one. In particular, if fmap
is an
expensive operation, it is likely better to use liftA2
than to
fmap
over the structure and then use <*>
.
(*>) :: f a -> f b -> f b infixl 4 #
Sequence actions, discarding the value of the first argument.
(<*) :: f a -> f b -> f a infixl 4 #
Sequence actions, discarding the value of the second argument.
Instances
Applicative [] | Since: 2.1 |
Applicative Maybe | Since: 2.1 |
Applicative IO | Since: 2.1 |
Applicative Par1 | Since: 4.9.0.0 |
Applicative Min | Since: 4.9.0.0 |
Applicative Max | Since: 4.9.0.0 |
Applicative First | Since: 4.9.0.0 |
Applicative Last | Since: 4.9.0.0 |
Applicative Option | Since: 4.9.0.0 |
Applicative NonEmpty | Since: 4.9.0.0 |
Applicative ZipList | f '<$>' 'ZipList' xs1 '<*>' ... '<*>' 'ZipList' xsN
|
Applicative Identity | Since: 4.8.0.0 |
Applicative Dual | Since: 4.8.0.0 |
Applicative Sum | Since: 4.8.0.0 |
Applicative Product | Since: 4.8.0.0 |
Applicative First | |
Applicative Last | |
Applicative (Either e) | Since: 3.0 |
Applicative (U1 *) | Since: 4.9.0.0 |
Monoid a => Applicative ((,) a) | For tuples, the ("hello ", (+15)) <*> ("world!", 2002) ("hello world!",2017) Since: 2.1 |
Monad m => Applicative (WrappedMonad m) | Since: 2.1 |
Arrow a => Applicative (ArrowMonad a) | Since: 4.6.0.0 |
Applicative (Proxy *) | Since: 4.7.0.0 |
Applicative (ST s) | Since: 4.4.0.0 |
Applicative f => Applicative (Rec1 * f) | Since: 4.9.0.0 |
Arrow a => Applicative (WrappedArrow a b) | Since: 2.1 |
Monoid m => Applicative (Const * m) | Since: 2.0.1 |
Applicative f => Applicative (Alt * f) | |
Monad m => Applicative (Reader r m) # | |
Monad m => Applicative (State s m) # | |
Applicative ((->) LiftedRep LiftedRep a) | Since: 2.1 |
(Applicative f, Applicative g) => Applicative ((:*:) * f g) | Since: 4.9.0.0 |
Applicative f => Applicative (M1 * i c f) | Since: 4.9.0.0 |
(Applicative f, Applicative g) => Applicative ((:.:) * * f g) | Since: 4.9.0.0 |
Monad state => Applicative (Builder collection mutCollection step state err) # | |
class Applicative m => Monad (m :: * -> *) where #
The Monad
class defines the basic operations over a monad,
a concept from a branch of mathematics known as category theory.
From the perspective of a Haskell programmer, however, it is best to
think of a monad as an abstract datatype of actions.
Haskell's do
expressions provide a convenient syntax for writing
monadic expressions.
Instances of Monad
should satisfy the following laws:
Furthermore, the Monad
and Applicative
operations should relate as follows:
The above laws imply:
and that pure
and (<*>
) satisfy the applicative functor laws.
The instances of Monad
for lists, Maybe
and IO
defined in the Prelude satisfy these laws.
Minimal complete definition
Methods
(>>=) :: m a -> (a -> m b) -> m b infixl 1 #
Sequentially compose two actions, passing any value produced by the first as an argument to the second.
(>>) :: m a -> m b -> m b infixl 1 #
Sequentially compose two actions, discarding any value produced by the first, like sequencing operators (such as the semicolon) in imperative languages.
Inject a value into the monadic type.
Fail with a message. This operation is not part of the
mathematical definition of a monad, but is invoked on pattern-match
failure in a do
expression.
As part of the MonadFail proposal (MFP), this function is moved
to its own class MonadFail
(see Control.Monad.Fail for more
details). The definition here will be removed in a future
release.
Instances
Monad [] | Since: 2.1 |
Monad Maybe | Since: 2.1 |
Monad IO | Since: 2.1 |
Monad Par1 | Since: 4.9.0.0 |
Monad Min | Since: 4.9.0.0 |
Monad Max | Since: 4.9.0.0 |
Monad First | Since: 4.9.0.0 |
Monad Last | Since: 4.9.0.0 |
Monad Option | Since: 4.9.0.0 |
Monad NonEmpty | Since: 4.9.0.0 |
Monad Identity | Since: 4.8.0.0 |
Monad Dual | Since: 4.8.0.0 |
Monad Sum | Since: 4.8.0.0 |
Monad Product | Since: 4.8.0.0 |
Monad First | |
Monad Last | |
Monad (Either e) | Since: 4.4.0.0 |
Monad (U1 *) | Since: 4.9.0.0 |
Monoid a => Monad ((,) a) | Since: 4.9.0.0 |
Monad m => Monad (WrappedMonad m) | |
ArrowApply a => Monad (ArrowMonad a) | Since: 2.1 |
Monad (Proxy *) | Since: 4.7.0.0 |
Monad (ST s) | Since: 2.1 |
Monad f => Monad (Rec1 * f) | Since: 4.9.0.0 |
Monad f => Monad (Alt * f) | |
Monad m => Monad (Reader r m) # | |
Monad m => Monad (State r m) # | |
Monad ((->) LiftedRep LiftedRep r) | Since: 2.1 |
(Monad f, Monad g) => Monad ((:*:) * f g) | Since: 4.9.0.0 |
Monad f => Monad (M1 * i c f) | Since: 4.9.0.0 |
Monad state => Monad (Builder collection mutCollection step state err) # | |
The Maybe
type encapsulates an optional value. A value of type
either contains a value of type Maybe
aa
(represented as
),
or it is empty (represented as Just
aNothing
). Using Maybe
is a good way to
deal with errors or exceptional cases without resorting to drastic
measures such as error
.
The Maybe
type is also a monad. It is a simple kind of error
monad, where all errors are represented by Nothing
. A richer
error monad can be built using the Either
type.
Instances
Monad Maybe | Since: 2.1 |
Functor Maybe | Since: 2.1 |
Applicative Maybe | Since: 2.1 |
Foldable Maybe | Since: 2.1 |
Traversable Maybe | Since: 2.1 |
Alternative Maybe | Since: 2.1 |
MonadPlus Maybe | Since: 2.1 |
MonadFailure Maybe Source # | |
Eq a => Eq (Maybe a) | |
Data a => Data (Maybe a) | Since: 4.0.0.0 |
Ord a => Ord (Maybe a) | |
Read a => Read (Maybe a) | Since: 2.1 |
Show a => Show (Maybe a) | |
Generic (Maybe a) | |
Semigroup a => Semigroup (Maybe a) | Since: 4.9.0.0 |
Monoid a => Monoid (Maybe a) | Lift a semigroup into Since: 2.1 |
SingKind a => SingKind (Maybe a) | Since: 4.9.0.0 |
NormalForm a => NormalForm (Maybe a) Source # | |
Generic1 * Maybe | |
SingI (Maybe a) (Nothing a) | Since: 4.9.0.0 |
SingI a1 a2 => SingI (Maybe a1) (Just a1 a2) | Since: 4.9.0.0 |
From (Maybe a) (Either () a) Source # | |
type Failure Maybe Source # | |
type Rep (Maybe a) | |
data Sing (Maybe a) | |
type DemoteRep (Maybe a) | |
type Rep1 * Maybe | |
type (==) (Maybe k) a b | |
Instances
Bounded Bool | Since: 2.1 |
Enum Bool | Since: 2.1 |
Eq Bool | |
Data Bool | Since: 4.0.0.0 |
Ord Bool | |
Read Bool | Since: 2.1 |
Show Bool | |
Generic Bool | |
SingKind Bool | Since: 4.9.0.0 |
Storable Bool | Since: 2.1 |
Bits Bool | Interpret Since: 4.7.0.0 |
FiniteBits Bool | Since: 4.7.0.0 |
NormalForm Bool Source # | |
SingI Bool False | Since: 4.9.0.0 |
SingI Bool True | Since: 4.9.0.0 |
type Rep Bool | |
data Sing Bool | |
type DemoteRep Bool | |
type (==) Bool a b | |
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
Invariant: Jn#
and Jp#
are used iff value doesn't fit in S#
Useful properties resulting from the invariants:
Instances
The character type Char
is an enumeration whose values represent
Unicode (or equivalently ISO/IEC 10646) characters (see
http://www.unicode.org/ for details). This set extends the ISO 8859-1
(Latin-1) character set (the first 256 characters), which is itself an extension
of the ASCII character set (the first 128 characters). A character literal in
Haskell has type Char
.
To convert a Char
to or from the corresponding Int
value defined
by Unicode, use toEnum
and fromEnum
from the
Enum
class respectively (or equivalently ord
and chr
).
Instances
Bounded Char | Since: 2.1 |
Enum Char | Since: 2.1 |
Eq Char | |
Data Char | Since: 4.0.0.0 |
Ord Char | |
Read Char | Since: 2.1 |
Show Char | Since: 2.1 |
Storable Char | Since: 2.1 |
Subtractive Char Source # | |
PrimMemoryComparable Char Source # | |
PrimType Char Source # | |
NormalForm Char Source # | |
Generic1 k (URec k Char) | |
Functor (URec * Char) | |
Foldable (URec * Char) | |
Traversable (URec * Char) | |
Eq (URec k Char p) | |
Ord (URec k Char p) | |
Show (URec k Char p) | |
Generic (URec k Char p) | |
type NatNumMaxBound Char Source # | |
type Difference Char Source # | |
type PrimSize Char Source # | |
data URec k Char | Used for marking occurrences of Since: 4.9.0.0 |
type Rep1 k (URec k Char) | |
type Rep (URec k Char p) | |
class Integral a where Source #
Integral Literal support
e.g. 123 :: Integer 123 :: Word8
Minimal complete definition
Methods
fromInteger :: Integer -> a Source #
Instances
class Fractional a where Source #
Fractional Literal support
e.g. 1.2 :: Double 0.03 :: Float
Minimal complete definition
Methods
fromRational :: Rational -> a Source #
class HasNegation a where Source #
Negation support
e.g. -(f x)
Minimal complete definition
Instances
8-bit signed integer type
Instances
16-bit signed integer type
Instances
32-bit signed integer type
Instances
64-bit signed integer type
Instances
8-bit unsigned integer type
Instances
16-bit unsigned integer type
Instances
32-bit unsigned integer type
Instances
64-bit unsigned integer type
Instances
Instances
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.
Instances
Eq Double | |
Floating Double | Since: 2.1 |
Data Double | Since: 4.0.0.0 |
Ord Double | |
Read Double | Since: 2.1 |
RealFloat Double | Since: 2.1 |
Storable Double | Since: 2.1 |
HasNegation Double Source # | |
Fractional Double Source # | |
Integral Double Source # | |
Subtractive Double Source # | |
Additive Double Source # | |
Divisible Double Source # | |
Multiplicative Double Source # | |
PrimType Double Source # | |
NormalForm Double Source # | |
Generic1 k (URec k Double) | |
Functor (URec * Double) | |
Foldable (URec * Double) | |
Traversable (URec * Double) | |
Eq (URec k Double p) | |
Ord (URec k Double p) | |
Show (URec k Double p) | |
Generic (URec k Double p) | |
type Difference Double Source # | |
type PrimSize Double Source # | |
data URec k Double | Used for marking occurrences of Since: 4.9.0.0 |
type Rep1 k (URec k Double) | |
type Rep (URec k Double p) | |
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.
Instances
Eq Float | |
Floating Float | Since: 2.1 |
Data Float | Since: 4.0.0.0 |
Ord Float | |
Read Float | Since: 2.1 |
RealFloat Float | Since: 2.1 |
Storable Float | Since: 2.1 |
HasNegation Float Source # | |
Fractional Float Source # | |
Integral Float Source # | |
Subtractive Float Source # | |
Additive Float Source # | |
Divisible Float Source # | |
Multiplicative Float Source # | |
PrimType Float Source # | |
NormalForm Float Source # | |
Generic1 k (URec k Float) | |
Functor (URec * Float) | |
Foldable (URec * Float) | |
Traversable (URec * Float) | |
Eq (URec k Float p) | |
Ord (URec k Float p) | |
Show (URec k Float p) | |
Generic (URec k Float p) | |
type Difference Float Source # | |
type PrimSize Float Source # | |
data URec k Float | Used for marking occurrences of Since: 4.9.0.0 |
type Rep1 k (URec k Float) | |
type Rep (URec k Float p) | |
A value of type
is a computation which, when performed,
does some I/O before returning a value of type IO
aa
.
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 >>
and >>=
operations from the Monad
class.
The IsList
class and its methods are intended to be used in
conjunction with the OverloadedLists extension.
Since: 4.7.0.0
Associated Types
The Item
type function returns the type of items of the structure
l
.
Methods
The fromList
function constructs the structure l
from the given
list of Item l
fromListN :: Int -> [Item l] -> l #
The fromListN
function takes the input list's length as a hint. Its
behaviour should be equivalent to fromList
. The hint can be used to
construct the structure l
more efficiently compared to fromList
. If
the given hint does not equal to the input list's length the behaviour of
fromListN
is not specified.
The toList
function extracts a list of Item l
from the structure l
.
It should satisfy fromList . toList = id.
Instances
IsList CallStack | Be aware that 'fromList . toList = id' only for unfrozen Since: 4.9.0.0 |
IsList Version | Since: 4.8.0.0 |
IsList AsciiString # | |
IsList String # | |
IsList [a] | Since: 4.7.0.0 |
IsList (NonEmpty a) | Since: 4.9.0.0 |
IsList c => IsList (NonEmpty c) # | |
PrimType ty => IsList (Block ty) # | |
PrimType ty => IsList (UArray ty) # | |
IsList (Array ty) # | |
Class for string-like datastructures; used by the overloaded string extension (-XOverloadedStrings in GHC).
Minimal complete definition
Methods
fromString :: String -> a #
Representable types of kind *. This class is derivable in GHC with the DeriveGeneric flag on.
Instances
data Either a b :: * -> * -> * #
The Either
type represents values with two possibilities: a value of
type
is either Either
a b
or Left
a
.Right
b
The Either
type is sometimes used to represent a value which is
either correct or an error; by convention, the Left
constructor is
used to hold an error value and the Right
constructor is used to
hold a correct value (mnemonic: "right" also means "correct").
Examples
The type
is the type of values which can be either
a Either
String
Int
String
or an Int
. The Left
constructor can be used only on
String
s, and the Right
constructor can be used only on Int
s:
>>>
let s = Left "foo" :: Either String Int
>>>
s
Left "foo">>>
let n = Right 3 :: Either String Int
>>>
n
Right 3>>>
:type s
s :: Either String Int>>>
:type n
n :: Either String Int
The fmap
from our Functor
instance will ignore Left
values, but
will apply the supplied function to values contained in a Right
:
>>>
let s = Left "foo" :: Either String Int
>>>
let n = Right 3 :: Either String Int
>>>
fmap (*2) s
Left "foo">>>
fmap (*2) n
Right 6
The Monad
instance for Either
allows us to chain together multiple
actions which may fail, and fail overall if any of the individual
steps failed. First we'll write a function that can either parse an
Int
from a Char
, or fail.
>>>
import Data.Char ( digitToInt, isDigit )
>>>
:{
let parseEither :: Char -> Either String Int parseEither c | isDigit c = Right (digitToInt c) | otherwise = Left "parse error">>>
:}
The following should work, since both '1'
and '2'
can be
parsed as Int
s.
>>>
:{
let parseMultiple :: Either String Int parseMultiple = do x <- parseEither '1' y <- parseEither '2' return (x + y)>>>
:}
>>>
parseMultiple
Right 3
But the following should fail overall, since the first operation where
we attempt to parse 'm'
as an Int
will fail:
>>>
:{
let parseMultiple :: Either String Int parseMultiple = do x <- parseEither 'm' y <- parseEither '2' return (x + y)>>>
:}
>>>
parseMultiple
Left "parse error"
Instances
Bifunctor Either | Since: 4.8.0.0 |
Monad (Either e) | Since: 4.4.0.0 |
Functor (Either a) | Since: 3.0 |
Applicative (Either e) | Since: 3.0 |
Foldable (Either a) | Since: 4.7.0.0 |
Traversable (Either a) | Since: 4.7.0.0 |
MonadFailure (Either a) Source # | |
Generic1 * (Either a) | |
From (Maybe a) (Either () a) Source # | |
(Eq b, Eq a) => Eq (Either a b) | |
(Data a, Data b) => Data (Either a b) | Since: 4.0.0.0 |
(Ord b, Ord a) => Ord (Either a b) | |
(Read b, Read a) => Read (Either a b) | |
(Show b, Show a) => Show (Either a b) | |
Generic (Either a b) | |
Semigroup (Either a b) | Since: 4.9.0.0 |
(NormalForm l, NormalForm r) => NormalForm (Either l r) Source # | |
From (Either a b) (These a b) Source # | |
type Failure (Either a) Source # | |
type Rep1 * (Either a) | |
type Rep (Either a b) | |
type (==) (Either k1 k2) a b | |
class Typeable * a => Data a where #
The Data
class comprehends a fundamental primitive gfoldl
for
folding over constructor applications, say terms. This primitive can
be instantiated in several ways to map over the immediate subterms
of a term; see the gmap
combinators later in this class. Indeed, a
generic programmer does not necessarily need to use the ingenious gfoldl
primitive but rather the intuitive gmap
combinators. The gfoldl
primitive is completed by means to query top-level constructors, to
turn constructor representations into proper terms, and to list all
possible datatype constructors. This completion allows us to serve
generic programming scenarios like read, show, equality, term generation.
The combinators gmapT
, gmapQ
, gmapM
, etc are all provided with
default definitions in terms of gfoldl
, leaving open the opportunity
to provide datatype-specific definitions.
(The inclusion of the gmap
combinators as members of class Data
allows the programmer or the compiler to derive specialised, and maybe
more efficient code per datatype. Note: gfoldl
is more higher-order
than the gmap
combinators. This is subject to ongoing benchmarking
experiments. It might turn out that the gmap
combinators will be
moved out of the class Data
.)
Conceptually, the definition of the gmap
combinators in terms of the
primitive gfoldl
requires the identification of the gfoldl
function
arguments. Technically, we also need to identify the type constructor
c
for the construction of the result type from the folded term type.
In the definition of gmapQ
x combinators, we use phantom type
constructors for the c
in the type of gfoldl
because the result type
of a query does not involve the (polymorphic) type of the term argument.
In the definition of gmapQl
we simply use the plain constant type
constructor because gfoldl
is left-associative anyway and so it is
readily suited to fold a left-associative binary operation over the
immediate subterms. In the definition of gmapQr, extra effort is
needed. We use a higher-order accumulation trick to mediate between
left-associative constructor application vs. right-associative binary
operation (e.g., (:)
). When the query is meant to compute a value
of type r
, then the result type withing generic folding is r -> r
.
So the result of folding is a function to which we finally pass the
right unit.
With the -XDeriveDataTypeable
option, GHC can generate instances of the
Data
class automatically. For example, given the declaration
data T a b = C1 a b | C2 deriving (Typeable, Data)
GHC will generate an instance that is equivalent to
instance (Data a, Data b) => Data (T a b) where gfoldl k z (C1 a b) = z C1 `k` a `k` b gfoldl k z C2 = z C2 gunfold k z c = case constrIndex c of 1 -> k (k (z C1)) 2 -> z C2 toConstr (C1 _ _) = con_C1 toConstr C2 = con_C2 dataTypeOf _ = ty_T con_C1 = mkConstr ty_T "C1" [] Prefix con_C2 = mkConstr ty_T "C2" [] Prefix ty_T = mkDataType "Module.T" [con_C1, con_C2]
This is suitable for datatypes that are exported transparently.
Minimal complete definition
Methods
Arguments
:: (forall d b. Data d => c (d -> b) -> d -> c b) | defines how nonempty constructor applications are folded. It takes the folded tail of the constructor application and its head, i.e., an immediate subterm, and combines them in some way. |
-> (forall g. g -> c g) | defines how the empty constructor application is folded, like the neutral / start element for list folding. |
-> a | structure to be folded. |
-> c a | result, with a type defined in terms of |
Left-associative fold operation for constructor applications.
The type of gfoldl
is a headache, but operationally it is a simple
generalisation of a list fold.
The default definition for gfoldl
is
, which is
suitable for abstract datatypes with no substructures.const
id
gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c a #
Unfolding constructor applications
Obtaining the constructor from a given datum. For proper terms, this is meant to be the top-level constructor. Primitive datatypes are here viewed as potentially infinite sets of values (i.e., constructors).
dataTypeOf :: a -> DataType #
The outer type constructor of the type
dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c a) #
Mediate types and unary type constructors.
In Data
instances of the form T a
, dataCast1
should be defined
as gcast1
.
The default definition is
, which is appropriate
for non-unary type constructors.const
Nothing
dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a) #
Mediate types and binary type constructors.
In Data
instances of the form T a b
, dataCast2
should be
defined as gcast2
.
The default definition is
, which is appropriate
for non-binary type constructors.const
Nothing
gmapT :: (forall b. Data b => b -> b) -> a -> a #
A generic transformation that maps over the immediate subterms
The default definition instantiates the type constructor c
in the
type of gfoldl
to an identity datatype constructor, using the
isomorphism pair as injection and projection.
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r #
A generic query with a left-associative binary operator
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r #
A generic query with a right-associative binary operator
gmapQ :: (forall d. Data d => d -> u) -> a -> [u] #
A generic query that processes the immediate subterms and returns a list of results. The list is given in the same order as originally specified in the declaration of the data constructors.
gmapQi :: Int -> (forall d. Data d => d -> u) -> a -> u #
A generic query that processes one child by index (zero-based)
gmapM :: Monad m => (forall d. Data d => d -> m d) -> a -> m a #
A generic monadic transformation that maps over the immediate subterms
The default definition instantiates the type constructor c
in
the type of gfoldl
to the monad datatype constructor, defining
injection and projection using return
and >>=
.
gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> a -> m a #
Transformation of at least one immediate subterm does not fail
gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> a -> m a #
Transformation of one immediate subterm with success
Instances
Data Bool | Since: 4.0.0.0 |
Data Char | Since: 4.0.0.0 |
Data Double | Since: 4.0.0.0 |
Data Float | Since: 4.0.0.0 |
Data Int | Since: 4.0.0.0 |
Data Int8 | Since: 4.0.0.0 |
Data Int16 | Since: 4.0.0.0 |
Data Int32 | Since: 4.0.0.0 |
Data Int64 | Since: 4.0.0.0 |
Data Integer | Since: 4.0.0.0 |
Data Natural | Since: 4.8.0.0 |
Data Ordering | Since: 4.0.0.0 |
Data Word | Since: 4.0.0.0 |
Data Word8 | Since: 4.0.0.0 |
Data Word16 | Since: 4.0.0.0 |
Data Word32 | Since: 4.0.0.0 |
Data Word64 | Since: 4.0.0.0 |
Data () | Since: 4.0.0.0 |
Data Void | |
Data SpecConstrAnnotation | |
Data Version | Since: 4.7.0.0 |
Data All | Since: 4.8.0.0 |
Data Any | Since: 4.8.0.0 |
Data Fixity | Since: 4.9.0.0 |
Data Associativity | Since: 4.9.0.0 |
Data SourceUnpackedness | Since: 4.9.0.0 |
Data SourceStrictness | Since: 4.9.0.0 |
Data DecidedStrictness | Since: 4.9.0.0 |
Data String # | |
Data Encoding # | |
Data a => Data [a] | Since: 4.0.0.0 |
Data a => Data (Maybe a) | Since: 4.0.0.0 |
(Data a, Integral a) => Data (Ratio a) | Since: 4.0.0.0 |
Data a => Data (Ptr a) | Since: 4.8.0.0 |
Data p => Data (Par1 p) | Since: 4.9.0.0 |
Data a => Data (Min a) | |
Data a => Data (Max a) | |
Data a => Data (First a) | |
Data a => Data (Last a) | |
Data m => Data (WrappedMonoid m) | |
Data a => Data (Option a) | |
Data a => Data (NonEmpty a) | |
Data a => Data (Identity a) | Since: 4.9.0.0 |
Data a => Data (ForeignPtr a) | Since: 4.8.0.0 |
Data a => Data (Dual a) | Since: 4.8.0.0 |
Data a => Data (Sum a) | Since: 4.8.0.0 |
Data a => Data (Product a) | Since: 4.8.0.0 |
Data a => Data (First a) | Since: 4.8.0.0 |
Data a => Data (Last a) | Since: 4.8.0.0 |
Data ty => Data (Block ty) # | |
Data ty => Data (UArray ty) # | |
Data ty => Data (Array ty) # | |
(Data a, Data b) => Data (Either a b) | Since: 4.0.0.0 |
Data p => Data (V1 * p) | Since: 4.9.0.0 |
Data p => Data (U1 * p) | Since: 4.9.0.0 |
(Data a, Data b) => Data (a, b) | Since: 4.0.0.0 |
(Data a, Data b, Ix a) => Data (Array a b) | Since: 4.8.0.0 |
(Data b, Data a) => Data (Arg a b) | |
Data t => Data (Proxy * t) | Since: 4.7.0.0 |
(Data (f p), Typeable (* -> *) f, Data p) => Data (Rec1 * f p) | Since: 4.9.0.0 |
(Data a, Data b, Data c) => Data (a, b, c) | Since: 4.0.0.0 |
(Typeable * k3, Data a, Typeable k3 b) => Data (Const k3 a b) | Since: 4.10.0.0 |
(Data (f a), Data a, Typeable (* -> *) f) => Data (Alt * f a) | Since: 4.8.0.0 |
(Coercible * a b, Data a, Data b) => Data (Coercion * a b) | Since: 4.7.0.0 |
((~) * a b, Data a) => Data ((:~:) * a b) | Since: 4.7.0.0 |
(Typeable * i, Data p, Data c) => Data (K1 * i c p) | Since: 4.9.0.0 |
(Typeable (* -> *) f, Typeable (* -> *) g, Data p, Data (f p), Data (g p)) => Data ((:+:) * f g p) | Since: 4.9.0.0 |
(Typeable (* -> *) f, Typeable (* -> *) g, Data p, Data (f p), Data (g p)) => Data ((:*:) * f g p) | Since: 4.9.0.0 |
(Data a, Data b, Data c, Data d) => Data (a, b, c, d) | Since: 4.0.0.0 |
(Typeable * i2, Typeable * j2, Typeable i2 a, Typeable j2 b, (~~) i2 j2 a b) => Data ((:~~:) i2 j2 a b) | Since: 4.10.0.0 |
(Data p, Data (f p), Typeable Meta c, Typeable * i, Typeable (* -> *) f) => Data (M1 * i c f p) | Since: 4.9.0.0 |
(Typeable (* -> *) f, Typeable (* -> *) g, Data p, Data (f (g p))) => Data ((:.:) * * f g p) | Since: 4.9.0.0 |
(Data a, Data b, Data c, Data d, Data e) => Data (a, b, c, d, e) | Since: 4.0.0.0 |
(Data a, Data b, Data c, Data d, Data e, Data f) => Data (a, b, c, d, e, f) | Since: 4.0.0.0 |
(Data a, Data b, Data c, Data d, Data e, Data f, Data g) => Data (a, b, c, d, e, f, g) | Since: 4.0.0.0 |
mkNoRepType :: String -> DataType #
Constructs a non-representation for a non-representable type
Representation of datatypes. A package of constructor representations with names of type and module.
The class Typeable
allows a concrete representation of a type to
be calculated.
Minimal complete definition
typeRep#
The class of monoids (types with an associative binary operation that has an identity). Instances should satisfy the following laws:
mappend mempty x = x
mappend x mempty = x
mappend x (mappend y z) = mappend (mappend x y) z
mconcat =
foldr
mappend 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
.
Methods
Identity of mappend
An associative operation
Fold 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.
Instances
Monoid Ordering | Since: 2.1 |
Monoid () | Since: 2.1 |
Monoid All | Since: 2.1 |
Monoid Any | Since: 2.1 |
Monoid AsciiString # | |
Monoid String # | |
Monoid Builder # | |
Monoid Builder # | |
Monoid [a] | Since: 2.1 |
Monoid a => Monoid (Maybe a) | Lift a semigroup into Since: 2.1 |
Monoid a => Monoid (IO a) | Since: 4.9.0.0 |
(Ord a, Bounded a) => Monoid (Min a) | Since: 4.9.0.0 |
(Ord a, Bounded a) => Monoid (Max a) | Since: 4.9.0.0 |
Monoid m => Monoid (WrappedMonoid m) | Since: 4.9.0.0 |
Semigroup a => Monoid (Option a) | Since: 4.9.0.0 |
Monoid a => Monoid (Identity a) | |
Monoid a => Monoid (Dual a) | Since: 2.1 |
Monoid (Endo a) | Since: 2.1 |
Num a => Monoid (Sum a) | Since: 2.1 |
Num a => Monoid (Product a) | Since: 2.1 |
Monoid (First a) | Since: 2.1 |
Monoid (Last a) | Since: 2.1 |
Monoid (CountOf ty) # | |
PrimType ty => Monoid (Block ty) # | |
PrimType ty => Monoid (UArray ty) # | |
Monoid (Array a) # | |
Monoid b => Monoid (a -> b) | Since: 2.1 |
(Monoid a, Monoid b) => Monoid (a, b) | Since: 2.1 |
Monoid (Proxy k s) | Since: 4.7.0.0 |
(Monoid a, Monoid b, Monoid c) => Monoid (a, b, c) | Since: 2.1 |
Monoid a => Monoid (Const k a b) | |
Alternative f => Monoid (Alt * f a) | Since: 4.8.0.0 |
(Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d) | Since: 2.1 |
(Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e) | Since: 2.1 |
class (Typeable * e, Show e) => Exception e #
Any type that you wish to throw or catch as an exception must be an
instance of the Exception
class. The simplest case is a new exception
type directly below the root:
data MyException = ThisException | ThatException deriving Show instance Exception MyException
The default method definitions in the Exception
class do what we need
in this case. You can now throw and catch ThisException
and
ThatException
as exceptions:
*Main> throw ThisException `catch` \e -> putStrLn ("Caught " ++ show (e :: MyException)) Caught ThisException
In more complicated examples, you may wish to define a whole hierarchy of exceptions:
--------------------------------------------------------------------- -- Make the root exception type for all the exceptions in a compiler data SomeCompilerException = forall e . Exception e => SomeCompilerException e instance Show SomeCompilerException where show (SomeCompilerException e) = show e instance Exception SomeCompilerException compilerExceptionToException :: Exception e => e -> SomeException compilerExceptionToException = toException . SomeCompilerException compilerExceptionFromException :: Exception e => SomeException -> Maybe e compilerExceptionFromException x = do SomeCompilerException a <- fromException x cast a --------------------------------------------------------------------- -- Make a subhierarchy for exceptions in the frontend of the compiler data SomeFrontendException = forall e . Exception e => SomeFrontendException e instance Show SomeFrontendException where show (SomeFrontendException e) = show e instance Exception SomeFrontendException where toException = compilerExceptionToException fromException = compilerExceptionFromException frontendExceptionToException :: Exception e => e -> SomeException frontendExceptionToException = toException . SomeFrontendException frontendExceptionFromException :: Exception e => SomeException -> Maybe e frontendExceptionFromException x = do SomeFrontendException a <- fromException x cast a --------------------------------------------------------------------- -- Make an exception type for a particular frontend compiler exception data MismatchedParentheses = MismatchedParentheses deriving Show instance Exception MismatchedParentheses where toException = frontendExceptionToException fromException = frontendExceptionFromException
We can now catch a MismatchedParentheses
exception as
MismatchedParentheses
, SomeFrontendException
or
SomeCompilerException
, but not other types, e.g. IOException
:
*Main> throw MismatchedParenthesescatch
e -> putStrLn ("Caught " ++ show (e :: MismatchedParentheses)) Caught MismatchedParentheses *Main> throw MismatchedParenthesescatch
e -> putStrLn ("Caught " ++ show (e :: SomeFrontendException)) Caught MismatchedParentheses *Main> throw MismatchedParenthesescatch
e -> putStrLn ("Caught " ++ show (e :: SomeCompilerException)) Caught MismatchedParentheses *Main> throw MismatchedParenthesescatch
e -> putStrLn ("Caught " ++ show (e :: IOException)) *** Exception: MismatchedParentheses
Instances
Exception Void | Since: 4.8.0.0 |
Exception BlockedIndefinitelyOnMVar | Since: 4.1.0.0 |
Exception BlockedIndefinitelyOnSTM | Since: 4.1.0.0 |
Exception Deadlock | Since: 4.1.0.0 |
Exception AllocationLimitExceeded | Since: 4.8.0.0 |
Exception CompactionFailed | Since: 4.10.0.0 |
Exception AssertionFailed | Since: 4.1.0.0 |
Exception SomeAsyncException | Since: 4.7.0.0 |
Exception AsyncException | Since: 4.7.0.0 |
Exception ArrayException | Since: 4.1.0.0 |
Exception ExitCode | Since: 4.1.0.0 |
Exception IOException | Since: 4.1.0.0 |
Exception ErrorCall | Since: 4.0.0.0 |
Exception ArithException | Since: 4.0.0.0 |
Exception SomeException | Since: 3.0 |
Exception NonEmptyCollectionIsEmpty # | |
Exception InvalidRecast # | |
Exception OutOfBound # | |
Exception ValidationFailure # | |
throw :: Exception e => e -> a #
Throw an exception. Exceptions may be thrown from purely
functional code, but may only be caught within the IO
monad.
throwIO :: Exception e => e -> IO a #
A variant of throw
that can only be used within the IO
monad.
Although throwIO
has a type that is an instance of the type of throw
, the
two functions are subtly different:
throw e `seq` x ===> throw e throwIO e `seq` x ===> x
The first example will cause the exception e
to be raised,
whereas the second one won't. In fact, throwIO
will only cause
an exception to be raised when it is used within the IO
monad.
The throwIO
variant should be used in preference to throw
to
raise an exception within the IO
monad because it guarantees
ordering with respect to other IO
operations, whereas throw
does not.
A value of type
represents a pointer to an object, or an
array of objects, which may be marshalled to or from Haskell values
of type Ptr
aa
.
The type a
will often be an instance of class
Storable
which provides the marshalling operations.
However this is not essential, and you can provide your own operations
to access the pointer. For example you might write small foreign
functions to get or set the fields of a C struct
.
Instances
Generic1 k (URec k (Ptr ())) | |
Eq (Ptr a) | |
Data a => Data (Ptr a) | Since: 4.8.0.0 |
Ord (Ptr a) | |
Show (Ptr a) | Since: 2.1 |
Storable (Ptr a) | Since: 2.1 |
NormalForm (Ptr a) Source # | |
Functor (URec * (Ptr ())) | |
Foldable (URec * (Ptr ())) | |
Traversable (URec * (Ptr ())) | |
Eq (URec k (Ptr ()) p) | |
Ord (URec k (Ptr ()) p) | |
Generic (URec k (Ptr ()) p) | |
data URec k (Ptr ()) | Used for marking occurrences of Since: 4.9.0.0 |
type Rep1 k (URec k (Ptr ())) | |
type Rep (URec k (Ptr ()) p) | |
ifThenElse :: Bool -> a -> a -> a Source #
for support of if .. then .. else
internalError :: [Char] -> a Source #
Only to use internally for internal error cases