packages feed

ruby-marshal 0.1.3 → 0.2.0

raw patch · 3 files changed

+30/−10 lines, 3 filesdep +faildep ~basedep ~vector

Dependencies added: fail

Dependency ranges changed: base, vector

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+# 0.2.0++- Added `MonadFail` instance for `Marshal` (#62)+ # 0.1.3  - Relaxed version bounds.
ruby-marshal.cabal view
@@ -1,5 +1,5 @@ name: ruby-marshal-version: 0.1.3+version: 0.2.0 synopsis: Parse a subset of Ruby objects serialised with Marshal.dump. description: Parse a subset of Ruby objects serialised with Marshal.dump. homepage: https://github.com/filib/ruby-marshal@@ -9,7 +9,7 @@ maintainer: hello@filib.io category: Data build-type: Simple-tested-with: GHC == 7.8, GHC == 7.10, GHC == 8.6.5+tested-with: GHC == 7.8.4, GHC == 7.10.3, GHC == 8.6.5, GHC == 8.8.3 cabal-version: >= 1.10 extra-source-files: CHANGELOG.md @@ -24,13 +24,14 @@   hs-source-dirs:     src   build-depends:-      base        >= 4.7    && <= 5-    , cereal      >= 0.4.0  && <  0.6.0-    , bytestring  >= 0.9.0  && <= 0.12.0-    , containers  >= 0.5.0  && <= 0.7.0-    , string-conv >= 0.1    && <= 0.2-    , mtl         >= 2.1.0  && <= 2.3.0-    , vector      >= 0.10.0 && <  0.12.1+      base        >= 4.7     && <= 5+    , bytestring  >= 0.9.0   && <= 0.12.0+    , cereal      >= 0.4.0   && <  0.6.0+    , containers  >= 0.5.0   && <= 0.7.0+    , fail        >= 4.9.0.0 && < 4.10+    , string-conv >= 0.1     && <= 0.2+    , mtl         >= 2.1.0   && <= 2.3.0+    , vector      >= 0.10.0  && <= 0.12.1.2   default-language:     Haskell2010   exposed-modules:@@ -53,6 +54,7 @@     , bytestring     , cereal     , containers+    , fail     , hspec     , mtl     , string-conv
src/Data/Ruby/Marshal/Monad.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP                        #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}  --------------------------------------------------------------------@@ -17,6 +18,9 @@ module Data.Ruby.Marshal.Monad where  import           Control.Applicative+import qualified Control.Monad.Fail           as Fail+import qualified Control.Monad                as Monad+import           Control.Monad                (join) import           Control.Monad.State.Strict   (MonadState, StateT, get, gets,                                                lift, put) import           Data.Ruby.Marshal.RubyObject (RubyObject (..))@@ -28,7 +32,17 @@ -- | Marshal monad endows the underlying Get monad with State. newtype Marshal a = Marshal {   runMarshal :: StateT Cache Get a-} deriving (Functor, Applicative, Monad, MonadState Cache)+} deriving (Functor, Applicative, MonadState Cache)++instance Monad Marshal where+  (Marshal ma) >>= f = Marshal . join $ runMarshal . f <$> ma++#if !MIN_VERSION_base(4,13,0)+  fail = Fail.fail+#endif++instance Fail.MonadFail Marshal where+  fail = Marshal . Monad.fail  -- | Lift Get monad into Marshal monad. liftMarshal :: Get a -> Marshal a