interchangeable-0.2.0.0: A type class for interchangeable data.

Safe HaskellSafe
LanguageHaskell2010

Control.Interchangeable

Synopsis

Documentation

class Interchangeable a b where Source #

Minimal definition is (interchange, interchange') and (applyI, applyI') or (modifyI, modifyI').

Minimal complete definition

interchange, interchange'

Methods

interchange :: a -> b Source #

Interchange a with b

interchange' :: b -> a Source #

Interchange b with a

applyI :: a -> b -> b Source #

Append a to b

applyI' :: b -> a -> a Source #

Append b to a

modifyI :: a -> (b -> b) -> a Source #

Modify a with an operation to b

modifyI' :: b -> (a -> a) -> b Source #

Modify a with an operation to b

Instances

Interchangeable a b => Interchangeable b a Source # 

Methods

interchange :: b -> a Source #

interchange' :: a -> b Source #

applyI :: b -> a -> a Source #

applyI' :: a -> b -> b Source #

modifyI :: b -> (a -> a) -> b Source #

modifyI' :: a -> (b -> b) -> a Source #

Ord a => Interchangeable [a] (Set a) Source # 

Methods

interchange :: [a] -> Set a Source #

interchange' :: Set a -> [a] Source #

applyI :: [a] -> Set a -> Set a Source #

applyI' :: Set a -> [a] -> [a] Source #

modifyI :: [a] -> (Set a -> Set a) -> [a] Source #

modifyI' :: Set a -> ([a] -> [a]) -> Set a Source #

Ord k => Interchangeable [(k, a)] (Map k a) Source # 

Methods

interchange :: [(k, a)] -> Map k a Source #

interchange' :: Map k a -> [(k, a)] Source #

applyI :: [(k, a)] -> Map k a -> Map k a Source #

applyI' :: Map k a -> [(k, a)] -> [(k, a)] Source #

modifyI :: [(k, a)] -> (Map k a -> Map k a) -> [(k, a)] Source #

modifyI' :: Map k a -> ([(k, a)] -> [(k, a)]) -> Map k a Source #