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

Flat.Instances.Text

Description

Flat instances for the text library

Synopsis

Documentation

Orphan instances

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

Flat Text Source #
Instance details