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
forked-upstream-packages-for-ghcjs/ghc
testsuite/tests/programs/andy_cherry/DataTypes.hs
bsd-3-clause
getSquarePiece :: BoardSquare -> Maybe Piece getSquarePiece VacantSq = Nothing
82
getSquarePiece :: BoardSquare -> Maybe Piece getSquarePiece VacantSq = Nothing
81
getSquarePiece VacantSq = Nothing
36
false
true
0
6
13
25
11
14
null
null
facebookincubator/duckling
Duckling/Time/SV/Rules.hs
bsd-3-clause
ruleOrdinalCycleOfTime :: Rule ruleOrdinalCycleOfTime = Rule { name = "<ordinal> <cycle> of <time>" , pattern = [ dimension Ordinal , dimension TimeGrain , regex "av|i|från" , dimension Time ] , prod = \tokens -> case tokens of (Token Ordinal od:Token TimeGrain grain:_:Token Time td:_) -> tt $ cycleNthAfter True grain (TOrdinal.value od - 1) td _ -> Nothing }
409
ruleOrdinalCycleOfTime :: Rule ruleOrdinalCycleOfTime = Rule { name = "<ordinal> <cycle> of <time>" , pattern = [ dimension Ordinal , dimension TimeGrain , regex "av|i|från" , dimension Time ] , prod = \tokens -> case tokens of (Token Ordinal od:Token TimeGrain grain:_:Token Time td:_) -> tt $ cycleNthAfter True grain (TOrdinal.value od - 1) td _ -> Nothing }
409
ruleOrdinalCycleOfTime = Rule { name = "<ordinal> <cycle> of <time>" , pattern = [ dimension Ordinal , dimension TimeGrain , regex "av|i|från" , dimension Time ] , prod = \tokens -> case tokens of (Token Ordinal od:Token TimeGrain grain:_:Token Time td:_) -> tt $ cycleNthAfter True grain (TOrdinal.value od - 1) td _ -> Nothing }
378
false
true
0
17
106
139
71
68
null
null
yairchu/defend
src/defend.hs
gpl-3.0
gNothing :: Maybe a -> Maybe () gNothing Nothing = Just ()
58
gNothing :: Maybe a -> Maybe () gNothing Nothing = Just ()
58
gNothing Nothing = Just ()
26
false
true
0
7
11
31
14
17
null
null
rahulmutt/ghcvm
compiler/Eta/Prelude/PrelNames.hs
bsd-3-clause
maxBound_RDR = varQual_RDR gHC_ENUM (fsLit "maxBound")
65
maxBound_RDR = varQual_RDR gHC_ENUM (fsLit "maxBound")
65
maxBound_RDR = varQual_RDR gHC_ENUM (fsLit "maxBound")
65
false
false
0
7
16
17
8
9
null
null
cmahon/smartbit
src/Smartbit/Rest.hs
bsd-3-clause
restPort :: Port restPort = 443
31
restPort :: Port restPort = 443
31
restPort = 443
14
false
true
0
4
5
11
6
5
null
null
Zigazou/containers
Data/Sequence.hs
bsd-3-clause
splitNode i (Node3 _ a b c) | i < sa = Split Nothing a (Just (Two b c)) | i < sab = Split (Just (One a)) b (Just (One c)) | otherwise = Split (Just (Two a b)) c Nothing where sa = size a sab = sa + size b
242
splitNode i (Node3 _ a b c) | i < sa = Split Nothing a (Just (Two b c)) | i < sab = Split (Just (One a)) b (Just (One c)) | otherwise = Split (Just (Two a b)) c Nothing where sa = size a sab = sa + size b
242
splitNode i (Node3 _ a b c) | i < sa = Split Nothing a (Just (Two b c)) | i < sab = Split (Just (One a)) b (Just (One c)) | otherwise = Split (Just (Two a b)) c Nothing where sa = size a sab = sa + size b
242
false
false
4
8
90
166
71
95
null
null
gleachkr/Carnap
Carnap-Server/Handler/Document.hs
gpl-3.0
allFilters = makeTreeDeduction . makeSequent . makeSynCheckers . makeProofChecker . makeTranslate . makeTruthTables . makeCounterModelers . makeQualitativeProblems . renderFormulas
292
allFilters = makeTreeDeduction . makeSequent . makeSynCheckers . makeProofChecker . makeTranslate . makeTruthTables . makeCounterModelers . makeQualitativeProblems . renderFormulas
292
allFilters = makeTreeDeduction . makeSequent . makeSynCheckers . makeProofChecker . makeTranslate . makeTruthTables . makeCounterModelers . makeQualitativeProblems . renderFormulas
292
false
false
9
5
130
50
19
31
null
null
ilyasergey/GHC-XAppFix
compiler/nativeGen/PPC/CodeGen.hs
bsd-3-clause
enCCall' gcp target dest_regs argsAndHints = ASSERT (not $ any (`elem` [II16]) $ map cmmTypeSize argReps) -- we rely on argument promotion in the codeGen do (finalStack,passArgumentsCode,usedRegs) <- passArguments (zip args argReps) allArgRegs allFPArgRegs initialStackOffset (toOL []) [] (labelOrExpr, reduceToFF32) <- case target of CmmCallee (CmmLit (CmmLabel lbl)) _ -> return (Left lbl, False) CmmCallee expr _ -> return (Right expr, False) CmmPrim mop -> outOfLineMachOp mop let codeBefore = move_sp_down finalStack `appOL` passArgumentsCode codeAfter = move_sp_up finalStack `appOL` moveResult reduceToFF32 case labelOrExpr of Left lbl -> do return ( codeBefore `snocOL` BL lbl usedRegs `appOL` codeAfter) Right dyn -> do (dynReg, dynCode) <- getSomeReg dyn return ( dynCode `snocOL` MTCTR dynReg `appOL` codeBefore `snocOL` BCTRL usedRegs `appOL` codeAfter) where initialStackOffset = case gcp of GCPDarwin -> 24 GCPLinux -> 8 -- size of linkage area + size of arguments, in bytes stackDelta finalStack = case gcp of GCPDarwin -> roundTo 16 $ (24 +) $ max 32 $ sum $ map (widthInBytes . typeWidth) argReps GCPLinux -> roundTo 16 finalStack -- need to remove alignment information argsAndHints' | (CmmPrim mop) <- target, (mop == MO_Memcpy || mop == MO_Memset || mop == MO_Memmove) = init argsAndHints | otherwise = argsAndHints args = map hintlessCmm argsAndHints' argReps = map cmmExprType args roundTo a x | x `mod` a == 0 = x | otherwise = x + a - (x `mod` a) move_sp_down finalStack | delta > 64 = toOL [STU II32 sp (AddrRegImm sp (ImmInt (-delta))), DELTA (-delta)] | otherwise = nilOL where delta = stackDelta finalStack move_sp_up finalStack | delta > 64 = toOL [ADD sp sp (RIImm (ImmInt delta)), DELTA 0] | otherwise = nilOL where delta = stackDelta finalStack passArguments [] _ _ stackOffset accumCode accumUsed = return (stackOffset, accumCode, accumUsed) passArguments ((arg,arg_ty):args) gprs fprs stackOffset accumCode accumUsed | isWord64 arg_ty = do ChildCode64 code vr_lo <- iselExpr64 arg let vr_hi = getHiVRegFromLo vr_lo case gcp of GCPDarwin -> do let storeWord vr (gpr:_) _ = MR gpr vr storeWord vr [] offset = ST II32 vr (AddrRegImm sp (ImmInt offset)) passArguments args (drop 2 gprs) fprs (stackOffset+8) (accumCode `appOL` code `snocOL` storeWord vr_hi gprs stackOffset `snocOL` storeWord vr_lo (drop 1 gprs) (stackOffset+4)) ((take 2 gprs) ++ accumUsed) GCPLinux -> do let stackOffset' = roundTo 8 stackOffset stackCode = accumCode `appOL` code `snocOL` ST II32 vr_hi (AddrRegImm sp (ImmInt stackOffset')) `snocOL` ST II32 vr_lo (AddrRegImm sp (ImmInt (stackOffset'+4))) regCode hireg loreg = accumCode `appOL` code `snocOL` MR hireg vr_hi `snocOL` MR loreg vr_lo case gprs of hireg : loreg : regs | even (length gprs) -> passArguments args regs fprs stackOffset (regCode hireg loreg) (hireg : loreg : accumUsed) _skipped : hireg : loreg : regs -> passArguments args regs fprs stackOffset (regCode hireg loreg) (hireg : loreg : accumUsed) _ -> -- only one or no regs left passArguments args [] fprs (stackOffset'+8) stackCode accumUsed passArguments ((arg,rep):args) gprs fprs stackOffset accumCode accumUsed | reg : _ <- regs = do register <- getRegister arg let code = case register of Fixed _ freg fcode -> fcode `snocOL` MR reg freg Any _ acode -> acode reg stackOffsetRes = case gcp of -- The Darwin ABI requires that we reserve -- stack slots for register parameters GCPDarwin -> stackOffset + stackBytes -- ... the SysV ABI doesn't. GCPLinux -> stackOffset passArguments args (drop nGprs gprs) (drop nFprs fprs) stackOffsetRes (accumCode `appOL` code) (reg : accumUsed) | otherwise = do (vr, code) <- getSomeReg arg passArguments args (drop nGprs gprs) (drop nFprs fprs) (stackOffset' + stackBytes) (accumCode `appOL` code `snocOL` ST (cmmTypeSize rep) vr stackSlot) accumUsed where stackOffset' = case gcp of GCPDarwin -> -- stackOffset is at least 4-byte aligned -- The Darwin ABI is happy with that. stackOffset GCPLinux -- ... the SysV ABI requires 8-byte -- alignment for doubles. | isFloatType rep && typeWidth rep == W64 -> roundTo 8 stackOffset | otherwise -> stackOffset stackSlot = AddrRegImm sp (ImmInt stackOffset') (nGprs, nFprs, stackBytes, regs) = case gcp of GCPDarwin -> case cmmTypeSize rep of II8 -> (1, 0, 4, gprs) II32 -> (1, 0, 4, gprs) -- The Darwin ABI requires that we skip a -- corresponding number of GPRs when we use -- the FPRs. FF32 -> (1, 1, 4, fprs) FF64 -> (2, 1, 8, fprs) II16 -> panic "genCCall' passArguments II16" II64 -> panic "genCCall' passArguments II64" FF80 -> panic "genCCall' passArguments FF80" GCPLinux -> case cmmTypeSize rep of II8 -> (1, 0, 4, gprs) II32 -> (1, 0, 4, gprs) -- ... the SysV ABI doesn't. FF32 -> (0, 1, 4, fprs) FF64 -> (0, 1, 8, fprs) II16 -> panic "genCCall' passArguments II16" II64 -> panic "genCCall' passArguments II64" FF80 -> panic "genCCall' passArguments FF80" moveResult reduceToFF32 = case dest_regs of [] -> nilOL [CmmHinted dest _hint] | reduceToFF32 && isFloat32 rep -> unitOL (FRSP r_dest f1) | isFloat32 rep || isFloat64 rep -> unitOL (MR r_dest f1) | isWord64 rep -> toOL [MR (getHiVRegFromLo r_dest) r3, MR r_dest r4] | otherwise -> unitOL (MR r_dest r3) where rep = cmmRegType (CmmLocal dest) r_dest = getRegisterReg (CmmLocal dest) _ -> panic "genCCall' moveResult: Bad dest_regs" outOfLineMachOp mop = do dflags <- getDynFlagsNat mopExpr <- cmmMakeDynamicReference dflags addImportNat CallReference $ mkForeignLabel functionName Nothing ForeignLabelInThisPackage IsFunction let mopLabelOrExpr = case mopExpr of CmmLit (CmmLabel lbl) -> Left lbl _ -> Right mopExpr return (mopLabelOrExpr, reduce) where (functionName, reduce) = case mop of MO_F32_Exp -> (fsLit "exp", True) MO_F32_Log -> (fsLit "log", True) MO_F32_Sqrt -> (fsLit "sqrt", True) MO_F32_Sin -> (fsLit "sin", True) MO_F32_Cos -> (fsLit "cos", True) MO_F32_Tan -> (fsLit "tan", True) MO_F32_Asin -> (fsLit "asin", True) MO_F32_Acos -> (fsLit "acos", True) MO_F32_Atan -> (fsLit "atan", True) MO_F32_Sinh -> (fsLit "sinh", True) MO_F32_Cosh -> (fsLit "cosh", True) MO_F32_Tanh -> (fsLit "tanh", True) MO_F32_Pwr -> (fsLit "pow", True) MO_F64_Exp -> (fsLit "exp", False) MO_F64_Log -> (fsLit "log", False) MO_F64_Sqrt -> (fsLit "sqrt", False) MO_F64_Sin -> (fsLit "sin", False) MO_F64_Cos -> (fsLit "cos", False) MO_F64_Tan -> (fsLit "tan", False) MO_F64_Asin -> (fsLit "asin", False) MO_F64_Acos -> (fsLit "acos", False) MO_F64_Atan -> (fsLit "atan", False) MO_F64_Sinh -> (fsLit "sinh", False) MO_F64_Cosh -> (fsLit "cosh", False) MO_F64_Tanh -> (fsLit "tanh", False) MO_F64_Pwr -> (fsLit "pow", False) MO_Memcpy -> (fsLit "memcpy", False) MO_Memset -> (fsLit "memset", False) MO_Memmove -> (fsLit "memmove", False) MO_PopCnt w -> (fsLit $ popCntLabel w, False) MO_WriteBarrier -> panic $ "outOfLineCmmOp: MO_WriteBarrier not supported" MO_Touch -> panic $ "outOfLineCmmOp: MO_Touch not supported" -- ----------------------------------------------------------------------------- -- Generating a table-branch
12,260
genCCall' gcp target dest_regs argsAndHints = ASSERT (not $ any (`elem` [II16]) $ map cmmTypeSize argReps) -- we rely on argument promotion in the codeGen do (finalStack,passArgumentsCode,usedRegs) <- passArguments (zip args argReps) allArgRegs allFPArgRegs initialStackOffset (toOL []) [] (labelOrExpr, reduceToFF32) <- case target of CmmCallee (CmmLit (CmmLabel lbl)) _ -> return (Left lbl, False) CmmCallee expr _ -> return (Right expr, False) CmmPrim mop -> outOfLineMachOp mop let codeBefore = move_sp_down finalStack `appOL` passArgumentsCode codeAfter = move_sp_up finalStack `appOL` moveResult reduceToFF32 case labelOrExpr of Left lbl -> do return ( codeBefore `snocOL` BL lbl usedRegs `appOL` codeAfter) Right dyn -> do (dynReg, dynCode) <- getSomeReg dyn return ( dynCode `snocOL` MTCTR dynReg `appOL` codeBefore `snocOL` BCTRL usedRegs `appOL` codeAfter) where initialStackOffset = case gcp of GCPDarwin -> 24 GCPLinux -> 8 -- size of linkage area + size of arguments, in bytes stackDelta finalStack = case gcp of GCPDarwin -> roundTo 16 $ (24 +) $ max 32 $ sum $ map (widthInBytes . typeWidth) argReps GCPLinux -> roundTo 16 finalStack -- need to remove alignment information argsAndHints' | (CmmPrim mop) <- target, (mop == MO_Memcpy || mop == MO_Memset || mop == MO_Memmove) = init argsAndHints | otherwise = argsAndHints args = map hintlessCmm argsAndHints' argReps = map cmmExprType args roundTo a x | x `mod` a == 0 = x | otherwise = x + a - (x `mod` a) move_sp_down finalStack | delta > 64 = toOL [STU II32 sp (AddrRegImm sp (ImmInt (-delta))), DELTA (-delta)] | otherwise = nilOL where delta = stackDelta finalStack move_sp_up finalStack | delta > 64 = toOL [ADD sp sp (RIImm (ImmInt delta)), DELTA 0] | otherwise = nilOL where delta = stackDelta finalStack passArguments [] _ _ stackOffset accumCode accumUsed = return (stackOffset, accumCode, accumUsed) passArguments ((arg,arg_ty):args) gprs fprs stackOffset accumCode accumUsed | isWord64 arg_ty = do ChildCode64 code vr_lo <- iselExpr64 arg let vr_hi = getHiVRegFromLo vr_lo case gcp of GCPDarwin -> do let storeWord vr (gpr:_) _ = MR gpr vr storeWord vr [] offset = ST II32 vr (AddrRegImm sp (ImmInt offset)) passArguments args (drop 2 gprs) fprs (stackOffset+8) (accumCode `appOL` code `snocOL` storeWord vr_hi gprs stackOffset `snocOL` storeWord vr_lo (drop 1 gprs) (stackOffset+4)) ((take 2 gprs) ++ accumUsed) GCPLinux -> do let stackOffset' = roundTo 8 stackOffset stackCode = accumCode `appOL` code `snocOL` ST II32 vr_hi (AddrRegImm sp (ImmInt stackOffset')) `snocOL` ST II32 vr_lo (AddrRegImm sp (ImmInt (stackOffset'+4))) regCode hireg loreg = accumCode `appOL` code `snocOL` MR hireg vr_hi `snocOL` MR loreg vr_lo case gprs of hireg : loreg : regs | even (length gprs) -> passArguments args regs fprs stackOffset (regCode hireg loreg) (hireg : loreg : accumUsed) _skipped : hireg : loreg : regs -> passArguments args regs fprs stackOffset (regCode hireg loreg) (hireg : loreg : accumUsed) _ -> -- only one or no regs left passArguments args [] fprs (stackOffset'+8) stackCode accumUsed passArguments ((arg,rep):args) gprs fprs stackOffset accumCode accumUsed | reg : _ <- regs = do register <- getRegister arg let code = case register of Fixed _ freg fcode -> fcode `snocOL` MR reg freg Any _ acode -> acode reg stackOffsetRes = case gcp of -- The Darwin ABI requires that we reserve -- stack slots for register parameters GCPDarwin -> stackOffset + stackBytes -- ... the SysV ABI doesn't. GCPLinux -> stackOffset passArguments args (drop nGprs gprs) (drop nFprs fprs) stackOffsetRes (accumCode `appOL` code) (reg : accumUsed) | otherwise = do (vr, code) <- getSomeReg arg passArguments args (drop nGprs gprs) (drop nFprs fprs) (stackOffset' + stackBytes) (accumCode `appOL` code `snocOL` ST (cmmTypeSize rep) vr stackSlot) accumUsed where stackOffset' = case gcp of GCPDarwin -> -- stackOffset is at least 4-byte aligned -- The Darwin ABI is happy with that. stackOffset GCPLinux -- ... the SysV ABI requires 8-byte -- alignment for doubles. | isFloatType rep && typeWidth rep == W64 -> roundTo 8 stackOffset | otherwise -> stackOffset stackSlot = AddrRegImm sp (ImmInt stackOffset') (nGprs, nFprs, stackBytes, regs) = case gcp of GCPDarwin -> case cmmTypeSize rep of II8 -> (1, 0, 4, gprs) II32 -> (1, 0, 4, gprs) -- The Darwin ABI requires that we skip a -- corresponding number of GPRs when we use -- the FPRs. FF32 -> (1, 1, 4, fprs) FF64 -> (2, 1, 8, fprs) II16 -> panic "genCCall' passArguments II16" II64 -> panic "genCCall' passArguments II64" FF80 -> panic "genCCall' passArguments FF80" GCPLinux -> case cmmTypeSize rep of II8 -> (1, 0, 4, gprs) II32 -> (1, 0, 4, gprs) -- ... the SysV ABI doesn't. FF32 -> (0, 1, 4, fprs) FF64 -> (0, 1, 8, fprs) II16 -> panic "genCCall' passArguments II16" II64 -> panic "genCCall' passArguments II64" FF80 -> panic "genCCall' passArguments FF80" moveResult reduceToFF32 = case dest_regs of [] -> nilOL [CmmHinted dest _hint] | reduceToFF32 && isFloat32 rep -> unitOL (FRSP r_dest f1) | isFloat32 rep || isFloat64 rep -> unitOL (MR r_dest f1) | isWord64 rep -> toOL [MR (getHiVRegFromLo r_dest) r3, MR r_dest r4] | otherwise -> unitOL (MR r_dest r3) where rep = cmmRegType (CmmLocal dest) r_dest = getRegisterReg (CmmLocal dest) _ -> panic "genCCall' moveResult: Bad dest_regs" outOfLineMachOp mop = do dflags <- getDynFlagsNat mopExpr <- cmmMakeDynamicReference dflags addImportNat CallReference $ mkForeignLabel functionName Nothing ForeignLabelInThisPackage IsFunction let mopLabelOrExpr = case mopExpr of CmmLit (CmmLabel lbl) -> Left lbl _ -> Right mopExpr return (mopLabelOrExpr, reduce) where (functionName, reduce) = case mop of MO_F32_Exp -> (fsLit "exp", True) MO_F32_Log -> (fsLit "log", True) MO_F32_Sqrt -> (fsLit "sqrt", True) MO_F32_Sin -> (fsLit "sin", True) MO_F32_Cos -> (fsLit "cos", True) MO_F32_Tan -> (fsLit "tan", True) MO_F32_Asin -> (fsLit "asin", True) MO_F32_Acos -> (fsLit "acos", True) MO_F32_Atan -> (fsLit "atan", True) MO_F32_Sinh -> (fsLit "sinh", True) MO_F32_Cosh -> (fsLit "cosh", True) MO_F32_Tanh -> (fsLit "tanh", True) MO_F32_Pwr -> (fsLit "pow", True) MO_F64_Exp -> (fsLit "exp", False) MO_F64_Log -> (fsLit "log", False) MO_F64_Sqrt -> (fsLit "sqrt", False) MO_F64_Sin -> (fsLit "sin", False) MO_F64_Cos -> (fsLit "cos", False) MO_F64_Tan -> (fsLit "tan", False) MO_F64_Asin -> (fsLit "asin", False) MO_F64_Acos -> (fsLit "acos", False) MO_F64_Atan -> (fsLit "atan", False) MO_F64_Sinh -> (fsLit "sinh", False) MO_F64_Cosh -> (fsLit "cosh", False) MO_F64_Tanh -> (fsLit "tanh", False) MO_F64_Pwr -> (fsLit "pow", False) MO_Memcpy -> (fsLit "memcpy", False) MO_Memset -> (fsLit "memset", False) MO_Memmove -> (fsLit "memmove", False) MO_PopCnt w -> (fsLit $ popCntLabel w, False) MO_WriteBarrier -> panic $ "outOfLineCmmOp: MO_WriteBarrier not supported" MO_Touch -> panic $ "outOfLineCmmOp: MO_Touch not supported" -- ----------------------------------------------------------------------------- -- Generating a table-branch
12,260
genCCall' gcp target dest_regs argsAndHints = ASSERT (not $ any (`elem` [II16]) $ map cmmTypeSize argReps) -- we rely on argument promotion in the codeGen do (finalStack,passArgumentsCode,usedRegs) <- passArguments (zip args argReps) allArgRegs allFPArgRegs initialStackOffset (toOL []) [] (labelOrExpr, reduceToFF32) <- case target of CmmCallee (CmmLit (CmmLabel lbl)) _ -> return (Left lbl, False) CmmCallee expr _ -> return (Right expr, False) CmmPrim mop -> outOfLineMachOp mop let codeBefore = move_sp_down finalStack `appOL` passArgumentsCode codeAfter = move_sp_up finalStack `appOL` moveResult reduceToFF32 case labelOrExpr of Left lbl -> do return ( codeBefore `snocOL` BL lbl usedRegs `appOL` codeAfter) Right dyn -> do (dynReg, dynCode) <- getSomeReg dyn return ( dynCode `snocOL` MTCTR dynReg `appOL` codeBefore `snocOL` BCTRL usedRegs `appOL` codeAfter) where initialStackOffset = case gcp of GCPDarwin -> 24 GCPLinux -> 8 -- size of linkage area + size of arguments, in bytes stackDelta finalStack = case gcp of GCPDarwin -> roundTo 16 $ (24 +) $ max 32 $ sum $ map (widthInBytes . typeWidth) argReps GCPLinux -> roundTo 16 finalStack -- need to remove alignment information argsAndHints' | (CmmPrim mop) <- target, (mop == MO_Memcpy || mop == MO_Memset || mop == MO_Memmove) = init argsAndHints | otherwise = argsAndHints args = map hintlessCmm argsAndHints' argReps = map cmmExprType args roundTo a x | x `mod` a == 0 = x | otherwise = x + a - (x `mod` a) move_sp_down finalStack | delta > 64 = toOL [STU II32 sp (AddrRegImm sp (ImmInt (-delta))), DELTA (-delta)] | otherwise = nilOL where delta = stackDelta finalStack move_sp_up finalStack | delta > 64 = toOL [ADD sp sp (RIImm (ImmInt delta)), DELTA 0] | otherwise = nilOL where delta = stackDelta finalStack passArguments [] _ _ stackOffset accumCode accumUsed = return (stackOffset, accumCode, accumUsed) passArguments ((arg,arg_ty):args) gprs fprs stackOffset accumCode accumUsed | isWord64 arg_ty = do ChildCode64 code vr_lo <- iselExpr64 arg let vr_hi = getHiVRegFromLo vr_lo case gcp of GCPDarwin -> do let storeWord vr (gpr:_) _ = MR gpr vr storeWord vr [] offset = ST II32 vr (AddrRegImm sp (ImmInt offset)) passArguments args (drop 2 gprs) fprs (stackOffset+8) (accumCode `appOL` code `snocOL` storeWord vr_hi gprs stackOffset `snocOL` storeWord vr_lo (drop 1 gprs) (stackOffset+4)) ((take 2 gprs) ++ accumUsed) GCPLinux -> do let stackOffset' = roundTo 8 stackOffset stackCode = accumCode `appOL` code `snocOL` ST II32 vr_hi (AddrRegImm sp (ImmInt stackOffset')) `snocOL` ST II32 vr_lo (AddrRegImm sp (ImmInt (stackOffset'+4))) regCode hireg loreg = accumCode `appOL` code `snocOL` MR hireg vr_hi `snocOL` MR loreg vr_lo case gprs of hireg : loreg : regs | even (length gprs) -> passArguments args regs fprs stackOffset (regCode hireg loreg) (hireg : loreg : accumUsed) _skipped : hireg : loreg : regs -> passArguments args regs fprs stackOffset (regCode hireg loreg) (hireg : loreg : accumUsed) _ -> -- only one or no regs left passArguments args [] fprs (stackOffset'+8) stackCode accumUsed passArguments ((arg,rep):args) gprs fprs stackOffset accumCode accumUsed | reg : _ <- regs = do register <- getRegister arg let code = case register of Fixed _ freg fcode -> fcode `snocOL` MR reg freg Any _ acode -> acode reg stackOffsetRes = case gcp of -- The Darwin ABI requires that we reserve -- stack slots for register parameters GCPDarwin -> stackOffset + stackBytes -- ... the SysV ABI doesn't. GCPLinux -> stackOffset passArguments args (drop nGprs gprs) (drop nFprs fprs) stackOffsetRes (accumCode `appOL` code) (reg : accumUsed) | otherwise = do (vr, code) <- getSomeReg arg passArguments args (drop nGprs gprs) (drop nFprs fprs) (stackOffset' + stackBytes) (accumCode `appOL` code `snocOL` ST (cmmTypeSize rep) vr stackSlot) accumUsed where stackOffset' = case gcp of GCPDarwin -> -- stackOffset is at least 4-byte aligned -- The Darwin ABI is happy with that. stackOffset GCPLinux -- ... the SysV ABI requires 8-byte -- alignment for doubles. | isFloatType rep && typeWidth rep == W64 -> roundTo 8 stackOffset | otherwise -> stackOffset stackSlot = AddrRegImm sp (ImmInt stackOffset') (nGprs, nFprs, stackBytes, regs) = case gcp of GCPDarwin -> case cmmTypeSize rep of II8 -> (1, 0, 4, gprs) II32 -> (1, 0, 4, gprs) -- The Darwin ABI requires that we skip a -- corresponding number of GPRs when we use -- the FPRs. FF32 -> (1, 1, 4, fprs) FF64 -> (2, 1, 8, fprs) II16 -> panic "genCCall' passArguments II16" II64 -> panic "genCCall' passArguments II64" FF80 -> panic "genCCall' passArguments FF80" GCPLinux -> case cmmTypeSize rep of II8 -> (1, 0, 4, gprs) II32 -> (1, 0, 4, gprs) -- ... the SysV ABI doesn't. FF32 -> (0, 1, 4, fprs) FF64 -> (0, 1, 8, fprs) II16 -> panic "genCCall' passArguments II16" II64 -> panic "genCCall' passArguments II64" FF80 -> panic "genCCall' passArguments FF80" moveResult reduceToFF32 = case dest_regs of [] -> nilOL [CmmHinted dest _hint] | reduceToFF32 && isFloat32 rep -> unitOL (FRSP r_dest f1) | isFloat32 rep || isFloat64 rep -> unitOL (MR r_dest f1) | isWord64 rep -> toOL [MR (getHiVRegFromLo r_dest) r3, MR r_dest r4] | otherwise -> unitOL (MR r_dest r3) where rep = cmmRegType (CmmLocal dest) r_dest = getRegisterReg (CmmLocal dest) _ -> panic "genCCall' moveResult: Bad dest_regs" outOfLineMachOp mop = do dflags <- getDynFlagsNat mopExpr <- cmmMakeDynamicReference dflags addImportNat CallReference $ mkForeignLabel functionName Nothing ForeignLabelInThisPackage IsFunction let mopLabelOrExpr = case mopExpr of CmmLit (CmmLabel lbl) -> Left lbl _ -> Right mopExpr return (mopLabelOrExpr, reduce) where (functionName, reduce) = case mop of MO_F32_Exp -> (fsLit "exp", True) MO_F32_Log -> (fsLit "log", True) MO_F32_Sqrt -> (fsLit "sqrt", True) MO_F32_Sin -> (fsLit "sin", True) MO_F32_Cos -> (fsLit "cos", True) MO_F32_Tan -> (fsLit "tan", True) MO_F32_Asin -> (fsLit "asin", True) MO_F32_Acos -> (fsLit "acos", True) MO_F32_Atan -> (fsLit "atan", True) MO_F32_Sinh -> (fsLit "sinh", True) MO_F32_Cosh -> (fsLit "cosh", True) MO_F32_Tanh -> (fsLit "tanh", True) MO_F32_Pwr -> (fsLit "pow", True) MO_F64_Exp -> (fsLit "exp", False) MO_F64_Log -> (fsLit "log", False) MO_F64_Sqrt -> (fsLit "sqrt", False) MO_F64_Sin -> (fsLit "sin", False) MO_F64_Cos -> (fsLit "cos", False) MO_F64_Tan -> (fsLit "tan", False) MO_F64_Asin -> (fsLit "asin", False) MO_F64_Acos -> (fsLit "acos", False) MO_F64_Atan -> (fsLit "atan", False) MO_F64_Sinh -> (fsLit "sinh", False) MO_F64_Cosh -> (fsLit "cosh", False) MO_F64_Tanh -> (fsLit "tanh", False) MO_F64_Pwr -> (fsLit "pow", False) MO_Memcpy -> (fsLit "memcpy", False) MO_Memset -> (fsLit "memset", False) MO_Memmove -> (fsLit "memmove", False) MO_PopCnt w -> (fsLit $ popCntLabel w, False) MO_WriteBarrier -> panic $ "outOfLineCmmOp: MO_WriteBarrier not supported" MO_Touch -> panic $ "outOfLineCmmOp: MO_Touch not supported" -- ----------------------------------------------------------------------------- -- Generating a table-branch
12,260
false
false
9
26
6,339
2,420
1,269
1,151
null
null
fpco/hlint
data/Default.hs
bsd-3-clause
warn = flip mapM ==> Control.Monad.forM where _ = noQuickCheck
63
warn = flip mapM ==> Control.Monad.forM where _ = noQuickCheck
63
warn = flip mapM ==> Control.Monad.forM where _ = noQuickCheck
63
false
false
1
7
10
34
14
20
null
null
AlexeyRaga/eta
compiler/ETA/CodeGen/Prim.hs
bsd-3-clause
emitPrimOp op [arg] | nopOp op = return [arg]
47
emitPrimOp op [arg] | nopOp op = return [arg]
47
emitPrimOp op [arg] | nopOp op = return [arg]
47
false
false
0
8
10
29
13
16
null
null
NickAger/LearningHaskell
haskellForMacMiscPlayground/poster2.hsproj/poster2.hs
mit
main = do folderImg <- getDataFileName "folder.png" filesImg <- getDataFileName "files.png" pdp7 <- getDataFileName "pdp7_3.png" let images = [folderImg, filesImg, pdp7] defaultMain (tlcPoster images) -- other stuff
226
main = do folderImg <- getDataFileName "folder.png" filesImg <- getDataFileName "files.png" pdp7 <- getDataFileName "pdp7_3.png" let images = [folderImg, filesImg, pdp7] defaultMain (tlcPoster images) -- other stuff
226
main = do folderImg <- getDataFileName "folder.png" filesImg <- getDataFileName "files.png" pdp7 <- getDataFileName "pdp7_3.png" let images = [folderImg, filesImg, pdp7] defaultMain (tlcPoster images) -- other stuff
226
false
false
0
10
37
67
31
36
null
null
olorin/git-vogue
src/git-vogue-cabal.hs
bsd-3-clause
check :: IO Bool check = do pdfile <- defaultPackageDesc silent ppd <- readPackageDescription silent pdfile let pkg_desc = flattenPackageDescription ppd ioChecks <- checkPackageFiles pkg_desc "." let packageChecks = filter goodCheck $ ioChecks <> checkPackage ppd (Just pkg_desc) buildImpossible = [ x | x@PackageBuildImpossible {} <- packageChecks ] buildWarning = [ x | x@PackageBuildWarning {} <- packageChecks ] distSuspicious = [ x | x@PackageDistSuspicious{} <- packageChecks ] distInexusable = [ x | x@PackageDistInexcusable {} <- packageChecks ] unless (null buildImpossible) $ do outputBad "The package will not build sanely due to these errors:" printCheckMessages buildImpossible unless (null buildWarning) $ do outputBad "The following warnings are likely affect your build negatively:" printCheckMessages buildWarning unless (null distSuspicious) $ do outputBad "These warnings may cause trouble when distributing the package:" printCheckMessages distSuspicious unless (null distInexusable) $ do outputBad "The following errors will cause portability problems on other environments:" printCheckMessages distInexusable let isDistError (PackageDistSuspicious {}) = False isDistError _ = True errors = filter isDistError packageChecks unless (null errors) $ outputBad "Hackage would reject this package." when (null packageChecks) $ outputGood "Checked cabal file" return (null packageChecks) where goodCheck (PackageDistSuspicious msg) = not $ "ghc-options: -O2" `isInfixOf` msg goodCheck _ = True printCheckMessages = mapM_ (outputBad . format . explanation) format = toUTF8 . wrapText . ("* "++)
1,850
check :: IO Bool check = do pdfile <- defaultPackageDesc silent ppd <- readPackageDescription silent pdfile let pkg_desc = flattenPackageDescription ppd ioChecks <- checkPackageFiles pkg_desc "." let packageChecks = filter goodCheck $ ioChecks <> checkPackage ppd (Just pkg_desc) buildImpossible = [ x | x@PackageBuildImpossible {} <- packageChecks ] buildWarning = [ x | x@PackageBuildWarning {} <- packageChecks ] distSuspicious = [ x | x@PackageDistSuspicious{} <- packageChecks ] distInexusable = [ x | x@PackageDistInexcusable {} <- packageChecks ] unless (null buildImpossible) $ do outputBad "The package will not build sanely due to these errors:" printCheckMessages buildImpossible unless (null buildWarning) $ do outputBad "The following warnings are likely affect your build negatively:" printCheckMessages buildWarning unless (null distSuspicious) $ do outputBad "These warnings may cause trouble when distributing the package:" printCheckMessages distSuspicious unless (null distInexusable) $ do outputBad "The following errors will cause portability problems on other environments:" printCheckMessages distInexusable let isDistError (PackageDistSuspicious {}) = False isDistError _ = True errors = filter isDistError packageChecks unless (null errors) $ outputBad "Hackage would reject this package." when (null packageChecks) $ outputGood "Checked cabal file" return (null packageChecks) where goodCheck (PackageDistSuspicious msg) = not $ "ghc-options: -O2" `isInfixOf` msg goodCheck _ = True printCheckMessages = mapM_ (outputBad . format . explanation) format = toUTF8 . wrapText . ("* "++)
1,850
check = do pdfile <- defaultPackageDesc silent ppd <- readPackageDescription silent pdfile let pkg_desc = flattenPackageDescription ppd ioChecks <- checkPackageFiles pkg_desc "." let packageChecks = filter goodCheck $ ioChecks <> checkPackage ppd (Just pkg_desc) buildImpossible = [ x | x@PackageBuildImpossible {} <- packageChecks ] buildWarning = [ x | x@PackageBuildWarning {} <- packageChecks ] distSuspicious = [ x | x@PackageDistSuspicious{} <- packageChecks ] distInexusable = [ x | x@PackageDistInexcusable {} <- packageChecks ] unless (null buildImpossible) $ do outputBad "The package will not build sanely due to these errors:" printCheckMessages buildImpossible unless (null buildWarning) $ do outputBad "The following warnings are likely affect your build negatively:" printCheckMessages buildWarning unless (null distSuspicious) $ do outputBad "These warnings may cause trouble when distributing the package:" printCheckMessages distSuspicious unless (null distInexusable) $ do outputBad "The following errors will cause portability problems on other environments:" printCheckMessages distInexusable let isDistError (PackageDistSuspicious {}) = False isDistError _ = True errors = filter isDistError packageChecks unless (null errors) $ outputBad "Hackage would reject this package." when (null packageChecks) $ outputGood "Checked cabal file" return (null packageChecks) where goodCheck (PackageDistSuspicious msg) = not $ "ghc-options: -O2" `isInfixOf` msg goodCheck _ = True printCheckMessages = mapM_ (outputBad . format . explanation) format = toUTF8 . wrapText . ("* "++)
1,833
false
true
3
14
455
463
214
249
null
null
sdiehl/ghc
libraries/base/Data/Typeable.hs
bsd-3-clause
-- | Applies a type to a function type. Returns: @Just u@ if the first argument -- represents a function of type @t -> u@ and the second argument represents a -- function of type @t@. Otherwise, returns @Nothing@. funResultTy :: TypeRep -> TypeRep -> Maybe TypeRep funResultTy (I.SomeTypeRep f) (I.SomeTypeRep x) | Just HRefl <- (I.typeRep :: I.TypeRep Type) `I.eqTypeRep` I.typeRepKind f , I.Fun arg res <- f , Just HRefl <- arg `I.eqTypeRep` x = Just (I.SomeTypeRep res) | otherwise = Nothing
504
funResultTy :: TypeRep -> TypeRep -> Maybe TypeRep funResultTy (I.SomeTypeRep f) (I.SomeTypeRep x) | Just HRefl <- (I.typeRep :: I.TypeRep Type) `I.eqTypeRep` I.typeRepKind f , I.Fun arg res <- f , Just HRefl <- arg `I.eqTypeRep` x = Just (I.SomeTypeRep res) | otherwise = Nothing
290
funResultTy (I.SomeTypeRep f) (I.SomeTypeRep x) | Just HRefl <- (I.typeRep :: I.TypeRep Type) `I.eqTypeRep` I.typeRepKind f , I.Fun arg res <- f , Just HRefl <- arg `I.eqTypeRep` x = Just (I.SomeTypeRep res) | otherwise = Nothing
239
true
true
0
12
93
144
70
74
null
null
jecisc/TP_PF_L3
PF-TP3/.dist-buildwrapper/dist/build/autogen/Paths_PF_TP3.hs
mit
getLibDir = catchIO (getEnv "PF_TP3_libdir") (\_ -> return libdir)
66
getLibDir = catchIO (getEnv "PF_TP3_libdir") (\_ -> return libdir)
66
getLibDir = catchIO (getEnv "PF_TP3_libdir") (\_ -> return libdir)
66
false
false
1
8
8
33
14
19
null
null
blamario/incremental-parser
src/Text/ParserCombinators/Incremental.hs
gpl-3.0
string :: (LeftReductive s, MonoidNull s, Semigroup s) => s -> Parser t s s string x | null x = mempty
102
string :: (LeftReductive s, MonoidNull s, Semigroup s) => s -> Parser t s s string x | null x = mempty
102
string x | null x = mempty
26
false
true
0
8
21
60
27
33
null
null
enolan/cabal
cabal-install/Main.hs
bsd-3-clause
sandboxAction :: SandboxFlags -> [String] -> Action sandboxAction sandboxFlags extraArgs globalFlags = do let verbosity = fromFlag (sandboxVerbosity sandboxFlags) case extraArgs of -- Basic sandbox commands. ["init"] -> sandboxInit verbosity sandboxFlags globalFlags ["delete"] -> sandboxDelete verbosity sandboxFlags globalFlags ("add-source":extra) -> do when (noExtraArgs extra) $ die "The 'sandbox add-source' command expects at least one argument" sandboxAddSource verbosity extra sandboxFlags globalFlags ("delete-source":extra) -> do when (noExtraArgs extra) $ die ("The 'sandbox delete-source' command expects " ++ "at least one argument") sandboxDeleteSource verbosity extra sandboxFlags globalFlags ["list-sources"] -> sandboxListSources verbosity sandboxFlags globalFlags -- More advanced commands. ("hc-pkg":extra) -> do when (noExtraArgs extra) $ die $ "The 'sandbox hc-pkg' command expects at least one argument" sandboxHcPkg verbosity sandboxFlags globalFlags extra ["buildopts"] -> die "Not implemented!" -- Hidden commands. ["dump-pkgenv"] -> dumpPackageEnvironment verbosity sandboxFlags globalFlags -- Error handling. [] -> die $ "Please specify a subcommand (see 'help sandbox')" _ -> die $ "Unknown 'sandbox' subcommand: " ++ unwords extraArgs where noExtraArgs = (<1) . length
1,464
sandboxAction :: SandboxFlags -> [String] -> Action sandboxAction sandboxFlags extraArgs globalFlags = do let verbosity = fromFlag (sandboxVerbosity sandboxFlags) case extraArgs of -- Basic sandbox commands. ["init"] -> sandboxInit verbosity sandboxFlags globalFlags ["delete"] -> sandboxDelete verbosity sandboxFlags globalFlags ("add-source":extra) -> do when (noExtraArgs extra) $ die "The 'sandbox add-source' command expects at least one argument" sandboxAddSource verbosity extra sandboxFlags globalFlags ("delete-source":extra) -> do when (noExtraArgs extra) $ die ("The 'sandbox delete-source' command expects " ++ "at least one argument") sandboxDeleteSource verbosity extra sandboxFlags globalFlags ["list-sources"] -> sandboxListSources verbosity sandboxFlags globalFlags -- More advanced commands. ("hc-pkg":extra) -> do when (noExtraArgs extra) $ die $ "The 'sandbox hc-pkg' command expects at least one argument" sandboxHcPkg verbosity sandboxFlags globalFlags extra ["buildopts"] -> die "Not implemented!" -- Hidden commands. ["dump-pkgenv"] -> dumpPackageEnvironment verbosity sandboxFlags globalFlags -- Error handling. [] -> die $ "Please specify a subcommand (see 'help sandbox')" _ -> die $ "Unknown 'sandbox' subcommand: " ++ unwords extraArgs where noExtraArgs = (<1) . length
1,464
sandboxAction sandboxFlags extraArgs globalFlags = do let verbosity = fromFlag (sandboxVerbosity sandboxFlags) case extraArgs of -- Basic sandbox commands. ["init"] -> sandboxInit verbosity sandboxFlags globalFlags ["delete"] -> sandboxDelete verbosity sandboxFlags globalFlags ("add-source":extra) -> do when (noExtraArgs extra) $ die "The 'sandbox add-source' command expects at least one argument" sandboxAddSource verbosity extra sandboxFlags globalFlags ("delete-source":extra) -> do when (noExtraArgs extra) $ die ("The 'sandbox delete-source' command expects " ++ "at least one argument") sandboxDeleteSource verbosity extra sandboxFlags globalFlags ["list-sources"] -> sandboxListSources verbosity sandboxFlags globalFlags -- More advanced commands. ("hc-pkg":extra) -> do when (noExtraArgs extra) $ die $ "The 'sandbox hc-pkg' command expects at least one argument" sandboxHcPkg verbosity sandboxFlags globalFlags extra ["buildopts"] -> die "Not implemented!" -- Hidden commands. ["dump-pkgenv"] -> dumpPackageEnvironment verbosity sandboxFlags globalFlags -- Error handling. [] -> die $ "Please specify a subcommand (see 'help sandbox')" _ -> die $ "Unknown 'sandbox' subcommand: " ++ unwords extraArgs where noExtraArgs = (<1) . length
1,412
false
true
1
16
327
327
157
170
null
null
Mokosha/Lambency
lib/Lambency.hs
mit
toggleWireframe :: Bool -> GameMonad () toggleWireframe b = GameMonad $ tell $ ([WireframeAction b], mempty)
108
toggleWireframe :: Bool -> GameMonad () toggleWireframe b = GameMonad $ tell $ ([WireframeAction b], mempty)
108
toggleWireframe b = GameMonad $ tell $ ([WireframeAction b], mempty)
68
false
true
0
9
15
48
23
25
null
null
ojw/relaxation
src/Main.hs
mit
randomizeBirdEvent :: State GameState () randomizeBirdEvent = do g <- fmap _gen $ get game <- get let (val :: Float, g') = randomR (0,2) g case game^.bird.event of Straight _ _ -> newCurve g Curve _ _ _ _ _ _ _ -> newStraight g bird.flapDuration .= 0.2 camera.followBird .= True where newStraight g = let (d, g'') = randomR (2, 5) g (s, g''') = randomR (200, 400) g'' in do bird.event .= Straight d s gen .= g''' newCurve g = let (d, g2) = randomR (1, 3) g (cl, g3) = randomR (0,2) g2 (cc, g4) = randomR (0,2) g3 (ga, g5) = randomR (-20,200) g4 (angs, g6) = randomR (0.5, 3) g5 (airs, g7) = randomR (200,400) g6 dr = cc in do bird.event .= Curve d cl cc ga angs airs dr gen .= g7
1,004
randomizeBirdEvent :: State GameState () randomizeBirdEvent = do g <- fmap _gen $ get game <- get let (val :: Float, g') = randomR (0,2) g case game^.bird.event of Straight _ _ -> newCurve g Curve _ _ _ _ _ _ _ -> newStraight g bird.flapDuration .= 0.2 camera.followBird .= True where newStraight g = let (d, g'') = randomR (2, 5) g (s, g''') = randomR (200, 400) g'' in do bird.event .= Straight d s gen .= g''' newCurve g = let (d, g2) = randomR (1, 3) g (cl, g3) = randomR (0,2) g2 (cc, g4) = randomR (0,2) g3 (ga, g5) = randomR (-20,200) g4 (angs, g6) = randomR (0.5, 3) g5 (airs, g7) = randomR (200,400) g6 dr = cc in do bird.event .= Curve d cl cc ga angs airs dr gen .= g7
1,004
randomizeBirdEvent = do g <- fmap _gen $ get game <- get let (val :: Float, g') = randomR (0,2) g case game^.bird.event of Straight _ _ -> newCurve g Curve _ _ _ _ _ _ _ -> newStraight g bird.flapDuration .= 0.2 camera.followBird .= True where newStraight g = let (d, g'') = randomR (2, 5) g (s, g''') = randomR (200, 400) g'' in do bird.event .= Straight d s gen .= g''' newCurve g = let (d, g2) = randomR (1, 3) g (cl, g3) = randomR (0,2) g2 (cc, g4) = randomR (0,2) g3 (ga, g5) = randomR (-20,200) g4 (angs, g6) = randomR (0.5, 3) g5 (airs, g7) = randomR (200,400) g6 dr = cc in do bird.event .= Curve d cl cc ga angs airs dr gen .= g7
963
false
true
3
11
465
424
209
215
null
null
ademinn/JavaWithClasses
src/Codegen.hs
bsd-3-clause
nextName :: Codegen A.Name nextName = do i <- gets lastInd let i' = i + 1 modify $ \s -> s { lastInd = i' } return $ A.UnName i'
144
nextName :: Codegen A.Name nextName = do i <- gets lastInd let i' = i + 1 modify $ \s -> s { lastInd = i' } return $ A.UnName i'
144
nextName = do i <- gets lastInd let i' = i + 1 modify $ \s -> s { lastInd = i' } return $ A.UnName i'
117
false
true
0
10
46
71
34
37
null
null
silkapp/bloodhound
src/Database/Bloodhound/Types.hs
bsd-3-clause
nonPostingsToPairs (Just (NonPostings npFragSize npNumOfFrags)) = [ "fragment_size" .= npFragSize , "number_of_fragments" .= npNumOfFrags]
146
nonPostingsToPairs (Just (NonPostings npFragSize npNumOfFrags)) = [ "fragment_size" .= npFragSize , "number_of_fragments" .= npNumOfFrags]
146
nonPostingsToPairs (Just (NonPostings npFragSize npNumOfFrags)) = [ "fragment_size" .= npFragSize , "number_of_fragments" .= npNumOfFrags]
146
false
false
0
8
21
38
19
19
null
null
mariusae/sstable
src/Data/SSTable/Writer.hs
bsd-3-clause
closeWriter :: Writer -> IO () closeWriter w@(Writer offset _ index h _) = do -- Ensure that the last block length is always filled in. fillLastBlockLen w index' <- liftM reverse $ readIORef index when (null index') $ error "no entries were defined" -- Write out the block count & index offset. hSeek h AbsoluteSeek 4 hPut32 h $ fromIntegral $ length index' readIORef offset >>= hPut64 h . fromIntegral -- Write out the index at the end. hSeek h SeekFromEnd 0 forM_ index' $ \(IndexEntry key blockOffset blockLength) -> do hPut32 h $ fromIntegral $ B.length key hPut64 h $ fromIntegral blockOffset hPut32 h $ fromIntegral blockLength B.hPut h key hClose h
700
closeWriter :: Writer -> IO () closeWriter w@(Writer offset _ index h _) = do -- Ensure that the last block length is always filled in. fillLastBlockLen w index' <- liftM reverse $ readIORef index when (null index') $ error "no entries were defined" -- Write out the block count & index offset. hSeek h AbsoluteSeek 4 hPut32 h $ fromIntegral $ length index' readIORef offset >>= hPut64 h . fromIntegral -- Write out the index at the end. hSeek h SeekFromEnd 0 forM_ index' $ \(IndexEntry key blockOffset blockLength) -> do hPut32 h $ fromIntegral $ B.length key hPut64 h $ fromIntegral blockOffset hPut32 h $ fromIntegral blockLength B.hPut h key hClose h
700
closeWriter w@(Writer offset _ index h _) = do -- Ensure that the last block length is always filled in. fillLastBlockLen w index' <- liftM reverse $ readIORef index when (null index') $ error "no entries were defined" -- Write out the block count & index offset. hSeek h AbsoluteSeek 4 hPut32 h $ fromIntegral $ length index' readIORef offset >>= hPut64 h . fromIntegral -- Write out the index at the end. hSeek h SeekFromEnd 0 forM_ index' $ \(IndexEntry key blockOffset blockLength) -> do hPut32 h $ fromIntegral $ B.length key hPut64 h $ fromIntegral blockOffset hPut32 h $ fromIntegral blockLength B.hPut h key hClose h
669
false
true
0
13
158
225
98
127
null
null
masaedw/PuddingX
src/Pudding/Core.hs
bsd-3-clause
lookupXt :: Monad m => ByteString -> EnvT m (PProc m) lookupXt x = do env <- get case Map.lookup x $ wordMap env of Just (NormalWord _ p _) -> return p Just (ImmediateWord _ p) -> return p Just (UserDefinedWord name x') -> return $ evalXt name x' Just (CompileOnlyWord _ p _) -> do top <- inTopLevel when top . throwError $ "Can't execute: " ++ unpack x return p Nothing -> throwError $ "undefined word: " ++ unpack x
459
lookupXt :: Monad m => ByteString -> EnvT m (PProc m) lookupXt x = do env <- get case Map.lookup x $ wordMap env of Just (NormalWord _ p _) -> return p Just (ImmediateWord _ p) -> return p Just (UserDefinedWord name x') -> return $ evalXt name x' Just (CompileOnlyWord _ p _) -> do top <- inTopLevel when top . throwError $ "Can't execute: " ++ unpack x return p Nothing -> throwError $ "undefined word: " ++ unpack x
459
lookupXt x = do env <- get case Map.lookup x $ wordMap env of Just (NormalWord _ p _) -> return p Just (ImmediateWord _ p) -> return p Just (UserDefinedWord name x') -> return $ evalXt name x' Just (CompileOnlyWord _ p _) -> do top <- inTopLevel when top . throwError $ "Can't execute: " ++ unpack x return p Nothing -> throwError $ "undefined word: " ++ unpack x
405
false
true
0
16
124
205
91
114
null
null
naoto-ogawa/h-xproto-mysql
src/DataBase/MySQLX/ExprParser.hs
mit
-- | oneOf (the same as oneOf in Parsec) oneOf :: String -> Parser Char oneOf xs = satisfy (`elem` xs)
102
oneOf :: String -> Parser Char oneOf xs = satisfy (`elem` xs)
61
oneOf xs = satisfy (`elem` xs)
30
true
true
0
6
20
31
17
14
null
null
YuichiroSato/GameOfSymbolGrounding
src/Graphics/Shapes.hs
bsd-3-clause
vertex2f :: GLfloat -> GLfloat -> IO () vertex2f x y = vertex3f x y 0
69
vertex2f :: GLfloat -> GLfloat -> IO () vertex2f x y = vertex3f x y 0
69
vertex2f x y = vertex3f x y 0
29
false
true
0
8
15
36
17
19
null
null
TransformingMusicology/tabcode-haskell
src/TabCode/Serialiser/MEIXML/Elements.hs
gpl-3.0
getChildren (TCOrnament _ cs) = cs
34
getChildren (TCOrnament _ cs) = cs
34
getChildren (TCOrnament _ cs) = cs
34
false
false
0
6
5
18
8
10
null
null
matonix/pfds
src/PFDS/Sec4/Ex2.hs
bsd-3-clause
(++) :: Stream a -> Stream a -> Stream a Nil ++ t = t
54
(++) :: Stream a -> Stream a -> Stream a Nil ++ t = t
53
Nil ++ t = t
12
false
true
0
7
15
36
17
19
null
null
lukemaurer/sequent-core
src/Language/SequentCore/WiredIn.hs
bsd-3-clause
isKontKind :: Kind -> Bool isKontKind = isJust . isKontKind_maybe
65
isKontKind :: Kind -> Bool isKontKind = isJust . isKontKind_maybe
65
isKontKind = isJust . isKontKind_maybe
38
false
true
0
5
9
19
10
9
null
null
gimbo/cabal-macosx
Distribution/MacOSX/DG.hs
bsd-3-clause
-- | Turn a dependency graph back into a list of FDeps. dgFDeps :: DG -> [FDeps] dgFDeps (DG g) = map mkFDep (G.labNodes g) where mkFDep :: G.LNode FilePath -> FDeps mkFDep (i, src) = FDeps src $ mapMaybe (G.lab g) (G.suc g i) -- | Create an empty dependency graph.
276
dgFDeps :: DG -> [FDeps] dgFDeps (DG g) = map mkFDep (G.labNodes g) where mkFDep :: G.LNode FilePath -> FDeps mkFDep (i, src) = FDeps src $ mapMaybe (G.lab g) (G.suc g i) -- | Create an empty dependency graph.
220
dgFDeps (DG g) = map mkFDep (G.labNodes g) where mkFDep :: G.LNode FilePath -> FDeps mkFDep (i, src) = FDeps src $ mapMaybe (G.lab g) (G.suc g i) -- | Create an empty dependency graph.
195
true
true
2
9
62
102
52
50
null
null
ghcjs/jsaddle-dom
src/JSDOM/Generated/FileList.hs
mit
-- | <https://developer.mozilla.org/en-US/docs/Web/API/FileList.item Mozilla FileList.item documentation> item :: (MonadDOM m) => FileList -> Word -> m (Maybe File) item self index = liftDOM ((self ^. jsf "item" [toJSVal index]) >>= fromJSVal)
246
item :: (MonadDOM m) => FileList -> Word -> m (Maybe File) item self index = liftDOM ((self ^. jsf "item" [toJSVal index]) >>= fromJSVal)
139
item self index = liftDOM ((self ^. jsf "item" [toJSVal index]) >>= fromJSVal)
80
true
true
0
12
33
71
36
35
null
null
fmapfmapfmap/amazonka
amazonka-devicefarm/gen/Network/AWS/DeviceFarm/Types/Product.hs
mpl-2.0
-- | Information about the associated device. pDevice :: Lens' Problem (Maybe Device) pDevice = lens _pDevice (\ s a -> s{_pDevice = a})
136
pDevice :: Lens' Problem (Maybe Device) pDevice = lens _pDevice (\ s a -> s{_pDevice = a})
90
pDevice = lens _pDevice (\ s a -> s{_pDevice = a})
50
true
true
0
9
23
46
25
21
null
null
arekfu/funpart
src/Physics/FunPart/MC.hs
bsd-3-clause
sampleIsoVec :: MonadState StdGen m => FPFloat -> m FPVec3 sampleIsoVec norm = do u <- uniform v <- uniform let theta = 2.0 * u - 1.0 phi = twoPi * v x = norm * sin theta * cos phi y = norm * sin theta * sin phi z = norm * cos theta in return $ Vec3 x y z
304
sampleIsoVec :: MonadState StdGen m => FPFloat -> m FPVec3 sampleIsoVec norm = do u <- uniform v <- uniform let theta = 2.0 * u - 1.0 phi = twoPi * v x = norm * sin theta * cos phi y = norm * sin theta * sin phi z = norm * cos theta in return $ Vec3 x y z
304
sampleIsoVec norm = do u <- uniform v <- uniform let theta = 2.0 * u - 1.0 phi = twoPi * v x = norm * sin theta * cos phi y = norm * sin theta * sin phi z = norm * cos theta in return $ Vec3 x y z
245
false
true
0
13
112
136
64
72
null
null
amccausl/Swish
Swish/HaskellUtils/LookupMapTest.hs
lgpl-2.1
testLookupMapFind34b = testLookupMapFind "34b" lm34 4 "ddd34"
61
testLookupMapFind34b = testLookupMapFind "34b" lm34 4 "ddd34"
61
testLookupMapFind34b = testLookupMapFind "34b" lm34 4 "ddd34"
61
false
false
1
5
6
19
7
12
null
null
riottracker/modfile
src/Codec/Tracker/S3M/Header.hs
bsd-3-clause
-- | Read a `Header` from the monad state. getHeader :: Get Header getHeader = label "S3M.Header" $ Header <$> replicateM 28 getWord8 <*> getWord8 <*> getWord8 <*> getWord16le <*> getWord16le <*> getWord16le <*> getWord16le <*> getWord16le <*> getWord16le <*> getWord16le <*> getWord32le <*> getWord8 <*> getWord8 <*> getWord8 <*> getWord8 <*> getWord8 <*> getWord8 <*> replicateM 8 getWord8 <*> getWord16le <*> replicateM 32 getWord8
807
getHeader :: Get Header getHeader = label "S3M.Header" $ Header <$> replicateM 28 getWord8 <*> getWord8 <*> getWord8 <*> getWord16le <*> getWord16le <*> getWord16le <*> getWord16le <*> getWord16le <*> getWord16le <*> getWord16le <*> getWord32le <*> getWord8 <*> getWord8 <*> getWord8 <*> getWord8 <*> getWord8 <*> getWord8 <*> replicateM 8 getWord8 <*> getWord16le <*> replicateM 32 getWord8
764
getHeader = label "S3M.Header" $ Header <$> replicateM 28 getWord8 <*> getWord8 <*> getWord8 <*> getWord16le <*> getWord16le <*> getWord16le <*> getWord16le <*> getWord16le <*> getWord16le <*> getWord16le <*> getWord32le <*> getWord8 <*> getWord8 <*> getWord8 <*> getWord8 <*> getWord8 <*> getWord8 <*> replicateM 8 getWord8 <*> getWord16le <*> replicateM 32 getWord8
740
true
true
0
26
437
117
57
60
null
null
radix/json-log-viewer
src/JsonLogViewer/FilterDialog.hs
mit
makeFilterDialog :: T.Text -- ^ Name of the dialog -> IO () -- ^ action for switching away from the filter dialog when accepting/canceling -> IO (FilterDialog, UI.Dialog, UI.Widget UI.FocusGroup) makeFilterDialog dialogName switchToMain = do (nameEdit, nameField) <- makeEditField "Filter Name:" (jsonPathEdit, jsonPathField) <- makeEditField "JSON Path:" parseStatusText <- UI.plainText "Please Enter a JSON Path." parseStatusField <- makeField "Parse status:" parseStatusText operatorLabel <- UI.plainText "Operator:" operatorRadioGroup <- UI.newRadioGroup equalsCheck <- UI.newCheckbox "Equals" substringCheck <- UI.newCheckbox "Has Substring" hasKeyCheck <- UI.newCheckbox "Has Key" UI.addToRadioGroup operatorRadioGroup equalsCheck UI.addToRadioGroup operatorRadioGroup substringCheck UI.addToRadioGroup operatorRadioGroup hasKeyCheck UI.setCheckboxChecked substringCheck operatorRadioChecks'' <- UI.hBox substringCheck hasKeyCheck operatorRadioChecks' <- UI.hBox equalsCheck operatorRadioChecks'' operatorRadioChecks <- UI.hBox operatorLabel operatorRadioChecks' (operandEdit, operandField) <- makeEditField "Operand:" dialogBody <- UI.newTable [UI.column UI.ColAuto] UI.BorderNone let addRow = UI.addRow dialogBody addRow nameField addRow jsonPathField addRow parseStatusField addRow operatorRadioChecks addRow operandField (filterDialog, filterFg) <- UI.newDialog dialogBody dialogName let returnKeyMeansNext = [nameEdit, jsonPathEdit, operandEdit] forM_ returnKeyMeansNext (`UI.onActivate` (\_ -> UI.focusNext filterFg)) let addFocus = void . UI.addToFocusGroup filterFg addFocus nameEdit addFocus jsonPathEdit addFocus equalsCheck addFocus substringCheck addFocus hasKeyCheck addFocus operandEdit jsonPathEdit `UI.onChange` \text -> do let path = Parser.getPath $ T.unpack text case path of (Left e) -> UI.setText parseStatusText $ T.pack $ show e (Right _) -> UI.setText parseStatusText "Valid! :-)" filterFg `UI.onKeyPressed` \_ key _ -> case key of Events.KEsc -> UI.cancelDialog filterDialog >> return True _ -> return False filterDialog `UI.onDialogCancel` const switchToMain let fd = FilterDialog { nameEdit , jsonPathEdit , operandEdit , operatorRadioGroup , equalsCheck , substringCheck , hasKeyCheck } return (fd, filterDialog, filterFg) -- | Create a Filter based on the contents of a filter-editing dialog.
2,473
makeFilterDialog :: T.Text -- ^ Name of the dialog -> IO () -- ^ action for switching away from the filter dialog when accepting/canceling -> IO (FilterDialog, UI.Dialog, UI.Widget UI.FocusGroup) makeFilterDialog dialogName switchToMain = do (nameEdit, nameField) <- makeEditField "Filter Name:" (jsonPathEdit, jsonPathField) <- makeEditField "JSON Path:" parseStatusText <- UI.plainText "Please Enter a JSON Path." parseStatusField <- makeField "Parse status:" parseStatusText operatorLabel <- UI.plainText "Operator:" operatorRadioGroup <- UI.newRadioGroup equalsCheck <- UI.newCheckbox "Equals" substringCheck <- UI.newCheckbox "Has Substring" hasKeyCheck <- UI.newCheckbox "Has Key" UI.addToRadioGroup operatorRadioGroup equalsCheck UI.addToRadioGroup operatorRadioGroup substringCheck UI.addToRadioGroup operatorRadioGroup hasKeyCheck UI.setCheckboxChecked substringCheck operatorRadioChecks'' <- UI.hBox substringCheck hasKeyCheck operatorRadioChecks' <- UI.hBox equalsCheck operatorRadioChecks'' operatorRadioChecks <- UI.hBox operatorLabel operatorRadioChecks' (operandEdit, operandField) <- makeEditField "Operand:" dialogBody <- UI.newTable [UI.column UI.ColAuto] UI.BorderNone let addRow = UI.addRow dialogBody addRow nameField addRow jsonPathField addRow parseStatusField addRow operatorRadioChecks addRow operandField (filterDialog, filterFg) <- UI.newDialog dialogBody dialogName let returnKeyMeansNext = [nameEdit, jsonPathEdit, operandEdit] forM_ returnKeyMeansNext (`UI.onActivate` (\_ -> UI.focusNext filterFg)) let addFocus = void . UI.addToFocusGroup filterFg addFocus nameEdit addFocus jsonPathEdit addFocus equalsCheck addFocus substringCheck addFocus hasKeyCheck addFocus operandEdit jsonPathEdit `UI.onChange` \text -> do let path = Parser.getPath $ T.unpack text case path of (Left e) -> UI.setText parseStatusText $ T.pack $ show e (Right _) -> UI.setText parseStatusText "Valid! :-)" filterFg `UI.onKeyPressed` \_ key _ -> case key of Events.KEsc -> UI.cancelDialog filterDialog >> return True _ -> return False filterDialog `UI.onDialogCancel` const switchToMain let fd = FilterDialog { nameEdit , jsonPathEdit , operandEdit , operatorRadioGroup , equalsCheck , substringCheck , hasKeyCheck } return (fd, filterDialog, filterFg) -- | Create a Filter based on the contents of a filter-editing dialog.
2,473
makeFilterDialog dialogName switchToMain = do (nameEdit, nameField) <- makeEditField "Filter Name:" (jsonPathEdit, jsonPathField) <- makeEditField "JSON Path:" parseStatusText <- UI.plainText "Please Enter a JSON Path." parseStatusField <- makeField "Parse status:" parseStatusText operatorLabel <- UI.plainText "Operator:" operatorRadioGroup <- UI.newRadioGroup equalsCheck <- UI.newCheckbox "Equals" substringCheck <- UI.newCheckbox "Has Substring" hasKeyCheck <- UI.newCheckbox "Has Key" UI.addToRadioGroup operatorRadioGroup equalsCheck UI.addToRadioGroup operatorRadioGroup substringCheck UI.addToRadioGroup operatorRadioGroup hasKeyCheck UI.setCheckboxChecked substringCheck operatorRadioChecks'' <- UI.hBox substringCheck hasKeyCheck operatorRadioChecks' <- UI.hBox equalsCheck operatorRadioChecks'' operatorRadioChecks <- UI.hBox operatorLabel operatorRadioChecks' (operandEdit, operandField) <- makeEditField "Operand:" dialogBody <- UI.newTable [UI.column UI.ColAuto] UI.BorderNone let addRow = UI.addRow dialogBody addRow nameField addRow jsonPathField addRow parseStatusField addRow operatorRadioChecks addRow operandField (filterDialog, filterFg) <- UI.newDialog dialogBody dialogName let returnKeyMeansNext = [nameEdit, jsonPathEdit, operandEdit] forM_ returnKeyMeansNext (`UI.onActivate` (\_ -> UI.focusNext filterFg)) let addFocus = void . UI.addToFocusGroup filterFg addFocus nameEdit addFocus jsonPathEdit addFocus equalsCheck addFocus substringCheck addFocus hasKeyCheck addFocus operandEdit jsonPathEdit `UI.onChange` \text -> do let path = Parser.getPath $ T.unpack text case path of (Left e) -> UI.setText parseStatusText $ T.pack $ show e (Right _) -> UI.setText parseStatusText "Valid! :-)" filterFg `UI.onKeyPressed` \_ key _ -> case key of Events.KEsc -> UI.cancelDialog filterDialog >> return True _ -> return False filterDialog `UI.onDialogCancel` const switchToMain let fd = FilterDialog { nameEdit , jsonPathEdit , operandEdit , operatorRadioGroup , equalsCheck , substringCheck , hasKeyCheck } return (fd, filterDialog, filterFg) -- | Create a Filter based on the contents of a filter-editing dialog.
2,271
false
true
1
19
409
665
309
356
null
null
ajnsit/glambda
src/Language/Glambda/Type.hs
bsd-3-clause
-- | Convert a 'Ty' into an 'STy'. refineTy :: Ty -> (forall ty. STy ty -> r) -> r refineTy (ty1 `Arr` ty2) k = refineTy ty1 $ \sty1 -> refineTy ty2 $ \sty2 -> k (sty1 `SArr` sty2)
190
refineTy :: Ty -> (forall ty. STy ty -> r) -> r refineTy (ty1 `Arr` ty2) k = refineTy ty1 $ \sty1 -> refineTy ty2 $ \sty2 -> k (sty1 `SArr` sty2)
155
refineTy (ty1 `Arr` ty2) k = refineTy ty1 $ \sty1 -> refineTy ty2 $ \sty2 -> k (sty1 `SArr` sty2)
107
true
true
0
11
49
85
46
39
null
null
lenary/AchtungMinen
AchtungMinen/Game.hs
bsd-3-clause
flagCoord :: Coord -> TrialM Response flagCoord c = do liftIO $ print ("Flagged", c) t <- get put t { flags = L.nub (c:flags t) } return Flagged -- | Have they flagged all the mines (extra flags are ok)
211
flagCoord :: Coord -> TrialM Response flagCoord c = do liftIO $ print ("Flagged", c) t <- get put t { flags = L.nub (c:flags t) } return Flagged -- | Have they flagged all the mines (extra flags are ok)
211
flagCoord c = do liftIO $ print ("Flagged", c) t <- get put t { flags = L.nub (c:flags t) } return Flagged -- | Have they flagged all the mines (extra flags are ok)
173
false
true
0
13
49
80
38
42
null
null
pparkkin/eta
libraries/eta-boot/Eta/Serialized.hs
bsd-3-clause
deserializeFixedWidthNum :: forall a b. (Integral a, FiniteBits a) => [Word8] -> (a -> [Word8] -> b) -> b deserializeFixedWidthNum bytes k = go (finiteBitSize (undefined :: a)) bytes k where go :: Int -> [Word8] -> (a -> [Word8] -> b) -> b go size bytes k | size <= 0 = k 0 bytes | otherwise = case bytes of (byte:bytes) -> go (size - 8) bytes (\x -> k ((x `shiftL` 8) .|. fromIntegral byte)) [] -> error "deserializeFixedWidthNum: unexpected end of stream"
537
deserializeFixedWidthNum :: forall a b. (Integral a, FiniteBits a) => [Word8] -> (a -> [Word8] -> b) -> b deserializeFixedWidthNum bytes k = go (finiteBitSize (undefined :: a)) bytes k where go :: Int -> [Word8] -> (a -> [Word8] -> b) -> b go size bytes k | size <= 0 = k 0 bytes | otherwise = case bytes of (byte:bytes) -> go (size - 8) bytes (\x -> k ((x `shiftL` 8) .|. fromIntegral byte)) [] -> error "deserializeFixedWidthNum: unexpected end of stream"
537
deserializeFixedWidthNum bytes k = go (finiteBitSize (undefined :: a)) bytes k where go :: Int -> [Word8] -> (a -> [Word8] -> b) -> b go size bytes k | size <= 0 = k 0 bytes | otherwise = case bytes of (byte:bytes) -> go (size - 8) bytes (\x -> k ((x `shiftL` 8) .|. fromIntegral byte)) [] -> error "deserializeFixedWidthNum: unexpected end of stream"
431
false
true
1
15
165
228
119
109
null
null
geophf/1HaskellADay
exercises/HAD/Y2020/M12/D11/Exercise.hs
mit
-- Now that we have those, use the Data.Aeson.WikiDatum.matchSet-function -- to associate lat/longs to capitals, and upload to the graph-store using -- the Graph.Query.getGraphResponse function uploadLatLongs :: Endpoint -> CapitalLocationMap -> IO String uploadLatLongs url caplocs = undefined
295
uploadLatLongs :: Endpoint -> CapitalLocationMap -> IO String uploadLatLongs url caplocs = undefined
100
uploadLatLongs url caplocs = undefined
38
true
true
0
7
38
30
16
14
null
null
pbrandwijk/chronorder
Main.hs
gpl-3.0
-- Return False so the safety question won't be asked. specSafety opts = return opts { optSafety = False }
112
specSafety opts = return opts { optSafety = False }
57
specSafety opts = return opts { optSafety = False }
57
true
false
0
7
25
21
11
10
null
null
elfeck/elfeckcom
src/Web/PostParser.hs
mit
parsePost post _ = do putHtml $ parseContent 3 (postContent post)
67
parsePost post _ = do putHtml $ parseContent 3 (postContent post)
67
parsePost post _ = do putHtml $ parseContent 3 (postContent post)
67
false
false
0
10
12
31
13
18
null
null
sgtest/haskell-module-import
src/Main.hs
mit
main = Hello.hello
18
main = Hello.hello
18
main = Hello.hello
18
false
false
0
5
2
8
4
4
null
null
m-alvarez/jhc
src/E/PrimDecode.hs
mit
star = [] :-> BKind Star
24
star = [] :-> BKind Star
24
star = [] :-> BKind Star
24
false
false
3
5
5
20
8
12
null
null
olsner/ghc
compiler/iface/IfaceType.hs
bsd-3-clause
pprIfaceForAllBndr (TvBndr tv _) = pprIfaceTvBndr True tv
64
pprIfaceForAllBndr (TvBndr tv _) = pprIfaceTvBndr True tv
64
pprIfaceForAllBndr (TvBndr tv _) = pprIfaceTvBndr True tv
64
false
false
0
7
14
22
10
12
null
null
fffej/HS-Poker
Hand.hs
bsd-3-clause
isThreeOneOneGroup :: GroupedRanks -> Bool isThreeOneOneGroup (ThreeOneOneGroup _ _ _) = True
93
isThreeOneOneGroup :: GroupedRanks -> Bool isThreeOneOneGroup (ThreeOneOneGroup _ _ _) = True
93
isThreeOneOneGroup (ThreeOneOneGroup _ _ _) = True
50
false
true
0
7
11
28
14
14
null
null
c0deaddict/project-euler
src/Part1/Problem12.hs
bsd-3-clause
altProblem12 :: Maybe Integer altProblem12 = find (\x -> nrDivisors x > 500) triangleNumbers
92
altProblem12 :: Maybe Integer altProblem12 = find (\x -> nrDivisors x > 500) triangleNumbers
92
altProblem12 = find (\x -> nrDivisors x > 500) triangleNumbers
62
false
true
0
9
13
34
17
17
null
null
ku-fpg/kansas-amber
System/Hardware/Haskino/Compiler.hs
bsd-3-clause
compileExpr (IfI16 e1 e2 e3) = compileIfSubExpr e1 e2 e3
56
compileExpr (IfI16 e1 e2 e3) = compileIfSubExpr e1 e2 e3
56
compileExpr (IfI16 e1 e2 e3) = compileIfSubExpr e1 e2 e3
56
false
false
0
7
9
26
12
14
null
null
nikita-volkov/hasql
tasty/Main/Statements.hs
mit
createEnum :: ByteString -> [ByteString] -> HQ.Statement () () createEnum name values = plain $ "create type " <> name <> " as enum (" <> mconcat (intersperse ", " (map (\x -> "'" <> x <> "'") values)) <> ")"
219
createEnum :: ByteString -> [ByteString] -> HQ.Statement () () createEnum name values = plain $ "create type " <> name <> " as enum (" <> mconcat (intersperse ", " (map (\x -> "'" <> x <> "'") values)) <> ")"
219
createEnum name values = plain $ "create type " <> name <> " as enum (" <> mconcat (intersperse ", " (map (\x -> "'" <> x <> "'") values)) <> ")"
156
false
true
6
13
51
101
48
53
null
null
valderman/data-bundle
Data/Embed/File.hs
mit
-- | Read a bundle static header from the end of a file. readStaticHeader :: Handle -> IO (Either String StaticHeader) readStaticHeader hdl = do hSeek hdl SeekFromEnd (negate bundleHeaderStaticSize) ehdr <- decode <$> BS.hGet hdl (fromInteger bundleHeaderStaticSize) case ehdr of Left e -> pure (Left $ "unable to parse static header: " ++ e) Right hdr | hdrMagicNumber hdr /= bundleMagicNumber -> pure (Left "not a bundle") | hdrVersion hdr > bundleCurrentVersion -> pure (Left "unsupported bundle version") | otherwise -> pure (Right hdr) -- | Open a file bundle. The bundle will keep an open handle to its backing -- file. The handle will be closed when the bundle is garbage collected. -- Use 'closeBundle' to close the handle before the
811
readStaticHeader :: Handle -> IO (Either String StaticHeader) readStaticHeader hdl = do hSeek hdl SeekFromEnd (negate bundleHeaderStaticSize) ehdr <- decode <$> BS.hGet hdl (fromInteger bundleHeaderStaticSize) case ehdr of Left e -> pure (Left $ "unable to parse static header: " ++ e) Right hdr | hdrMagicNumber hdr /= bundleMagicNumber -> pure (Left "not a bundle") | hdrVersion hdr > bundleCurrentVersion -> pure (Left "unsupported bundle version") | otherwise -> pure (Right hdr) -- | Open a file bundle. The bundle will keep an open handle to its backing -- file. The handle will be closed when the bundle is garbage collected. -- Use 'closeBundle' to close the handle before the
754
readStaticHeader hdl = do hSeek hdl SeekFromEnd (negate bundleHeaderStaticSize) ehdr <- decode <$> BS.hGet hdl (fromInteger bundleHeaderStaticSize) case ehdr of Left e -> pure (Left $ "unable to parse static header: " ++ e) Right hdr | hdrMagicNumber hdr /= bundleMagicNumber -> pure (Left "not a bundle") | hdrVersion hdr > bundleCurrentVersion -> pure (Left "unsupported bundle version") | otherwise -> pure (Right hdr) -- | Open a file bundle. The bundle will keep an open handle to its backing -- file. The handle will be closed when the bundle is garbage collected. -- Use 'closeBundle' to close the handle before the
692
true
true
0
14
192
177
82
95
null
null
ribag/ganeti-experiments
src/Ganeti/HTools/Program/Hcheck.hs
gpl-2.0
-- | Machine-readable keys to show depending on given level. keysData :: Level -> [String] keysData GroupLvl {} = map fst groupData
131
keysData :: Level -> [String] keysData GroupLvl {} = map fst groupData
70
keysData GroupLvl {} = map fst groupData
40
true
true
0
6
21
31
16
15
null
null
robdockins/edison
edison-core/src/Data/Edison/Assoc/PatriciaLoMap.hs
mit
intersectionWith _ (B _ _ _ _) E = E
36
intersectionWith _ (B _ _ _ _) E = E
36
intersectionWith _ (B _ _ _ _) E = E
36
false
false
0
7
9
25
12
13
null
null
rueshyna/gogol
gogol-admin-directory/gen/Network/Google/Directory/Types/Product.hs
mpl-2.0
-- | If the privilege can be restricted to an organization unit. priIsOuScopable :: Lens' Privilege (Maybe Bool) priIsOuScopable = lens _priIsOuScopable (\ s a -> s{_priIsOuScopable = a})
195
priIsOuScopable :: Lens' Privilege (Maybe Bool) priIsOuScopable = lens _priIsOuScopable (\ s a -> s{_priIsOuScopable = a})
130
priIsOuScopable = lens _priIsOuScopable (\ s a -> s{_priIsOuScopable = a})
82
true
true
0
9
36
48
25
23
null
null
brendanhay/pagerduty
src/Network/PagerDuty/REST/Users/NotificationRules.hs
mpl-2.0
-- | The id of the contact method. crContactMethodId :: Lens' (Request CreateRule s b) ContactId crContactMethodId = upd.crContactMethodId'
139
crContactMethodId :: Lens' (Request CreateRule s b) ContactId crContactMethodId = upd.crContactMethodId'
104
crContactMethodId = upd.crContactMethodId'
42
true
true
0
7
18
29
15
14
null
null
sherwoodwang/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxSTC_SH_STRING :: Int wxSTC_SH_STRING = 5
42
wxSTC_SH_STRING :: Int wxSTC_SH_STRING = 5
42
wxSTC_SH_STRING = 5
19
false
true
0
6
5
18
7
11
null
null
eigengrau/hlint
data/Default.hs
bsd-3-clause
warn "Use if" = case a of {True -> t; False -> f} ==> if a then t else f
73
warn "Use if" = case a of {True -> t; False -> f} ==> if a then t else f
73
warn "Use if" = case a of {True -> t; False -> f} ==> if a then t else f
73
false
false
2
7
20
41
20
21
null
null
bagl/takusen-oracle
Database/Test/Enumerator.hs
bsd-3-clause
iterTermEarly c1 acc = if c1 == "hello2" then return (Left (c1:acc)) else result (c1:acc)
103
iterTermEarly c1 acc = if c1 == "hello2" then return (Left (c1:acc)) else result (c1:acc)
103
iterTermEarly c1 acc = if c1 == "hello2" then return (Left (c1:acc)) else result (c1:acc)
103
false
false
1
10
28
53
25
28
null
null
gnn/Hets
OWL2/ColonKeywords.hs
gpl-2.0
typesC :: String typesC = "Types:"
34
typesC :: String typesC = "Types:"
34
typesC = "Types:"
17
false
true
0
4
5
11
6
5
null
null
enolan/cabal
Cabal/Distribution/Simple/Compiler.hs
bsd-3-clause
compilerCompatVersion :: CompilerFlavor -> Compiler -> Maybe Version compilerCompatVersion flavor comp | compilerFlavor comp == flavor = Just (compilerVersion comp) | otherwise = listToMaybe [ v | CompilerId fl v <- compilerCompat comp, fl == flavor ]
264
compilerCompatVersion :: CompilerFlavor -> Compiler -> Maybe Version compilerCompatVersion flavor comp | compilerFlavor comp == flavor = Just (compilerVersion comp) | otherwise = listToMaybe [ v | CompilerId fl v <- compilerCompat comp, fl == flavor ]
264
compilerCompatVersion flavor comp | compilerFlavor comp == flavor = Just (compilerVersion comp) | otherwise = listToMaybe [ v | CompilerId fl v <- compilerCompat comp, fl == flavor ]
195
false
true
1
9
49
86
40
46
null
null
hguenther/smtlib2
extras/emulated-datatypes/Language/SMTLib2/DatatypeEmulator.hs
gpl-3.0
linearize :: SMTType t => TransExpr t -> [SMTExpr Untyped] linearize (NormalExpr x) = [UntypedExpr x]
101
linearize :: SMTType t => TransExpr t -> [SMTExpr Untyped] linearize (NormalExpr x) = [UntypedExpr x]
101
linearize (NormalExpr x) = [UntypedExpr x]
42
false
true
0
10
15
52
23
29
null
null
vito/atomo-old
Atomo/Internals.hs
mit
pretty (ABlock es) = intercalate "\n" $ map pretty es
58
pretty (ABlock es) = intercalate "\n" $ map pretty es
58
pretty (ABlock es) = intercalate "\n" $ map pretty es
58
false
false
0
6
14
28
12
16
null
null
deciduously/Haskell-First-Principles-Exercises
2-Defining and combining/9-Lists/code/myStd.hs
mit
myMinimumBy f l = myMinimumBy f (lts l) where lts l = filter (\x -> f x (head.tail $ l) == LT) l
106
myMinimumBy f l = myMinimumBy f (lts l) where lts l = filter (\x -> f x (head.tail $ l) == LT) l
106
myMinimumBy f l = myMinimumBy f (lts l) where lts l = filter (\x -> f x (head.tail $ l) == LT) l
106
false
false
0
14
32
63
31
32
null
null
rjeli/luatalk
src/Parser.hs
bsd-3-clause
parseBlockWithArgs = brackets $ do args <- P.many1 arg match Pipe body <- P.many parseStatement return $ Block args body
128
parseBlockWithArgs = brackets $ do args <- P.many1 arg match Pipe body <- P.many parseStatement return $ Block args body
128
parseBlockWithArgs = brackets $ do args <- P.many1 arg match Pipe body <- P.many parseStatement return $ Block args body
128
false
false
0
10
27
52
22
30
null
null
triplepointfive/datatypes
src/SimpleBool.hs
mit
typeOf :: Context -> Term -> Ty typeOf _ (TmTrue _) = TyBool
72
typeOf :: Context -> Term -> Ty typeOf _ (TmTrue _) = TyBool
72
typeOf _ (TmTrue _) = TyBool
40
false
true
0
7
24
30
15
15
null
null
laura-dietz/name-tagger.hs
src/NameTagger/Matcher.hs
bsd-3-clause
isMatch _ = Nothing
29
isMatch _ = Nothing
29
isMatch _ = Nothing
29
false
false
0
4
13
10
4
6
null
null
mstksg/ghc-typelits-natnormalise
src/GHC/TypeLits/Normalise/Unify.hs
bsd-2-clause
fvSymbol :: CoreSymbol -> UniqSet TyVar fvSymbol (I _) = emptyUniqSet
71
fvSymbol :: CoreSymbol -> UniqSet TyVar fvSymbol (I _) = emptyUniqSet
71
fvSymbol (I _) = emptyUniqSet
31
false
true
0
6
12
31
14
17
null
null
kyagrd/mininax
src/Main.hs
bsd-2-clause
greet :: CmdArgs -> IO () greet (CmdArgs{..}) = do h <- maybe (return stdin) (\s -> openFile s ReadMode) argFilePath mp <- hProg h let program = case mp of { Ok p -> p; Bad msg -> error msg } let (kctx,ctx) = tiProg program -- print "================================" -- putStrLn ("length kctx = "++show(length kctx)) -- mapM_ print (reverse $ kctx) -- print "================================" -- putStrLn ("length ctx = "++show(length ctx)) -- mapM_ print (reverse $ ctx) -- print "================================" -- let uapply_u = uapply u when (flagAll || flagKi || (not flagEv && not flagTi)) $ do { mapM_ putStrLn $ reverse [ show x++" : "++ (renderN 1 . prt 1) -- (show . ty2Type) ({- uapply_u $ -} unbindSch k ) | (x,k) <- kctx ] ; putStrLn "" } when (flagAll || flagTi || (not flagKi && not flagEv)) $ do { mapM_ putStrLn $ reverse [ show x++" : "++ (renderN 1 . prt 1) -- (show . ty2Type) ({- uapply_u $ -} unbindSch t ) | (x,t) <- ctx ] ; putStrLn "" } when (flagAll || flagEv) (evProg program >> putStrLn "")
1,369
greet :: CmdArgs -> IO () greet (CmdArgs{..}) = do h <- maybe (return stdin) (\s -> openFile s ReadMode) argFilePath mp <- hProg h let program = case mp of { Ok p -> p; Bad msg -> error msg } let (kctx,ctx) = tiProg program -- print "================================" -- putStrLn ("length kctx = "++show(length kctx)) -- mapM_ print (reverse $ kctx) -- print "================================" -- putStrLn ("length ctx = "++show(length ctx)) -- mapM_ print (reverse $ ctx) -- print "================================" -- let uapply_u = uapply u when (flagAll || flagKi || (not flagEv && not flagTi)) $ do { mapM_ putStrLn $ reverse [ show x++" : "++ (renderN 1 . prt 1) -- (show . ty2Type) ({- uapply_u $ -} unbindSch k ) | (x,k) <- kctx ] ; putStrLn "" } when (flagAll || flagTi || (not flagKi && not flagEv)) $ do { mapM_ putStrLn $ reverse [ show x++" : "++ (renderN 1 . prt 1) -- (show . ty2Type) ({- uapply_u $ -} unbindSch t ) | (x,t) <- ctx ] ; putStrLn "" } when (flagAll || flagEv) (evProg program >> putStrLn "")
1,369
greet (CmdArgs{..}) = do h <- maybe (return stdin) (\s -> openFile s ReadMode) argFilePath mp <- hProg h let program = case mp of { Ok p -> p; Bad msg -> error msg } let (kctx,ctx) = tiProg program -- print "================================" -- putStrLn ("length kctx = "++show(length kctx)) -- mapM_ print (reverse $ kctx) -- print "================================" -- putStrLn ("length ctx = "++show(length ctx)) -- mapM_ print (reverse $ ctx) -- print "================================" -- let uapply_u = uapply u when (flagAll || flagKi || (not flagEv && not flagTi)) $ do { mapM_ putStrLn $ reverse [ show x++" : "++ (renderN 1 . prt 1) -- (show . ty2Type) ({- uapply_u $ -} unbindSch k ) | (x,k) <- kctx ] ; putStrLn "" } when (flagAll || flagTi || (not flagKi && not flagEv)) $ do { mapM_ putStrLn $ reverse [ show x++" : "++ (renderN 1 . prt 1) -- (show . ty2Type) ({- uapply_u $ -} unbindSch t ) | (x,t) <- ctx ] ; putStrLn "" } when (flagAll || flagEv) (evProg program >> putStrLn "")
1,343
false
true
1
18
538
386
191
195
null
null
urv/fixhs
src/Data/FIX/Arbitrary.hs
lgpl-2.1
arbibtraryFIXValues :: FIXTags -> Gen FIXValues arbibtraryFIXValues tags = let tlist :: [FIXTag] tlist = map snd $ LT.toList tags arb :: FIXTag -> Gen (Int, FIXValue) arb tag = fmap ((,) (tnum tag)) $ arbitraryValue tag in liftM LT.fromList $ mapM arb tlist
299
arbibtraryFIXValues :: FIXTags -> Gen FIXValues arbibtraryFIXValues tags = let tlist :: [FIXTag] tlist = map snd $ LT.toList tags arb :: FIXTag -> Gen (Int, FIXValue) arb tag = fmap ((,) (tnum tag)) $ arbitraryValue tag in liftM LT.fromList $ mapM arb tlist
299
arbibtraryFIXValues tags = let tlist :: [FIXTag] tlist = map snd $ LT.toList tags arb :: FIXTag -> Gen (Int, FIXValue) arb tag = fmap ((,) (tnum tag)) $ arbitraryValue tag in liftM LT.fromList $ mapM arb tlist
251
false
true
0
14
85
117
57
60
null
null
sdiehl/ghc
testsuite/tests/typecheck/should_compile/Vta1.hs
bsd-3-clause
answer = g @Char False
22
answer = g @Char False
22
answer = g @Char False
22
false
false
0
6
4
13
6
7
null
null
shurizzle/rockit
src/Main.hs
bsd-3-clause
usage :: IO () usage = do n <- getProgName putStrLn $ "USAGE: " ++ n ++ " [pathTemplate] url" putStrLn $ " " ++ n ++ " -h"
134
usage :: IO () usage = do n <- getProgName putStrLn $ "USAGE: " ++ n ++ " [pathTemplate] url" putStrLn $ " " ++ n ++ " -h"
134
usage = do n <- getProgName putStrLn $ "USAGE: " ++ n ++ " [pathTemplate] url" putStrLn $ " " ++ n ++ " -h"
119
false
true
0
9
40
59
26
33
null
null
CarstenKoenig/Countdown
src/web/CountdownGame/Spiel/Phasen.hs
mit
wartePhase :: SpielParameter -> Ergebnisse -> IO Phasen wartePhase params ltErg = do wartenBis <- (warteZeit params `addUTCTime`) <$> getCurrentTime start <- async $ warteStart wartenBis return $ WartePhase wartenBis ltErg start
238
wartePhase :: SpielParameter -> Ergebnisse -> IO Phasen wartePhase params ltErg = do wartenBis <- (warteZeit params `addUTCTime`) <$> getCurrentTime start <- async $ warteStart wartenBis return $ WartePhase wartenBis ltErg start
238
wartePhase params ltErg = do wartenBis <- (warteZeit params `addUTCTime`) <$> getCurrentTime start <- async $ warteStart wartenBis return $ WartePhase wartenBis ltErg start
182
false
true
0
10
41
75
36
39
null
null
balangs/eTeak
src/Bind.hs
bsd-3-clause
chainContexts :: Context Decl -> [Context Decl] -> Context Decl chainContexts context cs = rebaseContextIndices adjustment context where firstNewIndex = contextsNextIndex cs (firstOldIndex, _) = bounds $ contextBindings context adjustment = firstNewIndex - firstOldIndex
318
chainContexts :: Context Decl -> [Context Decl] -> Context Decl chainContexts context cs = rebaseContextIndices adjustment context where firstNewIndex = contextsNextIndex cs (firstOldIndex, _) = bounds $ contextBindings context adjustment = firstNewIndex - firstOldIndex
314
chainContexts context cs = rebaseContextIndices adjustment context where firstNewIndex = contextsNextIndex cs (firstOldIndex, _) = bounds $ contextBindings context adjustment = firstNewIndex - firstOldIndex
250
false
true
1
8
81
87
40
47
null
null
holzensp/ghc
compiler/cmm/CmmMachOp.hs
bsd-3-clause
mo_wordSub dflags = MO_Sub (wordWidth dflags)
50
mo_wordSub dflags = MO_Sub (wordWidth dflags)
50
mo_wordSub dflags = MO_Sub (wordWidth dflags)
50
false
false
1
7
10
21
8
13
null
null
naohaq/gf256-hs
src/Data/GF256.hs
mit
-- | Conversion to 'Integer' toInteger :: GF256 a -> Integer toInteger (GF256 x) = fromIntegral x
97
toInteger :: GF256 a -> Integer toInteger (GF256 x) = fromIntegral x
68
toInteger (GF256 x) = fromIntegral x
36
true
true
0
7
16
31
15
16
null
null
ben-schulz/Idris-dev
src/Idris/Reflection.hs
bsd-3-clause
reflectRawQuote :: [Name] -> Raw -> Raw reflectRawQuote unq (Var n) | n `elem` unq = Var n | otherwise = reflCall "Var" [reflectName n]
139
reflectRawQuote :: [Name] -> Raw -> Raw reflectRawQuote unq (Var n) | n `elem` unq = Var n | otherwise = reflCall "Var" [reflectName n]
139
reflectRawQuote unq (Var n) | n `elem` unq = Var n | otherwise = reflCall "Var" [reflectName n]
99
false
true
1
8
28
66
33
33
null
null
strager/b-shake
B/Shake/Errors.hs
bsd-3-clause
errorRuleRecursion :: Maybe TypeRep -> Maybe String -> a errorRuleRecursion tk k = structured_ -- may involve both rules and oracle, so report as a rule "Build system error - recursion detected" [("Key type",fmap show tk) ,("Key value",k)] "Rules may not be recursive"
284
errorRuleRecursion :: Maybe TypeRep -> Maybe String -> a errorRuleRecursion tk k = structured_ -- may involve both rules and oracle, so report as a rule "Build system error - recursion detected" [("Key type",fmap show tk) ,("Key value",k)] "Rules may not be recursive"
284
errorRuleRecursion tk k = structured_ -- may involve both rules and oracle, so report as a rule "Build system error - recursion detected" [("Key type",fmap show tk) ,("Key value",k)] "Rules may not be recursive"
227
false
true
0
8
58
61
32
29
null
null
ganeti-github-testing/ganeti-test-1
src/Ganeti/Constants.hs
bsd-2-clause
cvEnodefilecheck :: (String, String, String) cvEnodefilecheck = ("node", Types.cVErrorCodeToRaw CvENODEFILECHECK, "Error retrieving the checksum of the node files")
172
cvEnodefilecheck :: (String, String, String) cvEnodefilecheck = ("node", Types.cVErrorCodeToRaw CvENODEFILECHECK, "Error retrieving the checksum of the node files")
172
cvEnodefilecheck = ("node", Types.cVErrorCodeToRaw CvENODEFILECHECK, "Error retrieving the checksum of the node files")
127
false
true
0
7
25
34
20
14
null
null
jepst/CloudHaskell
examples/tests/Test-Task.hs
bsd-3-clause
initialProcess "WORKER" = receiveWait []
40
initialProcess "WORKER" = receiveWait []
40
initialProcess "WORKER" = receiveWait []
40
false
false
0
6
4
15
6
9
null
null
batkot/haskell-bf
app/Main.hs
bsd-3-clause
describeError :: P.SyntaxError -> String describeError = show
61
describeError :: P.SyntaxError -> String describeError = show
61
describeError = show
20
false
true
0
6
7
17
9
8
null
null
vladfi1/hs-misc
Sort.hs
mit
pivot :: (Ord a) => a -> [a] -> ([a], [a]) pivot _ [] = ([], [])
64
pivot :: (Ord a) => a -> [a] -> ([a], [a]) pivot _ [] = ([], [])
64
pivot _ [] = ([], [])
21
false
true
0
11
16
66
35
31
null
null
lambdageek/insomnia
src/Insomnia/Pretty.hs
bsd-3-clause
ppAnnVar :: AnnVar -> PM Doc ppAnnVar (v, U.unembed -> (Annot mt)) = case mt of Nothing -> pp v Just t -> parens (pp v <+> indent classify (pp t))
156
ppAnnVar :: AnnVar -> PM Doc ppAnnVar (v, U.unembed -> (Annot mt)) = case mt of Nothing -> pp v Just t -> parens (pp v <+> indent classify (pp t))
156
ppAnnVar (v, U.unembed -> (Annot mt)) = case mt of Nothing -> pp v Just t -> parens (pp v <+> indent classify (pp t))
127
false
true
1
13
40
89
42
47
null
null
amccausl/Swish
Swish/HaskellUtils/LookupMapTest.hs
lgpl-2.1
testMapValsSuite = TestList [ testMapVals00 , testMapVals01 , testMapVals02 , testMapVals03 , testMapVals04 , testMapVals05 , testMapVals06 , testMapVals07 , testMapVals08 , testMapVals09 ]
244
testMapValsSuite = TestList [ testMapVals00 , testMapVals01 , testMapVals02 , testMapVals03 , testMapVals04 , testMapVals05 , testMapVals06 , testMapVals07 , testMapVals08 , testMapVals09 ]
244
testMapValsSuite = TestList [ testMapVals00 , testMapVals01 , testMapVals02 , testMapVals03 , testMapVals04 , testMapVals05 , testMapVals06 , testMapVals07 , testMapVals08 , testMapVals09 ]
244
false
false
1
5
78
42
24
18
null
null
kapilash/scheme
pf/PostFix/src/Language/PostFix/DT.hs
apache-2.0
nextElem :: PFCommand PFElem nextElem = PFCmd $ \(PFEnv stack cmds defs) -> case stack of x:rest -> Right (x, PFEnv rest cmds defs) _ -> Left PFStackEmpty
169
nextElem :: PFCommand PFElem nextElem = PFCmd $ \(PFEnv stack cmds defs) -> case stack of x:rest -> Right (x, PFEnv rest cmds defs) _ -> Left PFStackEmpty
169
nextElem = PFCmd $ \(PFEnv stack cmds defs) -> case stack of x:rest -> Right (x, PFEnv rest cmds defs) _ -> Left PFStackEmpty
140
false
true
0
12
42
72
36
36
null
null
rad1al/hutton_exercises
ch11.hs
gpl-2.0
random_bestmove :: Grid -> Player -> IO Grid random_bestmove g p = do r <- randomRIO (0, length moves - 1) return (moves !! r) where moves = [g' | Node (g',p') _ <- ts, p' == best] tree = prune depth (gametree g p) Node (_, best) ts = minimax tree
371
random_bestmove :: Grid -> Player -> IO Grid random_bestmove g p = do r <- randomRIO (0, length moves - 1) return (moves !! r) where moves = [g' | Node (g',p') _ <- ts, p' == best] tree = prune depth (gametree g p) Node (_, best) ts = minimax tree
371
random_bestmove g p = do r <- randomRIO (0, length moves - 1) return (moves !! r) where moves = [g' | Node (g',p') _ <- ts, p' == best] tree = prune depth (gametree g p) Node (_, best) ts = minimax tree
326
false
true
3
11
175
150
70
80
null
null
hyPiRion/swearjure
src/Swearjure/Primitives.hs
gpl-3.0
divFn [x] = divFn [Fix (EInt 1), x]
35
divFn [x] = divFn [Fix (EInt 1), x]
35
divFn [x] = divFn [Fix (EInt 1), x]
35
false
false
0
9
7
30
15
15
null
null
markuspf/Idris-dev
src/Idris/Core/TT.hs
bsd-3-clause
envZero = map (\(n, _, b) -> (n, Rig0, b))
42
envZero = map (\(n, _, b) -> (n, Rig0, b))
42
envZero = map (\(n, _, b) -> (n, Rig0, b))
42
false
false
1
8
9
39
21
18
null
null
peri4n/projecteuler
haskell/problem14.hs
gpl-3.0
solution = maximumBy (compare `on` snd) $ map (\x -> (x, (collatz) x)) [1..1000000]
83
solution = maximumBy (compare `on` snd) $ map (\x -> (x, (collatz) x)) [1..1000000]
83
solution = maximumBy (compare `on` snd) $ map (\x -> (x, (collatz) x)) [1..1000000]
83
false
false
0
11
13
52
29
23
null
null
MWRuszczycky/Chemno
src/Model/SimpleCLP.hs
bsd-3-clause
chkOpt :: Options -> Option -> OptResult -- ^More expressive convenience function for looking up an option. chkOpt opts opt = case lookup opt opts of Nothing -> NotUsed -- Option was not specified. Just "" -> Used -- Option was specified -- but takes no argument. Just arg -> UsedArg arg -- Option was specified with -- the given argument.
520
chkOpt :: Options -> Option -> OptResult chkOpt opts opt = case lookup opt opts of Nothing -> NotUsed -- Option was not specified. Just "" -> Used -- Option was specified -- but takes no argument. Just arg -> UsedArg arg -- Option was specified with -- the given argument.
453
chkOpt opts opt = case lookup opt opts of Nothing -> NotUsed -- Option was not specified. Just "" -> Used -- Option was specified -- but takes no argument. Just arg -> UsedArg arg -- Option was specified with -- the given argument.
412
true
true
0
8
241
66
34
32
null
null
mtlstats/mtlstats
src/Mtlstats/Menu/EditPlayer.hs
gpl-3.0
-- | The 'Player' lifetime stats edit menu editPlayerLtMenu :: Menu () editPlayerLtMenu = editMenu "EDIT PLAYER LIFETIME" -- key, label, value [ ( 'A', "ALL LIFETIME STATS", EPLtGoals True ) , ( 'B', "LIFETIME GOALS", EPLtGoals False ) , ( 'C', "LIFETIME ASSITS", EPLtAssists False ) , ( 'D', "LIFETIME PENALTY MINS", EPLtPMin ) , ( 'R', "RETURN TO EDIT PLAYER MENU", EPMenu ) ]
479
editPlayerLtMenu :: Menu () editPlayerLtMenu = editMenu "EDIT PLAYER LIFETIME" -- key, label, value [ ( 'A', "ALL LIFETIME STATS", EPLtGoals True ) , ( 'B', "LIFETIME GOALS", EPLtGoals False ) , ( 'C', "LIFETIME ASSITS", EPLtAssists False ) , ( 'D', "LIFETIME PENALTY MINS", EPLtPMin ) , ( 'R', "RETURN TO EDIT PLAYER MENU", EPMenu ) ]
436
editPlayerLtMenu = editMenu "EDIT PLAYER LIFETIME" -- key, label, value [ ( 'A', "ALL LIFETIME STATS", EPLtGoals True ) , ( 'B', "LIFETIME GOALS", EPLtGoals False ) , ( 'C', "LIFETIME ASSITS", EPLtAssists False ) , ( 'D', "LIFETIME PENALTY MINS", EPLtPMin ) , ( 'R', "RETURN TO EDIT PLAYER MENU", EPMenu ) ]
408
true
true
0
7
166
93
55
38
null
null
paulrzcz/takusen-oracle
Database/Oracle/Enumerator.hs
bsd-3-clause
faultResourceUsage :: QueryResourceUsage defaultResourceUsage = QueryResourceUsage 100
89
defaultResourceUsage :: QueryResourceUsage defaultResourceUsage = QueryResourceUsage 100
88
defaultResourceUsage = QueryResourceUsage 100
45
false
true
0
5
9
14
7
7
null
null
sinelaw/lamdu
bottlelib/Data/Store/Transaction.hs
gpl-3.0
assocDataRef :: (Binary a, MonadA m) => ByteString -> Guid -> MkProperty m (Maybe a) assocDataRef str guid = MkProperty $ do val <- lookup assocGuid return $ Property.Property val set where assocGuid = Guid.combine guid $ Guid.make str set Nothing = delete assocGuid set (Just x) = writeGuid assocGuid x
321
assocDataRef :: (Binary a, MonadA m) => ByteString -> Guid -> MkProperty m (Maybe a) assocDataRef str guid = MkProperty $ do val <- lookup assocGuid return $ Property.Property val set where assocGuid = Guid.combine guid $ Guid.make str set Nothing = delete assocGuid set (Just x) = writeGuid assocGuid x
321
assocDataRef str guid = MkProperty $ do val <- lookup assocGuid return $ Property.Property val set where assocGuid = Guid.combine guid $ Guid.make str set Nothing = delete assocGuid set (Just x) = writeGuid assocGuid x
236
false
true
2
10
68
128
61
67
null
null
LeviSchuck/Goolosh
src/Goolosh/Geom/Output/Quad.hs
mit
graphToQuads :: SceneGraph a -> S.Seq (GMBQ, QuadKind) graphToQuads g = ST.execState s S.empty where cg = _sceneNodes $ collapseGraph g s = do mapM_ conv cg conv SceneNode{..} = do let bb = boundingBoxToQuad _nodeBoundingBox case _nodeDrawQuad of Nothing -> ST.modify (|> (bb, BoundingQuad)) Just q -> do let bbq = bb - q nz = L.nearZero bbq ST.modify (|> (q, DrawQuad)) unless nz $ ST.modify (|> (bb, BoundingQuad)) --
601
graphToQuads :: SceneGraph a -> S.Seq (GMBQ, QuadKind) graphToQuads g = ST.execState s S.empty where cg = _sceneNodes $ collapseGraph g s = do mapM_ conv cg conv SceneNode{..} = do let bb = boundingBoxToQuad _nodeBoundingBox case _nodeDrawQuad of Nothing -> ST.modify (|> (bb, BoundingQuad)) Just q -> do let bbq = bb - q nz = L.nearZero bbq ST.modify (|> (q, DrawQuad)) unless nz $ ST.modify (|> (bb, BoundingQuad)) --
601
graphToQuads g = ST.execState s S.empty where cg = _sceneNodes $ collapseGraph g s = do mapM_ conv cg conv SceneNode{..} = do let bb = boundingBoxToQuad _nodeBoundingBox case _nodeDrawQuad of Nothing -> ST.modify (|> (bb, BoundingQuad)) Just q -> do let bbq = bb - q nz = L.nearZero bbq ST.modify (|> (q, DrawQuad)) unless nz $ ST.modify (|> (bb, BoundingQuad)) --
546
false
true
1
20
252
198
99
99
null
null
uriba/biolab-interfaces
Biolab/Interfaces/MySql.hs
bsd-3-clause
wdTosid :: WellDesc -> SampleId wdTosid wd = SampleId {sidExpId = wdExp wd, sidPlate = wdPlate wd, sidWell = wdWell wd}
119
wdTosid :: WellDesc -> SampleId wdTosid wd = SampleId {sidExpId = wdExp wd, sidPlate = wdPlate wd, sidWell = wdWell wd}
119
wdTosid wd = SampleId {sidExpId = wdExp wd, sidPlate = wdPlate wd, sidWell = wdWell wd}
87
false
true
0
7
20
47
25
22
null
null
davdar/quals
src/FP/Pretty.hs
bsd-3-clause
ptoString :: (Pretty a) => a -> String ptoString = noFormatOut . execDoc . pretty
81
ptoString :: (Pretty a) => a -> String ptoString = noFormatOut . execDoc . pretty
81
ptoString = noFormatOut . execDoc . pretty
42
false
true
1
8
14
39
18
21
null
null
jarmond/locomotive-haskell
src/Loco/Interpreter.hs
gpl-3.0
-- |Execute a program with a new store. execProgramNewStore :: Program -> IO () execProgramNewStore prog = newStore >>= execProgram prog
136
execProgramNewStore :: Program -> IO () execProgramNewStore prog = newStore >>= execProgram prog
96
execProgramNewStore prog = newStore >>= execProgram prog
56
true
true
0
8
20
35
16
19
null
null
willprice/dotfiles-xmonad
lib/ManageHook.hs
mit
windowClassesToFloat = ["xmessage" , "yakuake" , "pavucontrol" , "zenity" , "feh" , "klipper" , "skype" , "plasmashell" , "insync.py" , "pyqt" , "albert" ]
408
windowClassesToFloat = ["xmessage" , "yakuake" , "pavucontrol" , "zenity" , "feh" , "klipper" , "skype" , "plasmashell" , "insync.py" , "pyqt" , "albert" ]
408
windowClassesToFloat = ["xmessage" , "yakuake" , "pavucontrol" , "zenity" , "feh" , "klipper" , "skype" , "plasmashell" , "insync.py" , "pyqt" , "albert" ]
408
false
false
0
5
276
39
25
14
null
null
Zankoku-Okuno/templar
src/Text/Templar/Source.hs
gpl-3.0
navChain (_, local) (Relative fields) = navFields local fields
62
navChain (_, local) (Relative fields) = navFields local fields
62
navChain (_, local) (Relative fields) = navFields local fields
62
false
false
0
7
8
28
14
14
null
null
holzensp/ghc
libraries/base/Data/List.hs
bsd-3-clause
-- | The 'union' function returns the list union of the two lists. -- For example, -- -- > "dog" `union` "cow" == "dogcw" -- -- Duplicates, and elements of the first list, are removed from the -- the second list, but if the first list contains duplicates, so will -- the result. -- It is a special case of 'unionBy', which allows the programmer to supply -- their own equality test. union :: (Eq a) => [a] -> [a] -> [a] union = unionBy (==)
477
union :: (Eq a) => [a] -> [a] -> [a] union = unionBy (==)
93
union = unionBy (==)
38
true
true
0
8
122
52
34
18
null
null
snoyberg/ghc
compiler/nativeGen/PPC/Ppr.hs
bsd-3-clause
pprInstr (MULLD reg1 reg2 ri@(RIReg _)) = pprLogic (sLit "mulld") reg1 reg2 ri
78
pprInstr (MULLD reg1 reg2 ri@(RIReg _)) = pprLogic (sLit "mulld") reg1 reg2 ri
78
pprInstr (MULLD reg1 reg2 ri@(RIReg _)) = pprLogic (sLit "mulld") reg1 reg2 ri
78
false
false
0
9
12
44
21
23
null
null
beijaflor-io/ghcjs-commonjs
examples/fibonacci/Main.hs
mit
fibs :: [Int] fibs = 1 : 1 : zipWith (+) fibs (tail fibs)
57
fibs :: [Int] fibs = 1 : 1 : zipWith (+) fibs (tail fibs)
57
fibs = 1 : 1 : zipWith (+) fibs (tail fibs)
43
false
true
0
8
13
37
20
17
null
null
alexander-at-github/eta
compiler/ETA/Prelude/TysPrim.hs
bsd-3-clause
proxyPrimTyConName = mkPrimTc (fsLit "Proxy#") proxyPrimTyConKey proxyPrimTyCon
90
proxyPrimTyConName = mkPrimTc (fsLit "Proxy#") proxyPrimTyConKey proxyPrimTyCon
90
proxyPrimTyConName = mkPrimTc (fsLit "Proxy#") proxyPrimTyConKey proxyPrimTyCon
90
false
false
0
7
17
19
9
10
null
null
dbp/snap-plus
src/Snap/Snaplet/PostgresqlSimple/Plus.hs
bsd-3-clause
numberQuery' :: (HasPostgres m, Functor m) => Query -> m Int numberQuery' q = fmap (head.fromJust) $ singleQuery' q
115
numberQuery' :: (HasPostgres m, Functor m) => Query -> m Int numberQuery' q = fmap (head.fromJust) $ singleQuery' q
115
numberQuery' q = fmap (head.fromJust) $ singleQuery' q
54
false
true
0
8
18
51
25
26
null
null