summaryrefslogtreecommitdiff
path: root/lib/Util.hs
diff options
context:
space:
mode:
authorstuebinm2021-12-29 04:49:46 +0100
committerstuebinm2021-12-29 04:56:19 +0100
commit0419aa9918723c8b74252bf6ff1a2162c2f3a89a (patch)
tree6c793ecd95e1653024f4cb73675ab2a400c7221c /lib/Util.hs
parent436a7dbb734f58a254bed6c9d28908033b537bf8 (diff)
maps, maps, and yet more maps
don't add maps to the result if their lint result looks the same as that of another list, just say it happened several times instead (this leads to a rather confusing Eq instance for MapResult which implements a very simple surface-level equality — perhaps change that later)
Diffstat (limited to 'lib/Util.hs')
-rw-r--r--lib/Util.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Util.hs b/lib/Util.hs
index d760fc2..3fe0a16 100644
--- a/lib/Util.hs
+++ b/lib/Util.hs
@@ -66,7 +66,12 @@ printPretty :: PrettyPrint a => a -> IO ()
printPretty = putStr . T.unpack . prettyprint
-
+-- | for long lists which shouldn't be printed out in their entirety
+ellipsis :: Int -> [Text] -> Text
+ellipsis i texts
+ | i < l = prettyprint (take i texts) <> " ... (and " <> showText (l-i) <> " more)"
+ | otherwise = prettyprint texts
+ where l = length texts