docs.md
July 18, 2015 ยท View on GitHub
Module Data.JSON
JObject
type JObject = Map String JValue
JArray
type JArray = Array JValue
JParser
type JParser = Either String
JValue
data JValue
= JObject JObject
| JArray JArray
| JString String
| JNumber Number
| JInt Int
| JBool Boolean
| JNull
Instances
instance showValue :: Show JValue
instance eqValue :: Eq JValue
instance valueFromJSON :: FromJSON JValue
instance valueToJSON :: ToJSON JValue
FromJSON
class FromJSON a where
parseJSON :: JValue -> JParser a
Instances
instance valueFromJSON :: FromJSON JValue
instance boolFromJSON :: FromJSON Boolean
instance numberFromJSON :: FromJSON Number
instance intFromJSON :: FromJSON Int
instance unitFromJSON :: FromJSON Unit
instance stringFromJSON :: FromJSON String
instance arrayFromJSON :: (FromJSON a) => FromJSON (Array a)
instance tupleFromJSON :: (FromJSON a, FromJSON b) => FromJSON (Tuple a b)
instance eitherFromJSON :: (FromJSON a, FromJSON b) => FromJSON (Either a b)
instance maybeFromJSON :: (FromJSON a) => FromJSON (Maybe a)
instance setFromJSON :: (Ord a, FromJSON a) => FromJSON (Set a)
instance mapFromJSON :: (FromJSON a) => FromJSON (Map String a)
eitherDecode
eitherDecode :: forall a. (FromJSON a) => String -> Either String a
decode
decode :: forall a. (FromJSON a) => String -> Maybe a
fail
fail :: forall a. String -> JParser a
(.:)
(.:) :: forall a. (FromJSON a) => JObject -> String -> JParser a
left-associative / precedence -1
(.:?)
(.:?) :: forall a. (FromJSON a) => JObject -> String -> JParser (Maybe a)
left-associative / precedence -1
(.!=)
(.!=) :: forall a. JParser (Maybe a) -> a -> JParser a
left-associative / precedence -1
ToJSON
class ToJSON a where
toJSON :: a -> JValue
Instances
instance boolToJSON :: ToJSON Boolean
instance numberToJSON :: ToJSON Number
instance intToJSON :: ToJSON Int
instance stringToJSON :: ToJSON String
instance unitToJSON :: ToJSON Unit
instance arrayToJSON :: (ToJSON a) => ToJSON (Array a)
instance eitherToJSON :: (ToJSON a, ToJSON b) => ToJSON (Either a b)
instance mapToJSON :: (ToJSON a) => ToJSON (Map String a)
instance maybeToJSON :: (ToJSON a) => ToJSON (Maybe a)
instance setToJSON :: (ToJSON a) => ToJSON (Set a)
instance tupleToJSON :: (ToJSON a, ToJSON b) => ToJSON (Tuple a b)
instance valueToJSON :: ToJSON JValue
Pair
type Pair = Tuple String JValue
(.=)
(.=) :: forall a. (ToJSON a) => String -> a -> Pair
left-associative / precedence -1
object
object :: Array Pair -> JValue
encode
encode :: forall a. (ToJSON a) => a -> String