yesodweb / yesodweb/persistent
Create `To/FromPersistValues` classes
Open
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 486
- Forks
- 306
- PR merge metrics
- No merged PRs in 30d
Description
In #1321 I discussed a new pair of type classes. THe first one is easy:
class ToPersistValues a where
toPersistValues :: a -> [PersistValue]
But the second is a bit more tricky.
class FromPersistValues a where
fromPersistValues :: RowParser a
newtype RowParser a
= RowParser
{ unRowParser :: ExceptT Text (State [PersistValue]) a
}
I think that's a good way to approach it - we'd ideally want to be able to have instances like:
instance (FromPersistValues a, FromPersistValues b) => FromPersistValues (a, b) where
fromPersistValues = (,) <$> fromPersistValues <*> fromPersistValues
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading issue #1321 for the discussion behind the proposed ToPersistValues and FromPersistValues classes, then inspect the existing persistence and RowParser APIs. Done means the two classes and the proposed tuple-style composition approach are defined consistently with the project’s existing types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100