aboutsummaryrefslogtreecommitdiff
path: root/bwrap-files/workdir
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2022-06-14 19:12:53 +0200
committerTom Smeding <tom@tomsmeding.com>2022-06-14 19:12:53 +0200
commitaa6327c3f630c9b7b7ceef8d07f3a57ca03cccf1 (patch)
treeac54f3f5d17e6c69b3d2ec894547bc767a269a0d /bwrap-files/workdir
parent181bdd640a5a605ed43cc14b295a6536541e428e (diff)
Early-catch large show output with -interactive-print
Diffstat (limited to 'bwrap-files/workdir')
-rw-r--r--bwrap-files/workdir/Yahb2Defs.hs8
-rwxr-xr-xbwrap-files/workdir/entry.sh6
2 files changed, 14 insertions, 0 deletions
diff --git a/bwrap-files/workdir/Yahb2Defs.hs b/bwrap-files/workdir/Yahb2Defs.hs
new file mode 100644
index 0000000..c0dfbfd
--- /dev/null
+++ b/bwrap-files/workdir/Yahb2Defs.hs
@@ -0,0 +1,8 @@
+module Yahb2Defs where
+
+
+limitedPrint :: Show a => a -> IO ()
+limitedPrint x =
+ case splitAt 200 (show x) of
+ (s, "") -> putStrLn s
+ (s, _) -> putStrLn (take 197 s ++ "...")
diff --git a/bwrap-files/workdir/entry.sh b/bwrap-files/workdir/entry.sh
new file mode 100755
index 0000000..1a466da
--- /dev/null
+++ b/bwrap-files/workdir/entry.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+set -euo pipefail
+
+cd "$(dirname "$0")"
+
+ghcup --offline run -- ghci Yahb2Defs.hs 2>&1