postgresql-types
Safe HaskellNone
LanguageHaskell2010

PostgresqlTypes.Varbit

Synopsis

Documentation

data Varbit (maxLen :: Nat) Source #

PostgreSQL varbit(n) type. Variable-length bit string with limit.

Similar to bit but with a variable length up to the specified maximum.

PostgreSQL docs.

The type parameter maxLen specifies the static maximum length of the bit string. Bit strings up to this length can be represented by this type.

Instances

Instances details
KnownNat maxLen => Arbitrary (Varbit maxLen) Source # 
Instance details

Defined in PostgresqlTypes.Varbit

Methods

arbitrary :: Gen (Varbit maxLen) #

shrink :: Varbit maxLen -> [Varbit maxLen] #

Eq (Varbit maxLen) Source # 
Instance details

Defined in PostgresqlTypes.Varbit

Methods

(==) :: Varbit maxLen -> Varbit maxLen -> Bool #

(/=) :: Varbit maxLen -> Varbit maxLen -> Bool #

Ord (Varbit maxLen) Source # 
Instance details

Defined in PostgresqlTypes.Varbit

Methods

compare :: Varbit maxLen -> Varbit maxLen -> Ordering #

(<) :: Varbit maxLen -> Varbit maxLen -> Bool #

(<=) :: Varbit maxLen -> Varbit maxLen -> Bool #

(>) :: Varbit maxLen -> Varbit maxLen -> Bool #

(>=) :: Varbit maxLen -> Varbit maxLen -> Bool #

max :: Varbit maxLen -> Varbit maxLen -> Varbit maxLen #

min :: Varbit maxLen -> Varbit maxLen -> Varbit maxLen #

KnownNat maxLen => IsString (Varbit maxLen) Source # 
Instance details

Defined in PostgresqlTypes.Varbit

Methods

fromString :: String -> Varbit maxLen #

KnownNat maxLen => Read (Varbit maxLen) Source # 
Instance details

Defined in PostgresqlTypes.Varbit

Methods

readsPrec :: Int -> ReadS (Varbit maxLen) #

readList :: ReadS [Varbit maxLen] #

readPrec :: ReadPrec (Varbit maxLen) #

readListPrec :: ReadPrec [Varbit maxLen] #

KnownNat maxLen => Show (Varbit maxLen) Source # 
Instance details

Defined in PostgresqlTypes.Varbit

Methods

showsPrec :: Int -> Varbit maxLen -> ShowS #

show :: Varbit maxLen -> String #

showList :: [Varbit maxLen] -> ShowS #

Hashable (Varbit maxLen) Source # 
Instance details

Defined in PostgresqlTypes.Varbit

Methods

hashWithSalt :: Int -> Varbit maxLen -> Int #

hash :: Varbit maxLen -> Int #

KnownNat maxLen => IsScalar (Varbit maxLen) Source # 
Instance details

Defined in PostgresqlTypes.Varbit

Accessors

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

Extract the bit string as a list of Bool.

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

Extract the bit string as an unboxed vector of Bool.

Constructors

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

Construct a PostgreSQL Varbit from a list of Bool with validation. Returns Nothing if the list length exceeds the maximum length.

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

Construct a PostgreSQL Varbit from a list of Bool. Truncates to the maximum length if necessary.

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

Construct a PostgreSQL Varbit from an unboxed vector of Bool with validation. Returns Nothing if the vector length exceeds the maximum length.

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

Construct a PostgreSQL Varbit from an unboxed vector of Bool. Truncates to the maximum length if necessary.