summaryrefslogtreecommitdiff
path: root/Com/Simatime/Go.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Com/Simatime/Go.hs')
-rw-r--r--Com/Simatime/Go.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/Com/Simatime/Go.hs b/Com/Simatime/Go.hs
index e622539..f19511f 100644
--- a/Com/Simatime/Go.hs
+++ b/Com/Simatime/Go.hs
@@ -27,6 +27,7 @@ import qualified Control.Concurrent as Concurrent
import qualified Control.Concurrent.Chan.Unagi.Bounded
as Chan
import qualified Data.Aeson as Aeson
+import qualified System.IO.Unsafe as Unsafe
-- | A standard channel.
data Channel a = Channel
@@ -36,7 +37,8 @@ data Channel a = Channel
}
instance Aeson.ToJSON (Channel a) where
- toJSON _ = Aeson.String ("#<channel>" :: Text)
+ toJSON c = Aeson.String ("#<channel " <> len c <> ">" :: Text)
+ where len = show . Unsafe.unsafePerformIO . Chan.estimatedLength . _in
-- | Starts a background process.
fork :: IO () -> IO Concurrent.ThreadId