Skip to content

Commit

Permalink
etc
Browse files Browse the repository at this point in the history
  • Loading branch information
ejconlon committed Sep 12, 2024
1 parent 0270a57 commit eee26e0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 0 additions & 2 deletions bin/minipat
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,4 @@ SCRIPT="$(realpath "${SCRIPT}")"

set -x

stack build --fast "minipat-${BACKEND}"

exec stack ghci --ghci-options "-ghci-script=\"${SCRIPT}\"" "minipat-${BACKEND}"
4 changes: 4 additions & 0 deletions minipat-live/src/Minipat/Live/Boot.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module Minipat.Live.Boot
, panic
, play
, stop
, status
, checkTasks
, peek
, d
Expand Down Expand Up @@ -136,6 +137,9 @@ play = setPlaying True
stop :: (LiveSt) => IO ()
stop = setPlaying False

status :: (LiveSt) => IO ()
status = readLiveSt >>= void . C.status

checkTasks :: (LiveSt) => IO ()
checkTasks = readLiveSt >>= void . C.checkTasks

Expand Down
14 changes: 14 additions & 0 deletions minipat-live/src/Minipat/Live/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module Minipat.Live.Core
, clearAllOrbits
, hush
, panic
, status
, checkTasks
, logAsyncState
, peek
Expand Down Expand Up @@ -425,6 +426,19 @@ logAsyncState logger name task = do
Left e -> False <$ logException logger ("Task " <> name <> " failed") e
Right _ -> False <$ logWarn logger ("Task " <> name <> " not running")

status :: St i -> IO ()
status st = do
let logger = stLogger st
dom = stDom st
rep :: (Show a) => (Domain -> TVar a) -> Text -> IO ()
rep p l = readTVarIO (p dom) >>= logInfo logger . (\v -> l <> ": " <> v) . T.pack . show
rep domPlaying "Playing"
rep domGenCycle "GenCycle"
rep domAbsGenCycle "AbsGenCycle"
rep domCps "CPS"
rep domGpc "GPC"
rep domDebug "Debug"

checkTasks :: (Backend i) => St i -> IO Bool
checkTasks st =
let logger = stLogger st
Expand Down

0 comments on commit eee26e0

Please sign in to comment.