aboutsummaryrefslogtreecommitdiff
path: root/hsm-repl
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2025-08-25 02:42:03 +0000
committerPaul Oliver <contact@pauloliver.dev>2025-08-25 02:42:03 +0000
commitf1f62e00559d5c68a5e7b1246208391835a13d0d (patch)
treeb90eb1fb77645aee7fcde5bde43b3f39ed2b376c /hsm-repl
parent6f80d2d579d0be8773829ee277086af087e85862 (diff)
Adds color to `hsm-repl` prompt
Diffstat (limited to 'hsm-repl')
-rw-r--r--hsm-repl/Hsm/Repl.hs3
-rw-r--r--hsm-repl/hsm-repl.cabal2
2 files changed, 4 insertions, 1 deletions
diff --git a/hsm-repl/Hsm/Repl.hs b/hsm-repl/Hsm/Repl.hs
index 46261d6..45a2cf2 100644
--- a/hsm-repl/Hsm/Repl.hs
+++ b/hsm-repl/Hsm/Repl.hs
@@ -15,6 +15,7 @@ import GHC.TypeLits (KnownSymbol, Symbol, symbolVal)
import Generic.Data.Function.Common.Generic.Meta (KnownSymbols, symbolVals)
import Hsm.Log (Log, Severity(Attention, Info, Trace), logBlock, logMsg)
import Language.Haskell.Interpreter (GhcError(errMsg), InterpreterError(WontCompile), as, interpret, runInterpreter, setImports)
+import String.ANSI (blue)
import System.Console.Haskeline (defaultSettings, getInputLine, handleInterrupt, withInterrupt)
import System.Console.Haskeline.IO (InputState, cancelInput, initializeInput, queryInput)
@@ -33,7 +34,7 @@ repl = query >>= maybe (return Nothing) parse
query = do
Repl inputState <- getStaticRep
logMsg Trace $ "Expecting a value of type: " <> show (typeRep $ Proxy @t)
- unsafeEff_ . queryInput inputState . handleInterrupt (return Nothing) . withInterrupt . getInputLine $ symbolVal (Proxy @p)
+ unsafeEff_ . queryInput inputState . handleInterrupt (return Nothing) . withInterrupt . getInputLine . blue $ symbolVal (Proxy @p)
parse string = do
logMsg Trace $ "Parsing string: " <> string
eitherValue <-
diff --git a/hsm-repl/hsm-repl.cabal b/hsm-repl/hsm-repl.cabal
index eb755a6..5d9a794 100644
--- a/hsm-repl/hsm-repl.cabal
+++ b/hsm-repl/hsm-repl.cabal
@@ -12,6 +12,7 @@ library
, haskeline
, hint
, hsm-log
+ , text-ansi
default-language: GHC2024
exposed-modules: Hsm.Repl
@@ -29,6 +30,7 @@ executable test-repl
, hint
, hsm-log
, monad-loops
+ , text-ansi
default-language: GHC2024
ghc-options: