packages feed

logict 0.6.0.2 → 0.6.0.3

raw patch · 3 files changed

+23/−7 lines, 3 filesdep +faildep ~basenew-uploader

Dependencies added: fail

Dependency ranges changed: base

Files

Control/Monad/Logic.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE UndecidableInstances, Rank2Types, FlexibleInstances, MultiParamTypeClasses #-}+{-# LANGUAGE CPP, UndecidableInstances, Rank2Types, FlexibleInstances, MultiParamTypeClasses #-}  ------------------------------------------------------------------------- -- |@@ -41,6 +41,7 @@ import Control.Applicative  import Control.Monad+import qualified Control.Monad.Fail as Fail import Control.Monad.Identity import Control.Monad.Trans @@ -63,7 +64,11 @@ ------------------------------------------------------------------------- -- | Extracts the first result from a LogicT computation, -- failing otherwise.+#if !MIN_VERSION_base(4,13,0) observeT :: Monad m => LogicT m a -> m a+#else+observeT :: MonadFail m => LogicT m a -> m a+#endif observeT lt = unLogicT lt (const . return) (fail "No answer.")  -------------------------------------------------------------------------@@ -103,7 +108,7 @@ ------------------------------------------------------------------------- -- | Extracts the first result from a Logic computation. observe :: Logic a -> a-observe = runIdentity . observeT +observe lt = runIdentity $ unLogicT lt (const . return) (error "No answer.")  ------------------------------------------------------------------------- -- | Extracts all results from a Logic computation.@@ -138,6 +143,11 @@ instance Monad (LogicT m) where     return a = LogicT $ \sk fk -> sk a fk     m >>= f = LogicT $ \sk fk -> unLogicT m (\a fk' -> unLogicT (f a) sk fk') fk+#if !MIN_VERSION_base(4,13,0)+    fail = Fail.fail+#endif++instance Fail.MonadFail (LogicT m) where     fail _ = LogicT $ \_ fk -> fk  instance MonadPlus (LogicT m) where
+ changelog.md view
@@ -0,0 +1,3 @@+# 0.6.0.3++* Comply with MonadFail proposal.
logict.cabal view
@@ -1,5 +1,5 @@ name:                   logict-version:                0.6.0.2+version:                0.6.0.3 description:            A continuation-based, backtracking, logic programming monad.                         An adaptation of the two-continuation implementation found                         in the paper "Backtracking, Interleaving, and Terminating@@ -13,18 +13,21 @@                         Copyright (c) 2011-2013, Edward Kmett,                         Copyright (c) 2014, Roman Cheplyaka author:                 Dan Doel-maintainer:             dan.doel@gmail.com-homepage:               http://code.haskell.org/~dolio/+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  source-repository head-  type:     darcs-  location: http://hub.darcs.net/dolio/logict+  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