base16
Copyright(c) 2019-2026 Emily Pillmore
LicenseBSD-style
MaintainerEmily Pillmore <emilypi@cohomolo.gy>, sofia-m-a <https://github.com/sofia-m-a>
Stabilitystable
Portabilitynon-portable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Base16.Types

Description

This module contains the opaque Base16 type and combinators for working with Base16-encoded values.

Synopsis

Documentation

data Base16 a Source #

Wrap a value that is or is intended to be Base16-encoded.

Use the parseBase16 function in the corresponding ByteString or Text module to validate external input. Encoding functions also produce this wrapper. assertBase16 and the Functor, Applicative, and Monad instances do not validate their results.

Instances

Instances details
Eq1 Base16 Source # 
Instance details

Defined in Data.Base16.Types

Methods

liftEq :: (a -> b -> Bool) -> Base16 a -> Base16 b -> Bool

Ord1 Base16 Source # 
Instance details

Defined in Data.Base16.Types

Methods

liftCompare :: (a -> b -> Ordering) -> Base16 a -> Base16 b -> Ordering

Applicative Base16 Source # 
Instance details

Defined in Data.Base16.Types

Methods

pure :: a -> Base16 a

(<*>) :: Base16 (a -> b) -> Base16 a -> Base16 b

liftA2 :: (a -> b -> c) -> Base16 a -> Base16 b -> Base16 c

(*>) :: Base16 a -> Base16 b -> Base16 b

(<*) :: Base16 a -> Base16 b -> Base16 a

Functor Base16 Source # 
Instance details

Defined in Data.Base16.Types

Methods

fmap :: (a -> b) -> Base16 a -> Base16 b

(<$) :: a -> Base16 b -> Base16 a

Monad Base16 Source # 
Instance details

Defined in Data.Base16.Types

Methods

(>>=) :: Base16 a -> (a -> Base16 b) -> Base16 b

(>>) :: Base16 a -> Base16 b -> Base16 b

return :: a -> Base16 a

NFData a => NFData (Base16 a) Source # 
Instance details

Defined in Data.Base16.Types

Methods

rnf :: Base16 a -> ()

Show a => Show (Base16 a) Source # 
Instance details

Defined in Data.Base16.Types

Methods

showsPrec :: Int -> Base16 a -> ShowS

show :: Base16 a -> String

showList :: [Base16 a] -> ShowS

Eq a => Eq (Base16 a) Source # 
Instance details

Defined in Data.Base16.Types

Methods

(==) :: Base16 a -> Base16 a -> Bool

(/=) :: Base16 a -> Base16 a -> Bool

Ord a => Ord (Base16 a) Source # 
Instance details

Defined in Data.Base16.Types

Methods

compare :: Base16 a -> Base16 a -> Ordering

(<) :: Base16 a -> Base16 a -> Bool

(<=) :: Base16 a -> Base16 a -> Bool

(>) :: Base16 a -> Base16 a -> Bool

(>=) :: Base16 a -> Base16 a -> Bool

max :: Base16 a -> Base16 a -> Base16 a

min :: Base16 a -> Base16 a -> Base16 a

assertBase16 :: a -> Base16 a Source #

Assert the provenance of a value.

For untrusted input, use the parseBase16 function in the corresponding ByteString or Text module to validate it first.

Warning: This is a blind assertion that a particular value is base16 encoded in some alphabet. If you are not sure of the provenance of the value, you may experience odd behavior when attempting to decode. Use at your own risk. If I see any issues logged on this project from negligent use of this, Sofia and I will smite you.

extractBase16 :: Base16 a -> a Source #

Forget that a particular value is Base16-encoded