Skip to content

Commit

Permalink
cli: Allow clients to know sym ~ ExprBuilder for ExtensionImpl
Browse files Browse the repository at this point in the history
  • Loading branch information
langston-barrett committed Aug 20, 2024
1 parent 7d1ed44 commit e068194
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions crucible-cli/src/Lang/Crucible/CLI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ defaultSimulateProgramHooks = SimulateProgramHooks

simulateProgramWithExtension
:: (IsSyntaxExtension ext, ?parserHooks :: ParserHooks ext)
=> (forall sym bak. IsSymBackend sym bak => bak -> IO (ExtensionImpl () sym ext))
=> (forall sym bak t st fs. (IsSymBackend sym bak, sym ~ ExprBuilder t st fs) =>
bak -> IO (ExtensionImpl () sym ext))
-> FilePath -- ^ The name of the input (appears in source locations)
-> Text -- ^ The contents of the input
-> Handle -- ^ A handle that will receive the output
Expand Down Expand Up @@ -257,7 +258,8 @@ data Command
-- line), and this function takes care of the rest.
execCommand ::
(IsSyntaxExtension ext, ?parserHooks :: ParserHooks ext) =>
(forall sym bak. IsSymBackend sym bak => bak -> IO (ExtensionImpl () sym ext)) ->
(forall sym bak t st fs. (IsSymBackend sym bak, sym ~ ExprBuilder t st fs) =>
bak -> IO (ExtensionImpl () sym ext)) ->
SimulateProgramHooks ext ->
Command ->
IO ()
Expand Down
5 changes: 4 additions & 1 deletion crucible-cli/src/Lang/Crucible/CLI/Options.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE ImplicitParams #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeOperators #-}

module Lang.Crucible.CLI.Options (main) where

Expand All @@ -14,6 +15,8 @@ import Options.Applicative ( (<**>) )

import Lang.Crucible.CLI

import What4.Expr (ExprBuilder)

file :: String -> Opt.Parser FilePath
file which = Opt.strArgument (Opt.metavar "FILE" <> Opt.help ("The " <> which <> " file"))

Expand Down Expand Up @@ -53,7 +56,7 @@ parseCheck =
main ::
(?parserHooks :: ParserHooks ext, IsSyntaxExtension ext) =>
String ->
(forall sym bak. IsSymBackend sym bak => bak -> IO (ExtensionImpl () sym ext)) ->
(forall sym bak t st fs. (IsSymBackend sym bak, sym ~ ExprBuilder t st fs) => bak -> IO (ExtensionImpl () sym ext)) ->
SimulateProgramHooks ext ->
IO ()
main name ext simulationHooks =
Expand Down

0 comments on commit e068194

Please sign in to comment.