diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c33954f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +dist-newstyle/ diff --git a/Example.hs b/Example.hs new file mode 100644 index 0000000..eb15135 --- /dev/null +++ b/Example.hs @@ -0,0 +1,21 @@ +{-# language TemplateHaskell #-} +{-# language TypeFamilies #-} + +module Example where + +-- units +import Data.Metrology +import Data.Metrology.TH + + +declareDimension "Cost" + + +declareCanonicalUnit "Dollar" [t| Cost |] ( Just "USD" ) + + +type instance DefaultUnitOfDim Cost = + Dollar + + +declareDerivedUnit "Cent" [t| Dollar |] ( 1 / 100 ) ( Just "cent" ) diff --git a/Setup.hs b/Setup.hs new file mode 100644 index 0000000..c0bc21b --- /dev/null +++ b/Setup.hs @@ -0,0 +1,6 @@ +module Main where + +import Distribution.Extra.Doctest (defaultMainWithDoctests) + +main :: IO () +main = defaultMainWithDoctests "doctests" diff --git a/cabal.project.freeze b/cabal.project.freeze new file mode 100644 index 0000000..b8e6061 --- /dev/null +++ b/cabal.project.freeze @@ -0,0 +1,113 @@ +constraints: any.Boolean ==0.2.4, + any.Cabal ==3.2.0.0, + any.MemoTrie ==0.6.10, + MemoTrie -examples, + any.NumInstances ==1.4, + any.StateVar ==1.2, + any.adjunctions ==4.4, + any.array ==0.5.4.0, + any.base ==4.14.1.0, + any.base-compat ==0.11.1, + any.base-orphans ==0.8.2, + any.bifunctors ==5.5.7, + bifunctors +semigroups +tagged, + any.binary ==0.8.8.0, + any.binary-orphans ==1.0.1, + any.bytes ==0.17, + bytes +test-doctests, + any.bytestring ==0.10.10.0, + any.cabal-doctest ==1.0.8, + any.call-stack ==0.2.0, + any.cereal ==0.5.8.1, + cereal -bytestring-builder, + any.code-page ==0.2, + any.comonad ==5.0.6, + comonad +containers +distributive +test-doctests, + any.containers ==0.6.2.1, + any.contravariant ==1.5.2, + contravariant +semigroups +statevar +tagged, + any.deepseq ==1.4.4.0, + any.directory ==1.3.6.0, + any.distributive ==0.6.2, + distributive +semigroups +tagged, + any.doctest ==0.17, + any.exceptions ==0.10.4, + any.fail ==4.9.0.0, + any.filepath ==1.4.2.1, + any.free ==5.1.3, + any.ghc ==8.10.2, + any.ghc-boot ==8.10.2, + any.ghc-boot-th ==8.10.2, + any.ghc-heap ==8.10.2, + any.ghc-paths ==0.1.0.12, + any.ghc-prim ==0.6.1, + any.ghci ==8.10.2, + any.hashable ==1.3.0.0, + hashable -examples +integer-gmp +sse2 -sse41, + any.hpc ==0.6.1.0, + any.hsc2hs ==0.68.7, + hsc2hs -in-ghc-tree, + any.integer-gmp ==1.0.3.0, + any.integer-logarithms ==1.0.3, + integer-logarithms -check-bounds +integer-gmp, + any.invariant ==0.5.3, + any.kan-extensions ==5.2, + any.lens ==4.19.2, + lens -benchmark-uniplate -dump-splices +inlining -j -old-inline-pragmas -safe +test-doctests +test-hunit +test-properties +test-templates +trustworthy, + any.linear ==1.21.1, + linear -herbie +template-haskell, + any.mtl ==2.2.2, + any.multimap ==1.2.1, + any.newtype-generics ==0.5.4, + any.ordered-containers ==0.2.2, + any.parallel ==3.2.2.0, + any.parsec ==3.1.14.0, + any.pretty ==1.1.3.6, + any.primitive ==0.7.1.0, + any.process ==1.6.9.0, + any.profunctors ==5.5.2, + any.random ==1.2.0, + any.reflection ==2.1.6, + reflection -slow +template-haskell, + any.rts ==1.0, + any.safe ==0.3.19, + any.scientific ==0.3.6.2, + scientific -bytestring-builder -integer-simple, + any.semigroupoids ==5.3.4, + semigroupoids +comonad +containers +contravariant +distributive +doctests +tagged +unordered-containers, + any.semigroups ==0.19.1, + semigroups +binary +bytestring -bytestring-builder +containers +deepseq +hashable +tagged +template-haskell +text +transformers +unordered-containers, + any.singletons ==2.7, + any.splitmix ==0.1.0.1, + splitmix -optimised-mixer, + any.stm ==2.5.0.0, + any.syb ==0.7.1, + any.tagged ==0.8.6, + tagged +deepseq +transformers, + any.template-haskell ==2.16.0.0, + any.terminfo ==0.4.1.4, + any.text ==1.2.3.2, + any.th-abstraction ==0.3.2.0, + any.th-desugar ==1.11, + any.th-expand-syns ==0.4.6.0, + any.th-lift ==0.8.1, + any.th-lift-instances ==0.1.17, + any.th-orphans ==0.13.10, + any.th-reify-many ==0.1.9, + any.time ==1.9.3, + any.transformers ==0.5.6.2, + any.transformers-base ==0.4.5.2, + transformers-base +orphaninstances, + any.transformers-compat ==0.6.5, + transformers-compat -five +five-three -four +generic-deriving +mtl -three -two, + any.units ==2.4.1.3, + any.units-parser ==0.1.1.3, + any.unix ==2.7.2.2, + any.unordered-containers ==0.2.12.0, + unordered-containers -debug, + any.vector ==0.12.1.2, + vector +boundschecks -internalchecks -unsafechecks -wall, + any.vector-space ==0.16, + any.void ==0.7.3, + void -safe +index-state: hackage.haskell.org:2020-08-20T08:14:08Z diff --git a/doctest271.cabal b/doctest271.cabal new file mode 100644 index 0000000..4762abd --- /dev/null +++ b/doctest271.cabal @@ -0,0 +1,21 @@ +cabal-version: >=1.10 +name: doctest271 +version: 0.1.0.0 +build-type: Custom + +library + default-language: Haskell2010 + build-depends: base >= 4.14 && <4.15, units + exposed-modules: Example + +custom-setup + setup-depends: + base >= 4 && <5, + Cabal, + cabal-doctest >= 1 && <1.1 + +test-suite doctests + main-is: test.hs + type: exitcode-stdio-1.0 + build-depends: base >=4.14 && <4.15, doctest271, doctest, base-compat + default-language: Haskell2010 diff --git a/test.hs b/test.hs new file mode 100644 index 0000000..a9e7cef --- /dev/null +++ b/test.hs @@ -0,0 +1,12 @@ +module Main where + +import Build_doctests (flags, pkgs, module_sources) +import Data.Foldable (traverse_) +import System.Environment.Compat (unsetEnv) +import Test.DocTest (doctest) + +main :: IO () +main = do + doctest args + where + args = flags ++ pkgs ++ module_sources