logict 0.7.0.0 → 0.7.0.1
raw patch · 4 files changed
+82/−32 lines, 4 filesdep +logictdep +tastydep +tasty-hunitdep ~basePVP ok
version bump matches the API change (PVP)
Dependencies added: logict, tasty, tasty-hunit
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- Control/Monad/Logic.hs +3/−1
- changelog.md +4/−0
- logict.cabal +46/−31
- test/Test.hs +29/−0
Control/Monad/Logic.hs view
@@ -195,7 +195,9 @@ -- Needs undecidable instances instance MonadReader r m => MonadReader r (LogicT m) where ask = lift ask- local f m = LogicT (\sk fk -> local f (unLogicT m sk fk))+ local f (LogicT m) = LogicT $ \sk fk -> do+ env <- ask+ local f $ m ((local (const env) .) . sk) (local (const env) fk) -- Needs undecidable instances instance MonadState s m => MonadState s (LogicT m) where
changelog.md view
@@ -1,3 +1,7 @@+# 0.7.0.1++* Fix `MonadReader r (LogicT m)` instance again.+ # 0.7.0.0 * Remove unlawful `MonadLogic (Writer T w m)` instances.
logict.cabal view
@@ -1,38 +1,53 @@-name: logict-version: 0.7.0.0-description: A continuation-based, backtracking, logic programming monad.- An adaptation of the two-continuation implementation found- in the paper "Backtracking, Interleaving, and Terminating- Monad Transformers" available here:- <http://okmij.org/ftp/papers/LogicT.pdf>-synopsis: A backtracking logic-programming monad.-category: Control-license: BSD3-license-file: LICENSE-copyright: Copyright (c) 2007-2014, Dan Doel,- Copyright (c) 2011-2013, Edward Kmett,- Copyright (c) 2014, Roman Cheplyaka-author: Dan Doel-maintainer: Andrew Lelechenko <andrew.lelechenko@gmail.com>-homepage: https://github.com/Bodigrim/logict#readme-cabal-version: >= 1.9.2-tested-with: GHC-build-type: Simple-extra-source-files: changelog.md+name: logict+version: 0.7.0.1+license: BSD3+license-file: LICENSE+copyright:+ Copyright (c) 2007-2014, Dan Doel,+ Copyright (c) 2011-2013, Edward Kmett,+ Copyright (c) 2014, Roman Cheplyaka+maintainer: Andrew Lelechenko <andrew.lelechenko@gmail.com>+author: Dan Doel+tested-with: ghc -any+homepage: https://github.com/Bodigrim/logict#readme+synopsis: A backtracking logic-programming monad.+description:+ A continuation-based, backtracking, logic programming monad.+ An adaptation of the two-continuation implementation found+ in the paper "Backtracking, Interleaving, and Terminating+ Monad Transformers" available here:+ <http://okmij.org/ftp/papers/LogicT.pdf>+category: Control+build-type: Simple+extra-source-files:+ changelog.md+cabal-version: >=1.9.2 source-repository head type: git location: https://github.com/Bodigrim/logict library- build-depends: base >=2 && < 5, mtl>=2 && <2.3- if impl(ghc < 8.0)- build-depends: fail+ exposed-modules:+ Control.Monad.Logic+ Control.Monad.Logic.Class+ ghc-options: -O2 -Wall+ build-depends:+ base >=2 && <5,+ mtl >=2 && <2.3 - exposed-modules: Control.Monad.Logic,- Control.Monad.Logic.Class- extensions: MultiParamTypeClasses,- UndecidableInstances,- Rank2Types,- FlexibleInstances- ghc-options: -O2 -Wall+ if impl(ghc <8.0)+ build-depends:+ fail -any++test-suite logict-tests+ type: exitcode-stdio-1.0+ main-is: Test.hs+ ghc-options: -Wall+ build-depends:+ base >=2 && <5,+ logict -any,+ mtl >=2 && <2.3,+ tasty,+ tasty-hunit+ hs-source-dirs: test
+ test/Test.hs view
@@ -0,0 +1,29 @@+{-# LANGUAGE FlexibleContexts #-}++module Main where++import Test.Tasty+import Test.Tasty.HUnit++import Control.Monad.Logic+import Control.Monad.Reader++monadReader1 :: Assertion+monadReader1 = assertEqual "should be equal" [5 :: Int] $+ runReader (observeAllT (local (+ 5) ask)) 0++monadReader2 :: Assertion+monadReader2 = assertEqual "should be equal" [(5, 0)] $+ runReader (observeAllT foo) 0+ where+ foo :: MonadReader Int m => m (Int,Int)+ foo = do+ x <- local (5+) ask+ y <- ask+ return (x,y)++main :: IO ()+main = defaultMain $ testGroup "All"+ [ testCase "Monad Reader 1" monadReader1+ , testCase "Monad Reader 2" monadReader2+ ]