From 16f6728d6599b1d7856ee574b576a2f943c47c02 Mon Sep 17 00:00:00 2001 From: Timothy Clem Date: Tue, 28 Aug 2018 09:47:31 -0700 Subject: [PATCH] Get the ~> all headed in the same direction --- src/Language/JSON/PrettyPrint.hs | 6 +++--- src/Language/Ruby/PrettyPrint.hs | 2 +- src/Reprinting/Translate.hs | 2 +- src/Semantic/Util/Rewriting.hs | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Language/JSON/PrettyPrint.hs b/src/Language/JSON/PrettyPrint.hs index b908c11fb..fbd0321dc 100644 --- a/src/Language/JSON/PrettyPrint.hs +++ b/src/Language/JSON/PrettyPrint.hs @@ -25,7 +25,7 @@ defaultJSONPipeline -- | Print JSON syntax. printingJSON :: Monad m => ProcessT m Fragment Fragment -printingJSON = flattened <~ auto step where +printingJSON = auto step ~> flattened where step :: Fragment -> Seq Fragment step s@(Defer el cs) = let ins = insert el cs @@ -58,7 +58,7 @@ defaultBeautyOpts = JSONBeautyOpts 2 False -- | Produce JSON with configurable whitespace and layout. beautifyingJSON :: (Member (Exc TranslationError) effs) => JSONBeautyOpts -> ProcessT (Eff effs) Fragment Splice -beautifyingJSON _ = flattened <~ autoT (Kleisli step) where +beautifyingJSON _ = autoT (Kleisli step) ~> flattened where step (Defer el cs) = throwError (NoTranslation el cs) step (Verbatim txt) = pure $ emit txt step (New el cs txt) = pure $ case (el, listToMaybe cs) of @@ -72,7 +72,7 @@ beautifyingJSON _ = flattened <~ autoT (Kleisli step) where -- | Produce whitespace minimal JSON. minimizingJSON :: (Member (Exc TranslationError) effs) => ProcessT (Eff effs) Fragment Splice -minimizingJSON = flattened <~ autoT (Kleisli step) where +minimizingJSON = autoT (Kleisli step) ~> flattened where step (Defer el cs) = throwError (NoTranslation el cs) step (Verbatim txt) = pure $ emit txt step (New _ _ txt) = pure $ emit txt diff --git a/src/Language/Ruby/PrettyPrint.hs b/src/Language/Ruby/PrettyPrint.hs index 26ffa1c94..2f6c1a05c 100644 --- a/src/Language/Ruby/PrettyPrint.hs +++ b/src/Language/Ruby/PrettyPrint.hs @@ -11,7 +11,7 @@ import Data.Reprinting.Token as Token -- | Print Ruby syntax. printingRuby :: (Member (Exc TranslationError) effs) => ProcessT (Eff effs) Fragment Splice -printingRuby = flattened <~ autoT (Kleisli step) +printingRuby = autoT (Kleisli step) ~> flattened step :: (Member (Exc TranslationError) effs) => Fragment -> Eff effs (Seq Splice) step (Verbatim txt) = pure $ emit txt diff --git a/src/Reprinting/Translate.hs b/src/Reprinting/Translate.hs index a1f6aecc3..e44e73436 100644 --- a/src/Reprinting/Translate.hs +++ b/src/Reprinting/Translate.hs @@ -27,7 +27,7 @@ contextualizing :: , Member (Exc TranslationError) effs ) => ProcessT (Eff effs) Token Fragment -contextualizing = flattened <~ autoT (Kleisli step) where +contextualizing = autoT (Kleisli step) ~> flattened where step t = case t of Chunk source -> pure $ copy (Source.toText source) TElement el -> toFragment el <$> get diff --git a/src/Semantic/Util/Rewriting.hs b/src/Semantic/Util/Rewriting.hs index 2a5a5ff35..d498cca68 100644 --- a/src/Semantic/Util/Rewriting.hs +++ b/src/Semantic/Util/Rewriting.hs @@ -125,7 +125,7 @@ addKVPair = repeatedly $ do testAddKVPair = do (src, tree) <- testJSONFile - tagged <- runM $ cata (toAlgebra (addKVPair <~ fromMatcher matchHash)) (mark Unmodified tree) + tagged <- runM $ cata (toAlgebra (fromMatcher matchHash ~> addKVPair)) (mark Unmodified tree) printToTerm $ runReprinter src defaultJSONPipeline tagged overwriteFloats :: forall effs syntax ann fields term . @@ -143,7 +143,7 @@ overwriteFloats = repeatedly $ do testOverwriteFloats = do (src, tree) <- testJSONFile - tagged <- runM $ cata (toAlgebra (overwriteFloats <~ fromMatcher matchFloat)) (mark Unmodified tree) + tagged <- runM $ cata (toAlgebra (fromMatcher matchFloat ~> overwriteFloats)) (mark Unmodified tree) printToTerm $ runReprinter src defaultJSONPipeline tagged findKV :: @@ -187,7 +187,7 @@ changeKV = auto $ either id injKV testChangeKV = do (src, tree) <- testJSONFile - tagged <- runM $ cata (toAlgebra (changeKV <~ findKV "\"bar\"")) (mark Unmodified tree) + tagged <- runM $ cata (toAlgebra (findKV "\"bar\"" ~> changeKV)) (mark Unmodified tree) printToTerm $ runReprinter src defaultJSONPipeline tagged -- Temporary, until new KURE system lands.