diff options
Diffstat (limited to 'src/Control/Funflow/Class.hs')
-rw-r--r-- | src/Control/Funflow/Class.hs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/Control/Funflow/Class.hs b/src/Control/Funflow/Class.hs index 833afc1..ec121ba 100644 --- a/src/Control/Funflow/Class.hs +++ b/src/Control/Funflow/Class.hs @@ -16,6 +16,7 @@ module Control.Funflow.Class where import Control.Arrow +import Control.Arrow.AppArrow import Control.Arrow.Free import qualified Control.Funflow.Base as Base import Control.Funflow.ContentHashable @@ -24,7 +25,7 @@ import Control.Funflow.External import Data.Default (def) import Path -class (ArrowChoice arr, ArrowError ex arr) => ArrowFlow eff ex arr | arr -> eff ex where +class (Arrow arr, ArrowError ex arr) => ArrowFlow eff ex arr | arr -> eff ex where -- | Create a flow from a pure function. step' :: Base.Properties a b -> (a -> b) -> arr a b -- | Create a flow from an IO action. @@ -64,3 +65,16 @@ stepIO = stepIO' def wrap :: ArrowFlow eff ex arr => eff a b -> arr a b wrap = wrap' def + +instance ( Applicative app + , ArrowError ex (AppArrow app (arr eff ex)) + , ArrowFlow eff ex (arr eff ex) ) + => ArrowFlow eff ex (AppArrow app (arr eff ex)) where + step' props f = appArrow $ step' props f + stepIO' props f = appArrow $ stepIO' props f + external f = appArrow $ external f + external' props f = appArrow $ external' props f + wrap' props eff = appArrow $ wrap' props eff + putInStore f = appArrow $ putInStore f + getFromStore f = appArrow $ getFromStore f + internalManipulateStore f = appArrow $ internalManipulateStore f |