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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dnaq/crypto-sodium | src/Crypto/Sodium/SecretBox/Xsalsa20Poly1305.hs | mit | mkNonce :: ByteString -> Maybe Nonce
mkNonce = mkHelper nonceBytes Nonce | 72 | mkNonce :: ByteString -> Maybe Nonce
mkNonce = mkHelper nonceBytes Nonce | 72 | mkNonce = mkHelper nonceBytes Nonce | 35 | false | true | 0 | 7 | 10 | 29 | 12 | 17 | null | null |
sherwoodwang/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/Events.hs | lgpl-2.1 | printOutGetOnPrint :: WXCPrintout a -> IO (EventPrint -> IO ())
printOutGetOnPrint printOut
= do evtHandler <- wxcPrintoutGetEvtHandler printOut
unsafeGetHandlerState evtHandler idAny wxEVT_PRINT_PAGE (\_ev -> skipCurrentEvent)
{-----------------------------------------------------------------------------------------
Scrolling
-----------------------------------------------------------------------------------------}
-- | Scroll events. | 453 | printOutGetOnPrint :: WXCPrintout a -> IO (EventPrint -> IO ())
printOutGetOnPrint printOut
= do evtHandler <- wxcPrintoutGetEvtHandler printOut
unsafeGetHandlerState evtHandler idAny wxEVT_PRINT_PAGE (\_ev -> skipCurrentEvent)
{-----------------------------------------------------------------------------------------
Scrolling
-----------------------------------------------------------------------------------------}
-- | Scroll events. | 453 | printOutGetOnPrint printOut
= do evtHandler <- wxcPrintoutGetEvtHandler printOut
unsafeGetHandlerState evtHandler idAny wxEVT_PRINT_PAGE (\_ev -> skipCurrentEvent)
{-----------------------------------------------------------------------------------------
Scrolling
-----------------------------------------------------------------------------------------}
-- | Scroll events. | 389 | false | true | 0 | 10 | 45 | 68 | 33 | 35 | null | null |
guoguo12/haskell-ptable | ptable.hs | apache-2.0 | pnum "Lu" = 6 | 13 | pnum "Lu" = 6 | 13 | pnum "Lu" = 6 | 13 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
mettekou/ghc | compiler/types/Type.hs | bsd-3-clause | equalityTyCon :: Role -> TyCon
equalityTyCon Nominal = eqPrimTyCon | 75 | equalityTyCon :: Role -> TyCon
equalityTyCon Nominal = eqPrimTyCon | 75 | equalityTyCon Nominal = eqPrimTyCon | 44 | false | true | 0 | 5 | 17 | 18 | 9 | 9 | null | null |
PierreR/basic-prelude | test-is-a-prelude.hs | mit | unwords = P.unwords | 19 | unwords = P.unwords | 19 | unwords = P.unwords | 19 | false | false | 0 | 5 | 2 | 8 | 4 | 4 | null | null |
imalsogreg/arte-ephys | tetrode-ephys/src/Data/Ephys/Spike.hs | gpl-3.0 | ------------------------------------------------------------------------------
-- | The number of samples between the peak and trough of the spike.
-- The width of the channel used for spike timing is used.
spikeWidth :: TrodeSpike -- ^ The spike of interest
-> Int
spikeWidth s =
let iChanMax = V.maxIndexBy (comparing U.maximum) (spikeWaveforms s)
in chanSpikeWidth $ spikeWaveforms s V.! iChanMax | 423 | spikeWidth :: TrodeSpike -- ^ The spike of interest
-> Int
spikeWidth s =
let iChanMax = V.maxIndexBy (comparing U.maximum) (spikeWaveforms s)
in chanSpikeWidth $ spikeWaveforms s V.! iChanMax | 214 | spikeWidth s =
let iChanMax = V.maxIndexBy (comparing U.maximum) (spikeWaveforms s)
in chanSpikeWidth $ spikeWaveforms s V.! iChanMax | 144 | true | true | 4 | 12 | 79 | 75 | 35 | 40 | null | null |
abakst/liquidhaskell | benchmarks/vector-0.10.0.1/Data/Vector/Generic.hs | bsd-3-clause | scanr1 f = unstreamR . inplace (MStream.scanl1 (flip f)) . streamR | 66 | scanr1 f = unstreamR . inplace (MStream.scanl1 (flip f)) . streamR | 66 | scanr1 f = unstreamR . inplace (MStream.scanl1 (flip f)) . streamR | 66 | false | false | 2 | 10 | 10 | 39 | 16 | 23 | null | null |
jaanos/TPJ-2015-16 | microhaskell/Exercise4_mh.hs | mit | rpt :: Integer -> (Integer -> Integer) -> Integer -> Integer ;
rpt m f n = if m == 0 then n
else rpt (m-1) f (f n) | 126 | rpt :: Integer -> (Integer -> Integer) -> Integer -> Integer
rpt m f n = if m == 0 then n
else rpt (m-1) f (f n) | 124 | rpt m f n = if m == 0 then n
else rpt (m-1) f (f n) | 63 | false | true | 0 | 8 | 40 | 74 | 38 | 36 | null | null |
LightAndLight/psbt | src/PSBT/SemVer/Range.hs | bsd-3-clause | partialHyphenUpper :: Partial -> Range
partialHyphenUpper Zero = error "The upper bound of a hyphen range cannot be a single wildcard" | 135 | partialHyphenUpper :: Partial -> Range
partialHyphenUpper Zero = error "The upper bound of a hyphen range cannot be a single wildcard" | 134 | partialHyphenUpper Zero = error "The upper bound of a hyphen range cannot be a single wildcard" | 95 | false | true | 0 | 5 | 21 | 21 | 10 | 11 | null | null |
mettekou/ghc | compiler/basicTypes/Unique.hs | bsd-3-clause | getKey (MkUnique x) = x | 23 | getKey (MkUnique x) = x | 23 | getKey (MkUnique x) = x | 23 | false | false | 0 | 7 | 4 | 15 | 7 | 8 | null | null |
andorp/grin | grin/src/Test/Test.hs | bsd-3-clause | middleBindR :: TestExpContext
middleBindR = ("middle bind right", second tr) where
tr (exprText -> e) = [expr|
_prim_int_print 42
$e
_prim_int_print 1
|] | 177 | middleBindR :: TestExpContext
middleBindR = ("middle bind right", second tr) where
tr (exprText -> e) = [expr|
_prim_int_print 42
$e
_prim_int_print 1
|] | 177 | middleBindR = ("middle bind right", second tr) where
tr (exprText -> e) = [expr|
_prim_int_print 42
$e
_prim_int_print 1
|] | 147 | false | true | 0 | 9 | 46 | 41 | 24 | 17 | null | null |
ford-prefect/haskell-gi | lib/Data/GI/CodeGen/Conversions.hs | lgpl-2.1 | suForeignPtr :: Bool -> TypeRep -> Transfer -> CodeGen Constructor
suForeignPtr isBoxed hType transfer = do
let constructor = T.pack . tyConName . typeRepTyCon $ hType
if isBoxed then
boxedForeignPtr constructor transfer
else return $ M $ parenthesize $
case transfer of
TransferEverything -> "wrapPtr " <> constructor
_ -> "newPtr " <> constructor | 385 | suForeignPtr :: Bool -> TypeRep -> Transfer -> CodeGen Constructor
suForeignPtr isBoxed hType transfer = do
let constructor = T.pack . tyConName . typeRepTyCon $ hType
if isBoxed then
boxedForeignPtr constructor transfer
else return $ M $ parenthesize $
case transfer of
TransferEverything -> "wrapPtr " <> constructor
_ -> "newPtr " <> constructor | 385 | suForeignPtr isBoxed hType transfer = do
let constructor = T.pack . tyConName . typeRepTyCon $ hType
if isBoxed then
boxedForeignPtr constructor transfer
else return $ M $ parenthesize $
case transfer of
TransferEverything -> "wrapPtr " <> constructor
_ -> "newPtr " <> constructor | 318 | false | true | 0 | 13 | 90 | 108 | 53 | 55 | null | null |
uriba/BioSite | Handler/ExperimentUpload.hs | bsd-2-clause | createExpForm :: Form Text
createExpForm = renderDivs $ id <$> areq textField "New experiment id" Nothing | 106 | createExpForm :: Form Text
createExpForm = renderDivs $ id <$> areq textField "New experiment id" Nothing | 106 | createExpForm = renderDivs $ id <$> areq textField "New experiment id" Nothing | 79 | false | true | 0 | 6 | 16 | 29 | 14 | 15 | null | null |
wujf/yesod | yesod-bin/Build.hs | mit | determineDeps :: FilePath -> IO [(ComparisonType, FilePath)]
determineDeps x = do
y <- safeReadFile x
case y of
Left _ -> return []
Right bs -> do
let z = A.parseOnly (many $ (parser <|> (A.anyChar >> return Nothing)))
$ decodeUtf8With lenientDecode bs
case z of
Left _ -> return []
Right r -> mapM go r >>= filterM (doesFileExist . snd) . concat
where
go (Just (StaticFiles fp, _)) = map ((,) AlwaysOutdated) <$> getFolderContents fp
go (Just (Hamlet, f)) = return [(AlwaysOutdated, f)]
go (Just (Widget, f)) = return
[ (AlwaysOutdated, "templates/" ++ f ++ ".hamlet")
, (CompareUsedIdentifiers $ map fst . juliusUsedIdentifiers, "templates/" ++ f ++ ".julius")
, (CompareUsedIdentifiers $ map fst . luciusUsedIdentifiers, "templates/" ++ f ++ ".lucius")
, (CompareUsedIdentifiers $ map fst . cassiusUsedIdentifiers, "templates/" ++ f ++ ".cassius")
]
go (Just (Julius, f)) = return [(CompareUsedIdentifiers $ map fst . juliusUsedIdentifiers, f)]
go (Just (Cassius, f)) = return [(CompareUsedIdentifiers $ map fst . cassiusUsedIdentifiers, f)]
go (Just (Lucius, f)) = return [(CompareUsedIdentifiers $ map fst . luciusUsedIdentifiers, f)]
go (Just (Verbatim, f)) = return [(AlwaysOutdated, f)]
go (Just (Messages f, _)) = map ((,) AlwaysOutdated) <$> getFolderContents f
go Nothing = return []
parser = do
ty <- (do _ <- A.string "\nstaticFiles \""
x' <- A.many1 $ A.satisfy (/= '"')
return $ StaticFiles x')
<|> (A.string "$(parseRoutesFile " >> return Verbatim)
<|> (A.string "$(hamletFile " >> return Hamlet)
<|> (A.string "$(ihamletFile " >> return Hamlet)
<|> (A.string "$(whamletFile " >> return Hamlet)
<|> (A.string "$(html " >> return Hamlet)
<|> (A.string "$(widgetFile " >> return Widget)
<|> (A.string "$(Settings.hamletFile " >> return Hamlet)
<|> (A.string "$(Settings.widgetFile " >> return Widget)
<|> (A.string "$(juliusFile " >> return Julius)
<|> (A.string "$(cassiusFile " >> return Cassius)
<|> (A.string "$(luciusFile " >> return Lucius)
<|> (A.string "$(persistFile " >> return Verbatim)
<|> (
A.string "$(persistFileWith " >>
A.many1 (A.satisfy (/= '"')) >>
return Verbatim)
<|> (do
_ <- A.string "\nmkMessage \""
A.skipWhile (/= '"')
_ <- A.string "\" \""
x' <- A.many1 $ A.satisfy (/= '"')
_ <- A.string "\" \""
_y <- A.many1 $ A.satisfy (/= '"')
_ <- A.string "\""
return $ Messages x')
case ty of
Messages{} -> return $ Just (ty, "")
StaticFiles{} -> return $ Just (ty, "")
_ -> do
A.skipWhile isSpace
_ <- A.char '"'
y <- A.many1 $ A.satisfy (/= '"')
_ <- A.char '"'
A.skipWhile isSpace
_ <- A.char ')'
return $ Just (ty, y)
getFolderContents :: FilePath -> IO [FilePath]
getFolderContents fp = do
cs <- getDirectoryContents fp
let notHidden ('.':_) = False
notHidden ('t':"mp") = False
notHidden ('f':"ay") = False
notHidden _ = True
fmap concat $ forM (filter notHidden cs) $ \c -> do
let f = fp ++ '/' : c
isFile <- doesFileExist f
if isFile then return [f] else getFolderContents f | 3,772 | determineDeps :: FilePath -> IO [(ComparisonType, FilePath)]
determineDeps x = do
y <- safeReadFile x
case y of
Left _ -> return []
Right bs -> do
let z = A.parseOnly (many $ (parser <|> (A.anyChar >> return Nothing)))
$ decodeUtf8With lenientDecode bs
case z of
Left _ -> return []
Right r -> mapM go r >>= filterM (doesFileExist . snd) . concat
where
go (Just (StaticFiles fp, _)) = map ((,) AlwaysOutdated) <$> getFolderContents fp
go (Just (Hamlet, f)) = return [(AlwaysOutdated, f)]
go (Just (Widget, f)) = return
[ (AlwaysOutdated, "templates/" ++ f ++ ".hamlet")
, (CompareUsedIdentifiers $ map fst . juliusUsedIdentifiers, "templates/" ++ f ++ ".julius")
, (CompareUsedIdentifiers $ map fst . luciusUsedIdentifiers, "templates/" ++ f ++ ".lucius")
, (CompareUsedIdentifiers $ map fst . cassiusUsedIdentifiers, "templates/" ++ f ++ ".cassius")
]
go (Just (Julius, f)) = return [(CompareUsedIdentifiers $ map fst . juliusUsedIdentifiers, f)]
go (Just (Cassius, f)) = return [(CompareUsedIdentifiers $ map fst . cassiusUsedIdentifiers, f)]
go (Just (Lucius, f)) = return [(CompareUsedIdentifiers $ map fst . luciusUsedIdentifiers, f)]
go (Just (Verbatim, f)) = return [(AlwaysOutdated, f)]
go (Just (Messages f, _)) = map ((,) AlwaysOutdated) <$> getFolderContents f
go Nothing = return []
parser = do
ty <- (do _ <- A.string "\nstaticFiles \""
x' <- A.many1 $ A.satisfy (/= '"')
return $ StaticFiles x')
<|> (A.string "$(parseRoutesFile " >> return Verbatim)
<|> (A.string "$(hamletFile " >> return Hamlet)
<|> (A.string "$(ihamletFile " >> return Hamlet)
<|> (A.string "$(whamletFile " >> return Hamlet)
<|> (A.string "$(html " >> return Hamlet)
<|> (A.string "$(widgetFile " >> return Widget)
<|> (A.string "$(Settings.hamletFile " >> return Hamlet)
<|> (A.string "$(Settings.widgetFile " >> return Widget)
<|> (A.string "$(juliusFile " >> return Julius)
<|> (A.string "$(cassiusFile " >> return Cassius)
<|> (A.string "$(luciusFile " >> return Lucius)
<|> (A.string "$(persistFile " >> return Verbatim)
<|> (
A.string "$(persistFileWith " >>
A.many1 (A.satisfy (/= '"')) >>
return Verbatim)
<|> (do
_ <- A.string "\nmkMessage \""
A.skipWhile (/= '"')
_ <- A.string "\" \""
x' <- A.many1 $ A.satisfy (/= '"')
_ <- A.string "\" \""
_y <- A.many1 $ A.satisfy (/= '"')
_ <- A.string "\""
return $ Messages x')
case ty of
Messages{} -> return $ Just (ty, "")
StaticFiles{} -> return $ Just (ty, "")
_ -> do
A.skipWhile isSpace
_ <- A.char '"'
y <- A.many1 $ A.satisfy (/= '"')
_ <- A.char '"'
A.skipWhile isSpace
_ <- A.char ')'
return $ Just (ty, y)
getFolderContents :: FilePath -> IO [FilePath]
getFolderContents fp = do
cs <- getDirectoryContents fp
let notHidden ('.':_) = False
notHidden ('t':"mp") = False
notHidden ('f':"ay") = False
notHidden _ = True
fmap concat $ forM (filter notHidden cs) $ \c -> do
let f = fp ++ '/' : c
isFile <- doesFileExist f
if isFile then return [f] else getFolderContents f | 3,772 | determineDeps x = do
y <- safeReadFile x
case y of
Left _ -> return []
Right bs -> do
let z = A.parseOnly (many $ (parser <|> (A.anyChar >> return Nothing)))
$ decodeUtf8With lenientDecode bs
case z of
Left _ -> return []
Right r -> mapM go r >>= filterM (doesFileExist . snd) . concat
where
go (Just (StaticFiles fp, _)) = map ((,) AlwaysOutdated) <$> getFolderContents fp
go (Just (Hamlet, f)) = return [(AlwaysOutdated, f)]
go (Just (Widget, f)) = return
[ (AlwaysOutdated, "templates/" ++ f ++ ".hamlet")
, (CompareUsedIdentifiers $ map fst . juliusUsedIdentifiers, "templates/" ++ f ++ ".julius")
, (CompareUsedIdentifiers $ map fst . luciusUsedIdentifiers, "templates/" ++ f ++ ".lucius")
, (CompareUsedIdentifiers $ map fst . cassiusUsedIdentifiers, "templates/" ++ f ++ ".cassius")
]
go (Just (Julius, f)) = return [(CompareUsedIdentifiers $ map fst . juliusUsedIdentifiers, f)]
go (Just (Cassius, f)) = return [(CompareUsedIdentifiers $ map fst . cassiusUsedIdentifiers, f)]
go (Just (Lucius, f)) = return [(CompareUsedIdentifiers $ map fst . luciusUsedIdentifiers, f)]
go (Just (Verbatim, f)) = return [(AlwaysOutdated, f)]
go (Just (Messages f, _)) = map ((,) AlwaysOutdated) <$> getFolderContents f
go Nothing = return []
parser = do
ty <- (do _ <- A.string "\nstaticFiles \""
x' <- A.many1 $ A.satisfy (/= '"')
return $ StaticFiles x')
<|> (A.string "$(parseRoutesFile " >> return Verbatim)
<|> (A.string "$(hamletFile " >> return Hamlet)
<|> (A.string "$(ihamletFile " >> return Hamlet)
<|> (A.string "$(whamletFile " >> return Hamlet)
<|> (A.string "$(html " >> return Hamlet)
<|> (A.string "$(widgetFile " >> return Widget)
<|> (A.string "$(Settings.hamletFile " >> return Hamlet)
<|> (A.string "$(Settings.widgetFile " >> return Widget)
<|> (A.string "$(juliusFile " >> return Julius)
<|> (A.string "$(cassiusFile " >> return Cassius)
<|> (A.string "$(luciusFile " >> return Lucius)
<|> (A.string "$(persistFile " >> return Verbatim)
<|> (
A.string "$(persistFileWith " >>
A.many1 (A.satisfy (/= '"')) >>
return Verbatim)
<|> (do
_ <- A.string "\nmkMessage \""
A.skipWhile (/= '"')
_ <- A.string "\" \""
x' <- A.many1 $ A.satisfy (/= '"')
_ <- A.string "\" \""
_y <- A.many1 $ A.satisfy (/= '"')
_ <- A.string "\""
return $ Messages x')
case ty of
Messages{} -> return $ Just (ty, "")
StaticFiles{} -> return $ Just (ty, "")
_ -> do
A.skipWhile isSpace
_ <- A.char '"'
y <- A.many1 $ A.satisfy (/= '"')
_ <- A.char '"'
A.skipWhile isSpace
_ <- A.char ')'
return $ Just (ty, y)
getFolderContents :: FilePath -> IO [FilePath]
getFolderContents fp = do
cs <- getDirectoryContents fp
let notHidden ('.':_) = False
notHidden ('t':"mp") = False
notHidden ('f':"ay") = False
notHidden _ = True
fmap concat $ forM (filter notHidden cs) $ \c -> do
let f = fp ++ '/' : c
isFile <- doesFileExist f
if isFile then return [f] else getFolderContents f | 3,711 | false | true | 1 | 28 | 1,326 | 1,368 | 666 | 702 | null | null |
HIPERFIT/futhark | src/Futhark/Pass/ExplicitAllocations.hs | isc | stmConsts _ = mempty | 20 | stmConsts _ = mempty | 20 | stmConsts _ = mempty | 20 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
qiuhw/calc | src/Calc/SyntaxTree.hs | bsd-3-clause | evalExpr (Bind name e) = do
expr <- evalExpr e
modify $ insert name expr
return Nil | 95 | evalExpr (Bind name e) = do
expr <- evalExpr e
modify $ insert name expr
return Nil | 95 | evalExpr (Bind name e) = do
expr <- evalExpr e
modify $ insert name expr
return Nil | 95 | false | false | 0 | 8 | 28 | 45 | 19 | 26 | null | null |
cocreature/leksah | src/IDE/Debug.hs | gpl-2.0 | debugExecuteAndShowSelection :: IDEAction
debugExecuteAndShowSelection = do
maybeText <- selectedTextOrCurrentLine
case maybeText of
Just text -> packageTry $ tryDebug $ do
debugSetLiberalScope
debugCommand (stripComments text) $ do
out <- C.getZipSink $ const
<$> C.ZipSink (CL.fold buildOutputString "")
<*> C.ZipSink logOutputDefault
lift . insertTextAfterSelection $ " " <> out
Nothing -> ideMessage Normal "Please select some text in the editor to execute"
where
buildOutputString :: Text -> ToolOutput -> Text
buildOutputString "" (ToolOutput str) = str
buildOutputString s (ToolOutput str) = s <> "\n" <> str
buildOutputString s _ = s | 810 | debugExecuteAndShowSelection :: IDEAction
debugExecuteAndShowSelection = do
maybeText <- selectedTextOrCurrentLine
case maybeText of
Just text -> packageTry $ tryDebug $ do
debugSetLiberalScope
debugCommand (stripComments text) $ do
out <- C.getZipSink $ const
<$> C.ZipSink (CL.fold buildOutputString "")
<*> C.ZipSink logOutputDefault
lift . insertTextAfterSelection $ " " <> out
Nothing -> ideMessage Normal "Please select some text in the editor to execute"
where
buildOutputString :: Text -> ToolOutput -> Text
buildOutputString "" (ToolOutput str) = str
buildOutputString s (ToolOutput str) = s <> "\n" <> str
buildOutputString s _ = s | 810 | debugExecuteAndShowSelection = do
maybeText <- selectedTextOrCurrentLine
case maybeText of
Just text -> packageTry $ tryDebug $ do
debugSetLiberalScope
debugCommand (stripComments text) $ do
out <- C.getZipSink $ const
<$> C.ZipSink (CL.fold buildOutputString "")
<*> C.ZipSink logOutputDefault
lift . insertTextAfterSelection $ " " <> out
Nothing -> ideMessage Normal "Please select some text in the editor to execute"
where
buildOutputString :: Text -> ToolOutput -> Text
buildOutputString "" (ToolOutput str) = str
buildOutputString s (ToolOutput str) = s <> "\n" <> str
buildOutputString s _ = s | 768 | false | true | 0 | 22 | 257 | 197 | 92 | 105 | null | null |
kim/amazonka | amazonka-dynamodb/gen/Network/AWS/DynamoDB/GetItem.hs | mpl-2.0 | -- | A string that identifies one or more attributes to retrieve from the table.
-- These attributes can include scalars, sets, or elements of a JSON document.
-- The attributes in the expression must be separated by commas.
--
-- If no attribute names are specified, then all attributes will be returned.
-- If any of the requested attributes are not found, they will not appear in the
-- result.
--
-- For more information, go to <http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html Accessing Item Attributes> in the /Amazon DynamoDBDeveloper Guide/.
giProjectionExpression :: Lens' GetItem (Maybe Text)
giProjectionExpression =
lens _giProjectionExpression (\s a -> s { _giProjectionExpression = a }) | 760 | giProjectionExpression :: Lens' GetItem (Maybe Text)
giProjectionExpression =
lens _giProjectionExpression (\s a -> s { _giProjectionExpression = a }) | 154 | giProjectionExpression =
lens _giProjectionExpression (\s a -> s { _giProjectionExpression = a }) | 101 | true | true | 1 | 9 | 109 | 58 | 33 | 25 | null | null |
GaloisInc/saw-script | saw/SAWScript/REPL/Trie.hs | bsd-3-clause | leaves :: Trie a -> [a]
leaves (Node mp mb) = maybeToList mb ++ concatMap leaves (Map.elems mp) | 95 | leaves :: Trie a -> [a]
leaves (Node mp mb) = maybeToList mb ++ concatMap leaves (Map.elems mp) | 95 | leaves (Node mp mb) = maybeToList mb ++ concatMap leaves (Map.elems mp) | 71 | false | true | 0 | 9 | 17 | 52 | 25 | 27 | null | null |
carlohamalainen/ghc-mod | test/CradleSpec.hs | bsd-3-clause | -- Work around GHC 7.2.2 where `canonicalizePath "/"` returns "/.".
stripLastDot :: FilePath -> FilePath
stripLastDot path
| (pathSeparator:'.':"") `isSuffixOf` path = init path
| otherwise = path | 200 | stripLastDot :: FilePath -> FilePath
stripLastDot path
| (pathSeparator:'.':"") `isSuffixOf` path = init path
| otherwise = path | 132 | stripLastDot path
| (pathSeparator:'.':"") `isSuffixOf` path = init path
| otherwise = path | 95 | true | true | 0 | 11 | 31 | 62 | 29 | 33 | null | null |
noraesae/euler | src/Problem37.hs | bsd-3-clause | rightTruncatablePrimesWithDigit :: Int -> [Int]
rightTruncatablePrimesWithDigit = (map rightTruncatablePrimesWithDigit [0..] !!)
where
rightTruncatablePrimesWithDigit 0 = [0]
rightTruncatablePrimesWithDigit digit
| null primes = []
| otherwise = filter isPrime rightConcats
where primes = rightTruncatablePrimesWithDigit (digit - 1)
rightConcats = [x + y * 10 | x <- [1..9], y <- primes] | 433 | rightTruncatablePrimesWithDigit :: Int -> [Int]
rightTruncatablePrimesWithDigit = (map rightTruncatablePrimesWithDigit [0..] !!)
where
rightTruncatablePrimesWithDigit 0 = [0]
rightTruncatablePrimesWithDigit digit
| null primes = []
| otherwise = filter isPrime rightConcats
where primes = rightTruncatablePrimesWithDigit (digit - 1)
rightConcats = [x + y * 10 | x <- [1..9], y <- primes] | 433 | rightTruncatablePrimesWithDigit = (map rightTruncatablePrimesWithDigit [0..] !!)
where
rightTruncatablePrimesWithDigit 0 = [0]
rightTruncatablePrimesWithDigit digit
| null primes = []
| otherwise = filter isPrime rightConcats
where primes = rightTruncatablePrimesWithDigit (digit - 1)
rightConcats = [x + y * 10 | x <- [1..9], y <- primes] | 385 | false | true | 1 | 11 | 95 | 132 | 67 | 65 | null | null |
kfish/const-math-ghc-plugin | ConstMath/Plugin.hs | bsd-3-clause | hasSimplifierPass (CoreDoPasses todos) = any hasSimplifierPass todos | 68 | hasSimplifierPass (CoreDoPasses todos) = any hasSimplifierPass todos | 68 | hasSimplifierPass (CoreDoPasses todos) = any hasSimplifierPass todos | 68 | false | false | 0 | 6 | 6 | 21 | 9 | 12 | null | null |
tidalcycles/tidal-midi | Sound/Tidal/MIDI/Tetra.hs | gpl-3.0 | dspread = doublePattern 13 | 26 | dspread = doublePattern 13 | 26 | dspread = doublePattern 13 | 26 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
ford-prefect/haskell-gi | lib/Data/GI/CodeGen/SymbolNaming.hs | lgpl-2.1 | -- | The name for the foreign wrapper allocator (@foreign import
-- "wrapper" ...@) for the given callback type. It can be passed in
-- qualified.
callbackWrapperAllocator :: Text -> Text
callbackWrapperAllocator = modifyQualified ("mk_" <>) | 241 | callbackWrapperAllocator :: Text -> Text
callbackWrapperAllocator = modifyQualified ("mk_" <>) | 94 | callbackWrapperAllocator = modifyQualified ("mk_" <>) | 53 | true | true | 0 | 6 | 35 | 25 | 15 | 10 | null | null |
yiannist/ganeti | src/Ganeti/Config.hs | bsd-2-clause | -- | Returns the DRBD minors of a given 'Disk'
getDrbdMinorsForDisk :: Disk -> [(Int, String)]
getDrbdMinorsForDisk =
collectFromDrbdDisks (\nA nB _ mnA mnB _ -> [(mnA, nA), (mnB, nB)]) | 187 | getDrbdMinorsForDisk :: Disk -> [(Int, String)]
getDrbdMinorsForDisk =
collectFromDrbdDisks (\nA nB _ mnA mnB _ -> [(mnA, nA), (mnB, nB)]) | 140 | getDrbdMinorsForDisk =
collectFromDrbdDisks (\nA nB _ mnA mnB _ -> [(mnA, nA), (mnB, nB)]) | 92 | true | true | 0 | 9 | 31 | 64 | 38 | 26 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/show_4.hs | mit | primDivInt vv vw = error | 24 | primDivInt vv vw = error | 24 | primDivInt vv vw = error | 24 | false | false | 1 | 5 | 4 | 16 | 5 | 11 | null | null |
RossMeikleham/GPC | src/GPC/Parser.hs | bsd-2-clause | -- | Parse top level statements/definitions
topLevels :: Parser [TopLevel SrcPos]
topLevels = ((:) <$> topLevel <*> topLevels)
<|> (eof >> return []) | 160 | topLevels :: Parser [TopLevel SrcPos]
topLevels = ((:) <$> topLevel <*> topLevels)
<|> (eof >> return []) | 115 | topLevels = ((:) <$> topLevel <*> topLevels)
<|> (eof >> return []) | 77 | true | true | 0 | 9 | 33 | 50 | 27 | 23 | null | null |
benkolera/haskell-ldap-classy | LDAP/Classy/Dn.hs | mit | _DnText :: Prism' Text Dn
_DnText = prism' dnToText dnFromText | 62 | _DnText :: Prism' Text Dn
_DnText = prism' dnToText dnFromText | 62 | _DnText = prism' dnToText dnFromText | 36 | false | true | 0 | 6 | 9 | 28 | 11 | 17 | null | null |
krisajenkins/esqueleto | src/Database/Esqueleto/Internal/Sql.hs | bsd-3-clause | from3 :: (a,b,c) -> ((a,b),c)
from3 (a,b,c) = ((a,b),c) | 55 | from3 :: (a,b,c) -> ((a,b),c)
from3 (a,b,c) = ((a,b),c) | 55 | from3 (a,b,c) = ((a,b),c) | 25 | false | true | 0 | 7 | 8 | 60 | 37 | 23 | null | null |
Saulzar/reflex | src/Reflex/Dynamic.hs | bsd-3-clause | -- | Demultiplex an input value to a 'Demux' with many outputs. At any given
-- time, whichever output is indicated by the given 'Dynamic' will be 'True'.
demux :: (Reflex t, Ord k) => Dynamic t k -> Demux t k
demux k = Demux (current k)
(fan $ attachWith (\k0 k1 -> if k0 == k1
then DMap.empty
else DMap.fromList [Const2 k0 :=> Identity False,
Const2 k1 :=> Identity True])
(current k) (updated k)) | 614 | demux :: (Reflex t, Ord k) => Dynamic t k -> Demux t k
demux k = Demux (current k)
(fan $ attachWith (\k0 k1 -> if k0 == k1
then DMap.empty
else DMap.fromList [Const2 k0 :=> Identity False,
Const2 k1 :=> Identity True])
(current k) (updated k)) | 458 | demux k = Demux (current k)
(fan $ attachWith (\k0 k1 -> if k0 == k1
then DMap.empty
else DMap.fromList [Const2 k0 :=> Identity False,
Const2 k1 :=> Identity True])
(current k) (updated k)) | 403 | true | true | 0 | 15 | 290 | 137 | 69 | 68 | null | null |
achernyak/stack | src/Stack/Options.hs | bsd-3-clause | ghciOptsParser :: Parser GhciOpts
ghciOptsParser = GhciOpts
<$> switch (long "no-build" <> help "Don't build before launching GHCi")
<*> fmap concat (many (argsOption (long "ghci-options" <>
metavar "OPTION" <>
help "Additional options passed to GHCi")))
<*> optional
(strOption (long "with-ghc" <>
metavar "GHC" <>
help "Use this GHC to run GHCi"))
<*> (not <$> boolFlags True "load" "load modules on start-up" idm)
<*> packagesParser
<*> optional
(textOption
(long "main-is" <>
metavar "TARGET" <>
help "Specify which target should contain the main \
\module to load, such as for an executable for \
\test suite or benchmark."))
<*> switch (long "load-local-deps" <> help "Load all local dependencies of your targets")
<*> switch (long "skip-intermediate-deps" <> help "Skip loading intermediate target dependencies")
<*> boolFlags True "package-hiding" "package hiding" idm
<*> buildOptsParser Build | 1,367 | ghciOptsParser :: Parser GhciOpts
ghciOptsParser = GhciOpts
<$> switch (long "no-build" <> help "Don't build before launching GHCi")
<*> fmap concat (many (argsOption (long "ghci-options" <>
metavar "OPTION" <>
help "Additional options passed to GHCi")))
<*> optional
(strOption (long "with-ghc" <>
metavar "GHC" <>
help "Use this GHC to run GHCi"))
<*> (not <$> boolFlags True "load" "load modules on start-up" idm)
<*> packagesParser
<*> optional
(textOption
(long "main-is" <>
metavar "TARGET" <>
help "Specify which target should contain the main \
\module to load, such as for an executable for \
\test suite or benchmark."))
<*> switch (long "load-local-deps" <> help "Load all local dependencies of your targets")
<*> switch (long "skip-intermediate-deps" <> help "Skip loading intermediate target dependencies")
<*> boolFlags True "package-hiding" "package hiding" idm
<*> buildOptsParser Build | 1,367 | ghciOptsParser = GhciOpts
<$> switch (long "no-build" <> help "Don't build before launching GHCi")
<*> fmap concat (many (argsOption (long "ghci-options" <>
metavar "OPTION" <>
help "Additional options passed to GHCi")))
<*> optional
(strOption (long "with-ghc" <>
metavar "GHC" <>
help "Use this GHC to run GHCi"))
<*> (not <$> boolFlags True "load" "load modules on start-up" idm)
<*> packagesParser
<*> optional
(textOption
(long "main-is" <>
metavar "TARGET" <>
help "Specify which target should contain the main \
\module to load, such as for an executable for \
\test suite or benchmark."))
<*> switch (long "load-local-deps" <> help "Load all local dependencies of your targets")
<*> switch (long "skip-intermediate-deps" <> help "Skip loading intermediate target dependencies")
<*> boolFlags True "package-hiding" "package hiding" idm
<*> buildOptsParser Build | 1,333 | false | true | 0 | 22 | 594 | 225 | 104 | 121 | null | null |
SaneApp/hedis-simple | src/Database/Redis/Simple.hs | mit | brPopLPush :: (R.RedisCtx mi r, WrappedRedis m mi r) => ByteString -> ByteString -> Integer -> m (Maybe ByteString)
brPopLPush src dest t = wrap $ R.brpoplpush src dest t | 170 | brPopLPush :: (R.RedisCtx mi r, WrappedRedis m mi r) => ByteString -> ByteString -> Integer -> m (Maybe ByteString)
brPopLPush src dest t = wrap $ R.brpoplpush src dest t | 170 | brPopLPush src dest t = wrap $ R.brpoplpush src dest t | 54 | false | true | 0 | 11 | 29 | 75 | 37 | 38 | null | null |
christiaanb/clash-tryout | src/CLaSH/Driver/TestbenchGen.hs | bsd-3-clause | genDecl _ (ident,ResetType i) = [ NetDecl ident (ResetType i) Nothing
, NetAssign "defaultClockReset" (ExprDelay
[ (ExprLit Nothing (ExprBit L), 0.0)
, (ExprLit Nothing (ExprBit H), (fromIntegral i) * 0.25)
]
)
] | 554 | genDecl _ (ident,ResetType i) = [ NetDecl ident (ResetType i) Nothing
, NetAssign "defaultClockReset" (ExprDelay
[ (ExprLit Nothing (ExprBit L), 0.0)
, (ExprLit Nothing (ExprBit H), (fromIntegral i) * 0.25)
]
)
] | 554 | genDecl _ (ident,ResetType i) = [ NetDecl ident (ResetType i) Nothing
, NetAssign "defaultClockReset" (ExprDelay
[ (ExprLit Nothing (ExprBit L), 0.0)
, (ExprLit Nothing (ExprBit H), (fromIntegral i) * 0.25)
]
)
] | 554 | false | false | 0 | 13 | 374 | 100 | 52 | 48 | null | null |
typedrat/typedrat-site | app/Typedrat/Auth.hs | gpl-3.0 | -- Has the side effect of logging out invalid users
userFromSession :: RatActionCtx ctx st (Maybe (User Hask))
userFromSession = readSession >>= \(RatSession mToken _) ->
case mToken of
Just token -> userWithToken token
Nothing -> return Nothing | 265 | userFromSession :: RatActionCtx ctx st (Maybe (User Hask))
userFromSession = readSession >>= \(RatSession mToken _) ->
case mToken of
Just token -> userWithToken token
Nothing -> return Nothing | 213 | userFromSession = readSession >>= \(RatSession mToken _) ->
case mToken of
Just token -> userWithToken token
Nothing -> return Nothing | 154 | true | true | 0 | 10 | 57 | 73 | 36 | 37 | null | null |
zaxtax/hakaru | haskell/Language/Hakaru/CodeGen/Flatten.hs | bsd-3-clause | normalFun :: CFunDef
normalFun = CFunDef (CTypeSpec <$> retTyp)
(CDeclr Nothing (CDDeclrIdent (Ident "normal")))
[typeDeclaration SReal aId
,typeDeclaration SProb bId ]
( CCompound . concat
$ [[CBlockDecl declMD],comment,decls,stmts])
where r = castTo CDouble randE
rMax = castTo CDouble (CVar . Ident $ "RAND_MAX")
retTyp = buildType (SMeasure SReal)
(aId,aE) = let ident = Ident "a" in (ident,CVar ident)
(bId,bE) = let ident = Ident "b" in (ident,CVar ident)
(qId,qE) = let ident = Ident "q" in (ident,CVar ident)
(uId,uE) = let ident = Ident "u" in (ident,CVar ident)
(vId,vE) = let ident = Ident "v" in (ident,CVar ident)
(rId,rE) = let ident = Ident "r" in (ident,CVar ident)
(mId,mE) = let ident = Ident "mdata" in (ident,CVar ident)
declMD = buildDeclaration (head retTyp) mId
draw xE = CExpr . Just $ xE .=. (((r ./. rMax) .*. (floatE 2)) .-. (floatE 1))
body = seqCStat [draw uE
,draw vE
,CExpr . Just $ qE .=. ((uE .*. uE) .+. (vE .*. vE))]
polar = CWhile (qE .>. (floatE 1)) body True
setR = CExpr . Just $ rE .=. (sqrtE (((CUnary CMinOp (floatE 2)) .*. logE qE) ./. qE))
finalValue = aE .+. (uE .*. rE .*. bE)
comment = fmap (CBlockStat . CComment)
["normal :: real -> real -> *(mdata real) -> ()"
,"Marsaglia Polar Method"
,"-----------------------------------------------"]
decls = (CBlockDecl . typeDeclaration SReal) <$> [uId,vId,qId,rId]
stmts = CBlockStat <$> [polar,setR, assW, assS,CReturn . Just $ mE]
assW = CExpr . Just $ mdataWeight mE .=. (floatE 0)
assS = CExpr . Just $ mdataSample mE .=. finalValue | 1,880 | normalFun :: CFunDef
normalFun = CFunDef (CTypeSpec <$> retTyp)
(CDeclr Nothing (CDDeclrIdent (Ident "normal")))
[typeDeclaration SReal aId
,typeDeclaration SProb bId ]
( CCompound . concat
$ [[CBlockDecl declMD],comment,decls,stmts])
where r = castTo CDouble randE
rMax = castTo CDouble (CVar . Ident $ "RAND_MAX")
retTyp = buildType (SMeasure SReal)
(aId,aE) = let ident = Ident "a" in (ident,CVar ident)
(bId,bE) = let ident = Ident "b" in (ident,CVar ident)
(qId,qE) = let ident = Ident "q" in (ident,CVar ident)
(uId,uE) = let ident = Ident "u" in (ident,CVar ident)
(vId,vE) = let ident = Ident "v" in (ident,CVar ident)
(rId,rE) = let ident = Ident "r" in (ident,CVar ident)
(mId,mE) = let ident = Ident "mdata" in (ident,CVar ident)
declMD = buildDeclaration (head retTyp) mId
draw xE = CExpr . Just $ xE .=. (((r ./. rMax) .*. (floatE 2)) .-. (floatE 1))
body = seqCStat [draw uE
,draw vE
,CExpr . Just $ qE .=. ((uE .*. uE) .+. (vE .*. vE))]
polar = CWhile (qE .>. (floatE 1)) body True
setR = CExpr . Just $ rE .=. (sqrtE (((CUnary CMinOp (floatE 2)) .*. logE qE) ./. qE))
finalValue = aE .+. (uE .*. rE .*. bE)
comment = fmap (CBlockStat . CComment)
["normal :: real -> real -> *(mdata real) -> ()"
,"Marsaglia Polar Method"
,"-----------------------------------------------"]
decls = (CBlockDecl . typeDeclaration SReal) <$> [uId,vId,qId,rId]
stmts = CBlockStat <$> [polar,setR, assW, assS,CReturn . Just $ mE]
assW = CExpr . Just $ mdataWeight mE .=. (floatE 0)
assS = CExpr . Just $ mdataSample mE .=. finalValue | 1,880 | normalFun = CFunDef (CTypeSpec <$> retTyp)
(CDeclr Nothing (CDDeclrIdent (Ident "normal")))
[typeDeclaration SReal aId
,typeDeclaration SProb bId ]
( CCompound . concat
$ [[CBlockDecl declMD],comment,decls,stmts])
where r = castTo CDouble randE
rMax = castTo CDouble (CVar . Ident $ "RAND_MAX")
retTyp = buildType (SMeasure SReal)
(aId,aE) = let ident = Ident "a" in (ident,CVar ident)
(bId,bE) = let ident = Ident "b" in (ident,CVar ident)
(qId,qE) = let ident = Ident "q" in (ident,CVar ident)
(uId,uE) = let ident = Ident "u" in (ident,CVar ident)
(vId,vE) = let ident = Ident "v" in (ident,CVar ident)
(rId,rE) = let ident = Ident "r" in (ident,CVar ident)
(mId,mE) = let ident = Ident "mdata" in (ident,CVar ident)
declMD = buildDeclaration (head retTyp) mId
draw xE = CExpr . Just $ xE .=. (((r ./. rMax) .*. (floatE 2)) .-. (floatE 1))
body = seqCStat [draw uE
,draw vE
,CExpr . Just $ qE .=. ((uE .*. uE) .+. (vE .*. vE))]
polar = CWhile (qE .>. (floatE 1)) body True
setR = CExpr . Just $ rE .=. (sqrtE (((CUnary CMinOp (floatE 2)) .*. logE qE) ./. qE))
finalValue = aE .+. (uE .*. rE .*. bE)
comment = fmap (CBlockStat . CComment)
["normal :: real -> real -> *(mdata real) -> ()"
,"Marsaglia Polar Method"
,"-----------------------------------------------"]
decls = (CBlockDecl . typeDeclaration SReal) <$> [uId,vId,qId,rId]
stmts = CBlockStat <$> [polar,setR, assW, assS,CReturn . Just $ mE]
assW = CExpr . Just $ mdataWeight mE .=. (floatE 0)
assS = CExpr . Just $ mdataSample mE .=. finalValue | 1,859 | false | true | 20 | 46 | 610 | 763 | 392 | 371 | null | null |
wiryls/HomeworkCollectionOfMYLS | 2018.ProjectV/src/IAFinance/Environment/Config.hs | mit | -- helper
io :: (MonadIO m) => IO a -> m a
io = liftIO | 55 | io :: (MonadIO m) => IO a -> m a
io = liftIO | 44 | io = liftIO | 11 | true | true | 0 | 8 | 15 | 37 | 17 | 20 | null | null |
Courseography/courseography | app/Css/Constants.hs | gpl-3.0 | -- |Defines the color of a soft red.
seDark :: T.Text
seDark = "#E68080" | 72 | seDark :: T.Text
seDark = "#E68080" | 35 | seDark = "#E68080" | 18 | true | true | 0 | 7 | 13 | 21 | 9 | 12 | null | null |
mzhou/opalfare | src/Main.hs | agpl-3.0 | main = do
(tarrif:orig:dest:_) <- getArgs
putStrLn $ show $ singleTrainFare (read tarrif) (read orig) (read dest) | 121 | main = do
(tarrif:orig:dest:_) <- getArgs
putStrLn $ show $ singleTrainFare (read tarrif) (read orig) (read dest) | 121 | main = do
(tarrif:orig:dest:_) <- getArgs
putStrLn $ show $ singleTrainFare (read tarrif) (read orig) (read dest) | 121 | false | false | 1 | 12 | 24 | 68 | 31 | 37 | null | null |
maurotrb/divisione-due-cifre | src/Main.hs | bsd-3-clause | optionsPI :: ParserInfo Options
optionsPI = info (helperIt <*> optionsP)
( fullDesc
<> progDesc "Calcola il risultato delle divisioni a due cifre."
<> header ddcVersion) | 209 | optionsPI :: ParserInfo Options
optionsPI = info (helperIt <*> optionsP)
( fullDesc
<> progDesc "Calcola il risultato delle divisioni a due cifre."
<> header ddcVersion) | 209 | optionsPI = info (helperIt <*> optionsP)
( fullDesc
<> progDesc "Calcola il risultato delle divisioni a due cifre."
<> header ddcVersion) | 177 | false | true | 0 | 9 | 64 | 50 | 22 | 28 | null | null |
dlilja/hxsc | src/Numeric/HXSC/Interval.hs | bsd-3-clause | newtonOperator :: (RoundedInterval Double -> RoundedInterval Double)
-> (RoundedInterval Double -> RoundedInterval Double)
-> RoundedInterval Double -> RoundedInterval Double
newtonOperator f f' x = x | 230 | newtonOperator :: (RoundedInterval Double -> RoundedInterval Double)
-> (RoundedInterval Double -> RoundedInterval Double)
-> RoundedInterval Double -> RoundedInterval Double
newtonOperator f f' x = x | 230 | newtonOperator f f' x = x | 25 | false | true | 0 | 9 | 54 | 62 | 29 | 33 | null | null |
bestian/haskell-sandbox | Quizs/q059_squaresum.hs | unlicense | isSquare :: Int -> Bool
isSquare n = (fromIntegral . floor) y == y
where y = (sqrt . fromIntegral) n
--開根號是整數的數為完全平方數
--將在a,b範圍 開根號是整數的數(isSquare) 加起來(sum) | 169 | isSquare :: Int -> Bool
isSquare n = (fromIntegral . floor) y == y
where y = (sqrt . fromIntegral) n
--開根號是整數的數為完全平方數
--將在a,b範圍 開根號是整數的數(isSquare) 加起來(sum) | 169 | isSquare n = (fromIntegral . floor) y == y
where y = (sqrt . fromIntegral) n
--開根號是整數的數為完全平方數
--將在a,b範圍 開根號是整數的數(isSquare) 加起來(sum) | 145 | false | true | 1 | 8 | 38 | 60 | 28 | 32 | null | null |
andorp/bead | src/Bead/Domain/Relationships.hs | bsd-3-clause | openedSubmissionsCata f (OpenedSubmissions admincourse admingroup relatedcourse)
= f admincourse admingroup relatedcourse | 123 | openedSubmissionsCata f (OpenedSubmissions admincourse admingroup relatedcourse)
= f admincourse admingroup relatedcourse | 123 | openedSubmissionsCata f (OpenedSubmissions admincourse admingroup relatedcourse)
= f admincourse admingroup relatedcourse | 123 | false | false | 0 | 6 | 12 | 32 | 13 | 19 | null | null |
sseefried/funky-foto | Handler/Images.hs | bsd-2-clause | compileEffect :: Effect -> Handler (Either String (String, FilePath))
compileEffect effect = do
foundation <- getYesod
let hash = codeHash effect
codeDir = (cacheDir foundation) </> "code"
effectSrcFile = codeDir </> hash <.> "hs"
effectObjectFile = codeDir </> hash <.> "o"
exists <- liftIO $ doesFileExist effectObjectFile
case exists of
True -> return (Right (hash, effectObjectFile))
False -> do
liftIO $ writeFile effectSrcFile $ (effectCodeWrapper foundation) ++ (indent $ effectCode effect) ++ "\n"
res <- liftIO $ Plugins.make effectSrcFile ["-DMODULE_NAME=" ++ hash, "-DJOB=job" ++ hash]
case res of
MakeSuccess _ objectFile -> return (Right (hash, objectFile))
MakeFailure errors -> return (Left (concat $ intersperse "\n" errors))
where
indent = concat . intersperse "\n" . map (" " ++) . lines
-- | Obtain the CUDA lock then run the effect. Use bitmap files as the intermediate
-- image file format. Remove the bitmap files on completion.
-- | 1,060 | compileEffect :: Effect -> Handler (Either String (String, FilePath))
compileEffect effect = do
foundation <- getYesod
let hash = codeHash effect
codeDir = (cacheDir foundation) </> "code"
effectSrcFile = codeDir </> hash <.> "hs"
effectObjectFile = codeDir </> hash <.> "o"
exists <- liftIO $ doesFileExist effectObjectFile
case exists of
True -> return (Right (hash, effectObjectFile))
False -> do
liftIO $ writeFile effectSrcFile $ (effectCodeWrapper foundation) ++ (indent $ effectCode effect) ++ "\n"
res <- liftIO $ Plugins.make effectSrcFile ["-DMODULE_NAME=" ++ hash, "-DJOB=job" ++ hash]
case res of
MakeSuccess _ objectFile -> return (Right (hash, objectFile))
MakeFailure errors -> return (Left (concat $ intersperse "\n" errors))
where
indent = concat . intersperse "\n" . map (" " ++) . lines
-- | Obtain the CUDA lock then run the effect. Use bitmap files as the intermediate
-- image file format. Remove the bitmap files on completion.
-- | 1,060 | compileEffect effect = do
foundation <- getYesod
let hash = codeHash effect
codeDir = (cacheDir foundation) </> "code"
effectSrcFile = codeDir </> hash <.> "hs"
effectObjectFile = codeDir </> hash <.> "o"
exists <- liftIO $ doesFileExist effectObjectFile
case exists of
True -> return (Right (hash, effectObjectFile))
False -> do
liftIO $ writeFile effectSrcFile $ (effectCodeWrapper foundation) ++ (indent $ effectCode effect) ++ "\n"
res <- liftIO $ Plugins.make effectSrcFile ["-DMODULE_NAME=" ++ hash, "-DJOB=job" ++ hash]
case res of
MakeSuccess _ objectFile -> return (Right (hash, objectFile))
MakeFailure errors -> return (Left (concat $ intersperse "\n" errors))
where
indent = concat . intersperse "\n" . map (" " ++) . lines
-- | Obtain the CUDA lock then run the effect. Use bitmap files as the intermediate
-- image file format. Remove the bitmap files on completion.
-- | 990 | false | true | 0 | 20 | 253 | 309 | 153 | 156 | null | null |
narrative/stack | src/Stack/Sig/Sign.hs | bsd-3-clause | signTarBytes
:: (MonadBaseControl IO m, MonadIO m, MonadMask m, MonadLogger m, MonadThrow m, MonadReader env m, HasConfig env)
=> Maybe (Path Abs Dir) -> String -> Path Rel File -> L.ByteString -> m ()
signTarBytes Nothing _ _ _ = throwM SigNoProjectRootException | 271 | signTarBytes
:: (MonadBaseControl IO m, MonadIO m, MonadMask m, MonadLogger m, MonadThrow m, MonadReader env m, HasConfig env)
=> Maybe (Path Abs Dir) -> String -> Path Rel File -> L.ByteString -> m ()
signTarBytes Nothing _ _ _ = throwM SigNoProjectRootException | 271 | signTarBytes Nothing _ _ _ = throwM SigNoProjectRootException | 61 | false | true | 0 | 12 | 49 | 116 | 55 | 61 | null | null |
RAFIRAF/HASKELL | bubbleSort2.hs | mit | bsort' :: (Ord a) => [a] -> [a]
bsort' (x:y:t)
| x > y = y:bsort' (x:t)
| x <= y = x:bsort' (y:t) | 101 | bsort' :: (Ord a) => [a] -> [a]
bsort' (x:y:t)
| x > y = y:bsort' (x:t)
| x <= y = x:bsort' (y:t) | 101 | bsort' (x:y:t)
| x > y = y:bsort' (x:t)
| x <= y = x:bsort' (y:t) | 69 | false | true | 4 | 11 | 27 | 104 | 49 | 55 | null | null |
elieux/ghc | compiler/typecheck/TcGenDeriv.hs | bsd-3-clause | litConTbl :: [(Type, LHsExpr RdrName -> LHsExpr RdrName)]
litConTbl
= [(charPrimTy , nlHsApp (nlHsVar charPrimL_RDR))
,(intPrimTy , nlHsApp (nlHsVar intPrimL_RDR)
. nlHsApp (nlHsVar toInteger_RDR))
,(wordPrimTy , nlHsApp (nlHsVar wordPrimL_RDR)
. nlHsApp (nlHsVar toInteger_RDR))
,(addrPrimTy , nlHsApp (nlHsVar stringPrimL_RDR)
. nlHsApp (nlHsApp
(nlHsVar map_RDR)
(compose_RDR `nlHsApps`
[ nlHsVar fromIntegral_RDR
, nlHsVar fromEnum_RDR
])))
,(floatPrimTy , nlHsApp (nlHsVar floatPrimL_RDR)
. nlHsApp (nlHsVar toRational_RDR))
,(doublePrimTy, nlHsApp (nlHsVar doublePrimL_RDR)
. nlHsApp (nlHsVar toRational_RDR))
] | 894 | litConTbl :: [(Type, LHsExpr RdrName -> LHsExpr RdrName)]
litConTbl
= [(charPrimTy , nlHsApp (nlHsVar charPrimL_RDR))
,(intPrimTy , nlHsApp (nlHsVar intPrimL_RDR)
. nlHsApp (nlHsVar toInteger_RDR))
,(wordPrimTy , nlHsApp (nlHsVar wordPrimL_RDR)
. nlHsApp (nlHsVar toInteger_RDR))
,(addrPrimTy , nlHsApp (nlHsVar stringPrimL_RDR)
. nlHsApp (nlHsApp
(nlHsVar map_RDR)
(compose_RDR `nlHsApps`
[ nlHsVar fromIntegral_RDR
, nlHsVar fromEnum_RDR
])))
,(floatPrimTy , nlHsApp (nlHsVar floatPrimL_RDR)
. nlHsApp (nlHsVar toRational_RDR))
,(doublePrimTy, nlHsApp (nlHsVar doublePrimL_RDR)
. nlHsApp (nlHsVar toRational_RDR))
] | 894 | litConTbl
= [(charPrimTy , nlHsApp (nlHsVar charPrimL_RDR))
,(intPrimTy , nlHsApp (nlHsVar intPrimL_RDR)
. nlHsApp (nlHsVar toInteger_RDR))
,(wordPrimTy , nlHsApp (nlHsVar wordPrimL_RDR)
. nlHsApp (nlHsVar toInteger_RDR))
,(addrPrimTy , nlHsApp (nlHsVar stringPrimL_RDR)
. nlHsApp (nlHsApp
(nlHsVar map_RDR)
(compose_RDR `nlHsApps`
[ nlHsVar fromIntegral_RDR
, nlHsVar fromEnum_RDR
])))
,(floatPrimTy , nlHsApp (nlHsVar floatPrimL_RDR)
. nlHsApp (nlHsVar toRational_RDR))
,(doublePrimTy, nlHsApp (nlHsVar doublePrimL_RDR)
. nlHsApp (nlHsVar toRational_RDR))
] | 836 | false | true | 2 | 15 | 346 | 238 | 122 | 116 | null | null |
crufter/hakit | src/hakit/http.hs | bsd-3-clause | isCookieH h = fst h == "Cookie" | 31 | isCookieH h = fst h == "Cookie" | 31 | isCookieH h = fst h == "Cookie" | 31 | false | false | 0 | 6 | 6 | 16 | 7 | 9 | null | null |
strager/b | Control/Monad/Trans/Either.hs | bsd-3-clause | -- | Analogous to 'Left'. Equivalent to 'throwError'.
left :: Monad m => e -> EitherT e m a
left = EitherT . return . Left | 122 | left :: Monad m => e -> EitherT e m a
left = EitherT . return . Left | 68 | left = EitherT . return . Left | 30 | true | true | 0 | 7 | 25 | 38 | 19 | 19 | null | null |
nevrenato/HetsAlloy | SoftFOL/ProveSPASS.hs | gpl-2.0 | -- * Prover implementation
{- |
The Prover implementation.
Implemented are: a prover GUI, and both commandline prover interfaces.
-}
spassName :: String
spassName = "SPASS" | 179 | spassName :: String
spassName = "SPASS" | 39 | spassName = "SPASS" | 19 | true | true | 0 | 4 | 32 | 13 | 8 | 5 | null | null |
maoe/text-keepalived | src/Text/Keepalived/Types.hs | bsd-3-clause | renderProtocol :: Protocol -> Doc
renderProtocol p = text "protocol" <+> proto p
where proto TCP = text "TCP"
proto UDP = text "UDP" | 142 | renderProtocol :: Protocol -> Doc
renderProtocol p = text "protocol" <+> proto p
where proto TCP = text "TCP"
proto UDP = text "UDP" | 142 | renderProtocol p = text "protocol" <+> proto p
where proto TCP = text "TCP"
proto UDP = text "UDP" | 108 | false | true | 1 | 6 | 33 | 51 | 24 | 27 | null | null |
CulpaBS/wbBach | src/Futhark/CodeGen/ImpCode.hs | bsd-3-clause | functionsCalled _ = mempty | 26 | functionsCalled _ = mempty | 26 | functionsCalled _ = mempty | 26 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
vladimir-ipatov/ganeti | src/Ganeti/HTools/Graph.hs | gpl-2.0 | -- | vertices of a graph, sorted by descending degree.
verticesByDegreeAsc :: Graph.Graph -> [Graph.Vertex]
verticesByDegreeAsc g = map fst . sortBy (comparing snd) $ verticesDegree g | 183 | verticesByDegreeAsc :: Graph.Graph -> [Graph.Vertex]
verticesByDegreeAsc g = map fst . sortBy (comparing snd) $ verticesDegree g | 128 | verticesByDegreeAsc g = map fst . sortBy (comparing snd) $ verticesDegree g | 75 | true | true | 0 | 9 | 26 | 49 | 24 | 25 | null | null |
timthelion/fenfire | Fenfire/Irc2Notetaker.hs | gpl-2.0 | parse rest = (Nothing, parse' "" rest) | 44 | parse rest = (Nothing, parse' "" rest) | 44 | parse rest = (Nothing, parse' "" rest) | 44 | false | false | 0 | 6 | 12 | 20 | 10 | 10 | null | null |
jwiegley/hnix | src/Nix/Type/Infer.hs | bsd-3-clause | solve cs = solve' (nextSolvable cs)
where
solve' (EqConst t1 t2, cs) = unifies t1 t2
>>- \su1 -> solve (apply su1 cs) >>- \su2 -> return (su2 `compose` su1)
solve' (ImpInstConst t1 ms t2, cs) =
solve (ExpInstConst t1 (generalize ms t2) : cs)
solve' (ExpInstConst t s, cs) = do
s' <- lift $ instantiate s
solve (EqConst t s' : cs) | 354 | solve cs = solve' (nextSolvable cs)
where
solve' (EqConst t1 t2, cs) = unifies t1 t2
>>- \su1 -> solve (apply su1 cs) >>- \su2 -> return (su2 `compose` su1)
solve' (ImpInstConst t1 ms t2, cs) =
solve (ExpInstConst t1 (generalize ms t2) : cs)
solve' (ExpInstConst t s, cs) = do
s' <- lift $ instantiate s
solve (EqConst t s' : cs) | 354 | solve cs = solve' (nextSolvable cs)
where
solve' (EqConst t1 t2, cs) = unifies t1 t2
>>- \su1 -> solve (apply su1 cs) >>- \su2 -> return (su2 `compose` su1)
solve' (ImpInstConst t1 ms t2, cs) =
solve (ExpInstConst t1 (generalize ms t2) : cs)
solve' (ExpInstConst t s, cs) = do
s' <- lift $ instantiate s
solve (EqConst t s' : cs) | 354 | false | false | 0 | 11 | 88 | 181 | 89 | 92 | null | null |
ehlemur/HLearn | src/HLearn/Data/SpaceTree/CoverTree.hs | bsd-3-clause | setexpratIORef :: Rational -> P.IO ()
setexpratIORef r = writeIORef expratIORef r | 81 | setexpratIORef :: Rational -> P.IO ()
setexpratIORef r = writeIORef expratIORef r | 81 | setexpratIORef r = writeIORef expratIORef r | 43 | false | true | 0 | 7 | 11 | 30 | 14 | 16 | null | null |
ghc-android/ghc | testsuite/tests/ghci/should_run/ghcirun004.hs | bsd-3-clause | 3148 = 3147 | 11 | 3148 = 3147 | 11 | 3148 = 3147 | 11 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
MichaelXavier/vigilance | src/Utils/Vigilance/Web/Yesod.hs | bsd-2-clause | alwaysNoContent :: a -> Handler Value
alwaysNoContent = const noContent | 71 | alwaysNoContent :: a -> Handler Value
alwaysNoContent = const noContent | 71 | alwaysNoContent = const noContent | 33 | false | true | 0 | 6 | 9 | 21 | 10 | 11 | null | null |
CulpaBS/wbBach | src/Futhark/Representation/AST/Attributes/TypeOf.hs | bsd-3-clause | primOpType (Partition _ n _ arrays) =
result <$> traverse lookupType arrays
where result ts = replicate n (Prim $ IntType Int32) ++ ts
-- | The type of an expression. | 172 | primOpType (Partition _ n _ arrays) =
result <$> traverse lookupType arrays
where result ts = replicate n (Prim $ IntType Int32) ++ ts
-- | The type of an expression. | 172 | primOpType (Partition _ n _ arrays) =
result <$> traverse lookupType arrays
where result ts = replicate n (Prim $ IntType Int32) ++ ts
-- | The type of an expression. | 172 | false | false | 0 | 9 | 36 | 60 | 29 | 31 | null | null |
hvr/jhc | src/FrontEnd/KindInfer.hs | mit | constrain KindAny k = return () | 31 | constrain KindAny k = return () | 31 | constrain KindAny k = return () | 31 | false | false | 0 | 6 | 5 | 17 | 7 | 10 | null | null |
wereHamster/etcd-hs | src/Network/Etcd.hs | unlicense | wait :: Client -> Key -> IO (Maybe Node)
wait client key =
runRequest' $ httpGET (keyUrl client key) [waitParam] | 116 | wait :: Client -> Key -> IO (Maybe Node)
wait client key =
runRequest' $ httpGET (keyUrl client key) [waitParam] | 116 | wait client key =
runRequest' $ httpGET (keyUrl client key) [waitParam] | 75 | false | true | 0 | 9 | 23 | 53 | 26 | 27 | null | null |
projectorhq/haskell-liquid | test/Text/Liquid/ParserTests.hs | bsd-3-clause | case_output12 = parseOnly output "{{ a\' }" @?= Left "Failed reading: Tag or output statement incomplete" | 105 | case_output12 = parseOnly output "{{ a\' }" @?= Left "Failed reading: Tag or output statement incomplete" | 105 | case_output12 = parseOnly output "{{ a\' }" @?= Left "Failed reading: Tag or output statement incomplete" | 105 | false | false | 1 | 6 | 15 | 22 | 8 | 14 | null | null |
wavewave/lhc-analysis-collection | exe/2013-07-20-XUDD.hs | gpl-3.0 | mprocs = mkMultiProc pdir [ SingleProc "2sg_10j2x" p_2sg_10j2x map_2sg_10j2x mgrunsetup
, SingleProc "sqsg_9j2x" p_sqsg_9j2x map_sqsg_9j2x mgrunsetup
, SingleProc "2sq_8j2x" p_2sq_8j2x map_2sq_8j2x mgrunsetup
] | 290 | mprocs = mkMultiProc pdir [ SingleProc "2sg_10j2x" p_2sg_10j2x map_2sg_10j2x mgrunsetup
, SingleProc "sqsg_9j2x" p_sqsg_9j2x map_sqsg_9j2x mgrunsetup
, SingleProc "2sq_8j2x" p_2sq_8j2x map_2sq_8j2x mgrunsetup
] | 290 | mprocs = mkMultiProc pdir [ SingleProc "2sg_10j2x" p_2sg_10j2x map_2sg_10j2x mgrunsetup
, SingleProc "sqsg_9j2x" p_sqsg_9j2x map_sqsg_9j2x mgrunsetup
, SingleProc "2sq_8j2x" p_2sq_8j2x map_2sq_8j2x mgrunsetup
] | 290 | false | false | 1 | 7 | 102 | 50 | 23 | 27 | null | null |
mettekou/ghc | compiler/hsSyn/HsBinds.hs | bsd-3-clause | isSpecInstLSig :: LSig name -> Bool
isSpecInstLSig (L _ (SpecInstSig {})) = True | 80 | isSpecInstLSig :: LSig name -> Bool
isSpecInstLSig (L _ (SpecInstSig {})) = True | 80 | isSpecInstLSig (L _ (SpecInstSig {})) = True | 44 | false | true | 1 | 10 | 12 | 41 | 19 | 22 | null | null |
kolmodin/cabal | Cabal/Distribution/Simple/Setup.hs | bsd-3-clause | emptyGlobalFlags :: GlobalFlags
emptyGlobalFlags = mempty | 57 | emptyGlobalFlags :: GlobalFlags
emptyGlobalFlags = mempty | 57 | emptyGlobalFlags = mempty | 25 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
DanielG/cabal-helper | lib/Distribution/Helper/Discover.hs | apache-2.0 | -- | @findProjects dir@. Find available project instances in @dir@.
--
-- For example, if the given directory contains both a @cabal.project@ and
-- a @stack.yaml@ file:
--
-- >>> findProjects "."
-- [ Ex (ProjLocStackYaml "./stack.yaml"), Ex (ProjLocCabalV2File "./cabal.project") ]
--
-- Note that this function only looks for "default" project markers. If you
-- want to for example support the common pattern of having multiple
-- @stack-<GHC_VER>.yaml@ files simply fill out a 'ProjLoc' yourself. In
-- this case 'ProjLocStackYaml'.
findProjects :: FilePath -> IO [Ex ProjLoc]
findProjects dir = execWriterT $ do
let cabalProject = dir </> "cabal.project"
whenM (liftIO $ doesFileExist cabalProject) $
tell [Ex $ ProjLocV2File cabalProject dir]
let stackYaml = dir </> "stack.yaml"
whenM (liftIO $ doesFileExist stackYaml) $
tell [Ex $ ProjLocStackYaml stackYaml]
maybeCabalDir <- liftIO (fmap takeDirectory <$> findCabalFile dir)
forM_ [Ex . ProjLocV2Dir, Ex . ProjLocV1Dir] $ \proj -> traverse (tell . pure . proj) maybeCabalDir
-- | @getDefaultDistDir pl@. Get the default dist-dir for the given project.
--
-- Note that the path in the returned dist-dir might not exist yet if the
-- build-tool has never been run for this project before. This is fine as
-- far as @cabal-helper@ is concerned. It will simply invoke the build-tool
-- as needed to answer the requested queries. | 1,407 | findProjects :: FilePath -> IO [Ex ProjLoc]
findProjects dir = execWriterT $ do
let cabalProject = dir </> "cabal.project"
whenM (liftIO $ doesFileExist cabalProject) $
tell [Ex $ ProjLocV2File cabalProject dir]
let stackYaml = dir </> "stack.yaml"
whenM (liftIO $ doesFileExist stackYaml) $
tell [Ex $ ProjLocStackYaml stackYaml]
maybeCabalDir <- liftIO (fmap takeDirectory <$> findCabalFile dir)
forM_ [Ex . ProjLocV2Dir, Ex . ProjLocV1Dir] $ \proj -> traverse (tell . pure . proj) maybeCabalDir
-- | @getDefaultDistDir pl@. Get the default dist-dir for the given project.
--
-- Note that the path in the returned dist-dir might not exist yet if the
-- build-tool has never been run for this project before. This is fine as
-- far as @cabal-helper@ is concerned. It will simply invoke the build-tool
-- as needed to answer the requested queries. | 869 | findProjects dir = execWriterT $ do
let cabalProject = dir </> "cabal.project"
whenM (liftIO $ doesFileExist cabalProject) $
tell [Ex $ ProjLocV2File cabalProject dir]
let stackYaml = dir </> "stack.yaml"
whenM (liftIO $ doesFileExist stackYaml) $
tell [Ex $ ProjLocStackYaml stackYaml]
maybeCabalDir <- liftIO (fmap takeDirectory <$> findCabalFile dir)
forM_ [Ex . ProjLocV2Dir, Ex . ProjLocV1Dir] $ \proj -> traverse (tell . pure . proj) maybeCabalDir
-- | @getDefaultDistDir pl@. Get the default dist-dir for the given project.
--
-- Note that the path in the returned dist-dir might not exist yet if the
-- build-tool has never been run for this project before. This is fine as
-- far as @cabal-helper@ is concerned. It will simply invoke the build-tool
-- as needed to answer the requested queries. | 825 | true | true | 0 | 13 | 237 | 211 | 109 | 102 | null | null |
uduki/hsQt | Qth/Core/Rect.hs | bsd-2-clause | setTop :: IRect a -> a -> IRect a
setTop = setY | 47 | setTop :: IRect a -> a -> IRect a
setTop = setY | 47 | setTop = setY | 13 | false | true | 0 | 7 | 11 | 25 | 12 | 13 | null | null |
jaalonso/I1M-Cod-Temas | src/Tema_15/ColaConListas.hs | gpl-2.0 | resto (C []) = error "resto: cola vacia" | 44 | resto (C []) = error "resto: cola vacia" | 44 | resto (C []) = error "resto: cola vacia" | 44 | false | false | 0 | 7 | 11 | 21 | 9 | 12 | null | null |
ben-han-cn/hdns | Network/ZDNS/Types/Message.hs | bsd-3-clause | getRD :: Word16 -> Bool
getRD flags = getFlag flags rdField == 1 | 64 | getRD :: Word16 -> Bool
getRD flags = getFlag flags rdField == 1 | 64 | getRD flags = getFlag flags rdField == 1 | 40 | false | true | 0 | 6 | 12 | 27 | 13 | 14 | null | null |
blitzcode/conduit-chunked | Main.hs | mit | main :: IO ()
main =
defaultMainWith
criterionCfg
(return ())
[
bgroup "1M file size"
[ bench "Speed-of-light" .
nfIO . runResourceT $ CB.sourceFile oneMBFileName
$$ CB.sinkFile outputFileName
, bench "Chunking with list" .
nfIO . runResourceT $ CB.sourceFile oneMBFileName
=$ processAndChunkOutputList
$$ CB.sinkFile outputFileName
, bench "Chunking with blaze-builder" .
nfIO . runResourceT $ CB.sourceFile oneMBFileName
=$ processAndChunkOutputBB
=$ builderToByteString
$$ CB.sinkFile outputFileName
, bench "Chunking with raw memory buffer" .
nfIO . runResourceT $ CB.sourceFile oneMBFileName
=$ processAndChunkOutputRaw
$$ CB.sinkFile outputFileName
, bench "Chunking with chunk builder" .
nfIO . runResourceT $ CB.sourceFile oneMBFileName
=$ processAndChunkOutputChunkBuilder
$$ CB.sinkFile outputFileName
, bench "Chunking with state" .
nfIO . runResourceT $ CB.sourceFile oneMBFileName
=$ processAndChunkOutputStateChunkBuilder
$$ CB.sinkFile outputFileName
, bench "Chunking with vectorBuilder" .
nfIO . runResourceT $ CB.sourceFile oneMBFileName
=$ processAndChunkOutputVectorBuilder
=$ vectorToByteString
$$ CB.sinkFile outputFileName
]
] | 1,997 | main :: IO ()
main =
defaultMainWith
criterionCfg
(return ())
[
bgroup "1M file size"
[ bench "Speed-of-light" .
nfIO . runResourceT $ CB.sourceFile oneMBFileName
$$ CB.sinkFile outputFileName
, bench "Chunking with list" .
nfIO . runResourceT $ CB.sourceFile oneMBFileName
=$ processAndChunkOutputList
$$ CB.sinkFile outputFileName
, bench "Chunking with blaze-builder" .
nfIO . runResourceT $ CB.sourceFile oneMBFileName
=$ processAndChunkOutputBB
=$ builderToByteString
$$ CB.sinkFile outputFileName
, bench "Chunking with raw memory buffer" .
nfIO . runResourceT $ CB.sourceFile oneMBFileName
=$ processAndChunkOutputRaw
$$ CB.sinkFile outputFileName
, bench "Chunking with chunk builder" .
nfIO . runResourceT $ CB.sourceFile oneMBFileName
=$ processAndChunkOutputChunkBuilder
$$ CB.sinkFile outputFileName
, bench "Chunking with state" .
nfIO . runResourceT $ CB.sourceFile oneMBFileName
=$ processAndChunkOutputStateChunkBuilder
$$ CB.sinkFile outputFileName
, bench "Chunking with vectorBuilder" .
nfIO . runResourceT $ CB.sourceFile oneMBFileName
=$ processAndChunkOutputVectorBuilder
=$ vectorToByteString
$$ CB.sinkFile outputFileName
]
] | 1,997 | main =
defaultMainWith
criterionCfg
(return ())
[
bgroup "1M file size"
[ bench "Speed-of-light" .
nfIO . runResourceT $ CB.sourceFile oneMBFileName
$$ CB.sinkFile outputFileName
, bench "Chunking with list" .
nfIO . runResourceT $ CB.sourceFile oneMBFileName
=$ processAndChunkOutputList
$$ CB.sinkFile outputFileName
, bench "Chunking with blaze-builder" .
nfIO . runResourceT $ CB.sourceFile oneMBFileName
=$ processAndChunkOutputBB
=$ builderToByteString
$$ CB.sinkFile outputFileName
, bench "Chunking with raw memory buffer" .
nfIO . runResourceT $ CB.sourceFile oneMBFileName
=$ processAndChunkOutputRaw
$$ CB.sinkFile outputFileName
, bench "Chunking with chunk builder" .
nfIO . runResourceT $ CB.sourceFile oneMBFileName
=$ processAndChunkOutputChunkBuilder
$$ CB.sinkFile outputFileName
, bench "Chunking with state" .
nfIO . runResourceT $ CB.sourceFile oneMBFileName
=$ processAndChunkOutputStateChunkBuilder
$$ CB.sinkFile outputFileName
, bench "Chunking with vectorBuilder" .
nfIO . runResourceT $ CB.sourceFile oneMBFileName
=$ processAndChunkOutputVectorBuilder
=$ vectorToByteString
$$ CB.sinkFile outputFileName
]
] | 1,983 | false | true | 0 | 15 | 986 | 295 | 140 | 155 | null | null |
keera-studios/hsQt | examples/assliders.hs | bsd-2-clause | connect_prev (Just prev) curr
= connectSlot (lcdrange curr) "valueChanged(int)" (lcdrange prev) "setValue(int)" $ setVal $ slider prev | 136 | connect_prev (Just prev) curr
= connectSlot (lcdrange curr) "valueChanged(int)" (lcdrange prev) "setValue(int)" $ setVal $ slider prev | 136 | connect_prev (Just prev) curr
= connectSlot (lcdrange curr) "valueChanged(int)" (lcdrange prev) "setValue(int)" $ setVal $ slider prev | 136 | false | false | 0 | 9 | 18 | 49 | 23 | 26 | null | null |
zohl/postgresql-simple-bind | examples/ExUsers.hs | bsd-3-clause | bindFunctionsFromDirectory bindOptions "./examples/sql/users/functions"
type instance PostgresType "varchar2" = Text | 118 | bindFunctionsFromDirectory bindOptions "./examples/sql/users/functions"
type instance PostgresType "varchar2" = Text | 118 | bindFunctionsFromDirectory bindOptions "./examples/sql/users/functions"
type instance PostgresType "varchar2" = Text | 118 | false | false | 0 | 5 | 10 | 19 | 9 | 10 | null | null |
uuhan/Idris-dev | src/Idris/Core/TT.hs | bsd-3-clause | finalise :: Eq n => TT n -> TT n
finalise (Bind x b sc) = Bind x (fmap finalise b) (pToV x (finalise sc)) | 105 | finalise :: Eq n => TT n -> TT n
finalise (Bind x b sc) = Bind x (fmap finalise b) (pToV x (finalise sc)) | 105 | finalise (Bind x b sc) = Bind x (fmap finalise b) (pToV x (finalise sc)) | 72 | false | true | 0 | 9 | 24 | 70 | 33 | 37 | null | null |
Purlox/InfLength | Source/Data/List/InfLength.hs | mit | -- | Checks if the number is smaller than the length of the list
(<~) :: (Integral i) => i -> [a] -> Bool
n <~ list = integralToNat n < infLength list | 150 | (<~) :: (Integral i) => i -> [a] -> Bool
n <~ list = integralToNat n < infLength list | 85 | n <~ list = integralToNat n < infLength list | 44 | true | true | 0 | 10 | 32 | 54 | 27 | 27 | null | null |
r-peck/Rome | src/Lib.hs | mit | remoteDsymPath :: TargetPlatform -> FrameworkName -> Version -> String
remoteDsymPath p f@(FrameworkName fwn) v = fwn ++ "/" ++ show p ++ "/" ++ dSYMArchiveName f v | 164 | remoteDsymPath :: TargetPlatform -> FrameworkName -> Version -> String
remoteDsymPath p f@(FrameworkName fwn) v = fwn ++ "/" ++ show p ++ "/" ++ dSYMArchiveName f v | 164 | remoteDsymPath p f@(FrameworkName fwn) v = fwn ++ "/" ++ show p ++ "/" ++ dSYMArchiveName f v | 93 | false | true | 0 | 8 | 26 | 63 | 31 | 32 | null | null |
vinnymac/glot-www | Model/Language.hs | mit | languageRunCmdExample C = "clang main.c && ./a.out" | 51 | languageRunCmdExample C = "clang main.c && ./a.out" | 51 | languageRunCmdExample C = "clang main.c && ./a.out" | 51 | false | false | 0 | 5 | 6 | 9 | 4 | 5 | null | null |
garious/hopt | Transforms/CopyProp.hs | mit | stat x = return [x] | 51 | stat x = return [x] | 51 | stat x = return [x] | 51 | false | false | 1 | 6 | 36 | 18 | 7 | 11 | null | null |
jpbetz/protolang | haskell/Emit.hs | apache-2.0 | lt :: AST.Operand -> AST.Operand -> Codegen AST.Operand
lt a b = do
test <- fcmp FP.ULT a b
uitofp double test | 114 | lt :: AST.Operand -> AST.Operand -> Codegen AST.Operand
lt a b = do
test <- fcmp FP.ULT a b
uitofp double test | 114 | lt a b = do
test <- fcmp FP.ULT a b
uitofp double test | 58 | false | true | 0 | 10 | 25 | 62 | 27 | 35 | null | null |
Mahdi89/eTeak | src/Latch.hs | bsd-3-clause | latchOptionUsage :: SubOptionUsages LatchOption
latchOptionUsage = SubOptionUsages "latch" showLatchOption (Just []) (Just defaultLatchOptions) [
("scp", boolSubOption "Do SCP" LatchDoSCP),
("scp-limit", SubOptionUsage False "limit" "SCP limit" "0"
(isJust . parseDouble) (\arg -> let
Just limit = parseDouble arg
in ([LatchSCPLimit limit], []))),
("simple", depthOption "latch every link" [LatchSimple] []),
("after-v", depthOption "latch after every V's read/write port" [LatchVar] []),
("after-o", depthOption "latch after every O" [LatchOpIn] []),
("before-i", depthOption "latch before every I" [LatchIIn] []),
("between-inst", depthOption "latch between every instance" [LatchBetweenInstances] []),
("through", depthOption "latch links that connect ports to ports" [LatchThrough] []),
("loop", depthOption "latch loops to guarantee deadlock-freedom" [LatchLoop] [])
]
where
parseDouble :: String -> Maybe Double
parseDouble arg = case (reads :: String -> [(Double, String)]) arg of
[(limit, "")] -> Just limit
_ -> Nothing
depthOption desc add remove = SubOptionUsage False "depth" desc "0"
(isJust . parseDepth) (\arg -> let
Just depth = parseDepth arg
makeOpt strategy = LatchOption strategy depth
in (map makeOpt add, map makeOpt remove))
parseDepth arg = case (reads :: String -> [(Int, String)]) arg of
[(int, "")] | int >= 0 -> Just int
_ -> Nothing | 1,687 | latchOptionUsage :: SubOptionUsages LatchOption
latchOptionUsage = SubOptionUsages "latch" showLatchOption (Just []) (Just defaultLatchOptions) [
("scp", boolSubOption "Do SCP" LatchDoSCP),
("scp-limit", SubOptionUsage False "limit" "SCP limit" "0"
(isJust . parseDouble) (\arg -> let
Just limit = parseDouble arg
in ([LatchSCPLimit limit], []))),
("simple", depthOption "latch every link" [LatchSimple] []),
("after-v", depthOption "latch after every V's read/write port" [LatchVar] []),
("after-o", depthOption "latch after every O" [LatchOpIn] []),
("before-i", depthOption "latch before every I" [LatchIIn] []),
("between-inst", depthOption "latch between every instance" [LatchBetweenInstances] []),
("through", depthOption "latch links that connect ports to ports" [LatchThrough] []),
("loop", depthOption "latch loops to guarantee deadlock-freedom" [LatchLoop] [])
]
where
parseDouble :: String -> Maybe Double
parseDouble arg = case (reads :: String -> [(Double, String)]) arg of
[(limit, "")] -> Just limit
_ -> Nothing
depthOption desc add remove = SubOptionUsage False "depth" desc "0"
(isJust . parseDepth) (\arg -> let
Just depth = parseDepth arg
makeOpt strategy = LatchOption strategy depth
in (map makeOpt add, map makeOpt remove))
parseDepth arg = case (reads :: String -> [(Int, String)]) arg of
[(int, "")] | int >= 0 -> Just int
_ -> Nothing | 1,683 | latchOptionUsage = SubOptionUsages "latch" showLatchOption (Just []) (Just defaultLatchOptions) [
("scp", boolSubOption "Do SCP" LatchDoSCP),
("scp-limit", SubOptionUsage False "limit" "SCP limit" "0"
(isJust . parseDouble) (\arg -> let
Just limit = parseDouble arg
in ([LatchSCPLimit limit], []))),
("simple", depthOption "latch every link" [LatchSimple] []),
("after-v", depthOption "latch after every V's read/write port" [LatchVar] []),
("after-o", depthOption "latch after every O" [LatchOpIn] []),
("before-i", depthOption "latch before every I" [LatchIIn] []),
("between-inst", depthOption "latch between every instance" [LatchBetweenInstances] []),
("through", depthOption "latch links that connect ports to ports" [LatchThrough] []),
("loop", depthOption "latch loops to guarantee deadlock-freedom" [LatchLoop] [])
]
where
parseDouble :: String -> Maybe Double
parseDouble arg = case (reads :: String -> [(Double, String)]) arg of
[(limit, "")] -> Just limit
_ -> Nothing
depthOption desc add remove = SubOptionUsage False "depth" desc "0"
(isJust . parseDepth) (\arg -> let
Just depth = parseDepth arg
makeOpt strategy = LatchOption strategy depth
in (map makeOpt add, map makeOpt remove))
parseDepth arg = case (reads :: String -> [(Int, String)]) arg of
[(int, "")] | int >= 0 -> Just int
_ -> Nothing | 1,635 | false | true | 1 | 15 | 513 | 503 | 264 | 239 | null | null |
ezyang/ghc | testsuite/tests/codeGen/should_run/CmmSwitchTest64.hs | bsd-3-clause | ax :: Word# -> Word#
ax 1## = 42## | 34 | ax :: Word# -> Word#
ax 1## = 42## | 34 | ax 1## = 42## | 13 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
input-output-hk/pos-haskell-prototype | chain/test/Test/Pos/Chain/Block/Bi.hs | mit | --------------------------------------------------------------------------------
-- Main test export
--------------------------------------------------------------------------------
tests :: IO Bool
tests = and <$> sequence
[ H.checkSequential $$discoverGolden
, H.checkParallel $$discoverRoundTrip
] | 313 | tests :: IO Bool
tests = and <$> sequence
[ H.checkSequential $$discoverGolden
, H.checkParallel $$discoverRoundTrip
] | 130 | tests = and <$> sequence
[ H.checkSequential $$discoverGolden
, H.checkParallel $$discoverRoundTrip
] | 113 | true | true | 0 | 9 | 34 | 42 | 21 | 21 | null | null |
mydaum/cabal | cabal-install/tests/UnitTests/Distribution/Client/FileMonitor.hs | bsd-3-clause | testGlobRemoveNonMatchSubdir :: Int -> Assertion
testGlobRemoveNonMatchSubdir mtimeChange =
withFileMonitor $ \root monitor -> do
touchFile root ("dir" </> "a" </> "good-a")
touchFile root ("dir" </> "b" </> "bad")
updateMonitor root monitor [monitorFileGlobStr "dir/*/good-*"] () ()
threadDelay mtimeChange
removeDir root ("dir" </> "b")
(res, files) <- expectMonitorUnchanged root monitor ()
res @?= ()
files @?= [monitorFileGlobStr "dir/*/good-*"]
-- try and tickle a bug that happens if we don't maintain the invariant that
-- MonitorStateGlobFiles entries are sorted | 609 | testGlobRemoveNonMatchSubdir :: Int -> Assertion
testGlobRemoveNonMatchSubdir mtimeChange =
withFileMonitor $ \root monitor -> do
touchFile root ("dir" </> "a" </> "good-a")
touchFile root ("dir" </> "b" </> "bad")
updateMonitor root monitor [monitorFileGlobStr "dir/*/good-*"] () ()
threadDelay mtimeChange
removeDir root ("dir" </> "b")
(res, files) <- expectMonitorUnchanged root monitor ()
res @?= ()
files @?= [monitorFileGlobStr "dir/*/good-*"]
-- try and tickle a bug that happens if we don't maintain the invariant that
-- MonitorStateGlobFiles entries are sorted | 609 | testGlobRemoveNonMatchSubdir mtimeChange =
withFileMonitor $ \root monitor -> do
touchFile root ("dir" </> "a" </> "good-a")
touchFile root ("dir" </> "b" </> "bad")
updateMonitor root monitor [monitorFileGlobStr "dir/*/good-*"] () ()
threadDelay mtimeChange
removeDir root ("dir" </> "b")
(res, files) <- expectMonitorUnchanged root monitor ()
res @?= ()
files @?= [monitorFileGlobStr "dir/*/good-*"]
-- try and tickle a bug that happens if we don't maintain the invariant that
-- MonitorStateGlobFiles entries are sorted | 560 | false | true | 0 | 12 | 113 | 158 | 76 | 82 | null | null |
abakst/symmetry | checker/tests/qc-log-test/SymVerify.hs | mit | runState state@State{..} pidR0Buf0 pidR1Buf0
(PIDR0 : (PIDR1 : sched)) stateList
= liquidAssert
(not
((((pidR1PtrW0 <= pidR1PtrR0) && (pidR1Pc == 0)) || False) &&
((((pidR1PtrW0 <= pidR1PtrR0) && (pidR1Pc == 0)) ||
(pidR1Pc == (-1)))
&& (False || (pidR0Pc == (-1))))))
$ stateList | 366 | runState state@State{..} pidR0Buf0 pidR1Buf0
(PIDR0 : (PIDR1 : sched)) stateList
= liquidAssert
(not
((((pidR1PtrW0 <= pidR1PtrR0) && (pidR1Pc == 0)) || False) &&
((((pidR1PtrW0 <= pidR1PtrR0) && (pidR1Pc == 0)) ||
(pidR1Pc == (-1)))
&& (False || (pidR0Pc == (-1))))))
$ stateList | 366 | runState state@State{..} pidR0Buf0 pidR1Buf0
(PIDR0 : (PIDR1 : sched)) stateList
= liquidAssert
(not
((((pidR1PtrW0 <= pidR1PtrR0) && (pidR1Pc == 0)) || False) &&
((((pidR1PtrW0 <= pidR1PtrR0) && (pidR1Pc == 0)) ||
(pidR1Pc == (-1)))
&& (False || (pidR0Pc == (-1))))))
$ stateList | 366 | false | false | 3 | 16 | 127 | 158 | 85 | 73 | null | null |
rahulmutt/ghcvm | compiler/Eta/Utils/Outputable.hs | bsd-3-clause | unicodeSyntax :: SDoc -> SDoc -> SDoc
unicodeSyntax unicode plain = sdocWithDynFlags $ \dflags ->
if useUnicode dflags && useUnicodeSyntax dflags
then unicode
else plain | 181 | unicodeSyntax :: SDoc -> SDoc -> SDoc
unicodeSyntax unicode plain = sdocWithDynFlags $ \dflags ->
if useUnicode dflags && useUnicodeSyntax dflags
then unicode
else plain | 181 | unicodeSyntax unicode plain = sdocWithDynFlags $ \dflags ->
if useUnicode dflags && useUnicodeSyntax dflags
then unicode
else plain | 143 | false | true | 0 | 9 | 36 | 51 | 26 | 25 | null | null |
mvoidex/carma-sync | tools/carma-sync.hs | bsd-3-clause | argsDecl :: [(String, String)]
argsDecl = [
("-m", ""),
("-f", ""),
("-t", ""),
("-l", "default")] | 114 | argsDecl :: [(String, String)]
argsDecl = [
("-m", ""),
("-f", ""),
("-t", ""),
("-l", "default")] | 114 | argsDecl = [
("-m", ""),
("-f", ""),
("-t", ""),
("-l", "default")] | 83 | false | true | 0 | 6 | 30 | 56 | 36 | 20 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/Resources/RedshiftCluster.hs | mit | -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-vpcsecuritygroupids
rcVpcSecurityGroupIds :: Lens' RedshiftCluster (Maybe (ValList Text))
rcVpcSecurityGroupIds = lens _redshiftClusterVpcSecurityGroupIds (\s a -> s { _redshiftClusterVpcSecurityGroupIds = a }) | 333 | rcVpcSecurityGroupIds :: Lens' RedshiftCluster (Maybe (ValList Text))
rcVpcSecurityGroupIds = lens _redshiftClusterVpcSecurityGroupIds (\s a -> s { _redshiftClusterVpcSecurityGroupIds = a }) | 190 | rcVpcSecurityGroupIds = lens _redshiftClusterVpcSecurityGroupIds (\s a -> s { _redshiftClusterVpcSecurityGroupIds = a }) | 120 | true | true | 0 | 9 | 22 | 52 | 28 | 24 | null | null |
allanderek/ipclib | Language/Hydra/Print.hs | gpl-2.0 | printCtype CLong = "long" | 26 | printCtype CLong = "long" | 26 | printCtype CLong = "long" | 26 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
evansb/jasper | src/Language/Java/Lexer/Internal.hs | mit | rBrace = RBrace <=* char '}' | 40 | rBrace = RBrace <=* char '}' | 40 | rBrace = RBrace <=* char '}' | 40 | false | false | 0 | 6 | 17 | 13 | 6 | 7 | null | null |
vikraman/packages-ng | parse-packages/src/PackagesNG/ParsePackage.hs | gpl-2.0 | lookup' :: (Ord k, Show k) => k -> M.Map k a -> Either String a
lookup' k m = M.lookup k m `orElse` ("Missing field " ++ show k) | 128 | lookup' :: (Ord k, Show k) => k -> M.Map k a -> Either String a
lookup' k m = M.lookup k m `orElse` ("Missing field " ++ show k) | 128 | lookup' k m = M.lookup k m `orElse` ("Missing field " ++ show k) | 64 | false | true | 0 | 10 | 29 | 79 | 38 | 41 | null | null |
ghc-android/ghc | testsuite/tests/ghci/should_run/ghcirun004.hs | bsd-3-clause | 916 = 915 | 9 | 916 = 915 | 9 | 916 = 915 | 9 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
CulpaBS/wbBach | src/Futhark/CodeGen/Backends/PyOpenCL.hs | bsd-3-clause | callKernel (Imp.GetGroupSize v) = do
Py.stm $ Assign (Var (textual v)) $ Constant $ value (512::Int32)
return Py.Done | 121 | callKernel (Imp.GetGroupSize v) = do
Py.stm $ Assign (Var (textual v)) $ Constant $ value (512::Int32)
return Py.Done | 121 | callKernel (Imp.GetGroupSize v) = do
Py.stm $ Assign (Var (textual v)) $ Constant $ value (512::Int32)
return Py.Done | 121 | false | false | 0 | 14 | 21 | 66 | 31 | 35 | null | null |
nitrix/lspace | legacy/Coordinate.hs | unlicense | coordinates = lens (\c -> (view coordinateX c, view coordinateY c))
(\s c -> s & set coordinateX (fst c) & set coordinateY (snd c)) | 150 | coordinates = lens (\c -> (view coordinateX c, view coordinateY c))
(\s c -> s & set coordinateX (fst c) & set coordinateY (snd c)) | 150 | coordinates = lens (\c -> (view coordinateX c, view coordinateY c))
(\s c -> s & set coordinateX (fst c) & set coordinateY (snd c)) | 150 | false | false | 0 | 12 | 43 | 75 | 38 | 37 | null | null |
Zigazou/containers | Data/Sequence.hs | bsd-3-clause | digitToTree (Two a b) = deep (One a) Empty (One b) | 50 | digitToTree (Two a b) = deep (One a) Empty (One b) | 50 | digitToTree (Two a b) = deep (One a) Empty (One b) | 50 | false | false | 0 | 7 | 10 | 36 | 17 | 19 | null | null |
notae/haskell-exercise | pack/Generics.hs | bsd-3-clause | {-
data CTX t x = CTX { unCTX :: L t x }
class (Data b) => Lift b where
type L (t :: * -> *) (p :: *)
liftUp :: (forall a. a -> t a) -> b -> L t b
liftUp f x0 = unCTX (gfoldl k z x0) where
k :: Data d => CTX t (d -> b) -> d -> CTX t b
k (CTX c) x = CTX (c (f x))
z :: g -> CTX t g
z g = CTX g
-}
-- liftDown :: (forall a. t a -> a) -> l -> b
-- liftDown = undefined
-- instance (Data a, Data (t a))
-- => Lift [a] [t a]
-- instance (Data a, Data b, Data (t a), Data (t b))
-- => Lift (a, b) (t a, t b)
gap :: (forall a. a -> t a) -> p -> T t p
gap f p = undefined | 611 | gap :: (forall a. a -> t a) -> p -> T t p
gap f p = undefined | 61 | gap f p = undefined | 19 | true | true | 0 | 9 | 210 | 56 | 30 | 26 | null | null |
meteogrid/sigym4-geometry | tests/Sigym4/Geometry/QuadTree/Arbitrary.hs | bsd-3-clause | calculateMinBox :: VectorSpace v => Extent v crs -> Level -> Box v
calculateMinBox e (Level l)
= fmap (/ (fromIntegral (2^l))) (eSize e) | 138 | calculateMinBox :: VectorSpace v => Extent v crs -> Level -> Box v
calculateMinBox e (Level l)
= fmap (/ (fromIntegral (2^l))) (eSize e) | 138 | calculateMinBox e (Level l)
= fmap (/ (fromIntegral (2^l))) (eSize e) | 71 | false | true | 0 | 10 | 25 | 73 | 36 | 37 | null | null |
nushio3/ghc | compiler/parser/ApiAnnotation.hs | bsd-3-clause | -- | Retrieve a list of annotation 'SrcSpan's based on the 'SrcSpan'
-- of the annotated AST element, and the known type of the annotation.
getAnnotation :: ApiAnns -> SrcSpan -> AnnKeywordId -> [SrcSpan]
getAnnotation (anns,_) span ann
= case Map.lookup (span,ann) anns of
Nothing -> []
Just ss -> ss
-- | Retrieve a list of annotation 'SrcSpan's based on the 'SrcSpan'
-- of the annotated AST element, and the known type of the annotation.
-- The list is removed from the annotations. | 504 | getAnnotation :: ApiAnns -> SrcSpan -> AnnKeywordId -> [SrcSpan]
getAnnotation (anns,_) span ann
= case Map.lookup (span,ann) anns of
Nothing -> []
Just ss -> ss
-- | Retrieve a list of annotation 'SrcSpan's based on the 'SrcSpan'
-- of the annotated AST element, and the known type of the annotation.
-- The list is removed from the annotations. | 364 | getAnnotation (anns,_) span ann
= case Map.lookup (span,ann) anns of
Nothing -> []
Just ss -> ss
-- | Retrieve a list of annotation 'SrcSpan's based on the 'SrcSpan'
-- of the annotated AST element, and the known type of the annotation.
-- The list is removed from the annotations. | 299 | true | true | 0 | 8 | 101 | 78 | 43 | 35 | null | null |
cchens/courseography | hs/Svg/Parser.hs | gpl-3.0 | parseNode :: Int64 -- ^ The Path's corresponding graph identifier.
-> Content i
-> ([Path],[Shape],[Text])
parseNode key content =
if getName content == "defs"
then ([],[],[])
else let attrs = contentAttrs content
trans = parseTransform $ lookupAttr "transform" attrs
styles' = styles (contentAttrs content)
fill = styleVal "fill" styles'
-- TODO: These 'tag "_"' conditions are mutually exclusive (I think).
rects = map (parseRect key . contentAttrs) (tag "rect" content)
texts = concatMap (parseText key styles') (tag "text" content)
paths = mapMaybe (parsePath key . contentAttrs) (tag "path" content)
ellipses = map (parseEllipse key . contentAttrs) (tag "ellipse" content)
concatThree (a1, b1, c1) (a2, b2, c2) =
(a1 ++ a2, b1 ++ b2, c1 ++ c2)
(newPaths, newShapes, newTexts) =
foldl concatThree (paths, rects ++ ellipses, texts)
(map (parseNode key) (path [children] content))
in (map (updatePath fill trans) (newPaths),
map (updateShape fill trans) (newShapes),
map (updateText trans) (newTexts)) | 1,267 | parseNode :: Int64 -- ^ The Path's corresponding graph identifier.
-> Content i
-> ([Path],[Shape],[Text])
parseNode key content =
if getName content == "defs"
then ([],[],[])
else let attrs = contentAttrs content
trans = parseTransform $ lookupAttr "transform" attrs
styles' = styles (contentAttrs content)
fill = styleVal "fill" styles'
-- TODO: These 'tag "_"' conditions are mutually exclusive (I think).
rects = map (parseRect key . contentAttrs) (tag "rect" content)
texts = concatMap (parseText key styles') (tag "text" content)
paths = mapMaybe (parsePath key . contentAttrs) (tag "path" content)
ellipses = map (parseEllipse key . contentAttrs) (tag "ellipse" content)
concatThree (a1, b1, c1) (a2, b2, c2) =
(a1 ++ a2, b1 ++ b2, c1 ++ c2)
(newPaths, newShapes, newTexts) =
foldl concatThree (paths, rects ++ ellipses, texts)
(map (parseNode key) (path [children] content))
in (map (updatePath fill trans) (newPaths),
map (updateShape fill trans) (newShapes),
map (updateText trans) (newTexts)) | 1,267 | parseNode key content =
if getName content == "defs"
then ([],[],[])
else let attrs = contentAttrs content
trans = parseTransform $ lookupAttr "transform" attrs
styles' = styles (contentAttrs content)
fill = styleVal "fill" styles'
-- TODO: These 'tag "_"' conditions are mutually exclusive (I think).
rects = map (parseRect key . contentAttrs) (tag "rect" content)
texts = concatMap (parseText key styles') (tag "text" content)
paths = mapMaybe (parsePath key . contentAttrs) (tag "path" content)
ellipses = map (parseEllipse key . contentAttrs) (tag "ellipse" content)
concatThree (a1, b1, c1) (a2, b2, c2) =
(a1 ++ a2, b1 ++ b2, c1 ++ c2)
(newPaths, newShapes, newTexts) =
foldl concatThree (paths, rects ++ ellipses, texts)
(map (parseNode key) (path [children] content))
in (map (updatePath fill trans) (newPaths),
map (updateShape fill trans) (newShapes),
map (updateText trans) (newTexts)) | 1,140 | false | true | 0 | 15 | 411 | 403 | 215 | 188 | null | null |
glguy/set-game | src/SetGame.hs | bsd-3-clause | boldString :: String -> Image
boldString = string (defAttr `withStyle` bold) | 76 | boldString :: String -> Image
boldString = string (defAttr `withStyle` bold) | 76 | boldString = string (defAttr `withStyle` bold) | 46 | false | true | 0 | 7 | 10 | 27 | 15 | 12 | null | null |
elieux/ghc | compiler/types/Type.hs | bsd-3-clause | mkEqPred :: Type -> Type -> PredType
mkEqPred ty1 ty2
= WARN( not (k `eqKind` typeKind ty2), ppr ty1 $$ ppr ty2 $$ ppr k $$ ppr (typeKind ty2) )
TyConApp eqTyCon [k, ty1, ty2]
where
k = typeKind ty1 | 210 | mkEqPred :: Type -> Type -> PredType
mkEqPred ty1 ty2
= WARN( not (k `eqKind` typeKind ty2), ppr ty1 $$ ppr ty2 $$ ppr k $$ ppr (typeKind ty2) )
TyConApp eqTyCon [k, ty1, ty2]
where
k = typeKind ty1 | 210 | mkEqPred ty1 ty2
= WARN( not (k `eqKind` typeKind ty2), ppr ty1 $$ ppr ty2 $$ ppr k $$ ppr (typeKind ty2) )
TyConApp eqTyCon [k, ty1, ty2]
where
k = typeKind ty1 | 173 | false | true | 0 | 9 | 51 | 109 | 53 | 56 | null | null |
gromakovsky/Orchid | src/Orchid/Codegen/Body.hs | mit | sortBlocks :: [(AST.Name, BlockState)] -> [(AST.Name, BlockState)]
sortBlocks = sortBy (compare `on` (view bsIdx . snd)) | 120 | sortBlocks :: [(AST.Name, BlockState)] -> [(AST.Name, BlockState)]
sortBlocks = sortBy (compare `on` (view bsIdx . snd)) | 120 | sortBlocks = sortBy (compare `on` (view bsIdx . snd)) | 53 | false | true | 0 | 10 | 15 | 59 | 34 | 25 | null | null |
urbanslug/ghc | testsuite/tests/typecheck/should_compile/T1634.hs | bsd-3-clause | t1 :: a -> (forall b. b -> (a,b))
t1 = (,) | 42 | t1 :: a -> (forall b. b -> (a,b))
t1 = (,) | 42 | t1 = (,) | 8 | false | true | 0 | 11 | 11 | 43 | 22 | 21 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.