antiope-messages-7.0.1: Please see the README on Github at <https://github.com/arbor/antiope#readme>

Safe HaskellNone
LanguageHaskell2010

Antiope.Messages.Types

Synopsis

Documentation

data WithEncoded (fld :: Symbol) a where Source #

Represents a JSON value of type a that is encoded as a string in a field fld

Constructors

WithEncoded :: forall fld a. KnownSymbol fld => a -> WithEncoded fld a 
Instances
FromWith (WithEncoded x) Source # 
Instance details

Defined in Antiope.Messages.Types

Methods

fromWith :: WithEncoded x a -> a Source #

Eq a => Eq (WithEncoded fld a) Source # 
Instance details

Defined in Antiope.Messages.Types

Methods

(==) :: WithEncoded fld a -> WithEncoded fld a -> Bool #

(/=) :: WithEncoded fld a -> WithEncoded fld a -> Bool #

Ord a => Ord (WithEncoded fld a) Source # 
Instance details

Defined in Antiope.Messages.Types

Methods

compare :: WithEncoded fld a -> WithEncoded fld a -> Ordering #

(<) :: WithEncoded fld a -> WithEncoded fld a -> Bool #

(<=) :: WithEncoded fld a -> WithEncoded fld a -> Bool #

(>) :: WithEncoded fld a -> WithEncoded fld a -> Bool #

(>=) :: WithEncoded fld a -> WithEncoded fld a -> Bool #

max :: WithEncoded fld a -> WithEncoded fld a -> WithEncoded fld a #

min :: WithEncoded fld a -> WithEncoded fld a -> WithEncoded fld a #

Show a => Show (WithEncoded fld a) Source # 
Instance details

Defined in Antiope.Messages.Types

Methods

showsPrec :: Int -> WithEncoded fld a -> ShowS #

show :: WithEncoded fld a -> String #

showList :: [WithEncoded fld a] -> ShowS #

(KnownSymbol fld, ToJSON a) => ToJSON (WithEncoded fld a) Source # 
Instance details

Defined in Antiope.Messages.Types

(KnownSymbol fld, FromJSON a) => FromJSON (WithEncoded fld a) Source # 
Instance details

Defined in Antiope.Messages.Types

data With (fld :: Symbol) a where Source #

Represents a JSON value of type a in a field fld

Constructors

With :: forall fld a. KnownSymbol fld => a -> With fld a 
Instances
FromWith (With x) Source # 
Instance details

Defined in Antiope.Messages.Types

Methods

fromWith :: With x a -> a Source #

Eq a => Eq (With fld a) Source # 
Instance details

Defined in Antiope.Messages.Types

Methods

(==) :: With fld a -> With fld a -> Bool #

(/=) :: With fld a -> With fld a -> Bool #

Ord a => Ord (With fld a) Source # 
Instance details

Defined in Antiope.Messages.Types

Methods

compare :: With fld a -> With fld a -> Ordering #

(<) :: With fld a -> With fld a -> Bool #

(<=) :: With fld a -> With fld a -> Bool #

(>) :: With fld a -> With fld a -> Bool #

(>=) :: With fld a -> With fld a -> Bool #

max :: With fld a -> With fld a -> With fld a #

min :: With fld a -> With fld a -> With fld a #

Show a => Show (With fld a) Source # 
Instance details

Defined in Antiope.Messages.Types

Methods

showsPrec :: Int -> With fld a -> ShowS #

show :: With fld a -> String #

showList :: [With fld a] -> ShowS #

(KnownSymbol fld, ToJSON a) => ToJSON (With fld a) Source # 
Instance details

Defined in Antiope.Messages.Types

Methods

toJSON :: With fld a -> Value #

toEncoding :: With fld a -> Encoding #

toJSONList :: [With fld a] -> Value #

toEncodingList :: [With fld a] -> Encoding #

(KnownSymbol fld, FromJSON a) => FromJSON (With fld a) Source # 
Instance details

Defined in Antiope.Messages.Types

Methods

parseJSON :: Value -> Parser (With fld a) #

parseJSONList :: Value -> Parser [With fld a] #

class FromWith f where Source #

Extracts value from With and WithEncoded wrappers

Methods

fromWith Source #

Arguments

:: f a 
-> a

Extracts value from With and WithEncoded

Instances
FromWith (With x) Source # 
Instance details

Defined in Antiope.Messages.Types

Methods

fromWith :: With x a -> a Source #

FromWith (WithEncoded x) Source # 
Instance details

Defined in Antiope.Messages.Types

Methods

fromWith :: WithEncoded x a -> a Source #

fromWith2 :: (FromWith f, FromWith g) => f (g a) -> a Source #

Extracts a value from any combination of two With and/or WithEncoded

fromWith2 @(With "one" (WithEncoded "two" True)) == True

fromWith3 :: (FromWith f, FromWith g, FromWith h) => f (g (h a)) -> a Source #

Extracts a value from any combination of two With and/or WithEncoded

fromWith3 @(With "one" (WithEncoded "two" (With "three" True))) == True