pgp-wordlist-0.1.0.0: Translate between binary data and a human-readable collection of words.

Safe HaskellSafe
LanguageHaskell2010

Data.Text.PgpWordlist.AltList

Contents

Description

Defines a type of list that containins two alternating element types.

Synopsis

Documentation

data AltList a b

List of elements of alternating element types.

Constructors

Nil 
Cons a (AltList b a) 

Instances

(Eq a, Eq b) => Eq (AltList a b) 
(Ord a, Ord b) => Ord (AltList a b) 
(Show a, Show b) => Show (AltList a b) 

Construction, deconstruction

fromList :: [a] -> AltList a a

Simple conversion function. Inverse of toList.

toList :: AltList a a -> [a]

Simple conversion function. Inverse of fromList.

Bifunctor

first :: (a -> a') -> AltList a b -> AltList a' b

Map over the first component of an AltList.

first f ≡ bimap f id

second :: (b -> b') -> AltList a b -> AltList a b'

Map over the second component of an AltList.

second g ≡ bimap id g

bimap :: (a -> a') -> (b -> b') -> AltList a b -> AltList a' b'

Map over the both components of an AltList.

bimap f g ≡ second g . first f

Bitraversable

bisequence :: Applicative f => AltList (f a) (f b) -> f (AltList a b)

Monomorphic bisequence.

bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> AltList a b -> f (AltList c d)

Monomorphic bitraverse.