1
1
mirror of https://github.com/github/semantic.git synced 2025-01-01 19:55:34 +03:00

Replace termA/termB with functions.

This commit is contained in:
Rob Rix 2016-08-11 12:25:30 -04:00
parent fb847d9d3f
commit fd6701973f

View File

@ -35,6 +35,6 @@ spec = parallel $ do
prop "produces unbiased deletions" $
\ a b -> let (a', b') = (decorate (toTerm a), decorate (toTerm (b :: ArbitraryTerm Text (Record '[Category]))))
termA = cofree $ (pure 0 .: Program .: RNil) :< Indexed [ a', b' ]
termB = cofree $ (pure 0 .: Program .: RNil) :< Indexed [ a' ] in
diffTerms wrap ((==) `on` extract) diffCost termA termB `shouldBe` free (Free (pure (pure 0 .: Program .: RNil) :< Indexed [ cata wrap (fmap pure a'), deleting b' ]))
two a b = cofree $ (pure 0 .: Program .: RNil) :< Indexed [ a, b ]
one a = cofree $ (pure 0 .: Program .: RNil) :< Indexed [ a ] in
diffTerms wrap ((==) `on` extract) diffCost (two a' b') (one a') `shouldBe` free (Free (pure (pure 0 .: Program .: RNil) :< Indexed [ cata wrap (fmap pure a'), deleting b' ]))