Bin: binary natural numbers.

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow to host generated Haddocks.

GPL-2.0-or-later licensed by Oleg Grenrus
Maintained by Oleg.Grenrus

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


  • First version. Released on an unsuspecting world.