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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
christiaanb/clash-tryout | src/CLaSH/Util/CoreHW/Tools.hs | bsd-3-clause | isSimple _ = False | 28 | isSimple _ = False | 28 | isSimple _ = False | 28 | false | false | 0 | 5 | 13 | 9 | 4 | 5 | null | null |
olsner/ghc | compiler/stranal/DmdAnal.hs | bsd-3-clause | lookupSigEnv :: AnalEnv -> Id -> Maybe (StrictSig, TopLevelFlag)
lookupSigEnv env id = lookupVarEnv (ae_sigs env) id | 116 | lookupSigEnv :: AnalEnv -> Id -> Maybe (StrictSig, TopLevelFlag)
lookupSigEnv env id = lookupVarEnv (ae_sigs env) id | 116 | lookupSigEnv env id = lookupVarEnv (ae_sigs env) id | 51 | false | true | 0 | 9 | 16 | 50 | 23 | 27 | null | null |
polux/snippets | AbstractInterpreter.hs | apache-2.0 | evalExpr (IntLit i) _ = VInt i | 30 | evalExpr (IntLit i) _ = VInt i | 30 | evalExpr (IntLit i) _ = VInt i | 30 | false | false | 1 | 7 | 6 | 22 | 9 | 13 | null | null |
pqwy/google-web-apis | Web/Google/GCal.hs | bsd-3-clause | timeQuery :: ByteString -> ZonedTime -> Query
timeQuery name time = [(name, Just . BS8.pack $ showRFC3339 time)] | 112 | timeQuery :: ByteString -> ZonedTime -> Query
timeQuery name time = [(name, Just . BS8.pack $ showRFC3339 time)] | 112 | timeQuery name time = [(name, Just . BS8.pack $ showRFC3339 time)] | 66 | false | true | 0 | 9 | 17 | 46 | 24 | 22 | null | null |
coreyoconnor/bind-marshal | test/verify_bind_rules_proto.hs | bsd-3-clause | force_7_alt :: Dyn () -> ()
force_7_alt = undefined | 51 | force_7_alt :: Dyn () -> ()
force_7_alt = undefined | 51 | force_7_alt = undefined | 23 | false | true | 0 | 7 | 8 | 22 | 11 | 11 | null | null |
codemac/yi-editor | src/Yi/Keymap/Nano.hs | gpl-2.0 | cmdChar :: NanoMode
cmdChar = choice [event c >> act | (c,act) <- cmdCharFM] | 76 | cmdChar :: NanoMode
cmdChar = choice [event c >> act | (c,act) <- cmdCharFM] | 76 | cmdChar = choice [event c >> act | (c,act) <- cmdCharFM] | 56 | false | true | 0 | 9 | 13 | 38 | 20 | 18 | null | null |
rrnewton/stack | src/Stack/Docker.hs | bsd-3-clause | -- | Name of home directory within docker sandbox.
homeDirName :: Path Rel Dir
homeDirName = $(mkRelDir "_home/") | 113 | homeDirName :: Path Rel Dir
homeDirName = $(mkRelDir "_home/") | 62 | homeDirName = $(mkRelDir "_home/") | 34 | true | true | 0 | 7 | 17 | 24 | 12 | 12 | null | null |
ThomWright/CIS194 | src/HW03.hs | bsd-3-clause | evalSimple state DSkip = state | 43 | evalSimple state DSkip = state | 43 | evalSimple state DSkip = state | 43 | false | false | 0 | 4 | 17 | 13 | 5 | 8 | null | null |
kojiromike/Idris-dev | src/Idris/IBC.hs | bsd-3-clause | ibc i (IBCAccess n a) f = return f { ibc_access = (n,a) : ibc_access f } | 72 | ibc i (IBCAccess n a) f = return f { ibc_access = (n,a) : ibc_access f } | 72 | ibc i (IBCAccess n a) f = return f { ibc_access = (n,a) : ibc_access f } | 72 | false | false | 1 | 9 | 16 | 50 | 23 | 27 | null | null |
bgamari/haskell-platform | hptool/src/Target.hs | bsd-3-clause | buildRules :: Rules ()
buildRules = do
packageBuildDir PackageWildCard %/> \buildDir -> do
hpRel <- askHpRelease
bc <- askBuildConfig
buildAction buildDir hpRel bc | 191 | buildRules :: Rules ()
buildRules = do
packageBuildDir PackageWildCard %/> \buildDir -> do
hpRel <- askHpRelease
bc <- askBuildConfig
buildAction buildDir hpRel bc | 191 | buildRules = do
packageBuildDir PackageWildCard %/> \buildDir -> do
hpRel <- askHpRelease
bc <- askBuildConfig
buildAction buildDir hpRel bc | 168 | false | true | 0 | 11 | 50 | 55 | 25 | 30 | null | null |
kawamuray/ganeti | src/Ganeti/Constants.hs | gpl-2.0 | -- * Helper VM-related timeouts
-- | The default fixed timeout - needed to startup the helper VM
helperVmStartup :: Int
helperVmStartup = 5 * 60 | 145 | helperVmStartup :: Int
helperVmStartup = 5 * 60 | 47 | helperVmStartup = 5 * 60 | 24 | true | true | 0 | 5 | 26 | 17 | 10 | 7 | null | null |
haskell-opengl/OpenGLRaw | src/Graphics/GL/Functions/F14.hs | bsd-3-clause | -- glIndexf --------------------------------------------------------------------
-- | Manual page for <https://www.opengl.org/sdk/docs/man2/xhtml/glIndex.xml OpenGL 2.x>. The vector equivalent of this command is 'glIndexfv'.
glIndexf
:: MonadIO m
=> GLfloat -- ^ @c@ of type @ColorIndexValueF@.
-> m ()
glIndexf v1 = liftIO $ dyn85 ptr_glIndexf v1 | 354 | glIndexf
:: MonadIO m
=> GLfloat -- ^ @c@ of type @ColorIndexValueF@.
-> m ()
glIndexf v1 = liftIO $ dyn85 ptr_glIndexf v1 | 128 | glIndexf v1 = liftIO $ dyn85 ptr_glIndexf v1 | 44 | true | true | 2 | 9 | 48 | 47 | 22 | 25 | null | null |
sordina/wai | wai-extra/Network/Wai/Middleware/RequestSizeLimit.hs | bsd-2-clause | -- | Middleware to limit request bodies to a certain size.
--
-- This uses 'requestSizeCheck' under the hood; see that function for details.
--
-- @since 3.1.1
requestSizeLimitMiddleware :: RequestSizeLimitSettings -> Middleware
requestSizeLimitMiddleware settings app req sendResponse = do
maybeMaxLen <- (maxLengthForRequest settings) req
case maybeMaxLen of
Nothing -> app req sendResponse
Just maxLen -> do
eitherSizeExceptionOrNewReq <- try (requestSizeCheck maxLen req)
case eitherSizeExceptionOrNewReq of
-- In the case of a known-length request, RequestSizeException will be thrown immediately
Left (RequestSizeException _maxLen) -> handleLengthExceeded maxLen
-- In the case of a chunked request (unknown length), RequestSizeException will be thrown during the processing of a body
Right newReq -> app newReq sendResponse `catch` \(RequestSizeException _maxLen) -> handleLengthExceeded maxLen
where
handleLengthExceeded maxLen = (onLengthExceeded settings) maxLen app req sendResponse | 1,119 | requestSizeLimitMiddleware :: RequestSizeLimitSettings -> Middleware
requestSizeLimitMiddleware settings app req sendResponse = do
maybeMaxLen <- (maxLengthForRequest settings) req
case maybeMaxLen of
Nothing -> app req sendResponse
Just maxLen -> do
eitherSizeExceptionOrNewReq <- try (requestSizeCheck maxLen req)
case eitherSizeExceptionOrNewReq of
-- In the case of a known-length request, RequestSizeException will be thrown immediately
Left (RequestSizeException _maxLen) -> handleLengthExceeded maxLen
-- In the case of a chunked request (unknown length), RequestSizeException will be thrown during the processing of a body
Right newReq -> app newReq sendResponse `catch` \(RequestSizeException _maxLen) -> handleLengthExceeded maxLen
where
handleLengthExceeded maxLen = (onLengthExceeded settings) maxLen app req sendResponse | 959 | requestSizeLimitMiddleware settings app req sendResponse = do
maybeMaxLen <- (maxLengthForRequest settings) req
case maybeMaxLen of
Nothing -> app req sendResponse
Just maxLen -> do
eitherSizeExceptionOrNewReq <- try (requestSizeCheck maxLen req)
case eitherSizeExceptionOrNewReq of
-- In the case of a known-length request, RequestSizeException will be thrown immediately
Left (RequestSizeException _maxLen) -> handleLengthExceeded maxLen
-- In the case of a chunked request (unknown length), RequestSizeException will be thrown during the processing of a body
Right newReq -> app newReq sendResponse `catch` \(RequestSizeException _maxLen) -> handleLengthExceeded maxLen
where
handleLengthExceeded maxLen = (onLengthExceeded settings) maxLen app req sendResponse | 890 | true | true | 0 | 18 | 252 | 176 | 86 | 90 | null | null |
typelead/epm | epm/Distribution/Client/BuildReports/Anonymous.hs | bsd-3-clause | parseFlag :: Parse.ReadP r (FlagName, Bool)
parseFlag = do
name <- Parse.munch1 (\c -> Char.isAlphaNum c || c == '_' || c == '-')
case name of
('-':flag) -> return (FlagName flag, False)
flag -> return (FlagName flag, True) | 241 | parseFlag :: Parse.ReadP r (FlagName, Bool)
parseFlag = do
name <- Parse.munch1 (\c -> Char.isAlphaNum c || c == '_' || c == '-')
case name of
('-':flag) -> return (FlagName flag, False)
flag -> return (FlagName flag, True) | 241 | parseFlag = do
name <- Parse.munch1 (\c -> Char.isAlphaNum c || c == '_' || c == '-')
case name of
('-':flag) -> return (FlagName flag, False)
flag -> return (FlagName flag, True) | 197 | false | true | 1 | 17 | 56 | 119 | 58 | 61 | null | null |
gcampax/ghc | compiler/typecheck/TcGenDeriv.hs | bsd-3-clause | leFloat_RDR = varQual_RDR gHC_PRIM (fsLit "leFloat#") | 57 | leFloat_RDR = varQual_RDR gHC_PRIM (fsLit "leFloat#") | 57 | leFloat_RDR = varQual_RDR gHC_PRIM (fsLit "leFloat#") | 57 | false | false | 1 | 7 | 9 | 20 | 8 | 12 | null | null |
facebookincubator/duckling | Duckling/Time/ES/Rules.hs | bsd-3-clause | ruleMonths :: [Rule]
ruleMonths = mkRuleMonths
[ ( "Enero" , "enero|ene\\.?")
, ( "Febrero" , "febrero|feb\\.?")
, ( "Marzo" , "marzo|mar\\.?")
, ( "Abril" , "abril|abr\\.?")
, ( "Mayo" , "mayo?\\.?")
, ( "Junio" , "junio|jun\\.?")
, ( "Julio" , "julio|jul\\.?")
, ( "Agosto" , "agosto|ago\\.?")
, ( "Septiembre", "septiembre|sept?\\.?")
, ( "Octubre" , "octubre|oct\\.?")
, ( "Noviembre" , "noviembre|nov\\.?")
, ( "Diciembre" , "diciembre|dic\\.?")
] | 510 | ruleMonths :: [Rule]
ruleMonths = mkRuleMonths
[ ( "Enero" , "enero|ene\\.?")
, ( "Febrero" , "febrero|feb\\.?")
, ( "Marzo" , "marzo|mar\\.?")
, ( "Abril" , "abril|abr\\.?")
, ( "Mayo" , "mayo?\\.?")
, ( "Junio" , "junio|jun\\.?")
, ( "Julio" , "julio|jul\\.?")
, ( "Agosto" , "agosto|ago\\.?")
, ( "Septiembre", "septiembre|sept?\\.?")
, ( "Octubre" , "octubre|oct\\.?")
, ( "Noviembre" , "noviembre|nov\\.?")
, ( "Diciembre" , "diciembre|dic\\.?")
] | 510 | ruleMonths = mkRuleMonths
[ ( "Enero" , "enero|ene\\.?")
, ( "Febrero" , "febrero|feb\\.?")
, ( "Marzo" , "marzo|mar\\.?")
, ( "Abril" , "abril|abr\\.?")
, ( "Mayo" , "mayo?\\.?")
, ( "Junio" , "junio|jun\\.?")
, ( "Julio" , "julio|jul\\.?")
, ( "Agosto" , "agosto|ago\\.?")
, ( "Septiembre", "septiembre|sept?\\.?")
, ( "Octubre" , "octubre|oct\\.?")
, ( "Noviembre" , "noviembre|nov\\.?")
, ( "Diciembre" , "diciembre|dic\\.?")
] | 489 | false | true | 0 | 6 | 123 | 125 | 81 | 44 | null | null |
soenkehahn/wai | wai-app-static/Network/Wai/Application/Static.hs | mit | filterButLast :: (a -> Bool) -> [a] -> [a]
filterButLast _ [] = [] | 66 | filterButLast :: (a -> Bool) -> [a] -> [a]
filterButLast _ [] = [] | 66 | filterButLast _ [] = [] | 23 | false | true | 0 | 7 | 13 | 41 | 22 | 19 | null | null |
eligottlieb/Shannon | src/Statistics/Information/Continuous/TotalCorrelation.hs | bsd-3-clause | corex_mis :: RandomGen g => g -> Int -> Int -> Matrix Double -> Matrix Double ->
Double
corex_mis g k base xs ys = sum mixs - mi_all where
mixs = [mi gcol k base col ys | (col, gcol) <- cols]
mi_all = mi g2 k base xs ys
(g1, g2) = split g
cols = (map colVector (columns xs)) `zip` (splitN (ncols xs) g1) | 324 | corex_mis :: RandomGen g => g -> Int -> Int -> Matrix Double -> Matrix Double ->
Double
corex_mis g k base xs ys = sum mixs - mi_all where
mixs = [mi gcol k base col ys | (col, gcol) <- cols]
mi_all = mi g2 k base xs ys
(g1, g2) = split g
cols = (map colVector (columns xs)) `zip` (splitN (ncols xs) g1) | 324 | corex_mis g k base xs ys = sum mixs - mi_all where
mixs = [mi gcol k base col ys | (col, gcol) <- cols]
mi_all = mi g2 k base xs ys
(g1, g2) = split g
cols = (map colVector (columns xs)) `zip` (splitN (ncols xs) g1) | 223 | false | true | 0 | 11 | 87 | 166 | 85 | 81 | null | null |
Crossroadsman/ProgrammingInHaskell | 07/voting.hs | apache-2.0 | -- as implemented, this will return the member that appears last in the sorted list
-- this does not mean this member had more votes than everyone else (the second-last
-- etc might have the same number of votes) nor does it mean that the member was
-- 'first past the post' as it does not check that the member's share was >50% of the total
mostVotes :: Ord a => [a] -> a
mostVotes = fst . last . result | 405 | mostVotes :: Ord a => [a] -> a
mostVotes = fst . last . result | 62 | mostVotes = fst . last . result | 31 | true | true | 0 | 8 | 81 | 44 | 22 | 22 | null | null |
mplamann/magic-spieler | src/SnapServer.hs | mit | main :: IO ()
main = do
updateGlobalLogger "Game" (setLevel DEBUG)
updateGlobalLogger "MVar" (setLevel DEBUG)
stateMVar <- newEmptyMVar
input <- newMVar (Nothing, IOReqPriority 0)
output <- newEmptyMVar :: IO (MVar GameAction)
gameState <- setupGame =<<
buildGame stateMVar input output
"Nicholas" nickDeck "Mitchell" mitchellDeck
debugM "MVar" "main putting initial game state"
putMVar stateMVar gameState
threadID <- spawnLogicThread stateMVar output input
tID <- newMVar threadID
quickHttpServe $ site stateMVar input output tID | 593 | main :: IO ()
main = do
updateGlobalLogger "Game" (setLevel DEBUG)
updateGlobalLogger "MVar" (setLevel DEBUG)
stateMVar <- newEmptyMVar
input <- newMVar (Nothing, IOReqPriority 0)
output <- newEmptyMVar :: IO (MVar GameAction)
gameState <- setupGame =<<
buildGame stateMVar input output
"Nicholas" nickDeck "Mitchell" mitchellDeck
debugM "MVar" "main putting initial game state"
putMVar stateMVar gameState
threadID <- spawnLogicThread stateMVar output input
tID <- newMVar threadID
quickHttpServe $ site stateMVar input output tID | 593 | main = do
updateGlobalLogger "Game" (setLevel DEBUG)
updateGlobalLogger "MVar" (setLevel DEBUG)
stateMVar <- newEmptyMVar
input <- newMVar (Nothing, IOReqPriority 0)
output <- newEmptyMVar :: IO (MVar GameAction)
gameState <- setupGame =<<
buildGame stateMVar input output
"Nicholas" nickDeck "Mitchell" mitchellDeck
debugM "MVar" "main putting initial game state"
putMVar stateMVar gameState
threadID <- spawnLogicThread stateMVar output input
tID <- newMVar threadID
quickHttpServe $ site stateMVar input output tID | 579 | false | true | 0 | 10 | 131 | 171 | 76 | 95 | null | null |
8l/metafun | src/Language/Kiff/Typing/Infer.hs | gpl-3.0 | typeOfOp OpSub = intOp | 23 | typeOfOp OpSub = intOp | 23 | typeOfOp OpSub = intOp | 23 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
MetaMemoryT/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | mapPTermFC f g (PMatchApp fc n) = PMatchApp (f fc) n | 52 | mapPTermFC f g (PMatchApp fc n) = PMatchApp (f fc) n | 52 | mapPTermFC f g (PMatchApp fc n) = PMatchApp (f fc) n | 52 | false | false | 0 | 7 | 10 | 32 | 15 | 17 | null | null |
AlexanderPankiv/ghc | compiler/utils/BooleanFormula.hs | bsd-3-clause | isFalse :: BooleanFormula a -> Bool
isFalse (Or []) = True | 58 | isFalse :: BooleanFormula a -> Bool
isFalse (Or []) = True | 58 | isFalse (Or []) = True | 22 | false | true | 0 | 8 | 10 | 29 | 14 | 15 | null | null |
AndrewRademacher/stack | src/Stack/Setup/Installed.hs | bsd-3-clause | listInstalled :: (MonadIO m, MonadThrow m)
=> Path Abs Dir
-> m [Tool]
listInstalled programsPath = do
doesDirExist programsPath >>= \case
False -> return []
True -> do (_, files) <- listDir programsPath
return $ mapMaybe toTool files
where
toTool fp = do
x <- T.stripSuffix ".installed" $ T.pack $ toFilePath $ filename fp
parseToolText x | 428 | listInstalled :: (MonadIO m, MonadThrow m)
=> Path Abs Dir
-> m [Tool]
listInstalled programsPath = do
doesDirExist programsPath >>= \case
False -> return []
True -> do (_, files) <- listDir programsPath
return $ mapMaybe toTool files
where
toTool fp = do
x <- T.stripSuffix ".installed" $ T.pack $ toFilePath $ filename fp
parseToolText x | 428 | listInstalled programsPath = do
doesDirExist programsPath >>= \case
False -> return []
True -> do (_, files) <- listDir programsPath
return $ mapMaybe toTool files
where
toTool fp = do
x <- T.stripSuffix ".installed" $ T.pack $ toFilePath $ filename fp
parseToolText x | 329 | false | true | 0 | 14 | 144 | 147 | 68 | 79 | null | null |
ZjMNZHgG5jMXw/privacy-option-simpol | start.hs | bsd-3-clause | d = join (join disclose) | 24 | d = join (join disclose) | 24 | d = join (join disclose) | 24 | false | false | 1 | 7 | 4 | 18 | 7 | 11 | null | null |
limaner2002/EPC-tools | RapidFire/src/Appian/Client.hs | bsd-3-clause | checkPaging :: StartIndex -> GridField a -> Bool
checkPaging (StartIndex idx) gf = maybe False (== idx) si
where
si = gf ^? pagingInfo . pgIStartIndex
-- * Convenience functions
-- | Clicks on the actions tab, locates the given action and clicks on the link | 265 | checkPaging :: StartIndex -> GridField a -> Bool
checkPaging (StartIndex idx) gf = maybe False (== idx) si
where
si = gf ^? pagingInfo . pgIStartIndex
-- * Convenience functions
-- | Clicks on the actions tab, locates the given action and clicks on the link | 265 | checkPaging (StartIndex idx) gf = maybe False (== idx) si
where
si = gf ^? pagingInfo . pgIStartIndex
-- * Convenience functions
-- | Clicks on the actions tab, locates the given action and clicks on the link | 216 | false | true | 0 | 7 | 53 | 62 | 32 | 30 | null | null |
capital-match/hdo | main/hdo.hs | mit | parseCommandOptions ("droplets":"action":dropletId:actionId:[])
= getAction (P.read dropletId) (P.read actionId) >>= outputResult | 187 | parseCommandOptions ("droplets":"action":dropletId:actionId:[])
= getAction (P.read dropletId) (P.read actionId) >>= outputResult | 187 | parseCommandOptions ("droplets":"action":dropletId:actionId:[])
= getAction (P.read dropletId) (P.read actionId) >>= outputResult | 187 | false | false | 0 | 11 | 67 | 55 | 27 | 28 | null | null |
bobgru/game-theory | compleat-strategyst/Game2xN.hs | bsd-3-clause | sName :: Player -> StrategyId -> Game2xN -> String
sName 1 1 g = p1Stg1Name g | 77 | sName :: Player -> StrategyId -> Game2xN -> String
sName 1 1 g = p1Stg1Name g | 77 | sName 1 1 g = p1Stg1Name g | 26 | false | true | 0 | 7 | 15 | 33 | 16 | 17 | null | null |
Javran/Project-Euler | src/ProjectEuler/Problem105.hs | mit | isIncreasing :: Ord a => [a] -> Bool
isIncreasing xs = and $ zipWith (<) xs (tail xs) | 85 | isIncreasing :: Ord a => [a] -> Bool
isIncreasing xs = and $ zipWith (<) xs (tail xs) | 85 | isIncreasing xs = and $ zipWith (<) xs (tail xs) | 48 | false | true | 2 | 8 | 17 | 53 | 25 | 28 | null | null |
centromere/cacophony | tests/vectors/Keys.hs | unlicense | responderEphemeral :: SomeDHType
-> ScrubbedBytes
responderEphemeral (WrapDHType Curve25519) = hexToSB "bbdb4cdbd309f1a1f2e1456967fe288cadd6f712d65dc7b7793d5e63da6b375b" | 188 | responderEphemeral :: SomeDHType
-> ScrubbedBytes
responderEphemeral (WrapDHType Curve25519) = hexToSB "bbdb4cdbd309f1a1f2e1456967fe288cadd6f712d65dc7b7793d5e63da6b375b" | 188 | responderEphemeral (WrapDHType Curve25519) = hexToSB "bbdb4cdbd309f1a1f2e1456967fe288cadd6f712d65dc7b7793d5e63da6b375b" | 119 | false | true | 0 | 7 | 29 | 27 | 13 | 14 | null | null |
erochest/c18sgml | app/Opts.hs | apache-2.0 | tagName :: Parser T.Text
tagName = option (T.pack <$> str)
( short 't' <> long "tag" <> metavar "TAG_NAME"
<> help "The tag name to process.") | 163 | tagName :: Parser T.Text
tagName = option (T.pack <$> str)
( short 't' <> long "tag" <> metavar "TAG_NAME"
<> help "The tag name to process.") | 163 | tagName = option (T.pack <$> str)
( short 't' <> long "tag" <> metavar "TAG_NAME"
<> help "The tag name to process.") | 138 | false | true | 0 | 10 | 46 | 57 | 27 | 30 | null | null |
sdiehl/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | specTyConName :: Name
specTyConName = tcQual gHC_TYPES (fsLit "SPEC") specTyConKey | 86 | specTyConName :: Name
specTyConName = tcQual gHC_TYPES (fsLit "SPEC") specTyConKey | 86 | specTyConName = tcQual gHC_TYPES (fsLit "SPEC") specTyConKey | 64 | false | true | 0 | 7 | 13 | 24 | 12 | 12 | null | null |
akru/haste-compiler | src/Data/JSTarget/Optimize.hs | bsd-3-clause | getTailcallInfo (Return (Call 0 _ (Var f) as)) = Just (f, as) | 63 | getTailcallInfo (Return (Call 0 _ (Var f) as)) = Just (f, as) | 63 | getTailcallInfo (Return (Call 0 _ (Var f) as)) = Just (f, as) | 63 | false | false | 0 | 11 | 13 | 42 | 21 | 21 | null | null |
facebookarchive/lex-pass | src/Transf/AntiPattern.hs | bsd-3-clause | transfs :: [Transf]
transfs = [
"assignables-go-right" -:- ftype -?-
"\"if ($x == true)\" -> \"if (true == $x)\" etc"
-=- (\ [] -> lexPass assignablesGoRight),
"kill-split" -:- ftype -?-
"split() becomes preg_split()"
-- TODO: detect non-regex case and go to explode() instead of preg_split()?
-=- (\ [] -> lexPass killSplit),
"preg-split-non-regex" -:- ftype -?-
"preg_split('/a/', ..) becomes explode('a', ..)"
-=- (\ [] -> lexPass pregSplitNonRegex)
] | 476 | transfs :: [Transf]
transfs = [
"assignables-go-right" -:- ftype -?-
"\"if ($x == true)\" -> \"if (true == $x)\" etc"
-=- (\ [] -> lexPass assignablesGoRight),
"kill-split" -:- ftype -?-
"split() becomes preg_split()"
-- TODO: detect non-regex case and go to explode() instead of preg_split()?
-=- (\ [] -> lexPass killSplit),
"preg-split-non-regex" -:- ftype -?-
"preg_split('/a/', ..) becomes explode('a', ..)"
-=- (\ [] -> lexPass pregSplitNonRegex)
] | 476 | transfs = [
"assignables-go-right" -:- ftype -?-
"\"if ($x == true)\" -> \"if (true == $x)\" etc"
-=- (\ [] -> lexPass assignablesGoRight),
"kill-split" -:- ftype -?-
"split() becomes preg_split()"
-- TODO: detect non-regex case and go to explode() instead of preg_split()?
-=- (\ [] -> lexPass killSplit),
"preg-split-non-regex" -:- ftype -?-
"preg_split('/a/', ..) becomes explode('a', ..)"
-=- (\ [] -> lexPass pregSplitNonRegex)
] | 456 | false | true | 0 | 10 | 88 | 106 | 55 | 51 | null | null |
qua-bla/hamsql | src/Database/HamSql/Internal/PostgresCon.hs | gpl-3.0 | pgsqlExecStmtList _ Unchanged [] failed conn =
pgsqlExecStmtHandled conn (head failed) | 88 | pgsqlExecStmtList _ Unchanged [] failed conn =
pgsqlExecStmtHandled conn (head failed) | 88 | pgsqlExecStmtList _ Unchanged [] failed conn =
pgsqlExecStmtHandled conn (head failed) | 88 | false | false | 0 | 7 | 12 | 30 | 14 | 16 | null | null |
Cahu/krpc-hs | src/KRPCHS/SpaceCenter.hs | gpl-3.0 | {-
- The impact tolerance of the part, in meters per second.
-}
getPartImpactTolerance :: KRPCHS.SpaceCenter.Part -> RPCContext (Double)
getPartImpactTolerance thisArg = do
let r = makeRequest "SpaceCenter" "Part_get_ImpactTolerance" [makeArgument 0 thisArg]
res <- sendRequest r
processResponse res | 313 | getPartImpactTolerance :: KRPCHS.SpaceCenter.Part -> RPCContext (Double)
getPartImpactTolerance thisArg = do
let r = makeRequest "SpaceCenter" "Part_get_ImpactTolerance" [makeArgument 0 thisArg]
res <- sendRequest r
processResponse res | 247 | getPartImpactTolerance thisArg = do
let r = makeRequest "SpaceCenter" "Part_get_ImpactTolerance" [makeArgument 0 thisArg]
res <- sendRequest r
processResponse res | 174 | true | true | 0 | 13 | 51 | 73 | 33 | 40 | null | null |
projectorhq/haskell-liquid | test/Text/Liquid/RendererTests.hs | bsd-3-clause | case_evalLogic5 = let j = object []
p = pure False
t = [RawText "foo", RawText "bar"]
res = evalLogic j p t
exp = AccSuccess ""
in res @?= exp | 248 | case_evalLogic5 = let j = object []
p = pure False
t = [RawText "foo", RawText "bar"]
res = evalLogic j p t
exp = AccSuccess ""
in res @?= exp | 248 | case_evalLogic5 = let j = object []
p = pure False
t = [RawText "foo", RawText "bar"]
res = evalLogic j p t
exp = AccSuccess ""
in res @?= exp | 248 | false | false | 1 | 10 | 136 | 75 | 35 | 40 | null | null |
HJvT/hdirect | src/Parser.hs | bsd-3-clause | action_100 x = happyTcHack x happyReduce_344 | 44 | action_100 x = happyTcHack x happyReduce_344 | 44 | action_100 x = happyTcHack x happyReduce_344 | 44 | false | false | 0 | 5 | 5 | 14 | 6 | 8 | null | null |
yuttie/ghc-mod | Language/Haskell/GhcMod/Cradle.hs | bsd-3-clause | -- Finding a Cabal file up to the root directory
-- Input: a directly to investigate
-- Output: (the path to the directory containing a Cabal file
-- ,the path to the Cabal file)
cabalDir :: FilePath -> IO (FilePath,FilePath)
cabalDir dir = do
cnts <- getCabalFiles dir
case cnts of
[] | dir' == dir -> throwIO $ userError "cabal files not found"
| otherwise -> cabalDir dir'
cfile:_ -> return (dir,dir </> cfile)
where
dir' = takeDirectory dir | 504 | cabalDir :: FilePath -> IO (FilePath,FilePath)
cabalDir dir = do
cnts <- getCabalFiles dir
case cnts of
[] | dir' == dir -> throwIO $ userError "cabal files not found"
| otherwise -> cabalDir dir'
cfile:_ -> return (dir,dir </> cfile)
where
dir' = takeDirectory dir | 317 | cabalDir dir = do
cnts <- getCabalFiles dir
case cnts of
[] | dir' == dir -> throwIO $ userError "cabal files not found"
| otherwise -> cabalDir dir'
cfile:_ -> return (dir,dir </> cfile)
where
dir' = takeDirectory dir | 270 | true | true | 0 | 13 | 139 | 119 | 58 | 61 | null | null |
Muzietto/transformerz | haskell/nilsson/nilsson_ref.hs | mit | unET (ET m) = m | 15 | unET (ET m) = m | 15 | unET (ET m) = m | 15 | false | false | 0 | 7 | 4 | 15 | 7 | 8 | null | null |
vTurbine/ghc | compiler/deSugar/DsBinds.hs | bsd-3-clause | dsHsWrapper (WpFun c1 c2 t1) e = do { x <- newSysLocalDs t1
; e1 <- dsHsWrapper c1 (Var x)
; e2 <- dsHsWrapper c2 (mkCoreAppDs (text "dsHsWrapper") e e1)
; return (Lam x e2) } | 287 | dsHsWrapper (WpFun c1 c2 t1) e = do { x <- newSysLocalDs t1
; e1 <- dsHsWrapper c1 (Var x)
; e2 <- dsHsWrapper c2 (mkCoreAppDs (text "dsHsWrapper") e e1)
; return (Lam x e2) } | 287 | dsHsWrapper (WpFun c1 c2 t1) e = do { x <- newSysLocalDs t1
; e1 <- dsHsWrapper c1 (Var x)
; e2 <- dsHsWrapper c2 (mkCoreAppDs (text "dsHsWrapper") e e1)
; return (Lam x e2) } | 287 | false | false | 0 | 12 | 147 | 96 | 46 | 50 | null | null |
bitemyapp/hpp | src/Hpp/Expr.hs | bsd-3-clause | opParsed :: Either BinOp UnaryOp -> Parsed
opParsed (Left x) = PBinOp x | 71 | opParsed :: Either BinOp UnaryOp -> Parsed
opParsed (Left x) = PBinOp x | 71 | opParsed (Left x) = PBinOp x | 28 | false | true | 0 | 7 | 12 | 32 | 15 | 17 | null | null |
sdiehl/ghc | testsuite/tests/utils/should_run/T15953.hs | bsd-3-clause | foo n = foo (n - 1) | 19 | foo n = foo (n - 1) | 19 | foo n = foo (n - 1) | 19 | false | false | 1 | 7 | 6 | 22 | 9 | 13 | null | null |
roberth/uu-helium | lib/Prelude.hs | gpl-3.0 | (++) :: [a] -> [a] -> [a]
(x:xs) ++ ys = x : (xs ++ ys) | 55 | (++) :: [a] -> [a] -> [a]
(x:xs) ++ ys = x : (xs ++ ys) | 55 | (x:xs) ++ ys = x : (xs ++ ys) | 29 | false | true | 0 | 7 | 15 | 54 | 30 | 24 | null | null |
Solumin/ScriptNScribe | src/BreveLang.hs | mit | -- Parses the other two kinds of statements; return and assign.
-- Return is furst so it can try to eat "return" keywords before parseAssign has
-- a go.
parseStatement :: Parser Statement
parseStatement = parseReturn <|> try parseAssign | 237 | parseStatement :: Parser Statement
parseStatement = parseReturn <|> try parseAssign | 83 | parseStatement = parseReturn <|> try parseAssign | 48 | true | true | 0 | 6 | 38 | 24 | 13 | 11 | null | null |
frt/happyscheduler | Settings.hs | mit | -- | How static files should be combined.
combineSettings :: CombineSettings
combineSettings = def | 98 | combineSettings :: CombineSettings
combineSettings = def | 56 | combineSettings = def | 21 | true | true | 0 | 6 | 13 | 19 | 8 | 11 | null | null |
brendanhay/gogol | gogol-dlp/gen/Network/Google/Resource/DLP/Projects/DeidentifyTemplates/Delete.hs | mpl-2.0 | -- | OAuth access token.
pdtdAccessToken :: Lens' ProjectsDeidentifyTemplatesDelete (Maybe Text)
pdtdAccessToken
= lens _pdtdAccessToken
(\ s a -> s{_pdtdAccessToken = a}) | 179 | pdtdAccessToken :: Lens' ProjectsDeidentifyTemplatesDelete (Maybe Text)
pdtdAccessToken
= lens _pdtdAccessToken
(\ s a -> s{_pdtdAccessToken = a}) | 154 | pdtdAccessToken
= lens _pdtdAccessToken
(\ s a -> s{_pdtdAccessToken = a}) | 82 | true | true | 0 | 9 | 29 | 48 | 25 | 23 | null | null |
tpltnt/Tidal | Sound/Tidal/Strategies.hs | gpl-3.0 | triple = stutter 3 | 18 | triple = stutter 3 | 18 | triple = stutter 3 | 18 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
fmenozzi/functional-programming | Noise.hs | mit | -- Cubic S-curve interpolation
clerp :: Double -> Double -> Double -> Double
clerp x y w = lerp x y cw
where
cw = ((-2)*w^3) + (3*w^2)
-- Quintic S-curve interpolation | 196 | clerp :: Double -> Double -> Double -> Double
clerp x y w = lerp x y cw
where
cw = ((-2)*w^3) + (3*w^2)
-- Quintic S-curve interpolation | 165 | clerp x y w = lerp x y cw
where
cw = ((-2)*w^3) + (3*w^2)
-- Quintic S-curve interpolation | 119 | true | true | 0 | 10 | 60 | 83 | 42 | 41 | null | null |
feliposz/learning-stuff | haskell/learn_chapter8.hs | mit | treeElem x (Node y left right)
| x == y = True
| x > y = treeElem x right
| x < y = treeElem x left | 113 | treeElem x (Node y left right)
| x == y = True
| x > y = treeElem x right
| x < y = treeElem x left | 113 | treeElem x (Node y left right)
| x == y = True
| x > y = treeElem x right
| x < y = treeElem x left | 113 | false | false | 0 | 8 | 41 | 67 | 30 | 37 | null | null |
Orvid/fbthrift | thrift/compiler/test/fixtures/namespace/gen-hs/My/Namespacing/Extend/Test/ExtendTestService.hs | apache-2.0 | process_check (seqid, iprot, oprot, handler) = do
args <- ExtendTestService.read_Check_args iprot
(Exception.catch
(do
val <- Iface.check handler (check_args_struct1 args)
let res = default_Check_result{check_result_success = val}
Thrift.writeMessage oprot ("check", Types.M_REPLY, seqid) $
write_Check_result oprot res
Thrift.tFlush (Thrift.getTransport oprot))
((\_ -> do
Thrift.writeMessage oprot ("check", Types.M_EXCEPTION, seqid) $
Thrift.writeAppExn oprot (Thrift.AppExn Thrift.AE_UNKNOWN "")
Thrift.tFlush (Thrift.getTransport oprot)) :: Exception.SomeException -> IO ())) | 644 | process_check (seqid, iprot, oprot, handler) = do
args <- ExtendTestService.read_Check_args iprot
(Exception.catch
(do
val <- Iface.check handler (check_args_struct1 args)
let res = default_Check_result{check_result_success = val}
Thrift.writeMessage oprot ("check", Types.M_REPLY, seqid) $
write_Check_result oprot res
Thrift.tFlush (Thrift.getTransport oprot))
((\_ -> do
Thrift.writeMessage oprot ("check", Types.M_EXCEPTION, seqid) $
Thrift.writeAppExn oprot (Thrift.AppExn Thrift.AE_UNKNOWN "")
Thrift.tFlush (Thrift.getTransport oprot)) :: Exception.SomeException -> IO ())) | 644 | process_check (seqid, iprot, oprot, handler) = do
args <- ExtendTestService.read_Check_args iprot
(Exception.catch
(do
val <- Iface.check handler (check_args_struct1 args)
let res = default_Check_result{check_result_success = val}
Thrift.writeMessage oprot ("check", Types.M_REPLY, seqid) $
write_Check_result oprot res
Thrift.tFlush (Thrift.getTransport oprot))
((\_ -> do
Thrift.writeMessage oprot ("check", Types.M_EXCEPTION, seqid) $
Thrift.writeAppExn oprot (Thrift.AppExn Thrift.AE_UNKNOWN "")
Thrift.tFlush (Thrift.getTransport oprot)) :: Exception.SomeException -> IO ())) | 644 | false | false | 0 | 18 | 122 | 217 | 108 | 109 | null | null |
samscott89/tamarin-prover | lib/theory/src/Theory/Model/Rule.hs | gpl-3.0 | isPubConstrRule :: HasRuleName r => r -> Bool
isPubConstrRule ru = case ruleName ru of
IntrInfo PubConstrRule -> True
_ -> False
-- | True iff the rule is the special fresh rule. | 210 | isPubConstrRule :: HasRuleName r => r -> Bool
isPubConstrRule ru = case ruleName ru of
IntrInfo PubConstrRule -> True
_ -> False
-- | True iff the rule is the special fresh rule. | 210 | isPubConstrRule ru = case ruleName ru of
IntrInfo PubConstrRule -> True
_ -> False
-- | True iff the rule is the special fresh rule. | 164 | false | true | 3 | 6 | 64 | 46 | 23 | 23 | null | null |
DavidAlphaFox/ghc | compiler/coreSyn/TrieMap.hs | bsd-3-clause | xtE env (Cast e c) f m = m { cm_cast = cm_cast m |> xtE env e |>>
xtC env c f } | 138 | xtE env (Cast e c) f m = m { cm_cast = cm_cast m |> xtE env e |>>
xtC env c f } | 138 | xtE env (Cast e c) f m = m { cm_cast = cm_cast m |> xtE env e |>>
xtC env c f } | 138 | false | false | 1 | 10 | 82 | 58 | 26 | 32 | null | null |
Evan-Zhao/FastCanvas | src/Files/Node/NodeJSON.hs | bsd-3-clause | getFileName :: FileJSON -> String
getFileName = makeValid . display_name | 72 | getFileName :: FileJSON -> String
getFileName = makeValid . display_name | 72 | getFileName = makeValid . display_name | 38 | false | true | 1 | 7 | 9 | 27 | 11 | 16 | null | null |
theHawke/real-dcpu | dcpu-asm/dcpu-asm.hs | gpl-2.0 | operandLength _ _ = 0 | 36 | operandLength _ _ = 0 | 36 | operandLength _ _ = 0 | 36 | false | false | 0 | 5 | 19 | 11 | 5 | 6 | null | null |
rueshyna/gogol | gogol-admin-reports/gen/Network/Google/Reports/Types/Product.hs | mpl-2.0 | -- | Information about the type of the item.
uEntity :: Lens' UsageReport (Maybe UsageReportEntity)
uEntity = lens _uEntity (\ s a -> s{_uEntity = a}) | 150 | uEntity :: Lens' UsageReport (Maybe UsageReportEntity)
uEntity = lens _uEntity (\ s a -> s{_uEntity = a}) | 105 | uEntity = lens _uEntity (\ s a -> s{_uEntity = a}) | 50 | true | true | 1 | 9 | 25 | 49 | 25 | 24 | null | null |
thoughtpolice/hs-asai | src/Control/Delimited.hs | mit | reset :: Delim s t s :~> t
reset (Delim f) = Delim (\k -> k (f id)) | 67 | reset :: Delim s t s :~> t
reset (Delim f) = Delim (\k -> k (f id)) | 67 | reset (Delim f) = Delim (\k -> k (f id)) | 40 | false | true | 0 | 10 | 17 | 51 | 25 | 26 | null | null |
tonyfloatersu/solution-haskell-craft-of-FP | Chapter_4_my_note.hs | mit | rangeProd :: Integer -> Integer -> Integer
rangeProd n m
| n > m && m > 0 = rangeProd m n
| n < m && n > 0 = n * rangeProd (n + 1) m
| n == m && n > 0 = m
| otherwise = error "smaller than 0 not expected" | 240 | rangeProd :: Integer -> Integer -> Integer
rangeProd n m
| n > m && m > 0 = rangeProd m n
| n < m && n > 0 = n * rangeProd (n + 1) m
| n == m && n > 0 = m
| otherwise = error "smaller than 0 not expected" | 240 | rangeProd n m
| n > m && m > 0 = rangeProd m n
| n < m && n > 0 = n * rangeProd (n + 1) m
| n == m && n > 0 = m
| otherwise = error "smaller than 0 not expected" | 197 | false | true | 1 | 10 | 92 | 123 | 58 | 65 | null | null |
tategakibunko/hml | Mahjong/Mentsu.hs | gpl-2.0 | paisOfMentsu (Atama p) = replicate 2 p | 38 | paisOfMentsu (Atama p) = replicate 2 p | 38 | paisOfMentsu (Atama p) = replicate 2 p | 38 | false | false | 0 | 6 | 6 | 21 | 9 | 12 | null | null |
beni55/pandoc | src/pandoc.hs | gpl-2.0 | compileInfo :: String
compileInfo =
"\nCompiled with citeproc-hs " ++ VERSION_citeproc_hs ++ " and " ++
"highlighting-kate " ++ VERSION_highlighting_kate ++
".\nSyntax highlighting is supported for the following languages:\n " ++
wrapWords 4 78 languages | 272 | compileInfo :: String
compileInfo =
"\nCompiled with citeproc-hs " ++ VERSION_citeproc_hs ++ " and " ++
"highlighting-kate " ++ VERSION_highlighting_kate ++
".\nSyntax highlighting is supported for the following languages:\n " ++
wrapWords 4 78 languages | 272 | compileInfo =
"\nCompiled with citeproc-hs " ++ VERSION_citeproc_hs ++ " and " ++
"highlighting-kate " ++ VERSION_highlighting_kate ++
".\nSyntax highlighting is supported for the following languages:\n " ++
wrapWords 4 78 languages | 250 | false | true | 2 | 7 | 52 | 52 | 22 | 30 | null | null |
google/cabal2bazel | bzl/check_module_names/CheckModuleNames.hs | apache-2.0 | getOptions :: IO Options
getOptions = do
args <- getArgs
case getOpt Permute options args of
(o, [], []) -> return $ foldr ($) defaultOptions o
_ -> error $ usageInfo "CheckModuleNames: invalid usage:"
options
-- | Runs a single GHC API session with the given command-line options.
-- Gets the libdir by looking for the first argument of "-B..." | 410 | getOptions :: IO Options
getOptions = do
args <- getArgs
case getOpt Permute options args of
(o, [], []) -> return $ foldr ($) defaultOptions o
_ -> error $ usageInfo "CheckModuleNames: invalid usage:"
options
-- | Runs a single GHC API session with the given command-line options.
-- Gets the libdir by looking for the first argument of "-B..." | 410 | getOptions = do
args <- getArgs
case getOpt Permute options args of
(o, [], []) -> return $ foldr ($) defaultOptions o
_ -> error $ usageInfo "CheckModuleNames: invalid usage:"
options
-- | Runs a single GHC API session with the given command-line options.
-- Gets the libdir by looking for the first argument of "-B..." | 385 | false | true | 0 | 12 | 124 | 90 | 44 | 46 | null | null |
green-haskell/ghc | compiler/basicTypes/SrcLoc.hs | bsd-3-clause | -- | Tests whether the first span "contains" the other span, meaning
-- that it covers at least as much source code. True where spans are equal.
containsSpan :: RealSrcSpan -> RealSrcSpan -> Bool
containsSpan s1 s2
= srcSpanFile s1 == srcSpanFile s2
&& (srcSpanStartLine s1, srcSpanStartCol s1)
<= (srcSpanStartLine s2, srcSpanStartCol s2)
&& (srcSpanEndLine s1, srcSpanEndCol s1)
>= (srcSpanEndLine s2, srcSpanEndCol s2) | 445 | containsSpan :: RealSrcSpan -> RealSrcSpan -> Bool
containsSpan s1 s2
= srcSpanFile s1 == srcSpanFile s2
&& (srcSpanStartLine s1, srcSpanStartCol s1)
<= (srcSpanStartLine s2, srcSpanStartCol s2)
&& (srcSpanEndLine s1, srcSpanEndCol s1)
>= (srcSpanEndLine s2, srcSpanEndCol s2) | 300 | containsSpan s1 s2
= srcSpanFile s1 == srcSpanFile s2
&& (srcSpanStartLine s1, srcSpanStartCol s1)
<= (srcSpanStartLine s2, srcSpanStartCol s2)
&& (srcSpanEndLine s1, srcSpanEndCol s1)
>= (srcSpanEndLine s2, srcSpanEndCol s2) | 249 | true | true | 8 | 7 | 86 | 107 | 52 | 55 | null | null |
vladimir-ipatov/ganeti | src/Ganeti/Runtime.hs | gpl-2.0 | daemonUser GanetiLuxid = AutoConf.luxidUser | 45 | daemonUser GanetiLuxid = AutoConf.luxidUser | 45 | daemonUser GanetiLuxid = AutoConf.luxidUser | 45 | false | false | 0 | 5 | 5 | 11 | 5 | 6 | null | null |
LambdaHack/LambdaHack | test/UnitTestHelpers.hs | bsd-3-clause | -- * Stub identifiers
-- Using different arbitrary numbers for these so that if tests fail
-- due to missing keys we'll have more of a clue.
testLevelId :: LevelId
testLevelId = toEnum 111 | 189 | testLevelId :: LevelId
testLevelId = toEnum 111 | 47 | testLevelId = toEnum 111 | 24 | true | true | 0 | 6 | 34 | 23 | 11 | 12 | null | null |
Noeda/caramia | src/Graphics/Caramia/Internal/OpenGLCApi.hs | mit | mglProgramUniform4f :: GLuint -> GLint
-> GLfloat -> GLfloat -> GLfloat -> GLfloat -> IO ()
mglProgramUniform4f program loc v1 v2 v3 v4 =
if gl_ARB_separate_shader_objects
then glProgramUniform4f program loc v1 v2 v3 v4
else withBoundProgram program $ glUniform4f loc v1 v2 v3 v4 | 311 | mglProgramUniform4f :: GLuint -> GLint
-> GLfloat -> GLfloat -> GLfloat -> GLfloat -> IO ()
mglProgramUniform4f program loc v1 v2 v3 v4 =
if gl_ARB_separate_shader_objects
then glProgramUniform4f program loc v1 v2 v3 v4
else withBoundProgram program $ glUniform4f loc v1 v2 v3 v4 | 311 | mglProgramUniform4f program loc v1 v2 v3 v4 =
if gl_ARB_separate_shader_objects
then glProgramUniform4f program loc v1 v2 v3 v4
else withBoundProgram program $ glUniform4f loc v1 v2 v3 v4 | 199 | false | true | 0 | 12 | 75 | 92 | 45 | 47 | null | null |
Chase-C/Flocking-Haskell | src/OctreePar.hs | gpl-2.0 | insert node obj = replaceSubtree node octant $ insert (getSubtree node octant) obj
where octant = getOctant (center node) (bPos obj) | 151 | insert node obj = replaceSubtree node octant $ insert (getSubtree node octant) obj
where octant = getOctant (center node) (bPos obj) | 151 | insert node obj = replaceSubtree node octant $ insert (getSubtree node octant) obj
where octant = getOctant (center node) (bPos obj) | 151 | false | false | 0 | 8 | 39 | 58 | 27 | 31 | null | null |
RaminHAL9001/rose-trie | src/Data/Tree/RoseTrie.hs | gpl-3.0 | intersectionsWith :: Ord p => (a -> a -> a) -> [RoseTrie p a] -> RoseTrie p a
intersectionsWith overlap = foldl (intersectionWith overlap) Data.Tree.RoseTrie.empty | 163 | intersectionsWith :: Ord p => (a -> a -> a) -> [RoseTrie p a] -> RoseTrie p a
intersectionsWith overlap = foldl (intersectionWith overlap) Data.Tree.RoseTrie.empty | 163 | intersectionsWith overlap = foldl (intersectionWith overlap) Data.Tree.RoseTrie.empty | 85 | false | true | 0 | 9 | 24 | 68 | 34 | 34 | null | null |
kolmodin/cabal | cabal-install/Distribution/Solver/Modular/Linking.hs | bsd-3-clause | -- | Invariant for the set of link groups: every element in the link group
-- must be pointing to the /same/ link group
lgInvariant :: Map QPN LinkGroup -> Bool
lgInvariant links = all invGroup (M.elems links)
where
invGroup :: LinkGroup -> Bool
invGroup lg = allEqual $ map (`M.lookup` links) members
where
members :: [QPN]
members = map (`Q` lgPackage lg) $ S.toList (lgMembers lg)
-- | Package version of this group
--
-- This is only known once we have picked a canonical element. | 517 | lgInvariant :: Map QPN LinkGroup -> Bool
lgInvariant links = all invGroup (M.elems links)
where
invGroup :: LinkGroup -> Bool
invGroup lg = allEqual $ map (`M.lookup` links) members
where
members :: [QPN]
members = map (`Q` lgPackage lg) $ S.toList (lgMembers lg)
-- | Package version of this group
--
-- This is only known once we have picked a canonical element. | 397 | lgInvariant links = all invGroup (M.elems links)
where
invGroup :: LinkGroup -> Bool
invGroup lg = allEqual $ map (`M.lookup` links) members
where
members :: [QPN]
members = map (`Q` lgPackage lg) $ S.toList (lgMembers lg)
-- | Package version of this group
--
-- This is only known once we have picked a canonical element. | 356 | true | true | 0 | 10 | 119 | 120 | 65 | 55 | null | null |
Vlix/facebookmessenger | test/UnitTest/CallbackParse/MessageCallback.hs | mit | fallbackVal :: Value
fallbackVal = $$(decodeFile "test/json/callback/attachment_callback_fallback.json") | 104 | fallbackVal :: Value
fallbackVal = $$(decodeFile "test/json/callback/attachment_callback_fallback.json") | 104 | fallbackVal = $$(decodeFile "test/json/callback/attachment_callback_fallback.json") | 83 | false | true | 0 | 7 | 6 | 18 | 9 | 9 | null | null |
k00mi/bckspc-bot | src/Main.hs | mit | mkMqttEnv :: Config -> IO MQTTEnv
mkMqttEnv cfg = do
mqtt <- MQTT.defaultConfig <$> MQTT.mkCommands <*> newTChanIO
return $ MQTTEnv
mqtt { MQTT.cHost = mqttHost cfg
, MQTT.cKeepAlive = Just 60
, MQTT.cClientID = "bckspc-bot"
}
(fromString $ pizzaTopic cfg)
(fromString $ alarmTopic cfg)
(fromString $ soundTopic cfg) | 437 | mkMqttEnv :: Config -> IO MQTTEnv
mkMqttEnv cfg = do
mqtt <- MQTT.defaultConfig <$> MQTT.mkCommands <*> newTChanIO
return $ MQTTEnv
mqtt { MQTT.cHost = mqttHost cfg
, MQTT.cKeepAlive = Just 60
, MQTT.cClientID = "bckspc-bot"
}
(fromString $ pizzaTopic cfg)
(fromString $ alarmTopic cfg)
(fromString $ soundTopic cfg) | 437 | mkMqttEnv cfg = do
mqtt <- MQTT.defaultConfig <$> MQTT.mkCommands <*> newTChanIO
return $ MQTTEnv
mqtt { MQTT.cHost = mqttHost cfg
, MQTT.cKeepAlive = Just 60
, MQTT.cClientID = "bckspc-bot"
}
(fromString $ pizzaTopic cfg)
(fromString $ alarmTopic cfg)
(fromString $ soundTopic cfg) | 403 | false | true | 0 | 12 | 168 | 123 | 60 | 63 | null | null |
mohsen3/Haskell4ScalaDevelopers | src/GettingStarted/Curry.hs | bsd-3-clause | -- | 'uncurry' converts a curried function to a function on pairs.
uncurry :: (a -> b -> c) -> ((a, b) -> c)
uncurry f p = f (fst p) (snd p) | 141 | uncurry :: (a -> b -> c) -> ((a, b) -> c)
uncurry f p = f (fst p) (snd p) | 74 | uncurry f p = f (fst p) (snd p) | 32 | true | true | 0 | 10 | 33 | 69 | 34 | 35 | null | null |
nomeata/incredible | logic/Rules.hs | mit | deriveRule :: Context -> Proof -> ScopedProof -> Maybe Rule
deriveRule ctxt proof (ScopedProof {..}) =
if badLocalHyps
then Nothing
else Just $ renameRule $ Rule {ports = rulePorts, localVars = localVars, freeVars = freeVars}
where
portNames = map (Tagged . ("port"++) . show) [1::Integer ..]
connectedPorts = S.fromList $ catMaybes $ concat
[ [connFrom c, connTo c] | (_, c) <- M.toList $ connections proof ]
openPorts = S.fromList $
[ BlockPort bKey pKey
| (bKey, block) <- M.toList $ blocks proof
, let rule = block2Rule ctxt block
, (pKey, _) <- M.toList (ports rule)
, BlockPort bKey pKey `S.notMember` connectedPorts
] ++
[ ps
| (_, (Connection _ from to)) <- M.toList $ connections proof
, (Nothing, Just ps) <- [(from, to), (to, from)] ]
localHyps =
[ (BlockPort blockKey portKey, BlockPort blockKey consumedBy)
| (blockKey, block) <- M.toList $ blocks proof
, let rule = block2Rule ctxt block
, (portKey, Port { portType = PTLocalHyp consumedBy }) <- M.toList $ ports rule
]
openLocalHyps = M.fromList $ [ (port, targets)
| (hyp, target) <- localHyps
, let targets = filter (validTargetFor ctxt proof target openPorts) $ S.toList openPorts
, port <- outPorts ctxt proof target hyp
, port `S.member` openPorts
]
badLocalHyps = any null $ M.elems openLocalHyps
openPort2PortName = M.fromList $ zip (S.toList openPorts) portNames
updatedPorts = [ Port
{ portType =
if isPortTypeOut (portType origPort)
then case M.lookup ps openLocalHyps of
Just (t:_) -> PTLocalHyp (openPort2PortName ! t)
Just [] -> error "updatedPorts: no targets?"
Nothing -> PTConclusion
else PTAssumption
, portProp = spProps ! ps
, portScopes = spScopedVars ! ps
}
| ps@(BlockPort blockKey portKey) <- S.toList openPorts
, let block = blocks proof ! blockKey
, let rule = block2Rule ctxt block
, let origPort = ports rule ! portKey
]
allVars :: S.Set Var
allVars = S.fromList $ fv (map portProp updatedPorts)
localVars = S.toList $ S.filter (\v -> name2Integer v > 0) allVars
freeVars = filter (`S.member` allVars) spFreeVars
rulePorts = M.fromList $ zip portNames updatedPorts
-- Checks if from this open port, everything goes to the target, and never
-- into another open port before | 2,576 | deriveRule :: Context -> Proof -> ScopedProof -> Maybe Rule
deriveRule ctxt proof (ScopedProof {..}) =
if badLocalHyps
then Nothing
else Just $ renameRule $ Rule {ports = rulePorts, localVars = localVars, freeVars = freeVars}
where
portNames = map (Tagged . ("port"++) . show) [1::Integer ..]
connectedPorts = S.fromList $ catMaybes $ concat
[ [connFrom c, connTo c] | (_, c) <- M.toList $ connections proof ]
openPorts = S.fromList $
[ BlockPort bKey pKey
| (bKey, block) <- M.toList $ blocks proof
, let rule = block2Rule ctxt block
, (pKey, _) <- M.toList (ports rule)
, BlockPort bKey pKey `S.notMember` connectedPorts
] ++
[ ps
| (_, (Connection _ from to)) <- M.toList $ connections proof
, (Nothing, Just ps) <- [(from, to), (to, from)] ]
localHyps =
[ (BlockPort blockKey portKey, BlockPort blockKey consumedBy)
| (blockKey, block) <- M.toList $ blocks proof
, let rule = block2Rule ctxt block
, (portKey, Port { portType = PTLocalHyp consumedBy }) <- M.toList $ ports rule
]
openLocalHyps = M.fromList $ [ (port, targets)
| (hyp, target) <- localHyps
, let targets = filter (validTargetFor ctxt proof target openPorts) $ S.toList openPorts
, port <- outPorts ctxt proof target hyp
, port `S.member` openPorts
]
badLocalHyps = any null $ M.elems openLocalHyps
openPort2PortName = M.fromList $ zip (S.toList openPorts) portNames
updatedPorts = [ Port
{ portType =
if isPortTypeOut (portType origPort)
then case M.lookup ps openLocalHyps of
Just (t:_) -> PTLocalHyp (openPort2PortName ! t)
Just [] -> error "updatedPorts: no targets?"
Nothing -> PTConclusion
else PTAssumption
, portProp = spProps ! ps
, portScopes = spScopedVars ! ps
}
| ps@(BlockPort blockKey portKey) <- S.toList openPorts
, let block = blocks proof ! blockKey
, let rule = block2Rule ctxt block
, let origPort = ports rule ! portKey
]
allVars :: S.Set Var
allVars = S.fromList $ fv (map portProp updatedPorts)
localVars = S.toList $ S.filter (\v -> name2Integer v > 0) allVars
freeVars = filter (`S.member` allVars) spFreeVars
rulePorts = M.fromList $ zip portNames updatedPorts
-- Checks if from this open port, everything goes to the target, and never
-- into another open port before | 2,576 | deriveRule ctxt proof (ScopedProof {..}) =
if badLocalHyps
then Nothing
else Just $ renameRule $ Rule {ports = rulePorts, localVars = localVars, freeVars = freeVars}
where
portNames = map (Tagged . ("port"++) . show) [1::Integer ..]
connectedPorts = S.fromList $ catMaybes $ concat
[ [connFrom c, connTo c] | (_, c) <- M.toList $ connections proof ]
openPorts = S.fromList $
[ BlockPort bKey pKey
| (bKey, block) <- M.toList $ blocks proof
, let rule = block2Rule ctxt block
, (pKey, _) <- M.toList (ports rule)
, BlockPort bKey pKey `S.notMember` connectedPorts
] ++
[ ps
| (_, (Connection _ from to)) <- M.toList $ connections proof
, (Nothing, Just ps) <- [(from, to), (to, from)] ]
localHyps =
[ (BlockPort blockKey portKey, BlockPort blockKey consumedBy)
| (blockKey, block) <- M.toList $ blocks proof
, let rule = block2Rule ctxt block
, (portKey, Port { portType = PTLocalHyp consumedBy }) <- M.toList $ ports rule
]
openLocalHyps = M.fromList $ [ (port, targets)
| (hyp, target) <- localHyps
, let targets = filter (validTargetFor ctxt proof target openPorts) $ S.toList openPorts
, port <- outPorts ctxt proof target hyp
, port `S.member` openPorts
]
badLocalHyps = any null $ M.elems openLocalHyps
openPort2PortName = M.fromList $ zip (S.toList openPorts) portNames
updatedPorts = [ Port
{ portType =
if isPortTypeOut (portType origPort)
then case M.lookup ps openLocalHyps of
Just (t:_) -> PTLocalHyp (openPort2PortName ! t)
Just [] -> error "updatedPorts: no targets?"
Nothing -> PTConclusion
else PTAssumption
, portProp = spProps ! ps
, portScopes = spScopedVars ! ps
}
| ps@(BlockPort blockKey portKey) <- S.toList openPorts
, let block = blocks proof ! blockKey
, let rule = block2Rule ctxt block
, let origPort = ports rule ! portKey
]
allVars :: S.Set Var
allVars = S.fromList $ fv (map portProp updatedPorts)
localVars = S.toList $ S.filter (\v -> name2Integer v > 0) allVars
freeVars = filter (`S.member` allVars) spFreeVars
rulePorts = M.fromList $ zip portNames updatedPorts
-- Checks if from this open port, everything goes to the target, and never
-- into another open port before | 2,515 | false | true | 0 | 14 | 768 | 862 | 453 | 409 | null | null |
martin-kolinek/stack | src/Stack/BuildPlan.hs | bsd-3-clause | -- | Compare 'BuildPlanCheck', where GT means a better plan.
compareBuildPlanCheck :: BuildPlanCheck -> BuildPlanCheck -> Ordering
compareBuildPlanCheck (BuildPlanCheckPartial _ e1) (BuildPlanCheckPartial _ e2) =
-- Note: order of comparison flipped, since it's better to have fewer errors.
compare (Map.size e2) (Map.size e1) | 334 | compareBuildPlanCheck :: BuildPlanCheck -> BuildPlanCheck -> Ordering
compareBuildPlanCheck (BuildPlanCheckPartial _ e1) (BuildPlanCheckPartial _ e2) =
-- Note: order of comparison flipped, since it's better to have fewer errors.
compare (Map.size e2) (Map.size e1) | 273 | compareBuildPlanCheck (BuildPlanCheckPartial _ e1) (BuildPlanCheckPartial _ e2) =
-- Note: order of comparison flipped, since it's better to have fewer errors.
compare (Map.size e2) (Map.size e1) | 203 | true | true | 0 | 10 | 50 | 70 | 33 | 37 | null | null |
keera-studios/hsQt | Qtc/Enums/Gui/QFileDialog.hs | bsd-2-clause | ieFileMode :: Int -> FileMode
ieFileMode x = QEnum (CFileMode x) | 64 | ieFileMode :: Int -> FileMode
ieFileMode x = QEnum (CFileMode x) | 64 | ieFileMode x = QEnum (CFileMode x) | 34 | false | true | 0 | 7 | 10 | 27 | 13 | 14 | null | null |
eigengrau/haskell-sg | Data/SG/Vector.hs | bsd-3-clause | projectOnto :: (Floating a, Ord a, VectorNum rel, Coord rel) => rel a -> rel a -> a
projectOnto v axis = (v `dotProduct` unitVector axis) | 137 | projectOnto :: (Floating a, Ord a, VectorNum rel, Coord rel) => rel a -> rel a -> a
projectOnto v axis = (v `dotProduct` unitVector axis) | 137 | projectOnto v axis = (v `dotProduct` unitVector axis) | 53 | false | true | 0 | 8 | 25 | 69 | 35 | 34 | null | null |
MichaelBurge/yxdb-utils | src/Database/Alteryx/StreamingYxdb.hs | gpl-3.0 | sourceBlocks :: (MonadResource m) => FilePath -> BlockRanges -> Source m Block
sourceBlocks filepath ranges = forM_ ranges $ sourceBlock filepath | 145 | sourceBlocks :: (MonadResource m) => FilePath -> BlockRanges -> Source m Block
sourceBlocks filepath ranges = forM_ ranges $ sourceBlock filepath | 145 | sourceBlocks filepath ranges = forM_ ranges $ sourceBlock filepath | 66 | false | true | 0 | 8 | 20 | 48 | 23 | 25 | null | null |
taktoa/HsCalculator | src/Tests.hs | gpl-3.0 | varName :: Int -> Gen Name
varName a = Name . pack . (\m -> "x" ++ show m) <$> elements [0..a] | 94 | varName :: Int -> Gen Name
varName a = Name . pack . (\m -> "x" ++ show m) <$> elements [0..a] | 94 | varName a = Name . pack . (\m -> "x" ++ show m) <$> elements [0..a] | 67 | false | true | 2 | 9 | 21 | 62 | 29 | 33 | null | null |
capitanbatata/marlows-parconc-exercises | parconc-ch08/src/MyExceptions.hs | gpl-3.0 | -- | Executes the first action, and then the second action regardless of wether
-- the first action generated an exception.
finally :: IO a -> IO b -> IO a
finally = undefined | 175 | finally :: IO a -> IO b -> IO a
finally = undefined | 51 | finally = undefined | 19 | true | true | 0 | 8 | 33 | 36 | 16 | 20 | null | null |
anchor/retcon | lib/Retcon/Diff.hs | bsd-3-clause | ignoreConflicts :: MergePolicy
ignoreConflicts = MergePolicy {..}
where
extractLabel = const Unamed
mergeWith :: [Patch] -> MergeResult
mergeWith patches =
let patch_keys = map (nub . sort . map D.changePath . D.patchOperations . _patchDiff) patches
touched = group . sort . concat $ patch_keys
accepted_paths = map head . filter (\l -> length l == 1) $ touched
allOps = reject =<< patches
(rejected, accepted) = partitionEithers . map (filterChanges accepted_paths) $ allOps
in (makePatch accepted, rejected)
-- | Filter out rejected changes.
filterChanges :: [D.Path] -> RejectedOp -> Either RejectedOp RejectedOp
filterChanges acc rop =
if (D.changePath $ rop ^. rejectedOperation) `elem` acc
then Right rop
else Left rop
makePatch = foldr addOperation emptyPatch . map (^. rejectedOperation)
--------------------------------------------------------------------------------
-- | Use a 'MergePolicy' to compare two versions of a document and extract a
-- 'Patch' describing changes. | 1,114 | ignoreConflicts :: MergePolicy
ignoreConflicts = MergePolicy {..}
where
extractLabel = const Unamed
mergeWith :: [Patch] -> MergeResult
mergeWith patches =
let patch_keys = map (nub . sort . map D.changePath . D.patchOperations . _patchDiff) patches
touched = group . sort . concat $ patch_keys
accepted_paths = map head . filter (\l -> length l == 1) $ touched
allOps = reject =<< patches
(rejected, accepted) = partitionEithers . map (filterChanges accepted_paths) $ allOps
in (makePatch accepted, rejected)
-- | Filter out rejected changes.
filterChanges :: [D.Path] -> RejectedOp -> Either RejectedOp RejectedOp
filterChanges acc rop =
if (D.changePath $ rop ^. rejectedOperation) `elem` acc
then Right rop
else Left rop
makePatch = foldr addOperation emptyPatch . map (^. rejectedOperation)
--------------------------------------------------------------------------------
-- | Use a 'MergePolicy' to compare two versions of a document and extract a
-- 'Patch' describing changes. | 1,114 | ignoreConflicts = MergePolicy {..}
where
extractLabel = const Unamed
mergeWith :: [Patch] -> MergeResult
mergeWith patches =
let patch_keys = map (nub . sort . map D.changePath . D.patchOperations . _patchDiff) patches
touched = group . sort . concat $ patch_keys
accepted_paths = map head . filter (\l -> length l == 1) $ touched
allOps = reject =<< patches
(rejected, accepted) = partitionEithers . map (filterChanges accepted_paths) $ allOps
in (makePatch accepted, rejected)
-- | Filter out rejected changes.
filterChanges :: [D.Path] -> RejectedOp -> Either RejectedOp RejectedOp
filterChanges acc rop =
if (D.changePath $ rop ^. rejectedOperation) `elem` acc
then Right rop
else Left rop
makePatch = foldr addOperation emptyPatch . map (^. rejectedOperation)
--------------------------------------------------------------------------------
-- | Use a 'MergePolicy' to compare two versions of a document and extract a
-- 'Patch' describing changes. | 1,083 | false | true | 2 | 15 | 268 | 303 | 150 | 153 | null | null |
gspia/reflex-dom-htmlea | lib/src/Reflex/Dom/HTML5/Elements/Embedded.hs | bsd-3-clause | -- | A short-hand notion for @ el \"map\" ... @
mapN ∷ forall t m a. DomBuilder t m ⇒ m a → m a
mapN children = snd <$> mapN' children | 134 | mapN ∷ forall t m a. DomBuilder t m ⇒ m a → m a
mapN children = snd <$> mapN' children | 86 | mapN children = snd <$> mapN' children | 38 | true | true | 0 | 8 | 32 | 48 | 24 | 24 | null | null |
NewByteOrder/ghcjs-base | test/Tests/Properties.hs | mit | j_Ord s = (compare s) `eq` (compare (J.pack s) . J.pack) | 66 | j_Ord s = (compare s) `eq` (compare (J.pack s) . J.pack) | 66 | j_Ord s = (compare s) `eq` (compare (J.pack s) . J.pack) | 66 | false | false | 0 | 11 | 20 | 41 | 21 | 20 | null | null |
MarcusVoelker/MuCurse | Continuations.hs | mit | weakChain :: DCont r e a -> (a -> DCont r e a) -> DCont r e a
weakChain c f = DCont (\btr etr -> run c (\x -> run (f x) btr (\_ -> btr x)) etr) | 143 | weakChain :: DCont r e a -> (a -> DCont r e a) -> DCont r e a
weakChain c f = DCont (\btr etr -> run c (\x -> run (f x) btr (\_ -> btr x)) etr) | 143 | weakChain c f = DCont (\btr etr -> run c (\x -> run (f x) btr (\_ -> btr x)) etr) | 81 | false | true | 0 | 14 | 38 | 109 | 53 | 56 | null | null |
xkollar/handy-haskell | other/pt-2013-07/pt2013-07.hs | gpl-3.0 | cumulative p (x:s) = x : f x s where
f x (y:s) = if p x y then y : f y s else f x s
f _ [] = []
-- main = putStr . unlines . map (show . (id &&& cnt)) . cumulative ((<) `on` cnt) $ list
-- solution? [1,2,5,14,33,72,125,219]
-- [1,2,5,14,33,72,137,218]
-- [1,2,5,14,33,72,153,218]
-- [1,2,5,14,33,75,128,196]
-- [1,2,5,14,33,75,143,196]
-- [1,2,5,14,33,85,131,185]
-- [1,2,5,40,84,112,130,142]
-- [1,2,5,79,102,114,132,142]
-- [1,3,6,35,75,108,121,130]
-- [1,10,23,56,96,125,128,130]
--
-- Final:
-- ([130,121,108,75,35,6,3,1],120)
-- ([130,128,125,96,56,23,10,1],120) | 579 | cumulative p (x:s) = x : f x s where
f x (y:s) = if p x y then y : f y s else f x s
f _ [] = []
-- main = putStr . unlines . map (show . (id &&& cnt)) . cumulative ((<) `on` cnt) $ list
-- solution? [1,2,5,14,33,72,125,219]
-- [1,2,5,14,33,72,137,218]
-- [1,2,5,14,33,72,153,218]
-- [1,2,5,14,33,75,128,196]
-- [1,2,5,14,33,75,143,196]
-- [1,2,5,14,33,85,131,185]
-- [1,2,5,40,84,112,130,142]
-- [1,2,5,79,102,114,132,142]
-- [1,3,6,35,75,108,121,130]
-- [1,10,23,56,96,125,128,130]
--
-- Final:
-- ([130,121,108,75,35,6,3,1],120)
-- ([130,128,125,96,56,23,10,1],120) | 579 | cumulative p (x:s) = x : f x s where
f x (y:s) = if p x y then y : f y s else f x s
f _ [] = []
-- main = putStr . unlines . map (show . (id &&& cnt)) . cumulative ((<) `on` cnt) $ list
-- solution? [1,2,5,14,33,72,125,219]
-- [1,2,5,14,33,72,137,218]
-- [1,2,5,14,33,72,153,218]
-- [1,2,5,14,33,75,128,196]
-- [1,2,5,14,33,75,143,196]
-- [1,2,5,14,33,85,131,185]
-- [1,2,5,40,84,112,130,142]
-- [1,2,5,79,102,114,132,142]
-- [1,3,6,35,75,108,121,130]
-- [1,10,23,56,96,125,128,130]
--
-- Final:
-- ([130,121,108,75,35,6,3,1],120)
-- ([130,128,125,96,56,23,10,1],120) | 579 | false | false | 0 | 9 | 92 | 102 | 58 | 44 | null | null |
onponomarev/ganeti | src/Ganeti/JQueue.hs | bsd-2-clause | archiveSomeJobsUntil replicateFn qDir endt cutt arch torepl (jid:jids) = do
let archiveMore = archiveSomeJobsUntil replicateFn qDir endt cutt
continue = archiveMore arch torepl jids
jidname = show $ fromJobId jid
time <- getClockTime
if time >= endt
then do
_ <- forkIO $ replicateFn torepl
return (arch, length (jid:jids))
else do
logDebug $ "Inspecting job " ++ jidname ++ " for archival"
loadResult <- loadJobFromDisk qDir False jid
case loadResult of
Bad _ -> continue
Ok (job, _) ->
if jobArchivable cutt job
then do
let live = liveJobFile qDir jid
archive = archivedJobFile qDir jid
renameResult <- safeRenameFile queueDirPermissions
live archive
case renameResult of
Bad s -> do
logWarning $ "Renaming " ++ live ++ " to " ++ archive
++ " failed unexpectedly: " ++ s
continue
Ok () -> do
let torepl' = jid:torepl
if length torepl' >= 10
then do
_ <- forkIO $ replicateFn torepl'
archiveMore (arch + 1) [] jids
else archiveMore (arch + 1) torepl' jids
else continue
-- | Archive jobs older than the given time, but do not exceed the timeout for
-- carrying out this task. | 1,496 | archiveSomeJobsUntil replicateFn qDir endt cutt arch torepl (jid:jids) = do
let archiveMore = archiveSomeJobsUntil replicateFn qDir endt cutt
continue = archiveMore arch torepl jids
jidname = show $ fromJobId jid
time <- getClockTime
if time >= endt
then do
_ <- forkIO $ replicateFn torepl
return (arch, length (jid:jids))
else do
logDebug $ "Inspecting job " ++ jidname ++ " for archival"
loadResult <- loadJobFromDisk qDir False jid
case loadResult of
Bad _ -> continue
Ok (job, _) ->
if jobArchivable cutt job
then do
let live = liveJobFile qDir jid
archive = archivedJobFile qDir jid
renameResult <- safeRenameFile queueDirPermissions
live archive
case renameResult of
Bad s -> do
logWarning $ "Renaming " ++ live ++ " to " ++ archive
++ " failed unexpectedly: " ++ s
continue
Ok () -> do
let torepl' = jid:torepl
if length torepl' >= 10
then do
_ <- forkIO $ replicateFn torepl'
archiveMore (arch + 1) [] jids
else archiveMore (arch + 1) torepl' jids
else continue
-- | Archive jobs older than the given time, but do not exceed the timeout for
-- carrying out this task. | 1,496 | archiveSomeJobsUntil replicateFn qDir endt cutt arch torepl (jid:jids) = do
let archiveMore = archiveSomeJobsUntil replicateFn qDir endt cutt
continue = archiveMore arch torepl jids
jidname = show $ fromJobId jid
time <- getClockTime
if time >= endt
then do
_ <- forkIO $ replicateFn torepl
return (arch, length (jid:jids))
else do
logDebug $ "Inspecting job " ++ jidname ++ " for archival"
loadResult <- loadJobFromDisk qDir False jid
case loadResult of
Bad _ -> continue
Ok (job, _) ->
if jobArchivable cutt job
then do
let live = liveJobFile qDir jid
archive = archivedJobFile qDir jid
renameResult <- safeRenameFile queueDirPermissions
live archive
case renameResult of
Bad s -> do
logWarning $ "Renaming " ++ live ++ " to " ++ archive
++ " failed unexpectedly: " ++ s
continue
Ok () -> do
let torepl' = jid:torepl
if length torepl' >= 10
then do
_ <- forkIO $ replicateFn torepl'
archiveMore (arch + 1) [] jids
else archiveMore (arch + 1) torepl' jids
else continue
-- | Archive jobs older than the given time, but do not exceed the timeout for
-- carrying out this task. | 1,496 | false | false | 0 | 27 | 605 | 377 | 179 | 198 | null | null |
uduki/hsQt | Qtc/Core/QUrl.hs | bsd-2-clause | qUrlFromPercentEncoding :: ((String)) -> IO (String)
qUrlFromPercentEncoding (x1)
= withStringResult $
withCWString x1 $ \cstr_x1 ->
qtc_QUrl_fromPercentEncoding cstr_x1 | 179 | qUrlFromPercentEncoding :: ((String)) -> IO (String)
qUrlFromPercentEncoding (x1)
= withStringResult $
withCWString x1 $ \cstr_x1 ->
qtc_QUrl_fromPercentEncoding cstr_x1 | 179 | qUrlFromPercentEncoding (x1)
= withStringResult $
withCWString x1 $ \cstr_x1 ->
qtc_QUrl_fromPercentEncoding cstr_x1 | 126 | false | true | 0 | 7 | 27 | 52 | 27 | 25 | null | null |
urbanslug/ghc | compiler/types/TyCon.hs | bsd-3-clause | isFamilyTyCon _ = False | 64 | isFamilyTyCon _ = False | 64 | isFamilyTyCon _ = False | 64 | false | false | 0 | 5 | 44 | 9 | 4 | 5 | null | null |
zoomhub/zoomhub | src/ZoomHub/API/Types/DeepZoomImage.hs | mit | toInternal :: DeepZoomImage -> Internal.DeepZoomImage
toInternal dzi =
Internal.mkDeepZoomImage
(dziWidth dzi)
(dziHeight dzi)
(dziTileSize dzi)
(dziTileOverlap dzi)
(dziTileFormat dzi) | 207 | toInternal :: DeepZoomImage -> Internal.DeepZoomImage
toInternal dzi =
Internal.mkDeepZoomImage
(dziWidth dzi)
(dziHeight dzi)
(dziTileSize dzi)
(dziTileOverlap dzi)
(dziTileFormat dzi) | 207 | toInternal dzi =
Internal.mkDeepZoomImage
(dziWidth dzi)
(dziHeight dzi)
(dziTileSize dzi)
(dziTileOverlap dzi)
(dziTileFormat dzi) | 153 | false | true | 0 | 7 | 40 | 63 | 31 | 32 | null | null |
gregoryck/biocalc | AlignPar.hs | mit | (-*) (Start n) n' = Start (n - n') | 34 | (-*) (Start n) n' = Start (n - n') | 34 | (-*) (Start n) n' = Start (n - n') | 34 | false | false | 0 | 7 | 8 | 29 | 15 | 14 | null | null |
rrnewton/criterion | Criterion/Types.hs | bsd-2-clause | toInt (Just i) = i | 18 | toInt (Just i) = i | 18 | toInt (Just i) = i | 18 | false | false | 0 | 7 | 4 | 15 | 7 | 8 | null | null |
BitFunctor/bitfunctor | src/Network/BitFunctor/Crypto/Key.hs | mit | -- not yet in cryptonite-0.23: C.generateSecretKey
toPublic :: SecretKey -> PublicKey
toPublic = C.toPublic | 108 | toPublic :: SecretKey -> PublicKey
toPublic = C.toPublic | 56 | toPublic = C.toPublic | 21 | true | true | 0 | 5 | 14 | 18 | 10 | 8 | null | null |
cfredric/arithmoi | Math/NumberTheory/GCD/LowLevel.hs | mit | gcdWordOdd# :: Word# -> Word# -> Word#
gcdWordOdd# a# b#
| isTrue# (a# `eqWord#` 1##) || isTrue# (b# `eqWord#` 1##) = 1##
| isTrue# (a# `eqWord#` b#) = a#
| isTrue# (a# `ltWord#` b#) = oddGCD# b# a#
| otherwise = oddGCD# a# b# | 355 | gcdWordOdd# :: Word# -> Word# -> Word#
gcdWordOdd# a# b#
| isTrue# (a# `eqWord#` 1##) || isTrue# (b# `eqWord#` 1##) = 1##
| isTrue# (a# `eqWord#` b#) = a#
| isTrue# (a# `ltWord#` b#) = oddGCD# b# a#
| otherwise = oddGCD# a# b# | 355 | gcdWordOdd# a# b#
| isTrue# (a# `eqWord#` 1##) || isTrue# (b# `eqWord#` 1##) = 1##
| isTrue# (a# `eqWord#` b#) = a#
| isTrue# (a# `ltWord#` b#) = oddGCD# b# a#
| otherwise = oddGCD# a# b# | 316 | false | true | 1 | 11 | 172 | 121 | 62 | 59 | null | null |
bacchanalia/KitchenSink | KitchenSink/Qualified.hs | gpl-3.0 | -- |'VGM.init'
vgm_init = VGM.init | 34 | vgm_init = VGM.init | 19 | vgm_init = VGM.init | 19 | true | false | 0 | 5 | 4 | 9 | 5 | 4 | null | null |
valderman/selda | selda/src/Database/Selda/Migrations.hs | mit | wrap :: (MonadSelda m, MonadMask m) => Bool -> m a -> m a
wrap enforceFKs
| enforceFKs = transaction
| otherwise = withoutForeignKeyEnforcement | 148 | wrap :: (MonadSelda m, MonadMask m) => Bool -> m a -> m a
wrap enforceFKs
| enforceFKs = transaction
| otherwise = withoutForeignKeyEnforcement | 148 | wrap enforceFKs
| enforceFKs = transaction
| otherwise = withoutForeignKeyEnforcement | 90 | false | true | 1 | 8 | 28 | 57 | 27 | 30 | null | null |
tonymorris/validation | src/Data/Validation.hs | bsd-3-clause | traverseValidationT ::
(Traversable g, Applicative f) =>
(a -> f b)
-> ValidationT err g a
-> f (ValidationT err g b)
traverseValidationT f (ValidationT x) =
ValidationT <$> traverse (traverse f) x | 207 | traverseValidationT ::
(Traversable g, Applicative f) =>
(a -> f b)
-> ValidationT err g a
-> f (ValidationT err g b)
traverseValidationT f (ValidationT x) =
ValidationT <$> traverse (traverse f) x | 207 | traverseValidationT f (ValidationT x) =
ValidationT <$> traverse (traverse f) x | 81 | false | true | 0 | 11 | 42 | 91 | 44 | 47 | null | null |
fmapfmapfmap/amazonka | amazonka-swf/gen/Network/AWS/SWF/Types/Product.hs | mpl-2.0 | -- | Undocumented member.
wecaneaTaskList :: Lens' WorkflowExecutionContinuedAsNewEventAttributes TaskList
wecaneaTaskList = lens _wecaneaTaskList (\ s a -> s{_wecaneaTaskList = a}) | 181 | wecaneaTaskList :: Lens' WorkflowExecutionContinuedAsNewEventAttributes TaskList
wecaneaTaskList = lens _wecaneaTaskList (\ s a -> s{_wecaneaTaskList = a}) | 155 | wecaneaTaskList = lens _wecaneaTaskList (\ s a -> s{_wecaneaTaskList = a}) | 74 | true | true | 0 | 9 | 19 | 40 | 22 | 18 | null | null |
ttuegel/arpack | src/Arpack/Foreign/Real.hs | bsd-3-clause | withAUPD :: Options Double -> Int -> (AUPD -> IO a) -> IO a
withAUPD options dim = bracket initAUPD freeAUPD where
initAUPD = do
let
_nev = number options
-- Largest number of basis vectors to use.
-- Work per iteration is O(dim * ncv ^ 2).
_ncv = min dim (4 * _nev)
_lworkl = 3 * _ncv * _ncv + 6 * _ncv
ido <- new 0
bmat <- newCString "I"
n <- new (fromIntegral dim)
which <- newCString "SR"
nev <- new (fromIntegral _nev)
tol <- new 0
resid <- VSM.new dim
ncv <- new (fromIntegral _ncv)
v <- VSM.new (dim * _ncv)
ldv <- new (fromIntegral dim)
iparam <- VSM.new 11
-- shift strategy
VSM.write iparam (1 - 1) 1
-- maximum number of iterations
VSM.write iparam (3 - 1)
(fromIntegral (fromMaybe (3 * dim) (maxIterations options)))
-- block size
VSM.write iparam (4 - 1) 1
-- eigenproblem type
VSM.write iparam (7 - 1) 1
ipntr <- VSM.new 14
workd <- VSM.new (3 * dim)
workl <- VSM.new _lworkl
lworkl <- new (fromIntegral _lworkl)
info <- new 0
pure AUPD {..}
freeAUPD AUPD {..} = do
free ido
free bmat
free n
free which
free nev
free tol
free ncv
free ldv
free lworkl
free info | 1,267 | withAUPD :: Options Double -> Int -> (AUPD -> IO a) -> IO a
withAUPD options dim = bracket initAUPD freeAUPD where
initAUPD = do
let
_nev = number options
-- Largest number of basis vectors to use.
-- Work per iteration is O(dim * ncv ^ 2).
_ncv = min dim (4 * _nev)
_lworkl = 3 * _ncv * _ncv + 6 * _ncv
ido <- new 0
bmat <- newCString "I"
n <- new (fromIntegral dim)
which <- newCString "SR"
nev <- new (fromIntegral _nev)
tol <- new 0
resid <- VSM.new dim
ncv <- new (fromIntegral _ncv)
v <- VSM.new (dim * _ncv)
ldv <- new (fromIntegral dim)
iparam <- VSM.new 11
-- shift strategy
VSM.write iparam (1 - 1) 1
-- maximum number of iterations
VSM.write iparam (3 - 1)
(fromIntegral (fromMaybe (3 * dim) (maxIterations options)))
-- block size
VSM.write iparam (4 - 1) 1
-- eigenproblem type
VSM.write iparam (7 - 1) 1
ipntr <- VSM.new 14
workd <- VSM.new (3 * dim)
workl <- VSM.new _lworkl
lworkl <- new (fromIntegral _lworkl)
info <- new 0
pure AUPD {..}
freeAUPD AUPD {..} = do
free ido
free bmat
free n
free which
free nev
free tol
free ncv
free ldv
free lworkl
free info | 1,267 | withAUPD options dim = bracket initAUPD freeAUPD where
initAUPD = do
let
_nev = number options
-- Largest number of basis vectors to use.
-- Work per iteration is O(dim * ncv ^ 2).
_ncv = min dim (4 * _nev)
_lworkl = 3 * _ncv * _ncv + 6 * _ncv
ido <- new 0
bmat <- newCString "I"
n <- new (fromIntegral dim)
which <- newCString "SR"
nev <- new (fromIntegral _nev)
tol <- new 0
resid <- VSM.new dim
ncv <- new (fromIntegral _ncv)
v <- VSM.new (dim * _ncv)
ldv <- new (fromIntegral dim)
iparam <- VSM.new 11
-- shift strategy
VSM.write iparam (1 - 1) 1
-- maximum number of iterations
VSM.write iparam (3 - 1)
(fromIntegral (fromMaybe (3 * dim) (maxIterations options)))
-- block size
VSM.write iparam (4 - 1) 1
-- eigenproblem type
VSM.write iparam (7 - 1) 1
ipntr <- VSM.new 14
workd <- VSM.new (3 * dim)
workl <- VSM.new _lworkl
lworkl <- new (fromIntegral _lworkl)
info <- new 0
pure AUPD {..}
freeAUPD AUPD {..} = do
free ido
free bmat
free n
free which
free nev
free tol
free ncv
free ldv
free lworkl
free info | 1,207 | false | true | 0 | 15 | 403 | 521 | 234 | 287 | null | null |
phischu/fragnix | tests/packages/scotty/Data.Primitive.SmallArray.hs | bsd-3-clause | createSmallArray i x k =
runST $ newSmallArray i x >>= \sa -> k sa *> unsafeFreezeSmallArray sa | 97 | createSmallArray i x k =
runST $ newSmallArray i x >>= \sa -> k sa *> unsafeFreezeSmallArray sa | 97 | createSmallArray i x k =
runST $ newSmallArray i x >>= \sa -> k sa *> unsafeFreezeSmallArray sa | 97 | false | false | 0 | 8 | 19 | 41 | 19 | 22 | null | null |
HIPERFIT/futhark | src/Futhark/IR/Traversals.hs | isc | walkOnType tv (Acc acc ispace ts _) = do
walkOnVName tv acc
traverse_ (walkOnSubExp tv) ispace
mapM_ (walkOnType tv) ts | 125 | walkOnType tv (Acc acc ispace ts _) = do
walkOnVName tv acc
traverse_ (walkOnSubExp tv) ispace
mapM_ (walkOnType tv) ts | 125 | walkOnType tv (Acc acc ispace ts _) = do
walkOnVName tv acc
traverse_ (walkOnSubExp tv) ispace
mapM_ (walkOnType tv) ts | 125 | false | false | 0 | 9 | 25 | 59 | 26 | 33 | null | null |
bgamari/pandoc | src/Text/Pandoc/Readers/Docx/Parse.hs | gpl-2.0 | elemToTblGrid :: NameSpaces -> Element -> D TblGrid
elemToTblGrid ns element | isElem ns "w" "tblGrid" element =
let cols = findChildren (elemName ns "w" "gridCol") element
in
mapD (\e -> maybeToD (findAttr (elemName ns "w" "val") e >>= stringToInteger))
cols | 269 | elemToTblGrid :: NameSpaces -> Element -> D TblGrid
elemToTblGrid ns element | isElem ns "w" "tblGrid" element =
let cols = findChildren (elemName ns "w" "gridCol") element
in
mapD (\e -> maybeToD (findAttr (elemName ns "w" "val") e >>= stringToInteger))
cols | 269 | elemToTblGrid ns element | isElem ns "w" "tblGrid" element =
let cols = findChildren (elemName ns "w" "gridCol") element
in
mapD (\e -> maybeToD (findAttr (elemName ns "w" "val") e >>= stringToInteger))
cols | 217 | false | true | 0 | 16 | 50 | 106 | 50 | 56 | null | null |
aelyasov/Haslog | src/Eu/Fittest/Logging/Compression/RawlogParser_withAttoparsec.hs | bsd-3-clause | sentStart = "%<{" | 20 | sentStart = "%<{" | 20 | sentStart = "%<{" | 20 | false | false | 1 | 5 | 5 | 10 | 3 | 7 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.