Skip to content

Instantly share code, notes, and snippets.

@codedmart
Last active January 16, 2016 22:51
Show Gist options
  • Save codedmart/522d140c5c815288f1ea to your computer and use it in GitHub Desktop.
Save codedmart/522d140c5c815288f1ea to your computer and use it in GitHub Desktop.
-- Object (fromList [("paging_info",Object (fromList [("page_count",Number 1.0),("current_page",Number 1.0),("entity_count",Number 1.0),("entities_per_page",Number 1.0)])),("entities",Array [Object (fromList [("id",Number 4482.0),("type",String "HumanUser"),("login",String "person")])])])
findOne :: (ToJSON a, FromJSON b, AsValue b) => a -> App b
findOne sParams = do
r <- postShotgun sParams
let r' = r ^? nth 0 . key "entities" . _Array . nth 0
return r
-- Could not deduce (AsValue (Vector Value))
-- arising from a use of ‘nth’
-- from the context (ToJSON a, FromJSON b, AsValue b)
-- bound by the type signature for
-- findOne :: (ToJSON a, FromJSON b, AsValue b) => a -> App b
-- at src/Lib/Wreq.hs:55:12-58
-- In the second argument of ‘(.)’, namely ‘nth 0’
-- In the second argument of ‘(.)’, namely ‘_Array . nth 0’
-- In the second argument of ‘(.)’, namely
-- ‘key "entities" . _Array . nth 0’
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment