Search is not available for this dataset
repo_name
string
path
string
license
string
full_code
string
full_size
int64
uncommented_code
string
uncommented_size
int64
function_only_code
string
function_only_size
int64
is_commented
bool
is_signatured
bool
n_ast_errors
int64
ast_max_depth
int64
n_whitespaces
int64
n_ast_nodes
int64
n_ast_terminals
int64
n_ast_nonterminals
int64
loc
int64
cycloplexity
int64
jamshidh/ethereum-query
src/State.hs
bsd-3-clause
isNecessary _ = True
20
isNecessary _ = True
20
isNecessary _ = True
20
false
false
0
4
3
10
4
6
null
null
1yefuwang1/haskell99problems
src/H99/Miscellaneous.hs
bsd-3-clause
{- Eight queens problem This is a classical problem in computer science. The objective is to place eight queens on a chessboard so that no two queens are attacking each other; i.e., no two queens are in the same row, the same column, or on the same diagonal. Hint: Represent the positions of the queens as a list of numbers 1..N. Example: [4,2,7,3,6,8,5,1] means that the queen in the first column is in row 4, the queen in the second column is in row 2, etc. Use the generate-and-test paradigm. Example in Haskell: > length (queens 8) 92 > head (queens 8) [1,5,8,6,3,7,2,4] -} queens :: Int -> [[Int]] queens n = placeQueens n where placeQueens 0 = return [] placeQueens n' = do queen <- [1..n] queens' <- placeQueens (n'-1) guard $ isSafe queen queens' return $ queen : queens' isSafe :: Int -> [Int] -> Bool isSafe row qs = row `notElem` qs && all (notDiagonalWith row) (zip qs [1..(length qs)]) where notDiagonalWith row (row', col) = col /= abs (row' - row) {- Problem 91 (**) Knight's tour Another famous problem is this one: How can a knight jump on an NxN chessboard in such a way that it visits every square exactly once? A set of solutions is given on the The_Knights_Tour page. Hints: Represent the squares by pairs of their coordinates of the form X/Y, where both X and Y are integers between 1 and N. (Note that '/' is just a convenient functor, not division!) Define the relation jump(N,X/Y,U/V) to express the fact that a knight can jump from X/Y to U/V on a NxN chessboard. And finally, represent the solution of our problem as a list of N*N knight positions (the knight's tour). There are two variants of this problem: find a tour ending at a particular square find a circular tour, ending a knight's jump from the start (clearly it doesn't matter where you start, so choose (1,1)) Example in Haskell: Knights> head $ knightsTo 8 (1,1) [(2,7),(3,5),(5,6),(4,8),(3,6),(4,4),(6,5),(4,6), (5,4),(7,5),(6,3),(5,5),(4,3),(2,4),(1,6),(2,8), (4,7),(6,8),(8,7),(6,6),(4,5),(6,4),(5,2),(7,1), (8,3),(6,2),(8,1),(7,3),(8,5),(7,7),(5,8),(3,7), (1,8),(2,6),(3,4),(1,5),(2,3),(3,1),(1,2),(3,3), (1,4),(2,2),(4,1),(5,3),(7,4),(8,2),(6,1),(4,2), (2,1),(1,3),(2,5),(1,7),(3,8),(5,7),(7,8),(8,6), (6,7),(8,8),(7,6),(8,4),(7,2),(5,1),(3,2),(1,1)] Knights> head $ closedKnights 8 [(1,1),(3,2),(1,3),(2,1),(3,3),(5,4),(6,6),(4,5), (2,6),(1,8),(3,7),(5,8),(4,6),(2,5),(4,4),(5,6), (6,4),(8,5),(7,7),(6,5),(5,3),(6,1),(4,2),(6,3), (8,2),(7,4),(5,5),(3,4),(1,5),(2,7),(4,8),(3,6), (1,7),(3,8),(5,7),(7,8),(8,6),(6,7),(8,8),(7,6), (8,4),(7,2),(5,1),(4,3),(3,5),(1,4),(2,2),(4,1), (6,2),(8,1),(7,3),(5,2),(7,1),(8,3),(7,5),(8,7), (6,8),(4,7),(2,8),(1,6),(2,4),(1,2),(3,1),(2,3)] -}
2,740
queens :: Int -> [[Int]] queens n = placeQueens n where placeQueens 0 = return [] placeQueens n' = do queen <- [1..n] queens' <- placeQueens (n'-1) guard $ isSafe queen queens' return $ queen : queens' isSafe :: Int -> [Int] -> Bool isSafe row qs = row `notElem` qs && all (notDiagonalWith row) (zip qs [1..(length qs)]) where notDiagonalWith row (row', col) = col /= abs (row' - row) {- Problem 91 (**) Knight's tour Another famous problem is this one: How can a knight jump on an NxN chessboard in such a way that it visits every square exactly once? A set of solutions is given on the The_Knights_Tour page. Hints: Represent the squares by pairs of their coordinates of the form X/Y, where both X and Y are integers between 1 and N. (Note that '/' is just a convenient functor, not division!) Define the relation jump(N,X/Y,U/V) to express the fact that a knight can jump from X/Y to U/V on a NxN chessboard. And finally, represent the solution of our problem as a list of N*N knight positions (the knight's tour). There are two variants of this problem: find a tour ending at a particular square find a circular tour, ending a knight's jump from the start (clearly it doesn't matter where you start, so choose (1,1)) Example in Haskell: Knights> head $ knightsTo 8 (1,1) [(2,7),(3,5),(5,6),(4,8),(3,6),(4,4),(6,5),(4,6), (5,4),(7,5),(6,3),(5,5),(4,3),(2,4),(1,6),(2,8), (4,7),(6,8),(8,7),(6,6),(4,5),(6,4),(5,2),(7,1), (8,3),(6,2),(8,1),(7,3),(8,5),(7,7),(5,8),(3,7), (1,8),(2,6),(3,4),(1,5),(2,3),(3,1),(1,2),(3,3), (1,4),(2,2),(4,1),(5,3),(7,4),(8,2),(6,1),(4,2), (2,1),(1,3),(2,5),(1,7),(3,8),(5,7),(7,8),(8,6), (6,7),(8,8),(7,6),(8,4),(7,2),(5,1),(3,2),(1,1)] Knights> head $ closedKnights 8 [(1,1),(3,2),(1,3),(2,1),(3,3),(5,4),(6,6),(4,5), (2,6),(1,8),(3,7),(5,8),(4,6),(2,5),(4,4),(5,6), (6,4),(8,5),(7,7),(6,5),(5,3),(6,1),(4,2),(6,3), (8,2),(7,4),(5,5),(3,4),(1,5),(2,7),(4,8),(3,6), (1,7),(3,8),(5,7),(7,8),(8,6),(6,7),(8,8),(7,6), (8,4),(7,2),(5,1),(4,3),(3,5),(1,4),(2,2),(4,1), (6,2),(8,1),(7,3),(5,2),(7,1),(8,3),(7,5),(8,7), (6,8),(4,7),(2,8),(1,6),(2,4),(1,2),(3,1),(2,3)] -}
2,158
queens n = placeQueens n where placeQueens 0 = return [] placeQueens n' = do queen <- [1..n] queens' <- placeQueens (n'-1) guard $ isSafe queen queens' return $ queen : queens' isSafe :: Int -> [Int] -> Bool isSafe row qs = row `notElem` qs && all (notDiagonalWith row) (zip qs [1..(length qs)]) where notDiagonalWith row (row', col) = col /= abs (row' - row) {- Problem 91 (**) Knight's tour Another famous problem is this one: How can a knight jump on an NxN chessboard in such a way that it visits every square exactly once? A set of solutions is given on the The_Knights_Tour page. Hints: Represent the squares by pairs of their coordinates of the form X/Y, where both X and Y are integers between 1 and N. (Note that '/' is just a convenient functor, not division!) Define the relation jump(N,X/Y,U/V) to express the fact that a knight can jump from X/Y to U/V on a NxN chessboard. And finally, represent the solution of our problem as a list of N*N knight positions (the knight's tour). There are two variants of this problem: find a tour ending at a particular square find a circular tour, ending a knight's jump from the start (clearly it doesn't matter where you start, so choose (1,1)) Example in Haskell: Knights> head $ knightsTo 8 (1,1) [(2,7),(3,5),(5,6),(4,8),(3,6),(4,4),(6,5),(4,6), (5,4),(7,5),(6,3),(5,5),(4,3),(2,4),(1,6),(2,8), (4,7),(6,8),(8,7),(6,6),(4,5),(6,4),(5,2),(7,1), (8,3),(6,2),(8,1),(7,3),(8,5),(7,7),(5,8),(3,7), (1,8),(2,6),(3,4),(1,5),(2,3),(3,1),(1,2),(3,3), (1,4),(2,2),(4,1),(5,3),(7,4),(8,2),(6,1),(4,2), (2,1),(1,3),(2,5),(1,7),(3,8),(5,7),(7,8),(8,6), (6,7),(8,8),(7,6),(8,4),(7,2),(5,1),(3,2),(1,1)] Knights> head $ closedKnights 8 [(1,1),(3,2),(1,3),(2,1),(3,3),(5,4),(6,6),(4,5), (2,6),(1,8),(3,7),(5,8),(4,6),(2,5),(4,4),(5,6), (6,4),(8,5),(7,7),(6,5),(5,3),(6,1),(4,2),(6,3), (8,2),(7,4),(5,5),(3,4),(1,5),(2,7),(4,8),(3,6), (1,7),(3,8),(5,7),(7,8),(8,6),(6,7),(8,8),(7,6), (8,4),(7,2),(5,1),(4,3),(3,5),(1,4),(2,2),(4,1), (6,2),(8,1),(7,3),(5,2),(7,1),(8,3),(7,5),(8,7), (6,8),(4,7),(2,8),(1,6),(2,4),(1,2),(3,1),(2,3)] -}
2,133
true
true
2
11
423
225
106
119
null
null
artuuge/IHaskell
ipython-kernel/src/IHaskell/IPython/Types.hs
mit
showMessageType CommCloseMessage = "comm_close"
47
showMessageType CommCloseMessage = "comm_close"
47
showMessageType CommCloseMessage = "comm_close"
47
false
false
0
5
3
9
4
5
null
null
foreverbell/project-euler-solutions
src/187.hs
bsd-3-clause
solve m | from > to = 0 | otherwise = fromJust (M.lookup to count) - fromJust (M.lookup (from - 1) count) where from = m to = n `div` m
153
solve m | from > to = 0 | otherwise = fromJust (M.lookup to count) - fromJust (M.lookup (from - 1) count) where from = m to = n `div` m
153
solve m | from > to = 0 | otherwise = fromJust (M.lookup to count) - fromJust (M.lookup (from - 1) count) where from = m to = n `div` m
153
false
false
0
11
48
84
41
43
null
null
asr/apia
test/Succeed/NonConjectures/Test.hs
mit
allNonConjecturesTests ∷ TestTree allNonConjecturesTests = testGroup "non-conjectures" [ dumpTypesOptionTest , helpOptionTest , interfaceTest , issue18Test , onlineATPTest , onlyFilesOptionTest , verboseOptionTest , unprovenConjectureNoErrorOptionTest ]
271
allNonConjecturesTests ∷ TestTree allNonConjecturesTests = testGroup "non-conjectures" [ dumpTypesOptionTest , helpOptionTest , interfaceTest , issue18Test , onlineATPTest , onlyFilesOptionTest , verboseOptionTest , unprovenConjectureNoErrorOptionTest ]
271
allNonConjecturesTests = testGroup "non-conjectures" [ dumpTypesOptionTest , helpOptionTest , interfaceTest , issue18Test , onlineATPTest , onlyFilesOptionTest , verboseOptionTest , unprovenConjectureNoErrorOptionTest ]
237
false
true
0
5
41
41
24
17
null
null
haskell-opengl/OpenGLRaw
src/Graphics/GL/Functions/F30.hs
bsd-3-clause
ptr_glVertexAttrib4NubARB :: FunPtr (GLuint -> GLubyte -> GLubyte -> GLubyte -> GLubyte -> IO ()) ptr_glVertexAttrib4NubARB = unsafePerformIO $ getCommand "glVertexAttrib4NubARB"
178
ptr_glVertexAttrib4NubARB :: FunPtr (GLuint -> GLubyte -> GLubyte -> GLubyte -> GLubyte -> IO ()) ptr_glVertexAttrib4NubARB = unsafePerformIO $ getCommand "glVertexAttrib4NubARB"
178
ptr_glVertexAttrib4NubARB = unsafePerformIO $ getCommand "glVertexAttrib4NubARB"
80
false
true
0
13
20
49
24
25
null
null
xenog/haskoin
src/Network/Haskoin/Script/Evaluator.hs
unlicense
-- | Checks the top of the stack for a minimal numeric representation -- if flagged to do so minimalStackValEnforcer :: StackOperation () minimalStackValEnforcer = do flgs <- ask s <- getStack let topStack = if null s then [] else head s when (MINIMALDATA `elem` flgs || null topStack) $ unless (checkMinimalNumRep topStack) $ programError $ "Non-minimal stack value: " ++ show topStack -- | Checks if a stack value is the minimal numeric representation of -- the integer to which it decoes. Based on CScriptNum from Bitcoin -- Core.
571
minimalStackValEnforcer :: StackOperation () minimalStackValEnforcer = do flgs <- ask s <- getStack let topStack = if null s then [] else head s when (MINIMALDATA `elem` flgs || null topStack) $ unless (checkMinimalNumRep topStack) $ programError $ "Non-minimal stack value: " ++ show topStack -- | Checks if a stack value is the minimal numeric representation of -- the integer to which it decoes. Based on CScriptNum from Bitcoin -- Core.
478
minimalStackValEnforcer = do flgs <- ask s <- getStack let topStack = if null s then [] else head s when (MINIMALDATA `elem` flgs || null topStack) $ unless (checkMinimalNumRep topStack) $ programError $ "Non-minimal stack value: " ++ show topStack -- | Checks if a stack value is the minimal numeric representation of -- the integer to which it decoes. Based on CScriptNum from Bitcoin -- Core.
433
true
true
1
15
128
114
55
59
null
null
abakst/liquidhaskell
tests/neg/ex0-unsafe.hs
bsd-3-clause
count :: Int -> Int count m = foldN (\_ n -> n + 1) m 0
55
count :: Int -> Int count m = foldN (\_ n -> n + 1) m 0
55
count m = foldN (\_ n -> n + 1) m 0
35
false
true
0
8
16
45
21
24
null
null
hvr/vector
Data/Vector/Storable/Mutable.hs
bsd-3-clause
replicate = G.replicate
23
replicate = G.replicate
23
replicate = G.replicate
23
false
false
1
6
2
12
4
8
null
null
tdammers/resourcerer
src/Web/Resourcerer/Serve.hs
bsd-3-clause
jsonToText (JSON.Object xs) = concat . intersperse ", " $ [ k <> ": " <> jsonToText v | (k, v) <- pairs xs ]
124
jsonToText (JSON.Object xs) = concat . intersperse ", " $ [ k <> ": " <> jsonToText v | (k, v) <- pairs xs ]
124
jsonToText (JSON.Object xs) = concat . intersperse ", " $ [ k <> ": " <> jsonToText v | (k, v) <- pairs xs ]
124
false
false
0
9
40
59
29
30
null
null
sgillespie/ghc
compiler/utils/Outputable.hs
bsd-3-clause
-- This shows an SDoc, but on one line only. It's cheaper than a full -- showSDoc, designed for when we're getting results like "Foo.bar" -- and "foo{uniq strictness}" so we don't want fancy layout anyway. showSDocOneLine :: DynFlags -> SDoc -> String showSDocOneLine dflags d = let s = Pretty.style{ Pretty.mode = OneLineMode, Pretty.lineLength = pprCols dflags } in Pretty.renderStyle s $ runSDoc d (initSDocContext dflags defaultUserStyle)
471
showSDocOneLine :: DynFlags -> SDoc -> String showSDocOneLine dflags d = let s = Pretty.style{ Pretty.mode = OneLineMode, Pretty.lineLength = pprCols dflags } in Pretty.renderStyle s $ runSDoc d (initSDocContext dflags defaultUserStyle)
265
showSDocOneLine dflags d = let s = Pretty.style{ Pretty.mode = OneLineMode, Pretty.lineLength = pprCols dflags } in Pretty.renderStyle s $ runSDoc d (initSDocContext dflags defaultUserStyle)
219
true
true
0
11
96
83
43
40
null
null
carliros/Simple-San-Simon-Functional-Web-Browser
src/Process/CssBox.hs
bsd-3-clause
-- get the length of the external boxes (margin, border and padding area) of a css box as a tuple getExternalSizeBox props = let [mt,mr,mb,ml] = getMarginProperties props [bt,br,bb,bl] = getBorderProperties props [ppt,ppr,ppb,ppl] = getPaddingProperties props in (ml+bl+ppl+ppr+br+mr,mt+bt+ppt+ppb+bb+mb)
336
getExternalSizeBox props = let [mt,mr,mb,ml] = getMarginProperties props [bt,br,bb,bl] = getBorderProperties props [ppt,ppr,ppb,ppl] = getPaddingProperties props in (ml+bl+ppl+ppr+br+mr,mt+bt+ppt+ppb+bb+mb)
238
getExternalSizeBox props = let [mt,mr,mb,ml] = getMarginProperties props [bt,br,bb,bl] = getBorderProperties props [ppt,ppr,ppb,ppl] = getPaddingProperties props in (ml+bl+ppl+ppr+br+mr,mt+bt+ppt+ppb+bb+mb)
238
true
false
0
12
69
125
67
58
null
null
myfreeweb/magicbane
library/Magicbane/Util.hs
unlicense
hPutStrLn ∷ MonadIO μ ⇒ System.IO.Handle → String → μ () hPutStrLn h s = liftIO $ System.IO.hPutStrLn h s
105
hPutStrLn ∷ MonadIO μ ⇒ System.IO.Handle → String → μ () hPutStrLn h s = liftIO $ System.IO.hPutStrLn h s
105
hPutStrLn h s = liftIO $ System.IO.hPutStrLn h s
48
false
true
0
9
19
51
25
26
null
null
haBuu/tfs-website
Application.hs
mit
-- | The @main@ function for an executable running this site. appMain :: IO () appMain = do -- Get the settings from all relevant sources settings <- loadYamlSettingsArgs -- fall back to compile-time values, set to [] to require values at runtime [configSettingsYmlValue] -- allow environment variables to override useEnv -- Generate the foundation from the settings foundation <- makeFoundation settings -- Generate a WAI Application from the foundation app <- makeApplication foundation -- Run the application with Warp runSettings (warpSettings foundation) app -------------------------------------------------------------- -- Functions for DevelMain.hs (a way to run the app from GHCi) --------------------------------------------------------------
822
appMain :: IO () appMain = do -- Get the settings from all relevant sources settings <- loadYamlSettingsArgs -- fall back to compile-time values, set to [] to require values at runtime [configSettingsYmlValue] -- allow environment variables to override useEnv -- Generate the foundation from the settings foundation <- makeFoundation settings -- Generate a WAI Application from the foundation app <- makeApplication foundation -- Run the application with Warp runSettings (warpSettings foundation) app -------------------------------------------------------------- -- Functions for DevelMain.hs (a way to run the app from GHCi) --------------------------------------------------------------
760
appMain = do -- Get the settings from all relevant sources settings <- loadYamlSettingsArgs -- fall back to compile-time values, set to [] to require values at runtime [configSettingsYmlValue] -- allow environment variables to override useEnv -- Generate the foundation from the settings foundation <- makeFoundation settings -- Generate a WAI Application from the foundation app <- makeApplication foundation -- Run the application with Warp runSettings (warpSettings foundation) app -------------------------------------------------------------- -- Functions for DevelMain.hs (a way to run the app from GHCi) --------------------------------------------------------------
743
true
true
0
9
167
75
39
36
null
null
epsilonhalbe/Algebra-Alchemy
Polynomial.hs
bsd-3-clause
norm1 :: Num a => Polynomial a -> a -- ^ the 1-Norm = $\sum_{i=1}^n |a_i|$ norm1 (Poly _ p) = sum $ map abs p
109
norm1 :: Num a => Polynomial a -> a norm1 (Poly _ p) = sum $ map abs p
70
norm1 (Poly _ p) = sum $ map abs p
34
true
true
2
10
25
52
23
29
null
null
naoto-ogawa/h-xproto-mysql
src/DataBase/MySQLX/Statement.hs
mit
resultFrom :: RowFrom a -> ResultSet -> [a] resultFrom from rs = foldr (\v acc -> (rowFrom from v) : acc) [] rs
111
resultFrom :: RowFrom a -> ResultSet -> [a] resultFrom from rs = foldr (\v acc -> (rowFrom from v) : acc) [] rs
111
resultFrom from rs = foldr (\v acc -> (rowFrom from v) : acc) [] rs
67
false
true
0
10
22
61
31
30
null
null
ryantrinkle/reflex
src/Reflex/Requester/Base.hs
bsd-3-clause
singletonRequesterData :: RequesterDataKey a -> f a -> RequesterData f singletonRequesterData rdk v = case rdk of RequesterDataKey_Single k -> RequesterData $ singletonTagMap k $ Entry v RequesterDataKey_Multi k k' k'' -> RequesterData $ singletonTagMap k $ Entry $ IntMap.singleton k' $ singletonRequesterData k'' v RequesterDataKey_Multi2 k k' k'' k''' -> RequesterData $ singletonTagMap k $ Entry $ Map.singleton k' $ IntMap.singleton k'' $ singletonRequesterData k''' v RequesterDataKey_Multi3 k k' k'' k''' -> RequesterData $ singletonTagMap k $ Entry $ IntMap.singleton k' $ IntMap.singleton k'' $ singletonRequesterData k''' v
641
singletonRequesterData :: RequesterDataKey a -> f a -> RequesterData f singletonRequesterData rdk v = case rdk of RequesterDataKey_Single k -> RequesterData $ singletonTagMap k $ Entry v RequesterDataKey_Multi k k' k'' -> RequesterData $ singletonTagMap k $ Entry $ IntMap.singleton k' $ singletonRequesterData k'' v RequesterDataKey_Multi2 k k' k'' k''' -> RequesterData $ singletonTagMap k $ Entry $ Map.singleton k' $ IntMap.singleton k'' $ singletonRequesterData k''' v RequesterDataKey_Multi3 k k' k'' k''' -> RequesterData $ singletonTagMap k $ Entry $ IntMap.singleton k' $ IntMap.singleton k'' $ singletonRequesterData k''' v
641
singletonRequesterData rdk v = case rdk of RequesterDataKey_Single k -> RequesterData $ singletonTagMap k $ Entry v RequesterDataKey_Multi k k' k'' -> RequesterData $ singletonTagMap k $ Entry $ IntMap.singleton k' $ singletonRequesterData k'' v RequesterDataKey_Multi2 k k' k'' k''' -> RequesterData $ singletonTagMap k $ Entry $ Map.singleton k' $ IntMap.singleton k'' $ singletonRequesterData k''' v RequesterDataKey_Multi3 k k' k'' k''' -> RequesterData $ singletonTagMap k $ Entry $ IntMap.singleton k' $ IntMap.singleton k'' $ singletonRequesterData k''' v
570
false
true
18
7
96
71
43
28
null
null
5outh/Bang
src/Bang/Interface/Drum.hs
mit
-- | Snare (alt) sn2 :: Music PercussionSound sn2 = snareDrum2
62
sn2 :: Music PercussionSound sn2 = snareDrum2
45
sn2 = snareDrum2
16
true
true
0
5
10
15
8
7
null
null
tonyday567/hdcharts
src/Chart/Bar.hs
mit
barRectScale :: BarConfig -> Element Double -> [D3Expr] barRectScale c e = toD3Expr $ [jmacroE| attr("x", function(d,i) { return c.xScale(i);}). attr('y', function(d) { return c.yScale(d);}). attr("width", function(d) { return `(barWidth c e)`;}). attr("height", function(d) { return (c.height - c.yScale(d));}) |]
357
barRectScale :: BarConfig -> Element Double -> [D3Expr] barRectScale c e = toD3Expr $ [jmacroE| attr("x", function(d,i) { return c.xScale(i);}). attr('y', function(d) { return c.yScale(d);}). attr("width", function(d) { return `(barWidth c e)`;}). attr("height", function(d) { return (c.height - c.yScale(d));}) |]
357
barRectScale c e = toD3Expr $ [jmacroE| attr("x", function(d,i) { return c.xScale(i);}). attr('y', function(d) { return c.yScale(d);}). attr("width", function(d) { return `(barWidth c e)`;}). attr("height", function(d) { return (c.height - c.yScale(d));}) |]
301
false
true
2
9
82
45
22
23
null
null
mrenaud92/Scheduling
testsuite/unittest/TestSuite.hs
bsd-3-clause
main :: IO () main = htfMain htf_importedTests
46
main :: IO () main = htfMain htf_importedTests
46
main = htfMain htf_importedTests
32
false
true
0
6
7
19
9
10
null
null
EarlGray/hasm
src/Language/HAsm/ELF.hs
mit
elf_magic :: B.ByteString elf_magic = B.pack $ take eiNIdent $ magic ++ repeat 0x00 where magic = (0x7f : map (int . ord) "ELF") ++ [num ElfClass32, num ElfDataLSB, num EVCurrrent, 0]
185
elf_magic :: B.ByteString elf_magic = B.pack $ take eiNIdent $ magic ++ repeat 0x00 where magic = (0x7f : map (int . ord) "ELF") ++ [num ElfClass32, num ElfDataLSB, num EVCurrrent, 0]
185
elf_magic = B.pack $ take eiNIdent $ magic ++ repeat 0x00 where magic = (0x7f : map (int . ord) "ELF") ++ [num ElfClass32, num ElfDataLSB, num EVCurrrent, 0]
159
false
true
0
10
33
85
43
42
null
null
karamellpelle/grid
designer/source/Game/Iteration.hs
gpl-3.0
localWorldA :: a -> Iteration a b -> Iteration a b localWorldA world iter = makeIteration $ \a b -> (iteration (modifyAfter iter (\_ b -> return (a, b)))) world b
207
localWorldA :: a -> Iteration a b -> Iteration a b localWorldA world iter = makeIteration $ \a b -> (iteration (modifyAfter iter (\_ b -> return (a, b)))) world b
207
localWorldA world iter = makeIteration $ \a b -> (iteration (modifyAfter iter (\_ b -> return (a, b)))) world b
124
false
true
2
14
75
88
43
45
null
null
nevrenato/HetsAlloy
Common/Lexer.hs
gpl-2.0
-- * skip whitespaces and nested comment out nestCommentOut :: CharParser st () nestCommentOut = forget $ nestedComment "%[" "]%"
130
nestCommentOut :: CharParser st () nestCommentOut = forget $ nestedComment "%[" "]%"
84
nestCommentOut = forget $ nestedComment "%[" "]%"
49
true
true
2
7
20
34
15
19
null
null
donnie4w/tim
protocols/gen-hs/ITim_Client.hs
apache-2.0
timPing (ip,op) arg_threadId = do send_timPing op arg_threadId
64
timPing (ip,op) arg_threadId = do send_timPing op arg_threadId
64
timPing (ip,op) arg_threadId = do send_timPing op arg_threadId
64
false
false
0
7
9
26
12
14
null
null
bacchanalia/KitchenSink
KitchenSink/Qualified.hs
gpl-3.0
-- |'VFM.trans' vfm_trans = VFM.trans
37
vfm_trans = VFM.trans
21
vfm_trans = VFM.trans
21
true
false
0
5
4
9
5
4
null
null
ribag/ganeti-experiments
src/Ganeti/UDSServer.hs
gpl-2.0
recvUpdate :: ConnectConfig -> Handle -> B.ByteString -> IO (B.ByteString, B.ByteString) recvUpdate conf handle obuf = do nbuf <- withTimeout (recvTmo conf) "reading a response" $ do _ <- hWaitForInput handle (-1) B.hGetNonBlocking handle 4096 let (msg, remaining) = B.break (eOM ==) nbuf newbuf = B.append obuf msg if B.null remaining then recvUpdate conf handle newbuf else return (newbuf, B.copy (B.tail remaining)) -- | Waits for a message over a transport.
517
recvUpdate :: ConnectConfig -> Handle -> B.ByteString -> IO (B.ByteString, B.ByteString) recvUpdate conf handle obuf = do nbuf <- withTimeout (recvTmo conf) "reading a response" $ do _ <- hWaitForInput handle (-1) B.hGetNonBlocking handle 4096 let (msg, remaining) = B.break (eOM ==) nbuf newbuf = B.append obuf msg if B.null remaining then recvUpdate conf handle newbuf else return (newbuf, B.copy (B.tail remaining)) -- | Waits for a message over a transport.
517
recvUpdate conf handle obuf = do nbuf <- withTimeout (recvTmo conf) "reading a response" $ do _ <- hWaitForInput handle (-1) B.hGetNonBlocking handle 4096 let (msg, remaining) = B.break (eOM ==) nbuf newbuf = B.append obuf msg if B.null remaining then recvUpdate conf handle newbuf else return (newbuf, B.copy (B.tail remaining)) -- | Waits for a message over a transport.
417
false
true
0
14
126
179
88
91
null
null
zhiyuanshi/fcore
frontend/simplify/SimplifyImpl.hs
bsd-2-clause
transExpr i j (FI.JNew c es) = JNew c . map (transExpr i j) $ es
78
transExpr i j (FI.JNew c es) = JNew c . map (transExpr i j) $ es
78
transExpr i j (FI.JNew c es) = JNew c . map (transExpr i j) $ es
78
false
false
0
9
29
45
21
24
null
null
csabahruska/q3demo
src/Q3Demo/Graphics/GLBackend.hs
bsd-3-clause
fromGLUniformType :: (GLenum,GLint) -> Maybe UniformType fromGLUniformType (t,1) | t == gl_FLOAT = Just UT_Float | t == gl_FLOAT_VEC2 = Just UT_Vec2 | t == gl_FLOAT_VEC3 = Just UT_Vec3 | t == gl_FLOAT_VEC4 = Just UT_Vec4 | t == gl_FLOAT_MAT2 = Just UT_Mat2 | t == gl_FLOAT_MAT3 = Just UT_Mat3 | t == gl_FLOAT_MAT4 = Just UT_Mat4 | t == gl_INT = Just UT_Int | t == gl_UNSIGNED_INT = Just UT_Word | t == gl_BOOL = Just UT_Bool | otherwise = Nothing
536
fromGLUniformType :: (GLenum,GLint) -> Maybe UniformType fromGLUniformType (t,1) | t == gl_FLOAT = Just UT_Float | t == gl_FLOAT_VEC2 = Just UT_Vec2 | t == gl_FLOAT_VEC3 = Just UT_Vec3 | t == gl_FLOAT_VEC4 = Just UT_Vec4 | t == gl_FLOAT_MAT2 = Just UT_Mat2 | t == gl_FLOAT_MAT3 = Just UT_Mat3 | t == gl_FLOAT_MAT4 = Just UT_Mat4 | t == gl_INT = Just UT_Int | t == gl_UNSIGNED_INT = Just UT_Word | t == gl_BOOL = Just UT_Bool | otherwise = Nothing
536
fromGLUniformType (t,1) | t == gl_FLOAT = Just UT_Float | t == gl_FLOAT_VEC2 = Just UT_Vec2 | t == gl_FLOAT_VEC3 = Just UT_Vec3 | t == gl_FLOAT_VEC4 = Just UT_Vec4 | t == gl_FLOAT_MAT2 = Just UT_Mat2 | t == gl_FLOAT_MAT3 = Just UT_Mat3 | t == gl_FLOAT_MAT4 = Just UT_Mat4 | t == gl_INT = Just UT_Int | t == gl_UNSIGNED_INT = Just UT_Word | t == gl_BOOL = Just UT_Bool | otherwise = Nothing
479
false
true
1
8
171
216
99
117
null
null
amirci/aoc2016-hs
src/Day4.hs
bsd-3-clause
parseRoom r = (readInt sectorId, init tokens, checksum) where tokens = splitOn "-" r [sectorId, checksum, _] = splitOneOf "[]" $ last tokens readInt = read :: String -> Int
186
parseRoom r = (readInt sectorId, init tokens, checksum) where tokens = splitOn "-" r [sectorId, checksum, _] = splitOneOf "[]" $ last tokens readInt = read :: String -> Int
186
parseRoom r = (readInt sectorId, init tokens, checksum) where tokens = splitOn "-" r [sectorId, checksum, _] = splitOneOf "[]" $ last tokens readInt = read :: String -> Int
186
false
false
0
6
43
74
38
36
null
null
rueshyna/gogol
gogol-drive/gen/Network/Google/Drive/Types/Product.hs
mpl-2.0
-- | The size of the file\'s content in bytes. This is only applicable to -- files with binary content in Drive. fSize :: Lens' File (Maybe Int64) fSize = lens _fSize (\ s a -> s{_fSize = a}) . mapping _Coerce
217
fSize :: Lens' File (Maybe Int64) fSize = lens _fSize (\ s a -> s{_fSize = a}) . mapping _Coerce
104
fSize = lens _fSize (\ s a -> s{_fSize = a}) . mapping _Coerce
70
true
true
1
10
49
57
29
28
null
null
tsahyt/clingo-haskell
src/Clingo/Internal/Inspection/Theory.hs
mit
theoryAtomsAtomGuard :: (MonadIO m, MonadThrow m) => TheoryAtoms s -> AtomId -> m (Text, TermId) theoryAtomsAtomGuard (TheoryAtoms h) (AtomId k) = bimap pack TermId <$> go where go = do (x,y) <- marshal2 $ Raw.theoryAtomsAtomGuard h k x' <- liftIO $ peekCString x return (x',y)
345
theoryAtomsAtomGuard :: (MonadIO m, MonadThrow m) => TheoryAtoms s -> AtomId -> m (Text, TermId) theoryAtomsAtomGuard (TheoryAtoms h) (AtomId k) = bimap pack TermId <$> go where go = do (x,y) <- marshal2 $ Raw.theoryAtomsAtomGuard h k x' <- liftIO $ peekCString x return (x',y)
345
theoryAtomsAtomGuard (TheoryAtoms h) (AtomId k) = bimap pack TermId <$> go where go = do (x,y) <- marshal2 $ Raw.theoryAtomsAtomGuard h k x' <- liftIO $ peekCString x return (x',y)
226
false
true
0
10
112
130
64
66
null
null
Palmik/wai-sockjs
src/Network/Sock/Handler.hs
bsd-3-clause
responseGreeting :: H.IsResponse res => res responseGreeting = H.response200 H.headerPlain "Welcome to SockJS!\n"
114
responseGreeting :: H.IsResponse res => res responseGreeting = H.response200 H.headerPlain "Welcome to SockJS!\n"
114
responseGreeting = H.response200 H.headerPlain "Welcome to SockJS!\n"
69
false
true
0
7
13
29
14
15
null
null
garetxe/cabal
Cabal/tests/UnitTests/Distribution/Version.hs
bsd-3-clause
prop_isNoVersion :: VersionRange -> Version -> Property prop_isNoVersion range version = isNoVersion range ==> not (withinRange version range)
144
prop_isNoVersion :: VersionRange -> Version -> Property prop_isNoVersion range version = isNoVersion range ==> not (withinRange version range)
144
prop_isNoVersion range version = isNoVersion range ==> not (withinRange version range)
88
false
true
0
8
19
42
20
22
null
null
abuiles/turbinado-blog
tmp/dependencies/hsx-0.4.5/src/HSX/Transform.hs
bsd-3-clause
-- foldComp = foldl (.) id, i.e. fold by composing foldCompFun :: HsExp foldCompFun = match_qual $ HsIdent "foldComp"
117
foldCompFun :: HsExp foldCompFun = match_qual $ HsIdent "foldComp"
66
foldCompFun = match_qual $ HsIdent "foldComp"
45
true
true
2
6
18
26
11
15
null
null
bixuanzju/SCore
src/Language.hs
gpl-3.0
flatten col ((INil, _):seqs) = flatten col seqs
47
flatten col ((INil, _):seqs) = flatten col seqs
47
flatten col ((INil, _):seqs) = flatten col seqs
47
false
false
0
8
7
29
15
14
null
null
ezyang/ghc
compiler/nativeGen/X86/Regs.hs
bsd-3-clause
rbx = regSingle 1
19
rbx = regSingle 1
19
rbx = regSingle 1
19
false
false
1
5
5
12
4
8
null
null
pierzchalski/cs3161a2
MinHS/TyInfer.hs
mit
primOpType Eq = Ty $ Base Int `Arrow` (Base Int `Arrow` Base Bool)
68
primOpType Eq = Ty $ Base Int `Arrow` (Base Int `Arrow` Base Bool)
68
primOpType Eq = Ty $ Base Int `Arrow` (Base Int `Arrow` Base Bool)
68
false
false
3
9
14
42
19
23
null
null
hguenther/nbis
MemoryModel/Typed.hs
agpl-3.0
typedLoad' :: Integer -> Integer -> [TypeDesc] -> [SMTExpr (BitVector BVUntyped)] -> [(Integer,SMTExpr (BitVector BVUntyped))] typedLoad' offset len ((TDStruct (Right (tps,_))):rest) banks = typedLoad' offset len (tps++rest) banks
230
typedLoad' :: Integer -> Integer -> [TypeDesc] -> [SMTExpr (BitVector BVUntyped)] -> [(Integer,SMTExpr (BitVector BVUntyped))] typedLoad' offset len ((TDStruct (Right (tps,_))):rest) banks = typedLoad' offset len (tps++rest) banks
230
typedLoad' offset len ((TDStruct (Right (tps,_))):rest) banks = typedLoad' offset len (tps++rest) banks
103
false
true
0
13
27
110
58
52
null
null
ksaveljev/hake-2
src/QCommon/FS.hs
bsd-3-clause
addGameDirectory :: B.ByteString -> Quake () addGameDirectory dir = do fsGlobals.fsGameDir .= dir -- add the directory to the search path -- ensure fs_userdir is first in searchpath let newSearchPath = newSearchPathT { _spFilename = dir } searchPaths <- use $ fsGlobals.fsSearchPaths case searchPaths of [] -> fsGlobals.fsSearchPaths .= [newSearchPath] (x:xs) -> fsGlobals.fsSearchPaths .= x : newSearchPath : xs -- add any pack files in the format pak0.pak pak1.pak ... void $ sequence $ fmap (addPackFiles dir) [0..9] where addPackFiles :: B.ByteString -> Int -> Quake () addPackFiles directory i = do let pakFile = directory `B.append` "/pak" `B.append` BC.pack (show i) `B.append` ".pak" -- IMPROVE: use binary package for Int to ByteString conversion? pakFileS = BC.unpack pakFile fileExists <- io $ doesFileExist pakFileS when fileExists $ do permissions <- io $ getPermissions pakFileS when (readable permissions) $ do pak <- loadPackFile pakFile when (isJust pak) $ fsGlobals.fsSearchPaths %= (newSearchPathT { _spFilename = "", _spPack = pak } :) -- takes an explicit (not game tree related) path to a pak file -- -- loads the header and directory, adding the files at the beginning of the -- list so they override previous pack files -- IMPROVE: there is a try catch block for IO operations in the original code ...
1,499
addGameDirectory :: B.ByteString -> Quake () addGameDirectory dir = do fsGlobals.fsGameDir .= dir -- add the directory to the search path -- ensure fs_userdir is first in searchpath let newSearchPath = newSearchPathT { _spFilename = dir } searchPaths <- use $ fsGlobals.fsSearchPaths case searchPaths of [] -> fsGlobals.fsSearchPaths .= [newSearchPath] (x:xs) -> fsGlobals.fsSearchPaths .= x : newSearchPath : xs -- add any pack files in the format pak0.pak pak1.pak ... void $ sequence $ fmap (addPackFiles dir) [0..9] where addPackFiles :: B.ByteString -> Int -> Quake () addPackFiles directory i = do let pakFile = directory `B.append` "/pak" `B.append` BC.pack (show i) `B.append` ".pak" -- IMPROVE: use binary package for Int to ByteString conversion? pakFileS = BC.unpack pakFile fileExists <- io $ doesFileExist pakFileS when fileExists $ do permissions <- io $ getPermissions pakFileS when (readable permissions) $ do pak <- loadPackFile pakFile when (isJust pak) $ fsGlobals.fsSearchPaths %= (newSearchPathT { _spFilename = "", _spPack = pak } :) -- takes an explicit (not game tree related) path to a pak file -- -- loads the header and directory, adding the files at the beginning of the -- list so they override previous pack files -- IMPROVE: there is a try catch block for IO operations in the original code ...
1,499
addGameDirectory dir = do fsGlobals.fsGameDir .= dir -- add the directory to the search path -- ensure fs_userdir is first in searchpath let newSearchPath = newSearchPathT { _spFilename = dir } searchPaths <- use $ fsGlobals.fsSearchPaths case searchPaths of [] -> fsGlobals.fsSearchPaths .= [newSearchPath] (x:xs) -> fsGlobals.fsSearchPaths .= x : newSearchPath : xs -- add any pack files in the format pak0.pak pak1.pak ... void $ sequence $ fmap (addPackFiles dir) [0..9] where addPackFiles :: B.ByteString -> Int -> Quake () addPackFiles directory i = do let pakFile = directory `B.append` "/pak" `B.append` BC.pack (show i) `B.append` ".pak" -- IMPROVE: use binary package for Int to ByteString conversion? pakFileS = BC.unpack pakFile fileExists <- io $ doesFileExist pakFileS when fileExists $ do permissions <- io $ getPermissions pakFileS when (readable permissions) $ do pak <- loadPackFile pakFile when (isJust pak) $ fsGlobals.fsSearchPaths %= (newSearchPathT { _spFilename = "", _spPack = pak } :) -- takes an explicit (not game tree related) path to a pak file -- -- loads the header and directory, adding the files at the beginning of the -- list so they override previous pack files -- IMPROVE: there is a try catch block for IO operations in the original code ...
1,454
false
true
3
17
384
342
173
169
null
null
Kinokkory/thorn
Data/Thorn/Functor.hs
bsd-3-clause
autofmap'' u (ListTx tx) = autofmap' u tx >>= \f -> return $ AppE (mkNameE "map") f
83
autofmap'' u (ListTx tx) = autofmap' u tx >>= \f -> return $ AppE (mkNameE "map") f
83
autofmap'' u (ListTx tx) = autofmap' u tx >>= \f -> return $ AppE (mkNameE "map") f
83
false
false
0
10
16
48
22
26
null
null
deviant-logic/props
src/Test/Properties.hs
bsd-3-clause
-- | @'symmetric' f a b@ implies @a == b@ -- -- prop> antisymmetric (-) :: Int -> Int -> Bool antisymmetric = antisymmetricBy id
128
antisymmetric = antisymmetricBy id
34
antisymmetric = antisymmetricBy id
34
true
false
1
5
24
15
7
8
null
null
lukexi/ghc-7.8-arm64
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
emitPrimOp dflags res IndexByteArrayOp_Word16 args = doIndexByteArrayOp (Just (mo_u_16ToWord dflags)) b16 res args
127
emitPrimOp dflags res IndexByteArrayOp_Word16 args = doIndexByteArrayOp (Just (mo_u_16ToWord dflags)) b16 res args
127
emitPrimOp dflags res IndexByteArrayOp_Word16 args = doIndexByteArrayOp (Just (mo_u_16ToWord dflags)) b16 res args
127
false
false
0
9
25
40
17
23
null
null
DanielRS/marquee
src/Text/Marquee/SyntaxTrees/AST.hs
mit
plain :: MarkdownInline -> Text plain (Text x) = x
54
plain :: MarkdownInline -> Text plain (Text x) = x
54
plain (Text x) = x
22
false
true
0
7
13
24
12
12
null
null
chrisbouchard/bartender
src/BarTender/Util.hs
gpl-3.0
ifJust :: Bool -> a -> Maybe a ifJust b x = guard b >> Just x
61
ifJust :: Bool -> a -> Maybe a ifJust b x = guard b >> Just x
61
ifJust b x = guard b >> Just x
30
false
true
0
7
16
37
17
20
null
null
rebasar/follower
follower.hs
gpl-3.0
followAll :: State -> IO State followAll us = do results <- mapM (runTM nullAuthUser . getTweetsBy) us putDoc $ formatTweets $ filter notReply $ merge results return $ updateState us results where updateState :: State -> [[Status]] -> State updateState [] [] = [] updateState (p:ps) (t:ts) = case t of [] -> p : (updateState ps ts) (x:xs) -> ((fst p), (statusId x)) : (updateState ps ts) updateState _ _ = error "This should not happen"
502
followAll :: State -> IO State followAll us = do results <- mapM (runTM nullAuthUser . getTweetsBy) us putDoc $ formatTweets $ filter notReply $ merge results return $ updateState us results where updateState :: State -> [[Status]] -> State updateState [] [] = [] updateState (p:ps) (t:ts) = case t of [] -> p : (updateState ps ts) (x:xs) -> ((fst p), (statusId x)) : (updateState ps ts) updateState _ _ = error "This should not happen"
502
followAll us = do results <- mapM (runTM nullAuthUser . getTweetsBy) us putDoc $ formatTweets $ filter notReply $ merge results return $ updateState us results where updateState :: State -> [[Status]] -> State updateState [] [] = [] updateState (p:ps) (t:ts) = case t of [] -> p : (updateState ps ts) (x:xs) -> ((fst p), (statusId x)) : (updateState ps ts) updateState _ _ = error "This should not happen"
471
false
true
0
11
143
218
108
110
null
null
ihc/futhark
src/futhark-doc.hs
isc
main :: IO () main = mainWithOptions initialDocConfig commandLineOptions f where f [dir] config = Just $ do res <- runFutharkM (m config dir) True case res of Left err -> liftIO $ do dumpError newFutharkConfig err exitWith $ ExitFailure 2 Right () -> return () f _ _ = Nothing m :: DocConfig -> FilePath -> FutharkM () m config dir = case docOutput config of Nothing -> liftIO $ do hPutStrLn stderr "Must specify output directory with -o." exitWith $ ExitFailure 1 Just outdir -> do files <- liftIO $ futFiles dir when (docVerbose config) $ liftIO $ do mapM_ (hPutStrLn stderr . ("Found source file "<>)) files hPutStrLn stderr "Reading files..." (prog, _w, imports, _vns) <- readLibrary False preludeBasis mempty files liftIO $ printDecs config outdir (nubBy sameImport imports) $ progDecs prog sameImport (x, _) (y, _) = x == y
1,133
main :: IO () main = mainWithOptions initialDocConfig commandLineOptions f where f [dir] config = Just $ do res <- runFutharkM (m config dir) True case res of Left err -> liftIO $ do dumpError newFutharkConfig err exitWith $ ExitFailure 2 Right () -> return () f _ _ = Nothing m :: DocConfig -> FilePath -> FutharkM () m config dir = case docOutput config of Nothing -> liftIO $ do hPutStrLn stderr "Must specify output directory with -o." exitWith $ ExitFailure 1 Just outdir -> do files <- liftIO $ futFiles dir when (docVerbose config) $ liftIO $ do mapM_ (hPutStrLn stderr . ("Found source file "<>)) files hPutStrLn stderr "Reading files..." (prog, _w, imports, _vns) <- readLibrary False preludeBasis mempty files liftIO $ printDecs config outdir (nubBy sameImport imports) $ progDecs prog sameImport (x, _) (y, _) = x == y
1,133
main = mainWithOptions initialDocConfig commandLineOptions f where f [dir] config = Just $ do res <- runFutharkM (m config dir) True case res of Left err -> liftIO $ do dumpError newFutharkConfig err exitWith $ ExitFailure 2 Right () -> return () f _ _ = Nothing m :: DocConfig -> FilePath -> FutharkM () m config dir = case docOutput config of Nothing -> liftIO $ do hPutStrLn stderr "Must specify output directory with -o." exitWith $ ExitFailure 1 Just outdir -> do files <- liftIO $ futFiles dir when (docVerbose config) $ liftIO $ do mapM_ (hPutStrLn stderr . ("Found source file "<>)) files hPutStrLn stderr "Reading files..." (prog, _w, imports, _vns) <- readLibrary False preludeBasis mempty files liftIO $ printDecs config outdir (nubBy sameImport imports) $ progDecs prog sameImport (x, _) (y, _) = x == y
1,119
false
true
24
15
447
324
164
160
null
null
ucsd-progsys/nanomaly
src/NanoML/Misc.hs
bsd-3-clause
pairwiseNub [] = []
21
pairwiseNub [] = []
21
pairwiseNub [] = []
21
false
false
0
6
5
13
6
7
null
null
nilthehuman/cis194
Homework7.hs
unlicense
x +++ y = Append (tag x `mappend` tag y) x y
52
x +++ y = Append (tag x `mappend` tag y) x y
52
x +++ y = Append (tag x `mappend` tag y) x y
52
false
false
0
8
19
34
16
18
null
null
thomasathorne/h-chu
src/Main.hs
bsd-3-clause
main :: IO () main = do args <- getArgs case args of [] -> withSocketsDo $ do bracket (getSock defaultPort) (\s -> sClose s >> putStrLn "Socket closed.") useSock args -> withSocketsDo $ do let port = read (head args) bracket (getSock port) (\s -> sClose s >> putStrLn "Socket closed.") useSock where getSock :: Int -> IO Socket getSock port = do sock <- listenOn (PortNumber (fromIntegral port)) printf "Listening on port %d\n" port return sock
523
main :: IO () main = do args <- getArgs case args of [] -> withSocketsDo $ do bracket (getSock defaultPort) (\s -> sClose s >> putStrLn "Socket closed.") useSock args -> withSocketsDo $ do let port = read (head args) bracket (getSock port) (\s -> sClose s >> putStrLn "Socket closed.") useSock where getSock :: Int -> IO Socket getSock port = do sock <- listenOn (PortNumber (fromIntegral port)) printf "Listening on port %d\n" port return sock
523
main = do args <- getArgs case args of [] -> withSocketsDo $ do bracket (getSock defaultPort) (\s -> sClose s >> putStrLn "Socket closed.") useSock args -> withSocketsDo $ do let port = read (head args) bracket (getSock port) (\s -> sClose s >> putStrLn "Socket closed.") useSock where getSock :: Int -> IO Socket getSock port = do sock <- listenOn (PortNumber (fromIntegral port)) printf "Listening on port %d\n" port return sock
509
false
true
3
18
156
200
91
109
null
null
bgamari/minir
MinIR/PostingList/Builder.hs
bsd-3-clause
mapMP :: Monad m => (a -> m b) -> Producer a m r -> Producer b m r mapMP f = go where go prod = do r <- lift $ next prod case r of Left a -> return a Right (x, prod') -> do lift (f x) >>= yield >> go prod'
261
mapMP :: Monad m => (a -> m b) -> Producer a m r -> Producer b m r mapMP f = go where go prod = do r <- lift $ next prod case r of Left a -> return a Right (x, prod') -> do lift (f x) >>= yield >> go prod'
261
mapMP f = go where go prod = do r <- lift $ next prod case r of Left a -> return a Right (x, prod') -> do lift (f x) >>= yield >> go prod'
194
false
true
0
16
110
134
62
72
null
null
rleshchinskiy/vector
Data/Vector/Unboxed.hs
bsd-3-clause
mapM_ = G.mapM_
15
mapM_ = G.mapM_
15
mapM_ = G.mapM_
15
false
false
0
5
2
8
4
4
null
null
fpco/wai-middleware-crowd
src/Network/Wai/Middleware/Crowd.hs
mit
-- | Default value for 'CrowdSettings'. -- -- Since 0.1.0 defaultCrowdSettings :: CrowdSettings defaultCrowdSettings = CrowdSettings { csGetKey = getDefaultKey , csCrowdRoot = "http://localhost:8095/openidserver" , csGetApproot = smartApproot , csGetManager = newManager tlsManagerSettings , csAge = 3600 }
330
defaultCrowdSettings :: CrowdSettings defaultCrowdSettings = CrowdSettings { csGetKey = getDefaultKey , csCrowdRoot = "http://localhost:8095/openidserver" , csGetApproot = smartApproot , csGetManager = newManager tlsManagerSettings , csAge = 3600 }
272
defaultCrowdSettings = CrowdSettings { csGetKey = getDefaultKey , csCrowdRoot = "http://localhost:8095/openidserver" , csGetApproot = smartApproot , csGetManager = newManager tlsManagerSettings , csAge = 3600 }
234
true
true
0
8
61
53
32
21
null
null
Lupino/dispatch-article
src/Article/RawAPI.hs
bsd-3-clause
updateArticleExtra :: HasMySQL u => ID -> Value -> GenHaxl u w Int64 updateArticleExtra artId extra = uncachedRequest (UpdateArticleExtra artId extra)
150
updateArticleExtra :: HasMySQL u => ID -> Value -> GenHaxl u w Int64 updateArticleExtra artId extra = uncachedRequest (UpdateArticleExtra artId extra)
150
updateArticleExtra artId extra = uncachedRequest (UpdateArticleExtra artId extra)
81
false
true
0
8
20
49
23
26
null
null
fluffynukeit/FNIStash
src/FNIStash/File/Item.hs
bsd-3-clause
hasFilePath 0x8149 = True
25
hasFilePath 0x8149 = True
25
hasFilePath 0x8149 = True
25
false
false
1
5
3
13
4
9
null
null
phaazon/OpenGLRaw
src/Graphics/Rendering/OpenGL/Raw/Tokens.hs
bsd-3-clause
gl_ATOMIC_COUNTER_BUFFER_INDEX :: GLenum gl_ATOMIC_COUNTER_BUFFER_INDEX = 0x9301
80
gl_ATOMIC_COUNTER_BUFFER_INDEX :: GLenum gl_ATOMIC_COUNTER_BUFFER_INDEX = 0x9301
80
gl_ATOMIC_COUNTER_BUFFER_INDEX = 0x9301
39
false
true
0
4
5
11
6
5
null
null
bacchanalia/KitchenSink
KitchenSink/Qualified.hs
gpl-3.0
-- |'MapS.foldrWithKey' ms_foldrWithKey = MapS.foldrWithKey
59
ms_foldrWithKey = MapS.foldrWithKey
35
ms_foldrWithKey = MapS.foldrWithKey
35
true
false
0
5
4
9
5
4
null
null
anton-dessiatov/stack
src/Stack/Ghci.hs
bsd-3-clause
setScriptPerms _ = do return () #else setScriptPerms fp = do liftIO $ Posix.setFileMode fp $ foldl1 Posix.unionFileModes [ Posix.ownerReadMode , Posix.ownerWriteMode , Posix.groupReadMode , Posix.otherReadMode ] #endif
266
setScriptPerms _ = do return () #else setScriptPerms fp = do liftIO $ Posix.setFileMode fp $ foldl1 Posix.unionFileModes [ Posix.ownerReadMode , Posix.ownerWriteMode , Posix.groupReadMode , Posix.otherReadMode ] #endif
266
setScriptPerms _ = do return () #else setScriptPerms fp = do liftIO $ Posix.setFileMode fp $ foldl1 Posix.unionFileModes [ Posix.ownerReadMode , Posix.ownerWriteMode , Posix.groupReadMode , Posix.otherReadMode ] #endif
266
false
false
0
8
75
18
8
10
null
null
royopa/pandoc
src/Text/Pandoc/Writers/HTML.hs
gpl-2.0
toList :: (Html -> Html) -> WriterOptions -> ([Html] -> Html) toList listop opts items = do if (writerIncremental opts) then if (writerSlideVariant opts /= RevealJsSlides) then (listop $ mconcat items) ! A.class_ "incremental" else listop $ mconcat $ map (! A.class_ "fragment") items else listop $ mconcat items
360
toList :: (Html -> Html) -> WriterOptions -> ([Html] -> Html) toList listop opts items = do if (writerIncremental opts) then if (writerSlideVariant opts /= RevealJsSlides) then (listop $ mconcat items) ! A.class_ "incremental" else listop $ mconcat $ map (! A.class_ "fragment") items else listop $ mconcat items
360
toList listop opts items = do if (writerIncremental opts) then if (writerSlideVariant opts /= RevealJsSlides) then (listop $ mconcat items) ! A.class_ "incremental" else listop $ mconcat $ map (! A.class_ "fragment") items else listop $ mconcat items
298
false
true
0
14
96
132
66
66
null
null
alang9/deque
Data/Deque/NonCat.hs
bsd-3-clause
fixup2' (BigR (RX B0 (B2 n o)) (Y1 (B4 (P s t) (P u v) (P w x) (P y z))) LEmpty) = go10 s t u v w x y z n o
125
fixup2' (BigR (RX B0 (B2 n o)) (Y1 (B4 (P s t) (P u v) (P w x) (P y z))) LEmpty) = go10 s t u v w x y z n o
125
fixup2' (BigR (RX B0 (B2 n o)) (Y1 (B4 (P s t) (P u v) (P w x) (P y z))) LEmpty) = go10 s t u v w x y z n o
125
false
false
0
12
51
107
52
55
null
null
emacstheviking/hexwax-usb
Commands.hs
lgpl-3.0
asPort :: Word8 -> String asPort 0x01 = "PORTA"
47
asPort :: Word8 -> String asPort 0x01 = "PORTA"
47
asPort 0x01 = "PORTA"
21
false
true
0
5
8
18
9
9
null
null
kaizhang/BCMtools
app/BCMtools/Convert.hs
mit
convertOptions :: Parser Command convertOptions = fmap Convert $ ConvertOptions <$> strOption ( long "genome" <> short 'g' <> metavar "ASSEMBLY" <> help "e.g., hg19, or a file" ) <*> fmap (splitOn ",") (strOption ( long "rownames" <> short 'r' <> metavar "ROW LABELS" )) <*> fmap (splitOn ",") (strOption ( long "colnames" <> short 'c' <> metavar "COLOUMN LABELS" )) <*> fmap readInt' (strOption ( long "resolution" <> short 's' <> metavar "RESOLUTION" )) <*> switch ( long "sparse" <> help "whether to use sparse encoding" ) <*> switch ( long "symmetric" <> help "whether to use symmetric encoding" ) where readInt' x = let (Just (i, left)) = B.readInt $ B.pack x in case () of _ | B.null left -> i | left == "k" || left == "K" -> i * 1000 | otherwise -> i
1,237
convertOptions :: Parser Command convertOptions = fmap Convert $ ConvertOptions <$> strOption ( long "genome" <> short 'g' <> metavar "ASSEMBLY" <> help "e.g., hg19, or a file" ) <*> fmap (splitOn ",") (strOption ( long "rownames" <> short 'r' <> metavar "ROW LABELS" )) <*> fmap (splitOn ",") (strOption ( long "colnames" <> short 'c' <> metavar "COLOUMN LABELS" )) <*> fmap readInt' (strOption ( long "resolution" <> short 's' <> metavar "RESOLUTION" )) <*> switch ( long "sparse" <> help "whether to use sparse encoding" ) <*> switch ( long "symmetric" <> help "whether to use symmetric encoding" ) where readInt' x = let (Just (i, left)) = B.readInt $ B.pack x in case () of _ | B.null left -> i | left == "k" || left == "K" -> i * 1000 | otherwise -> i
1,237
convertOptions = fmap Convert $ ConvertOptions <$> strOption ( long "genome" <> short 'g' <> metavar "ASSEMBLY" <> help "e.g., hg19, or a file" ) <*> fmap (splitOn ",") (strOption ( long "rownames" <> short 'r' <> metavar "ROW LABELS" )) <*> fmap (splitOn ",") (strOption ( long "colnames" <> short 'c' <> metavar "COLOUMN LABELS" )) <*> fmap readInt' (strOption ( long "resolution" <> short 's' <> metavar "RESOLUTION" )) <*> switch ( long "sparse" <> help "whether to use sparse encoding" ) <*> switch ( long "symmetric" <> help "whether to use symmetric encoding" ) where readInt' x = let (Just (i, left)) = B.readInt $ B.pack x in case () of _ | B.null left -> i | left == "k" || left == "K" -> i * 1000 | otherwise -> i
1,204
false
true
0
16
619
314
145
169
null
null
xmonad/xmonad-contrib
XMonad/Hooks/Minimize.hs
bsd-3-clause
minimizeEventHook _ = return (All True)
39
minimizeEventHook _ = return (All True)
39
minimizeEventHook _ = return (All True)
39
false
false
0
7
5
18
8
10
null
null
mikeizbicki/Classification
src/AI/MathTmp.hs
bsd-3-clause
-- mean x = fst $ foldl' (\(!m, !n) x -> (m+(x-m)/(n+1),n+1)) (0,0) x -- |Arbitrary quantile q of an unsorted list. The quantile /q/ of /N/ -- |data points is the point whose (zero-based) index in the sorted -- |data set is closest to /q(N-1)/. quantile :: (Fractional b, Ord b) => Double -> [b] -> b quantile q = quantileAsc q . sort
340
quantile :: (Fractional b, Ord b) => Double -> [b] -> b quantile q = quantileAsc q . sort
89
quantile q = quantileAsc q . sort
33
true
true
0
8
70
51
28
23
null
null
christetreault/dmp-photo-booth-prime
DMP/Photobooth/Module.hs
gpl-3.0
finalizeTrigger ms = runModuleT (TriggerResult) ms TriggerMod.finalize
82
finalizeTrigger ms = runModuleT (TriggerResult) ms TriggerMod.finalize
82
finalizeTrigger ms = runModuleT (TriggerResult) ms TriggerMod.finalize
82
false
false
1
6
18
27
10
17
null
null
neongreen/hat
src/JS.hs
bsd-3-clause
makeAdmin :: JSFunction a => a makeAdmin = makeJSFunction "makeAdmin" ["nick"] [text| $.post("/user/" + nick + "/make-admin") .done(function () { location.reload(); }); |]
199
makeAdmin :: JSFunction a => a makeAdmin = makeJSFunction "makeAdmin" ["nick"] [text| $.post("/user/" + nick + "/make-admin") .done(function () { location.reload(); }); |]
199
makeAdmin = makeJSFunction "makeAdmin" ["nick"] [text| $.post("/user/" + nick + "/make-admin") .done(function () { location.reload(); }); |]
168
false
true
0
6
50
33
18
15
null
null
AlexanderPankiv/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
kindConKey = mkPreludeTyConUnique 69
65
kindConKey = mkPreludeTyConUnique 69
65
kindConKey = mkPreludeTyConUnique 69
65
false
false
0
5
32
9
4
5
null
null
byorgey/Idris-dev
src/Idris/DataOpts.hs
bsd-3-clause
collapseCons :: Name -> [(Name, Type)] -> Idris () collapseCons ty cons = do i <- getIState let cons' = map (\ (n, t) -> (n, map snd (getArgTys t))) cons allFR <- mapM (forceRec i) cons' if and allFR then detaggable (map getRetTy (map snd cons)) else return () -- not collapsible as not detaggable where setCollapsible :: Name -> Idris () setCollapsible n = do i <- getIState iLOG $ show n ++ " collapsible" case lookupCtxt n (idris_optimisation i) of (oi:_) -> do let oi' = oi { collapsible = True } let opts = addDef n oi' (idris_optimisation i) putIState (i { idris_optimisation = opts }) [] -> do let oi = Optimise True [] [] let opts = addDef n oi (idris_optimisation i) putIState (i { idris_optimisation = opts }) addIBC (IBCOpt n) forceRec :: IState -> (Name, [Type]) -> Idris Bool forceRec i (n, ts) = case lookupCtxt n (idris_optimisation i) of (oi:_) -> checkFR (forceable oi) 0 ts _ -> return False checkFR fs i [] = return True checkFR fs i (_ : xs) | i `elem` fs = checkFR fs (i + 1) xs checkFR fs i (t : xs) -- must be recursive or type is not collapsible = do let (rtf, rta) = unApply $ getRetTy t if (ty `elem` freeNames rtf) then checkFR fs (i+1) xs else return False detaggable :: [Type] -> Idris () detaggable rtys = do let rtyArgs = map (snd . unApply) rtys -- if every rtyArgs is disjoint with every other, it's detaggable, -- therefore also collapsible given forceable/recursive check if disjoint rtyArgs then mapM_ setCollapsible (ty : map fst cons) else return () disjoint :: [[Term]] -> Bool disjoint [] = True disjoint [x] = True disjoint (x : xs) = anyDisjoint x xs && disjoint xs anyDisjoint x [] = True anyDisjoint x (y : ys) = disjointCons x y disjointCons [] [] = False disjointCons [] y = False disjointCons x [] = False disjointCons (x : xs) (y : ys) = disjointCon x y || disjointCons xs ys disjointCon x y = let (cx, _) = unApply x (cy, _) = unApply y in case (cx, cy) of (P (DCon _ _) nx _, P (DCon _ _) ny _) -> nx /= ny _ -> False
2,601
collapseCons :: Name -> [(Name, Type)] -> Idris () collapseCons ty cons = do i <- getIState let cons' = map (\ (n, t) -> (n, map snd (getArgTys t))) cons allFR <- mapM (forceRec i) cons' if and allFR then detaggable (map getRetTy (map snd cons)) else return () -- not collapsible as not detaggable where setCollapsible :: Name -> Idris () setCollapsible n = do i <- getIState iLOG $ show n ++ " collapsible" case lookupCtxt n (idris_optimisation i) of (oi:_) -> do let oi' = oi { collapsible = True } let opts = addDef n oi' (idris_optimisation i) putIState (i { idris_optimisation = opts }) [] -> do let oi = Optimise True [] [] let opts = addDef n oi (idris_optimisation i) putIState (i { idris_optimisation = opts }) addIBC (IBCOpt n) forceRec :: IState -> (Name, [Type]) -> Idris Bool forceRec i (n, ts) = case lookupCtxt n (idris_optimisation i) of (oi:_) -> checkFR (forceable oi) 0 ts _ -> return False checkFR fs i [] = return True checkFR fs i (_ : xs) | i `elem` fs = checkFR fs (i + 1) xs checkFR fs i (t : xs) -- must be recursive or type is not collapsible = do let (rtf, rta) = unApply $ getRetTy t if (ty `elem` freeNames rtf) then checkFR fs (i+1) xs else return False detaggable :: [Type] -> Idris () detaggable rtys = do let rtyArgs = map (snd . unApply) rtys -- if every rtyArgs is disjoint with every other, it's detaggable, -- therefore also collapsible given forceable/recursive check if disjoint rtyArgs then mapM_ setCollapsible (ty : map fst cons) else return () disjoint :: [[Term]] -> Bool disjoint [] = True disjoint [x] = True disjoint (x : xs) = anyDisjoint x xs && disjoint xs anyDisjoint x [] = True anyDisjoint x (y : ys) = disjointCons x y disjointCons [] [] = False disjointCons [] y = False disjointCons x [] = False disjointCons (x : xs) (y : ys) = disjointCon x y || disjointCons xs ys disjointCon x y = let (cx, _) = unApply x (cy, _) = unApply y in case (cx, cy) of (P (DCon _ _) nx _, P (DCon _ _) ny _) -> nx /= ny _ -> False
2,601
collapseCons ty cons = do i <- getIState let cons' = map (\ (n, t) -> (n, map snd (getArgTys t))) cons allFR <- mapM (forceRec i) cons' if and allFR then detaggable (map getRetTy (map snd cons)) else return () -- not collapsible as not detaggable where setCollapsible :: Name -> Idris () setCollapsible n = do i <- getIState iLOG $ show n ++ " collapsible" case lookupCtxt n (idris_optimisation i) of (oi:_) -> do let oi' = oi { collapsible = True } let opts = addDef n oi' (idris_optimisation i) putIState (i { idris_optimisation = opts }) [] -> do let oi = Optimise True [] [] let opts = addDef n oi (idris_optimisation i) putIState (i { idris_optimisation = opts }) addIBC (IBCOpt n) forceRec :: IState -> (Name, [Type]) -> Idris Bool forceRec i (n, ts) = case lookupCtxt n (idris_optimisation i) of (oi:_) -> checkFR (forceable oi) 0 ts _ -> return False checkFR fs i [] = return True checkFR fs i (_ : xs) | i `elem` fs = checkFR fs (i + 1) xs checkFR fs i (t : xs) -- must be recursive or type is not collapsible = do let (rtf, rta) = unApply $ getRetTy t if (ty `elem` freeNames rtf) then checkFR fs (i+1) xs else return False detaggable :: [Type] -> Idris () detaggable rtys = do let rtyArgs = map (snd . unApply) rtys -- if every rtyArgs is disjoint with every other, it's detaggable, -- therefore also collapsible given forceable/recursive check if disjoint rtyArgs then mapM_ setCollapsible (ty : map fst cons) else return () disjoint :: [[Term]] -> Bool disjoint [] = True disjoint [x] = True disjoint (x : xs) = anyDisjoint x xs && disjoint xs anyDisjoint x [] = True anyDisjoint x (y : ys) = disjointCons x y disjointCons [] [] = False disjointCons [] y = False disjointCons x [] = False disjointCons (x : xs) (y : ys) = disjointCon x y || disjointCons xs ys disjointCon x y = let (cx, _) = unApply x (cy, _) = unApply y in case (cx, cy) of (P (DCon _ _) nx _, P (DCon _ _) ny _) -> nx /= ny _ -> False
2,550
false
true
3
17
1,021
1,003
485
518
null
null
frenetic-lang/nettle-openflow
src/Nettle/OpenFlow/Match.hs
bsd-3-clause
matches :: (PortID, EthernetFrame) -> Match -> Bool matches (inPort, frame) (m@Match { inPort=inPort', ipTypeOfService=ipTypeOfService',..}) = and [maybe True matchesInPort inPort', maybe True matchesSrcEthAddress srcEthAddress, maybe True matchesDstEthAddress dstEthAddress, maybe True matchesVLANID vLANID, maybe True matchesVLANPriority vLANPriority, maybe True matchesEthFrameType ethFrameType, maybe True matchesIPProtocol matchIPProtocol, maybe True matchesIPToS ipTypeOfService', matchesIPSourcePrefix srcIPAddress, matchesIPDestPrefix dstIPAddress, maybe True matchesSrcTransportPort srcTransportPort, maybe True matchesDstTransportPort dstTransportPort ] where ethHeader = hOccurs frame matchesInPort p = p == inPort matchesSrcEthAddress a = sourceMACAddress ethHeader == a matchesDstEthAddress a = destMACAddress ethHeader == a matchesVLANID a = case ethHeader of EthernetHeader {} -> True Ethernet8021Q {..}-> a == vlanId matchesVLANPriority a = case ethHeader of EthernetHeader {} -> True Ethernet8021Q {..} -> a == priorityCodePoint matchesEthFrameType t = t == typeCode ethHeader matchesIPProtocol protCode = case eth_ip_packet frame of Just pkt -> IP.ipProtocol (hOccurs pkt) == protCode _ -> True matchesIPToS tos = case eth_ip_packet frame of Just pkt -> tos == IP.dscp (hOccurs pkt) _ -> True matchesIPSourcePrefix prefix = case eth_ip_packet frame of Just pkt -> IP.ipSrcAddress (hOccurs pkt) `elemOfPrefix` prefix Nothing -> True matchesIPDestPrefix prefix = case eth_ip_packet frame of Just pkt -> IP.ipSrcAddress (hOccurs pkt) `elemOfPrefix` prefix Nothing -> True matchesSrcTransportPort sp = case eth_ip_packet frame of Just pkt -> case hOccurs pkt of IP.TCPInIP (srcPort, _) -> srcPort == sp IP.UDPInIP (srcPort, _) body -> srcPort == sp _ -> True Nothing -> True matchesDstTransportPort dp = case eth_ip_packet frame of Just ipPacket -> case hOccurs ipPacket of IP.TCPInIP (_, dstPort) -> dstPort == dp IP.UDPInIP (_, dstPort) body -> dstPort == dp _ -> True Nothing -> True
2,914
matches :: (PortID, EthernetFrame) -> Match -> Bool matches (inPort, frame) (m@Match { inPort=inPort', ipTypeOfService=ipTypeOfService',..}) = and [maybe True matchesInPort inPort', maybe True matchesSrcEthAddress srcEthAddress, maybe True matchesDstEthAddress dstEthAddress, maybe True matchesVLANID vLANID, maybe True matchesVLANPriority vLANPriority, maybe True matchesEthFrameType ethFrameType, maybe True matchesIPProtocol matchIPProtocol, maybe True matchesIPToS ipTypeOfService', matchesIPSourcePrefix srcIPAddress, matchesIPDestPrefix dstIPAddress, maybe True matchesSrcTransportPort srcTransportPort, maybe True matchesDstTransportPort dstTransportPort ] where ethHeader = hOccurs frame matchesInPort p = p == inPort matchesSrcEthAddress a = sourceMACAddress ethHeader == a matchesDstEthAddress a = destMACAddress ethHeader == a matchesVLANID a = case ethHeader of EthernetHeader {} -> True Ethernet8021Q {..}-> a == vlanId matchesVLANPriority a = case ethHeader of EthernetHeader {} -> True Ethernet8021Q {..} -> a == priorityCodePoint matchesEthFrameType t = t == typeCode ethHeader matchesIPProtocol protCode = case eth_ip_packet frame of Just pkt -> IP.ipProtocol (hOccurs pkt) == protCode _ -> True matchesIPToS tos = case eth_ip_packet frame of Just pkt -> tos == IP.dscp (hOccurs pkt) _ -> True matchesIPSourcePrefix prefix = case eth_ip_packet frame of Just pkt -> IP.ipSrcAddress (hOccurs pkt) `elemOfPrefix` prefix Nothing -> True matchesIPDestPrefix prefix = case eth_ip_packet frame of Just pkt -> IP.ipSrcAddress (hOccurs pkt) `elemOfPrefix` prefix Nothing -> True matchesSrcTransportPort sp = case eth_ip_packet frame of Just pkt -> case hOccurs pkt of IP.TCPInIP (srcPort, _) -> srcPort == sp IP.UDPInIP (srcPort, _) body -> srcPort == sp _ -> True Nothing -> True matchesDstTransportPort dp = case eth_ip_packet frame of Just ipPacket -> case hOccurs ipPacket of IP.TCPInIP (_, dstPort) -> dstPort == dp IP.UDPInIP (_, dstPort) body -> dstPort == dp _ -> True Nothing -> True
2,914
matches (inPort, frame) (m@Match { inPort=inPort', ipTypeOfService=ipTypeOfService',..}) = and [maybe True matchesInPort inPort', maybe True matchesSrcEthAddress srcEthAddress, maybe True matchesDstEthAddress dstEthAddress, maybe True matchesVLANID vLANID, maybe True matchesVLANPriority vLANPriority, maybe True matchesEthFrameType ethFrameType, maybe True matchesIPProtocol matchIPProtocol, maybe True matchesIPToS ipTypeOfService', matchesIPSourcePrefix srcIPAddress, matchesIPDestPrefix dstIPAddress, maybe True matchesSrcTransportPort srcTransportPort, maybe True matchesDstTransportPort dstTransportPort ] where ethHeader = hOccurs frame matchesInPort p = p == inPort matchesSrcEthAddress a = sourceMACAddress ethHeader == a matchesDstEthAddress a = destMACAddress ethHeader == a matchesVLANID a = case ethHeader of EthernetHeader {} -> True Ethernet8021Q {..}-> a == vlanId matchesVLANPriority a = case ethHeader of EthernetHeader {} -> True Ethernet8021Q {..} -> a == priorityCodePoint matchesEthFrameType t = t == typeCode ethHeader matchesIPProtocol protCode = case eth_ip_packet frame of Just pkt -> IP.ipProtocol (hOccurs pkt) == protCode _ -> True matchesIPToS tos = case eth_ip_packet frame of Just pkt -> tos == IP.dscp (hOccurs pkt) _ -> True matchesIPSourcePrefix prefix = case eth_ip_packet frame of Just pkt -> IP.ipSrcAddress (hOccurs pkt) `elemOfPrefix` prefix Nothing -> True matchesIPDestPrefix prefix = case eth_ip_packet frame of Just pkt -> IP.ipSrcAddress (hOccurs pkt) `elemOfPrefix` prefix Nothing -> True matchesSrcTransportPort sp = case eth_ip_packet frame of Just pkt -> case hOccurs pkt of IP.TCPInIP (srcPort, _) -> srcPort == sp IP.UDPInIP (srcPort, _) body -> srcPort == sp _ -> True Nothing -> True matchesDstTransportPort dp = case eth_ip_packet frame of Just ipPacket -> case hOccurs ipPacket of IP.TCPInIP (_, dstPort) -> dstPort == dp IP.UDPInIP (_, dstPort) body -> dstPort == dp _ -> True Nothing -> True
2,862
false
true
0
14
1,180
676
336
340
null
null
vincenthz/language-c
src/Language/C/Analysis/AstAnalysis.hs
bsd-3-clause
tStmt c (CSwitch e s ni) = tExpr c RValue e >>= checkIntegral' ni >> tStmt (SwitchCtx : c) s
104
tStmt c (CSwitch e s ni) = tExpr c RValue e >>= checkIntegral' ni >> tStmt (SwitchCtx : c) s
104
tStmt c (CSwitch e s ni) = tExpr c RValue e >>= checkIntegral' ni >> tStmt (SwitchCtx : c) s
104
false
false
0
8
31
51
24
27
null
null
diku-dk/futhark
src/Futhark/IR/Primitive.hs
isc
doFloatBinOp _ _ _ _ _ = Nothing
32
doFloatBinOp _ _ _ _ _ = Nothing
32
doFloatBinOp _ _ _ _ _ = Nothing
32
false
false
0
5
7
17
8
9
null
null
xmonad/xmonad-contrib
XMonad/Actions/CycleWS.hs
bsd-3-clause
-- $toggling -- | Toggle to the workspace displayed previously. toggleWS :: X () toggleWS = toggleWS' []
105
toggleWS :: X () toggleWS = toggleWS' []
40
toggleWS = toggleWS' []
23
true
true
0
6
18
23
12
11
null
null
mydaum/cabal
cabal-install/Distribution/Solver/Types/PackageIndex.hs
bsd-3-clause
invariant :: Package pkg => PackageIndex pkg -> Bool invariant (PackageIndex m) = all (uncurry goodBucket) (Map.toList m) where goodBucket _ [] = False goodBucket name (pkg0:pkgs0) = check (packageId pkg0) pkgs0 where check pkgid [] = packageName pkgid == name check pkgid (pkg':pkgs) = packageName pkgid == name && pkgid < pkgid' && check pkgid' pkgs where pkgid' = packageId pkg' -- -- * Internal helpers --
526
invariant :: Package pkg => PackageIndex pkg -> Bool invariant (PackageIndex m) = all (uncurry goodBucket) (Map.toList m) where goodBucket _ [] = False goodBucket name (pkg0:pkgs0) = check (packageId pkg0) pkgs0 where check pkgid [] = packageName pkgid == name check pkgid (pkg':pkgs) = packageName pkgid == name && pkgid < pkgid' && check pkgid' pkgs where pkgid' = packageId pkg' -- -- * Internal helpers --
526
invariant (PackageIndex m) = all (uncurry goodBucket) (Map.toList m) where goodBucket _ [] = False goodBucket name (pkg0:pkgs0) = check (packageId pkg0) pkgs0 where check pkgid [] = packageName pkgid == name check pkgid (pkg':pkgs) = packageName pkgid == name && pkgid < pkgid' && check pkgid' pkgs where pkgid' = packageId pkg' -- -- * Internal helpers --
473
false
true
1
11
184
170
84
86
null
null
stefan-j/ProjectEuler
q9.hs
mit
is_triple (a,b,c) | not ((a < b) && (b < c)) = False | a^2 + b^2 /= c^2 = False | a + b + c /= 1000 = False | otherwise = True
138
is_triple (a,b,c) | not ((a < b) && (b < c)) = False | a^2 + b^2 /= c^2 = False | a + b + c /= 1000 = False | otherwise = True
138
is_triple (a,b,c) | not ((a < b) && (b < c)) = False | a^2 + b^2 /= c^2 = False | a + b + c /= 1000 = False | otherwise = True
138
false
false
0
12
46
115
56
59
null
null
andreagenso/java2scala
src/J2s/Ast/Semantic.hs
apache-2.0
sem_PackageOrTypeName_NilPackageOrTypeName = NilPackageOrTypeName
65
sem_PackageOrTypeName_NilPackageOrTypeName = NilPackageOrTypeName
65
sem_PackageOrTypeName_NilPackageOrTypeName = NilPackageOrTypeName
65
false
false
0
4
2
6
3
3
null
null
Copilot-Language/sbv-for-copilot
Data/SBV.hs
bsd-3-clause
-- | Is the floating-point number 0? (Note that both +0 and -0 will satisfy this predicate.) isZeroFP :: (Floating a, SymWord a) => SBV a -> SBool isZeroFP = liftFPPredicate "fp.isZero" (== 0)
192
isZeroFP :: (Floating a, SymWord a) => SBV a -> SBool isZeroFP = liftFPPredicate "fp.isZero" (== 0)
99
isZeroFP = liftFPPredicate "fp.isZero" (== 0)
45
true
true
0
7
33
43
23
20
null
null
mit-plv/riscv-semantics
src/Spec/Decode.hs
bsd-3-clause
funct7_DIVU :: MachineInt; funct7_DIVU = 0b0000001
57
funct7_DIVU :: MachineInt funct7_DIVU = 0b0000001
53
funct7_DIVU = 0b0000001
25
false
true
1
5
12
16
7
9
null
null
tom-szczarkowski/matasano-crypto-puzzles-solutions
set6/DSA.hs
mit
sha1 :: [Word8] -> [Word8] sha1 s = let (SHA.Digest bs) = SHA.sha1 $ encode s in decode bs
90
sha1 :: [Word8] -> [Word8] sha1 s = let (SHA.Digest bs) = SHA.sha1 $ encode s in decode bs
90
sha1 s = let (SHA.Digest bs) = SHA.sha1 $ encode s in decode bs
63
false
true
0
11
18
56
27
29
null
null
syoyo/lucille
rnd/HaskellRSLCompiler/RSL/CodeGenLLVM.hs
bsd-3-clause
initLLVMState = LLVMState { globals = [] , n = 0 }
114
initLLVMState = LLVMState { globals = [] , n = 0 }
114
initLLVMState = LLVMState { globals = [] , n = 0 }
114
false
false
0
7
75
22
13
9
null
null
tjakway/ghcjvm
compiler/main/DynFlags.hs
bsd-3-clause
safeDirectImpsReq :: DynFlags -> Bool safeDirectImpsReq d = safeLanguageOn d
76
safeDirectImpsReq :: DynFlags -> Bool safeDirectImpsReq d = safeLanguageOn d
76
safeDirectImpsReq d = safeLanguageOn d
38
false
true
0
7
9
26
11
15
null
null
brendanhay/gogol
gogol-android-enterprise/gen/Network/Google/Resource/AndroidEnterprise/ManagedConfigurationsforDevice/Get.hs
mpl-2.0
-- | The ID of the managed configuration (a product ID), e.g. -- \"app:com.google.android.gm\". mcdgManagedConfigurationForDeviceId :: Lens' ManagedConfigurationsforDeviceGet Text mcdgManagedConfigurationForDeviceId = lens _mcdgManagedConfigurationForDeviceId (\ s a -> s{_mcdgManagedConfigurationForDeviceId = a})
331
mcdgManagedConfigurationForDeviceId :: Lens' ManagedConfigurationsforDeviceGet Text mcdgManagedConfigurationForDeviceId = lens _mcdgManagedConfigurationForDeviceId (\ s a -> s{_mcdgManagedConfigurationForDeviceId = a})
235
mcdgManagedConfigurationForDeviceId = lens _mcdgManagedConfigurationForDeviceId (\ s a -> s{_mcdgManagedConfigurationForDeviceId = a})
151
true
true
0
9
46
43
23
20
null
null
tismith/tlisp
src/Primitives.hs
mit
anyNumListDiv badArgList = throwError $ NumArgs 1 badArgList
60
anyNumListDiv badArgList = throwError $ NumArgs 1 badArgList
60
anyNumListDiv badArgList = throwError $ NumArgs 1 badArgList
60
false
false
0
6
7
18
8
10
null
null
nablaa/hchesslib
src/Chess/Internal/Game.hs
gpl-2.0
updateWhiteCastlings (State _ _ castlings _ _ _ _) (Capture (Piece Black _) _ (7, 0)) = delete Long castlings
109
updateWhiteCastlings (State _ _ castlings _ _ _ _) (Capture (Piece Black _) _ (7, 0)) = delete Long castlings
109
updateWhiteCastlings (State _ _ castlings _ _ _ _) (Capture (Piece Black _) _ (7, 0)) = delete Long castlings
109
false
false
0
9
19
58
29
29
null
null
atupal/xmonad-mirror
xmonad/src/XMonad/Operations.hs
mit
-- | Set the layout of the currently viewed workspace setLayout :: Layout Window -> X () setLayout l = do ss@(W.StackSet { W.current = c@(W.Screen { W.workspace = ws })}) <- gets windowset handleMessage (W.layout ws) (SomeMessage ReleaseResources) windows $ const $ ss {W.current = c { W.workspace = ws { W.layout = l } } } ------------------------------------------------------------------------ -- Utilities -- | Return workspace visible on screen 'sc', or 'Nothing'.
483
setLayout :: Layout Window -> X () setLayout l = do ss@(W.StackSet { W.current = c@(W.Screen { W.workspace = ws })}) <- gets windowset handleMessage (W.layout ws) (SomeMessage ReleaseResources) windows $ const $ ss {W.current = c { W.workspace = ws { W.layout = l } } } ------------------------------------------------------------------------ -- Utilities -- | Return workspace visible on screen 'sc', or 'Nothing'.
429
setLayout l = do ss@(W.StackSet { W.current = c@(W.Screen { W.workspace = ws })}) <- gets windowset handleMessage (W.layout ws) (SomeMessage ReleaseResources) windows $ const $ ss {W.current = c { W.workspace = ws { W.layout = l } } } ------------------------------------------------------------------------ -- Utilities -- | Return workspace visible on screen 'sc', or 'Nothing'.
394
true
true
0
17
84
146
76
70
null
null
avh4/elm-format
elm-format-lib/src/Parse/Helpers.hs
bsd-3-clause
commaSep1 :: IParser (Comments -> Comments -> a) -> IParser (Comments -> Comments -> [a]) commaSep1 = spaceySepBy1'' comma
124
commaSep1 :: IParser (Comments -> Comments -> a) -> IParser (Comments -> Comments -> [a]) commaSep1 = spaceySepBy1'' comma
124
commaSep1 = spaceySepBy1'' comma
34
false
true
0
10
20
49
25
24
null
null
jtdaugherty/language-mixal
src/Language/MIXAL/Parser.hs
bsd-3-clause
parseBinOpExpr :: Parser S.Expr parseBinOpExpr = do e1 <- choice [ S.AtExpr <$> parseAtomicExpr , parseSignedExpr ] op1 <- parseBinOp e2 <- choice [ S.AtExpr <$> parseAtomicExpr , parseSignedExpr ] rest <- many $ do op <- parseBinOp e <- choice [ S.AtExpr <$> parseAtomicExpr , parseSignedExpr ] return (op, e) return $ S.BinOp e1 op1 e2 rest
498
parseBinOpExpr :: Parser S.Expr parseBinOpExpr = do e1 <- choice [ S.AtExpr <$> parseAtomicExpr , parseSignedExpr ] op1 <- parseBinOp e2 <- choice [ S.AtExpr <$> parseAtomicExpr , parseSignedExpr ] rest <- many $ do op <- parseBinOp e <- choice [ S.AtExpr <$> parseAtomicExpr , parseSignedExpr ] return (op, e) return $ S.BinOp e1 op1 e2 rest
498
parseBinOpExpr = do e1 <- choice [ S.AtExpr <$> parseAtomicExpr , parseSignedExpr ] op1 <- parseBinOp e2 <- choice [ S.AtExpr <$> parseAtomicExpr , parseSignedExpr ] rest <- many $ do op <- parseBinOp e <- choice [ S.AtExpr <$> parseAtomicExpr , parseSignedExpr ] return (op, e) return $ S.BinOp e1 op1 e2 rest
466
false
true
0
15
213
137
66
71
null
null
leshchevds/ganeti
src/Ganeti/Constants.hs
bsd-2-clause
-- | The set of storage types for which node storage reporting is available -- | (as used by LUQueryNodeStorage) stsReportNodeStorage :: FrozenSet String stsReportNodeStorage = ConstantUtils.union stsReport $ ConstantUtils.mkSet [ stSharedFile , stGluster ]
426
stsReportNodeStorage :: FrozenSet String stsReportNodeStorage = ConstantUtils.union stsReport $ ConstantUtils.mkSet [ stSharedFile , stGluster ]
313
stsReportNodeStorage = ConstantUtils.union stsReport $ ConstantUtils.mkSet [ stSharedFile , stGluster ]
272
true
true
0
7
203
36
19
17
null
null
aelve/ilist
bench/Functions.hs
bsd-3-clause
ifoldr_zip :: (Int -> a -> b -> b) -> b -> [a] -> b ifoldr_zip f a xs = foldr (\(i, x) acc -> f i x acc) a (zip [0..] xs)
121
ifoldr_zip :: (Int -> a -> b -> b) -> b -> [a] -> b ifoldr_zip f a xs = foldr (\(i, x) acc -> f i x acc) a (zip [0..] xs)
121
ifoldr_zip f a xs = foldr (\(i, x) acc -> f i x acc) a (zip [0..] xs)
69
false
true
0
9
32
89
47
42
null
null
gibiansky/hlint
src/Hint/Match.hs
bsd-3-clause
rebracket (Paren l e') (v, e) | e' == e = (v, Paren l e)
58
rebracket (Paren l e') (v, e) | e' == e = (v, Paren l e)
58
rebracket (Paren l e') (v, e) | e' == e = (v, Paren l e)
58
false
false
0
8
16
48
23
25
null
null
UBMLtonGroup/timberc
src/Kind.hs
bsd-3-clause
kiDecl env (i, DType vs t) = do env' <- newTScope env vs (cs1,k1) <- kiTExp env' (tAp' i vs) (cs2,k2) <- kiTExp env' t return ((k1,k2) : cs1 ++ cs2)
296
kiDecl env (i, DType vs t) = do env' <- newTScope env vs (cs1,k1) <- kiTExp env' (tAp' i vs) (cs2,k2) <- kiTExp env' t return ((k1,k2) : cs1 ++ cs2)
296
kiDecl env (i, DType vs t) = do env' <- newTScope env vs (cs1,k1) <- kiTExp env' (tAp' i vs) (cs2,k2) <- kiTExp env' t return ((k1,k2) : cs1 ++ cs2)
296
false
false
0
11
178
101
50
51
null
null
kawu/crf-chain2-tiers
src/Data/CRF/Chain2/Tiers/Inference.hs
bsd-2-clause
---------------------------------------------------- -- Potential ---------------------------------------------------- -- | Observation potential on a given position and a -- given label (identified by index). onWord :: Model -> Xs -> Int -> CbIx -> L.LogFloat onWord crf xs i u = product . map (phi crf) $ obFeatsOn xs i u
329
onWord :: Model -> Xs -> Int -> CbIx -> L.LogFloat onWord crf xs i u = product . map (phi crf) $ obFeatsOn xs i u
117
onWord crf xs i u = product . map (phi crf) $ obFeatsOn xs i u
66
true
true
0
9
52
67
35
32
null
null
uuhan/Idris-dev
src/IRTS/CodegenC.hs
bsd-3-clause
doOp v (LSLe (ATInt ITBig)) [l, r] = v ++ "idris_bigLe(vm, " ++ creg l ++ ", " ++ creg r ++ ")"
95
doOp v (LSLe (ATInt ITBig)) [l, r] = v ++ "idris_bigLe(vm, " ++ creg l ++ ", " ++ creg r ++ ")"
95
doOp v (LSLe (ATInt ITBig)) [l, r] = v ++ "idris_bigLe(vm, " ++ creg l ++ ", " ++ creg r ++ ")"
95
false
false
1
14
22
62
28
34
null
null
ghcjs/jsaddle-dom
src/JSDOM/Generated/Touch.hs
mit
-- | <https://developer.mozilla.org/en-US/docs/Web/API/Touch.webkitForce Mozilla Touch.webkitForce documentation> getWebkitForce :: (MonadDOM m) => Touch -> m Float getWebkitForce self = liftDOM (realToFrac <$> ((self ^. js "webkitForce") >>= valToNumber))
265
getWebkitForce :: (MonadDOM m) => Touch -> m Float getWebkitForce self = liftDOM (realToFrac <$> ((self ^. js "webkitForce") >>= valToNumber))
150
getWebkitForce self = liftDOM (realToFrac <$> ((self ^. js "webkitForce") >>= valToNumber))
99
true
true
0
11
35
58
30
28
null
null
imh/plover
src/Language/Plover/Macros.hs
mit
blockMatrix (_ : dims) exprs = let size = product dims in let exprs' = map (blockMatrix dims) (split size exprs) in foldr1 (:#) (map Ptr exprs') where split _ [] = [] split n ds = take n ds : split n (drop n ds) -- Make a length 1 vector from x
263
blockMatrix (_ : dims) exprs = let size = product dims in let exprs' = map (blockMatrix dims) (split size exprs) in foldr1 (:#) (map Ptr exprs') where split _ [] = [] split n ds = take n ds : split n (drop n ds) -- Make a length 1 vector from x
263
blockMatrix (_ : dims) exprs = let size = product dims in let exprs' = map (blockMatrix dims) (split size exprs) in foldr1 (:#) (map Ptr exprs') where split _ [] = [] split n ds = take n ds : split n (drop n ds) -- Make a length 1 vector from x
263
false
false
1
13
72
126
61
65
null
null
danielcnorris/haskell-spelling-corrector
src/Correct/Core.hs
mit
deletes :: ByteString -> [ByteString] deletes w = if B.null w then [] else splits' w >>= \(first, second) -> return $ B.concat [first, B.tail second]
202
deletes :: ByteString -> [ByteString] deletes w = if B.null w then [] else splits' w >>= \(first, second) -> return $ B.concat [first, B.tail second]
202
deletes w = if B.null w then [] else splits' w >>= \(first, second) -> return $ B.concat [first, B.tail second]
164
false
true
0
12
78
74
39
35
null
null
hesiod/OpenGL
src/Graphics/Rendering/OpenGL/GL/Texturing/Queries.hs
bsd-3-clause
textureIntensitySize :: QueryableTextureTarget t => TextureQuery t GLsizei textureIntensitySize t level = makeGettableStateVar $ getTexLevelParameteriNoProxy fromIntegral t level TextureIntensitySize
208
textureIntensitySize :: QueryableTextureTarget t => TextureQuery t GLsizei textureIntensitySize t level = makeGettableStateVar $ getTexLevelParameteriNoProxy fromIntegral t level TextureIntensitySize
208
textureIntensitySize t level = makeGettableStateVar $ getTexLevelParameteriNoProxy fromIntegral t level TextureIntensitySize
133
false
true
2
7
27
46
20
26
null
null
ducis/haAni
hs/common/Graphics/Rendering/OpenGL/GL/Evaluators.hs
gpl-2.0
-------------------------------------------------------------------------------- peekControlPoints1 :: (ControlPoint c, Domain d) => MapDescriptor d -> Ptr d -> IO [c d] peekControlPoints1 descriptor ptr = mapM peekControlPoint (controlPointPtrs1 descriptor ptr)
269
peekControlPoints1 :: (ControlPoint c, Domain d) => MapDescriptor d -> Ptr d -> IO [c d] peekControlPoints1 descriptor ptr = mapM peekControlPoint (controlPointPtrs1 descriptor ptr)
187
peekControlPoints1 descriptor ptr = mapM peekControlPoint (controlPointPtrs1 descriptor ptr)
95
true
true
0
10
32
69
33
36
null
null
patperry/hs-linear-algebra
tests-old/Banded.hs
bsd-3-clause
prop_cols_len (a :: B) = length (cols a) == numCols a
57
prop_cols_len (a :: B) = length (cols a) == numCols a
57
prop_cols_len (a :: B) = length (cols a) == numCols a
57
false
false
0
8
14
32
15
17
null
null
christiaanb/Idris-dev
src/Core/ProofState.hs
bsd-3-clause
attack ctxt env _ = fail "Not an attackable hole"
49
attack ctxt env _ = fail "Not an attackable hole"
49
attack ctxt env _ = fail "Not an attackable hole"
49
false
false
0
4
9
19
7
12
null
null
ulricha/dsh
src/Database/DSH/Tests/DSHComprehensions.hs
bsd-3-clause
groupjoin_sum_guard :: Q ([Integer], [Integer]) -> Q [Integer] groupjoin_sum_guard (view -> (njxs, njys)) = [ x | x <- njxs , let ys = [ 2 * y | y <- njys, x == y ] , 5 < length ys ]
202
groupjoin_sum_guard :: Q ([Integer], [Integer]) -> Q [Integer] groupjoin_sum_guard (view -> (njxs, njys)) = [ x | x <- njxs , let ys = [ 2 * y | y <- njys, x == y ] , 5 < length ys ]
202
groupjoin_sum_guard (view -> (njxs, njys)) = [ x | x <- njxs , let ys = [ 2 * y | y <- njys, x == y ] , 5 < length ys ]
139
false
true
0
12
61
107
57
50
null
null
ekmett/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxSTC_CSOUND_IRATE_VAR :: Int wxSTC_CSOUND_IRATE_VAR = 13
57
wxSTC_CSOUND_IRATE_VAR :: Int wxSTC_CSOUND_IRATE_VAR = 13
57
wxSTC_CSOUND_IRATE_VAR = 13
27
false
true
0
6
5
18
7
11
null
null