简体   繁体   中英

Ghc: partially compile Haskell code?

When I compile a Haskell file with ghci , typically with :load , and if there is no type error, all the expressions are loaded in the ghc interpreter. It's very nice: I can play around with :t to figure out the type of various expressions.

My problem is: if there is a tiny error somewhere, ghci is not able to load anything (not even the imported modules!!), which makes finding the right types even more difficult. I always do the same: comment out all the bits that do not typecheck, find the relevant types wiht :t in ghci, and de-comment.

But this is so tedious! Is there a better workflow for "partially compiling" a Haskell source code?

正如@MikhailGlushenkov在评论中指出的那样,解决方案是对GHCi使用-fdefer-type-errors标志。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM