[commit: packages/binary] ghc-head: Added MonadPlus instance. (3625372)

git at git.haskell.org git at git.haskell.org
Fri Aug 30 15:20:29 CEST 2013


Repository : ssh://git@git.haskell.org/binary

On branch  : ghc-head
Link       : http://git.haskell.org/?p=packages/binary.git;a=commit;h=3625372cad6796515eff405a37afa17cdbf2d2fe

>---------------------------------------------------------------

commit 3625372cad6796515eff405a37afa17cdbf2d2fe
Author: Daniel Diaz <dhelta.diaz at gmail.com>
Date:   Mon Apr 15 22:53:29 2013 -0400

    Added MonadPlus instance.


>---------------------------------------------------------------

3625372cad6796515eff405a37afa17cdbf2d2fe
 src/Data/Binary/Get/Internal.hs |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/Data/Binary/Get/Internal.hs b/src/Data/Binary/Get/Internal.hs
index 53346cc..a79f16d 100644
--- a/src/Data/Binary/Get/Internal.hs
+++ b/src/Data/Binary/Get/Internal.hs
@@ -42,6 +42,7 @@ import qualified Data.ByteString.Internal as B
 import qualified Data.ByteString.Unsafe as B
 
 import Control.Applicative
+import Control.Monad
 
 #if __GLASGOW_HASKELL__ < 704 && !defined(__HADDOCK__)
 -- needed for (# unboxing #) with magic hash
@@ -116,6 +117,10 @@ instance Applicative Get where
   (<*>) = apG
   {-# INLINE (<*>) #-}
 
+instance MonadPlus Get where
+  mzero = empty
+  mplus = (<|>)
+
 instance Functor Get where
   fmap = fmapG
 





More information about the ghc-commits mailing list