basement-0.0.2: Foundation scrap box of array & string

LicenseBSD-style
MaintainerHaskell Foundation
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Basement.Types.AsciiString

Contents

Description

A AsciiString type backed by a ASCII encoded byte array and all the necessary functions to manipulate the string.

Synopsis

Documentation

Binary conversion

fromBytesUnsafe :: UArray Word8 -> AsciiString Source #

Convert a Byte Array representing ASCII data directly to an AsciiString without checking for ASCII validity

If the input contains invalid Char7 value (anything above 0x7f), it will trigger runtime async errors when processing data.

In doubt, use fromBytes

fromBytes :: UArray Word8 -> Maybe AsciiString Source #

Convert a Byte Array representing ASCII checking validity.

If the byte array is not valid, then Nothing is returned