packages feed

monad-mock 0.1.1.0 → 0.1.1.1

raw patch · 5 files changed

+41/−21 lines, 5 filesdep ~template-haskell

Dependency ranges changed: template-haskell

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+## 0.1.1.1 (June 28th, 2017)++- Added support for GHC 8.2.+- Includes some minor documentation fixes.+ ## 0.1.1.0 (June 27th, 2017)  - Added `Control.Monad.Mock.TH`, which provides functions for automatically generating actions using Template Haskell.
library/Control/Monad/Mock/TH.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE TemplateHaskellQuotes #-}  {-|@@ -23,7 +24,7 @@ instances:  @-'makeAction' "FileSystemAction" ['ts'| MonadFileSystem |]+'makeAction' \"FileSystemAction\" ['ts'| MonadFileSystem |] @  This generates three things:@@ -33,7 +34,7 @@    2. An 'Action' instance for @FileSystemAction@. -  3. A 'MonadFileSystem' instance for @'MockT' FileSystemAction m@.+  3. A @MonadFileSystem@ instance for @'MockT' FileSystemAction m@.  The generated code effectively looks like this: @@ -68,7 +69,7 @@ spec = describe "copyFile" '$'   it "reads a file and writes its contents to another file" '$'     'Control.Exception.evaluate' '$' copyFile "foo.txt" "bar.txt"-      'Data.Function.&' 'runMock' [ ReadFile "foo.txt" ':->' "contents"+      'Data.Function.&' 'Control.Monad.Mock.runMock' [ ReadFile "foo.txt" ':->' "contents"                 , WriteFile "bar.txt" "contents" ':->' () ] @ -}@@ -109,7 +110,7 @@     actionCons <- concat <$> zipWithM (methodsToConstructors actionTypeCon) classTs methods      let actionDec = DataD [] actionName [PlainTV actionParamName] Nothing actionCons []-        mkStandaloneDec derivT = StandaloneDerivD [] (derivT `AppT` (actionTypeCon `AppT` VarT actionParamName))+        mkStandaloneDec derivT = standaloneDeriveD' [] (derivT `AppT` (actionTypeCon `AppT` VarT actionParamName))         standaloneDecs = [mkStandaloneDec (ConT ''Eq), mkStandaloneDec (ConT ''Show)]     actionInstanceDec <- deriveAction' actionTypeCon actionCons     classInstanceDecs <- zipWithM (mkInstance actionTypeCon) classTs methods@@ -405,3 +406,16 @@           DefaultSigD{} -> False           _             -> True classMethods other = fail $ "classMethods: internal error; expected a class type, given " ++ show other++{------------------------------------------------------------------------------|+| The following definitions abstract over differences in base and              |+| template-haskell between GHC versions. This allows the same code to work     |+| without writing CPP everywhere and ending up with a small mess.              |+|------------------------------------------------------------------------------}++standaloneDeriveD' :: Cxt -> Type -> Dec+#if MIN_VERSION_template_haskell(2,12,0)+standaloneDeriveD' = StandaloneDerivD Nothing+#else+standaloneDeriveD' = StandaloneDerivD+#endif
library/Control/Monad/Mock/TH/Internal/TypesQuasi.hs view
@@ -83,28 +83,29 @@           | otherwise = skipUntil d xs  resolveTypeNames :: Type -> Q Type+resolveTypeNames (AppT a b) = AppT <$> resolveTypeNames a <*> resolveTypeNames b resolveTypeNames (ConT nm) = ConT <$> resolveTypeName nm resolveTypeNames (ForallT tyVars ctx t) = ForallT tyVars <$> mapM resolveTypeNames ctx <*> resolveTypeNames t-resolveTypeNames (AppT a b) = AppT <$> resolveTypeNames a <*> resolveTypeNames b+resolveTypeNames (InfixT a n b) = InfixT <$> resolveTypeNames a <*> resolveTypeName n <*> resolveTypeNames b+resolveTypeNames (ParensT t) = ParensT <$> resolveTypeNames t resolveTypeNames (SigT t k) = SigT <$> resolveTypeNames t <*> resolveTypeNames k-resolveTypeNames t@VarT{} = return t-resolveTypeNames t@PromotedT{} = return t-resolveTypeNames t@TupleT{} = return t-resolveTypeNames t@UnboxedTupleT{} = return t+resolveTypeNames (UInfixT a n b) = UInfixT <$> resolveTypeNames a <*> resolveTypeName n <*> resolveTypeNames b resolveTypeNames t@ArrowT{} = return t+resolveTypeNames t@ConstraintT = return t resolveTypeNames t@EqualityT = return t resolveTypeNames t@ListT = return t-resolveTypeNames t@PromotedTupleT{} = return t-resolveTypeNames t@PromotedNilT = return t+resolveTypeNames t@LitT{} = return t resolveTypeNames t@PromotedConsT = return t+resolveTypeNames t@PromotedNilT = return t+resolveTypeNames t@PromotedT{} = return t+resolveTypeNames t@PromotedTupleT{} = return t resolveTypeNames t@StarT = return t-resolveTypeNames t@ConstraintT = return t-resolveTypeNames t@LitT{} = return t-#if MIN_VERSION_template_haskell(2,11,0)-resolveTypeNames (InfixT a n b) = InfixT <$> resolveTypeNames a <*> resolveTypeName n <*> resolveTypeNames b-resolveTypeNames (UInfixT a n b) = UInfixT <$> resolveTypeNames a <*> resolveTypeName n <*> resolveTypeNames b-resolveTypeNames (ParensT t) = ParensT <$> resolveTypeNames t+resolveTypeNames t@TupleT{} = return t+resolveTypeNames t@UnboxedTupleT{} = return t+resolveTypeNames t@VarT{} = return t resolveTypeNames t@WildCardT = return t+#if MIN_VERSION_template_haskell(2,12,0)+resolveTypeNames t@UnboxedSumT{} = return t #endif  resolveTypeName :: Name -> Q Name
monad-mock.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack  name:           monad-mock-version:        0.1.1.0+version:        0.1.1.1 synopsis:       A monad transformer for mocking mtl-style typeclasses description:    This package provides a monad transformer that helps create “mocks” of                 @mtl@-style typeclasses, intended for use in unit tests. A mock can be@@ -47,7 +47,7 @@     , th-orphans     , monad-control >= 1.0.0.0 && < 2     , mtl-    , template-haskell >= 2.11.0.0 && < 2.12+    , template-haskell >= 2.11.0.0 && < 2.13     , transformers-base   exposed-modules:       Control.Monad.Mock
package.yaml view
@@ -1,5 +1,5 @@ name: monad-mock-version: 0.1.1.0+version: 0.1.1.1 category: Testing synopsis: A monad transformer for mocking mtl-style typeclasses description: |@@ -48,7 +48,7 @@   - th-orphans   - monad-control >= 1.0.0.0 && < 2   - mtl-  - template-haskell >= 2.11.0.0 && < 2.12+  - template-haskell >= 2.11.0.0 && < 2.13   - transformers-base   source-dirs: library