haskus-binary-1.3: Haskus binary format manipulation

Safe HaskellNone
LanguageHaskell2010

Haskus.Format.Text

Synopsis

Documentation

newtype TextBuffer (t :: k) b Source #

Text buffer

The buffer contains a text encoded according to phantom type t

Constructors

TextBuffer b 
Instances
(IsList b, Item b ~ Word8) => IsString (TextBuffer ASCII b) Source #

Support ASCII text with OverloadedStrings

>>> :set -XOverloadedStrings
>>> let t = "HELLO" :: TextI ASCII
>>> showText t
"HELLO"
>>> let badt = "José" :: TextI ASCII
>>> showText badt
"*** Exception: Invalid ASCII character: é
Instance details

Defined in Haskus.Format.Text.ASCII

type TextB t mut pin fin heap = TextBuffer t (Buffer mut pin fin heap) Source #

class ShowText t b where Source #

Methods

showTextIO :: MonadIO m => TextBuffer t b -> m String Source #

Show text in IO

showText :: BufferToList b => TextBuffer t b -> String Source #

Pure show text

Instances
ShowText ASCII (Buffer mut pin gc heap) Source #

Instance for ASCII text

>>> :set -XOverloadedLists
>>> let b = [72,69,76,76,79] :: BufferI
>>> showText (TextBuffer @ASCII b)
"HELLO"
Instance details

Defined in Haskus.Format.Text.ASCII

Methods

showTextIO :: MonadIO m => TextBuffer ASCII (Buffer mut pin gc heap) -> m String Source #

showText :: TextBuffer ASCII (Buffer mut pin gc heap) -> String Source #