[Haskell-cafe] Re: request for code review
Shannon -jj Behrens
jjinux at gmail.com
Mon Mar 13 21:48:51 EST 2006
On 3/12/06, Einar Karttunen <ekarttun at cs.helsinki.fi> wrote:
> 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.
I'm sorry, I looked at Arrow.hs, and I just don't understand. The
State monad is working just fine. I'm only using |> as a replacement
for $ because I find it more readable to read left to right than right
to left. Arrows looks like a replacement for monads. Are you saying
I should drop my use of the State monad? If so, why? I like the
readability of the do syntax. Are you saying that >>> can be used as
a reversed version of $?
Thanks for your patiences with my ignorance ;)
More information about the Haskell-Cafe