elm-return
elm-return copied to clipboard
Either andThenK or pipelK seems not quite right
andThenK : (a -> Return x b) -> (b -> Return x c) -> (a -> Return x c)
which means it needs to be called like
andThenK doFirst doSecond
which is the opposite to andThen
.
This is fine, I guess, except that
pipelK = List.foldl andThenK singleton
which means
pipelK [doFirst, doSecond]
expand pipelK
List.foldl andThenK singleton [doFirst, doSecond]
expand foldl per https://package.elm-lang.org/packages/elm/core/1.0.5/List#foldl
singleton
|> andThenK doFirst
|> andThenK doSecond
expand |>
andThenK doSecond (andThenK doFirst singleton)
which has the effect of doing doSecond
first, then doFirst
. The name pipelK
(and the comment "Compose updaters from the left") implies it should be the other way around.
I'd solve this by flipping the type of andThenK
, and I am happy to submit a PR, just wanted to check it's the right thing to do.