haskell-src-meta 0.8.0.2 → 0.8.0.3
raw patch · 3 files changed
+44/−12 lines, 3 filesdep ~basedep ~template-haskellPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, template-haskell
API changes (from Hackage documentation)
Files
- haskell-src-meta.cabal +14/−5
- src/Language/Haskell/Meta/Syntax/Translate.hs +4/−7
- tests/Splices.hs +26/−0
haskell-src-meta.cabal view
@@ -1,5 +1,5 @@ name: haskell-src-meta-version: 0.8.0.2+version: 0.8.0.3 cabal-version: >= 1.8 build-type: Simple license: BSD3@@ -17,11 +17,11 @@ extra-source-files: ChangeLog README.md examples/*.hs library- build-depends: base >= 4.6 && < 4.11,+ build-depends: base >= 4.6 && < 4.12, haskell-src-exts >= 1.18 && < 1.21, pretty >= 1.0 && < 1.2, syb >= 0.1 && < 0.8,- template-haskell >= 2.8 && < 2.13,+ template-haskell >= 2.8 && < 2.14, th-orphans >= 0.9.1 && < 0.14 if impl(ghc < 7.8)@@ -40,13 +40,22 @@ build-depends: HUnit >= 1.2 && < 1.7,- base >= 4.5 && < 4.11,+ base >= 4.5 && < 4.12, haskell-src-exts >= 1.17 && < 1.21, haskell-src-meta, pretty >= 1.0 && < 1.2,- template-haskell >= 2.7 && < 2.13,+ template-haskell >= 2.7 && < 2.14, test-framework >= 0.8 && < 0.9, test-framework-hunit >= 0.3 && < 0.4++test-suite splices+ type: exitcode-stdio-1.0+ hs-source-dirs: tests+ main-is: Splices.hs++ build-depends:+ base,+ haskell-src-meta source-repository head type: git
src/Language/Haskell/Meta/Syntax/Translate.hs view
@@ -132,14 +132,11 @@ toName (Hs.Symbol _ s) = toName s instance ToName (Hs.SpecialCon l) where- toName (Hs.UnitCon _) = '()- toName (Hs.ListCon _) = '[]+ toName (Hs.UnitCon _) = mkName "()"+ toName (Hs.ListCon _) = ''[] -- Parser only uses this in types toName (Hs.FunCon _) = ''(->)- toName (Hs.TupleCon _ _ n)- | n<2 = '()- | otherwise =- let x = maybe [] (++".") (nameModule '(,))- in mkName . concat $ x : ["(",replicate (n-1) ',',")"]+ toName (Hs.TupleCon _ _ n) = + mkName $ concat ["(",replicate (n-1) ',',")"] toName (Hs.Cons _) = '(:)
+ tests/Splices.hs view
@@ -0,0 +1,26 @@+{-#LANGUAGE TemplateHaskell#-}+-- | Tests stuff mostly by just compiling correctly+import Language.Haskell.Meta+++----- Testing names:++-- Test that the unit constructor works+$(either error return $ parseDecs + "unit :: IO ()\nunit = return ()")++-- Testing that the [] constructor works in types, +$(either error return $ parseDecs + "nilp :: [a] -> ([] a)\nnilp [] = []")++$(either error return $ parseDecs + "pair :: (,) Int Int\npair = (,) 1 2")++++-- Just to check that it works as intended+main = do+ () <- unit+ [] <- return (nilp [])+ (1,2) <- return pair+ return ()