From b17396b2eeefdf113b862b254cb152557bebf68d Mon Sep 17 00:00:00 2001 From: stuebinm Date: Sat, 18 Sep 2021 00:27:22 +0200 Subject: tame the strings Adds a PrettyPrint typeclass which operates on Text and should replace Show, since constantly converting strings from linked lists to arrays seems somewhat silly. --- src/Main.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/Main.hs') diff --git a/src/Main.hs b/src/Main.hs index 7884cf9..969fa10 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -1,21 +1,22 @@ -{-# LANGUAGE LambdaCase #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE LambdaCase #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} module Main where -import Data.Maybe (fromMaybe) -import WithCli - -import CheckMap (loadAndLintMap) import Data.Aeson (encode) import Data.Aeson.Encode.Pretty (encodePretty) import qualified Data.ByteString.Lazy as LB import qualified Data.ByteString.Lazy.Encoding as LB +import Data.Maybe (fromMaybe) import Data.Text.Lazy as T import System.IO (utf8) +import WithCli + +import CheckMap (loadAndLintMap) +import Util (printPretty) -- | the options this cli tool can take data Options = Options @@ -44,7 +45,7 @@ run options = do if json options then printLB $ if pretty options then encodePretty lints else encode lints - else print lints + else printPretty lints -- | haskell's many string types are FUN … printLB :: LB.ByteString -> IO () -- cgit v1.2.3