[Haskell-cafe] Type-level numbers problem
Dmitry Dzhus
dima at dzhus.org
Mon Aug 18 19:51:29 UTC 2014
18.08.2014, 23:16, "Konstantine Rybnikov" <k-bx at k-bx.com>:
> The 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'
Hello Konstantine,
I think you're using GHC 7.6.x series which had no solver
for type-level natural numbers, resulting in 0+1
not typechecking with 1.
You may find some history in https://ghc.haskell.org/trac/ghc/ticket/4385.
With GHC 7.8 this compiles fine.
Probably you can overcome the issue by providing
the required instances of `+` type family
by hand (up to the desired number), but it's hackish
and may be tedious without TH. Just switch to 7.8 already.
More information about the Haskell-Cafe
mailing list