Bugs item #940294, was opened at 2004-04-22 13:16
Message generated for change (Comment added) made by nobody
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=940294&group_id=8032

Category: libraries (other)
Group: 6.2.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Jon Cast (jcast)
Assigned to: Nobody/Anonymous (nobody)
Summary: Language.Haskell.Pretty misformats 

Initial Comment:
ghci gives the following results:

$ ghci -fglasgow-exts
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version
6.2.1, for Haskell 98.
/ /_\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.
 
Loading package base ... linking ... done.
Prelude> :m + Language.Haskell.Syntax
Prelude Language.Haskell.Syntax> :m +
Language.Haskell.Pretty Prelude Language.Haskell.Syntax
Language.Haskell.Pretty> putStrLn $ prettyPrint  $
HsInfixApp (HsDo [HsQualifier (HsVar (UnQual (HsIdent
"undefined"))), HsQualifier (HsVar (UnQual (HsIdent
"undefined")))]) (HsQVarOp (UnQual (HsSymbol "<|>")))
(HsDo [HsQualifier (HsVar (UnQual (HsIdent "undefined")))])
Loading package haskell98 ... linking ... done.
Loading package haskell-src ... linking ... done.
do undefined
   undefined
  <|> do undefined
Prelude Language.Haskell.Pretty
Language.Haskell.Syntax> putStrLn $ prettyPrint $ HsApp
(HsVar (UnQual (HsIdent "foo"))) $ HsApp (HsVar (UnQual
(HsIdent "bar"))) $ HsVar (UnQual (HsIdent "baz"))
foo bar baz

In other words, it mis-indents infix applications and
does /not/ parenthesize nested applications.  There may
be other mis-formatting issues, but these are the ones
that have me stopped atm.


----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2004-04-22 16:10

Message:
Logged In: NO 

I don't see the problem with the first one: <|> must be
indented less
than the do body to force a }, but not so much that it
forces a ; in an
outer layout context.

Regarding the second one, prettyPrint never inserts
parentheses in
expressions. You have to use HsParen, and the parser leaves
those
in the parse tree. If you're generating source, you'll need
to add it.
Maybe it should be smarter than that, but it would still be
limited,
since there's no information about operator fixity.

-- Ross Paterson

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=940294&group_id=8032
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to