flat-0.4.4.0.0.0.0.2: Principled and efficient bit-oriented binary serialization.
Safe Haskell None
Language Haskell2010

Flat.Types

Description

Common Types

Synopsis

Documentation

type NumBits = Int Source #

Number of bits

module Data.Int

data Natural Source #

Type representing arbitrary-precision non-negative integers.

>>> 2^100 :: Natural
1267650600228229401496703205376

Operations whose result would be negative throw ( Underflow :: ArithException ) ,

>>> -1 :: Natural
*** Exception: arithmetic underflow

Since: base-4.8.0.0

Instances

Instances details
Enum Natural

Since: base-4.8.0.0

Instance details

Defined in GHC.Enum

Eq Natural

Since: base-4.8.0.0

Instance details

Defined in GHC.Natural

Integral Natural

Since: base-4.8.0.0

Instance details

Defined in GHC.Real

Num Natural

Note that Natural 's Num instance isn't a ring: no element but 0 has an additive inverse. It is a semiring though.

Since: base-4.8.0.0

Instance details

Defined in GHC.Num

Ord Natural

Since: base-4.8.0.0

Instance details

Defined in GHC.Natural

Read Natural

Since: base-4.8.0.0

Instance details

Defined in GHC.Read

Real Natural

Since: base-4.8.0.0

Instance details

Defined in GHC.Real

Show Natural

Since: base-4.8.0.0

Instance details

Defined in GHC.Show

Ix Natural

Since: base-4.8.0.0

Instance details

Defined in GHC.Ix

Bits Natural

Since: base-4.8.0

Instance details

Defined in Data.Bits

NFData Natural

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Hashable Natural
Instance details

Defined in Data.Hashable.Class

UniformRange Natural
Instance details

Defined in System.Random.Internal

Flat Natural Source #

Naturals are encoded just as the fixed size Words.

>>> test (0::Natural)
(True,8,"00000000")
>>> test (2^120::Natural)
(True,144,"10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 00000010")
Instance details

Defined in Flat.Instances.Base

Lift Natural
Instance details

Defined in Language.Haskell.TH.Syntax

ZigZag Integer Natural Source #
Instance details

Defined in Data.ZigZag

data ShortByteString Source #

A compact representation of a Word8 vector.

It has a lower memory overhead than a ByteString and does not contribute to heap fragmentation. It can be converted to or from a ByteString (at the cost of copying the string data). It supports very few other operations.

It is suitable for use as an internal representation for code that needs to keep many short strings in memory, but it should not be used as an interchange type. That is, it should not generally be used in public APIs. The ByteString type is usually more suitable for use in interfaces; it is more flexible and it supports a wide range of operations.

Instances

Instances details
IsList ShortByteString

Since: bytestring-0.10.12.0

Instance details

Defined in Data.ByteString.Short.Internal

Eq ShortByteString
Instance details

Defined in Data.ByteString.Short.Internal

Data ShortByteString
Instance details

Defined in Data.ByteString.Short.Internal

Methods

gfoldl :: ( forall d b. Data d => c (d -> b) -> d -> c b) -> ( forall g. g -> c g) -> ShortByteString -> c ShortByteString Source #

