what4-1.5.1: Solver-agnostic symbolic values support for issuing queries

Copyright | (c) Galois Inc 2019-2020
License | BSD3
Maintainer | Rob Dockins <rdockins@galois.com>
Stability | provisional
Safe Haskell | Safe-Inferred
Language | Haskell2010

What4.Utils.Word16String

Description

Synopsis

- data Word16String
- fromLEByteString :: ByteString -> Word16String
- toLEByteString :: Word16String -> ByteString
- empty :: Word16String
- singleton :: Word16 -> Word16String
- null :: Word16String -> Bool
- index :: Word16String -> Int -> Word16
- drop :: Int -> Word16String -> Word16String
- take :: Int -> Word16String -> Word16String
- append :: Word16String -> Word16String -> Word16String
- length :: Word16String -> Int
- foldl' :: (a -> Word16 -> a) -> a -> Word16String -> a
- findSubstring :: Word16String -> Word16String -> Maybe Int
- isInfixOf :: Word16String -> Word16String -> Bool
- isPrefixOf :: Word16String -> Word16String -> Bool
- isSuffixOf :: Word16String -> Word16String -> Bool

# Documentation

data Word16String Source #

A string of Word16 values, encoded as a bytestring in little endian (LE) order.

We maintain the invariant that Word16Strings are represented by an even number of bytes.

#### Instances

Instances details

Monoid Word16String Source # |
Instance details Defined in What4.Utils.Word16String Methods mempty :: Word16String Source # mappend :: Word16String -> Word16String -> Word16String Source # mconcat :: [Word16String] -> Word16String Source #
Semigroup Word16String Source # |
Instance details Defined in What4.Utils.Word16String Methods (<>) :: Word16String -> Word16String -> Word16String Source # sconcat :: NonEmpty Word16String -> Word16String Source # stimes :: Integral b => b -> Word16String -> Word16String Source #
Show Word16String Source # |
Instance details Defined in What4.Utils.Word16String Methods showsPrec :: Int -> Word16String -> ShowS Source # show :: Word16String -> String Source # showList :: [Word16String] -> ShowS Source #
Eq Word16String Source # |
Instance details Defined in What4.Utils.Word16String Methods (==) :: Word16String -> Word16String -> Bool Source # (/=) :: Word16String -> Word16String -> Bool Source #
Ord Word16String Source # |

Instance details

Defined in What4.Utils.Word16String

Methods

compare :: Word16String -> Word16String -> Ordering Source #

(<) :: Word16String -> Word16String -> Bool Source #

(<=) :: Word16String -> Word16String -> Bool Source #

(>) :: Word16String -> Word16String -> Bool Source #

(>=) :: Word16String -> Word16String -> Bool Source #

max :: Word16String -> Word16String -> Word16String Source #

min :: Word16String -> Word16String -> Word16String Source #

Hashable Word16String Source # |
Instance details Defined in What4.Utils.Word16String Methods hashWithSalt :: Int -> Word16String -> Int Source # hash :: Word16String -> Int Source #

fromLEByteString :: ByteString -> Word16String Source #

Generate a `Word16String` from a bytestring where the 16bit words are encoded as two bytes in little-endian order.

PRECONDITION: the input bytestring must have a length which is a multiple of 2.

toLEByteString :: Word16String -> ByteString Source #

Return the underlying little endian bytestring.

empty :: Word16String Source #

Return the empty string

singleton :: Word16 -> Word16String Source #

Compute the string containing just the given character

null :: Word16String -> Bool Source #

Test if the given string is empty

index :: Word16String -> Int -> Word16 Source #

Retrive the `n`th character of the string. Out of bounds accesses will cause an error.

drop :: Int -> Word16String -> Word16String Source #

take :: Int -> Word16String -> Word16String Source #

append :: Word16String -> Word16String -> Word16String Source #

length :: Word16String -> Int Source #

foldl' :: (a -> Word16 -> a) -> a -> Word16String -> a Source #

findSubstring :: Word16String -> Word16String -> Maybe Int Source #

Find the first index (if it exists) where the first string appears as a substring in the second

isInfixOf :: Word16String -> Word16String -> Bool Source #

Returns true if the first string appears somewhere in the second string.

isPrefixOf :: Word16String -> Word16String -> Bool Source #

isSuffixOf :: Word16String -> Word16String -> Bool Source #