s-cargot-letbind 0.2.0.0 → 0.2.1.0
raw patch · 4 files changed
+31/−17 lines, 4 filesdep ~s-cargotPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: s-cargot
API changes (from Hackage documentation)
Files
- ChangeLog.md +6/−0
- s-cargot-letbind.cabal +2/−2
- src/Data/SCargot/LetBind.hs +6/−0
- test/SCargotPrintParseLet.hs +17/−15
ChangeLog.md view
@@ -1,5 +1,11 @@ # Revision history for s-cargot-letbind +## 0.2.1.0 -- 2018-03-02++ * Updated to use s-cargot release 0.1.3.0 and the+ `unconstrainedOutput` added in that version for increased+ performance.+ ## 0.2.0.0 -- 2018-02-16 * Added verification ability to ensure let-bind variables are
s-cargot-letbind.cabal view
@@ -1,5 +1,5 @@ name: s-cargot-letbind-version: 0.2.0.0+version: 0.2.1.0 synopsis: Enables let-binding and let-expansion for s-cargot defined S-expressions. description: @@ -47,7 +47,7 @@ library exposed-modules: Data.SCargot.LetBind build-depends: base >=4.10 && <4.11- , s-cargot >= 0.1.0.0+ , s-cargot >= 0.1.3.0 && <0.2 , text >=1.2 && <2 hs-source-dirs: src default-language: Haskell2010
src/Data/SCargot/LetBind.hs view
@@ -180,6 +180,8 @@ alwaysBindWeight :: Int alwaysBindWeight = 1000000 +-- KWQ: never bind top (n) bindings to avoid: (let ((var2 (...))) (var2))+-- KWQ: no bindings if length of bound portion is 1 after another binding... why isn't skip reset protecting against this? bestBindings :: DiscoveryGuide a str -> ExprInfo a -> [Location a] -> [Location a] bestBindings guide exprs locs = getMaxBest where getMaxBest = head $@@ -411,3 +413,7 @@ Nothing -> SCons (expandWith vdefs l) (expandWith vdefs r) Just vv -> expandWith vdefs vv expandWith _ e@(SAtom _) = e++-- KWQ1: change+-- KWQ1: change 2+-- KWQ1: change 5
test/SCargotPrintParseLet.hs view
@@ -39,12 +39,12 @@ printSExpr (SCons (SAtom (AIdent "hi")) (SCons (SAtom (AIdent "world")) SNil))- , TestLabel "flatprint list of 2 pairs" $ "((hi . hallo) (world . welt))" ~=?+ , TestLabel "flatprint list of 2 pairs" $ "((hi . hallo) world . welt)" ~=? printSExpr (SCons (SCons (SAtom (AIdent "hi")) (SAtom (AIdent "hallo"))) (SCons (SAtom (AIdent "world")) (SAtom (AIdent "welt"))))- , TestLabel "flatprint list of 3 ending in a pair" $ "(hi world (hallo . welt))" ~=?+ , TestLabel "flatprint list of 3 ending in a pair" $ "(hi world hallo . welt)" ~=? printSExpr (SCons (SAtom (AIdent "hi")) (SCons (SAtom (AIdent "world")) (SCons (SAtom (AIdent "hallo"))@@ -57,29 +57,29 @@ ] , TestLabel "pretty print" $ let pprintIt = pprintSExpr 40 Swing in TestList- [ TestLabel "pretty print SNil" $ "()\n" ~=? pprintIt SNil- , TestLabel "pretty print SAtom" $ "hi\n" ~=? pprintIt (SAtom (AIdent "hi"))- , TestLabel "pretty print pair" $ "(hi . world)\n" ~=?+ [ TestLabel "pretty print SNil" $ "()" ~=? pprintIt SNil+ , TestLabel "pretty print SAtom" $ "hi" ~=? pprintIt (SAtom (AIdent "hi"))+ , TestLabel "pretty print pair" $ "(hi . world)" ~=? pprintIt (SCons (SAtom (AIdent "hi")) (SAtom (AIdent "world")))- , TestLabel "pretty print list of 1" $ "(hi)\n" ~=?+ , TestLabel "pretty print list of 1" $ "(hi)" ~=? pprintIt (SCons (SAtom (AIdent "hi")) SNil)- , TestLabel "pretty print list of 2" $ "(hi world)\n" ~=?+ , TestLabel "pretty print list of 2" $ "(hi world)" ~=? pprintIt (SCons (SAtom (AIdent "hi")) (SCons (SAtom (AIdent "world")) SNil)) , TestLabel "pretty print list of 2 pairs" $- "((hi . hallo) (world . welt))\n" ~=?+ "((hi . hallo) world . welt)" ~=? pprintIt (SCons (SCons (SAtom (AIdent "hi")) (SAtom (AIdent "hallo"))) (SCons (SAtom (AIdent "world")) (SAtom (AIdent "welt")))) , TestLabel "pretty print list of 3 ending in a pair" $- "(hi world (hallo . welt))\n" ~=?+ "(hi world hallo . welt)" ~=? pprintIt (SCons (SAtom (AIdent "hi")) (SCons (SAtom (AIdent "world")) (SCons (SAtom (AIdent "hallo")) (SAtom (AIdent "welt")))))- , TestLabel "pretty print list of 3" $ "(hi world hallo)\n" ~=?+ , TestLabel "pretty print list of 3" $ "(hi world hallo)" ~=? pprintIt (SCons (SAtom (AIdent "hi")) (SCons (SAtom (AIdent "world")) (SCons (SAtom (AIdent "hallo"))@@ -136,7 +136,7 @@ normalf = (SAtom (AIdent "people")) in TestList [ TestLabel "trivial let binding" $- "((hi world and people)\n hallo\n welt\n und\n leute)\n" ~=?+ "((hi world and\n people) hallo welt\nund\nleute)" ~=? (pprintIt $ discoverLetBindings nobindGuide $ sexpr normalf) , TestLabel "duplicate names" $@@ -148,10 +148,10 @@ ]) , TestLabel "expected bindings for these tests" $- "(let\n\- \ ((people (welt und leute))\n\+ "(let \n\+ \ ((people (welt und leute)) \n\ \ (var1 (world and last)))\n\- \ ((hi var1) hallo people))\n" ~=?+ \ ((hi var1) hallo people))" ~=? (pprintIt $ discoverLetBindings peoplenames $ sexpr (SAtom (AIdent "last"))) , TestLabel "expression ident names collision above bind point" $@@ -304,7 +304,9 @@ pprintSExpr w i = encodeOne (setIndentStrategy (const i) $ setMaxWidth w $ setIndentAmount 1 $- basicPrint printAtom)+ -- basicPrint+ unconstrainedPrint+ printAtom) getIdent :: FAtom -> Maybe String getIdent (AIdent s) = Just s