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
*.hp
Setup
.stack-work

View file

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

View file

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