foundation icon indicating copy to clipboard operation
foundation copied to clipboard

Add Type-level Nat-sized version of Block (BlockN)

Open tekul opened this issue 8 years ago • 3 comments

This will be analogous to SList (which should probably be renamed to ListN).

tekul avatar Jun 09 '17 15:06 tekul

I'm trying to write some tests and having doubts about the usability of the code. For example if I try to write a simple test using cons followed by uncons, the compiler complains (for uncons) that Natural (n+1) is out of bounds for Int. I have to add both NatWithinBound Int n and NatWithinBound Int (n+1)) to the test function. It then complains about CmpNat 0 (n+1) ~ 'LT and so on. It seems to all be part of the problem that ghc can't really add numbers in types, but I'm not sure how to get round this.

tekul avatar Jun 15 '17 12:06 tekul

I think you're hitting the normal problem of current nats. at the moment the only way is the plugin: https://github.com/yav/type-nat-solver

If the code is ready it's probably fine to start pushing even without tests, we can probably already use for just simple constraint like hardcoded value for API like 16 for block size.

vincenthz avatar Jun 15 '17 13:06 vincenthz

OK, thanks. I'll make a PR tomorrow. Have to go to Biel just now :).

On 15 Jun 2017 3:57 pm, "Vincent Hanquez" [email protected] wrote:

I think you're hitting the normal problem of current nats. at the moment the only way is the plugin: https://github.com/yav/type-nat-solver

If the code is ready it's probably fine to start pushing even without tests, we can probably already use for just simple constraint like hardcoded value for API like 16 for block size.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/haskell-foundation/foundation/issues/298#issuecomment-308735890, or mute the thread https://github.com/notifications/unsubscribe-auth/AALs6DVBqopwYw9f47m8uQnhKjWvu7wIks5sETeZgaJpZM4N1e8F .

tekul avatar Jun 15 '17 14:06 tekul