HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulebin-0.1.4Haskell2010

Data.Type.Bin

Binary natural numbers. DataKinds stuff.

  • 14 types
  • 2 classes
  • 12 values
  • Packagebin-0.1.4
  • Exports38
  • LanguageHaskell2010
  • LicenceGPL-2.0-or-later
  • SourceBin.hs

Singleton

6 declarations
datadata SBin (b :: Bin) where
#

Singleton of Bin.

Constructors

Instances10TestEquality, EqP, GEq, GNFData, GShow, Eq, …
  • TestEquality SBinDefined in bin-0.1.4 · Data.Type.Bin
  • EqP SBinDefined in bin-0.1.4 · Data.Type.Bin
  • GEq SBinDefined in bin-0.1.4 · Data.Type.Bin
  • GNFData SBinDefined in bin-0.1.4 · Data.Type.Bin
  • GShow SBinDefined in bin-0.1.4 · Data.Type.Bin
  • Eq (SBin a)Defined in bin-0.1.4 · Data.Type.Bin
  • Ord (SBin a)Defined in bin-0.1.4 · Data.Type.Bin
  • Show (SBin b)Defined in bin-0.1.4 · Data.Type.Bin
  • NFData (SBin n)Defined in bin-0.1.4 · Data.Type.Bin
  • SBinI b => Boring (SBin b)Defined in bin-0.1.4 · Data.Type.Bin
datadata SBinP (b :: BinP) where
#

Singleton of BinP.

Constructors

Instances10TestEquality, EqP, GEq, GNFData, GShow, Eq, …

Implicit

7 declarations
classclass SBinI (b :: Bin) where
#

Let constraint solver construct SBin.

Methods

Instances2SBinI
  • SBinI 'BZDefined in bin-0.1.4 · Data.Type.Bin
  • SBinPI b => SBinI ('BP b)Defined in bin-0.1.4 · Data.Type.Bin
valuereify :: Bin -> (forall (b :: Bin). SBinI b => Proxy b -> r) -> r
#

Reify Bin

Example1 expression
reify bin3 reflect3

Type equality

2 declarations

Induction

1 declaration

Arithmetic

0 declarations

Successor

Predecessor

familytype family Pred (b :: BinP) :: Bin where
#

Predecessor type family..

Example1 expression
:kind! Pred BP.BinP1Pred BP.BinP1 :: Bin= 'BZ
Example1 expression
:kind! Pred BP.BinP5 == Bin4Pred BP.BinP5 == Bin4 :: Bool= 'True
Example1 expression
:kind! Pred BP.BinP8 == Bin7Pred BP.BinP8 == Bin7 :: Bool= 'True
Example1 expression
:kind! Pred BP.BinP6 == Bin5Pred BP.BinP6 == Bin5 :: Bool= 'True

Equations

Addition

familytype family Plus (a :: Bin) (b :: Bin) :: Bin where
#

Addition.

Example1 expression
:kind! Plus Bin3 Bin3 == Bin6Plus Bin3 Bin3 == Bin6 :: Bool= 'True
Example1 expression
:kind! Mult2 Bin3 == Bin6Mult2 Bin3 == Bin6 :: Bool= 'True

Equations

Extras

familytype family Mult2 (b :: Bin) :: Bin where
#

Multiply by two.

Example1 expression
:kind! Mult2 Bin0 == Bin0Mult2 Bin0 == Bin0 :: Bool= 'True
Example1 expression
:kind! Mult2 Bin3 == Bin6Mult2 Bin3 == Bin6 :: Bool= 'True

Equations

familytype family Mult2Plus1 (b :: Bin) :: BinP where
#

Multiply by two and add one.

Example1 expression
:kind! Mult2Plus1 Bin0Mult2Plus1 Bin0 :: BinP= 'BE
Example1 expression
:kind! Mult2Plus1 Bin4 == BinP9Mult2Plus1 Bin4 == BinP9 :: Bool= 'True

Equations

Conversions

0 declarations

To GHC Nat

familytype family ToGHC (b :: Bin) :: Nat where
#

Convert to GHC Nat.

Example1 expression
:kind! ToGHC Bin5ToGHC Bin5 :: GHC.Nat...= 5

Equations

familytype family FromGHC (n :: Nat) :: Bin where
#

Convert from GHC Nat.

Example1 expression
:kind! FromGHC 7FromGHC 7 :: Bin= 'BP ('B1 ('B1 'BE))

Equations

  • FromGHC n = FromGHC' (GhcDivMod2 n)

To fin Nat

familytype family ToNat (b :: Bin) :: Nat where
#

Convert to fin Nat.

Example1 expression
:kind! ToNat Bin5ToNat Bin5 :: Nat= 'S ('S ('S ('S ('S 'Z))))

Equations

familytype family FromNat (n :: Nat) :: Bin where
#

Convert from fin Nat.

Example1 expression
:kind! FromNat N.Nat5FromNat N.Nat5 :: Bin= 'BP ('B1 ('B0 'BE))

Equations

Aliases

10 declarations