holeyexp 0.3.0.0 → 0.3.0.1
raw patch · 4 files changed
+23/−18 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- holeyexp.cabal +1/−1
- src/Data/HoleyExp/Text.hs +7/−7
- test/Data/HoleyExp/HExpInternalSpec.hs +10/−10
CHANGELOG.md view
@@ -7,6 +7,11 @@ [Haskell Package Versioning Policy](https://pvp.haskell.org/). ## Unreleased+## [0.3.0.1] - 2026-09-04+### Changed+ - We migrated to the hole syntax `$i(f)` from `$i{f}`, but we forgot to + migrate the parser combinators.+ ## [0.3.0.0] - 2026-09-02 ### Changed - Now builds with GHC 9.8.4. This required the removal of the
holeyexp.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: holeyexp-version: 0.3.0.0+version: 0.3.0.1 license: BSD-3-Clause license-file: LICENSE.md maintainer: Harley Eades III <harley.eades@gmail.com>
src/Data/HoleyExp/Text.hs view
@@ -135,7 +135,7 @@ charTextFillingParser :: Parsec TParseError Text Char charTextFillingParser = choice [- satisfy (\c -> c /= '{' && c /= '}' && c /= '\\'),+ satisfy (\c -> c /= '(' && c /= ')' && c /= '\\'), escapeCharTextFillingParser ] @@ -220,11 +220,11 @@ holeFillingParser = maybe n p (parseFilling @Text) where -- If there is no filling, then skip the braces.- n = (skip $ string "{}") >> pure Nothing+ n = (skip $ string "()") >> pure Nothing p :: (Text -> Either Text filling) -> Parser (Maybe filling) p expParser = do- f <- MT.between (char '{') (char '}') $ many $ hExpCharParser True+ f <- MT.between (char '(') (char ')') $ many $ hExpCharParser True if L.null f then pure Nothing else do let e = expParser . DT.pack $ f@@ -257,22 +257,22 @@ -- | Parse an expression character. These are any unicode character where the -- characters --- > ["$","{","}","\\"] +-- > ["$","(",")","\\"] -- are escaped when parsing a hole's filling, -- otherwise just @'$'@ needs to be escaped. hExpCharParser :: Bool -> Parser Char hExpCharParser filling = choice [- satisfy (\c -> c /= '$' && c /= '\'' && (if filling then c /= '{' && c /= '}' else True) && c /= '\\'),+ satisfy (\c -> c /= '$' && c /= '\'' && (if filling then c /= '(' && c /= ')' else True) && c /= '\\'), escapedHExpCharParser ] -- | Parsed an escaped character; one of, --- > ["\\$"","\\{"","\\}","\\\\"]+-- > ["\\$"","\\("","\\)","\\\\"] -- . escapedHExpCharParser :: Parser Char escapedHExpCharParser = do skipCount 1 (char '\\')- satisfy (\c -> c == '$' || c == '{' || c == '}' || c == '\'')+ satisfy (\c -> c == '$' || c == '(' || c == ')' || c == '\'') -- * Helper parsers
test/Data/HoleyExp/HExpInternalSpec.hs view
@@ -34,9 +34,9 @@ describe "Holes:" $ do test_case "no index" test_parseFail1 test_case "negative index" test_parseFail2- test_case "no opening brace" test_parseFail3- test_case "no closing brace" test_parseFail4- test_case "non-escaped curly brace" test_parseFail5+ test_case "no opening paren" test_parseFail3+ test_case "no closing paren" test_parseFail4+ test_case "non-escaped paren" test_parseFail5 test_case "non-escaped backslash" test_parseFail6 test_case "filling in unit hole" test_parseFail7 @@ -62,42 +62,42 @@ test_parseFail1 :: UnitTest (Maybe (HExp Text Text)) test_parseFail1 = UnitTest {- test_result=parseTest testParseHExp "foo${a}"+ test_result=parseTest testParseHExp "foo$(a)" ,test_output=Nothing } test_parseFail2 :: UnitTest (Maybe (HExp Text Text)) test_parseFail2 = UnitTest {- test_result=parseTest testParseHExp "foo$-1{a}"+ test_result=parseTest testParseHExp "foo$-1(a)" ,test_output=Nothing } test_parseFail3 :: UnitTest (Maybe (HExp Text Text)) test_parseFail3 = UnitTest {- test_result=parseTest testParseHExp "foo$1a}bar"+ test_result=parseTest testParseHExp "foo$1a)bar" ,test_output=Nothing } test_parseFail4 :: UnitTest (Maybe (HExp Text Text)) test_parseFail4 = UnitTest {- test_result=parseTest testParseHExp "foo$1{abar"+ test_result=parseTest testParseHExp "foo$1(abar" ,test_output=Nothing } test_parseFail5 :: UnitTest (Maybe (HExp Text Text)) test_parseFail5 = UnitTest {- test_result=parseTest testParseHExp "foo$1{{a}bar"+ test_result=parseTest testParseHExp "foo$1((a)bar" ,test_output=Nothing } test_parseFail6 :: UnitTest (Maybe (HExp Text Text)) test_parseFail6 = UnitTest {- test_result=parseTest testParseHExp "foo$1{\\a}bar"+ test_result=parseTest testParseHExp "foo$1(\\a)bar" ,test_output=Nothing } test_parseFail7 :: UnitTest (Maybe (HExp Text ())) test_parseFail7 = UnitTest {- test_result=parseTest testParseUnitHExp "foo$1{aa}bar"+ test_result=parseTest testParseUnitHExp "foo$1(aa)bar" ,test_output=Nothing }