json-autotype-1.1.2: 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 b, Eq a) => Eq ((:|:) a b) Source # 

Methods

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

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

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

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 b, Show a) => Show ((:|:) a b) Source # 

Methods

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

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

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

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

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 # 

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.