{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskellQuotes #-}

module Hercules.CNix.Expr.Context
  ( context,
    evalContext,
    EvalState,
    Value',
    Attr',
    BindingsBuilder',
    module Hercules.CNix.Store.Context,
    (=:),
  )
where

import qualified Data.Map as M
import Hercules.CNix.Store.Context hiding (context)
import qualified Language.C.Inline.Context as C
import qualified Language.C.Inline.Cpp as C
import qualified Language.C.Types as C
import Protolude

data EvalState

data Value'

data Attr'

data BindingsBuilder'

context :: C.Context
context :: Context
context =
  Context
C.cppCtx
    forall a. Semigroup a => a -> a -> a
<> Context
C.fptrCtx
    forall a. Semigroup a => a -> a -> a
<> Context
C.bsCtx
    forall a. Semigroup a => a -> a -> a
<> Context
evalContext

(=:) :: k -> a -> Map k a
=: :: forall k a. k -> a -> Map k a
(=:) = forall k a. k -> a -> Map k a
M.singleton

evalContext :: C.Context
evalContext :: Context
evalContext =
  forall a. Monoid a => a
mempty
    { ctxTypesTable :: TypesTable
C.ctxTypesTable =
        CIdentifier -> TypeSpecifier
C.TypeName CIdentifier
"EvalState" forall k a. k -> a -> Map k a
=: [t|EvalState|]
          forall a. Semigroup a => a -> a -> a
<> CIdentifier -> TypeSpecifier
C.TypeName CIdentifier
"Value" forall k a. k -> a -> Map k a
=: [t|Value'|]
          forall a. Semigroup a => a -> a -> a
<> CIdentifier -> TypeSpecifier
C.TypeName CIdentifier
"Attr" forall k a. k -> a -> Map k a
=: [t|Attr'|]
          forall a. Semigroup a => a -> a -> a
<> CIdentifier -> TypeSpecifier
C.TypeName CIdentifier
"BindingsBuilder" forall k a. k -> a -> Map k a
=: [t|BindingsBuilder'|]
    }