1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 23:42:31 +03:00
This commit is contained in:
Patrick Thomson 2018-09-19 11:58:44 -04:00
parent 62560cf462
commit 9a1f6e9835
2 changed files with 4 additions and 4 deletions

View File

@ -18,7 +18,7 @@ import GHC.TypeLits
import Diffing.Algorithm hiding (Empty) import Diffing.Algorithm hiding (Empty)
import Prelude import Prelude
import Prologue import Prologue
import Reprinting.Tokenize hiding (Context, Element) import Reprinting.Tokenize hiding (Element)
import qualified Assigning.Assignment as Assignment import qualified Assigning.Assignment as Assignment
import qualified Data.Error as Error import qualified Data.Error as Error
import Proto3.Suite.Class import Proto3.Suite.Class

View File

@ -88,7 +88,7 @@ renameKey :: ( Literal.TextElement :< fs
, Apply Functor fs , Apply Functor fs
, term ~ Term (Sum fs) (Record (History : fields)) , term ~ Term (Sum fs) (Record (History : fields))
) )
=> Rewrite (env, term) m (Literal.KeyValue term) => Rewrite (env, term) (Literal.KeyValue term)
renameKey = do renameKey = do
Literal.KeyValue k v <- id Literal.KeyValue k v <- id
guard (projectTerm k == (Just (Literal.TextElement "\"foo\""))) guard (projectTerm k == (Just (Literal.TextElement "\"foo\"")))
@ -97,11 +97,11 @@ renameKey = do
testRenameKey = do testRenameKey = do
(src, tree) <- testJSONFile (src, tree) <- testJSONFile
let (Right tagged) = applyPure (somewhere renameKey) () (mark Unmodified tree) let (Right tagged) = rewrite (somewhere' renameKey) () (mark Unmodified tree)
pPrint tagged pPrint tagged
printToTerm $ runReprinter src defaultJSONPipeline tagged printToTerm $ runReprinter src defaultJSONPipeline tagged
increaseNumbers :: (term ~ Term (Sum fs) (Record (History : fields))) => Rewrite (env, term) m (Literal.Float term) increaseNumbers :: (term ~ Term (Sum fs) (Record (History : fields))) => Rewrite (env, term) (Literal.Float term)
increaseNumbers = do increaseNumbers = do
(Literal.Float c) <- id (Literal.Float c) <- id
pure (Literal.Float (c <> "0")) pure (Literal.Float (c <> "0"))