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
cyberconcepts/fco-backend
src/Fco/Backend.hs
mit
queryTriples :: Connection -> TripleQuery -> IO (IntMap Triple) queryTriples conn query = do triples <- DB.queryTriples conn query return $ fromList triples -- load bootstrap definitions (obsolete): -- triple env "fco:datatype rdf:type rdf:Class" -- triple env "fco:int rdf:type fco:datatype" -- triple env "fco:string rdf:type fco:datatype" -- triple env "rdf:type rdf:type rdf:Property" -- triple env "rdf:Property rdf:type rdf:Class"
442
queryTriples :: Connection -> TripleQuery -> IO (IntMap Triple) queryTriples conn query = do triples <- DB.queryTriples conn query return $ fromList triples -- load bootstrap definitions (obsolete): -- triple env "fco:datatype rdf:type rdf:Class" -- triple env "fco:int rdf:type fco:datatype" -- triple env "fco:string rdf:type fco:datatype" -- triple env "rdf:type rdf:type rdf:Property" -- triple env "rdf:Property rdf:type rdf:Class"
442
queryTriples conn query = do triples <- DB.queryTriples conn query return $ fromList triples -- load bootstrap definitions (obsolete): -- triple env "fco:datatype rdf:type rdf:Class" -- triple env "fco:int rdf:type fco:datatype" -- triple env "fco:string rdf:type fco:datatype" -- triple env "rdf:type rdf:type rdf:Property" -- triple env "rdf:Property rdf:type rdf:Class"
378
false
true
0
10
63
68
33
35
null
null
ezyang/ghc
compiler/nativeGen/X86/Ppr.hs
bsd-3-clause
pprAlign :: Int -> SDoc pprAlign bytes = sdocWithPlatform $ \platform -> text ".align " <> int (alignment platform) where alignment platform = if platformOS platform == OSDarwin then log2 bytes else bytes log2 :: Int -> Int -- cache the common ones log2 1 = 0 log2 2 = 1 log2 4 = 2 log2 8 = 3 log2 n = 1 + log2 (n `quot` 2) -- ----------------------------------------------------------------------------- -- pprInstr: print an 'Instr'
576
pprAlign :: Int -> SDoc pprAlign bytes = sdocWithPlatform $ \platform -> text ".align " <> int (alignment platform) where alignment platform = if platformOS platform == OSDarwin then log2 bytes else bytes log2 :: Int -> Int -- cache the common ones log2 1 = 0 log2 2 = 1 log2 4 = 2 log2 8 = 3 log2 n = 1 + log2 (n `quot` 2) -- ----------------------------------------------------------------------------- -- pprInstr: print an 'Instr'
576
pprAlign bytes = sdocWithPlatform $ \platform -> text ".align " <> int (alignment platform) where alignment platform = if platformOS platform == OSDarwin then log2 bytes else bytes log2 :: Int -> Int -- cache the common ones log2 1 = 0 log2 2 = 1 log2 4 = 2 log2 8 = 3 log2 n = 1 + log2 (n `quot` 2) -- ----------------------------------------------------------------------------- -- pprInstr: print an 'Instr'
552
false
true
9
10
216
136
70
66
null
null
Toxaris/pandoc-lit
src/Text/Pandoc/Lit.hs
bsd-3-clause
transformEval _ _ text = return text
36
transformEval _ _ text = return text
36
transformEval _ _ text = return text
36
false
false
0
5
6
16
7
9
null
null
jamesdabbs/zorya
src/Rabbit.hs
bsd-3-clause
runRabbit :: RabbitConf -> IO AMQP.Channel runRabbit RabbitConf{..} = do conn <- openConnection rabbitHost rabbitVHost rabbitUser rabbitPass chan <- openChannel conn declareExchange chan newExchange { exchangeName = "notifications" , exchangeType = "topic" , exchangeDurable = True } _ <- declareQueue chan newQueue { queueName = logQ, queueDurable = False } bindQueue chan logQ "notifications" "#" _ <- declareQueue chan newQueue { queueName = downloadQ, queueDurable = True } bindQueue chan downloadQ "notifications" "download" _ <- declareQueue chan newQueue { queueName = "rpc", queueDurable = False } bindQueue chan "rpc" "notifications" "rpc.#" return chan
702
runRabbit :: RabbitConf -> IO AMQP.Channel runRabbit RabbitConf{..} = do conn <- openConnection rabbitHost rabbitVHost rabbitUser rabbitPass chan <- openChannel conn declareExchange chan newExchange { exchangeName = "notifications" , exchangeType = "topic" , exchangeDurable = True } _ <- declareQueue chan newQueue { queueName = logQ, queueDurable = False } bindQueue chan logQ "notifications" "#" _ <- declareQueue chan newQueue { queueName = downloadQ, queueDurable = True } bindQueue chan downloadQ "notifications" "download" _ <- declareQueue chan newQueue { queueName = "rpc", queueDurable = False } bindQueue chan "rpc" "notifications" "rpc.#" return chan
702
runRabbit RabbitConf{..} = do conn <- openConnection rabbitHost rabbitVHost rabbitUser rabbitPass chan <- openChannel conn declareExchange chan newExchange { exchangeName = "notifications" , exchangeType = "topic" , exchangeDurable = True } _ <- declareQueue chan newQueue { queueName = logQ, queueDurable = False } bindQueue chan logQ "notifications" "#" _ <- declareQueue chan newQueue { queueName = downloadQ, queueDurable = True } bindQueue chan downloadQ "notifications" "download" _ <- declareQueue chan newQueue { queueName = "rpc", queueDurable = False } bindQueue chan "rpc" "notifications" "rpc.#" return chan
659
false
true
15
6
132
110
71
39
null
null
tchagnon/cs636-raytracer
a3/scene1.hs
apache-2.0
matBunny = mat0 {c = cornflowerBlue}
36
matBunny = mat0 {c = cornflowerBlue}
36
matBunny = mat0 {c = cornflowerBlue}
36
false
false
1
7
5
21
9
12
null
null
beni55/hs-tls
core/Network/TLS/Crypto/DH.hs
bsd-3-clause
dhPrivate :: Integer -> DHPrivate dhPrivate = DH.PrivateNumber
62
dhPrivate :: Integer -> DHPrivate dhPrivate = DH.PrivateNumber
62
dhPrivate = DH.PrivateNumber
28
false
true
0
5
7
17
9
8
null
null
rsasse/tamarin-prover
lib/utils/src/Text/PrettyPrint/Highlight.hs
gpl-3.0
opParens :: HighlightDocument d => d -> d opParens d = operator_ "(" <> d <> operator_ ")"
90
opParens :: HighlightDocument d => d -> d opParens d = operator_ "(" <> d <> operator_ ")"
90
opParens d = operator_ "(" <> d <> operator_ ")"
48
false
true
0
7
17
42
19
23
null
null
franrogers/pam
Codec/Image/PAM.hs
bsd-3-clause
splitToken :: String -> Maybe (String, String) splitToken s = let s' = dropWhile (`elem` whitespace) s token = takeWhile (`notElem` whitespace) s' in if token == [] then Nothing else Just (token, drop (length token) s')
260
splitToken :: String -> Maybe (String, String) splitToken s = let s' = dropWhile (`elem` whitespace) s token = takeWhile (`notElem` whitespace) s' in if token == [] then Nothing else Just (token, drop (length token) s')
260
splitToken s = let s' = dropWhile (`elem` whitespace) s token = takeWhile (`notElem` whitespace) s' in if token == [] then Nothing else Just (token, drop (length token) s')
213
false
true
0
12
77
99
54
45
null
null
Shimuuar/protobuf
Data/Protobuf/Serialize/Protobuf.hs
bsd-3-clause
-- | Skip unknow field skipUnknownField :: WireTag -> Get () skipUnknownField (WireTag _ t) = case t of 0 -> void getVarInt 1 -> skip 8 2 -> skip =<< getVarInt 3 -> fail "Groups are not supported" 4 -> fail "Groups are not supported" 5 -> skip 4 _ -> fail ("Bad wire tag: " ++ show t) -- | Get packed sequence
340
skipUnknownField :: WireTag -> Get () skipUnknownField (WireTag _ t) = case t of 0 -> void getVarInt 1 -> skip 8 2 -> skip =<< getVarInt 3 -> fail "Groups are not supported" 4 -> fail "Groups are not supported" 5 -> skip 4 _ -> fail ("Bad wire tag: " ++ show t) -- | Get packed sequence
317
skipUnknownField (WireTag _ t) = case t of 0 -> void getVarInt 1 -> skip 8 2 -> skip =<< getVarInt 3 -> fail "Groups are not supported" 4 -> fail "Groups are not supported" 5 -> skip 4 _ -> fail ("Bad wire tag: " ++ show t) -- | Get packed sequence
279
true
true
0
11
95
115
54
61
null
null
AlexeyRaga/eta
compiler/ETA/Prelude/PrimOp.hs
bsd-3-clause
primOpInfo PopCnt64Op = mkGenPrimOp (fsLit "popCnt64#") [] [word64PrimTy] (wordPrimTy)
87
primOpInfo PopCnt64Op = mkGenPrimOp (fsLit "popCnt64#") [] [word64PrimTy] (wordPrimTy)
87
primOpInfo PopCnt64Op = mkGenPrimOp (fsLit "popCnt64#") [] [word64PrimTy] (wordPrimTy)
87
false
false
1
7
9
35
16
19
null
null
ekmett/ghclive
src-main/Main.hs
bsd-3-clause
{-- shared editor --} getEditR :: Handler RepHtml getEditR = liveLayout $ do addScript (StaticR jquery_js) addScript (StaticR codemirror_lib_codemirror_js) addScript (StaticR codemirror_mode_haskell_haskell_js) addScript (StaticR document_js) addStylesheet (StaticR codemirror_lib_codemirror_css) addStylesheet (StaticR foo_css) addScript (StaticR jquery_ui_1_8_23_custom_min_js) addStylesheet (StaticR jquery_ui_1_8_23_custom_css) addScript (StaticR jquery_layout_latest_js) addScript (StaticR jquery_scrollTo_js) addScript (StaticR ghclive_js) toWidget [lucius| #editor { width: 800px; height: 500px; } |] [whamlet|$newline never <div id="editor-pane" class="ui-layout-north"> <div class="ui-layout-content"> <textarea #editor> <form action="#"> <input type=submit value="Load shared document" #load> <div class="ui-layout-center"> <div #editormessages> <div #output class="ui-layout-content"> <div class="ui-layout-south"> <form id="evalform" action="#"> <div id="eval-panel"> <input type=text placeholder="Enter a Haskell expression" #expr> <div class="ui-layout-west"> <div class="ui-layout-east"> |]
1,683
getEditR :: Handler RepHtml getEditR = liveLayout $ do addScript (StaticR jquery_js) addScript (StaticR codemirror_lib_codemirror_js) addScript (StaticR codemirror_mode_haskell_haskell_js) addScript (StaticR document_js) addStylesheet (StaticR codemirror_lib_codemirror_css) addStylesheet (StaticR foo_css) addScript (StaticR jquery_ui_1_8_23_custom_min_js) addStylesheet (StaticR jquery_ui_1_8_23_custom_css) addScript (StaticR jquery_layout_latest_js) addScript (StaticR jquery_scrollTo_js) addScript (StaticR ghclive_js) toWidget [lucius| #editor { width: 800px; height: 500px; } |] [whamlet|$newline never <div id="editor-pane" class="ui-layout-north"> <div class="ui-layout-content"> <textarea #editor> <form action="#"> <input type=submit value="Load shared document" #load> <div class="ui-layout-center"> <div #editormessages> <div #output class="ui-layout-content"> <div class="ui-layout-south"> <form id="evalform" action="#"> <div id="eval-panel"> <input type=text placeholder="Enter a Haskell expression" #expr> <div class="ui-layout-west"> <div class="ui-layout-east"> |]
1,661
getEditR = liveLayout $ do addScript (StaticR jquery_js) addScript (StaticR codemirror_lib_codemirror_js) addScript (StaticR codemirror_mode_haskell_haskell_js) addScript (StaticR document_js) addStylesheet (StaticR codemirror_lib_codemirror_css) addStylesheet (StaticR foo_css) addScript (StaticR jquery_ui_1_8_23_custom_min_js) addStylesheet (StaticR jquery_ui_1_8_23_custom_css) addScript (StaticR jquery_layout_latest_js) addScript (StaticR jquery_scrollTo_js) addScript (StaticR ghclive_js) toWidget [lucius| #editor { width: 800px; height: 500px; } |] [whamlet|$newline never <div id="editor-pane" class="ui-layout-north"> <div class="ui-layout-content"> <textarea #editor> <form action="#"> <input type=submit value="Load shared document" #load> <div class="ui-layout-center"> <div #editormessages> <div #output class="ui-layout-content"> <div class="ui-layout-south"> <form id="evalform" action="#"> <div id="eval-panel"> <input type=text placeholder="Enter a Haskell expression" #expr> <div class="ui-layout-west"> <div class="ui-layout-east"> |]
1,633
true
true
1
10
676
172
76
96
null
null
tanakh/Peggy
Text/Peggy/Quote.hs
bsd-3-clause
genParser :: [(String, String)] -- ^ a list of pair of name of -- quasi-quoter and its start nonterminal -> Syntax -- ^ syntax -> Q [Dec] -- ^ definitions of parsers and quasi-quoters genParser qqs syn = do qq <- mapM (genQQ syn) qqs dec <- genDecs syn return $ concat qq ++ dec --
368
genParser :: [(String, String)] -- ^ a list of pair of name of -- quasi-quoter and its start nonterminal -> Syntax -- ^ syntax -> Q [Dec] genParser qqs syn = do qq <- mapM (genQQ syn) qqs dec <- genDecs syn return $ concat qq ++ dec --
314
genParser qqs syn = do qq <- mapM (genQQ syn) qqs dec <- genDecs syn return $ concat qq ++ dec --
107
true
true
0
10
142
86
44
42
null
null
TomMD/ghc
compiler/nativeGen/X86/Instr.hs
bsd-3-clause
-- memory reference -- | Returns which registers are read and written as a (read, written) -- pair. x86_regUsageOfInstr :: Platform -> Instr -> RegUsage x86_regUsageOfInstr platform instr = case instr of MOV _ src dst -> usageRW src dst CMOV _ _ src dst -> mkRU (use_R src [dst]) [dst] MOVZxL _ src dst -> usageRW src dst MOVSxL _ src dst -> usageRW src dst LEA _ src dst -> usageRW src dst ADD _ src dst -> usageRM src dst ADC _ src dst -> usageRM src dst SUB _ src dst -> usageRM src dst SBB _ src dst -> usageRM src dst IMUL _ src dst -> usageRM src dst IMUL2 _ src -> mkRU (eax:use_R src []) [eax,edx] MUL _ src dst -> usageRM src dst MUL2 _ src -> mkRU (eax:use_R src []) [eax,edx] DIV _ op -> mkRU (eax:edx:use_R op []) [eax,edx] IDIV _ op -> mkRU (eax:edx:use_R op []) [eax,edx] ADD_CC _ src dst -> usageRM src dst SUB_CC _ src dst -> usageRM src dst AND _ src dst -> usageRM src dst OR _ src dst -> usageRM src dst XOR _ (OpReg src) (OpReg dst) | src == dst -> mkRU [] [dst] XOR _ src dst -> usageRM src dst NOT _ op -> usageM op BSWAP _ reg -> mkRU [reg] [reg] NEGI _ op -> usageM op SHL _ imm dst -> usageRM imm dst SAR _ imm dst -> usageRM imm dst SHR _ imm dst -> usageRM imm dst BT _ _ src -> mkRUR (use_R src []) PUSH _ op -> mkRUR (use_R op []) POP _ op -> mkRU [] (def_W op) TEST _ src dst -> mkRUR (use_R src $! use_R dst []) CMP _ src dst -> mkRUR (use_R src $! use_R dst []) SETCC _ op -> mkRU [] (def_W op) JXX _ _ -> mkRU [] [] JXX_GBL _ _ -> mkRU [] [] JMP op regs -> mkRUR (use_R op regs) JMP_TBL op _ _ _ -> mkRUR (use_R op []) CALL (Left _) params -> mkRU params (callClobberedRegs platform) CALL (Right reg) params -> mkRU (reg:params) (callClobberedRegs platform) CLTD _ -> mkRU [eax] [edx] NOP -> mkRU [] [] GMOV src dst -> mkRU [src] [dst] GLD _ src dst -> mkRU (use_EA src []) [dst] GST _ src dst -> mkRUR (src : use_EA dst []) GLDZ dst -> mkRU [] [dst] GLD1 dst -> mkRU [] [dst] GFTOI src dst -> mkRU [src] [dst] GDTOI src dst -> mkRU [src] [dst] GITOF src dst -> mkRU [src] [dst] GITOD src dst -> mkRU [src] [dst] GDTOF src dst -> mkRU [src] [dst] GADD _ s1 s2 dst -> mkRU [s1,s2] [dst] GSUB _ s1 s2 dst -> mkRU [s1,s2] [dst] GMUL _ s1 s2 dst -> mkRU [s1,s2] [dst] GDIV _ s1 s2 dst -> mkRU [s1,s2] [dst] GCMP _ src1 src2 -> mkRUR [src1,src2] GABS _ src dst -> mkRU [src] [dst] GNEG _ src dst -> mkRU [src] [dst] GSQRT _ src dst -> mkRU [src] [dst] GSIN _ _ _ src dst -> mkRU [src] [dst] GCOS _ _ _ src dst -> mkRU [src] [dst] GTAN _ _ _ src dst -> mkRU [src] [dst] CVTSS2SD src dst -> mkRU [src] [dst] CVTSD2SS src dst -> mkRU [src] [dst] CVTTSS2SIQ _ src dst -> mkRU (use_R src []) [dst] CVTTSD2SIQ _ src dst -> mkRU (use_R src []) [dst] CVTSI2SS _ src dst -> mkRU (use_R src []) [dst] CVTSI2SD _ src dst -> mkRU (use_R src []) [dst] FDIV _ src dst -> usageRM src dst FETCHGOT reg -> mkRU [] [reg] FETCHPC reg -> mkRU [] [reg] COMMENT _ -> noUsage LOCATION{} -> noUsage DELTA _ -> noUsage POPCNT _ src dst -> mkRU (use_R src []) [dst] BSF _ src dst -> mkRU (use_R src []) [dst] BSR _ src dst -> mkRU (use_R src []) [dst] -- note: might be a better way to do this PREFETCH _ _ src -> mkRU (use_R src []) [] LOCK i -> x86_regUsageOfInstr platform i XADD _ src dst -> usageMM src dst CMPXCHG _ src dst -> usageRMM src dst (OpReg eax) MFENCE -> noUsage _other -> panic "regUsage: unrecognised instr" where -- # Definitions -- -- Written: If the operand is a register, it's written. If it's an -- address, registers mentioned in the address are read. -- -- Modified: If the operand is a register, it's both read and -- written. If it's an address, registers mentioned in the address -- are read. -- 2 operand form; first operand Read; second Written usageRW :: Operand -> Operand -> RegUsage usageRW op (OpReg reg) = mkRU (use_R op []) [reg] usageRW op (OpAddr ea) = mkRUR (use_R op $! use_EA ea []) usageRW _ _ = panic "X86.RegInfo.usageRW: no match" -- 2 operand form; first operand Read; second Modified usageRM :: Operand -> Operand -> RegUsage usageRM op (OpReg reg) = mkRU (use_R op [reg]) [reg] usageRM op (OpAddr ea) = mkRUR (use_R op $! use_EA ea []) usageRM _ _ = panic "X86.RegInfo.usageRM: no match" -- 2 operand form; first operand Modified; second Modified usageMM :: Operand -> Operand -> RegUsage usageMM (OpReg src) (OpReg dst) = mkRU [src, dst] [src, dst] usageMM (OpReg src) (OpAddr ea) = mkRU (use_EA ea [src]) [src] usageMM _ _ = panic "X86.RegInfo.usageMM: no match" -- 3 operand form; first operand Read; second Modified; third Modified usageRMM :: Operand -> Operand -> Operand -> RegUsage usageRMM (OpReg src) (OpReg dst) (OpReg reg) = mkRU [src, dst, reg] [dst, reg] usageRMM (OpReg src) (OpAddr ea) (OpReg reg) = mkRU (use_EA ea [src, reg]) [reg] usageRMM _ _ _ = panic "X86.RegInfo.usageRMM: no match" -- 1 operand form; operand Modified usageM :: Operand -> RegUsage usageM (OpReg reg) = mkRU [reg] [reg] usageM (OpAddr ea) = mkRUR (use_EA ea []) usageM _ = panic "X86.RegInfo.usageM: no match" -- Registers defd when an operand is written. def_W (OpReg reg) = [reg] def_W (OpAddr _ ) = [] def_W _ = panic "X86.RegInfo.def_W: no match" -- Registers used when an operand is read. use_R (OpReg reg) tl = reg : tl use_R (OpImm _) tl = tl use_R (OpAddr ea) tl = use_EA ea tl -- Registers used to compute an effective address. use_EA (ImmAddr _ _) tl = tl use_EA (AddrBaseIndex base index _) tl = use_base base $! use_index index tl where use_base (EABaseReg r) tl = r : tl use_base _ tl = tl use_index EAIndexNone tl = tl use_index (EAIndex i _) tl = i : tl mkRUR src = src' `seq` RU src' [] where src' = filter (interesting platform) src mkRU src dst = src' `seq` dst' `seq` RU src' dst' where src' = filter (interesting platform) src dst' = filter (interesting platform) dst -- | Is this register interesting for the register allocator?
7,118
x86_regUsageOfInstr :: Platform -> Instr -> RegUsage x86_regUsageOfInstr platform instr = case instr of MOV _ src dst -> usageRW src dst CMOV _ _ src dst -> mkRU (use_R src [dst]) [dst] MOVZxL _ src dst -> usageRW src dst MOVSxL _ src dst -> usageRW src dst LEA _ src dst -> usageRW src dst ADD _ src dst -> usageRM src dst ADC _ src dst -> usageRM src dst SUB _ src dst -> usageRM src dst SBB _ src dst -> usageRM src dst IMUL _ src dst -> usageRM src dst IMUL2 _ src -> mkRU (eax:use_R src []) [eax,edx] MUL _ src dst -> usageRM src dst MUL2 _ src -> mkRU (eax:use_R src []) [eax,edx] DIV _ op -> mkRU (eax:edx:use_R op []) [eax,edx] IDIV _ op -> mkRU (eax:edx:use_R op []) [eax,edx] ADD_CC _ src dst -> usageRM src dst SUB_CC _ src dst -> usageRM src dst AND _ src dst -> usageRM src dst OR _ src dst -> usageRM src dst XOR _ (OpReg src) (OpReg dst) | src == dst -> mkRU [] [dst] XOR _ src dst -> usageRM src dst NOT _ op -> usageM op BSWAP _ reg -> mkRU [reg] [reg] NEGI _ op -> usageM op SHL _ imm dst -> usageRM imm dst SAR _ imm dst -> usageRM imm dst SHR _ imm dst -> usageRM imm dst BT _ _ src -> mkRUR (use_R src []) PUSH _ op -> mkRUR (use_R op []) POP _ op -> mkRU [] (def_W op) TEST _ src dst -> mkRUR (use_R src $! use_R dst []) CMP _ src dst -> mkRUR (use_R src $! use_R dst []) SETCC _ op -> mkRU [] (def_W op) JXX _ _ -> mkRU [] [] JXX_GBL _ _ -> mkRU [] [] JMP op regs -> mkRUR (use_R op regs) JMP_TBL op _ _ _ -> mkRUR (use_R op []) CALL (Left _) params -> mkRU params (callClobberedRegs platform) CALL (Right reg) params -> mkRU (reg:params) (callClobberedRegs platform) CLTD _ -> mkRU [eax] [edx] NOP -> mkRU [] [] GMOV src dst -> mkRU [src] [dst] GLD _ src dst -> mkRU (use_EA src []) [dst] GST _ src dst -> mkRUR (src : use_EA dst []) GLDZ dst -> mkRU [] [dst] GLD1 dst -> mkRU [] [dst] GFTOI src dst -> mkRU [src] [dst] GDTOI src dst -> mkRU [src] [dst] GITOF src dst -> mkRU [src] [dst] GITOD src dst -> mkRU [src] [dst] GDTOF src dst -> mkRU [src] [dst] GADD _ s1 s2 dst -> mkRU [s1,s2] [dst] GSUB _ s1 s2 dst -> mkRU [s1,s2] [dst] GMUL _ s1 s2 dst -> mkRU [s1,s2] [dst] GDIV _ s1 s2 dst -> mkRU [s1,s2] [dst] GCMP _ src1 src2 -> mkRUR [src1,src2] GABS _ src dst -> mkRU [src] [dst] GNEG _ src dst -> mkRU [src] [dst] GSQRT _ src dst -> mkRU [src] [dst] GSIN _ _ _ src dst -> mkRU [src] [dst] GCOS _ _ _ src dst -> mkRU [src] [dst] GTAN _ _ _ src dst -> mkRU [src] [dst] CVTSS2SD src dst -> mkRU [src] [dst] CVTSD2SS src dst -> mkRU [src] [dst] CVTTSS2SIQ _ src dst -> mkRU (use_R src []) [dst] CVTTSD2SIQ _ src dst -> mkRU (use_R src []) [dst] CVTSI2SS _ src dst -> mkRU (use_R src []) [dst] CVTSI2SD _ src dst -> mkRU (use_R src []) [dst] FDIV _ src dst -> usageRM src dst FETCHGOT reg -> mkRU [] [reg] FETCHPC reg -> mkRU [] [reg] COMMENT _ -> noUsage LOCATION{} -> noUsage DELTA _ -> noUsage POPCNT _ src dst -> mkRU (use_R src []) [dst] BSF _ src dst -> mkRU (use_R src []) [dst] BSR _ src dst -> mkRU (use_R src []) [dst] -- note: might be a better way to do this PREFETCH _ _ src -> mkRU (use_R src []) [] LOCK i -> x86_regUsageOfInstr platform i XADD _ src dst -> usageMM src dst CMPXCHG _ src dst -> usageRMM src dst (OpReg eax) MFENCE -> noUsage _other -> panic "regUsage: unrecognised instr" where -- # Definitions -- -- Written: If the operand is a register, it's written. If it's an -- address, registers mentioned in the address are read. -- -- Modified: If the operand is a register, it's both read and -- written. If it's an address, registers mentioned in the address -- are read. -- 2 operand form; first operand Read; second Written usageRW :: Operand -> Operand -> RegUsage usageRW op (OpReg reg) = mkRU (use_R op []) [reg] usageRW op (OpAddr ea) = mkRUR (use_R op $! use_EA ea []) usageRW _ _ = panic "X86.RegInfo.usageRW: no match" -- 2 operand form; first operand Read; second Modified usageRM :: Operand -> Operand -> RegUsage usageRM op (OpReg reg) = mkRU (use_R op [reg]) [reg] usageRM op (OpAddr ea) = mkRUR (use_R op $! use_EA ea []) usageRM _ _ = panic "X86.RegInfo.usageRM: no match" -- 2 operand form; first operand Modified; second Modified usageMM :: Operand -> Operand -> RegUsage usageMM (OpReg src) (OpReg dst) = mkRU [src, dst] [src, dst] usageMM (OpReg src) (OpAddr ea) = mkRU (use_EA ea [src]) [src] usageMM _ _ = panic "X86.RegInfo.usageMM: no match" -- 3 operand form; first operand Read; second Modified; third Modified usageRMM :: Operand -> Operand -> Operand -> RegUsage usageRMM (OpReg src) (OpReg dst) (OpReg reg) = mkRU [src, dst, reg] [dst, reg] usageRMM (OpReg src) (OpAddr ea) (OpReg reg) = mkRU (use_EA ea [src, reg]) [reg] usageRMM _ _ _ = panic "X86.RegInfo.usageRMM: no match" -- 1 operand form; operand Modified usageM :: Operand -> RegUsage usageM (OpReg reg) = mkRU [reg] [reg] usageM (OpAddr ea) = mkRUR (use_EA ea []) usageM _ = panic "X86.RegInfo.usageM: no match" -- Registers defd when an operand is written. def_W (OpReg reg) = [reg] def_W (OpAddr _ ) = [] def_W _ = panic "X86.RegInfo.def_W: no match" -- Registers used when an operand is read. use_R (OpReg reg) tl = reg : tl use_R (OpImm _) tl = tl use_R (OpAddr ea) tl = use_EA ea tl -- Registers used to compute an effective address. use_EA (ImmAddr _ _) tl = tl use_EA (AddrBaseIndex base index _) tl = use_base base $! use_index index tl where use_base (EABaseReg r) tl = r : tl use_base _ tl = tl use_index EAIndexNone tl = tl use_index (EAIndex i _) tl = i : tl mkRUR src = src' `seq` RU src' [] where src' = filter (interesting platform) src mkRU src dst = src' `seq` dst' `seq` RU src' dst' where src' = filter (interesting platform) src dst' = filter (interesting platform) dst -- | Is this register interesting for the register allocator?
7,015
x86_regUsageOfInstr platform instr = case instr of MOV _ src dst -> usageRW src dst CMOV _ _ src dst -> mkRU (use_R src [dst]) [dst] MOVZxL _ src dst -> usageRW src dst MOVSxL _ src dst -> usageRW src dst LEA _ src dst -> usageRW src dst ADD _ src dst -> usageRM src dst ADC _ src dst -> usageRM src dst SUB _ src dst -> usageRM src dst SBB _ src dst -> usageRM src dst IMUL _ src dst -> usageRM src dst IMUL2 _ src -> mkRU (eax:use_R src []) [eax,edx] MUL _ src dst -> usageRM src dst MUL2 _ src -> mkRU (eax:use_R src []) [eax,edx] DIV _ op -> mkRU (eax:edx:use_R op []) [eax,edx] IDIV _ op -> mkRU (eax:edx:use_R op []) [eax,edx] ADD_CC _ src dst -> usageRM src dst SUB_CC _ src dst -> usageRM src dst AND _ src dst -> usageRM src dst OR _ src dst -> usageRM src dst XOR _ (OpReg src) (OpReg dst) | src == dst -> mkRU [] [dst] XOR _ src dst -> usageRM src dst NOT _ op -> usageM op BSWAP _ reg -> mkRU [reg] [reg] NEGI _ op -> usageM op SHL _ imm dst -> usageRM imm dst SAR _ imm dst -> usageRM imm dst SHR _ imm dst -> usageRM imm dst BT _ _ src -> mkRUR (use_R src []) PUSH _ op -> mkRUR (use_R op []) POP _ op -> mkRU [] (def_W op) TEST _ src dst -> mkRUR (use_R src $! use_R dst []) CMP _ src dst -> mkRUR (use_R src $! use_R dst []) SETCC _ op -> mkRU [] (def_W op) JXX _ _ -> mkRU [] [] JXX_GBL _ _ -> mkRU [] [] JMP op regs -> mkRUR (use_R op regs) JMP_TBL op _ _ _ -> mkRUR (use_R op []) CALL (Left _) params -> mkRU params (callClobberedRegs platform) CALL (Right reg) params -> mkRU (reg:params) (callClobberedRegs platform) CLTD _ -> mkRU [eax] [edx] NOP -> mkRU [] [] GMOV src dst -> mkRU [src] [dst] GLD _ src dst -> mkRU (use_EA src []) [dst] GST _ src dst -> mkRUR (src : use_EA dst []) GLDZ dst -> mkRU [] [dst] GLD1 dst -> mkRU [] [dst] GFTOI src dst -> mkRU [src] [dst] GDTOI src dst -> mkRU [src] [dst] GITOF src dst -> mkRU [src] [dst] GITOD src dst -> mkRU [src] [dst] GDTOF src dst -> mkRU [src] [dst] GADD _ s1 s2 dst -> mkRU [s1,s2] [dst] GSUB _ s1 s2 dst -> mkRU [s1,s2] [dst] GMUL _ s1 s2 dst -> mkRU [s1,s2] [dst] GDIV _ s1 s2 dst -> mkRU [s1,s2] [dst] GCMP _ src1 src2 -> mkRUR [src1,src2] GABS _ src dst -> mkRU [src] [dst] GNEG _ src dst -> mkRU [src] [dst] GSQRT _ src dst -> mkRU [src] [dst] GSIN _ _ _ src dst -> mkRU [src] [dst] GCOS _ _ _ src dst -> mkRU [src] [dst] GTAN _ _ _ src dst -> mkRU [src] [dst] CVTSS2SD src dst -> mkRU [src] [dst] CVTSD2SS src dst -> mkRU [src] [dst] CVTTSS2SIQ _ src dst -> mkRU (use_R src []) [dst] CVTTSD2SIQ _ src dst -> mkRU (use_R src []) [dst] CVTSI2SS _ src dst -> mkRU (use_R src []) [dst] CVTSI2SD _ src dst -> mkRU (use_R src []) [dst] FDIV _ src dst -> usageRM src dst FETCHGOT reg -> mkRU [] [reg] FETCHPC reg -> mkRU [] [reg] COMMENT _ -> noUsage LOCATION{} -> noUsage DELTA _ -> noUsage POPCNT _ src dst -> mkRU (use_R src []) [dst] BSF _ src dst -> mkRU (use_R src []) [dst] BSR _ src dst -> mkRU (use_R src []) [dst] -- note: might be a better way to do this PREFETCH _ _ src -> mkRU (use_R src []) [] LOCK i -> x86_regUsageOfInstr platform i XADD _ src dst -> usageMM src dst CMPXCHG _ src dst -> usageRMM src dst (OpReg eax) MFENCE -> noUsage _other -> panic "regUsage: unrecognised instr" where -- # Definitions -- -- Written: If the operand is a register, it's written. If it's an -- address, registers mentioned in the address are read. -- -- Modified: If the operand is a register, it's both read and -- written. If it's an address, registers mentioned in the address -- are read. -- 2 operand form; first operand Read; second Written usageRW :: Operand -> Operand -> RegUsage usageRW op (OpReg reg) = mkRU (use_R op []) [reg] usageRW op (OpAddr ea) = mkRUR (use_R op $! use_EA ea []) usageRW _ _ = panic "X86.RegInfo.usageRW: no match" -- 2 operand form; first operand Read; second Modified usageRM :: Operand -> Operand -> RegUsage usageRM op (OpReg reg) = mkRU (use_R op [reg]) [reg] usageRM op (OpAddr ea) = mkRUR (use_R op $! use_EA ea []) usageRM _ _ = panic "X86.RegInfo.usageRM: no match" -- 2 operand form; first operand Modified; second Modified usageMM :: Operand -> Operand -> RegUsage usageMM (OpReg src) (OpReg dst) = mkRU [src, dst] [src, dst] usageMM (OpReg src) (OpAddr ea) = mkRU (use_EA ea [src]) [src] usageMM _ _ = panic "X86.RegInfo.usageMM: no match" -- 3 operand form; first operand Read; second Modified; third Modified usageRMM :: Operand -> Operand -> Operand -> RegUsage usageRMM (OpReg src) (OpReg dst) (OpReg reg) = mkRU [src, dst, reg] [dst, reg] usageRMM (OpReg src) (OpAddr ea) (OpReg reg) = mkRU (use_EA ea [src, reg]) [reg] usageRMM _ _ _ = panic "X86.RegInfo.usageRMM: no match" -- 1 operand form; operand Modified usageM :: Operand -> RegUsage usageM (OpReg reg) = mkRU [reg] [reg] usageM (OpAddr ea) = mkRUR (use_EA ea []) usageM _ = panic "X86.RegInfo.usageM: no match" -- Registers defd when an operand is written. def_W (OpReg reg) = [reg] def_W (OpAddr _ ) = [] def_W _ = panic "X86.RegInfo.def_W: no match" -- Registers used when an operand is read. use_R (OpReg reg) tl = reg : tl use_R (OpImm _) tl = tl use_R (OpAddr ea) tl = use_EA ea tl -- Registers used to compute an effective address. use_EA (ImmAddr _ _) tl = tl use_EA (AddrBaseIndex base index _) tl = use_base base $! use_index index tl where use_base (EABaseReg r) tl = r : tl use_base _ tl = tl use_index EAIndexNone tl = tl use_index (EAIndex i _) tl = i : tl mkRUR src = src' `seq` RU src' [] where src' = filter (interesting platform) src mkRU src dst = src' `seq` dst' `seq` RU src' dst' where src' = filter (interesting platform) src dst' = filter (interesting platform) dst -- | Is this register interesting for the register allocator?
6,962
true
true
58
12
2,483
2,791
1,369
1,422
null
null
IreneKnapp/Faction
faction/Distribution/Client/IndexUtils.hs
bsd-3-clause
readPackageIndexFile :: Package pkg => (PackageId -> GenericPackageDescription -> pkg) -> FilePath -> IO (PackageIndex pkg, [Dependency]) readPackageIndexFile mkPkg indexFile = do (pkgs, prefs) <- either fail return . parsePackageIndex . maybeDecompress =<< BS.readFile indexFile pkgs' <- evaluate $ PackageIndex.fromList [ mkPkg pkgid pkg | (pkgid, pkg, _) <- pkgs] return (pkgs', prefs) -- | Parse an uncompressed \"00-index.tar\" repository index file represented -- as a 'ByteString'. --
623
readPackageIndexFile :: Package pkg => (PackageId -> GenericPackageDescription -> pkg) -> FilePath -> IO (PackageIndex pkg, [Dependency]) readPackageIndexFile mkPkg indexFile = do (pkgs, prefs) <- either fail return . parsePackageIndex . maybeDecompress =<< BS.readFile indexFile pkgs' <- evaluate $ PackageIndex.fromList [ mkPkg pkgid pkg | (pkgid, pkg, _) <- pkgs] return (pkgs', prefs) -- | Parse an uncompressed \"00-index.tar\" repository index file represented -- as a 'ByteString'. --
623
readPackageIndexFile mkPkg indexFile = do (pkgs, prefs) <- either fail return . parsePackageIndex . maybeDecompress =<< BS.readFile indexFile pkgs' <- evaluate $ PackageIndex.fromList [ mkPkg pkgid pkg | (pkgid, pkg, _) <- pkgs] return (pkgs', prefs) -- | Parse an uncompressed \"00-index.tar\" repository index file represented -- as a 'ByteString'. --
422
false
true
0
14
199
153
77
76
null
null
haroldcarr/learn-haskell-coq-ml-etc
haskell/playpen/anyhow/src/Lib.hs
unlicense
quxM :: Monad m => Int -> LBFT m e s a (Either (ErrLog a) Int) quxM i = ensure (i==i) (ErrL ["quxM1"]) () .?. ensure (i==i) (ErrL ["quxM2"]) .?. ensure (i==i) (ErrL ["quxM3"]) .?. const (ok 3)
206
quxM :: Monad m => Int -> LBFT m e s a (Either (ErrLog a) Int) quxM i = ensure (i==i) (ErrL ["quxM1"]) () .?. ensure (i==i) (ErrL ["quxM2"]) .?. ensure (i==i) (ErrL ["quxM3"]) .?. const (ok 3)
206
quxM i = ensure (i==i) (ErrL ["quxM1"]) () .?. ensure (i==i) (ErrL ["quxM2"]) .?. ensure (i==i) (ErrL ["quxM3"]) .?. const (ok 3)
143
false
true
0
11
51
138
69
69
null
null
d3sformal/bacon-core
src/Domain/Trans/FunctionAwareDomain.hs
mit
liftL :: Monad d => LocationAwareDomainT d a -> FunctionAwareDomainT d a liftL = FunctionAwareDomainT . lift
108
liftL :: Monad d => LocationAwareDomainT d a -> FunctionAwareDomainT d a liftL = FunctionAwareDomainT . lift
108
liftL = FunctionAwareDomainT . lift
35
false
true
0
8
16
42
18
24
null
null
psibi/yesod
yesod-websockets/Yesod/WebSockets.hs
mit
receiveDataMessageE :: (MonadIO m, MonadReader WS.Connection m) => m (Either SomeException WS.DataMessage) receiveDataMessageE = do conn <- ask liftIO $ tryAny $ WS.receiveDataMessage conn -- | Send a textual message to the client. -- -- Since 0.1.0
258
receiveDataMessageE :: (MonadIO m, MonadReader WS.Connection m) => m (Either SomeException WS.DataMessage) receiveDataMessageE = do conn <- ask liftIO $ tryAny $ WS.receiveDataMessage conn -- | Send a textual message to the client. -- -- Since 0.1.0
258
receiveDataMessageE = do conn <- ask liftIO $ tryAny $ WS.receiveDataMessage conn -- | Send a textual message to the client. -- -- Since 0.1.0
147
false
true
0
10
45
73
36
37
null
null
MichielDerhaeg/stack
src/Stack/Exec.hs
bsd-3-clause
execObserve :: (MonadUnliftIO m, MonadLogger m) => EnvOverride -> String -> [String] -> m String execObserve menv cmd0 args = do e <- withProcessTimeLog cmd0 args $ try (callProcessObserveStdout (Cmd Nothing cmd0 menv args)) case e of Left (ProcessExitedUnsuccessfully _ ec) -> liftIO $ exitWith ec Right s -> return s
354
execObserve :: (MonadUnliftIO m, MonadLogger m) => EnvOverride -> String -> [String] -> m String execObserve menv cmd0 args = do e <- withProcessTimeLog cmd0 args $ try (callProcessObserveStdout (Cmd Nothing cmd0 menv args)) case e of Left (ProcessExitedUnsuccessfully _ ec) -> liftIO $ exitWith ec Right s -> return s
354
execObserve menv cmd0 args = do e <- withProcessTimeLog cmd0 args $ try (callProcessObserveStdout (Cmd Nothing cmd0 menv args)) case e of Left (ProcessExitedUnsuccessfully _ ec) -> liftIO $ exitWith ec Right s -> return s
253
false
true
0
13
86
131
62
69
null
null
bjorg/HPlug
plug.hs
mit
encodeUserInfo :: String -> String encodeUserInfo = escapeURIString (isValidUriChar UserInfo)
93
encodeUserInfo :: String -> String encodeUserInfo = escapeURIString (isValidUriChar UserInfo)
93
encodeUserInfo = escapeURIString (isValidUriChar UserInfo)
58
false
true
0
7
9
30
13
17
null
null
music-suite/music-pitch
src/Music/Pitch/Literal/Pitch.hs
bsd-3-clause
fb' = fromPitch $ viaPitchL (3, (-1), 1)
46
fb' = fromPitch $ viaPitchL (3, (-1), 1)
46
fb' = fromPitch $ viaPitchL (3, (-1), 1)
46
false
false
0
9
13
27
15
12
null
null
alexander-at-github/eta
compiler/ETA/TypeCheck/TcPluginM.hs
bsd-3-clause
tcLookupId :: Name -> TcPluginM Id tcLookupId = unsafeTcPluginTcM . TcEnv.tcLookupId
84
tcLookupId :: Name -> TcPluginM Id tcLookupId = unsafeTcPluginTcM . TcEnv.tcLookupId
84
tcLookupId = unsafeTcPluginTcM . TcEnv.tcLookupId
49
false
true
0
6
10
24
12
12
null
null
mohsen3/haskell-tutorials
src/job-scheduling/src/Scheduler.hs
mit
bestCoresFit = genericSingleFieldScheduler cores minimumBy
58
bestCoresFit = genericSingleFieldScheduler cores minimumBy
58
bestCoresFit = genericSingleFieldScheduler cores minimumBy
58
false
false
0
5
4
11
5
6
null
null
vasily-kirichenko/haskell-book
src/Monads.hs
bsd-3-clause
append :: List a -> List a -> List a append Nil ys = ys
55
append :: List a -> List a -> List a append Nil ys = ys
55
append Nil ys = ys
18
false
true
0
7
14
33
15
18
null
null
lancelotsix/hs-tls
core/Network/TLS/Extension/EC.hs
bsd-3-clause
fromCurveName SEC_p192r1 = Just 19
34
fromCurveName SEC_p192r1 = Just 19
34
fromCurveName SEC_p192r1 = Just 19
34
false
false
0
5
4
12
5
7
null
null
facebookincubator/duckling
Duckling/Ordinal/PL/Rules.hs
bsd-3-clause
ruleThOrdinal5 :: Rule ruleThOrdinal5 = Rule { name = "12th ordinal" , pattern = [ regex "dwunast(ym|y|ego|emu|(a|ą)|ej)" ] , prod = \_ -> Just $ ordinal 12 }
174
ruleThOrdinal5 :: Rule ruleThOrdinal5 = Rule { name = "12th ordinal" , pattern = [ regex "dwunast(ym|y|ego|emu|(a|ą)|ej)" ] , prod = \_ -> Just $ ordinal 12 }
174
ruleThOrdinal5 = Rule { name = "12th ordinal" , pattern = [ regex "dwunast(ym|y|ego|emu|(a|ą)|ej)" ] , prod = \_ -> Just $ ordinal 12 }
151
false
true
0
10
43
59
30
29
null
null
jwiegley/lambdabot-1
unlambda/Language/Unlambda.hs
mit
apply (S2 x y) z = eval (App (App x z) (App y z))
49
apply (S2 x y) z = eval (App (App x z) (App y z))
49
apply (S2 x y) z = eval (App (App x z) (App y z))
49
false
false
0
9
13
46
22
24
null
null
mokus0/smoker-control
ResistanceRange.hs
unlicense
adcTRes probe adc = adcTResAtCnt probe adc . adcTCnt probe adc
62
adcTRes probe adc = adcTResAtCnt probe adc . adcTCnt probe adc
62
adcTRes probe adc = adcTResAtCnt probe adc . adcTCnt probe adc
62
false
false
1
6
10
29
11
18
null
null
imalsogreg/arte-ephys
tetrode-ephys/src/Data/Map/KDMap.hs
gpl-3.0
isValid (KDLeaf _ _ _) = True
29
isValid (KDLeaf _ _ _) = True
29
isValid (KDLeaf _ _ _) = True
29
false
false
0
7
6
19
9
10
null
null
riccardoscalco/FluBud
flubud.hs
gpl-3.0
main :: IO () main = runCommand $ \opts args -> do if null (optFastaFile opts) then error "The --fasta flag is required." else return () contents <- readFile $ optFastaFile opts let ps = [getPartition (optSpace opts) l | l <- getSequenceList $ lines contents] mat = matRohlinR muFlat ps mapM_ print mat
345
main :: IO () main = runCommand $ \opts args -> do if null (optFastaFile opts) then error "The --fasta flag is required." else return () contents <- readFile $ optFastaFile opts let ps = [getPartition (optSpace opts) l | l <- getSequenceList $ lines contents] mat = matRohlinR muFlat ps mapM_ print mat
345
main = runCommand $ \opts args -> do if null (optFastaFile opts) then error "The --fasta flag is required." else return () contents <- readFile $ optFastaFile opts let ps = [getPartition (optSpace opts) l | l <- getSequenceList $ lines contents] mat = matRohlinR muFlat ps mapM_ print mat
331
false
true
2
16
96
132
60
72
null
null
cosmoharrigan/atomspace
tests/haskell/src/OpenCog/Test.hs
agpl-3.0
uncurry1 = uncurry
18
uncurry1 = uncurry
18
uncurry1 = uncurry
18
false
false
0
4
2
6
3
3
null
null
amccausl/Swish
Swish/HaskellRDF/RDFGraphTest.hs
lgpl-2.1
gt2f3a = setFormulae ftm3 gt2
29
gt2f3a = setFormulae ftm3 gt2
29
gt2f3a = setFormulae ftm3 gt2
29
false
false
1
5
4
14
5
9
null
null
olsner/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
-- Generic data constructors crossDataConKey, inlDataConKey, inrDataConKey, genUnitDataConKey :: Unique crossDataConKey = mkPreludeDataConUnique 20
171
crossDataConKey, inlDataConKey, inrDataConKey, genUnitDataConKey :: Unique crossDataConKey = mkPreludeDataConUnique 20
142
crossDataConKey = mkPreludeDataConUnique 20
67
true
true
0
5
37
21
14
7
null
null
UU-ComputerScience/uu-cco
uu-cco/src/CCO/Feedback.hs
bsd-3-clause
-- | Runs a 'Feedback' computation at a specified verbosity and severity level, -- pretty printing messages onto a specified -- 'Handle'. runFeedback :: Feedback a -> Int -> Int -> Handle -> IO (Maybe a) runFeedback (Succeed msgs x) v w h = do let msgs' = filterMessages v w msgs putMessages h msgs' return (Just x)
395
runFeedback :: Feedback a -> Int -> Int -> Handle -> IO (Maybe a) runFeedback (Succeed msgs x) v w h = do let msgs' = filterMessages v w msgs putMessages h msgs' return (Just x)
257
runFeedback (Succeed msgs x) v w h = do let msgs' = filterMessages v w msgs putMessages h msgs' return (Just x)
191
true
true
0
11
137
95
45
50
null
null
substack/hs-disappoint
src/Language/Haskell/Pointfree/Rules.hs
mit
sumE = Quote $ Var Pref "sum"
35
sumE = Quote $ Var Pref "sum"
35
sumE = Quote $ Var Pref "sum"
35
false
false
0
6
12
15
7
8
null
null
ghcjs/ghcjs
src/Gen2/Rts.hs
mit
assignRegs' :: Array Int Ident assignRegs' = listArray (1,32) (map (TxtI . T.pack . ("h$l"++) . show) [(1::Int)..32])
117
assignRegs' :: Array Int Ident assignRegs' = listArray (1,32) (map (TxtI . T.pack . ("h$l"++) . show) [(1::Int)..32])
117
assignRegs' = listArray (1,32) (map (TxtI . T.pack . ("h$l"++) . show) [(1::Int)..32])
86
false
true
0
12
17
67
37
30
null
null
brendanhay/gogol
gogol-iam/gen/Network/Google/Resource/IAM/Projects/Roles/Get.hs
mpl-2.0
-- | Upload protocol for media (e.g. \"raw\", \"multipart\"). prgUploadProtocol :: Lens' ProjectsRolesGet (Maybe Text) prgUploadProtocol = lens _prgUploadProtocol (\ s a -> s{_prgUploadProtocol = a})
207
prgUploadProtocol :: Lens' ProjectsRolesGet (Maybe Text) prgUploadProtocol = lens _prgUploadProtocol (\ s a -> s{_prgUploadProtocol = a})
145
prgUploadProtocol = lens _prgUploadProtocol (\ s a -> s{_prgUploadProtocol = a})
88
true
true
0
9
33
48
25
23
null
null
Saulzar/Ants
Ant/Renderer.hs
bsd-3-clause
{-makeRGB (fromIntegral (i * 117 `mod` 360)) where makeRGB hue = uncurryRGB sRGB (hsv hue 1 1) -} drawCircle :: Point -> Double -> Render () drawCircle (Point x y) r = arc (fromIntegral x) (fromIntegral y) r 0 (pi * 2.0)
237
drawCircle :: Point -> Double -> Render () drawCircle (Point x y) r = arc (fromIntegral x) (fromIntegral y) r 0 (pi * 2.0)
122
drawCircle (Point x y) r = arc (fromIntegral x) (fromIntegral y) r 0 (pi * 2.0)
79
true
true
0
8
58
68
34
34
null
null
ihc/futhark
src/Futhark/Representation/AST/Attributes/Aliases.hs
isc
primOpAliases (Reshape _ e) = [vnameAliases e]
48
primOpAliases (Reshape _ e) = [vnameAliases e]
48
primOpAliases (Reshape _ e) = [vnameAliases e]
48
false
false
0
7
8
23
11
12
null
null
ScrambledEggsOnToast/kdt
lib-src/Data/KdTree/Static.hs
mit
-- | Returns the number of elements in the 'KdTree'. -- -- Time complexity: /O(1)/ size :: KdTree a p -> Int size (KdTree t) = KDM.size t
137
size :: KdTree a p -> Int size (KdTree t) = KDM.size t
54
size (KdTree t) = KDM.size t
28
true
true
0
7
27
37
19
18
null
null
gcampax/ghc
compiler/typecheck/TcGenDeriv.hs
bsd-3-clause
ltTag_Expr = nlHsVar ltTag_RDR
35
ltTag_Expr = nlHsVar ltTag_RDR
35
ltTag_Expr = nlHsVar ltTag_RDR
35
false
false
1
5
8
12
4
8
null
null
DavidAlphaFox/ghc
libraries/array/Data/Array/Base.hs
bsd-3-clause
unsafeAccumArrayST :: Ix i => (e -> e' -> e) -> e -> (i,i) -> [(Int, e')] -> ST s (STArray s i e) unsafeAccumArrayST f e (l,u) ies = do marr <- newArray (l,u) e sequence_ [do old <- unsafeRead marr i unsafeWrite marr i (f old new) | (i, new) <- ies] return marr
308
unsafeAccumArrayST :: Ix i => (e -> e' -> e) -> e -> (i,i) -> [(Int, e')] -> ST s (STArray s i e) unsafeAccumArrayST f e (l,u) ies = do marr <- newArray (l,u) e sequence_ [do old <- unsafeRead marr i unsafeWrite marr i (f old new) | (i, new) <- ies] return marr
308
unsafeAccumArrayST f e (l,u) ies = do marr <- newArray (l,u) e sequence_ [do old <- unsafeRead marr i unsafeWrite marr i (f old new) | (i, new) <- ies] return marr
210
false
true
0
13
102
167
84
83
null
null
brendanhay/gogol
gogol-vision/gen/Network/Google/Vision/Types/Product.hs
mpl-2.0
-- | Creates a value of 'GoogleCloudVisionV1p2beta1EntityAnnotation' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'gcvvea2Score' -- -- * 'gcvvea2Topicality' -- -- * 'gcvvea2Locale' -- -- * 'gcvvea2BoundingPoly' -- -- * 'gcvvea2Confidence' -- -- * 'gcvvea2Mid' -- -- * 'gcvvea2Locations' -- -- * 'gcvvea2Description' -- -- * 'gcvvea2Properties' googleCloudVisionV1p2beta1EntityAnnotation :: GoogleCloudVisionV1p2beta1EntityAnnotation googleCloudVisionV1p2beta1EntityAnnotation = GoogleCloudVisionV1p2beta1EntityAnnotation' { _gcvvea2Score = Nothing , _gcvvea2Topicality = Nothing , _gcvvea2Locale = Nothing , _gcvvea2BoundingPoly = Nothing , _gcvvea2Confidence = Nothing , _gcvvea2Mid = Nothing , _gcvvea2Locations = Nothing , _gcvvea2Description = Nothing , _gcvvea2Properties = Nothing }
922
googleCloudVisionV1p2beta1EntityAnnotation :: GoogleCloudVisionV1p2beta1EntityAnnotation googleCloudVisionV1p2beta1EntityAnnotation = GoogleCloudVisionV1p2beta1EntityAnnotation' { _gcvvea2Score = Nothing , _gcvvea2Topicality = Nothing , _gcvvea2Locale = Nothing , _gcvvea2BoundingPoly = Nothing , _gcvvea2Confidence = Nothing , _gcvvea2Mid = Nothing , _gcvvea2Locations = Nothing , _gcvvea2Description = Nothing , _gcvvea2Properties = Nothing }
490
googleCloudVisionV1p2beta1EntityAnnotation = GoogleCloudVisionV1p2beta1EntityAnnotation' { _gcvvea2Score = Nothing , _gcvvea2Topicality = Nothing , _gcvvea2Locale = Nothing , _gcvvea2BoundingPoly = Nothing , _gcvvea2Confidence = Nothing , _gcvvea2Mid = Nothing , _gcvvea2Locations = Nothing , _gcvvea2Description = Nothing , _gcvvea2Properties = Nothing }
397
true
true
1
7
154
95
65
30
null
null
acowley/ghc
compiler/basicTypes/DataCon.hs
bsd-3-clause
-- | The representation type of the data constructor, i.e. the sort -- type that will represent values of this type at runtime dataConRepType :: DataCon -> Type dataConRepType = dcRepType
187
dataConRepType :: DataCon -> Type dataConRepType = dcRepType
60
dataConRepType = dcRepType
26
true
true
0
5
30
17
10
7
null
null
pauloborba/plc
src/InterpretacaoEAnaliseEstaticaComMonads.hs
cc0-1.0
wr (i,v) ((j,u):l) = if (i == j) then (j,v):l else [(j,u)] ++ (wr (i,v) l)
74
wr (i,v) ((j,u):l) = if (i == j) then (j,v):l else [(j,u)] ++ (wr (i,v) l)
74
wr (i,v) ((j,u):l) = if (i == j) then (j,v):l else [(j,u)] ++ (wr (i,v) l)
74
false
false
0
9
15
82
48
34
null
null
23Skidoo/snap-core
test/Snap/Test/Common.hs
bsd-3-clause
------------------------------------------------------------------------------ expectException :: IO a -> PropertyM IO () expectException m = do e <- liftQ $ try m case e of Left (z::SomeException) -> (forceList $ show z) `seq` return () Right _ -> fail "expected exception, didn't get one" ------------------------------------------------------------------------------
392
expectException :: IO a -> PropertyM IO () expectException m = do e <- liftQ $ try m case e of Left (z::SomeException) -> (forceList $ show z) `seq` return () Right _ -> fail "expected exception, didn't get one" ------------------------------------------------------------------------------
313
expectException m = do e <- liftQ $ try m case e of Left (z::SomeException) -> (forceList $ show z) `seq` return () Right _ -> fail "expected exception, didn't get one" ------------------------------------------------------------------------------
270
true
true
0
13
64
100
48
52
null
null
bgamari/pandoc
src/Text/Pandoc/Parsing.hs
gpl-2.0
exampleNum :: Stream s m Char => ParserT s ParserState m (ListNumberStyle, Int) exampleNum = do char '@' lab <- many (alphaNum <|> satisfy (\c -> c == '_' || c == '-')) st <- getState let num = stateNextExample st let newlabels = if null lab then stateExamples st else M.insert lab num $ stateExamples st updateState $ \s -> s{ stateNextExample = num + 1 , stateExamples = newlabels } return (Example, num) -- | Parses a '#' returns (DefaultStyle, 1).
545
exampleNum :: Stream s m Char => ParserT s ParserState m (ListNumberStyle, Int) exampleNum = do char '@' lab <- many (alphaNum <|> satisfy (\c -> c == '_' || c == '-')) st <- getState let num = stateNextExample st let newlabels = if null lab then stateExamples st else M.insert lab num $ stateExamples st updateState $ \s -> s{ stateNextExample = num + 1 , stateExamples = newlabels } return (Example, num) -- | Parses a '#' returns (DefaultStyle, 1).
545
exampleNum = do char '@' lab <- many (alphaNum <|> satisfy (\c -> c == '_' || c == '-')) st <- getState let num = stateNextExample st let newlabels = if null lab then stateExamples st else M.insert lab num $ stateExamples st updateState $ \s -> s{ stateNextExample = num + 1 , stateExamples = newlabels } return (Example, num) -- | Parses a '#' returns (DefaultStyle, 1).
454
false
true
0
17
176
188
91
97
null
null
purebred-mua/purebred
src/Purebred/Types/Parser/ByteString.hs
agpl-3.0
-- | Assert end of input has been reached, or fail with a message -- that includes the problematic character and the offset. niceEndOfInput :: Parser () niceEndOfInput = endOfInput <|> p where p = do c <- peekChar' off <- offset fail $ "unexpected " <> show c <> " at offset " <> show off -- | Get the current position of the parser
349
niceEndOfInput :: Parser () niceEndOfInput = endOfInput <|> p where p = do c <- peekChar' off <- offset fail $ "unexpected " <> show c <> " at offset " <> show off -- | Get the current position of the parser
224
niceEndOfInput = endOfInput <|> p where p = do c <- peekChar' off <- offset fail $ "unexpected " <> show c <> " at offset " <> show off -- | Get the current position of the parser
196
true
true
0
10
82
70
34
36
null
null
ezyang/ghc
compiler/nativeGen/RegAlloc/Linear/SPARC/FreeRegs.hs
bsd-3-clause
oFreeRegs :: FreeRegs noFreeRegs = FreeRegs 0 0 0
50
noFreeRegs :: FreeRegs noFreeRegs = FreeRegs 0 0 0
50
noFreeRegs = FreeRegs 0 0 0
27
false
true
0
5
9
18
9
9
null
null
phunehehe/deepseq-bounded
tests/FooG.hs
bsd-3-clause
- E/A = 2 . B1 Bool TA expTB_20 = B6 __
46
expTB_20 = B6 __
16
expTB_20 = B6 __
16
true
false
5
5
18
38
14
24
null
null
ghc-android/ghc
testsuite/tests/ghci/should_run/ghcirun004.hs
bsd-3-clause
1043 = 1042
11
1043 = 1042
11
1043 = 1042
11
false
false
1
5
2
10
3
7
null
null
shicks/shsh
Language/Sh/Parser/Parsec.hs
bsd-3-clause
schar :: Char -> P Char schar c = do x <- char c spaces return x -- *More general functions
118
schar :: Char -> P Char schar c = do x <- char c spaces return x -- *More general functions
118
schar c = do x <- char c spaces return x -- *More general functions
94
false
true
0
9
47
46
19
27
null
null
mgsloan/compconfig
env/src/Process.hs
mit
syncSpawnImpl :: [String] -> FilePath -> [String] -> Xio () syncSpawnImpl catArgs cmd args = withCurrentEnv $ loggedProc catArgs cmd args $ runProcess_ . setStdin closed
171
syncSpawnImpl :: [String] -> FilePath -> [String] -> Xio () syncSpawnImpl catArgs cmd args = withCurrentEnv $ loggedProc catArgs cmd args $ runProcess_ . setStdin closed
171
syncSpawnImpl catArgs cmd args = withCurrentEnv $ loggedProc catArgs cmd args $ runProcess_ . setStdin closed
111
false
true
2
9
27
68
32
36
null
null
m0ar/safe-streaming
benchmarks/StreamingTest.hs
bsd-3-clause
simple_conduit_basic :: IO Int simple_conduit_basic = do xs <- S.sourceList [1..1000000] S.$= S.filterC even S.$= S.mapC ((+1) :: Int -> Int) S.$= S.dropC 1000 S.$= S.mapC ((+1) :: Int -> Int) S.$= S.filterC (\x -> x `mod` 2 == 0) S.$$ S.sinkList assert (Prelude.length xs == 499000) $ return (Prelude.length (xs :: [Int]))
377
simple_conduit_basic :: IO Int simple_conduit_basic = do xs <- S.sourceList [1..1000000] S.$= S.filterC even S.$= S.mapC ((+1) :: Int -> Int) S.$= S.dropC 1000 S.$= S.mapC ((+1) :: Int -> Int) S.$= S.filterC (\x -> x `mod` 2 == 0) S.$$ S.sinkList assert (Prelude.length xs == 499000) $ return (Prelude.length (xs :: [Int]))
377
simple_conduit_basic = do xs <- S.sourceList [1..1000000] S.$= S.filterC even S.$= S.mapC ((+1) :: Int -> Int) S.$= S.dropC 1000 S.$= S.mapC ((+1) :: Int -> Int) S.$= S.filterC (\x -> x `mod` 2 == 0) S.$$ S.sinkList assert (Prelude.length xs == 499000) $ return (Prelude.length (xs :: [Int]))
346
false
true
0
15
106
182
94
88
null
null
danidiaz/plan-applicative
lib/Control/Plan/Core.hs
mit
unliftKPlan :: Monad m => Plan s w m i o -> i -> m o unliftKPlan = unliftPlan'
78
unliftKPlan :: Monad m => Plan s w m i o -> i -> m o unliftKPlan = unliftPlan'
78
unliftKPlan = unliftPlan'
25
false
true
0
9
18
46
20
26
null
null
stschiff/rarecoal-tools
src-concatFreqSum/concatFreqSum.hs
gpl-3.0
options = OP.some (OP.strArgument (OP.metavar "FILES" <> OP.help "input file(s)"))
82
options = OP.some (OP.strArgument (OP.metavar "FILES" <> OP.help "input file(s)"))
82
options = OP.some (OP.strArgument (OP.metavar "FILES" <> OP.help "input file(s)"))
82
false
false
1
11
9
39
17
22
null
null
richardmiller/phsgen
Output.hs
mit
outputTemplate templateFilename outputRoot vars = do createDirectoryIfMissing True (outputDirectory cName outputRoot) rendered <- hastacheStr defaultConfig (encodeStr template) (mkGenericContext (toTemplateVars vars)) fileExists <- doesFileExist fName C.unless (fileExists && fromMaybe False (CV.locked vars)) $ TL.writeFile fName rendered where fName = outputFilename cName outputRoot cName = CV.className vars outputFilename cName = addOutputRoot $ cName ++ ".php" outputDirectory cName = addOutputRoot $ dirPath cName dirPath = join "\\" . init . splitNamespace addOutputRoot path outputRoot = concat [outputRoot, "/", map replaceSeparators $ path] replaceSeparators = (\c -> if c=='\\' then '/'; else c)
815
outputTemplate templateFilename outputRoot vars = do createDirectoryIfMissing True (outputDirectory cName outputRoot) rendered <- hastacheStr defaultConfig (encodeStr template) (mkGenericContext (toTemplateVars vars)) fileExists <- doesFileExist fName C.unless (fileExists && fromMaybe False (CV.locked vars)) $ TL.writeFile fName rendered where fName = outputFilename cName outputRoot cName = CV.className vars outputFilename cName = addOutputRoot $ cName ++ ".php" outputDirectory cName = addOutputRoot $ dirPath cName dirPath = join "\\" . init . splitNamespace addOutputRoot path outputRoot = concat [outputRoot, "/", map replaceSeparators $ path] replaceSeparators = (\c -> if c=='\\' then '/'; else c)
815
outputTemplate templateFilename outputRoot vars = do createDirectoryIfMissing True (outputDirectory cName outputRoot) rendered <- hastacheStr defaultConfig (encodeStr template) (mkGenericContext (toTemplateVars vars)) fileExists <- doesFileExist fName C.unless (fileExists && fromMaybe False (CV.locked vars)) $ TL.writeFile fName rendered where fName = outputFilename cName outputRoot cName = CV.className vars outputFilename cName = addOutputRoot $ cName ++ ".php" outputDirectory cName = addOutputRoot $ dirPath cName dirPath = join "\\" . init . splitNamespace addOutputRoot path outputRoot = concat [outputRoot, "/", map replaceSeparators $ path] replaceSeparators = (\c -> if c=='\\' then '/'; else c)
815
false
false
0
14
196
234
115
119
null
null
nevrenato/Hets_Fork
Static/test/TestDGTrans.hs
gpl-2.0
process :: HetcatsOpts -> FilePath -> IO (Maybe (LIB_NAME, LibEnv)) process opts file = do mResult <- anaLib opts file case mResult of Just (libName, gcMap) -> do ccomor <- compComorphism (Comorphism CASL2PCFOL) (Comorphism defaultCASL2SubCFOL) gcMap' <- trans gcMap ccomor return $ Just (libName, gcMap') _ -> fail "analib error."
425
process :: HetcatsOpts -> FilePath -> IO (Maybe (LIB_NAME, LibEnv)) process opts file = do mResult <- anaLib opts file case mResult of Just (libName, gcMap) -> do ccomor <- compComorphism (Comorphism CASL2PCFOL) (Comorphism defaultCASL2SubCFOL) gcMap' <- trans gcMap ccomor return $ Just (libName, gcMap') _ -> fail "analib error."
425
process opts file = do mResult <- anaLib opts file case mResult of Just (libName, gcMap) -> do ccomor <- compComorphism (Comorphism CASL2PCFOL) (Comorphism defaultCASL2SubCFOL) gcMap' <- trans gcMap ccomor return $ Just (libName, gcMap') _ -> fail "analib error."
357
false
true
0
16
143
139
65
74
null
null
Chobbes/Juicy.Pixels
src/Codec/Picture/InternalHelper.hs
bsd-3-clause
getRemainingBytes :: Get B.ByteString getRemainingBytes = do rest <- getRemainingLazyByteString return $ case L.toChunks rest of [] -> B.empty [a] -> a lst -> B.concat lst
204
getRemainingBytes :: Get B.ByteString getRemainingBytes = do rest <- getRemainingLazyByteString return $ case L.toChunks rest of [] -> B.empty [a] -> a lst -> B.concat lst
204
getRemainingBytes = do rest <- getRemainingLazyByteString return $ case L.toChunks rest of [] -> B.empty [a] -> a lst -> B.concat lst
166
false
true
0
12
58
69
33
36
null
null
neothemachine/monadiccp
src/Control/CP/FD/SearchSpec/Data.hs
bsd-3-clause
mmapSearch (Labelling (LabelCol a x d s f)) vf af bf = af a >>= \y -> return $ Labelling $ LabelCol y x d s f
109
mmapSearch (Labelling (LabelCol a x d s f)) vf af bf = af a >>= \y -> return $ Labelling $ LabelCol y x d s f
109
mmapSearch (Labelling (LabelCol a x d s f)) vf af bf = af a >>= \y -> return $ Labelling $ LabelCol y x d s f
109
false
false
0
9
26
66
32
34
null
null
HIPERFIT/futhark
src/Futhark/Analysis/SymbolTable.hs
isc
indexExp table (BasicOp (Replicate (Shape [_]) (Var v))) _ (_ : is) = do guard $ v `available` table index' v is table
122
indexExp table (BasicOp (Replicate (Shape [_]) (Var v))) _ (_ : is) = do guard $ v `available` table index' v is table
122
indexExp table (BasicOp (Replicate (Shape [_]) (Var v))) _ (_ : is) = do guard $ v `available` table index' v is table
122
false
false
0
12
26
75
37
38
null
null
GaloisInc/halvm-ghc
compiler/basicTypes/RdrName.hs
bsd-3-clause
plusParent :: Parent -> Parent -> Parent -- See Note [Combining parents] plusParent p1@(ParentIs _) p2 = hasParent p1 p2
123
plusParent :: Parent -> Parent -> Parent plusParent p1@(ParentIs _) p2 = hasParent p1 p2
91
plusParent p1@(ParentIs _) p2 = hasParent p1 p2
50
true
true
0
8
22
39
20
19
null
null
artems/htorr
src/Process/Tracker.hs
bsd-3-clause
tryTier' :: StatusState -> [B.ByteString] -> Process PConf PState (Either String (B.ByteString, TrackerResponse)) tryTier' torrentStatus [] = return (Left "Пустой список трекеров")
192
tryTier' :: StatusState -> [B.ByteString] -> Process PConf PState (Either String (B.ByteString, TrackerResponse)) tryTier' torrentStatus [] = return (Left "Пустой список трекеров")
192
tryTier' torrentStatus [] = return (Left "Пустой список трекеров")
66
false
true
0
12
33
67
33
34
null
null
tavisrudd/ghcjs-base
JavaScript/JSON/Types.hs
mit
-- | Run a 'Parser' with a 'Maybe' result type. parseMaybe :: (a -> Parser b) -> a -> Maybe b parseMaybe m v = runParser (m v) (const Nothing) Just
147
parseMaybe :: (a -> Parser b) -> a -> Maybe b parseMaybe m v = runParser (m v) (const Nothing) Just
99
parseMaybe m v = runParser (m v) (const Nothing) Just
53
true
true
0
9
30
61
29
32
null
null
sfultong/stand-in-language
src/SIL/TypeChecker.hs
apache-2.0
getPartialAnnotation (TraceTA x) = getPartialAnnotation x
57
getPartialAnnotation (TraceTA x) = getPartialAnnotation x
57
getPartialAnnotation (TraceTA x) = getPartialAnnotation x
57
false
false
0
6
5
19
8
11
null
null
markuspf/Idris-dev
src/Idris/IdeMode.hs
bsd-3-clause
atom = do string "nil"; return (SexpList []) <|> do char ':'; x <- atomC; return x <|> do char '"'; xs <- many quotedChar; char '"'; return (StringAtom xs) <|> do ints <- some digit case readDec ints of ((num, ""):_) -> return (IntegerAtom (toInteger num)) _ -> return (StringAtom ints)
329
atom = do string "nil"; return (SexpList []) <|> do char ':'; x <- atomC; return x <|> do char '"'; xs <- many quotedChar; char '"'; return (StringAtom xs) <|> do ints <- some digit case readDec ints of ((num, ""):_) -> return (IntegerAtom (toInteger num)) _ -> return (StringAtom ints)
329
atom = do string "nil"; return (SexpList []) <|> do char ':'; x <- atomC; return x <|> do char '"'; xs <- many quotedChar; char '"'; return (StringAtom xs) <|> do ints <- some digit case readDec ints of ((num, ""):_) -> return (IntegerAtom (toInteger num)) _ -> return (StringAtom ints)
329
false
false
10
15
94
179
82
97
null
null
badi/super-user-spark
src/Compiler.hs
mit
inputCompiled :: FilePath -> Sparker [Deployment] inputCompiled fp = do bs <- liftIO $ BS.readFile fp case eitherDecode bs of Left err -> throwError $ CompileError $ "Something went wrong while deserialising json data: " ++ err Right ds -> return ds
287
inputCompiled :: FilePath -> Sparker [Deployment] inputCompiled fp = do bs <- liftIO $ BS.readFile fp case eitherDecode bs of Left err -> throwError $ CompileError $ "Something went wrong while deserialising json data: " ++ err Right ds -> return ds
287
inputCompiled fp = do bs <- liftIO $ BS.readFile fp case eitherDecode bs of Left err -> throwError $ CompileError $ "Something went wrong while deserialising json data: " ++ err Right ds -> return ds
237
false
true
0
12
79
83
38
45
null
null
nushio3/ghc
libraries/base/Data/Data.hs
bsd-3-clause
------------------------------------------------------------------------------ -- -- From strings to constr's and vice versa: all data types -- ------------------------------------------------------------------------------ -- | Gets the string for a constructor showConstr :: Constr -> String showConstr = constring
322
showConstr :: Constr -> String showConstr = constring
53
showConstr = constring
22
true
true
0
7
37
28
15
13
null
null
beni55/attoparsec
benchmarks/TextFastSet.hs
bsd-3-clause
resolveCollisions :: [Entry] -> [Entry] resolveCollisions [] = []
65
resolveCollisions :: [Entry] -> [Entry] resolveCollisions [] = []
65
resolveCollisions [] = []
25
false
true
0
6
8
28
15
13
null
null
fmapfmapfmap/amazonka
amazonka-elasticache/gen/Network/AWS/ElastiCache/Types/Product.hs
mpl-2.0
-- | Creates a value of 'SecurityGroupMembership' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'sgmStatus' -- -- * 'sgmSecurityGroupId' securityGroupMembership :: SecurityGroupMembership securityGroupMembership = SecurityGroupMembership' { _sgmStatus = Nothing , _sgmSecurityGroupId = Nothing }
402
securityGroupMembership :: SecurityGroupMembership securityGroupMembership = SecurityGroupMembership' { _sgmStatus = Nothing , _sgmSecurityGroupId = Nothing }
178
securityGroupMembership = SecurityGroupMembership' { _sgmStatus = Nothing , _sgmSecurityGroupId = Nothing }
123
true
true
0
6
72
32
22
10
null
null
sjpet/quark
src/Quark/Lexer/Core.hs
mit
mapT f (Whitespace s) = f s
30
mapT f (Whitespace s) = f s
30
mapT f (Whitespace s) = f s
30
false
false
0
7
9
20
9
11
null
null
kumasento/accelerate
Data/Array/Accelerate/Trafo/Algebra.hs
bsd-3-clause
-- Scalar primitives -- ----------------- evalPrimConst :: PrimConst a -> a evalPrimConst (PrimMinBound ty) = evalMinBound ty
126
evalPrimConst :: PrimConst a -> a evalPrimConst (PrimMinBound ty) = evalMinBound ty
83
evalPrimConst (PrimMinBound ty) = evalMinBound ty
49
true
true
0
7
17
32
16
16
null
null
metabrainz/caa-admin
Main.hs
gpl-3.0
consumeFailures :: AMQP.Connection -> Text -> AcidState.AcidState FailedEvents -> IO (IO ()) consumeFailures conn failureQueue allFailures = do rabbitChan <- AMQP.openChannel conn retryChan <- AMQP.openChannel conn consumer <- AMQP.consumeMsgs rabbitChan failureQueue AMQP.Ack $ \(msg, env) -> do result <- runMaybeT $ do evType <- MaybeT $ return $ case AMQP.envRoutingKey env of "index" -> Just Index "delete" -> Just Delete "move" -> Just Move _ -> Nothing reasons <- MaybeT $ return $ fmap Sequence.fromList $ case AMQP.msgHeaders msg of Just (AMQP.FieldTable m) -> case Map.lookup "mb-exceptions" m of Just (AMQP.FVFieldArray reasons) -> traverse ?? reasons $ \r -> case r of AMQP.FVString s -> Just s _ -> Nothing _ -> Just [] _ -> Just [] now <- liftIO getCurrentTime liftIO $ AcidState.update allFailures $ AppendFailedEvent reasons now evType (Text.decodeUtf8 $ AMQP.msgBody msg ^. strict) case result of Nothing -> requeue retryChan env Just _ -> AMQP.ackEnv env return $ AMQP.cancelConsumer rabbitChan consumer where requeue chan env = AMQP.rejectMsg chan (AMQP.envDeliveryTag env) True --------------------------------------------------------------------------------
1,515
consumeFailures :: AMQP.Connection -> Text -> AcidState.AcidState FailedEvents -> IO (IO ()) consumeFailures conn failureQueue allFailures = do rabbitChan <- AMQP.openChannel conn retryChan <- AMQP.openChannel conn consumer <- AMQP.consumeMsgs rabbitChan failureQueue AMQP.Ack $ \(msg, env) -> do result <- runMaybeT $ do evType <- MaybeT $ return $ case AMQP.envRoutingKey env of "index" -> Just Index "delete" -> Just Delete "move" -> Just Move _ -> Nothing reasons <- MaybeT $ return $ fmap Sequence.fromList $ case AMQP.msgHeaders msg of Just (AMQP.FieldTable m) -> case Map.lookup "mb-exceptions" m of Just (AMQP.FVFieldArray reasons) -> traverse ?? reasons $ \r -> case r of AMQP.FVString s -> Just s _ -> Nothing _ -> Just [] _ -> Just [] now <- liftIO getCurrentTime liftIO $ AcidState.update allFailures $ AppendFailedEvent reasons now evType (Text.decodeUtf8 $ AMQP.msgBody msg ^. strict) case result of Nothing -> requeue retryChan env Just _ -> AMQP.ackEnv env return $ AMQP.cancelConsumer rabbitChan consumer where requeue chan env = AMQP.rejectMsg chan (AMQP.envDeliveryTag env) True --------------------------------------------------------------------------------
1,515
consumeFailures conn failureQueue allFailures = do rabbitChan <- AMQP.openChannel conn retryChan <- AMQP.openChannel conn consumer <- AMQP.consumeMsgs rabbitChan failureQueue AMQP.Ack $ \(msg, env) -> do result <- runMaybeT $ do evType <- MaybeT $ return $ case AMQP.envRoutingKey env of "index" -> Just Index "delete" -> Just Delete "move" -> Just Move _ -> Nothing reasons <- MaybeT $ return $ fmap Sequence.fromList $ case AMQP.msgHeaders msg of Just (AMQP.FieldTable m) -> case Map.lookup "mb-exceptions" m of Just (AMQP.FVFieldArray reasons) -> traverse ?? reasons $ \r -> case r of AMQP.FVString s -> Just s _ -> Nothing _ -> Just [] _ -> Just [] now <- liftIO getCurrentTime liftIO $ AcidState.update allFailures $ AppendFailedEvent reasons now evType (Text.decodeUtf8 $ AMQP.msgBody msg ^. strict) case result of Nothing -> requeue retryChan env Just _ -> AMQP.ackEnv env return $ AMQP.cancelConsumer rabbitChan consumer where requeue chan env = AMQP.rejectMsg chan (AMQP.envDeliveryTag env) True --------------------------------------------------------------------------------
1,422
false
true
1
30
502
449
205
244
null
null
sheyll/isobmff-builder
src/Data/Type/BitRecords/Builder/LazyByteStringBuilder.hs
bsd-3-clause
appendBitBuffer64 :: BitBuffer64 -> BitBuilder appendBitBuffer64 !x' = BitBuilder . Dual . Endo $ \(BitBuilderState !builder !buff !totalSizeIn) -> go x' builder buff totalSizeIn where go !x !builder !buff !totalSize | bitBuffer64Length x == 0 = BitBuilderState builder buff totalSize | otherwise = let (!rest, !buff') = bufferBits x buff in if bitBuffer64SpaceLeft buff' > 0 then BitBuilderState builder buff' totalSize else let !nextBuilder = builder <> SB.word64BE (bitBuffer64Content buff') !totalSize' = totalSize + bitBuffer64MaxLengthBytes in go rest nextBuilder emptyBitBuffer64 totalSize' -- | Write all the b*y*tes, into the 'BitBuilderState' this allows general -- purposes non-byte aligned builders.
880
appendBitBuffer64 :: BitBuffer64 -> BitBuilder appendBitBuffer64 !x' = BitBuilder . Dual . Endo $ \(BitBuilderState !builder !buff !totalSizeIn) -> go x' builder buff totalSizeIn where go !x !builder !buff !totalSize | bitBuffer64Length x == 0 = BitBuilderState builder buff totalSize | otherwise = let (!rest, !buff') = bufferBits x buff in if bitBuffer64SpaceLeft buff' > 0 then BitBuilderState builder buff' totalSize else let !nextBuilder = builder <> SB.word64BE (bitBuffer64Content buff') !totalSize' = totalSize + bitBuffer64MaxLengthBytes in go rest nextBuilder emptyBitBuffer64 totalSize' -- | Write all the b*y*tes, into the 'BitBuilderState' this allows general -- purposes non-byte aligned builders.
880
appendBitBuffer64 !x' = BitBuilder . Dual . Endo $ \(BitBuilderState !builder !buff !totalSizeIn) -> go x' builder buff totalSizeIn where go !x !builder !buff !totalSize | bitBuffer64Length x == 0 = BitBuilderState builder buff totalSize | otherwise = let (!rest, !buff') = bufferBits x buff in if bitBuffer64SpaceLeft buff' > 0 then BitBuilderState builder buff' totalSize else let !nextBuilder = builder <> SB.word64BE (bitBuffer64Content buff') !totalSize' = totalSize + bitBuffer64MaxLengthBytes in go rest nextBuilder emptyBitBuffer64 totalSize' -- | Write all the b*y*tes, into the 'BitBuilderState' this allows general -- purposes non-byte aligned builders.
833
false
true
1
15
266
203
92
111
null
null
fffej/HS-Poker
LookupPatternMatch.hs
bsd-3-clause
getValueFromProduct 26505 = 5865
32
getValueFromProduct 26505 = 5865
32
getValueFromProduct 26505 = 5865
32
false
false
0
5
3
9
4
5
null
null
zjhmale/monadme
monad/src/monad/haskell/mpc.hs
epl-1.0
pp :: Parser [Int] pp = symbol "[" >>>= (\_ -> natural >>>= (\n -> (many (symbol "," >>>= (\_ -> natural))) >>>= (\ns -> symbol "]" >>>= (\_ -> result (n:ns)))))
275
pp :: Parser [Int] pp = symbol "[" >>>= (\_ -> natural >>>= (\n -> (many (symbol "," >>>= (\_ -> natural))) >>>= (\ns -> symbol "]" >>>= (\_ -> result (n:ns)))))
275
pp = symbol "[" >>>= (\_ -> natural >>>= (\n -> (many (symbol "," >>>= (\_ -> natural))) >>>= (\ns -> symbol "]" >>>= (\_ -> result (n:ns)))))
256
false
true
1
20
145
109
57
52
null
null
ivanacostarubio/tic-tac-toe
tic-tac-toe.hs
mit
buildBoard :: String -> Board buildBoard (x) = Board [(take 3 x ), (take 3 (drop 3 x)), reverse(take 3 (reverse x))]
117
buildBoard :: String -> Board buildBoard (x) = Board [(take 3 x ), (take 3 (drop 3 x)), reverse(take 3 (reverse x))]
117
buildBoard (x) = Board [(take 3 x ), (take 3 (drop 3 x)), reverse(take 3 (reverse x))]
87
false
true
0
11
22
80
39
41
null
null
shlevy/ghc
compiler/basicTypes/DataCon.hs
bsd-3-clause
-- | The tag used for ordering 'DataCon's dataConTag :: DataCon -> ConTag dataConTag = dcTag
93
dataConTag :: DataCon -> ConTag dataConTag = dcTag
51
dataConTag = dcTag
19
true
true
0
7
16
23
10
13
null
null
NotBrianZach/postgrest
src/PostgREST/OpenAPI.hs
mit
makeRootPathItem :: (FilePath, PathItem) makeRootPathItem = ("/", p) where getOp = (mempty :: Operation) & tags .~ Set.fromList ["/"] & produces ?~ makeMimeList [CTOpenAPI] & at 200 ?~ "OK" pr = (mempty :: PathItem) & get ?~ getOp p = pr
269
makeRootPathItem :: (FilePath, PathItem) makeRootPathItem = ("/", p) where getOp = (mempty :: Operation) & tags .~ Set.fromList ["/"] & produces ?~ makeMimeList [CTOpenAPI] & at 200 ?~ "OK" pr = (mempty :: PathItem) & get ?~ getOp p = pr
269
makeRootPathItem = ("/", p) where getOp = (mempty :: Operation) & tags .~ Set.fromList ["/"] & produces ?~ makeMimeList [CTOpenAPI] & at 200 ?~ "OK" pr = (mempty :: PathItem) & get ?~ getOp p = pr
228
false
true
8
7
72
112
56
56
null
null
tphyahoo/gititpt
Network/Gitit/Framework.hs
gpl-2.0
-- | Run the handler if a user is logged in, otherwise redirect -- to login page. requireUser :: Handler -> Handler requireUser = requireUserThat (const True)
159
requireUser :: Handler -> Handler requireUser = requireUserThat (const True)
76
requireUser = requireUserThat (const True)
42
true
true
0
7
27
26
14
12
null
null
thalerjonathan/phd
coding/libraries/chimera/src/FRP/Chimera/Simulation/Simulation.hs
gpl-3.0
simulateAggregateTimeDeltas :: [AgentDef s m e] -> e -> SimulationParams e -> [DTime] -> AgentObservableAggregator s e a -> [a] simulateAggregateTimeDeltas adefs e params dts aggrFun = seq agrs agrs -- optimization where sts = zip dts (repeat Nothing) agrSf = arr aggrFun sf = simulate params adefs e >>> agrSf agrs = embed sf ((), sts)
515
simulateAggregateTimeDeltas :: [AgentDef s m e] -> e -> SimulationParams e -> [DTime] -> AgentObservableAggregator s e a -> [a] simulateAggregateTimeDeltas adefs e params dts aggrFun = seq agrs agrs -- optimization where sts = zip dts (repeat Nothing) agrSf = arr aggrFun sf = simulate params adefs e >>> agrSf agrs = embed sf ((), sts)
515
simulateAggregateTimeDeltas adefs e params dts aggrFun = seq agrs agrs -- optimization where sts = zip dts (repeat Nothing) agrSf = arr aggrFun sf = simulate params adefs e >>> agrSf agrs = embed sf ((), sts)
227
false
true
3
10
235
136
68
68
null
null
Heather/hackport
Portage/Cabal.hs
gpl-3.0
-- map the cabal license type to the gentoo license string format convertLicense :: Cabal.License -> Either String String convertLicense l = case l of -- good ones Cabal.AGPL mv -> Right $ "AGPL-" ++ (maybe "3" Cabal.display mv) -- almost certainly version 3 Cabal.GPL mv -> Right $ "GPL-" ++ (maybe "2" Cabal.display mv) -- almost certainly version 2 Cabal.LGPL mv -> Right $ "LGPL-" ++ (maybe "2.1" Cabal.display mv) -- probably version 2.1 Cabal.BSD2 -> Right "BSD-2" Cabal.BSD3 -> Right "BSD" Cabal.BSD4 -> Right "BSD-4" Cabal.PublicDomain -> Right "public-domain" Cabal.MIT -> Right "MIT" Cabal.Apache mv -> Right $ "Apache-" ++ (maybe "1.1" Cabal.display mv) -- probably version 1.1 Cabal.ISC -> Right "ISC" Cabal.MPL v -> Right $ "MPL-" ++ Cabal.display v -- probably version 1.0 -- bad ones Cabal.AllRightsReserved -> Left "EULA-style licence. Please pick it manually." Cabal.UnknownLicense _ -> Left "license unknown to cabal. Please pick it manually." Cabal.OtherLicense -> Left "(Other) Please look at license file of package and pick it manually." Cabal.UnspecifiedLicense -> Left "(Unspecified) Please look at license file of package and pick it manually."
1,386
convertLicense :: Cabal.License -> Either String String convertLicense l = case l of -- good ones Cabal.AGPL mv -> Right $ "AGPL-" ++ (maybe "3" Cabal.display mv) -- almost certainly version 3 Cabal.GPL mv -> Right $ "GPL-" ++ (maybe "2" Cabal.display mv) -- almost certainly version 2 Cabal.LGPL mv -> Right $ "LGPL-" ++ (maybe "2.1" Cabal.display mv) -- probably version 2.1 Cabal.BSD2 -> Right "BSD-2" Cabal.BSD3 -> Right "BSD" Cabal.BSD4 -> Right "BSD-4" Cabal.PublicDomain -> Right "public-domain" Cabal.MIT -> Right "MIT" Cabal.Apache mv -> Right $ "Apache-" ++ (maybe "1.1" Cabal.display mv) -- probably version 1.1 Cabal.ISC -> Right "ISC" Cabal.MPL v -> Right $ "MPL-" ++ Cabal.display v -- probably version 1.0 -- bad ones Cabal.AllRightsReserved -> Left "EULA-style licence. Please pick it manually." Cabal.UnknownLicense _ -> Left "license unknown to cabal. Please pick it manually." Cabal.OtherLicense -> Left "(Other) Please look at license file of package and pick it manually." Cabal.UnspecifiedLicense -> Left "(Unspecified) Please look at license file of package and pick it manually."
1,320
convertLicense l = case l of -- good ones Cabal.AGPL mv -> Right $ "AGPL-" ++ (maybe "3" Cabal.display mv) -- almost certainly version 3 Cabal.GPL mv -> Right $ "GPL-" ++ (maybe "2" Cabal.display mv) -- almost certainly version 2 Cabal.LGPL mv -> Right $ "LGPL-" ++ (maybe "2.1" Cabal.display mv) -- probably version 2.1 Cabal.BSD2 -> Right "BSD-2" Cabal.BSD3 -> Right "BSD" Cabal.BSD4 -> Right "BSD-4" Cabal.PublicDomain -> Right "public-domain" Cabal.MIT -> Right "MIT" Cabal.Apache mv -> Right $ "Apache-" ++ (maybe "1.1" Cabal.display mv) -- probably version 1.1 Cabal.ISC -> Right "ISC" Cabal.MPL v -> Right $ "MPL-" ++ Cabal.display v -- probably version 1.0 -- bad ones Cabal.AllRightsReserved -> Left "EULA-style licence. Please pick it manually." Cabal.UnknownLicense _ -> Left "license unknown to cabal. Please pick it manually." Cabal.OtherLicense -> Left "(Other) Please look at license file of package and pick it manually." Cabal.UnspecifiedLicense -> Left "(Unspecified) Please look at license file of package and pick it manually."
1,264
true
true
0
11
397
298
144
154
null
null
brendanhay/gogol
gogol-dfareporting/gen/Network/Google/DFAReporting/Types/Product.hs
mpl-2.0
-- | The date range this report should be run for. rpacDateRange :: Lens' ReportPathAttributionCriteria (Maybe DateRange) rpacDateRange = lens _rpacDateRange (\ s a -> s{_rpacDateRange = a})
198
rpacDateRange :: Lens' ReportPathAttributionCriteria (Maybe DateRange) rpacDateRange = lens _rpacDateRange (\ s a -> s{_rpacDateRange = a})
147
rpacDateRange = lens _rpacDateRange (\ s a -> s{_rpacDateRange = a})
76
true
true
1
9
35
52
25
27
null
null
zenzike/hectare
src/Main.hs
gpl-2.0
mouse :: IORef Camera -> IORef State -> IORef GLUT.Position -> GLUT.MouseCallback mouse cameraRef stateRef _ GLUT.WheelUp GLUT.Down _ = do cameraRef $~ Camera.setSpeed Camera.Toward 12 update cameraRef stateRef
214
mouse :: IORef Camera -> IORef State -> IORef GLUT.Position -> GLUT.MouseCallback mouse cameraRef stateRef _ GLUT.WheelUp GLUT.Down _ = do cameraRef $~ Camera.setSpeed Camera.Toward 12 update cameraRef stateRef
214
mouse cameraRef stateRef _ GLUT.WheelUp GLUT.Down _ = do cameraRef $~ Camera.setSpeed Camera.Toward 12 update cameraRef stateRef
132
false
true
0
9
32
77
35
42
null
null
conal/hermit
src/HERMIT/Dictionary/Local.hs
bsd-2-clause
flattenProgramT :: Monad m => Transform c m CoreProg CoreBind flattenProgramT = do bds <- arr (concatMap bindToVarExprs . progToBinds) guardMsg (nodups $ map fst bds) "Top-level bindings contain multiple occurrences of a name." return (Rec bds) ------------------------------------------------------------------------------ -- | Abstract over a variable using a lambda. -- e ==> (\ x. e) x
437
flattenProgramT :: Monad m => Transform c m CoreProg CoreBind flattenProgramT = do bds <- arr (concatMap bindToVarExprs . progToBinds) guardMsg (nodups $ map fst bds) "Top-level bindings contain multiple occurrences of a name." return (Rec bds) ------------------------------------------------------------------------------ -- | Abstract over a variable using a lambda. -- e ==> (\ x. e) x
437
flattenProgramT = do bds <- arr (concatMap bindToVarExprs . progToBinds) guardMsg (nodups $ map fst bds) "Top-level bindings contain multiple occurrences of a name." return (Rec bds) ------------------------------------------------------------------------------ -- | Abstract over a variable using a lambda. -- e ==> (\ x. e) x
375
false
true
0
12
101
88
40
48
null
null
HJvT/hdirect
src/Parser.hs
bsd-3-clause
happyReduce_8 = happySpecReduce_3 7# happyReduction_8
53
happyReduce_8 = happySpecReduce_3 7# happyReduction_8
53
happyReduce_8 = happySpecReduce_3 7# happyReduction_8
53
false
false
0
5
4
11
5
6
null
null
christiaanb/cabal
cabal-install/Distribution/Client/Setup.hs
bsd-3-clause
-- ------------------------------------------------------------ -- * Other commands -- ------------------------------------------------------------ updateCommand :: CommandUI (Flag Verbosity) updateCommand = CommandUI { commandName = "update", commandSynopsis = "Updates list of known packages.", commandDescription = Just $ \_ -> "For all known remote repositories, download the package list.\n", commandNotes = Just $ \_ -> relevantConfigValuesText ["remote-repo" ,"remote-repo-cache" ,"local-repo"], commandUsage = usageFlags "update", commandDefaultFlags = toFlag normal, commandOptions = \_ -> [optionVerbosity id const] }
765
updateCommand :: CommandUI (Flag Verbosity) updateCommand = CommandUI { commandName = "update", commandSynopsis = "Updates list of known packages.", commandDescription = Just $ \_ -> "For all known remote repositories, download the package list.\n", commandNotes = Just $ \_ -> relevantConfigValuesText ["remote-repo" ,"remote-repo-cache" ,"local-repo"], commandUsage = usageFlags "update", commandDefaultFlags = toFlag normal, commandOptions = \_ -> [optionVerbosity id const] }
616
updateCommand = CommandUI { commandName = "update", commandSynopsis = "Updates list of known packages.", commandDescription = Just $ \_ -> "For all known remote repositories, download the package list.\n", commandNotes = Just $ \_ -> relevantConfigValuesText ["remote-repo" ,"remote-repo-cache" ,"local-repo"], commandUsage = usageFlags "update", commandDefaultFlags = toFlag normal, commandOptions = \_ -> [optionVerbosity id const] }
571
true
true
2
11
205
126
69
57
null
null
plow-technologies/ircbrowse
src/Ircbrowse/View/Calendar.hs
bsd-3-clause
calendar :: Day -> Day -> Channel -> Html calendar firstDay today channel = template "calendar" (T.pack ("#" ++ showChan channel)) (return ()) $ do channelNav channel container $ do forM_ (years firstDay today) $ \year -> case year of ((yearsample:_):_) -> do row $ span12 $ h2 $ toHtml (showYear yearsample) forM_ (chunksOf 4 year) $ \months -> row $ do forM_ months $ \days -> span3 $ case days of [] -> return () (monthsample:_) -> do h3 $ toHtml (showMonth monthsample) table $ forM_ (chunksOf 7 days) $ \days -> tr $ forM_ days $ \day -> td $ a ! href (toValue ("/day/" ++ showChan channel ++ "/" ++ showDate day)) $ toHtml (showDayOfMonth day) _ -> return () footer
1,187
calendar :: Day -> Day -> Channel -> Html calendar firstDay today channel = template "calendar" (T.pack ("#" ++ showChan channel)) (return ()) $ do channelNav channel container $ do forM_ (years firstDay today) $ \year -> case year of ((yearsample:_):_) -> do row $ span12 $ h2 $ toHtml (showYear yearsample) forM_ (chunksOf 4 year) $ \months -> row $ do forM_ months $ \days -> span3 $ case days of [] -> return () (monthsample:_) -> do h3 $ toHtml (showMonth monthsample) table $ forM_ (chunksOf 7 days) $ \days -> tr $ forM_ days $ \day -> td $ a ! href (toValue ("/day/" ++ showChan channel ++ "/" ++ showDate day)) $ toHtml (showDayOfMonth day) _ -> return () footer
1,187
calendar firstDay today channel = template "calendar" (T.pack ("#" ++ showChan channel)) (return ()) $ do channelNav channel container $ do forM_ (years firstDay today) $ \year -> case year of ((yearsample:_):_) -> do row $ span12 $ h2 $ toHtml (showYear yearsample) forM_ (chunksOf 4 year) $ \months -> row $ do forM_ months $ \days -> span3 $ case days of [] -> return () (monthsample:_) -> do h3 $ toHtml (showMonth monthsample) table $ forM_ (chunksOf 7 days) $ \days -> tr $ forM_ days $ \day -> td $ a ! href (toValue ("/day/" ++ showChan channel ++ "/" ++ showDate day)) $ toHtml (showDayOfMonth day) _ -> return () footer
1,145
false
true
0
44
639
351
168
183
null
null
dsorokin/aivika-experiment
examples/MachRep3.hs
bsd-3-clause
= resultByName "t"
20
t = resultByName "t"
20
t = resultByName "t"
20
false
false
1
5
3
9
3
6
null
null
mainland/nikola
src/Data/Vector/UnboxedForeign.hs
bsd-3-clause
ifilter = G.ifilter
19
ifilter = G.ifilter
19
ifilter = G.ifilter
19
false
false
0
5
2
8
4
4
null
null
ahushh/Monaba
monaba/src/Handler/Admin.hs
mit
getMoveThreadR :: Text -> Int -> Text -> Handler Html getMoveThreadR srcBoard thread dstBoard = do when (srcBoard == dstBoard) $ redirectUltDest (BoardNoPageR srcBoard) mThread <- runDB $ selectFirst [PostBoard ==. srcBoard, PostParent ==. 0, PostLocalId ==. thread] [] when (isNothing mThread) $ (setMessageI MsgNoSuchThread) >> (redirect $ BoardNoPageR srcBoard) lastPostId <- (fmap (postLocalId . entityVal)) <$> runDB (selectFirst [PostBoard ==. dstBoard] [Desc PostLocalId]) oldIds <- ((thread:) . map (postLocalId . entityVal)) <$> runDB (selectList [PostBoard ==. srcBoard, PostParent ==. thread] [Desc PostLocalId]) let newId = maybe 1 (+1) lastPostId -- update OP post runDB $ updateWhere [PostBoard ==. srcBoard, PostLocalId ==. thread, PostParent ==. 0] [PostBoard =. dstBoard, PostLocalId =. newId] -- update replies runDB $ forM_ (zip (reverse oldIds) [newId+1..]) $ \(oldReplyId, newReplyId) -> do updateWhere [PostBoard ==. srcBoard, PostParent ==. thread, PostLocalId ==. oldReplyId] [PostBoard =. dstBoard, PostParent =. newId, PostLocalId =. newReplyId] -- fix referencies replies <- runDB (selectList [PostBoard ==. dstBoard, PostParent ==. newId] [Desc PostLocalId]) opPost <- fromJust <$> runDB (selectFirst [PostBoard ==. dstBoard, PostParent ==. 0, PostLocalId ==. newId] []) let newIds = (newId:) $ map (postLocalId . entityVal) replies -- fix in replies forM_ replies $ \(Entity k p) -> do fixedMsg <- liftIO $ fixReferences srcBoard (zip oldIds newIds) (Textarea $ postRawMessage p) msgFormatted <- doYobaMarkup (Just fixedMsg) dstBoard newId runDB $ update k [PostMessage =. msgFormatted, PostRawMessage =. unTextarea fixedMsg] -- fix in OP post fixedOpMsg <- liftIO $ fixReferences srcBoard (zip oldIds newIds) (Textarea $ postRawMessage $ entityVal opPost) opMsgFormatted <- doYobaMarkup (Just fixedOpMsg) dstBoard 0 runDB $ update (entityKey opPost) [PostMessage =. opMsgFormatted, PostRawMessage =. unTextarea fixedOpMsg] from <- makeExternalRef srcBoard thread to <- makeExternalRef dstBoard thread addModlogEntry $ MsgModlogMoveThread from to redirect $ BoardNoPageR dstBoard
2,205
getMoveThreadR :: Text -> Int -> Text -> Handler Html getMoveThreadR srcBoard thread dstBoard = do when (srcBoard == dstBoard) $ redirectUltDest (BoardNoPageR srcBoard) mThread <- runDB $ selectFirst [PostBoard ==. srcBoard, PostParent ==. 0, PostLocalId ==. thread] [] when (isNothing mThread) $ (setMessageI MsgNoSuchThread) >> (redirect $ BoardNoPageR srcBoard) lastPostId <- (fmap (postLocalId . entityVal)) <$> runDB (selectFirst [PostBoard ==. dstBoard] [Desc PostLocalId]) oldIds <- ((thread:) . map (postLocalId . entityVal)) <$> runDB (selectList [PostBoard ==. srcBoard, PostParent ==. thread] [Desc PostLocalId]) let newId = maybe 1 (+1) lastPostId -- update OP post runDB $ updateWhere [PostBoard ==. srcBoard, PostLocalId ==. thread, PostParent ==. 0] [PostBoard =. dstBoard, PostLocalId =. newId] -- update replies runDB $ forM_ (zip (reverse oldIds) [newId+1..]) $ \(oldReplyId, newReplyId) -> do updateWhere [PostBoard ==. srcBoard, PostParent ==. thread, PostLocalId ==. oldReplyId] [PostBoard =. dstBoard, PostParent =. newId, PostLocalId =. newReplyId] -- fix referencies replies <- runDB (selectList [PostBoard ==. dstBoard, PostParent ==. newId] [Desc PostLocalId]) opPost <- fromJust <$> runDB (selectFirst [PostBoard ==. dstBoard, PostParent ==. 0, PostLocalId ==. newId] []) let newIds = (newId:) $ map (postLocalId . entityVal) replies -- fix in replies forM_ replies $ \(Entity k p) -> do fixedMsg <- liftIO $ fixReferences srcBoard (zip oldIds newIds) (Textarea $ postRawMessage p) msgFormatted <- doYobaMarkup (Just fixedMsg) dstBoard newId runDB $ update k [PostMessage =. msgFormatted, PostRawMessage =. unTextarea fixedMsg] -- fix in OP post fixedOpMsg <- liftIO $ fixReferences srcBoard (zip oldIds newIds) (Textarea $ postRawMessage $ entityVal opPost) opMsgFormatted <- doYobaMarkup (Just fixedOpMsg) dstBoard 0 runDB $ update (entityKey opPost) [PostMessage =. opMsgFormatted, PostRawMessage =. unTextarea fixedOpMsg] from <- makeExternalRef srcBoard thread to <- makeExternalRef dstBoard thread addModlogEntry $ MsgModlogMoveThread from to redirect $ BoardNoPageR dstBoard
2,205
getMoveThreadR srcBoard thread dstBoard = do when (srcBoard == dstBoard) $ redirectUltDest (BoardNoPageR srcBoard) mThread <- runDB $ selectFirst [PostBoard ==. srcBoard, PostParent ==. 0, PostLocalId ==. thread] [] when (isNothing mThread) $ (setMessageI MsgNoSuchThread) >> (redirect $ BoardNoPageR srcBoard) lastPostId <- (fmap (postLocalId . entityVal)) <$> runDB (selectFirst [PostBoard ==. dstBoard] [Desc PostLocalId]) oldIds <- ((thread:) . map (postLocalId . entityVal)) <$> runDB (selectList [PostBoard ==. srcBoard, PostParent ==. thread] [Desc PostLocalId]) let newId = maybe 1 (+1) lastPostId -- update OP post runDB $ updateWhere [PostBoard ==. srcBoard, PostLocalId ==. thread, PostParent ==. 0] [PostBoard =. dstBoard, PostLocalId =. newId] -- update replies runDB $ forM_ (zip (reverse oldIds) [newId+1..]) $ \(oldReplyId, newReplyId) -> do updateWhere [PostBoard ==. srcBoard, PostParent ==. thread, PostLocalId ==. oldReplyId] [PostBoard =. dstBoard, PostParent =. newId, PostLocalId =. newReplyId] -- fix referencies replies <- runDB (selectList [PostBoard ==. dstBoard, PostParent ==. newId] [Desc PostLocalId]) opPost <- fromJust <$> runDB (selectFirst [PostBoard ==. dstBoard, PostParent ==. 0, PostLocalId ==. newId] []) let newIds = (newId:) $ map (postLocalId . entityVal) replies -- fix in replies forM_ replies $ \(Entity k p) -> do fixedMsg <- liftIO $ fixReferences srcBoard (zip oldIds newIds) (Textarea $ postRawMessage p) msgFormatted <- doYobaMarkup (Just fixedMsg) dstBoard newId runDB $ update k [PostMessage =. msgFormatted, PostRawMessage =. unTextarea fixedMsg] -- fix in OP post fixedOpMsg <- liftIO $ fixReferences srcBoard (zip oldIds newIds) (Textarea $ postRawMessage $ entityVal opPost) opMsgFormatted <- doYobaMarkup (Just fixedOpMsg) dstBoard 0 runDB $ update (entityKey opPost) [PostMessage =. opMsgFormatted, PostRawMessage =. unTextarea fixedOpMsg] from <- makeExternalRef srcBoard thread to <- makeExternalRef dstBoard thread addModlogEntry $ MsgModlogMoveThread from to redirect $ BoardNoPageR dstBoard
2,151
false
true
0
16
384
774
385
389
null
null
xkollar/handy-haskell
other/pt-2012-08/Pt201208.hs
gpl-3.0
-- vector sum vs (x1,y1) (x2,y2) = (x1+x2,y1+y2)
48
vs (x1,y1) (x2,y2) = (x1+x2,y1+y2)
34
vs (x1,y1) (x2,y2) = (x1+x2,y1+y2)
34
true
false
0
6
7
38
22
16
null
null
mgsloan/ghcjs-typescript
ghcjs-typescript-convert/GHCJS/TypeScript/Convert/Render.hs
mit
optionalPrefix Nothing = ""
27
optionalPrefix Nothing = ""
27
optionalPrefix Nothing = ""
27
false
false
1
5
3
13
4
9
null
null
travitch/gtk-traymanager
src/Graphics/UI/Gtk/Misc/TrayManager.hs
lgpl-2.1
connect_OBJECT_INT64__NONE :: (GObjectClass a', GObjectClass obj) => SignalName -> ConnectAfter -> obj -> (a' -> Int64 -> IO ()) -> IO (ConnectId obj) connect_OBJECT_INT64__NONE signal after obj user = connectGeneric signal after obj action where action :: Ptr GObject -> Ptr GObject -> Int64 -> IO () action _ obj1 int2 = failOnGError $ makeNewGObject (GObject, objectUnrefFromMainloop) (return obj1) >>= \obj1' -> user (unsafeCastGObject obj1') int2
627
connect_OBJECT_INT64__NONE :: (GObjectClass a', GObjectClass obj) => SignalName -> ConnectAfter -> obj -> (a' -> Int64 -> IO ()) -> IO (ConnectId obj) connect_OBJECT_INT64__NONE signal after obj user = connectGeneric signal after obj action where action :: Ptr GObject -> Ptr GObject -> Int64 -> IO () action _ obj1 int2 = failOnGError $ makeNewGObject (GObject, objectUnrefFromMainloop) (return obj1) >>= \obj1' -> user (unsafeCastGObject obj1') int2
627
connect_OBJECT_INT64__NONE signal after obj user = connectGeneric signal after obj action where action :: Ptr GObject -> Ptr GObject -> Int64 -> IO () action _ obj1 int2 = failOnGError $ makeNewGObject (GObject, objectUnrefFromMainloop) (return obj1) >>= \obj1' -> user (unsafeCastGObject obj1') int2
326
false
true
2
14
241
177
84
93
null
null
NewMountain/hangmanSimple
src/Game.hs
bsd-3-clause
fillInCharacter :: Puzzle -> Char -> Puzzle fillInCharacter (Puzzle secret hits guessed) guess = Puzzle secret newHits (guessed ++ [guess]) where zipper g sChar gChar = if sChar == g then Just g else gChar newHits = zipWith (zipper guess) secret hits
323
fillInCharacter :: Puzzle -> Char -> Puzzle fillInCharacter (Puzzle secret hits guessed) guess = Puzzle secret newHits (guessed ++ [guess]) where zipper g sChar gChar = if sChar == g then Just g else gChar newHits = zipWith (zipper guess) secret hits
322
fillInCharacter (Puzzle secret hits guessed) guess = Puzzle secret newHits (guessed ++ [guess]) where zipper g sChar gChar = if sChar == g then Just g else gChar newHits = zipWith (zipper guess) secret hits
278
false
true
1
8
114
99
50
49
null
null
andyarvanitis/Idris-dev
src/IRTS/System.hs
bsd-3-clause
getExecutablePom = do dir <- getDataDir return $ dir </> "java" </> "executable_pom.xml"
110
getExecutablePom = do dir <- getDataDir return $ dir </> "java" </> "executable_pom.xml"
110
getExecutablePom = do dir <- getDataDir return $ dir </> "java" </> "executable_pom.xml"
110
false
false
1
9
34
32
13
19
null
null
joshcough/HaskellTestingDemo
UnitTestsAndPropertiesMain.hs
mit
prop_list_reverse_reverse :: [Int] -> Bool prop_list_reverse_reverse list = list == reverse (reverse list)
106
prop_list_reverse_reverse :: [Int] -> Bool prop_list_reverse_reverse list = list == reverse (reverse list)
106
prop_list_reverse_reverse list = list == reverse (reverse list)
63
false
true
0
8
12
34
17
17
null
null
sopvop/cabal
Cabal/Distribution/Simple/BuildTarget.hs
bsd-3-clause
guardModuleName :: String -> Match () guardModuleName s | all validModuleChar s && not (null s) = increaseConfidence | otherwise = matchErrorExpected "module name" s where validModuleChar c = isAlphaNum c || c == '.' || c == '_' || c == '\''
273
guardModuleName :: String -> Match () guardModuleName s | all validModuleChar s && not (null s) = increaseConfidence | otherwise = matchErrorExpected "module name" s where validModuleChar c = isAlphaNum c || c == '.' || c == '_' || c == '\''
273
guardModuleName s | all validModuleChar s && not (null s) = increaseConfidence | otherwise = matchErrorExpected "module name" s where validModuleChar c = isAlphaNum c || c == '.' || c == '_' || c == '\''
235
false
true
1
11
74
98
45
53
null
null
peti/funcmp
FMP/Matrix.hs
gpl-3.0
matrixAlign :: [[Cell]] -> Picture matrixAlign = matrixAlignSepBy 16 16
108
matrixAlign :: [[Cell]] -> Picture matrixAlign = matrixAlignSepBy 16 16
108
matrixAlign = matrixAlignSepBy 16 16
55
false
true
0
7
46
26
14
12
null
null
ddssff/lens
src/GHC/Generics/Lens.hs
bsd-3-clause
_UAddr :: Iso (UAddr p) (UAddr q) (Ptr c) (Ptr d) _UAddr = iso remitter reviewer where remitter (UAddr a) = Ptr a reviewer (Ptr a) = UAddr a
147
_UAddr :: Iso (UAddr p) (UAddr q) (Ptr c) (Ptr d) _UAddr = iso remitter reviewer where remitter (UAddr a) = Ptr a reviewer (Ptr a) = UAddr a
147
_UAddr = iso remitter reviewer where remitter (UAddr a) = Ptr a reviewer (Ptr a) = UAddr a
97
false
true
0
7
35
86
41
45
null
null
anton-dessiatov/stack
src/Stack/PackageDump.hs
bsd-3-clause
-- | Call ghc-pkg dump with appropriate flags and stream to the given @Sink@, for a single database ghcPkgDump :: HasEnvOverride env => WhichCompiler -> [Path Abs Dir] -- ^ if empty, use global -> ConduitM Text Void (RIO env) a -> RIO env a ghcPkgDump = ghcPkgCmdArgs ["dump"]
296
ghcPkgDump :: HasEnvOverride env => WhichCompiler -> [Path Abs Dir] -- ^ if empty, use global -> ConduitM Text Void (RIO env) a -> RIO env a ghcPkgDump = ghcPkgCmdArgs ["dump"]
196
ghcPkgDump = ghcPkgCmdArgs ["dump"]
35
true
true
0
12
68
71
34
37
null
null