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
michaelt/series
Series/Folding/Prelude.hs
bsd-3-clause
scanr :: Monad m => (a -> b -> b) -> b -> Folding (Of a) m r -> Folding (Of b) m r scanr op b = \(Folding phi) -> Folding (lscanr_ phi op b)
149
scanr :: Monad m => (a -> b -> b) -> b -> Folding (Of a) m r -> Folding (Of b) m r scanr op b = \(Folding phi) -> Folding (lscanr_ phi op b)
149
scanr op b = \(Folding phi) -> Folding (lscanr_ phi op b)
57
false
true
0
12
44
100
48
52
null
null
haskoin/secp256k1-haskell
src/Crypto/Secp256k1.hs
unlicense
msg :: ByteString -> Maybe Msg msg bs | BS.length bs == 32 = Just (Msg bs) | otherwise = Nothing
104
msg :: ByteString -> Maybe Msg msg bs | BS.length bs == 32 = Just (Msg bs) | otherwise = Nothing
104
msg bs | BS.length bs == 32 = Just (Msg bs) | otherwise = Nothing
73
false
true
0
10
28
61
26
35
null
null
nazrhom/vcs-clojure
src/VCS/DiffPartial.hs
bsd-3-clause
diffPartialAlmu :: (IsRecEl u, IsRecEl v, MonadOracle o m) => o -> Int -> Usingl u -> Usingl v -> m (PartialAlmu u v) diffPartialAlmu orc maxCost x y = runReaderT (diffPartialAlmuO orc maxCost x y) initialHistory
221
diffPartialAlmu :: (IsRecEl u, IsRecEl v, MonadOracle o m) => o -> Int -> Usingl u -> Usingl v -> m (PartialAlmu u v) diffPartialAlmu orc maxCost x y = runReaderT (diffPartialAlmuO orc maxCost x y) initialHistory
221
diffPartialAlmu orc maxCost x y = runReaderT (diffPartialAlmuO orc maxCost x y) initialHistory
94
false
true
0
13
45
97
46
51
null
null
lunaris/hindent
src/HIndent/Styles/JohanTibell.hs
bsd-3-clause
exp (List _ es) = do single <- isSingleLiner p underflow <- fmap not (isOverflow p) if single && underflow then p else brackets (prefixedLined "," (map (depend space . pretty) es)) where p = brackets (inter (write ", ") (map pretty es))
339
exp (List _ es) = do single <- isSingleLiner p underflow <- fmap not (isOverflow p) if single && underflow then p else brackets (prefixedLined "," (map (depend space . pretty) es)) where p = brackets (inter (write ", ") (map pretty es))
339
exp (List _ es) = do single <- isSingleLiner p underflow <- fmap not (isOverflow p) if single && underflow then p else brackets (prefixedLined "," (map (depend space . pretty) es)) where p = brackets (inter (write ", ") (map pretty es))
339
false
false
0
15
145
123
58
65
null
null
bitemyapp/ganeti
src/Ganeti/Constants.hs
bsd-2-clause
htKvmSpiceVideoStreamDetectionFilter :: String htKvmSpiceVideoStreamDetectionFilter = "filter"
94
htKvmSpiceVideoStreamDetectionFilter :: String htKvmSpiceVideoStreamDetectionFilter = "filter"
94
htKvmSpiceVideoStreamDetectionFilter = "filter"
47
false
true
0
4
5
11
6
5
null
null
AlexanderPankiv/ghc
compiler/nativeGen/PPC/Ppr.hs
bsd-3-clause
pprImm (ImmConstantSum a b) = pprImm a <> char '+' <> pprImm b
62
pprImm (ImmConstantSum a b) = pprImm a <> char '+' <> pprImm b
62
pprImm (ImmConstantSum a b) = pprImm a <> char '+' <> pprImm b
62
false
false
0
7
12
35
15
20
null
null
jasonrbriggs/proton
haskell/src/Text/Proton/Template.hs
apache-2.0
getTemplate :: Templates -> String -> IO Template getTemplate tmps name = do let mp = tmplMap tmps let t = Map.findWithDefault NoTemplate name mp case t of NoTemplate -> return t _ -> do let (Template x dm _) = t return (Template x dm tmps)
304
getTemplate :: Templates -> String -> IO Template getTemplate tmps name = do let mp = tmplMap tmps let t = Map.findWithDefault NoTemplate name mp case t of NoTemplate -> return t _ -> do let (Template x dm _) = t return (Template x dm tmps)
304
getTemplate tmps name = do let mp = tmplMap tmps let t = Map.findWithDefault NoTemplate name mp case t of NoTemplate -> return t _ -> do let (Template x dm _) = t return (Template x dm tmps)
253
false
true
0
16
110
116
52
64
null
null
rueshyna/gogol
gogol-games/gen/Network/Google/Games/Types/Product.hs
mpl-2.0
-- | Creates a value of 'ImageAsset' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'iaHeight' -- -- * 'iaKind' -- -- * 'iaURL' -- -- * 'iaWidth' -- -- * 'iaName' imageAsset :: ImageAsset imageAsset = ImageAsset' { _iaHeight = Nothing , _iaKind = "games#imageAsset" , _iaURL = Nothing , _iaWidth = Nothing , _iaName = Nothing }
445
imageAsset :: ImageAsset imageAsset = ImageAsset' { _iaHeight = Nothing , _iaKind = "games#imageAsset" , _iaURL = Nothing , _iaWidth = Nothing , _iaName = Nothing }
196
imageAsset = ImageAsset' { _iaHeight = Nothing , _iaKind = "games#imageAsset" , _iaURL = Nothing , _iaWidth = Nothing , _iaName = Nothing }
167
true
true
1
7
108
63
41
22
null
null
tolysz/prepare-ghcjs
spec-lts8/base/GHC/Enum.hs
bsd-3-clause
enumDeltaInteger :: Integer -> Integer -> [Integer] enumDeltaInteger x d = x `seq` (x : enumDeltaInteger (x+d) d)
113
enumDeltaInteger :: Integer -> Integer -> [Integer] enumDeltaInteger x d = x `seq` (x : enumDeltaInteger (x+d) d)
113
enumDeltaInteger x d = x `seq` (x : enumDeltaInteger (x+d) d)
61
false
true
0
10
17
52
28
24
null
null
fffej/HS-Poker
LookupPatternMatch.hs
bsd-3-clause
getValueFromProduct 5772 = 6059
31
getValueFromProduct 5772 = 6059
31
getValueFromProduct 5772 = 6059
31
false
false
0
5
3
9
4
5
null
null
guoy34/ampersand
src/Database/Design/Ampersand/Basics/UTF8.hs
gpl-3.0
bom :: B.ByteString bom = B.pack [0xEF, 0xBB, 0xBF]
51
bom :: B.ByteString bom = B.pack [0xEF, 0xBB, 0xBF]
51
bom = B.pack [0xEF, 0xBB, 0xBF]
31
false
true
0
6
8
27
15
12
null
null
rjwright/js-typeomatic
ParseJS.hs
apache-2.0
oJSAST (NS (JSThrow expr) srcSpan) = [AWSS (Statement (EWSS (Throw (toJSASTExpression expr)) srcSpan)) srcSpan ] where toJSASTExpression :: JSNode -> ExprWithSourceSpan toJSASTExpression (NS (JSExpression ex) _) = listToJSASTExpression ex
295
toJSAST (NS (JSThrow expr) srcSpan) = [AWSS (Statement (EWSS (Throw (toJSASTExpression expr)) srcSpan)) srcSpan ] where toJSASTExpression :: JSNode -> ExprWithSourceSpan toJSASTExpression (NS (JSExpression ex) _) = listToJSASTExpression ex
295
toJSAST (NS (JSThrow expr) srcSpan) = [AWSS (Statement (EWSS (Throw (toJSASTExpression expr)) srcSpan)) srcSpan ] where toJSASTExpression :: JSNode -> ExprWithSourceSpan toJSASTExpression (NS (JSExpression ex) _) = listToJSASTExpression ex
295
false
false
0
14
85
93
46
47
null
null
cyclohexanamine/haskbot
src/Bot/Scripting/Vote.hs
bsd-3-clause
parseVoteCmd :: Parser (Either String (String, String, Maybe Integer, Maybe String)) parseVoteCmd = do start <- parseUntil' " " action <- optionMaybe $ parseUntil' " " target <- optionMaybe $ parseUntil' " " reason <- optionMaybe $ rstrip <$> parseUntil' "-" len <- optionMaybe $ do optionMaybe $ char '-' char 'l' optionMaybe $ char ' ' (*3600) <$> decimal if start /= "!vote" then parserFail $ "Parse fail in parseVoteCmd - " ++ start else if isNothing action then return $ Left "Need an action" else if isNothing target then return $ Left "Need a target." else return $ Right (fromJust action, fromJust target, len, reason) -- | Parse a !vote command, sending the appropriate error messages, and returning -- the vote options if the command was valid, or Nothing if not.
1,099
parseVoteCmd :: Parser (Either String (String, String, Maybe Integer, Maybe String)) parseVoteCmd = do start <- parseUntil' " " action <- optionMaybe $ parseUntil' " " target <- optionMaybe $ parseUntil' " " reason <- optionMaybe $ rstrip <$> parseUntil' "-" len <- optionMaybe $ do optionMaybe $ char '-' char 'l' optionMaybe $ char ' ' (*3600) <$> decimal if start /= "!vote" then parserFail $ "Parse fail in parseVoteCmd - " ++ start else if isNothing action then return $ Left "Need an action" else if isNothing target then return $ Left "Need a target." else return $ Right (fromJust action, fromJust target, len, reason) -- | Parse a !vote command, sending the appropriate error messages, and returning -- the vote options if the command was valid, or Nothing if not.
1,099
parseVoteCmd = do start <- parseUntil' " " action <- optionMaybe $ parseUntil' " " target <- optionMaybe $ parseUntil' " " reason <- optionMaybe $ rstrip <$> parseUntil' "-" len <- optionMaybe $ do optionMaybe $ char '-' char 'l' optionMaybe $ char ' ' (*3600) <$> decimal if start /= "!vote" then parserFail $ "Parse fail in parseVoteCmd - " ++ start else if isNothing action then return $ Left "Need an action" else if isNothing target then return $ Left "Need a target." else return $ Right (fromJust action, fromJust target, len, reason) -- | Parse a !vote command, sending the appropriate error messages, and returning -- the vote options if the command was valid, or Nothing if not.
1,014
false
true
0
13
458
230
111
119
null
null
gregwebs/haskell-spell-suggest
Text/SpellingSuggest.hs
bsd-3-clause
-- | For performance reasons, it may sometimes be desirable -- to know what's sitting under the dictionary. dictionaryIsDB :: SpellingDictionary -> Bool dictionaryIsDB (SpellingDatabase _) = True
195
dictionaryIsDB :: SpellingDictionary -> Bool dictionaryIsDB (SpellingDatabase _) = True
87
dictionaryIsDB (SpellingDatabase _) = True
42
true
true
0
6
27
30
15
15
null
null
rahulmutt/codec-jvm
src/Codec/JVM/Attr.hs
apache-2.0
toAttrs :: ConstPool -> Code -> [Attr] toAttrs cp code = [ACode maxStack' maxLocals' xs etes attrs'] where (xs, cf, smt, lnt, etes) = runInstrBCSLE (instr code) cp maxLocals' = CF.maxLocals cf maxStack' = CF.maxStack cf attrs = if null frames then [] else [AStackMapTable frames] frames = toStackMapFrames smt attrs' = attrs ++ if lnt == mempty then [] else [ALineNumberTable lnt]
544
toAttrs :: ConstPool -> Code -> [Attr] toAttrs cp code = [ACode maxStack' maxLocals' xs etes attrs'] where (xs, cf, smt, lnt, etes) = runInstrBCSLE (instr code) cp maxLocals' = CF.maxLocals cf maxStack' = CF.maxStack cf attrs = if null frames then [] else [AStackMapTable frames] frames = toStackMapFrames smt attrs' = attrs ++ if lnt == mempty then [] else [ALineNumberTable lnt]
544
toAttrs cp code = [ACode maxStack' maxLocals' xs etes attrs'] where (xs, cf, smt, lnt, etes) = runInstrBCSLE (instr code) cp maxLocals' = CF.maxLocals cf maxStack' = CF.maxStack cf attrs = if null frames then [] else [AStackMapTable frames] frames = toStackMapFrames smt attrs' = attrs ++ if lnt == mempty then [] else [ALineNumberTable lnt]
505
false
true
6
9
226
175
84
91
null
null
cirquit/Personal-Repository
Haskell/Playground/AdventOfCode/advent-coding/src/Day12.hs
mit
delims ':' = False
19
delims ':' = False
19
delims ':' = False
19
false
false
0
5
4
9
4
5
null
null
CloudI/CloudI
src/api/haskell/external/bytestring-0.10.10.0/tests/builder/Data/ByteString/Builder/Tests.hs
mit
buildAction (FDec f) = lift $ putBuilder $ floatDec f
68
buildAction (FDec f) = lift $ putBuilder $ floatDec f
68
buildAction (FDec f) = lift $ putBuilder $ floatDec f
68
false
false
0
7
24
26
12
14
null
null
Zigazou/containers
Data/Sequence.hs
bsd-3-clause
-- | /O(n log n)/. 'unstableSort' sorts the specified 'Seq' by -- the natural ordering of its elements, but the sort is not stable. -- This algorithm is frequently faster and uses less memory than 'sort', -- and performs extremely well -- frequently twice as fast as 'sort' -- -- when the sequence is already nearly sorted. unstableSort :: Ord a => Seq a -> Seq a unstableSort = unstableSortBy compare
402
unstableSort :: Ord a => Seq a -> Seq a unstableSort = unstableSortBy compare
77
unstableSort = unstableSortBy compare
37
true
true
0
8
71
42
20
22
null
null
beni55/fay
src/Fay/Compiler/Misc.hs
bsd-3-clause
-- | Runs compilation for a single module. runCompileModule :: CompileReader -> CompileState -> Compile a -> CompileModule a runCompileModule reader' state' m = runExceptT (runRWST (unCompile m) reader' state')
210
runCompileModule :: CompileReader -> CompileState -> Compile a -> CompileModule a runCompileModule reader' state' m = runExceptT (runRWST (unCompile m) reader' state')
167
runCompileModule reader' state' m = runExceptT (runRWST (unCompile m) reader' state')
85
true
true
0
9
29
56
27
29
null
null
fpco/strict-concurrency
Control/Concurrent/MVar/Strict.hs
bsd-3-clause
newMVar :: NFData a => a -> IO (MVar a) newMVar value = newEmptyMVar >>= \ mvar -> putMVar mvar value >> return mvar
136
newMVar :: NFData a => a -> IO (MVar a) newMVar value = newEmptyMVar >>= \ mvar -> putMVar mvar value >> return mvar
136
newMVar value = newEmptyMVar >>= \ mvar -> putMVar mvar value >> return mvar
96
false
true
0
9
43
55
26
29
null
null
amccausl/RDF4H
src/Text/RDF/RDF4H/TurtleParser.hs
bsd-3-clause
-- Make an absolute URL by returning as is if already an absolute URL and otherwise -- appending the URL to the given base URL. mkAbsoluteUrl :: ByteString -> ByteString -> ByteString mkAbsoluteUrl base url = case isAbsoluteUri url of True -> url False -> base `B.append` url
288
mkAbsoluteUrl :: ByteString -> ByteString -> ByteString mkAbsoluteUrl base url = case isAbsoluteUri url of True -> url False -> base `B.append` url
160
mkAbsoluteUrl base url = case isAbsoluteUri url of True -> url False -> base `B.append` url
104
true
true
0
9
60
59
29
30
null
null
andrewpetrovic/pandoc
src/Text/Pandoc/Writers/RST.hs
gpl-2.0
blockToRST (Para inlines) | LineBreak `elem` inlines = do -- use line block if LineBreaks lns <- mapM inlineListToRST $ splitBy (==LineBreak) inlines return $ (vcat $ map (hang 2 (text "| ")) lns) <> blankline | otherwise = do contents <- inlineListToRST inlines return $ contents <> blankline
321
blockToRST (Para inlines) | LineBreak `elem` inlines = do -- use line block if LineBreaks lns <- mapM inlineListToRST $ splitBy (==LineBreak) inlines return $ (vcat $ map (hang 2 (text "| ")) lns) <> blankline | otherwise = do contents <- inlineListToRST inlines return $ contents <> blankline
321
blockToRST (Para inlines) | LineBreak `elem` inlines = do -- use line block if LineBreaks lns <- mapM inlineListToRST $ splitBy (==LineBreak) inlines return $ (vcat $ map (hang 2 (text "| ")) lns) <> blankline | otherwise = do contents <- inlineListToRST inlines return $ contents <> blankline
321
false
false
1
17
76
118
56
62
null
null
emwap/syntactic
examples/NanoFeldspar.hs
bsd-3-clause
arrLength :: Type a => Data [a] -> Data Length arrLength = sugarSym $ Construct "arrLength" Prelude.length
106
arrLength :: Type a => Data [a] -> Data Length arrLength = sugarSym $ Construct "arrLength" Prelude.length
106
arrLength = sugarSym $ Construct "arrLength" Prelude.length
59
false
true
0
8
16
42
20
22
null
null
fpco/serial-bench
binary-0.4.3.1/tests/NewBenchmark.hs
bsd-3-clause
getWord16be :: BinHandle -> IO Word16 getWord16be = get
55
getWord16be :: BinHandle -> IO Word16 getWord16be = get
55
getWord16be = get
17
false
true
0
6
8
18
9
9
null
null
gnn/Hets
Common/Keywords.hs
gpl-2.0
-- | arrow started with a bar mapsTo :: String mapsTo = "|->"
61
mapsTo :: String mapsTo = "|->"
31
mapsTo = "|->"
14
true
true
0
6
12
19
8
11
null
null
mreid/papersite
src/exec/scrape-journal.hs
mit
-- Horrible bibliographic information extraction regular expression -- infoPattern = ".*\\s+({vol}\\d+):\\s*({first}\\d+\\.?\\d*)\\s*[^0-9]+\\s*({last}\\d+\\.?\\d*)\\s*,\\s*({year}\\d{4}).*" infoPattern = "\\s*[^0-9]*({vol}[^:]+):\\s*({first}\\d+\\.?\\d*)\\s*[^0-9]+\\s*({last}\\d+\\.?\\d*)\\s*,\\s*({year}\\d{4}).*"
317
infoPattern = "\\s*[^0-9]*({vol}[^:]+):\\s*({first}\\d+\\.?\\d*)\\s*[^0-9]+\\s*({last}\\d+\\.?\\d*)\\s*,\\s*({year}\\d{4}).*"
125
infoPattern = "\\s*[^0-9]*({vol}[^:]+):\\s*({first}\\d+\\.?\\d*)\\s*[^0-9]+\\s*({last}\\d+\\.?\\d*)\\s*,\\s*({year}\\d{4}).*"
125
true
false
0
4
14
8
5
3
null
null
taojang/haskell-programming-book-exercise
src/ch12/Live.hs
bsd-3-clause
countTheBeforeVowel :: String -> Integer countTheBeforeVowel x = let countTheRest = countTheBeforeVowel . unwords in case words x of ("the" : (x' : _) : xs) -> if x' `elem` vowels then 1 + countTheRest xs else countTheRest xs _ -> 0
340
countTheBeforeVowel :: String -> Integer countTheBeforeVowel x = let countTheRest = countTheBeforeVowel . unwords in case words x of ("the" : (x' : _) : xs) -> if x' `elem` vowels then 1 + countTheRest xs else countTheRest xs _ -> 0
340
countTheBeforeVowel x = let countTheRest = countTheBeforeVowel . unwords in case words x of ("the" : (x' : _) : xs) -> if x' `elem` vowels then 1 + countTheRest xs else countTheRest xs _ -> 0
299
false
true
0
14
149
94
48
46
null
null
cdparks/mini-core
src/MiniCore/Format.hs
mit
-- Format first n addresses on stack formatShortStack :: GMStack -> Int -> Doc formatShortStack stack n = text "Stack" <> colon <+> hsep (punctuate comma (shorten n (map formatAddr (reverse stack))))
202
formatShortStack :: GMStack -> Int -> Doc formatShortStack stack n = text "Stack" <> colon <+> hsep (punctuate comma (shorten n (map formatAddr (reverse stack))))
164
formatShortStack stack n = text "Stack" <> colon <+> hsep (punctuate comma (shorten n (map formatAddr (reverse stack))))
122
true
true
0
14
34
69
34
35
null
null
slpopejoy/fadno-xml
src/Fadno/MusicXml/MusicXml30.hs
bsd-2-clause
parseChxTime :: P.XParse ChxTime parseChxTime = TimeTimeSignature <$> P.many (parseTimeSignature) <*> P.optional (P.xchild (P.name "interchangeable") (parseInterchangeable)) <|> TimeSenzaMisura <$> (P.xchild (P.name "senza-misura") (P.xtext >>= return))
290
parseChxTime :: P.XParse ChxTime parseChxTime = TimeTimeSignature <$> P.many (parseTimeSignature) <*> P.optional (P.xchild (P.name "interchangeable") (parseInterchangeable)) <|> TimeSenzaMisura <$> (P.xchild (P.name "senza-misura") (P.xtext >>= return))
290
parseChxTime = TimeTimeSignature <$> P.many (parseTimeSignature) <*> P.optional (P.xchild (P.name "interchangeable") (parseInterchangeable)) <|> TimeSenzaMisura <$> (P.xchild (P.name "senza-misura") (P.xtext >>= return))
257
false
true
0
13
61
93
47
46
null
null
shepheb/go10c
Compiler.hs
bsd-3-clause
isArray TypeString = True
25
isArray TypeString = True
25
isArray TypeString = True
25
false
false
0
5
3
9
4
5
null
null
imalsogreg/arte-ephys
arte-decoder/src/System/Arte/Decode/Config.hs
gpl-3.0
field0 :: Field field0 = V.replicate (V.length $ allTrackPos defTrack) 0
72
field0 :: Field field0 = V.replicate (V.length $ allTrackPos defTrack) 0
72
field0 = V.replicate (V.length $ allTrackPos defTrack) 0
56
false
true
0
8
10
37
16
21
null
null
adept/hledger
hledger-lib/Hledger/Data/Amount.hs
gpl-3.0
showAmountPriceDebug (Just (TotalPrice pa)) = " @@ " ++ showAmountDebug pa
74
showAmountPriceDebug (Just (TotalPrice pa)) = " @@ " ++ showAmountDebug pa
74
showAmountPriceDebug (Just (TotalPrice pa)) = " @@ " ++ showAmountDebug pa
74
false
false
0
9
10
28
13
15
null
null
uuhan/Idris-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
mapPDeclFC f g (PDSL n dsl) = PDSL n (fmap (mapPTermFC f g) dsl)
64
mapPDeclFC f g (PDSL n dsl) = PDSL n (fmap (mapPTermFC f g) dsl)
64
mapPDeclFC f g (PDSL n dsl) = PDSL n (fmap (mapPTermFC f g) dsl)
64
false
false
0
9
13
42
20
22
null
null
zhangjiji/real-world-haskell
ch11/Prettify2.hs
mit
w `fits` (c:cs) = (w - 1) `fits` cs
35
w `fits` (c:cs) = (w - 1) `fits` cs
35
w `fits` (c:cs) = (w - 1) `fits` cs
35
false
false
0
7
8
40
21
19
null
null
ghc-android/ghc
testsuite/tests/ghci/should_run/ghcirun004.hs
bsd-3-clause
699 = 698
9
699 = 698
9
699 = 698
9
false
false
1
5
2
10
3
7
null
null
begriffs/hasql-postgres
library/Hasql/Postgres/ErrorCode.hs
mit
invalid_grant_operation :: ErrorCode = "0LP01"
75
invalid_grant_operation :: ErrorCode = "0LP01"
75
invalid_grant_operation :: ErrorCode = "0LP01"
75
false
false
0
5
33
11
5
6
null
null
MasseR/xmonadcontrib
XMonad/Config/Droundy.hs
bsd-3-clause
config = ewmh defaultConfig { borderWidth = 1 -- Width of the window border in pixels. , XMonad.workspaces = ["mutt","iceweasel"] , layoutHook = showWName $ workspaceDir "~" $ boringWindows $ smartBorders $ windowNavigation $ maximizeVertical $ toggleLayouts Full $ avoidStruts $ named "tabbed" mytab ||| named "xclock" (mytab ****//* combineTwo Square mytab mytab) ||| named "three" (mytab **//* mytab *//* combineTwo Square mytab mytab) ||| named "widescreen" ((mytab *||* mytab) ****//* combineTwo Square mytab mytab) -- ||| --mosaic 0.25 0.5 , manageHook = manageHook defaultConfig <+> manageDocks -- add panel-handling , terminal = "xterm" -- The preferred terminal program. , normalBorderColor = "#222222" -- Border color for unfocused windows. , focusedBorderColor = "#00ff00" -- Border color for focused windows. , XMonad.modMask = mod1Mask , XMonad.keys = keys }
1,179
config = ewmh defaultConfig { borderWidth = 1 -- Width of the window border in pixels. , XMonad.workspaces = ["mutt","iceweasel"] , layoutHook = showWName $ workspaceDir "~" $ boringWindows $ smartBorders $ windowNavigation $ maximizeVertical $ toggleLayouts Full $ avoidStruts $ named "tabbed" mytab ||| named "xclock" (mytab ****//* combineTwo Square mytab mytab) ||| named "three" (mytab **//* mytab *//* combineTwo Square mytab mytab) ||| named "widescreen" ((mytab *||* mytab) ****//* combineTwo Square mytab mytab) -- ||| --mosaic 0.25 0.5 , manageHook = manageHook defaultConfig <+> manageDocks -- add panel-handling , terminal = "xterm" -- The preferred terminal program. , normalBorderColor = "#222222" -- Border color for unfocused windows. , focusedBorderColor = "#00ff00" -- Border color for focused windows. , XMonad.modMask = mod1Mask , XMonad.keys = keys }
1,179
config = ewmh defaultConfig { borderWidth = 1 -- Width of the window border in pixels. , XMonad.workspaces = ["mutt","iceweasel"] , layoutHook = showWName $ workspaceDir "~" $ boringWindows $ smartBorders $ windowNavigation $ maximizeVertical $ toggleLayouts Full $ avoidStruts $ named "tabbed" mytab ||| named "xclock" (mytab ****//* combineTwo Square mytab mytab) ||| named "three" (mytab **//* mytab *//* combineTwo Square mytab mytab) ||| named "widescreen" ((mytab *||* mytab) ****//* combineTwo Square mytab mytab) -- ||| --mosaic 0.25 0.5 , manageHook = manageHook defaultConfig <+> manageDocks -- add panel-handling , terminal = "xterm" -- The preferred terminal program. , normalBorderColor = "#222222" -- Border color for unfocused windows. , focusedBorderColor = "#00ff00" -- Border color for focused windows. , XMonad.modMask = mod1Mask , XMonad.keys = keys }
1,179
false
false
0
19
435
214
117
97
null
null
spaceships/RogueMonad
src/Rogue/Util.hs
gpl-2.0
isFloor _ = False
17
isFloor _ = False
17
isFloor _ = False
17
false
false
0
5
3
9
4
5
null
null
d3zd3z/HaskellNet-old
Text/IMAPParsers.hs
bsd-3-clause
eval :: (RespDerivs -> Result RespDerivs r) -> String -> ByteString -> r eval pMain tag s = case pMain (parse tag (Pos tag 1 1) s) of Parsed v d' e' -> v NoParse e -> error (show e)
228
eval :: (RespDerivs -> Result RespDerivs r) -> String -> ByteString -> r eval pMain tag s = case pMain (parse tag (Pos tag 1 1) s) of Parsed v d' e' -> v NoParse e -> error (show e)
228
eval pMain tag s = case pMain (parse tag (Pos tag 1 1) s) of Parsed v d' e' -> v NoParse e -> error (show e)
155
false
true
0
10
86
100
48
52
null
null
AnthonyMl/pathfinding
src/pathfinding.hs
mit
uniformCostSearch :: (Graph graphT stateT) => graphT -> (stateT -> stateT -> Int) -> ([stateT], [stateT]) uniformCostSearch g edgeFn = prioritySearch g edgeFn (\ _ _ -> 0)
171
uniformCostSearch :: (Graph graphT stateT) => graphT -> (stateT -> stateT -> Int) -> ([stateT], [stateT]) uniformCostSearch g edgeFn = prioritySearch g edgeFn (\ _ _ -> 0)
171
uniformCostSearch g edgeFn = prioritySearch g edgeFn (\ _ _ -> 0)
65
false
true
0
11
27
80
42
38
null
null
jtapolczai/FileSync
tests/System/IO/FileSync/Tests/Tests.hs
apache-2.0
setModTime :: Integer -- ^Year -> Int -- ^Month -> Int -- ^Day -> FilePath -> IO () setModTime y m d fp = setModificationTime fp $ UTCTime (fromGregorian y m d) $ secondsToDiffTime 0
229
setModTime :: Integer -- ^Year -> Int -- ^Month -> Int -- ^Day -> FilePath -> IO () setModTime y m d fp = setModificationTime fp $ UTCTime (fromGregorian y m d) $ secondsToDiffTime 0
229
setModTime y m d fp = setModificationTime fp $ UTCTime (fromGregorian y m d) $ secondsToDiffTime 0
101
false
true
0
11
81
75
36
39
null
null
TikhonJelvis/adaptive-radix-trees
test/Test/Data/ART/Internal/Array.hs
bsd-3-clause
prop_binarySearch (Ordered keys') = let keys = List.nub keys' in forAll (choose (0, List.genericLength keys - 1)) $ \ i -> findIndex (keys !! fromIntegral i) (fromList keys) == Just i
189
prop_binarySearch (Ordered keys') = let keys = List.nub keys' in forAll (choose (0, List.genericLength keys - 1)) $ \ i -> findIndex (keys !! fromIntegral i) (fromList keys) == Just i
189
prop_binarySearch (Ordered keys') = let keys = List.nub keys' in forAll (choose (0, List.genericLength keys - 1)) $ \ i -> findIndex (keys !! fromIntegral i) (fromList keys) == Just i
189
false
false
0
14
36
92
44
48
null
null
kim/amazonka
amazonka-opsworks/gen/Network/AWS/OpsWorks/CreateApp.hs
mpl-2.0
-- | The app name. caName :: Lens' CreateApp Text caName = lens _caName (\s a -> s { _caName = a })
99
caName :: Lens' CreateApp Text caName = lens _caName (\s a -> s { _caName = a })
80
caName = lens _caName (\s a -> s { _caName = a })
49
true
true
0
9
22
40
22
18
null
null
osa1/Idris-dev
src/Idris/Core/TT.hs
bsd-3-clause
{-! deriving instance Binary Const deriving instance NFData Const !-} isTypeConst :: Const -> Bool isTypeConst (AType _) = True
128
isTypeConst :: Const -> Bool isTypeConst (AType _) = True
57
isTypeConst (AType _) = True
28
true
true
0
6
20
29
14
15
null
null
tsoding/boids
src/TestData.hs
mit
idAttrQName = QName { qName = "id" , qURI = Nothing , qPrefix = Nothing }
133
idAttrQName = QName { qName = "id" , qURI = Nothing , qPrefix = Nothing }
133
idAttrQName = QName { qName = "id" , qURI = Nothing , qPrefix = Nothing }
133
false
false
0
6
75
26
16
10
null
null
jpbetz/protolang
haskell/Emit.hs
apache-2.0
codegenTop exp = do define double "main" [] blks where blks = createBlocks $ execCodegen $ do entry <- addBlock entryBlockName setBlock entry cgen exp >>= ret ------------------------------------------------------------------------------- -- Operations -------------------------------------------------------------------------------
359
codegenTop exp = do define double "main" [] blks where blks = createBlocks $ execCodegen $ do entry <- addBlock entryBlockName setBlock entry cgen exp >>= ret ------------------------------------------------------------------------------- -- Operations -------------------------------------------------------------------------------
359
codegenTop exp = do define double "main" [] blks where blks = createBlocks $ execCodegen $ do entry <- addBlock entryBlockName setBlock entry cgen exp >>= ret ------------------------------------------------------------------------------- -- Operations -------------------------------------------------------------------------------
359
false
false
4
9
57
76
31
45
null
null
nevrenato/HetsAlloy
OMDoc/XmlInterface.hs
gpl-2.0
el_structure = toQN "structure"
31
el_structure = toQN "structure"
31
el_structure = toQN "structure"
31
false
false
0
5
3
9
4
5
null
null
lu-fennell/nix-env-rebuild
src/Nix/Commands.hs
gpl-3.0
isQuery NixQueryRemote = True
29
isQuery NixQueryRemote = True
29
isQuery NixQueryRemote = True
29
false
false
0
5
3
9
4
5
null
null
Helkafen/cabal
Cabal/Distribution/PackageDescription/PrettyPrint.hs
bsd-3-clause
ppConfVar (Arch arch) = text "arch" <> parens (disp arch)
76
ppConfVar (Arch arch) = text "arch" <> parens (disp arch)
76
ppConfVar (Arch arch) = text "arch" <> parens (disp arch)
76
false
false
0
8
28
32
14
18
null
null
joe9/barrelfish
tools/flounder/UMPCommon.hs
mit
connect_params p n = [ C.Param (C.Ptr $ C.Struct $ intf_frameinfo_type n) intf_frameinfo_var, C.Param (C.Ptr $ C.TypeName $ intf_bind_cont_type n) intf_cont_var, C.Param (C.Ptr $ C.TypeName "void") "st", C.Param (C.Ptr $ C.Struct "waitset") "ws", C.Param (C.TypeName "idc_bind_flags_t") "flags" ]
388
connect_params p n = [ C.Param (C.Ptr $ C.Struct $ intf_frameinfo_type n) intf_frameinfo_var, C.Param (C.Ptr $ C.TypeName $ intf_bind_cont_type n) intf_cont_var, C.Param (C.Ptr $ C.TypeName "void") "st", C.Param (C.Ptr $ C.Struct "waitset") "ws", C.Param (C.TypeName "idc_bind_flags_t") "flags" ]
388
connect_params p n = [ C.Param (C.Ptr $ C.Struct $ intf_frameinfo_type n) intf_frameinfo_var, C.Param (C.Ptr $ C.TypeName $ intf_bind_cont_type n) intf_cont_var, C.Param (C.Ptr $ C.TypeName "void") "st", C.Param (C.Ptr $ C.Struct "waitset") "ws", C.Param (C.TypeName "idc_bind_flags_t") "flags" ]
388
false
false
1
11
129
138
66
72
null
null
cshung/MiscLab
Haskell99/AvlMap.hs
mit
setValueByIndex :: TreeMap Int tValue -> Int -> tValue -> TreeMap Int tValue setValueByIndex node searchIndex replaceValue = case (trySetValueByIndex node searchIndex replaceValue) of Just result -> result Nothing -> error "Index not found"
351
setValueByIndex :: TreeMap Int tValue -> Int -> tValue -> TreeMap Int tValue setValueByIndex node searchIndex replaceValue = case (trySetValueByIndex node searchIndex replaceValue) of Just result -> result Nothing -> error "Index not found"
351
setValueByIndex node searchIndex replaceValue = case (trySetValueByIndex node searchIndex replaceValue) of Just result -> result Nothing -> error "Index not found"
274
false
true
0
8
144
72
34
38
null
null
danr/hipspec
src/HipSpec/Theory.hs
gpl-3.0
calcDeps :: Subtheory -> Subtheory calcDeps = calcDepsIgnoring []
65
calcDeps :: Subtheory -> Subtheory calcDeps = calcDepsIgnoring []
65
calcDeps = calcDepsIgnoring []
30
false
true
0
7
8
27
11
16
null
null
llllllllll/Math.Diophantine
Math/Diophantine/Parser.hs
gpl-2.0
findX2Coef (Minus expr (Variable n XTerm 2)) m = findX2Coef expr (m - n)
72
findX2Coef (Minus expr (Variable n XTerm 2)) m = findX2Coef expr (m - n)
72
findX2Coef (Minus expr (Variable n XTerm 2)) m = findX2Coef expr (m - n)
72
false
false
0
9
13
41
20
21
null
null
zmanian/SafeSignUp
src/Site.hs
gpl-3.0
countSplice ::Monad n => Int -> I.Splice n countSplice i = I.textSplice $ T.pack $ show i
89
countSplice ::Monad n => Int -> I.Splice n countSplice i = I.textSplice $ T.pack $ show i
89
countSplice i = I.textSplice $ T.pack $ show i
46
false
true
0
8
16
45
21
24
null
null
agocorona/tryhplay
examples/haste-canvas-simple.hs
gpl-3.0
:: Shape () squareShape = do rect (-20, -20) (20, 20) rect (-10, -10) (10, 10) line (-20, -20) (20, 20) -- | You can stroke any shape to get a "wireframe" version of them.
178
:: Shape () squareShape = do rect (-20, -20) (20, 20) rect (-10, -10) (10, 10) line (-20, -20) (20, 20) -- | You can stroke any shape to get a "wireframe" version of them.
178
:: Shape () squareShape = do rect (-20, -20) (20, 20) rect (-10, -10) (10, 10) line (-20, -20) (20, 20) -- | You can stroke any shape to get a "wireframe" version of them.
178
false
false
1
10
41
90
47
43
null
null
timjs/idris-clean
Sources/Main.hs
mit
main :: IO () main = do opts <- getOpts if null (inputs opts) then showUsage else runMain (run opts)
124
main :: IO () main = do opts <- getOpts if null (inputs opts) then showUsage else runMain (run opts)
124
main = do opts <- getOpts if null (inputs opts) then showUsage else runMain (run opts)
110
false
true
0
11
43
58
26
32
null
null
capello/Haskell_Premier
Test.hs
bsd-2-clause
doubleMe x = x + x
18
doubleMe x = x + x
18
doubleMe x = x + x
18
false
false
0
5
5
13
6
7
null
null
tmishima/bindings-Oculus
test/case1/GLFWWindow.hs
apache-2.0
getScrollMotion :: GLFWHandle -> IO (Int, Int) getScrollMotion glfwHdl = do (x,y) <- readIORef $ scrlMove opeMus writeIORef (scrlMove opeMus) (0,0) return (floor x, floor y) where opeMus = mouseStat glfwHdl
219
getScrollMotion :: GLFWHandle -> IO (Int, Int) getScrollMotion glfwHdl = do (x,y) <- readIORef $ scrlMove opeMus writeIORef (scrlMove opeMus) (0,0) return (floor x, floor y) where opeMus = mouseStat glfwHdl
218
getScrollMotion glfwHdl = do (x,y) <- readIORef $ scrlMove opeMus writeIORef (scrlMove opeMus) (0,0) return (floor x, floor y) where opeMus = mouseStat glfwHdl
171
false
true
0
9
43
96
47
49
null
null
changlinli/nikki
src/Utils.hs
lgpl-3.0
chainApp :: (b -> a -> a) -> [b] -> a -> a chainApp fun (b : r) a = chainApp fun r (fun b a)
92
chainApp :: (b -> a -> a) -> [b] -> a -> a chainApp fun (b : r) a = chainApp fun r (fun b a)
92
chainApp fun (b : r) a = chainApp fun r (fun b a)
49
false
true
0
11
25
71
35
36
null
null
phaazon/cuda
Foreign/CUDA/Internal/C2HS.hs
bsd-3-clause
-- Tests whether the given bit mask is contained in the given bit pattern -- (i.e., all bits set in the mask are also set in the pattern). -- containsBitMask :: (Num a, Bits a, Enum b) => a -> b -> Bool bits `containsBitMask` bm = let bm' = fromIntegral . fromEnum $ bm in bm' .&. bits == bm'
348
containsBitMask :: (Num a, Bits a, Enum b) => a -> b -> Bool bits `containsBitMask` bm = let bm' = fromIntegral . fromEnum $ bm in bm' .&. bits == bm'
206
bits `containsBitMask` bm = let bm' = fromIntegral . fromEnum $ bm in bm' .&. bits == bm'
145
true
true
0
10
116
78
41
37
null
null
ki11men0w/delphi-lint
src/ParsecUtils.hs
bsd-3-clause
-- | Ищет следующее вхождение комбинатора переданного в кчестве аргумента. Возвращает то что вернул -- этот комбинатор. searchFor this = manyTill anyChar (try $ lookAhead this) >> this
189
searchFor this = manyTill anyChar (try $ lookAhead this) >> this
67
searchFor this = manyTill anyChar (try $ lookAhead this) >> this
67
true
false
0
9
32
30
15
15
null
null
clojj/hsedit
src/EditRope.hs
bsd-3-clause
getLineLength :: Int -> Y.YiString -> Int getLineLength l = Y.length . Y.takeWhile (/= '\n') . snd . Y.splitAtLine l
116
getLineLength :: Int -> Y.YiString -> Int getLineLength l = Y.length . Y.takeWhile (/= '\n') . snd . Y.splitAtLine l
116
getLineLength l = Y.length . Y.takeWhile (/= '\n') . snd . Y.splitAtLine l
74
false
true
0
9
19
52
26
26
null
null
Zigazou/containers
Data/Sequence.hs
bsd-3-clause
addDigits3 m1 (Three a b c) d e f (Three g h i) m2 = appendTree3 m1 (node3 a b c) (node3 d e f) (node3 g h i) m2
116
addDigits3 m1 (Three a b c) d e f (Three g h i) m2 = appendTree3 m1 (node3 a b c) (node3 d e f) (node3 g h i) m2
116
addDigits3 m1 (Three a b c) d e f (Three g h i) m2 = appendTree3 m1 (node3 a b c) (node3 d e f) (node3 g h i) m2
116
false
false
0
7
33
82
40
42
null
null
kmicklas/pyrec
src/Pyrec/Misc.hs
mit
(<...>) :: (Functor f, Functor f1, Functor f2) => (b -> c) -> (a -> f (f1 (f2 b))) -> a -> f (f1 (f2 c)) a <...> b = (fmap . fmap . fmap) a . b
154
(<...>) :: (Functor f, Functor f1, Functor f2) => (b -> c) -> (a -> f (f1 (f2 b))) -> a -> f (f1 (f2 c)) a <...> b = (fmap . fmap . fmap) a . b
154
a <...> b = (fmap . fmap . fmap) a . b
38
false
true
0
15
48
118
59
59
null
null
shlevy/arithmoi
Math/NumberTheory/Primes/Counting/Approximate.hs
mit
-- Basically the approximation of the prime count by Li(x), -- adjusted to give close but slightly too high estimates -- in the interesting range. The constants are empirically -- determined. appi :: Double -> Double appi x = y - y/300000 + 7*ll where y = x*l*(1+l*(1+l*h)) w = log x l = 1/w ll = log w h | x < 10000000 = 2.5625 | x < 50000000 = 2.5 | x < 120000000 = 617/256 | otherwise = 2.0625 + l*(3+ll*l*(13.25+ll*l*57.75)) -- Basically an approximation to the inverse of Li(x), with -- empirically determined constants to get close results -- in the interesting range.
629
appi :: Double -> Double appi x = y - y/300000 + 7*ll where y = x*l*(1+l*(1+l*h)) w = log x l = 1/w ll = log w h | x < 10000000 = 2.5625 | x < 50000000 = 2.5 | x < 120000000 = 617/256 | otherwise = 2.0625 + l*(3+ll*l*(13.25+ll*l*57.75)) -- Basically an approximation to the inverse of Li(x), with -- empirically determined constants to get close results -- in the interesting range.
437
appi x = y - y/300000 + 7*ll where y = x*l*(1+l*(1+l*h)) w = log x l = 1/w ll = log w h | x < 10000000 = 2.5625 | x < 50000000 = 2.5 | x < 120000000 = 617/256 | otherwise = 2.0625 + l*(3+ll*l*(13.25+ll*l*57.75)) -- Basically an approximation to the inverse of Li(x), with -- empirically determined constants to get close results -- in the interesting range.
412
true
true
0
12
161
196
102
94
null
null
fpco/stackage-cabal
main/Init.hs
mit
handleInitExceptions :: Snapshot -> InitException -> IO () handleInitExceptions snapshot e = hPutStrLn stderr (err e) >> exitFailure where err InvalidSnapshot = "Invalid snapshot: " <> snapshot err SnapshotNotFound = "Snapshot not found: " <> snapshot err CabalConfigExists = "Warning: Cabal config already exists.\n" <> "No action taken." err (UnexpectedHttpException e) = "Unexpected http exception:\n" <> show e
444
handleInitExceptions :: Snapshot -> InitException -> IO () handleInitExceptions snapshot e = hPutStrLn stderr (err e) >> exitFailure where err InvalidSnapshot = "Invalid snapshot: " <> snapshot err SnapshotNotFound = "Snapshot not found: " <> snapshot err CabalConfigExists = "Warning: Cabal config already exists.\n" <> "No action taken." err (UnexpectedHttpException e) = "Unexpected http exception:\n" <> show e
444
handleInitExceptions snapshot e = hPutStrLn stderr (err e) >> exitFailure where err InvalidSnapshot = "Invalid snapshot: " <> snapshot err SnapshotNotFound = "Snapshot not found: " <> snapshot err CabalConfigExists = "Warning: Cabal config already exists.\n" <> "No action taken." err (UnexpectedHttpException e) = "Unexpected http exception:\n" <> show e
385
false
true
0
9
87
107
51
56
null
null
MichaelBurge/ToxicSludgeDB
Tests/Database/Toxic/Streams.hs
mit
test_cross_join :: Assertion test_cross_join = let stream1 = Stream { streamHeader = V.singleton $ Column { columnName = "x", columnType = TBool }, streamRecords = map (Record . V.singleton) [ VBool True, VBool False, VBool True ] } stream2 = Stream { streamHeader = V.singleton $ Column { columnName = "y", columnType = TBool }, streamRecords = map (Record . V.singleton) [ VBool False, VBool True ] } expectedStream = Stream { streamHeader = V.fromList [ Column { columnName = "$0.x", columnType = TBool }, Column { columnName = "$1.y", columnType = TBool } ], streamRecords = map (Record . V.fromList) [ [ VBool True, VBool False], [ VBool True, VBool True ], [ VBool False, VBool False ], [ VBool False, VBool True ], [ VBool True, VBool False ], [ VBool True, VBool True ] ] } actualStream = crossJoinStreams $ V.fromList [ stream1, stream2 ] in assertEqual "" expectedStream actualStream
1,112
test_cross_join :: Assertion test_cross_join = let stream1 = Stream { streamHeader = V.singleton $ Column { columnName = "x", columnType = TBool }, streamRecords = map (Record . V.singleton) [ VBool True, VBool False, VBool True ] } stream2 = Stream { streamHeader = V.singleton $ Column { columnName = "y", columnType = TBool }, streamRecords = map (Record . V.singleton) [ VBool False, VBool True ] } expectedStream = Stream { streamHeader = V.fromList [ Column { columnName = "$0.x", columnType = TBool }, Column { columnName = "$1.y", columnType = TBool } ], streamRecords = map (Record . V.fromList) [ [ VBool True, VBool False], [ VBool True, VBool True ], [ VBool False, VBool False ], [ VBool False, VBool True ], [ VBool True, VBool False ], [ VBool True, VBool True ] ] } actualStream = crossJoinStreams $ V.fromList [ stream1, stream2 ] in assertEqual "" expectedStream actualStream
1,112
test_cross_join = let stream1 = Stream { streamHeader = V.singleton $ Column { columnName = "x", columnType = TBool }, streamRecords = map (Record . V.singleton) [ VBool True, VBool False, VBool True ] } stream2 = Stream { streamHeader = V.singleton $ Column { columnName = "y", columnType = TBool }, streamRecords = map (Record . V.singleton) [ VBool False, VBool True ] } expectedStream = Stream { streamHeader = V.fromList [ Column { columnName = "$0.x", columnType = TBool }, Column { columnName = "$1.y", columnType = TBool } ], streamRecords = map (Record . V.fromList) [ [ VBool True, VBool False], [ VBool True, VBool True ], [ VBool False, VBool False ], [ VBool False, VBool True ], [ VBool True, VBool False ], [ VBool True, VBool True ] ] } actualStream = crossJoinStreams $ V.fromList [ stream1, stream2 ] in assertEqual "" expectedStream actualStream
1,083
false
true
0
14
371
342
190
152
null
null
bus000/Dikunt
src/Monitoring.hs
bsd-3-clause
writeAll :: DikuntMonitor -- The monitor specifying the plugins. -> T.Text -- The message to write. -> IO () writeAll monitor message = C.withMVar monitor $ \m -> do mapM_ (safePrint message . inputHandle) (getProcesses m) where safePrint msg h = T.hPutStrLn h msg `catch` (\e -> lError $ show (e :: IOException)) lError = Log.errorM "monitoring.writeAll" {- | Read all output that comes from any plugin in the monitor. -}
462
writeAll :: DikuntMonitor -- The monitor specifying the plugins. -> T.Text -- The message to write. -> IO () writeAll monitor message = C.withMVar monitor $ \m -> do mapM_ (safePrint message . inputHandle) (getProcesses m) where safePrint msg h = T.hPutStrLn h msg `catch` (\e -> lError $ show (e :: IOException)) lError = Log.errorM "monitoring.writeAll" {- | Read all output that comes from any plugin in the monitor. -}
462
writeAll monitor message = C.withMVar monitor $ \m -> do mapM_ (safePrint message . inputHandle) (getProcesses m) where safePrint msg h = T.hPutStrLn h msg `catch` (\e -> lError $ show (e :: IOException)) lError = Log.errorM "monitoring.writeAll" {- | Read all output that comes from any plugin in the monitor. -}
337
false
true
0
12
110
130
66
64
null
null
PipocaQuemada/ermine
src/Ermine/Interpreter.hs
bsd-2-clause
{- watch :: (Monad m, Show a) => MachineState m -> String -> m a -> m a watch ms n m = do a <- m note ms n a return a -} nargs :: MachineState m -> Sorted Int nargs ms = ms^.fp -ms^.sp
191
nargs :: MachineState m -> Sorted Int nargs ms = ms^.fp -ms^.sp
63
nargs ms = ms^.fp -ms^.sp
25
true
true
0
7
52
37
18
19
null
null
chpatrick/hchip
HChip/Sound.hs
mit
wavefunc :: Tone -> Double -> IO (Word64 -> IO Double) wavefunc Simple f = return (return . triangle f)
103
wavefunc :: Tone -> Double -> IO (Word64 -> IO Double) wavefunc Simple f = return (return . triangle f)
103
wavefunc Simple f = return (return . triangle f)
48
false
true
0
10
19
50
24
26
null
null
afcowie/detour
lib/Linux/Program.hs
bsd-3-clause
-- -- Main program entry point -- interruptHandler :: MVar () -> Handler interruptHandler semaphore = Catch $ do hPutStrLn stdout "\nInterrupt" hFlush stdout putMVar semaphore ()
191
interruptHandler :: MVar () -> Handler interruptHandler semaphore = Catch $ do hPutStrLn stdout "\nInterrupt" hFlush stdout putMVar semaphore ()
156
interruptHandler semaphore = Catch $ do hPutStrLn stdout "\nInterrupt" hFlush stdout putMVar semaphore ()
117
true
true
0
9
39
54
25
29
null
null
rahulmutt/ghcvm
libraries/base/Data/List/NonEmpty.hs
bsd-3-clause
-- | @'filter' p xs@ removes any elements from @xs@ that do not satisfy @p@. filter :: (a -> Bool) -> NonEmpty a -> [a] filter p = List.filter p . toList
153
filter :: (a -> Bool) -> NonEmpty a -> [a] filter p = List.filter p . toList
76
filter p = List.filter p . toList
33
true
true
1
9
31
52
24
28
null
null
Noeda/compiled-expressions
src/Data/CompiledExpression/Internal.hs
mit
synthVarSize (Minus sz1 sz2) = 1 + synthVarSize sz1 + synthVarSize sz2
70
synthVarSize (Minus sz1 sz2) = 1 + synthVarSize sz1 + synthVarSize sz2
70
synthVarSize (Minus sz1 sz2) = 1 + synthVarSize sz1 + synthVarSize sz2
70
false
false
0
7
11
31
14
17
null
null
music-suite/music-pitch-literal
src/Music/Pitch/Literal/Pitch.hs
bsd-3-clause
bs___ = fromPitch $ PitchL (6, Just 1, -3)
46
bs___ = fromPitch $ PitchL (6, Just 1, -3)
46
bs___ = fromPitch $ PitchL (6, Just 1, -3)
46
false
false
3
7
12
31
14
17
null
null
input-output-hk/pos-haskell-prototype
wallet/test/unit/Util/GenHash.hs
mit
withHash :: Monad m => Int -> GenHashT m a -> m a withHash = flip evalGenHashT
78
withHash :: Monad m => Int -> GenHashT m a -> m a withHash = flip evalGenHashT
78
withHash = flip evalGenHashT
28
false
true
0
9
16
43
18
25
null
null
arianvp/binary-serialise-cbor
Data/Binary/Serialise/CBOR/Term.hs
bsd-3-clause
decodeListN :: Int -> [Term] -> Decoder Term decodeListN !n acc = case n of 0 -> return $! TList (reverse acc) _ -> do !t <- decodeTerm decodeListN (n-1) (t : acc)
193
decodeListN :: Int -> [Term] -> Decoder Term decodeListN !n acc = case n of 0 -> return $! TList (reverse acc) _ -> do !t <- decodeTerm decodeListN (n-1) (t : acc)
193
decodeListN !n acc = case n of 0 -> return $! TList (reverse acc) _ -> do !t <- decodeTerm decodeListN (n-1) (t : acc)
148
false
true
0
12
62
90
43
47
null
null
rjeli/luatalk
src/Lexer.hs
bsd-3-clause
ppToken Pipe = "|"
31
ppToken Pipe = "|"
31
ppToken Pipe = "|"
31
false
false
0
5
16
9
4
5
null
null
opensuse-haskell/cabal-rpm
src/PackageUtils.hs
gpl-3.0
rpmbuild :: RpmStage -> Bool -> Maybe FilePath -> FilePath -> IO () rpmbuild mode quiet moutdir spec = do let rpmCmd = case mode of Binary -> "a" Source -> "s" Prep -> "p" BuildDep -> "_" cwd <- getCurrentDirectory gitDir <- isGitDir cwd let rpmdirs_override = if gitDir then ["--define=_rpmdir" +-+ cwd, "--define=_srcrpmdir" +-+ cwd, "--define=_sourcedir" +-+ cwd] else [] command "rpmbuild" $ ["-b" ++ rpmCmd] ++ ["--nodeps" | mode == Prep] ++ ["--define=_builddir" +-+ maybe cwd (cwd </>) moutdir | isJust moutdir] ++ rpmdirs_override ++ [spec] where command = if quiet then cmdSilent else cmd_
774
rpmbuild :: RpmStage -> Bool -> Maybe FilePath -> FilePath -> IO () rpmbuild mode quiet moutdir spec = do let rpmCmd = case mode of Binary -> "a" Source -> "s" Prep -> "p" BuildDep -> "_" cwd <- getCurrentDirectory gitDir <- isGitDir cwd let rpmdirs_override = if gitDir then ["--define=_rpmdir" +-+ cwd, "--define=_srcrpmdir" +-+ cwd, "--define=_sourcedir" +-+ cwd] else [] command "rpmbuild" $ ["-b" ++ rpmCmd] ++ ["--nodeps" | mode == Prep] ++ ["--define=_builddir" +-+ maybe cwd (cwd </>) moutdir | isJust moutdir] ++ rpmdirs_override ++ [spec] where command = if quiet then cmdSilent else cmd_
774
rpmbuild mode quiet moutdir spec = do let rpmCmd = case mode of Binary -> "a" Source -> "s" Prep -> "p" BuildDep -> "_" cwd <- getCurrentDirectory gitDir <- isGitDir cwd let rpmdirs_override = if gitDir then ["--define=_rpmdir" +-+ cwd, "--define=_srcrpmdir" +-+ cwd, "--define=_sourcedir" +-+ cwd] else [] command "rpmbuild" $ ["-b" ++ rpmCmd] ++ ["--nodeps" | mode == Prep] ++ ["--define=_builddir" +-+ maybe cwd (cwd </>) moutdir | isJust moutdir] ++ rpmdirs_override ++ [spec] where command = if quiet then cmdSilent else cmd_
706
false
true
1
13
273
234
115
119
null
null
acowley/ghc
testsuite/tests/simplCore/should_compile/spec001.hs
bsd-3-clause
------------------------------------------------------------ -- | The 'join' function takes a 'PackedString' and a list of 'PackedString's -- and concatenates the list after interspersing the first argument between -- each element of the list. join :: PackedString -> [PackedString] -> PackedString join filler pss = concat (splice pss) where splice [] = [] splice [x] = [x] splice (x:y:xs) = x:filler:splice (y:xs) -- ToDo: the obvious generalisation {- Some properties that hold: * split x ls = ls' where False = any (map (x `elem`) ls') * join (pack [x]) (split x ls) = ls -} -- | The 'split' function splits the input string on each occurrence of the given 'Char'.
693
join :: PackedString -> [PackedString] -> PackedString join filler pss = concat (splice pss) where splice [] = [] splice [x] = [x] splice (x:y:xs) = x:filler:splice (y:xs) -- ToDo: the obvious generalisation {- Some properties that hold: * split x ls = ls' where False = any (map (x `elem`) ls') * join (pack [x]) (split x ls) = ls -} -- | The 'split' function splits the input string on each occurrence of the given 'Char'.
448
join filler pss = concat (splice pss) where splice [] = [] splice [x] = [x] splice (x:y:xs) = x:filler:splice (y:xs) -- ToDo: the obvious generalisation {- Some properties that hold: * split x ls = ls' where False = any (map (x `elem`) ls') * join (pack [x]) (split x ls) = ls -} -- | The 'split' function splits the input string on each occurrence of the given 'Char'.
393
true
true
0
8
133
109
59
50
null
null
GaloisInc/halvm-ghc
compiler/basicTypes/Lexeme.hs
bsd-3-clause
okVarOcc _ = False
18
okVarOcc _ = False
18
okVarOcc _ = False
18
false
false
0
4
3
10
4
6
null
null
sol/pandoc
src/Text/Pandoc/Readers/HTML.hs
gpl-2.0
pCodeBlock :: TagParser [Block] pCodeBlock = try $ do TagOpen _ attr <- pSatisfy (~== TagOpen "pre" []) contents <- manyTill pAnyTag (pCloses "pre" <|> eof) let rawText = concatMap fromTagText $ filter isTagText contents -- drop leading newline if any let result' = case rawText of '\n':xs -> xs _ -> rawText -- drop trailing newline if any let result = case reverse result' of '\n':_ -> init result' _ -> result' let attribsId = fromMaybe "" $ lookup "id" attr let attribsClasses = words $ fromMaybe "" $ lookup "class" attr let attribsKV = filter (\(k,_) -> k /= "class" && k /= "id") attr st <- getState let attribs = if stateStrict st then ("",[],[]) else (attribsId, attribsClasses, attribsKV) return [CodeBlock attribs result]
895
pCodeBlock :: TagParser [Block] pCodeBlock = try $ do TagOpen _ attr <- pSatisfy (~== TagOpen "pre" []) contents <- manyTill pAnyTag (pCloses "pre" <|> eof) let rawText = concatMap fromTagText $ filter isTagText contents -- drop leading newline if any let result' = case rawText of '\n':xs -> xs _ -> rawText -- drop trailing newline if any let result = case reverse result' of '\n':_ -> init result' _ -> result' let attribsId = fromMaybe "" $ lookup "id" attr let attribsClasses = words $ fromMaybe "" $ lookup "class" attr let attribsKV = filter (\(k,_) -> k /= "class" && k /= "id") attr st <- getState let attribs = if stateStrict st then ("",[],[]) else (attribsId, attribsClasses, attribsKV) return [CodeBlock attribs result]
895
pCodeBlock = try $ do TagOpen _ attr <- pSatisfy (~== TagOpen "pre" []) contents <- manyTill pAnyTag (pCloses "pre" <|> eof) let rawText = concatMap fromTagText $ filter isTagText contents -- drop leading newline if any let result' = case rawText of '\n':xs -> xs _ -> rawText -- drop trailing newline if any let result = case reverse result' of '\n':_ -> init result' _ -> result' let attribsId = fromMaybe "" $ lookup "id" attr let attribsClasses = words $ fromMaybe "" $ lookup "class" attr let attribsKV = filter (\(k,_) -> k /= "class" && k /= "id") attr st <- getState let attribs = if stateStrict st then ("",[],[]) else (attribsId, attribsClasses, attribsKV) return [CodeBlock attribs result]
863
false
true
0
16
288
305
148
157
null
null
randen/cabal
Cabal/Distribution/Simple/Build.hs
bsd-3-clause
buildComponent verbosity numJobs pkg_descr lbi suffixes comp@(CBench bm@Benchmark { benchmarkInterface = BenchmarkExeV10 {} }) clbi _ = do let (exe, exeClbi) = benchmarkExeV10asExe bm clbi preprocessComponent pkg_descr comp lbi False verbosity suffixes extras <- preprocessExtras comp lbi info verbosity $ "Building benchmark " ++ benchmarkName bm ++ "..." let ebi = buildInfo exe exe' = exe { buildInfo = addExtraCSources ebi extras } buildExe verbosity numJobs pkg_descr lbi exe' exeClbi
551
buildComponent verbosity numJobs pkg_descr lbi suffixes comp@(CBench bm@Benchmark { benchmarkInterface = BenchmarkExeV10 {} }) clbi _ = do let (exe, exeClbi) = benchmarkExeV10asExe bm clbi preprocessComponent pkg_descr comp lbi False verbosity suffixes extras <- preprocessExtras comp lbi info verbosity $ "Building benchmark " ++ benchmarkName bm ++ "..." let ebi = buildInfo exe exe' = exe { buildInfo = addExtraCSources ebi extras } buildExe verbosity numJobs pkg_descr lbi exe' exeClbi
551
buildComponent verbosity numJobs pkg_descr lbi suffixes comp@(CBench bm@Benchmark { benchmarkInterface = BenchmarkExeV10 {} }) clbi _ = do let (exe, exeClbi) = benchmarkExeV10asExe bm clbi preprocessComponent pkg_descr comp lbi False verbosity suffixes extras <- preprocessExtras comp lbi info verbosity $ "Building benchmark " ++ benchmarkName bm ++ "..." let ebi = buildInfo exe exe' = exe { buildInfo = addExtraCSources ebi extras } buildExe verbosity numJobs pkg_descr lbi exe' exeClbi
551
false
false
0
13
131
164
78
86
null
null
DanielWaterworth/Idris-dev
src/Idris/REPL.hs
bsd-3-clause
removeProof :: Name -> Idris () removeProof n = do i <- getIState let proofs = proof_list i let ps = filter ((/= n) . fst) proofs putIState $ i { proof_list = ps }
180
removeProof :: Name -> Idris () removeProof n = do i <- getIState let proofs = proof_list i let ps = filter ((/= n) . fst) proofs putIState $ i { proof_list = ps }
180
removeProof n = do i <- getIState let proofs = proof_list i let ps = filter ((/= n) . fst) proofs putIState $ i { proof_list = ps }
148
false
true
0
13
51
82
40
42
null
null
mitchellwrosen/Sloch
src/sloch/Dirent.hs
bsd-3-clause
-- | Build a Maybe Dirent from the specified FilePath. Returns Nothing if the specified file should be ignored. A file -- should be ignored if: -- - it's a symlink -- - it's a dotfile, and @ignore_dotfiles@ is True. -- - the file cannot be opened or does not exist. -- Otherwise, return a Just DirentDir (recursively create Dirents from each entry, ignoring "." and "..") or a Just -- DirentFile. makeDirent :: Bool -> FilePath -> IO (Maybe Dirent) makeDirent include_dotfiles path = catch (runMaybeT makeDirent') (\(_ :: IOException) -> return Nothing) where makeDirent' :: MaybeT IO Dirent makeDirent' = do guard $ include_dotfiles || not (isDotfile path) guardM $ lift $ isNotSymbolicLink path guardM $ lift $ hasReadPermission path is_dir <- lift $ isDirectory path if is_dir then do children <- lift $ getDirectoryContents path childrenDirents <- lift $ concurrently' $ map (makeDirent include_dotfiles) children return $ DirentDir path (catMaybes childrenDirents) else return $ DirentFile path where isNotSymbolicLink :: FilePath -> IO Bool isNotSymbolicLink = fmap not . isSymbolicLink
1,257
makeDirent :: Bool -> FilePath -> IO (Maybe Dirent) makeDirent include_dotfiles path = catch (runMaybeT makeDirent') (\(_ :: IOException) -> return Nothing) where makeDirent' :: MaybeT IO Dirent makeDirent' = do guard $ include_dotfiles || not (isDotfile path) guardM $ lift $ isNotSymbolicLink path guardM $ lift $ hasReadPermission path is_dir <- lift $ isDirectory path if is_dir then do children <- lift $ getDirectoryContents path childrenDirents <- lift $ concurrently' $ map (makeDirent include_dotfiles) children return $ DirentDir path (catMaybes childrenDirents) else return $ DirentFile path where isNotSymbolicLink :: FilePath -> IO Bool isNotSymbolicLink = fmap not . isSymbolicLink
845
makeDirent include_dotfiles path = catch (runMaybeT makeDirent') (\(_ :: IOException) -> return Nothing) where makeDirent' :: MaybeT IO Dirent makeDirent' = do guard $ include_dotfiles || not (isDotfile path) guardM $ lift $ isNotSymbolicLink path guardM $ lift $ hasReadPermission path is_dir <- lift $ isDirectory path if is_dir then do children <- lift $ getDirectoryContents path childrenDirents <- lift $ concurrently' $ map (makeDirent include_dotfiles) children return $ DirentDir path (catMaybes childrenDirents) else return $ DirentFile path where isNotSymbolicLink :: FilePath -> IO Bool isNotSymbolicLink = fmap not . isSymbolicLink
793
true
true
0
14
336
267
125
142
null
null
scslab/iterIO
tests/conttest.hs
bsd-3-clause
foo :: Bind Int foo = do x <- Bind "x" 7 y <- Bind "y" 8 z <- Bind "z" 9 return $ x + y + z
99
foo :: Bind Int foo = do x <- Bind "x" 7 y <- Bind "y" 8 z <- Bind "z" 9 return $ x + y + z
99
foo = do x <- Bind "x" 7 y <- Bind "y" 8 z <- Bind "z" 9 return $ x + y + z
83
false
true
0
9
36
71
30
41
null
null
danr/hipspec
testsuite/prod/zeno_version/PropT23.hs
gpl-3.0
rev :: [a] -> [a] rev [] = []
33
rev :: [a] -> [a] rev [] = []
33
rev [] = []
15
false
true
0
6
12
32
16
16
null
null
erochest/stat-nlp
src/StatNLP/Utils.hs
apache-2.0
lookup' :: (Num n, Eq a, Hashable a) => M.HashMap a (Sum n) -> a -> n lookup' m k = getSum $ M.lookupDefault mempty k m
119
lookup' :: (Num n, Eq a, Hashable a) => M.HashMap a (Sum n) -> a -> n lookup' m k = getSum $ M.lookupDefault mempty k m
119
lookup' m k = getSum $ M.lookupDefault mempty k m
49
false
true
0
9
26
71
35
36
null
null
olsner/ghc
compiler/main/HscTypes.hs
bsd-3-clause
setInteractivePrintName :: InteractiveContext -> Name -> InteractiveContext setInteractivePrintName ic n = ic{ic_int_print = n}
127
setInteractivePrintName :: InteractiveContext -> Name -> InteractiveContext setInteractivePrintName ic n = ic{ic_int_print = n}
127
setInteractivePrintName ic n = ic{ic_int_print = n}
51
false
true
0
6
13
32
17
15
null
null
tomahawkins/lmor
LMOR.hs
bsd-3-clause
invertBranch :: Int -> Handle -> IO () invertBranch i h = do hSeek h AbsoluteSeek $ fromIntegral i c <- hGetChar h case ord c of 0x74 -> do hSeek h AbsoluteSeek $ fromIntegral i hPutChar h $ chr 0x75 0x75 -> do hSeek h AbsoluteSeek $ fromIntegral i hPutChar h $ chr 0x74 0x0f -> do c <- hGetChar h case ord c of 0x84 -> do hSeek h AbsoluteSeek $ fromIntegral $ i + 1 hPutChar h $ chr 0x85 0x85 -> do hSeek h AbsoluteSeek $ fromIntegral $ i + 1 hPutChar h $ chr 0x84 a -> error $ printf "Expected JE or JNE, but got 0x%02x at 0x%x\n" a i a -> error $ printf "Expected JE or JNE, but got 0x%02x at 0x%x\n" a i
729
invertBranch :: Int -> Handle -> IO () invertBranch i h = do hSeek h AbsoluteSeek $ fromIntegral i c <- hGetChar h case ord c of 0x74 -> do hSeek h AbsoluteSeek $ fromIntegral i hPutChar h $ chr 0x75 0x75 -> do hSeek h AbsoluteSeek $ fromIntegral i hPutChar h $ chr 0x74 0x0f -> do c <- hGetChar h case ord c of 0x84 -> do hSeek h AbsoluteSeek $ fromIntegral $ i + 1 hPutChar h $ chr 0x85 0x85 -> do hSeek h AbsoluteSeek $ fromIntegral $ i + 1 hPutChar h $ chr 0x84 a -> error $ printf "Expected JE or JNE, but got 0x%02x at 0x%x\n" a i a -> error $ printf "Expected JE or JNE, but got 0x%02x at 0x%x\n" a i
729
invertBranch i h = do hSeek h AbsoluteSeek $ fromIntegral i c <- hGetChar h case ord c of 0x74 -> do hSeek h AbsoluteSeek $ fromIntegral i hPutChar h $ chr 0x75 0x75 -> do hSeek h AbsoluteSeek $ fromIntegral i hPutChar h $ chr 0x74 0x0f -> do c <- hGetChar h case ord c of 0x84 -> do hSeek h AbsoluteSeek $ fromIntegral $ i + 1 hPutChar h $ chr 0x85 0x85 -> do hSeek h AbsoluteSeek $ fromIntegral $ i + 1 hPutChar h $ chr 0x84 a -> error $ printf "Expected JE or JNE, but got 0x%02x at 0x%x\n" a i a -> error $ printf "Expected JE or JNE, but got 0x%02x at 0x%x\n" a i
690
false
true
0
20
253
270
117
153
null
null
enolan/cabal
cabal-install/Distribution/Client/Setup.hs
bsd-3-clause
yesNoOpt _ sf lf = Command.boolOpt' flagToMaybe Flag (sf, lf) ([], map ("no-" ++) lf) sf lf
98
yesNoOpt _ sf lf = Command.boolOpt' flagToMaybe Flag (sf, lf) ([], map ("no-" ++) lf) sf lf
98
yesNoOpt _ sf lf = Command.boolOpt' flagToMaybe Flag (sf, lf) ([], map ("no-" ++) lf) sf lf
98
false
false
0
8
23
51
27
24
null
null
vladimir-ipatov/ganeti
src/Ganeti/Constants.hs
gpl-2.0
validIallocatorDirections :: FrozenSet String validIallocatorDirections = ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..]
143
validIallocatorDirections :: FrozenSet String validIallocatorDirections = ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..]
143
validIallocatorDirections = ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..]
97
false
true
3
6
12
35
15
20
null
null
MichaelBurge/stockfighter-jailbreak
src/Api/Stockfighter/Jailbreak/Decompiler.hs
bsd-3-clause
decompile :: [ Instruction ] -> IO Context decompile instructions = let iexs = map (\i -> InstructionEx i (parseInstruction i)) instructions context = mempty { _ctx_statements = map iex_asm iexs } in flip execStateT context $ do -- Instruction-level passes pass_groupBySymbol fixPass "ilevel" $ do pass_rewriteCallInstructionsToCallSymbols pass_fuse3Instrs pass_replaceLocalJumpsWithGotos pass_fuseMultibytePtrs pass_replaceBranchesWithJumps pass_replaceSingleInstructions -- Statement-level passes fixPass "slevel" $ do pass_simplify pass_fuseRedundantLabels pass_fuse2Statements pass_reorderStatements -- stmts <- _ctx_statements <$> get -- liftIO $ print_ast stmts -- Block-level passes fixPass "blevel" $ do fixPass "pushpop" pass_convertPushesAndPopsIntoVariables fixPass "while" pass_fuseLabelsAndGotosIntoWhileLoops fixPass "ifblocks" pass_fuseLabelsGotosIfsIntoIfBlocks fixPass "simplify" pass_simplify
1,051
decompile :: [ Instruction ] -> IO Context decompile instructions = let iexs = map (\i -> InstructionEx i (parseInstruction i)) instructions context = mempty { _ctx_statements = map iex_asm iexs } in flip execStateT context $ do -- Instruction-level passes pass_groupBySymbol fixPass "ilevel" $ do pass_rewriteCallInstructionsToCallSymbols pass_fuse3Instrs pass_replaceLocalJumpsWithGotos pass_fuseMultibytePtrs pass_replaceBranchesWithJumps pass_replaceSingleInstructions -- Statement-level passes fixPass "slevel" $ do pass_simplify pass_fuseRedundantLabels pass_fuse2Statements pass_reorderStatements -- stmts <- _ctx_statements <$> get -- liftIO $ print_ast stmts -- Block-level passes fixPass "blevel" $ do fixPass "pushpop" pass_convertPushesAndPopsIntoVariables fixPass "while" pass_fuseLabelsAndGotosIntoWhileLoops fixPass "ifblocks" pass_fuseLabelsGotosIfsIntoIfBlocks fixPass "simplify" pass_simplify
1,051
decompile instructions = let iexs = map (\i -> InstructionEx i (parseInstruction i)) instructions context = mempty { _ctx_statements = map iex_asm iexs } in flip execStateT context $ do -- Instruction-level passes pass_groupBySymbol fixPass "ilevel" $ do pass_rewriteCallInstructionsToCallSymbols pass_fuse3Instrs pass_replaceLocalJumpsWithGotos pass_fuseMultibytePtrs pass_replaceBranchesWithJumps pass_replaceSingleInstructions -- Statement-level passes fixPass "slevel" $ do pass_simplify pass_fuseRedundantLabels pass_fuse2Statements pass_reorderStatements -- stmts <- _ctx_statements <$> get -- liftIO $ print_ast stmts -- Block-level passes fixPass "blevel" $ do fixPass "pushpop" pass_convertPushesAndPopsIntoVariables fixPass "while" pass_fuseLabelsAndGotosIntoWhileLoops fixPass "ifblocks" pass_fuseLabelsGotosIfsIntoIfBlocks fixPass "simplify" pass_simplify
1,008
false
true
0
14
233
186
83
103
null
null
abakst/liquidhaskell
src/Language/Haskell/Liquid/Types/RefType.hs
bsd-3-clause
-- GHC INVARIANT: RApp is Type Application to something other than TYCon subsFreeRAppTy m s (RApp c ts rs r) t' r' = mkRApp m s c (ts ++ [t']) rs r r'
152
subsFreeRAppTy m s (RApp c ts rs r) t' r' = mkRApp m s c (ts ++ [t']) rs r r'
79
subsFreeRAppTy m s (RApp c ts rs r) t' r' = mkRApp m s c (ts ++ [t']) rs r r'
79
true
false
0
8
34
55
28
27
null
null
bitemyapp/github
Github/Issues.hs
bsd-3-clause
-- | -- Create a new issue. -- -- > createIssue (GithubUser (user, password)) user repo -- > (newIssue "some_repo") {...} createIssue :: GithubAuth -> String -> String -> NewIssue -> IO (Either Error Issue) createIssue auth user repo = githubPost auth ["repos", user, repo, "issues"]
296
createIssue :: GithubAuth -> String -> String -> NewIssue -> IO (Either Error Issue) createIssue auth user repo = githubPost auth ["repos", user, repo, "issues"]
173
createIssue auth user repo = githubPost auth ["repos", user, repo, "issues"]
76
true
true
0
11
58
67
37
30
null
null
lucasbraun/mt-rewrite
src/MtRewriteSelect.hs
bsd-3-clause
rewriteMaybeScalarExpr _ _ prov Nothing _ _ = Right (prov, Nothing)
67
rewriteMaybeScalarExpr _ _ prov Nothing _ _ = Right (prov, Nothing)
67
rewriteMaybeScalarExpr _ _ prov Nothing _ _ = Right (prov, Nothing)
67
false
false
0
6
10
28
14
14
null
null
yuto-matsum/contest-util-hs
src/Euler/005.hs
mit
nswer :: Int -> Int answer n = [0..n] ^* maxpows n
51
answer :: Int -> Int answer n = [0..n] ^* maxpows n
51
answer n = [0..n] ^* maxpows n
30
false
true
0
6
12
30
15
15
null
null
Cortlandd/ConversionFormulas
src/Ghazan/Time.hs
bsd-3-clause
{- Minutes -} minTOd :: Floating a => a -> a minTOd x = x / 1440
64
minTOd :: Floating a => a -> a minTOd x = x / 1440
50
minTOd x = x / 1440
19
true
true
0
6
16
30
15
15
null
null
shlevy/ghc
compiler/llvmGen/Llvm/Types.hs
bsd-3-clause
ppLit (LMIntLit i (LMInt 64)) = ppr (fromInteger i :: Int64)
61
ppLit (LMIntLit i (LMInt 64)) = ppr (fromInteger i :: Int64)
61
ppLit (LMIntLit i (LMInt 64)) = ppr (fromInteger i :: Int64)
61
false
false
0
9
11
35
17
18
null
null
droundy/franchise
enfranchise.hs
bsd-3-clause
main :: IO () main = build [] $ do [cabalfile] <- filter ((==".cabal") . dropWhile (/='.')) `fmap` ls "." putS $ "cabal file is: "++ cabalfile xxx <- cat cabalfile putS $ unlines $ "it parses to:" : map show (parseCabal $ lines xxx) let cf = parseCabal $ lines xxx lookupField :: String -> Maybe [String] lookupField d = lu cf where lu [] = Nothing lu ((d',v):r) = if map toLower d' == map toLower d then case lu r of Just v' -> Just (v++v') Nothing -> Just v else lu r withToken :: Monoid a => String -> (String -> C a) -> C a withToken d j = case lookupField d of Nothing -> do putS $ "Couldn't find "++d return mempty Just v -> case reads $ unlines v of (x,_):_ -> j x _ -> j $ takeWhile (`notElem` "\r\n") $ unlines v withTokens :: Monoid a => String -> ([String] -> C a) -> C a withTokens d j = case lookupField d of Nothing -> do putS $ "Couldn't find "++d return mempty Just v -> j $ readTokens $ unlines v withField :: Monoid a => String -> ([String] -> C a) -> C a withField d j = maybe (return mempty) j $ lookupField d withToken "version" version withTokens "hs-source-dirs" $ \ds -> ghcFlags $ map ("-i"++) ds -- withoutField "hs-source-dirs" $ ghcFlags ["-i."] withTokens "include-dirs" $ \ds -> ghcFlags $ map ("-I"++) ds withTokens "extensions" $ \es -> ghcFlags $ map extension2flag es withTokens "cpp-options" ghcFlags withTokens "ghc-options" ghcFlags withTokens "extra-libraries" $ \libs -> ldFlags $ map ("-l"++) libs withField "exposed-modules" $ \ds -> do pn <- withToken "name" return withField "description" $ ("description" <<=) . unlines putS $ "found package "++pn++" exporting modules "++ (unwords $ words $ unlines ds) package pn (words $ unlines ds) [] withToken "main-is" $ \m -> executable (reverse $ drop 1 $ dropWhile (/='.') $ reverse m) m [] return () where extension2flag "CPP" = "-cpp" extension2flag x = "-X"++x
2,768
main :: IO () main = build [] $ do [cabalfile] <- filter ((==".cabal") . dropWhile (/='.')) `fmap` ls "." putS $ "cabal file is: "++ cabalfile xxx <- cat cabalfile putS $ unlines $ "it parses to:" : map show (parseCabal $ lines xxx) let cf = parseCabal $ lines xxx lookupField :: String -> Maybe [String] lookupField d = lu cf where lu [] = Nothing lu ((d',v):r) = if map toLower d' == map toLower d then case lu r of Just v' -> Just (v++v') Nothing -> Just v else lu r withToken :: Monoid a => String -> (String -> C a) -> C a withToken d j = case lookupField d of Nothing -> do putS $ "Couldn't find "++d return mempty Just v -> case reads $ unlines v of (x,_):_ -> j x _ -> j $ takeWhile (`notElem` "\r\n") $ unlines v withTokens :: Monoid a => String -> ([String] -> C a) -> C a withTokens d j = case lookupField d of Nothing -> do putS $ "Couldn't find "++d return mempty Just v -> j $ readTokens $ unlines v withField :: Monoid a => String -> ([String] -> C a) -> C a withField d j = maybe (return mempty) j $ lookupField d withToken "version" version withTokens "hs-source-dirs" $ \ds -> ghcFlags $ map ("-i"++) ds -- withoutField "hs-source-dirs" $ ghcFlags ["-i."] withTokens "include-dirs" $ \ds -> ghcFlags $ map ("-I"++) ds withTokens "extensions" $ \es -> ghcFlags $ map extension2flag es withTokens "cpp-options" ghcFlags withTokens "ghc-options" ghcFlags withTokens "extra-libraries" $ \libs -> ldFlags $ map ("-l"++) libs withField "exposed-modules" $ \ds -> do pn <- withToken "name" return withField "description" $ ("description" <<=) . unlines putS $ "found package "++pn++" exporting modules "++ (unwords $ words $ unlines ds) package pn (words $ unlines ds) [] withToken "main-is" $ \m -> executable (reverse $ drop 1 $ dropWhile (/='.') $ reverse m) m [] return () where extension2flag "CPP" = "-cpp" extension2flag x = "-X"++x
2,768
main = build [] $ do [cabalfile] <- filter ((==".cabal") . dropWhile (/='.')) `fmap` ls "." putS $ "cabal file is: "++ cabalfile xxx <- cat cabalfile putS $ unlines $ "it parses to:" : map show (parseCabal $ lines xxx) let cf = parseCabal $ lines xxx lookupField :: String -> Maybe [String] lookupField d = lu cf where lu [] = Nothing lu ((d',v):r) = if map toLower d' == map toLower d then case lu r of Just v' -> Just (v++v') Nothing -> Just v else lu r withToken :: Monoid a => String -> (String -> C a) -> C a withToken d j = case lookupField d of Nothing -> do putS $ "Couldn't find "++d return mempty Just v -> case reads $ unlines v of (x,_):_ -> j x _ -> j $ takeWhile (`notElem` "\r\n") $ unlines v withTokens :: Monoid a => String -> ([String] -> C a) -> C a withTokens d j = case lookupField d of Nothing -> do putS $ "Couldn't find "++d return mempty Just v -> j $ readTokens $ unlines v withField :: Monoid a => String -> ([String] -> C a) -> C a withField d j = maybe (return mempty) j $ lookupField d withToken "version" version withTokens "hs-source-dirs" $ \ds -> ghcFlags $ map ("-i"++) ds -- withoutField "hs-source-dirs" $ ghcFlags ["-i."] withTokens "include-dirs" $ \ds -> ghcFlags $ map ("-I"++) ds withTokens "extensions" $ \es -> ghcFlags $ map extension2flag es withTokens "cpp-options" ghcFlags withTokens "ghc-options" ghcFlags withTokens "extra-libraries" $ \libs -> ldFlags $ map ("-l"++) libs withField "exposed-modules" $ \ds -> do pn <- withToken "name" return withField "description" $ ("description" <<=) . unlines putS $ "found package "++pn++" exporting modules "++ (unwords $ words $ unlines ds) package pn (words $ unlines ds) [] withToken "main-is" $ \m -> executable (reverse $ drop 1 $ dropWhile (/='.') $ reverse m) m [] return () where extension2flag "CPP" = "-cpp" extension2flag x = "-X"++x
2,754
false
true
2
20
1,257
869
415
454
null
null
mydaum/cabal
cabal-install/Distribution/Client/FetchUtils.hs
bsd-3-clause
packageFile :: Repo -> PackageId -> FilePath packageFile repo pkgid = packageDir repo pkgid </> display pkgid <.> "tar.gz"
164
packageFile :: Repo -> PackageId -> FilePath packageFile repo pkgid = packageDir repo pkgid </> display pkgid <.> "tar.gz"
164
packageFile repo pkgid = packageDir repo pkgid </> display pkgid <.> "tar.gz"
119
false
true
0
7
60
40
19
21
null
null