oi-0.4.0.2: Library for purely functional lazy interactions with the outer world.

Copyright(c) Nobuo Yamashita 2011-2016
LicenseBSD3
Safe HaskellNone
LanguageHaskell2010

Data.OI.Internal

Contents

Description

Author : Nobuo Yamashita Maintainer : nobsun@sampou.org Stability : experimental

Synopsis

Types

data OI a Source

Datatype for intermediating interaction: OI has two states (programmer cannot distinguish), non-expressed and exressed. `Non-expressed' indicates that no computation is assigned. In other words, it's value is never denotated by any expression. So, if you refer the value then the process will be suspended until other process determins the value. Non-expressed value can be determined to become expressed for a value by a expression at most once. Expressed indicates that some computation is assigned for the value. Once expressed, the value never be back to non-expressed nor be changed.

type (:->) a b = OI a -> b infixr 0 Source

Interaction (a function from a intermediating type to another type) type

Primitive operators on OI

(??) :: OI a -> a Source

Dereference operator

(##) :: a -> OI a Source

Reference operator

Assign operator

(=:) :: a -> OI a -> a Source

Assign Operator

Splitters against OI datatype

dePair :: OI (a, b) -> (OI a, OI b) Source

Decomposer for pair

deList :: OI [a] -> Maybe (OI a, OI [a]) Source

Decomposer for list

deTriple :: OI (a, b, c) -> (OI a, OI b, OI c) Source

Decomposer for triple

deTuple4 :: OI (a, b, c, d) -> (OI a, OI b, OI c, OI d) Source

Decomposer for 4-tuple

deTuple5 :: OI (a, b, c, d, e) -> (OI a, OI b, OI c, OI d, OI e) Source

Decomposer for 5-tuple

deTuple6 :: OI (a, b, c, d, e, f) -> (OI a, OI b, OI c, OI d, OI e, OI f) Source

Decomposer for 6-tuple

deTuple7 :: OI (a, b, c, d, e, f, g) -> (OI a, OI b, OI c, OI d, OI e, OI f, OI g) Source

Decomposer for 7-tuple

deLeft :: OI (Either a b) -> Either (OI a) (OI b) Source

deRight :: OI (Either a b) -> Either (OI a) (OI b) Source

Interaction driver

runInteraction :: (OI a -> b) -> IO b Source

Drive interaction

IO converters

data IOResult a Source

IOResult for error handling

Constructors

Success 

Fields

result :: a
 
Failure 

Fields

errmsg :: String
 

iooi :: IO a -> OI a -> a Source

Convert IO to interaction

iooi' :: IO a -> OI (IOResult a) -> IOResult a Source