PROPOSAL: Add 'Natural' type to base:Data.Word

Richard Eisenberg eir at cis.upenn.edu
Wed Nov 12 20:07:07 UTC 2014


On Nov 12, 2014, at 2:16 PM, Iavor Diatchki <iavor.diatchki at gmail.com> wrote:

> As Richard points out, with the current implementation the two would be unrelated: type-level nats belong to the kind `Nat`, which is just a lifted empty type called `Nat`.   I think it would be possible to modify the implementation, to link the two:  when promoting, GHC would promote `Natural` to an empty kind, and we'd modify the type-literals to have kind `Natural` instead of `Nat`.   I imagine that should not be too hard to do.   From a design point of view, I don't know if this is a good idea, but I have not thought about it.  As a data point, we don't do this for kind `Symbol` (i.e., it is not linked in any way `String` or `Text`).

I'm a big -1 on this idea. I think we can work toward having more of a unified story of term-level things and type-level things, and every bit of magic that we do like this makes that unified story harder to realize. So, while I agree that implementing Iavor's idea wouldn't be hard today, I would encourage us to wait until we can do this without magic.

Richard



More information about the Libraries mailing list