module UniqueLogic.ST.RuleLog (
   -- * Custom rules
   generic2,
   generic3,
   ) where

import qualified UniqueLogic.ST.SystemLog as Sys

import Control.Monad.Trans.Writer (Writer, )
import Data.Monoid (Monoid, )

import qualified Prelude as P
import Prelude hiding (max)


generic2 ::
   Monoid w =>
   (b -> Writer w a) -> (a -> Writer w b) ->
   Sys.Variable w s a -> Sys.Variable w s b -> Sys.T w s ()
generic2 f g x y =
   sequence_ $
   Sys.assignment2 f y x :
   Sys.assignment2 g x y :
   []

generic3 ::
   Monoid w =>
   (b -> c -> Writer w a) -> (c -> a -> Writer w b) -> (a -> b -> Writer w c) ->
   Sys.Variable w s a -> Sys.Variable w s b -> Sys.Variable w s c -> Sys.T w s ()
generic3 f g h x y z =
   sequence_ $
   Sys.assignment3 f y z x :
   Sys.assignment3 g z x y :
   Sys.assignment3 h x y z :
   []