[Haskell-cafe] type families with non-type indices
gesh at gesh.uni.cx
Wed Oct 8 12:54:50 UTC 2014
On 2014-10-08 15:28, Doug McIlroy wrote:
> Is there an analog or variant of type families that is indexed
> by values rather than by types?
It depends on what you want from your indices. If all you want is
to lift values to types and back, then the 'reflection' package is
what you want. This suffices to define modulo-bearing numbers and
local typeclass instances, for example.
You might also want to look into the 'singletons' package, which
to my understanding provides lifted functions and Template Haskell to
lift values to the type level. However, I haven't investigated this
package in any depth, so take this paragraph with a grain of salt.
 - https://hackage.haskell.org/package/reflection
 - https://hackage.haskell.org/package/singletons
More information about the Haskell-Cafe