Skip to content

Commit cae9772

Browse files
committed
Initial project setup
1 parent aa38eaa commit cae9772

File tree

12 files changed

+285
-0
lines changed

12 files changed

+285
-0
lines changed

.ghci

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import System.FSNotify
2+
import Data.String
3+
import Control.Concurrent.MVar
4+
import Control.Concurrent
5+
6+
:{
7+
:def test const (withManager (\manager ->
8+
do putStrLn "Listening to changes, press any key to stop..."
9+
lock <- newEmptyMVar
10+
watchTree manager (fromString ".") (const True) (const $ putMVar lock True)
11+
forkIO (getLine >> putMVar lock False)
12+
rerun <- readMVar lock
13+
return $ if rerun
14+
then ":reload \n :main \n :test"
15+
else ""
16+
))
17+
:}

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Enforce LF line endings.
2+
* text=auto

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
dist
2+
cabal-dev
3+
*.o
4+
*.hi
5+
*.chi
6+
*.chs.h
7+
.virthualenv
8+
.cabal-sandbox
9+
.hpc
10+
cabal.sandbox.config
11+
*.log
12+
.#*

.travis.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
language: haskell
2+
3+
before_install:
4+
- cabal install --only-dependencies --enable-tests
5+
- cabal install hpc-coveralls --avoid-reinstalls
6+
7+
script:
8+
- cabal configure --enable-tests --enable-library-coverage
9+
- cabal build
10+
- run-cabal-test --show-details=always
11+
12+
after_script:
13+
- hpc-coveralls --exclude-dir=tests kdb-haskell-hpc

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
No specific guidelines atm.

Makefile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
CABALSANDBOX := ".cabal-sandbox"
2+
3+
.PHONY: bench clean haddock hpc init install repl run test
4+
5+
all: install hpc bench haddock run
6+
7+
bench: install
8+
cabal build
9+
cabal bench --benchmark-options="-o report.html"
10+
11+
clean:
12+
cabal clean
13+
if test -d .cabal-sandbox; then cabal sandbox delete; fi
14+
if test -d .hpc; then rm -r .hpc; fi
15+
16+
haddock:
17+
cabal configure
18+
cabal build
19+
cabal haddock --hyperlink-source
20+
# dist/doc/html/threase/index.html
21+
22+
hpc: test
23+
hpc report dist/hpc/tix/hspec/hspec.tix
24+
hpc markup --destdir=tmp dist/hpc/tix/hspec/hspec.tix
25+
init:
26+
cabal update
27+
cabal sandbox init
28+
29+
install: init
30+
cabal install --enable-benchmarks --enable-tests --flags=documentation --only-dependencies
31+
32+
repl:
33+
cabal configure
34+
cabal build
35+
cabal repl
36+
37+
test: install
38+
cabal configure --enable-tests
39+
cabal build
40+
cabal test

Setup.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import Distribution.Simple
2+
3+
main = defaultMain

benchmarks/Benchmark.hs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
-----------------------------------------------------------------------------
2+
-- |
3+
-- Module : Benchmark
4+
-- Copyright : (c) 2014, Jakub Kozlowski
5+
-- License : MIT
6+
--
7+
-- Maintainer : mail@jakub-kozlowski.com
8+
--
9+
-- All benchmarks.
10+
-----------------------------------------------------------------------------
11+
module Main where
12+
13+
import Criterion.Main
14+
15+
fib :: Int -> Int
16+
fib 0 = 0
17+
fib 1 = 1
18+
fib n = fib (n-1) + fib (n-2)
19+
20+
main :: IO ()
21+
main = defaultMain [
22+
bench "fib 10" $ nf (\n -> fib (10+n-n)) 10
23+
, bench "fib 30" $ nf (\n -> fib (30+n-n)) 30
24+
, bench "fib 35" $ nf (\n -> fib (35+n-n)) 35
25+
]

