HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Moduleserialise-0.2.6.1Haskell2010

Codec.Serialise.Properties

This module contains a set of generally useful properties, which instance authors are encouraged to use in order to test their instances of the Serialise class. For example, if you have a data type which you might derive or write instances for:

data Foo = Foo { fooInt :: Int, fooBool :: Bool }
  deriving (Eq, Show, Generic)
-- or, alternatively
instance Serialise Foo where
  encode = ...
  decode = ...

Then you can use this module to easily derive some quick properties:

import qualified Codec.Serialise.Properties as Props

fooSerialiseId :: Foo -> Bool
fooSerialiseId = Props.serialiseIdentity

fooFlatTermId :: Foo -> Bool
fooFlatTermId = Props.flatTermIdentity

fooHasValidFlatTerm :: Foo -> Bool
fooHasValidFlatTerm = Props.hasValidFlatTerm

You can then conveniently use these three functions with QuickCheck, for example.

Contents
  1. CBOR Properties
  2. FlatTerm Properties
Synopsis
  • Packageserialise-0.2.6.1
  • Exports3
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceProperties.hs

CBOR Properties

FlatTerm Properties