json-autotype-2.0.0: Automatic type declaration for JSON input data

Safe HaskellNone
LanguageHaskell2010

Data.Aeson.AutoType.Alternative

Description

This module defines data type (a :|: b) that behaves all like Either, except that has no tag in JSON representation as used by FromJSON and ToJSON.

Synopsis

Documentation

data a :|: b infixr 5 Source #

Data type (a :|: b) that behaves all like Either, except that has no tag in JSON representation as used by FromJSON and ToJSON.

Constructors

AltLeft a 
AltRight b 
Instances
(Eq a, Eq b) => Eq (a :|: b) Source # 
Instance details

Defined in Data.Aeson.AutoType.Alternative

Methods

(==) :: (a :|: b) -> (a :|: b) -> Bool #

(/=) :: (a :|: b) -> (a :|: b) -> Bool #

(Ord a, Ord b) => Ord (a :|: b) Source # 
Instance details

Defined in Data.Aeson.AutoType.Alternative

Methods

compare :: (a :|: b) -> (a :|: b) -> Ordering #

(<) :: (a :|: b) -> (a :|: b) -> Bool #

(<=) :: (a :|: b) -> (a :|: b) -> Bool #

(>) :: (a :|: b) -> (a :|: b) -> Bool #

(>=) :: (a :|: b) -> (a :|: b) -> Bool #

max :: (a :|: b) -> (a :|: b) -> a :|: b #

min :: (a :|: b) -> (a :|: b) -> a :|: b #

(Show a, Show b) => Show (a :|: b) Source # 
Instance details

Defined in Data.Aeson.AutoType.Alternative

Methods

showsPrec :: Int -> (a :|: b) -> ShowS #

show :: (a :|: b) -> String #

showList :: [a :|: b] -> ShowS #

(ToJSON a, ToJSON b) => ToJSON (a :|: b) Source # 
Instance details

Defined in Data.Aeson.AutoType.Alternative

Methods

toJSON :: (a :|: b) -> Value #

toEncoding :: (a :|: b) -> Encoding #

toJSONList :: [a :|: b] -> Value #

toEncodingList :: [a :|: b] -> Encoding #

(FromJSON a, FromJSON b) => FromJSON (a :|: b) Source # 
Instance details

Defined in Data.Aeson.AutoType.Alternative

Methods

parseJSON :: Value -> Parser (a :|: b) #

parseJSONList :: Value -> Parser [a :|: b] #

toEither :: (a :|: b) -> Either a b Source #

Convert to Either datatype.

fromEither :: Either a b -> a :|: b Source #

Convert from Either datatype.

alt :: (a -> c) -> (b -> c) -> (a :|: b) -> c Source #

Deconstruct the type with two functions corresponding to constructors. This is like either.