I’ve recently started working on adding support for Type-level Integers and would like to open an RFC regarding the following features. As a short introduction, this PR essentially adds syntax for type-level integers (kinded with the Int type), as well as type classes for operations such Add, Mul, Compare, and IsReflectable. I’d like to ask about the following concerns that we’ve encountered in the PR, in no particular order.
-
IsReflectable's name was chosen as to parallel the existing convention withIsSymbol, whose purpose it also overrides. As discussed in the PR, other names forIsReflectablecan beReflectable,Reifies,Reflect, orReify. Breaking precedence with these alternative options seems optimal if we eventually want to removeIsSymbolin the future, as well as to makeSymbols kinded withStringinstead.
class IsReflectable t v | v -> t where
reflectType :: forall proxy. proxy v -> t
- With regards to a type-level
DivModoperation, what are some possible “practical” use-cases for it? Existing packages which depend on typelevel-peano only seem to make use of addition/multiplication. At the moment,DivModis constrained as to only allow for denominators that are> 0, and there’s also the question whether or not negative denominators are significant enough to relax this constraint.
class (Compare 0 denominator LT) <= DivMod (numerator :: Int) (denominator :: Int) (quotient :: Int) (remainder :: Int) | numerator denominator -> quotient remainder
- The
Comparetype class for type-level integers involves a solving algorithm which can infer relationships like so. ShouldComparethis be backported forSymbols as well?
