-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3fd99a2
Showing
13 changed files
with
277 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
:set -isrc -idist/build/autogen -optP-include -optPdist/build/autogen/cabal_macros.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
dist | ||
docs | ||
wiki | ||
TAGS | ||
tags | ||
wip | ||
.DS_Store | ||
.*.swp | ||
.*.swo | ||
*.o | ||
*.hi | ||
*~ | ||
*# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
language: haskell | ||
before_install: | ||
# Uncomment whenever hackage is down. | ||
# - mkdir -p ~/.cabal && cp travis/config ~/.cabal/config && cabal update | ||
|
||
# Try installing some of the build-deps with apt-get for speed. | ||
- travis/cabal-apt-install --only-dependencies --force-reinstall $mode | ||
|
||
- sudo apt-get -q -y install hlint || cabal install hlint | ||
|
||
install: | ||
- cabal configure $mode | ||
- cabal build | ||
|
||
script: | ||
- $script | ||
- hlint src --cpp-define HLINT | ||
|
||
notifications: | ||
irc: | ||
channels: | ||
- "irc.freenode.org#haskell-lens" | ||
skip_join: true | ||
template: | ||
- "\x0313foo\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}" | ||
|
||
env: | ||
- mode="--enable-tests" script="cabal test" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
" Add the following to your .vimrc to automatically load this on startup | ||
|
||
" if filereadable(".vim.custom") | ||
" so .vim.custom | ||
" endif | ||
|
||
function StripTrailingWhitespace() | ||
let myline=line(".") | ||
let mycolumn = col(".") | ||
silent %s/ *$// | ||
call cursor(myline, mycolumn) | ||
endfunction | ||
|
||
" enable syntax highlighting | ||
syntax on | ||
|
||
" search for the tags file anywhere between here and / | ||
set tags=TAGS;/ | ||
|
||
" highlight tabs and trailing spaces | ||
set listchars=tab:‗‗,trail:‗ | ||
set list | ||
|
||
" f2 runs hasktags | ||
map <F2> :exec ":!hasktags -x -c --ignore src"<CR><CR> | ||
|
||
" strip trailing whitespace before saving | ||
" au BufWritePre *.hs,*.markdown silent! cal StripTrailingWhitespace() | ||
|
||
" rebuild hasktags after saving | ||
au BufWritePost *.hs silent! :exec ":!hasktags -x -c --ignore src" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
0.1 | ||
--- | ||
* Repository initialized |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import "hint" HLint.Default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Copyright 2011 Edward Kmett | ||
|
||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
|
||
1. Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the author nor the names of his contributors | ||
may be used to endorse or promote products derived from this software | ||
without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR | ||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
foo | ||
=== | ||
|
||
[![Build Status](https://secure.travis-ci.org/ekmett/foo.png?branch=master)](http://travis-ci.org/ekmett/foo) | ||
|
||
Contact Information | ||
------------------- | ||
|
||
Contributions and bug reports are welcome! | ||
|
||
Please feel free to contact me through github or on the #haskell IRC channel on irc.freenode.net. | ||
|
||
-Edward Kmett |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/runhaskell | ||
\begin{code} | ||
{-# OPTIONS_GHC -Wall #-} | ||
module Main (main) where | ||
|
||
import Data.List ( nub ) | ||
import Data.Version ( showVersion ) | ||
import Distribution.Package ( PackageName(PackageName), PackageId, InstalledPackageId, packageVersion, packageName ) | ||
import Distribution.PackageDescription ( PackageDescription(), TestSuite(..) ) | ||
import Distribution.Simple ( defaultMainWithHooks, UserHooks(..), simpleUserHooks ) | ||
import Distribution.Simple.Utils ( rewriteFile, createDirectoryIfMissingVerbose ) | ||
import Distribution.Simple.BuildPaths ( autogenModulesDir ) | ||
import Distribution.Simple.Setup ( BuildFlags(buildVerbosity), fromFlag ) | ||
import Distribution.Simple.LocalBuildInfo ( withLibLBI, withTestLBI, LocalBuildInfo(), ComponentLocalBuildInfo(componentPackageDeps) ) | ||
import Distribution.Verbosity ( Verbosity ) | ||
import System.FilePath ( (</>) ) | ||
|
||
main :: IO () | ||
main = defaultMainWithHooks simpleUserHooks | ||
{ buildHook = \pkg lbi hooks flags -> do | ||
generateBuildModule (fromFlag (buildVerbosity flags)) pkg lbi | ||
buildHook simpleUserHooks pkg lbi hooks flags | ||
} | ||
|
||
generateBuildModule :: Verbosity -> PackageDescription -> LocalBuildInfo -> IO () | ||
generateBuildModule verbosity pkg lbi = do | ||
let dir = autogenModulesDir lbi | ||
createDirectoryIfMissingVerbose verbosity True dir | ||
withLibLBI pkg lbi $ \_ libcfg -> do | ||
withTestLBI pkg lbi $ \suite suitecfg -> do | ||
rewriteFile (dir </> "Build_" ++ testName suite ++ ".hs") $ unlines | ||
[ "module Build_" ++ testName suite ++ " where" | ||
, "deps :: [String]" | ||
, "deps = " ++ (show $ formatdeps (testDeps libcfg suitecfg)) | ||
] | ||
where | ||
formatdeps = map (formatone . snd) | ||
formatone p = case packageName p of | ||
PackageName n -> n ++ "-" ++ showVersion (packageVersion p) | ||
|
||
testDeps :: ComponentLocalBuildInfo -> ComponentLocalBuildInfo -> [(InstalledPackageId, PackageId)] | ||
testDeps xs ys = nub $ componentPackageDeps xs ++ componentPackageDeps ys | ||
|
||
\end{code} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: foo | ||
category: foo | ||
version: 0.1 | ||
license: BSD3 | ||
cabal-version: >= 1.10 | ||
license-file: LICENSE | ||
author: Edward A. Kmett | ||
maintainer: Edward A. Kmett <[email protected]> | ||
stability: experimental | ||
homepage: http://github.com/ekmett/foo/ | ||
bug-reports: http://github.com/ekmett/foo/issues | ||
copyright: Copyright (C) 2013 Edward A. Kmett | ||
synopsis: foo | ||
description: foo | ||
build-type: Custom | ||
|
||
extra-source-files: | ||
.ghci | ||
.gitignore | ||
.travis.yml | ||
.vim.custom | ||
CHANGELOG.markdown | ||
HLint.hs | ||
README.markdown | ||
travis/cabal-apt-install | ||
travis/config | ||
|
||
source-repository head | ||
type: git | ||
location: git://github.com/ekmett/foo.git | ||
|
||
library | ||
hs-source-dirs: src | ||
default-language: Haskell2010 | ||
ghc-options: -Wall | ||
build-depends: | ||
base >= 4.4 && < 5 | ||
|
||
test-suite doctests | ||
type: exitcode-stdio-1.0 | ||
main-is: doctests.hs | ||
default-language: Haskell2010 | ||
build-depends: | ||
base, | ||
directory >= 1.0, | ||
doctest >= 0.9.1, | ||
filepath | ||
ghc-options: -Wall -threaded | ||
if impl(ghc<7.6.1) | ||
ghc-options: -Werror | ||
hs-source-dirs: tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module Main where | ||
|
||
import Build_doctests (deps) | ||
import Control.Applicative | ||
import Control.Monad | ||
import Data.List | ||
import System.Directory | ||
import System.FilePath | ||
import Test.DocTest | ||
|
||
main :: IO () | ||
main = getSources >>= \sources -> doctest $ | ||
"-isrc" | ||
: "-idist/build/autogen" | ||
: "-optP-include" | ||
: "-optPdist/build/autogen/cabal_macros.h" | ||
: "-hide-all-packages" | ||
: map ("-package="++) deps ++ sources | ||
|
||
getSources :: IO [FilePath] | ||
getSources = filter (isSuffixOf ".hs") <$> go "src" | ||
where | ||
go dir = do | ||
(dirs, files) <- getFilesAndDirectories dir | ||
(files ++) . concat <$> mapM go dirs | ||
|
||
getFilesAndDirectories :: FilePath -> IO ([FilePath], [FilePath]) | ||
getFilesAndDirectories dir = do | ||
c <- map (dir </>) . filter (`notElem` ["..", "."]) <$> getDirectoryContents dir | ||
(,) <$> filterM doesDirectoryExist c <*> filterM doesFileExist c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
set -eu | ||
|
||
sudo apt-get -q update | ||
sudo apt-get -q -y install dctrl-tools | ||
|
||
# Try installing some of the build-deps with apt-get for speed. | ||
eval "$( | ||
printf '%s' "grep-aptavail -n -sPackage '(' -FFALSE -X FALSE ')'" | ||
2>/dev/null cabal install "$@" --dry-run -v | \ | ||
sed -nre "s/^([^ ]+)-[0-9.]+ \(.*$/ -o '(' -FPackage -X libghc-\1-dev ')'/p" | \ | ||
xargs -d'\n' | ||
)" | sort -u | xargs -d'\n' sudo apt-get -q -y install -- libghc-quickcheck2-dev | ||
|
||
# Install whatever is still needed with cabal. | ||
cabal install "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
-- This provides a custom ~/.cabal/config file for use when hackage is down that should work on unix | ||
-- | ||
-- This is particularly useful for travis-ci to get it to stop complaining | ||
-- about a broken build when everything is still correct on our end. | ||
-- | ||
-- This uses Luite Stegeman's mirror of hackage provided by his 'hdiff' site instead | ||
-- | ||
-- To enable this, uncomment the before_script in .travis.yml | ||
|
||
remote-repo: hdiff.luite.com:http://hdiff.luite.com/packages/archive | ||
remote-repo-cache: ~/.cabal/packages | ||
world-file: ~/.cabal/world | ||
build-summary: ~/.cabal/logs/build.log | ||
remote-build-reporting: anonymous | ||
install-dirs user | ||
install-dirs global |