Connect GetListElem to outer input list

This commit is contained in:
Niels G. W. Serup 2024-09-21 19:32:32 +02:00
parent 8184160035
commit 8c7e311338
No known key found for this signature in database
GPG Key ID: 38EEEBCE67324F19
1 changed files with 4 additions and 4 deletions

View File

@ -12,7 +12,7 @@ data TypedRun a b where
Function :: IsFunction f a b => f -> TypedRun a b Function :: IsFunction f a b => f -> TypedRun a b
FunctionIO :: IsFunctionIO f a b => f -> TypedRun a b FunctionIO :: IsFunctionIO f a b => f -> TypedRun a b
Inject :: b -> TypedRun () b Inject :: b -> TypedRun () b
GetListElem :: TypedRun () b GetListElem :: TypedRun [b] b
SetListElem :: TypedRun a () SetListElem :: TypedRun a ()
MapComp :: [DependencyUntyped] -> TypedRun [a] [b] MapComp :: [DependencyUntyped] -> TypedRun [a] [b]
@ -57,8 +57,8 @@ genDependency g = do
inject :: Show a => a -> ComputationM a inject :: Show a => a -> ComputationM a
inject x = genDependency (Dependency NoToken (Inject x)) inject x = genDependency (Dependency NoToken (Inject x))
getListElem :: Show a => ComputationM a getListElem :: Show a => Token [a] -> ComputationM a
getListElem = genDependency (Dependency NoToken GetListElem) getListElem outer = genDependency (Dependency outer GetListElem)
setListElem :: Show a => Token a -> ComputationM () setListElem :: Show a => Token a -> ComputationM ()
setListElem a = genDependency (Dependency a SetListElem) setListElem a = genDependency (Dependency a SetListElem)
@ -86,6 +86,6 @@ mapComputationM f input = do
genDependency (Dependency input (MapComp res)) genDependency (Dependency input (MapComp res))
where m :: ComputationM () where m :: ComputationM ()
m = do m = do
inp <- getListElem inp <- getListElem input
outp <- f inp outp <- f inp
setListElem outp setListElem outp