[Haskell-cafe] Re: request for code review

Einar Karttunen ekarttun at cs.helsinki.fi
Sun Mar 12 05:32:39 EST 2006


On 12.03 01:47, Shannon -jj Behrens wrote:
> monad.  Perhaps controversially, I've continued to use |> in a bunch
> of places that the monad didn't get rid of because I think it's more
> readable, but I'm still open for argument on this topic.  Using the

What about using (>>>) from Control.Arrow?

> -- For convenience:
> currTokType :: ParseContext -> TokenType
> currTokType ctx = ctx |> currTok |> tokenType

currTokType = currTok >>> tokenType

> currTokValue :: ParseContext -> String
> currTokValue ctx = ctx |> currTok |> tokenValue

currTokValue = currTok >>> tokenValue

> -- Create the final output string given a ParseContext.
> consolidateOutput :: ParseContext -> String
> consolidateOutput ctx =
>   ctx |> output |> reverse |> concat

consolidateOutput = output >>> reverse >>> concat

and so on.

- Einar Karttunen


More information about the Haskell-Cafe mailing list