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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
codemac/yi-editor | src/Yi/Syntax/Strokes/Haskell.hs | gpl-2.0 | one :: Stroke -> Endo [Stroke]
one x = Endo (x :) | 49 | one :: Stroke -> Endo [Stroke]
one x = Endo (x :) | 49 | one x = Endo (x :) | 18 | false | true | 0 | 8 | 11 | 36 | 17 | 19 | null | null |
nevrenato/HetsAlloy | CASL/Morphism.hs | gpl-2.0 | isInclOpMap :: Op_map -> Bool
isInclOpMap = all (\ ((i, _), (j, _)) -> i == j) . Map.toList | 91 | isInclOpMap :: Op_map -> Bool
isInclOpMap = all (\ ((i, _), (j, _)) -> i == j) . Map.toList | 91 | isInclOpMap = all (\ ((i, _), (j, _)) -> i == j) . Map.toList | 61 | false | true | 0 | 9 | 18 | 61 | 32 | 29 | null | null |
kim/amazonka | amazonka-cloudtrail/gen/Network/AWS/CloudTrail/CreateTrail.hs | mpl-2.0 | -- | Specifies the Amazon S3 key prefix that precedes the name of the bucket you
-- have designated for log file delivery.
ctrS3KeyPrefix :: Lens' CreateTrailResponse (Maybe Text)
ctrS3KeyPrefix = lens _ctrS3KeyPrefix (\s a -> s { _ctrS3KeyPrefix = a }) | 253 | ctrS3KeyPrefix :: Lens' CreateTrailResponse (Maybe Text)
ctrS3KeyPrefix = lens _ctrS3KeyPrefix (\s a -> s { _ctrS3KeyPrefix = a }) | 130 | ctrS3KeyPrefix = lens _ctrS3KeyPrefix (\s a -> s { _ctrS3KeyPrefix = a }) | 73 | true | true | 0 | 9 | 41 | 47 | 26 | 21 | null | null |
alexander-at-github/eta | libraries/base/Data/Typeable/Internal.hs | bsd-3-clause | -- | Split a type constructor application
splitPolyTyConApp :: TypeRep -> (TyCon,[KindRep],[TypeRep])
splitPolyTyConApp (TypeRep _ tc ks trs) = (tc,ks,trs) | 155 | splitPolyTyConApp :: TypeRep -> (TyCon,[KindRep],[TypeRep])
splitPolyTyConApp (TypeRep _ tc ks trs) = (tc,ks,trs) | 113 | splitPolyTyConApp (TypeRep _ tc ks trs) = (tc,ks,trs) | 53 | true | true | 0 | 7 | 19 | 59 | 33 | 26 | null | null |
grumply/Ef | bench/Bench/AltState.hs | bsd-3-clause | ef_test = eval ef_add_return | 28 | ef_test = eval ef_add_return | 28 | ef_test = eval ef_add_return | 28 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
jtobin/okasaki | working/Stack.hs | mit | cons :: a -> Stack a -> Stack a
cons = Cons | 43 | cons :: a -> Stack a -> Stack a
cons = Cons | 43 | cons = Cons | 11 | false | true | 0 | 7 | 11 | 25 | 12 | 13 | null | null |
antonlogvinenko/javelin | src/Javelin/Lib/ByteCode/Attribute.hs | mit | rtInvisibleParamAnnsAttr len = do
numParameters <- Get.getWord8
annAttrs <- times (several parseAnnAttr) (fromIntegral numParameters)
return $ RTInvisibleParamAnns annAttrs | 178 | rtInvisibleParamAnnsAttr len = do
numParameters <- Get.getWord8
annAttrs <- times (several parseAnnAttr) (fromIntegral numParameters)
return $ RTInvisibleParamAnns annAttrs | 178 | rtInvisibleParamAnnsAttr len = do
numParameters <- Get.getWord8
annAttrs <- times (several parseAnnAttr) (fromIntegral numParameters)
return $ RTInvisibleParamAnns annAttrs | 178 | false | false | 0 | 10 | 23 | 52 | 23 | 29 | null | null |
kawu/adict | util/MkPoliHist.hs | bsd-2-clause | main = do
[poliPath, histPath, outPath] <- getArgs
poliEs <- Poli.parsePoliMorf <$> readFile poliPath
let poli = fromListWith (++)
[ (Poli.form x, [Poli.base x])
| x <- poliEs ]
histEs <- Hist.parseHist <$> readFile histPath
let hist = fmap S.fromList $ fromListWith (++)
[ (form, [Hist.lxId x])
| x <- histEs
, form <- Hist.forms x ]
let poliHist = Poli.joinDict poli hist
let unSet x = let f (s, y) = (S.toList s, y) in fmap f x
let xs = [(T.unpack x, unSet y) | (x, y) <- M.toList poliHist]
let dawg = D.mkDAWG (fromList xs :: IdTrie)
encodeFile outPath dawg | 665 | main = do
[poliPath, histPath, outPath] <- getArgs
poliEs <- Poli.parsePoliMorf <$> readFile poliPath
let poli = fromListWith (++)
[ (Poli.form x, [Poli.base x])
| x <- poliEs ]
histEs <- Hist.parseHist <$> readFile histPath
let hist = fmap S.fromList $ fromListWith (++)
[ (form, [Hist.lxId x])
| x <- histEs
, form <- Hist.forms x ]
let poliHist = Poli.joinDict poli hist
let unSet x = let f (s, y) = (S.toList s, y) in fmap f x
let xs = [(T.unpack x, unSet y) | (x, y) <- M.toList poliHist]
let dawg = D.mkDAWG (fromList xs :: IdTrie)
encodeFile outPath dawg | 665 | main = do
[poliPath, histPath, outPath] <- getArgs
poliEs <- Poli.parsePoliMorf <$> readFile poliPath
let poli = fromListWith (++)
[ (Poli.form x, [Poli.base x])
| x <- poliEs ]
histEs <- Hist.parseHist <$> readFile histPath
let hist = fmap S.fromList $ fromListWith (++)
[ (form, [Hist.lxId x])
| x <- histEs
, form <- Hist.forms x ]
let poliHist = Poli.joinDict poli hist
let unSet x = let f (s, y) = (S.toList s, y) in fmap f x
let xs = [(T.unpack x, unSet y) | (x, y) <- M.toList poliHist]
let dawg = D.mkDAWG (fromList xs :: IdTrie)
encodeFile outPath dawg | 665 | false | false | 1 | 17 | 206 | 307 | 149 | 158 | null | null |
EXio4/zyflex | src/Coloring.hs | gpl-3.0 | purple = Color 255 0 255 0 | 30 | purple = Color 255 0 255 0 | 30 | purple = Color 255 0 255 0 | 30 | false | false | 0 | 5 | 10 | 15 | 7 | 8 | null | null |
amccausl/Swish | Swish/HaskellRDF/VarBindingTest.hs | lgpl-2.1 | testFindComp53 = testJust "testFindComp53" jcompad | 53 | testFindComp53 = testJust "testFindComp53" jcompad | 53 | testFindComp53 = testJust "testFindComp53" jcompad | 53 | false | false | 0 | 5 | 7 | 11 | 5 | 6 | null | null |
kylcarte/harihara | src/Harihara/Lastfm/Requests.hs | bsd-3-clause | -- Request Abstractions {{{
sendRequest :: (Show a) => (Value -> Parser a) -> KeyedRequest -> Lastfm a
sendRequest prs req = do
key <- getsLastfmEnv getApiKey
logInfo "Sending request"
mjs <- io $ FM.lastfm $ req <*> key
case mjs of
Nothing -> do
logError "No response"
io $ throwIO NoResponse
Just js -> do
logInfo "Received response"
let jsonStr = C8.unpack $ encodePretty js
logDebugData "Lastfm Response" $ jsonStr
logInfo "Parsing Response"
case parseEither prs js of
Left err -> do
logErrorData "No Parse" err
io $ throwIO $ JSONParseError err
Right res -> do
logDebugData "Parse Successful" $ ppShow res
return res
-- | generic function for Last.fm's *.search call. | 788 | sendRequest :: (Show a) => (Value -> Parser a) -> KeyedRequest -> Lastfm a
sendRequest prs req = do
key <- getsLastfmEnv getApiKey
logInfo "Sending request"
mjs <- io $ FM.lastfm $ req <*> key
case mjs of
Nothing -> do
logError "No response"
io $ throwIO NoResponse
Just js -> do
logInfo "Received response"
let jsonStr = C8.unpack $ encodePretty js
logDebugData "Lastfm Response" $ jsonStr
logInfo "Parsing Response"
case parseEither prs js of
Left err -> do
logErrorData "No Parse" err
io $ throwIO $ JSONParseError err
Right res -> do
logDebugData "Parse Successful" $ ppShow res
return res
-- | generic function for Last.fm's *.search call. | 759 | sendRequest prs req = do
key <- getsLastfmEnv getApiKey
logInfo "Sending request"
mjs <- io $ FM.lastfm $ req <*> key
case mjs of
Nothing -> do
logError "No response"
io $ throwIO NoResponse
Just js -> do
logInfo "Received response"
let jsonStr = C8.unpack $ encodePretty js
logDebugData "Lastfm Response" $ jsonStr
logInfo "Parsing Response"
case parseEither prs js of
Left err -> do
logErrorData "No Parse" err
io $ throwIO $ JSONParseError err
Right res -> do
logDebugData "Parse Successful" $ ppShow res
return res
-- | generic function for Last.fm's *.search call. | 684 | true | true | 0 | 18 | 228 | 234 | 102 | 132 | null | null |
AndrewRademacher/hs-euler | src/Problem1.hs | mit | sumOf :: Int -> Int
sumOf = sum . flip takeWhile m' . (>)
where m' = [ x | x <- [1..], x `mod` 3 == 0 || x `mod` 5 == 0] | 124 | sumOf :: Int -> Int
sumOf = sum . flip takeWhile m' . (>)
where m' = [ x | x <- [1..], x `mod` 3 == 0 || x `mod` 5 == 0] | 124 | sumOf = sum . flip takeWhile m' . (>)
where m' = [ x | x <- [1..], x `mod` 3 == 0 || x `mod` 5 == 0] | 104 | false | true | 0 | 11 | 37 | 80 | 44 | 36 | null | null |
nimia/bottle | bottlelib/Graphics/UI/GLFW/Events.hs | gpl-3.0 | translate ((_, RawWindowClose) : xs) = GLFWWindowClose : translate xs | 69 | translate ((_, RawWindowClose) : xs) = GLFWWindowClose : translate xs | 69 | translate ((_, RawWindowClose) : xs) = GLFWWindowClose : translate xs | 69 | false | false | 0 | 7 | 9 | 30 | 15 | 15 | null | null |
bgaster/hlinda | TupleServer.hs | mit | createProxyServer :: NetID ->
ServerConn ->
TChan TupleServerMsg ->
[TupleServerMsg] ->
IO ()
createProxyServer myID conn reqChan initInReqs =
proxyServer myID (ConOps (sendInReqNet conn)
(sendAcceptNet conn)
(sendCancelNet conn)
(replyNet conn)) reqChan initInReqs | 468 | createProxyServer :: NetID ->
ServerConn ->
TChan TupleServerMsg ->
[TupleServerMsg] ->
IO ()
createProxyServer myID conn reqChan initInReqs =
proxyServer myID (ConOps (sendInReqNet conn)
(sendAcceptNet conn)
(sendCancelNet conn)
(replyNet conn)) reqChan initInReqs | 467 | createProxyServer myID conn reqChan initInReqs =
proxyServer myID (ConOps (sendInReqNet conn)
(sendAcceptNet conn)
(sendCancelNet conn)
(replyNet conn)) reqChan initInReqs | 261 | false | true | 0 | 10 | 234 | 92 | 45 | 47 | null | null |
sjakobi/brick | src/Brick/Widgets/FileBrowser.hs | bsd-3-clause | sanitizeFilename :: String -> String
sanitizeFilename = fmap toPrint
where
toPrint c | isPrint c = c
| otherwise = '?' | 148 | sanitizeFilename :: String -> String
sanitizeFilename = fmap toPrint
where
toPrint c | isPrint c = c
| otherwise = '?' | 148 | sanitizeFilename = fmap toPrint
where
toPrint c | isPrint c = c
| otherwise = '?' | 111 | false | true | 0 | 8 | 50 | 46 | 21 | 25 | null | null |
mrd/camfort | src/Camfort/Specification/Units/InferenceFrontend.hs | apache-2.0 | binOpKind F.NE = RelOp | 36 | binOpKind F.NE = RelOp | 36 | binOpKind F.NE = RelOp | 36 | false | false | 0 | 6 | 17 | 11 | 5 | 6 | null | null |
projectorhq/haskell-liquid | test/Text/Liquid/ParserTests.hs | bsd-3-clause | case_filterCell6 = parseOnly filterCell "replace:\'foo\',\'bar\' " @?=
Right (FilterCell "replace" [QuoteString "foo", QuoteString "bar"]) | 140 | case_filterCell6 = parseOnly filterCell "replace:\'foo\',\'bar\' " @?=
Right (FilterCell "replace" [QuoteString "foo", QuoteString "bar"]) | 140 | case_filterCell6 = parseOnly filterCell "replace:\'foo\',\'bar\' " @?=
Right (FilterCell "replace" [QuoteString "foo", QuoteString "bar"]) | 140 | false | false | 1 | 8 | 15 | 42 | 18 | 24 | null | null |
pparkkin/eta | compiler/ETA/HsSyn/HsDecls.hs | bsd-3-clause | isFamilyDecl _other = False | 34 | isFamilyDecl _other = False | 34 | isFamilyDecl _other = False | 34 | false | false | 0 | 5 | 10 | 9 | 4 | 5 | null | null |
apyrgio/snf-ganeti | src/Ganeti/Constants.hs | bsd-2-clause | -- | Entity not found
errorsEcodeNoent :: String
errorsEcodeNoent = "unknown_entity" | 84 | errorsEcodeNoent :: String
errorsEcodeNoent = "unknown_entity" | 62 | errorsEcodeNoent = "unknown_entity" | 35 | true | true | 0 | 4 | 10 | 12 | 7 | 5 | null | null |
sdiehl/ghc | testsuite/tests/printer/T14343.hs | bsd-3-clause | test2 = _ :: Proxy '[ '[ 1 ] ] | 30 | test2 = _ :: Proxy '[ '[ 1 ] ] | 30 | test2 = _ :: Proxy '[ '[ 1 ] ] | 30 | false | false | 0 | 9 | 9 | 25 | 13 | 12 | null | null |
drhodes/jade2hdl | src/Jade/Schematic.hs | bsd-3-clause | getAllPartsAtPoint :: Schematic -> Point -> J [Part]
getAllPartsAtPoint schem point = "Schematic.getAllPartsAtPoint" <? do
filterM (flip Part.hasPoint point) (getAllParts schem) | 181 | getAllPartsAtPoint :: Schematic -> Point -> J [Part]
getAllPartsAtPoint schem point = "Schematic.getAllPartsAtPoint" <? do
filterM (flip Part.hasPoint point) (getAllParts schem) | 181 | getAllPartsAtPoint schem point = "Schematic.getAllPartsAtPoint" <? do
filterM (flip Part.hasPoint point) (getAllParts schem) | 128 | false | true | 0 | 11 | 24 | 58 | 28 | 30 | null | null |
ingemaradahl/bilder | src/Compiler/Lifter.hs | lgpl-3.0 | liftFuns ∷ LM ()
liftFuns = do
funs ← sourceFunctions
mapM (liftInnerFuns . snd) (toList funs) >>= mapM_ updateSourceFunction
where
liftInnerFuns ∷ T.Function → LM T.Function
liftInnerFuns f = do
setCurrentFile (fst $ T.functionLocation f)
sequence_ [ addVarType (paramToString p) ((qualsToType . paramToQuals) p) | p ← T.parameters f ]
stms' ← funLifter (T.statements f)
return $ f { T.statements = stms' }
-- | Lifts all functions from a list of Stm | 477 | liftFuns ∷ LM ()
liftFuns = do
funs ← sourceFunctions
mapM (liftInnerFuns . snd) (toList funs) >>= mapM_ updateSourceFunction
where
liftInnerFuns ∷ T.Function → LM T.Function
liftInnerFuns f = do
setCurrentFile (fst $ T.functionLocation f)
sequence_ [ addVarType (paramToString p) ((qualsToType . paramToQuals) p) | p ← T.parameters f ]
stms' ← funLifter (T.statements f)
return $ f { T.statements = stms' }
-- | Lifts all functions from a list of Stm | 477 | liftFuns = do
funs ← sourceFunctions
mapM (liftInnerFuns . snd) (toList funs) >>= mapM_ updateSourceFunction
where
liftInnerFuns ∷ T.Function → LM T.Function
liftInnerFuns f = do
setCurrentFile (fst $ T.functionLocation f)
sequence_ [ addVarType (paramToString p) ((qualsToType . paramToQuals) p) | p ← T.parameters f ]
stms' ← funLifter (T.statements f)
return $ f { T.statements = stms' }
-- | Lifts all functions from a list of Stm | 460 | false | true | 0 | 13 | 98 | 178 | 85 | 93 | null | null |
nadavshemer/buildsome | src/Lib/Makefile/CondState.hs | gpl-2.0 | nest :: Bool -> CondState -> CondState
nest True condState@CondState{..}
| falseNesting == 0 =
condState { trueNesting = trueNesting + 1 } | 142 | nest :: Bool -> CondState -> CondState
nest True condState@CondState{..}
| falseNesting == 0 =
condState { trueNesting = trueNesting + 1 } | 142 | nest True condState@CondState{..}
| falseNesting == 0 =
condState { trueNesting = trueNesting + 1 } | 103 | false | true | 9 | 5 | 26 | 56 | 30 | 26 | null | null |
mpitid/scheme48 | Main.hs | mit | main :: IO ()
main = scheme48 | 29 | main :: IO ()
main = scheme48 | 29 | main = scheme48 | 15 | false | true | 0 | 6 | 6 | 16 | 8 | 8 | null | null |
agrafix/hackage-server | Distribution/Client/Mirror/Session.hs | bsd-3-clause | mkErrorResponse :: URI -> Response ByteString -> ErrorResponse
mkErrorResponse uri rsp =
ErrorResponse uri (rspCode rsp) (rspReason rsp) mBody
where
mBody = case lookupHeader HdrContentType (rspHeaders rsp) of
Just mimetype | "text/plain" `isPrefixOf` mimetype
-> Just (unpackUTF8 (rspBody rsp))
_ -> Nothing | 360 | mkErrorResponse :: URI -> Response ByteString -> ErrorResponse
mkErrorResponse uri rsp =
ErrorResponse uri (rspCode rsp) (rspReason rsp) mBody
where
mBody = case lookupHeader HdrContentType (rspHeaders rsp) of
Just mimetype | "text/plain" `isPrefixOf` mimetype
-> Just (unpackUTF8 (rspBody rsp))
_ -> Nothing | 360 | mkErrorResponse uri rsp =
ErrorResponse uri (rspCode rsp) (rspReason rsp) mBody
where
mBody = case lookupHeader HdrContentType (rspHeaders rsp) of
Just mimetype | "text/plain" `isPrefixOf` mimetype
-> Just (unpackUTF8 (rspBody rsp))
_ -> Nothing | 297 | false | true | 0 | 13 | 93 | 113 | 54 | 59 | null | null |
tedhag/teuler | haskell/rest-euler/src/UCeuler3.hs | gpl-3.0 | -- https://en.wikipedia.org/wiki/Prime_factor#Perfect_squares
-- https://en.wikipedia.org/wiki/Square_number
--
-- fromIntegral:
-- For example, given an Int value n, one does not simply take
-- its square root by typing sqrt n, since sqrt can only be applied
-- to Floating-point numbers. Instead, one must write
-- sqrt (fromIntegral n) to explicitly convert n to a floating-point number.
--
-- '.'
-- In Haskell, '.' works like the UNIX |, but "backwards".
perfect_squares n = takeWhile (< i) primes
where i = round . sqrt . fromIntegral $ n
-- Anonymus function that filter if the reminder
-- for n divided by n is zero, i.e. evenly divided by perfect_squares input
-- (Perfect square numbers) | 705 | perfect_squares n = takeWhile (< i) primes
where i = round . sqrt . fromIntegral $ n
-- Anonymus function that filter if the reminder
-- for n divided by n is zero, i.e. evenly divided by perfect_squares input
-- (Perfect square numbers) | 240 | perfect_squares n = takeWhile (< i) primes
where i = round . sqrt . fromIntegral $ n
-- Anonymus function that filter if the reminder
-- for n divided by n is zero, i.e. evenly divided by perfect_squares input
-- (Perfect square numbers) | 240 | true | false | 4 | 6 | 118 | 60 | 33 | 27 | null | null |
urbanslug/ghc | testsuite/tests/perf/compiler/T783.hs | bsd-3-clause | foo x | x == 315 = 315 | 22 | foo x | x == 315 = 315 | 22 | foo x | x == 315 = 315 | 22 | false | false | 0 | 8 | 7 | 23 | 9 | 14 | null | null |
schell/odin | app/Demos/Physics.hs | mit | allocDemo :: (MonadIO m, Resources s m, Rezed s m, Fonts s m)
=> m (PhysicsDemo m)
allocDemo = do
comicFont <- getFontPath "KMKDSP__.ttf"
let desc = fontDescriptor comicFont 16
title <- allocText desc white "Physics Demo"
reset <- allocButton buttonPainter "Reset"
let emptyGUI = (return (), const $ return ())
sq <- slot emptyGUI
big <- slot emptyGUI
rw <- slot emptyGUI
bw <- slot emptyGUI
flip evalStateT (emptyDemoData title reset sq big rw bw) $ do
t <- io newTime
demoTime .= t
addRenderers
resetPhysics
s <- slot =<< get
return
PhysicsDemo { demoRenderer = (freeDemoData s, renderPhysDemo s)
, pauseDemo = pauseDemoData s
, resumeDemo = resumeDemoData s
} | 787 | allocDemo :: (MonadIO m, Resources s m, Rezed s m, Fonts s m)
=> m (PhysicsDemo m)
allocDemo = do
comicFont <- getFontPath "KMKDSP__.ttf"
let desc = fontDescriptor comicFont 16
title <- allocText desc white "Physics Demo"
reset <- allocButton buttonPainter "Reset"
let emptyGUI = (return (), const $ return ())
sq <- slot emptyGUI
big <- slot emptyGUI
rw <- slot emptyGUI
bw <- slot emptyGUI
flip evalStateT (emptyDemoData title reset sq big rw bw) $ do
t <- io newTime
demoTime .= t
addRenderers
resetPhysics
s <- slot =<< get
return
PhysicsDemo { demoRenderer = (freeDemoData s, renderPhysDemo s)
, pauseDemo = pauseDemoData s
, resumeDemo = resumeDemoData s
} | 787 | allocDemo = do
comicFont <- getFontPath "KMKDSP__.ttf"
let desc = fontDescriptor comicFont 16
title <- allocText desc white "Physics Demo"
reset <- allocButton buttonPainter "Reset"
let emptyGUI = (return (), const $ return ())
sq <- slot emptyGUI
big <- slot emptyGUI
rw <- slot emptyGUI
bw <- slot emptyGUI
flip evalStateT (emptyDemoData title reset sq big rw bw) $ do
t <- io newTime
demoTime .= t
addRenderers
resetPhysics
s <- slot =<< get
return
PhysicsDemo { demoRenderer = (freeDemoData s, renderPhysDemo s)
, pauseDemo = pauseDemoData s
, resumeDemo = resumeDemoData s
} | 694 | false | true | 0 | 14 | 236 | 278 | 128 | 150 | null | null |
sgillespie/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | prodTyConName = tcQual gHC_GENERICS (fsLit ":*:") prodTyConKey | 64 | prodTyConName = tcQual gHC_GENERICS (fsLit ":*:") prodTyConKey | 64 | prodTyConName = tcQual gHC_GENERICS (fsLit ":*:") prodTyConKey | 64 | false | false | 0 | 7 | 8 | 19 | 9 | 10 | null | null |
JacquesCarette/literate-scientific-software | code/drasil-code/Language/Drasil/Mod.hs | bsd-2-clause | fname (FDef (FuncDef n _ _ _ _ _)) = n | 38 | fname (FDef (FuncDef n _ _ _ _ _)) = n | 38 | fname (FDef (FuncDef n _ _ _ _ _)) = n | 38 | false | false | 0 | 8 | 10 | 32 | 15 | 17 | null | null |
TwitterFriends/twitter-friend-server | src/SimHash.hs | bsd-3-clause | hammingDistance :: Word64 -> Word64 -> Int
hammingDistance a b = h_dist 0 (a `xor` b)
where
h_dist c v
| v == 0 = c
| otherwise = h_dist (c + 1) (v .&. (v - 1)) | 182 | hammingDistance :: Word64 -> Word64 -> Int
hammingDistance a b = h_dist 0 (a `xor` b)
where
h_dist c v
| v == 0 = c
| otherwise = h_dist (c + 1) (v .&. (v - 1)) | 182 | hammingDistance a b = h_dist 0 (a `xor` b)
where
h_dist c v
| v == 0 = c
| otherwise = h_dist (c + 1) (v .&. (v - 1)) | 139 | false | true | 0 | 9 | 59 | 110 | 51 | 59 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/Resources/EC2SecurityGroup.hs | mit | -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html#cfn-ec2-securitygroup-securitygroupingress
ecsgSecurityGroupIngress :: Lens' EC2SecurityGroup (Maybe [EC2SecurityGroupIngressProperty])
ecsgSecurityGroupIngress = lens _eC2SecurityGroupSecurityGroupIngress (\s a -> s { _eC2SecurityGroupSecurityGroupIngress = a }) | 369 | ecsgSecurityGroupIngress :: Lens' EC2SecurityGroup (Maybe [EC2SecurityGroupIngressProperty])
ecsgSecurityGroupIngress = lens _eC2SecurityGroupSecurityGroupIngress (\s a -> s { _eC2SecurityGroupSecurityGroupIngress = a }) | 220 | ecsgSecurityGroupIngress = lens _eC2SecurityGroupSecurityGroupIngress (\s a -> s { _eC2SecurityGroupSecurityGroupIngress = a }) | 127 | true | true | 0 | 9 | 21 | 49 | 27 | 22 | null | null |
GaloisInc/saw-script | rme/src/Data/RME/Vector.hs | bsd-3-clause | pdivmod_helper :: [RME] -> [RME] -> ([RME], [RME])
pdivmod_helper ds mask = go (length ds - length mask) ds
where
go :: Int -> [RME] -> ([RME], [RME])
go n cs | n <= 0 = ([], cs)
go _ [] = error "Data.AIG.Operations.pdiv: impossible"
go n (c : cs) = (c : qs, rs)
where cs' = mux_add c cs mask
(qs, rs) = go (n - 1) cs'
mux_add :: RME -> [RME] -> [RME] -> [RME]
mux_add c (x : xs) (y : ys) = RME.mux c (RME.xor x y) x : mux_add c xs ys
mux_add _ [] (_ : _ ) = error "pdiv: impossible"
mux_add _ xs [] = xs | 587 | pdivmod_helper :: [RME] -> [RME] -> ([RME], [RME])
pdivmod_helper ds mask = go (length ds - length mask) ds
where
go :: Int -> [RME] -> ([RME], [RME])
go n cs | n <= 0 = ([], cs)
go _ [] = error "Data.AIG.Operations.pdiv: impossible"
go n (c : cs) = (c : qs, rs)
where cs' = mux_add c cs mask
(qs, rs) = go (n - 1) cs'
mux_add :: RME -> [RME] -> [RME] -> [RME]
mux_add c (x : xs) (y : ys) = RME.mux c (RME.xor x y) x : mux_add c xs ys
mux_add _ [] (_ : _ ) = error "pdiv: impossible"
mux_add _ xs [] = xs | 587 | pdivmod_helper ds mask = go (length ds - length mask) ds
where
go :: Int -> [RME] -> ([RME], [RME])
go n cs | n <= 0 = ([], cs)
go _ [] = error "Data.AIG.Operations.pdiv: impossible"
go n (c : cs) = (c : qs, rs)
where cs' = mux_add c cs mask
(qs, rs) = go (n - 1) cs'
mux_add :: RME -> [RME] -> [RME] -> [RME]
mux_add c (x : xs) (y : ys) = RME.mux c (RME.xor x y) x : mux_add c xs ys
mux_add _ [] (_ : _ ) = error "pdiv: impossible"
mux_add _ xs [] = xs | 536 | false | true | 8 | 11 | 198 | 323 | 168 | 155 | null | null |
glguy/5puzzle | src/BoxDrawing.hs | isc | boxChar Nothing (Just Thin ) (Just Double) Nothing = Just '╕' | 74 | boxChar Nothing (Just Thin ) (Just Double) Nothing = Just '╕' | 74 | boxChar Nothing (Just Thin ) (Just Double) Nothing = Just '╕' | 74 | false | false | 0 | 7 | 23 | 32 | 14 | 18 | null | null |
text-utf8/text | Data/Text/Lazy.hs | bsd-2-clause | splitAtWord x (Chunk c@(T.Text arr off len) cs)
| y >= len = let h :*: t = splitAtWord (x-fromIntegral len) cs
in Chunk c h :*: t
| otherwise = chunk (text arr off y) empty :*:
chunk (text arr (off+y) (len-y)) cs
where y = fromIntegral x
-- | /O(n+m)/ Find the first instance of @needle@ (which must be
-- non-'null') in @haystack@. The first element of the returned tuple
-- is the prefix of @haystack@ before @needle@ is matched. The second
-- is the remainder of @haystack@, starting with the match.
--
-- Examples:
--
-- > breakOn "::" "a::b::c" ==> ("a", "::b::c")
-- > breakOn "/" "foobar" ==> ("foobar", "")
--
-- Laws:
--
-- > append prefix match == haystack
-- > where (prefix, match) = breakOn needle haystack
--
-- If you need to break a string by a substring repeatedly (e.g. you
-- want to break on every instance of a substring), use 'breakOnAll'
-- instead, as it has lower startup overhead.
--
-- This function is strict in its first argument, and lazy in its
-- second.
--
-- In (unlikely) bad cases, this function's time complexity degrades
-- towards /O(n*m)/. | 1,136 | splitAtWord x (Chunk c@(T.Text arr off len) cs)
| y >= len = let h :*: t = splitAtWord (x-fromIntegral len) cs
in Chunk c h :*: t
| otherwise = chunk (text arr off y) empty :*:
chunk (text arr (off+y) (len-y)) cs
where y = fromIntegral x
-- | /O(n+m)/ Find the first instance of @needle@ (which must be
-- non-'null') in @haystack@. The first element of the returned tuple
-- is the prefix of @haystack@ before @needle@ is matched. The second
-- is the remainder of @haystack@, starting with the match.
--
-- Examples:
--
-- > breakOn "::" "a::b::c" ==> ("a", "::b::c")
-- > breakOn "/" "foobar" ==> ("foobar", "")
--
-- Laws:
--
-- > append prefix match == haystack
-- > where (prefix, match) = breakOn needle haystack
--
-- If you need to break a string by a substring repeatedly (e.g. you
-- want to break on every instance of a substring), use 'breakOnAll'
-- instead, as it has lower startup overhead.
--
-- This function is strict in its first argument, and lazy in its
-- second.
--
-- In (unlikely) bad cases, this function's time complexity degrades
-- towards /O(n*m)/. | 1,136 | splitAtWord x (Chunk c@(T.Text arr off len) cs)
| y >= len = let h :*: t = splitAtWord (x-fromIntegral len) cs
in Chunk c h :*: t
| otherwise = chunk (text arr off y) empty :*:
chunk (text arr (off+y) (len-y)) cs
where y = fromIntegral x
-- | /O(n+m)/ Find the first instance of @needle@ (which must be
-- non-'null') in @haystack@. The first element of the returned tuple
-- is the prefix of @haystack@ before @needle@ is matched. The second
-- is the remainder of @haystack@, starting with the match.
--
-- Examples:
--
-- > breakOn "::" "a::b::c" ==> ("a", "::b::c")
-- > breakOn "/" "foobar" ==> ("foobar", "")
--
-- Laws:
--
-- > append prefix match == haystack
-- > where (prefix, match) = breakOn needle haystack
--
-- If you need to break a string by a substring repeatedly (e.g. you
-- want to break on every instance of a substring), use 'breakOnAll'
-- instead, as it has lower startup overhead.
--
-- This function is strict in its first argument, and lazy in its
-- second.
--
-- In (unlikely) bad cases, this function's time complexity degrades
-- towards /O(n*m)/. | 1,136 | false | false | 1 | 13 | 255 | 174 | 96 | 78 | null | null |
cgag/spock-starter | src/App.hs | bsd-3-clause | layout :: Html () -> Html ()
layout x = doctypehtml_ $
body_ $
do nav
x
where
nav = ul_ $
do li_ (a_ [href_ "/"] "home")
li_ (a_ [href_ "/login"] "login")
li_ (a_ [href_ "/register"] "register") | 299 | layout :: Html () -> Html ()
layout x = doctypehtml_ $
body_ $
do nav
x
where
nav = ul_ $
do li_ (a_ [href_ "/"] "home")
li_ (a_ [href_ "/login"] "login")
li_ (a_ [href_ "/register"] "register") | 299 | layout x = doctypehtml_ $
body_ $
do nav
x
where
nav = ul_ $
do li_ (a_ [href_ "/"] "home")
li_ (a_ [href_ "/login"] "login")
li_ (a_ [href_ "/register"] "register") | 270 | false | true | 7 | 12 | 142 | 125 | 53 | 72 | null | null |
typedvar/hLand | hcore/Heap.hs | mit | hIsNull :: Addr -> Bool
hIsNull addr = addr == 0 | 48 | hIsNull :: Addr -> Bool
hIsNull addr = addr == 0 | 48 | hIsNull addr = addr == 0 | 24 | false | true | 0 | 5 | 10 | 22 | 11 | 11 | null | null |
brendanhay/gogol | gogol-customsearch/gen/Network/Google/CustomSearch/Types/Product.hs | mpl-2.0 | -- | Specifies that all results should contain a link to a specific URL.
sqriLinkSite :: Lens' SearchQueriesRequestItem (Maybe Text)
sqriLinkSite
= lens _sqriLinkSite (\ s a -> s{_sqriLinkSite = a}) | 200 | sqriLinkSite :: Lens' SearchQueriesRequestItem (Maybe Text)
sqriLinkSite
= lens _sqriLinkSite (\ s a -> s{_sqriLinkSite = a}) | 127 | sqriLinkSite
= lens _sqriLinkSite (\ s a -> s{_sqriLinkSite = a}) | 67 | true | true | 1 | 9 | 32 | 52 | 25 | 27 | null | null |
kim/amazonka | amazonka-ec2/gen/Network/AWS/EC2/Types.hs | mpl-2.0 | -- | Adds a specific AWS account ID or group to a volume's list of create volume
-- permissions.
cvpmAdd :: Lens' CreateVolumePermissionModifications [CreateVolumePermission]
cvpmAdd = lens _cvpmAdd (\s a -> s { _cvpmAdd = a }) . _List | 235 | cvpmAdd :: Lens' CreateVolumePermissionModifications [CreateVolumePermission]
cvpmAdd = lens _cvpmAdd (\s a -> s { _cvpmAdd = a }) . _List | 138 | cvpmAdd = lens _cvpmAdd (\s a -> s { _cvpmAdd = a }) . _List | 60 | true | true | 1 | 9 | 38 | 54 | 27 | 27 | null | null |
oldmanmike/ghc | compiler/utils/Outputable.hs | bsd-3-clause | qualName (PprDump q) mod occ = queryQualifyName q mod occ | 60 | qualName (PprDump q) mod occ = queryQualifyName q mod occ | 60 | qualName (PprDump q) mod occ = queryQualifyName q mod occ | 60 | false | false | 0 | 7 | 12 | 26 | 12 | 14 | null | null |
ShaneKilkelly/YesodExample | tests/TestTools.hs | mit | doLogin :: Text -> Text -> OneSpec conn ()
doLogin user pass = do
mbloc2 <- submitLogin user pass
return () | 115 | doLogin :: Text -> Text -> OneSpec conn ()
doLogin user pass = do
mbloc2 <- submitLogin user pass
return () | 115 | doLogin user pass = do
mbloc2 <- submitLogin user pass
return () | 72 | false | true | 0 | 9 | 28 | 56 | 24 | 32 | null | null |
olsner/ghc | testsuite/tests/perf/compiler/T10370.hs | bsd-3-clause | a374 :: IO (); a374 = forever $ putStrLn "a374" | 47 | a374 :: IO ()
a374 = forever $ putStrLn "a374" | 46 | a374 = forever $ putStrLn "a374" | 32 | false | true | 0 | 6 | 9 | 24 | 12 | 12 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/showInt_1.hs | mit | primMinusNat :: Nat -> Nat -> MyInt;
primMinusNat Zero Zero = Pos Zero | 74 | primMinusNat :: Nat -> Nat -> MyInt
primMinusNat Zero Zero = Pos Zero | 73 | primMinusNat Zero Zero = Pos Zero | 33 | false | true | 0 | 6 | 16 | 28 | 14 | 14 | null | null |
abakst/liquidhaskell | src/Language/Haskell/Liquid/Desugar710/DsBinds.hs | bsd-3-clause | -- Zonker has got rid of this
dsTcEvBinds (EvBinds bs) = dsEvBinds bs | 71 | dsTcEvBinds (EvBinds bs) = dsEvBinds bs | 41 | dsTcEvBinds (EvBinds bs) = dsEvBinds bs | 41 | true | false | 0 | 7 | 14 | 19 | 9 | 10 | null | null |
Philonous/d-bus | tests/Main.hs | mit | genDBV (SDBusSimpleType STypeInt32) = DBVInt32 <$> arbitrary | 70 | genDBV (SDBusSimpleType STypeInt32) = DBVInt32 <$> arbitrary | 70 | genDBV (SDBusSimpleType STypeInt32) = DBVInt32 <$> arbitrary | 70 | false | false | 0 | 7 | 16 | 19 | 9 | 10 | null | null |
sboosali/commands-frontend-DragonNaturallySpeaking | sources/Commands/Frontends/Dragon13/Serialize.hs | bsd-3-clause | -- | serializes 'DNSProduction's into a Python @String@.
--
--
--
--
serializeProductions :: NonEmpty (DNSProduction i DNSText DNSName) -> Doc
serializeProductions (export :| productions)
= cat
. punctuate "\n"
$ serializeExport export : fmap serializeProduction productions | 277 | serializeProductions :: NonEmpty (DNSProduction i DNSText DNSName) -> Doc
serializeProductions (export :| productions)
= cat
. punctuate "\n"
$ serializeExport export : fmap serializeProduction productions | 208 | serializeProductions (export :| productions)
= cat
. punctuate "\n"
$ serializeExport export : fmap serializeProduction productions | 134 | true | true | 3 | 8 | 39 | 68 | 34 | 34 | null | null |
jtapolczai/FileSync | System/IO/FileSync/STM/Utils.hs | apache-2.0 | -- |Executes a collection of actions with a thread pool,
-- gathering the results in a qeue.
--
-- The function blocks until all actions have finished.
-- Ordering of the results is not guaranteed;
-- they are inserted as each task finishes.
--
-- This function is morally identical to 'Control.Parallel.Strategies.parMap'
-- in Control.Parallel.Strategies, with the difference that it takes
-- an @a -> IO b@ instead of @a -> b@.
parMapSTM :: (a -> IO b)
-- ^The function which is to be applied to each element
-- of the input.
-> [a]
-- ^Input data.
-> IO [b]
parMapSTM f inp = do
remaining <- atomically $ newTVar $ length inp
results <- atomically newTQueue
traverse_ (f' remaining results) inp
atomically (readTVar remaining >>= check . (<=0))
atomically (readWholeQueue results)
where
f' remaining results n =
forkIO (do result <- f n
atomically (writeTQueue results result
>> modifyTVar remaining (subtract 1))) | 1,070 | parMapSTM :: (a -> IO b)
-- ^The function which is to be applied to each element
-- of the input.
-> [a]
-- ^Input data.
-> IO [b]
parMapSTM f inp = do
remaining <- atomically $ newTVar $ length inp
results <- atomically newTQueue
traverse_ (f' remaining results) inp
atomically (readTVar remaining >>= check . (<=0))
atomically (readWholeQueue results)
where
f' remaining results n =
forkIO (do result <- f n
atomically (writeTQueue results result
>> modifyTVar remaining (subtract 1))) | 632 | parMapSTM f inp = do
remaining <- atomically $ newTVar $ length inp
results <- atomically newTQueue
traverse_ (f' remaining results) inp
atomically (readTVar remaining >>= check . (<=0))
atomically (readWholeQueue results)
where
f' remaining results n =
forkIO (do result <- f n
atomically (writeTQueue results result
>> modifyTVar remaining (subtract 1))) | 441 | true | true | 0 | 14 | 305 | 196 | 98 | 98 | null | null |
spechub/Hets | TopHybrid/Print_AS.hs | gpl-2.0 | {- the use of the function makeNamed is vacuous, it is only needed
to satisfy the types of the print_named function -}
printFormula :: Frm_Wrap -> Doc
printFormula (Frm_Wrap l f) = case f of
UnderLogic f' -> print_named l $ makeNamed "" f'
f' -> pretty f' | 317 | printFormula :: Frm_Wrap -> Doc
printFormula (Frm_Wrap l f) = case f of
UnderLogic f' -> print_named l $ makeNamed "" f'
f' -> pretty f' | 198 | printFormula (Frm_Wrap l f) = case f of
UnderLogic f' -> print_named l $ makeNamed "" f'
f' -> pretty f' | 166 | true | true | 0 | 9 | 109 | 61 | 29 | 32 | null | null |
achirkin/BuildWrapper | src-exe/Language/Haskell/BuildWrapper/CMD.hs | bsd-3-clause | mcleanimports :: BWCmd
mcleanimports = CleanImports tf cp cf uf co fp formatF mcc lc | 85 | mcleanimports :: BWCmd
mcleanimports = CleanImports tf cp cf uf co fp formatF mcc lc | 84 | mcleanimports = CleanImports tf cp cf uf co fp formatF mcc lc | 61 | false | true | 0 | 5 | 15 | 30 | 15 | 15 | null | null |
neosam/esge | src/Esge/Core.hs | bsd-3-clause | -- | Get storge with given key
storageGetA :: String -> Action (Maybe Storage)
storageGetA k = do
ingame <- getIngame
return $ storageGet k ingame
-- | Got storage with given key from Storage List | 206 | storageGetA :: String -> Action (Maybe Storage)
storageGetA k = do
ingame <- getIngame
return $ storageGet k ingame
-- | Got storage with given key from Storage List | 175 | storageGetA k = do
ingame <- getIngame
return $ storageGet k ingame
-- | Got storage with given key from Storage List | 127 | true | true | 0 | 8 | 45 | 48 | 23 | 25 | null | null |
epsilonhalbe/Skriptenliste | Parser.hs | bsd-3-clause | parseSkriptum :: Parser Skriptum
parseSkriptum = do a <- parseAutor
char '_'
ti <- parseTitel
char '_'
ty <- parseMTyp
char '_'
tm <- parseMSemester
char '_'
y <- parseMJahr
return $ Skriptum a ti tm y Nothing ty | 383 | parseSkriptum :: Parser Skriptum
parseSkriptum = do a <- parseAutor
char '_'
ti <- parseTitel
char '_'
ty <- parseMTyp
char '_'
tm <- parseMSemester
char '_'
y <- parseMJahr
return $ Skriptum a ti tm y Nothing ty | 383 | parseSkriptum = do a <- parseAutor
char '_'
ti <- parseTitel
char '_'
ty <- parseMTyp
char '_'
tm <- parseMSemester
char '_'
y <- parseMJahr
return $ Skriptum a ti tm y Nothing ty | 350 | false | true | 0 | 8 | 209 | 93 | 39 | 54 | null | null |
pawel-n/fingertree-tf | Data/FingerTree.hs | bsd-3-clause | addDigits2 m1 (Two a b) c d (Three e f g) m2 =
appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2 | 106 | addDigits2 m1 (Two a b) c d (Three e f g) m2 =
appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2 | 106 | addDigits2 m1 (Two a b) c d (Three e f g) m2 =
appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2 | 106 | false | false | 0 | 7 | 29 | 74 | 36 | 38 | null | null |
daniel-beard/projecteulerhaskell | Problems/p15.hs | mit | calculate :: Integer
calculate = (factorial (gridSize + gridSize)) `div` (factorial gridSize) `div` (factorial gridSize) | 120 | calculate :: Integer
calculate = (factorial (gridSize + gridSize)) `div` (factorial gridSize) `div` (factorial gridSize) | 120 | calculate = (factorial (gridSize + gridSize)) `div` (factorial gridSize) `div` (factorial gridSize) | 99 | false | true | 0 | 10 | 14 | 48 | 27 | 21 | null | null |
gnn/Hets | OWL2/Parse.hs | gpl-2.0 | objectPropertyCharacter :: CharParser st Character
objectPropertyCharacter =
choice $ map (\ f -> keyword (show f) >> return f) characters | 140 | objectPropertyCharacter :: CharParser st Character
objectPropertyCharacter =
choice $ map (\ f -> keyword (show f) >> return f) characters | 140 | objectPropertyCharacter =
choice $ map (\ f -> keyword (show f) >> return f) characters | 89 | false | true | 0 | 12 | 21 | 49 | 24 | 25 | null | null |
damoxc/ganeti | src/Ganeti/HTools/Types.hs | gpl-2.0 | opToResult :: OpResult a -> Result a
opToResult (Bad f) = Bad $ show f | 70 | opToResult :: OpResult a -> Result a
opToResult (Bad f) = Bad $ show f | 70 | opToResult (Bad f) = Bad $ show f | 33 | false | true | 2 | 9 | 14 | 43 | 18 | 25 | null | null |
frerich/pandoc | src/Text/Pandoc/Writers/LaTeX.hs | gpl-2.0 | citationsToBiblatex _ = return empty | 36 | citationsToBiblatex _ = return empty | 36 | citationsToBiblatex _ = return empty | 36 | false | false | 0 | 5 | 4 | 12 | 5 | 7 | null | null |
jleahred/katas | concurrency/haskell3/app/Main.hs | gpl-3.0 | out2 = do
putStrLn "insert char............. "
c <- getChar
out c | 79 | out2 = do
putStrLn "insert char............. "
c <- getChar
out c | 79 | out2 = do
putStrLn "insert char............. "
c <- getChar
out c | 79 | false | false | 0 | 7 | 25 | 25 | 10 | 15 | null | null |
google/codeworld | codeworld-base/src/Internal/Prelude.hs | apache-2.0 | -- | Converts a function to an operator.
--
-- Example use:
--
-- > f(x,y) = 2*x + y
-- > (%) = toOperator(f)
-- >
-- > eight = 3 % 2
--
-- This has the same effect as defining % as:
--
-- > x % y = 2*x + y
-- > eight = 3 % 2
toOperator :: ((a, b) -> c) -> (a -> b -> c)
toOperator = P.curry | 296 | toOperator :: ((a, b) -> c) -> (a -> b -> c)
toOperator = P.curry | 65 | toOperator = P.curry | 20 | true | true | 0 | 10 | 81 | 61 | 37 | 24 | null | null |
rimmington/cabal | Cabal/Distribution/Simple/Utils.hs | bsd-3-clause | ordNubRight :: (Ord a) => [a] -> [a]
ordNubRight = fst . foldr go ([], Set.empty)
where
go x p@(l, s) = if x `Set.member` s then p
else (x:l, Set.insert x s)
-- | A right-biased version of 'listUnion'.
--
-- Example:
--
-- @
-- > listUnion [1,2,3,4,3] [2,1,1]
-- [1,2,3,4,3]
-- > listUnionRight [1,2,3,4,3] [2,1,1]
-- [4,3,2,1,1]
-- @ | 381 | ordNubRight :: (Ord a) => [a] -> [a]
ordNubRight = fst . foldr go ([], Set.empty)
where
go x p@(l, s) = if x `Set.member` s then p
else (x:l, Set.insert x s)
-- | A right-biased version of 'listUnion'.
--
-- Example:
--
-- @
-- > listUnion [1,2,3,4,3] [2,1,1]
-- [1,2,3,4,3]
-- > listUnionRight [1,2,3,4,3] [2,1,1]
-- [4,3,2,1,1]
-- @ | 381 | ordNubRight = fst . foldr go ([], Set.empty)
where
go x p@(l, s) = if x `Set.member` s then p
else (x:l, Set.insert x s)
-- | A right-biased version of 'listUnion'.
--
-- Example:
--
-- @
-- > listUnion [1,2,3,4,3] [2,1,1]
-- [1,2,3,4,3]
-- > listUnionRight [1,2,3,4,3] [2,1,1]
-- [4,3,2,1,1]
-- @ | 344 | false | true | 0 | 8 | 108 | 115 | 68 | 47 | null | null |
haskell-distributed/distributed-process-extras | tests/TestPrimitives.hs | bsd-3-clause | testLinkingWithNormalExits :: TestResult DiedReason -> Process ()
testLinkingWithNormalExits result = do
testPid <- getSelfPid
pid <- spawnLocal $ do
worker <- spawnLocal $ do
"finish" <- expect
return ()
linkOnFailure worker
send testPid worker
() <- expect
return ()
workerPid <- expect :: Process ProcessId
ref <- monitor workerPid
send workerPid "finish"
receiveWait [
matchIf (\(ProcessMonitorNotification ref' _ _) -> ref == ref')
(\_ -> return ())
]
-- by now, the worker is gone, so we can check that the
-- insulator is still alive and well and that it exits normally
-- when asked to do so
ref2 <- monitor pid
send pid ()
r <- receiveWait [
matchIf (\(ProcessMonitorNotification ref2' _ _) -> ref2 == ref2')
(\(ProcessMonitorNotification _ _ reason) -> return reason)
]
stash result r | 904 | testLinkingWithNormalExits :: TestResult DiedReason -> Process ()
testLinkingWithNormalExits result = do
testPid <- getSelfPid
pid <- spawnLocal $ do
worker <- spawnLocal $ do
"finish" <- expect
return ()
linkOnFailure worker
send testPid worker
() <- expect
return ()
workerPid <- expect :: Process ProcessId
ref <- monitor workerPid
send workerPid "finish"
receiveWait [
matchIf (\(ProcessMonitorNotification ref' _ _) -> ref == ref')
(\_ -> return ())
]
-- by now, the worker is gone, so we can check that the
-- insulator is still alive and well and that it exits normally
-- when asked to do so
ref2 <- monitor pid
send pid ()
r <- receiveWait [
matchIf (\(ProcessMonitorNotification ref2' _ _) -> ref2 == ref2')
(\(ProcessMonitorNotification _ _ reason) -> return reason)
]
stash result r | 904 | testLinkingWithNormalExits result = do
testPid <- getSelfPid
pid <- spawnLocal $ do
worker <- spawnLocal $ do
"finish" <- expect
return ()
linkOnFailure worker
send testPid worker
() <- expect
return ()
workerPid <- expect :: Process ProcessId
ref <- monitor workerPid
send workerPid "finish"
receiveWait [
matchIf (\(ProcessMonitorNotification ref' _ _) -> ref == ref')
(\_ -> return ())
]
-- by now, the worker is gone, so we can check that the
-- insulator is still alive and well and that it exits normally
-- when asked to do so
ref2 <- monitor pid
send pid ()
r <- receiveWait [
matchIf (\(ProcessMonitorNotification ref2' _ _) -> ref2 == ref2')
(\(ProcessMonitorNotification _ _ reason) -> return reason)
]
stash result r | 838 | false | true | 0 | 17 | 239 | 278 | 127 | 151 | null | null |
pjones/xmonad-test | vendor/xmonad/src/XMonad/Core.hs | bsd-2-clause | -- | spawn. Launch an external application. Specifically, it double-forks and
-- runs the 'String' you pass as a command to \/bin\/sh.
--
-- Note this function assumes your locale uses utf8.
spawn :: MonadIO m => String -> m ()
spawn x = spawnPID x >> return () | 261 | spawn :: MonadIO m => String -> m ()
spawn x = spawnPID x >> return () | 70 | spawn x = spawnPID x >> return () | 33 | true | true | 0 | 8 | 48 | 46 | 23 | 23 | null | null |
UCSD-PL/RefScript | src/Language/Rsc/Liquid/Checker.hs | bsd-3-clause | consExprT g e t = consCall g l exprTId [(e, Just t)] (idTy t)
where
l = getAnnotation e
exprTId = builtinOpId BIExprT :: Identifier
-------------------------------------------------------------------------------- | 241 | consExprT g e t = consCall g l exprTId [(e, Just t)] (idTy t)
where
l = getAnnotation e
exprTId = builtinOpId BIExprT :: Identifier
-------------------------------------------------------------------------------- | 241 | consExprT g e t = consCall g l exprTId [(e, Just t)] (idTy t)
where
l = getAnnotation e
exprTId = builtinOpId BIExprT :: Identifier
-------------------------------------------------------------------------------- | 241 | false | false | 0 | 8 | 54 | 65 | 33 | 32 | null | null |
ice1000/Kt2Dart | src/LexicalStructure.hs | agpl-3.0 | --
unicodeEscapeSequeceP :: Parser String
unicodeEscapeSequeceP = do
stringP "\\u"
a <- hexDigitP
b <- hexDigitP
c <- hexDigitP
d <- hexDigitP
return $ "\\u{" ++ [a, b, c, d] ++ "}"
-- | 197 | unicodeEscapeSequeceP :: Parser String
unicodeEscapeSequeceP = do
stringP "\\u"
a <- hexDigitP
b <- hexDigitP
c <- hexDigitP
d <- hexDigitP
return $ "\\u{" ++ [a, b, c, d] ++ "}"
-- | 193 | unicodeEscapeSequeceP = do
stringP "\\u"
a <- hexDigitP
b <- hexDigitP
c <- hexDigitP
d <- hexDigitP
return $ "\\u{" ++ [a, b, c, d] ++ "}"
-- | 154 | true | true | 0 | 9 | 45 | 77 | 38 | 39 | null | null |
lukexi/rumpus | src/Rumpus/Systems/Controls.hs | bsd-3-clause | hapticPulse :: (MonadIO m, MonadState ECS m) => WhichHand -> CUShort -> m ()
hapticPulse whichHand duration = do
let axis = 0 -- none of the others seem to work??
vrPal <- getVRPal
triggerHandHapticPulse vrPal whichHand axis duration
-- FIXME should update and get hndHead instead | 293 | hapticPulse :: (MonadIO m, MonadState ECS m) => WhichHand -> CUShort -> m ()
hapticPulse whichHand duration = do
let axis = 0 -- none of the others seem to work??
vrPal <- getVRPal
triggerHandHapticPulse vrPal whichHand axis duration
-- FIXME should update and get hndHead instead | 293 | hapticPulse whichHand duration = do
let axis = 0 -- none of the others seem to work??
vrPal <- getVRPal
triggerHandHapticPulse vrPal whichHand axis duration
-- FIXME should update and get hndHead instead | 216 | false | true | 0 | 9 | 59 | 76 | 37 | 39 | null | null |
sboosali/commands | commands-core/bench/Bench.hs | mit | -- main = defaultMainWith defaultConfig
-- [ bgroup "parse"
-- [ benchParse (root^.comRule) "replace par round grave camel lit with async break break action with blank" --
-- ]
-- ]
-- main = time (nf (either (error.show) show . runRuleParser rule) (words s))
main = do
(Measured{measTime},_) <- measure (nf (either (error.show) show . runRuleParser (root^.comRule)) (words "replace par round grave camel lit with async break break action with blank")) 1
print $ measTime | 481 | main = do
(Measured{measTime},_) <- measure (nf (either (error.show) show . runRuleParser (root^.comRule)) (words "replace par round grave camel lit with async break break action with blank")) 1
print $ measTime | 213 | main = do
(Measured{measTime},_) <- measure (nf (either (error.show) show . runRuleParser (root^.comRule)) (words "replace par round grave camel lit with async break break action with blank")) 1
print $ measTime | 213 | true | false | 0 | 15 | 84 | 84 | 45 | 39 | null | null |
voidlizard/ntced-tcp-proxy | contrib/msgpack/src/Data/MessagePack/Object.hs | mit | getObject :: Get Object
getObject =
ObjectNil <$ getNil
<|> ObjectBool <$> getBool
<|> ObjectInt <$> getInt
<|> ObjectFloat <$> getFloat
<|> ObjectDouble <$> getDouble
<|> ObjectStr <$> getStr
<|> ObjectBin <$> getBin
<|> ObjectArray <$> getArray getObject
<|> ObjectMap <$> getMap getObject getObject
<|> uncurry ObjectExt <$> getExt | 378 | getObject :: Get Object
getObject =
ObjectNil <$ getNil
<|> ObjectBool <$> getBool
<|> ObjectInt <$> getInt
<|> ObjectFloat <$> getFloat
<|> ObjectDouble <$> getDouble
<|> ObjectStr <$> getStr
<|> ObjectBin <$> getBin
<|> ObjectArray <$> getArray getObject
<|> ObjectMap <$> getMap getObject getObject
<|> uncurry ObjectExt <$> getExt | 378 | getObject =
ObjectNil <$ getNil
<|> ObjectBool <$> getBool
<|> ObjectInt <$> getInt
<|> ObjectFloat <$> getFloat
<|> ObjectDouble <$> getDouble
<|> ObjectStr <$> getStr
<|> ObjectBin <$> getBin
<|> ObjectArray <$> getArray getObject
<|> ObjectMap <$> getMap getObject getObject
<|> uncurry ObjectExt <$> getExt | 354 | false | true | 27 | 6 | 92 | 129 | 67 | 62 | null | null |
kylcarte/type-combinators-quote | src/Data/Type/Index/Quote.hs | bsd-3-clause | qI :: QuasiQuoter
qI = QuasiQuoter
{ quoteExp = parseAsNatTerm qq varE [|IZ|] $ \x -> [|IS $x|]
, quotePat = parseAsNatTerm qq varP [p|IZ|] $ \x -> [p|IS $x|]
, quoteType = stub qq "quoteType"
, quoteDec = stub qq "quoteDec"
}
where
qq = "qI" | 260 | qI :: QuasiQuoter
qI = QuasiQuoter
{ quoteExp = parseAsNatTerm qq varE [|IZ|] $ \x -> [|IS $x|]
, quotePat = parseAsNatTerm qq varP [p|IZ|] $ \x -> [p|IS $x|]
, quoteType = stub qq "quoteType"
, quoteDec = stub qq "quoteDec"
}
where
qq = "qI" | 260 | qI = QuasiQuoter
{ quoteExp = parseAsNatTerm qq varE [|IZ|] $ \x -> [|IS $x|]
, quotePat = parseAsNatTerm qq varP [p|IZ|] $ \x -> [p|IS $x|]
, quoteType = stub qq "quoteType"
, quoteDec = stub qq "quoteDec"
}
where
qq = "qI" | 242 | false | true | 0 | 8 | 64 | 105 | 62 | 43 | null | null |
kovach/web | res0/Parser.hs | gpl-2.0 | rhs_ :: Parser [Effect]
rhs_ = pattern_ | 39 | rhs_ :: Parser [Effect]
rhs_ = pattern_ | 39 | rhs_ = pattern_ | 15 | false | true | 0 | 7 | 6 | 23 | 10 | 13 | null | null |
brownplt/strobe-old | src/BrownPLT/TypedJS/PrettyPrint.hs | bsd-2-clause | yExpr :: Maybe (Expression a) -> Doc
yExpr Nothing = empty | 58 | yExpr :: Maybe (Expression a) -> Doc
yExpr Nothing = empty | 58 | yExpr Nothing = empty | 21 | false | true | 0 | 8 | 10 | 27 | 13 | 14 | null | null |
erantapaa/happstack-server | src/Happstack/Server/Internal/RFC822Headers.hs | bsd-3-clause | pHeader :: Parser Header
pHeader =
do name <- many1 headerNameChar
void $ char ':'
void $ many ws1
line <- lineString
void crLf
extraLines <- many extraFieldLine
return (map toLower name, concat (line:extraLines)) | 259 | pHeader :: Parser Header
pHeader =
do name <- many1 headerNameChar
void $ char ':'
void $ many ws1
line <- lineString
void crLf
extraLines <- many extraFieldLine
return (map toLower name, concat (line:extraLines)) | 259 | pHeader =
do name <- many1 headerNameChar
void $ char ':'
void $ many ws1
line <- lineString
void crLf
extraLines <- many extraFieldLine
return (map toLower name, concat (line:extraLines)) | 234 | false | true | 0 | 11 | 79 | 94 | 41 | 53 | null | null |
FranklinChen/Idris-dev | src/IRTS/CodegenC.hs | bsd-3-clause | doOp v (LASHR ITNative) [l, r] = v ++ "INTOP(>>," ++ creg l ++ ", " ++ creg r ++ ")" | 84 | doOp v (LASHR ITNative) [l, r] = v ++ "INTOP(>>," ++ creg l ++ ", " ++ creg r ++ ")" | 84 | doOp v (LASHR ITNative) [l, r] = v ++ "INTOP(>>," ++ creg l ++ ", " ++ creg r ++ ")" | 84 | false | false | 0 | 9 | 20 | 54 | 25 | 29 | null | null |
deech/LibClang | src/Clang/Type.hs | bsd-3-clause | getOffsetOf :: ClangBase m => FFI.Type s' -> B.ByteString
-> ClangT s m (Either FFI.TypeLayoutError Int64)
getOffsetOf = FFI.type_getOffsetOf | 153 | getOffsetOf :: ClangBase m => FFI.Type s' -> B.ByteString
-> ClangT s m (Either FFI.TypeLayoutError Int64)
getOffsetOf = FFI.type_getOffsetOf | 153 | getOffsetOf = FFI.type_getOffsetOf | 34 | false | true | 0 | 11 | 30 | 52 | 25 | 27 | null | null |
denibertovic/dummy-api | src/Dummy/Api/Api.hs | bsd-3-clause | updateBoard :: Int64 -> Board -> AppM Board
updateBoard i b = do
board <- runDb $ get ((toSqlKey i) :: Key Board)
case board of
Nothing -> lift $ left err404
Just _ -> do
runDb $ update (toSqlKey i) $ boardToUpdate b
return b | 297 | updateBoard :: Int64 -> Board -> AppM Board
updateBoard i b = do
board <- runDb $ get ((toSqlKey i) :: Key Board)
case board of
Nothing -> lift $ left err404
Just _ -> do
runDb $ update (toSqlKey i) $ boardToUpdate b
return b | 297 | updateBoard i b = do
board <- runDb $ get ((toSqlKey i) :: Key Board)
case board of
Nothing -> lift $ left err404
Just _ -> do
runDb $ update (toSqlKey i) $ boardToUpdate b
return b | 253 | false | true | 0 | 16 | 117 | 114 | 52 | 62 | null | null |
nau/lasca-compiler | src/lib/Lasca/Parser.hs | bsd-3-clause | valdef f = do
try $ lookAhead valdefPrefix -- if expression starts with 'ident =' then we consume it and expect a valid value binding,
i <- valdefPrefix -- otherwise, alternate to unnamedStmt
e <- expr
return (f (Name i) e)
<?> "name binding (e.g. four = 2 + 2)"
where
valdefPrefix = do
ident <- identifier
option TypeAny typeAscription
reservedOp "="
return ident | 433 | valdef f = do
try $ lookAhead valdefPrefix -- if expression starts with 'ident =' then we consume it and expect a valid value binding,
i <- valdefPrefix -- otherwise, alternate to unnamedStmt
e <- expr
return (f (Name i) e)
<?> "name binding (e.g. four = 2 + 2)"
where
valdefPrefix = do
ident <- identifier
option TypeAny typeAscription
reservedOp "="
return ident | 433 | valdef f = do
try $ lookAhead valdefPrefix -- if expression starts with 'ident =' then we consume it and expect a valid value binding,
i <- valdefPrefix -- otherwise, alternate to unnamedStmt
e <- expr
return (f (Name i) e)
<?> "name binding (e.g. four = 2 + 2)"
where
valdefPrefix = do
ident <- identifier
option TypeAny typeAscription
reservedOp "="
return ident | 433 | false | false | 4 | 11 | 132 | 102 | 41 | 61 | null | null |
tolysz/postgresql-simple | src/Database/PostgreSQL/Simple/Internal.hs | bsd-3-clause | escapeStringConn :: Connection -> ByteString -> IO (Either ByteString ByteString)
escapeStringConn = escapeWrap PQ.escapeStringConn | 131 | escapeStringConn :: Connection -> ByteString -> IO (Either ByteString ByteString)
escapeStringConn = escapeWrap PQ.escapeStringConn | 131 | escapeStringConn = escapeWrap PQ.escapeStringConn | 49 | false | true | 0 | 9 | 13 | 35 | 17 | 18 | null | null |
phischu/fragnix | tests/packages/scotty/Data.CaseInsensitive.Internal.hs | bsd-3-clause | -- | Make the given string-like value case insensitive.
mk :: FoldCase s => s -> CI s
mk s = CI s (foldCase s) | 110 | mk :: FoldCase s => s -> CI s
mk s = CI s (foldCase s) | 54 | mk s = CI s (foldCase s) | 24 | true | true | 0 | 7 | 24 | 43 | 20 | 23 | null | null |
GaloisInc/halvm-ghc | compiler/stranal/WwLib.hs | bsd-3-clause | deepSplitCprType_maybe _ _ _ = Nothing | 38 | deepSplitCprType_maybe _ _ _ = Nothing | 38 | deepSplitCprType_maybe _ _ _ = Nothing | 38 | false | false | 0 | 5 | 5 | 13 | 6 | 7 | null | null |
Icelandjack/lens | src/Control/Lens/Lens.hs | bsd-3-clause | -- | A version of ('Control.Lens.Setter.%=') that works on 'ALens'.
( #%= ) :: MonadState s m => ALens s s a b -> (a -> b) -> m ()
l #%= f = modify (l #%~ f) | 157 | ( #%= ) :: MonadState s m => ALens s s a b -> (a -> b) -> m ()
l #%= f = modify (l #%~ f) | 89 | l #%= f = modify (l #%~ f) | 26 | true | true | 0 | 11 | 37 | 71 | 35 | 36 | null | null |
tabemann/amphibian | src_old/Network/IRC/Client/Amphibian/Frontend/Vty/VtyWindowServer.hs | bsd-3-clause | waitStop :: VtyWindowServerStopResponse -> STM (Either Error ())
waitStop (VtyWindowServerStopResponse response) = readTMVar response | 133 | waitStop :: VtyWindowServerStopResponse -> STM (Either Error ())
waitStop (VtyWindowServerStopResponse response) = readTMVar response | 133 | waitStop (VtyWindowServerStopResponse response) = readTMVar response | 68 | false | true | 0 | 9 | 13 | 40 | 19 | 21 | null | null |
mdsteele/fallback | src/Fallback/Control/Error.hs | gpl-3.0 | onlyIO :: IO a -> IOEO a
onlyIO = IOEO . fmap pure | 50 | onlyIO :: IO a -> IOEO a
onlyIO = IOEO . fmap pure | 50 | onlyIO = IOEO . fmap pure | 25 | false | true | 0 | 6 | 12 | 28 | 13 | 15 | null | null |
kosmoskatten/programmable-endpoint | src/Simulation/Node/SystemCounter.hs | mit | -- | Create an empty system counter.
create :: SystemCounter
create = SystemCounter 0 0 0 0 | 91 | create :: SystemCounter
create = SystemCounter 0 0 0 0 | 54 | create = SystemCounter 0 0 0 0 | 30 | true | true | 0 | 6 | 16 | 31 | 12 | 19 | null | null |
aburnett88/HSat | tests-src/TestUtils.hs | mit | listsContainSame a b =
counterexample ("Lists inconsistant" ++ show a ++ show b) False | 88 | listsContainSame a b =
counterexample ("Lists inconsistant" ++ show a ++ show b) False | 88 | listsContainSame a b =
counterexample ("Lists inconsistant" ++ show a ++ show b) False | 88 | false | false | 0 | 9 | 15 | 35 | 15 | 20 | null | null |
cdettmering/tae | Player.hs | gpl-3.0 | inventoryString (Player _ objs) = "\nYou are carrying: " ++ (L.intercalate ", " (O.names objs)) | 95 | inventoryString (Player _ objs) = "\nYou are carrying: " ++ (L.intercalate ", " (O.names objs)) | 95 | inventoryString (Player _ objs) = "\nYou are carrying: " ++ (L.intercalate ", " (O.names objs)) | 95 | false | false | 0 | 10 | 14 | 40 | 19 | 21 | null | null |
sdiehl/ghc | libraries/base/GHC/Enum.hs | bsd-3-clause | -- See Note [Inline FB functions] in GHC.List
enumDeltaIntegerFB :: (Integer -> b -> b) -> Integer -> Integer -> b
enumDeltaIntegerFB c x0 d = go x0
where go x = x `seq` (x `c` go (x+d))
| 190 | enumDeltaIntegerFB :: (Integer -> b -> b) -> Integer -> Integer -> b
enumDeltaIntegerFB c x0 d = go x0
where go x = x `seq` (x `c` go (x+d))
| 144 | enumDeltaIntegerFB c x0 d = go x0
where go x = x `seq` (x `c` go (x+d))
| 75 | true | true | 0 | 10 | 41 | 80 | 43 | 37 | null | null |
sejdm/smartWallpaper | src/Calendar.hs | bsd-3-clause | -- Filters only the matching dates to avoid a space leak owing to loading everything at once.
takeOnlyDays n d = filter (\w -> let d' = (fst) w in any ((flip matchDay d')) (dayRange n d)) | 187 | takeOnlyDays n d = filter (\w -> let d' = (fst) w in any ((flip matchDay d')) (dayRange n d)) | 93 | takeOnlyDays n d = filter (\w -> let d' = (fst) w in any ((flip matchDay d')) (dayRange n d)) | 93 | true | false | 1 | 13 | 36 | 68 | 32 | 36 | null | null |
athanclark/Idris-dev | src/Idris/Reflection.hs | bsd-3-clause | reifyPair :: (Term -> ElabD a) -> (Term -> ElabD b) -> Term -> ElabD (a, b)
reifyPair left right (App _ (App _ (App _ (App _ (P _ n _) _) _) x) y)
| n == pairCon = liftM2 (,) (left x) (right y) | 195 | reifyPair :: (Term -> ElabD a) -> (Term -> ElabD b) -> Term -> ElabD (a, b)
reifyPair left right (App _ (App _ (App _ (App _ (P _ n _) _) _) x) y)
| n == pairCon = liftM2 (,) (left x) (right y) | 195 | reifyPair left right (App _ (App _ (App _ (App _ (P _ n _) _) _) x) y)
| n == pairCon = liftM2 (,) (left x) (right y) | 119 | false | true | 0 | 15 | 48 | 141 | 70 | 71 | null | null |
bos/statistics | Statistics/Distribution/Poisson/Internal.hs | bsd-2-clause | -- | Returns the average of the upper and lower bounds accounding to
-- theorem 2.
alyThm2 :: Double -> [Double] -> [Double] -> Double
alyThm2 lambda upper lower =
alyThm2Upper lambda upper + 0.5 * (zipCoefficients lambda lower) | 230 | alyThm2 :: Double -> [Double] -> [Double] -> Double
alyThm2 lambda upper lower =
alyThm2Upper lambda upper + 0.5 * (zipCoefficients lambda lower) | 147 | alyThm2 lambda upper lower =
alyThm2Upper lambda upper + 0.5 * (zipCoefficients lambda lower) | 95 | true | true | 0 | 8 | 40 | 59 | 31 | 28 | null | null |
changlinli/nikki | src/Sorts/Robots/Jetpack.hs | lgpl-3.0 | antiGravity =
CM.scale (Vector 0 v) jetpackMass
where
v = (- gravity) + jetpackGravity | 96 | antiGravity =
CM.scale (Vector 0 v) jetpackMass
where
v = (- gravity) + jetpackGravity | 96 | antiGravity =
CM.scale (Vector 0 v) jetpackMass
where
v = (- gravity) + jetpackGravity | 96 | false | false | 1 | 7 | 23 | 41 | 19 | 22 | null | null |
patrickherrmann/advent2016 | src/Day09.hs | bsd-3-clause | decompress1 :: Text -> Text
decompress1 t = p
where
Right p = parse plaintextP "" t
plaintextP :: Parser Text
plaintextP = mconcat <$> some (try markerP <|> charP)
charP = do
c <- anyChar
return $ toS [c]
markerP = do
(range, reps) <- do
char '('
range <- numP
char 'x'
reps <- numP
char ')'
return (range, reps)
cs <- replicateM range anyChar
let expanded = toS (concat (replicate reps cs))
return expanded | 513 | decompress1 :: Text -> Text
decompress1 t = p
where
Right p = parse plaintextP "" t
plaintextP :: Parser Text
plaintextP = mconcat <$> some (try markerP <|> charP)
charP = do
c <- anyChar
return $ toS [c]
markerP = do
(range, reps) <- do
char '('
range <- numP
char 'x'
reps <- numP
char ')'
return (range, reps)
cs <- replicateM range anyChar
let expanded = toS (concat (replicate reps cs))
return expanded | 513 | decompress1 t = p
where
Right p = parse plaintextP "" t
plaintextP :: Parser Text
plaintextP = mconcat <$> some (try markerP <|> charP)
charP = do
c <- anyChar
return $ toS [c]
markerP = do
(range, reps) <- do
char '('
range <- numP
char 'x'
reps <- numP
char ')'
return (range, reps)
cs <- replicateM range anyChar
let expanded = toS (concat (replicate reps cs))
return expanded | 485 | false | true | 0 | 14 | 182 | 198 | 91 | 107 | null | null |
np/ling | Ling/Defs.hs | bsd-3-clause | mkLet__ :: SubTerms a => Scoped a -> a
mkLet__ = mkLet_ subTerms | 64 | mkLet__ :: SubTerms a => Scoped a -> a
mkLet__ = mkLet_ subTerms | 64 | mkLet__ = mkLet_ subTerms | 25 | false | true | 0 | 7 | 12 | 28 | 13 | 15 | null | null |
HIPERFIT/futhark | src/Futhark/Analysis/SymbolTable.hs | isc | entryAliases (LoopVar _) = mempty | 33 | entryAliases (LoopVar _) = mempty | 33 | entryAliases (LoopVar _) = mempty | 33 | false | false | 0 | 7 | 4 | 15 | 7 | 8 | null | null |
ancientlanguage/haskell-analysis | grammar/src/Grammar/Common/Decompose.hs | mit | decomposeChar '\xF99B' = "\x934A" | 33 | decomposeChar '\xF99B' = "\x934A" | 33 | decomposeChar '\xF99B' = "\x934A" | 33 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
dmjio/miso | src/Miso/Subscription/History.hs | bsd-3-clause | back = FFI.back | 15 | back = FFI.back | 15 | back = FFI.back | 15 | false | false | 0 | 5 | 2 | 8 | 4 | 4 | null | null |
AndrewRademacher/stack | src/Path/Extra.hs | bsd-3-clause | rejectMissingFile (Just p) = bool Nothing (Just p) `liftM` doesFileExist p | 74 | rejectMissingFile (Just p) = bool Nothing (Just p) `liftM` doesFileExist p | 74 | rejectMissingFile (Just p) = bool Nothing (Just p) `liftM` doesFileExist p | 74 | false | false | 0 | 8 | 10 | 36 | 17 | 19 | null | null |
kim/amazonka | amazonka-rds/gen/Network/AWS/RDS/Types.hs | mpl-2.0 | -- | Specifies the DNS address of the DB instance.
eAddress :: Lens' Endpoint (Maybe Text)
eAddress = lens _eAddress (\s a -> s { _eAddress = a }) | 146 | eAddress :: Lens' Endpoint (Maybe Text)
eAddress = lens _eAddress (\s a -> s { _eAddress = a }) | 95 | eAddress = lens _eAddress (\s a -> s { _eAddress = a }) | 55 | true | true | 2 | 9 | 28 | 55 | 25 | 30 | null | null |
purefn/naggy | src/HipBot/Naggy/Types.hs | bsd-3-clause | forkNaggy :: Naggy () -> Naggy ThreadId
forkNaggy n = naggy (forkIO . runNaggy n) | 81 | forkNaggy :: Naggy () -> Naggy ThreadId
forkNaggy n = naggy (forkIO . runNaggy n) | 81 | forkNaggy n = naggy (forkIO . runNaggy n) | 41 | false | true | 0 | 8 | 14 | 44 | 19 | 25 | null | null |
rahulmutt/ghcvm | compiler/Eta/BasicTypes/Var.hs | bsd-3-clause | isLocalId :: Var -> Bool
isLocalId (Id { idScope = LocalId _ }) = True | 70 | isLocalId :: Var -> Bool
isLocalId (Id { idScope = LocalId _ }) = True | 70 | isLocalId (Id { idScope = LocalId _ }) = True | 45 | false | true | 3 | 7 | 14 | 39 | 18 | 21 | null | null |
DougBurke/swish | tests/GraphTest.hs | lgpl-2.1 | eq2hs1, eq2hs2 :: [Arc (ScopedLabel LabelMem)]
eq2hs1 = [t10_1,t11_1,t12_1] | 80 | eq2hs1, eq2hs2 :: [Arc (ScopedLabel LabelMem)]
eq2hs1 = [t10_1,t11_1,t12_1] | 80 | eq2hs1 = [t10_1,t11_1,t12_1] | 33 | false | true | 2 | 8 | 13 | 39 | 20 | 19 | null | null |
tyoko-dev/rwhile-B-haskell | src/Trans.hs | agpl-3.0 | transRep' ns q r = error $ "impossible happened in Trans.transRep': " ++ show q ++ ", " ++ show r | 97 | transRep' ns q r = error $ "impossible happened in Trans.transRep': " ++ show q ++ ", " ++ show r | 97 | transRep' ns q r = error $ "impossible happened in Trans.transRep': " ++ show q ++ ", " ++ show r | 97 | false | false | 0 | 8 | 20 | 35 | 16 | 19 | null | null |
garetxe/cabal | cabal-install/Distribution/Client/Sandbox/Timestamp.hs | bsd-3-clause | -- | Helper for implementing 'withAddTimestamps' and
-- 'withRemoveTimestamps'. Runs a given action on the list of
-- 'AddSourceTimestamp's for all compilers, applies 'f' to the result and then
-- updates the timestamp file. The IO action is run only once.
withActionOnAllTimestamps :: ([AddSourceTimestamp] -> [FilePath]
-> [AddSourceTimestamp])
-> FilePath
-> IO [FilePath]
-> IO ()
withActionOnAllTimestamps f sandboxDir act =
withTimestampFile sandboxDir $ \timestampRecords -> do
paths <- act
return [(key, f timestamps paths) | (key, timestamps) <- timestampRecords]
-- | Helper for implementing 'withUpdateTimestamps'. Runs a given action on the
-- list of 'AddSourceTimestamp's for this compiler, applies 'f' to the result
-- and then updates the timestamp file record. The IO action is run only once. | 937 | withActionOnAllTimestamps :: ([AddSourceTimestamp] -> [FilePath]
-> [AddSourceTimestamp])
-> FilePath
-> IO [FilePath]
-> IO ()
withActionOnAllTimestamps f sandboxDir act =
withTimestampFile sandboxDir $ \timestampRecords -> do
paths <- act
return [(key, f timestamps paths) | (key, timestamps) <- timestampRecords]
-- | Helper for implementing 'withUpdateTimestamps'. Runs a given action on the
-- list of 'AddSourceTimestamp's for this compiler, applies 'f' to the result
-- and then updates the timestamp file record. The IO action is run only once. | 680 | withActionOnAllTimestamps f sandboxDir act =
withTimestampFile sandboxDir $ \timestampRecords -> do
paths <- act
return [(key, f timestamps paths) | (key, timestamps) <- timestampRecords]
-- | Helper for implementing 'withUpdateTimestamps'. Runs a given action on the
-- list of 'AddSourceTimestamp's for this compiler, applies 'f' to the result
-- and then updates the timestamp file record. The IO action is run only once. | 435 | true | true | 0 | 13 | 246 | 121 | 66 | 55 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.