module JsonLogic.IO.Type (Result, SubEvaluator, Function, Operation, Operations, throw, T.Exception (..)) where
import Control.Monad.Except
import qualified Data.Map as M
import JsonLogic.Json
import qualified JsonLogic.Type as T
type Result r = IO (Either T.Exception r)
type SubEvaluator = Rule -> Data -> Result Json
type Function r = SubEvaluator -> Rule -> Data -> Result r
type Operation = (String, Function Json)
type Operations = M.Map String (Function Json)
throw :: String -> Result a
throw :: String -> Result a
throw = ExceptT Exception IO a -> Result a
forall e (m :: * -> *) a. ExceptT e m a -> m (Either e a)
runExceptT (ExceptT Exception IO a -> Result a)
-> (String -> ExceptT Exception IO a) -> String -> Result a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Exception -> ExceptT Exception IO a
forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Exception -> ExceptT Exception IO a)
-> (String -> Exception) -> String -> ExceptT Exception IO a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Exception
T.EvalException