Skip to content
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

Persistent Entity Declaration QuasiQuote doesn't support type literals #562

Closed
pseudonom opened this issue May 17, 2016 · 2 comments · Fixed by #1388
Closed

Persistent Entity Declaration QuasiQuote doesn't support type literals #562

pseudonom opened this issue May 17, 2016 · 2 comments · Fixed by #1388

Comments

@pseudonom
Copy link

pseudonom commented May 17, 2016

e.g. If you try to do

import Data.Finite
...

share [mkPersist sqlSettings, mkMigrate "migration"] [persistLowerCase|
  foo (Finite 20)
|]

you're met with an error like Invalid field type "Finite 2001" PSFail ('2',"001").

This is an artifact of https://github.com/yesodweb/persistent/blob/master/persistent/Database/Persist/Quasi.hs#L63 and not any fundamental limitation. type Twenty = 20 works fine as a workaround.

@snoyberg
Copy link
Member

I don't have an inherit objection to adding support for type level literals, just a vague concern that the error messages could end up being confusing for users. Want to take a stab at a PR to generalize the parser here?

@parsonsmatt
Copy link
Collaborator

This should be relatively straightforward to add in the parser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants