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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sopvop/cabal | Cabal/Distribution/Version.hs | bsd-3-clause | validInterval :: (LowerBound, UpperBound) -> Bool
validInterval i@(l, u) = validLower l && validUpper u && nonEmpty i
where
validLower (LowerBound v _) = validVersion v
validUpper NoUpperBound = True
validUpper (UpperBound v _) = validVersion v
-- Check an interval is non-empty
-- | 300 | validInterval :: (LowerBound, UpperBound) -> Bool
validInterval i@(l, u) = validLower l && validUpper u && nonEmpty i
where
validLower (LowerBound v _) = validVersion v
validUpper NoUpperBound = True
validUpper (UpperBound v _) = validVersion v
-- Check an interval is non-empty
-- | 300 | validInterval i@(l, u) = validLower l && validUpper u && nonEmpty i
where
validLower (LowerBound v _) = validVersion v
validUpper NoUpperBound = True
validUpper (UpperBound v _) = validVersion v
-- Check an interval is non-empty
-- | 250 | false | true | 4 | 6 | 62 | 115 | 52 | 63 | null | null |
noughtmare/yi | yi-keymap-vim/src/Yi/Keymap/Vim/Digraph.hs | gpl-2.0 | -- LATIN SMALL LETTER S WITH ACUTE
switch 'S' '>' = '\x015C' | 60 | switch 'S' '>' = '\x015C' | 25 | switch 'S' '>' = '\x015C' | 25 | true | false | 0 | 5 | 11 | 12 | 6 | 6 | null | null |
ak3n/hseiffel | src/Codegen.hs | mit | fmul :: Operand -> Operand -> Codegen Operand
fmul a b = instr $ FMul NoFastMathFlags a b [] | 92 | fmul :: Operand -> Operand -> Codegen Operand
fmul a b = instr $ FMul NoFastMathFlags a b [] | 92 | fmul a b = instr $ FMul NoFastMathFlags a b [] | 46 | false | true | 0 | 7 | 18 | 42 | 20 | 22 | null | null |
joelkarli/chestega-cover | src/Encoding.hs | bsd-3-clause | unslice (w:ws) = unify w (head ws) : unslice (tail ws) | 54 | unslice (w:ws) = unify w (head ws) : unslice (tail ws) | 54 | unslice (w:ws) = unify w (head ws) : unslice (tail ws) | 54 | false | false | 0 | 8 | 10 | 40 | 19 | 21 | null | null |
FunctionalThinking/ninety-nine | src/Exercises.hs | mit | dropEvery :: [a] -> Int -> [a]
dropEvery [] _ = [] | 50 | dropEvery :: [a] -> Int -> [a]
dropEvery [] _ = [] | 50 | dropEvery [] _ = [] | 19 | false | true | 0 | 9 | 11 | 40 | 19 | 21 | null | null |
vikraman/ghc | compiler/coreSyn/MkCore.hs | bsd-3-clause | nonExhaustiveGuardsErrorName = err_nm "nonExhaustiveGuardsError"
nonExhaustiveGuardsErrorIdKey nON_EXHAUSTIVE_GUARDS_ERROR_ID | 159 | nonExhaustiveGuardsErrorName = err_nm "nonExhaustiveGuardsError"
nonExhaustiveGuardsErrorIdKey nON_EXHAUSTIVE_GUARDS_ERROR_ID | 159 | nonExhaustiveGuardsErrorName = err_nm "nonExhaustiveGuardsError"
nonExhaustiveGuardsErrorIdKey nON_EXHAUSTIVE_GUARDS_ERROR_ID | 159 | false | false | 1 | 5 | 39 | 18 | 6 | 12 | null | null |
andrewMacmurray/haskell-book-solutions | src/ch15/Semigroup.hs | mit | accumRightGen :: (Arbitrary a, Arbitrary b) => Gen (AccumulateRight a b)
accumRightGen = do
a <- validationGen
b <- validationGen
frequency [ (10, return $ AccumulateRight a )
, (1, return $ AccumulateRight b)
] | 242 | accumRightGen :: (Arbitrary a, Arbitrary b) => Gen (AccumulateRight a b)
accumRightGen = do
a <- validationGen
b <- validationGen
frequency [ (10, return $ AccumulateRight a )
, (1, return $ AccumulateRight b)
] | 242 | accumRightGen = do
a <- validationGen
b <- validationGen
frequency [ (10, return $ AccumulateRight a )
, (1, return $ AccumulateRight b)
] | 169 | false | true | 0 | 12 | 65 | 95 | 46 | 49 | null | null |
jmitchell/Idris-dev | src/IRTS/Simplified.hs | bsd-3-clause | bindExprM :: DExp -> (LVar -> State (DDefs, Int) SExp) -> State (DDefs, Int) SExp
bindExprM (DV (Glob x)) f
= do ctxt <- ldefs
case lookupCtxtExact x ctxt of
Just (DConstructor _ t 0) -> bindExprM (DC Nothing t x []) f
_ -> f (Glob x) | 275 | bindExprM :: DExp -> (LVar -> State (DDefs, Int) SExp) -> State (DDefs, Int) SExp
bindExprM (DV (Glob x)) f
= do ctxt <- ldefs
case lookupCtxtExact x ctxt of
Just (DConstructor _ t 0) -> bindExprM (DC Nothing t x []) f
_ -> f (Glob x) | 275 | bindExprM (DV (Glob x)) f
= do ctxt <- ldefs
case lookupCtxtExact x ctxt of
Just (DConstructor _ t 0) -> bindExprM (DC Nothing t x []) f
_ -> f (Glob x) | 193 | false | true | 0 | 13 | 88 | 137 | 67 | 70 | null | null |
gennady-em/haskel | src/D_Say.hs | gpl-2.0 | nothing= repeat "" | 19 | nothing= repeat "" | 19 | nothing= repeat "" | 19 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
DougBurke/swish | tests/RDFGraphTest.hs | lgpl-2.1 | fm4 = toFM [lf11, lf23, lf33] | 30 | fm4 = toFM [lf11, lf23, lf33] | 30 | fm4 = toFM [lf11, lf23, lf33] | 30 | false | false | 0 | 6 | 6 | 18 | 10 | 8 | null | null |
genos/online_problems | advent_of_code_2016/day10/src/Main.hs | mit | mkFactory :: Instructions -> Factory
mkFactory is =
Factory { _bots = HM.empty, _output = HM.empty, _instructions = is } | 122 | mkFactory :: Instructions -> Factory
mkFactory is =
Factory { _bots = HM.empty, _output = HM.empty, _instructions = is } | 122 | mkFactory is =
Factory { _bots = HM.empty, _output = HM.empty, _instructions = is } | 85 | false | true | 0 | 8 | 21 | 51 | 26 | 25 | null | null |
phadej/stack | src/Stack/Solver.hs | bsd-3-clause | prettyPath
:: forall r t m. (MonadIO m, RelPath (Path r t) ~ Path Rel t, AnyPath (Path r t))
=> Path r t -> m String
prettyPath path = do
eres <- liftIO $ try $ makeRelativeToCurrentDir path
return $ case eres of
Left (_ :: PathParseException) -> toFilePath path
Right res -> toFilePath (res :: Path Rel t) | 338 | prettyPath
:: forall r t m. (MonadIO m, RelPath (Path r t) ~ Path Rel t, AnyPath (Path r t))
=> Path r t -> m String
prettyPath path = do
eres <- liftIO $ try $ makeRelativeToCurrentDir path
return $ case eres of
Left (_ :: PathParseException) -> toFilePath path
Right res -> toFilePath (res :: Path Rel t) | 338 | prettyPath path = do
eres <- liftIO $ try $ makeRelativeToCurrentDir path
return $ case eres of
Left (_ :: PathParseException) -> toFilePath path
Right res -> toFilePath (res :: Path Rel t) | 213 | false | true | 0 | 13 | 91 | 151 | 73 | 78 | null | null |
lpeterse/crprover | Parser.hs | gpl-2.0 | runLex p input = PP.parse (do whiteSpace
x <- p
eof
return x
) "" input | 188 | runLex p input = PP.parse (do whiteSpace
x <- p
eof
return x
) "" input | 188 | runLex p input = PP.parse (do whiteSpace
x <- p
eof
return x
) "" input | 188 | false | false | 0 | 9 | 132 | 42 | 18 | 24 | null | null |
vdweegen/UvA-Software_Testing | Lab5/Willem/Lecture5NRC.hs | gpl-3.0 | takeT :: Int -> Tree a -> Tree a
takeT 0 (T x _) = T x [] | 57 | takeT :: Int -> Tree a -> Tree a
takeT 0 (T x _) = T x [] | 57 | takeT 0 (T x _) = T x [] | 24 | false | true | 0 | 10 | 17 | 49 | 22 | 27 | null | null |
nevrenato/HetsAlloy | CASL/Freeness.hs | gpl-2.0 | quantifyPredsSorts :: Set.Set SORT -> CASLFORMULA -> CASLFORMULA
quantifyPredsSorts ss f = Set.fold quantifyPredsSort f ss | 122 | quantifyPredsSorts :: Set.Set SORT -> CASLFORMULA -> CASLFORMULA
quantifyPredsSorts ss f = Set.fold quantifyPredsSort f ss | 122 | quantifyPredsSorts ss f = Set.fold quantifyPredsSort f ss | 57 | false | true | 0 | 7 | 15 | 38 | 18 | 20 | null | null |
reflex-frp/reflex-dom | reflex-dom-core/src/Reflex/Dom/Xhr.hs | bsd-3-clause | xhrResponse_body :: Lens' XhrResponse (Maybe Text)
xhrResponse_body = lens _xhrResponse_responseText (\r t -> r { _xhrResponse_responseText = t }) | 146 | xhrResponse_body :: Lens' XhrResponse (Maybe Text)
xhrResponse_body = lens _xhrResponse_responseText (\r t -> r { _xhrResponse_responseText = t }) | 146 | xhrResponse_body = lens _xhrResponse_responseText (\r t -> r { _xhrResponse_responseText = t }) | 95 | false | true | 0 | 9 | 18 | 45 | 24 | 21 | null | null |
allanderek/ipclib | tests/passage/good/Make.hs | gpl-2.0 | kNumbers :: [ Int ]
kNumbers = [1..9] | 37 | kNumbers :: [ Int ]
kNumbers = [1..9] | 37 | kNumbers = [1..9] | 17 | false | true | 0 | 5 | 7 | 19 | 11 | 8 | null | null |
mfpi/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/Core31/Tokens.hs | bsd-3-clause | gl_PIXEL_PACK_BUFFER_BINDING :: GLenum
gl_PIXEL_PACK_BUFFER_BINDING = 0x88ED | 76 | gl_PIXEL_PACK_BUFFER_BINDING :: GLenum
gl_PIXEL_PACK_BUFFER_BINDING = 0x88ED | 76 | gl_PIXEL_PACK_BUFFER_BINDING = 0x88ED | 37 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
shlevy/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | emitMemcpyCall :: CmmExpr -> CmmExpr -> CmmExpr -> Int -> FCode ()
emitMemcpyCall dst src n align = do
emitPrimCall
[ {-no results-} ]
(MO_Memcpy align)
[ dst, src, n ]
-- | Emit a call to @memmove@. | 228 | emitMemcpyCall :: CmmExpr -> CmmExpr -> CmmExpr -> Int -> FCode ()
emitMemcpyCall dst src n align = do
emitPrimCall
[ {-no results-} ]
(MO_Memcpy align)
[ dst, src, n ]
-- | Emit a call to @memmove@. | 228 | emitMemcpyCall dst src n align = do
emitPrimCall
[ {-no results-} ]
(MO_Memcpy align)
[ dst, src, n ]
-- | Emit a call to @memmove@. | 161 | false | true | 0 | 11 | 66 | 75 | 37 | 38 | null | null |
danr/hipspec | testsuite/prod/zeno_version/PropT32.hs | gpl-3.0 | insert n (x:xs) =
case n <= x of
True -> n : x : xs
False -> x : (insert n xs) | 88 | insert n (x:xs) =
case n <= x of
True -> n : x : xs
False -> x : (insert n xs) | 88 | insert n (x:xs) =
case n <= x of
True -> n : x : xs
False -> x : (insert n xs) | 88 | false | false | 2 | 8 | 32 | 62 | 29 | 33 | null | null |
rebeccaskinner/http-s3 | src/Network/HTTP/S3/Signature.hs | bsd-3-clause | signRequest :: B.ByteString -> B.ByteString -> Request B.ByteString -> Maybe (Request B.ByteString)
signRequest access secret request =
let requestSig = hashSigningRequest $ mkSigningRequest request
signedReq = hmac secret requestSig :: Digest SHA1
in Nothing | 275 | signRequest :: B.ByteString -> B.ByteString -> Request B.ByteString -> Maybe (Request B.ByteString)
signRequest access secret request =
let requestSig = hashSigningRequest $ mkSigningRequest request
signedReq = hmac secret requestSig :: Digest SHA1
in Nothing | 275 | signRequest access secret request =
let requestSig = hashSigningRequest $ mkSigningRequest request
signedReq = hmac secret requestSig :: Digest SHA1
in Nothing | 175 | false | true | 0 | 11 | 49 | 84 | 40 | 44 | null | null |
iu-parfunc/containers | tests/map-properties.hs | bsd-3-clause | test_toList :: Assertion
test_toList = do
toList (fromList [(5,"a"), (3,"b")]) @?= [(3,"b"), (5,"a")]
toList (empty :: SMap) @?= [] | 139 | test_toList :: Assertion
test_toList = do
toList (fromList [(5,"a"), (3,"b")]) @?= [(3,"b"), (5,"a")]
toList (empty :: SMap) @?= [] | 139 | test_toList = do
toList (fromList [(5,"a"), (3,"b")]) @?= [(3,"b"), (5,"a")]
toList (empty :: SMap) @?= [] | 114 | false | true | 0 | 12 | 26 | 88 | 47 | 41 | null | null |
miguel-negrao/iCalendar | Text/ICalendar/Parser/Properties.hs | bsd-3-clause | parseDurationProp :: Maybe DTStart -> Content -> ContentParser DurationProp
parseDurationProp dts (ContentLine _ "DURATION" o bs) = do
val <- parseDuration "DURATION" bs
case (dts, val) of
(Just DTStartDate {}, DurationDate {..})
| durHour == 0 && durMinute == 0 && durSecond == 0 -> return ()
(Just DTStartDate {}, DurationWeek {}) -> return ()
(Just DTStartDate {}, _) ->
throwError "DURATION must be in weeks or days when DTSTART \
\has VALUE DATE and not DATE-TIME."
_ -> return ()
return . DurationProp val $ toO o | 616 | parseDurationProp :: Maybe DTStart -> Content -> ContentParser DurationProp
parseDurationProp dts (ContentLine _ "DURATION" o bs) = do
val <- parseDuration "DURATION" bs
case (dts, val) of
(Just DTStartDate {}, DurationDate {..})
| durHour == 0 && durMinute == 0 && durSecond == 0 -> return ()
(Just DTStartDate {}, DurationWeek {}) -> return ()
(Just DTStartDate {}, _) ->
throwError "DURATION must be in weeks or days when DTSTART \
\has VALUE DATE and not DATE-TIME."
_ -> return ()
return . DurationProp val $ toO o | 616 | parseDurationProp dts (ContentLine _ "DURATION" o bs) = do
val <- parseDuration "DURATION" bs
case (dts, val) of
(Just DTStartDate {}, DurationDate {..})
| durHour == 0 && durMinute == 0 && durSecond == 0 -> return ()
(Just DTStartDate {}, DurationWeek {}) -> return ()
(Just DTStartDate {}, _) ->
throwError "DURATION must be in weeks or days when DTSTART \
\has VALUE DATE and not DATE-TIME."
_ -> return ()
return . DurationProp val $ toO o | 540 | false | true | 0 | 18 | 184 | 206 | 97 | 109 | null | null |
akamaus/gcodec | src/CNC/Declarative.hs | bsd-3-clause | -- renders a path in HCode monad
renderPath :: (Expr RealT, Expr RealT) -> Path -> HCode ()
renderPath (x0, y0) path = do
frame [g 0, x x0, y y0]
mapPathM_ (\(xi :+ yi) -> frame [g 1, x $ toExpr xi + x0, y $ toExpr yi + y0]) path | 233 | renderPath :: (Expr RealT, Expr RealT) -> Path -> HCode ()
renderPath (x0, y0) path = do
frame [g 0, x x0, y y0]
mapPathM_ (\(xi :+ yi) -> frame [g 1, x $ toExpr xi + x0, y $ toExpr yi + y0]) path | 200 | renderPath (x0, y0) path = do
frame [g 0, x x0, y y0]
mapPathM_ (\(xi :+ yi) -> frame [g 1, x $ toExpr xi + x0, y $ toExpr yi + y0]) path | 141 | true | true | 0 | 14 | 55 | 132 | 66 | 66 | null | null |
google/haskell-indexer | haskell-indexer-backend-ghc/src/Language/Haskell/Indexer/Backend/Ghc.hs | apache-2.0 | nameOccurenceString :: Name -> String
nameOccurenceString = occNameString . nameOccName | 87 | nameOccurenceString :: Name -> String
nameOccurenceString = occNameString . nameOccName | 87 | nameOccurenceString = occNameString . nameOccName | 49 | false | true | 0 | 5 | 9 | 19 | 10 | 9 | null | null |
mydaum/cabal | cabal-install/Distribution/Client/SetupWrapper.hs | bsd-3-clause | internalSetupMethod :: SetupRunner
internalSetupMethod verbosity options bt args = do
info verbosity $ "Using internal setup method with build-type " ++ show bt
++ " and args:\n " ++ show args
inDir (useWorkingDir options) $ do
withEnv "HASKELL_DIST_DIR" (useDistPref options) $
withExtraPathEnv (useExtraPathEnv options) $
buildTypeAction bt args | 386 | internalSetupMethod :: SetupRunner
internalSetupMethod verbosity options bt args = do
info verbosity $ "Using internal setup method with build-type " ++ show bt
++ " and args:\n " ++ show args
inDir (useWorkingDir options) $ do
withEnv "HASKELL_DIST_DIR" (useDistPref options) $
withExtraPathEnv (useExtraPathEnv options) $
buildTypeAction bt args | 386 | internalSetupMethod verbosity options bt args = do
info verbosity $ "Using internal setup method with build-type " ++ show bt
++ " and args:\n " ++ show args
inDir (useWorkingDir options) $ do
withEnv "HASKELL_DIST_DIR" (useDistPref options) $
withExtraPathEnv (useExtraPathEnv options) $
buildTypeAction bt args | 351 | false | true | 1 | 15 | 86 | 106 | 45 | 61 | null | null |
tonyfloatersu/solution-haskell-craft-of-FP | Chapter_12_my_note.hs | mit | blackList :: Picture -> [(Int, Int)]
blackList pic = filter (`isBlack` pic) (uncurry pointsCreate (picSize pic)) | 115 | blackList :: Picture -> [(Int, Int)]
blackList pic = filter (`isBlack` pic) (uncurry pointsCreate (picSize pic)) | 115 | blackList pic = filter (`isBlack` pic) (uncurry pointsCreate (picSize pic)) | 78 | false | true | 0 | 9 | 18 | 57 | 30 | 27 | null | null |
mrehayden1/lji | src/LJI/Args.hs | bsd-3-clause | guideToneLine1Cmd :: OperationParser
guideToneLine1Cmd =
guideToneLine1 <$ (string "guide1" *> notFollowedBy alphaNum) | 120 | guideToneLine1Cmd :: OperationParser
guideToneLine1Cmd =
guideToneLine1 <$ (string "guide1" *> notFollowedBy alphaNum) | 120 | guideToneLine1Cmd =
guideToneLine1 <$ (string "guide1" *> notFollowedBy alphaNum) | 83 | false | true | 2 | 8 | 13 | 36 | 15 | 21 | null | null |
crzysdrs/griddle | src/Steam/BinVDF.hs | gpl-2.0 | bytes2Int :: String -> Int
bytes2Int cs = if v > bit 31
then v - bit 32
else v
where v = fromIntegral $ BinGet.runGet BinGet.getWord32host $ C.pack cs | 180 | bytes2Int :: String -> Int
bytes2Int cs = if v > bit 31
then v - bit 32
else v
where v = fromIntegral $ BinGet.runGet BinGet.getWord32host $ C.pack cs | 180 | bytes2Int cs = if v > bit 31
then v - bit 32
else v
where v = fromIntegral $ BinGet.runGet BinGet.getWord32host $ C.pack cs | 153 | false | true | 0 | 8 | 59 | 68 | 33 | 35 | null | null |
bakineggs/k-framework | tools/k-pipeline/src/xpath.hs | gpl-2.0 | main :: IO ()
main = do
args <- getArgs
when (null args) $ do
putStrLn "One argument required (the xpath query)."
exitFailure
let query = head args
rs <- runX $
readDocument [] ""
>>>
getXPathTrees query
>>>
-- Is this the best thing to do?
xshow this
mapM_ putStrLn rs | 357 | main :: IO ()
main = do
args <- getArgs
when (null args) $ do
putStrLn "One argument required (the xpath query)."
exitFailure
let query = head args
rs <- runX $
readDocument [] ""
>>>
getXPathTrees query
>>>
-- Is this the best thing to do?
xshow this
mapM_ putStrLn rs | 357 | main = do
args <- getArgs
when (null args) $ do
putStrLn "One argument required (the xpath query)."
exitFailure
let query = head args
rs <- runX $
readDocument [] ""
>>>
getXPathTrees query
>>>
-- Is this the best thing to do?
xshow this
mapM_ putStrLn rs | 343 | false | true | 0 | 12 | 139 | 101 | 44 | 57 | null | null |
x456/binary | tests/QC.hs | bsd-3-clause | prop_bytesRead :: L.ByteString -> Property
prop_bytesRead lbs =
forAll (makeChunks 0 totalLength) $ \chunkSizes ->
let result = pushChunks (runGetIncremental decoder) lbs
decoder = do
-- Read some data and invoke bytesRead several times.
-- Each time, check that the values are what we expect.
flip mapM_ chunkSizes $ \(total, step) -> do
_ <- getByteString (fromIntegral step)
n <- bytesRead
unless (n == total) $ fail "unexpected position"
bytesRead
in case result of
Done unused pos value ->
and [ value == totalLength
, pos == value
, B.null unused
]
Partial _ -> False
Fail _ _ _ -> False
where
totalLength = L.length lbs
makeChunks total i
| i == 0 = return []
| otherwise = do
n <- choose (0,i)
let total' = total + n
rest <- makeChunks total' (i - n)
return ((total',n):rest)
-- | We're trying to guarantee that the Decoder will not ask for more input
-- with Partial if it has been given Nothing once.
-- In this test we're making the decoder return 'Partial' to get more
-- input, and to get knownledge of the current position using 'BytesRead'.
-- Both of these operations, when used with the <|> operator, result internally
-- in that the decoder return with Partial and BytesRead multiple times,
-- in which case we need to keep track of if the user has passed Nothing to a
-- Partial in the past. | 1,517 | prop_bytesRead :: L.ByteString -> Property
prop_bytesRead lbs =
forAll (makeChunks 0 totalLength) $ \chunkSizes ->
let result = pushChunks (runGetIncremental decoder) lbs
decoder = do
-- Read some data and invoke bytesRead several times.
-- Each time, check that the values are what we expect.
flip mapM_ chunkSizes $ \(total, step) -> do
_ <- getByteString (fromIntegral step)
n <- bytesRead
unless (n == total) $ fail "unexpected position"
bytesRead
in case result of
Done unused pos value ->
and [ value == totalLength
, pos == value
, B.null unused
]
Partial _ -> False
Fail _ _ _ -> False
where
totalLength = L.length lbs
makeChunks total i
| i == 0 = return []
| otherwise = do
n <- choose (0,i)
let total' = total + n
rest <- makeChunks total' (i - n)
return ((total',n):rest)
-- | We're trying to guarantee that the Decoder will not ask for more input
-- with Partial if it has been given Nothing once.
-- In this test we're making the decoder return 'Partial' to get more
-- input, and to get knownledge of the current position using 'BytesRead'.
-- Both of these operations, when used with the <|> operator, result internally
-- in that the decoder return with Partial and BytesRead multiple times,
-- in which case we need to keep track of if the user has passed Nothing to a
-- Partial in the past. | 1,517 | prop_bytesRead lbs =
forAll (makeChunks 0 totalLength) $ \chunkSizes ->
let result = pushChunks (runGetIncremental decoder) lbs
decoder = do
-- Read some data and invoke bytesRead several times.
-- Each time, check that the values are what we expect.
flip mapM_ chunkSizes $ \(total, step) -> do
_ <- getByteString (fromIntegral step)
n <- bytesRead
unless (n == total) $ fail "unexpected position"
bytesRead
in case result of
Done unused pos value ->
and [ value == totalLength
, pos == value
, B.null unused
]
Partial _ -> False
Fail _ _ _ -> False
where
totalLength = L.length lbs
makeChunks total i
| i == 0 = return []
| otherwise = do
n <- choose (0,i)
let total' = total + n
rest <- makeChunks total' (i - n)
return ((total',n):rest)
-- | We're trying to guarantee that the Decoder will not ask for more input
-- with Partial if it has been given Nothing once.
-- In this test we're making the decoder return 'Partial' to get more
-- input, and to get knownledge of the current position using 'BytesRead'.
-- Both of these operations, when used with the <|> operator, result internally
-- in that the decoder return with Partial and BytesRead multiple times,
-- in which case we need to keep track of if the user has passed Nothing to a
-- Partial in the past. | 1,474 | false | true | 0 | 20 | 444 | 324 | 160 | 164 | null | null |
ankhers/haskell-ide-engine | hie-docs-generator/src/Main.hs | bsd-3-clause | pluginIndexPath :: MonadReader O.Config m => m FilePath
pluginIndexPath = reader $ \(O.Config _ prefix) -> prefix </> "plugins" </> "index.rst" | 143 | pluginIndexPath :: MonadReader O.Config m => m FilePath
pluginIndexPath = reader $ \(O.Config _ prefix) -> prefix </> "plugins" </> "index.rst" | 143 | pluginIndexPath = reader $ \(O.Config _ prefix) -> prefix </> "plugins" </> "index.rst" | 87 | false | true | 0 | 9 | 20 | 52 | 26 | 26 | null | null |
adept/hledger | hledger-lib/Hledger/Utils/Text.hs | gpl-3.0 | -- | Read a decimal number from a Text. Assumes the input consists only of digit
-- characters.
readDecimal :: Text -> Integer
readDecimal = T.foldl' step 0
where step a c = a * 10 + toInteger (digitToInt c) | 209 | readDecimal :: Text -> Integer
readDecimal = T.foldl' step 0
where step a c = a * 10 + toInteger (digitToInt c) | 113 | readDecimal = T.foldl' step 0
where step a c = a * 10 + toInteger (digitToInt c) | 82 | true | true | 0 | 8 | 41 | 53 | 27 | 26 | null | null |
brendanhay/gogol | gogol-oslogin/gen/Network/Google/OSLogin/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'Empty' with the minimum fields required to make a request.
--
empty
:: Empty
empty = Empty' | 120 | empty
:: Empty
empty = Empty' | 33 | empty = Empty' | 14 | true | true | 1 | 5 | 26 | 17 | 8 | 9 | null | null |
bgold-cosmos/Tidal | src/Sound/Tidal/Params.hs | gpl-3.0 | distortCountTo :: String -> Pattern Double -> Pattern ValueMap
distortCountTo name ipat = innerJoin $ (\i -> pStateF "distort" name (maybe 0 ((`mod'` i) . (+1)))) <$> ipat | 171 | distortCountTo :: String -> Pattern Double -> Pattern ValueMap
distortCountTo name ipat = innerJoin $ (\i -> pStateF "distort" name (maybe 0 ((`mod'` i) . (+1)))) <$> ipat | 171 | distortCountTo name ipat = innerJoin $ (\i -> pStateF "distort" name (maybe 0 ((`mod'` i) . (+1)))) <$> ipat | 108 | false | true | 2 | 13 | 27 | 84 | 43 | 41 | null | null |
aristidb/random-extras | Data/Random/Shuffle/Weighted.hs | bsd-3-clause | moduleError :: String -> String -> a
moduleError n s = error $ "Data.Random.Shuffle.Weighted." ++ n ++ ": " ++ s | 112 | moduleError :: String -> String -> a
moduleError n s = error $ "Data.Random.Shuffle.Weighted." ++ n ++ ": " ++ s | 112 | moduleError n s = error $ "Data.Random.Shuffle.Weighted." ++ n ++ ": " ++ s | 75 | false | true | 0 | 8 | 20 | 40 | 20 | 20 | null | null |
alexander-at-github/eta | compiler/ETA/Prelude/PrelNames.hs | bsd-3-clause | gHC_CSTRING = mkPrimModule (fsLit "GHC.CString") | 52 | gHC_CSTRING = mkPrimModule (fsLit "GHC.CString") | 52 | gHC_CSTRING = mkPrimModule (fsLit "GHC.CString") | 52 | false | false | 1 | 7 | 8 | 18 | 7 | 11 | null | null |
YLiLarry/db-model | benchmark/Test/Run.hs | mit | testLoadObj :: Test Load
testLoadObj = Test {
a = Load "Test" "id" "id <= 100000",
b = Load "Test" "f1" "id <= 100000",
c = LoadV 1,
d = LoadN,
e = LoadR $ Test {
a = Load "Test" "id" "id <= 100000",
b = Load "Test" "f1" "id <= 100000",
c = LoadV 1,
d = LoadN,
e = LoadN
}
} | 322 | testLoadObj :: Test Load
testLoadObj = Test {
a = Load "Test" "id" "id <= 100000",
b = Load "Test" "f1" "id <= 100000",
c = LoadV 1,
d = LoadN,
e = LoadR $ Test {
a = Load "Test" "id" "id <= 100000",
b = Load "Test" "f1" "id <= 100000",
c = LoadV 1,
d = LoadN,
e = LoadN
}
} | 322 | testLoadObj = Test {
a = Load "Test" "id" "id <= 100000",
b = Load "Test" "f1" "id <= 100000",
c = LoadV 1,
d = LoadN,
e = LoadR $ Test {
a = Load "Test" "id" "id <= 100000",
b = Load "Test" "f1" "id <= 100000",
c = LoadV 1,
d = LoadN,
e = LoadN
}
} | 297 | false | true | 0 | 10 | 112 | 116 | 65 | 51 | null | null |
seinokatsuhiro/koshu-java-tool | Content.hs | bsd-3-clause | pWord8 :: (K.CContent c) => W.Word8 -> c
pWord8 i = K.pDecFromInt i' where
i' = fromIntegral i :: Int | 105 | pWord8 :: (K.CContent c) => W.Word8 -> c
pWord8 i = K.pDecFromInt i' where
i' = fromIntegral i :: Int | 105 | pWord8 i = K.pDecFromInt i' where
i' = fromIntegral i :: Int | 64 | false | true | 0 | 7 | 23 | 49 | 25 | 24 | null | null |
koba-e964/tigress | src/Codegen.hs | bsd-3-clause | -- 8-bit integer (char)
int8 :: AST.Type
int8 = IntegerType 8 | 61 | int8 :: AST.Type
int8 = IntegerType 8 | 37 | int8 = IntegerType 8 | 20 | true | true | 0 | 5 | 10 | 17 | 9 | 8 | null | null |
Narfinger/player-control | haskell/MusicController.hs | gpl-3.0 | callMedia :: Client -> String -> String -> IO (Maybe MethodReturn)
callMedia client path method = do
let p = objectPath_ path
let m = memberName_ method
callDBus client p "org.freedesktop.MediaPlayer" "org.mpris.clementine" m | 231 | callMedia :: Client -> String -> String -> IO (Maybe MethodReturn)
callMedia client path method = do
let p = objectPath_ path
let m = memberName_ method
callDBus client p "org.freedesktop.MediaPlayer" "org.mpris.clementine" m | 231 | callMedia client path method = do
let p = objectPath_ path
let m = memberName_ method
callDBus client p "org.freedesktop.MediaPlayer" "org.mpris.clementine" m | 164 | false | true | 0 | 10 | 38 | 77 | 35 | 42 | null | null |
michaeljklein/git-details | src/Data/Conduit/Maybe.hs | bsd-3-clause | -- | A `Conduit` that converts @Maybe Bool@ to @Bool@, taking @Just True@
-- as the only @True@ value
fromMaybeBool :: Monad m => Conduit (Maybe Bool) m Bool
fromMaybeBool = map fromMaybeBool'
where
fromMaybeBool' :: Maybe Bool -> Bool
fromMaybeBool' (Just True) = True
fromMaybeBool' _ = False | 318 | fromMaybeBool :: Monad m => Conduit (Maybe Bool) m Bool
fromMaybeBool = map fromMaybeBool'
where
fromMaybeBool' :: Maybe Bool -> Bool
fromMaybeBool' (Just True) = True
fromMaybeBool' _ = False | 216 | fromMaybeBool = map fromMaybeBool'
where
fromMaybeBool' :: Maybe Bool -> Bool
fromMaybeBool' (Just True) = True
fromMaybeBool' _ = False | 160 | true | true | 0 | 8 | 72 | 73 | 36 | 37 | null | null |
bgwines/project-euler | src/solved/problem5.hs | bsd-3-clause | main :: IO ()
main = do
putStrLn . show $ fromJust divider | 59 | main :: IO ()
main = do
putStrLn . show $ fromJust divider | 59 | main = do
putStrLn . show $ fromJust divider | 45 | false | true | 0 | 8 | 13 | 30 | 14 | 16 | null | null |
jaalonso/I1M-Cod-Temas | src/Tema_22/GrafoConMatrizDeAdyacencia.hs | gpl-2.0 | -- (creaGrafo d cs as) es un grafo (dirigido o no, según el valor de o),
-- con el par de cotas cs y listas de aristas as (cada arista es un trío
-- formado por los dos vértices y su peso). Ver el ejemplo a continuación.
creaGrafo :: (Ix v,Num p) => Orientacion -> (v,v) -> [(v,v,p)] -> Grafo v p
creaGrafo D cs as =
G D (matrizVacia cs // [((v1,v2),Just c) | (v1,v2,c) <- as]) | 379 | creaGrafo :: (Ix v,Num p) => Orientacion -> (v,v) -> [(v,v,p)] -> Grafo v p
creaGrafo D cs as =
G D (matrizVacia cs // [((v1,v2),Just c) | (v1,v2,c) <- as]) | 158 | creaGrafo D cs as =
G D (matrizVacia cs // [((v1,v2),Just c) | (v1,v2,c) <- as]) | 82 | true | true | 0 | 11 | 79 | 127 | 69 | 58 | null | null |
tjakway/ghcjvm | compiler/prelude/PrelNames.hs | bsd-3-clause | dTyConKey = mkPreludeTyConUnique 146 | 36 | dTyConKey = mkPreludeTyConUnique 146 | 36 | dTyConKey = mkPreludeTyConUnique 146 | 36 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
timtylin/scholdoc | src/Text/Pandoc/Writers/Docx.hs | gpl-2.0 | inlineToOpenXML opts (Span (_,classes,kvs) ils)
| "insertion" `elem` classes = do
defaultAuthor <- gets stChangesAuthor
defaultDate <- gets stChangesDate
let author = fromMaybe defaultAuthor (lookup "author" kvs)
date = fromMaybe defaultDate (lookup "date" kvs)
insId <- gets stInsId
modify $ \s -> s{stInsId = (insId + 1)}
x <- inlinesToOpenXML opts ils
return [ mknode "w:ins" [("w:id", (show insId)),
("w:author", author),
("w:date", date)]
x ]
| "deletion" `elem` classes = do
defaultAuthor <- gets stChangesAuthor
defaultDate <- gets stChangesDate
let author = fromMaybe defaultAuthor (lookup "author" kvs)
date = fromMaybe defaultDate (lookup "date" kvs)
delId <- gets stDelId
modify $ \s -> s{stDelId = (delId + 1)}
modify $ \s -> s{stInDel = True}
x <- inlinesToOpenXML opts ils
modify $ \s -> s{stInDel = False}
return [ mknode "w:del" [("w:id", (show delId)),
("w:author", author),
("w:date", date)]
x ]
| otherwise = do
let off x = withTextProp (mknode x [("w:val","0")] ())
((if "csl-no-emph" `elem` classes then off "w:i" else id) .
(if "csl-no-strong" `elem` classes then off "w:b" else id) .
(if "csl-no-smallcaps" `elem` classes then off "w:smallCaps" else id))
$ inlinesToOpenXML opts ils | 1,461 | inlineToOpenXML opts (Span (_,classes,kvs) ils)
| "insertion" `elem` classes = do
defaultAuthor <- gets stChangesAuthor
defaultDate <- gets stChangesDate
let author = fromMaybe defaultAuthor (lookup "author" kvs)
date = fromMaybe defaultDate (lookup "date" kvs)
insId <- gets stInsId
modify $ \s -> s{stInsId = (insId + 1)}
x <- inlinesToOpenXML opts ils
return [ mknode "w:ins" [("w:id", (show insId)),
("w:author", author),
("w:date", date)]
x ]
| "deletion" `elem` classes = do
defaultAuthor <- gets stChangesAuthor
defaultDate <- gets stChangesDate
let author = fromMaybe defaultAuthor (lookup "author" kvs)
date = fromMaybe defaultDate (lookup "date" kvs)
delId <- gets stDelId
modify $ \s -> s{stDelId = (delId + 1)}
modify $ \s -> s{stInDel = True}
x <- inlinesToOpenXML opts ils
modify $ \s -> s{stInDel = False}
return [ mknode "w:del" [("w:id", (show delId)),
("w:author", author),
("w:date", date)]
x ]
| otherwise = do
let off x = withTextProp (mknode x [("w:val","0")] ())
((if "csl-no-emph" `elem` classes then off "w:i" else id) .
(if "csl-no-strong" `elem` classes then off "w:b" else id) .
(if "csl-no-smallcaps" `elem` classes then off "w:smallCaps" else id))
$ inlinesToOpenXML opts ils | 1,461 | inlineToOpenXML opts (Span (_,classes,kvs) ils)
| "insertion" `elem` classes = do
defaultAuthor <- gets stChangesAuthor
defaultDate <- gets stChangesDate
let author = fromMaybe defaultAuthor (lookup "author" kvs)
date = fromMaybe defaultDate (lookup "date" kvs)
insId <- gets stInsId
modify $ \s -> s{stInsId = (insId + 1)}
x <- inlinesToOpenXML opts ils
return [ mknode "w:ins" [("w:id", (show insId)),
("w:author", author),
("w:date", date)]
x ]
| "deletion" `elem` classes = do
defaultAuthor <- gets stChangesAuthor
defaultDate <- gets stChangesDate
let author = fromMaybe defaultAuthor (lookup "author" kvs)
date = fromMaybe defaultDate (lookup "date" kvs)
delId <- gets stDelId
modify $ \s -> s{stDelId = (delId + 1)}
modify $ \s -> s{stInDel = True}
x <- inlinesToOpenXML opts ils
modify $ \s -> s{stInDel = False}
return [ mknode "w:del" [("w:id", (show delId)),
("w:author", author),
("w:date", date)]
x ]
| otherwise = do
let off x = withTextProp (mknode x [("w:val","0")] ())
((if "csl-no-emph" `elem` classes then off "w:i" else id) .
(if "csl-no-strong" `elem` classes then off "w:b" else id) .
(if "csl-no-smallcaps" `elem` classes then off "w:smallCaps" else id))
$ inlinesToOpenXML opts ils | 1,461 | false | false | 2 | 15 | 440 | 540 | 278 | 262 | null | null |
mettekou/ghc | compiler/simplCore/SetLevels.hs | bsd-3-clause | floatSpecLevel (StayPut l) = l | 30 | floatSpecLevel (StayPut l) = l | 30 | floatSpecLevel (StayPut l) = l | 30 | false | false | 0 | 7 | 4 | 15 | 7 | 8 | null | null |
x-y-z/cabal | cabal-install/Distribution/Client/List.hs | bsd-3-clause | showPackageDetailedInfo :: PackageDisplayInfo -> String
showPackageDetailedInfo pkginfo =
renderStyle (style {lineLength = 80, ribbonsPerLine = 1}) $
char '*' <+> disp (pkgName pkginfo)
<> maybe empty (\v -> char '-' <> disp v) (selectedVersion pkginfo)
<+> text (replicate (16 - length (display (pkgName pkginfo))) ' ')
<> parens pkgkind
$+$
(nest 4 $ vcat [
entry "Synopsis" synopsis hideIfNull reflowParagraphs
, entry "Versions available" sourceVersions
(altText null "[ Not available from server ]")
(dispTopVersions 9 (preferredVersions pkginfo))
, entry "Versions installed" installedVersions
(altText null (if hasLib pkginfo then "[ Not installed ]"
else "[ Unknown ]"))
(dispTopVersions 4 (preferredVersions pkginfo))
, entry "Homepage" homepage orNotSpecified text
, entry "Bug reports" bugReports orNotSpecified text
, entry "Description" description hideIfNull reflowParagraphs
, entry "Category" category hideIfNull text
, entry "License" license alwaysShow disp
, entry "Author" author hideIfNull reflowLines
, entry "Maintainer" maintainer hideIfNull reflowLines
, entry "Source repo" sourceRepo orNotSpecified text
, entry "Executables" executables hideIfNull (commaSep text)
, entry "Flags" flags hideIfNull (commaSep dispFlag)
, entry "Dependencies" dependencies hideIfNull (commaSep dispExtDep)
, entry "Documentation" haddockHtml showIfInstalled text
, entry "Cached" haveTarball alwaysShow dispYesNo
, if not (hasLib pkginfo) then empty else
text "Modules:" $+$ nest 4 (vcat (map disp . sort . modules $ pkginfo))
])
$+$ text ""
where
entry fname field cond format = case cond (field pkginfo) of
Nothing -> label <+> format (field pkginfo)
Just Nothing -> empty
Just (Just other) -> label <+> text other
where
label = text fname <> char ':' <> padding
padding = text (replicate (13 - length fname ) ' ')
normal = Nothing
hide = Just Nothing
replace msg = Just (Just msg)
alwaysShow = const normal
hideIfNull v = if null v then hide else normal
showIfInstalled v
| not isInstalled = hide
| null v = replace "[ Not installed ]"
| otherwise = normal
altText nul msg v = if nul v then replace msg else normal
orNotSpecified = altText null "[ Not specified ]"
commaSep f = Disp.fsep . Disp.punctuate (Disp.char ',') . map f
dispFlag f = case flagName f of FlagName n -> text n
dispYesNo True = text "Yes"
dispYesNo False = text "No"
dispExtDep (SourceDependency dep) = disp dep
dispExtDep (InstalledDependency dep) = disp dep
isInstalled = not (null (installedVersions pkginfo))
hasExes = length (executables pkginfo) >= 2
--TODO: exclude non-buildable exes
pkgkind | hasLib pkginfo && hasExes = text "programs and library"
| hasLib pkginfo && hasExe pkginfo = text "program and library"
| hasLib pkginfo = text "library"
| hasExes = text "programs"
| hasExe pkginfo = text "program"
| otherwise = empty | 3,495 | showPackageDetailedInfo :: PackageDisplayInfo -> String
showPackageDetailedInfo pkginfo =
renderStyle (style {lineLength = 80, ribbonsPerLine = 1}) $
char '*' <+> disp (pkgName pkginfo)
<> maybe empty (\v -> char '-' <> disp v) (selectedVersion pkginfo)
<+> text (replicate (16 - length (display (pkgName pkginfo))) ' ')
<> parens pkgkind
$+$
(nest 4 $ vcat [
entry "Synopsis" synopsis hideIfNull reflowParagraphs
, entry "Versions available" sourceVersions
(altText null "[ Not available from server ]")
(dispTopVersions 9 (preferredVersions pkginfo))
, entry "Versions installed" installedVersions
(altText null (if hasLib pkginfo then "[ Not installed ]"
else "[ Unknown ]"))
(dispTopVersions 4 (preferredVersions pkginfo))
, entry "Homepage" homepage orNotSpecified text
, entry "Bug reports" bugReports orNotSpecified text
, entry "Description" description hideIfNull reflowParagraphs
, entry "Category" category hideIfNull text
, entry "License" license alwaysShow disp
, entry "Author" author hideIfNull reflowLines
, entry "Maintainer" maintainer hideIfNull reflowLines
, entry "Source repo" sourceRepo orNotSpecified text
, entry "Executables" executables hideIfNull (commaSep text)
, entry "Flags" flags hideIfNull (commaSep dispFlag)
, entry "Dependencies" dependencies hideIfNull (commaSep dispExtDep)
, entry "Documentation" haddockHtml showIfInstalled text
, entry "Cached" haveTarball alwaysShow dispYesNo
, if not (hasLib pkginfo) then empty else
text "Modules:" $+$ nest 4 (vcat (map disp . sort . modules $ pkginfo))
])
$+$ text ""
where
entry fname field cond format = case cond (field pkginfo) of
Nothing -> label <+> format (field pkginfo)
Just Nothing -> empty
Just (Just other) -> label <+> text other
where
label = text fname <> char ':' <> padding
padding = text (replicate (13 - length fname ) ' ')
normal = Nothing
hide = Just Nothing
replace msg = Just (Just msg)
alwaysShow = const normal
hideIfNull v = if null v then hide else normal
showIfInstalled v
| not isInstalled = hide
| null v = replace "[ Not installed ]"
| otherwise = normal
altText nul msg v = if nul v then replace msg else normal
orNotSpecified = altText null "[ Not specified ]"
commaSep f = Disp.fsep . Disp.punctuate (Disp.char ',') . map f
dispFlag f = case flagName f of FlagName n -> text n
dispYesNo True = text "Yes"
dispYesNo False = text "No"
dispExtDep (SourceDependency dep) = disp dep
dispExtDep (InstalledDependency dep) = disp dep
isInstalled = not (null (installedVersions pkginfo))
hasExes = length (executables pkginfo) >= 2
--TODO: exclude non-buildable exes
pkgkind | hasLib pkginfo && hasExes = text "programs and library"
| hasLib pkginfo && hasExe pkginfo = text "program and library"
| hasLib pkginfo = text "library"
| hasExes = text "programs"
| hasExe pkginfo = text "program"
| otherwise = empty | 3,495 | showPackageDetailedInfo pkginfo =
renderStyle (style {lineLength = 80, ribbonsPerLine = 1}) $
char '*' <+> disp (pkgName pkginfo)
<> maybe empty (\v -> char '-' <> disp v) (selectedVersion pkginfo)
<+> text (replicate (16 - length (display (pkgName pkginfo))) ' ')
<> parens pkgkind
$+$
(nest 4 $ vcat [
entry "Synopsis" synopsis hideIfNull reflowParagraphs
, entry "Versions available" sourceVersions
(altText null "[ Not available from server ]")
(dispTopVersions 9 (preferredVersions pkginfo))
, entry "Versions installed" installedVersions
(altText null (if hasLib pkginfo then "[ Not installed ]"
else "[ Unknown ]"))
(dispTopVersions 4 (preferredVersions pkginfo))
, entry "Homepage" homepage orNotSpecified text
, entry "Bug reports" bugReports orNotSpecified text
, entry "Description" description hideIfNull reflowParagraphs
, entry "Category" category hideIfNull text
, entry "License" license alwaysShow disp
, entry "Author" author hideIfNull reflowLines
, entry "Maintainer" maintainer hideIfNull reflowLines
, entry "Source repo" sourceRepo orNotSpecified text
, entry "Executables" executables hideIfNull (commaSep text)
, entry "Flags" flags hideIfNull (commaSep dispFlag)
, entry "Dependencies" dependencies hideIfNull (commaSep dispExtDep)
, entry "Documentation" haddockHtml showIfInstalled text
, entry "Cached" haveTarball alwaysShow dispYesNo
, if not (hasLib pkginfo) then empty else
text "Modules:" $+$ nest 4 (vcat (map disp . sort . modules $ pkginfo))
])
$+$ text ""
where
entry fname field cond format = case cond (field pkginfo) of
Nothing -> label <+> format (field pkginfo)
Just Nothing -> empty
Just (Just other) -> label <+> text other
where
label = text fname <> char ':' <> padding
padding = text (replicate (13 - length fname ) ' ')
normal = Nothing
hide = Just Nothing
replace msg = Just (Just msg)
alwaysShow = const normal
hideIfNull v = if null v then hide else normal
showIfInstalled v
| not isInstalled = hide
| null v = replace "[ Not installed ]"
| otherwise = normal
altText nul msg v = if nul v then replace msg else normal
orNotSpecified = altText null "[ Not specified ]"
commaSep f = Disp.fsep . Disp.punctuate (Disp.char ',') . map f
dispFlag f = case flagName f of FlagName n -> text n
dispYesNo True = text "Yes"
dispYesNo False = text "No"
dispExtDep (SourceDependency dep) = disp dep
dispExtDep (InstalledDependency dep) = disp dep
isInstalled = not (null (installedVersions pkginfo))
hasExes = length (executables pkginfo) >= 2
--TODO: exclude non-buildable exes
pkgkind | hasLib pkginfo && hasExes = text "programs and library"
| hasLib pkginfo && hasExe pkginfo = text "program and library"
| hasLib pkginfo = text "library"
| hasExes = text "programs"
| hasExe pkginfo = text "program"
| otherwise = empty | 3,439 | false | true | 27 | 18 | 1,109 | 1,029 | 481 | 548 | null | null |
siddhanathan/ghc | testsuite/tests/typecheck/should_run/T1735_Help/Basics.hs | bsd-3-clause | -- | Test for a non-representable type
isNorepType :: DataType -> Bool
isNorepType dt = case datarep dt of
NoRep -> True
_ -> False | 173 | isNorepType :: DataType -> Bool
isNorepType dt = case datarep dt of
NoRep -> True
_ -> False | 132 | isNorepType dt = case datarep dt of
NoRep -> True
_ -> False | 100 | true | true | 0 | 8 | 66 | 44 | 20 | 24 | null | null |
brendanhay/gogol | gogol-sheets/gen/Network/Google/Sheets/Types/Product.hs | mpl-2.0 | -- | The cell the object is anchored to.
opAnchorCell :: Lens' OverlayPosition (Maybe GridCoordinate)
opAnchorCell
= lens _opAnchorCell (\ s a -> s{_opAnchorCell = a}) | 169 | opAnchorCell :: Lens' OverlayPosition (Maybe GridCoordinate)
opAnchorCell
= lens _opAnchorCell (\ s a -> s{_opAnchorCell = a}) | 128 | opAnchorCell
= lens _opAnchorCell (\ s a -> s{_opAnchorCell = a}) | 67 | true | true | 1 | 9 | 27 | 52 | 25 | 27 | null | null |
afcowie/konvig | lib/Data/Config/Parser.hs | bsd-3-clause | key :: Parser Key
key = do
candidate <- takeWhile1 (not . isHorizontalSpace)
case T.find (not . isAlphaNum) candidate of
Nothing -> return candidate
Just _ -> fail "key must be an alpha-numeric identifier" | 230 | key :: Parser Key
key = do
candidate <- takeWhile1 (not . isHorizontalSpace)
case T.find (not . isAlphaNum) candidate of
Nothing -> return candidate
Just _ -> fail "key must be an alpha-numeric identifier" | 230 | key = do
candidate <- takeWhile1 (not . isHorizontalSpace)
case T.find (not . isAlphaNum) candidate of
Nothing -> return candidate
Just _ -> fail "key must be an alpha-numeric identifier" | 212 | false | true | 0 | 11 | 58 | 79 | 35 | 44 | null | null |
danr/hipspec | examples/Flatten3.hs | gpl-3.0 | flat2 (B (Leaf x) r) = x : flat2 r | 34 | flat2 (B (Leaf x) r) = x : flat2 r | 34 | flat2 (B (Leaf x) r) = x : flat2 r | 34 | false | false | 0 | 9 | 9 | 30 | 14 | 16 | null | null |
GregorySchwartz/dotfiles | .xmonad/xmonad.hs | gpl-2.0 | colors "darkmagenta" = "#b16286" | 32 | colors "darkmagenta" = "#b16286" | 32 | colors "darkmagenta" = "#b16286" | 32 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
SumAll/haskell-canteven-log | src/Canteven/Log/MonadLog.hs | apache-2.0 | configPermits :: LoggingConfig -> Loc -> LogSource -> LogLevel -> Bool
configPermits LoggingConfig {level=defaultLP, loggers} = runFilters
where
predicates = map toPredicate loggers
toPredicate LoggerDetails {loggerName, loggerPackage,
loggerModule, loggerLevel=loggerLevel}
loc src level =
if matches (T.pack <$> loggerName) src &&
matches loggerPackage (loc_package loc) &&
matchesGlob loggerModule (loc_module loc)
then Just (level >= loggerLevel)
else Nothing
-- It's considered a "match" if either the specification is absent (matches
-- everything), or the specification is given and matches the target.
matches Nothing _ = True
matches (Just s1) s2 = s1 == s2
-- Not real glob matching.
matchesGlob Nothing _ = True
matchesGlob (Just p) candidate
| "*" `isSuffixOf` p = dropWhileEnd (=='*') p `isPrefixOf` candidate
| otherwise = p == candidate
runFilters loc src level =
-- default to the defaultLP
fromMaybe (level >= defaultLP) $
-- take the first value
listToMaybe $
-- of the predicates that returned Just something
mapMaybe (\p -> p loc src level) predicates
-- | This is similar to the version defined in monad-logger (which we can't
-- share because of privacy restrictions), but with the added nuance of
-- uppercasing. | 1,428 | configPermits :: LoggingConfig -> Loc -> LogSource -> LogLevel -> Bool
configPermits LoggingConfig {level=defaultLP, loggers} = runFilters
where
predicates = map toPredicate loggers
toPredicate LoggerDetails {loggerName, loggerPackage,
loggerModule, loggerLevel=loggerLevel}
loc src level =
if matches (T.pack <$> loggerName) src &&
matches loggerPackage (loc_package loc) &&
matchesGlob loggerModule (loc_module loc)
then Just (level >= loggerLevel)
else Nothing
-- It's considered a "match" if either the specification is absent (matches
-- everything), or the specification is given and matches the target.
matches Nothing _ = True
matches (Just s1) s2 = s1 == s2
-- Not real glob matching.
matchesGlob Nothing _ = True
matchesGlob (Just p) candidate
| "*" `isSuffixOf` p = dropWhileEnd (=='*') p `isPrefixOf` candidate
| otherwise = p == candidate
runFilters loc src level =
-- default to the defaultLP
fromMaybe (level >= defaultLP) $
-- take the first value
listToMaybe $
-- of the predicates that returned Just something
mapMaybe (\p -> p loc src level) predicates
-- | This is similar to the version defined in monad-logger (which we can't
-- share because of privacy restrictions), but with the added nuance of
-- uppercasing. | 1,428 | configPermits LoggingConfig {level=defaultLP, loggers} = runFilters
where
predicates = map toPredicate loggers
toPredicate LoggerDetails {loggerName, loggerPackage,
loggerModule, loggerLevel=loggerLevel}
loc src level =
if matches (T.pack <$> loggerName) src &&
matches loggerPackage (loc_package loc) &&
matchesGlob loggerModule (loc_module loc)
then Just (level >= loggerLevel)
else Nothing
-- It's considered a "match" if either the specification is absent (matches
-- everything), or the specification is given and matches the target.
matches Nothing _ = True
matches (Just s1) s2 = s1 == s2
-- Not real glob matching.
matchesGlob Nothing _ = True
matchesGlob (Just p) candidate
| "*" `isSuffixOf` p = dropWhileEnd (=='*') p `isPrefixOf` candidate
| otherwise = p == candidate
runFilters loc src level =
-- default to the defaultLP
fromMaybe (level >= defaultLP) $
-- take the first value
listToMaybe $
-- of the predicates that returned Just something
mapMaybe (\p -> p loc src level) predicates
-- | This is similar to the version defined in monad-logger (which we can't
-- share because of privacy restrictions), but with the added nuance of
-- uppercasing. | 1,357 | false | true | 9 | 15 | 380 | 303 | 160 | 143 | null | null |
brendanhay/gogol | gogol-dfareporting/gen/Network/Google/DFAReporting/Types/Product.hs | mpl-2.0 | -- | Dimension value for the ID of the advertiser. This is a read-only,
-- auto-generated field.
cgAdvertiserIdDimensionValue :: Lens' CreativeGroup (Maybe DimensionValue)
cgAdvertiserIdDimensionValue
= lens _cgAdvertiserIdDimensionValue
(\ s a -> s{_cgAdvertiserIdDimensionValue = a}) | 293 | cgAdvertiserIdDimensionValue :: Lens' CreativeGroup (Maybe DimensionValue)
cgAdvertiserIdDimensionValue
= lens _cgAdvertiserIdDimensionValue
(\ s a -> s{_cgAdvertiserIdDimensionValue = a}) | 196 | cgAdvertiserIdDimensionValue
= lens _cgAdvertiserIdDimensionValue
(\ s a -> s{_cgAdvertiserIdDimensionValue = a}) | 121 | true | true | 0 | 8 | 41 | 50 | 26 | 24 | null | null |
alang9/deque | Data/Deque/NonCat.hs | bsd-3-clause | fixup2' (BigR (XR (B2 a b) (B0)) N (TinyL (B1 (P s t)))) = go4 a b s t | 112 | fixup2' (BigR (XR (B2 a b) (B0)) N (TinyL (B1 (P s t)))) = go4 a b s t | 112 | fixup2' (BigR (XR (B2 a b) (B0)) N (TinyL (B1 (P s t)))) = go4 a b s t | 112 | false | false | 0 | 12 | 60 | 68 | 33 | 35 | null | null |
schell/lamdu | bottlelib/Data/Store/Rev/View.hs | gpl-3.0 | curVersion :: MonadA m => View (Tag m) -> Transaction m (Version (Tag m))
curVersion = Branch.curVersion <=< branch | 115 | curVersion :: MonadA m => View (Tag m) -> Transaction m (Version (Tag m))
curVersion = Branch.curVersion <=< branch | 115 | curVersion = Branch.curVersion <=< branch | 41 | false | true | 0 | 12 | 18 | 60 | 27 | 33 | null | null |
sigrlami/pollock | app-snap/src/Db.hs | mit | getPolls :: Connection -> IO [Poll]
getPolls conn = do
let !query' = Data.List.unlines
[ "SELECT * FROM poll"
]
!query'' = fromString $ query' :: Query
(xss::[Poll]) <- query_ conn query''
return xss | 249 | getPolls :: Connection -> IO [Poll]
getPolls conn = do
let !query' = Data.List.unlines
[ "SELECT * FROM poll"
]
!query'' = fromString $ query' :: Query
(xss::[Poll]) <- query_ conn query''
return xss | 249 | getPolls conn = do
let !query' = Data.List.unlines
[ "SELECT * FROM poll"
]
!query'' = fromString $ query' :: Query
(xss::[Poll]) <- query_ conn query''
return xss | 213 | false | true | 0 | 12 | 83 | 91 | 42 | 49 | null | null |
LouisJenkinsCS/Minimal-JVM | Main.hs | bsd-3-clause | parseArgs _ _ = parseArgs ["-"] False | 37 | parseArgs _ _ = parseArgs ["-"] False | 37 | parseArgs _ _ = parseArgs ["-"] False | 37 | false | false | 0 | 6 | 6 | 19 | 9 | 10 | null | null |
energyflowanalysis/efa-2.1 | src/EFA/Graph/Topology/StateAnalysis.hs | bsd-3-clause | clusteringGreedy :: (Node.C node) => Topology node -> [FlowTopology node]
clusteringGreedy topo =
let (cleanTopo, es) = splitNodesEdges topo
in untilLeft (mergeSmallestClusters cleanTopo) $
PQ.fromList $
map (\c -> (length $ clusterEdges c, c)) $
emptyCluster cleanTopo :
map (singletonCluster cleanTopo) es | 345 | clusteringGreedy :: (Node.C node) => Topology node -> [FlowTopology node]
clusteringGreedy topo =
let (cleanTopo, es) = splitNodesEdges topo
in untilLeft (mergeSmallestClusters cleanTopo) $
PQ.fromList $
map (\c -> (length $ clusterEdges c, c)) $
emptyCluster cleanTopo :
map (singletonCluster cleanTopo) es | 345 | clusteringGreedy topo =
let (cleanTopo, es) = splitNodesEdges topo
in untilLeft (mergeSmallestClusters cleanTopo) $
PQ.fromList $
map (\c -> (length $ clusterEdges c, c)) $
emptyCluster cleanTopo :
map (singletonCluster cleanTopo) es | 271 | false | true | 0 | 15 | 79 | 124 | 61 | 63 | null | null |
sherwoodwang/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxSYS_COLOUR_3DSHADOW :: Int
wxSYS_COLOUR_3DSHADOW = 16 | 55 | wxSYS_COLOUR_3DSHADOW :: Int
wxSYS_COLOUR_3DSHADOW = 16 | 55 | wxSYS_COLOUR_3DSHADOW = 16 | 26 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
jvilar/hrows | lib/GUI/DialogManager/Actions.hs | gpl-2.0 | addComboBox :: Grid -> [Text] -> Int32 -> Int32 -> IO ComboBoxText
addComboBox grid options left top = do
cbox <- comboBoxTextNew
forM_ options $ #append cbox Nothing
#setActive cbox 0
#attach grid cbox left top 1 1
return cbox | 247 | addComboBox :: Grid -> [Text] -> Int32 -> Int32 -> IO ComboBoxText
addComboBox grid options left top = do
cbox <- comboBoxTextNew
forM_ options $ #append cbox Nothing
#setActive cbox 0
#attach grid cbox left top 1 1
return cbox | 247 | addComboBox grid options left top = do
cbox <- comboBoxTextNew
forM_ options $ #append cbox Nothing
#setActive cbox 0
#attach grid cbox left top 1 1
return cbox | 180 | false | true | 0 | 10 | 59 | 99 | 43 | 56 | null | null |
ksallberg/adventofcode | 2015/src/Day19_2.hs | bsd-2-clause | trans "NRnMgAr" = "H" | 21 | trans "NRnMgAr" = "H" | 21 | trans "NRnMgAr" = "H" | 21 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
nh2/shake | Examples/Test/Directory.hs | bsd-3-clause | readEsc ('_':'l':xs) = '/' : readEsc xs | 39 | readEsc ('_':'l':xs) = '/' : readEsc xs | 39 | readEsc ('_':'l':xs) = '/' : readEsc xs | 39 | false | false | 0 | 8 | 6 | 27 | 13 | 14 | null | null |
RoboNickBot/fnlp | src/Database/SimpleDB.hs | gpl-3.0 | sqlsBare :: (Convertible SqlValue v) => [SqlValue] -> v
sqlsBare (a:[]) = fromSql a | 83 | sqlsBare :: (Convertible SqlValue v) => [SqlValue] -> v
sqlsBare (a:[]) = fromSql a | 83 | sqlsBare (a:[]) = fromSql a | 27 | false | true | 0 | 8 | 13 | 44 | 23 | 21 | null | null |
haskell-id/website | src/Site.hs | bsd-3-clause | hakyllConf :: Configuration
hakyllConf = defaultConfiguration {
providerDirectory = "provider"
} | 100 | hakyllConf :: Configuration
hakyllConf = defaultConfiguration {
providerDirectory = "provider"
} | 100 | hakyllConf = defaultConfiguration {
providerDirectory = "provider"
} | 72 | false | true | 0 | 6 | 14 | 19 | 11 | 8 | null | null |
mfpi/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/EXT/VertexShader.hs | bsd-3-clause | gl_OP_EXP_BASE_2 :: GLenum
gl_OP_EXP_BASE_2 = 0x8791 | 52 | gl_OP_EXP_BASE_2 :: GLenum
gl_OP_EXP_BASE_2 = 0x8791 | 52 | gl_OP_EXP_BASE_2 = 0x8791 | 25 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
rickerbh/GenerativeArtHaskell | GenerativeArt.hsproj/GenerativeArtC3.hs | mit | line4Points = partition 2 1 (zip steps l4ys) | 44 | line4Points = partition 2 1 (zip steps l4ys) | 44 | line4Points = partition 2 1 (zip steps l4ys) | 44 | false | false | 1 | 7 | 7 | 26 | 10 | 16 | null | null |
lenary/Idris-dev | src/Idris/Core/TT.hs | bsd-3-clause | str :: T.Text -> String
str = T.unpack | 38 | str :: T.Text -> String
str = T.unpack | 38 | str = T.unpack | 14 | false | true | 0 | 7 | 7 | 26 | 11 | 15 | null | null |
dgvncsz0f/nws | src/Jerimum/Storage/Server/Pipe.hs | bsd-3-clause | startInterruptible ::
MonadLoggerIO m => Sentinel -> Config -> Connection -> Sink -> m ()
startInterruptible sentinel config replConn sink = do
continue <- liftIO sentinel
when continue $ do
mfeed <- liftIO (openFeed replConn config (lastLsn sink))
case mfeed of
Nothing -> do
stat <- liftIO $ status replConn
if ConnectionBad == stat
then do
$(logWarn) "database connection lost, trying to reconnect"
liftIO $ reset replConn
else $(logError) "error connecting to replication slot"
liftIO $ threadDelay (1000 * 1000)
startInterruptible sentinel config replConn sink
Just feed -> do
$(logInfo) "connected to replication slot"
serverLoop sentinel feed sink
startInterruptible sentinel config replConn sink | 832 | startInterruptible ::
MonadLoggerIO m => Sentinel -> Config -> Connection -> Sink -> m ()
startInterruptible sentinel config replConn sink = do
continue <- liftIO sentinel
when continue $ do
mfeed <- liftIO (openFeed replConn config (lastLsn sink))
case mfeed of
Nothing -> do
stat <- liftIO $ status replConn
if ConnectionBad == stat
then do
$(logWarn) "database connection lost, trying to reconnect"
liftIO $ reset replConn
else $(logError) "error connecting to replication slot"
liftIO $ threadDelay (1000 * 1000)
startInterruptible sentinel config replConn sink
Just feed -> do
$(logInfo) "connected to replication slot"
serverLoop sentinel feed sink
startInterruptible sentinel config replConn sink | 832 | startInterruptible sentinel config replConn sink = do
continue <- liftIO sentinel
when continue $ do
mfeed <- liftIO (openFeed replConn config (lastLsn sink))
case mfeed of
Nothing -> do
stat <- liftIO $ status replConn
if ConnectionBad == stat
then do
$(logWarn) "database connection lost, trying to reconnect"
liftIO $ reset replConn
else $(logError) "error connecting to replication slot"
liftIO $ threadDelay (1000 * 1000)
startInterruptible sentinel config replConn sink
Just feed -> do
$(logInfo) "connected to replication slot"
serverLoop sentinel feed sink
startInterruptible sentinel config replConn sink | 737 | false | true | 0 | 20 | 231 | 233 | 104 | 129 | null | null |
bartfrenk/jira-client | src/Run.hs | bsd-3-clause | runCommandM :: CommandM a -> Options -> Log -> IO (Either Failure a, Log)
runCommandM act opts =
runStateT (runReaderT (runExceptT act) opts) | 143 | runCommandM :: CommandM a -> Options -> Log -> IO (Either Failure a, Log)
runCommandM act opts =
runStateT (runReaderT (runExceptT act) opts) | 143 | runCommandM act opts =
runStateT (runReaderT (runExceptT act) opts) | 69 | false | true | 0 | 11 | 24 | 67 | 31 | 36 | null | null |
wavewave/chatter | src/server.hs | bsd-3-clause | broadcaster :: TVar [Message] -> IO ()
broadcaster tvarLog = do
serve HostAny "5002" $ \(sock,addr) -> do
putStrLn $ "TCP connection established from " ++ show addr
let go n = do (n',logs) <- atomically $ do
logs <- readTVar tvarLog
if null logs then retry else do
let n' = checkLatestMessage logs
if n' > n then return (n',logs) else retry
packAndSend sock (filter ((>n) . messageNum) logs)
go n'
go (-1) | 593 | broadcaster :: TVar [Message] -> IO ()
broadcaster tvarLog = do
serve HostAny "5002" $ \(sock,addr) -> do
putStrLn $ "TCP connection established from " ++ show addr
let go n = do (n',logs) <- atomically $ do
logs <- readTVar tvarLog
if null logs then retry else do
let n' = checkLatestMessage logs
if n' > n then return (n',logs) else retry
packAndSend sock (filter ((>n) . messageNum) logs)
go n'
go (-1) | 593 | broadcaster tvarLog = do
serve HostAny "5002" $ \(sock,addr) -> do
putStrLn $ "TCP connection established from " ++ show addr
let go n = do (n',logs) <- atomically $ do
logs <- readTVar tvarLog
if null logs then retry else do
let n' = checkLatestMessage logs
if n' > n then return (n',logs) else retry
packAndSend sock (filter ((>n) . messageNum) logs)
go n'
go (-1) | 554 | false | true | 0 | 27 | 261 | 204 | 97 | 107 | null | null |
jacekszymanski/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxSOUND_LOOP :: Int
wxSOUND_LOOP = 2 | 36 | wxSOUND_LOOP :: Int
wxSOUND_LOOP = 2 | 36 | wxSOUND_LOOP = 2 | 16 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
centromere/cacophony | tools/noise-repl/Types.hs | unlicense | patternToHandshake PatternKpsk0 = noiseKpsk0 | 45 | patternToHandshake PatternKpsk0 = noiseKpsk0 | 45 | patternToHandshake PatternKpsk0 = noiseKpsk0 | 45 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
adp-multi/adp-multi | tests/ADP/Tests/CopyExample.hs | bsd-3-clause | copyGr :: Copy_Algebra Char answerDim1 answerDim2 -> String -> [answerDim1]
copyGr algebra inp =
let
(nil,copy,copy') = algebra
s = tabulated1 $
copy <<< c >>> id1
rewriteCopy :: Dim2
rewriteCopy [a',a'',c1,c2] = ([a',c1],[a'',c2])
c = tabulated2 $
yieldSize2 (0,Nothing) (0,Nothing) $
copy' <<< 'a' ~~~ 'a' ~~~ c >>> rewriteCopy |||
copy' <<< 'b' ~~~ 'b' ~~~ c >>> rewriteCopy |||
nil <<< ("","") >>> id2
z = mk inp
tabulated1 = table1 z
tabulated2 = table2 z
in axiom z s | 558 | copyGr :: Copy_Algebra Char answerDim1 answerDim2 -> String -> [answerDim1]
copyGr algebra inp =
let
(nil,copy,copy') = algebra
s = tabulated1 $
copy <<< c >>> id1
rewriteCopy :: Dim2
rewriteCopy [a',a'',c1,c2] = ([a',c1],[a'',c2])
c = tabulated2 $
yieldSize2 (0,Nothing) (0,Nothing) $
copy' <<< 'a' ~~~ 'a' ~~~ c >>> rewriteCopy |||
copy' <<< 'b' ~~~ 'b' ~~~ c >>> rewriteCopy |||
nil <<< ("","") >>> id2
z = mk inp
tabulated1 = table1 z
tabulated2 = table2 z
in axiom z s | 558 | copyGr algebra inp =
let
(nil,copy,copy') = algebra
s = tabulated1 $
copy <<< c >>> id1
rewriteCopy :: Dim2
rewriteCopy [a',a'',c1,c2] = ([a',c1],[a'',c2])
c = tabulated2 $
yieldSize2 (0,Nothing) (0,Nothing) $
copy' <<< 'a' ~~~ 'a' ~~~ c >>> rewriteCopy |||
copy' <<< 'b' ~~~ 'b' ~~~ c >>> rewriteCopy |||
nil <<< ("","") >>> id2
z = mk inp
tabulated1 = table1 z
tabulated2 = table2 z
in axiom z s | 482 | false | true | 0 | 24 | 167 | 234 | 124 | 110 | null | null |
hemio-ev/libghc-acme | test/TestIntegration.hs | lgpl-3.0 | myHttpServer :: HTTPServerLiveConf -> IO ()
myHttpServer v = do
void $ forkIO $ runServer "127.0.0.1"
void $ forkIO $ runServer "::1"
where
runServer host =
runSettings (setHost host $ setPort 5002 defaultSettings) app
app req respond = do
resp <- readIORef v
let host =
takeWhile (/= ':') $
B.unpack $ fromJust $ lookup "Host" $ requestHeaders req
path = B.unpack $ rawPathInfo req
case lookup (host, path) resp of
Nothing -> error $ show (host, path) ++ " not found in " ++ show resp
Just r -> do
putStrLn $
"[HTTP-Server] Responding to request: " ++ show (host, path)
respond $ responseLBS status200 [] (L.pack r) | 736 | myHttpServer :: HTTPServerLiveConf -> IO ()
myHttpServer v = do
void $ forkIO $ runServer "127.0.0.1"
void $ forkIO $ runServer "::1"
where
runServer host =
runSettings (setHost host $ setPort 5002 defaultSettings) app
app req respond = do
resp <- readIORef v
let host =
takeWhile (/= ':') $
B.unpack $ fromJust $ lookup "Host" $ requestHeaders req
path = B.unpack $ rawPathInfo req
case lookup (host, path) resp of
Nothing -> error $ show (host, path) ++ " not found in " ++ show resp
Just r -> do
putStrLn $
"[HTTP-Server] Responding to request: " ++ show (host, path)
respond $ responseLBS status200 [] (L.pack r) | 736 | myHttpServer v = do
void $ forkIO $ runServer "127.0.0.1"
void $ forkIO $ runServer "::1"
where
runServer host =
runSettings (setHost host $ setPort 5002 defaultSettings) app
app req respond = do
resp <- readIORef v
let host =
takeWhile (/= ':') $
B.unpack $ fromJust $ lookup "Host" $ requestHeaders req
path = B.unpack $ rawPathInfo req
case lookup (host, path) resp of
Nothing -> error $ show (host, path) ++ " not found in " ++ show resp
Just r -> do
putStrLn $
"[HTTP-Server] Responding to request: " ++ show (host, path)
respond $ responseLBS status200 [] (L.pack r) | 692 | false | true | 1 | 19 | 228 | 257 | 121 | 136 | null | null |
sjakobi/stack | src/Stack/PackageDump.hs | bsd-3-clause | stripSuffixText :: Text -> Text -> Maybe Text
stripSuffixText x y
| x `T.isSuffixOf` y = Just $ T.take (T.length y - T.length x) y
| otherwise = Nothing | 160 | stripSuffixText :: Text -> Text -> Maybe Text
stripSuffixText x y
| x `T.isSuffixOf` y = Just $ T.take (T.length y - T.length x) y
| otherwise = Nothing | 160 | stripSuffixText x y
| x `T.isSuffixOf` y = Just $ T.take (T.length y - T.length x) y
| otherwise = Nothing | 114 | false | true | 0 | 11 | 36 | 78 | 37 | 41 | null | null |
antonlogvinenko/javelin | src/Javelin/Lib/ByteCode/Stats.hs | mit | oc L2D = "l2d" | 14 | oc L2D = "l2d" | 14 | oc L2D = "l2d" | 14 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
mumuki/mulang | src/Language/Mulang/Analyzer/Synthesizer.hs | gpl-3.0 | -- extract an operator from an inspection
decodeIsInspection :: Decoder Operator
decodeIsInspection = decodeInspection "Is" | 124 | decodeIsInspection :: Decoder Operator
decodeIsInspection = decodeInspection "Is" | 81 | decodeIsInspection = decodeInspection "Is" | 42 | true | true | 0 | 5 | 15 | 18 | 9 | 9 | null | null |
MattWis/smallEmail | smallEmail/ParseEmail.hs | mit | flattenContent :: Content -> [Content]
flattenContent content = case content of
Multipart _ contents -> concatMap flattenContent contents
Singlepart _ _ -> [content] | 169 | flattenContent :: Content -> [Content]
flattenContent content = case content of
Multipart _ contents -> concatMap flattenContent contents
Singlepart _ _ -> [content] | 169 | flattenContent content = case content of
Multipart _ contents -> concatMap flattenContent contents
Singlepart _ _ -> [content] | 130 | false | true | 0 | 9 | 26 | 59 | 28 | 31 | null | null |
nikita-volkov/hasql-th | library/Hasql/TH/Extraction/ChildExprList.hs | mit | constCharacter (ConstCharacter _ _) = [] | 40 | constCharacter (ConstCharacter _ _) = [] | 40 | constCharacter (ConstCharacter _ _) = [] | 40 | false | false | 0 | 6 | 5 | 20 | 9 | 11 | null | null |
kfish/hogg | tools/hogg.hs | bsd-3-clause | -- All pages, from all files, matching the given criteria
pages :: Hot [[[OggPage]]]
pages = chainMatch chainPages | 114 | pages :: Hot [[[OggPage]]]
pages = chainMatch chainPages | 56 | pages = chainMatch chainPages | 29 | true | true | 0 | 9 | 17 | 33 | 16 | 17 | null | null |
coubeatczech/product-profunctors | Data/Profunctor/Product/Flatten.hs | bsd-3-clause | flatten17 (a, (b, (c, (a4, (a5, (a6, (a7, (a8, (a9, (a10, (a11, (a12,
(a13, (a14, (a15, (a16, a17))))))))))))))))
= (a, b, c, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) | 202 | flatten17 (a, (b, (c, (a4, (a5, (a6, (a7, (a8, (a9, (a10, (a11, (a12,
(a13, (a14, (a15, (a16, a17))))))))))))))))
= (a, b, c, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) | 202 | flatten17 (a, (b, (c, (a4, (a5, (a6, (a7, (a8, (a9, (a10, (a11, (a12,
(a13, (a14, (a15, (a16, a17))))))))))))))))
= (a, b, c, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) | 202 | false | false | 0 | 21 | 48 | 156 | 102 | 54 | null | null |
wavewave/gnuplot | src/Graphics/Gnuplot/Frame/OptionSet.hs | bsd-3-clause | yLabel :: Graph.C graph => String -> T graph -> T graph
yLabel = label Option.yLabelText | 88 | yLabel :: Graph.C graph => String -> T graph -> T graph
yLabel = label Option.yLabelText | 88 | yLabel = label Option.yLabelText | 32 | false | true | 0 | 8 | 15 | 39 | 18 | 21 | null | null |
shlevy/ghc | testsuite/tests/typecheck/should_compile/T2497.hs | bsd-3-clause | -- Used
beq = (==) | 18 | beq = (==) | 10 | beq = (==) | 10 | true | false | 1 | 5 | 4 | 13 | 6 | 7 | null | null |
Ian-Stewart-Binks/courseography | dependencies/HaXml-1.25.3/src/Text/XML/HaXml/OneOfN.hs | gpl-3.0 | foldOneOf16 a b c d e f g h i j k l m n o p (SevenOf16 z) = g z | 63 | foldOneOf16 a b c d e f g h i j k l m n o p (SevenOf16 z) = g z | 63 | foldOneOf16 a b c d e f g h i j k l m n o p (SevenOf16 z) = g z | 63 | false | false | 0 | 7 | 21 | 50 | 24 | 26 | null | null |
ekmett/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | mkBasicIndexedRead :: ByteOff -- Initial offset in bytes
-> Maybe MachOp -- Optional result cast
-> CmmType -- Type of element we are accessing
-> LocalReg -- Destination
-> CmmExpr -- Base address
-> CmmType -- Type of element by which we are indexing
-> CmmExpr -- Index
-> FCode ()
mkBasicIndexedRead off Nothing ty res base idx_ty idx
= do dflags <- getDynFlags
emitAssign (CmmLocal res) (cmmLoadIndexOffExpr dflags off ty base idx_ty idx) | 616 | mkBasicIndexedRead :: ByteOff -- Initial offset in bytes
-> Maybe MachOp -- Optional result cast
-> CmmType -- Type of element we are accessing
-> LocalReg -- Destination
-> CmmExpr -- Base address
-> CmmType -- Type of element by which we are indexing
-> CmmExpr -- Index
-> FCode ()
mkBasicIndexedRead off Nothing ty res base idx_ty idx
= do dflags <- getDynFlags
emitAssign (CmmLocal res) (cmmLoadIndexOffExpr dflags off ty base idx_ty idx) | 616 | mkBasicIndexedRead off Nothing ty res base idx_ty idx
= do dflags <- getDynFlags
emitAssign (CmmLocal res) (cmmLoadIndexOffExpr dflags off ty base idx_ty idx) | 169 | false | true | 0 | 13 | 246 | 106 | 54 | 52 | null | null |
HJvT/hdirect | src/Parser.hs | bsd-3-clause | action_562 (125#) = happyShift action_573 | 41 | action_562 (125#) = happyShift action_573 | 41 | action_562 (125#) = happyShift action_573 | 41 | false | false | 0 | 6 | 4 | 15 | 7 | 8 | null | null |
bixuanzju/fcore | lib/simplify/SimplifyImpl.hs | bsd-2-clause | getter _ _ _ _ = Nothing | 24 | getter _ _ _ _ = Nothing | 24 | getter _ _ _ _ = Nothing | 24 | false | false | 1 | 5 | 6 | 15 | 6 | 9 | null | null |
pparkkin/eta | compiler/ETA/TypeCheck/TcGenDeriv.hs | bsd-3-clause | infix_RDR = dataQual_RDR gENERICS (fsLit "Infix") | 54 | infix_RDR = dataQual_RDR gENERICS (fsLit "Infix") | 54 | infix_RDR = dataQual_RDR gENERICS (fsLit "Infix") | 54 | false | false | 0 | 7 | 10 | 17 | 8 | 9 | null | null |
Fuuzetsu/yi-agda | src/Yi/Mode/Agda.hs | gpl-3.0 | skippingPrompt ∷ Parser ()
skippingPrompt = void $ optional prompt | 66 | skippingPrompt ∷ Parser ()
skippingPrompt = void $ optional prompt | 66 | skippingPrompt = void $ optional prompt | 39 | false | true | 1 | 6 | 9 | 26 | 11 | 15 | null | null |
quintype/ringo | src/Ringo/Extractor/Internal.hs | mit | factDimFKIdColumnName :: Text -> Text -> Fact -> Table -> [Table] -> ColumnName
factDimFKIdColumnName dimPrefix dimIdColName dimFact dimTable@Table { .. } tables =
if dimTable `elem` tables
then head [ factColTargetColumn
| FactColumn {factColType = DimId {..}, ..} <- factColumns dimFact
, factColTargetTable == tableName ]
else fromMaybe tableName (Text.stripPrefix dimPrefix tableName) <> "_" <> dimIdColName | 453 | factDimFKIdColumnName :: Text -> Text -> Fact -> Table -> [Table] -> ColumnName
factDimFKIdColumnName dimPrefix dimIdColName dimFact dimTable@Table { .. } tables =
if dimTable `elem` tables
then head [ factColTargetColumn
| FactColumn {factColType = DimId {..}, ..} <- factColumns dimFact
, factColTargetTable == tableName ]
else fromMaybe tableName (Text.stripPrefix dimPrefix tableName) <> "_" <> dimIdColName | 453 | factDimFKIdColumnName dimPrefix dimIdColName dimFact dimTable@Table { .. } tables =
if dimTable `elem` tables
then head [ factColTargetColumn
| FactColumn {factColType = DimId {..}, ..} <- factColumns dimFact
, factColTargetTable == tableName ]
else fromMaybe tableName (Text.stripPrefix dimPrefix tableName) <> "_" <> dimIdColName | 373 | false | true | 0 | 14 | 97 | 135 | 70 | 65 | null | null |
adp-multi/adp-multi | src/ADP/Multi/Combinators.hs | bsd-3-clause | (|||) (ParserInfo2 (minY11,minY12) (maxY11,maxY12), r)
(ParserInfo2 (minY21,minY22) (maxY21,maxY22), q) =
(
ParserInfo2 {
minYield2 = (min minY11 minY21, min minY12 minY22),
maxYield2 = (liftM2 max maxY11 maxY21, liftM2 max maxY12 maxY22)
},
alt r q
) | 368 | (|||) (ParserInfo2 (minY11,minY12) (maxY11,maxY12), r)
(ParserInfo2 (minY21,minY22) (maxY21,maxY22), q) =
(
ParserInfo2 {
minYield2 = (min minY11 minY21, min minY12 minY22),
maxYield2 = (liftM2 max maxY11 maxY21, liftM2 max maxY12 maxY22)
},
alt r q
) | 368 | (|||) (ParserInfo2 (minY11,minY12) (maxY11,maxY12), r)
(ParserInfo2 (minY21,minY22) (maxY21,maxY22), q) =
(
ParserInfo2 {
minYield2 = (min minY11 minY21, min minY12 minY22),
maxYield2 = (liftM2 max maxY11 maxY21, liftM2 max maxY12 maxY22)
},
alt r q
) | 368 | false | false | 0 | 9 | 152 | 122 | 68 | 54 | null | null |
urbanslug/ghc | compiler/deSugar/Coverage.hs | bsd-3-clause | addTickHsExpr (NegApp e neg) =
liftM2 NegApp
(addTickLHsExpr e)
(addTickSyntaxExpr hpcSrcSpan neg) | 138 | addTickHsExpr (NegApp e neg) =
liftM2 NegApp
(addTickLHsExpr e)
(addTickSyntaxExpr hpcSrcSpan neg) | 138 | addTickHsExpr (NegApp e neg) =
liftM2 NegApp
(addTickLHsExpr e)
(addTickSyntaxExpr hpcSrcSpan neg) | 138 | false | false | 0 | 7 | 51 | 38 | 18 | 20 | null | null |
jhance/llvm-untyped | LLVM/Untyped/Core.hs | gpl-3.0 | getLastParam :: Value -> LLVM Value
getLastParam (Value value) = LLVM $ Value <$> L.getLastParam value | 102 | getLastParam :: Value -> LLVM Value
getLastParam (Value value) = LLVM $ Value <$> L.getLastParam value | 102 | getLastParam (Value value) = LLVM $ Value <$> L.getLastParam value | 66 | false | true | 0 | 7 | 15 | 40 | 19 | 21 | null | null |
maxsnew/TAPL | SimplyTyped/Lambda/Implementation/Interpreter.hs | bsd-3-clause | -- | Transitive Closure of eval1
eval :: Term -> Term
eval = last . evals | 73 | eval :: Term -> Term
eval = last . evals | 40 | eval = last . evals | 19 | true | true | 1 | 7 | 15 | 28 | 12 | 16 | null | null |
dhess/gpio | src/System/GPIO/Linux/Sysfs/Mock/Internal.hs | bsd-3-clause | -- cd /.. == /
root :: MockFSZipper -> MockFSZipper
root (MockFSZipper t []) = MockFSZipper t [] | 97 | root :: MockFSZipper -> MockFSZipper
root (MockFSZipper t []) = MockFSZipper t [] | 81 | root (MockFSZipper t []) = MockFSZipper t [] | 44 | true | true | 0 | 10 | 18 | 43 | 19 | 24 | null | null |
wavewave/ttbar | lib/HEP/Physics/TTBar/Reconstruction/Combined.hs | gpl-3.0 | action4AllComb :: (PhyEventClassified -> IO ()) -- ^ starter
-> (SemiLepTopBothInfo -> IO a) -- ^ main
-> PhyEventClassified -> IO [a]
action4AllComb starter iofunc p = do
starter p
case cnstrctCombinatorics p of
Nothing -> return []
Just r -> do let comb = (map mkSemiLepTopBothInfo) r
hline
putStrLn $ "chisqr minimum for all comb by Simulated Annealing"
mapM iofunc comb | 480 | action4AllComb :: (PhyEventClassified -> IO ()) -- ^ starter
-> (SemiLepTopBothInfo -> IO a) -- ^ main
-> PhyEventClassified -> IO [a]
action4AllComb starter iofunc p = do
starter p
case cnstrctCombinatorics p of
Nothing -> return []
Just r -> do let comb = (map mkSemiLepTopBothInfo) r
hline
putStrLn $ "chisqr minimum for all comb by Simulated Annealing"
mapM iofunc comb | 480 | action4AllComb starter iofunc p = do
starter p
case cnstrctCombinatorics p of
Nothing -> return []
Just r -> do let comb = (map mkSemiLepTopBothInfo) r
hline
putStrLn $ "chisqr minimum for all comb by Simulated Annealing"
mapM iofunc comb | 306 | false | true | 0 | 17 | 168 | 132 | 61 | 71 | null | null |
gcampax/ghc | compiler/typecheck/TcRnTypes.hs | bsd-3-clause | -- | Get the equality relation for the given 'Ct'
ctEqRel :: Ct -> EqRel
ctEqRel = ctEvEqRel . ctEvidence | 105 | ctEqRel :: Ct -> EqRel
ctEqRel = ctEvEqRel . ctEvidence | 55 | ctEqRel = ctEvEqRel . ctEvidence | 32 | true | true | 0 | 5 | 19 | 20 | 11 | 9 | null | null |
fmapfmapfmap/amazonka | amazonka-storagegateway/gen/Network/AWS/StorageGateway/Types/Product.hs | mpl-2.0 | -- | The secret key that the initiator (for example, the Windows client) must
-- provide to participate in mutual CHAP with the target.
ciSecretToAuthenticateInitiator :: Lens' ChapInfo (Maybe Text)
ciSecretToAuthenticateInitiator = lens _ciSecretToAuthenticateInitiator (\ s a -> s{_ciSecretToAuthenticateInitiator = a}) | 321 | ciSecretToAuthenticateInitiator :: Lens' ChapInfo (Maybe Text)
ciSecretToAuthenticateInitiator = lens _ciSecretToAuthenticateInitiator (\ s a -> s{_ciSecretToAuthenticateInitiator = a}) | 185 | ciSecretToAuthenticateInitiator = lens _ciSecretToAuthenticateInitiator (\ s a -> s{_ciSecretToAuthenticateInitiator = a}) | 122 | true | true | 0 | 9 | 40 | 47 | 26 | 21 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.