[Haskell-cafe] Re: how to see operators precedence in GHCi

Stefan O'Rear stefanor at cox.net
Wed Jul 25 13:55:56 EDT 2007


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:

stefan at stefans:~$ 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> 

Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20070725/0e6fc69f/attachment.bin


More information about the Haskell-Cafe mailing list