kdb-haskell.cabal

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: kdb-haskell
2+
version: 0.1.0
3+
synopsis: Haskell bindings for KDB+.
4+
description: This package implements binding for KDB+ database (kx.com) in Haskell.
5+
category: Finance, Database
6+
homepage: https://github.com/jkozlowski/kdb-haskell
7+
bug-reports: https://github.com/jkozlowski/kdb-haskell/issues
8+
license-file: LICENSE
9+
license: MIT
10+
11+
author: Jakub Kozlowski
12+
copyright: 2014 Jakub Kozlowski <mail@jakub-kozlowski.com>
13+
maintainer: mail@jakub-kozlowski.com
14+
15+
build-type: Custom
16+
cabal-version: >= 1.9.2
17+
extra-source-files: LICENCE
18+
README.md
19+
CONTRIBUTING.md
20+
21+
source-repository head
22+
location:
23+
git@github.com:jkozlowski/kdb-haskell.git
24+
type:
25+
git
26+
27+
flag documentation
28+
default:
29+
False
30+
31+
library
32+
exposed-modules: Database.Kdb.Types
33+
default-language: Haskell2010
34+
build-depends: base >= 4 && < 5
35+
, mtl
36+
, bytestring
37+
, text
38+
, containers
39+
, binary
40+
, lens
41+
, QuickCheck == 2.6.*
42+
, directory
43+
hs-source-dirs: src
44+
ghc-options: -Wall
45+
-fwarn-incomplete-patterns
46+
-funbox-strict-fields
47+
48+
test-suite kdb-haskell-hpc
49+
main-is: Test.hs
50+
type: exitcode-stdio-1.0
51+
build-depends: base
52+
, bytestring
53+
, containers
54+
, text
55+
, time
56+
, binary
57+
, mtl
58+
, lens
59+
, tasty == 0.8
60+
, tasty-quickcheck == 0.8
61+
, QuickCheck == 2.6.*
62+
, Cabal >= 1.9.2
63+
Ghc-Options: -Wall
64+
-O0
65+
-fhpc
66+
-hpcdir
67+
dist/hpc/mix/kdb-haskell-tests
68+
-funbox-strict-fields
69+
hs-source-dirs: src
70+
, tests
71+
72+
test-suite kdb-haskell-tests
73+
hs-source-dirs: src
74+
, tests
75+
main-is: Test.hs
76+
type: exitcode-stdio-1.0
77+
build-depends: base
78+
, bytestring
79+
, containers
80+
, text
81+
, time
82+
, binary
83+
, mtl
84+
, lens
85+
, tasty == 0.8
86+
, tasty-quickcheck == 0.8
87+
, QuickCheck == 2.6.*
88+
, Cabal >= 1.9.2
89+
-- Dependencies for rerunning tests in ghci
90+
, fsnotify >= 0.0.11
91+
, system-filepath >= 0.4.7
92+
Ghc-Options: -Wall
93+
-O0
94+
-funbox-strict-fields
95+
96+
benchmark kdb-haskell-benchmark
97+
type: exitcode-stdio-1.0
98+
hs-source-dirs: src
99+
, benchmarks
100+
main-is: Benchmark.hs
101+
build-depends: base
102+
, mtl
103+
, criterion
104+
, random
105+
ghc-options: -Wall
106+
-O2
107+
-funbox-strict-fields

src/Database/Kdb/Types.hs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
-----------------------------------------------------------------------------
2+
-- |
3+
-- Module : Database.Kdb.Types
4+
-- Copyright : (c) 2014, Jakub Dominik Kozlowski
5+
-- License : MIT
6+
--
7+
-- Maintainer : mail@jakub-kozlowski.com
8+
--
9+
-- Main types used throughout the code.
10+
-----------------------------------------------------------------------------
11+
module Database.Kdb.Types (
12+
Kdb
13+
) where
14+
15+
-- | Main Kdb data type.
16+
data Kdb = Bool
17+

0 commit comments

Comments
 (0)