Skip to content

Commit

Permalink
feat: expose target updater
Browse files Browse the repository at this point in the history
  • Loading branch information
linsyking committed May 18, 2023
1 parent 41af53f commit 7b0f218
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion elm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "linsyking/messenger-core",
"summary": "Core library for Messenger.",
"license": "BSD-3-Clause",
"version": "4.0.1",
"version": "4.1.0",
"exposed-modules": {
"Definitions": [
"Messenger.Recursion",
Expand Down
11 changes: 9 additions & 2 deletions src/Messenger/RecursionArray.elm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Messenger.RecursionArray exposing
( updateObjects
( updateObjects, updateObjectsWithTarget
, getObjectIndices, getObjectIndex, getObjects, getObject, updateObjectByIndex, updateObjectsByTarget
)

Expand All @@ -10,7 +10,7 @@ module Messenger.RecursionArray exposing
Array implementation for the recursion algorithm
@docs updateObjects
@docs updateObjects, updateObjectsWithTarget
## Tools
Expand All @@ -35,6 +35,13 @@ updateObjects rec env msg objs =
updateRemain rec newEnv ( newMsgUnfinished, newMsgFinished ) newObjs


{-| Recursively update all the objects in the Array, but also uses target
-}
updateObjectsWithTarget : RecBody a b c d -> c -> List ( d, b ) -> Array a -> ( Array a, List b, c )
updateObjectsWithTarget rec env msgs objs =
updateRemain rec env ( msgs, [] ) objs



-- Below are all helper functions

Expand Down
11 changes: 9 additions & 2 deletions src/Messenger/RecursionList.elm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Messenger.RecursionList exposing
( updateObjects
( updateObjects, updateObjectsWithTarget
, getObjectByIndex, getObjectIndices, getObjectIndex, getObjects, getObject, updateObjectByIndex, updateObjectsByTarget
)

Expand All @@ -10,7 +10,7 @@ module Messenger.RecursionList exposing
List implementation for the recursion algorithm
@docs updateObjects
@docs updateObjects, updateObjectsWithTarget
## Tools
Expand All @@ -34,6 +34,13 @@ updateObjects rec env msg objs =
updateRemain rec newEnv ( newMsgUnfinished, newMsgFinished ) newObjs


{-| Recursively update all the objects in the List, but also uses target
-}
updateObjectsWithTarget : RecBody a b c d -> c -> List ( d, b ) -> List a -> ( List a, List b, c )
updateObjectsWithTarget rec env msgs objs =
updateRemain rec env ( msgs, [] ) objs



-- Below are all helper functions

Expand Down

0 comments on commit 7b0f218

Please sign in to comment.