basement-0.0.0: Foundation scrap box of array & string

Safe HaskellNone
LanguageHaskell2010

Basement.From

Synopsis

Documentation

class From a b where Source #

Class of things that can be converted from a to b

Minimal complete definition

from

Methods

from :: a -> b Source #

Instances

From Int Word Source # 

Methods

from :: Int -> Word Source #

From Word Int Source # 

Methods

from :: Word -> Int Source #

From a a Source # 

Methods

from :: a -> a Source #

From (CountOf ty) Word Source # 

Methods

from :: CountOf ty -> Word Source #

From (CountOf ty) Int Source # 

Methods

from :: CountOf ty -> Int Source #

type Into b a = From a b Source #

class TryFrom a b where Source #

Class of things that can mostly be converted from a to b, but with possible error cases.

Minimal complete definition

tryFrom

Methods

tryFrom :: a -> Maybe b Source #

type TryInto b a = TryFrom a b Source #

into :: Into b a => a -> b Source #

Same as from but reverse the type variable so that the destination type can be specified first

e.g. converting:

from _ Word (10 :: Int)

into @Word (10 :: Int)

tryInto :: TryInto b a => a -> Maybe b Source #

same as tryFrom but reversed