-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Define a Lift
version for Version
and related data types
#68
Comments
`versions-6.0.*` removes the `VChunk` data type, which `what4` defines an orphan `Lift` instance for. This requires some CPP to fix up. This is somewhat messy, and in an ideal world, we'd move these orphan instances directly to the `versions` library. (See also fosskers/versions#68.) Fixes #240.
`versions-6.0.*` removes the `VChunk` data type, which `what4` defines an orphan `Lift` instance for. This requires some CPP to fix up. This is somewhat messy, and in an ideal world, we'd move these orphan instances directly to the `versions` library. (See also fosskers/versions#68.) Fixes #240.
Sure. Can you suggest a unit test that could be used to verify it? |
@RyanGlScott Can you test the linked PR and see if it works for you? If so I'll make a release. |
Thanks, @fosskers! That PR gives me exactly what I need.
The way we are using this functionality in the ver :: Text -> Q Exp
ver nm =
case Versions.version nm of
Left err -> fail (errorBundlePretty err)
Right v -> lift v
... $(ver "0") ... So you could test something like You could also test that supplied an invalid version throws a compile-time error, e.g., |
Thanks a lot, I'll incorporate those! |
Released as |
It is very useful to be able to call the
version
function within a Template Haskell splice so that one can throw a compile-time error if the version number is malformed:Currently, this function doesn't work out of the box, as the
Version
data type (whichversion
returns) does not define aLift
instance. As a result, we have to define our own orphanLift
instances to make this work.Would you be OK with defining the
Lift
instances directly in theversions
library? Something like this would suffice:The text was updated successfully, but these errors were encountered: