the-sett / elm-syntax-dsl

A DSL for creating Elm syntax trees and pretty printing Elm source code.
BSD 3-Clause "New" or "Revised" License
20 stars 4 forks source link

`chain` function recurses into the `pipe` function #20

Open rupertlssmith opened 4 years ago

rupertlssmith commented 4 years ago
chain : Expression -> List Expression -> Expression
chain head expressions =
    case expressions of
        [] ->
            head

        [ expr ] ->
            applyBinOp head composer expr

        expr :: exprs ->
            applyBinOp head composer (pipe expr exprs)

In the last line it should recurse into the chain function, or this will produce one function compose operator followed by pipe operators.