{-# LANGUAGE ImplicitParams #-}
module Algebra (
  module Algebra.Core,
  module Algebra.Arrow,
  module Algebra.Traversable,
  module Algebra.Lens,
  trace,trace2,mtrace,debug,

  cli
  ) where

import Algebra.Arrow
import Algebra.Core hiding (flip)
import Algebra.Lens
import Algebra.Traversable
import System.Environment (getArgs)

trace :: String -> a -> a
trace s x = (putStrLn s^.thunk)`seq`x
trace2 :: String -> String -> a -> a
trace2 b a x = trace b (x`seq`trace a x)
mtrace :: Unit f => String -> f ()
mtrace str = trace str (pure ())
debug :: Show a => a -> a
debug x = trace (show x) x

cli :: (( ?cliargs :: [String] ) => IO a) -> IO a
cli main = getArgs >>= \a -> let ?cliargs = a in main