readable-0.1.0.1: Reading from Text and ByteString

Safe HaskellNone

Data.Readable

Description

The Read type class is very useful for building data types from String representations. But String has high overhead, so sometimes it isn't suitable for applications where space usage and performance are important. This library provides a simpler version of Read's functionality for Text and UTF8 encoded ByteStrings.

Synopsis

Documentation

class Readable a whereSource

ByteString and Text reading using MonadPlus to handle parse failure. On error, fromText and fromBS will return mzero. You can use mplus to provide fallback defaults.

Methods

fromText :: MonadPlus m => Text -> m aSource

Reads data from a Text representation.

fromBS :: MonadPlus m => ByteString -> m aSource

Reads data from a UTF8 encoded ByteString.