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
urbanslug/ghc
compiler/cmm/CmmType.hs
bsd-3-clause
widthFromBytes 16 = W128
24
widthFromBytes 16 = W128
24
widthFromBytes 16 = W128
24
false
false
0
5
3
9
4
5
null
null
GaloisInc/halvm-ghc
compiler/hsSyn/HsBinds.hs
bsd-3-clause
ppr_sig (FixSig fix_sig) = ppr fix_sig
42
ppr_sig (FixSig fix_sig) = ppr fix_sig
42
ppr_sig (FixSig fix_sig) = ppr fix_sig
42
false
false
0
6
9
19
8
11
null
null
k-bx/snap-server
test/Test/Common/TestHandler.hs
bsd-3-clause
echoUriHandler :: Snap () echoUriHandler = do req <- getRequest writeBS $ rqURI req
91
echoUriHandler :: Snap () echoUriHandler = do req <- getRequest writeBS $ rqURI req
91
echoUriHandler = do req <- getRequest writeBS $ rqURI req
65
false
true
0
8
21
33
15
18
null
null
kazu-yamamoto/word8
Data/Word8.hs
bsd-3-clause
_6 = 0x36
9
_6 = 0x36
9
_6 = 0x36
9
false
false
1
5
2
10
3
7
null
null
mrehayden1/lji
src/LJI/Args.hs
bsd-3-clause
---- Top level parser parseArgs :: Monad m => String -> m (Either String Options) parseArgs args = do opts <- wrapParser (spaces *> argsParser <* spaces <* eof) args case opts of Right os -> return $ Right $ os { optArgString = args } l -> return l
268
parseArgs :: Monad m => String -> m (Either String Options) parseArgs args = do opts <- wrapParser (spaces *> argsParser <* spaces <* eof) args case opts of Right os -> return $ Right $ os { optArgString = args } l -> return l
245
parseArgs args = do opts <- wrapParser (spaces *> argsParser <* spaces <* eof) args case opts of Right os -> return $ Right $ os { optArgString = args } l -> return l
185
true
true
0
13
69
110
52
58
null
null
olsner/ghc
compiler/ghci/ByteCodeGen.hs
bsd-3-clause
bcView (AnnApp (_,e) (_, AnnType _)) = Just e
45
bcView (AnnApp (_,e) (_, AnnType _)) = Just e
45
bcView (AnnApp (_,e) (_, AnnType _)) = Just e
45
false
false
0
9
8
35
18
17
null
null
ucsd-progsys/nanomaly
src/NanoML/Misc.hs
bsd-3-clause
findM p (x:xs) = ifM (p x) (return $ Just x) (findM p xs)
57
findM p (x:xs) = ifM (p x) (return $ Just x) (findM p xs)
57
findM p (x:xs) = ifM (p x) (return $ Just x) (findM p xs)
57
false
false
0
8
13
50
24
26
null
null
sdiehl/ghc
compiler/nativeGen/SPARC/CodeGen/Gen32.hs
bsd-3-clause
-- | The dual to getAnyReg: compute an expression into a register, but -- we don't mind which one it is. getSomeReg :: CmmExpr -> NatM (Reg, InstrBlock) getSomeReg expr = do r <- getRegister expr case r of Any rep code -> do tmp <- getNewRegNat rep return (tmp, code tmp) Fixed _ reg code -> return (reg, code) -- | Make code to evaluate a 32 bit expression. --
405
getSomeReg :: CmmExpr -> NatM (Reg, InstrBlock) getSomeReg expr = do r <- getRegister expr case r of Any rep code -> do tmp <- getNewRegNat rep return (tmp, code tmp) Fixed _ reg code -> return (reg, code) -- | Make code to evaluate a 32 bit expression. --
295
getSomeReg expr = do r <- getRegister expr case r of Any rep code -> do tmp <- getNewRegNat rep return (tmp, code tmp) Fixed _ reg code -> return (reg, code) -- | Make code to evaluate a 32 bit expression. --
247
true
true
0
14
114
106
52
54
null
null
jhp/treersec
Treersec.hs
bsd-2-clause
tok_str = term (\s -> if "\"" `isPrefixOf` s then if "\"" `isSuffixOf` s then [s] else [s ++ "\""] else [])
151
tok_str = term (\s -> if "\"" `isPrefixOf` s then if "\"" `isSuffixOf` s then [s] else [s ++ "\""] else [])
151
tok_str = term (\s -> if "\"" `isPrefixOf` s then if "\"" `isSuffixOf` s then [s] else [s ++ "\""] else [])
151
false
false
1
11
65
61
34
27
null
null
arekfu/project_euler
p0089/p0089.hs
mit
intToRoman :: Int -> Roman intToRoman n = let thousands = n `div` 1000 n' = n - thousands * 1000 hundreds = n' `div` 100 n'' = n' - hundreds * 100 tens = n'' `div` 10 units = n `mod` 10 in replicate thousands rm ++ romanUnit rc rd rm hundreds ++ romanUnit rx rl rc tens ++ romanUnit ri rv rx units
407
intToRoman :: Int -> Roman intToRoman n = let thousands = n `div` 1000 n' = n - thousands * 1000 hundreds = n' `div` 100 n'' = n' - hundreds * 100 tens = n'' `div` 10 units = n `mod` 10 in replicate thousands rm ++ romanUnit rc rd rm hundreds ++ romanUnit rx rl rc tens ++ romanUnit ri rv rx units
407
intToRoman n = let thousands = n `div` 1000 n' = n - thousands * 1000 hundreds = n' `div` 100 n'' = n' - hundreds * 100 tens = n'' `div` 10 units = n `mod` 10 in replicate thousands rm ++ romanUnit rc rd rm hundreds ++ romanUnit rx rl rc tens ++ romanUnit ri rv rx units
380
false
true
2
10
174
145
74
71
null
null
dsj36/dropray
src/Core/Geometry.hs
gpl-3.0
-- | Does the ray have differential information? hasDifferential :: Ray -> Bool hasDifferential Ray {differential = Nothing} = False
132
hasDifferential :: Ray -> Bool hasDifferential Ray {differential = Nothing} = False
83
hasDifferential Ray {differential = Nothing} = False
52
true
true
0
8
19
28
15
13
null
null
csheanz/haskell-signals
Data/Signal.hs
mit
emit :: (a -> IO b) -> Signal a -> IO [b] emit z (Signal' ref) = do Sig' _ m <- readIORef ref go $ M.elems m where go [] = return [] go (s : ss) = do blk <- blocked s if blk then go ss else do x <- apply z s xs <- go ss return (x:xs)
377
emit :: (a -> IO b) -> Signal a -> IO [b] emit z (Signal' ref) = do Sig' _ m <- readIORef ref go $ M.elems m where go [] = return [] go (s : ss) = do blk <- blocked s if blk then go ss else do x <- apply z s xs <- go ss return (x:xs)
377
emit z (Signal' ref) = do Sig' _ m <- readIORef ref go $ M.elems m where go [] = return [] go (s : ss) = do blk <- blocked s if blk then go ss else do x <- apply z s xs <- go ss return (x:xs)
335
false
true
0
14
205
167
77
90
null
null
z0isch/advent-of-code
src/Day23.hs
bsd-3-clause
testInput= either ( error . show) id $ parse instructionsParser "" "inc a\njio a, +2\ntpl a\ninc a\n"
103
testInput= either ( error . show) id $ parse instructionsParser "" "inc a\njio a, +2\ntpl a\ninc a\n"
103
testInput= either ( error . show) id $ parse instructionsParser "" "inc a\njio a, +2\ntpl a\ninc a\n"
103
false
false
0
8
18
29
14
15
null
null
kim/amazonka
amazonka-cloudwatch/gen/Network/AWS/CloudWatch/Types.hs
mpl-2.0
-- | 'AlarmHistoryItem' constructor. -- -- The fields accessible through corresponding lenses are: -- -- * 'ahiAlarmName' @::@ 'Maybe' 'Text' -- -- * 'ahiHistoryData' @::@ 'Maybe' 'Text' -- -- * 'ahiHistoryItemType' @::@ 'Maybe' 'HistoryItemType' -- -- * 'ahiHistorySummary' @::@ 'Maybe' 'Text' -- -- * 'ahiTimestamp' @::@ 'Maybe' 'UTCTime' -- alarmHistoryItem :: AlarmHistoryItem alarmHistoryItem = AlarmHistoryItem { _ahiAlarmName = Nothing , _ahiTimestamp = Nothing , _ahiHistoryItemType = Nothing , _ahiHistorySummary = Nothing , _ahiHistoryData = Nothing }
602
alarmHistoryItem :: AlarmHistoryItem alarmHistoryItem = AlarmHistoryItem { _ahiAlarmName = Nothing , _ahiTimestamp = Nothing , _ahiHistoryItemType = Nothing , _ahiHistorySummary = Nothing , _ahiHistoryData = Nothing }
258
alarmHistoryItem = AlarmHistoryItem { _ahiAlarmName = Nothing , _ahiTimestamp = Nothing , _ahiHistoryItemType = Nothing , _ahiHistorySummary = Nothing , _ahiHistoryData = Nothing }
221
true
true
0
7
116
67
43
24
null
null
GaloisInc/galua
galua-jit/src/Galua/Micro/JIT.hs
mit
performDrop :: ListReg -> Int -> HsExpr -> HsExpr performDrop res n = setRegList res ("SMV.drop" <+> int n <+> getRegList res)
126
performDrop :: ListReg -> Int -> HsExpr -> HsExpr performDrop res n = setRegList res ("SMV.drop" <+> int n <+> getRegList res)
126
performDrop res n = setRegList res ("SMV.drop" <+> int n <+> getRegList res)
76
false
true
0
9
21
55
25
30
null
null
sdiehl/ghc
compiler/GHC/Hs/Lit.hs
bsd-3-clause
pmPprHsLit (HsCharPrim _ c) = pprHsChar c
43
pmPprHsLit (HsCharPrim _ c) = pprHsChar c
43
pmPprHsLit (HsCharPrim _ c) = pprHsChar c
43
false
false
0
6
8
21
9
12
null
null
Laar/opengl-xmlspec
src/Text/OpenGL/Xml/Pickle.hs
bsd-3-clause
xpSet :: Ord a => PU a -> PU (S.Set a) xpSet = xpWrap (S.fromList, S.toList) . xpList
85
xpSet :: Ord a => PU a -> PU (S.Set a) xpSet = xpWrap (S.fromList, S.toList) . xpList
85
xpSet = xpWrap (S.fromList, S.toList) . xpList
46
false
true
0
10
17
53
26
27
null
null
smaccm/capDL-tool
CapDL/PrintDot.hs
bsd-2-clause
dotCovered names ms covers list@(id:xs) | hasCover id covers = dotUntyped names ms covers [] id [Nothing] obj: dotCovered names ms covers (drop (length same) list) | otherwise = (doubleQuotes.text) (getName id names) <> semi: dotCovered names ms covers (drop (length same) list) where same = takeWhile (sameNode names id) list obj = getObject ms id -- Minor problem if a covered object has a cap to the untyped
495
dotCovered names ms covers list@(id:xs) | hasCover id covers = dotUntyped names ms covers [] id [Nothing] obj: dotCovered names ms covers (drop (length same) list) | otherwise = (doubleQuotes.text) (getName id names) <> semi: dotCovered names ms covers (drop (length same) list) where same = takeWhile (sameNode names id) list obj = getObject ms id -- Minor problem if a covered object has a cap to the untyped
495
dotCovered names ms covers list@(id:xs) | hasCover id covers = dotUntyped names ms covers [] id [Nothing] obj: dotCovered names ms covers (drop (length same) list) | otherwise = (doubleQuotes.text) (getName id names) <> semi: dotCovered names ms covers (drop (length same) list) where same = takeWhile (sameNode names id) list obj = getObject ms id -- Minor problem if a covered object has a cap to the untyped
495
false
false
2
11
153
169
83
86
null
null
SAdams601/HaRe
old/testing/generativeFold/RecordIn1.hs
bsd-3-clause
{- map2 xs = map (\y -> S1 {x = 1}) xs -} map2 xs = (case ((\ y -> S1 {x = 1}), xs) of (f, []) -> [] (f, (x : xs)) -> (f x) : (map f xs))
168
map2 xs = (case ((\ y -> S1 {x = 1}), xs) of (f, []) -> [] (f, (x : xs)) -> (f x) : (map f xs))
125
map2 xs = (case ((\ y -> S1 {x = 1}), xs) of (f, []) -> [] (f, (x : xs)) -> (f x) : (map f xs))
125
true
false
0
11
71
92
52
40
null
null
peterbecich/haskell-programming-first-principles
src/Chapter11.hs
bsd-3-clause
testTree :: BinaryTree Integer testTree = Node (Node Leaf 1 Leaf) 2 (Node Leaf 3 Leaf)
86
testTree :: BinaryTree Integer testTree = Node (Node Leaf 1 Leaf) 2 (Node Leaf 3 Leaf)
86
testTree = Node (Node Leaf 1 Leaf) 2 (Node Leaf 3 Leaf)
55
false
true
0
7
15
41
20
21
null
null
ennocramer/hindent
src/HIndent/Styles/Gibiansky.hs
bsd-3-clause
opExpr :: Exp NodeInfo -> Printer State () opExpr expr@(InfixApp _ left op right) = keepingColumn $ do let deltaLeft = lineDelta op left deltaRight = lineDelta right op -- If this starts out as a single line expression, try to keep it as a single line expression. Break -- it up over multiple lines if it doesn't fit using operator columns, but only when all the -- operators are the same. if deltaLeft == 0 && deltaRight == 0 && numOperatorUses op expr >= 2 then attemptSingleLine opSingle opMulti else userSpecified deltaLeft deltaRight where -- Use user-specified spacing for the newlines in the operator userSpecified deltaLeft deltaRight = do pretty left if deltaLeft == 0 then space else replicateM_ deltaLeft newline pretty op if deltaRight == 0 then space else replicateM_ deltaRight newline pretty right -- Write the entire infix expression on one line. opSingle = sequence_ [pretty left, space, pretty op, space, pretty right] -- Use operator column layout. opMulti = do let opArguments = collectOpArguments op expr forM_ (init opArguments) $ \arg -> do pretty arg space pretty op newline pretty (last opArguments) -- Count the number of times an infix operator is used in a row. numOperatorUses op e = length (collectOpArguments op e) - 1 -- Collect all arguments to an infix operator. collectOpArguments op expr'@(InfixApp _ left' op' right') | void op == void op' = collectOpArguments op left' ++ collectOpArguments op right' | otherwise = [expr'] collectOpArguments _ expr' = [expr']
1,700
opExpr :: Exp NodeInfo -> Printer State () opExpr expr@(InfixApp _ left op right) = keepingColumn $ do let deltaLeft = lineDelta op left deltaRight = lineDelta right op -- If this starts out as a single line expression, try to keep it as a single line expression. Break -- it up over multiple lines if it doesn't fit using operator columns, but only when all the -- operators are the same. if deltaLeft == 0 && deltaRight == 0 && numOperatorUses op expr >= 2 then attemptSingleLine opSingle opMulti else userSpecified deltaLeft deltaRight where -- Use user-specified spacing for the newlines in the operator userSpecified deltaLeft deltaRight = do pretty left if deltaLeft == 0 then space else replicateM_ deltaLeft newline pretty op if deltaRight == 0 then space else replicateM_ deltaRight newline pretty right -- Write the entire infix expression on one line. opSingle = sequence_ [pretty left, space, pretty op, space, pretty right] -- Use operator column layout. opMulti = do let opArguments = collectOpArguments op expr forM_ (init opArguments) $ \arg -> do pretty arg space pretty op newline pretty (last opArguments) -- Count the number of times an infix operator is used in a row. numOperatorUses op e = length (collectOpArguments op e) - 1 -- Collect all arguments to an infix operator. collectOpArguments op expr'@(InfixApp _ left' op' right') | void op == void op' = collectOpArguments op left' ++ collectOpArguments op right' | otherwise = [expr'] collectOpArguments _ expr' = [expr']
1,700
opExpr expr@(InfixApp _ left op right) = keepingColumn $ do let deltaLeft = lineDelta op left deltaRight = lineDelta right op -- If this starts out as a single line expression, try to keep it as a single line expression. Break -- it up over multiple lines if it doesn't fit using operator columns, but only when all the -- operators are the same. if deltaLeft == 0 && deltaRight == 0 && numOperatorUses op expr >= 2 then attemptSingleLine opSingle opMulti else userSpecified deltaLeft deltaRight where -- Use user-specified spacing for the newlines in the operator userSpecified deltaLeft deltaRight = do pretty left if deltaLeft == 0 then space else replicateM_ deltaLeft newline pretty op if deltaRight == 0 then space else replicateM_ deltaRight newline pretty right -- Write the entire infix expression on one line. opSingle = sequence_ [pretty left, space, pretty op, space, pretty right] -- Use operator column layout. opMulti = do let opArguments = collectOpArguments op expr forM_ (init opArguments) $ \arg -> do pretty arg space pretty op newline pretty (last opArguments) -- Count the number of times an infix operator is used in a row. numOperatorUses op e = length (collectOpArguments op e) - 1 -- Collect all arguments to an infix operator. collectOpArguments op expr'@(InfixApp _ left' op' right') | void op == void op' = collectOpArguments op left' ++ collectOpArguments op right' | otherwise = [expr'] collectOpArguments _ expr' = [expr']
1,657
false
true
8
15
450
400
193
207
null
null
cmahon/interactive-brokers
library/API/IB/Enum.hs
bsd-3-clause
parseIBRight :: Parser IBRight parseIBRight = return Call <* (string "C" <|> string "CALL") <|> return Put <* (string "P" <|> string "PUT")
143
parseIBRight :: Parser IBRight parseIBRight = return Call <* (string "C" <|> string "CALL") <|> return Put <* (string "P" <|> string "PUT")
143
parseIBRight = return Call <* (string "C" <|> string "CALL") <|> return Put <* (string "P" <|> string "PUT")
112
false
true
0
10
26
58
27
31
null
null
mmirman/cmu-skillswap-2012
GuessTheNumberSupport.hs
bsd-3-clause
printLine :: String -> WIO w IO () printLine str = lift $ putStrLn str
70
printLine :: String -> WIO w IO () printLine str = lift $ putStrLn str
70
printLine str = lift $ putStrLn str
35
false
true
0
7
14
34
16
18
null
null
winterland1989/stdio
Data/Builder.hs
bsd-3-clause
insertChunk :: Int -> Int -> BuildStep -> BuildStep insertChunk !chunkSiz !wantSiz k buffer@(Buffer buf offset) = do !siz <- A.sizeofMutableArr buf case () of _ | offset /= 0 -> do -- this is certainly hold, but we still guard it when (offset < siz) (A.shrinkMutableArr buf offset) -- shrink old buffer if not full arr <- A.unsafeFreezeArr buf -- popup old buffer buf' <- A.newArr (max wantSiz chunkSiz) -- make a new buffer xs <- unsafeInterleaveIO (k (Buffer buf' 0)) -- delay the rest building process let v = V.fromArr arr 0 offset v `seq` return (v : xs) | wantSiz <= siz -> k (Buffer buf 0) | otherwise -> do buf' <- A.newArr wantSiz -- make a new buffer k (Buffer buf' 0 )
928
insertChunk :: Int -> Int -> BuildStep -> BuildStep insertChunk !chunkSiz !wantSiz k buffer@(Buffer buf offset) = do !siz <- A.sizeofMutableArr buf case () of _ | offset /= 0 -> do -- this is certainly hold, but we still guard it when (offset < siz) (A.shrinkMutableArr buf offset) -- shrink old buffer if not full arr <- A.unsafeFreezeArr buf -- popup old buffer buf' <- A.newArr (max wantSiz chunkSiz) -- make a new buffer xs <- unsafeInterleaveIO (k (Buffer buf' 0)) -- delay the rest building process let v = V.fromArr arr 0 offset v `seq` return (v : xs) | wantSiz <= siz -> k (Buffer buf 0) | otherwise -> do buf' <- A.newArr wantSiz -- make a new buffer k (Buffer buf' 0 )
928
insertChunk !chunkSiz !wantSiz k buffer@(Buffer buf offset) = do !siz <- A.sizeofMutableArr buf case () of _ | offset /= 0 -> do -- this is certainly hold, but we still guard it when (offset < siz) (A.shrinkMutableArr buf offset) -- shrink old buffer if not full arr <- A.unsafeFreezeArr buf -- popup old buffer buf' <- A.newArr (max wantSiz chunkSiz) -- make a new buffer xs <- unsafeInterleaveIO (k (Buffer buf' 0)) -- delay the rest building process let v = V.fromArr arr 0 offset v `seq` return (v : xs) | wantSiz <= siz -> k (Buffer buf 0) | otherwise -> do buf' <- A.newArr wantSiz -- make a new buffer k (Buffer buf' 0 )
876
false
true
1
18
376
275
128
147
null
null
Proclivis/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxSTC_CMD_HOMERECTEXTEND :: Int wxSTC_CMD_HOMERECTEXTEND = 2430
63
wxSTC_CMD_HOMERECTEXTEND :: Int wxSTC_CMD_HOMERECTEXTEND = 2430
63
wxSTC_CMD_HOMERECTEXTEND = 2430
31
false
true
0
4
5
11
6
5
null
null
ocramz/petsc-hs
examples/Test2.hs
gpl-3.0
withTSSolve c pt t0 dt0 maxsteps maxtime v pre post = withTs c $ \ts -> do -- NB: Vec v contains initial condition and will be updated with final state -- -- (initial state must be given or computed internally) -- NB2 : this version does not account for time-varying right-hand side -- see: -- http://www.mcs.anl.gov/petsc/petsc-current/src/ts/examples/tutorials/ex3.c.html tsSetProblemType ts pt tsSetInitialTimeStep ts t0 dt0 tsSetDuration ts maxsteps maxtime pre ts tsSolve ts v post ts -- TSSetFromOptions(ts); -- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- Solve the problem -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -- /* -- Evaluate initial conditions -- */ -- InitialConditions(u,&appctx); -- TSSolve(ts,u); -- PetscErrorCode TSSolve(TS ts,Vec u) -- Collective on TS -- Input Parameters : -- ts - the TS context obtained from TSCreate() -- u - the solution vector (can be null if TSSetSolution() was used, otherwise must contain the initial conditions) -- Notes : -- The final time returned by this function may be different from the time of the internally held state accessible by TSGetSolution() and TSGetTime() because the method may have stepped over the final time.
1,313
withTSSolve c pt t0 dt0 maxsteps maxtime v pre post = withTs c $ \ts -> do -- NB: Vec v contains initial condition and will be updated with final state -- -- (initial state must be given or computed internally) -- NB2 : this version does not account for time-varying right-hand side -- see: -- http://www.mcs.anl.gov/petsc/petsc-current/src/ts/examples/tutorials/ex3.c.html tsSetProblemType ts pt tsSetInitialTimeStep ts t0 dt0 tsSetDuration ts maxsteps maxtime pre ts tsSolve ts v post ts -- TSSetFromOptions(ts); -- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- Solve the problem -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -- /* -- Evaluate initial conditions -- */ -- InitialConditions(u,&appctx); -- TSSolve(ts,u); -- PetscErrorCode TSSolve(TS ts,Vec u) -- Collective on TS -- Input Parameters : -- ts - the TS context obtained from TSCreate() -- u - the solution vector (can be null if TSSetSolution() was used, otherwise must contain the initial conditions) -- Notes : -- The final time returned by this function may be different from the time of the internally held state accessible by TSGetSolution() and TSGetTime() because the method may have stepped over the final time.
1,313
withTSSolve c pt t0 dt0 maxsteps maxtime v pre post = withTs c $ \ts -> do -- NB: Vec v contains initial condition and will be updated with final state -- -- (initial state must be given or computed internally) -- NB2 : this version does not account for time-varying right-hand side -- see: -- http://www.mcs.anl.gov/petsc/petsc-current/src/ts/examples/tutorials/ex3.c.html tsSetProblemType ts pt tsSetInitialTimeStep ts t0 dt0 tsSetDuration ts maxsteps maxtime pre ts tsSolve ts v post ts -- TSSetFromOptions(ts); -- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- Solve the problem -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -- /* -- Evaluate initial conditions -- */ -- InitialConditions(u,&appctx); -- TSSolve(ts,u); -- PetscErrorCode TSSolve(TS ts,Vec u) -- Collective on TS -- Input Parameters : -- ts - the TS context obtained from TSCreate() -- u - the solution vector (can be null if TSSetSolution() was used, otherwise must contain the initial conditions) -- Notes : -- The final time returned by this function may be different from the time of the internally held state accessible by TSGetSolution() and TSGetTime() because the method may have stepped over the final time.
1,313
false
false
0
9
315
106
56
50
null
null
uuhan/Idris-dev
src/Idris/Core/Elaborate.hs
bsd-3-clause
attack :: Elab' aux () attack = processTactic' Attack
53
attack :: Elab' aux () attack = processTactic' Attack
53
attack = processTactic' Attack
30
false
true
0
7
8
27
11
16
null
null
kawamuray/ganeti
src/Ganeti/Query/Query.hs
gpl-2.0
queryFields (QueryFields (ItemTypeOpCode QRNetwork) fields) = Ok $ fieldsExtractor Network.fieldsMap fields
109
queryFields (QueryFields (ItemTypeOpCode QRNetwork) fields) = Ok $ fieldsExtractor Network.fieldsMap fields
109
queryFields (QueryFields (ItemTypeOpCode QRNetwork) fields) = Ok $ fieldsExtractor Network.fieldsMap fields
109
false
false
2
9
12
35
16
19
null
null
olsner/ghc
compiler/basicTypes/Module.hs
bsd-3-clause
lookupWithDefaultModuleEnv :: ModuleEnv a -> a -> Module -> a lookupWithDefaultModuleEnv (ModuleEnv e) x m = Map.findWithDefault x (NDModule m) e
147
lookupWithDefaultModuleEnv :: ModuleEnv a -> a -> Module -> a lookupWithDefaultModuleEnv (ModuleEnv e) x m = Map.findWithDefault x (NDModule m) e
147
lookupWithDefaultModuleEnv (ModuleEnv e) x m = Map.findWithDefault x (NDModule m) e
85
false
true
0
7
22
54
26
28
null
null
binesiyu/ifl
book/utils.hs
mit
setIsEmpty s = null s
21
setIsEmpty s = null s
21
setIsEmpty s = null s
21
false
false
0
5
4
12
5
7
null
null
ekmett/ghc
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
callishOp FloatAcosOp = Just MO_F32_Acos
42
callishOp FloatAcosOp = Just MO_F32_Acos
42
callishOp FloatAcosOp = Just MO_F32_Acos
42
false
false
0
5
6
12
5
7
null
null
peteg/ADHOC
Tests/04_Generics/010_inverses.hs
gpl-2.0
prop_pair_id = property (\(a :: (Int, Int)) -> inst_dest_prop a)
64
prop_pair_id = property (\(a :: (Int, Int)) -> inst_dest_prop a)
64
prop_pair_id = property (\(a :: (Int, Int)) -> inst_dest_prop a)
64
false
false
0
10
9
33
18
15
null
null
CindyLinz/Haskell.js
trans/src/Desugar/Tuple.hs
mit
deTuplePat (PWildCard l) = PWildCard (id l)
43
deTuplePat (PWildCard l) = PWildCard (id l)
43
deTuplePat (PWildCard l) = PWildCard (id l)
43
false
false
0
7
6
25
11
14
null
null
josuf107/Adverb
Adverb/Common.hs
gpl-3.0
ruggedly = id
13
ruggedly = id
13
ruggedly = id
13
false
false
0
4
2
6
3
3
null
null
brendanhay/gogol
gogol-storage/gen/Network/Google/Resource/Storage/Projects/HmacKeys/Update.hs
mpl-2.0
-- | The project to be billed for this request. phkuUserProject :: Lens' ProjectsHmacKeysUpdate (Maybe Text) phkuUserProject = lens _phkuUserProject (\ s a -> s{_phkuUserProject = a})
191
phkuUserProject :: Lens' ProjectsHmacKeysUpdate (Maybe Text) phkuUserProject = lens _phkuUserProject (\ s a -> s{_phkuUserProject = a})
143
phkuUserProject = lens _phkuUserProject (\ s a -> s{_phkuUserProject = a})
82
true
true
0
9
34
48
25
23
null
null
VictorDenisov/jdi
src/Language/Java/Jdi/Impl.hs
gpl-2.0
{- | Waits forever for the next available event. Returns: the next EventSet. -} removeEvent :: MonadIO m => VirtualMachine m J.EventSet removeEvent = do h <- getVmHandle idsizes <- getIdSizes qe <- queueEmpty if qe then do eventSetData <- J.dat `liftM` (liftIO $ J.waitEvent h) return $ runGet (J.parseEventSet idsizes) (J.toLazy eventSetData) else takeFromQueue -- }}} -- EventRequest functions section. {{{ {- | Represents a request for notification of an event. Examples include BreakpointRequest and ExceptionRequest. When an event occurs for which an enabled request is present, an EventSet will be placed on the event queue. The number of events generated for an event request can be controlled through filters. Filters provide additional constraints that an event must satisfy before it is placed on the event queue. Multiple filters can be used by making multiple calls to filter addition functions such as addClassFilter :: EventRequest -> String -> EventRequest. Filters are added to an event one at a time only while the event is disabled. Multiple filters are applied with CUT-OFF AND, in the order it was added to the request. Only events that satisfy all filters are placed in the event queue. The set of available filters is dependent on the event request, some examples of filters are: Thread filters allow control over the thread for which events are generated. Class filters allow control over the class in which the event occurs. Instance filters allow control over the instance in which the event occurs. Count filters allow control over the number of times an event is reported. Filters can dramatically improve debugger performance by reducing the amount of event traffic sent from the target VM to the debugger VM. -}
1,819
removeEvent :: MonadIO m => VirtualMachine m J.EventSet removeEvent = do h <- getVmHandle idsizes <- getIdSizes qe <- queueEmpty if qe then do eventSetData <- J.dat `liftM` (liftIO $ J.waitEvent h) return $ runGet (J.parseEventSet idsizes) (J.toLazy eventSetData) else takeFromQueue -- }}} -- EventRequest functions section. {{{ {- | Represents a request for notification of an event. Examples include BreakpointRequest and ExceptionRequest. When an event occurs for which an enabled request is present, an EventSet will be placed on the event queue. The number of events generated for an event request can be controlled through filters. Filters provide additional constraints that an event must satisfy before it is placed on the event queue. Multiple filters can be used by making multiple calls to filter addition functions such as addClassFilter :: EventRequest -> String -> EventRequest. Filters are added to an event one at a time only while the event is disabled. Multiple filters are applied with CUT-OFF AND, in the order it was added to the request. Only events that satisfy all filters are placed in the event queue. The set of available filters is dependent on the event request, some examples of filters are: Thread filters allow control over the thread for which events are generated. Class filters allow control over the class in which the event occurs. Instance filters allow control over the instance in which the event occurs. Count filters allow control over the number of times an event is reported. Filters can dramatically improve debugger performance by reducing the amount of event traffic sent from the target VM to the debugger VM. -}
1,738
removeEvent = do h <- getVmHandle idsizes <- getIdSizes qe <- queueEmpty if qe then do eventSetData <- J.dat `liftM` (liftIO $ J.waitEvent h) return $ runGet (J.parseEventSet idsizes) (J.toLazy eventSetData) else takeFromQueue -- }}} -- EventRequest functions section. {{{ {- | Represents a request for notification of an event. Examples include BreakpointRequest and ExceptionRequest. When an event occurs for which an enabled request is present, an EventSet will be placed on the event queue. The number of events generated for an event request can be controlled through filters. Filters provide additional constraints that an event must satisfy before it is placed on the event queue. Multiple filters can be used by making multiple calls to filter addition functions such as addClassFilter :: EventRequest -> String -> EventRequest. Filters are added to an event one at a time only while the event is disabled. Multiple filters are applied with CUT-OFF AND, in the order it was added to the request. Only events that satisfy all filters are placed in the event queue. The set of available filters is dependent on the event request, some examples of filters are: Thread filters allow control over the thread for which events are generated. Class filters allow control over the class in which the event occurs. Instance filters allow control over the instance in which the event occurs. Count filters allow control over the number of times an event is reported. Filters can dramatically improve debugger performance by reducing the amount of event traffic sent from the target VM to the debugger VM. -}
1,682
true
true
0
15
360
122
59
63
null
null
tittoassini/flat
src/Flat/Encoder/Strict.hs
bsd-3-clause
eUTF16 :: Text -> Encoding eUTF16 = Encoding . eUTF16F
54
eUTF16 :: Text -> Encoding eUTF16 = Encoding . eUTF16F
54
eUTF16 = Encoding . eUTF16F
27
false
true
1
7
9
27
11
16
null
null
DeathByTape/LifeRaft
src/Network/LifeRaft.hs
bsd-3-clause
serverHandler :: (Ser.Serialize a) => LifeRaft a b s m r -> (SockAddr, Socket) -> IO () serverHandler liferaft (saddr, sock) = do putStrLn "Handling! Immediately disconnecting... TODO" sClose sock removeServerConnection liferaft saddr -- | Handle client connection request -- -- Handle requests made by client --
361
serverHandler :: (Ser.Serialize a) => LifeRaft a b s m r -> (SockAddr, Socket) -> IO () serverHandler liferaft (saddr, sock) = do putStrLn "Handling! Immediately disconnecting... TODO" sClose sock removeServerConnection liferaft saddr -- | Handle client connection request -- -- Handle requests made by client --
361
serverHandler liferaft (saddr, sock) = do putStrLn "Handling! Immediately disconnecting... TODO" sClose sock removeServerConnection liferaft saddr -- | Handle client connection request -- -- Handle requests made by client --
231
false
true
0
10
95
92
45
47
null
null
fit-ivs/calc
src/Lib.hs
gpl-3.0
render (Subtract a b) = "(" ++ render a ++ ") - (" ++ render b ++ ")"
71
render (Subtract a b) = "(" ++ render a ++ ") - (" ++ render b ++ ")"
71
render (Subtract a b) = "(" ++ render a ++ ") - (" ++ render b ++ ")"
71
false
false
0
9
19
39
18
21
null
null
suhailshergill/GenAlg
src/Algorithm/GenAlg.hs
gpl-3.0
evolutionStep :: (GASemConstraint sem) => GenAlgConfig (Dom sem) sem -> [(Chromosome (Dom sem))] -> (Rand StdGen) [(Chromosome (Dom sem))] evolutionStep _ [] = return []
220
evolutionStep :: (GASemConstraint sem) => GenAlgConfig (Dom sem) sem -> [(Chromosome (Dom sem))] -> (Rand StdGen) [(Chromosome (Dom sem))] evolutionStep _ [] = return []
220
evolutionStep _ [] = return []
30
false
true
0
13
75
90
45
45
null
null
pgj/bead
src/Bead/Domain/Entities.hs
bsd-3-clause
timeZoneName f (TimeZoneName z) = f z
37
timeZoneName f (TimeZoneName z) = f z
37
timeZoneName f (TimeZoneName z) = f z
37
false
false
0
6
6
22
9
13
null
null
Yuras/tide
src/HaskellLex.hs
bsd-3-clause
isSymbol '"' = False
20
isSymbol '"' = False
20
isSymbol '"' = False
20
false
false
0
5
3
9
4
5
null
null
fffej/haskellprojects
traffic/Traffic.hs
bsd-2-clause
{- Actual Logic of simulation -} update :: Environment -> Environment update env = env' { cars = updateCars env (cars env) } where env' = env { noise = drop (length (cars env)) (noise env) }
200
update :: Environment -> Environment update env = env' { cars = updateCars env (cars env) } where env' = env { noise = drop (length (cars env)) (noise env) }
167
update env = env' { cars = updateCars env (cars env) } where env' = env { noise = drop (length (cars env)) (noise env) }
130
true
true
0
12
46
81
41
40
null
null
ghcjs/jsaddle-dom
src/JSDOM/Generated/HTMLFormElement.hs
mit
-- | <https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement.action Mozilla HTMLFormElement.action documentation> getAction :: (MonadDOM m, FromJSString result) => HTMLFormElement -> m result getAction self = liftDOM ((self ^. js "action") >>= fromJSValUnchecked)
286
getAction :: (MonadDOM m, FromJSString result) => HTMLFormElement -> m result getAction self = liftDOM ((self ^. js "action") >>= fromJSValUnchecked)
161
getAction self = liftDOM ((self ^. js "action") >>= fromJSValUnchecked)
73
true
true
0
10
39
57
29
28
null
null
andyarvanitis/Idris-dev
src/IRTS/Compiler.hs
bsd-3-clause
irSC vs (Case up n [ConCase (UN delay) i [_, _, n'] sc]) | delay == txt "Delay" = do sc' <- irSC vs $ mkForce n' n sc return $ LLet n' (LForce (LV (Glob n))) sc' -- There are two transformations in this case: -- -- 1. Newtype-case elimination: -- case {e0} of -- wrap({e1}) -> P({e1}) ==> P({e0}) -- -- This is important because newtyped constructors are compiled away entirely -- and we need to do that everywhere. -- -- 2. Unused-case elimination (only valid for singleton branches): -- case {e0} of ==> P -- C(x,y) -> P[... x,y not used ...] -- -- This is important for runtime because sometimes we case on irrelevant data: -- -- In the example above, {e0} will most probably have been erased -- so this vain projection would make the resulting program segfault -- because the code generator still emits a PROJECT(...) G-machine instruction. -- -- Hence, we check whether the variables are used at all -- and erase the casesplit if they are not. --
1,038
irSC vs (Case up n [ConCase (UN delay) i [_, _, n'] sc]) | delay == txt "Delay" = do sc' <- irSC vs $ mkForce n' n sc return $ LLet n' (LForce (LV (Glob n))) sc' -- There are two transformations in this case: -- -- 1. Newtype-case elimination: -- case {e0} of -- wrap({e1}) -> P({e1}) ==> P({e0}) -- -- This is important because newtyped constructors are compiled away entirely -- and we need to do that everywhere. -- -- 2. Unused-case elimination (only valid for singleton branches): -- case {e0} of ==> P -- C(x,y) -> P[... x,y not used ...] -- -- This is important for runtime because sometimes we case on irrelevant data: -- -- In the example above, {e0} will most probably have been erased -- so this vain projection would make the resulting program segfault -- because the code generator still emits a PROJECT(...) G-machine instruction. -- -- Hence, we check whether the variables are used at all -- and erase the casesplit if they are not. --
1,038
irSC vs (Case up n [ConCase (UN delay) i [_, _, n'] sc]) | delay == txt "Delay" = do sc' <- irSC vs $ mkForce n' n sc return $ LLet n' (LForce (LV (Glob n))) sc' -- There are two transformations in this case: -- -- 1. Newtype-case elimination: -- case {e0} of -- wrap({e1}) -> P({e1}) ==> P({e0}) -- -- This is important because newtyped constructors are compiled away entirely -- and we need to do that everywhere. -- -- 2. Unused-case elimination (only valid for singleton branches): -- case {e0} of ==> P -- C(x,y) -> P[... x,y not used ...] -- -- This is important for runtime because sometimes we case on irrelevant data: -- -- In the example above, {e0} will most probably have been erased -- so this vain projection would make the resulting program segfault -- because the code generator still emits a PROJECT(...) G-machine instruction. -- -- Hence, we check whether the variables are used at all -- and erase the casesplit if they are not. --
1,038
false
false
0
15
262
138
76
62
null
null
text-utf8/text
tests/Tests/Properties.hs
bsd-2-clause
tb_decimal_int32 (a::Int32) = tb_decimal a
42
tb_decimal_int32 (a::Int32) = tb_decimal a
42
tb_decimal_int32 (a::Int32) = tb_decimal a
42
false
false
0
7
4
19
9
10
null
null
seereason/ghcjs
src/Gen2/Object.hs
mit
getIW16 :: GetS Int getIW16 = lift (fmap fromIntegral DB.getWord16le)
69
getIW16 :: GetS Int getIW16 = lift (fmap fromIntegral DB.getWord16le)
69
getIW16 = lift (fmap fromIntegral DB.getWord16le)
49
false
true
0
8
9
27
13
14
null
null
ryantrinkle/reflex
src/Reflex/Requester/Base.hs
bsd-3-clause
responseFromTag :: Monad m => MyTagWrap response (Entry response x) -> RequesterT t request response m (Event t (Entry response x)) responseFromTag (MyTagWrap t) = do responses :: EventSelectorInt t Any <- RequesterT ask return $ (unsafeCoerce :: Event t Any -> Event t (Entry response x)) $ selectInt responses t
317
responseFromTag :: Monad m => MyTagWrap response (Entry response x) -> RequesterT t request response m (Event t (Entry response x)) responseFromTag (MyTagWrap t) = do responses :: EventSelectorInt t Any <- RequesterT ask return $ (unsafeCoerce :: Event t Any -> Event t (Entry response x)) $ selectInt responses t
317
responseFromTag (MyTagWrap t) = do responses :: EventSelectorInt t Any <- RequesterT ask return $ (unsafeCoerce :: Event t Any -> Event t (Entry response x)) $ selectInt responses t
185
false
true
0
13
54
134
63
71
null
null
phi16/ASCIIize
Main.hs
gpl-3.0
main :: IO () main = getLine >>= putStr . asciize
49
main :: IO () main = getLine >>= putStr . asciize
49
main = getLine >>= putStr . asciize
35
false
true
0
6
10
24
12
12
null
null
oldmanmike/ghc
compiler/basicTypes/Name.hs
bsd-3-clause
nameModule_maybe _ = Nothing
61
nameModule_maybe _ = Nothing
61
nameModule_maybe _ = Nothing
61
false
false
0
4
36
10
4
6
null
null
SwiftsNamesake/Elrond
src/Elrond/Server.hs
mit
-------------------------------------------------------------------------------------------------------------------------------------------- -- Functions -------------------------------------------------------------------------------------------------------------------------------------------- -- | -- TODO: Pling start :: IO () start = serverWith config handlerequest where handlerequest sockaddr url request = (printf "Request: %s\n" (show url) :: IO ()) >> return response headers = [Header HdrContentType "application/json", Header HdrContentLength (show $ length htmlbody)] response = Response (2,0,0) "Reason goes here" headers htmlbody config = Config stdLogger (show ip) 8000 ip = IP (192, 168, 1, 88) htmlbody = ""
760
start :: IO () start = serverWith config handlerequest where handlerequest sockaddr url request = (printf "Request: %s\n" (show url) :: IO ()) >> return response headers = [Header HdrContentType "application/json", Header HdrContentLength (show $ length htmlbody)] response = Response (2,0,0) "Reason goes here" headers htmlbody config = Config stdLogger (show ip) 8000 ip = IP (192, 168, 1, 88) htmlbody = ""
444
start = serverWith config handlerequest where handlerequest sockaddr url request = (printf "Request: %s\n" (show url) :: IO ()) >> return response headers = [Header HdrContentType "application/json", Header HdrContentLength (show $ length htmlbody)] response = Response (2,0,0) "Reason goes here" headers htmlbody config = Config stdLogger (show ip) 8000 ip = IP (192, 168, 1, 88) htmlbody = ""
429
true
true
1
9
107
171
89
82
null
null
topliceanu/learn
haskell/functions.hs
mit
foldr' f acc (x:xs) = f x rightAcc where rightAcc = foldr' f acc xs -- foldl traverses a list from right to left, note that this prevents the -- compiler from lazy evaluating the expression.
195
foldr' f acc (x:xs) = f x rightAcc where rightAcc = foldr' f acc xs -- foldl traverses a list from right to left, note that this prevents the -- compiler from lazy evaluating the expression.
195
foldr' f acc (x:xs) = f x rightAcc where rightAcc = foldr' f acc xs -- foldl traverses a list from right to left, note that this prevents the -- compiler from lazy evaluating the expression.
195
false
false
1
6
40
48
21
27
null
null
vladimir-ipatov/ganeti
src/Ganeti/Objects.hs
gpl-2.0
lidDiskType (LIDRados {}) = DTRbd
33
lidDiskType (LIDRados {}) = DTRbd
33
lidDiskType (LIDRados {}) = DTRbd
33
false
false
0
7
4
16
8
8
null
null
ekmett/ghc
compiler/nativeGen/X86/Ppr.hs
bsd-3-clause
pprGInstr (GDTOF src dst) = pprSizeSizeRegReg (sLit "gdtof") FF64 FF32 src dst
78
pprGInstr (GDTOF src dst) = pprSizeSizeRegReg (sLit "gdtof") FF64 FF32 src dst
78
pprGInstr (GDTOF src dst) = pprSizeSizeRegReg (sLit "gdtof") FF64 FF32 src dst
78
false
false
0
7
11
34
16
18
null
null
pxqr/regex-fuzzy
src/Text/Regex/Fuzzy/AST.hs
mit
isJustCharI :: Item -> Maybe Char isJustCharI (CharI c) = Just c
66
isJustCharI :: Item -> Maybe Char isJustCharI (CharI c) = Just c
66
isJustCharI (CharI c) = Just c
32
false
true
0
9
13
34
15
19
null
null
olsner/ghc
compiler/deSugar/DsBinds.hs
bsd-3-clause
dsSpec :: Maybe CoreExpr -- Just rhs => RULE is for a local binding -- Nothing => RULE is for an imported Id -- rhs is in the Id's unfolding -> Located TcSpecPrag -> DsM (Maybe (OrdList (Id,CoreExpr), CoreRule)) dsSpec mb_poly_rhs (L loc (SpecPrag poly_id spec_co spec_inl)) | isJust (isClassOpId_maybe poly_id) = putSrcSpanDs loc $ do { warnDs NoReason (text "Ignoring useless SPECIALISE pragma for class method selector" <+> quotes (ppr poly_id)) ; return Nothing } -- There is no point in trying to specialise a class op -- Moreover, classops don't (currently) have an inl_sat arity set -- (it would be Just 0) and that in turn makes makeCorePair bleat | no_act_spec && isNeverActive rule_act = putSrcSpanDs loc $ do { warnDs NoReason (text "Ignoring useless SPECIALISE pragma for NOINLINE function:" <+> quotes (ppr poly_id)) ; return Nothing } -- Function is NOINLINE, and the specialiation inherits that -- See Note [Activation pragmas for SPECIALISE] | otherwise = putSrcSpanDs loc $ do { uniq <- newUnique ; let poly_name = idName poly_id spec_occ = mkSpecOcc (getOccName poly_name) spec_name = mkInternalName uniq spec_occ (getSrcSpan poly_name) (spec_bndrs, spec_app) = collectHsWrapBinders spec_co -- spec_co looks like -- \spec_bndrs. [] spec_args -- perhaps with the body of the lambda wrapped in some WpLets -- E.g. /\a \(d:Eq a). let d2 = $df d in [] (Maybe a) d2 ; core_app <- dsHsWrapper spec_app ; let ds_lhs = core_app (Var poly_id) spec_ty = mkLamTypes spec_bndrs (exprType ds_lhs) ; -- pprTrace "dsRule" (vcat [ text "Id:" <+> ppr poly_id -- , text "spec_co:" <+> ppr spec_co -- , text "ds_rhs:" <+> ppr ds_lhs ]) $ case decomposeRuleLhs spec_bndrs ds_lhs of { Left msg -> do { warnDs NoReason msg; return Nothing } ; Right (rule_bndrs, _fn, args) -> do { dflags <- getDynFlags ; this_mod <- getModule ; let fn_unf = realIdUnfolding poly_id spec_unf = specUnfolding spec_bndrs core_app arity_decrease fn_unf spec_id = mkLocalId spec_name spec_ty `setInlinePragma` inl_prag `setIdUnfolding` spec_unf arity_decrease = count isValArg args - count isId spec_bndrs ; rule <- dsMkUserRule this_mod is_local_id (mkFastString ("SPEC " ++ showPpr dflags poly_name)) rule_act poly_name rule_bndrs args (mkVarApps (Var spec_id) spec_bndrs) ; let spec_rhs = mkLams spec_bndrs (core_app poly_rhs) -- Commented out: see Note [SPECIALISE on INLINE functions] -- ; when (isInlinePragma id_inl) -- (warnDs $ text "SPECIALISE pragma on INLINE function probably won't fire:" -- <+> quotes (ppr poly_name)) ; return (Just (unitOL (spec_id, spec_rhs), rule)) -- NB: do *not* use makeCorePair on (spec_id,spec_rhs), because -- makeCorePair overwrites the unfolding, which we have -- just created using specUnfolding } } } where is_local_id = isJust mb_poly_rhs poly_rhs | Just rhs <- mb_poly_rhs = rhs -- Local Id; this is its rhs | Just unfolding <- maybeUnfoldingTemplate (realIdUnfolding poly_id) = unfolding -- Imported Id; this is its unfolding -- Use realIdUnfolding so we get the unfolding -- even when it is a loop breaker. -- We want to specialise recursive functions! | otherwise = pprPanic "dsImpSpecs" (ppr poly_id) -- The type checker has checked that it *has* an unfolding id_inl = idInlinePragma poly_id -- See Note [Activation pragmas for SPECIALISE] inl_prag | not (isDefaultInlinePragma spec_inl) = spec_inl | not is_local_id -- See Note [Specialising imported functions] -- in OccurAnal , isStrongLoopBreaker (idOccInfo poly_id) = neverInlinePragma | otherwise = id_inl -- Get the INLINE pragma from SPECIALISE declaration, or, -- failing that, from the original Id spec_prag_act = inlinePragmaActivation spec_inl -- See Note [Activation pragmas for SPECIALISE] -- no_act_spec is True if the user didn't write an explicit -- phase specification in the SPECIALISE pragma no_act_spec = case inlinePragmaSpec spec_inl of NoInline -> isNeverActive spec_prag_act _ -> isAlwaysActive spec_prag_act rule_act | no_act_spec = inlinePragmaActivation id_inl -- Inherit | otherwise = spec_prag_act -- Specified by user
5,313
dsSpec :: Maybe CoreExpr -- Just rhs => RULE is for a local binding -- Nothing => RULE is for an imported Id -- rhs is in the Id's unfolding -> Located TcSpecPrag -> DsM (Maybe (OrdList (Id,CoreExpr), CoreRule)) dsSpec mb_poly_rhs (L loc (SpecPrag poly_id spec_co spec_inl)) | isJust (isClassOpId_maybe poly_id) = putSrcSpanDs loc $ do { warnDs NoReason (text "Ignoring useless SPECIALISE pragma for class method selector" <+> quotes (ppr poly_id)) ; return Nothing } -- There is no point in trying to specialise a class op -- Moreover, classops don't (currently) have an inl_sat arity set -- (it would be Just 0) and that in turn makes makeCorePair bleat | no_act_spec && isNeverActive rule_act = putSrcSpanDs loc $ do { warnDs NoReason (text "Ignoring useless SPECIALISE pragma for NOINLINE function:" <+> quotes (ppr poly_id)) ; return Nothing } -- Function is NOINLINE, and the specialiation inherits that -- See Note [Activation pragmas for SPECIALISE] | otherwise = putSrcSpanDs loc $ do { uniq <- newUnique ; let poly_name = idName poly_id spec_occ = mkSpecOcc (getOccName poly_name) spec_name = mkInternalName uniq spec_occ (getSrcSpan poly_name) (spec_bndrs, spec_app) = collectHsWrapBinders spec_co -- spec_co looks like -- \spec_bndrs. [] spec_args -- perhaps with the body of the lambda wrapped in some WpLets -- E.g. /\a \(d:Eq a). let d2 = $df d in [] (Maybe a) d2 ; core_app <- dsHsWrapper spec_app ; let ds_lhs = core_app (Var poly_id) spec_ty = mkLamTypes spec_bndrs (exprType ds_lhs) ; -- pprTrace "dsRule" (vcat [ text "Id:" <+> ppr poly_id -- , text "spec_co:" <+> ppr spec_co -- , text "ds_rhs:" <+> ppr ds_lhs ]) $ case decomposeRuleLhs spec_bndrs ds_lhs of { Left msg -> do { warnDs NoReason msg; return Nothing } ; Right (rule_bndrs, _fn, args) -> do { dflags <- getDynFlags ; this_mod <- getModule ; let fn_unf = realIdUnfolding poly_id spec_unf = specUnfolding spec_bndrs core_app arity_decrease fn_unf spec_id = mkLocalId spec_name spec_ty `setInlinePragma` inl_prag `setIdUnfolding` spec_unf arity_decrease = count isValArg args - count isId spec_bndrs ; rule <- dsMkUserRule this_mod is_local_id (mkFastString ("SPEC " ++ showPpr dflags poly_name)) rule_act poly_name rule_bndrs args (mkVarApps (Var spec_id) spec_bndrs) ; let spec_rhs = mkLams spec_bndrs (core_app poly_rhs) -- Commented out: see Note [SPECIALISE on INLINE functions] -- ; when (isInlinePragma id_inl) -- (warnDs $ text "SPECIALISE pragma on INLINE function probably won't fire:" -- <+> quotes (ppr poly_name)) ; return (Just (unitOL (spec_id, spec_rhs), rule)) -- NB: do *not* use makeCorePair on (spec_id,spec_rhs), because -- makeCorePair overwrites the unfolding, which we have -- just created using specUnfolding } } } where is_local_id = isJust mb_poly_rhs poly_rhs | Just rhs <- mb_poly_rhs = rhs -- Local Id; this is its rhs | Just unfolding <- maybeUnfoldingTemplate (realIdUnfolding poly_id) = unfolding -- Imported Id; this is its unfolding -- Use realIdUnfolding so we get the unfolding -- even when it is a loop breaker. -- We want to specialise recursive functions! | otherwise = pprPanic "dsImpSpecs" (ppr poly_id) -- The type checker has checked that it *has* an unfolding id_inl = idInlinePragma poly_id -- See Note [Activation pragmas for SPECIALISE] inl_prag | not (isDefaultInlinePragma spec_inl) = spec_inl | not is_local_id -- See Note [Specialising imported functions] -- in OccurAnal , isStrongLoopBreaker (idOccInfo poly_id) = neverInlinePragma | otherwise = id_inl -- Get the INLINE pragma from SPECIALISE declaration, or, -- failing that, from the original Id spec_prag_act = inlinePragmaActivation spec_inl -- See Note [Activation pragmas for SPECIALISE] -- no_act_spec is True if the user didn't write an explicit -- phase specification in the SPECIALISE pragma no_act_spec = case inlinePragmaSpec spec_inl of NoInline -> isNeverActive spec_prag_act _ -> isAlwaysActive spec_prag_act rule_act | no_act_spec = inlinePragmaActivation id_inl -- Inherit | otherwise = spec_prag_act -- Specified by user
5,313
dsSpec mb_poly_rhs (L loc (SpecPrag poly_id spec_co spec_inl)) | isJust (isClassOpId_maybe poly_id) = putSrcSpanDs loc $ do { warnDs NoReason (text "Ignoring useless SPECIALISE pragma for class method selector" <+> quotes (ppr poly_id)) ; return Nothing } -- There is no point in trying to specialise a class op -- Moreover, classops don't (currently) have an inl_sat arity set -- (it would be Just 0) and that in turn makes makeCorePair bleat | no_act_spec && isNeverActive rule_act = putSrcSpanDs loc $ do { warnDs NoReason (text "Ignoring useless SPECIALISE pragma for NOINLINE function:" <+> quotes (ppr poly_id)) ; return Nothing } -- Function is NOINLINE, and the specialiation inherits that -- See Note [Activation pragmas for SPECIALISE] | otherwise = putSrcSpanDs loc $ do { uniq <- newUnique ; let poly_name = idName poly_id spec_occ = mkSpecOcc (getOccName poly_name) spec_name = mkInternalName uniq spec_occ (getSrcSpan poly_name) (spec_bndrs, spec_app) = collectHsWrapBinders spec_co -- spec_co looks like -- \spec_bndrs. [] spec_args -- perhaps with the body of the lambda wrapped in some WpLets -- E.g. /\a \(d:Eq a). let d2 = $df d in [] (Maybe a) d2 ; core_app <- dsHsWrapper spec_app ; let ds_lhs = core_app (Var poly_id) spec_ty = mkLamTypes spec_bndrs (exprType ds_lhs) ; -- pprTrace "dsRule" (vcat [ text "Id:" <+> ppr poly_id -- , text "spec_co:" <+> ppr spec_co -- , text "ds_rhs:" <+> ppr ds_lhs ]) $ case decomposeRuleLhs spec_bndrs ds_lhs of { Left msg -> do { warnDs NoReason msg; return Nothing } ; Right (rule_bndrs, _fn, args) -> do { dflags <- getDynFlags ; this_mod <- getModule ; let fn_unf = realIdUnfolding poly_id spec_unf = specUnfolding spec_bndrs core_app arity_decrease fn_unf spec_id = mkLocalId spec_name spec_ty `setInlinePragma` inl_prag `setIdUnfolding` spec_unf arity_decrease = count isValArg args - count isId spec_bndrs ; rule <- dsMkUserRule this_mod is_local_id (mkFastString ("SPEC " ++ showPpr dflags poly_name)) rule_act poly_name rule_bndrs args (mkVarApps (Var spec_id) spec_bndrs) ; let spec_rhs = mkLams spec_bndrs (core_app poly_rhs) -- Commented out: see Note [SPECIALISE on INLINE functions] -- ; when (isInlinePragma id_inl) -- (warnDs $ text "SPECIALISE pragma on INLINE function probably won't fire:" -- <+> quotes (ppr poly_name)) ; return (Just (unitOL (spec_id, spec_rhs), rule)) -- NB: do *not* use makeCorePair on (spec_id,spec_rhs), because -- makeCorePair overwrites the unfolding, which we have -- just created using specUnfolding } } } where is_local_id = isJust mb_poly_rhs poly_rhs | Just rhs <- mb_poly_rhs = rhs -- Local Id; this is its rhs | Just unfolding <- maybeUnfoldingTemplate (realIdUnfolding poly_id) = unfolding -- Imported Id; this is its unfolding -- Use realIdUnfolding so we get the unfolding -- even when it is a loop breaker. -- We want to specialise recursive functions! | otherwise = pprPanic "dsImpSpecs" (ppr poly_id) -- The type checker has checked that it *has* an unfolding id_inl = idInlinePragma poly_id -- See Note [Activation pragmas for SPECIALISE] inl_prag | not (isDefaultInlinePragma spec_inl) = spec_inl | not is_local_id -- See Note [Specialising imported functions] -- in OccurAnal , isStrongLoopBreaker (idOccInfo poly_id) = neverInlinePragma | otherwise = id_inl -- Get the INLINE pragma from SPECIALISE declaration, or, -- failing that, from the original Id spec_prag_act = inlinePragmaActivation spec_inl -- See Note [Activation pragmas for SPECIALISE] -- no_act_spec is True if the user didn't write an explicit -- phase specification in the SPECIALISE pragma no_act_spec = case inlinePragmaSpec spec_inl of NoInline -> isNeverActive spec_prag_act _ -> isAlwaysActive spec_prag_act rule_act | no_act_spec = inlinePragmaActivation id_inl -- Inherit | otherwise = spec_prag_act -- Specified by user
5,005
false
true
5
20
1,905
817
414
403
null
null
mpickering/hackage-server
Distribution/Server/Framework/Templating.hs
bsd-3-clause
($=) :: ToSElem a => String -> a -> TemplateAttr ($=) k v = TemplateAttr (setAttribute k v)
91
($=) :: ToSElem a => String -> a -> TemplateAttr ($=) k v = TemplateAttr (setAttribute k v)
91
($=) k v = TemplateAttr (setAttribute k v)
42
false
true
0
7
17
46
24
22
null
null
GaloisInc/pads-haskell
Language/Pads/Library/LittleEndian.hs
bsd-3-clause
w16sblTob (i,md) = (word16ToBytes SBL i, md)
44
w16sblTob (i,md) = (word16ToBytes SBL i, md)
44
w16sblTob (i,md) = (word16ToBytes SBL i, md)
44
false
false
0
6
6
27
14
13
null
null
Booster2/Booster2
Workflow_Precond/impl_nondisjoint/Misc.hs
bsd-3-clause
printMap_help m ([k]) = (show k) ++ " --> \n\n" ++ (show (m!k))
94
printMap_help m ([k]) = (show k) ++ " --> \n\n" ++ (show (m!k))
94
printMap_help m ([k]) = (show k) ++ " --> \n\n" ++ (show (m!k))
94
false
false
2
10
43
48
23
25
null
null
rahulmutt/ghcvm
compiler/Eta/TypeCheck/TcRnTypes.hs
bsd-3-clause
pprTcTyThingCategory (ATcId {}) = ptext (sLit "Local identifier")
73
pprTcTyThingCategory (ATcId {}) = ptext (sLit "Local identifier")
73
pprTcTyThingCategory (ATcId {}) = ptext (sLit "Local identifier")
73
false
false
0
7
15
25
12
13
null
null
andyfriesen/hs-sajson
tests/SajsonTest.hs
mit
assumeSuccess (Left e) = error $ "Unexpected error: " ++ (show e)
65
assumeSuccess (Left e) = error $ "Unexpected error: " ++ (show e)
65
assumeSuccess (Left e) = error $ "Unexpected error: " ++ (show e)
65
false
false
0
7
11
29
14
15
null
null
brendanhay/gogol
gogol-clouderrorreporting/gen/Network/Google/Resource/CloudErrorReporting/Projects/Events/List.hs
mpl-2.0
-- | Optional. The exact value to match against -- [\`ServiceContext.resource_type\`](\/error-reporting\/reference\/rest\/v1beta1\/ServiceContext#FIELDS.resource_type). pelServiceFilterResourceType :: Lens' ProjectsEventsList (Maybe Text) pelServiceFilterResourceType = lens _pelServiceFilterResourceType (\ s a -> s{_pelServiceFilterResourceType = a})
360
pelServiceFilterResourceType :: Lens' ProjectsEventsList (Maybe Text) pelServiceFilterResourceType = lens _pelServiceFilterResourceType (\ s a -> s{_pelServiceFilterResourceType = a})
191
pelServiceFilterResourceType = lens _pelServiceFilterResourceType (\ s a -> s{_pelServiceFilterResourceType = a})
121
true
true
1
9
35
52
26
26
null
null
jkr/pandoc-citeproc
src/Text/CSL/Parser.hs
bsd-3-clause
parseIf :: Cursor -> IfThen parseIf cur = IfThen cond mat elts where cond = Condition { isType = go "type" , isSet = go "variable" , isNumeric = go "is-numeric" , isUncertainDate = go "is-uncertain-date" , isPosition = go "position" , disambiguation = go "disambiguate" , isLocator = go "locator" } mat = attrWithDefault "match" All cur elts = cur $/ parseElement go x = words $ stringAttr x cur
581
parseIf :: Cursor -> IfThen parseIf cur = IfThen cond mat elts where cond = Condition { isType = go "type" , isSet = go "variable" , isNumeric = go "is-numeric" , isUncertainDate = go "is-uncertain-date" , isPosition = go "position" , disambiguation = go "disambiguate" , isLocator = go "locator" } mat = attrWithDefault "match" All cur elts = cur $/ parseElement go x = words $ stringAttr x cur
581
parseIf cur = IfThen cond mat elts where cond = Condition { isType = go "type" , isSet = go "variable" , isNumeric = go "is-numeric" , isUncertainDate = go "is-uncertain-date" , isPosition = go "position" , disambiguation = go "disambiguate" , isLocator = go "locator" } mat = attrWithDefault "match" All cur elts = cur $/ parseElement go x = words $ stringAttr x cur
553
false
true
3
10
256
139
71
68
null
null
bkach/HaskellRaycaster
src/RayCaster/JsonSceneDef.hs
apache-2.0
parseShape :: String -> A.Object -> Parser Shape parseShape shapeType v = case shapeType of "sphere" -> Sphere <$> v .: "center" <*> v .: "radius" "plane" -> Plane <$> v .: "center" <*> v .: "normal" _ -> empty
232
parseShape :: String -> A.Object -> Parser Shape parseShape shapeType v = case shapeType of "sphere" -> Sphere <$> v .: "center" <*> v .: "radius" "plane" -> Plane <$> v .: "center" <*> v .: "normal" _ -> empty
232
parseShape shapeType v = case shapeType of "sphere" -> Sphere <$> v .: "center" <*> v .: "radius" "plane" -> Plane <$> v .: "center" <*> v .: "normal" _ -> empty
183
false
true
0
11
61
88
42
46
null
null
FranklinChen/reddit
test/Reddit/Types/SubredditSpec.hs
bsd-2-clause
isLeft :: Either a b -> Bool isLeft = const True `either` const False
69
isLeft :: Either a b -> Bool isLeft = const True `either` const False
69
isLeft = const True `either` const False
40
false
true
0
7
13
42
18
24
null
null
spockwangs/scheme.in.haskell
list6.3.hs
unlicense
unwordsList :: [LispVal] -> String unwordsList = unwords . map show
67
unwordsList :: [LispVal] -> String unwordsList = unwords . map show
67
unwordsList = unwords . map show
32
false
true
0
7
10
31
14
17
null
null
conal/lambda-ccc
src/LambdaCCC/Lambda.hs
bsd-3-clause
eval' (ConstE p) _ = evalP p
32
eval' (ConstE p) _ = evalP p
32
eval' (ConstE p) _ = evalP p
32
false
false
0
6
10
22
9
13
null
null
carliros/lsystem
src/GenSequences.hs
bsd-3-clause
generate :: SistemaL -> Int -> [Simbolo] generate (SistemaL _ _ init prods) n = generate' init prods n where generate' seq prods 0 = seq generate' seq prods n = let seq' = concat [lst | s1 <- seq, (s2,lst) <- prods, s1 == s2] in generate' seq' prods (n-1)
303
generate :: SistemaL -> Int -> [Simbolo] generate (SistemaL _ _ init prods) n = generate' init prods n where generate' seq prods 0 = seq generate' seq prods n = let seq' = concat [lst | s1 <- seq, (s2,lst) <- prods, s1 == s2] in generate' seq' prods (n-1)
303
generate (SistemaL _ _ init prods) n = generate' init prods n where generate' seq prods 0 = seq generate' seq prods n = let seq' = concat [lst | s1 <- seq, (s2,lst) <- prods, s1 == s2] in generate' seq' prods (n-1)
262
false
true
1
14
98
134
67
67
null
null
faylang/fay-server
src/Language/Fay/JQuery.hs
bsd-3-clause
setScrollTop :: Double -> JQuery -> Fay JQuery setScrollTop = ffi "%2['scrollTop'](%1)"
87
setScrollTop :: Double -> JQuery -> Fay JQuery setScrollTop = ffi "%2['scrollTop'](%1)"
87
setScrollTop = ffi "%2['scrollTop'](%1)"
40
false
true
0
7
11
25
12
13
null
null
kbiscanic/PUH
hw04/exercises.hs
mit
headHunter (_:_:(x:_):_) = x
28
headHunter (_:_:(x:_):_) = x
28
headHunter (_:_:(x:_):_) = x
28
false
false
0
11
3
31
16
15
null
null
harrisi/on-being-better
list-expansion/Haskell/cis194/02/02-lists.hs
cc0-1.0
squareAll :: [Int] -> [Int] squareAll [] = []
45
squareAll :: [Int] -> [Int] squareAll [] = []
45
squareAll [] = []
17
false
true
0
6
8
28
15
13
null
null
ulricha/dsh-example-queries
Queries/TPCH/NonStandard/Flat.hs
bsd-3-clause
nf2Qc :: Q (Decimal, Decimal) nf2Qc = tup2 (maximum prices) (minimum prices) where prices = map o_totalpriceQ orders
122
nf2Qc :: Q (Decimal, Decimal) nf2Qc = tup2 (maximum prices) (minimum prices) where prices = map o_totalpriceQ orders
122
nf2Qc = tup2 (maximum prices) (minimum prices) where prices = map o_totalpriceQ orders
92
false
true
1
7
23
61
26
35
null
null
maoe/shared-buffer
src/System/Posix/CircularBuffer.hs
bsd-3-clause
-- read currently available data starting from the given sequence number. readSeqReady :: Storable a => CircularBuffer -> Int -> IO [a] readSeqReady cb@CircularBuffer{..} rseq = do curReady <- unsafeSemGetValue cbSem vals <- readSeqs cb rseq curReady replicateM_ curReady (unsafeSemLock cbSem) -- unsafeSemLock is ok if there are no other readers on this -- semaphore. return vals
405
readSeqReady :: Storable a => CircularBuffer -> Int -> IO [a] readSeqReady cb@CircularBuffer{..} rseq = do curReady <- unsafeSemGetValue cbSem vals <- readSeqs cb rseq curReady replicateM_ curReady (unsafeSemLock cbSem) -- unsafeSemLock is ok if there are no other readers on this -- semaphore. return vals
331
readSeqReady cb@CircularBuffer{..} rseq = do curReady <- unsafeSemGetValue cbSem vals <- readSeqs cb rseq curReady replicateM_ curReady (unsafeSemLock cbSem) -- unsafeSemLock is ok if there are no other readers on this -- semaphore. return vals
269
true
true
0
9
81
93
44
49
null
null
nkarag/haskell-CSVDB
src/Data/RTable.hs
bsd-3-clause
addSpace :: Int -- ^ number of spaces to add -> String -- ^ input String -> String -- ^ output string addSpace i s = s ++ Data.List.take i (repeat ' ')
174
addSpace :: Int -- ^ number of spaces to add -> String -- ^ input String -> String addSpace i s = s ++ Data.List.take i (repeat ' ')
154
addSpace i s = s ++ Data.List.take i (repeat ' ')
49
true
true
0
8
55
45
24
21
null
null
nugarstu/projectX
shoot.hs
apache-2.0
koko = 69
9
koko = 69
9
koko = 69
9
false
false
0
4
2
6
3
3
null
null
edsko/cabal
cabal-install/Distribution/Client/IndexUtils.hs
bsd-3-clause
indexFile :: Index -> FilePath indexFile (RepoIndex _ctxt repo) = repoLocalDir repo </> "00-index.tar"
102
indexFile :: Index -> FilePath indexFile (RepoIndex _ctxt repo) = repoLocalDir repo </> "00-index.tar"
102
indexFile (RepoIndex _ctxt repo) = repoLocalDir repo </> "00-index.tar"
71
false
true
0
7
13
33
16
17
null
null
ScaledSoftware/writemealist
Handler/Lists.hs
bsd-3-clause
postListItemCompleteR :: ListId -> ListItemId -> Handler Html postListItemCompleteR listId listItemId = do Entity uId _ <- requireAuth currTime <- lift getCurrentTime runDB $ do listItem <- get404 listItemId if isNothing (listItemCompletedAt listItem) then do update listItemId [ListItemCompletedBy =. (Just uId), ListItemCompletedAt =. (Just currTime), ListItemModified =. currTime] else do update listItemId [ListItemCompletedBy =. Nothing, ListItemCompletedAt =. Nothing, ListItemModified =. currTime] redirect $ ListR listId
754
postListItemCompleteR :: ListId -> ListItemId -> Handler Html postListItemCompleteR listId listItemId = do Entity uId _ <- requireAuth currTime <- lift getCurrentTime runDB $ do listItem <- get404 listItemId if isNothing (listItemCompletedAt listItem) then do update listItemId [ListItemCompletedBy =. (Just uId), ListItemCompletedAt =. (Just currTime), ListItemModified =. currTime] else do update listItemId [ListItemCompletedBy =. Nothing, ListItemCompletedAt =. Nothing, ListItemModified =. currTime] redirect $ ListR listId
754
postListItemCompleteR listId listItemId = do Entity uId _ <- requireAuth currTime <- lift getCurrentTime runDB $ do listItem <- get404 listItemId if isNothing (listItemCompletedAt listItem) then do update listItemId [ListItemCompletedBy =. (Just uId), ListItemCompletedAt =. (Just currTime), ListItemModified =. currTime] else do update listItemId [ListItemCompletedBy =. Nothing, ListItemCompletedAt =. Nothing, ListItemModified =. currTime] redirect $ ListR listId
692
false
true
0
17
290
166
79
87
null
null
fpco/streaming-commons
Data/Streaming/Network.hs
mit
-- | Attempt to bind a listening @Socket@ on the given host/port using given -- socket options and @SocketType@. If no host is given, will use the first address available. -- -- Since 0.1.17 bindPortGenEx :: [(NS.SocketOption, Int)] -> SocketType -> Int -> HostPreference -> IO Socket bindPortGenEx sockOpts sockettype p s = do let hints = NS.defaultHints { NS.addrFlags = [NS.AI_PASSIVE] , NS.addrSocketType = sockettype } host = case s of Host s' -> Just s' _ -> Nothing port = Just . show $ p addrs <- NS.getAddrInfo (Just hints) host port -- Choose an IPv6 socket if exists. This ensures the socket can -- handle both IPv4 and IPv6 if v6only is false. let addrs4 = filter (\x -> NS.addrFamily x /= NS.AF_INET6) addrs addrs6 = filter (\x -> NS.addrFamily x == NS.AF_INET6) addrs addrs' = case s of HostIPv4 -> addrs4 ++ addrs6 HostIPv4Only -> addrs4 HostIPv6 -> addrs6 ++ addrs4 HostIPv6Only -> addrs6 _ -> addrs tryAddrs (addr1:rest@(_:_)) = E.catch (theBody addr1) (\(_ :: IOException) -> tryAddrs rest) tryAddrs (addr1:[]) = theBody addr1 tryAddrs _ = error "bindPort: addrs is empty" theBody addr = bracketOnError (NS.socket (NS.addrFamily addr) (NS.addrSocketType addr) (NS.addrProtocol addr)) NS.close (\sock -> do mapM_ (\(opt,v) -> NS.setSocketOption sock opt v) sockOpts NS.bind sock (NS.addrAddress addr) return sock ) tryAddrs addrs' -- | Bind to a random port number. Especially useful for writing network tests. -- -- Since 0.1.1
1,948
bindPortGenEx :: [(NS.SocketOption, Int)] -> SocketType -> Int -> HostPreference -> IO Socket bindPortGenEx sockOpts sockettype p s = do let hints = NS.defaultHints { NS.addrFlags = [NS.AI_PASSIVE] , NS.addrSocketType = sockettype } host = case s of Host s' -> Just s' _ -> Nothing port = Just . show $ p addrs <- NS.getAddrInfo (Just hints) host port -- Choose an IPv6 socket if exists. This ensures the socket can -- handle both IPv4 and IPv6 if v6only is false. let addrs4 = filter (\x -> NS.addrFamily x /= NS.AF_INET6) addrs addrs6 = filter (\x -> NS.addrFamily x == NS.AF_INET6) addrs addrs' = case s of HostIPv4 -> addrs4 ++ addrs6 HostIPv4Only -> addrs4 HostIPv6 -> addrs6 ++ addrs4 HostIPv6Only -> addrs6 _ -> addrs tryAddrs (addr1:rest@(_:_)) = E.catch (theBody addr1) (\(_ :: IOException) -> tryAddrs rest) tryAddrs (addr1:[]) = theBody addr1 tryAddrs _ = error "bindPort: addrs is empty" theBody addr = bracketOnError (NS.socket (NS.addrFamily addr) (NS.addrSocketType addr) (NS.addrProtocol addr)) NS.close (\sock -> do mapM_ (\(opt,v) -> NS.setSocketOption sock opt v) sockOpts NS.bind sock (NS.addrAddress addr) return sock ) tryAddrs addrs' -- | Bind to a random port number. Especially useful for writing network tests. -- -- Since 0.1.1
1,757
bindPortGenEx sockOpts sockettype p s = do let hints = NS.defaultHints { NS.addrFlags = [NS.AI_PASSIVE] , NS.addrSocketType = sockettype } host = case s of Host s' -> Just s' _ -> Nothing port = Just . show $ p addrs <- NS.getAddrInfo (Just hints) host port -- Choose an IPv6 socket if exists. This ensures the socket can -- handle both IPv4 and IPv6 if v6only is false. let addrs4 = filter (\x -> NS.addrFamily x /= NS.AF_INET6) addrs addrs6 = filter (\x -> NS.addrFamily x == NS.AF_INET6) addrs addrs' = case s of HostIPv4 -> addrs4 ++ addrs6 HostIPv4Only -> addrs4 HostIPv6 -> addrs6 ++ addrs4 HostIPv6Only -> addrs6 _ -> addrs tryAddrs (addr1:rest@(_:_)) = E.catch (theBody addr1) (\(_ :: IOException) -> tryAddrs rest) tryAddrs (addr1:[]) = theBody addr1 tryAddrs _ = error "bindPort: addrs is empty" theBody addr = bracketOnError (NS.socket (NS.addrFamily addr) (NS.addrSocketType addr) (NS.addrProtocol addr)) NS.close (\sock -> do mapM_ (\(opt,v) -> NS.setSocketOption sock opt v) sockOpts NS.bind sock (NS.addrAddress addr) return sock ) tryAddrs addrs' -- | Bind to a random port number. Especially useful for writing network tests. -- -- Since 0.1.1
1,663
true
true
0
19
738
473
243
230
null
null
simonmichael/hledger
hledger-lib/Hledger/Data/Period.hs
gpl-3.0
periodPrevious p = p
20
periodPrevious p = p
20
periodPrevious p = p
20
false
false
0
5
3
9
4
5
null
null
luinix/haskell_snail
.cabal-sandbox/share/x86_64-osx-ghc-7.6.3/hlint-1.8.59/Default.hs
gpl-3.0
error "Evaluate" = const x y ==> x
34
error "Evaluate" = const x y ==> x
34
error "Evaluate" = const x y ==> x
34
false
false
2
5
7
26
9
17
null
null
anttisalonen/freekick2
src/Listings.hs
gpl-3.0
showTeamNation 27 = "Norway"
28
showTeamNation 27 = "Norway"
28
showTeamNation 27 = "Norway"
28
false
false
1
5
3
13
4
9
null
null
jameshsmith/HRL
Server/Component/Modifier.hs
mit
removeModifier :: MRef -> Game k Level () removeModifier (MRef ref n) = do actor ref %= (\(Mods ms) -> Mods $ IMap.delete n ms)
131
removeModifier :: MRef -> Game k Level () removeModifier (MRef ref n) = do actor ref %= (\(Mods ms) -> Mods $ IMap.delete n ms)
131
removeModifier (MRef ref n) = do actor ref %= (\(Mods ms) -> Mods $ IMap.delete n ms)
89
false
true
0
12
28
70
34
36
null
null
fehu/h-agents
test/Agent/PingPong/Role/Ask.hs
mit
pongRoleDescriptor = genericRoleDescriptor PongRole (const . const $ return Ask.pongDescriptor)
115
pongRoleDescriptor = genericRoleDescriptor PongRole (const . const $ return Ask.pongDescriptor)
115
pongRoleDescriptor = genericRoleDescriptor PongRole (const . const $ return Ask.pongDescriptor)
115
false
false
0
9
29
27
13
14
null
null
GaloisInc/mistral
src/Mistral/Driver/Monad.hs
bsd-3-clause
-- | Add a list of warnings, all with no associated location information. addWarns :: (BaseM drv Driver, PP w) => [w] -> drv () addWarns msgs = addWarnsAt msgs Unknown
167
addWarns :: (BaseM drv Driver, PP w) => [w] -> drv () addWarns msgs = addWarnsAt msgs Unknown
93
addWarns msgs = addWarnsAt msgs Unknown
39
true
true
0
9
30
55
26
29
null
null
sopvop/snap
test/suite/Snap/Snaplet/Test/Common/App.hs
bsd-3-clause
------------------------------------------------------------------------------ compiledSplices :: Splices (Splice (Handler App App)) compiledSplices = do "userSplice" #! withSplices runChildren userCSplices $ lift $ maybe pass return =<< with auth currentUser ------------------------------------------------------------------------------
345
compiledSplices :: Splices (Splice (Handler App App)) compiledSplices = do "userSplice" #! withSplices runChildren userCSplices $ lift $ maybe pass return =<< with auth currentUser ------------------------------------------------------------------------------
266
compiledSplices = do "userSplice" #! withSplices runChildren userCSplices $ lift $ maybe pass return =<< with auth currentUser ------------------------------------------------------------------------------
212
true
true
0
11
33
64
31
33
null
null
reinh/Hask8080
src/Hask8080/Instructions.hs
mit
mvi r = tick 7 >> reg r <~ nextByte
46
mvi r = tick 7 >> reg r <~ nextByte
46
mvi r = tick 7 >> reg r <~ nextByte
46
false
false
0
7
20
23
10
13
null
null
ku-fpg/kansas-amber
System/Hardware/Haskino/Protocol.hs
bsd-3-clause
packageExpr (ConsList8 e1 e2) = packageTwoSubExpr (exprLCmdVal EXPRL_CONS) e1 e2
80
packageExpr (ConsList8 e1 e2) = packageTwoSubExpr (exprLCmdVal EXPRL_CONS) e1 e2
80
packageExpr (ConsList8 e1 e2) = packageTwoSubExpr (exprLCmdVal EXPRL_CONS) e1 e2
80
false
false
0
7
9
30
14
16
null
null
jsavatgy/xroads-game
code/io-vecs.hs
gpl-2.0
setColor (RGB r g b) = setColor (RGBA r g b 0.8)
48
setColor (RGB r g b) = setColor (RGBA r g b 0.8)
48
setColor (RGB r g b) = setColor (RGBA r g b 0.8)
48
false
false
0
7
11
34
16
18
null
null
ankhers/haskell-ide-engine
src/Haskell/Ide/Engine/BasePlugin.hs
bsd-3-clause
pluginsCmd :: CommandFunc IdePlugins pluginsCmd = CmdSync $ \_ _ -> IdeResponseOk . IdePlugins . Map.map (map cmdDesc . pdCommands) <$> getPlugins
148
pluginsCmd :: CommandFunc IdePlugins pluginsCmd = CmdSync $ \_ _ -> IdeResponseOk . IdePlugins . Map.map (map cmdDesc . pdCommands) <$> getPlugins
148
pluginsCmd = CmdSync $ \_ _ -> IdeResponseOk . IdePlugins . Map.map (map cmdDesc . pdCommands) <$> getPlugins
111
false
true
1
12
23
56
26
30
null
null
da-x/ghc
libraries/template-haskell/Language/Haskell/TH/Ppr.hs
bsd-3-clause
------------------------------ pprint :: Ppr a => a -> String pprint x = render $ to_HPJ_Doc $ ppr x
101
pprint :: Ppr a => a -> String pprint x = render $ to_HPJ_Doc $ ppr x
69
pprint x = render $ to_HPJ_Doc $ ppr x
38
true
true
0
6
18
37
18
19
null
null
facebookincubator/duckling
Duckling/Time/ES/Rules.hs
bsd-3-clause
ruleNPasadosCycle :: Rule ruleNPasadosCycle = Rule { name = "n pasados <cycle>" , pattern = [ Predicate $ isIntegerBetween 2 9999 , regex "pasad(a|o)s?" , dimension TimeGrain ] , prod = \tokens -> case tokens of (token:_:Token TimeGrain grain:_) -> do v <- getIntValue token tt $ cycleN True grain (- v) _ -> Nothing }
370
ruleNPasadosCycle :: Rule ruleNPasadosCycle = Rule { name = "n pasados <cycle>" , pattern = [ Predicate $ isIntegerBetween 2 9999 , regex "pasad(a|o)s?" , dimension TimeGrain ] , prod = \tokens -> case tokens of (token:_:Token TimeGrain grain:_) -> do v <- getIntValue token tt $ cycleN True grain (- v) _ -> Nothing }
370
ruleNPasadosCycle = Rule { name = "n pasados <cycle>" , pattern = [ Predicate $ isIntegerBetween 2 9999 , regex "pasad(a|o)s?" , dimension TimeGrain ] , prod = \tokens -> case tokens of (token:_:Token TimeGrain grain:_) -> do v <- getIntValue token tt $ cycleN True grain (- v) _ -> Nothing }
344
false
true
0
17
107
129
66
63
null
null
brendanhay/gogol
gogol-run/gen/Network/Google/Run/Types/Product.hs
mpl-2.0
-- | Creates a value of 'TrafficTarget' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'ttRevisionName' -- -- * 'ttConfigurationName' -- -- * 'ttTag' -- -- * 'ttLatestRevision' -- -- * 'ttURL' -- -- * 'ttPercent' trafficTarget :: TrafficTarget trafficTarget = TrafficTarget' { _ttRevisionName = Nothing , _ttConfigurationName = Nothing , _ttTag = Nothing , _ttLatestRevision = Nothing , _ttURL = Nothing , _ttPercent = Nothing }
548
trafficTarget :: TrafficTarget trafficTarget = TrafficTarget' { _ttRevisionName = Nothing , _ttConfigurationName = Nothing , _ttTag = Nothing , _ttLatestRevision = Nothing , _ttURL = Nothing , _ttPercent = Nothing }
249
trafficTarget = TrafficTarget' { _ttRevisionName = Nothing , _ttConfigurationName = Nothing , _ttTag = Nothing , _ttLatestRevision = Nothing , _ttURL = Nothing , _ttPercent = Nothing }
214
true
true
0
6
118
64
46
18
null
null
hanepjiv/make10_hs
src/Game/Make10/Cell.hs
mit
expand (Triple op lhs rhs) = expandFunc op (expand lhs) (expand rhs) where expandFunc :: forall a0. (Ord a0, Num a0) => Op.Operator -> Exp.Expand a0 -> Exp.Expand a0 -> Exp.Expand a0 expandFunc Op.ADD = Exp.add expandFunc Op.SUB = Exp.sub expandFunc Op.RSUB = flip Exp.sub expandFunc Op.MUL = Exp.mul expandFunc Op.DIV = Exp.truediv expandFunc Op.RDIV = flip Exp.truediv
548
expand (Triple op lhs rhs) = expandFunc op (expand lhs) (expand rhs) where expandFunc :: forall a0. (Ord a0, Num a0) => Op.Operator -> Exp.Expand a0 -> Exp.Expand a0 -> Exp.Expand a0 expandFunc Op.ADD = Exp.add expandFunc Op.SUB = Exp.sub expandFunc Op.RSUB = flip Exp.sub expandFunc Op.MUL = Exp.mul expandFunc Op.DIV = Exp.truediv expandFunc Op.RDIV = flip Exp.truediv
548
expand (Triple op lhs rhs) = expandFunc op (expand lhs) (expand rhs) where expandFunc :: forall a0. (Ord a0, Num a0) => Op.Operator -> Exp.Expand a0 -> Exp.Expand a0 -> Exp.Expand a0 expandFunc Op.ADD = Exp.add expandFunc Op.SUB = Exp.sub expandFunc Op.RSUB = flip Exp.sub expandFunc Op.MUL = Exp.mul expandFunc Op.DIV = Exp.truediv expandFunc Op.RDIV = flip Exp.truediv
548
false
false
0
11
235
173
84
89
null
null
forste/haReFork
tools/base/AST/HsExpUtil.hs
bsd-3-clause
atoms2Stmt (HsGeneratorAtom s p e : ss) = HsGenerator s p e # atoms2Stmt ss
75
atoms2Stmt (HsGeneratorAtom s p e : ss) = HsGenerator s p e # atoms2Stmt ss
75
atoms2Stmt (HsGeneratorAtom s p e : ss) = HsGenerator s p e # atoms2Stmt ss
75
false
false
0
8
14
37
17
20
null
null
brendanhay/gogol
gogol-healthcare/gen/Network/Google/Resource/Healthcare/Projects/Locations/DataSets/FhirStores/Fhir/ConditionalPatch.hs
mpl-2.0
-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\"). pldsfsfcpUploadType :: Lens' ProjectsLocationsDataSetsFhirStoresFhirConditionalPatch (Maybe Text) pldsfsfcpUploadType = lens _pldsfsfcpUploadType (\ s a -> s{_pldsfsfcpUploadType = a})
263
pldsfsfcpUploadType :: Lens' ProjectsLocationsDataSetsFhirStoresFhirConditionalPatch (Maybe Text) pldsfsfcpUploadType = lens _pldsfsfcpUploadType (\ s a -> s{_pldsfsfcpUploadType = a})
192
pldsfsfcpUploadType = lens _pldsfsfcpUploadType (\ s a -> s{_pldsfsfcpUploadType = a})
94
true
true
0
9
34
48
25
23
null
null
AndrewRademacher/wai
warp/Network/Wai/Handler/Warp/MultiMap.hs
mit
turnB :: MMap k v -> MMap k v turnB Leaf = error "turnB"
68
turnB :: MMap k v -> MMap k v turnB Leaf = error "turnB"
68
turnB Leaf = error "turnB"
38
false
true
0
6
25
31
14
17
null
null
adinapoli/Shelly.hs
src/Shelly.hs
bsd-3-clause
isExecutable :: FilePath -> IO Bool isExecutable f = (executable `fmap` getPermissions (encodeString f)) `catch` (\(_ :: IOError) -> return False)
146
isExecutable :: FilePath -> IO Bool isExecutable f = (executable `fmap` getPermissions (encodeString f)) `catch` (\(_ :: IOError) -> return False)
146
isExecutable f = (executable `fmap` getPermissions (encodeString f)) `catch` (\(_ :: IOError) -> return False)
110
false
true
0
10
20
63
34
29
null
null
soenkehahn/wai
warp/Network/Wai/Handler/Warp/HTTP2/Types.hs
mit
---------------------------------------------------------------- http2ver :: H.HttpVersion http2ver = H.HttpVersion 2 0
120
http2ver :: H.HttpVersion http2ver = H.HttpVersion 2 0
54
http2ver = H.HttpVersion 2 0
28
true
true
0
7
9
27
12
15
null
null
netrium/Netrium
share/Calendar.hs
mit
isBusinessDay _ = False
33
isBusinessDay _ = False
33
isBusinessDay _ = False
33
false
false
0
4
13
10
4
6
null
null
pparkkin/eta
compiler/ETA/DeSugar/DsUtils.hs
bsd-3-clause
mkLHsVarPatTup :: [Id] -> LPat Id mkLHsVarPatTup bs = mkLHsPatTup (map nlVarPat bs)
84
mkLHsVarPatTup :: [Id] -> LPat Id mkLHsVarPatTup bs = mkLHsPatTup (map nlVarPat bs)
84
mkLHsVarPatTup bs = mkLHsPatTup (map nlVarPat bs)
50
false
true
0
7
13
40
18
22
null
null