{-# OPTIONS_HADDOCK hide #-}
{-# OPTIONS_GHC -Wno-orphans #-}
{-# LANGUAGE UndecidableInstances #-}
module Control.Eff.Logic.Experimental where
import Control.Eff
import Control.Eff.Extend
import Control.Eff.Exception
import Control.Eff.Logic.Core
import Control.Monad
instance (MonadPlus (Eff (Exc CutFalse : r)), MSplit (Eff (Exc CutFalse : r)))
=> Call r where
call m = loop m [] where
loop m' jq = case msplit m' of
Val Nothing -> next jq
Val (Just (x, q)) -> return x `mplus` next (q : jq)
E q u -> case u of
U0 (Exc CutFalse) -> next []
U1 _ -> loop (E q u >>= reflect) jq
next jq = list mzero loop jq