packages feed

haskell-exp-parser 0.1 → 0.1.1

raw patch · 2 files changed

+29/−1 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

haskell-exp-parser.cabal view
@@ -1,5 +1,5 @@ name:           haskell-exp-parser-version:        0.1+version:        0.1.1 synopsis:       Simple parser parser from Haskell to TemplateHaskell expressions description:    This package defines a simple parser for a subset of Haskell expressions and patterns to the TemplateHaskell AST.                 .@@ -8,8 +8,11 @@                 The following expressions are currently supported:                 .                 * Variables+                .                 * Integer and string literals+                .                 * Prefix function application+                .                 * Lists and tuples                 .                 The following patterns are currently supported:@@ -25,6 +28,9 @@ category:       Language build-type:     Simple cabal-version:  >=1.10++extra-source-files:+  tests/*.hs  source-repository head   type:     git
+ tests/ParseExp.hs view
@@ -0,0 +1,22 @@+module ParseExp where++++import Data.Either+import Language.Haskell.TH++import Language.Haskell.ParseExp++++parse :: String -> ExpQ+parse str = return $ case parseExp str of+    Right exp -> exp+    Left msg  -> error msg++exp1 = parse "\"sdf\""+exp2 = parse "sum [1,2,3]"+exp3 = parse "min (max (negate (-34)) 888) (signum (-45))"+exp4 = parse "  min   (  max   (  negate   (  -  34  )  )   888  )   (   signum    (  - 45   )   )  "+exp5 = parse "[(1,'a'),(2,'b'),(3,'c')]"+