{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE UndecidableInstances #-}
module Charon.Runner.Env
( Env (..),
LogEnv (..),
LogFile (..),
)
where
import Charon.Backend.Data (Backend)
import Charon.Data.Paths (PathI, PathIndex (TrashHome))
import Charon.Env (HasBackend, HasTrashHome)
import Charon.Prelude
import Effects.LoggerNS (Namespace)
data LogFile m = MkLogFile
{
forall {k} (m :: k). LogFile m -> Handle
handle :: Handle,
forall {k} (m :: k). LogFile m -> LogLevel
logLevel :: LogLevel
}
instance Show (LogFile m) where
show :: LogFile m -> String
show (MkLogFile Handle
_ LogLevel
l) =
String
"MkLogFile {handle = <handle>, logLevel ="
String -> ShowS
forall a. Semigroup a => a -> a -> a
<> LogLevel -> String
forall a. Show a => a -> String
show LogLevel
l
String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
"}"
makeFieldLabelsNoPrefix ''LogFile
data LogEnv m = MkLogEnv
{
forall {k} (m :: k). LogEnv m -> Maybe (LogFile m)
logFile :: !(Maybe (LogFile m)),
forall {k} (m :: k). LogEnv m -> Namespace
logNamespace :: Namespace
}
deriving stock (Int -> LogEnv m -> ShowS
[LogEnv m] -> ShowS
LogEnv m -> String
(Int -> LogEnv m -> ShowS)
-> (LogEnv m -> String) -> ([LogEnv m] -> ShowS) -> Show (LogEnv m)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (m :: k). Int -> LogEnv m -> ShowS
forall k (m :: k). [LogEnv m] -> ShowS
forall k (m :: k). LogEnv m -> String
$cshowsPrec :: forall k (m :: k). Int -> LogEnv m -> ShowS
showsPrec :: Int -> LogEnv m -> ShowS
$cshow :: forall k (m :: k). LogEnv m -> String
show :: LogEnv m -> String
$cshowList :: forall k (m :: k). [LogEnv m] -> ShowS
showList :: [LogEnv m] -> ShowS
Show)
makeFieldLabelsNoPrefix ''LogEnv
data Env m = MkEnv
{
forall {k} (m :: k). Env m -> PathI 'TrashHome
trashHome :: PathI TrashHome,
forall {k} (m :: k). Env m -> Backend
backend :: Backend,
forall {k} (m :: k). Env m -> LogEnv m
logEnv :: LogEnv m
}
deriving stock (Int -> Env m -> ShowS
[Env m] -> ShowS
Env m -> String
(Int -> Env m -> ShowS)
-> (Env m -> String) -> ([Env m] -> ShowS) -> Show (Env m)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (m :: k). Int -> Env m -> ShowS
forall k (m :: k). [Env m] -> ShowS
forall k (m :: k). Env m -> String
$cshowsPrec :: forall k (m :: k). Int -> Env m -> ShowS
showsPrec :: Int -> Env m -> ShowS
$cshow :: forall k (m :: k). Env m -> String
show :: Env m -> String
$cshowList :: forall k (m :: k). [Env m] -> ShowS
showList :: [Env m] -> ShowS
Show)
makeFieldLabelsNoPrefix ''Env
deriving anyclass instance HasTrashHome (Env m)
deriving anyclass instance HasBackend (Env m)