con-kitty / categorifier

Interpret Haskell programs into any cartesian closed category.
BSD 3-Clause "New" or "Revised" License
57 stars 2 forks source link

Add support for `ghc-bignum` #102

Closed sellout closed 7 months ago

sellout commented 8 months ago

GHC 9 moved bignum (Integer and Natural) implementations to a new library, which exposes new operations. Previously, instances were derived. These new operations need explicit Categorifier support.

Fixes #99.

sellout commented 8 months ago

For now, this requires adding a dependency on categorifier-ghc-bignum-integration and the following GHC flags:

-fplugin-opt Categorifier:lookup:Categorifier.GhcBignum.Integration.symbolLookup
-fplugin-opt Categorifier:maker-map:Categorifier.GhcBignum.Integration.makerMapFun

but since this library is depended-on by base and these operations can be encountered by using types exposed by base, these should be part of the “core” plugin flags (conditional on GHC 9 being used).

I’m waffling on the best way to do that. Of course, my inclination is always more packages – e.g., split categorifier-plugin into three packages like

graph BT
  bignum(categorifier-ghc-bignum-integration) --> integration(categorifier-integration)
  base(categorifier-base-integration) --> integration
  base --> bignum
  plugin(categorifier-plugin) --> base

Then users should still only need to depend on categorifier-plugin to get base (and ghc-bignum) support, but we can still partition everything by library. And extracting base (by far the biggest “integration”) might help solidify the API for other integrations.