Hi!
I wrote one thing with type-level numbers that were represented as simple
data Zero
data Succ a
Then, in order to not invent my own peano numbers, I decided to go look for ones, and found GHC.TypeLits. But unfortunately, it shows a weird error for me.
Here is a piece of code:
https://gist.github.com/k-bx/a7b49165399658f87358The one that's below "main" is working properly, while the one on top of it gives this error:
typenats.hs:17:16:
No instance for (Op D (0 + 1)) arising from a use of `f'
Possible fix: add an instance declaration for (Op D (0 + 1))
In the expression: f (VJ i :: VJ D (0 + 1))
In an equation for `f': f (VJ i) = f (VJ i :: VJ D (0 + 1))
In the instance declaration for `Op D 0'
Maybe I worked too much on type-level numbers today to not understand this simple error I'm getting, but could someone be so kind and explain me what am I doing wrong?