ghc-typelits-extra: Additional type-level operations on GHC.TypeLits.Nat

[ bsd2, library, type-system ] [ Propose Tags ] [ Report a vulnerability ]

Additional type-level operations on GHC.TypeLits.Nat:

  • Max: type-level max

  • Min: type-level min

  • Div: type-level div

  • Mod: type-level mod

  • FLog: type-level equivalent of integerLogBase# i.e. the exact integer equivalent to floor (logBase x y)

  • CLog: type-level equivalent of the ceiling of integerLogBase# i.e. the exact integer equivalent to ceiling (logBase x y)

  • Log: type-level equivalent of integerLogBase# where the operation only reduces when floor (logBase b x) ~ ceiling (logBase b x)

  • GCD: a type-level gcd

  • LCM: 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.


[Skip to Readme]

Flags

Manual Flags

NameDescriptionDefault
deverror

Enables `-Werror` for development mode and TravisCI

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1, 0.1.1, 0.1.2, 0.1.3, 0.2, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 0.2.6, 0.3, 0.3.1, 0.3.2, 0.3.3, 0.4, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.4.5, 0.4.6, 0.4.7
Change log CHANGELOG.md
Dependencies base (>=4.8 && <5), containers (>=0.5.7.1 && <0.7), ghc (>=7.10 && <9.6), ghc-bignum (>=1.0 && <1.4), ghc-prim (>=0.5 && <1.0), ghc-tcplugins-extra (>=0.3.1), ghc-typelits-knownnat (>=0.7.2 && <0.8), ghc-typelits-natnormalise (>=0.7.1 && <0.8), integer-gmp (>=1.0 && <1.1), transformers (>=0.4.2.0 && <0.6) [details]
Tested with ghc ==8.0.2, ghc ==8.2.2, ghc ==8.4.4, ghc ==8.6.5, ghc ==8.8.4, ghc ==8.10.7, ghc ==9.0.2, ghc ==9.2.4, ghc ==9.4.2
License BSD-2-Clause
Copyright Copyright © 2015-2016, University of Twente, 2017-2018, QBayLogic B.V.
Author Christiaan Baaij
Maintainer christiaan.baaij@gmail.com
Category Type System
Home page http://www.clash-lang.org/
Bug tracker http://github.com/clash-lang/ghc-typelits-extra/issues
Source repo head: git clone https://github.com/clash-lang/ghc-typelits-extra.git
Uploaded by ChristiaanBaaij at 2022-10-21T15:31:23Z
Distributions Arch:0.4.4, LTSHaskell:0.4.7, NixOS:0.4.7, Stackage:0.4.7
Reverse Dependencies 9 direct, 13 indirect [details]
Downloads 18518 total (148 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2022-10-21 [all 1 reports]

Readme for ghc-typelits-extra-0.4.4

[back to package description]

ghc-typelits-extra

Build Status Hackage Hackage Dependencies

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 max
  • GHC.TypeLits.Extra.Min: type-level min
  • GHC.TypeLits.Extra.Div: type-level div
  • GHC.TypeLits.Extra.Mod: type-level mod
  • GHC.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 of integerLogBase# .i.e. the exact integer equivalent to "ceiling (logBase x y)"
  • 'GHC.TypeLits.Extra.Log': type-level equivalent of <https://hackage.haskell.org/package/integer-gmp/docs/GHC-Integer-Logarithms.html#v:integerLogBase-35- integerLogBase#> where the operation only reduces when "floor (logBase b x) ~ ceiling (logBase b x)"
  • GHC.TypeLits.Extra.GCD: a type-level gcd
  • GHC.TypeLits.Extra.LCM: a type-level lcm