hsx2hs 0.13.3.2 → 0.13.4
raw patch · 5 files changed
+122/−25 lines, 5 filesdep ~haskell-src-extsPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: haskell-src-exts
API changes (from Hackage documentation)
- Language.Haskell.HSX.Transform: instance [overlap ok] Applicative HsxM
- Language.Haskell.HSX.Transform: instance [overlap ok] Applicative RN
- Language.Haskell.HSX.Transform: instance [overlap ok] Applicative Tr
- Language.Haskell.HSX.Transform: instance [overlap ok] Functor HsxM
- Language.Haskell.HSX.Transform: instance [overlap ok] Functor RN
- Language.Haskell.HSX.Transform: instance [overlap ok] Functor Tr
- Language.Haskell.HSX.Transform: instance [overlap ok] Monad HsxM
- Language.Haskell.HSX.Transform: instance [overlap ok] Monad RN
- Language.Haskell.HSX.Transform: instance [overlap ok] Monad Tr
+ Language.Haskell.HSX.Transform: instance GHC.Base.Applicative Language.Haskell.HSX.Transform.HsxM
+ Language.Haskell.HSX.Transform: instance GHC.Base.Applicative Language.Haskell.HSX.Transform.RN
+ Language.Haskell.HSX.Transform: instance GHC.Base.Applicative Language.Haskell.HSX.Transform.Tr
+ Language.Haskell.HSX.Transform: instance GHC.Base.Functor Language.Haskell.HSX.Transform.HsxM
+ Language.Haskell.HSX.Transform: instance GHC.Base.Functor Language.Haskell.HSX.Transform.RN
+ Language.Haskell.HSX.Transform: instance GHC.Base.Functor Language.Haskell.HSX.Transform.Tr
+ Language.Haskell.HSX.Transform: instance GHC.Base.Monad Language.Haskell.HSX.Transform.HsxM
+ Language.Haskell.HSX.Transform: instance GHC.Base.Monad Language.Haskell.HSX.Transform.RN
+ Language.Haskell.HSX.Transform: instance GHC.Base.Monad Language.Haskell.HSX.Transform.Tr
Files
- .travis.yml +76/−21
- hsx2hs.cabal +3/−3
- src/Language/Haskell/HSX/QQ.hs +3/−0
- src/Language/Haskell/HSX/Transform.hs +35/−0
- src/hsx2hs.hs +5/−1
.travis.yml view
@@ -1,31 +1,86 @@-language: haskell-before_install:-env:- - GHCVER=7.4.2 CABALVER=1.18 HAPPYVER=1.19.4 ALEXVER=3.1.3- - GHCVER=7.6.3 CABALVER=1.18 HAPPYVER=1.19.4 ALEXVER=3.1.3- - GHCVER=7.8.4 CABALVER=1.22 HAPPYVER=1.19.4 ALEXVER=3.1.3- - GHCVER=7.10.1 CABALVER=1.22 HAPPYVER=1.19.4 ALEXVER=3.1.3- - GHCVER=head CABALVER=head HAPPYVER=1.19.4 ALEXVER=3.1.3+language: c+sudo: false +cache:+ directories:+ - $HOME/.cabsnap+ - $HOME/.cabal/packages++before_cache:+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar+ matrix:+ include:+ - env: CABALVER=1.16 GHCVER=7.6.3 HAPPYVER=1.19.5+ compiler: ": #GHC 7.6.3"+ addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3,happy-1.19.5], sources: [hvr-ghc]}}+ - env: CABALVER=1.18 GHCVER=7.8.4 HAPPYVER=1.19.5+ compiler: ": #GHC 7.8.4"+ addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4,happy-1.19.5], sources: [hvr-ghc]}}+ - env: CABALVER=1.22 GHCVER=7.10.3 HAPPYVER=1.19.5+ compiler: ": #GHC 7.10.3"+ addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3,happy-1.19.5], sources: [hvr-ghc]}}+ - env: CABALVER=1.22 GHCVER=head HAPPYVER=1.19.5+ compiler: ": #GHC HEAD"+ addons: {apt: {packages: [cabal-install-1.22,ghc-head,happy-1.19.5], sources: [hvr-ghc]}} allow_failures:- - env: GHCVER=7.10.1 CABALVER=1.22 HAPPYVER=1.19.4 ALEXVER=3.1.3- - env: GHCVER=head CABALVER=head HAPPYVER=1.19.4 ALEXVER=3.1.3+ - env: CABALVER=1.22 GHCVER=head HAPPYVER=1.19.5 before_install:- - travis_retry sudo add-apt-repository -y ppa:hvr/ghc- - travis_retry sudo apt-get update- - travis_retry sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER happy-$HAPPYVER alex-$ALEXVER- - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:/opt/happy/$HAPPYVER/bin:/opt/alex/$ALEXVER/bin:$HOME/.cabal/bin:$PATH- - cabal --version+ - unset CC+ - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:/opt/happy/$HAPPYVER/bin:$PATH install:- - travis_retry cabal update- - travis_retry git clone https://github.com/seereason/haskell-src-meta- - cabal install -j2 ./haskell-src-meta- - cabal install --only-dependencies --enable-tests --constraint="Cabal==$CABALVER.*"+ - cabal --version+ - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"+ - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];+ then+ zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >+ $HOME/.cabal/packages/hackage.haskell.org/00-index.tar;+ fi+ - travis_retry cabal update -v+ - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config+ - cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt+ - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt +# check whether current requested install-plan matches cached package-db snapshot+ - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;+ then+ echo "cabal build-cache HIT";+ rm -rfv .ghc;+ cp -a $HOME/.cabsnap/ghc $HOME/.ghc;+ cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;+ else+ echo "cabal build-cache MISS";+ rm -rf $HOME/.cabsnap;+ mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;+ cabal install --only-dependencies --enable-tests --enable-benchmarks;+ fi++# snapshot package-db on cache miss+ - if [ ! -d $HOME/.cabsnap ];+ then+ echo "snapshotting package-db to build-cache";+ mkdir $HOME/.cabsnap;+ cp -a $HOME/.ghc $HOME/.cabsnap/ghc;+ cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;+ fi++# Here starts the actual work to be performed for the package under test;+# any command which exits with a non-zero exit code causes the build to fail. script:- - cabal configure --enable-tests- - cabal build+ - if [ -f configure.ac ]; then autoreconf -i; fi+ - cabal configure --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging+ - cabal build # this builds all libraries and executables (including tests/benchmarks) - cabal test+ - cabal check+ - cabal sdist # tests that a source-distribution can be generated++# Check that the resulting source distribution can be built & installed.+# If there are no other `.tar.gz` files in `dist`, this can be even simpler:+# `cabal install --force-reinstalls dist/*-*.tar.gz`+ - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&+ (cd dist && cabal install --force-reinstalls "$SRC_TGZ")++# EOF
hsx2hs.cabal view
@@ -1,5 +1,5 @@ Name: hsx2hs-Version: 0.13.3.2+Version: 0.13.4 License: BSD3 License-File: LICENSE Author: Niklas Broberg, Joel Bjornson@@ -29,7 +29,7 @@ Homepage: https://github.com/seereason/hsx2hs -Tested-With: GHC==7.6.3, GHC==7.8.2+Tested-With: GHC==7.6.3, GHC==7.8.4, GHC==7.10.3 Cabal-Version: >= 1.6 Build-Type: Simple Extra-source-files: .travis.yml@@ -43,7 +43,7 @@ Library Build-depends: mtl >= 2.0 && < 2.3,- haskell-src-exts >= 1.16 && < 1.17,+ haskell-src-exts >= 1.16 && < 1.18, haskell-src-meta >= 0.6 && < 0.7, template-haskell >= 2.7 && < 2.11, bytestring,
src/Language/Haskell/HSX/QQ.hs view
@@ -67,6 +67,9 @@ parseMode :: ParseMode parseMode = ParseMode "" Haskell2010 allExtensions False True (Just baseFixities)+#if MIN_VERSION_haskell_src_exts(1,17,0)+ False+#endif allExtensions :: [Extension] allExtensions = map EnableExtension
src/Language/Haskell/HSX/Transform.hs view
@@ -13,6 +13,8 @@ -- other words, we transform away regular patterns. ----------------------------------------------------------------------------- +{-# LANGUAGE CPP #-}+ module Language.Haskell.HSX.Transform ( transform -- :: HsModule -> HsModule , transformExp@@ -116,8 +118,15 @@ -- Transform declarations in the where clause, adding any generated -- declarations to it decls' <- case decls of+#if MIN_VERSION_haskell_src_exts(1,17,0)+ Nothing -> return Nothing+ Just (BDecls ds)+ -> do ds' <- transformLetDecls ds+ return $ Just $ BDecls $ decls'' ++ ds'+#else BDecls ds -> do ds' <- transformLetDecls ds return $ BDecls $ decls'' ++ ds'+#endif _ -> error "Cannot bind implicit parameters in the \ \ \'where\' clause of a function using regular patterns." return $ PatBind srcloc pat'' rhs' decls'@@ -170,8 +179,15 @@ -- Transform declarations in the where clause, adding any generated -- declarations to it decls' <- case decls of+#if MIN_VERSION_haskell_src_exts(1,17,0)+ Nothing -> return Nothing+ Just (BDecls ds)+ -> do ds' <- transformLetDecls ds+ return $ Just $ BDecls $ decls'' ++ ds'+#else BDecls ds -> do ds' <- transformLetDecls ds return $ BDecls $ decls'' ++ ds'+#endif _ -> error "Cannot bind implicit parameters in the \ \ \'where\' clause of a function using regular patterns." @@ -451,10 +467,19 @@ -- Any declarations already in place should be left where they -- are since they probably refer to the generating right-hand -- side of the pattern bind. If they don't, we're in trouble...+#if MIN_VERSION_haskell_src_exts(1,17,0)+ Nothing -> return Nothing+ Just (BDecls decls) -> fmap (Just . BDecls) $ transformLetDecls decls+#else BDecls decls -> fmap BDecls $ transformLetDecls decls+#endif -- If they are implicit parameter bindings we simply transform -- them as such.+#if MIN_VERSION_haskell_src_exts(1,17,0)+ Just (IPBinds decls) -> fmap (Just . IPBinds) $ mapM transformIPBind decls+#else IPBinds decls -> fmap IPBinds $ mapM transformIPBind decls+#endif -- The generated guard, if any, should be a declaration, and the -- generated declarations should be associated with it. let gs' = case gs of@@ -574,8 +599,14 @@ -- Transform declarations in the where clause, adding any generated -- declarations to it. decls' <- case decls of+#if MIN_VERSION_haskell_src_exts(1,17,0)+ Nothing -> return Nothing+ Just (BDecls ds) -> do ds' <- mapM transformDecl ds+ return $ Just $ BDecls $ decls'' ++ ds+#else BDecls ds -> do ds' <- mapM transformDecl ds return $ BDecls $ decls'' ++ ds+#endif _ -> error "Cannot bind implicit parameters in the \ \ \'where\' clause of a function using regular patterns." @@ -1191,7 +1222,11 @@ -- match the given pattern let alt1 = altGW s p gs -- foo -> Just (mf foo) (app (con just_name) $+#if MIN_VERSION_haskell_src_exts(1,17,0)+ tuple (map (retVar b) vs)) (binds [])+#else tuple (map (retVar b) vs)) noBinds+#endif -- .. and finally an alternative for not matching the pattern. alt2 = alt s wildcard (con nothing_name) -- _ -> Nothing -- ... and that pattern could itself contain regular patterns
src/hsx2hs.hs view
@@ -82,7 +82,11 @@ transform $ checkParse $ parse fp fc parse :: String -> String -> ParseResult Module-parse fn fc = parseModuleWithMode (ParseMode fn Haskell2010 allExtensions False True (Just baseFixities)) fcuc+parse fn fc = parseModuleWithMode (ParseMode fn Haskell2010 allExtensions False True (Just baseFixities)+#if MIN_VERSION_haskell_src_exts(1,17,0)+ False+#endif+ ) fcuc where fcuc= unlines $ filter (not . isPrefixOf "#") $ lines fc usageString :: String