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
DavidAlphaFox/ghc
libraries/containers/Data/IntSet/Base.hs
bsd-3-clause
nequal _ _ = True
21
nequal _ _ = True
21
nequal _ _ = True
21
false
false
1
5
8
12
5
7
null
null
romanb/amazonka
amazonka-opsworks/gen/Network/AWS/OpsWorks/DescribeStacks.hs
mpl-2.0
describeStacksResponse :: DescribeStacksResponse describeStacksResponse = DescribeStacksResponse { _dsrStacks = mempty }
128
describeStacksResponse :: DescribeStacksResponse describeStacksResponse = DescribeStacksResponse { _dsrStacks = mempty }
128
describeStacksResponse = DescribeStacksResponse { _dsrStacks = mempty }
79
false
true
0
6
18
19
11
8
null
null
nakamuray/htig
HTIG/IRCServer/Constants.hs
bsd-3-clause
rPL_LUSEROP = 252
17
rPL_LUSEROP = 252
17
rPL_LUSEROP = 252
17
false
false
1
5
2
10
3
7
null
null
ihc/futhark
src/futhark-doc.hs
isc
commandLineOptions :: [DocOption] commandLineOptions = [ Option "o" ["output-directory"] (ReqArg (\dirname -> Right $ \config -> config { docOutput = Just dirname }) "DIR") "Directory in which to put generated documentation." , Option "v" ["verbose"] (NoArg $ Right $ \config -> config { docVerbose = True }) "Print status messages on stderr." ]
502
commandLineOptions :: [DocOption] commandLineOptions = [ Option "o" ["output-directory"] (ReqArg (\dirname -> Right $ \config -> config { docOutput = Just dirname }) "DIR") "Directory in which to put generated documentation." , Option "v" ["verbose"] (NoArg $ Right $ \config -> config { docVerbose = True }) "Print status messages on stderr." ]
502
commandLineOptions = [ Option "o" ["output-directory"] (ReqArg (\dirname -> Right $ \config -> config { docOutput = Just dirname }) "DIR") "Directory in which to put generated documentation." , Option "v" ["verbose"] (NoArg $ Right $ \config -> config { docVerbose = True }) "Print status messages on stderr." ]
468
false
true
0
15
209
104
58
46
null
null
bhamrick/HSS
HSS/Color.hs
mit
darkOliveGreen = RGB 0x55 0x6B 0x2F
44
darkOliveGreen = RGB 0x55 0x6B 0x2F
44
darkOliveGreen = RGB 0x55 0x6B 0x2F
44
false
false
0
5
14
13
6
7
null
null
edahlgren/protocol-buffers
hprotoc/Text/ProtocolBuffers/ProtoCompile/Parser.hs
apache-2.0
undoLexer (L _ ';') = ";\n"
27
undoLexer (L _ ';') = ";\n"
27
undoLexer (L _ ';') = ";\n"
27
false
false
0
7
5
17
8
9
null
null
mbelicki/valdemar
src/Syntax.hs
gpl-3.0
tagOfExpr (BinOpExpr _ _ _ tag) = tag
37
tagOfExpr (BinOpExpr _ _ _ tag) = tag
37
tagOfExpr (BinOpExpr _ _ _ tag) = tag
37
false
false
0
7
7
21
10
11
null
null
lpeterse/koka
src/Type/InferMonad.hs
apache-2.0
improveEffects :: Range -> Tvs -> [Evidence] -> (Effect,Type) -> Inf ([Evidence],Core.Expr -> Core.Expr) improveEffects contextRange free evs etp = return (evs,id)
165
improveEffects :: Range -> Tvs -> [Evidence] -> (Effect,Type) -> Inf ([Evidence],Core.Expr -> Core.Expr) improveEffects contextRange free evs etp = return (evs,id)
165
improveEffects contextRange free evs etp = return (evs,id)
60
false
true
0
12
23
74
40
34
null
null
phischu/fragnix
tests/packages/scotty/Data.Primitive.UnliftedArray.hs
bsd-3-clause
-- | Gets the value at the specified position of a 'MutableUnliftedArray'. readUnliftedArray :: (PrimMonad m, PrimUnlifted a) => MutableUnliftedArray (PrimState m) a -- ^ source -> Int -- ^ index -> m a readUnliftedArray (MutableUnliftedArray maa#) (I# i#) = primitive $ \s -> case readArrayArrayArray# maa# i# s of (# s', aa# #) -> (# s', fromArrayArray# aa# #)
380
readUnliftedArray :: (PrimMonad m, PrimUnlifted a) => MutableUnliftedArray (PrimState m) a -- ^ source -> Int -- ^ index -> m a readUnliftedArray (MutableUnliftedArray maa#) (I# i#) = primitive $ \s -> case readArrayArrayArray# maa# i# s of (# s', aa# #) -> (# s', fromArrayArray# aa# #)
305
readUnliftedArray (MutableUnliftedArray maa#) (I# i#) = primitive $ \s -> case readArrayArrayArray# maa# i# s of (# s', aa# #) -> (# s', fromArrayArray# aa# #)
169
true
true
2
11
77
112
56
56
null
null
google/cabal2bazel
src/Google/Google3/Buildifier.hs
apache-2.0
-- | Runs buildifier on files with the specified paths. call :: [FilePath] -> IO () call args = do bin <- findHostDependencyOrDie "devtools/buildifier/buildifier" callProcess bin ("--lint=fix" : args)
208
call :: [FilePath] -> IO () call args = do bin <- findHostDependencyOrDie "devtools/buildifier/buildifier" callProcess bin ("--lint=fix" : args)
152
call args = do bin <- findHostDependencyOrDie "devtools/buildifier/buildifier" callProcess bin ("--lint=fix" : args)
124
true
true
0
9
36
52
25
27
null
null
conal/hermit
src/HERMIT/Name.hs
bsd-2-clause
parseQualified s = mkQualified mnm nm where (c:cs) = reverse s -- we are careful to parse 'Prelude..' correctly (rNm, _dot:rMod) = break (=='.') cs (nm, mnm) = (reverse (c:rNm), reverse rMod) -- | Turn a HermitName into a (possibly fully-qualified) String.
281
parseQualified s = mkQualified mnm nm where (c:cs) = reverse s -- we are careful to parse 'Prelude..' correctly (rNm, _dot:rMod) = break (=='.') cs (nm, mnm) = (reverse (c:rNm), reverse rMod) -- | Turn a HermitName into a (possibly fully-qualified) String.
281
parseQualified s = mkQualified mnm nm where (c:cs) = reverse s -- we are careful to parse 'Prelude..' correctly (rNm, _dot:rMod) = break (=='.') cs (nm, mnm) = (reverse (c:rNm), reverse rMod) -- | Turn a HermitName into a (possibly fully-qualified) String.
281
false
false
2
9
66
89
48
41
null
null
klarh/haste-webgl
src/Haste/Graphics/WebGL/Texture.hs
mit
createTexture::Context->IO Texture createTexture = ffi "(function(ctx) {return ctx.createTexture();})"
102
createTexture::Context->IO Texture createTexture = ffi "(function(ctx) {return ctx.createTexture();})"
102
createTexture = ffi "(function(ctx) {return ctx.createTexture();})"
67
false
true
0
6
7
21
10
11
null
null
CulpaBS/wbBach
src/Futhark/Analysis/Range.hs
bsd-3-clause
simplifyKnownBound ranges (Out.MinimumBound b1 b2) = Out.MinimumBound (simplifyKnownBound ranges b1) (simplifyKnownBound ranges b2)
133
simplifyKnownBound ranges (Out.MinimumBound b1 b2) = Out.MinimumBound (simplifyKnownBound ranges b1) (simplifyKnownBound ranges b2)
133
simplifyKnownBound ranges (Out.MinimumBound b1 b2) = Out.MinimumBound (simplifyKnownBound ranges b1) (simplifyKnownBound ranges b2)
133
false
false
0
8
14
46
21
25
null
null
bvdelft/parac2
src/Language/Java/Paragon/TypeCheck/Types.hs
bsd-3-clause
-- | Converts a statetype to an annotated AST type as being a non-native type, -- having removed the state information. toT :: TcStateType -> T toT sty = Just (unStateType sty, False)
183
toT :: TcStateType -> T toT sty = Just (unStateType sty, False)
63
toT sty = Just (unStateType sty, False)
39
true
true
0
7
32
37
18
19
null
null
abstools/abs-haskell-formal
benchmarks/4_logarithms_range/progs/4500.hs
bsd-3-clause
compute_logarithms :: Method compute_logarithms [pn, pmax] this wb k = Assign nn (Val (I pn)) $ Assign base (Val (I 2)) $ Assign max_val (Val (I pmax)) $ While (IGT (Attr nn) (I 0)) (\k' -> Assign obj New $ Assign f (Async obj logarithm [nn,base,max_val]) $ Assign nn (Val (Sub (Attr nn) (I 1))) $ k' ) $ Return i wb k
347
compute_logarithms :: Method compute_logarithms [pn, pmax] this wb k = Assign nn (Val (I pn)) $ Assign base (Val (I 2)) $ Assign max_val (Val (I pmax)) $ While (IGT (Attr nn) (I 0)) (\k' -> Assign obj New $ Assign f (Async obj logarithm [nn,base,max_val]) $ Assign nn (Val (Sub (Attr nn) (I 1))) $ k' ) $ Return i wb k
347
compute_logarithms [pn, pmax] this wb k = Assign nn (Val (I pn)) $ Assign base (Val (I 2)) $ Assign max_val (Val (I pmax)) $ While (IGT (Attr nn) (I 0)) (\k' -> Assign obj New $ Assign f (Async obj logarithm [nn,base,max_val]) $ Assign nn (Val (Sub (Attr nn) (I 1))) $ k' ) $ Return i wb k
318
false
true
0
18
91
205
102
103
null
null
bgold-cosmos/Tidal
src/Sound/Tidal/UI.hs
gpl-3.0
substruct' :: Pattern Int -> Pattern a -> Pattern a substruct' s p = p {query = \st -> concatMap (f st) (query s st)} where f st (Event c (Just a') _ i) = map (\e -> e {context = combineContexts [c, context e]}) $ queryArc (compressArcTo a' (inside (pure $ 1/toRational(length (queryArc s (Arc (sam (start $ arc st)) (nextSam (start $ arc st)))))) (rotR (toRational i)) p)) a' -- Ignore analog events (ones without wholes) f _ _ = [] -- | @stripe n p@: repeats pattern @p@, @n@ times per cycle. So -- similar to @fast@, but with random durations. The repetitions will -- be continguous (touching, but not overlapping) and the durations -- will add up to a single cycle. @n@ can be supplied as a pattern of -- integers.
737
substruct' :: Pattern Int -> Pattern a -> Pattern a substruct' s p = p {query = \st -> concatMap (f st) (query s st)} where f st (Event c (Just a') _ i) = map (\e -> e {context = combineContexts [c, context e]}) $ queryArc (compressArcTo a' (inside (pure $ 1/toRational(length (queryArc s (Arc (sam (start $ arc st)) (nextSam (start $ arc st)))))) (rotR (toRational i)) p)) a' -- Ignore analog events (ones without wholes) f _ _ = [] -- | @stripe n p@: repeats pattern @p@, @n@ times per cycle. So -- similar to @fast@, but with random durations. The repetitions will -- be continguous (touching, but not overlapping) and the durations -- will add up to a single cycle. @n@ can be supplied as a pattern of -- integers.
737
substruct' s p = p {query = \st -> concatMap (f st) (query s st)} where f st (Event c (Just a') _ i) = map (\e -> e {context = combineContexts [c, context e]}) $ queryArc (compressArcTo a' (inside (pure $ 1/toRational(length (queryArc s (Arc (sam (start $ arc st)) (nextSam (start $ arc st)))))) (rotR (toRational i)) p)) a' -- Ignore analog events (ones without wholes) f _ _ = [] -- | @stripe n p@: repeats pattern @p@, @n@ times per cycle. So -- similar to @fast@, but with random durations. The repetitions will -- be continguous (touching, but not overlapping) and the durations -- will add up to a single cycle. @n@ can be supplied as a pattern of -- integers.
685
false
true
1
24
153
258
130
128
null
null
eunmin/fpis-hs
src/Ch3.hs
bsd-3-clause
foldLeft (x:xs) b f = foldLeft xs (f x b) f
43
foldLeft (x:xs) b f = foldLeft xs (f x b) f
43
foldLeft (x:xs) b f = foldLeft xs (f x b) f
43
false
false
0
7
10
35
17
18
null
null
pparkkin/eta
compiler/ETA/Prelude/PrimOp.hs
bsd-3-clause
tagOf_PrimOp DoubleMulOp = _ILIT(92)
36
tagOf_PrimOp DoubleMulOp = _ILIT(92)
36
tagOf_PrimOp DoubleMulOp = _ILIT(92)
36
false
false
0
6
3
15
7
8
null
null
mietek/idris-js
src/IRTS/CodegenJS.hs
bsd-3-clause
cgVar :: LVar -> String cgVar (Loc i) = loc i
45
cgVar :: LVar -> String cgVar (Loc i) = loc i
45
cgVar (Loc i) = loc i
21
false
true
0
6
10
31
14
17
null
null
fmapfmapfmap/amazonka
amazonka-swf/gen/Network/AWS/SWF/PollForDecisionTask.hs
mpl-2.0
-- | The type of the workflow execution for which this decision task was -- created. pfdtrsWorkflowType :: Lens' PollForDecisionTaskResponse WorkflowType pfdtrsWorkflowType = lens _pfdtrsWorkflowType (\ s a -> s{_pfdtrsWorkflowType = a})
237
pfdtrsWorkflowType :: Lens' PollForDecisionTaskResponse WorkflowType pfdtrsWorkflowType = lens _pfdtrsWorkflowType (\ s a -> s{_pfdtrsWorkflowType = a})
152
pfdtrsWorkflowType = lens _pfdtrsWorkflowType (\ s a -> s{_pfdtrsWorkflowType = a})
83
true
true
0
9
31
41
23
18
null
null
noughtmare/yi
yi-keymap-vim/src/Yi/Keymap/Vim/Digraph.hs
gpl-2.0
-- LATIN SMALL LETTER V WITH TILDE switch 'W' '!' = '\x1E80'
60
switch 'W' '!' = '\x1E80'
25
switch 'W' '!' = '\x1E80'
25
true
false
0
5
11
12
6
6
null
null
Rotsor/factorio-module-selector
Matrix.hs
unlicense
vector_of_function f = Matrix (f_array (\(x, ()) -> f x))
57
vector_of_function f = Matrix (f_array (\(x, ()) -> f x))
57
vector_of_function f = Matrix (f_array (\(x, ()) -> f x))
57
false
false
0
11
9
37
19
18
null
null
urbanslug/ghc
compiler/typecheck/TcType.hs
bsd-3-clause
getDFunTyLitKey :: TyLit -> OccName getDFunTyLitKey (NumTyLit n) = mkOccName Name.varName (show n)
98
getDFunTyLitKey :: TyLit -> OccName getDFunTyLitKey (NumTyLit n) = mkOccName Name.varName (show n)
98
getDFunTyLitKey (NumTyLit n) = mkOccName Name.varName (show n)
62
false
true
0
7
12
37
18
19
null
null
Catchouli/tyke
src/Game/Terrain/Rendering.hs
bsd-3-clause
-- | The 6 cardinal directions cardinalDirections = [ (1, 0, 0), (-1, 0, 0) , (0, 1, 0), (0, -1, 0) , (0, 0, 1), (0, 0, -1) ]
188
cardinalDirections = [ (1, 0, 0), (-1, 0, 0) , (0, 1, 0), (0, -1, 0) , (0, 0, 1), (0, 0, -1) ]
157
cardinalDirections = [ (1, 0, 0), (-1, 0, 0) , (0, 1, 0), (0, -1, 0) , (0, 0, 1), (0, 0, -1) ]
157
true
false
0
7
92
85
55
30
null
null
forked-upstream-packages-for-ghcjs/ghc
compiler/deSugar/DsArrows.hs
bsd-3-clause
collectEvBinders (TcEvBinds {}) = panic "ToDo: collectEvBinders"
64
collectEvBinders (TcEvBinds {}) = panic "ToDo: collectEvBinders"
64
collectEvBinders (TcEvBinds {}) = panic "ToDo: collectEvBinders"
64
false
false
0
7
6
19
9
10
null
null
lally/orgmode
src/Data/OrgMode.hs
bsd-3-clause
updateLastChildOfLastNode c doczip path@(pn:pns) = let updatedPn = pn { nChildren = c:(tail $ nChildren pn) } in doczip { ozNodePath = updatedPn:pns }
154
updateLastChildOfLastNode c doczip path@(pn:pns) = let updatedPn = pn { nChildren = c:(tail $ nChildren pn) } in doczip { ozNodePath = updatedPn:pns }
154
updateLastChildOfLastNode c doczip path@(pn:pns) = let updatedPn = pn { nChildren = c:(tail $ nChildren pn) } in doczip { ozNodePath = updatedPn:pns }
154
false
false
0
14
27
73
37
36
null
null
dmbarbour/Sirea
src/Sirea/Activate.hs
bsd-3-clause
-- termination signal requested since last heartbeat haltApp :: AppPeriodic -> T -> IO () haltApp ap tHalt = apTime ap >>= \ tNow -> apSched ap (stoppingApp ap (tNow `addTime` dtGrace)) >> let tS = StableT (tNow `addTime` dtFinalize) in ln_update (ap_link ap) tS tHalt s_never
292
haltApp :: AppPeriodic -> T -> IO () haltApp ap tHalt = apTime ap >>= \ tNow -> apSched ap (stoppingApp ap (tNow `addTime` dtGrace)) >> let tS = StableT (tNow `addTime` dtFinalize) in ln_update (ap_link ap) tS tHalt s_never
239
haltApp ap tHalt = apTime ap >>= \ tNow -> apSched ap (stoppingApp ap (tNow `addTime` dtGrace)) >> let tS = StableT (tNow `addTime` dtFinalize) in ln_update (ap_link ap) tS tHalt s_never
202
true
true
0
14
62
106
54
52
null
null
urbanslug/ghc
compiler/basicTypes/DataCon.hs
bsd-3-clause
promoteDataCon_maybe :: DataCon -> Maybe TyCon promoteDataCon_maybe (MkData { dcPromoted = mb_tc }) = mb_tc
107
promoteDataCon_maybe :: DataCon -> Maybe TyCon promoteDataCon_maybe (MkData { dcPromoted = mb_tc }) = mb_tc
107
promoteDataCon_maybe (MkData { dcPromoted = mb_tc }) = mb_tc
60
false
true
0
8
14
38
18
20
null
null
cwlmyjm/haskell
AFP/L0307.hs
mpl-2.0
a = ST (\x -> (even x,x))
25
a = ST (\x -> (even x,x))
25
a = ST (\x -> (even x,x))
25
false
false
1
9
6
29
14
15
null
null
christiaanb/ghc
libraries/base/System/Posix/Internals.hs
bsd-3-clause
fdGetMode _ = do -- We don't have a way of finding out which flags are set on FDs -- on Windows, so make a handle that thinks that anything goes. let flags = o_RDWR #else fdGetMode fd = do flags <- throwErrnoIfMinus1Retry "fdGetMode" (c_fcntl_read fd const_f_getfl) #endif let wH = (flags .&. o_WRONLY) /= 0 aH = (flags .&. o_APPEND) /= 0 rwH = (flags .&. o_RDWR) /= 0 mode | wH && aH = AppendMode | wH = WriteMode | rwH = ReadWriteMode | otherwise = ReadMode return mode #ifdef mingw32_HOST_OS
617
fdGetMode _ = do -- We don't have a way of finding out which flags are set on FDs -- on Windows, so make a handle that thinks that anything goes. let flags = o_RDWR #else fdGetMode fd = do flags <- throwErrnoIfMinus1Retry "fdGetMode" (c_fcntl_read fd const_f_getfl) #endif let wH = (flags .&. o_WRONLY) /= 0 aH = (flags .&. o_APPEND) /= 0 rwH = (flags .&. o_RDWR) /= 0 mode | wH && aH = AppendMode | wH = WriteMode | rwH = ReadWriteMode | otherwise = ReadMode return mode #ifdef mingw32_HOST_OS
617
fdGetMode _ = do -- We don't have a way of finding out which flags are set on FDs -- on Windows, so make a handle that thinks that anything goes. let flags = o_RDWR #else fdGetMode fd = do flags <- throwErrnoIfMinus1Retry "fdGetMode" (c_fcntl_read fd const_f_getfl) #endif let wH = (flags .&. o_WRONLY) /= 0 aH = (flags .&. o_APPEND) /= 0 rwH = (flags .&. o_RDWR) /= 0 mode | wH && aH = AppendMode | wH = WriteMode | rwH = ReadWriteMode | otherwise = ReadMode return mode #ifdef mingw32_HOST_OS
617
false
false
0
13
215
124
62
62
null
null
HaskellCNOrg/snap-web
src/Views/Utils.hs
bsd-3-clause
---------------------------------------------------------------- -- | decode parameter which will be "" if not found. -- decodedParam :: MonadSnap m => BS.ByteString -> m BS.ByteString decodedParam p = fromMaybe "" <$> getParam p
230
decodedParam :: MonadSnap m => BS.ByteString -> m BS.ByteString decodedParam p = fromMaybe "" <$> getParam p
108
decodedParam p = fromMaybe "" <$> getParam p
44
true
true
0
8
30
45
22
23
null
null
fmthoma/ghc
compiler/types/InstEnv.hs
bsd-3-clause
-- | Checks for an exact match of ClsInst in the instance environment. -- We use this when we do signature checking in TcRnDriver memberInstEnv :: InstEnv -> ClsInst -> Bool memberInstEnv inst_env ins_item@(ClsInst { is_cls_nm = cls_nm } ) = maybe False (\(ClsIE items) -> any (identicalClsInstHead ins_item) items) (lookupUFM inst_env cls_nm)
357
memberInstEnv :: InstEnv -> ClsInst -> Bool memberInstEnv inst_env ins_item@(ClsInst { is_cls_nm = cls_nm } ) = maybe False (\(ClsIE items) -> any (identicalClsInstHead ins_item) items) (lookupUFM inst_env cls_nm)
227
memberInstEnv inst_env ins_item@(ClsInst { is_cls_nm = cls_nm } ) = maybe False (\(ClsIE items) -> any (identicalClsInstHead ins_item) items) (lookupUFM inst_env cls_nm)
183
true
true
0
10
66
81
43
38
null
null
shicks/shsh
System/Console/ShSh/Internal/IO.hs
bsd-3-clause
rIsClosedNonBlocking :: ReadHandle -> IO Bool rIsClosedNonBlocking (RChan c) = isEOFChanNonBlocking c
101
rIsClosedNonBlocking :: ReadHandle -> IO Bool rIsClosedNonBlocking (RChan c) = isEOFChanNonBlocking c
101
rIsClosedNonBlocking (RChan c) = isEOFChanNonBlocking c
55
false
true
0
7
11
30
14
16
null
null
CRogers/stack
src/main/Main.hs
bsd-3-clause
-- | Install installCmd :: BuildOpts -> GlobalOpts -> IO () installCmd opts = buildCmdHelper ExecStrategy DoNothing opts { boptsInstallExes = True }
148
installCmd :: BuildOpts -> GlobalOpts -> IO () installCmd opts = buildCmdHelper ExecStrategy DoNothing opts { boptsInstallExes = True }
135
installCmd opts = buildCmdHelper ExecStrategy DoNothing opts { boptsInstallExes = True }
88
true
true
0
8
22
46
23
23
null
null
snoyberg/ghc
compiler/typecheck/TcType.hs
bsd-3-clause
isSigMaybe (ConArgCtxt n) = Just n
36
isSigMaybe (ConArgCtxt n) = Just n
36
isSigMaybe (ConArgCtxt n) = Just n
36
false
false
0
7
7
18
8
10
null
null
kazu-yamamoto/wai
wai-extra/Network/Wai/Middleware/RealIp.hs
mit
findRealIp :: RequestHeaders -> HeaderName -> (IP.IP -> Bool) -> Maybe IP.IP findRealIp reqHeaders header isTrusted = case (nonTrusted, ips) of ([], xs) -> listToMaybe xs (xs, _) -> listToMaybe $ reverse xs where -- account for repeated headers headerVals = [ v | (k, v) <- reqHeaders, k == header ] ips = mapMaybe (readMaybe . B8.unpack) $ concatMap (B8.split ',') headerVals nonTrusted = filter (not . isTrusted) ips
453
findRealIp :: RequestHeaders -> HeaderName -> (IP.IP -> Bool) -> Maybe IP.IP findRealIp reqHeaders header isTrusted = case (nonTrusted, ips) of ([], xs) -> listToMaybe xs (xs, _) -> listToMaybe $ reverse xs where -- account for repeated headers headerVals = [ v | (k, v) <- reqHeaders, k == header ] ips = mapMaybe (readMaybe . B8.unpack) $ concatMap (B8.split ',') headerVals nonTrusted = filter (not . isTrusted) ips
453
findRealIp reqHeaders header isTrusted = case (nonTrusted, ips) of ([], xs) -> listToMaybe xs (xs, _) -> listToMaybe $ reverse xs where -- account for repeated headers headerVals = [ v | (k, v) <- reqHeaders, k == header ] ips = mapMaybe (readMaybe . B8.unpack) $ concatMap (B8.split ',') headerVals nonTrusted = filter (not . isTrusted) ips
376
false
true
2
10
104
176
92
84
null
null
haslab/SecreC
src/Language/SecreC/Transformation/Dafny.hs
gpl-3.0
assignmentToDafny annK se@(PostIndexExpr l e (Foldable.toList -> [i])) (Left pre) = do (anni,pi) <- indexToDafny True annK Nothing 0 i (annse,_) <- expressionToDafny True Nothing annK se (ann,doc) <- assignmentToDafny annK e (Right $ dbrackets (dtext "int" <<>> dparens pi <<+>> dtext ":=" <<+>> pre)) return (anni++annse++ann,doc)
347
assignmentToDafny annK se@(PostIndexExpr l e (Foldable.toList -> [i])) (Left pre) = do (anni,pi) <- indexToDafny True annK Nothing 0 i (annse,_) <- expressionToDafny True Nothing annK se (ann,doc) <- assignmentToDafny annK e (Right $ dbrackets (dtext "int" <<>> dparens pi <<+>> dtext ":=" <<+>> pre)) return (anni++annse++ann,doc)
347
assignmentToDafny annK se@(PostIndexExpr l e (Foldable.toList -> [i])) (Left pre) = do (anni,pi) <- indexToDafny True annK Nothing 0 i (annse,_) <- expressionToDafny True Nothing annK se (ann,doc) <- assignmentToDafny annK e (Right $ dbrackets (dtext "int" <<>> dparens pi <<+>> dtext ":=" <<+>> pre)) return (anni++annse++ann,doc)
347
false
false
0
16
62
164
82
82
null
null
lynnard/cocos2d-hs
src/Graphics/UI/Cocos2d/Label.hs
bsd-3-clause
label_enableOutlineWithSize :: (LabelPtr arg'1, M2.Color4BValue arg'2) => arg'1 -> arg'2 -> HoppyP.Int -> HoppyP.IO () label_enableOutlineWithSize arg'1 arg'2 arg'3 = HoppyFHR.withCppPtr (toLabel arg'1) $ \arg'1' -> M2.withColor4BPtr arg'2 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'2' -> let arg'3' = HoppyFHR.coerceIntegral arg'3 in (label_enableOutlineWithSize' arg'1' arg'2' arg'3')
392
label_enableOutlineWithSize :: (LabelPtr arg'1, M2.Color4BValue arg'2) => arg'1 -> arg'2 -> HoppyP.Int -> HoppyP.IO () label_enableOutlineWithSize arg'1 arg'2 arg'3 = HoppyFHR.withCppPtr (toLabel arg'1) $ \arg'1' -> M2.withColor4BPtr arg'2 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'2' -> let arg'3' = HoppyFHR.coerceIntegral arg'3 in (label_enableOutlineWithSize' arg'1' arg'2' arg'3')
392
label_enableOutlineWithSize arg'1 arg'2 arg'3 = HoppyFHR.withCppPtr (toLabel arg'1) $ \arg'1' -> M2.withColor4BPtr arg'2 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'2' -> let arg'3' = HoppyFHR.coerceIntegral arg'3 in (label_enableOutlineWithSize' arg'1' arg'2' arg'3')
273
false
true
0
14
51
127
62
65
null
null
RossMeikleham/NesMonad
src/Instructions.hs
mit
-- Branch if condition met, to signed 8 bit offset jmpCond :: Bool -> CPUState() jmpCond b = when b (do im <- getIm pc <- getPC let im' = (fromIntegral im :: Word16) newPC = pc + (im' .&. 127) - (im' .&. 128) setPC newPC -- Branch has been taken, so need to add an extra cycle if (newPC .&. 0xFF00) /= (pc .&. 0xFF00) then modifyCycles (+2) -- Page boundary crosses, another extra cycle else modifyCycles (+1))
495
jmpCond :: Bool -> CPUState() jmpCond b = when b (do im <- getIm pc <- getPC let im' = (fromIntegral im :: Word16) newPC = pc + (im' .&. 127) - (im' .&. 128) setPC newPC -- Branch has been taken, so need to add an extra cycle if (newPC .&. 0xFF00) /= (pc .&. 0xFF00) then modifyCycles (+2) -- Page boundary crosses, another extra cycle else modifyCycles (+1))
444
jmpCond b = when b (do im <- getIm pc <- getPC let im' = (fromIntegral im :: Word16) newPC = pc + (im' .&. 127) - (im' .&. 128) setPC newPC -- Branch has been taken, so need to add an extra cycle if (newPC .&. 0xFF00) /= (pc .&. 0xFF00) then modifyCycles (+2) -- Page boundary crosses, another extra cycle else modifyCycles (+1))
414
true
true
0
15
164
142
74
68
null
null
ssaavedra/liquidhaskell
benchmarks/vector-0.10.0.1/Data/Vector.hs
bsd-3-clause
unsafeCopy = G.unsafeCopy
25
unsafeCopy = G.unsafeCopy
25
unsafeCopy = G.unsafeCopy
25
false
false
0
5
2
8
4
4
null
null
alphalambda/codeworld
codeworld-base/src/Extras/Colors.hs
apache-2.0
byName("lightgreen") = colorNamed'("#90ee90")
45
byName("lightgreen") = colorNamed'("#90ee90")
45
byName("lightgreen") = colorNamed'("#90ee90")
45
false
false
0
6
2
18
9
9
null
null
kazu-yamamoto/dns
internal/Network/DNS/Decode/Parsers.hs
bsd-3-clause
getRData CDNSKEY len = RD_CDNSKEY <$> decodeKeyFlags <*> decodeKeyProto <*> decodeKeyAlg <*> decodeKeyBytes where decodeKeyFlags = get16 decodeKeyProto = get8 decodeKeyAlg = get8 decodeKeyBytes = getNByteString (len - 4) --
349
getRData CDNSKEY len = RD_CDNSKEY <$> decodeKeyFlags <*> decodeKeyProto <*> decodeKeyAlg <*> decodeKeyBytes where decodeKeyFlags = get16 decodeKeyProto = get8 decodeKeyAlg = get8 decodeKeyBytes = getNByteString (len - 4) --
349
getRData CDNSKEY len = RD_CDNSKEY <$> decodeKeyFlags <*> decodeKeyProto <*> decodeKeyAlg <*> decodeKeyBytes where decodeKeyFlags = get16 decodeKeyProto = get8 decodeKeyAlg = get8 decodeKeyBytes = getNByteString (len - 4) --
349
false
false
4
8
155
74
32
42
null
null
spechub/Hets
Comorphisms/Hs2HOLCFaux.hs
gpl-2.0
mkNewDef :: Named Sentence -> String -> Int -> Int -> [(Typ, Typ)] -> Named Sentence mkNewDef s z x y t = let -- x is the max a = NotCont zy = uncurry mkFunType (t !! (y - 1)) in mapNamed ( \ sen -> case sen of ConstDef (IsaEq lh rh) -> case (lh, extFBody rh) of (Const nam _, (_, w : ws)) -> ConstDef $ IsaEq (Const nam $ hideNN zy) $ termMAbs a (w : ws) $ termMAppl a (tupleSelector x y (termSAppl a (Const (mkVName z) noType) w) a) ws _ -> error "Hs2HOLCFaux.mkNewDef1" _ -> error "Hs2HOLCFaux.mkNewDef2") s
610
mkNewDef :: Named Sentence -> String -> Int -> Int -> [(Typ, Typ)] -> Named Sentence mkNewDef s z x y t = let -- x is the max a = NotCont zy = uncurry mkFunType (t !! (y - 1)) in mapNamed ( \ sen -> case sen of ConstDef (IsaEq lh rh) -> case (lh, extFBody rh) of (Const nam _, (_, w : ws)) -> ConstDef $ IsaEq (Const nam $ hideNN zy) $ termMAbs a (w : ws) $ termMAppl a (tupleSelector x y (termSAppl a (Const (mkVName z) noType) w) a) ws _ -> error "Hs2HOLCFaux.mkNewDef1" _ -> error "Hs2HOLCFaux.mkNewDef2") s
610
mkNewDef s z x y t = let -- x is the max a = NotCont zy = uncurry mkFunType (t !! (y - 1)) in mapNamed ( \ sen -> case sen of ConstDef (IsaEq lh rh) -> case (lh, extFBody rh) of (Const nam _, (_, w : ws)) -> ConstDef $ IsaEq (Const nam $ hideNN zy) $ termMAbs a (w : ws) $ termMAppl a (tupleSelector x y (termSAppl a (Const (mkVName z) noType) w) a) ws _ -> error "Hs2HOLCFaux.mkNewDef1" _ -> error "Hs2HOLCFaux.mkNewDef2") s
505
false
true
0
23
205
273
136
137
null
null
melted/idris-chez
src/Chez/Operators.hs
isc
compileOp LStrHead [x] = call "string-ref" [compileVar x, "0"]
62
compileOp LStrHead [x] = call "string-ref" [compileVar x, "0"]
62
compileOp LStrHead [x] = call "string-ref" [compileVar x, "0"]
62
false
false
0
7
8
30
14
16
null
null
mapinguari/SC_HS_Proxy
src/Proxy/Query/Unit.hs
mit
supplyRequired ZergHatchery = 0
31
supplyRequired ZergHatchery = 0
31
supplyRequired ZergHatchery = 0
31
false
false
0
5
3
9
4
5
null
null
coreyoconnor/bind-marshal
test/FLVHeader/Data.hs
bsd-3-clause
peek_char8 :: Ptr Word8 -> IO Char peek_char8 p = do v :: Word8 <- peek p return $! toEnum $! fromEnum v
112
peek_char8 :: Ptr Word8 -> IO Char peek_char8 p = do v :: Word8 <- peek p return $! toEnum $! fromEnum v
112
peek_char8 p = do v :: Word8 <- peek p return $! toEnum $! fromEnum v
77
false
true
0
8
30
52
23
29
null
null
Gabriel439/suns-search
src/Meld.hs
gpl-3.0
{- I chose this cutoff assuming no hydrogen atoms. The smallest non-hydrogen bonds are C-C bonds of 1.2 Angstroms, so I rounded down to 1.0 to be safe -} cutoff :: Double cutoff = 1.0
187
cutoff :: Double cutoff = 1.0
29
cutoff = 1.0
12
true
true
0
4
38
12
7
5
null
null
svenkeidel/sdl2
src/SDL/Audio.hs
bsd-3-clause
-- | Query the state of an 'AudioDevice'. audioDeviceStatus :: MonadIO m => AudioDevice -> m AudioDeviceStatus audioDeviceStatus (AudioDevice d) = liftIO $ fromC "SDL.Audio.audioDeviceStatus" "SDL_AudioStatus" readStatus <$> Raw.getAudioDeviceStatus d where readStatus n = case n of Raw.SDL_AUDIO_PLAYING -> Just Playing Raw.SDL_AUDIO_STOPPED -> Just Stopped Raw.SDL_AUDIO_PAUSED -> Just Paused _ -> Nothing -- clearQueuedAudio :: AudioDevice -> IO () -- clearQueuedAudio (AudioDevice d) = Raw.clearQueuedAudio d
535
audioDeviceStatus :: MonadIO m => AudioDevice -> m AudioDeviceStatus audioDeviceStatus (AudioDevice d) = liftIO $ fromC "SDL.Audio.audioDeviceStatus" "SDL_AudioStatus" readStatus <$> Raw.getAudioDeviceStatus d where readStatus n = case n of Raw.SDL_AUDIO_PLAYING -> Just Playing Raw.SDL_AUDIO_STOPPED -> Just Stopped Raw.SDL_AUDIO_PAUSED -> Just Paused _ -> Nothing -- clearQueuedAudio :: AudioDevice -> IO () -- clearQueuedAudio (AudioDevice d) = Raw.clearQueuedAudio d
493
audioDeviceStatus (AudioDevice d) = liftIO $ fromC "SDL.Audio.audioDeviceStatus" "SDL_AudioStatus" readStatus <$> Raw.getAudioDeviceStatus d where readStatus n = case n of Raw.SDL_AUDIO_PLAYING -> Just Playing Raw.SDL_AUDIO_STOPPED -> Just Stopped Raw.SDL_AUDIO_PAUSED -> Just Paused _ -> Nothing -- clearQueuedAudio :: AudioDevice -> IO () -- clearQueuedAudio (AudioDevice d) = Raw.clearQueuedAudio d
424
true
true
5
7
88
113
53
60
null
null
kvelicka/Fizz
Graphics.hs
lgpl-2.1
--------------------------------------------------------------------- -- 1. Isosurfacing: construct a scene from lists of vertex geometry -- and vertex colour. For the contest, surface colour is uniform, -- but the interface below supports probing. --------------------------------------------------------------------- surfaceGeom :: [Vertex3 GLfloat] -> [Color4 GLfloat] -> HsScene surfaceGeom verts cols = Group static $ geom where geom = [ Special $ blend $= Disabled , Special $ depthMask $= Enabled , Special $ render_mode Enabled 1.0 Fill , Special $ color (head cols) , Geometry static Triangles $ [HsGeomNt $ normt] -- map (HsGeomNt . normt) verts -- ] normt = map (\g -> (makeNormal g, g)) . triples $ verts {-# INLINE normt #-} triples (v1:v2:v3:vs) = (v1,v2,v3):(triples vs) triples _ = [] {-# INLINE triples #-} render_mode lt lw pm = do { lighting $= lt ; light (Light 0) $= lt ; lineWidth $= lw ; polygonMode $= (pm, pm) ; polygonOffsetFill$= lt }
1,240
surfaceGeom :: [Vertex3 GLfloat] -> [Color4 GLfloat] -> HsScene surfaceGeom verts cols = Group static $ geom where geom = [ Special $ blend $= Disabled , Special $ depthMask $= Enabled , Special $ render_mode Enabled 1.0 Fill , Special $ color (head cols) , Geometry static Triangles $ [HsGeomNt $ normt] -- map (HsGeomNt . normt) verts -- ] normt = map (\g -> (makeNormal g, g)) . triples $ verts {-# INLINE normt #-} triples (v1:v2:v3:vs) = (v1,v2,v3):(triples vs) triples _ = [] {-# INLINE triples #-} render_mode lt lw pm = do { lighting $= lt ; light (Light 0) $= lt ; lineWidth $= lw ; polygonMode $= (pm, pm) ; polygonOffsetFill$= lt }
918
surfaceGeom verts cols = Group static $ geom where geom = [ Special $ blend $= Disabled , Special $ depthMask $= Enabled , Special $ render_mode Enabled 1.0 Fill , Special $ color (head cols) , Geometry static Triangles $ [HsGeomNt $ normt] -- map (HsGeomNt . normt) verts -- ] normt = map (\g -> (makeNormal g, g)) . triples $ verts {-# INLINE normt #-} triples (v1:v2:v3:vs) = (v1,v2,v3):(triples vs) triples _ = [] {-# INLINE triples #-} render_mode lt lw pm = do { lighting $= lt ; light (Light 0) $= lt ; lineWidth $= lw ; polygonMode $= (pm, pm) ; polygonOffsetFill$= lt }
853
true
true
0
13
428
282
151
131
null
null
MatheusFaria/ExperimentalLanguage
Interpreter.hs
mit
lessC _ _ = error "Operation '<' not define for this data type"
63
lessC _ _ = error "Operation '<' not define for this data type"
63
lessC _ _ = error "Operation '<' not define for this data type"
63
false
false
1
5
12
14
6
8
null
null
neothemachine/monadiccp
src/Control/CP/FD/SearchSpec/Data.hs
bsd-3-clause
mmapSearch (CombineSeq a b) vf af bf = do ad <- mmapSearch a vf af bf bd <- mmapSearch b vf af bf return (CombineSeq ad bd)
129
mmapSearch (CombineSeq a b) vf af bf = do ad <- mmapSearch a vf af bf bd <- mmapSearch b vf af bf return (CombineSeq ad bd)
129
mmapSearch (CombineSeq a b) vf af bf = do ad <- mmapSearch a vf af bf bd <- mmapSearch b vf af bf return (CombineSeq ad bd)
129
false
false
0
9
32
69
31
38
null
null
kosmoskatten/glmat
test/GLMatrixTests.hs
mit
translateTest :: Assertion translateTest = assertEqual "Should be equal" (GLMatrix 1 0 0 1 0 1 0 2 0 0 1 3 0 0 0 1) (translate 1 2 3 :: GLMatrix Int)
309
translateTest :: Assertion translateTest = assertEqual "Should be equal" (GLMatrix 1 0 0 1 0 1 0 2 0 0 1 3 0 0 0 1) (translate 1 2 3 :: GLMatrix Int)
309
translateTest = assertEqual "Should be equal" (GLMatrix 1 0 0 1 0 1 0 2 0 0 1 3 0 0 0 1) (translate 1 2 3 :: GLMatrix Int)
282
false
true
0
7
192
70
35
35
null
null
gcampax/ghc
compiler/typecheck/TcRnTypes.hs
bsd-3-clause
isCFunEqCan_maybe _ = Nothing
29
isCFunEqCan_maybe _ = Nothing
29
isCFunEqCan_maybe _ = Nothing
29
false
false
0
5
3
9
4
5
null
null
kgadek/novelist
qc-gen/Novelist/Arbitrary/QuickCheckF.hs
bsd-2-clause
arbitraryNovella :: Validity -> QC.Gen N.Novella arbitraryNovella v = N.Fix2 <$> QC.sized arb where arb n | n <= 0 = N.File <$> arbitraryNovellaName v | otherwise = QC.scale (`div` 2) $ ifM (biasedCoin 5) (N.Dir <$> arbitraryNovellaName v <*> QC.listOf (arbitraryNovella v)) (arb 0)
355
arbitraryNovella :: Validity -> QC.Gen N.Novella arbitraryNovella v = N.Fix2 <$> QC.sized arb where arb n | n <= 0 = N.File <$> arbitraryNovellaName v | otherwise = QC.scale (`div` 2) $ ifM (biasedCoin 5) (N.Dir <$> arbitraryNovellaName v <*> QC.listOf (arbitraryNovella v)) (arb 0)
355
arbitraryNovella v = N.Fix2 <$> QC.sized arb where arb n | n <= 0 = N.File <$> arbitraryNovellaName v | otherwise = QC.scale (`div` 2) $ ifM (biasedCoin 5) (N.Dir <$> arbitraryNovellaName v <*> QC.listOf (arbitraryNovella v)) (arb 0)
306
false
true
0
12
117
135
65
70
null
null
expipiplus1/spir-v
Language/SpirV/OpCode.hs
mit
instructionSize OpVectorTimesScalar = Fixed 5
45
instructionSize OpVectorTimesScalar = Fixed 5
45
instructionSize OpVectorTimesScalar = Fixed 5
45
false
false
0
5
4
12
5
7
null
null
jberryman/wai
wai-extra/test/Network/Wai/ParseSpec.hs
mit
caseMultipartPlus :: Assertion caseMultipartPlus = do result <- parseRequestBody' lbsBackEnd $ toRequest ctype content result @?= ([("email", "has+plus")], []) where content = "--AaB03x\n" <> "Content-Disposition: form-data; name=\"email\"\n" <> "Content-Type: text/plain; charset=iso-8859-1\n\n" <> "has+plus\n" <> "--AaB03x--" ctype = "multipart/form-data; boundary=AaB03x"
433
caseMultipartPlus :: Assertion caseMultipartPlus = do result <- parseRequestBody' lbsBackEnd $ toRequest ctype content result @?= ([("email", "has+plus")], []) where content = "--AaB03x\n" <> "Content-Disposition: form-data; name=\"email\"\n" <> "Content-Type: text/plain; charset=iso-8859-1\n\n" <> "has+plus\n" <> "--AaB03x--" ctype = "multipart/form-data; boundary=AaB03x"
433
caseMultipartPlus = do result <- parseRequestBody' lbsBackEnd $ toRequest ctype content result @?= ([("email", "has+plus")], []) where content = "--AaB03x\n" <> "Content-Disposition: form-data; name=\"email\"\n" <> "Content-Type: text/plain; charset=iso-8859-1\n\n" <> "has+plus\n" <> "--AaB03x--" ctype = "multipart/form-data; boundary=AaB03x"
402
false
true
6
10
96
98
44
54
null
null
keithodulaigh/Hets
glade-0.12.5.0/demo/noughty/NoughtyGlade.hs
gpl-2.0
diag :: [[a]] -> [a] diag xss = [xss !! n !! n | n <- [0 .. length xss - 1]]
81
diag :: [[a]] -> [a] diag xss = [xss !! n !! n | n <- [0 .. length xss - 1]]
81
diag xss = [xss !! n !! n | n <- [0 .. length xss - 1]]
56
false
true
0
11
26
65
33
32
null
null
shayan-najd/Haskell-Desugar-Generic
Language/Haskell/Exts/Desugar/Generic/Others.hs
bsd-3-clause
desugarFunCon = noDesugaring
28
desugarFunCon = noDesugaring
28
desugarFunCon = noDesugaring
28
false
false
0
4
2
6
3
3
null
null
brendanhay/gogol
gogol-deploymentmanager/gen/Network/Google/DeploymentManager/Types/Product.hs
mpl-2.0
-- | Creates a value of 'DeploymentsStopRequest' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'dsrFingerprint' deploymentsStopRequest :: DeploymentsStopRequest deploymentsStopRequest = DeploymentsStopRequest' {_dsrFingerprint = Nothing}
328
deploymentsStopRequest :: DeploymentsStopRequest deploymentsStopRequest = DeploymentsStopRequest' {_dsrFingerprint = Nothing}
129
deploymentsStopRequest = DeploymentsStopRequest' {_dsrFingerprint = Nothing}
76
true
true
1
7
46
28
16
12
null
null
snoyberg/ghc
compiler/typecheck/TcRnTypes.hs
bsd-3-clause
pprSkolInfo (PatSkol cl mc) = sep [ pprPatSkolInfo cl , text "in" <+> pprMatchContext mc ]
128
pprSkolInfo (PatSkol cl mc) = sep [ pprPatSkolInfo cl , text "in" <+> pprMatchContext mc ]
128
pprSkolInfo (PatSkol cl mc) = sep [ pprPatSkolInfo cl , text "in" <+> pprMatchContext mc ]
128
false
false
0
8
53
40
18
22
null
null
bno1/adventofcode_2016
d08/main.hs
mit
rotateList :: Int -> [a] -> [a] rotateList _ [] = []
52
rotateList :: Int -> [a] -> [a] rotateList _ [] = []
52
rotateList _ [] = []
20
false
true
0
7
11
34
18
16
null
null
goalieca/haskelling
060.hs
gpl-3.0
combinations n (x:xs) = [x:cs | cs <- combinations (n-1) xs] ++ (combinations n xs)
83
combinations n (x:xs) = [x:cs | cs <- combinations (n-1) xs] ++ (combinations n xs)
83
combinations n (x:xs) = [x:cs | cs <- combinations (n-1) xs] ++ (combinations n xs)
83
false
false
0
11
14
57
29
28
null
null
mainland/dph
dph-lifted-vseg/examples/Test.hs
bsd-3-clause
-- TODO: this fails and not caught by quickcheck props -- validPA $ combine2PA' [0, 1, 0] arrM3 arrM3' arrM6 = fromListPA [arrN4, arrN2, arrN3, arrN1, arrN4', arrN1]
171
arrM6 = fromListPA [arrN4, arrN2, arrN3, arrN1, arrN4', arrN1]
67
arrM6 = fromListPA [arrN4, arrN2, arrN3, arrN1, arrN4', arrN1]
67
true
false
0
6
33
29
18
11
null
null
jasonkuhrt/weather
source/Table.hs
bsd-3-clause
mapColumns :: (Column -> Column) -> Table -> Table mapColumns f = transpose . fmap f . transpose
96
mapColumns :: (Column -> Column) -> Table -> Table mapColumns f = transpose . fmap f . transpose
96
mapColumns f = transpose . fmap f . transpose
45
false
true
0
7
17
40
20
20
null
null
NICTA/tickle
src/Data/Tickle/IsolateError.hs
bsd-3-clause
-- | -- -- >>> isolateError 7 (\_ -> 8) (\_ _ -> 9) (_NegativeSize # ()) -- 7 -- -- >>> isolateError 7 (+10) (\_ _ -> 9) (_IsolateXFail # 99) -- 109 -- -- >>> isolateError 7 (\_ -> 8) (+) (_UnexpectedConsumed # (12, 14)) -- 26 isolateError :: a -> (e -> a) -> (Int -> Int -> a) -> IsolateError e -> a isolateError n _ _ NegativeSize = n
348
isolateError :: a -> (e -> a) -> (Int -> Int -> a) -> IsolateError e -> a isolateError n _ _ NegativeSize = n
121
isolateError n _ _ NegativeSize = n
37
true
true
0
11
85
73
40
33
null
null
Ptival/peacoq-server
lib/PeaCoqHandler.hs
mit
testSertop :: String -> IO (Either String ()) testSertop sertop = do (hi, ho, _, _) <- runCommandWithoutBuffering sertop hClose hi _ <- hWaitForInput ho 1000 rdy <- hReady ho if rdy then do eof <- hGetLine ho return $ if eof == "(Answer EOF Ack)" || eof == "(Feedback((id(State 1))(contents Processed)(route 0)))" then Right () else Left $ "Unexpected answer: " ++ eof else do return $ Left "Expected output to be ready"
462
testSertop :: String -> IO (Either String ()) testSertop sertop = do (hi, ho, _, _) <- runCommandWithoutBuffering sertop hClose hi _ <- hWaitForInput ho 1000 rdy <- hReady ho if rdy then do eof <- hGetLine ho return $ if eof == "(Answer EOF Ack)" || eof == "(Feedback((id(State 1))(contents Processed)(route 0)))" then Right () else Left $ "Unexpected answer: " ++ eof else do return $ Left "Expected output to be ready"
462
testSertop sertop = do (hi, ho, _, _) <- runCommandWithoutBuffering sertop hClose hi _ <- hWaitForInput ho 1000 rdy <- hReady ho if rdy then do eof <- hGetLine ho return $ if eof == "(Answer EOF Ack)" || eof == "(Feedback((id(State 1))(contents Processed)(route 0)))" then Right () else Left $ "Unexpected answer: " ++ eof else do return $ Left "Expected output to be ready"
416
false
true
0
14
115
157
73
84
null
null
nomeata/gipeda
src/JsonUtils.hs
mit
delete [k] = mapObject $ HM.delete k
41
delete [k] = mapObject $ HM.delete k
41
delete [k] = mapObject $ HM.delete k
41
false
false
0
7
11
21
10
11
null
null
brendanhay/gogol
gogol-serviceusage/gen/Network/Google/ServiceUsage/Types/Product.hs
mpl-2.0
-- | Quota configuration. gasQuota :: Lens' GoogleAPIService (Maybe Quota) gasQuota = lens _gasQuota (\ s a -> s{_gasQuota = a})
128
gasQuota :: Lens' GoogleAPIService (Maybe Quota) gasQuota = lens _gasQuota (\ s a -> s{_gasQuota = a})
102
gasQuota = lens _gasQuota (\ s a -> s{_gasQuota = a})
53
true
true
0
9
20
46
25
21
null
null
dirkz/haskell-cis-194
03/Golf.hs
isc
freq :: [Integer] -> Map.Map Integer Integer -- foldr over the list, using an empty association map as starting accumulator, -- and using insertWith to add 1 to existing counts freq xs = foldr (\x list -> Map.insertWith (+) x 1 list) (Map.fromList []) xs
254
freq :: [Integer] -> Map.Map Integer Integer freq xs = foldr (\x list -> Map.insertWith (+) x 1 list) (Map.fromList []) xs
122
freq xs = foldr (\x list -> Map.insertWith (+) x 1 list) (Map.fromList []) xs
77
true
true
0
9
44
75
38
37
null
null
uuhan/Idris-dev
src/Idris/Core/Elaborate.hs
bsd-3-clause
complete_fill :: Elab' aux () complete_fill = processTactic' CompleteFill
73
complete_fill :: Elab' aux () complete_fill = processTactic' CompleteFill
73
complete_fill = processTactic' CompleteFill
43
false
true
1
6
8
24
10
14
null
null
sdiehl/ghc
libraries/base/Control/Monad/ST/Lazy/Imp.hs
bsd-3-clause
runST :: (forall s. ST s a) -> a runST (ST st) = runRW# (\s -> case st (S# s) of (r, _) -> r)
93
runST :: (forall s. ST s a) -> a runST (ST st) = runRW# (\s -> case st (S# s) of (r, _) -> r)
93
runST (ST st) = runRW# (\s -> case st (S# s) of (r, _) -> r)
60
false
true
0
11
24
77
39
38
null
null
cdxr/command
Control/Command.hs
bsd-3-clause
-- | Parser that succeeds at end of line. A specialized version of -- 'P.eof'. end :: (Monad m) => CommandT m () end = eof
122
end :: (Monad m) => CommandT m () end = eof
43
end = eof
9
true
true
0
8
25
35
17
18
null
null
edoardo90/lsystem
src/FractalTree.hs
bsd-3-clause
nearCouples (x:y:z:xs) = [x,y]: [y,z] : nearCouples (z:xs)
58
nearCouples (x:y:z:xs) = [x,y]: [y,z] : nearCouples (z:xs)
58
nearCouples (x:y:z:xs) = [x,y]: [y,z] : nearCouples (z:xs)
58
false
false
0
9
7
54
29
25
null
null
mrakgr/futhark
src/Futhark/CodeGen/Backends/GenericC.hs
bsd-3-clause
envWriteScalar :: CompilerEnv op s -> WriteScalar op s envWriteScalar = opsWriteScalar . envOperations
102
envWriteScalar :: CompilerEnv op s -> WriteScalar op s envWriteScalar = opsWriteScalar . envOperations
102
envWriteScalar = opsWriteScalar . envOperations
47
false
true
0
6
13
29
14
15
null
null
wyager/IHaskell
src/IHaskell/IPython.hs
mit
getIHaskellDir :: IO String getIHaskellDir = SH.shelly ihaskellDir
66
getIHaskellDir :: IO String getIHaskellDir = SH.shelly ihaskellDir
66
getIHaskellDir = SH.shelly ihaskellDir
38
false
true
0
6
7
19
9
10
null
null
ancientlanguage/haskell-analysis
greek-script/src/Grammar/Greek/Script/Rounds/VocalicSyllable.hs
mit
mergeDiaeresisConventions :: [DiaeresisConvention] -> DiaeresisConvention mergeDiaeresisConventions = foldr go basicDiaeresisConvention where go (DiaeresisConvention x1 y1) (DiaeresisConvention x2 y2) = DiaeresisConvention (mergeAccentBreaksDiphthong x1 x2) (mergeUselessDiaeresis y1 y2)
299
mergeDiaeresisConventions :: [DiaeresisConvention] -> DiaeresisConvention mergeDiaeresisConventions = foldr go basicDiaeresisConvention where go (DiaeresisConvention x1 y1) (DiaeresisConvention x2 y2) = DiaeresisConvention (mergeAccentBreaksDiphthong x1 x2) (mergeUselessDiaeresis y1 y2)
299
mergeDiaeresisConventions = foldr go basicDiaeresisConvention where go (DiaeresisConvention x1 y1) (DiaeresisConvention x2 y2) = DiaeresisConvention (mergeAccentBreaksDiphthong x1 x2) (mergeUselessDiaeresis y1 y2)
225
false
true
0
7
37
74
36
38
null
null
nomeata/ghc
compiler/nativeGen/PPC/CodeGen.hs
bsd-3-clause
rivialCode rep _ instr x y = do (src1, code1) <- getSomeReg x (src2, code2) <- getSomeReg y let code dst = code1 `appOL` code2 `snocOL` instr dst src1 (RIReg src2) return (Any (intSize rep) code)
212
trivialCode rep _ instr x y = do (src1, code1) <- getSomeReg x (src2, code2) <- getSomeReg y let code dst = code1 `appOL` code2 `snocOL` instr dst src1 (RIReg src2) return (Any (intSize rep) code)
212
trivialCode rep _ instr x y = do (src1, code1) <- getSomeReg x (src2, code2) <- getSomeReg y let code dst = code1 `appOL` code2 `snocOL` instr dst src1 (RIReg src2) return (Any (intSize rep) code)
212
false
false
0
13
52
106
52
54
null
null
remyoudompheng/forum-gtk
src-haskell/mainwindow.hs
gpl-3.0
xml_menu :: IO String xml_menu = do readFile "menu.xml"
59
xml_menu :: IO String xml_menu = do readFile "menu.xml"
59
xml_menu = do readFile "menu.xml"
37
false
true
0
8
12
26
10
16
null
null
brendanhay/gogol
gogol-logging/gen/Network/Google/Resource/Logging/Folders/Sinks/Update.hs
mpl-2.0
-- | Optional. Field mask that specifies the fields in sink that need an -- update. A sink field will be overwritten if, and only if, it is in the -- update mask. name and output only fields cannot be updated.An empty -- updateMask is temporarily treated as using the following mask for -- backwards compatibility purposes: destination,filter,includeChildren At -- some point in the future, behavior will be removed and specifying an -- empty updateMask will be an error.For a detailed FieldMask definition, -- see -- https:\/\/developers.google.com\/protocol-buffers\/docs\/reference\/google.protobuf#google.protobuf.FieldMaskExample: -- updateMask=filter. fsuUpdateMask :: Lens' FoldersSinksUpdate (Maybe GFieldMask) fsuUpdateMask = lens _fsuUpdateMask (\ s a -> s{_fsuUpdateMask = a})
795
fsuUpdateMask :: Lens' FoldersSinksUpdate (Maybe GFieldMask) fsuUpdateMask = lens _fsuUpdateMask (\ s a -> s{_fsuUpdateMask = a})
137
fsuUpdateMask = lens _fsuUpdateMask (\ s a -> s{_fsuUpdateMask = a})
76
true
true
0
8
113
58
34
24
null
null
rrnewton/accelerate
Data/Array/Accelerate/Array/Sugar.hs
bsd-3-clause
sinkFromElt2 f = \x y -> fromElt $ f (toElt x) (toElt y)
56
sinkFromElt2 f = \x y -> fromElt $ f (toElt x) (toElt y)
56
sinkFromElt2 f = \x y -> fromElt $ f (toElt x) (toElt y)
56
false
false
0
9
12
37
18
19
null
null
samplecount/shake-language-c
src/Development/Shake/Language/C/Target/Windows.hs
apache-2.0
-- | Build target given an architecture. target :: Arch -> Target target = Target Windows (Platform "windows")
110
target :: Arch -> Target target = Target Windows (Platform "windows")
69
target = Target Windows (Platform "windows")
44
true
true
0
7
17
33
15
18
null
null
alexbaluta/courseography
dependencies/HaXml-1.25.3/src/Text/XML/HaXml/ByteStringPP.hs
gpl-3.0
markupdecl (MarkupMisc m) = misc m
35
markupdecl (MarkupMisc m) = misc m
35
markupdecl (MarkupMisc m) = misc m
35
false
false
0
6
6
19
8
11
null
null
green-haskell/ghc
includes/CodeGen.Platform.hs
bsd-3-clause
globalRegMaybe (ZmmReg 4) = Just (RealRegSingle REG_ZMM4)
71
globalRegMaybe (ZmmReg 4) = Just (RealRegSingle REG_ZMM4)
71
globalRegMaybe (ZmmReg 4) = Just (RealRegSingle REG_ZMM4)
71
false
false
0
7
20
24
11
13
null
null
rtoal/ple
haskell/is_thirty_four_pattern_matching.hs
mit
main = do guard $ not (isThirtyFour 8) guard $ isThirtyFour 34
70
main = do guard $ not (isThirtyFour 8) guard $ isThirtyFour 34
70
main = do guard $ not (isThirtyFour 8) guard $ isThirtyFour 34
70
false
false
1
11
19
36
14
22
null
null
erochest/life-cast
Life.hs
apache-2.0
onEvent _ lc = lc
17
onEvent _ lc = lc
17
onEvent _ lc = lc
17
false
false
1
5
4
12
5
7
null
null
cartazio/omega
src/Toplevel.hs
bsd-3-clause
add = run "D:/IntelWork/adder.prg"
34
add = run "D:/IntelWork/adder.prg"
34
add = run "D:/IntelWork/adder.prg"
34
false
false
1
5
3
13
4
9
null
null
Teaspot-Studio/Urho3D-Haskell
src/Graphics/Urho3D/Graphics/VertexBuffer.hs
mit
vertexBufferGetElement :: (Parent VertexBuffer a, Pointer p a, MonadIO m) => p -- ^ Pointer to VertexBuffer or ascentor -> VertexElementSemantic -- ^ sematic -> Word8 -- ^ index (default 0) -> m (Maybe VertexElement) vertexBufferGetElement p semantic_ index_ = liftIO $ do let ptr = parentPointer p semantic' = fromIntegral . fromEnum $ semantic_ index' = fromIntegral index_ ve <- [C.exp| const VertexElement* {$(VertexBuffer* ptr)->GetElement((VertexElementSemantic)$(int semantic'), $(unsigned char index'))} |] checkNullPtr' ve peek -- const VertexElement* GetElement(VertexElementSemantic semantic, unsigned char index = 0) const; -- | Return vertex element with specific type, or null if does not exist.
736
vertexBufferGetElement :: (Parent VertexBuffer a, Pointer p a, MonadIO m) => p -- ^ Pointer to VertexBuffer or ascentor -> VertexElementSemantic -- ^ sematic -> Word8 -- ^ index (default 0) -> m (Maybe VertexElement) vertexBufferGetElement p semantic_ index_ = liftIO $ do let ptr = parentPointer p semantic' = fromIntegral . fromEnum $ semantic_ index' = fromIntegral index_ ve <- [C.exp| const VertexElement* {$(VertexBuffer* ptr)->GetElement((VertexElementSemantic)$(int semantic'), $(unsigned char index'))} |] checkNullPtr' ve peek -- const VertexElement* GetElement(VertexElementSemantic semantic, unsigned char index = 0) const; -- | Return vertex element with specific type, or null if does not exist.
736
vertexBufferGetElement p semantic_ index_ = liftIO $ do let ptr = parentPointer p semantic' = fromIntegral . fromEnum $ semantic_ index' = fromIntegral index_ ve <- [C.exp| const VertexElement* {$(VertexBuffer* ptr)->GetElement((VertexElementSemantic)$(int semantic'), $(unsigned char index'))} |] checkNullPtr' ve peek -- const VertexElement* GetElement(VertexElementSemantic semantic, unsigned char index = 0) const; -- | Return vertex element with specific type, or null if does not exist.
511
false
true
0
12
125
128
66
62
null
null
glutamate/probably-baysig
src/Math/Probably/Sampler.hs
bsd-3-clause
normalMany :: [(Double,Double)] -> Prob [Double] normalMany means_vars = do gus <- normalManyUnit (length means_vars) return $ map f $ zip gus means_vars where f (gu, (mean, var)) = gu*(sqrt var)+mean
231
normalMany :: [(Double,Double)] -> Prob [Double] normalMany means_vars = do gus <- normalManyUnit (length means_vars) return $ map f $ zip gus means_vars where f (gu, (mean, var)) = gu*(sqrt var)+mean
231
normalMany means_vars = do gus <- normalManyUnit (length means_vars) return $ map f $ zip gus means_vars where f (gu, (mean, var)) = gu*(sqrt var)+mean
182
false
true
0
10
61
104
53
51
null
null
abakst/liquidhaskell
src/Language/Haskell/Liquid/Transforms/CoreToLogic.hs
bsd-3-clause
coreToLg (C.Tick _ e) = coreToLg e
34
coreToLg (C.Tick _ e) = coreToLg e
34
coreToLg (C.Tick _ e) = coreToLg e
34
false
false
0
8
6
22
10
12
null
null
stefanocerruti/haskell-primer-alpha
src/Playground07.hs
bsd-3-clause
fib'' n = let (a,b) = fib'' (div n 2 ) c = a * (b * 2 - a) d = a * a + b * b in if even n then ( c, d) else (d, c + d)
210
fib'' n = let (a,b) = fib'' (div n 2 ) c = a * (b * 2 - a) d = a * a + b * b in if even n then ( c, d) else (d, c + d)
210
fib'' n = let (a,b) = fib'' (div n 2 ) c = a * (b * 2 - a) d = a * a + b * b in if even n then ( c, d) else (d, c + d)
210
false
false
1
12
133
106
54
52
null
null
oprdyn/technique
tests/MockData.hs
mit
spec :: Spec spec = do describe "Load mock data for tests" $ do testFlushDatastore testSetFakeData
108
spec :: Spec spec = do describe "Load mock data for tests" $ do testFlushDatastore testSetFakeData
108
spec = do describe "Load mock data for tests" $ do testFlushDatastore testSetFakeData
95
false
true
0
10
25
34
13
21
null
null
epsilonhalbe/accelerate-typelits
src/Data/Array/Accelerate/TypeLits.hs
isc
(./^) :: forall n a. (KnownNat n, A.Floating a, Elt a) => Exp a -> AccVector n a -> AccVector n a -- | a convenient helper deviding every element of a vector -- -- > βŽ›xβ‚βŽž βŽ› x₁/a ⎞ -- > ⎜xβ‚‚βŽŸ ⎜ xβ‚‚/a ⎟ -- > ⎜. ⎟ ⎜ . ⎟ -- > a / ⎜. ⎟ = ⎜ . ⎟ -- > ⎜. ⎟ ⎜ . ⎟ -- > ⎜. ⎟ ⎜ . ⎟ -- > ⎝xβ‚™βŽ  ⎝ xβ‚™/a ⎠ a ./^ v = let v' = unVector v in AccVector $ A.map (/ a) v'
411
(./^) :: forall n a. (KnownNat n, A.Floating a, Elt a) => Exp a -> AccVector n a -> AccVector n a a ./^ v = let v' = unVector v in AccVector $ A.map (/ a) v'
173
a ./^ v = let v' = unVector v in AccVector $ A.map (/ a) v'
69
true
true
0
11
162
110
59
51
null
null
nushio3/authoring
old-src/Text/Authoring/LaTeX/Utils.hs
bsd-3-clause
-- | A numbered mathematical eqnarray (or otherwise math expression). eqnarray :: LaTeXC l => l -> l eqnarray = texEnv "eqnarray" []
132
eqnarray :: LaTeXC l => l -> l eqnarray = texEnv "eqnarray" []
62
eqnarray = texEnv "eqnarray" []
31
true
true
0
6
22
30
15
15
null
null
cutsea110/aop
src/Tree.hs
bsd-3-clause
para (d, g) (Bin l r) = g (l, para (d, g) l) (r, para (d, g) r)
63
para (d, g) (Bin l r) = g (l, para (d, g) l) (r, para (d, g) r)
63
para (d, g) (Bin l r) = g (l, para (d, g) l) (r, para (d, g) r)
63
false
false
0
8
17
64
35
29
null
null
beni55/LambdaHack
Game/LambdaHack/Atomic/HandleAtomicWrite.hs
bsd-3-clause
updRestartServer :: MonadStateWrite m => State -> m () updRestartServer = putState
82
updRestartServer :: MonadStateWrite m => State -> m () updRestartServer = putState
82
updRestartServer = putState
27
false
true
0
8
11
27
13
14
null
null
jmct/IterativeCompiler
frontend/GMachine.hs
mit
putSparks :: GMSparks -> GMState -> GMState putSparks sparks' ((o, heap, globals, sparks, stats), locals) = ((o, heap, globals, sparks', stats), locals)
156
putSparks :: GMSparks -> GMState -> GMState putSparks sparks' ((o, heap, globals, sparks, stats), locals) = ((o, heap, globals, sparks', stats), locals)
156
putSparks sparks' ((o, heap, globals, sparks, stats), locals) = ((o, heap, globals, sparks', stats), locals)
112
false
true
0
7
25
66
40
26
null
null
vikraman/ghc
compiler/simplCore/OccurAnal.hs
bsd-3-clause
extendFvs_ :: UniqFM VarSet -> VarSet -> VarSet extendFvs_ env s = fst (extendFvs env s)
88
extendFvs_ :: UniqFM VarSet -> VarSet -> VarSet extendFvs_ env s = fst (extendFvs env s)
88
extendFvs_ env s = fst (extendFvs env s)
40
false
true
0
7
15
38
18
20
null
null
rtts/cchess
src/Main.hs
gpl-3.0
gameLoop board = do if (check White board) then putStrLn "White is checked!" else return () if (check Black board) then putStrLn "Black is checked!" else return () if (mate White board) then do putStrLn "Black has won. Congratulations!" exitWith ExitSuccess else return () if (mate Black board) then do putStrLn "White has won. Congratulations!" exitWith ExitSuccess else return () putStr "Your move: " hFlush stdout move <- getLine newBoard <- (evaluate $ moveSAN move board) `catch` (\(SomeException _) -> return $ Left NoParse) case newBoard of Left e -> do putStrLn "Invalid move, try again..." gameLoop board Right b -> do putStrLn $ prettyBoard b gameLoop b
755
gameLoop board = do if (check White board) then putStrLn "White is checked!" else return () if (check Black board) then putStrLn "Black is checked!" else return () if (mate White board) then do putStrLn "Black has won. Congratulations!" exitWith ExitSuccess else return () if (mate Black board) then do putStrLn "White has won. Congratulations!" exitWith ExitSuccess else return () putStr "Your move: " hFlush stdout move <- getLine newBoard <- (evaluate $ moveSAN move board) `catch` (\(SomeException _) -> return $ Left NoParse) case newBoard of Left e -> do putStrLn "Invalid move, try again..." gameLoop board Right b -> do putStrLn $ prettyBoard b gameLoop b
755
gameLoop board = do if (check White board) then putStrLn "White is checked!" else return () if (check Black board) then putStrLn "Black is checked!" else return () if (mate White board) then do putStrLn "Black has won. Congratulations!" exitWith ExitSuccess else return () if (mate Black board) then do putStrLn "White has won. Congratulations!" exitWith ExitSuccess else return () putStr "Your move: " hFlush stdout move <- getLine newBoard <- (evaluate $ moveSAN move board) `catch` (\(SomeException _) -> return $ Left NoParse) case newBoard of Left e -> do putStrLn "Invalid move, try again..." gameLoop board Right b -> do putStrLn $ prettyBoard b gameLoop b
755
false
false
0
13
199
253
114
139
null
null
Elastifile/git-sling
server/src/Sling.hs
gpl-2.0
tryTakeJob' :: Proposal.ServerId -> Options -> Git.Remote -> Git.Branch -> Proposal -> EShell (Maybe Job) tryTakeJob' serverId options remote proposalBranch proposal = do let ontoBranchName = Proposal.proposalBranchOnto proposal remoteOnto = Git.RefBranch $ Git.RemoteBranch remote ontoBranchName (baseRef, headRef) = case Proposal.proposalType proposal of Proposal.ProposalTypeMerge _mergeType base -> (Git.RefHash base, Git.RefBranch proposalBranch) Proposal.ProposalTypeRebase name -> (remoteOnto, Git.RefBranch $ Git.RemoteBranch remote name) commits <- Git.log baseRef headRef -- must be done after we verify the remote branch exists remoteOntoBranchHash <- Git.refToHash (Git.RefBranch $ Git.RemoteBranch remote ontoBranchName) let nicePrefix = if Proposal.proposalName proposal == ontoBranchName then "_" -- to ensure niceBranchName never equals ontoBranchName else "" niceBranchName = Git.mkBranchName $ nicePrefix <> Git.fromBranchName (Proposal.proposalName proposal) niceBranch = Git.LocalBranch niceBranchName finalBase = Git.RefHash remoteOntoBranchHash -- create local work branch, reset to proposed withLocalBranch niceBranchName $ do case Proposal.proposalType proposal of Proposal.ProposalTypeMerge _mergeType baseHash -> prepareMergeProposal remote proposalBranch proposal baseHash niceBranch Proposal.ProposalTypeRebase branchToRebase -> do Git.reset Git.ResetHard (Git.RefBranch $ Git.RemoteBranch remote branchToRebase) -- rebase target on onto Git.rebase Git.Rebase { Git.rebaseBase = remoteOnto, Git.rebaseOnto = remoteOnto, Git.rebasePolicy = Git.RebaseKeepMerges } `catchError` (rejectProposalAndAbort options remote proposal "Rebase failed" Nothing . Just) -- rebase succeeded, we can now take this job finalHead <- Git.currentRef eprint "Switching to (new) in-progress branch" let forceCreateInProgress = case Proposal.proposalStatus proposal of Proposal.ProposalInProgress{} -> Git.PushForceWithoutLease -- can't use lease to create new branch. stupid git. _ -> Git.PushNonForce inProgressProposal <- makeUnique proposal { Proposal.proposalStatus = Proposal.ProposalInProgress serverId } let inProgressBranchName = Proposal.toBranchName inProgressProposal eprint . T.pack $ "Creating in-progress proposal branch: " <> T.unpack (Git.fromBranchName inProgressBranchName) withNewBranch remote inProgressBranchName forceCreateInProgress $ do Git.deleteLocalBranch niceBranchName jobTaken <- case Proposal.proposalStatus proposal of Proposal.ProposalRejected -> error "ASSERTION FAILED! Shouldn't be taking rejected proposal" Proposal.ProposalInProgress{} | inProgressBranchName == Git.branchName proposalBranch -> return True _ -> do eprint "Deleting proposal branch..." (Git.deleteBranch proposalBranch >> return True) `catchError` const (eprint "Can't delete proposal - Other slave took the job? Dropping" >> return False) if jobTaken then do commitLogHtml <- formatCommitsForEmail options inProgressProposal commits <$> Git.remoteUrl remote let title = if isDryRun options proposal then "Running dry run" else "Attempting to merge" prefix = case Proposal.proposalPrefix proposal of Nothing -> "" Just s -> " (" <> fromNonEmptyText (Proposal.fromPrefix s) <> ")" sendProposalEmail options proposal (title <> prefix) commitLogHtml Nothing ProposalAttemptEmail return . Just $ Job inProgressProposal finalBase finalHead else return Nothing ----------------------------------------------------------------------
4,359
tryTakeJob' :: Proposal.ServerId -> Options -> Git.Remote -> Git.Branch -> Proposal -> EShell (Maybe Job) tryTakeJob' serverId options remote proposalBranch proposal = do let ontoBranchName = Proposal.proposalBranchOnto proposal remoteOnto = Git.RefBranch $ Git.RemoteBranch remote ontoBranchName (baseRef, headRef) = case Proposal.proposalType proposal of Proposal.ProposalTypeMerge _mergeType base -> (Git.RefHash base, Git.RefBranch proposalBranch) Proposal.ProposalTypeRebase name -> (remoteOnto, Git.RefBranch $ Git.RemoteBranch remote name) commits <- Git.log baseRef headRef -- must be done after we verify the remote branch exists remoteOntoBranchHash <- Git.refToHash (Git.RefBranch $ Git.RemoteBranch remote ontoBranchName) let nicePrefix = if Proposal.proposalName proposal == ontoBranchName then "_" -- to ensure niceBranchName never equals ontoBranchName else "" niceBranchName = Git.mkBranchName $ nicePrefix <> Git.fromBranchName (Proposal.proposalName proposal) niceBranch = Git.LocalBranch niceBranchName finalBase = Git.RefHash remoteOntoBranchHash -- create local work branch, reset to proposed withLocalBranch niceBranchName $ do case Proposal.proposalType proposal of Proposal.ProposalTypeMerge _mergeType baseHash -> prepareMergeProposal remote proposalBranch proposal baseHash niceBranch Proposal.ProposalTypeRebase branchToRebase -> do Git.reset Git.ResetHard (Git.RefBranch $ Git.RemoteBranch remote branchToRebase) -- rebase target on onto Git.rebase Git.Rebase { Git.rebaseBase = remoteOnto, Git.rebaseOnto = remoteOnto, Git.rebasePolicy = Git.RebaseKeepMerges } `catchError` (rejectProposalAndAbort options remote proposal "Rebase failed" Nothing . Just) -- rebase succeeded, we can now take this job finalHead <- Git.currentRef eprint "Switching to (new) in-progress branch" let forceCreateInProgress = case Proposal.proposalStatus proposal of Proposal.ProposalInProgress{} -> Git.PushForceWithoutLease -- can't use lease to create new branch. stupid git. _ -> Git.PushNonForce inProgressProposal <- makeUnique proposal { Proposal.proposalStatus = Proposal.ProposalInProgress serverId } let inProgressBranchName = Proposal.toBranchName inProgressProposal eprint . T.pack $ "Creating in-progress proposal branch: " <> T.unpack (Git.fromBranchName inProgressBranchName) withNewBranch remote inProgressBranchName forceCreateInProgress $ do Git.deleteLocalBranch niceBranchName jobTaken <- case Proposal.proposalStatus proposal of Proposal.ProposalRejected -> error "ASSERTION FAILED! Shouldn't be taking rejected proposal" Proposal.ProposalInProgress{} | inProgressBranchName == Git.branchName proposalBranch -> return True _ -> do eprint "Deleting proposal branch..." (Git.deleteBranch proposalBranch >> return True) `catchError` const (eprint "Can't delete proposal - Other slave took the job? Dropping" >> return False) if jobTaken then do commitLogHtml <- formatCommitsForEmail options inProgressProposal commits <$> Git.remoteUrl remote let title = if isDryRun options proposal then "Running dry run" else "Attempting to merge" prefix = case Proposal.proposalPrefix proposal of Nothing -> "" Just s -> " (" <> fromNonEmptyText (Proposal.fromPrefix s) <> ")" sendProposalEmail options proposal (title <> prefix) commitLogHtml Nothing ProposalAttemptEmail return . Just $ Job inProgressProposal finalBase finalHead else return Nothing ----------------------------------------------------------------------
4,359
tryTakeJob' serverId options remote proposalBranch proposal = do let ontoBranchName = Proposal.proposalBranchOnto proposal remoteOnto = Git.RefBranch $ Git.RemoteBranch remote ontoBranchName (baseRef, headRef) = case Proposal.proposalType proposal of Proposal.ProposalTypeMerge _mergeType base -> (Git.RefHash base, Git.RefBranch proposalBranch) Proposal.ProposalTypeRebase name -> (remoteOnto, Git.RefBranch $ Git.RemoteBranch remote name) commits <- Git.log baseRef headRef -- must be done after we verify the remote branch exists remoteOntoBranchHash <- Git.refToHash (Git.RefBranch $ Git.RemoteBranch remote ontoBranchName) let nicePrefix = if Proposal.proposalName proposal == ontoBranchName then "_" -- to ensure niceBranchName never equals ontoBranchName else "" niceBranchName = Git.mkBranchName $ nicePrefix <> Git.fromBranchName (Proposal.proposalName proposal) niceBranch = Git.LocalBranch niceBranchName finalBase = Git.RefHash remoteOntoBranchHash -- create local work branch, reset to proposed withLocalBranch niceBranchName $ do case Proposal.proposalType proposal of Proposal.ProposalTypeMerge _mergeType baseHash -> prepareMergeProposal remote proposalBranch proposal baseHash niceBranch Proposal.ProposalTypeRebase branchToRebase -> do Git.reset Git.ResetHard (Git.RefBranch $ Git.RemoteBranch remote branchToRebase) -- rebase target on onto Git.rebase Git.Rebase { Git.rebaseBase = remoteOnto, Git.rebaseOnto = remoteOnto, Git.rebasePolicy = Git.RebaseKeepMerges } `catchError` (rejectProposalAndAbort options remote proposal "Rebase failed" Nothing . Just) -- rebase succeeded, we can now take this job finalHead <- Git.currentRef eprint "Switching to (new) in-progress branch" let forceCreateInProgress = case Proposal.proposalStatus proposal of Proposal.ProposalInProgress{} -> Git.PushForceWithoutLease -- can't use lease to create new branch. stupid git. _ -> Git.PushNonForce inProgressProposal <- makeUnique proposal { Proposal.proposalStatus = Proposal.ProposalInProgress serverId } let inProgressBranchName = Proposal.toBranchName inProgressProposal eprint . T.pack $ "Creating in-progress proposal branch: " <> T.unpack (Git.fromBranchName inProgressBranchName) withNewBranch remote inProgressBranchName forceCreateInProgress $ do Git.deleteLocalBranch niceBranchName jobTaken <- case Proposal.proposalStatus proposal of Proposal.ProposalRejected -> error "ASSERTION FAILED! Shouldn't be taking rejected proposal" Proposal.ProposalInProgress{} | inProgressBranchName == Git.branchName proposalBranch -> return True _ -> do eprint "Deleting proposal branch..." (Git.deleteBranch proposalBranch >> return True) `catchError` const (eprint "Can't delete proposal - Other slave took the job? Dropping" >> return False) if jobTaken then do commitLogHtml <- formatCommitsForEmail options inProgressProposal commits <$> Git.remoteUrl remote let title = if isDryRun options proposal then "Running dry run" else "Attempting to merge" prefix = case Proposal.proposalPrefix proposal of Nothing -> "" Just s -> " (" <> fromNonEmptyText (Proposal.fromPrefix s) <> ")" sendProposalEmail options proposal (title <> prefix) commitLogHtml Nothing ProposalAttemptEmail return . Just $ Job inProgressProposal finalBase finalHead else return Nothing ----------------------------------------------------------------------
4,253
false
true
0
27
1,307
842
403
439
null
null
filib/ruby-marshal
src/Data/Ruby/Marshal/Encoding.hs
mit
toEnc "Windows-1257" = Windows_1257
49
toEnc "Windows-1257" = Windows_1257
49
toEnc "Windows-1257" = Windows_1257
49
false
false
0
5
17
9
4
5
null
null