canonical-json-0.6.0.0: Canonical JSON for signing and hashing JSON values

Copyright(c) Edsko de Vries Duncan Coutts 2015
Safe HaskellNone
LanguageHaskell2010

Text.JSON.Canonical.Class

Contents

Description

Type classes and utilities for converting to and from JSValue.

Synopsis

Type classes

class ToJSON m a where Source #

Methods

toJSON :: a -> m JSValue Source #

Instances
Monad m => ToJSON m Int54 Source # 
Instance details

Defined in Text.JSON.Canonical.Class

Methods

toJSON :: Int54 -> m JSValue Source #

Monad m => ToJSON m String Source # 
Instance details

Defined in Text.JSON.Canonical.Class

Methods

toJSON :: String -> m JSValue Source #

Monad m => ToJSON m JSString Source # 
Instance details

Defined in Text.JSON.Canonical.Class

Methods

toJSON :: JSString -> m JSValue Source #

Monad m => ToJSON m JSValue Source # 
Instance details

Defined in Text.JSON.Canonical.Class

Methods

toJSON :: JSValue -> m JSValue Source #

(Monad m, ToJSON m a) => ToJSON m [a] Source # 
Instance details

Defined in Text.JSON.Canonical.Class

Methods

toJSON :: [a] -> m JSValue Source #

(Monad m, ToObjectKey m k, ToJSON m a) => ToJSON m (Map k a) Source # 
Instance details

Defined in Text.JSON.Canonical.Class

Methods

toJSON :: Map k a -> m JSValue Source #

class FromJSON m a where Source #

Methods

fromJSON :: JSValue -> m a Source #

Instances
ReportSchemaErrors m => FromJSON m Int54 Source # 
Instance details

Defined in Text.JSON.Canonical.Class

Methods

fromJSON :: JSValue -> m Int54 Source #

ReportSchemaErrors m => FromJSON m String Source # 
Instance details

Defined in Text.JSON.Canonical.Class

Methods

fromJSON :: JSValue -> m String Source #

ReportSchemaErrors m => FromJSON m JSString Source # 
Instance details

Defined in Text.JSON.Canonical.Class

Monad m => FromJSON m JSValue Source # 
Instance details

Defined in Text.JSON.Canonical.Class

(ReportSchemaErrors m, FromJSON m a) => FromJSON m [a] Source # 
Instance details

Defined in Text.JSON.Canonical.Class

Methods

fromJSON :: JSValue -> m [a] Source #

(ReportSchemaErrors m, Ord k, FromObjectKey m k, FromJSON m a) => FromJSON m (Map k a) Source # 
Instance details

Defined in Text.JSON.Canonical.Class

Methods

fromJSON :: JSValue -> m (Map k a) Source #

class ToObjectKey m a where Source #

Used in the ToJSON instance for Map

Methods

toObjectKey :: a -> m JSString Source #

Instances
Monad m => ToObjectKey m String Source # 
Instance details

Defined in Text.JSON.Canonical.Class

Monad m => ToObjectKey m JSString Source # 
Instance details

Defined in Text.JSON.Canonical.Class

class FromObjectKey m a where Source #

Used in the FromJSON instance for Map

Methods

fromObjectKey :: JSString -> m (Maybe a) Source #

Instances
Monad m => FromObjectKey m String Source # 
Instance details

Defined in Text.JSON.Canonical.Class

Monad m => FromObjectKey m JSString Source # 
Instance details

Defined in Text.JSON.Canonical.Class

class (Applicative m, Monad m) => ReportSchemaErrors m where Source #

Monads in which we can report schema errors

Methods

expected :: Expected -> Maybe Got -> m a Source #

Utility

fromJSField :: (ReportSchemaErrors m, FromJSON m a) => JSValue -> JSString -> m a Source #

Extract a field from a JSON object

mkObject :: forall m. Monad m => [(JSString, m JSValue)] -> m JSValue Source #