问题描述:

Is there a way in GHCI to show a fully parenthesized version of a statement? I've found myself wanting to do that sometimes to help me understand a piece of code that I'm not familiar with. Sometimes the conciseness of the masters obscure things for us n00bs, and anything to help me break these beasts apart seems to help.

网友答案:

Try ghc -ddump-parsed.

网友答案:

A number of approaches are documented on the wiki: http://haskell.org/haskellwiki/Indent#Indenting_Haskell_Mechanically

网友答案:

Perhaps not directly relating to your question, but I often find point-free code hard to read. Incidentally, the tool to generate a point-free form for expressions, can also do the opposite. For example:

 > unpl const . (1 +)
 (\ e _ -> 1 + e)

Much better! :)

相关阅读:
Top