feldspar-language-0.7: A functional embedded language for DSP and parallelism

Safe HaskellNone
LanguageHaskell2010

Feldspar.Option

Contents

Synopsis

Documentation

data Option a Source

Constructors

Option 

Fields

isSome :: Data Bool
 
fromSome :: a
 

desugarOption :: Type a => Option (Data a) -> Data (Bool, a) Source

One-layer desugaring of Option

sugarOption :: Type a => Data (Bool, a) -> Option (Data a) Source

One-layer sugaring of Option

some :: a -> Option a Source

option :: Syntax b => b -> (a -> b) -> Option a -> b Source

oplus :: Syntax a => Option a -> Option a -> Option a Source

Conditional choice operator

(?>) :: Data Bool -> a -> Option a infixr 0 Source

Conditional choice operator. Can be used together with <? to write guarded choices as follows:

prog :: Data Index -> Data Index
prog a
    =  a+1 <? a==0
    ?> a+2 <? a==1
    ?> a+3 <? a==2
    ?> a+4 <? a==3
    ?> a+5

(<?) :: Syntax a => a -> Option a -> a infixr 0 Source