diff --git a/byg/src/ComputationM.hs b/byg/src/ComputationM.hs index 8f54603..fa222a9 100644 --- a/byg/src/ComputationM.hs +++ b/byg/src/ComputationM.hs @@ -15,6 +15,7 @@ data TypedRun a b where F :: IsF f a b => f -> TypedRun a b FIO :: IsFIO f a b => f -> TypedRun a b TInject :: b -> TypedRun () b + GetListElem :: TypedRun () b InList :: ComputationM TokenNotTraversable b -> TypedRun [a] [b] instance Show (ComputationM t a) where @@ -69,6 +70,9 @@ genDependency g = do inject :: Show a => a -> ComputationM ta a inject x = genDependency (Dependency NoToken (TInject x)) +getListElem :: Show a => ComputationM ta a +getListElem = genDependency (Dependency NoToken GetListElem) + run :: (Show a, Show b, IsF f a b) => f -> Token t a -> ComputationM TokenNotTraversable b run f input = genDependency (Dependency input (F f)) diff --git a/byg/src/Main.hs b/byg/src/Main.hs index 90dc4bc..cee6fa3 100644 --- a/byg/src/Main.hs +++ b/byg/src/Main.hs @@ -1,13 +1,18 @@ module Main where +import Types import ComputationM +testSub :: ComputationM TokenNotTraversable Image +testSub = do + inp <- getListElem + openImage inp + test :: ComputationM TokenNotTraversable () test = do dir <- inject "retter" dirContents <- listDirectory dir - let dirContents' = makeTraversable dirContents - u <- mapM openImage dirContents' + u <- mapListTaken testSub dirContents pure $ NoToken main :: IO ()