How justromeon/codingbat works
Project type and purpose
• This is a Haskell-based code repository whose purpose is to provide Haskell solutions to CodingBat Python exercises, together with a test suite validating those solutions.
• It is not a full-stack app or a microservices system, but rather a small library/CLI‐style project with source modules and automated tests, built and managed by Cabal.
File structure
• Top level:
• codingbat.cabal – the Cabal package descriptor (defines library or executable targets, dependencies, test suite).
• src/ – contains all Haskell modules (Logic1.hs, Logic2.hs, String1.hs, String2.hs, Warmup1.hs, Warmup2.hs).
• test/ – HSpec test specifications for each module, plus Spec.hs as the test runner entry point.
• Configuration files:
• .gitignore, LICENSE, README.md
• Build scripts and commands are driven by Cabal (cabal update, cabal build, cabal test).
README for additional insights
• Confirms that this is a repository of solutions and tests, built via Cabal.
• No external services or databases; it’s purely source → build → test.
Components
a. Source modules layer (“Library”)
• Src/*.hs file (or group them logically as “Warmup”, “Logic”, “String”)
• This is the core functionality: Haskell functions implementing CodingBat challenges.
b. Test suite layer
• test/*.hs files, driven by HSpec, referencing the functions in src/
c. Build system / toolchain
• Cabal: dependency resolution, compilation, linking, test execution
d. External dependencies
• Base libraries (GHC’s base, HSpec) fetched via Cabal
e. Developer workflow
• Commands: cabal update → cabal build → cabal test
Architectural patterns & design principles
• Clear separation of concerns: pure functions in src/ vs. tests in test/
• Layered architecture:
• Source layer
• Build/Test orchestration layer
• Use of declarative package management (Cabal files)
Diagramming recommendations
• Use rectangles for components: src modules grouped, test suite grouped, Cabal tool, external repo
• src → Cabal (“cabal build”)
• Cabal → build artifacts (compiled .o/.hi or executable)
• Test suite → Cabal/test runner (HSpec harness)
• Blue for code artifacts (src, tests)
• Green for tooling (Cabal)
• Gray for external (Hackage)