git.iko.soy/haskell-generate
on 7df7171 help sign in
7 files changed+16−28
since splitsnapshots
unifiedsplit
.travis.yml+3−5 LICENSE+1−1 README.md+1 haskell-generate.cabal+6−9 src/Language/Haskell/Generate/Monad.hs+3−11 src/Language/Haskell/Generate/PreludeDef.hs−1 tests/doctests.hsc+2−1
.travis.yml+3−5
@@ -1,9 +1,7 @@
11env:
22 - GHCVER=7.4.2 CABALVER=1.16
33 - GHCVER=7.6.3 CABALVER=1.18
4− - GHCVER=7.8.3 CABALVER=1.20
5− - GHCVER=7.10.2 CABALVER=1.22
6− - GHCVER=head CABALVER=1.22
4+ - GHCVER=head CABALVER=1.18
75
86before_install:
97 - sudo add-apt-repository -y ppa:hvr/ghc
@@ -22,5 +20,5 @@ script:
2220
2321matrix:
2422 allow_failures:
25− - env: GHCVER=head CABALVER=1.22
26− fast_finish: true
23+ - env: GHCVER=head CABALVER=1.18
24+ fast_finish: true
LICENSE+1−1
@@ -1,4 +1,4 @@
1−Copyright 2013-2015 Benno Fünfstück
1+Copyright 2013-2014 Benno Fünfstück
22
33All rights reserved.
44
README.md+1
@@ -102,3 +102,4 @@ declareFunction 'permutations -- This generates the same code as above, but is m
102102## Contributing
103103
104104If you have an idea, a question or a bug report, open an issue on github. You can also find me on freenode in the #haskell channel, my nick is bennofs.
105+
haskell-generate.cabal+6−9
@@ -1,5 +1,5 @@
11name: haskell-generate
2−version: 0.2.4
2+version: 0.2.1
33license: BSD3
44category: Code Generation, Language
55cabal-version: >= 1.10
@@ -9,13 +9,9 @@ maintainer: Benno Fünfstück <benno.fuenfstueck@gmail.com>
99stability: experimental
1010homepage: http://github.com/bennofs/haskell-generate/
1111bug-reports: http://github.com/bennofs/haskell-generate/issues
12−copyright: Copyright (C) 2013-2015 Benno Fünfstück
13−synopsis: Typesafe generation of haskell source code
14−description:
15− 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
18− introduction explaining how to use the library.
12+copyright: Copyright (C) 2013 Benno Fünfstück
13+synopsis: haskell-generate
14+description: haskell-generate
1915build-type: Custom
2016
2117extra-source-files:
@@ -45,7 +41,6 @@ library
4541 Language.Haskell.Generate.Expression
4642 Language.Haskell.Generate.TH
4743 Language.Haskell.Generate.PreludeDef
48− other-extensions: TemplateHaskell
4944
5045test-suite doctests
5146 type: exitcode-stdio-1.0
@@ -57,4 +52,6 @@ test-suite doctests
5752 , doctest >= 0.9.1
5853 , filepath
5954 ghc-options: -Wall -threaded
55+ if impl(ghc<7.6.1)
56+ ghc-options: -Werror
6057 hs-source-dirs: tests
src/Language/Haskell/Generate/Monad.hs+3−11
@@ -36,8 +36,6 @@ import Language.Haskell.Exts.SrcLoc
3636import Language.Haskell.Exts.Syntax
3737import Language.Haskell.Generate.Expression
3838
39−import Prelude
40−
4139--------------------------------------------------------------------------------
4240-- Generate expressions
4341
@@ -64,11 +62,9 @@ generateExp = prettyPrint . runExpression . fst . runGenerate
6462caseE :: ExpG x -> [(Pat, ExpG t)] -> ExpG t
6563caseE v alt = do
6664 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)
65+#if MIN_VERSION_haskell_src_exts(1,16,0)
7066 alt' <- mapM (\(p,a) -> fmap (\a' -> Alt noLoc p (UnGuardedRhs $ runExpression a') (BDecls [])) a) alt
71−#else
67+#else
7268 alt' <- mapM (\(p,a) -> fmap (\a' -> Alt noLoc p (UnGuardedAlt $ runExpression a') (BDecls [])) a) alt
7369#endif
7470 return $ Expression $ Case (runExpression v') alt'
@@ -214,7 +210,7 @@ instance GenExp (FunRef t) where
214210
215211-- | Generate a ExportSpec for a given function item.
216212exportFun :: FunRef t -> ExportSpec
217−#if MIN_VERSION_haskell_src_exts(1,16,0) && !MIN_VERSION_haskell_src_exts(1,17,0)
213+#if MIN_VERSION_haskell_src_exts(1,16,0)
218214exportFun (FunRef name) = EVar NoNamespace (UnQual name)
219215#else
220216exportFun (FunRef name) = EVar (UnQual name)
@@ -224,11 +220,7 @@ exportFun (FunRef name) = EVar (UnQual name)
224220addDecl :: Name -> ExpG t -> ModuleM (FunRef t)
225221addDecl name e = ModuleM $ do
226222 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
230223 tell (mods, [FunBind [Match noLoc name [] Nothing (UnGuardedRhs $ runExpression body) $ BDecls []]])
231−#endif
232224 return $ FunRef name
233225
234226-- | Extract the Module from a module generator.
src/Language/Haskell/Generate/PreludeDef.hs−1
@@ -60,7 +60,6 @@ fmap concat $ mapM declareNamedSymbol
6060 , ('(++), "append'")
6161 , ('(!!), "index'")
6262 , ('(==), "equal'")
63− , ('(/=), "notequal'")
6463 ]
6564
6665(<>.) :: ExpG (b -> c) -> ExpG (a -> b) -> ExpG (a -> c)
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