diff --git a/elm.json b/elm.json index 88f17b0..cbfa04e 100644 --- a/elm.json +++ b/elm.json @@ -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", diff --git a/src/Messenger/Recursion.elm b/src/Messenger/Recursion.elm index d85282b..255acf4 100644 --- a/src/Messenger/Recursion.elm +++ b/src/Messenger/Recursion.elm @@ -1,5 +1,5 @@ module Messenger.Recursion exposing - ( Updater, Matcher, Super + ( Updater, Matcher, Super, Cleaner , RecBody ) @@ -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 -} @@ -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 @@ -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 } diff --git a/src/Messenger/RecursionArray.elm b/src/Messenger/RecursionArray.elm index 6e8d684..9b014a4 100644 --- a/src/Messenger/RecursionArray.elm +++ b/src/Messenger/RecursionArray.elm @@ -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 diff --git a/src/Messenger/RecursionList.elm b/src/Messenger/RecursionList.elm index a5f1dfd..59cbc28 100644 --- a/src/Messenger/RecursionList.elm +++ b/src/Messenger/RecursionList.elm @@ -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