hslua-marshalling: make Peek, Result instances of MonadPlus
Uses the default definition from `Alternative`.
@@ -33,7 +33,7 @@ module HsLua.Marshalling.Peek
) where
import Control.Applicative (Alternative (..))
-import Control.Monad ((<$!>), (<=<))
+import Control.Monad ((<$!>), (<=<), MonadPlus)
import Data.ByteString (ByteString)
import Data.List (intercalate)
import HsLua.Core as Lua
@@ -71,6 +71,8 @@ instance Alternative Result where
_ -> x
{-# INLINE (<|>) #-}
+instance MonadPlus Result
+
--
-- Peek
--
@@ -124,6 +126,8 @@ instance Alternative (Peek e) where
_ -> runPeek b
{-# INLINE (<|>) #-}
+instance MonadPlus (Peek e)
+
instance MonadFail (Peek e) where
fail = Peek . return . failure . Utf8.fromString
{-# INLINABLE fail #-}
