On Wed, Jul 25, 2007 at 10:55:56AM -0700, Stefan O'Rear wrote: > On Wed, Jul 25, 2007 at 09:35:38PM +0400, Bulat Ziganshin wrote: > > Hello Jon, > > > > Wednesday, July 25, 2007, 8:07:57 PM, you wrote: > > >> Q: how to see operators precedence in GHCi? > > >> In the definition of `it': it = showParen $ (2 + (3 * 4)) > > > > > Hmm, OK, but not that much quicker than going > > > Prelude> :info (*) > > > > it just my poor english :) i mean - "how to see how Haskell will > > parse some expression?". it will be too slow to look up each > > precedence and parse expression by hand :) > > Much easier: > > [EMAIL PROTECTED]:~$ ghci > GHCi, version 6.7.20070712: http://www.haskell.org/ghc/ :? for help > Loading package base ... linking ... done. > Prelude> :set -ddump-parsed > Prelude> 2 + 3 * 4 > > ==================== Parser ==================== > Just (2 + 3) * 4 > > > 14 > Prelude>
Uhm... that didn't work :) Not quite as nice: [EMAIL PROTECTED]:~$ ghci -ddump-rn-trace GHCi, version 6.7.20070712: http://www.haskell.org/ghc/ :? for help Top level: tcRnStmt let __cmCompileExpr = System.IO.stdout let __cmCompileExpr = GHC.Handle.stdout [(rw, GHC.Handle.stdout)] Loading package base ... linking ... done. Top level: tcRnStmt let __cmCompileExpr = System.IO.stderr let __cmCompileExpr = GHC.Handle.stderr [(rjJ, GHC.Handle.stderr)] Top level: tcRnStmt let __cmCompileExpr = System.IO.stdin let __cmCompileExpr = GHC.Handle.stdin [(rq, GHC.Handle.stdin)] Prelude> 2 + 3 * 4 Top level: tcRnStmt (2 + 3) * 4 2 + (3 * 4) [(rqz, +), (rqA, *)] 14 Prelude> Stefan
signature.asc
Description: Digital signature
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
