By the way, thanks for everyone's comments so far!  They're very helpful!

> Also, most haskell programs use $ instead of |>
>
> > -- For convenience:
> > currTokType :: ParseContext -> TokenType
> > currTokType ctx = ctx |> currTok |> tokenType
>
> this could be written as:
> tokenType $ currTok $ ctx

Concerning:

-- |> is like a UNIX pipe.
infixl 9 |>
x |> f = f x

I find "ctx |> currTok |> tokenType" to be more readable than
"tokenType $ currTok $ ctx" because you're not reading the code in
reverse.  That's my primary complaint with "." and "$".  That's
especially the case when I'm spreading the code over multiple lines:

-- Translate a C type declaration into English.
translate :: String -> String
translate s =
  s |>
  createParseContext |>
  readToFirstIdentifier |>
  dealWithDeclarator |>
  consolidateOutput

I prefer |> for readability, but I understand that it can be bad to
spring new constructs on programmers in the middle of a program, and
I'm totally in favor of following standard Haskell idioms.  Does
anyone else have strong opinions one way or the other?  It seems like
most of my program is centered around pipes of "|>", so it's an
important issue.

Thanks!
-jj
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to