I was following the stack guide and I got a new project setup (yay!).
It generated the following file layout:
.
├── app
│ ├── Main.hs
├── .gitignore
├── LICENSE
├── helloworld.cabal
├── Setup.hs
├── src
│ └── Lib.hs
├── stack.yaml
└── test
└── Spec.hs
According to the "Files in helloworld" section of the guide:
The app/Main.hs, src/Lib.hs, and test/Spec.hs files are all Haskell source files that compose the actual functionality of our project (we won't dwell on them here).
I really wish they had dwelled on that for a second, because I have no idea what the distinction between app/Main.hs
and src/Lib.hs
should be. Which code should I put where?
In what ways am I supposed to divide code between app/
, src/
, app/Main.hs
and src/Lib.hs
?
If I'm just writing an application or just writing a library, do I need both files/directories?