-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GHC.TypeLits.Witnesses is deprecated? #2
Comments
Yes, I have deprecated it for a while now, although I have started to maybe see it as a valid low-dependency/low compiletime replacement for singletons, so I might un-deprecate it in the future. w.r.t singletons, the hackage documentation provides a migration guide: https://hackage.haskell.org/package/typelits-witnesses-0.3.0.3/docs/GHC-TypeLits-Witnesses.html#g:1
|
Ok, thanks! Will have to get my head around this. |
Let me know if you would like any help migrating any specific piece of code :) |
Managed to get most of this code ported over to use singletons, but I am stuck on this:
which worked fine with
I tried changing that line to:
but that only causes this error:
later in the code. The problem seems to be that Any clues to a solution to this much appreciated. |
Ah yeah, the problem is that you need to bring in a witness of the inequality where you use a function that requires that inequality. Typically you can get around this without any singletons using typechecker plugins like https://hackage.haskell.org/package/ghc-typelits-knownnat and http://hackage.haskell.org/package/ghc-typelits-natnormalise . However, if those fail, you need to find some other way of bringing in the constraint. In this case, you can use the functions in GHC.TypeLits.Compare; in particular, |
n.b. I have uploaded a new release that overhauls GHC.TypeLits.Witnesses to be more or less a lite singletons clone as it pertains only to |
I would like to avoid the extra complication of compiler plugins, but I don't really understand the option involving
but that doesn't work. It doesn't seem to be a complete solution and I don't understand the rest of your proposed solution. If its of any help, the code is in the last two commits here: https://github.com/HuwCampbell/grenade/tree/topic/singletons |
Sorry for not getting back earlier; I've been on vacation :)
The main thing you would do at the value level is require something like |
With ghc 8.6.5, I get a deprecation warning with this module that suggests:
but the
singletons
package does not seem to have a repalcement. What am I missing?The text was updated successfully, but these errors were encountered: