<div dir="ltr">I have to admit that is a heck of a lot easier to use than what I have:<div><br></div><div><a href="https://github.com/ekmett/constraints/blob/master/src/Data/Constraint/Nat.hs">https://github.com/ekmett/constraints/blob/master/src/Data/Constraint/Nat.hs</a><br></div><div><br></div><div>=)</div><div><br></div><div>-Edward</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 17, 2016 at 9:11 AM, Christiaan Baaij <span dir="ltr"><<a href="mailto:christiaan.baaij@gmail.com" target="_blank">christiaan.baaij@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
If you have ever worked with `GHC.TypeLits`, then you have probably encountered an error very similar to:<br>
<br>
>    • Could not deduce (KnownNat (n + 2))<br>
>        arising from a use of ‘natVal’<br>
>      from the context: KnownNat n<br>
<br>
i.e. where GHC cannot infer a `KnownNat (n+2)` constraint, even though a `KnownNat n` constraint is already given.<br>
<br>
Enter <a href="http://hackage.haskell.org/package/ghc-typelits-knownnat" rel="noreferrer" target="_blank">http://hackage.haskell.org/pac<wbr>kage/ghc-typelits-knownnat</a><br>
A type-checker plugin that can automatically derive "complex" KnownNat constraints from simpler ones.<br>
<br>
To use it, you simply add the<br>
<br>
{-# OPTIONS_GHC -fplugin GHC.TypeLits.KnownNat.Solver #-}<br>
<br>
pragma to the top of your file.<br>
<br>
If you want to know more, you can also check out the corresponding blog posts:<br>
<br>
<a href="http://qbaylogic.com/blog/2016/08/10/solving-knownnat-constraints-plugin.html" rel="noreferrer" target="_blank">http://qbaylogic.com/blog/2016<wbr>/08/10/solving-knownnat-constr<wbr>aints-plugin.html</a><br>
<a href="http://qbaylogic.com/blog/2016/08/17/solving-knownnat-custom-operations.html" rel="noreferrer" target="_blank">http://qbaylogic.com/blog/2016<wbr>/08/17/solving-knownnat-custom<wbr>-operations.html</a><br>
<br>
Regards,<br>
<br>
Christiaan<br>
______________________________<wbr>_________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bi<wbr>n/mailman/listinfo/haskell-caf<wbr>e</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div><br></div>