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

fromSql for invalid SQL column value #155

Open
jchia opened this issue Nov 3, 2020 · 0 comments
Open

fromSql for invalid SQL column value #155

jchia opened this issue Nov 3, 2020 · 0 comments

Comments

@jchia
Copy link
Contributor

jchia commented Nov 3, 2020

Suppose I want to make an SqlType instance for my own data type that can be represented as a value in an SQL column. E.g. I want to represent integers from 0 to 1000:

newtype SmallInt = SmallInt { unSmallInt :: Int }

I could define mkLit (SmallInt x) = LInt x. However, converting in the other direction, what should be done in fromSql if the input is an out-of-range SqlInt value? Just error? How does the user detect an error in the input when running a query?

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

No branches or pull requests

1 participant