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
sdiehl/ghc
libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs
bsd-3-clause
doublePrimL :: Rational -> Lit doublePrimL = DoublePrimL
56
doublePrimL :: Rational -> Lit doublePrimL = DoublePrimL
56
doublePrimL = DoublePrimL
25
false
true
0
5
7
15
8
7
null
null
Michaelt293/isotope
src/Isotope/Base.hs
gpl-3.0
-- | Selects an isotope of element based on the isotope's mass number -- ('IntegerMass'). selectIsotope :: ElementSymbol -> MassNumber -> Maybe Isotope selectIsotope sym massNum = find (\iso -> (massNumber . nucleons) iso == massNum) isotopeList where isotopeList = isotopes sym -- | Exact masses for all naturally-occurring isotopes for an element.
357
selectIsotope :: ElementSymbol -> MassNumber -> Maybe Isotope selectIsotope sym massNum = find (\iso -> (massNumber . nucleons) iso == massNum) isotopeList where isotopeList = isotopes sym -- | Exact masses for all naturally-occurring isotopes for an element.
267
selectIsotope sym massNum = find (\iso -> (massNumber . nucleons) iso == massNum) isotopeList where isotopeList = isotopes sym -- | Exact masses for all naturally-occurring isotopes for an element.
205
true
true
1
11
60
76
36
40
null
null
chpatrick/hchip
HChip/Sound.hs
mit
planVolumes = concatMap (\s -> map (step s) [1..stepTime s])
60
planVolumes = concatMap (\s -> map (step s) [1..stepTime s])
60
planVolumes = concatMap (\s -> map (step s) [1..stepTime s])
60
false
false
0
10
9
36
18
18
null
null
remram44/haskell-rps
Rps.hs
bsd-3-clause
playRound :: (Num a, Show a) => StdGen -> (a, a) -> IO () playRound g scores = do (whoWon, g) <- play g case whoWon of PLAYER -> putStrLn "The player won" COMPUTER -> putStrLn "The computer won" DRAW -> putStrLn "It was a draw" scores <- return (updateScores scores whoWon) putStrLn ("Score is " ++ show (fst scores) ++ " to " ++ show (snd scores)) again <- askPlayAgain if again then playRound g scores else return () -- Entry point: just starts playRound with null scores
544
playRound :: (Num a, Show a) => StdGen -> (a, a) -> IO () playRound g scores = do (whoWon, g) <- play g case whoWon of PLAYER -> putStrLn "The player won" COMPUTER -> putStrLn "The computer won" DRAW -> putStrLn "It was a draw" scores <- return (updateScores scores whoWon) putStrLn ("Score is " ++ show (fst scores) ++ " to " ++ show (snd scores)) again <- askPlayAgain if again then playRound g scores else return () -- Entry point: just starts playRound with null scores
544
playRound g scores = do (whoWon, g) <- play g case whoWon of PLAYER -> putStrLn "The player won" COMPUTER -> putStrLn "The computer won" DRAW -> putStrLn "It was a draw" scores <- return (updateScores scores whoWon) putStrLn ("Score is " ++ show (fst scores) ++ " to " ++ show (snd scores)) again <- askPlayAgain if again then playRound g scores else return () -- Entry point: just starts playRound with null scores
486
false
true
0
14
159
186
89
97
null
null
athanclark/Idris-dev
src/Idris/IdrisDoc.hs
bsd-3-clause
getNs _ = []
20
getNs _ = []
20
getNs _ = []
20
false
false
0
5
11
11
5
6
null
null
prt2121/haskell-practice
parconc/distrib-db/Database.hs
apache-2.0
-- exercise set :: Database -> Key -> Value -> Process () set db k v = error "not implemented!"
96
set :: Database -> Key -> Value -> Process () set db k v = error "not implemented!"
83
set db k v = error "not implemented!"
37
true
true
0
10
20
44
20
24
null
null
svenpanne/tiger
chapter01/SLP.hs
bsd-3-clause
maxArgsExp (EseqExp s e) = maxArgs s `max` maxArgsExp e
55
maxArgsExp (EseqExp s e) = maxArgs s `max` maxArgsExp e
55
maxArgsExp (EseqExp s e) = maxArgs s `max` maxArgsExp e
55
false
false
0
7
9
29
14
15
null
null
jvilar/hrows
lib/Model/Expression/Parser.hs
gpl-2.0
binaryLevel :: Parser Expression -> Parser (Maybe BinaryOpInfo) -> Parser Expression binaryLevel nextLevel operator = nextLevel >>= go where go left = do mop <- operator case mop of Nothing -> return left Just op -> nextLevel >>= go . mkBinary op left -- logical -> conjunction (orOperator conjunction)*
360
binaryLevel :: Parser Expression -> Parser (Maybe BinaryOpInfo) -> Parser Expression binaryLevel nextLevel operator = nextLevel >>= go where go left = do mop <- operator case mop of Nothing -> return left Just op -> nextLevel >>= go . mkBinary op left -- logical -> conjunction (orOperator conjunction)*
360
binaryLevel nextLevel operator = nextLevel >>= go where go left = do mop <- operator case mop of Nothing -> return left Just op -> nextLevel >>= go . mkBinary op left -- logical -> conjunction (orOperator conjunction)*
275
false
true
1
12
105
108
47
61
null
null
pxqr/intset
src/Data/IntervalSet/Internal.hs
bsd-3-clause
partition :: (Key -> Bool) -> IntSet -> (IntSet, IntSet) partition f = unStrict . go where -- TODO use where clauses go (Bin p m l r) = let ll :*: lr = go l rl :*: rr = go r -- in both cases we could have Nil and Fin in bin p m ll rl :*: bin p m lr rr go (Tip p bm) = let bm' = filterBitMap p f bm -- in both cases we could have Nil and Fin in tip p bm' :*: tip p (bm' `xor` bm) go (Fin p m) = let (l, r) = L.partition f (listFin p m) in fromList l :*: fromList r go Nil = Nil :*: Nil {-------------------------------------------------------------------- Min/max --------------------------------------------------------------------} -- | /O(min(W, n))/ or /O(1)/. Find minimal element of the set. -- If set is empty then min is undefined. --
876
partition :: (Key -> Bool) -> IntSet -> (IntSet, IntSet) partition f = unStrict . go where -- TODO use where clauses go (Bin p m l r) = let ll :*: lr = go l rl :*: rr = go r -- in both cases we could have Nil and Fin in bin p m ll rl :*: bin p m lr rr go (Tip p bm) = let bm' = filterBitMap p f bm -- in both cases we could have Nil and Fin in tip p bm' :*: tip p (bm' `xor` bm) go (Fin p m) = let (l, r) = L.partition f (listFin p m) in fromList l :*: fromList r go Nil = Nil :*: Nil {-------------------------------------------------------------------- Min/max --------------------------------------------------------------------} -- | /O(min(W, n))/ or /O(1)/. Find minimal element of the set. -- If set is empty then min is undefined. --
876
partition f = unStrict . go where -- TODO use where clauses go (Bin p m l r) = let ll :*: lr = go l rl :*: rr = go r -- in both cases we could have Nil and Fin in bin p m ll rl :*: bin p m lr rr go (Tip p bm) = let bm' = filterBitMap p f bm -- in both cases we could have Nil and Fin in tip p bm' :*: tip p (bm' `xor` bm) go (Fin p m) = let (l, r) = L.partition f (listFin p m) in fromList l :*: fromList r go Nil = Nil :*: Nil {-------------------------------------------------------------------- Min/max --------------------------------------------------------------------} -- | /O(min(W, n))/ or /O(1)/. Find minimal element of the set. -- If set is empty then min is undefined. --
819
false
true
0
11
281
251
125
126
null
null
ghcjs/jsaddle-dom
src/JSDOM/Generated/IDBObjectStore.hs
mit
-- | <https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore.put Mozilla IDBObjectStore.put documentation> put_ :: (MonadDOM m, ToJSVal value, ToJSVal key) => IDBObjectStore -> value -> Maybe key -> m () put_ self value key = liftDOM (void (self ^. jsf "put" [toJSVal value, toJSVal key]))
313
put_ :: (MonadDOM m, ToJSVal value, ToJSVal key) => IDBObjectStore -> value -> Maybe key -> m () put_ self value key = liftDOM (void (self ^. jsf "put" [toJSVal value, toJSVal key]))
196
put_ self value key = liftDOM (void (self ^. jsf "put" [toJSVal value, toJSVal key]))
87
true
true
0
12
53
93
46
47
null
null
dicomgrid/dicom-haskell-library
src/Data/DICOM/Dictionary.hs
gpl-3.0
dopplercorrectionangle :: B.ByteString -> Element dopplercorrectionangle = fd $ tag (TagGroup 0x0018) (TagElement 0x6034)
121
dopplercorrectionangle :: B.ByteString -> Element dopplercorrectionangle = fd $ tag (TagGroup 0x0018) (TagElement 0x6034)
121
dopplercorrectionangle = fd $ tag (TagGroup 0x0018) (TagElement 0x6034)
71
false
true
0
8
13
44
20
24
null
null
junjihashimoto/th-cas
Algebra/CAS/Solve.hs
mit
rSolve :: [Formula] -> [(Formula,Formula)] rSolve [] = []
57
rSolve :: [Formula] -> [(Formula,Formula)] rSolve [] = []
57
rSolve [] = []
14
false
true
0
9
8
40
20
20
null
null
rahulmutt/ghcvm
compiler/Eta/Specialise/Rules.hs
bsd-3-clause
ruleCantMatch :: [Maybe Name] -> [Maybe Name] -> Bool -- ^ @ruleCantMatch tpl actual@ returns True only if @actual@ -- definitely can't match @tpl@ by instantiating @tpl@. -- It's only a one-way match; unlike instance matching we -- don't consider unification. -- -- Notice that [_$_] -- @ruleCantMatch [Nothing] [Just n2] = False@ -- Reason: a template variable can be instantiated by a constant -- Also: -- @ruleCantMatch [Just n1] [Nothing] = False@ -- Reason: a local variable @v@ in the actuals might [_$_] ruleCantMatch (Just n1 : ts) (Just n2 : as) = n1 /= n2 || ruleCantMatch ts as
610
ruleCantMatch :: [Maybe Name] -> [Maybe Name] -> Bool ruleCantMatch (Just n1 : ts) (Just n2 : as) = n1 /= n2 || ruleCantMatch ts as
131
ruleCantMatch (Just n1 : ts) (Just n2 : as) = n1 /= n2 || ruleCantMatch ts as
77
true
true
0
11
121
85
46
39
null
null
andorp/hs-bluesnap
src/Bluesnap/API/Request.hs
gpl-3.0
elementShort_text_type :: XMLParser Short_text_type elementShort_text_type = parseSchemaType "short-text-type"
110
elementShort_text_type :: XMLParser Short_text_type elementShort_text_type = parseSchemaType "short-text-type"
110
elementShort_text_type = parseSchemaType "short-text-type"
58
false
true
0
5
7
17
8
9
null
null
moonKimura/conduit-1.0.8
Data/Conduit/Internal.hs
mit
sinkToPipe :: Monad m => Sink i m r -> Pipe l i o u m r sinkToPipe = go . injectLeftovers . unConduitM where go (HaveOutput _ _ o) = absurd o go (NeedInput p c) = NeedInput (go . p) (const $ go $ c ()) go (Done r) = Done r go (PipeM mp) = PipeM (liftM go mp) go (Leftover _ l) = absurd l
313
sinkToPipe :: Monad m => Sink i m r -> Pipe l i o u m r sinkToPipe = go . injectLeftovers . unConduitM where go (HaveOutput _ _ o) = absurd o go (NeedInput p c) = NeedInput (go . p) (const $ go $ c ()) go (Done r) = Done r go (PipeM mp) = PipeM (liftM go mp) go (Leftover _ l) = absurd l
313
sinkToPipe = go . injectLeftovers . unConduitM where go (HaveOutput _ _ o) = absurd o go (NeedInput p c) = NeedInput (go . p) (const $ go $ c ()) go (Done r) = Done r go (PipeM mp) = PipeM (liftM go mp) go (Leftover _ l) = absurd l
257
false
true
0
9
94
179
86
93
null
null
froozen/kademlia
src/Network/Kademlia/Protocol.hs
bsd-3-clause
commandArgs (FIND_NODE id) = toBS id
42
commandArgs (FIND_NODE id) = toBS id
42
commandArgs (FIND_NODE id) = toBS id
42
false
false
0
6
11
19
8
11
null
null
rightfold/snek
src/SNEK/Check.hs
bsd-3-clause
veT (StructReadVE f s) = case veT s of StructT fs -> case Map.lookup f fs of Just t -> t Nothing -> error "veT: ill-typed expression" _ -> error "veT: ill-typed expression"
223
veT (StructReadVE f s) = case veT s of StructT fs -> case Map.lookup f fs of Just t -> t Nothing -> error "veT: ill-typed expression" _ -> error "veT: ill-typed expression"
223
veT (StructReadVE f s) = case veT s of StructT fs -> case Map.lookup f fs of Just t -> t Nothing -> error "veT: ill-typed expression" _ -> error "veT: ill-typed expression"
223
false
false
0
11
83
72
32
40
null
null
demhydraz/ligand
src/Compiler.hs
mit
compileStatement (SFunction (n,_) params body) = do tell $ "function " ++ n parens $ tell $ intercalate ", " $ (\(x, _, _) -> x) `map` params block $ do mapM_ ((>> newline) . indent . makeDefault) params compileBody body newline tell "end"
262
compileStatement (SFunction (n,_) params body) = do tell $ "function " ++ n parens $ tell $ intercalate ", " $ (\(x, _, _) -> x) `map` params block $ do mapM_ ((>> newline) . indent . makeDefault) params compileBody body newline tell "end"
262
compileStatement (SFunction (n,_) params body) = do tell $ "function " ++ n parens $ tell $ intercalate ", " $ (\(x, _, _) -> x) `map` params block $ do mapM_ ((>> newline) . indent . makeDefault) params compileBody body newline tell "end"
262
false
false
0
14
66
123
61
62
null
null
diffusionkinetics/open
fuml/lib/Fuml/Supervised/Accuracy.hs
mit
gridSearch :: Monad m => Int -> [(Vector Double, o)] -> ( [(Vector Double, o)] -> Predict p o1 -> Double ) -> (hyper -> Supervisor m o p o1) -> [hyper] -> Maybe Int -> m [(hyper,Double)] gridSearch nfolds theData metric hsuper hypers (Just fold) = let (testD, trainD) = splitData nfolds fold theData getAcc h = fmap ((h,) . metric testD) $ runSupervisor (hsuper h) Nothing $ trainD in mapM getAcc hypers
520
gridSearch :: Monad m => Int -> [(Vector Double, o)] -> ( [(Vector Double, o)] -> Predict p o1 -> Double ) -> (hyper -> Supervisor m o p o1) -> [hyper] -> Maybe Int -> m [(hyper,Double)] gridSearch nfolds theData metric hsuper hypers (Just fold) = let (testD, trainD) = splitData nfolds fold theData getAcc h = fmap ((h,) . metric testD) $ runSupervisor (hsuper h) Nothing $ trainD in mapM getAcc hypers
520
gridSearch nfolds theData metric hsuper hypers (Just fold) = let (testD, trainD) = splitData nfolds fold theData getAcc h = fmap ((h,) . metric testD) $ runSupervisor (hsuper h) Nothing $ trainD in mapM getAcc hypers
226
false
true
0
14
190
209
106
103
null
null
TomMD/ghc
compiler/prelude/THNames.hs
bsd-3-clause
funLikeDataConName = thCon (fsLit "FunLike") funLikeDataConKey
62
funLikeDataConName = thCon (fsLit "FunLike") funLikeDataConKey
62
funLikeDataConName = thCon (fsLit "FunLike") funLikeDataConKey
62
false
false
0
7
5
17
8
9
null
null
ezyang/ghc
testsuite/tests/simplCore/should_compile/T13367.hs
bsd-3-clause
y = MkT "foo"#
14
y = MkT "foo"#
14
y = MkT "foo"#
14
false
false
1
5
3
13
4
9
null
null
mavenraven/chronic-haskell
tests/TestSuite.hs
bsd-3-clause
parserOptions = ParserOptions
29
parserOptions = ParserOptions
29
parserOptions = ParserOptions
29
false
false
0
4
2
6
3
3
null
null
JohnLato/combobuffer
src/Data/RingBuffer/ComboBuffer.hs
bsd-3-clause
at :: V.Unbox a => ComboBuffer a -> Int -> a at (CB sz pos v1 v2 upds) ix | ix < 0 = error $ "ComboBuffer: index out of range: " ++ show ix | ix < pos = upds ! ix | ix < 2*sz = let ix' = ix - pos in if ix' < sz then v1 `V.unsafeIndex` ix' else v2 `V.unsafeIndex` (ix' - sz) | otherwise = error $ "ComboBuffer: index out of range: " ++ show (ix,2*sz)
397
at :: V.Unbox a => ComboBuffer a -> Int -> a at (CB sz pos v1 v2 upds) ix | ix < 0 = error $ "ComboBuffer: index out of range: " ++ show ix | ix < pos = upds ! ix | ix < 2*sz = let ix' = ix - pos in if ix' < sz then v1 `V.unsafeIndex` ix' else v2 `V.unsafeIndex` (ix' - sz) | otherwise = error $ "ComboBuffer: index out of range: " ++ show (ix,2*sz)
397
at (CB sz pos v1 v2 upds) ix | ix < 0 = error $ "ComboBuffer: index out of range: " ++ show ix | ix < pos = upds ! ix | ix < 2*sz = let ix' = ix - pos in if ix' < sz then v1 `V.unsafeIndex` ix' else v2 `V.unsafeIndex` (ix' - sz) | otherwise = error $ "ComboBuffer: index out of range: " ++ show (ix,2*sz)
352
false
true
6
11
130
202
97
105
null
null
KommuSoft/vty-ui
src/Graphics/Vty/Widgets/List.hs
bsd-3-clause
insertIntoList :: (Show b) => Widget (List a b) -> a -> Widget b -> Int -> IO () insertIntoList list key w pos = do numItems <- (V.length . listItems) <~~ list -- Calculate the new selected index. oldSel <- selectedIndex <~~ list oldScr <- scrollTopIndex <~~ list swSize <- scrollWindowSize <~~ list let newSelIndex = if numItems == 0 then 0 else if pos <= oldSel then oldSel + 1 else oldSel newScrollTop = if pos <= oldSel then if (oldSel - oldScr + 1) == swSize then oldScr + 1 else oldScr else oldScr let vInject atPos a as = let (hd, t) = (V.take atPos as, V.drop atPos as) in hd V.++ (V.cons a t) -- Optimize the append case. let newItems s = if pos >= numItems then V.snoc (listItems s) (key, w) else vInject pos (key, w) (listItems s) updateWidgetState list $ \s -> s { listItems = V.force $ newItems s , selectedIndex = newSelIndex , scrollTopIndex = newScrollTop } notifyItemAddHandler list (min numItems pos) key w when (numItems == 0) $ do foc <- focused <~ list when foc $ focus w when (oldSel /= newSelIndex) $ notifySelectionHandler list -- |Register event handlers to be invoked when the list's selected -- item changes.
1,555
insertIntoList :: (Show b) => Widget (List a b) -> a -> Widget b -> Int -> IO () insertIntoList list key w pos = do numItems <- (V.length . listItems) <~~ list -- Calculate the new selected index. oldSel <- selectedIndex <~~ list oldScr <- scrollTopIndex <~~ list swSize <- scrollWindowSize <~~ list let newSelIndex = if numItems == 0 then 0 else if pos <= oldSel then oldSel + 1 else oldSel newScrollTop = if pos <= oldSel then if (oldSel - oldScr + 1) == swSize then oldScr + 1 else oldScr else oldScr let vInject atPos a as = let (hd, t) = (V.take atPos as, V.drop atPos as) in hd V.++ (V.cons a t) -- Optimize the append case. let newItems s = if pos >= numItems then V.snoc (listItems s) (key, w) else vInject pos (key, w) (listItems s) updateWidgetState list $ \s -> s { listItems = V.force $ newItems s , selectedIndex = newSelIndex , scrollTopIndex = newScrollTop } notifyItemAddHandler list (min numItems pos) key w when (numItems == 0) $ do foc <- focused <~ list when foc $ focus w when (oldSel /= newSelIndex) $ notifySelectionHandler list -- |Register event handlers to be invoked when the list's selected -- item changes.
1,555
insertIntoList list key w pos = do numItems <- (V.length . listItems) <~~ list -- Calculate the new selected index. oldSel <- selectedIndex <~~ list oldScr <- scrollTopIndex <~~ list swSize <- scrollWindowSize <~~ list let newSelIndex = if numItems == 0 then 0 else if pos <= oldSel then oldSel + 1 else oldSel newScrollTop = if pos <= oldSel then if (oldSel - oldScr + 1) == swSize then oldScr + 1 else oldScr else oldScr let vInject atPos a as = let (hd, t) = (V.take atPos as, V.drop atPos as) in hd V.++ (V.cons a t) -- Optimize the append case. let newItems s = if pos >= numItems then V.snoc (listItems s) (key, w) else vInject pos (key, w) (listItems s) updateWidgetState list $ \s -> s { listItems = V.force $ newItems s , selectedIndex = newSelIndex , scrollTopIndex = newScrollTop } notifyItemAddHandler list (min numItems pos) key w when (numItems == 0) $ do foc <- focused <~ list when foc $ focus w when (oldSel /= newSelIndex) $ notifySelectionHandler list -- |Register event handlers to be invoked when the list's selected -- item changes.
1,474
false
true
0
16
630
459
231
228
null
null
kwibus/myLang
src/InfixFix.hs
bsd-3-clause
-- 'higherPrec' accept expresion in the order they appear; so stack expression first higherThenTop y (x : _) = higherPrec (getPrec x) (getPrec y)
146
higherThenTop y (x : _) = higherPrec (getPrec x) (getPrec y)
60
higherThenTop y (x : _) = higherPrec (getPrec x) (getPrec y)
60
true
false
0
7
24
36
18
18
null
null
rfdickerson/numerical-methods
src/NumericalMethods/Simple.hs
mit
balance color a x b = T color a x b
35
balance color a x b = T color a x b
35
balance color a x b = T color a x b
35
false
false
0
5
10
24
11
13
null
null
Shimuuar/banana-tcltk
UI/TclTk/Builder.hs
bsd-3-clause
actimateIO :: Frameworks t => Event t a -> (a -> IO ()) -> GUI t p () actimateIO evt action = lift $ actimateWith action evt
159
actimateIO :: Frameworks t => Event t a -> (a -> IO ()) -> GUI t p () actimateIO evt action = lift $ actimateWith action evt
159
actimateIO evt action = lift $ actimateWith action evt
56
false
true
0
11
61
66
31
35
null
null
dylanmc/cryptol
src/Cryptol/TypeCheck/AST.hs
bsd-3-clause
tBit :: Type tBit = TCon (TC TCBit) []
47
tBit :: Type tBit = TCon (TC TCBit) []
47
tBit = TCon (TC TCBit) []
30
false
true
0
7
17
30
13
17
null
null
codygman/yesod-dsl
YesodDsl/Generator/UpdateHandlers.hs
bsd-2-clause
updateHandlerDecode :: (Int,Stmt) -> String updateHandlerDecode (pId,p) = case p of Update (Right e) fr io -> readInputObject e (io >>= \io' -> Just (Nothing, io')) (Just fr) Insert (Right e) io _ -> readInputObject e io Nothing _ -> "" where readInputObject :: Entity -> Maybe (Maybe VariableName, [FieldRefMapping]) -> Maybe FieldRef -> String readInputObject e (Just (mv, fields)) fr = let maybeExisting = maybeSelectExisting e (mv,fields) fr fieldMappers = mapFields e fields isNew isNew = isNothing fr && isNothing mv entityToUpdate | isNew = entityName e | otherwise = "e" in T.unpack $(codegenFile "codegen/read-input-object-fields.cg") readInputObject e Nothing _ = let fieldMappers = mapFields e [] True in T.unpack $(codegenFile "codegen/read-input-object-whole.cg") maybeSelectExisting e (Nothing, fields) (Just fr) | Nothing `elem` [ matchInputField fields (fieldName f) | f <- entityFields e ] = let ifr = inputFieldRef fr in T.unpack $(codegenFile "codegen/select-existing.cg") | otherwise = "" maybeSelectExisting _ (Just vn, _) _ = T.unpack $(codegenFile "codegen/select-bound-result.cg") maybeSelectExisting _ _ _ = "" mapFields e fields isNew = intercalate ",\n" $ catMaybes $ map (mapJsonInputField fields isNew) [ (e,f) | f <- entityFields e ]
1,656
updateHandlerDecode :: (Int,Stmt) -> String updateHandlerDecode (pId,p) = case p of Update (Right e) fr io -> readInputObject e (io >>= \io' -> Just (Nothing, io')) (Just fr) Insert (Right e) io _ -> readInputObject e io Nothing _ -> "" where readInputObject :: Entity -> Maybe (Maybe VariableName, [FieldRefMapping]) -> Maybe FieldRef -> String readInputObject e (Just (mv, fields)) fr = let maybeExisting = maybeSelectExisting e (mv,fields) fr fieldMappers = mapFields e fields isNew isNew = isNothing fr && isNothing mv entityToUpdate | isNew = entityName e | otherwise = "e" in T.unpack $(codegenFile "codegen/read-input-object-fields.cg") readInputObject e Nothing _ = let fieldMappers = mapFields e [] True in T.unpack $(codegenFile "codegen/read-input-object-whole.cg") maybeSelectExisting e (Nothing, fields) (Just fr) | Nothing `elem` [ matchInputField fields (fieldName f) | f <- entityFields e ] = let ifr = inputFieldRef fr in T.unpack $(codegenFile "codegen/select-existing.cg") | otherwise = "" maybeSelectExisting _ (Just vn, _) _ = T.unpack $(codegenFile "codegen/select-bound-result.cg") maybeSelectExisting _ _ _ = "" mapFields e fields isNew = intercalate ",\n" $ catMaybes $ map (mapJsonInputField fields isNew) [ (e,f) | f <- entityFields e ]
1,656
updateHandlerDecode (pId,p) = case p of Update (Right e) fr io -> readInputObject e (io >>= \io' -> Just (Nothing, io')) (Just fr) Insert (Right e) io _ -> readInputObject e io Nothing _ -> "" where readInputObject :: Entity -> Maybe (Maybe VariableName, [FieldRefMapping]) -> Maybe FieldRef -> String readInputObject e (Just (mv, fields)) fr = let maybeExisting = maybeSelectExisting e (mv,fields) fr fieldMappers = mapFields e fields isNew isNew = isNothing fr && isNothing mv entityToUpdate | isNew = entityName e | otherwise = "e" in T.unpack $(codegenFile "codegen/read-input-object-fields.cg") readInputObject e Nothing _ = let fieldMappers = mapFields e [] True in T.unpack $(codegenFile "codegen/read-input-object-whole.cg") maybeSelectExisting e (Nothing, fields) (Just fr) | Nothing `elem` [ matchInputField fields (fieldName f) | f <- entityFields e ] = let ifr = inputFieldRef fr in T.unpack $(codegenFile "codegen/select-existing.cg") | otherwise = "" maybeSelectExisting _ (Just vn, _) _ = T.unpack $(codegenFile "codegen/select-bound-result.cg") maybeSelectExisting _ _ _ = "" mapFields e fields isNew = intercalate ",\n" $ catMaybes $ map (mapJsonInputField fields isNew) [ (e,f) | f <- entityFields e ]
1,612
false
true
12
19
576
503
249
254
null
null
lpsmith/postgresql-simple-implicit
src/Database/PostgreSQL/Simple/Implicit.hs
bsd-3-clause
execute :: (DB.ToRow q, MonadCatchIO m) => DB.Query -> q -> Postgres m Int64 execute q ps = liftPostgres (\conn -> DB.execute conn q ps)
144
execute :: (DB.ToRow q, MonadCatchIO m) => DB.Query -> q -> Postgres m Int64 execute q ps = liftPostgres (\conn -> DB.execute conn q ps)
144
execute q ps = liftPostgres (\conn -> DB.execute conn q ps)
59
false
true
0
9
32
72
35
37
null
null
akegalj/snowdrift
app/SnowdriftEmailDaemon.hs
agpl-3.0
withLogging :: MonadIO m => LoggingT m a -> m a withLogging m = runLoggingT m $ \loc src level str -> let out = if level == LevelError then stderr else stdout in Char8.hPutStrLn out (fromLogStr (defaultLogStr loc src level (toLogStr str)))
270
withLogging :: MonadIO m => LoggingT m a -> m a withLogging m = runLoggingT m $ \loc src level str -> let out = if level == LevelError then stderr else stdout in Char8.hPutStrLn out (fromLogStr (defaultLogStr loc src level (toLogStr str)))
270
withLogging m = runLoggingT m $ \loc src level str -> let out = if level == LevelError then stderr else stdout in Char8.hPutStrLn out (fromLogStr (defaultLogStr loc src level (toLogStr str)))
222
false
true
0
15
73
105
51
54
null
null
ctford/Idris-Elba-dev
src/Idris/ParseHelpers.hs
bsd-3-clause
-- | Parses an integral number integer :: MonadicParsing m => m Integer integer = Tok.integer
93
integer :: MonadicParsing m => m Integer integer = Tok.integer
62
integer = Tok.integer
21
true
true
0
6
15
24
12
12
null
null
mstksg/hledger
hledger-lib/Hledger/Reports.hs
gpl-3.0
-- import Hledger.Reports.BalanceHistoryReport tests_Hledger_Reports :: Test tests_Hledger_Reports = TestList $ -- ++ tests_isInterestingIndented [ tests_Hledger_Reports_ReportOptions, tests_Hledger_Reports_EntriesReport, tests_Hledger_Reports_PostingsReport, tests_Hledger_Reports_BalanceReport, tests_Hledger_Reports_MultiBalanceReport ]
348
tests_Hledger_Reports :: Test tests_Hledger_Reports = TestList $ -- ++ tests_isInterestingIndented [ tests_Hledger_Reports_ReportOptions, tests_Hledger_Reports_EntriesReport, tests_Hledger_Reports_PostingsReport, tests_Hledger_Reports_BalanceReport, tests_Hledger_Reports_MultiBalanceReport ]
300
tests_Hledger_Reports = TestList $ -- ++ tests_isInterestingIndented [ tests_Hledger_Reports_ReportOptions, tests_Hledger_Reports_EntriesReport, tests_Hledger_Reports_PostingsReport, tests_Hledger_Reports_BalanceReport, tests_Hledger_Reports_MultiBalanceReport ]
270
true
true
0
6
28
32
20
12
null
null
philopon/haddocset
Documentation/Haddocset.hs
bsd-3-clause
moduleProvider :: MonadIO m => DocInfo -> Producer m Provider moduleProvider iFile = mapM_ sub $ diInterfaces iFile where sub file = do rd <- liftIO $ readInterfaceFile freshNameCache file case rd of Left _ -> return () Right (ifInstalledIfaces -> iIntrf) -> do let pkg = diPackageId iFile yield $ Haddock pkg file yield $ Package pkg forM_ iIntrf $ \i -> do let modn = instMod i fs = instVisibleExports i when (OptHide `notElem` instOptions i) $ do yield $ Module pkg modn mapM_ (yield . Function pkg modn) fs
738
moduleProvider :: MonadIO m => DocInfo -> Producer m Provider moduleProvider iFile = mapM_ sub $ diInterfaces iFile where sub file = do rd <- liftIO $ readInterfaceFile freshNameCache file case rd of Left _ -> return () Right (ifInstalledIfaces -> iIntrf) -> do let pkg = diPackageId iFile yield $ Haddock pkg file yield $ Package pkg forM_ iIntrf $ \i -> do let modn = instMod i fs = instVisibleExports i when (OptHide `notElem` instOptions i) $ do yield $ Module pkg modn mapM_ (yield . Function pkg modn) fs
738
moduleProvider iFile = mapM_ sub $ diInterfaces iFile where sub file = do rd <- liftIO $ readInterfaceFile freshNameCache file case rd of Left _ -> return () Right (ifInstalledIfaces -> iIntrf) -> do let pkg = diPackageId iFile yield $ Haddock pkg file yield $ Package pkg forM_ iIntrf $ \i -> do let modn = instMod i fs = instVisibleExports i when (OptHide `notElem` instOptions i) $ do yield $ Module pkg modn mapM_ (yield . Function pkg modn) fs
676
false
true
0
22
319
227
102
125
null
null
Chobbes/Juicy.Pixels
src/Codec/Picture/Gif.hs
bsd-3-clause
decodeFirstGifImage :: GifFile -> Either String (DynamicImage, Metadatas) decodeFirstGifImage img@GifFile { gifImages = (firstImage:_) } = case decodeAllGifImages img { gifImages = [firstImage] } of [] -> Left "No image after decoding" (i:_) -> Right (i, basicMetadata SourceGif (screenWidth hdr) (screenHeight hdr)) where hdr = gifScreenDescriptor $ gifHeader img
382
decodeFirstGifImage :: GifFile -> Either String (DynamicImage, Metadatas) decodeFirstGifImage img@GifFile { gifImages = (firstImage:_) } = case decodeAllGifImages img { gifImages = [firstImage] } of [] -> Left "No image after decoding" (i:_) -> Right (i, basicMetadata SourceGif (screenWidth hdr) (screenHeight hdr)) where hdr = gifScreenDescriptor $ gifHeader img
382
decodeFirstGifImage img@GifFile { gifImages = (firstImage:_) } = case decodeAllGifImages img { gifImages = [firstImage] } of [] -> Left "No image after decoding" (i:_) -> Right (i, basicMetadata SourceGif (screenWidth hdr) (screenHeight hdr)) where hdr = gifScreenDescriptor $ gifHeader img
308
false
true
4
11
66
132
69
63
null
null
patrickherrmann/sudoku
src/Sudoku.hs
mit
removeGivens :: Board -> [Board] removeGivens b = do loc <- map fst . filter (certain . snd) $ assocs b return $ b // [(loc, vals)]
135
removeGivens :: Board -> [Board] removeGivens b = do loc <- map fst . filter (certain . snd) $ assocs b return $ b // [(loc, vals)]
135
removeGivens b = do loc <- map fst . filter (certain . snd) $ assocs b return $ b // [(loc, vals)]
102
false
true
0
12
30
78
37
41
null
null
ksaveljev/hake-2
src/Server/SVInit.hs
bsd-3-clause
initGame :: Quake () initGame = do initialized <- use $ svGlobals.svServerStatic.ssInitialized if initialized -- cause any connected clients to reconnect then SVMain.shutdown "Server restarted\n" True else do -- make sure the client is down CL.drop SCR.beginLoadingPlaque -- get any latched variable changes (maxclients, etc) CVar.getLatchedVars svGlobals.svServerStatic.ssInitialized .= True coop <- CVar.variableValue "coop" deathmatch <- CVar.variableValue "deathmatch" when (coop /= 0 && deathmatch /= 0) $ do Com.printf "Deathmatch and Coop both set, disabling Coop\n" void $ CVar.fullSet "coop" "0" (Constants.cvarServerInfo .|. Constants.cvarLatch) -- dedicated servers can't be single player and are usually DM -- so unless they explicitly set coop, force it to deathmatch dedicatedValue <- liftM (^.cvValue) dedicatedCVar when (dedicatedValue /= 0 && coop == 0) $ void $ CVar.fullSet "deathmatch" "1" (Constants.cvarServerInfo .|. Constants.cvarLatch) initClients r <- Lib.rand svGlobals.svServerStatic.ssSpawnCount .= fromIntegral r maxClientsValue <- liftM (truncate . (^.cvValue)) maxClientsCVar svGlobals.svServerStatic.ssClients .= V.generate maxClientsValue (\idx -> newClientT { _cServerIndex = idx }) let numClientEntities = maxClientsValue * Constants.updateBackup * 64 svGlobals.svServerStatic.ssNumClientEntities .= numClientEntities svGlobals.svServerStatic.ssClientEntities .= V.replicate numClientEntities (newEntityStateT Nothing) -- init network stuff NET.config (maxClientsValue > 1) -- heartbeats will always be sent to the id master svGlobals.svServerStatic.ssLastHeartbeat .= -99999 -- send immediately let idmaster = "192.246.40.37:" `B.append` BC.pack (show Constants.portMaster) -- IMPROVE: convert Int to ByteString using binary package? idmasterNetAdr <- NET.stringToAdr idmaster case idmasterNetAdr of Nothing -> return () -- well, shouldn't happen really Just adr -> svGlobals.svMasterAdr %= (V.// [(0, adr)]) -- init game SVGame.initGameProgs clients <- use $ svGlobals.svServerStatic.ssClients let updatedClients = V.imap (\idx client -> client { _cEdict = Just (Ref (idx + 1)), _cLastCmd = newUserCmdT }) clients svGlobals.svServerStatic.ssClients .= updatedClients where initClients :: Quake () initClients = do coop <- CVar.variableValue "coop" deathmatch <- CVar.variableValue "deathmatch" maxClientsValue <- liftM (truncate . (^.cvValue)) maxClientsCVar let serverLatchFlags = Constants.cvarServerInfo .|. Constants.cvarLatch if | deathmatch /= 0 -> if | maxClientsValue <= 1 -> void $ CVar.fullSet "maxclients" "8" serverLatchFlags | maxClientsValue > Constants.maxClients -> void $ CVar.fullSet "maxclients" (BC.pack $ show Constants.maxClients) serverLatchFlags | coop /= 0 -> when (maxClientsValue <= 1 || maxClientsValue > 4) $ void $ CVar.fullSet "maxclients" "4" serverLatchFlags | otherwise -> -- non-deathmatch, non-coop is one player void $ CVar.fullSet "maxclients" "1" serverLatchFlags {- - SV_Map - - the full syntax is: - - map [*] <map>$ <startspot>+ <nextserver> - - command from the console or progs. Map can also be a.cin, .pcx, or .dm2 file. - - Nextserver is used to allow a cinematic to play, then proceed to - another level: - - map tram.cin+jail_e3 -}
3,632
initGame :: Quake () initGame = do initialized <- use $ svGlobals.svServerStatic.ssInitialized if initialized -- cause any connected clients to reconnect then SVMain.shutdown "Server restarted\n" True else do -- make sure the client is down CL.drop SCR.beginLoadingPlaque -- get any latched variable changes (maxclients, etc) CVar.getLatchedVars svGlobals.svServerStatic.ssInitialized .= True coop <- CVar.variableValue "coop" deathmatch <- CVar.variableValue "deathmatch" when (coop /= 0 && deathmatch /= 0) $ do Com.printf "Deathmatch and Coop both set, disabling Coop\n" void $ CVar.fullSet "coop" "0" (Constants.cvarServerInfo .|. Constants.cvarLatch) -- dedicated servers can't be single player and are usually DM -- so unless they explicitly set coop, force it to deathmatch dedicatedValue <- liftM (^.cvValue) dedicatedCVar when (dedicatedValue /= 0 && coop == 0) $ void $ CVar.fullSet "deathmatch" "1" (Constants.cvarServerInfo .|. Constants.cvarLatch) initClients r <- Lib.rand svGlobals.svServerStatic.ssSpawnCount .= fromIntegral r maxClientsValue <- liftM (truncate . (^.cvValue)) maxClientsCVar svGlobals.svServerStatic.ssClients .= V.generate maxClientsValue (\idx -> newClientT { _cServerIndex = idx }) let numClientEntities = maxClientsValue * Constants.updateBackup * 64 svGlobals.svServerStatic.ssNumClientEntities .= numClientEntities svGlobals.svServerStatic.ssClientEntities .= V.replicate numClientEntities (newEntityStateT Nothing) -- init network stuff NET.config (maxClientsValue > 1) -- heartbeats will always be sent to the id master svGlobals.svServerStatic.ssLastHeartbeat .= -99999 -- send immediately let idmaster = "192.246.40.37:" `B.append` BC.pack (show Constants.portMaster) -- IMPROVE: convert Int to ByteString using binary package? idmasterNetAdr <- NET.stringToAdr idmaster case idmasterNetAdr of Nothing -> return () -- well, shouldn't happen really Just adr -> svGlobals.svMasterAdr %= (V.// [(0, adr)]) -- init game SVGame.initGameProgs clients <- use $ svGlobals.svServerStatic.ssClients let updatedClients = V.imap (\idx client -> client { _cEdict = Just (Ref (idx + 1)), _cLastCmd = newUserCmdT }) clients svGlobals.svServerStatic.ssClients .= updatedClients where initClients :: Quake () initClients = do coop <- CVar.variableValue "coop" deathmatch <- CVar.variableValue "deathmatch" maxClientsValue <- liftM (truncate . (^.cvValue)) maxClientsCVar let serverLatchFlags = Constants.cvarServerInfo .|. Constants.cvarLatch if | deathmatch /= 0 -> if | maxClientsValue <= 1 -> void $ CVar.fullSet "maxclients" "8" serverLatchFlags | maxClientsValue > Constants.maxClients -> void $ CVar.fullSet "maxclients" (BC.pack $ show Constants.maxClients) serverLatchFlags | coop /= 0 -> when (maxClientsValue <= 1 || maxClientsValue > 4) $ void $ CVar.fullSet "maxclients" "4" serverLatchFlags | otherwise -> -- non-deathmatch, non-coop is one player void $ CVar.fullSet "maxclients" "1" serverLatchFlags {- - SV_Map - - the full syntax is: - - map [*] <map>$ <startspot>+ <nextserver> - - command from the console or progs. Map can also be a.cin, .pcx, or .dm2 file. - - Nextserver is used to allow a cinematic to play, then proceed to - another level: - - map tram.cin+jail_e3 -}
3,632
initGame = do initialized <- use $ svGlobals.svServerStatic.ssInitialized if initialized -- cause any connected clients to reconnect then SVMain.shutdown "Server restarted\n" True else do -- make sure the client is down CL.drop SCR.beginLoadingPlaque -- get any latched variable changes (maxclients, etc) CVar.getLatchedVars svGlobals.svServerStatic.ssInitialized .= True coop <- CVar.variableValue "coop" deathmatch <- CVar.variableValue "deathmatch" when (coop /= 0 && deathmatch /= 0) $ do Com.printf "Deathmatch and Coop both set, disabling Coop\n" void $ CVar.fullSet "coop" "0" (Constants.cvarServerInfo .|. Constants.cvarLatch) -- dedicated servers can't be single player and are usually DM -- so unless they explicitly set coop, force it to deathmatch dedicatedValue <- liftM (^.cvValue) dedicatedCVar when (dedicatedValue /= 0 && coop == 0) $ void $ CVar.fullSet "deathmatch" "1" (Constants.cvarServerInfo .|. Constants.cvarLatch) initClients r <- Lib.rand svGlobals.svServerStatic.ssSpawnCount .= fromIntegral r maxClientsValue <- liftM (truncate . (^.cvValue)) maxClientsCVar svGlobals.svServerStatic.ssClients .= V.generate maxClientsValue (\idx -> newClientT { _cServerIndex = idx }) let numClientEntities = maxClientsValue * Constants.updateBackup * 64 svGlobals.svServerStatic.ssNumClientEntities .= numClientEntities svGlobals.svServerStatic.ssClientEntities .= V.replicate numClientEntities (newEntityStateT Nothing) -- init network stuff NET.config (maxClientsValue > 1) -- heartbeats will always be sent to the id master svGlobals.svServerStatic.ssLastHeartbeat .= -99999 -- send immediately let idmaster = "192.246.40.37:" `B.append` BC.pack (show Constants.portMaster) -- IMPROVE: convert Int to ByteString using binary package? idmasterNetAdr <- NET.stringToAdr idmaster case idmasterNetAdr of Nothing -> return () -- well, shouldn't happen really Just adr -> svGlobals.svMasterAdr %= (V.// [(0, adr)]) -- init game SVGame.initGameProgs clients <- use $ svGlobals.svServerStatic.ssClients let updatedClients = V.imap (\idx client -> client { _cEdict = Just (Ref (idx + 1)), _cLastCmd = newUserCmdT }) clients svGlobals.svServerStatic.ssClients .= updatedClients where initClients :: Quake () initClients = do coop <- CVar.variableValue "coop" deathmatch <- CVar.variableValue "deathmatch" maxClientsValue <- liftM (truncate . (^.cvValue)) maxClientsCVar let serverLatchFlags = Constants.cvarServerInfo .|. Constants.cvarLatch if | deathmatch /= 0 -> if | maxClientsValue <= 1 -> void $ CVar.fullSet "maxclients" "8" serverLatchFlags | maxClientsValue > Constants.maxClients -> void $ CVar.fullSet "maxclients" (BC.pack $ show Constants.maxClients) serverLatchFlags | coop /= 0 -> when (maxClientsValue <= 1 || maxClientsValue > 4) $ void $ CVar.fullSet "maxclients" "4" serverLatchFlags | otherwise -> -- non-deathmatch, non-coop is one player void $ CVar.fullSet "maxclients" "1" serverLatchFlags {- - SV_Map - - the full syntax is: - - map [*] <map>$ <startspot>+ <nextserver> - - command from the console or progs. Map can also be a.cin, .pcx, or .dm2 file. - - Nextserver is used to allow a cinematic to play, then proceed to - another level: - - map tram.cin+jail_e3 -}
3,611
false
true
0
19
834
826
399
427
null
null
keera-studios/hsQt
Qtc/Enums/Gui/QSlider.hs
bsd-2-clause
eTicksBelow :: TickPosition eTicksBelow = ieTickPosition $ 2
62
eTicksBelow :: TickPosition eTicksBelow = ieTickPosition $ 2
62
eTicksBelow = ieTickPosition $ 2
34
false
true
0
6
9
18
8
10
null
null
5HT/n2o.hs
sample/server.hs
isc
handle :: MVar (I.IxSet ChannelData) -> MVar (Connections Entry) -> Entry -> [Term] -> IO () handle pubSub state entry [AtomTerm "LOGON", BinaryTerm name] | invalidName $ b2t name = alert entry "Name cannot contain punctuation or whitespace, and cannot be empty" | otherwise = do let dname = b2t name print $ "login: " <> dname ce <- clientExists state dname if ce then alert entry "User already exists" else do setState state (eSocketId entry) $ \entry -> entry { eUser = Just dname } send (eConn entry) $ T.pack $ show $ foldl Sequence EmptyBlock [ jqHide "join-section" , jqShow "chat-section" , jqShow "users-section" ] sub pubSub (eSocketId entry) All updateUsers state $ dname <> " joined"
902
handle :: MVar (I.IxSet ChannelData) -> MVar (Connections Entry) -> Entry -> [Term] -> IO () handle pubSub state entry [AtomTerm "LOGON", BinaryTerm name] | invalidName $ b2t name = alert entry "Name cannot contain punctuation or whitespace, and cannot be empty" | otherwise = do let dname = b2t name print $ "login: " <> dname ce <- clientExists state dname if ce then alert entry "User already exists" else do setState state (eSocketId entry) $ \entry -> entry { eUser = Just dname } send (eConn entry) $ T.pack $ show $ foldl Sequence EmptyBlock [ jqHide "join-section" , jqShow "chat-section" , jqShow "users-section" ] sub pubSub (eSocketId entry) All updateUsers state $ dname <> " joined"
902
handle pubSub state entry [AtomTerm "LOGON", BinaryTerm name] | invalidName $ b2t name = alert entry "Name cannot contain punctuation or whitespace, and cannot be empty" | otherwise = do let dname = b2t name print $ "login: " <> dname ce <- clientExists state dname if ce then alert entry "User already exists" else do setState state (eSocketId entry) $ \entry -> entry { eUser = Just dname } send (eConn entry) $ T.pack $ show $ foldl Sequence EmptyBlock [ jqHide "join-section" , jqShow "chat-section" , jqShow "users-section" ] sub pubSub (eSocketId entry) All updateUsers state $ dname <> " joined"
809
false
true
1
15
325
272
126
146
null
null
GaloisInc/halvm-ghc
compiler/utils/Outputable.hs
bsd-3-clause
vcat ds = SDoc $ \sty -> Pretty.vcat [runSDoc d sty | d <- ds]
62
vcat ds = SDoc $ \sty -> Pretty.vcat [runSDoc d sty | d <- ds]
62
vcat ds = SDoc $ \sty -> Pretty.vcat [runSDoc d sty | d <- ds]
62
false
false
0
10
14
39
19
20
null
null
Helium4Haskell/helium
src/Helium/Utils/QualifiedTypes.hs
gpl-3.0
convertTpSchemeToQualified :: ImportEnvironment -> TpScheme -> TpScheme convertTpSchemeToQualified env = convertTpScheme (toQualTyCon env)
138
convertTpSchemeToQualified :: ImportEnvironment -> TpScheme -> TpScheme convertTpSchemeToQualified env = convertTpScheme (toQualTyCon env)
138
convertTpSchemeToQualified env = convertTpScheme (toQualTyCon env)
66
false
true
0
7
12
31
15
16
null
null
Spheniscida/symmath
Symmath/Simplify.hs
mit
prodListToCommonExps :: [SymTerm] -> [SymTerm] prodListToCommonExps = map sameExpToProd . groupBy prodExpGroupable . sortProductExpList
135
prodListToCommonExps :: [SymTerm] -> [SymTerm] prodListToCommonExps = map sameExpToProd . groupBy prodExpGroupable . sortProductExpList
135
prodListToCommonExps = map sameExpToProd . groupBy prodExpGroupable . sortProductExpList
88
false
true
0
8
13
42
19
23
null
null
kim/amazonka
amazonka-cognito-sync/gen/Network/AWS/CognitoSync/ListIdentityPoolUsage.hs
mpl-2.0
-- | Total number of identities for the identity pool. lipurCount :: Lens' ListIdentityPoolUsageResponse (Maybe Int) lipurCount = lens _lipurCount (\s a -> s { _lipurCount = a })
178
lipurCount :: Lens' ListIdentityPoolUsageResponse (Maybe Int) lipurCount = lens _lipurCount (\s a -> s { _lipurCount = a })
123
lipurCount = lens _lipurCount (\s a -> s { _lipurCount = a })
61
true
true
0
9
28
46
25
21
null
null
rodrigo-machado/verigraph
src/library/Analysis/Interlevel/EvolutionarySpans.hs
gpl-3.0
-- combine rules asymmetrically --allEvolSpans dpoConf sndOrderRules = concatMap (\r1 -> map (evolSpans dpoConf r1) sndOrderRules) sndOrderRules -- | Gets all Evolutionary Spans of two Second Order Rules evolSpans :: MorphismsConfig (RuleMorphism a b) -> (String, SndOrderRule a b) -> (String, SndOrderRule a b) -> (String, String, [EvoSpan a b]) evolSpans conf' (n1,r1) (n2,r2) = (n1, n2, spans) where spans = map (\m@(m1,m2) -> EvoSpan m1 m2 (classify conf' r1 r2 m)) xs'' -- filter to catch only interesting situations --filteredSpans = filter (\s -> cpe s `elem` [FolDuse, DuseFol]) spans r1Left = leftObject r1 r2Left = leftObject r2 r1Right = rightObject r1 r2Right = rightObject r2 leftR1 = Production (mappingLeft (leftMorphism r1)) (mappingLeft (rightMorphism r1)) [] leftR2 = Production (mappingLeft (leftMorphism r2)) (mappingLeft (rightMorphism r2)) [] pairs = findJointSurjections (matchRestriction conf', leftR1) (matchRestriction conf', leftR2) conf = toFstOrderMorphismsConfig conf' xs = filter (\(m1,_) -> isValid (codomain m1)) pairs xs' = filter (\(m1,m2) -> satisfiesRewritingConditions conf r1Left (mappingLeft m1) && satisfiesRewritingConditions conf r2Left (mappingLeft m2)) xs xs'' = filter (\(m1,m2) -> satisfiesRewritingConditions conf r1Right (mappingLeft m1) && satisfiesRewritingConditions conf r2Right (mappingLeft m2)) xs' -- | Given two second-order rules and their matches overlaped, return their type
1,499
evolSpans :: MorphismsConfig (RuleMorphism a b) -> (String, SndOrderRule a b) -> (String, SndOrderRule a b) -> (String, String, [EvoSpan a b]) evolSpans conf' (n1,r1) (n2,r2) = (n1, n2, spans) where spans = map (\m@(m1,m2) -> EvoSpan m1 m2 (classify conf' r1 r2 m)) xs'' -- filter to catch only interesting situations --filteredSpans = filter (\s -> cpe s `elem` [FolDuse, DuseFol]) spans r1Left = leftObject r1 r2Left = leftObject r2 r1Right = rightObject r1 r2Right = rightObject r2 leftR1 = Production (mappingLeft (leftMorphism r1)) (mappingLeft (rightMorphism r1)) [] leftR2 = Production (mappingLeft (leftMorphism r2)) (mappingLeft (rightMorphism r2)) [] pairs = findJointSurjections (matchRestriction conf', leftR1) (matchRestriction conf', leftR2) conf = toFstOrderMorphismsConfig conf' xs = filter (\(m1,_) -> isValid (codomain m1)) pairs xs' = filter (\(m1,m2) -> satisfiesRewritingConditions conf r1Left (mappingLeft m1) && satisfiesRewritingConditions conf r2Left (mappingLeft m2)) xs xs'' = filter (\(m1,m2) -> satisfiesRewritingConditions conf r1Right (mappingLeft m1) && satisfiesRewritingConditions conf r2Right (mappingLeft m2)) xs' -- | Given two second-order rules and their matches overlaped, return their type
1,294
evolSpans conf' (n1,r1) (n2,r2) = (n1, n2, spans) where spans = map (\m@(m1,m2) -> EvoSpan m1 m2 (classify conf' r1 r2 m)) xs'' -- filter to catch only interesting situations --filteredSpans = filter (\s -> cpe s `elem` [FolDuse, DuseFol]) spans r1Left = leftObject r1 r2Left = leftObject r2 r1Right = rightObject r1 r2Right = rightObject r2 leftR1 = Production (mappingLeft (leftMorphism r1)) (mappingLeft (rightMorphism r1)) [] leftR2 = Production (mappingLeft (leftMorphism r2)) (mappingLeft (rightMorphism r2)) [] pairs = findJointSurjections (matchRestriction conf', leftR1) (matchRestriction conf', leftR2) conf = toFstOrderMorphismsConfig conf' xs = filter (\(m1,_) -> isValid (codomain m1)) pairs xs' = filter (\(m1,m2) -> satisfiesRewritingConditions conf r1Left (mappingLeft m1) && satisfiesRewritingConditions conf r2Left (mappingLeft m2)) xs xs'' = filter (\(m1,m2) -> satisfiesRewritingConditions conf r1Right (mappingLeft m1) && satisfiesRewritingConditions conf r2Right (mappingLeft m2)) xs' -- | Given two second-order rules and their matches overlaped, return their type
1,151
true
true
2
11
260
447
235
212
null
null
ezyang/ghc
compiler/basicTypes/SrcLoc.hs
bsd-3-clause
mkSrcSpan _ (UnhelpfulLoc str) = UnhelpfulSpan str
50
mkSrcSpan _ (UnhelpfulLoc str) = UnhelpfulSpan str
50
mkSrcSpan _ (UnhelpfulLoc str) = UnhelpfulSpan str
50
false
false
1
6
6
22
9
13
null
null
tbarnetlamb/hyphen
hyphen/lowlevel_src/HyphenGHC.hs
gpl-2.0
transformGHCTyThing :: Text -> GHC.TyThing -> ([(Text, PreObj)], [(Text, TyNSElt)]) transformGHCTyThing im (GHCType.AnId id) = (maybeToList $ transformGHCId im id, [])
176
transformGHCTyThing :: Text -> GHC.TyThing -> ([(Text, PreObj)], [(Text, TyNSElt)]) transformGHCTyThing im (GHCType.AnId id) = (maybeToList $ transformGHCId im id, [])
176
transformGHCTyThing im (GHCType.AnId id) = (maybeToList $ transformGHCId im id, [])
92
false
true
0
9
29
75
42
33
null
null
dolio/vector
Data/Vector/Fusion/Stream/Monadic.hs
bsd-3-clause
fold1M' = foldl1M'
18
fold1M' = foldl1M'
18
fold1M' = foldl1M'
18
false
false
0
4
2
6
3
3
null
null
yav/haskell-zipper
Data/Tree/Zipper.hs
mit
-- | The last child of the given location. lastChild :: TreePos Full a -> Maybe (TreePos Full a) lastChild = prevTree . last . children
135
lastChild :: TreePos Full a -> Maybe (TreePos Full a) lastChild = prevTree . last . children
92
lastChild = prevTree . last . children
38
true
true
0
8
25
40
20
20
null
null
snoyberg/ghc
compiler/basicTypes/Name.hs
bsd-3-clause
isWiredInName :: Name -> Bool isWiredInName (Name {n_sort = WiredIn _ _ _}) = True
87
isWiredInName :: Name -> Bool isWiredInName (Name {n_sort = WiredIn _ _ _}) = True
86
isWiredInName (Name {n_sort = WiredIn _ _ _}) = True
52
false
true
0
10
19
37
19
18
null
null
rueshyna/gogol
gogol-dfareporting/gen/Network/Google/Resource/DFAReporting/PlacementStrategies/Delete.hs
mpl-2.0
-- | Placement strategy ID. psdId :: Lens' PlacementStrategiesDelete Int64 psdId = lens _psdId (\ s a -> s{_psdId = a}) . _Coerce
131
psdId :: Lens' PlacementStrategiesDelete Int64 psdId = lens _psdId (\ s a -> s{_psdId = a}) . _Coerce
103
psdId = lens _psdId (\ s a -> s{_psdId = a}) . _Coerce
56
true
true
0
10
24
46
24
22
null
null
alexander-at-github/eta
compiler/ETA/SimplCore/CoreMonad.hs
bsd-3-clause
-- | Output an error to the screen errorMsg :: SDoc -> CoreM () errorMsg = msg Err.errorMsg
91
errorMsg :: SDoc -> CoreM () errorMsg = msg Err.errorMsg
56
errorMsg = msg Err.errorMsg
27
true
true
0
8
17
32
14
18
null
null
forestbelton/orb
src/Layout.hs
bsd-3-clause
layoutNode :: StyledNode -> [DisplayCommand] layoutNode = buildDisplayCommands . buildLayout . makeAnonymousBox . makeBoxModel
126
layoutNode :: StyledNode -> [DisplayCommand] layoutNode = buildDisplayCommands . buildLayout . makeAnonymousBox . makeBoxModel
126
layoutNode = buildDisplayCommands . buildLayout . makeAnonymousBox . makeBoxModel
81
false
true
0
8
13
37
17
20
null
null
ekmett/text
tests/Tests/Properties.hs
bsd-2-clause
tl_dropWhileEnd p = (L.reverse . L.dropWhile p . L.reverse) `eqP` (unpackS . TL.dropWhileEnd p)
115
tl_dropWhileEnd p = (L.reverse . L.dropWhile p . L.reverse) `eqP` (unpackS . TL.dropWhileEnd p)
115
tl_dropWhileEnd p = (L.reverse . L.dropWhile p . L.reverse) `eqP` (unpackS . TL.dropWhileEnd p)
115
false
false
0
10
33
47
24
23
null
null
jacekszymanski/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxID_ICONIZE_FRAME :: Int wxID_ICONIZE_FRAME = 5205
51
wxID_ICONIZE_FRAME :: Int wxID_ICONIZE_FRAME = 5205
51
wxID_ICONIZE_FRAME = 5205
25
false
true
0
4
5
11
6
5
null
null
henrytill/hecate
src/Hecate/Backend/SQLite/Database.hs
apache-2.0
createTable :: MonadIO m => SQLite.Connection -> m () createTable conn = liftIO (SQLite.execute_ conn currentSchema)
116
createTable :: MonadIO m => SQLite.Connection -> m () createTable conn = liftIO (SQLite.execute_ conn currentSchema)
116
createTable conn = liftIO (SQLite.execute_ conn currentSchema)
62
false
true
0
8
15
45
21
24
null
null
cobbpg/elerea-examples
src/Bounce/Main.hs
bsd-3-clause
ballFade = 2
12
ballFade = 2
12
ballFade = 2
12
false
false
0
4
2
6
3
3
null
null
BarrelfishOS/barrelfish
tools/skate/SkateParser.hs
mit
{- ============================================================================== = The Skate Token Parser ============================================================================== -} {- create the Skate Lexer -} lexer = P.makeTokenParser ( javaStyle { {- list of reserved Names -} P.reservedNames = [ "schema", "fact", "flags", "flag", "constants", "const", "enumeration", "enum", "text", "section" ], {- list of reserved operators -} P.reservedOpNames = ["*","/","+","-"], {- valid identifiers -} P.identStart = letter, P.identLetter = alphaNum, {- Skate is not case sensitive. -} P.caseSensitive = False, {- comment start and end -} P.commentStart = "/*", P.commentEnd = "*/", P.commentLine = "//", P.nestedComments = False })
927
lexer = P.makeTokenParser ( javaStyle { {- list of reserved Names -} P.reservedNames = [ "schema", "fact", "flags", "flag", "constants", "const", "enumeration", "enum", "text", "section" ], {- list of reserved operators -} P.reservedOpNames = ["*","/","+","-"], {- valid identifiers -} P.identStart = letter, P.identLetter = alphaNum, {- Skate is not case sensitive. -} P.caseSensitive = False, {- comment start and end -} P.commentStart = "/*", P.commentEnd = "*/", P.commentLine = "//", P.nestedComments = False })
708
lexer = P.makeTokenParser ( javaStyle { {- list of reserved Names -} P.reservedNames = [ "schema", "fact", "flags", "flag", "constants", "const", "enumeration", "enum", "text", "section" ], {- list of reserved operators -} P.reservedOpNames = ["*","/","+","-"], {- valid identifiers -} P.identStart = letter, P.identLetter = alphaNum, {- Skate is not case sensitive. -} P.caseSensitive = False, {- comment start and end -} P.commentStart = "/*", P.commentEnd = "*/", P.commentLine = "//", P.nestedComments = False })
708
true
false
0
9
281
137
88
49
null
null
olsner/ghc
compiler/hsSyn/HsBinds.hs
bsd-3-clause
hsSigDoc (PatSynSig {}) = text "pattern synonym signature"
66
hsSigDoc (PatSynSig {}) = text "pattern synonym signature"
66
hsSigDoc (PatSynSig {}) = text "pattern synonym signature"
66
false
false
0
7
15
19
9
10
null
null
brenov/set
interpreter/Types.hs
mit
inputCast _ _ = error "Error: Invalid cast."
44
inputCast _ _ = error "Error: Invalid cast."
44
inputCast _ _ = error "Error: Invalid cast."
44
false
false
0
5
7
14
6
8
null
null
DanielSchiavini/ampersand
src/Database/Design/Ampersand/Input/ADL1/LexerMonad.hs
gpl-3.0
returnLM :: a -> LexerMonad a returnLM x = LM (\_ pos brackets -> Right (x, [], pos, brackets))
95
returnLM :: a -> LexerMonad a returnLM x = LM (\_ pos brackets -> Right (x, [], pos, brackets))
95
returnLM x = LM (\_ pos brackets -> Right (x, [], pos, brackets))
65
false
true
0
10
18
53
28
25
null
null
keera-studios/hsQt
Qtc/Enums/Gui/QSystemTrayIcon.hs
bsd-2-clause
eUnknown :: ActivationReason eUnknown = ieActivationReason $ 0
64
eUnknown :: ActivationReason eUnknown = ieActivationReason $ 0
64
eUnknown = ieActivationReason $ 0
35
false
true
0
6
9
18
8
10
null
null
ctford/Idris-Elba-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
declared (PInstance _ _ _ _ _ _ _ _) = []
41
declared (PInstance _ _ _ _ _ _ _ _) = []
41
declared (PInstance _ _ _ _ _ _ _ _) = []
41
false
false
0
7
11
31
15
16
null
null
Seblink/HackerRank
functional-programming/introduction/fp-filter-positions-in-a-list.hs
mit
f (x:y:lst) = y : f lst
23
f (x:y:lst) = y : f lst
23
f (x:y:lst) = y : f lst
23
false
false
0
7
6
28
13
15
null
null
lpsmith/aeson
Data/Aeson/Types/Instances.hs
bsd-3-clause
scientificToNumber :: Scientific -> Number scientificToNumber s | e < 0 = D $ realToFrac s | otherwise = I $ c * 10 ^ e where e = Scientific.base10Exponent s c = Scientific.coefficient s
209
scientificToNumber :: Scientific -> Number scientificToNumber s | e < 0 = D $ realToFrac s | otherwise = I $ c * 10 ^ e where e = Scientific.base10Exponent s c = Scientific.coefficient s
209
scientificToNumber s | e < 0 = D $ realToFrac s | otherwise = I $ c * 10 ^ e where e = Scientific.base10Exponent s c = Scientific.coefficient s
166
false
true
9
8
57
93
38
55
null
null
f-me/snap-core
test/suite/Snap/Util/FileServe/Tests.hs
bsd-3-clause
goRange :: Snap a -> ByteString -> (Int,Int) -> IO Response goRange m s (start,end) = do rq' <- mkRequest s let rq = setHeader "Range" (S.pack $ "bytes=" ++ show start ++ "-" ++ show end) rq' liftM snd (run_ $ runIt m rq) ------------------------------------------------------------------------------
360
goRange :: Snap a -> ByteString -> (Int,Int) -> IO Response goRange m s (start,end) = do rq' <- mkRequest s let rq = setHeader "Range" (S.pack $ "bytes=" ++ show start ++ "-" ++ show end) rq' liftM snd (run_ $ runIt m rq) ------------------------------------------------------------------------------
360
goRange m s (start,end) = do rq' <- mkRequest s let rq = setHeader "Range" (S.pack $ "bytes=" ++ show start ++ "-" ++ show end) rq' liftM snd (run_ $ runIt m rq) ------------------------------------------------------------------------------
300
false
true
0
16
105
122
59
63
null
null
CarmineM74/haskell_craft3e
Chapter16/PrioQueue.hs
mit
remQ :: PrioQ a -> (a, PrioQ a) remQ (PrioQ []) = error "Cannot remove from an empty queue"
91
remQ :: PrioQ a -> (a, PrioQ a) remQ (PrioQ []) = error "Cannot remove from an empty queue"
91
remQ (PrioQ []) = error "Cannot remove from an empty queue"
59
false
true
0
8
18
41
20
21
null
null
spaceships/garbled-circuits
test/TestGarbledCircuits.hs
apache-2.0
op2circ AND x y = L.and x y
27
op2circ AND x y = L.and x y
27
op2circ AND x y = L.and x y
27
false
false
0
6
7
20
9
11
null
null
brendanhay/gogol
gogol-bigquery/gen/Network/Google/Resource/BigQuery/DataSets/Delete.hs
mpl-2.0
-- | If True, delete all the tables in the dataset. If False and the dataset -- contains tables, the request will fail. Default is False dsdDeleteContents :: Lens' DataSetsDelete (Maybe Bool) dsdDeleteContents = lens _dsdDeleteContents (\ s a -> s{_dsdDeleteContents = a})
280
dsdDeleteContents :: Lens' DataSetsDelete (Maybe Bool) dsdDeleteContents = lens _dsdDeleteContents (\ s a -> s{_dsdDeleteContents = a})
143
dsdDeleteContents = lens _dsdDeleteContents (\ s a -> s{_dsdDeleteContents = a})
88
true
true
0
9
50
49
26
23
null
null
kojiromike/Idris-dev
src/Idris/Core/ProofState.hs
bsd-3-clause
complete_fill ctxt env t = fail $ "Can't complete fill at " ++ show t
69
complete_fill ctxt env t = fail $ "Can't complete fill at " ++ show t
69
complete_fill ctxt env t = fail $ "Can't complete fill at " ++ show t
69
false
false
0
6
14
26
11
15
null
null
vito/atomo-old
Atomo/Internals.hs
mit
list :: Type list = Type (Name "[]") [Name "a"]
47
list :: Type list = Type (Name "[]") [Name "a"]
47
list = Type (Name "[]") [Name "a"]
34
false
true
0
7
9
35
15
20
null
null
ice1000/OI-codes
codewars/1-100/folding-through-a-fixed-point.hs
agpl-3.0
l2Intermediate :: Least f -> Intermediate f l2Intermediate (Least k) = k Intermediate
85
l2Intermediate :: Least f -> Intermediate f l2Intermediate (Least k) = k Intermediate
85
l2Intermediate (Least k) = k Intermediate
41
false
true
0
7
12
33
15
18
null
null
frincon/heventsourced
test/Spec.hs
apache-2.0
testMethod :: Baz f z -> String testMethod (Cons f z) = (foo f) ++ (bar z)
74
testMethod :: Baz f z -> String testMethod (Cons f z) = (foo f) ++ (bar z)
74
testMethod (Cons f z) = (foo f) ++ (bar z)
42
false
true
0
9
16
53
24
29
null
null
cjack/Adt4c
dev/two34.hs
mit
is_Empty _ = False
18
is_Empty _ = False
18
is_Empty _ = False
18
false
false
0
4
3
10
4
6
null
null
ndmitchell/cmdargs
System/Console/CmdArgs/Explicit/Type.hs
bsd-3-clause
flagOpt :: String -> [Name] -> Update a -> FlagHelp -> Help -> Flag a flagOpt def names upd typ help = Flag names (FlagOpt def) upd typ help
140
flagOpt :: String -> [Name] -> Update a -> FlagHelp -> Help -> Flag a flagOpt def names upd typ help = Flag names (FlagOpt def) upd typ help
140
flagOpt def names upd typ help = Flag names (FlagOpt def) upd typ help
70
false
true
0
11
28
72
34
38
null
null
exercism/xhaskell
exercises/practice/go-counting/.meta/examples/success-standard/src/Counting.hs
mit
-- | Get the adjacent valid coordinates for a coordinate. adjacentCoords :: Board -> Coord -> [Coord] adjacentCoords b (cx, cy) = filter (inBounds b) [(cx+1, cy), (cx, cy+1), (cx-1, cy), (cx, cy-1)]
202
adjacentCoords :: Board -> Coord -> [Coord] adjacentCoords b (cx, cy) = filter (inBounds b) [(cx+1, cy), (cx, cy+1), (cx-1, cy), (cx, cy-1)]
144
adjacentCoords b (cx, cy) = filter (inBounds b) [(cx+1, cy), (cx, cy+1), (cx-1, cy), (cx, cy-1)]
100
true
true
0
8
36
97
56
41
null
null
christiaanb/Idris-dev
src/IRTS/CodegenC.hs
bsd-3-clause
doOp v (LPlus (ATInt ITNative)) [l, r] = v ++ "ADD(" ++ creg l ++ ", " ++ creg r ++ ")"
87
doOp v (LPlus (ATInt ITNative)) [l, r] = v ++ "ADD(" ++ creg l ++ ", " ++ creg r ++ ")"
87
doOp v (LPlus (ATInt ITNative)) [l, r] = v ++ "ADD(" ++ creg l ++ ", " ++ creg r ++ ")"
87
false
false
1
14
21
62
28
34
null
null
olsner/ghc
compiler/nativeGen/X86/CodeGen.hs
bsd-3-clause
isVecExpr (CmmMachOp (MO_VF_Sub {}) _) = True
49
isVecExpr (CmmMachOp (MO_VF_Sub {}) _) = True
49
isVecExpr (CmmMachOp (MO_VF_Sub {}) _) = True
49
false
false
0
8
10
25
12
13
null
null
lukexi/ghc
compiler/nativeGen/X86/Instr.hs
bsd-3-clause
canShortcut (JMP (OpImm imm) _) = Just (DestImm imm)
53
canShortcut (JMP (OpImm imm) _) = Just (DestImm imm)
53
canShortcut (JMP (OpImm imm) _) = Just (DestImm imm)
53
false
false
0
9
9
32
15
17
null
null
UBMLtonGroup/timberc
src/Termred.hs
bsd-3-clause
redInt p _ _ = internalError0 ("redInt: " ++ show p)
71
redInt p _ _ = internalError0 ("redInt: " ++ show p)
71
redInt p _ _ = internalError0 ("redInt: " ++ show p)
71
false
false
1
8
29
27
12
15
null
null
ardumont/haskell-lab
src/Tree/AVL.hs
gpl-2.0
-- *AVL> pp $ ins t10 100 -- --6 -- |--3 -- | |--2 -- | | |-- /- -- | | `-- /- -- | `--4 -- | |-- /- -- | `-- /- -- `--7 -- |-- /- -- `--100 -- |-- /- -- `-- /- -- build an AVL from a list build :: (Num a, Ord a) => [a] -> Tree a build = foldl ins Empty
310
build :: (Num a, Ord a) => [a] -> Tree a build = foldl ins Empty
64
build = foldl ins Empty
23
true
true
0
7
127
56
36
20
null
null
fmapfmapfmap/amazonka
amazonka-ec2/gen/Network/AWS/EC2/CreateFlowLogs.hs
mpl-2.0
-- | Information about the flow logs that could not be created successfully. cflrsUnsuccessful :: Lens' CreateFlowLogsResponse [UnsuccessfulItem] cflrsUnsuccessful = lens _cflrsUnsuccessful (\ s a -> s{_cflrsUnsuccessful = a}) . _Default . _Coerce
247
cflrsUnsuccessful :: Lens' CreateFlowLogsResponse [UnsuccessfulItem] cflrsUnsuccessful = lens _cflrsUnsuccessful (\ s a -> s{_cflrsUnsuccessful = a}) . _Default . _Coerce
170
cflrsUnsuccessful = lens _cflrsUnsuccessful (\ s a -> s{_cflrsUnsuccessful = a}) . _Default . _Coerce
101
true
true
0
11
32
51
28
23
null
null
sol/aeson
tests/ErrorMessages.hs
bsd-3-clause
expected :: String -> String -> String expected ex enc = "Error in $: expected " ++ ex ++ ", encountered " ++ enc
113
expected :: String -> String -> String expected ex enc = "Error in $: expected " ++ ex ++ ", encountered " ++ enc
113
expected ex enc = "Error in $: expected " ++ ex ++ ", encountered " ++ enc
74
false
true
0
7
23
36
18
18
null
null
clample/lamdabtc
backend/src/Protocol/Messages.hs
bsd-3-clause
arbitraryGetHeadersMessage = do version <- choose (0, maxVersion) n <- choose (0, 2000) blockLocatorHashes <- vectorOf n arbitrary hashStop <- arbitrary return $ GetHeadersMessageBody (GetHeadersMessage version blockLocatorHashes hashStop) where maxVersion = 0xffffffff -- 4 bytes
301
arbitraryGetHeadersMessage = do version <- choose (0, maxVersion) n <- choose (0, 2000) blockLocatorHashes <- vectorOf n arbitrary hashStop <- arbitrary return $ GetHeadersMessageBody (GetHeadersMessage version blockLocatorHashes hashStop) where maxVersion = 0xffffffff -- 4 bytes
301
arbitraryGetHeadersMessage = do version <- choose (0, maxVersion) n <- choose (0, 2000) blockLocatorHashes <- vectorOf n arbitrary hashStop <- arbitrary return $ GetHeadersMessageBody (GetHeadersMessage version blockLocatorHashes hashStop) where maxVersion = 0xffffffff -- 4 bytes
301
false
false
0
10
55
86
41
45
null
null
jsavatgy/dit-doo
code/accum-end-01.hs
gpl-2.0
filterMe (d,m) c = Map.filter (\(a,b) -> a<=c && c<=b) m
56
filterMe (d,m) c = Map.filter (\(a,b) -> a<=c && c<=b) m
56
filterMe (d,m) c = Map.filter (\(a,b) -> a<=c && c<=b) m
56
false
false
1
9
10
56
27
29
null
null
massysett/dapi
dapi.hs
bsd-3-clause
pdctEnds :: MA.OptSpec (ParseOpts -> Ex.Exceptional String ParseOpts) pdctEnds = MA.OptSpec ["ends"] "e" (MA.NoArg (fmap return f)) where f = addOperand tok tok = Exp.operand pdct pdct = begin ||| end begin = Pd.operand "first date in the list" ((== 0) . iFwd) end = Pd.operand "last date in the list" ((== 0) . iBack)
340
pdctEnds :: MA.OptSpec (ParseOpts -> Ex.Exceptional String ParseOpts) pdctEnds = MA.OptSpec ["ends"] "e" (MA.NoArg (fmap return f)) where f = addOperand tok tok = Exp.operand pdct pdct = begin ||| end begin = Pd.operand "first date in the list" ((== 0) . iFwd) end = Pd.operand "last date in the list" ((== 0) . iBack)
340
pdctEnds = MA.OptSpec ["ends"] "e" (MA.NoArg (fmap return f)) where f = addOperand tok tok = Exp.operand pdct pdct = begin ||| end begin = Pd.operand "first date in the list" ((== 0) . iFwd) end = Pd.operand "last date in the list" ((== 0) . iBack)
270
false
true
6
9
76
153
71
82
null
null
oldmanmike/ghc
compiler/types/Type.hs
bsd-3-clause
-- NB: Do the slow check here. This is important to keep the splitXXX -- functions working properly. Otherwise, we may end up with something -- like (((->) |> something_reflexive_but_not_obviously_so) biz baz) -- fails under splitFunTy_maybe. This happened with the cheaper check -- in test dependent/should_compile/dynamic-paper. mkCastTy (CastTy ty co1) co2 = mkCastTy ty (co1 `mkTransCo` co2)
396
mkCastTy (CastTy ty co1) co2 = mkCastTy ty (co1 `mkTransCo` co2)
64
mkCastTy (CastTy ty co1) co2 = mkCastTy ty (co1 `mkTransCo` co2)
64
true
false
1
7
57
40
22
18
null
null
ony/exherbo-cabal
src/ExRender/Base.hs
gpl-2.0
-- | Wrap width soft limit exWrapWidth ∷ Int exWrapWidth = 100
62
exWrapWidth ∷ Int exWrapWidth = 100
35
exWrapWidth = 100
17
true
true
0
4
11
12
7
5
null
null
rumuki/rumuki-server
test/TestExtension.hs
gpl-3.0
getTables :: MonadIO m => ReaderT SqlBackend m [Text] getTables = do tables <- rawSql [st| SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' AND table_name != 'installed_migrations'; |] [] return $ map unSingle tables
298
getTables :: MonadIO m => ReaderT SqlBackend m [Text] getTables = do tables <- rawSql [st| SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' AND table_name != 'installed_migrations'; |] [] return $ map unSingle tables
298
getTables = do tables <- rawSql [st| SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' AND table_name != 'installed_migrations'; |] [] return $ map unSingle tables
244
false
true
0
9
86
58
29
29
null
null
vincenthz/cryptonite
QA.hs
bsd-3-clause
getIssueLevel (Issue_FailedToParseModule {}) = IssueFatal
57
getIssueLevel (Issue_FailedToParseModule {}) = IssueFatal
57
getIssueLevel (Issue_FailedToParseModule {}) = IssueFatal
57
false
false
0
7
4
16
8
8
null
null
brendanhay/gogol
gogol-compute/gen/Network/Google/Resource/Compute/NodeGroups/AggregatedList.hs
mpl-2.0
-- | Creates a value of 'NodeGroupsAggregatedList' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'ngalIncludeAllScopes' -- -- * 'ngalReturnPartialSuccess' -- -- * 'ngalOrderBy' -- -- * 'ngalProject' -- -- * 'ngalFilter' -- -- * 'ngalPageToken' -- -- * 'ngalMaxResults' nodeGroupsAggregatedList :: Text -- ^ 'ngalProject' -> NodeGroupsAggregatedList nodeGroupsAggregatedList pNgalProject_ = NodeGroupsAggregatedList' { _ngalIncludeAllScopes = Nothing , _ngalReturnPartialSuccess = Nothing , _ngalOrderBy = Nothing , _ngalProject = pNgalProject_ , _ngalFilter = Nothing , _ngalPageToken = Nothing , _ngalMaxResults = 500 }
749
nodeGroupsAggregatedList :: Text -- ^ 'ngalProject' -> NodeGroupsAggregatedList nodeGroupsAggregatedList pNgalProject_ = NodeGroupsAggregatedList' { _ngalIncludeAllScopes = Nothing , _ngalReturnPartialSuccess = Nothing , _ngalOrderBy = Nothing , _ngalProject = pNgalProject_ , _ngalFilter = Nothing , _ngalPageToken = Nothing , _ngalMaxResults = 500 }
393
nodeGroupsAggregatedList pNgalProject_ = NodeGroupsAggregatedList' { _ngalIncludeAllScopes = Nothing , _ngalReturnPartialSuccess = Nothing , _ngalOrderBy = Nothing , _ngalProject = pNgalProject_ , _ngalFilter = Nothing , _ngalPageToken = Nothing , _ngalMaxResults = 500 }
305
true
true
0
7
140
89
58
31
null
null
nikoheikkila/boggle
Boggle.hs
mit
toLowStr (c:str) = toLower c : str
34
toLowStr (c:str) = toLower c : str
34
toLowStr (c:str) = toLower c : str
34
false
false
0
7
6
23
11
12
null
null
lukexi/ghc
libraries/base/GHC/Event/Thread.hs
bsd-3-clause
-- | Suspends the current thread for a given number of microseconds -- (GHC only). -- -- There is no guarantee that the thread will be rescheduled promptly -- when the delay has expired, but the thread will never continue to -- run /earlier/ than specified. threadDelay :: Int -> IO () threadDelay usecs = mask_ $ do mgr <- getSystemTimerManager m <- newEmptyMVar reg <- TM.registerTimeout mgr usecs (putMVar m ()) takeMVar m `onException` TM.unregisterTimeout mgr reg -- | Set the value of returned TVar to True after a given number of -- microseconds. The caveats associated with threadDelay also apply. --
617
threadDelay :: Int -> IO () threadDelay usecs = mask_ $ do mgr <- getSystemTimerManager m <- newEmptyMVar reg <- TM.registerTimeout mgr usecs (putMVar m ()) takeMVar m `onException` TM.unregisterTimeout mgr reg -- | Set the value of returned TVar to True after a given number of -- microseconds. The caveats associated with threadDelay also apply. --
359
threadDelay usecs = mask_ $ do mgr <- getSystemTimerManager m <- newEmptyMVar reg <- TM.registerTimeout mgr usecs (putMVar m ()) takeMVar m `onException` TM.unregisterTimeout mgr reg -- | Set the value of returned TVar to True after a given number of -- microseconds. The caveats associated with threadDelay also apply. --
331
true
true
0
12
111
95
49
46
null
null
hsinhuang/codebase
h99/H18.hs
gpl-2.0
slice :: (Integral i) => [a] -> i -> i -> [a] slice xs m n = snd $ split (fst (H17.split xs n)) (m - 1)
103
slice :: (Integral i) => [a] -> i -> i -> [a] slice xs m n = snd $ split (fst (H17.split xs n)) (m - 1)
103
slice xs m n = snd $ split (fst (H17.split xs n)) (m - 1)
57
false
true
0
11
26
81
41
40
null
null
gglouser/ChainReactGame
src/Entities.hs
mit
updateDisplayedScore :: State GameState () updateDisplayedScore = do scDiff <- subtract <$> use displayedScore <*> use score when (scDiff /= 0) $ displayedScore += (scDiff + 5) `div` 6
192
updateDisplayedScore :: State GameState () updateDisplayedScore = do scDiff <- subtract <$> use displayedScore <*> use score when (scDiff /= 0) $ displayedScore += (scDiff + 5) `div` 6
192
updateDisplayedScore = do scDiff <- subtract <$> use displayedScore <*> use score when (scDiff /= 0) $ displayedScore += (scDiff + 5) `div` 6
149
false
true
0
12
36
73
36
37
null
null
elordin/haskell-tetris
font.hs
mit
letterPath 'm' = [ (0 , 0 , 0) , (0 , 1 , 0) , (0.33, 0 , 0) , (0.33, 1 , 0) , (0.33, 0.67, 0) , (0.5 , 0.67, 0) , (0.5 , 0.33, 0) , (0.5 , 0.67, 0) , (0.67, 0.67, 0) , (0.67, 1 , 0) , (0.67, 0 , 0) , (1 , 1 , 0) , (1 , 0 , 0) ]
320
letterPath 'm' = [ (0 , 0 , 0) , (0 , 1 , 0) , (0.33, 0 , 0) , (0.33, 1 , 0) , (0.33, 0.67, 0) , (0.5 , 0.67, 0) , (0.5 , 0.33, 0) , (0.5 , 0.67, 0) , (0.67, 0.67, 0) , (0.67, 1 , 0) , (0.67, 0 , 0) , (1 , 1 , 0) , (1 , 0 , 0) ]
320
letterPath 'm' = [ (0 , 0 , 0) , (0 , 1 , 0) , (0.33, 0 , 0) , (0.33, 1 , 0) , (0.33, 0.67, 0) , (0.5 , 0.67, 0) , (0.5 , 0.33, 0) , (0.5 , 0.67, 0) , (0.67, 0.67, 0) , (0.67, 1 , 0) , (0.67, 0 , 0) , (1 , 1 , 0) , (1 , 0 , 0) ]
320
false
false
1
6
162
168
108
60
null
null
oldmanmike/ghc
compiler/typecheck/TcEvidence.hs
bsd-3-clause
mk_co_lam_fn :: (a -> HsWrapper) -> [a] -> HsWrapper mk_co_lam_fn f as = foldr (\x wrap -> f x <.> wrap) WpHole as
114
mk_co_lam_fn :: (a -> HsWrapper) -> [a] -> HsWrapper mk_co_lam_fn f as = foldr (\x wrap -> f x <.> wrap) WpHole as
114
mk_co_lam_fn f as = foldr (\x wrap -> f x <.> wrap) WpHole as
61
false
true
0
9
22
58
30
28
null
null
ftomassetti/hplatetectonics
src/Geometry.hs
apache-2.0
randomDistinctPoints' width height 0 points = return points
65
randomDistinctPoints' width height 0 points = return points
65
randomDistinctPoints' width height 0 points = return points
65
false
false
0
5
13
19
8
11
null
null
soenkehahn/cabal-macosx
Distribution/MacOSX/Dependencies.hs
bsd-3-clause
-- | Copy some object file's library dependencies into the application -- bundle. copyInDependency :: FilePath -- ^ Path to application bundle root. -> MacApp -> FDeps -- ^ Dependencies to copy in. -> IO () copyInDependency appPath app (FDeps src _) = Control.Monad.unless (isRoot app src) $ do putStrLn $ "Copying " ++ src ++ " to " ++ tgt createDirectoryIfMissing True $ takeDirectory tgt absSrc <- lookupLibrary src copyFile absSrc tgt where tgt = appPath </> pathInApp app src -- | Update some object file's library dependencies to point to -- bundled copies of libraries.
636
copyInDependency :: FilePath -- ^ Path to application bundle root. -> MacApp -> FDeps -- ^ Dependencies to copy in. -> IO () copyInDependency appPath app (FDeps src _) = Control.Monad.unless (isRoot app src) $ do putStrLn $ "Copying " ++ src ++ " to " ++ tgt createDirectoryIfMissing True $ takeDirectory tgt absSrc <- lookupLibrary src copyFile absSrc tgt where tgt = appPath </> pathInApp app src -- | Update some object file's library dependencies to point to -- bundled copies of libraries.
554
copyInDependency appPath app (FDeps src _) = Control.Monad.unless (isRoot app src) $ do putStrLn $ "Copying " ++ src ++ " to " ++ tgt createDirectoryIfMissing True $ takeDirectory tgt absSrc <- lookupLibrary src copyFile absSrc tgt where tgt = appPath </> pathInApp app src -- | Update some object file's library dependencies to point to -- bundled copies of libraries.
421
true
true
3
11
156
142
66
76
null
null
vincenthz/hs-foundation
basement/Basement/UArray/Base.hs
bsd-3-clause
unsafeCopyAtRO :: forall prim ty . (PrimMonad prim, PrimType ty) => MUArray ty (PrimState prim) -- ^ destination array -> Offset ty -- ^ offset at destination -> UArray ty -- ^ source array -> Offset ty -- ^ offset at source -> CountOf ty -- ^ number of elements to copy -> prim () unsafeCopyAtRO (MUArray dstStart _ (MUArrayMBA (MutableBlock dstMba))) ed (UArray srcStart _ (UArrayBA (Block srcBa))) es n = primitive $ \st -> (# copyByteArray# srcBa os dstMba od nBytes st, () #) where sz = primSizeInBytes (Proxy :: Proxy ty) !(Offset (I# os)) = offsetOfE sz (srcStart+es) !(Offset (I# od)) = offsetOfE sz (dstStart+ed) !(CountOf (I# nBytes)) = sizeOfE sz n
849
unsafeCopyAtRO :: forall prim ty . (PrimMonad prim, PrimType ty) => MUArray ty (PrimState prim) -- ^ destination array -> Offset ty -- ^ offset at destination -> UArray ty -- ^ source array -> Offset ty -- ^ offset at source -> CountOf ty -- ^ number of elements to copy -> prim () unsafeCopyAtRO (MUArray dstStart _ (MUArrayMBA (MutableBlock dstMba))) ed (UArray srcStart _ (UArrayBA (Block srcBa))) es n = primitive $ \st -> (# copyByteArray# srcBa os dstMba od nBytes st, () #) where sz = primSizeInBytes (Proxy :: Proxy ty) !(Offset (I# os)) = offsetOfE sz (srcStart+es) !(Offset (I# od)) = offsetOfE sz (dstStart+ed) !(CountOf (I# nBytes)) = sizeOfE sz n
849
unsafeCopyAtRO (MUArray dstStart _ (MUArrayMBA (MutableBlock dstMba))) ed (UArray srcStart _ (UArrayBA (Block srcBa))) es n = primitive $ \st -> (# copyByteArray# srcBa os dstMba od nBytes st, () #) where sz = primSizeInBytes (Proxy :: Proxy ty) !(Offset (I# os)) = offsetOfE sz (srcStart+es) !(Offset (I# od)) = offsetOfE sz (dstStart+ed) !(CountOf (I# nBytes)) = sizeOfE sz n
403
false
true
3
13
304
278
140
138
null
null
brendanhay/gogol
gogol-youtube/gen/Network/Google/Resource/YouTube/Members/List.hs
mpl-2.0
-- | Upload protocol for media (e.g. \"raw\", \"multipart\"). mlUploadProtocol :: Lens' MembersList (Maybe Text) mlUploadProtocol = lens _mlUploadProtocol (\ s a -> s{_mlUploadProtocol = a})
198
mlUploadProtocol :: Lens' MembersList (Maybe Text) mlUploadProtocol = lens _mlUploadProtocol (\ s a -> s{_mlUploadProtocol = a})
136
mlUploadProtocol = lens _mlUploadProtocol (\ s a -> s{_mlUploadProtocol = a})
85
true
true
0
9
33
48
25
23
null
null