开发者

Packages, modules and import in Haskell

I'm newish to Haskell. Would someone kindly explain how code organization works in Haskell? To date I have written everything in one big long file and tested code from GHCi. I want 开发者_运维技巧to start writing tests an refactor my code into logical units. There are bits and pieces about how to do this in lots of places, but nothing comprehensive.

Please explain how packages, modules and the import statement work then tell me how to use them to organize code into a larger, test-driven project.


Here is an introduction Haskell modules from "Learn You a Haskell for Great Good!":

http://learnyouahaskell.com/modules

I would call a package the smallest deliverable unit of Haskell software. For most people, it is enough to say "packages are the things on Hackage".

If you're shipping an executable I wouldn't worry about breaking up your project into multiple packages until you get to your second project, and want to re-use modules from the first.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