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

Safe HaskellNone
LanguageHaskell2010

Data.Text.PgpWordlist.Internal.Word8Bimap

Description

Bimap between Word8 an an arbitrary (ordered) type. Values of type Word8Bimap have to be constructed carefully to contain values for all 256 Word8 values, or the API will not be safe to use.

Synopsis

Documentation

data Word8Bimap a Source

Bimap where one of the keys is (of the size of) a Word8.

unsafeConstruct :: Ord a => [(Word8, a)] -> Word8Bimap a Source

Create a Word8Bimap from an association list.

The list must contain all Word8 in order to make the API operating on the result safe.

lookupL :: Word8Bimap a -> Word8 -> a Source

Get the value corresponding to an index.

lookupR :: Ord a => Word8Bimap a -> a -> Maybe Word8 Source

Get the index corresponding to a value, if present.