gunfold :: ( forall b r. Data b => c (b -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c ShortByteString Source #

toConstr :: ShortByteString -> Constr Source #

dataTypeOf :: ShortByteString -> DataType Source #

dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe (c ShortByteString ) Source #

dataCast2 :: Typeable t => ( forall d e. ( Data d, Data e) => c (t d e)) -> Maybe (c ShortByteString ) Source #

gmapT :: ( forall b. Data b => b -> b) -> ShortByteString -> ShortByteString Source #

gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data d => d -> r') -> ShortByteString -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data d => d -> r') -> ShortByteString -> r Source #

gmapQ :: ( forall d. Data d => d -> u) -> ShortByteString -> [u] Source #

gmapQi :: Int -> ( forall d. Data d => d -> u) -> ShortByteString -> u Source #

gmapM :: Monad m => ( forall d. Data d => d -> m d) -> ShortByteString -> m ShortByteString Source #

gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> ShortByteString -> m ShortByteString Source #

gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> ShortByteString -> m ShortByteString Source #

Ord ShortByteString
Instance details

Defined in Data.ByteString.Short.Internal

Read ShortByteString
Instance details

Defined in Data.ByteString.Short.Internal

Show ShortByteString
Instance details

Defined in Data.ByteString.Short.Internal

IsString ShortByteString

Beware: fromString truncates multi-byte characters to octets. e.g. "枯朶に烏のとまりけり秋の暮" becomes �6k�nh~�Q��n�

Instance details

Defined in Data.ByteString.Short.Internal

Semigroup ShortByteString
Instance details

Defined in Data.ByteString.Short.Internal

Monoid ShortByteString
Instance details

Defined in Data.ByteString.Short.Internal

NFData ShortByteString
Instance details

Defined in Data.ByteString.Short.Internal

Hashable ShortByteString
Instance details

Defined in Data.Hashable.Class

Flat ShortByteString Source #
>>> tst ((False,True,False,SBS.pack [11,22,33]))
(True,51,[65,3,11,22,33,0])
Instance details

Defined in Flat.Instances.ByteString

type Item ShortByteString
Instance details

Defined in Data.ByteString.Short.Internal

data Text Source #

A space efficient, packed, unboxed Unicode text type.

Instances

Instances details
Hashable Text
Instance details

Defined in Data.Hashable.Class

SemiSequence Text
Instance details

Defined in Data.Sequences

Associated Types

type Index Text Source #

IsSequence Text
Instance details

Defined in Data.Sequences

Methods

fromList :: [ Element Text ] -> Text Source #

lengthIndex :: Text -> Index Text Source #

break :: ( Element Text -> Bool ) -> Text -> ( Text , Text ) Source #

span :: ( Element Text -> Bool ) -> Text -> ( Text , Text ) Source #

dropWhile :: ( Element Text -> Bool ) -> Text -> Text Source #

takeWhile :: ( Element Text -> Bool ) -> Text -> Text Source #

splitAt :: Index Text -> Text -> ( Text , Text ) Source #

unsafeSplitAt :: Index Text -> Text -> ( Text , Text ) Source #

take :: Index Text -> Text -> Text Source #

unsafeTake :: Index Text -> Text -> Text Source #

drop :: Index Text -> Text -> Text Source #

unsafeDrop :: Index Text -> Text -> Text Source #

dropEnd :: Index Text -> Text -> Text Source #

partition :: ( Element Text -> Bool ) -> Text -> ( Text , Text ) Source #

uncons :: Text -> Maybe ( Element Text , Text ) Source #

unsnoc :: Text -> Maybe ( Text , Element Text ) Source #

filter :: ( Element Text -> Bool ) -> Text -> Text Source #

filterM :: Monad m => ( Element Text -> m Bool ) -> Text -> m Text Source #

replicate :: Index Text -> Element Text -> Text Source #

replicateM :: Monad m => Index Text -> m ( Element Text ) -> m Text Source #

groupBy :: ( Element Text -> Element Text -> Bool ) -> Text -> [ Text ] Source #

groupAllOn :: Eq b => ( Element Text -> b) -> Text -> [ Text ] Source #

subsequences :: Text -> [ Text ] Source #

permutations :: Text -> [ Text ] Source #

tailEx :: Text -> Text Source #

tailMay :: Text -> Maybe Text Source #

initEx :: Text -> Text Source #

initMay :: Text -> Maybe Text Source #

unsafeTail :: Text -> Text Source #

unsafeInit :: Text -> Text Source #

index :: Text -> Index Text -> Maybe ( Element Text ) Source #

indexEx :: Text -> Index Text -> Element Text Source #

unsafeIndex :: Text -> Index Text -> Element Text Source #

splitWhen :: ( Element Text -> Bool ) -> Text -> [ Text ] Source #

Textual Text
Instance details

Defined in Data.Sequences

MonoZip Text
Instance details

Defined in Data.Containers

MonoFunctor Text
Instance details

Defined in Data.MonoTraversable

MonoFoldable Text
Instance details

Defined in Data.MonoTraversable

Methods

ofoldMap :: Monoid m => ( Element Text -> m) -> Text -> m Source #

ofoldr :: ( Element Text -> b -> b) -> b -> Text -> b Source #

ofoldl' :: (a -> Element Text -> a) -> a -> Text -> a Source #

otoList :: Text -> [ Element Text ] Source #

oall :: ( Element Text -> Bool ) -> Text -> Bool Source #

oany :: ( Element Text -> Bool ) -> Text -> Bool Source #

onull :: Text -> Bool Source #

olength :: Text -> Int Source #

olength64 :: Text -> Int64 Source #

ocompareLength :: Integral i => Text -> i -> Ordering Source #

otraverse_ :: Applicative f => ( Element Text -> f b) -> Text -> f () Source #

ofor_ :: Applicative f => Text -> ( Element Text -> f b) -> f () Source #

omapM_ :: Applicative m => ( Element Text -> m ()) -> Text -> m () Source #

oforM_ :: Applicative m => Text -> ( Element Text -> m ()) -> m () Source #

ofoldlM :: Monad m => (a -> Element Text -> m a) -> a -> Text -> m a Source #

ofoldMap1Ex :: Semigroup m => ( Element Text -> m) -> Text -> m Source #

ofoldr1Ex :: ( Element Text -> Element Text -> Element Text ) -> Text -> Element Text Source #

ofoldl1Ex' :: ( Element Text -> Element Text -> Element Text ) -> Text -> Element Text Source #

headEx :: Text -> Element Text Source #

lastEx :: Text -> Element Text Source #

unsafeHead :: Text -> Element Text Source #

unsafeLast :: Text -> Element Text Source #

maximumByEx :: ( Element Text -> Element Text -> Ordering ) -> Text -> Element Text Source #

minimumByEx :: ( Element Text -> Element Text -> Ordering ) -> Text -> Element Text Source #

oelem :: Element Text -> Text -> Bool Source #

onotElem :: Element Text -> Text -> Bool Source #

MonoTraversable Text
Instance details

Defined in Data.MonoTraversable

MonoPointed Text
Instance details

Defined in Data.MonoTraversable

GrowingAppend Text
Instance details

Defined in Data.MonoTraversable

Flat Text Source #

Text (and Data.Text.Lazy) is encoded as a byte aligned array of bytes corresponding to its UTF8 encoding.

>>> tst $ T.pack ""
(True,16,[1,0])
>>> tst $ T.pack "aaa"
(True,120,[1,3,97,97,97,0])
>>> tst $ T.pack "¢¢¢"
(True,120,[1,6,194,162,194,162,194,162,0])
>>> tst $ T.pack "日日日"
(True,120,[1,9,230,151,165,230,151,165,230,151,165,0])
>>> tst $ T.pack "𐍈𐍈𐍈"
(True,120,[1,12,240,144,141,136,240,144,141,136,240,144,141,136,0])

Strict and Lazy Text has the same encoding:

>>> tst (T.pack "abc") == tst (TL.pack "abc")
True
Instance details

Defined in Flat.Instances.Text

LazySequence Text Text
Instance details

Defined in Data.Sequences

Utf8 Text ByteString
Instance details

Defined in Data.Sequences

type Item Text
Instance details

Defined in Data.Text

type Index Text
Instance details

Defined in Data.Sequences

type Element Text
Instance details

Defined in Data.MonoTraversable