GPL-2.0-or-later licensed by Oleg Grenrus
Maintained by Oleg.Grenrus
This version can be pinned in stack with:bin-0.1.3@sha256:a6bae4bdbcc2d49504bd21b9fd1dbf4cfaa5750d42662be56b684752b18049e8,2386

Module documentation for 0.1.3

Used by 1 package in lts-21.11(full list with versions):

This package provides binary natural numbers (Data.Bin); also utilities to work on the type level with DataKinds (Data.Type.Bin).

data Bin
    = BZ       -- ^ zero
    | BP BinP  -- ^ non-zero

data BinP
    = BE       -- ^ one
    | B0 BinP  -- ^ double
    | B1 BinP  -- ^ double plus 1

There are ordinals in Data.Bin.Pos module, as well as fixed width integers in Data.Wrd.

Another implementation is at, this differs in naming, and provides promoted variant.


Version history for bin


  • Add EqP and OrdP instances.
  • Add GShow Pos/P instances.
  • Better ‘PosP.toNatural’ implementation.


  • Add boring instances
  • Add EqBinP and EqBin type families
  • Add NFData instances
  • Add GEq, GNFData, GShow (from some package) instances for SBin and SBinP.


  • Explicitly mark all modules as Safe or Trustworthy.
  • fin-0.2 support.


  • First version. Released on an unsuspecting world.