1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Slightly different JSON printing options

This commit is contained in:
Timothy Clem 2018-08-20 10:37:55 -07:00
parent ae20bf5477
commit a473a346c9

View File

@ -12,12 +12,6 @@ import Data.Reprinting.Splice
import Data.Reprinting.Token import Data.Reprinting.Token
import Data.Sequence import Data.Sequence
newtype JSONBeautyOpts = JSONBeautyOpts { jsonPrettyPrint :: Bool }
deriving (Eq, Show)
defaultBeautyOpts :: JSONBeautyOpts
defaultBeautyOpts = JSONBeautyOpts True
defaultJSONPipeline :: Monad m => ProcessT m Splice Splice defaultJSONPipeline :: Monad m => ProcessT m Splice Splice
defaultJSONPipeline defaultJSONPipeline
= translatingJSON = translatingJSON
@ -44,6 +38,14 @@ translatingJSON = flattened <~ auto step where
step x = pure x step x = pure x
-- | TODO: Fill out and implement configurable options like indentation count,
-- tabs vs. spaces, etc.
data JSONBeautyOpts = JSONBeautyOpts { jsonIndent :: Int, jsonUseTabs :: Bool }
deriving (Eq, Show)
defaultBeautyOpts :: JSONBeautyOpts
defaultBeautyOpts = JSONBeautyOpts 2 False
beautifyingJSON :: Monad m => JSONBeautyOpts -> ProcessT m Splice Splice beautifyingJSON :: Monad m => JSONBeautyOpts -> ProcessT m Splice Splice
beautifyingJSON _ = flattened <~ auto step where beautifyingJSON _ = flattened <~ auto step where
step :: Splice -> Seq Splice step :: Splice -> Seq Splice