Additional type-level operations on GHC.TypeLits.Nat.
Additional type-level operations on GHC.TypeLits.Nat
:
Max
: type-level maxMin
: type-level minDiv
: type-level divMod
: type-level modFLog
: type-level equivalent of integerLogBase# i.e. the exact integer equivalent tofloor (logBase x y)
CLog
: type-level equivalent of the ceiling ofintegerLogBase# i.e. the exact integer equivalent toceiling (logBase x y)
Log
: type-level equivalent of integerLogBase# where the operation only reduces whenfloor (logBase b x) ~ ceiling (logBase b x)
GCD
: a type-level gcdLCM
: a type-level lcm
And a custom solver for the above operations defined in GHC.TypeLits.Extra.Solver
as a GHC type-checker plugin. To use the plugin, add the
OPTIONS_GHC -fplugin GHC.TypeLits.Extra.Solver
pragma to the header of your file.
ghc-typelits-extra
Extra type-level operations on GHC.TypeLits.Nat and a custom solver implemented as a GHC type-checker plugin:
GHC.TypeLits.Extra.Max
: type-level maxGHC.TypeLits.Extra.Min
: type-level minGHC.TypeLits.Extra.Div
: type-level divGHC.TypeLits.Extra.Mod
: type-level modGHC.TypeLits.Extra.FLog
: type-level equivalent of integerLogBase# .i.e. the exact integer equivalent to "floor (logBase x y)
"GHC.TypeLits.Extra.CLog
: type-level equivalent of the ceiling ofintegerLogBase# .i.e. the exact integer equivalent to "ceiling (logBase x y)
"- 'GHC.TypeLits.Extra.Log': type-level equivalent of integerLogBase# where the operation only reduces when "
floor (logBase b x) ~ ceiling (logBase b x)
" GHC.TypeLits.Extra.GCD
: a type-level gcdGHC.TypeLits.Extra.LCM
: a type-level lcm.