{-# LANGUAGE TemplateHaskell #-}

module PlutusCore.Compiler.Opts
  ( CompilationOpts (..)
  , coSimplifyOpts
  , coBuiltinSemanticsVariant
  , defaultCompilationOpts
  ) where

import Control.Lens (makeLenses)
import Data.Default.Class (Default (def))
import PlutusCore.Builtin.Meaning (BuiltinSemanticsVariant)
import UntypedPlutusCore.Simplify.Opts (SimplifyOpts, defaultSimplifyOpts)

data CompilationOpts name fun a = CompilationOpts
  { forall name fun a.
CompilationOpts name fun a -> SimplifyOpts name a
_coSimplifyOpts            :: SimplifyOpts name a
  , forall name fun a.
CompilationOpts name fun a -> BuiltinSemanticsVariant fun
_coBuiltinSemanticsVariant :: BuiltinSemanticsVariant fun
  }

$(makeLenses ''CompilationOpts)

defaultCompilationOpts :: (Default (BuiltinSemanticsVariant fun)) => CompilationOpts name fun a
defaultCompilationOpts :: forall fun name a.
Default (BuiltinSemanticsVariant fun) =>
CompilationOpts name fun a
defaultCompilationOpts =
  CompilationOpts
    { _coSimplifyOpts :: SimplifyOpts name a
_coSimplifyOpts = SimplifyOpts name a
forall name a. SimplifyOpts name a
defaultSimplifyOpts
    , _coBuiltinSemanticsVariant :: BuiltinSemanticsVariant fun
_coBuiltinSemanticsVariant = BuiltinSemanticsVariant fun
forall a. Default a => a
def
    }