cassava
cassava copied to clipboard
Add 'lookupChoice' and '(.::)'
This helper function allows code like:
data Person = Person { first :: ByteString, last :: ByteString }
instance FromNamedRecord Person where
parseNamedRecord r =
Person <$> r .:: ["firstName", "fname"] <*> lookupChoice r ["lastName", "lname"]
which is useful when working with a small set of similarly-structured CSV files, or where field names vary slightly.
Let me know if you need version numbers bumped, more docs, etc before merging.