convertible-1.1.1.0: Typeclasses and instances for converting between types

CopyrightCopyright (C) 2009-2011 John Goerzen
LicenseBSD3
MaintainerJohn Goerzen <jgoerzen@complete.org>
Stabilityprovisional
Portabilityportable
Safe HaskellSafe
LanguageHaskell98

Data.Convertible.Base

Contents

Description

 

Synopsis

The conversion process

convert :: Convertible a b => a -> b #

Convert from one type of data to another. Raises an exception if there is an error with the conversion. For a function that does not raise an exception in that case, see safeConvert.

class Convertible a b where #

A typeclass that represents something that can be converted. A Convertible a b instance represents an a that can be converted to a b.

Minimal complete definition

safeConvert

Methods

safeConvert :: a -> ConvertResult b #

Convert a to b, returning Right on success and Left on error. For a simpler interface, see convert.

Handling the results

type ConvertResult a = Either ConvertError a #

The result of a safe conversion via safeConvert.