basement-0.0.6: 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

newtype AsciiString Source #

Opaque packed array of characters in the ASCII encoding

Constructors

AsciiString 

Fields

Instances

IsList AsciiString Source # 
Eq AsciiString Source # 
Ord AsciiString Source # 
Show AsciiString Source # 
IsString AsciiString Source # 
Semigroup AsciiString Source # 
Monoid AsciiString Source # 
From AsciiString String Source # 
From AsciiString (UArray Word8) Source # 
type Item AsciiString Source # 

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