Skip to content

Commit b92a08e

Browse files
committed
Remove executables
1 parent 0ab755c commit b92a08e

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
lines changed

bloomfilter/examples/spell.hs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
{-# LANGUAGE BangPatterns #-}
22
module Main (main) where
33

4-
import Control.Monad (forM_, when)
4+
import Control.Monad (forM_, unless, when)
55
import System.Environment (getArgs)
66

77
import qualified Data.BloomFilter as B
88

99
main :: IO ()
1010
main = do
1111
files <- getArgs
12-
dictionary <- readFile "/usr/share/dict/words"
13-
let !bloom = B.fromList (B.policyForFPR 0.01) (words dictionary)
14-
forM_ files $ \file ->
15-
putStrLn . unlines . filter (`B.notElem` bloom) . words
16-
=<< readFile file
12+
unless (null files) $ do
13+
dictionary <- readFile "/usr/share/dict/words"
14+
let !bloom = B.fromList (B.policyForFPR 0.01) (words dictionary)
15+
forM_ files $ \file ->
16+
putStrLn . unlines . filter (`B.notElem` bloom) . words
17+
=<< readFile file

bloomfilter/tests/fpr-calc.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import qualified Data.IntSet as IntSet
1212
import Data.List (unfoldr)
1313
import Math.Regression.Simple
1414
import System.Environment (getArgs)
15-
import System.Exit (exitFailure)
1615
import System.IO
1716
import System.Random
1817

@@ -29,7 +28,8 @@ main = do
2928
["Regression"] -> main_regression
3029
_ -> do
3130
putStrLn "Usage: bloomfilter-fpr-calc [Generate|Regression]"
32-
exitFailure
31+
-- NOTE: we expicitly don't use exitFailure here because
32+
-- @bloomfilter-fpr-calc@ is a cabal @test-suite@.
3333

3434
main_regression :: IO ()
3535
main_regression = do

lsm-tree.cabal

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -692,9 +692,14 @@ benchmark bloomfilter-bench
692692
, lsm-tree:bloomfilter
693693
, random
694694

695-
executable bloomfilter-fpr-calc
695+
-- TODO: ideally this should be an executable because it's not really testing
696+
-- anything, but if we make it an executable component then the solver takes the
697+
-- build-depends into account when building the public library, which is not
698+
-- desirable. Maybe these executables should be moved out into a separate
699+
-- package?
700+
test-suite bloomfilter-fpr-calc
696701
import: language, warnings
697-
scope: private
702+
type: exitcode-stdio-1.0
698703
hs-source-dirs: bloomfilter/tests
699704
main-is: fpr-calc.hs
700705
build-depends:
@@ -707,9 +712,14 @@ executable bloomfilter-fpr-calc
707712

708713
ghc-options: -threaded
709714

710-
executable bloomfilter-spell
715+
-- TODO: ideally this should be an executable because it's not really testing
716+
-- anything, but if we make it an executable component then the solver takes the
717+
-- build-depends into account when building the public library, which is not
718+
-- desirable. Maybe these executables should be moved out into a separate
719+
-- package?
720+
test-suite bloomfilter-spell
711721
import: language
712-
scope: private
722+
type: exitcode-stdio-1.0
713723
hs-source-dirs: bloomfilter/examples
714724
main-is: spell.hs
715725
build-depends:

0 commit comments

Comments
 (0)