git.iko.soy/haskell-generate
on 3bd820f help sign in
4 files changed+12−17
since splitsnapshots
unifiedsplit
.travis.yml+3−4 haskell-generate.cabal+4−3 src/Language/Haskell/Generate/Monad.hs+3−9 tests/doctests.hsc+2−1
.travis.yml+3−4
@@ -2,8 +2,7 @@ env:
22 - GHCVER=7.4.2 CABALVER=1.16
33 - GHCVER=7.6.3 CABALVER=1.18
44 - GHCVER=7.8.3 CABALVER=1.20
5− - GHCVER=7.10.2 CABALVER=1.22
6− - GHCVER=head CABALVER=1.22
5+ - GHCVER=head CABALVER=1.20
76
87before_install:
98 - sudo add-apt-repository -y ppa:hvr/ghc
@@ -22,5 +21,5 @@ script:
2221
2322matrix:
2423 allow_failures:
25− - env: GHCVER=head CABALVER=1.22
26− fast_finish: true
24+ - env: GHCVER=head CABALVER=1.20
25+ fast_finish: true
haskell-generate.cabal+4−3
@@ -1,5 +1,5 @@
11name: haskell-generate
2−version: 0.2.4
2+version: 0.2.3
33license: BSD3
44category: Code Generation, Language
55cabal-version: >= 1.10
@@ -13,8 +13,7 @@ copyright: Copyright (C) 2013-2015 Benno Fünfstück
1313synopsis: Typesafe generation of haskell source code
1414description:
1515 This library provides an interface to generate haskell source code, verifying at compile time
16− that the resulting code typechecks.
17− See <https://github.com/bennofs/haskell-generate haskell-generate> for an
16+ that the resulting code typechecks. See https://github.com/bennofs/haskell-generate for an
1817 introduction explaining how to use the library.
1918build-type: Custom
2019
@@ -57,4 +56,6 @@ test-suite doctests
5756 , doctest >= 0.9.1
5857 , filepath
5958 ghc-options: -Wall -threaded
59+ if impl(ghc<7.6.1)
60+ ghc-options: -Werror
6061 hs-source-dirs: tests
src/Language/Haskell/Generate/Monad.hs+3−9
@@ -64,11 +64,9 @@ generateExp = prettyPrint . runExpression . fst . runGenerate
6464caseE :: ExpG x -> [(Pat, ExpG t)] -> ExpG t
6565caseE v alt = do
6666 v' <- v
67−#if MIN_VERSION_haskell_src_exts(1,17,0)
68− alt' <- mapM (\(p,a) -> fmap (\a' -> Alt noLoc p (UnGuardedRhs $ runExpression a') Nothing) a) alt
69−#elif MIN_VERSION_haskell_src_exts(1,16,0)
67+#if MIN_VERSION_haskell_src_exts(1,16,0)
7068 alt' <- mapM (\(p,a) -> fmap (\a' -> Alt noLoc p (UnGuardedRhs $ runExpression a') (BDecls [])) a) alt
71−#else
69+#else
7270 alt' <- mapM (\(p,a) -> fmap (\a' -> Alt noLoc p (UnGuardedAlt $ runExpression a') (BDecls [])) a) alt
7371#endif
7472 return $ Expression $ Case (runExpression v') alt'
@@ -214,7 +212,7 @@ instance GenExp (FunRef t) where
214212
215213-- | Generate a ExportSpec for a given function item.
216214exportFun :: FunRef t -> ExportSpec
217−#if MIN_VERSION_haskell_src_exts(1,16,0) && !MIN_VERSION_haskell_src_exts(1,17,0)
215+#if MIN_VERSION_haskell_src_exts(1,16,0)
218216exportFun (FunRef name) = EVar NoNamespace (UnQual name)
219217#else
220218exportFun (FunRef name) = EVar (UnQual name)
@@ -224,11 +222,7 @@ exportFun (FunRef name) = EVar (UnQual name)
224222addDecl :: Name -> ExpG t -> ModuleM (FunRef t)
225223addDecl name e = ModuleM $ do
226224 let (body, mods) = runGenerate e
227−#if MIN_VERSION_haskell_src_exts(1,17,0)
228− tell (mods, [FunBind [Match noLoc name [] Nothing (UnGuardedRhs $ runExpression body) Nothing]])
229−#else
230225 tell (mods, [FunBind [Match noLoc name [] Nothing (UnGuardedRhs $ runExpression body) $ BDecls []]])
231−#endif
232226 return $ FunRef name
233227
234228-- | Extract the Module from a module generator.
tests/doctests.hsc+2−1
@@ -20,17 +20,18 @@ import Data.List
2020import System.Directory
2121import System.FilePath
2222import Test.DocTest
23−import Prelude
2423
2524##ifdef mingw32_HOST_ARCH
2625##ifdef i386_HOST_ARCH
2726##define USE_CP
27+import Control.Applicative
2828import Control.Exception
2929import Foreign.C.Types
3030foreign import stdcall "windows.h SetConsoleCP" c_SetConsoleCP :: CUInt -> IO Bool
3131foreign import stdcall "windows.h GetConsoleCP" c_GetConsoleCP :: IO CUInt
3232##elif defined(x86_64_HOST_ARCH)
3333##define USE_CP
34+import Control.Applicative
3435import Control.Exception
3536import Foreign.C.Types
3637foreign import ccall "windows.h SetConsoleCP" c_SetConsoleCP :: CUInt -> IO Bool