add stack file

This commit is contained in:
Sönke Hahn 2015-07-25 17:22:05 +08:00
parent 2cf2d08cd3
commit e24cb9ddf6
5 changed files with 71 additions and 35 deletions

1
.gitignore vendored
View file

@ -22,3 +22,4 @@ cabal.config
*.aux *.aux
*.hp *.hp
Setup Setup
.stack-work

View file

@ -80,7 +80,7 @@ test-suite spec
, lens , lens
, servant-js , servant-js
, servant , servant
, hspec >= 2.0 , hspec >= 2.1.8
, hspec-expectations , hspec-expectations
, language-ecmascript >= 0.16 , language-ecmascript >= 0.16
default-language: Haskell2010 default-language: Haskell2010

View file

@ -9,23 +9,33 @@ import Test.DocTest
main :: IO () main :: IO ()
main = do main = do
files <- find always (extension ==? ".hs") "src" files <- find always (extension ==? ".hs") "src"
cabalMacrosFile <- getCabalMacrosFile mCabalMacrosFile <- getCabalMacrosFile
doctest $ [ "-isrc" doctest $ "-isrc" :
, "-optP-include" (maybe [] (\ f -> ["-optP-include", "-optP" ++ f]) mCabalMacrosFile) ++
, "-optP" ++ cabalMacrosFile "-XOverloadedStrings" :
, "-XOverloadedStrings" "-XFlexibleInstances" :
, "-XFlexibleInstances" "-XMultiParamTypeClasses" :
, "-XMultiParamTypeClasses" "-XDataKinds" :
, "-XDataKinds" "-XTypeOperators" :
, "-XTypeOperators" files
] ++ files
getCabalMacrosFile :: IO FilePath getCabalMacrosFile :: IO (Maybe FilePath)
getCabalMacrosFile = do getCabalMacrosFile = do
contents <- getDirectoryContents "dist" exists <- doesDirectoryExist "dist"
let rest = "build" </> "autogen" </> "cabal_macros.h" if exists
return $ case filter ("dist-sandbox-" `isPrefixOf`) contents of then do
[x] -> "dist" </> x </> rest contents <- getDirectoryContents "dist"
[] -> "dist" </> rest let rest = "build" </> "autogen" </> "cabal_macros.h"
xs -> error $ "ran doctests with multiple dist/dist-sandbox-xxxxx's: \n" whenExists $ case filter ("dist-sandbox-" `isPrefixOf`) contents of
++ show xs ++ "\nTry cabal clean" [x] -> "dist" </> x </> rest
[] -> "dist" </> rest
xs -> error $ "ran doctests with multiple dist/dist-sandbox-xxxxx's: \n"
++ show xs ++ "\nTry cabal clean"
else return Nothing
where
whenExists :: FilePath -> IO (Maybe FilePath)
whenExists file = do
exists <- doesFileExist file
return $ if exists
then Just file
else Nothing

View file

@ -9,21 +9,31 @@ import Test.DocTest
main :: IO () main :: IO ()
main = do main = do
files <- find always (extension ==? ".hs") "src" files <- find always (extension ==? ".hs") "src"
cabalMacrosFile <- getCabalMacrosFile mCabalMacrosFile <- getCabalMacrosFile
doctest $ [ "-isrc" doctest $ "-isrc" :
, "-optP-include" (maybe [] (\ f -> ["-optP-include", "-optP" ++ f]) mCabalMacrosFile) ++
, "-optP" ++ cabalMacrosFile "-XOverloadedStrings" :
, "-XOverloadedStrings" "-XFlexibleInstances" :
, "-XFlexibleInstances" "-XMultiParamTypeClasses" :
, "-XMultiParamTypeClasses" files
] ++ files
getCabalMacrosFile :: IO FilePath getCabalMacrosFile :: IO (Maybe FilePath)
getCabalMacrosFile = do getCabalMacrosFile = do
contents <- getDirectoryContents "dist" exists <- doesDirectoryExist "dist"
let rest = "build" </> "autogen" </> "cabal_macros.h" if exists
return $ case filter ("dist-sandbox-" `isPrefixOf`) contents of then do
[x] -> "dist" </> x </> rest contents <- getDirectoryContents "dist"
[] -> "dist" </> rest let rest = "build" </> "autogen" </> "cabal_macros.h"
xs -> error $ "ran doctests with multiple dist/dist-sandbox-xxxxx's: \n" whenExists $ case filter ("dist-sandbox-" `isPrefixOf`) contents of
++ show xs ++ "\nTry cabal clean" [x] -> "dist" </> x </> rest
[] -> "dist" </> rest
xs -> error $ "ran doctests with multiple dist/dist-sandbox-xxxxx's: \n"
++ show xs ++ "\nTry cabal clean"
else return Nothing
where
whenExists :: FilePath -> IO (Maybe FilePath)
whenExists file = do
exists <- doesFileExist file
return $ if exists
then Just file
else Nothing

15
stack.yaml Normal file
View file

@ -0,0 +1,15 @@
flags:
servant-js:
example: false
packages:
- servant/
- servant-blaze/
- servant-client/
- servant-docs/
- servant-examples/
- servant-js/
- servant-lucid/
- servant-mock/
- servant-server/
extra-deps: []
resolver: nightly-2015-07-24