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

DynamoDB: Support for nested records #193

Open
angerman opened this issue Mar 24, 2016 · 0 comments
Open

DynamoDB: Support for nested records #193

angerman opened this issue Mar 24, 2016 · 0 comments

Comments

@angerman
Copy link
Contributor

I just came across the need for something like this:

getItem :: FromDynItem a => Text -> Item -> Parser a
getItem k m =
  case M.lookup k m of
    Nothing -> fail ("Key " <> T.unpack k <> " not found")
    Just (DMap dv) -> either (fail "...") return $ fromItem dv
    _       -> fail ("Key " <> T.unpack k <> " is not a map!")

which basically allows to use getItem like getAttr to produce nested
data types.

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