rename CRM to Crem

This commit is contained in:
Marco Perone 2023-02-06 12:31:35 +01:00 committed by Marco Perone
parent b5cb36c0a9
commit 380ed98093
30 changed files with 116 additions and 116 deletions

View File

@ -23,4 +23,4 @@ jobs:
with:
nix_path: nixpkgs=channel:nixos-22.11
- name: Build
run: nix build -L .#crm.ghc${{ matrix.ghc }}
run: nix build -L .#crem.ghc${{ matrix.ghc }}

View File

@ -50,14 +50,14 @@ To do this, run
nix build
# custom GHC
nix build .#crm.ghc90
nix build .#crm.ghc92
nix build .#crem.ghc90
nix build .#crem.ghc92
```
To view the compilation logs, you can append `-L`:
```sh
nix build -L
nix build -L .#crm.ghc92
nix build -L .#crem.ghc92
```
## project setup
@ -113,7 +113,7 @@ hpack
Note that Cabal does not understand `package.yaml` files, and requires us to generate a `.cabal` file before running `cabal`.
Nix (or more precisely, Cabal2nix) uses a `.cabal` file if it is present, otherwise the `package.yaml` file. Because `package.yaml` is our single source of truth, we would prefer that Nix uses it instead of the generated `.cabal`. This is why we don't commit the `.cabal` file.
- `crm.cabal`
- `crem.cabal`
This file is automatically generated from the `package.yaml` file and should not be committed to Git history.

View File

@ -5,4 +5,4 @@ import "doctest-parallel" Test.DocTest (mainFromCabal)
main :: IO ()
main = do
mainFromCabal "crm" =<< getArgs
mainFromCabal "crem" =<< getArgs

View File

@ -1,5 +1,5 @@
{
description = "marcosh/crm: compositional reproducible machines";
description = "tweag/cerm: compositional reproducible executable machines";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
@ -37,8 +37,8 @@
}:
haskellPackages.override {
overrides = self: super: {
crm = (self.callCabal2nix "crm" src { }).overrideAttrs (attrs: {
# doctest-parallel needs to know where the compiled crm package is
crem = (self.callCabal2nix "crem" src { }).overrideAttrs (attrs: {
# doctest-parallel needs to know where the compiled crem package is
preCheck = ''
export GHC_PACKAGE_PATH="dist/package.conf.inplace:$GHC_PACKAGE_PATH"
'';
@ -118,24 +118,24 @@
in
rec {
packages = {
# Build crm for one given GHC versions.
crm = foldConfigurations (haskellPackages: haskellPackages.crm);
# Build crem for one given GHC versions.
crem = foldConfigurations (haskellPackages: haskellPackages.crem);
# Build crm for all GHC versions at once, collecting the results into one derivation.
# Build crem for all GHC versions at once, collecting the results into one derivation.
# documentation: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/trivial-builders.nix
crmAll = pkgs.symlinkJoin {
name = "crmAll";
paths = builtins.attrValues packages.crm;
cremAll = pkgs.symlinkJoin {
name = "cremAll";
paths = builtins.attrValues packages.crem;
};
default = packages.crm.${defaultGhcVersion};
default = packages.crem.${defaultGhcVersion};
};
# Prepare a development shell for many diffent GHC versions.
devShells = foldConfigurations
(haskellPackages:
haskellPackages.shellFor {
packages = ps: [ ps.crm ];
packages = ps: [ ps.crem ];
nativeBuildInputs = with haskellPackages; [
cabal-install
fourmolu

View File

@ -2,8 +2,8 @@
module Main where
import "crm" CRM.Example.TheHobbit
import "crm" CRM.StateMachine
import "crem" Crem.Example.TheHobbit
import "crem" Crem.StateMachine
import "base" Data.Functor.Identity
main :: IO ()

View File

@ -1,4 +1,4 @@
name: crm
name: crem
version: 0.1.0.0
author: Marco Perone
maintainer: marco.perone@tweag.io
@ -99,46 +99,46 @@ library:
- profunctors
- singletons-base
- text
# Disable adding Paths_crm to other-modules, because it does not conform to our style guide.
# Disable adding Paths_crem to other-modules, because it does not conform to our style guide.
# https://github.com/sol/hpack#handling-of-paths_-modules
when:
- condition: false
other-modules: Paths_crm
other-modules: Paths_crem
tests:
crm-spec:
crem-spec:
main: Spec.hs
source-dirs: spec
dependencies:
- crm
- crem
- hspec
- profunctors
- singletons-base
when:
- condition: false
other-modules: Paths_crm
other-modules: Paths_crem
crm-doctests:
crem-doctests:
source-dirs: doctest
main: Main.hs
ghc-options:
- -threaded
- -Wno-unused-packages
dependencies:
- crm
- crem
- doctest-parallel
when:
- condition: false
other-modules: Paths_crm
other-modules: Paths_crem
executables:
hobbit-game:
source-dirs: hobbit-game
main: Main.hs
dependencies:
- crm
# Disable adding Paths_crm to other-modules, because it does not conform to our style guide.
- crem
# Disable adding Paths_crem to other-modules, because it does not conform to our style guide.
# https://github.com/sol/hpack#handling-of-paths_-modules
when:
- condition: false
other-modules: Paths_crm
other-modules: Paths_crem

View File

@ -1,6 +1,6 @@
module CRM.GraphSpec where
module Crem.GraphSpec where
import "crm" CRM.Graph
import "crem" Crem.Graph
import "hspec" Test.Hspec (Spec, describe, it, shouldBe)
spec :: Spec

View File

@ -1,10 +1,10 @@
module CRM.Render.RenderFlowSpec where
module Crem.Render.RenderFlowSpec where
import "crm" CRM.Example.LockDoor (SLockDoorVertex (..), lockDoorMachine)
import "crm" CRM.Example.RiskManager.Application (riskApplication)
import "crm" CRM.Render.Render (MachineLabel (..), Mermaid (..), baseMachineAsGraph, renderLabelledGraph)
import "crm" CRM.Render.RenderFlow (TreeMetadata (..), renderFlow)
import "crm" CRM.StateMachine (StateMachineT (..), stateless)
import "crem" Crem.Example.LockDoor (SLockDoorVertex (..), lockDoorMachine)
import "crem" Crem.Example.RiskManager.Application (riskApplication)
import "crem" Crem.Render.Render (MachineLabel (..), Mermaid (..), baseMachineAsGraph, renderLabelledGraph)
import "crem" Crem.Render.RenderFlow (TreeMetadata (..), renderFlow)
import "crem" Crem.StateMachine (StateMachineT (..), stateless)
import "base" Data.Functor.Identity (Identity)
import "base" Data.List (singleton)
import "hspec" Test.Hspec

View File

@ -1,12 +1,12 @@
module CRM.Render.RenderSpec where
module Crem.Render.RenderSpec where
import CRM.Example.LockDoor
import CRM.Example.OneState
import CRM.Example.Switch
import "crm" CRM.Graph
import "crm" CRM.Render.Render
import "crm" CRM.StateMachine
import CRM.Topology (trivialTopology)
import Crem.Example.LockDoor
import Crem.Example.OneState
import Crem.Example.Switch
import "crem" Crem.Graph
import "crem" Crem.Render.Render
import "crem" Crem.StateMachine
import Crem.Topology (trivialTopology)
import Data.Functor.Identity
import "base" Data.List (intersperse)
import Data.Singletons.Base.TH

View File

@ -1,10 +1,10 @@
module CRM.RiskManagerSpec where
module Crem.RiskManagerSpec where
import CRM.Example.RiskManager.Application
import CRM.Example.RiskManager.Domain
import CRM.Example.RiskManager.Projection (ReceivedData (..))
import "crm" CRM.StateMachine (run, runMultiple)
import CRM.StateMachineSpec (shouldOutput)
import Crem.Example.RiskManager.Application
import Crem.Example.RiskManager.Domain
import Crem.Example.RiskManager.Projection (ReceivedData (..))
import "crem" Crem.StateMachine (run, runMultiple)
import Crem.StateMachineSpec (shouldOutput)
import "hspec" Test.Hspec (Spec, describe, it)
myUserData :: UserData

View File

@ -1,10 +1,10 @@
module CRM.StateMachineSpec where
module Crem.StateMachineSpec where
import CRM.Example.BooleanStateMachine (booleanStateMachine)
import CRM.Example.LockDoor
import CRM.Example.PlusOneUpToFour (plus1UpTo4)
import CRM.Example.Switch (switchMachine)
import "crm" CRM.StateMachine
import Crem.Example.BooleanStateMachine (booleanStateMachine)
import Crem.Example.LockDoor
import Crem.Example.PlusOneUpToFour (plus1UpTo4)
import Crem.Example.Switch (switchMachine)
import "crem" Crem.StateMachine
import "base" Control.Category qualified
import "base" Data.Functor.Identity (Identity (..))
import "base" Data.List (singleton)

View File

@ -1,8 +1,8 @@
{-# LANGUAGE DataKinds #-}
module CRM.BaseMachine where
module Crem.BaseMachine where
import CRM.Topology
import Crem.Topology
import "base" Data.Bifunctor (Bifunctor (..), first)
import "base" Data.Kind (Type)

View File

@ -1,9 +1,9 @@
{-# LANGUAGE GADTs #-}
module CRM.Example.BooleanStateMachine where
module Crem.Example.BooleanStateMachine where
import CRM.BaseMachine
import CRM.StateMachine
import Crem.BaseMachine
import Crem.StateMachine
import "singletons-base" Data.Singletons.Base.TH
booleanStateMachine

View File

@ -9,10 +9,10 @@
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wunused-type-patterns
{-# OPTIONS_GHC -Wno-unused-type-patterns #-}
module CRM.Example.LockDoor where
module Crem.Example.LockDoor where
import CRM.BaseMachine
import CRM.Topology
import Crem.BaseMachine
import Crem.Topology
import "singletons-base" Data.Singletons.Base.TH
$( singletons

View File

@ -1,10 +1,10 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
module CRM.Example.OneState where
module Crem.Example.OneState where
import CRM.BaseMachine
import CRM.Topology
import Crem.BaseMachine
import Crem.Topology
import "singletons-base" Data.Singletons.Base.TH
oneVertexMachine :: BaseMachine (TrivialTopology @()) () ()

View File

@ -1,8 +1,8 @@
{-# LANGUAGE GADTs #-}
module CRM.Example.PlusOneUpToFour where
module Crem.Example.PlusOneUpToFour where
import CRM.StateMachine (StateMachine, stateless)
import Crem.StateMachine (StateMachine, stateless)
plus1UpTo4 :: StateMachine Int [Int]
plus1UpTo4 =

View File

@ -7,11 +7,11 @@
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wunused-type-patterns
{-# OPTIONS_GHC -Wno-unused-type-patterns #-}
module CRM.Example.RiskManager.Aggregate where
module Crem.Example.RiskManager.Aggregate where
import CRM.BaseMachine
import CRM.Example.RiskManager.Domain
import CRM.Topology
import Crem.BaseMachine
import Crem.Example.RiskManager.Domain
import Crem.Topology
import "singletons-base" Data.Singletons.Base.TH
$( singletons

View File

@ -1,10 +1,10 @@
module CRM.Example.RiskManager.Application where
module Crem.Example.RiskManager.Application where
import CRM.Example.RiskManager.Aggregate (riskAggregate)
import CRM.Example.RiskManager.Domain (RiskCommand, RiskEvent)
import CRM.Example.RiskManager.Policy (riskPolicy)
import CRM.Example.RiskManager.Projection (ReceivedData, riskProjection)
import CRM.StateMachine
import Crem.Example.RiskManager.Aggregate (riskAggregate)
import Crem.Example.RiskManager.Domain (RiskCommand, RiskEvent)
import Crem.Example.RiskManager.Policy (riskPolicy)
import Crem.Example.RiskManager.Projection (ReceivedData, riskProjection)
import Crem.StateMachine
import "base" Data.List (singleton)
import "base" Data.Maybe (maybeToList)
import "profunctors" Data.Profunctor (rmap)

View File

@ -1,4 +1,4 @@
module CRM.Example.RiskManager.Domain where
module Crem.Example.RiskManager.Domain where
import "base" Data.String (IsString)

View File

@ -1,7 +1,7 @@
module CRM.Example.RiskManager.Policy where
module Crem.Example.RiskManager.Policy where
import CRM.Example.RiskManager.Domain
import CRM.StateMachine
import Crem.Example.RiskManager.Domain
import Crem.StateMachine
riskPolicy :: StateMachine RiskEvent (Maybe RiskCommand)
riskPolicy =

View File

@ -9,11 +9,11 @@
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wunused-type-patterns
{-# OPTIONS_GHC -Wno-unused-type-patterns #-}
module CRM.Example.RiskManager.Projection where
module Crem.Example.RiskManager.Projection where
import CRM.BaseMachine
import CRM.Example.RiskManager.Domain
import CRM.Topology
import Crem.BaseMachine
import Crem.Example.RiskManager.Domain
import Crem.Topology
import "base" Data.Monoid (Last (..))
import "singletons-base" Data.Singletons.Base.TH
import "base" GHC.Generics (Generic)

View File

@ -5,10 +5,10 @@
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wall-missed-specialisations
{-# OPTIONS_GHC -Wno-all-missed-specialisations #-}
module CRM.Example.Switch where
module Crem.Example.Switch where
import CRM.BaseMachine
import CRM.Topology
import Crem.BaseMachine
import Crem.Topology
import "singletons-base" Data.Singletons.Base.TH
$( singletons

View File

@ -8,10 +8,10 @@
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wunused-type-patterns
{-# OPTIONS_GHC -Wno-unused-type-patterns #-}
module CRM.Example.TheHobbit where
module Crem.Example.TheHobbit where
import CRM.BaseMachine
import CRM.Topology
import Crem.BaseMachine
import Crem.Topology
import "base" Data.Semigroup
import "singletons-base" Data.Singletons.Base.TH

View File

@ -1,10 +1,10 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
module CRM.Example.TriangularMachine where
module Crem.Example.TriangularMachine where
import CRM.BaseMachine (InitialState (..), pureResult)
import CRM.StateMachine (StateMachine, unrestrictedMachine)
import Crem.BaseMachine (InitialState (..), pureResult)
import Crem.StateMachine (StateMachine, unrestrictedMachine)
data TriangularState (a :: ()) where
OnlyState :: Int -> TriangularState '()

View File

@ -1,6 +1,6 @@
module CRM.Graph where
module Crem.Graph where
import CRM.Render.RenderableVertices (RenderableVertices)
import Crem.Render.RenderableVertices (RenderableVertices)
import "base" Data.List (nub)
-- * Graph

View File

@ -2,13 +2,13 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ScopedTypeVariables #-}
module CRM.Render.Render where
module Crem.Render.Render where
import CRM.BaseMachine
import CRM.Graph
import CRM.Render.RenderableVertices
import CRM.StateMachine
import CRM.Topology
import Crem.BaseMachine
import Crem.Graph
import Crem.Render.RenderableVertices
import Crem.StateMachine
import Crem.Topology
import "base" Data.List (intersperse)
import "singletons-base" Data.Singletons (Demote, SingI, SingKind, demote)
import "base" Data.String (IsString)

View File

@ -1,9 +1,9 @@
{-# LANGUAGE GADTs #-}
module CRM.Render.RenderFlow where
module Crem.Render.RenderFlow where
import CRM.Render.Render
import CRM.StateMachine
import Crem.Render.Render
import Crem.StateMachine
data TreeMetadata a
= LeafLabel a

View File

@ -1,6 +1,6 @@
{-# LANGUAGE UndecidableInstances #-}
module CRM.Render.RenderableVertices where
module Crem.Render.RenderableVertices where
class RenderableVertices a where
vertices :: [a]

View File

@ -2,12 +2,12 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
module CRM.StateMachine where
module Crem.StateMachine where
import CRM.BaseMachine as BaseMachine
import CRM.Render.RenderableVertices (RenderableVertices)
import CRM.Topology
import "base" Control.Category (Category (..))
import Crem.BaseMachine as BaseMachine
import Crem.Render.RenderableVertices (RenderableVertices)
import Crem.Topology
import "base" Data.Bifunctor (Bifunctor (..), bimap)
import "base" Data.Foldable (foldlM)
import "base" Data.Kind (Type)

View File

@ -7,7 +7,7 @@
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wunused-type-patterns
{-# OPTIONS_GHC -Wno-unused-type-patterns #-}
module CRM.Topology where
module Crem.Topology where
import "singletons-base" Data.Singletons.Base.TH
import "singletons-base" Prelude.Singletons