module Funcons.ValueOperations ( execRewrites, evalOperation, IException(..), IE(..), isIn, ) where import Funcons.EDSL (library) import Funcons.Types import Funcons.MSOS import Funcons.Patterns (isIn) import Funcons.Exceptions (IException(..), IE(..)) import Funcons.RunOptions import Funcons.Core.Manual evalOperation :: Funcons -> Either IE [Values] evalOperation :: Funcons -> Either IE [Values] evalOperation Funcons f = case forall a. Rewrite a -> Either IE a execRewrites (Funcons -> Rewrite Rewritten rewriteFuncons Funcons f) of Left IE exc -> forall a b. a -> Either a b Left IE exc Right (ValTerm [Values] vs) -> forall a b. b -> Either a b Right [Values] vs Right Rewritten _ -> forall a. HasCallStack => [Char] -> a error [Char] "rewriteToTerm: did you provide a value operation?" execRewrites :: Rewrite a -> (Either IE a) execRewrites :: forall a. Rewrite a -> Either IE a execRewrites Rewrite a rew = case Either IException a e_exc_rewritten of Left (Funcons _, Funcons _, IE exc) -> forall a b. a -> Either a b Left IE exc Right a r -> forall a b. b -> Either a b Right a r where (Either IException a e_exc_rewritten, RewriteState _, RewriteWriterr _) = forall a. Rewrite a -> RewriteReader -> RewriteState -> (Either IException a, RewriteState, RewriteWriterr) runRewrite Rewrite a rew RewriteReader reader RewriteState emptyRewriteState reader :: RewriteReader reader = FunconLibrary -> TypeRelation -> RunOptions -> Funcons -> Funcons -> RewriteReader RewriteReader ([FunconLibrary] -> FunconLibrary libUnions [FunconLibrary Funcons.EDSL.library ,FunconLibrary Funcons.Core.Manual.library]) TypeRelation emptyTypeRelation RunOptions defaultRunOptions forall a. HasCallStack => a undefined forall a. HasCallStack => a undefined