postgresql-types-0.1.2: Precise PostgreSQL types representation and driver-agnostic codecs
Safe HaskellNone
LanguageHaskell2010

PostgresqlTypes.Bit

Synopsis

Documentation

data Bit (numBits :: Nat) Source #

PostgreSQL bit type. Fixed-length bit string.

PostgreSQL docs.

The type parameter numBits specifies the static length of the bit string. Only bit strings with exactly this length can be represented by this type.

Instances

Instances details
KnownNat numBits => Arbitrary (Bit numBits) Source # 
Instance details

Defined in PostgresqlTypes.Bit

Methods

arbitrary :: Gen (Bit numBits) #

shrink :: Bit numBits -> [Bit numBits] #

KnownNat numBits => IsString (Bit numBits) Source # 
Instance details

Defined in PostgresqlTypes.Bit

Methods

fromString :: String -> Bit numBits #

KnownNat numBits => Read (Bit numBits) Source # 
Instance details

Defined in PostgresqlTypes.Bit

Methods

readsPrec :: Int -> ReadS (Bit numBits) #

readList :: ReadS [Bit numBits] #

readPrec :: ReadPrec (Bit numBits) #

readListPrec :: ReadPrec [Bit numBits] #

KnownNat numBits => Show (Bit numBits) Source # 
Instance details

Defined in PostgresqlTypes.Bit

Methods

showsPrec :: Int -> Bit numBits -> ShowS #

show :: Bit numBits -> String #

showList :: [Bit numBits] -> ShowS #

Eq (Bit numBits) Source # 
Instance details

Defined in PostgresqlTypes.Bit

Methods

(==) :: Bit numBits -> Bit numBits -> Bool #

(/=) :: Bit numBits -> Bit numBits -> Bool #

Ord (Bit numBits) Source # 
Instance details

Defined in PostgresqlTypes.Bit

Methods

compare :: Bit numBits -> Bit numBits -> Ordering #

(<) :: Bit numBits -> Bit numBits -> Bool #

(<=) :: Bit numBits -> Bit numBits -> Bool #

(>) :: Bit numBits -> Bit numBits -> Bool #

(>=) :: Bit numBits -> Bit numBits -> Bool #

max :: Bit numBits -> Bit numBits -> Bit numBits #

min :: Bit numBits -> Bit numBits -> Bit numBits #

Hashable (Bit numBits) Source # 
Instance details

Defined in PostgresqlTypes.Bit

Methods

hashWithSalt :: Int -> Bit numBits -> Int #

hash :: Bit numBits -> Int #

KnownNat numBits => IsScalar (Bit numBits) Source # 
Instance details

Defined in PostgresqlTypes.Bit

Methods

schemaName :: Tagged (Bit numBits) (Maybe Text) #

typeName :: Tagged (Bit numBits) Text #

baseOid :: Tagged (Bit numBits) (Maybe Word32) #

arrayOid :: Tagged (Bit numBits) (Maybe Word32) #

typeParams :: Tagged (Bit numBits) [Text] #

typeSignature :: Tagged (Bit numBits) Text #

binaryEncoder :: Bit numBits -> Write #

binaryDecoder :: Variable (Either DecodingError (Bit numBits)) #

textualEncoder :: Bit numBits -> TextBuilder #

textualDecoder :: Parser (Bit numBits) #

Accessors

toBoolList :: forall (numBits :: Nat). KnownNat numBits => Bit numBits -> [Bool] Source #

Extract the bit string as a list of Bool.

toBoolVector :: forall (numBits :: Nat) vec. (KnownNat numBits, Vector vec Bool) => Bit numBits -> vec Bool Source #

Extract the bit string as any vector of Bool.

Constructors

refineFromBoolList :: forall (numBits :: Nat). KnownNat numBits => [Bool] -> Maybe (Bit numBits) Source #

Construct a PostgreSQL Bit from a list of Bool with validation. Returns Nothing if the list length doesn't match the expected length.

normalizeFromBoolList :: forall (numBits :: Nat). KnownNat numBits => [Bool] -> Bit numBits Source #

Construct a PostgreSQL Bit from a list of Bool. Truncates or pads to match the type-level length.

refineFromBoolVector :: forall (numBits :: Nat) vec. (KnownNat numBits, Vector vec Bool) => vec Bool -> Maybe (Bit numBits) Source #

Construct a PostgreSQL Bit from an unboxed vector of Bool with validation. Returns Nothing if the vector length doesn't match the expected length.

normalizeFromBoolVector :: forall (numBits :: Nat) vec. (KnownNat numBits, Vector vec Bool) => vec Bool -> Bit numBits Source #

Construct a PostgreSQL Bit from an unboxed vector of Bool. Truncates or pads to match the type-level length.