From a0a794c8c3542c80980fc1dfda9e3fea60979f81 Mon Sep 17 00:00:00 2001
From: Ben Gamari <ben@smart-cactus.org>
Date: Fri, 10 Dec 2021 13:58:06 -0500
Subject: [PATCH] Add a simple interpreter

---
 Interpreter.hs    | 14 ++++++++++++++
 iserv-proxy.cabal | 12 ++++++++++--
 2 files changed, 24 insertions(+), 2 deletions(-)
 create mode 100644 Interpreter.hs

diff --git a/Interpreter.hs b/Interpreter.hs
new file mode 100644
index 0000000..77a3921
--- /dev/null
+++ b/Interpreter.hs
@@ -0,0 +1,14 @@
+module Main where
+
+import System.Environment
+import IServ.Remote.Message
+import IServ.Remote.Interpreter
+
+verbose :: Bool
+verbose = True
+
+main :: IO ()
+main = do
+    [portStr, storagePath] <- getArgs
+    let port = read portStr
+    startInterpreter' verbose storagePath port
diff --git a/iserv-proxy.cabal b/iserv-proxy.cabal
index 792463f..7179864 100644
--- a/iserv-proxy.cabal
+++ b/iserv-proxy.cabal
@@ -37,8 +37,9 @@ Description:
       > iserv $ arch-platform-target-cabal install -flibrary
   .
   * setup an application for your target that calls the
-    @startInterpreter@ function. This could be either Haskell or your
-    target's FFI-capable language, if needed.
+    @startInterpreter@ function. This could be either the included
+    @iserv-proxy-interpreter@ executable or, if necessary, an application in
+    your target's FFI-capable language:
   .
       >  void startInterpreter(
       >    false /* verbose */, 5000 /* port */,
@@ -94,3 +95,10 @@ Executable iserv-proxy
                   ghci       == 9.3,
                   libiserv   == 9.3,
                   iserv-proxy
+
+Executable iserv-proxy-interpreter
+   Default-Language: Haskell2010
+   Main-Is: Interpreter.hs
+   Build-Depends: base       >= 4   && < 5,
+                  iserv-proxy
+
-- 
GitLab