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
amccausl/Swish
Swish/HaskellRDF/N3ParserTest.hs
lgpl-2.1
exoticTest12 = parseTest "exoticTest12" exoticN3Graph_x12 x12 noError
69
exoticTest12 = parseTest "exoticTest12" exoticN3Graph_x12 x12 noError
69
exoticTest12 = parseTest "exoticTest12" exoticN3Graph_x12 x12 noError
69
false
false
0
5
6
15
7
8
null
null
egison/egison
hs-src/Language/Egison/PrettyMath/Mathematica.hs
mit
showMathExpr (Multiply [x]) = showMathExpr x
44
showMathExpr (Multiply [x]) = showMathExpr x
44
showMathExpr (Multiply [x]) = showMathExpr x
44
false
false
0
7
5
22
10
12
null
null
flofehrenbacher/music-project
EasyNotes/MidiFun.hs
gpl-3.0
initDevices :: IO (InputDeviceID, OutputDeviceID) initDevices = do initializeMidi inputID <- getFirstInputID outputID <- getFirstOutputID return (inputID, outputID) -- | Transforms a midi message into a Music Pitch. -- if the 'Message' corresponds to a note. -- Otherwise returns 'Nothing'
306
initDevices :: IO (InputDeviceID, OutputDeviceID) initDevices = do initializeMidi inputID <- getFirstInputID outputID <- getFirstOutputID return (inputID, outputID) -- | Transforms a midi message into a Music Pitch. -- if the 'Message' corresponds to a note. -- Otherwise returns 'Nothing'
306
initDevices = do initializeMidi inputID <- getFirstInputID outputID <- getFirstOutputID return (inputID, outputID) -- | Transforms a midi message into a Music Pitch. -- if the 'Message' corresponds to a note. -- Otherwise returns 'Nothing'
256
false
true
0
8
56
52
27
25
null
null
andyarvanitis/Idris-dev
src/Idris/REPL.hs
bsd-3-clause
process fn (ChangeDirectory f) = do runIO $ setCurrentDirectory f return ()
114
process fn (ChangeDirectory f) = do runIO $ setCurrentDirectory f return ()
114
process fn (ChangeDirectory f) = do runIO $ setCurrentDirectory f return ()
114
false
false
0
8
50
37
15
22
null
null
Philonous/pontarius-xmpp
source/Network/Xmpp/Stanza.hs
bsd-3-clause
-- | Produce an answer message with the given payload, setting "from" to the -- "to" attributes in the original message. Produces a 'Nothing' value of the -- provided message message has no "from" attribute. Sets the "from" attribute -- to 'Nothing' to let the server assign one. answerMessage :: Message -> [Element] -> Maybe Message answerMessage Message{messageFrom = Just frm, ..} payload' = Just Message{ messageFrom = Nothing , messageID = Nothing , messageTo = Just frm , messagePayload = payload' , .. }
608
answerMessage :: Message -> [Element] -> Maybe Message answerMessage Message{messageFrom = Just frm, ..} payload' = Just Message{ messageFrom = Nothing , messageID = Nothing , messageTo = Just frm , messagePayload = payload' , .. }
328
answerMessage Message{messageFrom = Just frm, ..} payload' = Just Message{ messageFrom = Nothing , messageID = Nothing , messageTo = Just frm , messagePayload = payload' , .. }
273
true
true
0
9
181
84
48
36
null
null
UURAGE/ScenarioReasoner
src/Domain/Scenarios/Condition.hs
apache-2.0
getCompareOperator :: CompareOperator -> DD.Value -> DD.Value -> Bool getCompareOperator operator = case operator of LessThan -> liftIntCompareOperator (<) LessThanEqualTo -> liftIntCompareOperator (<=) EqualTo -> (==) GreaterThanEqualTo -> liftIntCompareOperator (>=) GreaterThan -> liftIntCompareOperator (>) NotEqualTo -> (/=) where liftIntCompareOperator op (DD.VInteger i1) (DD.VInteger i2) = i1 `op` i2 liftIntCompareOperator _ v1 v2 = error ("Cannot compare " ++ show v1 ++ " and " ++ show v2) -- | Evaluates the unary condition based on the given state
686
getCompareOperator :: CompareOperator -> DD.Value -> DD.Value -> Bool getCompareOperator operator = case operator of LessThan -> liftIntCompareOperator (<) LessThanEqualTo -> liftIntCompareOperator (<=) EqualTo -> (==) GreaterThanEqualTo -> liftIntCompareOperator (>=) GreaterThan -> liftIntCompareOperator (>) NotEqualTo -> (/=) where liftIntCompareOperator op (DD.VInteger i1) (DD.VInteger i2) = i1 `op` i2 liftIntCompareOperator _ v1 v2 = error ("Cannot compare " ++ show v1 ++ " and " ++ show v2) -- | Evaluates the unary condition based on the given state
686
getCompareOperator operator = case operator of LessThan -> liftIntCompareOperator (<) LessThanEqualTo -> liftIntCompareOperator (<=) EqualTo -> (==) GreaterThanEqualTo -> liftIntCompareOperator (>=) GreaterThan -> liftIntCompareOperator (>) NotEqualTo -> (/=) where liftIntCompareOperator op (DD.VInteger i1) (DD.VInteger i2) = i1 `op` i2 liftIntCompareOperator _ v1 v2 = error ("Cannot compare " ++ show v1 ++ " and " ++ show v2) -- | Evaluates the unary condition based on the given state
616
false
true
1
11
203
167
88
79
null
null
diku-dk/futhark
src/Language/Futhark/Traversals.hs
isc
bareField (RecordFieldImplicit name _ loc) = RecordFieldImplicit name NoInfo loc
82
bareField (RecordFieldImplicit name _ loc) = RecordFieldImplicit name NoInfo loc
82
bareField (RecordFieldImplicit name _ loc) = RecordFieldImplicit name NoInfo loc
82
false
false
0
6
11
27
12
15
null
null
mapinguari/SC_HS_Proxy
src/Proxy/Query/Unit.hs
mit
tileWidth SpecialOvermindCocoon = 3
35
tileWidth SpecialOvermindCocoon = 3
35
tileWidth SpecialOvermindCocoon = 3
35
false
false
0
5
3
9
4
5
null
null
julienschmaltz/madl
src/Madl/Network.hs
mit
prop net (matchIn:dataIn:[], (Match _ f), tOut:fOut:[]) = maybe (updateNoMatch net) applyNoMatch updateMatch where applyNoMatch n = maybe (Just n) Just (updateNoMatch n) updateMatch = updateType net tOut (matchingValues True) updateNoMatch net' = updateType net' fOut (matchingValues False) matchingValues val = filter (flip (mayMatch val f) $ getColorSet net matchIn) (getColors $ getColorSet net dataIn)
421
prop net (matchIn:dataIn:[], (Match _ f), tOut:fOut:[]) = maybe (updateNoMatch net) applyNoMatch updateMatch where applyNoMatch n = maybe (Just n) Just (updateNoMatch n) updateMatch = updateType net tOut (matchingValues True) updateNoMatch net' = updateType net' fOut (matchingValues False) matchingValues val = filter (flip (mayMatch val f) $ getColorSet net matchIn) (getColors $ getColorSet net dataIn)
421
prop net (matchIn:dataIn:[], (Match _ f), tOut:fOut:[]) = maybe (updateNoMatch net) applyNoMatch updateMatch where applyNoMatch n = maybe (Just n) Just (updateNoMatch n) updateMatch = updateType net tOut (matchingValues True) updateNoMatch net' = updateType net' fOut (matchingValues False) matchingValues val = filter (flip (mayMatch val f) $ getColorSet net matchIn) (getColors $ getColorSet net dataIn)
421
false
false
0
12
70
179
87
92
null
null
wuxb45/eval
Eval/Storage.hs
bsd-3-clause
-- }}} -- accessAndPrint {{{ accessAndPrint :: DServerInfo -> [String] -> IO () accessAndPrint si args = do result <- accessServer si (clientCmdH args) case result of Just (Left ok) -> putStrLn $ "result: " ++ show ok Just (Right lst) -> putStrLn "result list: " >> mapM_ putStrLn lst _ -> putStrLn "accessServer failed" -- }}} -- }}} -- vim: fdm=marker
372
accessAndPrint :: DServerInfo -> [String] -> IO () accessAndPrint si args = do result <- accessServer si (clientCmdH args) case result of Just (Left ok) -> putStrLn $ "result: " ++ show ok Just (Right lst) -> putStrLn "result list: " >> mapM_ putStrLn lst _ -> putStrLn "accessServer failed" -- }}} -- }}} -- vim: fdm=marker
342
accessAndPrint si args = do result <- accessServer si (clientCmdH args) case result of Just (Left ok) -> putStrLn $ "result: " ++ show ok Just (Right lst) -> putStrLn "result list: " >> mapM_ putStrLn lst _ -> putStrLn "accessServer failed" -- }}} -- }}} -- vim: fdm=marker
291
true
true
0
12
80
124
60
64
null
null
uduki/hsQt
Qtc/Gui/QDragLeaveEvent.hs
bsd-2-clause
qDragLeaveEvent_delete :: QDragLeaveEvent a -> IO () qDragLeaveEvent_delete x0 = withObjectPtr x0 $ \cobj_x0 -> qtc_QDragLeaveEvent_delete cobj_x0
152
qDragLeaveEvent_delete :: QDragLeaveEvent a -> IO () qDragLeaveEvent_delete x0 = withObjectPtr x0 $ \cobj_x0 -> qtc_QDragLeaveEvent_delete cobj_x0
152
qDragLeaveEvent_delete x0 = withObjectPtr x0 $ \cobj_x0 -> qtc_QDragLeaveEvent_delete cobj_x0
99
false
true
2
8
22
46
20
26
null
null
jwaldmann/sat-life
src/Opt.hs
gpl-3.0
reduce_implied f cl = let here = O.or $ map (uncurry O.unit) cl sub = S.unions $ do (pre, _ : post) <- splits cl let cl' = pre ++ post return $ reduce_implied f cl' in if o_implies f here then if S.null sub then S.singleton (M.fromList cl) else sub else S.empty
326
reduce_implied f cl = let here = O.or $ map (uncurry O.unit) cl sub = S.unions $ do (pre, _ : post) <- splits cl let cl' = pre ++ post return $ reduce_implied f cl' in if o_implies f here then if S.null sub then S.singleton (M.fromList cl) else sub else S.empty
326
reduce_implied f cl = let here = O.or $ map (uncurry O.unit) cl sub = S.unions $ do (pre, _ : post) <- splits cl let cl' = pre ++ post return $ reduce_implied f cl' in if o_implies f here then if S.null sub then S.singleton (M.fromList cl) else sub else S.empty
326
false
false
0
15
117
138
67
71
null
null
rueshyna/gogol
gogol-sheets/gen/Network/Google/Sheets/Types/Product.hs
mpl-2.0
-- | The sheet of the rule to move. Required if new_index is set, unused -- otherwise. ucfrrSheetId :: Lens' UpdateConditionalFormatRuleRequest (Maybe Int32) ucfrrSheetId = lens _ucfrrSheetId (\ s a -> s{_ucfrrSheetId = a}) . mapping _Coerce
249
ucfrrSheetId :: Lens' UpdateConditionalFormatRuleRequest (Maybe Int32) ucfrrSheetId = lens _ucfrrSheetId (\ s a -> s{_ucfrrSheetId = a}) . mapping _Coerce
162
ucfrrSheetId = lens _ucfrrSheetId (\ s a -> s{_ucfrrSheetId = a}) . mapping _Coerce
91
true
true
2
9
44
60
29
31
null
null
solidsnack/shuttercat
shuttercat.hs
bsd-3-clause
above :: Term (Maybe String) above = value . opt Nothing $ (optInfo [ "above" ]) { optDoc = "Lines placed above each chunk." , optName = "TEXT" }
209
above :: Term (Maybe String) above = value . opt Nothing $ (optInfo [ "above" ]) { optDoc = "Lines placed above each chunk." , optName = "TEXT" }
209
above = value . opt Nothing $ (optInfo [ "above" ]) { optDoc = "Lines placed above each chunk." , optName = "TEXT" }
180
false
true
0
9
92
54
29
25
null
null
mankyKitty/holy-haskell-project-starter
src/HolyProject.hs
mit
-- End actor functions. -- | Play the intro spiel for the user. intro :: IO () intro = do bk "Stop!" bk "Who would cross the Bridge of Death" bk "must answer me these questions three," bk "ere the other side they see." you "Ask me the questions, Bridgekeeper, I am not afraid.\n" -- | GET ON WITH IT!
312
intro :: IO () intro = do bk "Stop!" bk "Who would cross the Bridge of Death" bk "must answer me these questions three," bk "ere the other side they see." you "Ask me the questions, Bridgekeeper, I am not afraid.\n" -- | GET ON WITH IT!
247
intro = do bk "Stop!" bk "Who would cross the Bridge of Death" bk "must answer me these questions three," bk "ere the other side they see." you "Ask me the questions, Bridgekeeper, I am not afraid.\n" -- | GET ON WITH IT!
232
true
true
0
7
71
49
21
28
null
null
DavidAlphaFox/ghc
libraries/Cabal/cabal-install/Distribution/Client/IndexUtils.hs
bsd-3-clause
convert :: InstalledPackageIndex -> PackageIndex InstalledPackage convert index' = PackageIndex.fromList -- There can be multiple installed instances of each package version, -- like when the same package is installed in the global & user DBs. -- InstalledPackageIndex.allPackagesBySourcePackageId gives us the -- installed packages with the most preferred instances first, so by -- picking the first we should get the user one. This is almost but not -- quite the same as what ghc does. [ InstalledPackage ipkg (sourceDeps index' ipkg) | (_,ipkg:_) <- InstalledPackageIndex.allPackagesBySourcePackageId index' ] where -- The InstalledPackageInfo only lists dependencies by the -- InstalledPackageId, which means we do not directly know the corresponding -- source dependency. The only way to find out is to lookup the -- InstalledPackageId to get the InstalledPackageInfo and look at its -- source PackageId. But if the package is broken because it depends on -- other packages that do not exist then we have a problem we cannot find -- the original source package id. Instead we make up a bogus package id. -- This should have the same effect since it should be a dependency on a -- nonexistent package. sourceDeps index ipkg = [ maybe (brokenPackageId depid) packageId mdep | let depids = InstalledPackageInfo.depends ipkg getpkg = InstalledPackageIndex.lookupInstalledPackageId index , (depid, mdep) <- zip depids (map getpkg depids) ] brokenPackageId (InstalledPackageId str) = PackageIdentifier (PackageName (str ++ "-broken")) (Version [] []) ------------------------------------------------------------------------ -- Reading the source package index -- -- | Read a repository index from disk, from the local files specified by -- a list of 'Repo's. -- -- All the 'SourcePackage's are marked as having come from the appropriate -- 'Repo'. -- -- This is a higher level wrapper used internally in cabal-install. --
2,037
convert :: InstalledPackageIndex -> PackageIndex InstalledPackage convert index' = PackageIndex.fromList -- There can be multiple installed instances of each package version, -- like when the same package is installed in the global & user DBs. -- InstalledPackageIndex.allPackagesBySourcePackageId gives us the -- installed packages with the most preferred instances first, so by -- picking the first we should get the user one. This is almost but not -- quite the same as what ghc does. [ InstalledPackage ipkg (sourceDeps index' ipkg) | (_,ipkg:_) <- InstalledPackageIndex.allPackagesBySourcePackageId index' ] where -- The InstalledPackageInfo only lists dependencies by the -- InstalledPackageId, which means we do not directly know the corresponding -- source dependency. The only way to find out is to lookup the -- InstalledPackageId to get the InstalledPackageInfo and look at its -- source PackageId. But if the package is broken because it depends on -- other packages that do not exist then we have a problem we cannot find -- the original source package id. Instead we make up a bogus package id. -- This should have the same effect since it should be a dependency on a -- nonexistent package. sourceDeps index ipkg = [ maybe (brokenPackageId depid) packageId mdep | let depids = InstalledPackageInfo.depends ipkg getpkg = InstalledPackageIndex.lookupInstalledPackageId index , (depid, mdep) <- zip depids (map getpkg depids) ] brokenPackageId (InstalledPackageId str) = PackageIdentifier (PackageName (str ++ "-broken")) (Version [] []) ------------------------------------------------------------------------ -- Reading the source package index -- -- | Read a repository index from disk, from the local files specified by -- a list of 'Repo's. -- -- All the 'SourcePackage's are marked as having come from the appropriate -- 'Repo'. -- -- This is a higher level wrapper used internally in cabal-install. --
2,037
convert index' = PackageIndex.fromList -- There can be multiple installed instances of each package version, -- like when the same package is installed in the global & user DBs. -- InstalledPackageIndex.allPackagesBySourcePackageId gives us the -- installed packages with the most preferred instances first, so by -- picking the first we should get the user one. This is almost but not -- quite the same as what ghc does. [ InstalledPackage ipkg (sourceDeps index' ipkg) | (_,ipkg:_) <- InstalledPackageIndex.allPackagesBySourcePackageId index' ] where -- The InstalledPackageInfo only lists dependencies by the -- InstalledPackageId, which means we do not directly know the corresponding -- source dependency. The only way to find out is to lookup the -- InstalledPackageId to get the InstalledPackageInfo and look at its -- source PackageId. But if the package is broken because it depends on -- other packages that do not exist then we have a problem we cannot find -- the original source package id. Instead we make up a bogus package id. -- This should have the same effect since it should be a dependency on a -- nonexistent package. sourceDeps index ipkg = [ maybe (brokenPackageId depid) packageId mdep | let depids = InstalledPackageInfo.depends ipkg getpkg = InstalledPackageIndex.lookupInstalledPackageId index , (depid, mdep) <- zip depids (map getpkg depids) ] brokenPackageId (InstalledPackageId str) = PackageIdentifier (PackageName (str ++ "-broken")) (Version [] []) ------------------------------------------------------------------------ -- Reading the source package index -- -- | Read a repository index from disk, from the local files specified by -- a list of 'Repo's. -- -- All the 'SourcePackage's are marked as having come from the appropriate -- 'Repo'. -- -- This is a higher level wrapper used internally in cabal-install. --
1,971
false
true
0
11
402
219
121
98
null
null
judah/haskeline
tests/RunTTY.hs
bsd-3-clause
setLang :: String -> Invocation -> Invocation setLang = setEnv "LANG"
69
setLang :: String -> Invocation -> Invocation setLang = setEnv "LANG"
69
setLang = setEnv "LANG"
23
false
true
0
8
10
29
12
17
null
null
jbracker/presentation-gen
src/PresentationGen/Render.hs
gpl-2.0
htmlTitleSlide :: SlideM Html htmlTitleSlide = do title <- fromJust `fmap` getTitle authors <- map authorToHtml `fmap` getAuthors organisations <- getOrganisations return $ H.section $ do H.h1 $ fromString title H.p $ H.small $ do case length authors of 0 -> return () 1 -> sequence_ authors n -> do sequence_ (intersperse (fromString ", ") (init authors)) fromString " and " last authors seqMap orgToHtml organisations where authorToHtml :: (String, [Int]) -> Html authorToHtml (auth, []) = fromString auth authorToHtml (auth, assoc) = do fromString auth H.sup $ fromString $ intercalate "," $ map show assoc orgToHtml :: (Int, [String]) -> Html orgToHtml (n, org) = H.p $ H.small $ H.address $ do H.sup $ toHtml n sequence_ $ intersperse H.br $ map fromString org -- ----------------------------------------------------------------------- -- Pandoc to Html Translation -- -----------------------------------------------------------------------
1,073
htmlTitleSlide :: SlideM Html htmlTitleSlide = do title <- fromJust `fmap` getTitle authors <- map authorToHtml `fmap` getAuthors organisations <- getOrganisations return $ H.section $ do H.h1 $ fromString title H.p $ H.small $ do case length authors of 0 -> return () 1 -> sequence_ authors n -> do sequence_ (intersperse (fromString ", ") (init authors)) fromString " and " last authors seqMap orgToHtml organisations where authorToHtml :: (String, [Int]) -> Html authorToHtml (auth, []) = fromString auth authorToHtml (auth, assoc) = do fromString auth H.sup $ fromString $ intercalate "," $ map show assoc orgToHtml :: (Int, [String]) -> Html orgToHtml (n, org) = H.p $ H.small $ H.address $ do H.sup $ toHtml n sequence_ $ intersperse H.br $ map fromString org -- ----------------------------------------------------------------------- -- Pandoc to Html Translation -- -----------------------------------------------------------------------
1,073
htmlTitleSlide = do title <- fromJust `fmap` getTitle authors <- map authorToHtml `fmap` getAuthors organisations <- getOrganisations return $ H.section $ do H.h1 $ fromString title H.p $ H.small $ do case length authors of 0 -> return () 1 -> sequence_ authors n -> do sequence_ (intersperse (fromString ", ") (init authors)) fromString " and " last authors seqMap orgToHtml organisations where authorToHtml :: (String, [Int]) -> Html authorToHtml (auth, []) = fromString auth authorToHtml (auth, assoc) = do fromString auth H.sup $ fromString $ intercalate "," $ map show assoc orgToHtml :: (Int, [String]) -> Html orgToHtml (n, org) = H.p $ H.small $ H.address $ do H.sup $ toHtml n sequence_ $ intersperse H.br $ map fromString org -- ----------------------------------------------------------------------- -- Pandoc to Html Translation -- -----------------------------------------------------------------------
1,043
false
true
15
22
261
313
157
156
null
null
snowleopard/alga
test/Algebra/Graph/Test/RewriteRules.hs
mit
overlaysP, overlaysPR :: b -> (a -> b) -> (b -> b -> b) -> (b -> b -> b) -> [Graph a] -> b overlaysP e v o c xs = foldg e v o c (overlays xs)
144
overlaysP, overlaysPR :: b -> (a -> b) -> (b -> b -> b) -> (b -> b -> b) -> [Graph a] -> b overlaysP e v o c xs = foldg e v o c (overlays xs)
144
overlaysP e v o c xs = foldg e v o c (overlays xs)
51
false
true
1
7
41
93
50
43
null
null
cdornan/idiot
Text/RE/Parsers.hs
bsd-3-clause
parseDateTimeCLF :: Replace a => a -> Maybe UTCTime parseDateTimeCLF = parse_time ["%d/%b/%Y:%H:%M:%S %z"]
106
parseDateTimeCLF :: Replace a => a -> Maybe UTCTime parseDateTimeCLF = parse_time ["%d/%b/%Y:%H:%M:%S %z"]
106
parseDateTimeCLF = parse_time ["%d/%b/%Y:%H:%M:%S %z"]
54
false
true
0
7
13
31
15
16
null
null
ezyang/ghc
compiler/nativeGen/PPC/Ppr.hs
bsd-3-clause
pprInstr (MR reg1 reg2) | reg1 == reg2 = empty | otherwise = hcat [ char '\t', sdocWithPlatform $ \platform -> case targetClassOfReg platform reg1 of RcInteger -> text "mr" _ -> text "fmr", char '\t', pprReg reg1, text ", ", pprReg reg2 ]
330
pprInstr (MR reg1 reg2) | reg1 == reg2 = empty | otherwise = hcat [ char '\t', sdocWithPlatform $ \platform -> case targetClassOfReg platform reg1 of RcInteger -> text "mr" _ -> text "fmr", char '\t', pprReg reg1, text ", ", pprReg reg2 ]
330
pprInstr (MR reg1 reg2) | reg1 == reg2 = empty | otherwise = hcat [ char '\t', sdocWithPlatform $ \platform -> case targetClassOfReg platform reg1 of RcInteger -> text "mr" _ -> text "fmr", char '\t', pprReg reg1, text ", ", pprReg reg2 ]
330
false
false
1
12
135
106
51
55
null
null
robdockins/edison
edison-core/src/Data/Edison/Seq/Defaults.hs
mit
adjustUsingSplitAt :: Sequence s => (a -> a) -> Int -> s a -> s a adjustUsingSplitAt f i xs | i < 0 = xs | otherwise = let (ys,zs) = splitAt i xs in case lview zs of Nothing -> xs Just (z,zs') -> append ys (lcons (f z) zs') {- insertAtUsingLists :: Sequence s => Int -> a -> s a -> s a insertAtUsingLists i x xs = fromList (L.insertAt i x (toList xs)) insertAtUsingSplitAt :: Sequence s => Int -> a -> s a -> s a insertAtUsingSplitAt i x xs | (xs_before, xs_after) <- splitAt i xs = append xs_before (lcons x xs_after) deleteAtUsingLists :: Sequence s => Int -> s a -> s a deleteAtUsingLists i xs = fromList (L.deleteAt i (toList xs)) deleteAtUsingSplitAt :: Sequence s => Int -> s a -> s a deleteAtUsingSplitAt i xs | (xs_before, xs_after) <- splitAt i xs = append xs_before (ltail xs_after) -}
884
adjustUsingSplitAt :: Sequence s => (a -> a) -> Int -> s a -> s a adjustUsingSplitAt f i xs | i < 0 = xs | otherwise = let (ys,zs) = splitAt i xs in case lview zs of Nothing -> xs Just (z,zs') -> append ys (lcons (f z) zs') {- insertAtUsingLists :: Sequence s => Int -> a -> s a -> s a insertAtUsingLists i x xs = fromList (L.insertAt i x (toList xs)) insertAtUsingSplitAt :: Sequence s => Int -> a -> s a -> s a insertAtUsingSplitAt i x xs | (xs_before, xs_after) <- splitAt i xs = append xs_before (lcons x xs_after) deleteAtUsingLists :: Sequence s => Int -> s a -> s a deleteAtUsingLists i xs = fromList (L.deleteAt i (toList xs)) deleteAtUsingSplitAt :: Sequence s => Int -> s a -> s a deleteAtUsingSplitAt i xs | (xs_before, xs_after) <- splitAt i xs = append xs_before (ltail xs_after) -}
884
adjustUsingSplitAt f i xs | i < 0 = xs | otherwise = let (ys,zs) = splitAt i xs in case lview zs of Nothing -> xs Just (z,zs') -> append ys (lcons (f z) zs') {- insertAtUsingLists :: Sequence s => Int -> a -> s a -> s a insertAtUsingLists i x xs = fromList (L.insertAt i x (toList xs)) insertAtUsingSplitAt :: Sequence s => Int -> a -> s a -> s a insertAtUsingSplitAt i x xs | (xs_before, xs_after) <- splitAt i xs = append xs_before (lcons x xs_after) deleteAtUsingLists :: Sequence s => Int -> s a -> s a deleteAtUsingLists i xs = fromList (L.deleteAt i (toList xs)) deleteAtUsingSplitAt :: Sequence s => Int -> s a -> s a deleteAtUsingSplitAt i xs | (xs_before, xs_after) <- splitAt i xs = append xs_before (ltail xs_after) -}
818
false
true
1
14
246
138
67
71
null
null
ecaustin/haskhol-math
src/HaskHOL/Lib/Arith.hs
bsd-2-clause
defMIN :: ArithCtxt thry => HOL cls thry HOLThm defMIN = cacheProof "defMIN" ctxtArith $ getDefinition "MIN"
108
defMIN :: ArithCtxt thry => HOL cls thry HOLThm defMIN = cacheProof "defMIN" ctxtArith $ getDefinition "MIN"
108
defMIN = cacheProof "defMIN" ctxtArith $ getDefinition "MIN"
60
false
true
0
7
16
43
18
25
null
null
haskell/haddock
haddock-api/src/Haddock/Utils/Json.hs
bsd-2-clause
encodeStringBB :: String -> Builder encodeStringBB str = BB.char8 '"' <> go str <> BB.char8 '"' where go = BB.stringUtf8 . escapeString ------------------------------------------------------------------------------ -- 'String'-based encoding -- | Serialise value as JSON-encoded Unicode 'String'
303
encodeStringBB :: String -> Builder encodeStringBB str = BB.char8 '"' <> go str <> BB.char8 '"' where go = BB.stringUtf8 . escapeString ------------------------------------------------------------------------------ -- 'String'-based encoding -- | Serialise value as JSON-encoded Unicode 'String'
303
encodeStringBB str = BB.char8 '"' <> go str <> BB.char8 '"' where go = BB.stringUtf8 . escapeString ------------------------------------------------------------------------------ -- 'String'-based encoding -- | Serialise value as JSON-encoded Unicode 'String'
267
false
true
0
8
41
56
28
28
null
null
Annaraf/ASD
Isi/a.hs
mit
zip' [a] [] = []
16
zip' [a] [] = []
16
zip' [a] [] = []
16
false
false
0
6
4
18
9
9
null
null
acamino/state-codes
src/Data/StateCodes/ISO31662US.hs
mit
toName IN = "Indiana"
21
toName IN = "Indiana"
21
toName IN = "Indiana"
21
false
false
0
5
3
9
4
5
null
null
grnet/snf-ganeti
src/Ganeti/Constants.hs
bsd-2-clause
-- * Boot order htBoCdrom :: String htBoCdrom = "cdrom"
56
htBoCdrom :: String htBoCdrom = "cdrom"
39
htBoCdrom = "cdrom"
19
true
true
0
6
10
19
8
11
null
null
siddhanathan/ghc
compiler/utils/Encoding.hs
bsd-3-clause
encode_ch '>' = "zg"
21
encode_ch '>' = "zg"
21
encode_ch '>' = "zg"
21
false
false
1
5
4
13
4
9
null
null
haroldcarr/nfsn-client
NFSNClient.hs
apache-2.0
req :: Body -> Method -> ContentType -> RCat -> RSubCat -> Ix -> IO (Response L.ByteString) req (Body body) method (ContentType contentType0) (RCat rCat) (RSubCat rSubCat) (Ix ix0) = do let uri = "/" ++ rCat ++ "/" ++ ix0 ++ "/" ++ rSubCat (login, apiKey) <- getApiKey strHash <- authHash (Uri uri) login apiKey (Body body) let apiHost = "api.nearlyfreespeech.net" let contentType = if null contentType0 then "application/x-nfsn-api" else contentType0 let opts = defaults & header "Host" .~ [C8.pack apiHost] & header "Content-Type" .~ [C8.pack contentType] & header "X-NFSN-Authentication" .~ [C8.pack strHash] let url = "https://" ++ apiHost ++ ":443" ++ uri case method of GET -> getWith opts url -- 'Raw' to set the correct content type POST -> postWith opts url (Raw (C8.pack contentType) (RequestBodyBS (C8.pack body)))
1,041
req :: Body -> Method -> ContentType -> RCat -> RSubCat -> Ix -> IO (Response L.ByteString) req (Body body) method (ContentType contentType0) (RCat rCat) (RSubCat rSubCat) (Ix ix0) = do let uri = "/" ++ rCat ++ "/" ++ ix0 ++ "/" ++ rSubCat (login, apiKey) <- getApiKey strHash <- authHash (Uri uri) login apiKey (Body body) let apiHost = "api.nearlyfreespeech.net" let contentType = if null contentType0 then "application/x-nfsn-api" else contentType0 let opts = defaults & header "Host" .~ [C8.pack apiHost] & header "Content-Type" .~ [C8.pack contentType] & header "X-NFSN-Authentication" .~ [C8.pack strHash] let url = "https://" ++ apiHost ++ ":443" ++ uri case method of GET -> getWith opts url -- 'Raw' to set the correct content type POST -> postWith opts url (Raw (C8.pack contentType) (RequestBodyBS (C8.pack body)))
1,041
req (Body body) method (ContentType contentType0) (RCat rCat) (RSubCat rSubCat) (Ix ix0) = do let uri = "/" ++ rCat ++ "/" ++ ix0 ++ "/" ++ rSubCat (login, apiKey) <- getApiKey strHash <- authHash (Uri uri) login apiKey (Body body) let apiHost = "api.nearlyfreespeech.net" let contentType = if null contentType0 then "application/x-nfsn-api" else contentType0 let opts = defaults & header "Host" .~ [C8.pack apiHost] & header "Content-Type" .~ [C8.pack contentType] & header "X-NFSN-Authentication" .~ [C8.pack strHash] let url = "https://" ++ apiHost ++ ":443" ++ uri case method of GET -> getWith opts url -- 'Raw' to set the correct content type POST -> postWith opts url (Raw (C8.pack contentType) (RequestBodyBS (C8.pack body)))
918
false
true
0
17
346
338
163
175
null
null
kaliumxyz/learnings
haskell/baby.hs
mit
patGuard :: (RealFloat a) => (a, a) -> String patGuard (0, 0) = "error"
71
patGuard :: (RealFloat a) => (a, a) -> String patGuard (0, 0) = "error"
71
patGuard (0, 0) = "error"
25
false
true
0
7
13
43
23
20
null
null
rvion/stack
src/Stack/Setup.hs
bsd-3-clause
installDockerStackExe :: (MonadIO m, MonadMask m, MonadLogger m, MonadReader env m, HasConfig env, HasHttpManager env, MonadBaseControl IO m) => SetupInfo -> Path Abs File -> ArchiveType -> Path Abs Dir -> m () installDockerStackExe _ archiveFile _ destDir = do (_,tarTool) <- checkDependencies $ (,) <$> checkDependency "gzip" <*> checkDependency "tar" menv <- getMinimalEnvOverride createTree destDir readInNull destDir tarTool menv ["xf", toFilePath archiveFile, "--strip-components", "1"] Nothing
596
installDockerStackExe :: (MonadIO m, MonadMask m, MonadLogger m, MonadReader env m, HasConfig env, HasHttpManager env, MonadBaseControl IO m) => SetupInfo -> Path Abs File -> ArchiveType -> Path Abs Dir -> m () installDockerStackExe _ archiveFile _ destDir = do (_,tarTool) <- checkDependencies $ (,) <$> checkDependency "gzip" <*> checkDependency "tar" menv <- getMinimalEnvOverride createTree destDir readInNull destDir tarTool menv ["xf", toFilePath archiveFile, "--strip-components", "1"] Nothing
596
installDockerStackExe _ archiveFile _ destDir = do (_,tarTool) <- checkDependencies $ (,) <$> checkDependency "gzip" <*> checkDependency "tar" menv <- getMinimalEnvOverride createTree destDir readInNull destDir tarTool menv ["xf", toFilePath archiveFile, "--strip-components", "1"] Nothing
361
false
true
0
12
161
181
87
94
null
null
jystic/hsimport
lib/HsImport/Utils.hs
bsd-3-clause
srcLine :: HS.ImportDecl -> SrcLine srcLine = HS.srcLine . HS.importLoc
71
srcLine :: HS.ImportDecl -> SrcLine srcLine = HS.srcLine . HS.importLoc
71
srcLine = HS.srcLine . HS.importLoc
35
false
true
0
7
9
32
14
18
null
null
ianoc/jt
src/Jt.hs
mit
err :: String -> a err msg = throw $ ForcedException msg
56
err :: String -> a err msg = throw $ ForcedException msg
56
err msg = throw $ ForcedException msg
37
false
true
0
6
11
25
12
13
null
null
da-x/lamdu
Lamdu/Eval/JS/Compiler.hs
gpl-3.0
($.) :: JSS.Expression () -> JSS.Id () -> JSS.Expression () ($.) = JS.dot
73
($.) :: JSS.Expression () -> JSS.Id () -> JSS.Expression () ($.) = JS.dot
73
($.) = JS.dot
13
false
true
0
9
12
52
25
27
null
null
kadena-io/pact
src/Pact/Types/Logger.hs
bsd-3-clause
logInfo :: Logging m => String -> m () logInfo = log "INFO"
59
logInfo :: Logging m => String -> m () logInfo = log "INFO"
59
logInfo = log "INFO"
20
false
true
0
8
12
30
14
16
null
null
sdiehl/ghc
libraries/base/Data/Void.hs
bsd-3-clause
-- | If 'Void' is uninhabited then any 'Functor' that holds only -- values of type 'Void' is holding no values. -- -- Using @ApplicativeDo@: \'@'vacuous' theVoid@\' can be understood as the -- @do@ expression -- -- @ -- do void <- theVoid -- pure (absurd void) -- @ -- -- with an inferred @Functor@ constraint. -- -- @since 4.8.0.0 vacuous :: Functor f => f Void -> f a vacuous = fmap absurd
394
vacuous :: Functor f => f Void -> f a vacuous = fmap absurd
59
vacuous = fmap absurd
21
true
true
0
8
76
51
29
22
null
null
nevrenato/Hets_Fork
GMP/versioning/gmp-coloss-0.0.3/GMP/Logics/SysS.hs
gpl-2.0
cStructs2 :: [[Int]] -> [([Int],[(Int,Int)])] cStructs2 worldss = concat [ cStructs worlds | worlds <- worldss ]
112
cStructs2 :: [[Int]] -> [([Int],[(Int,Int)])] cStructs2 worldss = concat [ cStructs worlds | worlds <- worldss ]
112
cStructs2 worldss = concat [ cStructs worlds | worlds <- worldss ]
66
false
true
0
9
16
62
35
27
null
null
haskell-opengl/OpenGLRaw
src/Graphics/GL/Functions/F09.hs
bsd-3-clause
ptr_glGenPerfMonitorsAMD :: FunPtr (GLsizei -> Ptr GLuint -> IO ()) ptr_glGenPerfMonitorsAMD = unsafePerformIO $ getCommand "glGenPerfMonitorsAMD"
146
ptr_glGenPerfMonitorsAMD :: FunPtr (GLsizei -> Ptr GLuint -> IO ()) ptr_glGenPerfMonitorsAMD = unsafePerformIO $ getCommand "glGenPerfMonitorsAMD"
146
ptr_glGenPerfMonitorsAMD = unsafePerformIO $ getCommand "glGenPerfMonitorsAMD"
78
false
true
0
10
15
40
19
21
null
null
atupal/xmonad-mirror
xmonad/tests/Properties/StackSet.hs
mit
prop_shift_win_I (nex :: NonEmptyWindowsStackSet) = do let NonEmptyWindowsStackSet x = nex w <- arbitraryWindow nex n <- arbitraryTag x return $ invariant $ shiftWin n w x -- --------------------------------------------------------------------- -- empty StackSets have no windows in them
299
prop_shift_win_I (nex :: NonEmptyWindowsStackSet) = do let NonEmptyWindowsStackSet x = nex w <- arbitraryWindow nex n <- arbitraryTag x return $ invariant $ shiftWin n w x -- --------------------------------------------------------------------- -- empty StackSets have no windows in them
299
prop_shift_win_I (nex :: NonEmptyWindowsStackSet) = do let NonEmptyWindowsStackSet x = nex w <- arbitraryWindow nex n <- arbitraryTag x return $ invariant $ shiftWin n w x -- --------------------------------------------------------------------- -- empty StackSets have no windows in them
299
false
false
0
10
48
70
31
39
null
null
dylanmc/cryptol
sbv/Data/SBV/Tools/Optimize.hs
bsd-3-clause
-- | Maximizes a cost function with respect to a constraint. Examples: -- -- >>> maximize Quantified sum 3 (bAll (.< (10 :: SInteger))) -- Just [9,9,9] maximize :: (SatModel a, SymWord a, Show a, SymWord c, Show c) => OptimizeOpts -> ([SBV a] -> SBV c) -> Int -> ([SBV a] -> SBool) -> IO (Maybe [a]) maximize = maximizeWith defaultSMTCfg
341
maximize :: (SatModel a, SymWord a, Show a, SymWord c, Show c) => OptimizeOpts -> ([SBV a] -> SBV c) -> Int -> ([SBV a] -> SBool) -> IO (Maybe [a]) maximize = maximizeWith defaultSMTCfg
185
maximize = maximizeWith defaultSMTCfg
37
true
true
0
14
65
114
58
56
null
null
spetz911/progames
nehe-tuts-master/lesson03.hs
mit
keyPressed :: GLFW.KeyCallback keyPressed win GLFW.Key'Escape _ GLFW.KeyState'Pressed _ = shutdown win
102
keyPressed :: GLFW.KeyCallback keyPressed win GLFW.Key'Escape _ GLFW.KeyState'Pressed _ = shutdown win
102
keyPressed win GLFW.Key'Escape _ GLFW.KeyState'Pressed _ = shutdown win
71
false
true
0
6
11
31
15
16
null
null
olsner/ghc
compiler/coreSyn/MkCore.hs
bsd-3-clause
-- | Make a core tuple of the given boxity mkCoreTupBoxity :: Boxity -> [CoreExpr] -> CoreExpr mkCoreTupBoxity Boxed exps = mkCoreTup exps
140
mkCoreTupBoxity :: Boxity -> [CoreExpr] -> CoreExpr mkCoreTupBoxity Boxed exps = mkCoreTup exps
97
mkCoreTupBoxity Boxed exps = mkCoreTup exps
45
true
true
0
7
24
31
16
15
null
null
tsoding/boids
src/Main.hs
mit
main = do boids <- randomState play window backgroundColor 30 boids renderState handleInput nextState
111
main = do boids <- randomState play window backgroundColor 30 boids renderState handleInput nextState
111
main = do boids <- randomState play window backgroundColor 30 boids renderState handleInput nextState
111
false
false
0
7
23
31
14
17
null
null
xaverdh/hmail
HMail/Brick.hs
gpl-3.0
handleKeyEvent :: Key -> [Modifier] -> EventF View handleKeyEvent key mods = case key of KEsc -> haltEventF KChar 'q' -> haltEventF _ -> continueEventF
165
handleKeyEvent :: Key -> [Modifier] -> EventF View handleKeyEvent key mods = case key of KEsc -> haltEventF KChar 'q' -> haltEventF _ -> continueEventF
165
handleKeyEvent key mods = case key of KEsc -> haltEventF KChar 'q' -> haltEventF _ -> continueEventF
114
false
true
0
8
38
55
27
28
null
null
urv/fixhs
src/Data/FIX/Spec/FIX42.hs
lgpl-2.1
tListExecInst :: FIXTag tListExecInst = FIXTag { tName = "ListExecInst" , tnum = 69 , tparser = toFIXString , arbitraryValue = FIXString <$> arbitrary }
165
tListExecInst :: FIXTag tListExecInst = FIXTag { tName = "ListExecInst" , tnum = 69 , tparser = toFIXString , arbitraryValue = FIXString <$> arbitrary }
165
tListExecInst = FIXTag { tName = "ListExecInst" , tnum = 69 , tparser = toFIXString , arbitraryValue = FIXString <$> arbitrary }
141
false
true
0
8
37
45
26
19
null
null
gridaphobe/ghc
compiler/typecheck/TcGenDeriv.hs
bsd-3-clause
-- | A table of postfix modifiers for unboxed values. postfixModTbl :: [(Type, String)] postfixModTbl = [(charPrimTy , "#" ) ,(intPrimTy , "#" ) ,(wordPrimTy , "##") ,(floatPrimTy , "#" ) ,(doublePrimTy, "##") ]
237
postfixModTbl :: [(Type, String)] postfixModTbl = [(charPrimTy , "#" ) ,(intPrimTy , "#" ) ,(wordPrimTy , "##") ,(floatPrimTy , "#" ) ,(doublePrimTy, "##") ]
183
postfixModTbl = [(charPrimTy , "#" ) ,(intPrimTy , "#" ) ,(wordPrimTy , "##") ,(floatPrimTy , "#" ) ,(doublePrimTy, "##") ]
149
true
true
0
8
59
69
43
26
null
null
purcell/adventofcodeteam
app/Three.hs
bsd-3-clause
numDistinctLocations :: [Coord] -> Int numDistinctLocations = length . nub
74
numDistinctLocations :: [Coord] -> Int numDistinctLocations = length . nub
74
numDistinctLocations = length . nub
35
false
true
0
6
9
22
12
10
null
null
zjurelinac/Pljuska
Language/Commands/Basic.hs
mit
lsCommand :: CommandFunction lsCommand env args = do let f = if( length args > 0 ) then toString $ head args else currentDirectory env d <- createDir f let fs = files d let ds = subDirs d return ( StringValue $ ( folderStylize ( intercalate "\n" ( sort $ map getBaseName ds ) ) ++ ( if null ds then "" else "\n" ) ++ ( intercalate "\n" $ sort $ map getBaseName fs ) ), env ) where folderStylize = styledString ( Style Blue Normal ) -- add some styling
546
lsCommand :: CommandFunction lsCommand env args = do let f = if( length args > 0 ) then toString $ head args else currentDirectory env d <- createDir f let fs = files d let ds = subDirs d return ( StringValue $ ( folderStylize ( intercalate "\n" ( sort $ map getBaseName ds ) ) ++ ( if null ds then "" else "\n" ) ++ ( intercalate "\n" $ sort $ map getBaseName fs ) ), env ) where folderStylize = styledString ( Style Blue Normal ) -- add some styling
546
lsCommand env args = do let f = if( length args > 0 ) then toString $ head args else currentDirectory env d <- createDir f let fs = files d let ds = subDirs d return ( StringValue $ ( folderStylize ( intercalate "\n" ( sort $ map getBaseName ds ) ) ++ ( if null ds then "" else "\n" ) ++ ( intercalate "\n" $ sort $ map getBaseName fs ) ), env ) where folderStylize = styledString ( Style Blue Normal ) -- add some styling
517
false
true
0
18
187
190
92
98
null
null
brendanhay/gogol
gogol-identity-toolkit/gen/Network/Google/IdentityToolkit/Types/Product.hs
mpl-2.0
-- | Creates a value of 'IdentitytoolkitRelyingPartyCreateAuthURIRequestCustomParameter' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'irpcaurcpAddtional' identitytoolkitRelyingPartyCreateAuthURIRequestCustomParameter :: HashMap Text Text -- ^ 'irpcaurcpAddtional' -> IdentitytoolkitRelyingPartyCreateAuthURIRequestCustomParameter identitytoolkitRelyingPartyCreateAuthURIRequestCustomParameter pIrpcaurcpAddtional_ = IdentitytoolkitRelyingPartyCreateAuthURIRequestCustomParameter' {_irpcaurcpAddtional = _Coerce # pIrpcaurcpAddtional_}
637
identitytoolkitRelyingPartyCreateAuthURIRequestCustomParameter :: HashMap Text Text -- ^ 'irpcaurcpAddtional' -> IdentitytoolkitRelyingPartyCreateAuthURIRequestCustomParameter identitytoolkitRelyingPartyCreateAuthURIRequestCustomParameter pIrpcaurcpAddtional_ = IdentitytoolkitRelyingPartyCreateAuthURIRequestCustomParameter' {_irpcaurcpAddtional = _Coerce # pIrpcaurcpAddtional_}
394
identitytoolkitRelyingPartyCreateAuthURIRequestCustomParameter pIrpcaurcpAddtional_ = IdentitytoolkitRelyingPartyCreateAuthURIRequestCustomParameter' {_irpcaurcpAddtional = _Coerce # pIrpcaurcpAddtional_}
210
true
true
0
7
66
41
24
17
null
null
kemskems/cis194-spring13
src/HW06/HW06Tests.hs
bsd-3-clause
ex05Tests :: [Test] ex05Tests = [ Test "nats test" testNats [()] , Test "ruler test" testRuler [()] ]
126
ex05Tests :: [Test] ex05Tests = [ Test "nats test" testNats [()] , Test "ruler test" testRuler [()] ]
126
ex05Tests = [ Test "nats test" testNats [()] , Test "ruler test" testRuler [()] ]
106
false
true
0
9
42
51
25
26
null
null
sdroege/duckduckbot
src/DuckDuckBot/Commands/UrbanDictionary.hs
gpl-3.0
handleUD :: TMChan OutMessage -> HTTP.Manager -> B.ByteString -> B.ByteString -> IO () handleUD outChan manager target term = void $ runMaybeT $ do let url = "http://api.urbandictionary.com/v0/define" -- Catch all exceptions and print something but then rethrow them resp <- liftIO $ handle (\(SomeException e) -> putStrLn ("Exception while getting Urban Dictionary result: " ++ show e) >> throwIO e) $ do baseReq <- HTTP.parseUrl url let params = [ ("term", Just term) ] req = HTTP.setQueryString params baseReq HTTP.httpLbs req manager let reply = generateReply (decode (HTTP.responseBody resp) :: Maybe UDReply) liftIO . atomically $ writeTMChan outChan (OutIRCMessage $ replyMessage (UB.fromString reply)) where replyMessage text = IRC.Message { IRC.msg_prefix = Nothing, IRC.msg_command = "PRIVMSG", IRC.msg_params = [target, text] } generateReply (Just (UDReply (UDEntry word defId definition:_))) = shortenedDefinition ++ " (http://urbanup.com/" ++ show defId ++ ")" where maxIrcLen = 400 shortenedDefinition = take maxIrcLen formattedDefinition ++ dots where dots = if length formattedDefinition > maxIrcLen then "…" else "" formattedDefinition = word ++ ": " ++ cleanedDefinition cleanedDefinition = filter isPrint . map (\c -> if isSpace c then ' ' else c) . filter (/= '\r') $ definition generateReply _ = "No results for " ++ UB.toString term
2,369
handleUD :: TMChan OutMessage -> HTTP.Manager -> B.ByteString -> B.ByteString -> IO () handleUD outChan manager target term = void $ runMaybeT $ do let url = "http://api.urbandictionary.com/v0/define" -- Catch all exceptions and print something but then rethrow them resp <- liftIO $ handle (\(SomeException e) -> putStrLn ("Exception while getting Urban Dictionary result: " ++ show e) >> throwIO e) $ do baseReq <- HTTP.parseUrl url let params = [ ("term", Just term) ] req = HTTP.setQueryString params baseReq HTTP.httpLbs req manager let reply = generateReply (decode (HTTP.responseBody resp) :: Maybe UDReply) liftIO . atomically $ writeTMChan outChan (OutIRCMessage $ replyMessage (UB.fromString reply)) where replyMessage text = IRC.Message { IRC.msg_prefix = Nothing, IRC.msg_command = "PRIVMSG", IRC.msg_params = [target, text] } generateReply (Just (UDReply (UDEntry word defId definition:_))) = shortenedDefinition ++ " (http://urbanup.com/" ++ show defId ++ ")" where maxIrcLen = 400 shortenedDefinition = take maxIrcLen formattedDefinition ++ dots where dots = if length formattedDefinition > maxIrcLen then "…" else "" formattedDefinition = word ++ ": " ++ cleanedDefinition cleanedDefinition = filter isPrint . map (\c -> if isSpace c then ' ' else c) . filter (/= '\r') $ definition generateReply _ = "No results for " ++ UB.toString term
2,369
handleUD outChan manager target term = void $ runMaybeT $ do let url = "http://api.urbandictionary.com/v0/define" -- Catch all exceptions and print something but then rethrow them resp <- liftIO $ handle (\(SomeException e) -> putStrLn ("Exception while getting Urban Dictionary result: " ++ show e) >> throwIO e) $ do baseReq <- HTTP.parseUrl url let params = [ ("term", Just term) ] req = HTTP.setQueryString params baseReq HTTP.httpLbs req manager let reply = generateReply (decode (HTTP.responseBody resp) :: Maybe UDReply) liftIO . atomically $ writeTMChan outChan (OutIRCMessage $ replyMessage (UB.fromString reply)) where replyMessage text = IRC.Message { IRC.msg_prefix = Nothing, IRC.msg_command = "PRIVMSG", IRC.msg_params = [target, text] } generateReply (Just (UDReply (UDEntry word defId definition:_))) = shortenedDefinition ++ " (http://urbanup.com/" ++ show defId ++ ")" where maxIrcLen = 400 shortenedDefinition = take maxIrcLen formattedDefinition ++ dots where dots = if length formattedDefinition > maxIrcLen then "…" else "" formattedDefinition = word ++ ": " ++ cleanedDefinition cleanedDefinition = filter isPrint . map (\c -> if isSpace c then ' ' else c) . filter (/= '\r') $ definition generateReply _ = "No results for " ++ UB.toString term
2,282
false
true
3
18
1,215
445
225
220
null
null
corajr/cataskell
src/Cataskell/GameData/Basics.hs
bsd-3-clause
isVictoryPoint :: Item -> Bool isVictoryPoint x = case (x ^? card) of Just VictoryPoint -> True _ -> False
110
isVictoryPoint :: Item -> Bool isVictoryPoint x = case (x ^? card) of Just VictoryPoint -> True _ -> False
110
isVictoryPoint x = case (x ^? card) of Just VictoryPoint -> True _ -> False
79
false
true
0
8
23
44
22
22
null
null
mettekou/ghc
compiler/hsSyn/HsImpExp.hs
bsd-3-clause
ieNames (IEThingWith (L _ n) _ ns _) = n : map unLoc ns
55
ieNames (IEThingWith (L _ n) _ ns _) = n : map unLoc ns
55
ieNames (IEThingWith (L _ n) _ ns _) = n : map unLoc ns
55
false
false
0
8
13
39
18
21
null
null
itkovian/number-six
src/NumberSix/Handlers/Insult.hs
bsd-3-clause
-------------------------------------------------------------------------------- handler :: UninitializedHandler handler = makeBangHandler "Insult" ["!insult"] $ \user -> (user <> ": " <>) <$> liftIO randomInsult
216
handler :: UninitializedHandler handler = makeBangHandler "Insult" ["!insult"] $ \user -> (user <> ": " <>) <$> liftIO randomInsult
135
handler = makeBangHandler "Insult" ["!insult"] $ \user -> (user <> ": " <>) <$> liftIO randomInsult
103
true
true
0
9
23
50
25
25
null
null
abakst/liquidhaskell
src/Language/Haskell/Liquid/Desugar710/DsUtils.hs
bsd-3-clause
-- The Big equivalents for the source tuple patterns mkBigLHsVarPatTup :: [Id] -> LPat Id mkBigLHsVarPatTup bs = mkBigLHsPatTup (map nlVarPat bs)
145
mkBigLHsVarPatTup :: [Id] -> LPat Id mkBigLHsVarPatTup bs = mkBigLHsPatTup (map nlVarPat bs)
92
mkBigLHsVarPatTup bs = mkBigLHsPatTup (map nlVarPat bs)
55
true
true
0
7
21
36
18
18
null
null
ttylec/QLogic
src/cart.hs
gpl-3.0
main :: IO () main = do let boxWorld1 = logicRepr $ boxWorldLogic' onebox boxWorld2 = logicRepr $ boxWorldLogic' twoboxes -- constr = boxConstraints threeboxes -- boxWorld = boxWorldLogic' threeboxes -- threeBoxElems = filter ((<= 1) . maxStateValue constr) -- . elementsOf $ boxWorld -- (n:_) <- getArgs -- print n print $ elementsOf boxWorld1 print $ elementsOf . cartesian $ two boxWorld1 boxWorld1 print $ length . elementsOf $ boxWorld2 -- print $ take (read n) . elementsOf $ boxWorld -- -- print $ take (read n) . elementsOf . logicRepr $ boxWorld -- print $ length threeBoxElems
657
main :: IO () main = do let boxWorld1 = logicRepr $ boxWorldLogic' onebox boxWorld2 = logicRepr $ boxWorldLogic' twoboxes -- constr = boxConstraints threeboxes -- boxWorld = boxWorldLogic' threeboxes -- threeBoxElems = filter ((<= 1) . maxStateValue constr) -- . elementsOf $ boxWorld -- (n:_) <- getArgs -- print n print $ elementsOf boxWorld1 print $ elementsOf . cartesian $ two boxWorld1 boxWorld1 print $ length . elementsOf $ boxWorld2 -- print $ take (read n) . elementsOf $ boxWorld -- -- print $ take (read n) . elementsOf . logicRepr $ boxWorld -- print $ length threeBoxElems
657
main = do let boxWorld1 = logicRepr $ boxWorldLogic' onebox boxWorld2 = logicRepr $ boxWorldLogic' twoboxes -- constr = boxConstraints threeboxes -- boxWorld = boxWorldLogic' threeboxes -- threeBoxElems = filter ((<= 1) . maxStateValue constr) -- . elementsOf $ boxWorld -- (n:_) <- getArgs -- print n print $ elementsOf boxWorld1 print $ elementsOf . cartesian $ two boxWorld1 boxWorld1 print $ length . elementsOf $ boxWorld2 -- print $ take (read n) . elementsOf $ boxWorld -- -- print $ take (read n) . elementsOf . logicRepr $ boxWorld -- print $ length threeBoxElems
643
false
true
0
11
169
104
51
53
null
null
spechub/Hets
Syntax/Parse_AS_Structured.hs
gpl-2.0
expandCurieMConservative :: LogicGraph -> IRI -> GenParser Char st IRI expandCurieMConservative lG i = if isSimple i then return i else expandCurieM lG i
185
expandCurieMConservative :: LogicGraph -> IRI -> GenParser Char st IRI expandCurieMConservative lG i = if isSimple i then return i else expandCurieM lG i
185
expandCurieMConservative lG i = if isSimple i then return i else expandCurieM lG i
114
false
true
0
7
55
50
24
26
null
null
romanb/amazonka
amazonka-swf/gen/Network/AWS/SWF/RespondActivityTaskFailed.hs
mpl-2.0
-- | 'RespondActivityTaskFailed' constructor. -- -- The fields accessible through corresponding lenses are: -- -- * 'ratfDetails' @::@ 'Maybe' 'Text' -- -- * 'ratfReason' @::@ 'Maybe' 'Text' -- -- * 'ratfTaskToken' @::@ 'Text' -- respondActivityTaskFailed :: Text -- ^ 'ratfTaskToken' -> RespondActivityTaskFailed respondActivityTaskFailed p1 = RespondActivityTaskFailed { _ratfTaskToken = p1 , _ratfReason = Nothing , _ratfDetails = Nothing }
490
respondActivityTaskFailed :: Text -- ^ 'ratfTaskToken' -> RespondActivityTaskFailed respondActivityTaskFailed p1 = RespondActivityTaskFailed { _ratfTaskToken = p1 , _ratfReason = Nothing , _ratfDetails = Nothing }
260
respondActivityTaskFailed p1 = RespondActivityTaskFailed { _ratfTaskToken = p1 , _ratfReason = Nothing , _ratfDetails = Nothing }
150
true
true
0
6
105
49
33
16
null
null
foreverbell/unlimited-plt-toys
tapl/fullsimple/Evaluator.hs
bsd-3-clause
evaluate1 ctx (TermProj t f) = TermProj <$> evaluate1 ctx t <*> pure f
70
evaluate1 ctx (TermProj t f) = TermProj <$> evaluate1 ctx t <*> pure f
70
evaluate1 ctx (TermProj t f) = TermProj <$> evaluate1 ctx t <*> pure f
70
false
false
0
7
13
37
16
21
null
null
jlamothe/passman
test/Spec/NewPWSalt.hs
lgpl-3.0
tests :: Test tests = TestLabel "newPWSalt" $ TestList [ testLength salt , testDiff salt salt' ] where (salt, g') = newPWSalt g (salt', _) = newPWSalt g' g = mkStdGen 1
186
tests :: Test tests = TestLabel "newPWSalt" $ TestList [ testLength salt , testDiff salt salt' ] where (salt, g') = newPWSalt g (salt', _) = newPWSalt g' g = mkStdGen 1
186
tests = TestLabel "newPWSalt" $ TestList [ testLength salt , testDiff salt salt' ] where (salt, g') = newPWSalt g (salt', _) = newPWSalt g' g = mkStdGen 1
172
false
true
0
6
49
76
38
38
null
null
a143753/AOJ
1135.hs
apache-2.0
main = do _ <- getLine c <- getContents let i = lines c o = ans i mapM_ print o
93
main = do _ <- getLine c <- getContents let i = lines c o = ans i mapM_ print o
93
main = do _ <- getLine c <- getContents let i = lines c o = ans i mapM_ print o
93
false
false
1
11
34
52
21
31
null
null
tpsinnem/Idris-dev
src/Idris/Core/TT.hs
bsd-3-clause
pprintRaw :: [Name] -- ^ Bound names, for highlighting -> Raw -- ^ The term to pretty-print -> Doc OutputAnnotation pprintRaw bound (Var n) = enclose lparen rparen . group . align . hang 2 $ (text "Var") <$> annotate (if n `elem` bound then AnnBoundName n False else AnnName n Nothing Nothing Nothing) (text $ show n)
441
pprintRaw :: [Name] -- ^ Bound names, for highlighting -> Raw -- ^ The term to pretty-print -> Doc OutputAnnotation pprintRaw bound (Var n) = enclose lparen rparen . group . align . hang 2 $ (text "Var") <$> annotate (if n `elem` bound then AnnBoundName n False else AnnName n Nothing Nothing Nothing) (text $ show n)
441
pprintRaw bound (Var n) = enclose lparen rparen . group . align . hang 2 $ (text "Var") <$> annotate (if n `elem` bound then AnnBoundName n False else AnnName n Nothing Nothing Nothing) (text $ show n)
305
false
true
2
10
181
124
61
63
null
null
moonKimura/cipher-aes-0.2.6
Crypto/Cipher/AES.hs
bsd-3-clause
doCBC :: Byteable iv => (Ptr b -> Ptr AES -> Ptr Word8 -> CString -> CUInt -> IO ()) -> AES -> iv -> ByteString -> ByteString doCBC f ctx iv input | len == 0 = B.empty | r /= 0 = error $ "Encryption error: input length must be a multiple of block size (16). Its length is: " ++ (show len) | otherwise = unsafeCreate len $ \o -> withKeyAndIV ctx iv $ \k v -> unsafeUseAsCString input $ \i -> f (castPtr o) k v i (fromIntegral nbBlocks) where (nbBlocks, r) = len `quotRem` 16 len = B.length input
598
doCBC :: Byteable iv => (Ptr b -> Ptr AES -> Ptr Word8 -> CString -> CUInt -> IO ()) -> AES -> iv -> ByteString -> ByteString doCBC f ctx iv input | len == 0 = B.empty | r /= 0 = error $ "Encryption error: input length must be a multiple of block size (16). Its length is: " ++ (show len) | otherwise = unsafeCreate len $ \o -> withKeyAndIV ctx iv $ \k v -> unsafeUseAsCString input $ \i -> f (castPtr o) k v i (fromIntegral nbBlocks) where (nbBlocks, r) = len `quotRem` 16 len = B.length input
598
doCBC f ctx iv input | len == 0 = B.empty | r /= 0 = error $ "Encryption error: input length must be a multiple of block size (16). Its length is: " ++ (show len) | otherwise = unsafeCreate len $ \o -> withKeyAndIV ctx iv $ \k v -> unsafeUseAsCString input $ \i -> f (castPtr o) k v i (fromIntegral nbBlocks) where (nbBlocks, r) = len `quotRem` 16 len = B.length input
460
false
true
1
14
207
222
108
114
null
null
kaoskorobase/mescaline
lib/mescaline-patterns/src/Mescaline/Pattern/Compiler.hs
gpl-3.0
compileE (AST.E_binding h) = compileBinding B.event h
59
compileE (AST.E_binding h) = compileBinding B.event h
59
compileE (AST.E_binding h) = compileBinding B.event h
59
false
false
0
8
12
24
11
13
null
null
pgj/bead
src/Bead/View/Pagelets.hs
bsd-3-clause
linkWithHtml :: String -> Html -> Html linkWithHtml r t = H.a ! A.href (fromString r) $ t
89
linkWithHtml :: String -> Html -> Html linkWithHtml r t = H.a ! A.href (fromString r) $ t
89
linkWithHtml r t = H.a ! A.href (fromString r) $ t
50
false
true
0
9
17
45
22
23
null
null
ocramz/petsc-hs
src/Numerical/PETSc/Internal/InlineC.hs
gpl-3.0
kspSetInitialGuessNonzero' :: KSP -> Bool -> IO CInt kspSetInitialGuessNonzero' ksp b | b = [C.exp|int{KSPSetInitialGuessNonzero($(KSP ksp), PETSC_TRUE)}|] | otherwise = [C.exp|int{KSPSetInitialGuessNonzero($(KSP ksp), PETSC_FALSE)}|]
238
kspSetInitialGuessNonzero' :: KSP -> Bool -> IO CInt kspSetInitialGuessNonzero' ksp b | b = [C.exp|int{KSPSetInitialGuessNonzero($(KSP ksp), PETSC_TRUE)}|] | otherwise = [C.exp|int{KSPSetInitialGuessNonzero($(KSP ksp), PETSC_FALSE)}|]
238
kspSetInitialGuessNonzero' ksp b | b = [C.exp|int{KSPSetInitialGuessNonzero($(KSP ksp), PETSC_TRUE)}|] | otherwise = [C.exp|int{KSPSetInitialGuessNonzero($(KSP ksp), PETSC_FALSE)}|]
185
false
true
0
7
26
57
30
27
null
null
keera-studios/hsQt
Qtc/Enums/Gui/QStyleOptionToolButton.hs
bsd-2-clause
ePopupDelay :: ToolButtonFeature ePopupDelay = ieToolButtonFeature $ 8
72
ePopupDelay :: ToolButtonFeature ePopupDelay = ieToolButtonFeature $ 8
72
ePopupDelay = ieToolButtonFeature $ 8
39
false
true
2
6
9
23
9
14
null
null
thielema/wxhaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcTypes.hs
lgpl-2.1
withColourPtr :: Color -> (Ptr (TColour a) -> IO b) -> IO b withColourPtr c f = do pcolour <- colourCreateFromUnsignedInt (fromColor c) x <- f pcolour colourSafeDelete pcolour return x
207
withColourPtr :: Color -> (Ptr (TColour a) -> IO b) -> IO b withColourPtr c f = do pcolour <- colourCreateFromUnsignedInt (fromColor c) x <- f pcolour colourSafeDelete pcolour return x
207
withColourPtr c f = do pcolour <- colourCreateFromUnsignedInt (fromColor c) x <- f pcolour colourSafeDelete pcolour return x
147
false
true
0
11
53
84
37
47
null
null
jjingram/satori
src/Parser.hs
bsd-3-clause
binop'' :: String -> Parser BinOp binop'' op = do L.reservedOp op case Map.lookup op Parser.binops of Nothing -> fail $ "unknown operator " ++ op Just op' -> return op'
180
binop'' :: String -> Parser BinOp binop'' op = do L.reservedOp op case Map.lookup op Parser.binops of Nothing -> fail $ "unknown operator " ++ op Just op' -> return op'
180
binop'' op = do L.reservedOp op case Map.lookup op Parser.binops of Nothing -> fail $ "unknown operator " ++ op Just op' -> return op'
146
false
true
0
12
42
76
33
43
null
null
ChrisCoffey/rwh
src/RW/Chap5/Prettify.hs
bsd-3-clause
a <> b = Concat a b
23
a <> b = Concat a b
23
a <> b = Concat a b
23
false
false
3
5
10
20
7
13
null
null
schell/caltrops
src/Web/Bootstrap.hs
mit
liDropdown :: Html -> Html -> Html liDropdown toggle lst = li ! class_ "dropdown" $ do a ! href "#" ! class_ "dropdown-toggle" ! role "button" ! dataToggle "dropdown" ! ariaExpanded False $ do toggle ul ! class_ "dropdown-menu" ! role "menu" $ lst
285
liDropdown :: Html -> Html -> Html liDropdown toggle lst = li ! class_ "dropdown" $ do a ! href "#" ! class_ "dropdown-toggle" ! role "button" ! dataToggle "dropdown" ! ariaExpanded False $ do toggle ul ! class_ "dropdown-menu" ! role "menu" $ lst
285
liDropdown toggle lst = li ! class_ "dropdown" $ do a ! href "#" ! class_ "dropdown-toggle" ! role "button" ! dataToggle "dropdown" ! ariaExpanded False $ do toggle ul ! class_ "dropdown-menu" ! role "menu" $ lst
250
false
true
0
14
82
101
45
56
null
null
unknownloner/calccomp
Asm/InstrBytes.hs
mit
w8l :: [Int] -> Builder w8l x = foldl1 (<>) (map w8 x)
54
w8l :: [Int] -> Builder w8l x = foldl1 (<>) (map w8 x)
54
w8l x = foldl1 (<>) (map w8 x)
30
false
true
0
7
12
36
19
17
null
null
ibukanov/ahome
dev/haskell/Main.hs
unlicense
sfoldr :: Source source => (a->b->b) -> b -> source a -> b sfoldr f inital source = case draw source of Stop -> inital More value source2 -> f value (sfoldr f inital source2)
179
sfoldr :: Source source => (a->b->b) -> b -> source a -> b sfoldr f inital source = case draw source of Stop -> inital More value source2 -> f value (sfoldr f inital source2)
179
sfoldr f inital source = case draw source of Stop -> inital More value source2 -> f value (sfoldr f inital source2)
120
false
true
0
10
39
95
44
51
null
null
gnn/Hets
OWL2/Print.hs
gpl-2.0
cardinalityType :: CardinalityType -> Doc cardinalityType = keyword . showCardinalityType
89
cardinalityType :: CardinalityType -> Doc cardinalityType = keyword . showCardinalityType
89
cardinalityType = keyword . showCardinalityType
47
false
true
0
7
9
26
11
15
null
null
noughtmare/yi
yi-keymap-vim/src/Yi/Keymap/Vim/Digraph.hs
gpl-2.0
-- LATIN SMALL LIGATURE LONG S T switch 's' 't' = '\xFB06'
58
switch 's' 't' = '\xFB06'
25
switch 's' 't' = '\xFB06'
25
true
false
0
5
11
12
6
6
null
null
CindyLinz/Haskell-HVG
src/HVG/SVGState.hs
bsd-3-clause
rpath :: Pos -> Builder info SVGState PathDrawing () -> Builder info SVGState ContourDrawing () rpath = pathMightReverse reversePath
132
rpath :: Pos -> Builder info SVGState PathDrawing () -> Builder info SVGState ContourDrawing () rpath = pathMightReverse reversePath
132
rpath = pathMightReverse reversePath
36
false
true
0
8
18
44
21
23
null
null
AyaMorisawa/aya-script
src/AyaScript/Parser.hs
mit
lexer :: P.TokenParser () lexer = P.makeTokenParser (haskellDef { reservedOpNames = [] })
89
lexer :: P.TokenParser () lexer = P.makeTokenParser (haskellDef { reservedOpNames = [] })
89
lexer = P.makeTokenParser (haskellDef { reservedOpNames = [] })
63
false
true
0
9
12
36
19
17
null
null
kojiromike/Idris-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
piBindp :: Plicity -> [(Name, PTerm)] -> PTerm -> PTerm piBindp p [] t = t
74
piBindp :: Plicity -> [(Name, PTerm)] -> PTerm -> PTerm piBindp p [] t = t
74
piBindp p [] t = t
18
false
true
0
10
15
47
23
24
null
null
sboosali/wagon-challenge
sources/Wagon/First.hs
mit
fAnyRowSummary :: (Eq a) => F.Fold (Maybe' a) AnyRowSummary fAnyRowSummary = AnyRowSummary <$> fAnyTotalCount <*> fAnyNullCount
130
fAnyRowSummary :: (Eq a) => F.Fold (Maybe' a) AnyRowSummary fAnyRowSummary = AnyRowSummary <$> fAnyTotalCount <*> fAnyNullCount
130
fAnyRowSummary = AnyRowSummary <$> fAnyTotalCount <*> fAnyNullCount
70
false
true
5
8
18
46
23
23
null
null
Hodapp87/ivory
ivory-quickcheck/src/Ivory/QuickCheck.hs
bsd-3-clause
-- | Generate a random C program to check that the property holds. The -- generated program will be placed in the @test@ subdirectory. check :: Int -- ^ The number of inputs to generate. -> [Module] -- ^ Modules we need to have in scope. -> Module -- ^ The defining module. -> Def (args :-> IBool) -- ^ The property to check. -> IO () check n deps m p = checkWith n (initialOpts { outDir = Just "test"}) deps m p
479
check :: Int -- ^ The number of inputs to generate. -> [Module] -- ^ Modules we need to have in scope. -> Module -- ^ The defining module. -> Def (args :-> IBool) -- ^ The property to check. -> IO () check n deps m p = checkWith n (initialOpts { outDir = Just "test"}) deps m p
344
check n deps m p = checkWith n (initialOpts { outDir = Just "test"}) deps m p
77
true
true
0
12
150
89
47
42
null
null
DominikJaniec/LearnHaskell
problems/calculator/test/Notation/ReversePolishSpec.hs
mit
main :: IO () main = hspec spec
31
main :: IO () main = hspec spec
31
main = hspec spec
17
false
true
0
7
7
25
10
15
null
null
zaxtax/hakaru
haskell/Language/Hakaru/Parser/Parser.hs
bsd-3-clause
float :: Parser Rational float = (decimal >>= fractExponent) <* whiteSpace
75
float :: Parser Rational float = (decimal >>= fractExponent) <* whiteSpace
75
float = (decimal >>= fractExponent) <* whiteSpace
50
false
true
0
7
11
25
13
12
null
null
NCrashed/PowerCom
src/powercom/Physical/Detector.hs
gpl-3.0
-- | Returns list of available serial ports in the system. -- Scans dev folder in GNU/Linux. As devices in linux are files, can find not only serial port. -- Tries serial port name patterns like "COM4" to discover serial ports in Windows. getSerialPorts :: IO [FilePath] getSerialPorts = case os of "linux" -> do fileList <- getDirectoryContents "/dev" filterM isSerialPort $ map ("/dev/" ++) fileList "windows" -> filterM isSerialPort $ take 20 $ map (("COM"++) . show) [0 :: Int ..] _ -> return [] -- | Tries to open specified serial port name. If any error occurs, then -- it is not serial port.
637
getSerialPorts :: IO [FilePath] getSerialPorts = case os of "linux" -> do fileList <- getDirectoryContents "/dev" filterM isSerialPort $ map ("/dev/" ++) fileList "windows" -> filterM isSerialPort $ take 20 $ map (("COM"++) . show) [0 :: Int ..] _ -> return [] -- | Tries to open specified serial port name. If any error occurs, then -- it is not serial port.
398
getSerialPorts = case os of "linux" -> do fileList <- getDirectoryContents "/dev" filterM isSerialPort $ map ("/dev/" ++) fileList "windows" -> filterM isSerialPort $ take 20 $ map (("COM"++) . show) [0 :: Int ..] _ -> return [] -- | Tries to open specified serial port name. If any error occurs, then -- it is not serial port.
366
true
true
3
10
144
118
60
58
null
null
tkonolige/haskell-bplist
src/Data/PList/Binary.hs
bsd-3-clause
elemLen (PData x) = B.length x
31
elemLen (PData x) = B.length x
31
elemLen (PData x) = B.length x
31
false
false
0
7
6
20
9
11
null
null
brendanhay/gogol
gogol-android-enterprise/gen/Network/Google/Resource/AndroidEnterprise/Storelayoutpages/Insert.hs
mpl-2.0
-- | V1 error format. siXgafv :: Lens' StorelayoutpagesInsert (Maybe Xgafv) siXgafv = lens _siXgafv (\ s a -> s{_siXgafv = a})
126
siXgafv :: Lens' StorelayoutpagesInsert (Maybe Xgafv) siXgafv = lens _siXgafv (\ s a -> s{_siXgafv = a})
104
siXgafv = lens _siXgafv (\ s a -> s{_siXgafv = a})
50
true
true
1
9
21
52
25
27
null
null
vikraman/ghc
compiler/hsSyn/HsExpr.hs
bsd-3-clause
ppr_cmd (HsCmdIf _ e ct ce) = sep [hsep [text "if", nest 2 (ppr e), ptext (sLit "then")], nest 4 (ppr ct), text "else", nest 4 (ppr ce)]
165
ppr_cmd (HsCmdIf _ e ct ce) = sep [hsep [text "if", nest 2 (ppr e), ptext (sLit "then")], nest 4 (ppr ct), text "else", nest 4 (ppr ce)]
165
ppr_cmd (HsCmdIf _ e ct ce) = sep [hsep [text "if", nest 2 (ppr e), ptext (sLit "then")], nest 4 (ppr ct), text "else", nest 4 (ppr ce)]
165
false
false
0
11
56
96
47
49
null
null
tsahyt/clingo-haskell
src/Clingo/Solving.hs
mit
solverWait' :: MonadIO m => Solver s -> Double -> m ResultReady solverWait' (Solver s) timeout = do x <- marshal1V $ Raw.solveHandleWait s (realToFrac timeout) pure . toRR . toBool $ x
192
solverWait' :: MonadIO m => Solver s -> Double -> m ResultReady solverWait' (Solver s) timeout = do x <- marshal1V $ Raw.solveHandleWait s (realToFrac timeout) pure . toRR . toBool $ x
192
solverWait' (Solver s) timeout = do x <- marshal1V $ Raw.solveHandleWait s (realToFrac timeout) pure . toRR . toBool $ x
128
false
true
0
11
40
82
38
44
null
null
wavewave/hoodle-render
src/Graphics/Hoodle/Render/Highlight.hs
bsd-2-clause
renderRItemHltd (RItemSVG svg _) = renderBBoxHltd svg
53
renderRItemHltd (RItemSVG svg _) = renderBBoxHltd svg
53
renderRItemHltd (RItemSVG svg _) = renderBBoxHltd svg
53
false
false
0
7
6
20
9
11
null
null
ksaveljev/hNES
NES/EmulatorHelpers.hs
mit
pop :: MonadEmulator m => m Word8 pop = do sp <- loadSP storeSP $ sp + 1 load8 $ Ram $ 0x100 + fromIntegral sp + 1
126
pop :: MonadEmulator m => m Word8 pop = do sp <- loadSP storeSP $ sp + 1 load8 $ Ram $ 0x100 + fromIntegral sp + 1
126
pop = do sp <- loadSP storeSP $ sp + 1 load8 $ Ram $ 0x100 + fromIntegral sp + 1
92
false
true
0
10
39
67
29
38
null
null
ice1000/OI-codes
codewars/101-200/counting-duplicates.hs
agpl-3.0
duplicateCount :: String -> Int duplicateCount str = duplicateCount' $ sort (map toLower str)
93
duplicateCount :: String -> Int duplicateCount str = duplicateCount' $ sort (map toLower str)
93
duplicateCount str = duplicateCount' $ sort (map toLower str)
61
false
true
0
8
13
33
16
17
null
null
sdiehl/ghc
compiler/types/Type.hs
bsd-3-clause
tyConArgFlags :: TyCon -> [Type] -> [ArgFlag] tyConArgFlags tc = fun_kind_arg_flags (tyConKind tc)
98
tyConArgFlags :: TyCon -> [Type] -> [ArgFlag] tyConArgFlags tc = fun_kind_arg_flags (tyConKind tc)
98
tyConArgFlags tc = fun_kind_arg_flags (tyConKind tc)
52
false
true
0
7
12
40
20
20
null
null
sonyxperiadev/dataflow
src/DataFlow/DFD.hs
bsd-3-clause
small s = printf "<font point-size=\"10\">%s</font>" s
54
small s = printf "<font point-size=\"10\">%s</font>" s
54
small s = printf "<font point-size=\"10\">%s</font>" s
54
false
false
1
5
6
18
6
12
null
null
spechub/Hets
OWL2/ColonKeywords.hs
gpl-2.0
sameAsC :: String sameAsC = "SameAs:"
37
sameAsC :: String sameAsC = "SameAs:"
37
sameAsC = "SameAs:"
19
false
true
0
4
5
11
6
5
null
null
Noeda/rwpas
src/RWPAS/Level/Type.hs
mit
couldPotentiallyGoThroughPortal _ DDown = False
47
couldPotentiallyGoThroughPortal _ DDown = False
47
couldPotentiallyGoThroughPortal _ DDown = False
47
false
false
0
5
4
11
5
6
null
null
ford-prefect/haskell-gi
test/testGtk.hs
lgpl-2.1
buildPopupMenu :: IO Menu buildPopupMenu = do performGC putStrLn "*** Building popup menu" menuitem <- new MenuItem [_label := "TestAsync"] on menuitem Activate $ putStrLn "Menuitem activated!" menu <- new Menu [] menuShellAppend menu menuitem widgetShowAll menu performGC putStrLn "+++ Menu constructed" return menu -- ScopeTypeAsync callback test
369
buildPopupMenu :: IO Menu buildPopupMenu = do performGC putStrLn "*** Building popup menu" menuitem <- new MenuItem [_label := "TestAsync"] on menuitem Activate $ putStrLn "Menuitem activated!" menu <- new Menu [] menuShellAppend menu menuitem widgetShowAll menu performGC putStrLn "+++ Menu constructed" return menu -- ScopeTypeAsync callback test
369
buildPopupMenu = do performGC putStrLn "*** Building popup menu" menuitem <- new MenuItem [_label := "TestAsync"] on menuitem Activate $ putStrLn "Menuitem activated!" menu <- new Menu [] menuShellAppend menu menuitem widgetShowAll menu performGC putStrLn "+++ Menu constructed" return menu -- ScopeTypeAsync callback test
343
false
true
0
10
68
101
42
59
null
null
christiaanb/Idris-dev
src/Idris/Delaborate.hs
bsd-3-clause
showSc i xs = "\n\nIn context:\n" ++ showSep "\n" (map showVar (reverse xs)) where showVar (x, y) = "\t" ++ showbasic x ++ " : " ++ show (delab i y)
150
showSc i xs = "\n\nIn context:\n" ++ showSep "\n" (map showVar (reverse xs)) where showVar (x, y) = "\t" ++ showbasic x ++ " : " ++ show (delab i y)
150
showSc i xs = "\n\nIn context:\n" ++ showSep "\n" (map showVar (reverse xs)) where showVar (x, y) = "\t" ++ showbasic x ++ " : " ++ show (delab i y)
150
false
false
0
10
32
76
37
39
null
null
TimoFreiberg/hanabi
src/Hanabi/Repl.hs
mit
hint :: IsHint a => PlayerId -> a -> IO () hint pId h = turn (hintGiven h pId)
82
hint :: IsHint a => PlayerId -> a -> IO () hint pId h = turn (hintGiven h pId)
82
hint pId h = turn (hintGiven h pId)
35
false
true
0
9
22
50
23
27
null
null
pparkkin/eta
compiler/ETA/Prelude/PrimOp.hs
bsd-3-clause
tagOf_PrimOp ReadByteArrayOp_Char = _ILIT(197)
46
tagOf_PrimOp ReadByteArrayOp_Char = _ILIT(197)
46
tagOf_PrimOp ReadByteArrayOp_Char = _ILIT(197)
46
false
false
0
6
3
15
7
8
null
null
ulricha/dsh
src/Database/DSH/SL/Builtins.hs
bsd-3-clause
antiJoinL _ _ _ = $impossible
29
antiJoinL _ _ _ = $impossible
29
antiJoinL _ _ _ = $impossible
29
false
false
0
5
5
14
6
8
null
null
HJvT/hdirect
src/Parser.hs
bsd-3-clause
action_381 (176#) = happyShift action_86
40
action_381 (176#) = happyShift action_86
40
action_381 (176#) = happyShift action_86
40
false
false
0
6
4
15
7
8
null
null