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
NatureShade/SymbolicHaskell
src/Math/Symbolic/Expression.hs
mit
showMath :: (Show a, Fractional a, Ord a) => Math a -> String showMath (Op op [x]) = T.unpack op <> "(" <> showMath x <> ")"
125
showMath :: (Show a, Fractional a, Ord a) => Math a -> String showMath (Op op [x]) = T.unpack op <> "(" <> showMath x <> ")"
125
showMath (Op op [x]) = T.unpack op <> "(" <> showMath x <> ")"
63
false
true
0
9
27
73
36
37
null
null
buckie/juno
src/Juno/Hoplite/Types.hs
bsd-3-clause
collectFreeVars :: (Ord a, Traversable f) => f a -> Set.Set a collectFreeVars = Set.fromList . foldl' (flip (:)) []
117
collectFreeVars :: (Ord a, Traversable f) => f a -> Set.Set a collectFreeVars = Set.fromList . foldl' (flip (:)) []
117
collectFreeVars = Set.fromList . foldl' (flip (:)) []
55
false
true
0
8
21
59
30
29
null
null
rvion/lamdu
Lamdu/Sugar/OrderTags.hs
gpl-3.0
orderedFlatComposite (T.CVar x) = ([], Just x)
46
orderedFlatComposite (T.CVar x) = ([], Just x)
46
orderedFlatComposite (T.CVar x) = ([], Just x)
46
false
false
0
8
6
28
14
14
null
null
ephemient/aoc2016
src/Day1.hs
mit
main :: IO () main = do let (_:os, ps@(last -> (x, y))) = unzip $ scanl' loop (North, (0, 0)) input expanded = (0, 0) : concat (zipWith3 expand os ps (tail ps)) visited = scanl' (flip insert) empty expanded Just ((x', y'), _) = find (uncurry member) $ zip expanded visited print $ abs x + abs y print $ abs x' + abs y'
354
main :: IO () main = do let (_:os, ps@(last -> (x, y))) = unzip $ scanl' loop (North, (0, 0)) input expanded = (0, 0) : concat (zipWith3 expand os ps (tail ps)) visited = scanl' (flip insert) empty expanded Just ((x', y'), _) = find (uncurry member) $ zip expanded visited print $ abs x + abs y print $ abs x' + abs y'
354
main = do let (_:os, ps@(last -> (x, y))) = unzip $ scanl' loop (North, (0, 0)) input expanded = (0, 0) : concat (zipWith3 expand os ps (tail ps)) visited = scanl' (flip insert) empty expanded Just ((x', y'), _) = find (uncurry member) $ zip expanded visited print $ abs x + abs y print $ abs x' + abs y'
340
false
true
0
16
102
208
104
104
null
null
GaloisInc/sk-dev-platform
libs/lviz/GUI.hs
bsd-3-clause
getDrawWindow :: MVar St -> IO DrawWindow getDrawWindow mv = do da <- getDrawingArea mv widgetGetDrawWindow da
114
getDrawWindow :: MVar St -> IO DrawWindow getDrawWindow mv = do da <- getDrawingArea mv widgetGetDrawWindow da
114
getDrawWindow mv = do da <- getDrawingArea mv widgetGetDrawWindow da
72
false
true
0
8
20
40
17
23
null
null
ku-fpg/kansas-amber
System/Hardware/Haskino/Protocol.hs
bsd-3-clause
unpackageResponse (cmdWord:args) | Right cmd <- getFirmwareReply cmdWord = case (cmd, args) of (BC_RESP_DELAY, []) -> DelayResp (BC_RESP_IF_THEN_ELSE , [t,l]) | t == toW8 EXPR_UNIT && l == toW8 EXPR_LIT -> IfThenElseUnitReply () (BC_RESP_IF_THEN_ELSE , [t,l,b]) | t == toW8 EXPR_BOOL && l == toW8 EXPR_LIT -> IfThenElseBoolReply (if b == 0 then False else True) (BC_RESP_IF_THEN_ELSE , [t,l,b]) | t == toW8 EXPR_WORD8 && l == toW8 EXPR_LIT -> IfThenElseW8Reply b (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2]) | t == toW8 EXPR_WORD16 && l == toW8 EXPR_LIT -> IfThenElseW16Reply (bytesToWord16 (b1, b2)) (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_WORD32 && l == toW8 EXPR_LIT -> IfThenElseW32Reply (bytesToWord32 (b1, b2, b3, b4)) (BC_RESP_IF_THEN_ELSE , [t,l,b]) | t == toW8 EXPR_INT8 && l == toW8 EXPR_LIT -> IfThenElseI8Reply $ fromIntegral b (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2]) | t == toW8 EXPR_INT16 && l == toW8 EXPR_LIT -> IfThenElseI16Reply $ fromIntegral (bytesToWord16 (b1, b2)) (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_INT32 && l == toW8 EXPR_LIT -> IfThenElseI32Reply $ fromIntegral (bytesToWord32 (b1, b2, b3, b4)) (BC_RESP_IF_THEN_ELSE , t:l:_:bs) | t == toW8 EXPR_LIST8 && l == toW8 EXPR_LIT -> IfThenElseL8Reply bs (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_FLOAT && l == toW8 EXPR_LIT -> IfThenElseFloatReply $ bytesToFloat (b1, b2, b3, b4) {-- The IfThenElse Left replies are only used inside of Iterates -- so they will never be received by the host, but are here for -- test purposes (BC_RESP_IF_THEN_ELSE , [t,l,b]) | t == (toW8 EXPR_BOOL + 0x80) && l == toW8 EXPR_LIT -> IfThenElseBoolLeftReply (if b == 0 then False else True) (BC_RESP_IF_THEN_ELSE , [t,l,b]) | t == (toW8 EXPR_WORD8 + 0x80) && l == toW8 EXPR_LIT -> IfThenElseW8LeftReply b (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2]) | t == (toW8 EXPR_WORD16 + 0x80) && l == toW8 EXPR_LIT -> IfThenElseW16LeftReply (bytesToWord16 (b1, b2)) (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2,b3,b4]) | t == (toW8 EXPR_WORD32 + 0x80) && l == toW8 EXPR_LIT -> IfThenElseW32LeftReply (bytesToWord32 (b1, b2, b3, b4)) (BC_RESP_IF_THEN_ELSE , [t,l,b]) | t == (toW8 EXPR_INT8 + 0x80) && l == toW8 EXPR_LIT -> IfThenElseI8LeftReply $ fromIntegral b (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2]) | t == (toW8 EXPR_INT16 + 0x80) && l == toW8 EXPR_LIT -> IfThenElseI16LeftReply $ fromIntegral (bytesToWord16 (b1, b2)) (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2,b3,b4]) | t == (toW8 EXPR_INT32 + 0x80) && l == toW8 EXPR_LIT -> IfThenElseI32LeftReply $ fromIntegral (bytesToWord32 (b1, b2, b3, b4)) (BC_RESP_IF_THEN_ELSE , t:l:_:bs) | t == (toW8 EXPR_LIST8 + 0x80) && l == toW8 EXPR_LIT -> IfThenElseL8LeftReply bs (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2,b3,b4]) | t == (toW8 EXPR_FLOAT + 0x80) && l == toW8 EXPR_LIT -> IfThenElseFloatLeftReply $ bytesToFloat (b1, b2, b3, b4) -} (BC_RESP_ITERATE , [t,l]) | t == toW8 EXPR_UNIT && l == toW8 EXPR_LIT -> IterateUnitReply (BC_RESP_ITERATE , [t,l,b]) | t == toW8 EXPR_BOOL && l == toW8 EXPR_LIT -> IterateBoolReply (if b == 0 then False else True) (BC_RESP_ITERATE , [t,l,b]) | t == toW8 EXPR_WORD8 && l == toW8 EXPR_LIT -> IterateW8Reply b (BC_RESP_ITERATE , [t,l,b1,b2]) | t == toW8 EXPR_WORD16 && l == toW8 EXPR_LIT -> IterateW16Reply (bytesToWord16 (b1, b2)) (BC_RESP_ITERATE , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_WORD32 && l == toW8 EXPR_LIT -> IterateW32Reply (bytesToWord32 (b1, b2, b3, b4)) (BC_RESP_ITERATE , [t,l,b]) | t == toW8 EXPR_INT8 && l == toW8 EXPR_LIT -> IterateI8Reply $ fromIntegral b (BC_RESP_ITERATE , [t,l,b1,b2]) | t == toW8 EXPR_INT16 && l == toW8 EXPR_LIT -> IterateI16Reply $ fromIntegral (bytesToWord16 (b1, b2)) (BC_RESP_ITERATE , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_INT32 && l == toW8 EXPR_LIT -> IterateI32Reply $ fromIntegral (bytesToWord32 (b1, b2, b3, b4)) (BC_RESP_ITERATE , t:l:_:bs) | t == toW8 EXPR_LIST8 && l == toW8 EXPR_LIT -> IterateL8Reply bs (BC_RESP_ITERATE , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_FLOAT && l == toW8 EXPR_LIT -> IterateFloatReply $ bytesToFloat (b1, b2, b3, b4) (BS_RESP_DEBUG, []) -> DebugResp (BS_RESP_VERSION, [majV, minV]) -> Firmware (bytesToWord16 (majV,minV)) (BS_RESP_TYPE, [p]) -> ProcessorType p (BS_RESP_MICROS, [_t,_l,m0,m1,m2,m3]) -> MicrosReply (bytesToWord32 (m0,m1,m2,m3)) (BS_RESP_MILLIS, [_t,_l,m0,m1,m2,m3]) -> MillisReply (bytesToWord32 (m0,m1,m2,m3)) (BS_RESP_STRING, rest) -> StringMessage (getString rest) (DIG_RESP_READ_PIN, [_t,_l,b]) -> DigitalReply b (DIG_RESP_READ_PORT, [_t,_l,b]) -> DigitalPortReply b (ALG_RESP_READ_PIN, [_t,_l,bl,bh]) -> AnalogReply (bytesToWord16 (bl,bh)) (I2C_RESP_READ, _:_:_:xs) -> I2CReply xs (SER_RESP_AVAIL, [_t, _l, w0]) -> SerialAvailableReply w0 (SER_RESP_READ, [_t,_l,i0,i1,i2,i3]) -> SerialReadReply (bytesToInt32 (i0,i1,i2,i3)) (SER_RESP_READ_LIST, _:_:_:xs) -> SerialReadListReply xs (STEP_RESP_2PIN, [_t,_l,st]) -> Stepper2PinReply st (STEP_RESP_4PIN, [_t,_l,st]) -> Stepper4PinReply st (STEP_RESP_STEP, []) -> StepperStepReply (SRVO_RESP_ATTACH, [_t,_l,sv]) -> ServoAttachReply sv (SRVO_RESP_READ, [_t,_l,il,ih]) -> ServoReadReply (fromIntegral (bytesToWord16 (il,ih))) (SRVO_RESP_READ_MICROS, [_t,_l,il,ih]) -> ServoReadMicrosReply (fromIntegral (bytesToWord16 (il,ih))) (SCHED_RESP_BOOT, [_t,_l,b]) -> BootTaskResp b (SCHED_RESP_QUERY_ALL, _:_:_:ts) -> QueryAllTasksReply ts (SCHED_RESP_QUERY, ts) | length ts == 0 -> QueryTaskReply Nothing (SCHED_RESP_QUERY, ts) | length ts >= 9 -> let ts0:ts1:tl0:tl1:tp0:tp1:tt0:tt1:tt2:tt3:_ = ts in QueryTaskReply (Just (bytesToWord16 (ts0,ts1), bytesToWord16 (tl0,tl1), bytesToWord16 (tp0,tp1), bytesToWord32 (tt0,tt1,tt2,tt3))) (REF_RESP_READ , [t,l,b]) | t == toW8 EXPR_BOOL && l == toW8 EXPR_LIT -> ReadRefBReply (if b == 0 then False else True) (REF_RESP_READ , [t,l,b]) | t == toW8 EXPR_WORD8 && l == toW8 EXPR_LIT -> ReadRefW8Reply b (REF_RESP_READ , [t,l,b1,b2]) | t == toW8 EXPR_WORD16 && l == toW8 EXPR_LIT -> ReadRefW16Reply (bytesToWord16 (b1, b2)) (REF_RESP_READ , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_WORD32 && l == toW8 EXPR_LIT -> ReadRefW32Reply (bytesToWord32 (b1, b2, b3, b4)) (REF_RESP_READ , [t,l,b]) | t == toW8 EXPR_INT8 && l == toW8 EXPR_LIT -> ReadRefI8Reply $ fromIntegral b (REF_RESP_READ , [t,l,b1,b2]) | t == toW8 EXPR_INT16 && l == toW8 EXPR_LIT -> ReadRefI16Reply $ fromIntegral (bytesToWord16 (b1, b2)) (REF_RESP_READ , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_INT32 && l == toW8 EXPR_LIT -> ReadRefI32Reply $ fromIntegral (bytesToWord32 (b1, b2, b3, b4)) (REF_RESP_READ , t:l:_:bs) | t == toW8 EXPR_LIST8 && l == toW8 EXPR_LIT -> ReadRefL8Reply bs (REF_RESP_READ , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_FLOAT && l == toW8 EXPR_LIT -> ReadRefFloatReply $ bytesToFloat (b1, b2, b3, b4) (REF_RESP_NEW , [_t,_l,w]) -> NewReply w (REF_RESP_NEW , []) -> FailedNewRef _ -> Unimplemented (Just (show cmd)) args | True = Unimplemented Nothing (cmdWord : args)
9,097
unpackageResponse (cmdWord:args) | Right cmd <- getFirmwareReply cmdWord = case (cmd, args) of (BC_RESP_DELAY, []) -> DelayResp (BC_RESP_IF_THEN_ELSE , [t,l]) | t == toW8 EXPR_UNIT && l == toW8 EXPR_LIT -> IfThenElseUnitReply () (BC_RESP_IF_THEN_ELSE , [t,l,b]) | t == toW8 EXPR_BOOL && l == toW8 EXPR_LIT -> IfThenElseBoolReply (if b == 0 then False else True) (BC_RESP_IF_THEN_ELSE , [t,l,b]) | t == toW8 EXPR_WORD8 && l == toW8 EXPR_LIT -> IfThenElseW8Reply b (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2]) | t == toW8 EXPR_WORD16 && l == toW8 EXPR_LIT -> IfThenElseW16Reply (bytesToWord16 (b1, b2)) (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_WORD32 && l == toW8 EXPR_LIT -> IfThenElseW32Reply (bytesToWord32 (b1, b2, b3, b4)) (BC_RESP_IF_THEN_ELSE , [t,l,b]) | t == toW8 EXPR_INT8 && l == toW8 EXPR_LIT -> IfThenElseI8Reply $ fromIntegral b (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2]) | t == toW8 EXPR_INT16 && l == toW8 EXPR_LIT -> IfThenElseI16Reply $ fromIntegral (bytesToWord16 (b1, b2)) (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_INT32 && l == toW8 EXPR_LIT -> IfThenElseI32Reply $ fromIntegral (bytesToWord32 (b1, b2, b3, b4)) (BC_RESP_IF_THEN_ELSE , t:l:_:bs) | t == toW8 EXPR_LIST8 && l == toW8 EXPR_LIT -> IfThenElseL8Reply bs (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_FLOAT && l == toW8 EXPR_LIT -> IfThenElseFloatReply $ bytesToFloat (b1, b2, b3, b4) {-- The IfThenElse Left replies are only used inside of Iterates -- so they will never be received by the host, but are here for -- test purposes (BC_RESP_IF_THEN_ELSE , [t,l,b]) | t == (toW8 EXPR_BOOL + 0x80) && l == toW8 EXPR_LIT -> IfThenElseBoolLeftReply (if b == 0 then False else True) (BC_RESP_IF_THEN_ELSE , [t,l,b]) | t == (toW8 EXPR_WORD8 + 0x80) && l == toW8 EXPR_LIT -> IfThenElseW8LeftReply b (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2]) | t == (toW8 EXPR_WORD16 + 0x80) && l == toW8 EXPR_LIT -> IfThenElseW16LeftReply (bytesToWord16 (b1, b2)) (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2,b3,b4]) | t == (toW8 EXPR_WORD32 + 0x80) && l == toW8 EXPR_LIT -> IfThenElseW32LeftReply (bytesToWord32 (b1, b2, b3, b4)) (BC_RESP_IF_THEN_ELSE , [t,l,b]) | t == (toW8 EXPR_INT8 + 0x80) && l == toW8 EXPR_LIT -> IfThenElseI8LeftReply $ fromIntegral b (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2]) | t == (toW8 EXPR_INT16 + 0x80) && l == toW8 EXPR_LIT -> IfThenElseI16LeftReply $ fromIntegral (bytesToWord16 (b1, b2)) (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2,b3,b4]) | t == (toW8 EXPR_INT32 + 0x80) && l == toW8 EXPR_LIT -> IfThenElseI32LeftReply $ fromIntegral (bytesToWord32 (b1, b2, b3, b4)) (BC_RESP_IF_THEN_ELSE , t:l:_:bs) | t == (toW8 EXPR_LIST8 + 0x80) && l == toW8 EXPR_LIT -> IfThenElseL8LeftReply bs (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2,b3,b4]) | t == (toW8 EXPR_FLOAT + 0x80) && l == toW8 EXPR_LIT -> IfThenElseFloatLeftReply $ bytesToFloat (b1, b2, b3, b4) -} (BC_RESP_ITERATE , [t,l]) | t == toW8 EXPR_UNIT && l == toW8 EXPR_LIT -> IterateUnitReply (BC_RESP_ITERATE , [t,l,b]) | t == toW8 EXPR_BOOL && l == toW8 EXPR_LIT -> IterateBoolReply (if b == 0 then False else True) (BC_RESP_ITERATE , [t,l,b]) | t == toW8 EXPR_WORD8 && l == toW8 EXPR_LIT -> IterateW8Reply b (BC_RESP_ITERATE , [t,l,b1,b2]) | t == toW8 EXPR_WORD16 && l == toW8 EXPR_LIT -> IterateW16Reply (bytesToWord16 (b1, b2)) (BC_RESP_ITERATE , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_WORD32 && l == toW8 EXPR_LIT -> IterateW32Reply (bytesToWord32 (b1, b2, b3, b4)) (BC_RESP_ITERATE , [t,l,b]) | t == toW8 EXPR_INT8 && l == toW8 EXPR_LIT -> IterateI8Reply $ fromIntegral b (BC_RESP_ITERATE , [t,l,b1,b2]) | t == toW8 EXPR_INT16 && l == toW8 EXPR_LIT -> IterateI16Reply $ fromIntegral (bytesToWord16 (b1, b2)) (BC_RESP_ITERATE , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_INT32 && l == toW8 EXPR_LIT -> IterateI32Reply $ fromIntegral (bytesToWord32 (b1, b2, b3, b4)) (BC_RESP_ITERATE , t:l:_:bs) | t == toW8 EXPR_LIST8 && l == toW8 EXPR_LIT -> IterateL8Reply bs (BC_RESP_ITERATE , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_FLOAT && l == toW8 EXPR_LIT -> IterateFloatReply $ bytesToFloat (b1, b2, b3, b4) (BS_RESP_DEBUG, []) -> DebugResp (BS_RESP_VERSION, [majV, minV]) -> Firmware (bytesToWord16 (majV,minV)) (BS_RESP_TYPE, [p]) -> ProcessorType p (BS_RESP_MICROS, [_t,_l,m0,m1,m2,m3]) -> MicrosReply (bytesToWord32 (m0,m1,m2,m3)) (BS_RESP_MILLIS, [_t,_l,m0,m1,m2,m3]) -> MillisReply (bytesToWord32 (m0,m1,m2,m3)) (BS_RESP_STRING, rest) -> StringMessage (getString rest) (DIG_RESP_READ_PIN, [_t,_l,b]) -> DigitalReply b (DIG_RESP_READ_PORT, [_t,_l,b]) -> DigitalPortReply b (ALG_RESP_READ_PIN, [_t,_l,bl,bh]) -> AnalogReply (bytesToWord16 (bl,bh)) (I2C_RESP_READ, _:_:_:xs) -> I2CReply xs (SER_RESP_AVAIL, [_t, _l, w0]) -> SerialAvailableReply w0 (SER_RESP_READ, [_t,_l,i0,i1,i2,i3]) -> SerialReadReply (bytesToInt32 (i0,i1,i2,i3)) (SER_RESP_READ_LIST, _:_:_:xs) -> SerialReadListReply xs (STEP_RESP_2PIN, [_t,_l,st]) -> Stepper2PinReply st (STEP_RESP_4PIN, [_t,_l,st]) -> Stepper4PinReply st (STEP_RESP_STEP, []) -> StepperStepReply (SRVO_RESP_ATTACH, [_t,_l,sv]) -> ServoAttachReply sv (SRVO_RESP_READ, [_t,_l,il,ih]) -> ServoReadReply (fromIntegral (bytesToWord16 (il,ih))) (SRVO_RESP_READ_MICROS, [_t,_l,il,ih]) -> ServoReadMicrosReply (fromIntegral (bytesToWord16 (il,ih))) (SCHED_RESP_BOOT, [_t,_l,b]) -> BootTaskResp b (SCHED_RESP_QUERY_ALL, _:_:_:ts) -> QueryAllTasksReply ts (SCHED_RESP_QUERY, ts) | length ts == 0 -> QueryTaskReply Nothing (SCHED_RESP_QUERY, ts) | length ts >= 9 -> let ts0:ts1:tl0:tl1:tp0:tp1:tt0:tt1:tt2:tt3:_ = ts in QueryTaskReply (Just (bytesToWord16 (ts0,ts1), bytesToWord16 (tl0,tl1), bytesToWord16 (tp0,tp1), bytesToWord32 (tt0,tt1,tt2,tt3))) (REF_RESP_READ , [t,l,b]) | t == toW8 EXPR_BOOL && l == toW8 EXPR_LIT -> ReadRefBReply (if b == 0 then False else True) (REF_RESP_READ , [t,l,b]) | t == toW8 EXPR_WORD8 && l == toW8 EXPR_LIT -> ReadRefW8Reply b (REF_RESP_READ , [t,l,b1,b2]) | t == toW8 EXPR_WORD16 && l == toW8 EXPR_LIT -> ReadRefW16Reply (bytesToWord16 (b1, b2)) (REF_RESP_READ , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_WORD32 && l == toW8 EXPR_LIT -> ReadRefW32Reply (bytesToWord32 (b1, b2, b3, b4)) (REF_RESP_READ , [t,l,b]) | t == toW8 EXPR_INT8 && l == toW8 EXPR_LIT -> ReadRefI8Reply $ fromIntegral b (REF_RESP_READ , [t,l,b1,b2]) | t == toW8 EXPR_INT16 && l == toW8 EXPR_LIT -> ReadRefI16Reply $ fromIntegral (bytesToWord16 (b1, b2)) (REF_RESP_READ , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_INT32 && l == toW8 EXPR_LIT -> ReadRefI32Reply $ fromIntegral (bytesToWord32 (b1, b2, b3, b4)) (REF_RESP_READ , t:l:_:bs) | t == toW8 EXPR_LIST8 && l == toW8 EXPR_LIT -> ReadRefL8Reply bs (REF_RESP_READ , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_FLOAT && l == toW8 EXPR_LIT -> ReadRefFloatReply $ bytesToFloat (b1, b2, b3, b4) (REF_RESP_NEW , [_t,_l,w]) -> NewReply w (REF_RESP_NEW , []) -> FailedNewRef _ -> Unimplemented (Just (show cmd)) args | True = Unimplemented Nothing (cmdWord : args)
9,097
unpackageResponse (cmdWord:args) | Right cmd <- getFirmwareReply cmdWord = case (cmd, args) of (BC_RESP_DELAY, []) -> DelayResp (BC_RESP_IF_THEN_ELSE , [t,l]) | t == toW8 EXPR_UNIT && l == toW8 EXPR_LIT -> IfThenElseUnitReply () (BC_RESP_IF_THEN_ELSE , [t,l,b]) | t == toW8 EXPR_BOOL && l == toW8 EXPR_LIT -> IfThenElseBoolReply (if b == 0 then False else True) (BC_RESP_IF_THEN_ELSE , [t,l,b]) | t == toW8 EXPR_WORD8 && l == toW8 EXPR_LIT -> IfThenElseW8Reply b (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2]) | t == toW8 EXPR_WORD16 && l == toW8 EXPR_LIT -> IfThenElseW16Reply (bytesToWord16 (b1, b2)) (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_WORD32 && l == toW8 EXPR_LIT -> IfThenElseW32Reply (bytesToWord32 (b1, b2, b3, b4)) (BC_RESP_IF_THEN_ELSE , [t,l,b]) | t == toW8 EXPR_INT8 && l == toW8 EXPR_LIT -> IfThenElseI8Reply $ fromIntegral b (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2]) | t == toW8 EXPR_INT16 && l == toW8 EXPR_LIT -> IfThenElseI16Reply $ fromIntegral (bytesToWord16 (b1, b2)) (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_INT32 && l == toW8 EXPR_LIT -> IfThenElseI32Reply $ fromIntegral (bytesToWord32 (b1, b2, b3, b4)) (BC_RESP_IF_THEN_ELSE , t:l:_:bs) | t == toW8 EXPR_LIST8 && l == toW8 EXPR_LIT -> IfThenElseL8Reply bs (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_FLOAT && l == toW8 EXPR_LIT -> IfThenElseFloatReply $ bytesToFloat (b1, b2, b3, b4) {-- The IfThenElse Left replies are only used inside of Iterates -- so they will never be received by the host, but are here for -- test purposes (BC_RESP_IF_THEN_ELSE , [t,l,b]) | t == (toW8 EXPR_BOOL + 0x80) && l == toW8 EXPR_LIT -> IfThenElseBoolLeftReply (if b == 0 then False else True) (BC_RESP_IF_THEN_ELSE , [t,l,b]) | t == (toW8 EXPR_WORD8 + 0x80) && l == toW8 EXPR_LIT -> IfThenElseW8LeftReply b (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2]) | t == (toW8 EXPR_WORD16 + 0x80) && l == toW8 EXPR_LIT -> IfThenElseW16LeftReply (bytesToWord16 (b1, b2)) (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2,b3,b4]) | t == (toW8 EXPR_WORD32 + 0x80) && l == toW8 EXPR_LIT -> IfThenElseW32LeftReply (bytesToWord32 (b1, b2, b3, b4)) (BC_RESP_IF_THEN_ELSE , [t,l,b]) | t == (toW8 EXPR_INT8 + 0x80) && l == toW8 EXPR_LIT -> IfThenElseI8LeftReply $ fromIntegral b (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2]) | t == (toW8 EXPR_INT16 + 0x80) && l == toW8 EXPR_LIT -> IfThenElseI16LeftReply $ fromIntegral (bytesToWord16 (b1, b2)) (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2,b3,b4]) | t == (toW8 EXPR_INT32 + 0x80) && l == toW8 EXPR_LIT -> IfThenElseI32LeftReply $ fromIntegral (bytesToWord32 (b1, b2, b3, b4)) (BC_RESP_IF_THEN_ELSE , t:l:_:bs) | t == (toW8 EXPR_LIST8 + 0x80) && l == toW8 EXPR_LIT -> IfThenElseL8LeftReply bs (BC_RESP_IF_THEN_ELSE , [t,l,b1,b2,b3,b4]) | t == (toW8 EXPR_FLOAT + 0x80) && l == toW8 EXPR_LIT -> IfThenElseFloatLeftReply $ bytesToFloat (b1, b2, b3, b4) -} (BC_RESP_ITERATE , [t,l]) | t == toW8 EXPR_UNIT && l == toW8 EXPR_LIT -> IterateUnitReply (BC_RESP_ITERATE , [t,l,b]) | t == toW8 EXPR_BOOL && l == toW8 EXPR_LIT -> IterateBoolReply (if b == 0 then False else True) (BC_RESP_ITERATE , [t,l,b]) | t == toW8 EXPR_WORD8 && l == toW8 EXPR_LIT -> IterateW8Reply b (BC_RESP_ITERATE , [t,l,b1,b2]) | t == toW8 EXPR_WORD16 && l == toW8 EXPR_LIT -> IterateW16Reply (bytesToWord16 (b1, b2)) (BC_RESP_ITERATE , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_WORD32 && l == toW8 EXPR_LIT -> IterateW32Reply (bytesToWord32 (b1, b2, b3, b4)) (BC_RESP_ITERATE , [t,l,b]) | t == toW8 EXPR_INT8 && l == toW8 EXPR_LIT -> IterateI8Reply $ fromIntegral b (BC_RESP_ITERATE , [t,l,b1,b2]) | t == toW8 EXPR_INT16 && l == toW8 EXPR_LIT -> IterateI16Reply $ fromIntegral (bytesToWord16 (b1, b2)) (BC_RESP_ITERATE , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_INT32 && l == toW8 EXPR_LIT -> IterateI32Reply $ fromIntegral (bytesToWord32 (b1, b2, b3, b4)) (BC_RESP_ITERATE , t:l:_:bs) | t == toW8 EXPR_LIST8 && l == toW8 EXPR_LIT -> IterateL8Reply bs (BC_RESP_ITERATE , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_FLOAT && l == toW8 EXPR_LIT -> IterateFloatReply $ bytesToFloat (b1, b2, b3, b4) (BS_RESP_DEBUG, []) -> DebugResp (BS_RESP_VERSION, [majV, minV]) -> Firmware (bytesToWord16 (majV,minV)) (BS_RESP_TYPE, [p]) -> ProcessorType p (BS_RESP_MICROS, [_t,_l,m0,m1,m2,m3]) -> MicrosReply (bytesToWord32 (m0,m1,m2,m3)) (BS_RESP_MILLIS, [_t,_l,m0,m1,m2,m3]) -> MillisReply (bytesToWord32 (m0,m1,m2,m3)) (BS_RESP_STRING, rest) -> StringMessage (getString rest) (DIG_RESP_READ_PIN, [_t,_l,b]) -> DigitalReply b (DIG_RESP_READ_PORT, [_t,_l,b]) -> DigitalPortReply b (ALG_RESP_READ_PIN, [_t,_l,bl,bh]) -> AnalogReply (bytesToWord16 (bl,bh)) (I2C_RESP_READ, _:_:_:xs) -> I2CReply xs (SER_RESP_AVAIL, [_t, _l, w0]) -> SerialAvailableReply w0 (SER_RESP_READ, [_t,_l,i0,i1,i2,i3]) -> SerialReadReply (bytesToInt32 (i0,i1,i2,i3)) (SER_RESP_READ_LIST, _:_:_:xs) -> SerialReadListReply xs (STEP_RESP_2PIN, [_t,_l,st]) -> Stepper2PinReply st (STEP_RESP_4PIN, [_t,_l,st]) -> Stepper4PinReply st (STEP_RESP_STEP, []) -> StepperStepReply (SRVO_RESP_ATTACH, [_t,_l,sv]) -> ServoAttachReply sv (SRVO_RESP_READ, [_t,_l,il,ih]) -> ServoReadReply (fromIntegral (bytesToWord16 (il,ih))) (SRVO_RESP_READ_MICROS, [_t,_l,il,ih]) -> ServoReadMicrosReply (fromIntegral (bytesToWord16 (il,ih))) (SCHED_RESP_BOOT, [_t,_l,b]) -> BootTaskResp b (SCHED_RESP_QUERY_ALL, _:_:_:ts) -> QueryAllTasksReply ts (SCHED_RESP_QUERY, ts) | length ts == 0 -> QueryTaskReply Nothing (SCHED_RESP_QUERY, ts) | length ts >= 9 -> let ts0:ts1:tl0:tl1:tp0:tp1:tt0:tt1:tt2:tt3:_ = ts in QueryTaskReply (Just (bytesToWord16 (ts0,ts1), bytesToWord16 (tl0,tl1), bytesToWord16 (tp0,tp1), bytesToWord32 (tt0,tt1,tt2,tt3))) (REF_RESP_READ , [t,l,b]) | t == toW8 EXPR_BOOL && l == toW8 EXPR_LIT -> ReadRefBReply (if b == 0 then False else True) (REF_RESP_READ , [t,l,b]) | t == toW8 EXPR_WORD8 && l == toW8 EXPR_LIT -> ReadRefW8Reply b (REF_RESP_READ , [t,l,b1,b2]) | t == toW8 EXPR_WORD16 && l == toW8 EXPR_LIT -> ReadRefW16Reply (bytesToWord16 (b1, b2)) (REF_RESP_READ , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_WORD32 && l == toW8 EXPR_LIT -> ReadRefW32Reply (bytesToWord32 (b1, b2, b3, b4)) (REF_RESP_READ , [t,l,b]) | t == toW8 EXPR_INT8 && l == toW8 EXPR_LIT -> ReadRefI8Reply $ fromIntegral b (REF_RESP_READ , [t,l,b1,b2]) | t == toW8 EXPR_INT16 && l == toW8 EXPR_LIT -> ReadRefI16Reply $ fromIntegral (bytesToWord16 (b1, b2)) (REF_RESP_READ , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_INT32 && l == toW8 EXPR_LIT -> ReadRefI32Reply $ fromIntegral (bytesToWord32 (b1, b2, b3, b4)) (REF_RESP_READ , t:l:_:bs) | t == toW8 EXPR_LIST8 && l == toW8 EXPR_LIT -> ReadRefL8Reply bs (REF_RESP_READ , [t,l,b1,b2,b3,b4]) | t == toW8 EXPR_FLOAT && l == toW8 EXPR_LIT -> ReadRefFloatReply $ bytesToFloat (b1, b2, b3, b4) (REF_RESP_NEW , [_t,_l,w]) -> NewReply w (REF_RESP_NEW , []) -> FailedNewRef _ -> Unimplemented (Just (show cmd)) args | True = Unimplemented Nothing (cmdWord : args)
9,097
false
false
0
23
3,214
2,742
1,464
1,278
null
null
NorfairKing/the-notes
src/Groups/Macro.hs
gpl-2.0
-- | Infix version of the above -- -- > C-k '0 (˚) :: Note -> Note -> Note (˚) = binop mndop_
93
(˚) :: Note -> Note -> Note (˚) = binop mndop_
46
(˚) = binop mndop_
18
true
true
0
6
22
29
18
11
null
null
acharal/hopes
src/interpreter/Driver.hs
gpl-2.0
consultFile f = do (src, env) <- loadSource f modify (\s -> s{ kb = KB src, p = (kbtoProgram (KB src)), currentEnv = env}) liftIO $ putStrLn ("% consulted " ++ show f ++ "")
227
consultFile f = do (src, env) <- loadSource f modify (\s -> s{ kb = KB src, p = (kbtoProgram (KB src)), currentEnv = env}) liftIO $ putStrLn ("% consulted " ++ show f ++ "")
227
consultFile f = do (src, env) <- loadSource f modify (\s -> s{ kb = KB src, p = (kbtoProgram (KB src)), currentEnv = env}) liftIO $ putStrLn ("% consulted " ++ show f ++ "")
227
false
false
0
15
89
98
50
48
null
null
adamse/hindent
src/HIndent.hs
bsd-3-clause
test :: Style -> Text -> IO () test style = either error (T.putStrLn . T.toLazyText) . reformat style Nothing
113
test :: Style -> Text -> IO () test style = either error (T.putStrLn . T.toLazyText) . reformat style Nothing
113
test style = either error (T.putStrLn . T.toLazyText) . reformat style Nothing
82
false
true
0
9
23
52
25
27
null
null
mattraibert/codetest
src/Test/Acceptance.hs
gpl-3.0
main :: IO () main = do model <- readFileText "code_test_files/model_output.txt" files <- readFiles defaultMain $ model $==$ doMain files
147
main :: IO () main = do model <- readFileText "code_test_files/model_output.txt" files <- readFiles defaultMain $ model $==$ doMain files
147
main = do model <- readFileText "code_test_files/model_output.txt" files <- readFiles defaultMain $ model $==$ doMain files
133
false
true
0
8
29
47
21
26
null
null
mortum5/programming
haskell/usefull/parser/errorcheck.hs
mit
parseNumber :: Parser LispVal parseNumber = liftM (Number . read) $ many1 digit
79
parseNumber :: Parser LispVal parseNumber = liftM (Number . read) $ many1 digit
79
parseNumber = liftM (Number . read) $ many1 digit
49
false
true
1
8
12
34
15
19
null
null
brendanhay/gogol
gogol-cloudsearch/gen/Network/Google/CloudSearch/Types/Product.hs
mpl-2.0
-- | The options for sorting the search results srSortOptions :: Lens' SearchRequest (Maybe SortOptions) srSortOptions = lens _srSortOptions (\ s a -> s{_srSortOptions = a})
181
srSortOptions :: Lens' SearchRequest (Maybe SortOptions) srSortOptions = lens _srSortOptions (\ s a -> s{_srSortOptions = a})
133
srSortOptions = lens _srSortOptions (\ s a -> s{_srSortOptions = a})
76
true
true
1
9
33
52
25
27
null
null
cullina/Extractor
src/QTree.hs
bsd-3-clause
tritLookup (_,x,_) EQ = x
25
tritLookup (_,x,_) EQ = x
25
tritLookup (_,x,_) EQ = x
25
false
false
1
5
4
22
11
11
null
null
nomeata/sat-britney
Data/DenseIntSet.hs
gpl-2.0
-- | /O(n)/. Cardinality of the set. size :: IntSet -> Int size t = case t of Bin _ _ l r -> size l + size r Tip _ bm -> bitcount 0 bm Nil -> 0 -- The 'go' function in the member causes 10% speedup, but also an -- increased memory allocation. It does not cause speedup with other methods -- like insert and delete, so it is present only in member. -- Also mind the 'nomatch' line in member definition, which is not present in -- IntMap.hs. That condition stops the search if the prefix of current vertex -- is different that the element looked for. The member is correct both with -- and without this condition. With this condition, elements not present are -- rejected sooner, but a little bit more work is done for the elements in the -- set (we are talking about 3-5% slowdown). Any of the solutions is better -- than the other, because we do not know the distribution of input data. -- Current state is historic. -- | /O(min(n,W))/. Is the value a member of the set?
995
size :: IntSet -> Int size t = case t of Bin _ _ l r -> size l + size r Tip _ bm -> bitcount 0 bm Nil -> 0 -- The 'go' function in the member causes 10% speedup, but also an -- increased memory allocation. It does not cause speedup with other methods -- like insert and delete, so it is present only in member. -- Also mind the 'nomatch' line in member definition, which is not present in -- IntMap.hs. That condition stops the search if the prefix of current vertex -- is different that the element looked for. The member is correct both with -- and without this condition. With this condition, elements not present are -- rejected sooner, but a little bit more work is done for the elements in the -- set (we are talking about 3-5% slowdown). Any of the solutions is better -- than the other, because we do not know the distribution of input data. -- Current state is historic. -- | /O(min(n,W))/. Is the value a member of the set?
958
size t = case t of Bin _ _ l r -> size l + size r Tip _ bm -> bitcount 0 bm Nil -> 0 -- The 'go' function in the member causes 10% speedup, but also an -- increased memory allocation. It does not cause speedup with other methods -- like insert and delete, so it is present only in member. -- Also mind the 'nomatch' line in member definition, which is not present in -- IntMap.hs. That condition stops the search if the prefix of current vertex -- is different that the element looked for. The member is correct both with -- and without this condition. With this condition, elements not present are -- rejected sooner, but a little bit more work is done for the elements in the -- set (we are talking about 3-5% slowdown). Any of the solutions is better -- than the other, because we do not know the distribution of input data. -- Current state is historic. -- | /O(min(n,W))/. Is the value a member of the set?
936
true
true
0
9
213
88
46
42
null
null
plow-technologies/ircbrowse
src/Text/Blaze/Bootstrap.hs
bsd-3-clause
span3 :: Html -> Html span3 x = div !. "span3" $ x
50
span3 :: Html -> Html span3 x = div !. "span3" $ x
50
span3 x = div !. "span3" $ x
28
false
true
0
6
12
26
13
13
null
null
michalkonecny/aern
aern-real/src/Numeric/AERN/RealArithmetic/NumericOrderRounding/MixedFieldOps.hs
bsd-3-clause
(|*^) :: (RoundedMixedMultiply t tn) => tn -> t -> t (|*^) = flip mixedMultUp
77
(|*^) :: (RoundedMixedMultiply t tn) => tn -> t -> t (|*^) = flip mixedMultUp
77
(|*^) = flip mixedMultUp
24
false
true
0
7
14
37
21
16
null
null
urbanslug/ghc
compiler/basicTypes/Unique.hs
bsd-3-clause
-- deriveUnique uses an 'X' tag so that it won't clash with -- any of the uniques produced any other way deriveUnique (MkUnique i) delta = mkUnique 'X' (iBox i + delta)
168
deriveUnique (MkUnique i) delta = mkUnique 'X' (iBox i + delta)
63
deriveUnique (MkUnique i) delta = mkUnique 'X' (iBox i + delta)
63
true
false
1
8
31
39
17
22
null
null
google/cabal2bazel
bzl/tests/template_haskell/TransitiveDependency.hs
apache-2.0
myThing :: Map.Map Integer String myThing = Map.fromList [(1, "one"), (2, "two")]
81
myThing :: Map.Map Integer String myThing = Map.fromList [(1, "one"), (2, "two")]
81
myThing = Map.fromList [(1, "one"), (2, "two")]
47
false
true
0
7
11
46
24
22
null
null
romanb/amazonka
amazonka-rds/gen/Network/AWS/RDS/Types.hs
mpl-2.0
-- | The description of the reserved DB instance. rdbiProductDescription :: Lens' ReservedDBInstance (Maybe Text) rdbiProductDescription = lens _rdbiProductDescription (\s a -> s { _rdbiProductDescription = a })
215
rdbiProductDescription :: Lens' ReservedDBInstance (Maybe Text) rdbiProductDescription = lens _rdbiProductDescription (\s a -> s { _rdbiProductDescription = a })
165
rdbiProductDescription = lens _rdbiProductDescription (\s a -> s { _rdbiProductDescription = a })
101
true
true
0
9
31
46
25
21
null
null
kawu/tagger
src/Text/Tagset/TagPrinter.hs
bsd-3-clause
showTag :: Tagset -> Label -> T.Text showTag tagset label = let values = tagValues tagset label in case tagView tagset of NKJPView -> T.intercalate (T.singleton ':') $ catMaybes values MorphosView -> (fromJust $ head values) `T.append` T.singleton '.' `T.append` T.concat [ case value of Just x -> x -- Nothing -> T.singleton '_' Nothing -> T.empty | value <- tail values ]
572
showTag :: Tagset -> Label -> T.Text showTag tagset label = let values = tagValues tagset label in case tagView tagset of NKJPView -> T.intercalate (T.singleton ':') $ catMaybes values MorphosView -> (fromJust $ head values) `T.append` T.singleton '.' `T.append` T.concat [ case value of Just x -> x -- Nothing -> T.singleton '_' Nothing -> T.empty | value <- tail values ]
572
showTag tagset label = let values = tagValues tagset label in case tagView tagset of NKJPView -> T.intercalate (T.singleton ':') $ catMaybes values MorphosView -> (fromJust $ head values) `T.append` T.singleton '.' `T.append` T.concat [ case value of Just x -> x -- Nothing -> T.singleton '_' Nothing -> T.empty | value <- tail values ]
535
false
true
2
11
261
159
76
83
null
null
Heather/Idris-dev
src/Idris/IdrisDoc.hs
bsd-3-clause
extractPTermNames (PNoImplicits p) = extract p
48
extractPTermNames (PNoImplicits p) = extract p
48
extractPTermNames (PNoImplicits p) = extract p
48
false
false
0
6
7
19
8
11
null
null
np/ling
Ling/Prelude.hs
bsd-3-clause
-- TODO: What is the best threshold between repeatdly deleting elements from a map and filtering the -- whole map? deleteList :: Ord k => [k] -> Endom (Map k a) deleteList = \case [] -> id [k] -> Map.delete k ks -> let sks = l2s ks in Map.filterWithKey (\k _ -> k `notMember` sks)
297
deleteList :: Ord k => [k] -> Endom (Map k a) deleteList = \case [] -> id [k] -> Map.delete k ks -> let sks = l2s ks in Map.filterWithKey (\k _ -> k `notMember` sks)
182
deleteList = \case [] -> id [k] -> Map.delete k ks -> let sks = l2s ks in Map.filterWithKey (\k _ -> k `notMember` sks)
136
true
true
3
10
72
97
50
47
null
null
redelmann/e-zimod-server
Main.hs
bsd-3-clause
addUserProfileH :: Snap Integer addUserProfileH = do pr <- jsonParam "profile" withConnection $ \ c -> do addProfile c pr lastInsertedId c "userprofiles" -- | User profile delete handler.
212
addUserProfileH :: Snap Integer addUserProfileH = do pr <- jsonParam "profile" withConnection $ \ c -> do addProfile c pr lastInsertedId c "userprofiles" -- | User profile delete handler.
212
addUserProfileH = do pr <- jsonParam "profile" withConnection $ \ c -> do addProfile c pr lastInsertedId c "userprofiles" -- | User profile delete handler.
180
false
true
0
11
53
53
24
29
null
null
uduki/hsQt
Qtc/ClassTypes/Core.hs
bsd-2-clause
qCast_QTextCodec :: Object a -> IO (QTextCodec ()) qCast_QTextCodec _qobj = return (objectCast _qobj)
103
qCast_QTextCodec :: Object a -> IO (QTextCodec ()) qCast_QTextCodec _qobj = return (objectCast _qobj)
103
qCast_QTextCodec _qobj = return (objectCast _qobj)
52
false
true
0
9
15
41
19
22
null
null
sheepforce/Hoptics
src/Parsers.hs
gpl-3.0
parse_spectrum_line :: Parser (Double,Double) parse_spectrum_line = do skipSpace x <- double skipSpace y <- double skipSpace return $ (x,y)
163
parse_spectrum_line :: Parser (Double,Double) parse_spectrum_line = do skipSpace x <- double skipSpace y <- double skipSpace return $ (x,y)
163
parse_spectrum_line = do skipSpace x <- double skipSpace y <- double skipSpace return $ (x,y)
117
false
true
0
8
42
56
27
29
null
null
ledyba/java.js
lib/Java2js/Java/IO.hs
gpl-3.0
-- | java.io.PrintStream class as field type printStreamClass :: FieldType printStreamClass = ObjectType printStream
117
printStreamClass :: FieldType printStreamClass = ObjectType printStream
72
printStreamClass = ObjectType printStream
41
true
true
0
5
14
15
8
7
null
null
ComputationWithBoundedResources/ara-inference
doc/tpdb_trs/Haskell/basic_haskell/enumFromThen_2.hs
mit
primQuotInt (Neg x) (Neg (Succ y)) = Pos (primDivNatS x (Succ y))
65
primQuotInt (Neg x) (Neg (Succ y)) = Pos (primDivNatS x (Succ y))
65
primQuotInt (Neg x) (Neg (Succ y)) = Pos (primDivNatS x (Succ y))
65
false
false
0
9
11
46
22
24
null
null
Pitometsu/bake
src/Development/Bake/Git.hs
bsd-3-clause
gitInit :: String -> String -> IO SHA1 gitInit repo branch = traced "gitInit" $ do Stdout hash <- time $ cmd "git ls-remote" [repo] [branch] case words $ concat $ takeEnd 1 $ lines hash of [] -> error "Couldn't find branch" x:xs -> return $ toSHA1 $ trim x
280
gitInit :: String -> String -> IO SHA1 gitInit repo branch = traced "gitInit" $ do Stdout hash <- time $ cmd "git ls-remote" [repo] [branch] case words $ concat $ takeEnd 1 $ lines hash of [] -> error "Couldn't find branch" x:xs -> return $ toSHA1 $ trim x
280
gitInit repo branch = traced "gitInit" $ do Stdout hash <- time $ cmd "git ls-remote" [repo] [branch] case words $ concat $ takeEnd 1 $ lines hash of [] -> error "Couldn't find branch" x:xs -> return $ toSHA1 $ trim x
241
false
true
0
12
74
118
55
63
null
null
crvs/scythe
src/Math/Scythe.bak.hs
bsd-3-clause
-- if the queue is empty then there is nothing left to do and we return the diagram quePlay d (y:ys) cs ms = if length (nonCUnder y cs d) == 1 then -- there is a non-critical element over exactly one other non-critical let{ x = head (nonCUnder y cs d) ; nys = ys ++ elemOver x y ms d ; nms = ms `union` nys ; y' = head $ filter (==y) (hlist d) } in quePlay (reducepair d x y') -- reduce the diagram d with respect to s and y nys -- y gets dequeued and we equeue all elements over x and y cs -- the critical set is not changed by this operation nms -- add all new enqueued elements to the marked list else let { nys = ys ++ elemOver' y ms d ; nms = ms `union` nys } in quePlay d -- the diagram is unchanged at this stage nys -- enqueue every element over y that hasn't been enqueued yet cs -- the critical elements remain the same nms
1,036
quePlay d (y:ys) cs ms = if length (nonCUnder y cs d) == 1 then -- there is a non-critical element over exactly one other non-critical let{ x = head (nonCUnder y cs d) ; nys = ys ++ elemOver x y ms d ; nms = ms `union` nys ; y' = head $ filter (==y) (hlist d) } in quePlay (reducepair d x y') -- reduce the diagram d with respect to s and y nys -- y gets dequeued and we equeue all elements over x and y cs -- the critical set is not changed by this operation nms -- add all new enqueued elements to the marked list else let { nys = ys ++ elemOver' y ms d ; nms = ms `union` nys } in quePlay d -- the diagram is unchanged at this stage nys -- enqueue every element over y that hasn't been enqueued yet cs -- the critical elements remain the same nms
952
quePlay d (y:ys) cs ms = if length (nonCUnder y cs d) == 1 then -- there is a non-critical element over exactly one other non-critical let{ x = head (nonCUnder y cs d) ; nys = ys ++ elemOver x y ms d ; nms = ms `union` nys ; y' = head $ filter (==y) (hlist d) } in quePlay (reducepair d x y') -- reduce the diagram d with respect to s and y nys -- y gets dequeued and we equeue all elements over x and y cs -- the critical set is not changed by this operation nms -- add all new enqueued elements to the marked list else let { nys = ys ++ elemOver' y ms d ; nms = ms `union` nys } in quePlay d -- the diagram is unchanged at this stage nys -- enqueue every element over y that hasn't been enqueued yet cs -- the critical elements remain the same nms
952
true
false
0
13
383
202
111
91
null
null
rolph-recto/liquidhaskell
tests/todo/Interpreter.hs
bsd-3-clause
-- Termination Annotations {-@ data Exp [expSize] @-} {-@ invariant {v:Exp | expSize v >= 0} @-} {-@ measure expSize @-} expSize :: Exp -> Int expSize (EConst _) = 0
166
expSize :: Exp -> Int expSize (EConst _) = 0
44
expSize (EConst _) = 0
22
true
true
0
7
31
28
16
12
null
null
bitemyapp/ghc
compiler/rename/RnBinds.hs
bsd-3-clause
rnValBindsRHS _ b = pprPanic "rnValBindsRHS" (ppr b)
52
rnValBindsRHS _ b = pprPanic "rnValBindsRHS" (ppr b)
52
rnValBindsRHS _ b = pprPanic "rnValBindsRHS" (ppr b)
52
false
false
0
7
7
22
10
12
null
null
keera-studios/hsQt
Qtc/ClassTypes/Network.hs
bsd-2-clause
withQListQTcpServerResult :: (Ptr (Ptr (TQTcpServer a)) -> IO CInt) -> IO [QTcpServer a] withQListQTcpServerResult f = withQListObjectResult qtc_QTcpServer_getFinalizer f
172
withQListQTcpServerResult :: (Ptr (Ptr (TQTcpServer a)) -> IO CInt) -> IO [QTcpServer a] withQListQTcpServerResult f = withQListObjectResult qtc_QTcpServer_getFinalizer f
172
withQListQTcpServerResult f = withQListObjectResult qtc_QTcpServer_getFinalizer f
83
false
true
0
12
20
57
27
30
null
null
qpliu/esolang
shiftprime/hs/Parse.hs
gpl-3.0
compileBody :: (String -> Maybe Int) -> Def1Body -> DefBody compileBody arity (Def1Body exprs guards) = DefBody (compileDef1ExprsToExpr arity exprs) (map (compileGuard arity) guards)
186
compileBody :: (String -> Maybe Int) -> Def1Body -> DefBody compileBody arity (Def1Body exprs guards) = DefBody (compileDef1ExprsToExpr arity exprs) (map (compileGuard arity) guards)
186
compileBody arity (Def1Body exprs guards) = DefBody (compileDef1ExprsToExpr arity exprs) (map (compileGuard arity) guards)
126
false
true
0
9
27
69
34
35
null
null
bredelings/BAli-Phy
tests/prob_prog/infer_tree/2/Main.hs
gpl-2.0
main = do [filename] <- getArgs seq_data <- load_sequences filename mcmc $ model seq_data
103
main = do [filename] <- getArgs seq_data <- load_sequences filename mcmc $ model seq_data
103
main = do [filename] <- getArgs seq_data <- load_sequences filename mcmc $ model seq_data
103
false
false
1
9
27
40
16
24
null
null
stevezhee/pec
Pec/HUtil.hs
bsd-3-clause
hString :: Pretty a => a -> H.Exp hString = H.Lit . H.String . ppShow
69
hString :: Pretty a => a -> H.Exp hString = H.Lit . H.String . ppShow
69
hString = H.Lit . H.String . ppShow
35
false
true
0
7
14
36
18
18
null
null
CindyLinz/Haskell.js
trans/src/Desugar/String.hs
mit
deStringCName (ConName l name) = ConName (id l) (deStringName name)
67
deStringCName (ConName l name) = ConName (id l) (deStringName name)
67
deStringCName (ConName l name) = ConName (id l) (deStringName name)
67
false
false
0
7
9
34
16
18
null
null
joshrule/poplog
src/Poplog/Types.hs
mit
showTerm (Structure "." xs) = "[" ++ (showListTerm xs) ++ "]"
61
showTerm (Structure "." xs) = "[" ++ (showListTerm xs) ++ "]"
61
showTerm (Structure "." xs) = "[" ++ (showListTerm xs) ++ "]"
61
false
false
0
8
10
31
15
16
null
null
brendanhay/gogol
gogol-healthcare/gen/Network/Google/Healthcare/Types/Product.hs
mpl-2.0
-- | Creates a value of 'DeidentifyDicomStoreRequest' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'ddsrConfig' -- -- * 'ddsrFilterConfig' -- -- * 'ddsrDestinationStore' deidentifyDicomStoreRequest :: DeidentifyDicomStoreRequest deidentifyDicomStoreRequest = DeidentifyDicomStoreRequest' { _ddsrConfig = Nothing , _ddsrFilterConfig = Nothing , _ddsrDestinationStore = Nothing }
487
deidentifyDicomStoreRequest :: DeidentifyDicomStoreRequest deidentifyDicomStoreRequest = DeidentifyDicomStoreRequest' { _ddsrConfig = Nothing , _ddsrFilterConfig = Nothing , _ddsrDestinationStore = Nothing }
229
deidentifyDicomStoreRequest = DeidentifyDicomStoreRequest' { _ddsrConfig = Nothing , _ddsrFilterConfig = Nothing , _ddsrDestinationStore = Nothing }
166
true
true
0
7
82
50
30
20
null
null
gatlin/psilo
src/Lib/Preprocessor.hs
gpl-3.0
surfaceToCore (Free (IfS c t e)) = do c' <- surfaceToCore c t' <- surfaceToCore t e' <- surfaceToCore e return $ cIf c' t' e'
141
surfaceToCore (Free (IfS c t e)) = do c' <- surfaceToCore c t' <- surfaceToCore t e' <- surfaceToCore e return $ cIf c' t' e'
141
surfaceToCore (Free (IfS c t e)) = do c' <- surfaceToCore c t' <- surfaceToCore t e' <- surfaceToCore e return $ cIf c' t' e'
141
false
false
0
8
41
70
30
40
null
null
bitonic/kyotocabinet
Database/KyotoCabinet/Internal.hs
bsd-3-clause
getKeyValue (MaxSize i) = ("capsize", show i)
52
getKeyValue (MaxSize i) = ("capsize", show i)
52
getKeyValue (MaxSize i) = ("capsize", show i)
52
false
false
0
6
13
25
12
13
null
null
dmbarbour/Sirea
src/Sirea/Internal/SigType.hs
bsd-3-clause
eqConst1 _ Done = Done
23
seqConst1 _ Done = Done
23
seqConst1 _ Done = Done
23
false
false
1
4
5
12
5
7
null
null
NorfairKing/haphviz
src/Text/Dot/Attributes.hs
mit
shape :: AttributeName shape = "shape"
38
shape :: AttributeName shape = "shape"
38
shape = "shape"
15
false
true
0
4
5
11
6
5
null
null
phischu/fragnix
benchmarks/containers/Data.IntSet.Base.hs
bsd-3-clause
member :: Key -> IntSet -> Bool member x = x `seq` go where go (Bin p m l r) | nomatch x p m = False | zero x m = go l | otherwise = go r go (Tip y bm) = prefixOf x == y && bitmapOf x .&. bm /= 0 go Nil = False -- | /O(min(n,W))/. Is the element not in the set?
303
member :: Key -> IntSet -> Bool member x = x `seq` go where go (Bin p m l r) | nomatch x p m = False | zero x m = go l | otherwise = go r go (Tip y bm) = prefixOf x == y && bitmapOf x .&. bm /= 0 go Nil = False -- | /O(min(n,W))/. Is the element not in the set?
303
member x = x `seq` go where go (Bin p m l r) | nomatch x p m = False | zero x m = go l | otherwise = go r go (Tip y bm) = prefixOf x == y && bitmapOf x .&. bm /= 0 go Nil = False -- | /O(min(n,W))/. Is the element not in the set?
271
false
true
0
9
110
140
66
74
null
null
ml9951/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
pureAName = varQual gHC_BASE (fsLit "pure") pureAClassOpKey
77
pureAName = varQual gHC_BASE (fsLit "pure") pureAClassOpKey
77
pureAName = varQual gHC_BASE (fsLit "pure") pureAClassOpKey
77
false
false
0
7
24
19
9
10
null
null
sgraf812/worklist
src/Worklist.hs
isc
runFramework :: Ord node => DataFlowFramework node lattice -> Set node -> Map node lattice runFramework framework_ interestingNodes = run framework_ where st = work (Map.fromSet (const Set.empty) interestingNodes) run = Map.mapMaybe value . graph . execState st . initialWorklistState
302
runFramework :: Ord node => DataFlowFramework node lattice -> Set node -> Map node lattice runFramework framework_ interestingNodes = run framework_ where st = work (Map.fromSet (const Set.empty) interestingNodes) run = Map.mapMaybe value . graph . execState st . initialWorklistState
302
runFramework framework_ interestingNodes = run framework_ where st = work (Map.fromSet (const Set.empty) interestingNodes) run = Map.mapMaybe value . graph . execState st . initialWorklistState
203
false
true
1
13
57
106
48
58
null
null
tjakway/ghcjvm
compiler/prelude/THNames.hs
bsd-3-clause
varBangTypeQTyConName = libTc (fsLit "VarBangTypeQ") varBangTypeQTyConKey
77
varBangTypeQTyConName = libTc (fsLit "VarBangTypeQ") varBangTypeQTyConKey
77
varBangTypeQTyConName = libTc (fsLit "VarBangTypeQ") varBangTypeQTyConKey
77
false
false
0
7
9
17
8
9
null
null
jbracker/supermonad-plugin
examples/monad/hmtc/original/Type.hs
bsd-3-clause
-- | Predicate that decides if the type is a reference type. refType :: Type -> Bool refType (Src _) = True
107
refType :: Type -> Bool refType (Src _) = True
46
refType (Src _) = True
22
true
true
0
9
21
31
14
17
null
null
ivan-m/Graphalyze
Data/Graph/Analysis/Reporting/Pandoc.hs
bsd-2-clause
elements p (Itemized elems) = do elems' <- multiElems' p elems return (fmap (return . BulletList) elems')
144
elements p (Itemized elems) = do elems' <- multiElems' p elems return (fmap (return . BulletList) elems')
144
elements p (Itemized elems) = do elems' <- multiElems' p elems return (fmap (return . BulletList) elems')
144
false
false
0
11
55
50
23
27
null
null
brendanhay/gogol
gogol-dfareporting/gen/Network/Google/Resource/DFAReporting/TargetingTemplates/List.hs
mpl-2.0
-- | Maximum number of results to return. ttlMaxResults :: Lens' TargetingTemplatesList Int32 ttlMaxResults = lens _ttlMaxResults (\ s a -> s{_ttlMaxResults = a}) . _Coerce
186
ttlMaxResults :: Lens' TargetingTemplatesList Int32 ttlMaxResults = lens _ttlMaxResults (\ s a -> s{_ttlMaxResults = a}) . _Coerce
144
ttlMaxResults = lens _ttlMaxResults (\ s a -> s{_ttlMaxResults = a}) . _Coerce
92
true
true
2
8
39
50
24
26
null
null
phdenzel/dotfiles
.config/xmonad/xmonad.hs
mit
-------------------- Scratchpads myScratchPads :: [NamedScratchpad] myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm , NS "calculator" spawnCalc findCalc manageCalc , NS "ranger" spawnRanger findRanger manageRanger ] where spawnTerm = myTerminal ++ " -t scratchpad" findTerm = title =? "scratchpad" manageTerm = customFloating $ W.RationalRect l t w h where h = 0.9 w = 0.9 t = 0.95 -h l = 0.95 -w spawnCalc = "qalculate-gtk" findCalc = className =? "Qalculate-gtk" manageCalc = customFloating $ W.RationalRect l t w h where h = 0.5 w = 0.4 t = 0.75 -h l = 0.70 -w spawnRanger = myTerminal ++ " --class ranger -t Ranger -e ranger" findRanger = appName =? "ranger" manageRanger = customFloating $ W.RationalRect l t w h where h = 0.9 w = 0.9 t = 0.95 -h l = 0.95 -w -------------------- Manage windows
1,027
myScratchPads :: [NamedScratchpad] myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm , NS "calculator" spawnCalc findCalc manageCalc , NS "ranger" spawnRanger findRanger manageRanger ] where spawnTerm = myTerminal ++ " -t scratchpad" findTerm = title =? "scratchpad" manageTerm = customFloating $ W.RationalRect l t w h where h = 0.9 w = 0.9 t = 0.95 -h l = 0.95 -w spawnCalc = "qalculate-gtk" findCalc = className =? "Qalculate-gtk" manageCalc = customFloating $ W.RationalRect l t w h where h = 0.5 w = 0.4 t = 0.75 -h l = 0.70 -w spawnRanger = myTerminal ++ " --class ranger -t Ranger -e ranger" findRanger = appName =? "ranger" manageRanger = customFloating $ W.RationalRect l t w h where h = 0.9 w = 0.9 t = 0.95 -h l = 0.95 -w -------------------- Manage windows
994
myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm , NS "calculator" spawnCalc findCalc manageCalc , NS "ranger" spawnRanger findRanger manageRanger ] where spawnTerm = myTerminal ++ " -t scratchpad" findTerm = title =? "scratchpad" manageTerm = customFloating $ W.RationalRect l t w h where h = 0.9 w = 0.9 t = 0.95 -h l = 0.95 -w spawnCalc = "qalculate-gtk" findCalc = className =? "Qalculate-gtk" manageCalc = customFloating $ W.RationalRect l t w h where h = 0.5 w = 0.4 t = 0.75 -h l = 0.70 -w spawnRanger = myTerminal ++ " --class ranger -t Ranger -e ranger" findRanger = appName =? "ranger" manageRanger = customFloating $ W.RationalRect l t w h where h = 0.9 w = 0.9 t = 0.95 -h l = 0.95 -w -------------------- Manage windows
959
true
true
9
7
351
274
138
136
null
null
garetxe/cabal
cabal-install/Distribution/Client/Dependency/Modular/IndexConversion.hs
bsd-3-clause
-- | Convert a Cabal installed package index to the simpler, -- more uniform index format of the solver. convIPI' :: Bool -> SI.InstalledPackageIndex -> [(PN, I, PInfo)] convIPI' sip idx = -- apply shadowing whenever there are multiple installed packages with -- the same version [ maybeShadow (convIP idx pkg) | (_pkgid, pkgs) <- SI.allPackagesBySourcePackageId idx , (maybeShadow, pkg) <- zip (id : repeat shadow) pkgs ] where -- shadowing is recorded in the package info shadow (pn, i, PInfo fdeps fds _) | sip = (pn, i, PInfo fdeps fds (Just Shadowed)) shadow x = x -- | Convert a single installed package into the solver-specific format.
709
convIPI' :: Bool -> SI.InstalledPackageIndex -> [(PN, I, PInfo)] convIPI' sip idx = -- apply shadowing whenever there are multiple installed packages with -- the same version [ maybeShadow (convIP idx pkg) | (_pkgid, pkgs) <- SI.allPackagesBySourcePackageId idx , (maybeShadow, pkg) <- zip (id : repeat shadow) pkgs ] where -- shadowing is recorded in the package info shadow (pn, i, PInfo fdeps fds _) | sip = (pn, i, PInfo fdeps fds (Just Shadowed)) shadow x = x -- | Convert a single installed package into the solver-specific format.
604
convIPI' sip idx = -- apply shadowing whenever there are multiple installed packages with -- the same version [ maybeShadow (convIP idx pkg) | (_pkgid, pkgs) <- SI.allPackagesBySourcePackageId idx , (maybeShadow, pkg) <- zip (id : repeat shadow) pkgs ] where -- shadowing is recorded in the package info shadow (pn, i, PInfo fdeps fds _) | sip = (pn, i, PInfo fdeps fds (Just Shadowed)) shadow x = x -- | Convert a single installed package into the solver-specific format.
539
true
true
1
11
175
169
91
78
null
null
Flogistix/aws-commander
src/Commander/EC2/SecurityGroup.hs
mit
commanderSGDesc = "Commander SG"
32
commanderSGDesc = "Commander SG"
32
commanderSGDesc = "Commander SG"
32
false
false
1
5
3
10
3
7
null
null
MauriceIsAG/HaskellScratch
.stack-work/intero/intero19793okA.hs
bsd-3-clause
combinationsWithDupes :: (Eq a) => Int -> [a] -> [[a]] combinationsWithDupes 0 _ = [[]]
87
combinationsWithDupes :: (Eq a) => Int -> [a] -> [[a]] combinationsWithDupes 0 _ = [[]]
87
combinationsWithDupes 0 _ = [[]]
32
false
true
0
9
14
47
26
21
null
null
brendanhay/gogol
gogol-dns/gen/Network/Google/Resource/DNS/ManagedZones/Create.hs
mpl-2.0
-- | For mutating operation requests only. An optional identifier specified -- by the client. Must be unique for operation resources in the Operations -- collection. mzcClientOperationId :: Lens' ManagedZonesCreate (Maybe Text) mzcClientOperationId = lens _mzcClientOperationId (\ s a -> s{_mzcClientOperationId = a})
325
mzcClientOperationId :: Lens' ManagedZonesCreate (Maybe Text) mzcClientOperationId = lens _mzcClientOperationId (\ s a -> s{_mzcClientOperationId = a})
159
mzcClientOperationId = lens _mzcClientOperationId (\ s a -> s{_mzcClientOperationId = a})
97
true
true
0
9
50
50
27
23
null
null
keera-studios/hsQt
Qtc/Enums/Gui/QAbstractItemView.hs
bsd-2-clause
fDoubleClicked :: EditTriggers fDoubleClicked = ifEditTriggers $ 2
68
fDoubleClicked :: EditTriggers fDoubleClicked = ifEditTriggers $ 2
68
fDoubleClicked = ifEditTriggers $ 2
37
false
true
2
6
9
23
9
14
null
null
juanmab37/HOpenCV-0.5.0.1
src/HOpenCV/CV/ImgProc.hs
gpl-2.0
fromCvtColorFlag YUV420i2BGR = 91
34
fromCvtColorFlag YUV420i2BGR = 91
34
fromCvtColorFlag YUV420i2BGR = 91
34
false
false
0
5
4
9
4
5
null
null
Lythimus/lptv
sites/all/modules/jgm-pandoc-8be6cc2/src/Text/Pandoc/Readers/HTML.hs
gpl-2.0
pSpace :: GenParser Char ParserState Inline pSpace = many1 (satisfy isSpace) >> return Space
92
pSpace :: GenParser Char ParserState Inline pSpace = many1 (satisfy isSpace) >> return Space
92
pSpace = many1 (satisfy isSpace) >> return Space
48
false
true
0
8
13
34
16
18
null
null
forked-upstream-packages-for-ghcjs/ghc
compiler/basicTypes/OccName.hs
bsd-3-clause
-- Generic deriving mechanism (new) mkGenD = mk_simple_deriv tcName "D1"
80
mkGenD = mk_simple_deriv tcName "D1"
44
mkGenD = mk_simple_deriv tcName "D1"
44
true
false
1
5
17
15
6
9
null
null
himura/twitter-enumerator
Web/Twitter/Enumerator/Api.hs
bsd-2-clause
mkListParam :: ListParam -> HT.Query mkListParam (ListIdParam lid) = [("list_id", toMaybeByteString lid)]
106
mkListParam :: ListParam -> HT.Query mkListParam (ListIdParam lid) = [("list_id", toMaybeByteString lid)]
106
mkListParam (ListIdParam lid) = [("list_id", toMaybeByteString lid)]
69
false
true
0
7
12
38
20
18
null
null
fibsifan/pandoc
src/Text/Pandoc/Writers/LaTeX.hs
gpl-2.0
inlineToLaTeX (Quoted qt lst) = do contents <- inlineListToLaTeX lst csquotes <- liftM stCsquotes get opts <- gets stOptions if csquotes then return $ "\\enquote" <> braces contents else do let s1 = if (not (null lst)) && (isQuoted (head lst)) then "\\," else empty let s2 = if (not (null lst)) && (isQuoted (last lst)) then "\\," else empty let inner = s1 <> contents <> s2 return $ case qt of DoubleQuote -> if writerTeXLigatures opts then text "``" <> inner <> text "''" else char '\x201C' <> inner <> char '\x201D' SingleQuote -> if writerTeXLigatures opts then char '`' <> inner <> char '\'' else char '\x2018' <> inner <> char '\x2019'
921
inlineToLaTeX (Quoted qt lst) = do contents <- inlineListToLaTeX lst csquotes <- liftM stCsquotes get opts <- gets stOptions if csquotes then return $ "\\enquote" <> braces contents else do let s1 = if (not (null lst)) && (isQuoted (head lst)) then "\\," else empty let s2 = if (not (null lst)) && (isQuoted (last lst)) then "\\," else empty let inner = s1 <> contents <> s2 return $ case qt of DoubleQuote -> if writerTeXLigatures opts then text "``" <> inner <> text "''" else char '\x201C' <> inner <> char '\x201D' SingleQuote -> if writerTeXLigatures opts then char '`' <> inner <> char '\'' else char '\x2018' <> inner <> char '\x2019'
921
inlineToLaTeX (Quoted qt lst) = do contents <- inlineListToLaTeX lst csquotes <- liftM stCsquotes get opts <- gets stOptions if csquotes then return $ "\\enquote" <> braces contents else do let s1 = if (not (null lst)) && (isQuoted (head lst)) then "\\," else empty let s2 = if (not (null lst)) && (isQuoted (last lst)) then "\\," else empty let inner = s1 <> contents <> s2 return $ case qt of DoubleQuote -> if writerTeXLigatures opts then text "``" <> inner <> text "''" else char '\x201C' <> inner <> char '\x201D' SingleQuote -> if writerTeXLigatures opts then char '`' <> inner <> char '\'' else char '\x2018' <> inner <> char '\x2019'
921
false
false
0
18
394
280
133
147
null
null
leshchevds/ganeti
src/Ganeti/Locking/Locks.hs
bsd-2-clause
lockLevel :: GanetiLocks -> LockLevel lockLevel BGL = LevelCluster
66
lockLevel :: GanetiLocks -> LockLevel lockLevel BGL = LevelCluster
66
lockLevel BGL = LevelCluster
28
false
true
0
5
8
18
9
9
null
null
k0001/gtk2hs
tools/apidiff/HiDiff.hs
gpl-3.0
demodule [] = []
16
demodule [] = []
16
demodule [] = []
16
false
false
1
6
3
17
6
11
null
null
plaimi/blubber-server
src/Blubber/Server/World.hs
agpl-3.0
setTargetPos :: String -> Double -> Double -> World -> Map String Entity -- | Check if the client in the passed in 'String' is the owner of an -- 'Entity'; if so, set its 'targetPos' to the passed in 'Double's. setTargetPos p x y w = case M.lookup p (players w) of Just e | isNeutral e -> players w | otherwise -> M.insert p e {entity = (entity e) {targetPos = Vec x y}} (players w) Nothing -> players w
472
setTargetPos :: String -> Double -> Double -> World -> Map String Entity setTargetPos p x y w = case M.lookup p (players w) of Just e | isNeutral e -> players w | otherwise -> M.insert p e {entity = (entity e) {targetPos = Vec x y}} (players w) Nothing -> players w
334
setTargetPos p x y w = case M.lookup p (players w) of Just e | isNeutral e -> players w | otherwise -> M.insert p e {entity = (entity e) {targetPos = Vec x y}} (players w) Nothing -> players w
261
true
true
4
9
150
127
61
66
null
null
lukexi/ghc-7.8-arm64
compiler/cmm/CmmContFlowOpt.hs
bsd-3-clause
callContinuation_maybe _ = Nothing
34
callContinuation_maybe _ = Nothing
34
callContinuation_maybe _ = Nothing
34
false
false
0
5
3
9
4
5
null
null
andrewthad/persistent
persistent-template/Database/Persist/TH.hs
mit
mkEntityDefSqlTypeExp :: EmbedEntityMap -> EntityMap -> EntityDef -> EntityDefSqlTypeExp mkEntityDefSqlTypeExp emEntities entMap ent = EntityDefSqlTypeExp ent (getSqlType $ entityId ent) $ (map getSqlType $ entityFields ent) where getSqlType field = maybe (defaultSqlTypeExp field) (SqlType' . SqlOther) (listToMaybe $ mapMaybe (stripPrefix "sqltype=") $ fieldAttrs field) -- In the case of embedding, there won't be any datatype created yet. -- We just use SqlString, as the data will be serialized to JSON. defaultSqlTypeExp field = case mEmbedded emEntities ftype of Right _ -> SqlType' SqlString Left (Just FTKeyCon) -> SqlType' SqlString Left Nothing -> case fieldReference field of ForeignRef refName ft -> case M.lookup refName entMap of Nothing -> SqlTypeExp ft -- A ForeignRef is blindly set to an Int64 in setEmbedField -- correct that now Just ent -> case entityPrimary ent of Nothing -> SqlTypeExp ft Just pdef -> case compositeFields pdef of [] -> error "mkEntityDefSqlTypeExp: no composite fields" [x] -> SqlTypeExp $ fieldType x _ -> SqlType' $ SqlOther "Composite Reference" CompositeRef _ -> SqlType' $ SqlOther "Composite Reference" _ -> case ftype of -- In the case of lists, we always serialize to a string -- value (via JSON). -- -- Normally, this would be determined automatically by -- SqlTypeExp. However, there's one corner case: if there's -- a list of entity IDs, the datatype for the ID has not -- yet been created, so the compiler will fail. This extra -- clause works around this limitation. FTList _ -> SqlType' SqlString _ -> SqlTypeExp ftype where ftype = fieldType field -- | Create data types and appropriate 'PersistEntity' instances for the given -- 'EntityDef's. Works well with the persist quasi-quoter.
2,248
mkEntityDefSqlTypeExp :: EmbedEntityMap -> EntityMap -> EntityDef -> EntityDefSqlTypeExp mkEntityDefSqlTypeExp emEntities entMap ent = EntityDefSqlTypeExp ent (getSqlType $ entityId ent) $ (map getSqlType $ entityFields ent) where getSqlType field = maybe (defaultSqlTypeExp field) (SqlType' . SqlOther) (listToMaybe $ mapMaybe (stripPrefix "sqltype=") $ fieldAttrs field) -- In the case of embedding, there won't be any datatype created yet. -- We just use SqlString, as the data will be serialized to JSON. defaultSqlTypeExp field = case mEmbedded emEntities ftype of Right _ -> SqlType' SqlString Left (Just FTKeyCon) -> SqlType' SqlString Left Nothing -> case fieldReference field of ForeignRef refName ft -> case M.lookup refName entMap of Nothing -> SqlTypeExp ft -- A ForeignRef is blindly set to an Int64 in setEmbedField -- correct that now Just ent -> case entityPrimary ent of Nothing -> SqlTypeExp ft Just pdef -> case compositeFields pdef of [] -> error "mkEntityDefSqlTypeExp: no composite fields" [x] -> SqlTypeExp $ fieldType x _ -> SqlType' $ SqlOther "Composite Reference" CompositeRef _ -> SqlType' $ SqlOther "Composite Reference" _ -> case ftype of -- In the case of lists, we always serialize to a string -- value (via JSON). -- -- Normally, this would be determined automatically by -- SqlTypeExp. However, there's one corner case: if there's -- a list of entity IDs, the datatype for the ID has not -- yet been created, so the compiler will fail. This extra -- clause works around this limitation. FTList _ -> SqlType' SqlString _ -> SqlTypeExp ftype where ftype = fieldType field -- | Create data types and appropriate 'PersistEntity' instances for the given -- 'EntityDef's. Works well with the persist quasi-quoter.
2,248
mkEntityDefSqlTypeExp emEntities entMap ent = EntityDefSqlTypeExp ent (getSqlType $ entityId ent) $ (map getSqlType $ entityFields ent) where getSqlType field = maybe (defaultSqlTypeExp field) (SqlType' . SqlOther) (listToMaybe $ mapMaybe (stripPrefix "sqltype=") $ fieldAttrs field) -- In the case of embedding, there won't be any datatype created yet. -- We just use SqlString, as the data will be serialized to JSON. defaultSqlTypeExp field = case mEmbedded emEntities ftype of Right _ -> SqlType' SqlString Left (Just FTKeyCon) -> SqlType' SqlString Left Nothing -> case fieldReference field of ForeignRef refName ft -> case M.lookup refName entMap of Nothing -> SqlTypeExp ft -- A ForeignRef is blindly set to an Int64 in setEmbedField -- correct that now Just ent -> case entityPrimary ent of Nothing -> SqlTypeExp ft Just pdef -> case compositeFields pdef of [] -> error "mkEntityDefSqlTypeExp: no composite fields" [x] -> SqlTypeExp $ fieldType x _ -> SqlType' $ SqlOther "Composite Reference" CompositeRef _ -> SqlType' $ SqlOther "Composite Reference" _ -> case ftype of -- In the case of lists, we always serialize to a string -- value (via JSON). -- -- Normally, this would be determined automatically by -- SqlTypeExp. However, there's one corner case: if there's -- a list of entity IDs, the datatype for the ID has not -- yet been created, so the compiler will fail. This extra -- clause works around this limitation. FTList _ -> SqlType' SqlString _ -> SqlTypeExp ftype where ftype = fieldType field -- | Create data types and appropriate 'PersistEntity' instances for the given -- 'EntityDef's. Works well with the persist quasi-quoter.
2,159
false
true
5
21
778
372
175
197
null
null
kite-lang/kite
src/Kite/Sugar.hs
mit
generateGuards args (g:gs) = PApply (PApply (PIdentifier "&&") (mkCalls g args)) (generateGuards args gs)
105
generateGuards args (g:gs) = PApply (PApply (PIdentifier "&&") (mkCalls g args)) (generateGuards args gs)
105
generateGuards args (g:gs) = PApply (PApply (PIdentifier "&&") (mkCalls g args)) (generateGuards args gs)
105
false
false
0
9
13
55
26
29
null
null
hnakamur/haskell-sandbox
sandbox-json/UnitTest.hs
bsd-3-clause
strings = test
14
strings = test
14
strings = test
14
false
false
1
5
2
10
3
7
null
null
bacchanalia/KitchenSink
KitchenSink/Qualified.hs
gpl-3.0
-- |'BLC.pack' blc_pack = BLC.pack
34
blc_pack = BLC.pack
19
blc_pack = BLC.pack
19
true
false
0
5
4
9
5
4
null
null
brendanhay/amqp-bark
bark/src/Bark/IO.hs
bsd-3-clause
liftTry :: MonadIO m => IO a -> m (Either SomeException a) liftTry = liftIO . try
81
liftTry :: MonadIO m => IO a -> m (Either SomeException a) liftTry = liftIO . try
81
liftTry = liftIO . try
22
false
true
0
9
16
40
19
21
null
null
maxsnew/TAPL
Untyped/Lambda/Implementation/Haskell/Grammar.hs
bsd-3-clause
validIdentifiers :: [String] validIdentifiers = (flip (:)) <$> ("":validRest) <*> validStart where validStart = ['a'..'z'] ++ ['A'..'Z'] ++ "_" validRest = (flip (:)) <$> ("" : validRest) <*> (validStart ++ ['0'..'9'] ++ "'") -- | Convert back and forth between De Bruijn and explicit names -- | Returns the nameless term and a list representing the encodings of -- | the free variables (the naming context).
419
validIdentifiers :: [String] validIdentifiers = (flip (:)) <$> ("":validRest) <*> validStart where validStart = ['a'..'z'] ++ ['A'..'Z'] ++ "_" validRest = (flip (:)) <$> ("" : validRest) <*> (validStart ++ ['0'..'9'] ++ "'") -- | Convert back and forth between De Bruijn and explicit names -- | Returns the nameless term and a list representing the encodings of -- | the free variables (the naming context).
419
validIdentifiers = (flip (:)) <$> ("":validRest) <*> validStart where validStart = ['a'..'z'] ++ ['A'..'Z'] ++ "_" validRest = (flip (:)) <$> ("" : validRest) <*> (validStart ++ ['0'..'9'] ++ "'") -- | Convert back and forth between De Bruijn and explicit names -- | Returns the nameless term and a list representing the encodings of -- | the free variables (the naming context).
390
false
true
1
10
76
112
63
49
null
null
asm-products/ccar-websockets
CCAR/Main/Driver.hs
agpl-3.0
tradierPollingInterval :: IO Int tradierPollingInterval = return $ 10 * 10 ^ 6
79
tradierPollingInterval :: IO Int tradierPollingInterval = return $ 10 * 10 ^ 6
78
tradierPollingInterval = return $ 10 * 10 ^ 6
45
false
true
0
7
13
26
13
13
null
null
dagit/zenc
Text/Encoding/Z.hs
bsd-3-clause
encode_ch '\\' = "zr"
21
encode_ch '\\' = "zr"
21
encode_ch '\\' = "zr"
21
false
false
0
5
3
9
4
5
null
null
bacchanalia/KitchenSink
KitchenSink/Qualified.hs
gpl-3.0
-- |'IntMapS.updateMaxWithKey' ims_updateMaxWithKey = IntMapS.updateMaxWithKey
78
ims_updateMaxWithKey = IntMapS.updateMaxWithKey
47
ims_updateMaxWithKey = IntMapS.updateMaxWithKey
47
true
false
0
5
4
9
5
4
null
null
lykahb/aeson
Data/Aeson/TH.hs
bsd-3-clause
getConName :: Con -> Name getConName (NormalC name _) = name
61
getConName :: Con -> Name getConName (NormalC name _) = name
61
getConName (NormalC name _) = name
35
false
true
0
7
11
26
13
13
null
null
apyrgio/ganeti
src/Ganeti/Constants.hs
bsd-2-clause
iecAll :: [String] iecAll = [iecGzip, iecGzipFast, iecGzipSlow, iecLzop, iecNone]
81
iecAll :: [String] iecAll = [iecGzip, iecGzipFast, iecGzipSlow, iecLzop, iecNone]
81
iecAll = [iecGzip, iecGzipFast, iecGzipSlow, iecLzop, iecNone]
62
false
true
0
5
9
29
18
11
null
null
wouter-swierstra/Data.Stream
Data/Stream.hs
bsd-3-clause
-- | The 'fromList' converts an infinite list to a -- stream. -- -- /Beware/: Passing a finite list, will cause an error. fromList :: [a] -> Stream a fromList (x:xs) = Cons x (fromList xs)
188
fromList :: [a] -> Stream a fromList (x:xs) = Cons x (fromList xs)
66
fromList (x:xs) = Cons x (fromList xs)
38
true
true
0
7
35
46
25
21
null
null
kylcarte/threepenny-extra
src/Graphics/UI/Threepenny/Extra.hs
bsd-3-clause
(#>) :: UI Element -> (Element -> E a,Element -> a -> UI void) -> UI Element me #> (e,h) = do el <- me on e el $ h el return el
133
(#>) :: UI Element -> (Element -> E a,Element -> a -> UI void) -> UI Element me #> (e,h) = do el <- me on e el $ h el return el
133
me #> (e,h) = do el <- me on e el $ h el return el
56
false
true
0
11
38
95
44
51
null
null
imalsogreg/arte-ephys
tetrode-ephys/src/Data/Ephys/Position.hs
gpl-3.0
-- | Angle of the mean resultant vector of a list of angles circMean :: [Double] -> Double circMean angs = let (r :+ i) = mrv angs in atan2 i r
148
circMean :: [Double] -> Double circMean angs = let (r :+ i) = mrv angs in atan2 i r
88
circMean angs = let (r :+ i) = mrv angs in atan2 i r
57
true
true
0
10
36
49
24
25
null
null
kawu/ltag
src/NLP/LTAG/Early.hs
bsd-2-clause
-- | We update the current entry by `ignore'ing the non-terminal -- internal nodes where possible. Note, that after performing -- `ignoreAll' there may be new states in the entry which can be, -- again, possibly ignored. ignoreAll :: (Ord a, Ord b) => Entry a b -- ^ The current chart entry -> Entry a b ignoreAll curr = S.union curr $ let doit (st, k) = (,k) <$> ignore st in S.fromList $ mapMaybe doit $ S.toList curr
448
ignoreAll :: (Ord a, Ord b) => Entry a b -- ^ The current chart entry -> Entry a b ignoreAll curr = S.union curr $ let doit (st, k) = (,k) <$> ignore st in S.fromList $ mapMaybe doit $ S.toList curr
226
ignoreAll curr = S.union curr $ let doit (st, k) = (,k) <$> ignore st in S.fromList $ mapMaybe doit $ S.toList curr
124
true
true
4
10
108
112
55
57
null
null
JoeyEremondi/elm-summer-opt
src/Docs/Check.hs
bsd-3-clause
-- CHECK DOCUMENTATION check :: [Var.Value] -> A.Located (Maybe Docs.Centralized) -> Result w Docs.Checked check exports (A.A region maybeDocs) = case maybeDocs of Nothing -> R.throw region Error.NoDocs Just docs -> checkHelp region exports docs
273
check :: [Var.Value] -> A.Located (Maybe Docs.Centralized) -> Result w Docs.Checked check exports (A.A region maybeDocs) = case maybeDocs of Nothing -> R.throw region Error.NoDocs Just docs -> checkHelp region exports docs
249
check exports (A.A region maybeDocs) = case maybeDocs of Nothing -> R.throw region Error.NoDocs Just docs -> checkHelp region exports docs
165
true
true
0
11
62
99
47
52
null
null
ambiata/airship-tutorial
Setup.hs
apache-2.0
timestamp :: Verbosity -> IO String timestamp verbosity = rawSystemStdout verbosity "date" ["+%Y%m%d%H%M%S"] >>= \s -> case splitAt 14 s of (d, n : []) -> if (length d == 14 && filter isDigit d == d) then return d else fail $ "date has failed to produce the correct format [" <> s <> "]." _ -> fail $ "date has failed to produce a date long enough [" <> s <> "]."
417
timestamp :: Verbosity -> IO String timestamp verbosity = rawSystemStdout verbosity "date" ["+%Y%m%d%H%M%S"] >>= \s -> case splitAt 14 s of (d, n : []) -> if (length d == 14 && filter isDigit d == d) then return d else fail $ "date has failed to produce the correct format [" <> s <> "]." _ -> fail $ "date has failed to produce a date long enough [" <> s <> "]."
417
timestamp verbosity = rawSystemStdout verbosity "date" ["+%Y%m%d%H%M%S"] >>= \s -> case splitAt 14 s of (d, n : []) -> if (length d == 14 && filter isDigit d == d) then return d else fail $ "date has failed to produce the correct format [" <> s <> "]." _ -> fail $ "date has failed to produce a date long enough [" <> s <> "]."
381
false
true
0
15
127
131
66
65
null
null
Airtnp/Freshman_Simple_Haskell_Lib
Intro/TAPL/arith.hs
mit
eval :: Term -> Term eval t = case t of TmIf TmTrue t2 t3 -> t2 TmIf TmFalse t2 t3 -> t3 TmIf t1 t2 t3 -> let t1' = eval t1 in TmIf t1' t2 t3 TmSucc t1 -> let t1' = eval t1 in TmSucc t1' TmPred TmZero -> TmZero TmPred (TmSucc t1) | isnumericval t1 -> t1 TmPred t1 -> let t1' = eval t1 in TmPred t1' TmIsZero TmZero -> TmTrue TmIsZero (TmSucc t1) | isnumericval t1 -> TmFalse TmIsZero t1 -> let t1' = eval t1 in TmIsZero t1' TmZero -> TmZero TmTrue -> TmTrue TmFalse -> TmFalse
634
eval :: Term -> Term eval t = case t of TmIf TmTrue t2 t3 -> t2 TmIf TmFalse t2 t3 -> t3 TmIf t1 t2 t3 -> let t1' = eval t1 in TmIf t1' t2 t3 TmSucc t1 -> let t1' = eval t1 in TmSucc t1' TmPred TmZero -> TmZero TmPred (TmSucc t1) | isnumericval t1 -> t1 TmPred t1 -> let t1' = eval t1 in TmPred t1' TmIsZero TmZero -> TmTrue TmIsZero (TmSucc t1) | isnumericval t1 -> TmFalse TmIsZero t1 -> let t1' = eval t1 in TmIsZero t1' TmZero -> TmZero TmTrue -> TmTrue TmFalse -> TmFalse
634
eval t = case t of TmIf TmTrue t2 t3 -> t2 TmIf TmFalse t2 t3 -> t3 TmIf t1 t2 t3 -> let t1' = eval t1 in TmIf t1' t2 t3 TmSucc t1 -> let t1' = eval t1 in TmSucc t1' TmPred TmZero -> TmZero TmPred (TmSucc t1) | isnumericval t1 -> t1 TmPred t1 -> let t1' = eval t1 in TmPred t1' TmIsZero TmZero -> TmTrue TmIsZero (TmSucc t1) | isnumericval t1 -> TmFalse TmIsZero t1 -> let t1' = eval t1 in TmIsZero t1' TmZero -> TmZero TmTrue -> TmTrue TmFalse -> TmFalse
613
false
true
11
8
261
218
101
117
null
null
miguelpagano/equ
Equ/Parser/Expr.hs
gpl-3.0
initPExprState :: ParenFlag -> PExprState initPExprState = PExprState
69
initPExprState :: ParenFlag -> PExprState initPExprState = PExprState
69
initPExprState = PExprState
27
false
true
0
7
7
22
9
13
null
null
ezyang/ghc
compiler/specialise/Rules.hs
bsd-3-clause
{- ************************************************************************ * * RuleInfo: the rules in an IdInfo * * ************************************************************************ -} -- | Make a 'RuleInfo' containing a number of 'CoreRule's, suitable -- for putting into an 'IdInfo' mkRuleInfo :: [CoreRule] -> RuleInfo mkRuleInfo rules = RuleInfo rules (rulesFreeVarsDSet rules)
544
mkRuleInfo :: [CoreRule] -> RuleInfo mkRuleInfo rules = RuleInfo rules (rulesFreeVarsDSet rules)
96
mkRuleInfo rules = RuleInfo rules (rulesFreeVarsDSet rules)
59
true
true
0
7
197
40
20
20
null
null
dmjio/aeson
tests/PropUtils.hs
bsd-3-clause
encodeInteger :: Integer -> Property encodeInteger i = encode i === L.pack (show i)
83
encodeInteger :: Integer -> Property encodeInteger i = encode i === L.pack (show i)
83
encodeInteger i = encode i === L.pack (show i)
46
false
true
0
8
13
36
17
19
null
null
bartavelle/manglingrules
Mangling.hs
gpl-3.0
quotedString :: Parser String quotedString = do separator <- anyChar content <- many1 $ satisfy (/= separator) _ <- char separator return content
163
quotedString :: Parser String quotedString = do separator <- anyChar content <- many1 $ satisfy (/= separator) _ <- char separator return content
163
quotedString = do separator <- anyChar content <- many1 $ satisfy (/= separator) _ <- char separator return content
133
false
true
0
11
40
61
26
35
null
null
aaronc/Idris-dev
src/Idris/Reflection.hs
bsd-3-clause
reflectErr (CantIntroduce t) = raw_apply (Var $ reflErrName "CantIntroduce") [reflect t]
88
reflectErr (CantIntroduce t) = raw_apply (Var $ reflErrName "CantIntroduce") [reflect t]
88
reflectErr (CantIntroduce t) = raw_apply (Var $ reflErrName "CantIntroduce") [reflect t]
88
false
false
0
8
10
37
17
20
null
null
benkolera/haskell-opaleye
src/Opaleye/Internal/Print.hs
bsd-3-clause
ppGroupBy (Just xs) = HPrint.ppGroupBy (NEL.toList xs)
54
ppGroupBy (Just xs) = HPrint.ppGroupBy (NEL.toList xs)
54
ppGroupBy (Just xs) = HPrint.ppGroupBy (NEL.toList xs)
54
false
false
0
8
6
29
13
16
null
null
kumasento/accelerate-cuda
Data/Array/Accelerate/CUDA/Execute/Event.hs
bsd-3-clause
showEvent :: Event -> String showEvent (Event e) = show e
57
showEvent :: Event -> String showEvent (Event e) = show e
57
showEvent (Event e) = show e
28
false
true
0
7
10
27
13
14
null
null
gromakovsky/Orchid
test/Test/Orchid/Data.hs
mit
shapeSource :: IsString s => s shapeSource = $(embedStringFile $ testPath "shape.orc")
94
shapeSource :: IsString s => s shapeSource = $(embedStringFile $ testPath "shape.orc")
94
shapeSource = $(embedStringFile $ testPath "shape.orc")
55
false
true
0
9
19
36
15
21
null
null
sopvop/cabal
Cabal/Distribution/Simple/PreProcess.hs
bsd-3-clause
-- | Find any extra C sources generated by preprocessing that need to -- be added to the component (addresses issue #238). preprocessExtras :: Component -> LocalBuildInfo -> IO [FilePath] preprocessExtras comp lbi = case comp of CLib _ -> pp $ buildDir lbi (CExe Executable { exeName = nm }) -> pp $ buildDir lbi </> nm </> nm ++ "-tmp" CTest test -> do case testInterface test of TestSuiteExeV10 _ _ -> pp $ buildDir lbi </> testName test </> testName test ++ "-tmp" TestSuiteLibV09 _ _ -> pp $ buildDir lbi </> stubName test </> stubName test ++ "-tmp" TestSuiteUnsupported tt -> die $ "No support for preprocessing test " ++ "suite type " ++ display tt CBench bm -> do case benchmarkInterface bm of BenchmarkExeV10 _ _ -> pp $ buildDir lbi </> benchmarkName bm </> benchmarkName bm ++ "-tmp" BenchmarkUnsupported tt -> die $ "No support for preprocessing benchmark " ++ "type " ++ display tt where pp :: FilePath -> IO [FilePath] pp dir = (map (dir </>) . filter not_sub . concat) <$> for knownExtrasHandlers (withLexicalCallStack (\f -> f dir)) -- TODO: This is a terrible hack to work around #3545 while we don't -- reorganize the directory layout. Basically, for the main -- library, we might accidentally pick up autogenerated sources for -- our subcomponents, because they are all stored as subdirectories -- in dist/build. This is a cheap and cheerful check to prevent -- this from happening. It is not particularly correct; for example -- if a user has a test suite named foobar and puts their C file in -- foobar/foo.c, this test will incorrectly exclude it. But I -- didn't want to break BC... not_sub p = and [ not (pre `isPrefixOf` p) | pre <- component_dirs ] component_dirs = component_names (localPkgDescr lbi) -- TODO: libify me component_names pkg_descr = mapMaybe libName (subLibraries pkg_descr) ++ map exeName (executables pkg_descr) ++ map testName (testSuites pkg_descr) ++ map benchmarkName (benchmarks pkg_descr)
2,245
preprocessExtras :: Component -> LocalBuildInfo -> IO [FilePath] preprocessExtras comp lbi = case comp of CLib _ -> pp $ buildDir lbi (CExe Executable { exeName = nm }) -> pp $ buildDir lbi </> nm </> nm ++ "-tmp" CTest test -> do case testInterface test of TestSuiteExeV10 _ _ -> pp $ buildDir lbi </> testName test </> testName test ++ "-tmp" TestSuiteLibV09 _ _ -> pp $ buildDir lbi </> stubName test </> stubName test ++ "-tmp" TestSuiteUnsupported tt -> die $ "No support for preprocessing test " ++ "suite type " ++ display tt CBench bm -> do case benchmarkInterface bm of BenchmarkExeV10 _ _ -> pp $ buildDir lbi </> benchmarkName bm </> benchmarkName bm ++ "-tmp" BenchmarkUnsupported tt -> die $ "No support for preprocessing benchmark " ++ "type " ++ display tt where pp :: FilePath -> IO [FilePath] pp dir = (map (dir </>) . filter not_sub . concat) <$> for knownExtrasHandlers (withLexicalCallStack (\f -> f dir)) -- TODO: This is a terrible hack to work around #3545 while we don't -- reorganize the directory layout. Basically, for the main -- library, we might accidentally pick up autogenerated sources for -- our subcomponents, because they are all stored as subdirectories -- in dist/build. This is a cheap and cheerful check to prevent -- this from happening. It is not particularly correct; for example -- if a user has a test suite named foobar and puts their C file in -- foobar/foo.c, this test will incorrectly exclude it. But I -- didn't want to break BC... not_sub p = and [ not (pre `isPrefixOf` p) | pre <- component_dirs ] component_dirs = component_names (localPkgDescr lbi) -- TODO: libify me component_names pkg_descr = mapMaybe libName (subLibraries pkg_descr) ++ map exeName (executables pkg_descr) ++ map testName (testSuites pkg_descr) ++ map benchmarkName (benchmarks pkg_descr)
2,122
preprocessExtras comp lbi = case comp of CLib _ -> pp $ buildDir lbi (CExe Executable { exeName = nm }) -> pp $ buildDir lbi </> nm </> nm ++ "-tmp" CTest test -> do case testInterface test of TestSuiteExeV10 _ _ -> pp $ buildDir lbi </> testName test </> testName test ++ "-tmp" TestSuiteLibV09 _ _ -> pp $ buildDir lbi </> stubName test </> stubName test ++ "-tmp" TestSuiteUnsupported tt -> die $ "No support for preprocessing test " ++ "suite type " ++ display tt CBench bm -> do case benchmarkInterface bm of BenchmarkExeV10 _ _ -> pp $ buildDir lbi </> benchmarkName bm </> benchmarkName bm ++ "-tmp" BenchmarkUnsupported tt -> die $ "No support for preprocessing benchmark " ++ "type " ++ display tt where pp :: FilePath -> IO [FilePath] pp dir = (map (dir </>) . filter not_sub . concat) <$> for knownExtrasHandlers (withLexicalCallStack (\f -> f dir)) -- TODO: This is a terrible hack to work around #3545 while we don't -- reorganize the directory layout. Basically, for the main -- library, we might accidentally pick up autogenerated sources for -- our subcomponents, because they are all stored as subdirectories -- in dist/build. This is a cheap and cheerful check to prevent -- this from happening. It is not particularly correct; for example -- if a user has a test suite named foobar and puts their C file in -- foobar/foo.c, this test will incorrectly exclude it. But I -- didn't want to break BC... not_sub p = and [ not (pre `isPrefixOf` p) | pre <- component_dirs ] component_dirs = component_names (localPkgDescr lbi) -- TODO: libify me component_names pkg_descr = mapMaybe libName (subLibraries pkg_descr) ++ map exeName (executables pkg_descr) ++ map testName (testSuites pkg_descr) ++ map benchmarkName (benchmarks pkg_descr)
2,023
true
true
0
17
636
481
234
247
null
null
slcz/gomoku
src/Main.hs
apache-2.0
walkDirection :: Set Pos -> Dimension -> Pos -> Pos -> Set Pos walkDirection set dimension position (deltax, deltay) = let oneDirection position'@(x, y) inc = if withinBoard dimension position' && position' `member` set then position' `Data.Set.insert` oneDirection (x + inc * deltax, y + inc * deltay) inc else mempty in (oneDirection position 1) <> (oneDirection position (-1))
451
walkDirection :: Set Pos -> Dimension -> Pos -> Pos -> Set Pos walkDirection set dimension position (deltax, deltay) = let oneDirection position'@(x, y) inc = if withinBoard dimension position' && position' `member` set then position' `Data.Set.insert` oneDirection (x + inc * deltax, y + inc * deltay) inc else mempty in (oneDirection position 1) <> (oneDirection position (-1))
451
walkDirection set dimension position (deltax, deltay) = let oneDirection position'@(x, y) inc = if withinBoard dimension position' && position' `member` set then position' `Data.Set.insert` oneDirection (x + inc * deltax, y + inc * deltay) inc else mempty in (oneDirection position 1) <> (oneDirection position (-1))
388
false
true
0
14
130
157
83
74
null
null
flowbox-public/fgl
Data/Graph/Inductive/Query/BFS.hs
bsd-3-clause
-- bfs (node list ordered by distance) -- bfsnInternal :: Graph gr => (Context a b -> c) -> Queue Node -> gr a b -> [c] bfsnInternal f q g | queueEmpty q || isEmpty g = [] | otherwise = case match v g of (Just c, g') -> f c:bfsnInternal f (queuePutList (suc' c) q') g' (Nothing, g') -> bfsnInternal f q' g' where (v,q') = queueGet q
399
bfsnInternal :: Graph gr => (Context a b -> c) -> Queue Node -> gr a b -> [c] bfsnInternal f q g | queueEmpty q || isEmpty g = [] | otherwise = case match v g of (Just c, g') -> f c:bfsnInternal f (queuePutList (suc' c) q') g' (Nothing, g') -> bfsnInternal f q' g' where (v,q') = queueGet q
357
bfsnInternal f q g | queueEmpty q || isEmpty g = [] | otherwise = case match v g of (Just c, g') -> f c:bfsnInternal f (queuePutList (suc' c) q') g' (Nothing, g') -> bfsnInternal f q' g' where (v,q') = queueGet q
279
true
true
0
14
137
177
86
91
null
null
dpwright/z80
src/Z80/Operations.hs
mit
ini, inir, ind, indr :: Z80ASM ini = code [0xed, 0xa2]
55
ini, inir, ind, indr :: Z80ASM ini = code [0xed, 0xa2]
55
ini = code [0xed, 0xa2]
24
false
true
6
6
11
41
17
24
null
null
ComputationWithBoundedResources/ara-inference
doc/tpdb_trs/Haskell/basic_haskell/enumFromTo_4.hs
mit
esEsOrdering EQ GT = MyFalse
28
esEsOrdering EQ GT = MyFalse
28
esEsOrdering EQ GT = MyFalse
28
false
false
1
5
4
16
5
11
null
null
bredelings/BAli-Phy
haskell/Probability/Distribution/Bernoulli.hs
gpl-2.0
bernoulli p = bernoulli2 p (1.0-p)
34
bernoulli p = bernoulli2 p (1.0-p)
34
bernoulli p = bernoulli2 p (1.0-p)
34
false
false
0
7
5
21
10
11
null
null
olsner/ghc
testsuite/tests/profiling/should_run/T11627b.hs
bsd-3-clause
newBlob :: Int -> IO Blob newBlob (I# n#) = IO $ \s -> case newByteArray# n# s of (# s', mba# #) -> (# s', Blob# mba# #)
143
newBlob :: Int -> IO Blob newBlob (I# n#) = IO $ \s -> case newByteArray# n# s of (# s', mba# #) -> (# s', Blob# mba# #)
143
newBlob (I# n#) = IO $ \s -> case newByteArray# n# s of (# s', mba# #) -> (# s', Blob# mba# #)
117
false
true
0
11
51
64
32
32
null
null
yesodweb/persistent
persistent/Database/Persist/EntityDef.hs
mit
-- | -- -- @since 2.13.0.0 setEntityIdDef :: EntityIdDef -> EntityDef -> EntityDef setEntityIdDef i ed = ed { entityId = i }
136
setEntityIdDef :: EntityIdDef -> EntityDef -> EntityDef setEntityIdDef i ed = ed { entityId = i }
109
setEntityIdDef i ed = ed { entityId = i }
41
true
true
0
8
34
44
22
22
null
null
ecaustin/haskhol-core
src/HaskHOL/Core/Printer.hs
bsd-2-clause
destClauses :: forall m. MonadThrow m => HOLTerm -> m [[HOLTerm]] destClauses tm = let (s, args) = stripComb tm in if nameOf s == "_SEQPATTERN" && length args == 2 then do c <- destClause (head args) cs <- destClauses (args !! 1) return (c:cs) else do c <- destClause tm return [c] where destClause :: HOLTerm -> m [HOLTerm] destClause tm' = do (_, pbod) <- stripExists' `fmap` (body =<< body tm') let (s, args) = stripComb pbod if nameOf s == "_UNGUARDED_PATTERN" && length args == 2 then do tm'1 <- rand =<< rator (head args) tm'2 <- rand =<< rator (args !! 1) return [tm'1, tm'2] else if nameOf s == "_GUARDED_PATTERN" && length args == 3 then do tm'1 <- rand =<< rator (head args) let tm'2 = head $ tail args tm'3 <- rand =<< rator (args !! 2) return [tm'1, tm'2, tm'3] else fail' "destClause" stripExists' :: HOLTerm -> ([HOLTerm], HOLTerm) stripExists' = splitList (destBinder "?")
1,274
destClauses :: forall m. MonadThrow m => HOLTerm -> m [[HOLTerm]] destClauses tm = let (s, args) = stripComb tm in if nameOf s == "_SEQPATTERN" && length args == 2 then do c <- destClause (head args) cs <- destClauses (args !! 1) return (c:cs) else do c <- destClause tm return [c] where destClause :: HOLTerm -> m [HOLTerm] destClause tm' = do (_, pbod) <- stripExists' `fmap` (body =<< body tm') let (s, args) = stripComb pbod if nameOf s == "_UNGUARDED_PATTERN" && length args == 2 then do tm'1 <- rand =<< rator (head args) tm'2 <- rand =<< rator (args !! 1) return [tm'1, tm'2] else if nameOf s == "_GUARDED_PATTERN" && length args == 3 then do tm'1 <- rand =<< rator (head args) let tm'2 = head $ tail args tm'3 <- rand =<< rator (args !! 2) return [tm'1, tm'2, tm'3] else fail' "destClause" stripExists' :: HOLTerm -> ([HOLTerm], HOLTerm) stripExists' = splitList (destBinder "?")
1,274
destClauses tm = let (s, args) = stripComb tm in if nameOf s == "_SEQPATTERN" && length args == 2 then do c <- destClause (head args) cs <- destClauses (args !! 1) return (c:cs) else do c <- destClause tm return [c] where destClause :: HOLTerm -> m [HOLTerm] destClause tm' = do (_, pbod) <- stripExists' `fmap` (body =<< body tm') let (s, args) = stripComb pbod if nameOf s == "_UNGUARDED_PATTERN" && length args == 2 then do tm'1 <- rand =<< rator (head args) tm'2 <- rand =<< rator (args !! 1) return [tm'1, tm'2] else if nameOf s == "_GUARDED_PATTERN" && length args == 3 then do tm'1 <- rand =<< rator (head args) let tm'2 = head $ tail args tm'3 <- rand =<< rator (args !! 2) return [tm'1, tm'2, tm'3] else fail' "destClause" stripExists' :: HOLTerm -> ([HOLTerm], HOLTerm) stripExists' = splitList (destBinder "?")
1,208
false
true
0
15
549
455
218
237
null
null
graninas/Haskell-Algorithms
Tests/Robotics/Task2.hs
gpl-3.0
try f n = let ss = foldSuccesses (solve f n startPositions) pathLengths = map length ss groupedPathLengths = group . sort $ pathLengths pathLengthStats = map (\gpls -> (head gpls, length gpls)) groupedPathLengths in (length ss, pathLengthStats)
300
try f n = let ss = foldSuccesses (solve f n startPositions) pathLengths = map length ss groupedPathLengths = group . sort $ pathLengths pathLengthStats = map (\gpls -> (head gpls, length gpls)) groupedPathLengths in (length ss, pathLengthStats)
300
try f n = let ss = foldSuccesses (solve f n startPositions) pathLengths = map length ss groupedPathLengths = group . sort $ pathLengths pathLengthStats = map (\gpls -> (head gpls, length gpls)) groupedPathLengths in (length ss, pathLengthStats)
300
false
false
1
13
93
102
49
53
null
null