Developer Guide
Getting Started with nix
For instructions on installing nix, see TODO.
|
To develop within this repository,
we recommend using a development shell defined in flake.nix.
In this way,
you will use applications
pinned to same version that other developers and the CI use.
For example, from the project’s root directory, launch the project’s default shell using:
nix develop .
To launch a shell with the haskell toolchain loaded:
nix develop .#haskell
After launching a nix shell,
you’re in a bash shell with the appropriate applications
in your path.
As of 2022-04-12,
cabal build all fails in
the project’s nix Haskell shell on an M1 Mac
(it works on the CI’s linux machine).
For now, use your locally installed versions of ghc and cabal.
|
Notable Indirections
This sections tries to document where and why the structure of certain parts of the repository may not be straightfoward.
-
Tests for models are not automatically created in the
fact-modelslibrary. Model creators should create aTestmodule for their model, and add those tests to the mainTestmodule. -
This repo uses
ormolufor Haskell formatting. Other repos such asasclepiasusebrittany, but as of 2022-04-22brittanyyields errors likely due to incompatability with template haskell. -
The eventline shape is defined for Rust in this repo, but as of 2022-04-22, the same shapes in Haskell are defined in the
event-data-theorypackage in asclepias. -
The
build-fragmentsapplication (seeflake.nixin project root) creates a dhall file than be used to check the integrity of eachFact.dhall(orModel.dhall) file. This is checked by thecheck-fragments.shcheck (seeflake.nix) withdhall freeze $1 --check --all. This also serves to check that the fragments are up-to-date assuming that the fragments are only created bybuild-fragmentsand not edited otherwise.
Tests
An important part of this repository are the integration tests that ensure that application logic is correct and that data can be marshalled to/from applications as appropriate.
This page documents checks done in this repo and where they are found.
| Description | Notes | Implemented |
|---|---|---|
Serialization of facts and models in Haskell, Dhall, and JSON |
See
The
See Each model needs to call the test functions in a test module. |
Yes, though see note. |
Eventlines values produced by upstream processes can be marshalled to/from Haskell applications |
No |
Versioning
Versioning of fact-models and other packages in this repository follow
semantic versioning (MAJOR.MINOR.PATCH),
where you increment:
MAJOR version when you make incompatible API changes,
MINOR version when you add functionality in a backwards compatible manner
PATCH version when you make backwards compatible bug fixes
In particular, adding new facts or models typically only requires a MINOR update, while changing the shape of existing facts or models should trigger a MAJOR update. Bug fixes to the library functions should only trigger a PATCH update.