Remove instantBullets

This commit is contained in:
2024-12-24 12:50:00 +00:00
parent a28ec07ffb
commit 75958c1e2c
9 changed files with 25 additions and 23 deletions
+7 -6
View File
@@ -1,4 +1,5 @@
module AesonHelp where
import Data.Aeson (ToJSON)
import qualified Data.Aeson.Encode.Pretty as AEP
import Data.ByteString.Lazy.Char8 (unpack)
@@ -7,15 +8,15 @@ import Data.Maybe
getPretty :: ToJSON a => a -> [String]
getPretty = lines . unpack . AEP.encodePretty' (AEP.Config (AEP.Spaces 2) compare AEP.Generic False)
getPrettyShort :: ToJSON a => a -> [String]
getPrettyShort = mapMaybe cullPretty . getPretty
prettyShort :: ToJSON a => a -> [String]
prettyShort = mapMaybe cullPretty . getPretty
cullPretty :: String -> Maybe String
cullPretty s = case dropWhile (== ' ') s of
']':_ -> Nothing
'[':_ -> Nothing
'}':_ -> Nothing
'{':_ -> Nothing
']' : _ -> Nothing
'[' : _ -> Nothing
'}' : _ -> Nothing
'{' : _ -> Nothing
_ -> Just $ filter f s
where
f '_' = False