Add nice wrappers
This commit is contained in:
parent
bb52c043cd
commit
5fc78b14ad
|
@ -75,6 +75,10 @@ inject x = genDependency (Dependency NoToken (TInject x))
|
||||||
runIO :: (Show a, Show b, IsFIO f a b) => f -> Token t a -> ComputationM TokenNotTraversable b
|
runIO :: (Show a, Show b, IsFIO f a b) => f -> Token t a -> ComputationM TokenNotTraversable b
|
||||||
runIO f input = genDependency (Dependency input (FIO f))
|
runIO f input = genDependency (Dependency input (FIO f))
|
||||||
|
|
||||||
|
listDirectory = runIO ListDirectory
|
||||||
|
openImage = runIO OpenImage
|
||||||
|
|
||||||
|
|
||||||
makeTraversable :: Token TokenNotTraversable [a] -> Token TokenTraversable (Token TokenNotTraversable a)
|
makeTraversable :: Token TokenNotTraversable [a] -> Token TokenTraversable (Token TokenNotTraversable a)
|
||||||
makeTraversable (Token n) = Token n
|
makeTraversable (Token n) = Token n
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,9 @@ import ComputationM
|
||||||
test :: ComputationM TokenNotTraversable ()
|
test :: ComputationM TokenNotTraversable ()
|
||||||
test = do
|
test = do
|
||||||
dir <- inject "retter"
|
dir <- inject "retter"
|
||||||
dirContents <- runIO ListDirectory dir
|
dirContents <- listDirectory dir
|
||||||
let dirContents' = makeTraversable dirContents
|
let dirContents' = makeTraversable dirContents
|
||||||
u <- mapM (runIO OpenImage) dirContents'
|
u <- mapM openImage dirContents'
|
||||||
pure $ NoToken
|
pure $ NoToken
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
|
|
Loading…
Reference in New Issue