A simple Haskell project created with
cabal init, showcasing a clean structure with library, executable, and test suite components.
This repository accompanies two lessons from the Software Library Design and Implementation course:
-
Lesson Language: Spanish
-
Code and Repo Language: English (to improve accessibility)
The goal is to provide a minimal but well-structured foundation for learning how to organize and build Haskell projects using Cabal and GHCup, with a focus on clean architecture and modularity.
echo-app-cabal/
βββ app/ # Executable entry point
β βββ Main.hs
βββ src-lib/ # Library source code
β βββ Echo.hs
βββ test/ # Test suite
β βββ Main.hs
βββ echo-app-cabal.cabal # Project definition
βββ LICENSE # License (BSD-2-Clause)
- macOS:
brew install ghcup
- Linux:
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
- Windows (with Scoop):
scoop install ghcup
ghcup install ghc
ghcup install cabalOn Windows, you may need to manually add GHC's bin directory to your PATH. The lessons explain how to do this with PowerShell.
cabal run echo-app-cabal -- "Hi Barbie!" "Hi Ken!" "Do you guys ever think about dying?"Expected output:
Hi Barbie!
Hi Ken!
Do you guys ever think about dying?
cabal testThis project was initialized interactively using cabal init, with both lessons guiding you through:
- Choosing project layout and
.cabalspecification - Separating reusable logic into a library (
src-lib) - Configuring an executable to consume the library
- Passing arguments from the terminal
- Preparing for testing by including a test suite early
The lessons go beyond just running commands: they explain the reasoning behind each choice and how to make your project modular and extensible from the start.
BSD-2-Clause Β© Ignacio Slater MuΓ±oz