Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doctest wip #30

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,19 @@ preserves the monoidal structure.

This library encodes monoidal functors and related structures in
Haskell.

## Testing

Using Doctest to find all Haskell sources:

```sh
cabal exec -- cabal test
```

or individual files:

```sh
cabal exec -- doctest -isrc -XLambdaCase -XUndecidableInstances -XFunctionalDependencies src/Control/Category/Cartesian.hs
```

TODO: Find out how to enable extensions automatically.
10 changes: 9 additions & 1 deletion monoidal-functors.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ library
hs-source-dirs: src

default-language: Haskell2010

--------------------------------------------------------------------------------

executable co-log
Expand All @@ -99,3 +99,11 @@ executable co-log
, distributive
, monoidal-functors
, mtl

test-suite monoidal-functors-test
import: common-extensions
type: exitcode-stdio-1.0
main-is: Main.hs
hs-source-dirs: src, test
build-depends: doctest

39 changes: 39 additions & 0 deletions test/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module Main where

import Prelude
import Test.DocTest ( doctest )
import System.Process

main :: IO ()
main = do
let cmd = shell "find src -name '*.hs'"
hsString <- readCreateProcess cmd ""
let sources = lines hsString
print sources
doctest
$ "-isrc"
: "-XConstraintKinds"
: "-XDeriveFunctor"
: "-XDerivingVia"
: "-XFunctionalDependencies"
: "-XFlexibleInstances"
: "-XFlexibleContexts"
: "-XGeneralizedNewtypeDeriving"
: "-XImportQualifiedPost"
: "-XInstanceSigs"
: "-XKindSignatures"
: "-XLambdaCase"
: "-XMultiParamTypeClasses"
: "-XNoImplicitPrelude"
: "-XQuantifiedConstraints"
: "-XRankNTypes"
: "-XScopedTypeVariables"
: "-XStandaloneDeriving"
: "-XTupleSections"
: "-XTypeApplications"
: "-XTypeOperators"
: "-XUndecidableInstances"
: "-XDataKinds"
: sources