Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module reexports the six necessary type classes that many rule types must support through ShakeValue
.
You can use this module to define new rules without depending on the binary
, deepseq
and hashable
packages.
Documentation
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)"
.
:: 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
The class Typeable
allows a concrete representation of a type to
be calculated.
typeRep#
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:
Instances
Eq Bool | |
Eq Char | |
Eq Double | Note that due to the presence of
Also note that
|
Eq Float | Note that due to the presence of
Also note that
|
Eq Int | |
Eq Int8 | Since: base-2.1 |
Eq Int16 | Since: base-2.1 |
Eq Int32 | Since: base-2.1 |
Eq Int64 | Since: base-2.1 |
Eq Integer | |
Eq Natural | Since: base-4.8.0.0 |
Eq Ordering | |
Eq Word | |
Eq Word8 | Since: base-2.1 |
Eq Word16 | Since: base-2.1 |
Eq Word32 | Since: base-2.1 |
Eq Word64 | Since: base-2.1 |
Eq SomeTypeRep | |
Defined in Data.Typeable.Internal (==) :: SomeTypeRep -> SomeTypeRep -> Bool # (/=) :: SomeTypeRep -> SomeTypeRep -> Bool # | |
Eq () | |
Eq TyCon | |
Eq Module | |
Eq TrName | |
Eq Handle | Since: base-4.1.0.0 |
Eq Void | Since: base-4.8.0.0 |
Eq SpecConstrAnnotation | Since: base-4.3.0.0 |
Defined in GHC.Exts (==) :: SpecConstrAnnotation -> SpecConstrAnnotation -> Bool # (/=) :: SpecConstrAnnotation -> SpecConstrAnnotation -> Bool # | |
Eq Constr | Equality of constructors Since: base-4.0.0.0 |
Eq DataRep | Since: base-4.0.0.0 |
Eq ConstrRep | Since: base-4.0.0.0 |
Eq Fixity | Since: base-4.0.0.0 |
Eq Unique | |
Eq Version | Since: base-2.1 |
Eq HandlePosn | Since: base-4.1.0.0 |
Defined in GHC.IO.Handle (==) :: HandlePosn -> HandlePosn -> Bool # (/=) :: HandlePosn -> HandlePosn -> Bool # | |
Eq ThreadId | Since: base-4.2.0.0 |
Eq BlockReason | Since: base-4.3.0.0 |
Defined in GHC.Conc.Sync (==) :: BlockReason -> BlockReason -> Bool # (/=) :: BlockReason -> BlockReason -> Bool # | |
Eq ThreadStatus | Since: base-4.3.0.0 |
Defined in GHC.Conc.Sync (==) :: ThreadStatus -> ThreadStatus -> Bool # (/=) :: ThreadStatus -> ThreadStatus -> Bool # | |
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 CSocklen | |
Eq CNfds | |
Eq Fd | |
Eq Errno | Since: base-2.1 |
Eq AsyncException | Since: base-4.2.0.0 |
Defined in GHC.IO.Exception (==) :: AsyncException -> AsyncException -> Bool # (/=) :: AsyncException -> AsyncException -> Bool # | |
Eq ArrayException | Since: base-4.2.0.0 |
Defined in GHC.IO.Exception (==) :: ArrayException -> ArrayException -> Bool # (/=) :: ArrayException -> ArrayException -> Bool # | |
Eq ExitCode | |
Eq IOErrorType | Since: base-4.1.0.0 |
Defined in GHC.IO.Exception (==) :: IOErrorType -> IOErrorType -> Bool # (/=) :: IOErrorType -> IOErrorType -> Bool # | |
Eq BufferMode | Since: base-4.2.0.0 |
Defined in GHC.IO.Handle.Types (==) :: BufferMode -> BufferMode -> Bool # (/=) :: BufferMode -> BufferMode -> Bool # | |
Eq Newline | Since: base-4.2.0.0 |
Eq NewlineMode | Since: base-4.2.0.0 |
Defined in GHC.IO.Handle.Types (==) :: NewlineMode -> NewlineMode -> Bool # (/=) :: NewlineMode -> NewlineMode -> Bool # | |
Eq IODeviceType | Since: base-4.2.0.0 |
Defined in GHC.IO.Device (==) :: IODeviceType -> IODeviceType -> Bool # (/=) :: IODeviceType -> IODeviceType -> Bool # | |
Eq SeekMode | Since: base-4.2.0.0 |
Eq CodingProgress | Since: base-4.4.0.0 |
Defined in GHC.IO.Encoding.Types (==) :: CodingProgress -> CodingProgress -> Bool # (/=) :: CodingProgress -> CodingProgress -> Bool # | |
Eq MaskingState | Since: base-4.3.0.0 |
Defined in GHC.IO (==) :: MaskingState -> MaskingState -> Bool # (/=) :: MaskingState -> MaskingState -> Bool # | |
Eq IOException | Since: base-4.1.0.0 |
Defined in GHC.IO.Exception (==) :: IOException -> IOException -> Bool # (/=) :: IOException -> IOException -> Bool # | |
Eq ErrorCall | Since: base-4.7.0.0 |
Eq ArithException | Since: base-3.0 |
Defined in GHC.Exception.Type (==) :: ArithException -> ArithException -> Bool # (/=) :: ArithException -> ArithException -> Bool # | |
Eq All | Since: base-2.1 |
Eq Any | Since: base-2.1 |
Eq Fixity | Since: base-4.6.0.0 |
Eq Associativity | Since: base-4.6.0.0 |
Defined in GHC.Generics (==) :: Associativity -> Associativity -> Bool # (/=) :: Associativity -> Associativity -> Bool # | |
Eq SourceUnpackedness | Since: base-4.9.0.0 |
Defined in GHC.Generics (==) :: SourceUnpackedness -> SourceUnpackedness -> Bool # (/=) :: SourceUnpackedness -> SourceUnpackedness -> Bool # | |
Eq SourceStrictness | Since: base-4.9.0.0 |
Defined in GHC.Generics (==) :: SourceStrictness -> SourceStrictness -> Bool # (/=) :: SourceStrictness -> SourceStrictness -> Bool # | |
Eq DecidedStrictness | Since: base-4.9.0.0 |
Defined in GHC.Generics (==) :: DecidedStrictness -> DecidedStrictness -> Bool # (/=) :: DecidedStrictness -> DecidedStrictness -> Bool # | |
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 | |
Defined in Foreign.C.Types (==) :: CSigAtomic -> CSigAtomic -> Bool # (/=) :: CSigAtomic -> CSigAtomic -> Bool # | |
Eq CClock | |
Eq CTime | |
Eq CUSeconds | |
Eq CSUSeconds | |
Defined in Foreign.C.Types (==) :: CSUSeconds -> CSUSeconds -> Bool # (/=) :: CSUSeconds -> CSUSeconds -> Bool # | |
Eq CIntPtr | |
Eq CUIntPtr | |
Eq CIntMax | |
Eq CUIntMax | |
Eq WordPtr | |
Eq IntPtr | |
Eq IOMode | Since: base-4.2.0.0 |
Eq Fingerprint | Since: base-4.4.0.0 |
Defined in GHC.Fingerprint.Type (==) :: Fingerprint -> Fingerprint -> Bool # (/=) :: Fingerprint -> Fingerprint -> Bool # | |
Eq Lexeme | Since: base-2.1 |
Eq Number | Since: base-4.6.0.0 |
Eq GeneralCategory | Since: base-2.1 |
Defined in GHC.Unicode (==) :: GeneralCategory -> GeneralCategory -> Bool # (/=) :: GeneralCategory -> GeneralCategory -> Bool # | |
Eq SrcLoc | Since: base-4.9.0.0 |
Eq ShortByteString | |
Defined in Data.ByteString.Short.Internal (==) :: ShortByteString -> ShortByteString -> Bool # (/=) :: ShortByteString -> ShortByteString -> Bool # | |
Eq ByteString | |
Defined in Data.ByteString.Lazy.Internal (==) :: ByteString -> ByteString -> Bool # (/=) :: ByteString -> ByteString -> Bool # | |
Eq ByteString | |
Defined in Data.ByteString.Internal (==) :: ByteString -> ByteString -> Bool # (/=) :: ByteString -> ByteString -> Bool # | |
Eq Clock | |
Eq TimeSpec | |
Eq IntSet | |
Eq FileType | |
Eq Permissions | |
Defined in System.Directory.Internal.Common (==) :: Permissions -> Permissions -> Bool # (/=) :: Permissions -> Permissions -> Bool # | |
Eq XdgDirectory | |
Defined in System.Directory.Internal.Common (==) :: XdgDirectory -> XdgDirectory -> Bool # (/=) :: XdgDirectory -> XdgDirectory -> Bool # | |
Eq XdgDirectoryList | |
Defined in System.Directory.Internal.Common (==) :: XdgDirectoryList -> XdgDirectoryList -> Bool # (/=) :: XdgDirectoryList -> XdgDirectoryList -> Bool # | |
Eq StdStream | |
Eq CmdSpec | |
Eq CreateProcess | |
Defined in System.Process.Common (==) :: CreateProcess -> CreateProcess -> Bool # (/=) :: CreateProcess -> CreateProcess -> Bool # | |
Eq Path | |
Eq Pattern | |
Eq StepNext | |
Eq BigNat | |
Eq Flot | |
Eq StdGen | |
Eq TimeLocale | |
Defined in Data.Time.Format.Locale (==) :: TimeLocale -> TimeLocale -> Bool # (/=) :: TimeLocale -> TimeLocale -> Bool # | |
Eq LocalTime | |
Eq TimeOfDay | |
Eq TimeZone | |
Eq CalendarDiffTime | |
Defined in Data.Time.LocalTime.Internal.CalendarDiffTime (==) :: CalendarDiffTime -> CalendarDiffTime -> Bool # (/=) :: CalendarDiffTime -> CalendarDiffTime -> Bool # | |
Eq UniversalTime | |
Defined in Data.Time.Clock.Internal.UniversalTime (==) :: UniversalTime -> UniversalTime -> Bool # (/=) :: UniversalTime -> UniversalTime -> Bool # | |
Eq UTCTime | |
Eq NominalDiffTime | |
Defined in Data.Time.Clock.Internal.NominalDiffTime (==) :: NominalDiffTime -> NominalDiffTime -> Bool # (/=) :: NominalDiffTime -> NominalDiffTime -> Bool # | |
Eq DiffTime | |
Eq DayOfWeek | |
Eq Day | |
Eq CalendarDiffDays | |
Defined in Data.Time.Calendar.CalendarDiffDays (==) :: CalendarDiffDays -> CalendarDiffDays -> Bool # (/=) :: CalendarDiffDays -> CalendarDiffDays -> Bool # | |
Eq CmdOption Source # | |
Eq Timeout | |
Eq Verbosity Source # | |
Eq Progress Source # | |
Eq Change Source # | |
Eq Lint Source # | |
Eq Rebuild Source # | |
Eq RunChanged Source # | |
Defined in Development.Shake.Internal.Core.Types (==) :: RunChanged -> RunChanged -> Bool # (/=) :: RunChanged -> RunChanged -> Bool # | |
Eq RunMode Source # | |
Eq Resource Source # | |
Eq CmdArgument Source # | |
Defined in Development.Shake.Command (==) :: CmdArgument -> CmdArgument -> Bool # (/=) :: CmdArgument -> CmdArgument -> Bool # | |
Eq Pat | |
Eq a => Eq [a] | |
Eq a => Eq (Maybe a) | Since: base-2.1 |
Eq a => Eq (Ratio a) | Since: base-2.1 |
Eq (StablePtr a) | Since: base-2.1 |
Eq (Ptr a) | Since: base-2.1 |
Eq (FunPtr a) | |
Eq p => Eq (Par1 p) | Since: base-4.7.0.0 |
Eq (ForeignPtr a) | Since: base-2.1 |
Defined in GHC.ForeignPtr (==) :: ForeignPtr a -> ForeignPtr a -> Bool # (/=) :: ForeignPtr a -> ForeignPtr a -> Bool # | |
Eq a => Eq (Complex a) | Since: base-2.1 |
Eq a => Eq (Min a) | Since: base-4.9.0.0 |
Eq a => Eq (Max a) | Since: base-4.9.0.0 |
Eq a => Eq (First a) | Since: base-4.9.0.0 |
Eq a => Eq (Last a) | Since: base-4.9.0.0 |
Eq m => Eq (WrappedMonoid m) | Since: base-4.9.0.0 |
Defined in Data.Semigroup (==) :: WrappedMonoid m -> WrappedMonoid m -> Bool # (/=) :: WrappedMonoid m -> WrappedMonoid m -> Bool # | |
Eq a => Eq (Option a) | Since: base-4.9.0.0 |
Eq (Chan a) | Since: base-4.4.0.0 |
Eq (StableName a) | Since: base-2.1 |
Defined in GHC.StableName (==) :: StableName a -> StableName a -> Bool # (/=) :: StableName a -> StableName a -> Bool # | |
Eq a => Eq (ZipList a) | Since: base-4.7.0.0 |
Eq a => Eq (Identity a) | Since: base-4.8.0.0 |
Eq (TVar a) | Since: base-4.8.0.0 |
Eq (IORef a) | Pointer equality. Since: base-4.0.0.0 |
Eq a => Eq (First a) | Since: base-2.1 |
Eq a => Eq (Last a) | Since: base-2.1 |
Eq a => Eq (Dual a) | Since: base-2.1 |
Eq a => Eq (Sum a) | Since: base-2.1 |
Eq a => Eq (Product a) | Since: base-2.1 |
Eq a => Eq (Down a) | Since: base-4.6.0.0 |
Eq (MVar a) | Since: base-4.1.0.0 |
Eq a => Eq (NonEmpty a) | Since: base-4.9.0.0 |
Eq a => Eq (IntMap a) | |
Eq a => Eq (Tree a) | |
Eq a => Eq (Seq a) | |
Eq a => Eq (ViewL a) | |
Eq a => Eq (ViewR a) | |
Eq a => Eq (Set a) | |
Eq a => Eq (Hashed a) | Uses precomputed hash to detect inequality faster |
Eq (Heap a) | |
Eq a => Eq (Array a) | |
Eq g => Eq (StateGen g) | |
Eq a => Eq (HashSet a) | Note that, in the presence of hash collisions, equal
In general, the lack of substitutivity can be observed with any function that depends on the key ordering, such as folds and traversals. |
Eq a => Eq (FSATrace a) Source # | |
(Eq a, Eq b) => Eq (Either a b) | Since: base-2.1 |
Eq (V1 p) | Since: base-4.9.0.0 |
Eq (U1 p) | Since: base-4.9.0.0 |
Eq (TypeRep a) | Since: base-2.1 |
(Eq a, Eq b) => Eq (a, b) | |
(Ix ix, Eq e, IArray UArray e) => Eq (UArray ix e) | |
(Ix i, Eq e) => Eq (Array i e) | Since: base-2.1 |
Eq (Fixed a) | Since: base-2.1 |
Eq a => Eq (Arg a b) | Since: base-4.9.0.0 |
Eq (Proxy s) | Since: base-4.7.0.0 |
Eq (STRef s a) | Pointer equality. Since: base-2.1 |
(Eq k, Eq a) => Eq (Map k a) | |
Eq p => Eq (Entry p a) | |
(Eq1 m, Eq a) => Eq (ListT m a) | |
Eq (MutableArray s a) | |
Defined in Data.Primitive.Array (==) :: MutableArray s a -> MutableArray s a -> Bool # (/=) :: MutableArray s a -> MutableArray s a -> Bool # | |
(Eq1 m, Eq a) => Eq (MaybeT m a) | |
(Eq k, Eq v) => Eq (Leaf k v) | |
(Eq k, Eq v) => Eq (HashMap k v) | Note that, in the presence of hash collisions, equal
In general, the lack of substitutivity can be observed with any function that depends on the key ordering, such as folds and traversals. |
Eq (f p) => Eq (Rec1 f p) | Since: base-4.7.0.0 |
Eq (URec (Ptr ()) p) | Since: base-4.9.0.0 |
Eq (URec Char p) | Since: base-4.9.0.0 |
Eq (URec Double p) | Since: base-4.9.0.0 |
Eq (URec Float p) | |
Eq (URec Int p) | Since: base-4.9.0.0 |
Eq (URec Word p) | Since: base-4.9.0.0 |
(Eq a, Eq b, Eq c) => Eq (a, b, c) | |
Eq (STUArray s i e) | |
Eq (STArray s i e) | Since: base-2.1 |
Eq a => Eq (Const a b) | Since: base-4.9.0.0 |
Eq (f a) => Eq (Ap f a) | Since: base-4.12.0.0 |
Eq (f a) => Eq (Alt f a) | Since: base-4.8.0.0 |
Eq (Coercion a b) | Since: base-4.7.0.0 |
Eq (a :~: b) | Since: base-4.7.0.0 |
(Eq1 f, Eq a) => Eq (IdentityT f a) | |
(Eq e, Eq1 m, Eq a) => Eq (ErrorT e m a) | |
(Eq e, Eq1 m, Eq a) => Eq (ExceptT e m a) | |
(Eq w, Eq1 m, Eq a) => Eq (WriterT w m a) | |
(Eq w, Eq1 m, Eq a) => Eq (WriterT w m a) | |
Eq c => Eq (K1 i c p) | Since: base-4.7.0.0 |
(Eq (f p), Eq (g p)) => Eq ((f :+: g) p) | Since: base-4.7.0.0 |
(Eq (f p), Eq (g p)) => Eq ((f :*: g) p) | Since: base-4.7.0.0 |
(Eq a, Eq b, Eq c, Eq d) => Eq (a, b, c, d) | |
(Eq1 f, Eq1 g, Eq a) => Eq (Product f g a) | Since: base-4.9.0.0 |
(Eq1 f, Eq1 g, Eq a) => Eq (Sum f g a) | Since: base-4.9.0.0 |
Eq (a :~~: b) | Since: base-4.10.0.0 |
Eq (f p) => Eq (M1 i c f p) | Since: base-4.7.0.0 |
Eq (f (g p)) => Eq ((f :.: g) p) | Since: base-4.7.0.0 |
(Eq a, Eq b, Eq c, Eq d, Eq e) => Eq (a, b, c, d, e) | |
(Eq1 f, Eq1 g, Eq a) => Eq (Compose f g a) | Since: base-4.9.0.0 |
(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 class of types that can be converted to a hash value.
Minimal implementation: hashWithSalt
.
Nothing
hashWithSalt :: Int -> a -> Int infixl 0 #
Return a hash value for the argument, using the given salt.
The general contract of hashWithSalt
is:
- If two values are equal according to the
==
method, then applying thehashWithSalt
method on each of the two values must produce the same integer result if the same salt is used in each case. - It is not required that if two values are unequal
according to the
==
method, then applying thehashWithSalt
method on each of the two values must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal values may improve the performance of hashing-based data structures. - This method can be used to compute different hash values for
the same input by providing a different salt in each
application of the method. This implies that any instance
that defines
hashWithSalt
must make use of the salt in its implementation.
Like hashWithSalt
, but no salt is used. The default
implementation uses hashWithSalt
with some default salt.
Instances might want to implement this method to provide a more
efficient implementation than the default implementation.
Instances
The Binary
class provides put
and get
, methods to encode and
decode a Haskell value to a lazy ByteString
. It mirrors the Read
and
Show
classes for textual representation of Haskell types, and is
suitable for serialising Haskell values to disk, over the network.
For decoding and generating simple external binary formats (e.g. C
structures), Binary may be used, but in general is not suitable
for complex protocols. Instead use the Put
and Get
primitives
directly.
Instances of Binary should satisfy the following property:
decode . encode == id
That is, the get
and put
methods should be the inverse of each
other. A range of instances are provided for basic Haskell types.
Nothing
Encode a value in the Put monad.
Decode a value in the Get monad
Encode a list of values in the Put monad. The default implementation may be overridden to be more efficient but must still have the same encoding format.
Instances
Binary Bool | |
Binary Char | |
Binary Double | |
Binary Float | |
Binary Int | |
Binary Int8 | |
Binary Int16 | |
Binary Int32 | |
Binary Int64 | |
Binary Integer | |
Binary Natural | Since: binary-0.7.3.0 |
Binary Ordering | |
Binary Word | |
Binary Word8 | |
Binary Word16 | |
Binary Word32 | |
Binary Word64 | |
Binary RuntimeRep | Since: binary-0.8.5.0 |
Defined in Data.Binary.Class | |
Binary VecCount | Since: binary-0.8.5.0 |
Binary VecElem | Since: binary-0.8.5.0 |
Binary SomeTypeRep | |
Defined in Data.Binary.Class | |
Binary () | |
Binary TyCon | Since: binary-0.8.5.0 |
Binary KindRep | Since: binary-0.8.5.0 |
Binary TypeLitSort | Since: binary-0.8.5.0 |
Defined in Data.Binary.Class | |
Binary Void | Since: binary-0.8.0.0 |
Binary Version | Since: binary-0.8.0.0 |
Binary All | Since: binary-0.8.4.0 |
Binary Any | Since: binary-0.8.4.0 |
Binary Fingerprint | Since: binary-0.7.6.0 |
Defined in Data.Binary.Class | |
Binary ShortByteString | |
Defined in Data.Binary.Class | |
Binary ByteString | |
Defined in Data.Binary.Class | |
Binary ByteString | |
Defined in Data.Binary.Class | |
Binary IntSet | |
Binary a => Binary [a] | |
Binary a => Binary (Maybe a) | |
(Binary a, Integral a) => Binary (Ratio a) | |
Binary a => Binary (Complex a) | |
Binary a => Binary (Min a) | Since: binary-0.8.4.0 |
Binary a => Binary (Max a) | Since: binary-0.8.4.0 |
Binary a => Binary (First a) | Since: binary-0.8.4.0 |
Binary a => Binary (Last a) | Since: binary-0.8.4.0 |
Binary m => Binary (WrappedMonoid m) | Since: binary-0.8.4.0 |
Defined in Data.Binary.Class | |
Binary a => Binary (Option a) | Since: binary-0.8.4.0 |
Binary a => Binary (Identity a) | |
Binary a => Binary (First a) | Since: binary-0.8.4.0 |
Binary a => Binary (Last a) | Since: binary-0.8.4.0 |
Binary a => Binary (Dual a) | Since: binary-0.8.4.0 |
Binary a => Binary (Sum a) | Since: binary-0.8.4.0 |
Binary a => Binary (Product a) | Since: binary-0.8.4.0 |
Binary a => Binary (NonEmpty a) | Since: binary-0.8.4.0 |
Binary e => Binary (IntMap e) | |
Binary e => Binary (Tree e) | |
Binary e => Binary (Seq e) | |
Binary a => Binary (Set a) | |
(Binary a, Binary b) => Binary (Either a b) | |
Typeable a => Binary (TypeRep a) | |
(Binary a, Binary b) => Binary (a, b) | |
(Binary i, Ix i, Binary e, IArray UArray e) => Binary (UArray i e) | |
(Binary i, Ix i, Binary e) => Binary (Array i e) | |
Binary (Fixed a) | Since: binary-0.8.0.0 |
(Binary a, Binary b) => Binary (Arg a b) | Since: binary-0.8.4.0 |
(Binary k, Binary e) => Binary (Map k e) | |
(Binary a, Binary b, Binary c) => Binary (a, b, c) | |
Binary (f a) => Binary (Alt f a) | Since: binary-0.8.4.0 |
(Binary a, Binary b, Binary c, Binary d) => Binary (a, b, c, d) | |
(Binary a, Binary b, Binary c, Binary d, Binary e) => Binary (a, b, c, d, e) | |
(Binary a, Binary b, Binary c, Binary d, Binary e, Binary f) => Binary (a, b, c, d, e, f) | |
(Binary a, Binary b, Binary c, Binary d, Binary e, Binary f, Binary g) => Binary (a, b, c, d, e, f, g) | |
(Binary a, Binary b, Binary c, Binary d, Binary e, Binary f, Binary g, Binary h) => Binary (a, b, c, d, e, f, g, h) | |
(Binary a, Binary b, Binary c, Binary d, Binary e, Binary f, Binary g, Binary h, Binary i) => Binary (a, b, c, d, e, f, g, h, i) | |
(Binary a, Binary b, Binary c, Binary d, Binary e, Binary f, Binary g, Binary h, Binary i, Binary j) => Binary (a, b, c, d, e, f, g, h, i, j) | |
A class of types that can be fully evaluated.
Since: deepseq-1.1.0.0
Nothing
rnf
should reduce its argument to normal form (that is, fully
evaluate all sub-components), and then return ()
.
Generic
NFData
deriving
Starting with GHC 7.2, you can automatically derive instances
for types possessing a Generic
instance.
Note: Generic1
can be auto-derived starting with GHC 7.4
{-# LANGUAGE DeriveGeneric #-} import GHC.Generics (Generic, Generic1) import Control.DeepSeq data Foo a = Foo a String deriving (Eq, Generic, Generic1) instance NFData a => NFData (Foo a) instance NFData1 Foo data Colour = Red | Green | Blue deriving Generic instance NFData Colour
Starting with GHC 7.10, the example above can be written more
concisely by enabling the new DeriveAnyClass
extension:
{-# LANGUAGE DeriveGeneric, DeriveAnyClass #-} import GHC.Generics (Generic) import Control.DeepSeq data Foo a = Foo a String deriving (Eq, Generic, Generic1, NFData, NFData1) data Colour = Red | Green | Blue deriving (Generic, NFData)
Compatibility with previous deepseq
versions
Prior to version 1.4.0.0, the default implementation of the rnf
method was defined as
rnf
a =seq
a ()
However, starting with deepseq-1.4.0.0
, the default
implementation is based on DefaultSignatures
allowing for
more accurate auto-derived NFData
instances. If you need the
previously used exact default rnf
method implementation
semantics, use
instance NFData Colour where rnf x = seq x ()
or alternatively
instance NFData Colour where rnf = rwhnf
or
{-# LANGUAGE BangPatterns #-} instance NFData Colour where rnf !_ = ()
Instances
NFData Bool | |
Defined in Control.DeepSeq | |
NFData Char | |
Defined in Control.DeepSeq | |
NFData Double | |
Defined in Control.DeepSeq | |
NFData Float | |
Defined in Control.DeepSeq | |
NFData Int | |
Defined in Control.DeepSeq | |
NFData Int8 | |
Defined in Control.DeepSeq | |
NFData Int16 | |
Defined in Control.DeepSeq | |
NFData Int32 | |
Defined in Control.DeepSeq | |
NFData Int64 | |
Defined in Control.DeepSeq | |
NFData Integer | |
Defined in Control.DeepSeq | |
NFData Natural | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData Ordering | |
Defined in Control.DeepSeq | |
NFData Word | |
Defined in Control.DeepSeq | |
NFData Word8 | |
Defined in Control.DeepSeq | |
NFData Word16 | |
Defined in Control.DeepSeq | |
NFData Word32 | |
Defined in Control.DeepSeq | |
NFData Word64 | |
Defined in Control.DeepSeq | |
NFData CallStack | Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq | |
NFData () | |
Defined in Control.DeepSeq | |
NFData TyCon | NOTE: Prior to Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData Void | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData Unique | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData Version | Since: deepseq-1.3.0.0 |
Defined in Control.DeepSeq | |
NFData ThreadId | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData ExitCode | Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq | |
NFData MaskingState | Since: deepseq-1.4.4.0 |
Defined in Control.DeepSeq rnf :: MaskingState -> () # | |
NFData TypeRep | NOTE: Prior to Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData All | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData Any | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CChar | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CSChar | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CUChar | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CShort | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CUShort | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CInt | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CUInt | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CLong | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CULong | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CLLong | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CULLong | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CBool | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
NFData CFloat | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CDouble | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CPtrdiff | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CSize | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CWchar | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CSigAtomic | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq rnf :: CSigAtomic -> () # | |
NFData CClock | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CTime | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CUSeconds | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CSUSeconds | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq rnf :: CSUSeconds -> () # | |
NFData CFile | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CFpos | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CJmpBuf | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CIntPtr | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CUIntPtr | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CIntMax | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData CUIntMax | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData Fingerprint | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq rnf :: Fingerprint -> () # | |
NFData SrcLoc | Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq | |
NFData ShortByteString | |
Defined in Data.ByteString.Short.Internal rnf :: ShortByteString -> () # | |
NFData ByteString | |
Defined in Data.ByteString.Lazy.Internal rnf :: ByteString -> () # | |
NFData ByteString | |
Defined in Data.ByteString.Internal rnf :: ByteString -> () # | |
NFData IntSet | |
Defined in Data.IntSet.Internal | |
NFData StdGen | |
Defined in System.Random.Internal | |
NFData ZonedTime | |
Defined in Data.Time.LocalTime.Internal.ZonedTime | |
NFData LocalTime | |
Defined in Data.Time.LocalTime.Internal.LocalTime | |
NFData TimeOfDay | |
Defined in Data.Time.LocalTime.Internal.TimeOfDay | |
NFData TimeZone | |
Defined in Data.Time.LocalTime.Internal.TimeZone | |
NFData UniversalTime | |
Defined in Data.Time.Clock.Internal.UniversalTime rnf :: UniversalTime -> () # | |
NFData UTCTime | |
Defined in Data.Time.Clock.Internal.UTCTime | |
NFData NominalDiffTime | |
Defined in Data.Time.Clock.Internal.NominalDiffTime rnf :: NominalDiffTime -> () # | |
NFData DiffTime | |
Defined in Data.Time.Clock.Internal.DiffTime | |
NFData Day | |
Defined in Data.Time.Calendar.Days | |
NFData RunChanged Source # | |
Defined in Development.Shake.Internal.Core.Types rnf :: RunChanged -> () # | |
NFData RunMode Source # | |
Defined in Development.Shake.Internal.Core.Types | |
NFData a => NFData [a] | |
Defined in Control.DeepSeq | |
NFData a => NFData (Maybe a) | |
Defined in Control.DeepSeq | |
NFData a => NFData (Ratio a) | |
Defined in Control.DeepSeq | |
NFData (Ptr a) | Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq | |
NFData (FunPtr a) | Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq | |
NFData a => NFData (Complex a) | |
Defined in Control.DeepSeq | |
NFData a => NFData (Min a) | Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq | |
NFData a => NFData (Max a) | Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq | |
NFData a => NFData (First a) | Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq | |
NFData a => NFData (Last a) | Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq | |
NFData m => NFData (WrappedMonoid m) | Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq rnf :: WrappedMonoid m -> () # | |
NFData a => NFData (Option a) | Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq | |
NFData (StableName a) | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq rnf :: StableName a -> () # | |
NFData a => NFData (ZipList a) | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData a => NFData (Identity a) | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData (IORef a) | NOTE: Only strict in the reference and not the referenced value. Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq | |
NFData a => NFData (First a) | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData a => NFData (Last a) | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData a => NFData (Dual a) | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData a => NFData (Sum a) | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData a => NFData (Product a) | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData a => NFData (Down a) | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData (MVar a) | NOTE: Only strict in the reference and not the referenced value. Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq | |
NFData a => NFData (NonEmpty a) | Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq | |
NFData a => NFData (IntMap a) | |
Defined in Data.IntMap.Internal | |
NFData a => NFData (Tree a) | |
NFData a => NFData (Seq a) | |
Defined in Data.Sequence.Internal | |
NFData a => NFData (FingerTree a) | |
Defined in Data.Sequence.Internal rnf :: FingerTree a -> () # | |
NFData a => NFData (Digit a) | |
Defined in Data.Sequence.Internal | |
NFData a => NFData (Node a) | |
Defined in Data.Sequence.Internal | |
NFData a => NFData (Elem a) | |
Defined in Data.Sequence.Internal | |
NFData a => NFData (Set a) | |
Defined in Data.Set.Internal | |
NFData a => NFData (Hashed a) | |
Defined in Data.Hashable.Class | |
NFData a => NFData (Array a) | |
Defined in Data.Primitive.Array | |
NFData g => NFData (StateGen g) | |
Defined in System.Random.Internal | |
NFData a => NFData (HashSet a) | |
Defined in Data.HashSet.Internal | |
NFData a => NFData (Array a) | |
Defined in Data.HashMap.Internal.Array | |
NFData value => NFData (RunResult value) Source # | |
Defined in Development.Shake.Internal.Core.Types | |
NFData (a -> b) | This instance is for convenience and consistency with Since: deepseq-1.3.0.0 |
Defined in Control.DeepSeq | |
(NFData a, NFData b) => NFData (Either a b) | |
Defined in Control.DeepSeq | |
(NFData a, NFData b) => NFData (a, b) | |
Defined in Control.DeepSeq | |
(NFData a, NFData b) => NFData (Array a b) | |
Defined in Control.DeepSeq | |
NFData (Fixed a) | Since: deepseq-1.3.0.0 |
Defined in Control.DeepSeq | |
(NFData a, NFData b) => NFData (Arg a b) | Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq | |
NFData (Proxy a) | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData (STRef s a) | NOTE: Only strict in the reference and not the referenced value. Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq | |
(NFData k, NFData a) => NFData (Map k a) | |
Defined in Data.Map.Internal | |
(NFData k, NFData v) => NFData (Leaf k v) | |
Defined in Data.HashMap.Internal | |
(NFData k, NFData v) => NFData (HashMap k v) | |
Defined in Data.HashMap.Internal | |
(NFData a1, NFData a2, NFData a3) => NFData (a1, a2, a3) | |
Defined in Control.DeepSeq | |
NFData a => NFData (Const a b) | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
NFData (a :~: b) | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
(NFData a1, NFData a2, NFData a3, NFData a4) => NFData (a1, a2, a3, a4) | |
Defined in Control.DeepSeq | |
(NFData1 f, NFData1 g, NFData a) => NFData (Product f g a) | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
(NFData1 f, NFData1 g, NFData a) => NFData (Sum f g a) | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
NFData (a :~~: b) | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5) => NFData (a1, a2, a3, a4, a5) | |
Defined in Control.DeepSeq | |
(NFData1 f, NFData1 g, NFData a) => NFData (Compose f g a) | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6) => NFData (a1, a2, a3, a4, a5, a6) | |
Defined in Control.DeepSeq | |
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7) => NFData (a1, a2, a3, a4, a5, a6, a7) | |
Defined in Control.DeepSeq | |
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7, NFData a8) => NFData (a1, a2, a3, a4, a5, a6, a7, a8) | |
Defined in Control.DeepSeq | |
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7, NFData a8, NFData a9) => NFData (a1, a2, a3, a4, a5, a6, a7, a8, a9) | |
Defined in Control.DeepSeq |