packages feed

mello 0.4.0 → 0.5.0

raw patch · 4 files changed

+18/−6 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

mello.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           mello-version:        0.4.0+version:        0.5.0 synopsis:       No-fuss syntax with s-expressions description:    Please see the README on GitHub at <https://github.com/ejconlon/mello#readme> category:       Parsing
src/Mello/Parse.hs view
@@ -14,7 +14,7 @@  import Bowtie (Memo, pattern MemoP) import Control.Monad (guard, unless, void)-import Data.Char (isSpace)+import Data.Char (isDigit, isSpace) import Data.Sequence (Seq (..)) import Data.Text (Text) import Data.Text qualified as T@@ -28,7 +28,6 @@   , isAtomStart   , isCharStart   , isListStart-  , isNumStart   , isQuoteStart   , isStringStart   , isSymCont@@ -153,11 +152,18 @@     pure (SexpListF b ss)   quoteP = L.charP_ '`' *> fmap SexpQuoteF rootP   unquoteP = L.charP_ ',' *> fmap SexpUnquoteF rootP+  guardNumStartP = do+    c <- L.headP+    if isDigit c+      then pure ()+      else do+        guard (c == '-')+        void (L.headP >>= guard . isDigit)   atomP =     SexpAtomF       <$> L.commitP-        [ (guard1P isSymStart, L.labelP "sym" (fmap AtomSym symP))-        , (guard1P isNumStart, L.labelP "num" (fmap (either AtomInt AtomSci) L.numP))+        [ (guardNumStartP, L.labelP "num" (fmap (either AtomInt AtomSci) L.numP))+        , (guard1P isSymStart, L.labelP "sym" (fmap AtomSym symP))         , (guard1P isStringStart, L.labelP "str" (fmap AtomStr stringLitP))         , (guard1P isCharStart, L.labelP "char" (fmap AtomChar charLitP))         ]
src/Mello/Text.hs view
@@ -75,7 +75,6 @@       || isCharStart c       || isQuoteStart c       || isUnquoteStart c-      || isDigit c isListStart c = c == '(' || c == '{' || c == '[' isListEnd c = c == ')' || c == '}' || c == ']' isCharStart c = c == '\''
test/Main.hs view
@@ -44,6 +44,13 @@     , parseCaseAs "unquote" ",1" (SexpUnquote 1)     , parseCaseAs "list" "(1 2)" (SexpList BraceParen [1, 2])     , parseCaseAs "doc" ";|X\n;Y\n1" (SexpDoc (Doc ["X", "Y"]) 1)+    , parseCaseAs "atom int neg" "-1" (SexpAtom (AtomInt (-1)))+    , parseCaseAs "atom sym special 1" "_y-3z" (SexpAtom (AtomSym "_y-3z"))+    , parseCaseAs "atom sym special 2" ">=" (SexpAtom (AtomSym ">="))+    , parseCaseAs "atom sym special 3" "<=" (SexpAtom (AtomSym "<="))+    , parseCaseAs "atom sym special 4" "=>" (SexpAtom (AtomSym "=>"))+    , parseCaseAs "atom sym special 5" "->" (SexpAtom (AtomSym "->"))+    , parseCaseAs "atom sym special 6" ":x" (SexpAtom (AtomSym ":x"))     ]  main :: IO ()