{-# OPTIONS_GHC -fno-warn-orphans #-}
module Data.MonadicStreamFunction.Instances.ArrowPlus where
import Control.Arrow
import Control.Monad
import Control.Applicative
import Data.MonadicStreamFunction.Core
import Data.MonadicStreamFunction.InternalCore
instance (Monad m, MonadPlus m) => ArrowZero (MSF m) where
zeroArrow = MSF $ const mzero
instance (Monad m, MonadPlus m) => ArrowPlus (MSF m) where
sf1 <+> sf2 = MSF $ \a -> unMSF sf1 a `mplus` unMSF sf2 a
instance (Functor m, Monad m, MonadPlus m) => Alternative (MSF m a) where
empty = zeroArrow
(<|>) = (<+>)