Skip to content

Instantly share code, notes, and snippets.

@reite
Last active December 17, 2015 06:49
Show Gist options
  • Save reite/5568677 to your computer and use it in GitHub Desktop.
Save reite/5568677 to your computer and use it in GitHub Desktop.
objToArray :: Value -> Array
objToArray obj@(Object v) = V.singleton obj
--I need a value of type Value for further processing. How can I make the result Array into a Value type?
-- Definitions of types from source of Data.Aeson.Types
-- | A JSON \"object\" (key\/value map).
type Object = HashMap Text Value
-- | A JSON \"array\" (sequence).
type Array = Vector Value
-- | A JSON value represented as a Haskell value.
data Value = Object !Object
| Array !Array
| String !Text
| Number !Number
| Bool !Bool
| Null
deriving (Eq, Show, Typeable)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment