json-autotype-0.2.5.12: 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 
(Ord a, Ord b) => Ord ((:|:) a b) Source 
(Show a, Show b) => Show ((:|:) a b) Source 
(ToJSON a, ToJSON b) => ToJSON ((:|:) a b) Source 
(FromJSON a, FromJSON b) => FromJSON ((:|:) a b) Source 

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.