Skip to content

πŸ“¦ A minimal Haskell project with library, executable, and tests. Built with cabal init and used in two lessons from the Software Library Design and Implementation course.

License

Notifications You must be signed in to change notification settings

r8vnhill/echo-app-cabal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

echo-app-cabal

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:

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.

πŸ“¦ Project Structure

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)

πŸš€ Quick Start

1. Install GHCup (if not already installed)

  • macOS:
    brew install ghcup
  • Linux:
    curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
  • Windows (with Scoop):
    scoop install ghcup

2. Install tools

ghcup install ghc
ghcup install cabal

On Windows, you may need to manually add GHC's bin directory to your PATH. The lessons explain how to do this with PowerShell.

3. Run the app

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?

πŸ§ͺ Running Tests

cabal test

✍️ About the Lessons

This project was initialized interactively using cabal init, with both lessons guiding you through:

  • Choosing project layout and .cabal specification
  • 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.

πŸ“š References

βš–οΈ License

BSD-2-Clause Β© Ignacio Slater MuΓ±oz

About

πŸ“¦ A minimal Haskell project with library, executable, and tests. Built with cabal init and used in two lessons from the Software Library Design and Implementation course.

Topics

Resources

License

Stars

Watchers

Forks