Comment by viraptor
6 years ago
> how do you describe type "such value doesn't exist in the db table yet"?
Depends what you mean by that, but depending on the context, you may not want this in a type.
If it's a "Dirty" value / not inserted yet, you can just wrap it with "newtype Dirty ... = SomeRecordType ...".
If you mean something that you just checked that isn't in the database, you probably just want a properly named true/false, or a Maybe result. Encoding the value itself as not existing in the database will just bite you when something else inserts one in the meantime.
No comments yet
Contribute on Hacker News ↗