Skip to content

Commit

Permalink
feat: add cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
linsyking committed May 18, 2023
1 parent 7b0f218 commit bc32e3b
Show file tree
Hide file tree
Showing 4 changed files with 12 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.1.0",
"version": "5.0.0",
"exposed-modules": {
"Definitions": [
"Messenger.Recursion",
Expand Down
11 changes: 9 additions & 2 deletions src/Messenger/Recursion.elm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Messenger.Recursion exposing
( Updater, Matcher, Super
( Updater, Matcher, Super, Cleaner
, RecBody
)

Expand All @@ -10,7 +10,7 @@ module Messenger.Recursion exposing
This module provides the signature for the updater
@docs Updater, Matcher, Super
@docs Updater, Matcher, Super, Cleaner
@docs RecBody
-}
Expand Down Expand Up @@ -38,6 +38,12 @@ type alias Super d =
d -> Bool


{-| Clean the environment
-}
type alias Cleaner c =
c -> c


{-| RecBody type.
Pass this as an argument to the updater
Expand All @@ -47,4 +53,5 @@ type alias RecBody a b c d =
{ update : Updater a b c d
, match : Matcher a d
, super : Super d
, clean : Cleaner c
}
2 changes: 1 addition & 1 deletion src/Messenger/RecursionArray.elm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ updateObjects rec env msg objs =
( newObjs, ( newMsgUnfinished, newMsgFinished ), newEnv ) =
updateOnce rec env msg objs
in
updateRemain rec newEnv ( newMsgUnfinished, newMsgFinished ) newObjs
updateRemain rec (rec.clean newEnv) ( newMsgUnfinished, newMsgFinished ) newObjs


{-| Recursively update all the objects in the Array, but also uses target
Expand Down
2 changes: 1 addition & 1 deletion src/Messenger/RecursionList.elm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ updateObjects rec env msg objs =
( newObjs, ( newMsgUnfinished, newMsgFinished ), newEnv ) =
updateOnce rec env msg objs
in
updateRemain rec newEnv ( newMsgUnfinished, newMsgFinished ) newObjs
updateRemain rec (rec.clean newEnv) ( newMsgUnfinished, newMsgFinished ) newObjs


{-| Recursively update all the objects in the List, but also uses target
Expand Down

0 comments on commit bc32e3b

Please sign in to comment.