Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions crem.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.0
cabal-version: 3.0

-- This file has been generated from package.yaml by hpack version 0.35.2.
-- This file has been generated from package.yaml by hpack version 0.38.3.
--
-- see: https://github.com/sol/hpack

Expand Down Expand Up @@ -54,12 +54,12 @@ library
PackageImports
ghc-options: -Weverything -Wno-safe -Wno-unsafe -Wno-missing-safe-haskell-mode -Wno-implicit-prelude -Wno-missing-export-lists -Wno-missing-home-modules -Wno-missing-import-lists -Wno-all-missed-specialisations -Wno-prepositive-qualified-module
build-depends:
base >=4.15 && <4.19
, machines >=0.7.3 && <0.8
, nothunks >=0.1 && <0.4
, profunctors >=3.2 && <5.7
, singletons-base >=3.0 && <3.3
, text >=1.2 && <2.1
base >=4.15
, machines >=0.7.3
, nothunks >=0.1
, profunctors >=3.2
, singletons-base >=3.0
, text >=1.2 && <2.2
default-language: Haskell2010
if impl(ghc >= 9.2)
ghc-options: -Wno-missing-kind-signatures
Expand Down Expand Up @@ -144,7 +144,7 @@ library crem-examples
PackageImports
ghc-options: -Weverything -Wno-safe -Wno-unsafe -Wno-missing-safe-haskell-mode -Wno-implicit-prelude -Wno-missing-export-lists -Wno-missing-home-modules -Wno-missing-import-lists -Wno-all-missed-specialisations -Wno-prepositive-qualified-module
build-depends:
base >=4.15 && <4.19
base >=4.15
, crem
, profunctors
, singletons-base
Expand Down Expand Up @@ -213,9 +213,9 @@ executable hobbit-game
PackageImports
ghc-options: -Weverything -Wno-safe -Wno-unsafe -Wno-missing-safe-haskell-mode -Wno-implicit-prelude -Wno-missing-export-lists -Wno-missing-home-modules -Wno-missing-import-lists -Wno-all-missed-specialisations -Wno-prepositive-qualified-module
build-depends:
base >=4.15 && <4.19
base >=4.15
, crem
, crem-examples
, crem:crem-examples
default-language: Haskell2010
if impl(ghc >= 9.2)
ghc-options: -Wno-missing-kind-signatures
Expand Down Expand Up @@ -280,9 +280,9 @@ executable hobbit-map
PackageImports
ghc-options: -Weverything -Wno-safe -Wno-unsafe -Wno-missing-safe-haskell-mode -Wno-implicit-prelude -Wno-missing-export-lists -Wno-missing-home-modules -Wno-missing-import-lists -Wno-all-missed-specialisations -Wno-prepositive-qualified-module
build-depends:
base >=4.15 && <4.19
base >=4.15
, crem
, crem-examples
, crem:crem-examples
, text
default-language: Haskell2010
if impl(ghc >= 9.2)
Expand Down Expand Up @@ -349,10 +349,12 @@ test-suite crem-doctests
PackageImports
ghc-options: -Weverything -Wno-safe -Wno-unsafe -Wno-missing-safe-haskell-mode -Wno-implicit-prelude -Wno-missing-export-lists -Wno-missing-home-modules -Wno-missing-import-lists -Wno-all-missed-specialisations -Wno-prepositive-qualified-module -threaded -Wno-unused-packages
build-depends:
base >=4.15 && <4.19
base >=4.15
, crem
, crem-examples
, doctest-parallel >=0.2.3 && <0.4
, crem:crem-examples
, directory
, doctest-parallel >=0.2.3
, filepath
default-language: Haskell2010
if impl(ghc >= 9.2)
ghc-options: -Wno-missing-kind-signatures
Expand Down Expand Up @@ -431,10 +433,10 @@ test-suite crem-spec
build-tool-depends:
hspec-discover:hspec-discover
build-depends:
base >=4.15 && <4.19
base >=4.15
, crem
, crem-examples
, hspec >=2.7 && <2.12
, crem:crem-examples
, hspec >=2.7
, machines
, profunctors
, singletons-base
Expand Down
39 changes: 34 additions & 5 deletions doctest/Main.hs
Original file line number Diff line number Diff line change
@@ -1,15 +1,44 @@
{-# LANGUAGE ImplicitParams #-}

module Main where

import "base" System.Environment (getArgs)
import "doctest-parallel" Test.DocTest
import "base" Control.Monad (unless)
import "base" Data.List (isPrefixOf, isInfixOf)
import "base" System.Exit (exitFailure)
import "directory" System.Directory (getCurrentDirectory, listDirectory)
import "filepath" System.FilePath ((</>))
import "doctest-parallel" Test.DocTest (isSuccess, setSeed)
import "doctest-parallel" Test.DocTest.Helpers
import "doctest-parallel" Test.DocTest.Internal.Logging (LogLevel (..))
import "doctest-parallel" Test.DocTest.Internal.Options (defaultModuleConfig)
import "doctest-parallel" Test.DocTest.Internal.Runner (runModules)

main :: IO ()
main = do
args <- getArgs
cremPackage <- findCabalPackage "crem"
cremLib <- extractCabalLibrary cremPackage
cremExamplesLib <- extractSpecificCabalLibrary (Just "crem-examples") cremPackage
let wholeCremLib = mergeLibraries [cremLib, cremExamplesLib]
pkgId <- findCremExamplesId
let
wholeCremLib = mergeLibraries [cremLib, cremExamplesLib]
mainFromLibrary wholeCremLib args
(includeArgs, allModules, otherGhciArgs) = libraryToGhciArgs wholeCremLib
evalGhciArgs = otherGhciArgs ++ ["-package-id", pkgId]
parseGhcArgs = includeArgs ++ otherGhciArgs
modConfig <- let ?verbosity = Info in setSeed defaultModuleConfig
summary <- let ?verbosity = Info in runModules modConfig Nothing True parseGhcArgs evalGhciArgs allModules
unless (isSuccess summary) exitFailure

findCremExamplesId :: IO String
findCremExamplesId = do
dir <- getCurrentDirectory
files <- listDirectory dir
let envFiles = filter (isPrefixOf ".ghc.environment.") files
case envFiles of
[] -> error "No .ghc.environment file found; run cabal build first"
(f:_) -> do
contents <- readFile (dir </> f)
let pkgIdLines = filter (isPrefixOf "package-id") (lines contents)
examplesLines = filter (isInfixOf "crem-examples") pkgIdLines
case examplesLines of
[] -> error "Could not find crem-examples package-id in .ghc.environment file"
(l:_) -> pure (drop (length "package-id ") l)
6 changes: 3 additions & 3 deletions examples/Crem/Example/Cart/Aggregate.hs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeAbstractions #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wmissing-deriving-strategies
{-# OPTIONS_GHC -Wno-missing-deriving-strategies #-}
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wunticked-promoted-constructors
{-# OPTIONS_GHC -Wno-missing-poly-kind-signatures #-}
{-# OPTIONS_GHC -Wno-missing-role-annotations #-}
{-# OPTIONS_GHC -Wno-unticked-promoted-constructors #-}
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wunused-type-patterns
{-# OPTIONS_GHC -Wno-unused-type-patterns #-}

module Crem.Example.Cart.Aggregate where
Expand Down
8 changes: 3 additions & 5 deletions examples/Crem/Example/Cart/Shipping.hs
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeAbstractions #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wmissing-deriving-strategies
{-# OPTIONS_GHC -Wno-missing-deriving-strategies #-}
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wredundant-constraints
{-# OPTIONS_GHC -Wno-redundant-constraints #-}
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wunticked-promoted-constructors
{-# OPTIONS_GHC -Wno-missing-poly-kind-signatures #-}
{-# OPTIONS_GHC -Wno-missing-role-annotations #-}
{-# OPTIONS_GHC -Wno-unticked-promoted-constructors #-}
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wunused-type-patterns
{-# OPTIONS_GHC -Wno-unused-type-patterns #-}

module Crem.Example.Cart.Shipping where
Expand Down
7 changes: 3 additions & 4 deletions examples/Crem/Example/LockDoor.hs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeAbstractions #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wall-missed-specialisations
{-# OPTIONS_GHC -Wno-all-missed-specialisations #-}
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wmissing-deriving-strategies
{-# OPTIONS_GHC -Wno-missing-deriving-strategies #-}
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wunticked-promoted-constructors
{-# OPTIONS_GHC -Wno-missing-poly-kind-signatures #-}
{-# OPTIONS_GHC -Wno-missing-role-annotations #-}
{-# OPTIONS_GHC -Wno-unticked-promoted-constructors #-}
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wunused-type-patterns
{-# OPTIONS_GHC -Wno-unused-type-patterns #-}

module Crem.Example.LockDoor where
Expand Down
6 changes: 3 additions & 3 deletions examples/Crem/Example/RiskManager/Aggregate.hs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeAbstractions #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wmissing-deriving-strategies
{-# OPTIONS_GHC -Wno-missing-deriving-strategies #-}
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wunticked-promoted-constructors
{-# OPTIONS_GHC -Wno-missing-poly-kind-signatures #-}
{-# OPTIONS_GHC -Wno-missing-role-annotations #-}
{-# OPTIONS_GHC -Wno-unticked-promoted-constructors #-}
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wunused-type-patterns
{-# OPTIONS_GHC -Wno-unused-type-patterns #-}

module Crem.Example.RiskManager.Aggregate where
Expand Down
8 changes: 3 additions & 5 deletions examples/Crem/Example/RiskManager/Projection.hs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeAbstractions #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wmissing-deriving-strategies
{-# OPTIONS_GHC -Wno-missing-deriving-strategies #-}
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wunticked-promoted-constructors
{-# OPTIONS_GHC -Wno-missing-poly-kind-signatures #-}
{-# OPTIONS_GHC -Wno-missing-role-annotations #-}
{-# OPTIONS_GHC -Wno-unticked-promoted-constructors #-}
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wunused-type-patterns
{-# OPTIONS_GHC -Wno-unused-type-patterns #-}

module Crem.Example.RiskManager.Projection where

import Crem.BaseMachine
Expand Down
6 changes: 3 additions & 3 deletions examples/Crem/Example/TheHobbit.hs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeAbstractions #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wmissing-deriving-strategies
{-# OPTIONS_GHC -Wno-missing-deriving-strategies #-}
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wunticked-promoted-constructors
{-# OPTIONS_GHC -Wno-missing-poly-kind-signatures #-}
{-# OPTIONS_GHC -Wno-missing-role-annotations #-}
{-# OPTIONS_GHC -Wno-unticked-promoted-constructors #-}
-- https://downloads.haskell.org/ghc/latest/docs/users_guide/using-warnings.html#ghc-flag--Wunused-type-patterns
{-# OPTIONS_GHC -Wno-unused-type-patterns #-}

-- | This is a small adventure game based on [The Hobbit](https://en.wikipedia.org/wiki/The_Hobbit_(1982_video_game))
Expand Down
3 changes: 3 additions & 0 deletions examples/Crem/Example/TriangularMachine.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RoleAnnotations #-}

module Crem.Example.TriangularMachine where

Expand All @@ -9,6 +10,8 @@ import Crem.StateMachine (StateMachine, unrestrictedMachine)
data TriangularState (a :: ()) where
OnlyState :: Int -> TriangularState '()

type role TriangularState nominal

triangular :: StateMachine Int Int
triangular =
unrestrictedMachine
Expand Down
Loading