phino 0.0.0.25 → 0.0.0.26
raw patch · 3 files changed
+71/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- phino.cabal +1/−1
- src/Matcher.hs +6/−1
- test/MatcherSpec.hs +64/−0
phino.cabal view
@@ -1,7 +1,7 @@ cabal-version: 3.0 name: phino-version: 0.0.0.25+version: 0.0.0.26 license: MIT synopsis: Command-Line Manipulator of 𝜑-Calculus Expressions description: Please see the README on GitHub at <https://github.com/objectionary/phino#readme>
src/Matcher.hs view
@@ -53,6 +53,11 @@ where combine' :: [(String, MetaValue)] -> Map String MetaValue -> Maybe Subst combine' [] acc = Just (Subst acc)+ combine' ((key, MvExpression tgt scope) : rest) acc = case Map.lookup key acc of+ Just (MvExpression expr _)+ | expr == tgt -> combine' rest acc+ | otherwise -> Nothing+ Nothing -> combine' rest (Map.insert key (MvExpression tgt scope) acc) combine' ((key, value) : rest) acc = case Map.lookup key acc of Just found | found == value -> combine' rest acc@@ -70,7 +75,7 @@ matchBinding :: Binding -> Binding -> Expression -> [Subst] matchBinding (BiVoid pattr) (BiVoid tattr) _ = matchAttribute pattr tattr-matchBinding (BiDelta (BtMeta meta)) (BiDelta tdata) _ = [substSingle meta (MvBytes tdata)] +matchBinding (BiDelta (BtMeta meta)) (BiDelta tdata) _ = [substSingle meta (MvBytes tdata)] matchBinding (BiDelta pdata) (BiDelta tdata) _ | pdata == tdata = [substEmpty] | otherwise = []
test/MatcherSpec.hs view
@@ -92,6 +92,70 @@ ("B2", MvBindings []) ] ]+ ),+ ( "somebody",+ ExFormation+ [ BiTau+ (AtLabel "i1")+ ( ExFormation+ [ BiTau (AtLabel "a") (ExMeta "e0"),+ BiTau (AtLabel "b") (ExMeta "e-first")+ ]+ ),+ BiTau+ (AtLabel "i2")+ ( ExFormation+ [ BiTau (AtLabel "a") (ExMeta "e0"),+ BiTau (AtLabel "b") (ExMeta "e-second")+ ]+ )+ ],+ ExFormation+ [ BiTau+ (AtLabel "i1")+ ( ExFormation+ [ BiTau (AtLabel "a") ExGlobal,+ BiTau (AtLabel "b") ExThis+ ]+ ),+ BiTau+ (AtLabel "i2")+ ( ExFormation+ [ BiTau (AtLabel "a") ExGlobal,+ BiTau (AtLabel "b") (ExFormation [BiVoid AtPhi])+ ]+ )+ ],+ defaultScope,+ [ [ ( "e0",+ MvExpression+ ExGlobal+ ( ExFormation+ [ BiTau (AtLabel "a") ExGlobal,+ BiTau (AtLabel "b") ExThis+ ]+ )+ ),+ ( "e-first",+ MvExpression+ ExThis+ ( ExFormation+ [ BiTau (AtLabel "a") ExGlobal,+ BiTau (AtLabel "b") ExThis+ ]+ )+ ),+ ( "e-second",+ MvExpression+ (ExFormation [BiVoid AtPhi])+ ( ExFormation+ [ BiTau (AtLabel "a") ExGlobal,+ BiTau (AtLabel "b") (ExFormation [BiVoid AtPhi])+ ]+ )+ )+ ]+ ] ) ]