Basement.Block.Builder

basement-0.0.12: Foundation scrap box of array & string

License | BSD-style
Maintainer | Foundation
Safe Haskell | Safe-Inferred
Language | Haskell2010

Basement.Block.Builder

Contents

- Emit functions
- unsafe

Description

Block builder

Synopsis

- data Builder
- run :: PrimMonad prim => Builder -> prim (Block Word8)
- emit :: Block a -> Builder
- emitPrim :: (PrimType ty, ty ~ Word8) => ty -> Builder
- emitString :: String -> Builder
- emitUTF8Char :: Char -> Builder
- unsafeRunString :: PrimMonad prim => Builder -> prim String

# Documentation

data Builder #

#### Instances

Instances details

Monoid Builder # |
Instance details Defined in Basement.Block.Builder Methods mempty :: Builder # mappend :: Builder -> Builder -> Builder # mconcat :: [Builder] -> Builder #
Semigroup Builder # |
Instance details Defined in Basement.Block.Builder Methods (<>) :: Builder -> Builder -> Builder # sconcat :: NonEmpty Builder -> Builder # stimes :: Integral b => b -> Builder -> Builder #

run :: PrimMonad prim => Builder -> prim (Block Word8) #

run the given builder and return the generated block

# Emit functions

emit :: Block a -> Builder #

add a Block in the builder

emitPrim :: (PrimType ty, ty ~ Word8) => ty -> Builder #

emitString :: String -> Builder #

add a string in the builder

emitUTF8Char :: Char -> Builder #

emit a UTF8 char in the builder

this function may be replaced by `emit :: Encoding -> Char -> Builder`

# unsafe

unsafeRunString :: PrimMonad prim => Builder -> prim String #

run the given builder and return a UTF8String

this action is unsafe as there is no guarantee upon the validity of the content of the built block.