module Language.KURE.Debug (
debugR
) where
import Control.Monad.Fail
import Debug.Trace
import Language.KURE.Combinators.Transform
import Language.KURE.Transform
debugR :: (MonadFail m, Show a) => Int -> String -> Rewrite c m a
debugR :: Int -> String -> Rewrite c m a
debugR Int
n String
msg = (a -> Bool) -> Rewrite c m a
forall (m :: * -> *) a c.
MonadFail m =>
(a -> Bool) -> Rewrite c m a
acceptR (\ a
a -> String -> Bool -> Bool
forall a. String -> a -> a
trace (String
msg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" : " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Int -> String -> String
forall a. Int -> [a] -> [a]
take Int
n (a -> String
forall a. Show a => a -> String
show a
a)) Bool
True)