eve 0.1.7 → 0.1.8
raw patch · 3 files changed
+22/−1 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Eve.Internal.Actions: instance (GHC.Base.Monoid a, GHC.Base.Monad m) => GHC.Base.Monoid (Eve.Internal.Actions.ActionT base zoomed m a)
Files
- eve.cabal +1/−1
- src/Eve/Internal/Actions.hs +7/−0
- test/Eve/Internal/ActionsSpec.hs +14/−0
eve.cabal view
@@ -1,5 +1,5 @@ name: eve-version: 0.1.7+version: 0.1.8 synopsis: An extensible event framework description: An extensible event-driven application framework in haskell for building embarassingly modular software. homepage: https://github.com/ChrisPenner/eve#readme
src/Eve/Internal/Actions.hs view
@@ -42,6 +42,13 @@ { getAction :: FreeT (AppF base m) (StateT zoomed m) a } deriving (Functor, Applicative, Monad, MonadIO, MonadState zoomed) +instance (Monoid a, Monad m) => Monoid (ActionT base zoomed m a) where+ mempty = return mempty+ a `mappend` b = do+ a' <- a+ b' <- b+ return $ a' `mappend` b'+ instance Monad n => MonadFree (AppF base n) (ActionT base zoomed n) where wrap (RunApp act) = join . ActionT . liftF . RunApp $ act
test/Eve/Internal/ActionsSpec.hs view
@@ -34,6 +34,15 @@ myString .= "Hello!" use myString +monoidTest :: ActionT AppState SimpleState Identity (String, [Int])+monoidTest = do+ result <- one `mappend` two+ str <- use myString+ return (str, result)+ where+ one = myString .= "first" >> return [1]+ two = myString <>= "second" >> return [2]+ spec :: Spec spec = do describe "Exiting" $ do@@ -64,3 +73,8 @@ it "compiles" $ let (alterationResult, _) = noIOTest (runAction alterSimpleState :: AppT AppState Identity String) in alterationResult `shouldBe` "Hello!"++ describe "is a Monoid" $ do+ it "combines results and effects" $+ let (monoidResult, _) = noIOTest (runAction monoidTest :: AppT AppState Identity (String, [Int]))+ in monoidResult `shouldBe` ("firstsecond", [1, 2])