From 9f91c31b2df37048669ce355d17c9cf1e25a9c7b Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Sun, 12 Mar 2023 00:02:36 -0800 Subject: [PATCH] Add a lazy instance for LogicT. --- src/Control/Monad/Logic/Trans.purs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Control/Monad/Logic/Trans.purs b/src/Control/Monad/Logic/Trans.purs index 692943d..0c635b7 100644 --- a/src/Control/Monad/Logic/Trans.purs +++ b/src/Control/Monad/Logic/Trans.purs @@ -3,6 +3,7 @@ module Control.Monad.Logic.Trans (SFKT(..), FK, SK, unSFKT, runSFKT, runSFKTOnce import Prelude (class Applicative, class Apply, class Bind, class Functor, class Monad, bind, pure, ($), (<<<), (>>=), const, Unit, unit) import Control.Monad.Logic.Class +import Control.Lazy (class Lazy) import Control.MonadPlus (class MonadPlus, class Alternative, class Alt, class Plus, (<|>), empty) import Control.Monad.Reader.Class (class MonadReader, local, class MonadAsk, ask) import Control.Monad.State.Class (class MonadState, state) @@ -73,3 +74,6 @@ instance MonadReader r m => MonadReader r (SFKT m) where instance MonadState s m => MonadState s (SFKT m) where state f = lift $ state f + +instance Lazy (SFKT m a) where + defer f = SFKT (\sk fk -> unSFKT (f unit) sk fk)