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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
keithodulaigh/Hets | Isabelle/IsaConsts.hs | gpl-2.0 | lSumS = "either" | 16 | lSumS = "either" | 16 | lSumS = "either" | 16 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
brendanhay/gogol | gogol-fitness/gen/Network/Google/Fitness/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'Value' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'vMapVal'
--
-- * 'vFpVal'
--
-- * 'vIntVal'
--
-- * 'vStringVal'
value
:: Value
value =
Value'
{ _vMapVal = Nothing
, _vFpVal = Nothing
, _vIntVal = Nothing
, _vStringVal = Nothing
} | 374 | value
:: Value
value =
Value'
{ _vMapVal = Nothing
, _vFpVal = Nothing
, _vIntVal = Nothing
, _vStringVal = Nothing
} | 143 | value =
Value'
{ _vMapVal = Nothing
, _vFpVal = Nothing
, _vIntVal = Nothing
, _vStringVal = Nothing
} | 124 | true | true | 0 | 6 | 94 | 48 | 34 | 14 | null | null |
Heather/Idris-dev | src/IRTS/JavaScript/Codegen.hs | bsd-3-clause | cgForeignRes (FCon (UN "JS_Str")) x = pure x | 44 | cgForeignRes (FCon (UN "JS_Str")) x = pure x | 44 | cgForeignRes (FCon (UN "JS_Str")) x = pure x | 44 | false | false | 0 | 9 | 7 | 26 | 12 | 14 | null | null |
christiaanb/ghc | compiler/main/DriverPipeline.hs | bsd-3-clause | haveRtsOptsFlags :: DynFlags -> Bool
haveRtsOptsFlags dflags =
isJust (rtsOpts dflags) || case rtsOptsEnabled dflags of
RtsOptsSafeOnly -> False
_ -> True
-- | Find out path to @ghcversion.h@ file | 286 | haveRtsOptsFlags :: DynFlags -> Bool
haveRtsOptsFlags dflags =
isJust (rtsOpts dflags) || case rtsOptsEnabled dflags of
RtsOptsSafeOnly -> False
_ -> True
-- | Find out path to @ghcversion.h@ file | 286 | haveRtsOptsFlags dflags =
isJust (rtsOpts dflags) || case rtsOptsEnabled dflags of
RtsOptsSafeOnly -> False
_ -> True
-- | Find out path to @ghcversion.h@ file | 249 | false | true | 0 | 8 | 119 | 51 | 25 | 26 | null | null |
nfrisby/th-extra | Language/Haskell/TH/TypeDec.hs | bsd-3-clause | project :: Dec -> Maybe TyDec
project (DataD c n tvbs cons _) = Just (TyDec c n tvbs cons) | 90 | project :: Dec -> Maybe TyDec
project (DataD c n tvbs cons _) = Just (TyDec c n tvbs cons) | 90 | project (DataD c n tvbs cons _) = Just (TyDec c n tvbs cons) | 60 | false | true | 0 | 7 | 19 | 50 | 24 | 26 | null | null |
dysinger/amazonka | amazonka-glacier/gen/Network/AWS/Glacier/UploadArchive.hs | mpl-2.0 | -- | The SHA256 checksum (a linear hash) of the payload.
uaChecksum :: Lens' UploadArchive (Maybe Text)
uaChecksum = lens _uaChecksum (\s a -> s { _uaChecksum = a }) | 165 | uaChecksum :: Lens' UploadArchive (Maybe Text)
uaChecksum = lens _uaChecksum (\s a -> s { _uaChecksum = a }) | 108 | uaChecksum = lens _uaChecksum (\s a -> s { _uaChecksum = a }) | 61 | true | true | 0 | 9 | 29 | 46 | 25 | 21 | null | null |
sboosali/Earley | bench/BenchAll.hs | bsd-3-clause | main :: IO ()
main = do
evaluate (rnf linearInputs)
evaluate (rnf treeInputs)
defaultMain
[ -- bgroup "inputs" $ map inputBench linearInputs
bgroup "earley" $ map earleyBench linearInputs
, bgroup "earley'" $ map earley'Bench linearInputs
, bgroup "parsec" $ map parsecBench linearInputs
-- , bgroup "inputsTree" $ map inputBench treeInputs
, bgroup "earleyTree" $ map earleyBench treeInputs
, bgroup "earley'Tree" $ map earley'Bench treeInputs
, bgroup "parsecTree" $ map parsecBench treeInputs
] | 542 | main :: IO ()
main = do
evaluate (rnf linearInputs)
evaluate (rnf treeInputs)
defaultMain
[ -- bgroup "inputs" $ map inputBench linearInputs
bgroup "earley" $ map earleyBench linearInputs
, bgroup "earley'" $ map earley'Bench linearInputs
, bgroup "parsec" $ map parsecBench linearInputs
-- , bgroup "inputsTree" $ map inputBench treeInputs
, bgroup "earleyTree" $ map earleyBench treeInputs
, bgroup "earley'Tree" $ map earley'Bench treeInputs
, bgroup "parsecTree" $ map parsecBench treeInputs
] | 542 | main = do
evaluate (rnf linearInputs)
evaluate (rnf treeInputs)
defaultMain
[ -- bgroup "inputs" $ map inputBench linearInputs
bgroup "earley" $ map earleyBench linearInputs
, bgroup "earley'" $ map earley'Bench linearInputs
, bgroup "parsec" $ map parsecBench linearInputs
-- , bgroup "inputsTree" $ map inputBench treeInputs
, bgroup "earleyTree" $ map earleyBench treeInputs
, bgroup "earley'Tree" $ map earley'Bench treeInputs
, bgroup "parsecTree" $ map parsecBench treeInputs
] | 528 | false | true | 0 | 10 | 116 | 138 | 64 | 74 | null | null |
frantisekfarka/ghc-dsi | compiler/cmm/CLabel.hs | bsd-3-clause | labelType (CmmLabel _ _ CmmRetInfo) = DataLabel | 59 | labelType (CmmLabel _ _ CmmRetInfo) = DataLabel | 59 | labelType (CmmLabel _ _ CmmRetInfo) = DataLabel | 59 | false | false | 0 | 7 | 18 | 19 | 9 | 10 | null | null |
siddhanathan/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | coercionTokenIdKey :: Unique
coercionTokenIdKey = mkPreludeMiscIdUnique 124 | 78 | coercionTokenIdKey :: Unique
coercionTokenIdKey = mkPreludeMiscIdUnique 124 | 78 | coercionTokenIdKey = mkPreludeMiscIdUnique 124 | 49 | false | true | 0 | 5 | 9 | 14 | 7 | 7 | null | null |
dmbarbour/awelon | hsrc/ABC/Imperative/Interpreter.hs | bsd-3-clause | op Op_3 = d3
| 13 | iop Op_3 = d3 | 13 | iop Op_3 = d3 | 13 | false | false | 1 | 4 | 4 | 12 | 4 | 8 | null | null |
badp/ganeti | src/Ganeti/HTools/Loader.hs | gpl-2.0 | -- | An empty cluster.
emptyCluster :: ClusterData
emptyCluster = ClusterData Container.empty Container.empty Container.empty []
defIPolicy | 156 | emptyCluster :: ClusterData
emptyCluster = ClusterData Container.empty Container.empty Container.empty []
defIPolicy | 133 | emptyCluster = ClusterData Container.empty Container.empty Container.empty []
defIPolicy | 105 | true | true | 0 | 6 | 32 | 31 | 16 | 15 | null | null |
KommuSoft/dep-software | Dep.Printing.Schematics.hs | gpl-3.0 | wireMask VLine = dirMask U .|. dirMask D | 40 | wireMask VLine = dirMask U .|. dirMask D | 40 | wireMask VLine = dirMask U .|. dirMask D | 40 | false | false | 0 | 6 | 7 | 20 | 8 | 12 | null | null |
FranklinChen/hugs98-plus-Sep2006 | packages/network/tests/URITest.hs | bsd-3-clause | isAbsRfT _ = False | 22 | isAbsRfT _ = False | 22 | isAbsRfT _ = False | 22 | false | false | 0 | 4 | 7 | 10 | 4 | 6 | null | null |
chreekat/stack | src/Stack/Build/Execute.hs | bsd-3-clause | singleTest :: M env m
=> TestOpts
-> ActionContext
-> ExecuteEnv
-> Task
-> m ()
singleTest topts ac ee task =
withSingleContext ac ee task (Just "test") $ \package cabalfp pkgDir cabal announce console mlogFile -> do
(_cache, neededConfig) <- ensureConfig pkgDir ee task (announce "configure (test)") cabal cabalfp ["--enable-tests"]
config <- asks getConfig
testBuilt <- checkTestBuilt pkgDir
let needBuild = neededConfig ||
(case taskType task of
TTLocal lp -> lpDirtyFiles lp
_ -> assert False True) ||
not testBuilt
needHpc = toCoverage topts
componentsRaw =
case taskType task of
TTLocal lp -> Set.toList $ lpComponents lp
TTUpstream _ _ -> assert False []
testsToRun = compareTestsComponents componentsRaw $ Set.toList $ packageTests package
components = map (T.unpack . T.append "test:") testsToRun
when needBuild $ do
announce "build (test)"
unsetTestBuilt pkgDir
unsetTestSuccess pkgDir
case taskType task of
TTLocal lp -> writeBuildCache pkgDir $ lpNewBuildCache lp
TTUpstream _ _ -> assert False $ return ()
extraOpts <- extraBuildOptions
cabal (console && configHideTHLoading config) $
"build" : (components ++ extraOpts)
setTestBuilt pkgDir
toRun <-
if toDisableRun topts
then do
announce "Test running disabled by --no-run-tests flag."
return False
else if toRerunTests topts
then return True
else do
success <- checkTestSuccess pkgDir
if success
then do
unless (null testsToRun) $ announce "skipping already passed test"
return False
else return True
when toRun $ do
bconfig <- asks getBuildConfig
buildDir <- distDirFromDir pkgDir
hpcDir <- hpcDirFromDir pkgDir
when needHpc (createTree hpcDir)
let exeExtension =
case configPlatform $ getConfig bconfig of
Platform _ Windows -> ".exe"
_ -> ""
errs <- liftM Map.unions $ forM testsToRun $ \testName -> do
nameDir <- parseRelDir $ T.unpack testName
nameExe <- parseRelFile $ T.unpack testName ++ exeExtension
nameTix <- liftM (pkgDir </>) $ parseRelFile $ T.unpack testName ++ ".tix"
let exeName = buildDir </> $(mkRelDir "build") </> nameDir </> nameExe
exists <- fileExists exeName
menv <- liftIO $ configEnvOverride config EnvSettings
{ esIncludeLocals = taskLocation task == Local
, esIncludeGhcPackagePath = True
, esStackExe = True
}
if exists
then do
-- We clear out the .tix files before doing a run.
when needHpc $ do
tixexists <- fileExists nameTix
when tixexists $
$logWarn ("Removing HPC file " <> T.pack (toFilePath nameTix))
removeFileIfExists nameTix
let args = toAdditionalArgs topts
argsDisplay = case args of
[] -> ""
_ -> ", args: " <> T.intercalate " " (map showProcessArgDebug args)
announce $ "test (suite: " <> testName <> argsDisplay <> ")"
let cp = (proc (toFilePath exeName) args)
{ cwd = Just $ toFilePath pkgDir
, Process.env = envHelper menv
, std_in = CreatePipe
, std_out =
case mlogFile of
Nothing -> Inherit
Just (_, h) -> UseHandle h
, std_err =
case mlogFile of
Nothing -> Inherit
Just (_, h) -> UseHandle h
}
-- Use createProcess_ to avoid the log file being closed afterwards
(Just inH, Nothing, Nothing, ph) <- liftIO $ createProcess_ "singleBuild.runTests" cp
liftIO $ hClose inH
ec <- liftIO $ waitForProcess ph
-- Move the .tix file out of the package directory
-- into the hpc work dir, for tidiness.
when needHpc $
moveFileIfExists nameTix hpcDir
return $ case ec of
ExitSuccess -> Map.empty
_ -> Map.singleton testName $ Just ec
else do
$logError $ T.concat
[ "Test suite "
, testName
, " executable not found for "
, packageNameText $ packageName package
]
return $ Map.singleton testName Nothing
when needHpc $ forM_ (lastMay testsToRun) $ \testName -> do
let pkgName = packageNameText (packageName package)
when (not $ null $ tail testsToRun) $ $logWarn $ T.concat
[ "Error: The --coverage flag does not yet support multiple test suites in a single cabal file. "
, "All of the tests have been run, however, the HPC report will only supply coverage info for "
, pkgName
, "'s last test, "
, testName
, "."
]
generateHpcReport pkgDir pkgName testName
bs <- liftIO $
case mlogFile of
Nothing -> return ""
Just (logFile, h) -> do
hClose h
S.readFile $ toFilePath logFile
unless (Map.null errs) $ throwM $ TestSuiteFailure
(taskProvides task)
errs
(fmap fst mlogFile)
bs
setTestSuccess pkgDir
-- | Determine the tests to be run based on the list of components. | 6,990 | singleTest :: M env m
=> TestOpts
-> ActionContext
-> ExecuteEnv
-> Task
-> m ()
singleTest topts ac ee task =
withSingleContext ac ee task (Just "test") $ \package cabalfp pkgDir cabal announce console mlogFile -> do
(_cache, neededConfig) <- ensureConfig pkgDir ee task (announce "configure (test)") cabal cabalfp ["--enable-tests"]
config <- asks getConfig
testBuilt <- checkTestBuilt pkgDir
let needBuild = neededConfig ||
(case taskType task of
TTLocal lp -> lpDirtyFiles lp
_ -> assert False True) ||
not testBuilt
needHpc = toCoverage topts
componentsRaw =
case taskType task of
TTLocal lp -> Set.toList $ lpComponents lp
TTUpstream _ _ -> assert False []
testsToRun = compareTestsComponents componentsRaw $ Set.toList $ packageTests package
components = map (T.unpack . T.append "test:") testsToRun
when needBuild $ do
announce "build (test)"
unsetTestBuilt pkgDir
unsetTestSuccess pkgDir
case taskType task of
TTLocal lp -> writeBuildCache pkgDir $ lpNewBuildCache lp
TTUpstream _ _ -> assert False $ return ()
extraOpts <- extraBuildOptions
cabal (console && configHideTHLoading config) $
"build" : (components ++ extraOpts)
setTestBuilt pkgDir
toRun <-
if toDisableRun topts
then do
announce "Test running disabled by --no-run-tests flag."
return False
else if toRerunTests topts
then return True
else do
success <- checkTestSuccess pkgDir
if success
then do
unless (null testsToRun) $ announce "skipping already passed test"
return False
else return True
when toRun $ do
bconfig <- asks getBuildConfig
buildDir <- distDirFromDir pkgDir
hpcDir <- hpcDirFromDir pkgDir
when needHpc (createTree hpcDir)
let exeExtension =
case configPlatform $ getConfig bconfig of
Platform _ Windows -> ".exe"
_ -> ""
errs <- liftM Map.unions $ forM testsToRun $ \testName -> do
nameDir <- parseRelDir $ T.unpack testName
nameExe <- parseRelFile $ T.unpack testName ++ exeExtension
nameTix <- liftM (pkgDir </>) $ parseRelFile $ T.unpack testName ++ ".tix"
let exeName = buildDir </> $(mkRelDir "build") </> nameDir </> nameExe
exists <- fileExists exeName
menv <- liftIO $ configEnvOverride config EnvSettings
{ esIncludeLocals = taskLocation task == Local
, esIncludeGhcPackagePath = True
, esStackExe = True
}
if exists
then do
-- We clear out the .tix files before doing a run.
when needHpc $ do
tixexists <- fileExists nameTix
when tixexists $
$logWarn ("Removing HPC file " <> T.pack (toFilePath nameTix))
removeFileIfExists nameTix
let args = toAdditionalArgs topts
argsDisplay = case args of
[] -> ""
_ -> ", args: " <> T.intercalate " " (map showProcessArgDebug args)
announce $ "test (suite: " <> testName <> argsDisplay <> ")"
let cp = (proc (toFilePath exeName) args)
{ cwd = Just $ toFilePath pkgDir
, Process.env = envHelper menv
, std_in = CreatePipe
, std_out =
case mlogFile of
Nothing -> Inherit
Just (_, h) -> UseHandle h
, std_err =
case mlogFile of
Nothing -> Inherit
Just (_, h) -> UseHandle h
}
-- Use createProcess_ to avoid the log file being closed afterwards
(Just inH, Nothing, Nothing, ph) <- liftIO $ createProcess_ "singleBuild.runTests" cp
liftIO $ hClose inH
ec <- liftIO $ waitForProcess ph
-- Move the .tix file out of the package directory
-- into the hpc work dir, for tidiness.
when needHpc $
moveFileIfExists nameTix hpcDir
return $ case ec of
ExitSuccess -> Map.empty
_ -> Map.singleton testName $ Just ec
else do
$logError $ T.concat
[ "Test suite "
, testName
, " executable not found for "
, packageNameText $ packageName package
]
return $ Map.singleton testName Nothing
when needHpc $ forM_ (lastMay testsToRun) $ \testName -> do
let pkgName = packageNameText (packageName package)
when (not $ null $ tail testsToRun) $ $logWarn $ T.concat
[ "Error: The --coverage flag does not yet support multiple test suites in a single cabal file. "
, "All of the tests have been run, however, the HPC report will only supply coverage info for "
, pkgName
, "'s last test, "
, testName
, "."
]
generateHpcReport pkgDir pkgName testName
bs <- liftIO $
case mlogFile of
Nothing -> return ""
Just (logFile, h) -> do
hClose h
S.readFile $ toFilePath logFile
unless (Map.null errs) $ throwM $ TestSuiteFailure
(taskProvides task)
errs
(fmap fst mlogFile)
bs
setTestSuccess pkgDir
-- | Determine the tests to be run based on the list of components. | 6,990 | singleTest topts ac ee task =
withSingleContext ac ee task (Just "test") $ \package cabalfp pkgDir cabal announce console mlogFile -> do
(_cache, neededConfig) <- ensureConfig pkgDir ee task (announce "configure (test)") cabal cabalfp ["--enable-tests"]
config <- asks getConfig
testBuilt <- checkTestBuilt pkgDir
let needBuild = neededConfig ||
(case taskType task of
TTLocal lp -> lpDirtyFiles lp
_ -> assert False True) ||
not testBuilt
needHpc = toCoverage topts
componentsRaw =
case taskType task of
TTLocal lp -> Set.toList $ lpComponents lp
TTUpstream _ _ -> assert False []
testsToRun = compareTestsComponents componentsRaw $ Set.toList $ packageTests package
components = map (T.unpack . T.append "test:") testsToRun
when needBuild $ do
announce "build (test)"
unsetTestBuilt pkgDir
unsetTestSuccess pkgDir
case taskType task of
TTLocal lp -> writeBuildCache pkgDir $ lpNewBuildCache lp
TTUpstream _ _ -> assert False $ return ()
extraOpts <- extraBuildOptions
cabal (console && configHideTHLoading config) $
"build" : (components ++ extraOpts)
setTestBuilt pkgDir
toRun <-
if toDisableRun topts
then do
announce "Test running disabled by --no-run-tests flag."
return False
else if toRerunTests topts
then return True
else do
success <- checkTestSuccess pkgDir
if success
then do
unless (null testsToRun) $ announce "skipping already passed test"
return False
else return True
when toRun $ do
bconfig <- asks getBuildConfig
buildDir <- distDirFromDir pkgDir
hpcDir <- hpcDirFromDir pkgDir
when needHpc (createTree hpcDir)
let exeExtension =
case configPlatform $ getConfig bconfig of
Platform _ Windows -> ".exe"
_ -> ""
errs <- liftM Map.unions $ forM testsToRun $ \testName -> do
nameDir <- parseRelDir $ T.unpack testName
nameExe <- parseRelFile $ T.unpack testName ++ exeExtension
nameTix <- liftM (pkgDir </>) $ parseRelFile $ T.unpack testName ++ ".tix"
let exeName = buildDir </> $(mkRelDir "build") </> nameDir </> nameExe
exists <- fileExists exeName
menv <- liftIO $ configEnvOverride config EnvSettings
{ esIncludeLocals = taskLocation task == Local
, esIncludeGhcPackagePath = True
, esStackExe = True
}
if exists
then do
-- We clear out the .tix files before doing a run.
when needHpc $ do
tixexists <- fileExists nameTix
when tixexists $
$logWarn ("Removing HPC file " <> T.pack (toFilePath nameTix))
removeFileIfExists nameTix
let args = toAdditionalArgs topts
argsDisplay = case args of
[] -> ""
_ -> ", args: " <> T.intercalate " " (map showProcessArgDebug args)
announce $ "test (suite: " <> testName <> argsDisplay <> ")"
let cp = (proc (toFilePath exeName) args)
{ cwd = Just $ toFilePath pkgDir
, Process.env = envHelper menv
, std_in = CreatePipe
, std_out =
case mlogFile of
Nothing -> Inherit
Just (_, h) -> UseHandle h
, std_err =
case mlogFile of
Nothing -> Inherit
Just (_, h) -> UseHandle h
}
-- Use createProcess_ to avoid the log file being closed afterwards
(Just inH, Nothing, Nothing, ph) <- liftIO $ createProcess_ "singleBuild.runTests" cp
liftIO $ hClose inH
ec <- liftIO $ waitForProcess ph
-- Move the .tix file out of the package directory
-- into the hpc work dir, for tidiness.
when needHpc $
moveFileIfExists nameTix hpcDir
return $ case ec of
ExitSuccess -> Map.empty
_ -> Map.singleton testName $ Just ec
else do
$logError $ T.concat
[ "Test suite "
, testName
, " executable not found for "
, packageNameText $ packageName package
]
return $ Map.singleton testName Nothing
when needHpc $ forM_ (lastMay testsToRun) $ \testName -> do
let pkgName = packageNameText (packageName package)
when (not $ null $ tail testsToRun) $ $logWarn $ T.concat
[ "Error: The --coverage flag does not yet support multiple test suites in a single cabal file. "
, "All of the tests have been run, however, the HPC report will only supply coverage info for "
, pkgName
, "'s last test, "
, testName
, "."
]
generateHpcReport pkgDir pkgName testName
bs <- liftIO $
case mlogFile of
Nothing -> return ""
Just (logFile, h) -> do
hClose h
S.readFile $ toFilePath logFile
unless (Map.null errs) $ throwM $ TestSuiteFailure
(taskProvides task)
errs
(fmap fst mlogFile)
bs
setTestSuccess pkgDir
-- | Determine the tests to be run based on the list of components. | 6,854 | false | true | 0 | 29 | 3,409 | 1,420 | 664 | 756 | null | null |
genos/online_problems | advent_of_code_2016/day15/hask/src/Main.hs | mit | input :: Text
input = T.pack $(embedStringFile "input.txt") | 59 | input :: Text
input = T.pack $(embedStringFile "input.txt") | 59 | input = T.pack $(embedStringFile "input.txt") | 45 | false | true | 0 | 8 | 7 | 23 | 11 | 12 | null | null |
MadSciGuys/NodeInit | Main.hs | mit | putMVarSh :: MVar a -> a -> Sh ()
putMVarSh = (liftIO . ) . putMVar | 67 | putMVarSh :: MVar a -> a -> Sh ()
putMVarSh = (liftIO . ) . putMVar | 67 | putMVarSh = (liftIO . ) . putMVar | 33 | false | true | 0 | 9 | 15 | 41 | 19 | 22 | null | null |
spacekitteh/smcghc | libraries/base/Text/ParserCombinators/ReadPrec.hs | bsd-3-clause | step :: ReadPrec a -> ReadPrec a
-- ^ Increases the precedence context by one.
step (P f) = P (\n -> f (n+1)) | 109 | step :: ReadPrec a -> ReadPrec a
step (P f) = P (\n -> f (n+1)) | 63 | step (P f) = P (\n -> f (n+1)) | 30 | true | true | 0 | 10 | 23 | 57 | 27 | 30 | null | null |
nschoe/hpt | src/Dispatcher.hs | bsd-3-clause | server :: IO ()
server = withSocketsDo $ do
-- Construct Credential information
putStr "Loading certificate..."
certFile <- getCertificateFile
certificate <- case certFile of
Left err ->
do
failed ("failed\n" ++ err ++ "\n")
exitFailure
Right certificateFile ->
do
fileReadCertificate certificateFile
success "success\n"
putStr "Loading private key..."
keyFile <- getPrivateKeyFile
privKey <- case keyFile of
Left err ->
do
failed ("failed\n" ++ err ++ "\n")
exitFailure
Right privateKeyFile ->
do
fileReadPrivateKey privateKeyFile
success "success\n"
putStr "Creating server credential..."
let cred = Credential certificate privKey []
success "success\n"
-- Create server SSL settings
putStr "Creating server SSL settings..."
let servSettings = makeServerSettings cred Nothing
success "success\n"
-- Reading registered users database
putStr "Reading registered users database..."
regDb <- getRegisteredDb
dbFile <- case regDb of
Left err ->
do
failed ("failed\n" ++ err ++ "\n")
exitFailure
Right file ->
return file
-- De-serialize registered users list from file
raw <- withFile dbFile ReadMode $ \h ->
do !contents <- L.hGetContents h
return contents
let reg = case L.null raw of
True -> Map.empty
False -> decode raw :: Map.Map UserName HashPassword
success "success\n"
-- Create internal state
putStr "Initializing currently connected users list..."
aliveUsers <- atomically $ newTVar (Map.empty)
success "success\n"
putStr "Creating empty registered users list..."
registeredUsers <- atomically $ newTVar reg
success "success\n"
putStr "Creating internal state..."
let state = DispatcherState {
dsAlive = aliveUsers
, dsRegistered = registeredUsers
}
success "success\n"
-- Start the server
hSetBuffering stdout NoBuffering
printf "Starting dispatcher on port %s...\n\n" port
-- server_tId <- forkIO $ serve servSettings HostIPv6 port (handleClient state)
server_tId <- forkIO $ serve servSettings HostIPv4 port (handleClient state)
-- Start the thread that saves registered user list every 5 minutes
saveRegistered_tId <- forkIO $ forever $ threadDelay ((5*60 * 10^6)::Int) >> saveDb state dbFile
-- Loop and parse dispatcher administrative commands
loop state server_tId dbFile
putStrLn "Server exiting..."
where
loop state server_tId dbFile = do
putStr "Administrative dispatcher command : "
cmd <- getLine
putStr "\n"
case cmd of
"help" -> putStrLn ("Available commands : help, stop, list alive, list registered, save") >> loop state server_tId dbFile
"stop" -> putStrLn "Dispatcher exiting..." >> throwTo server_tId ThreadKilled
"list alive" -> do
clientsmap <- atomically $ readTVar (dsAlive state)
putStrLn ("Alive users : \n" ++ show clientsmap)
loop state server_tId dbFile
"list registered" -> do
regmap <- atomically $ readTVar (dsRegistered state)
putStrLn ("Registered users : \n" ++ show regmap)
loop state server_tId dbFile
"save" -> do
putStr "Saving..."
saveDb state dbFile
success "success\n"
loop state server_tId dbFile
_ -> putStrLn ("Unknown command : " ++ cmd) >> loop state server_tId dbFile
-- | Deal with a client connecting | 4,096 | server :: IO ()
server = withSocketsDo $ do
-- Construct Credential information
putStr "Loading certificate..."
certFile <- getCertificateFile
certificate <- case certFile of
Left err ->
do
failed ("failed\n" ++ err ++ "\n")
exitFailure
Right certificateFile ->
do
fileReadCertificate certificateFile
success "success\n"
putStr "Loading private key..."
keyFile <- getPrivateKeyFile
privKey <- case keyFile of
Left err ->
do
failed ("failed\n" ++ err ++ "\n")
exitFailure
Right privateKeyFile ->
do
fileReadPrivateKey privateKeyFile
success "success\n"
putStr "Creating server credential..."
let cred = Credential certificate privKey []
success "success\n"
-- Create server SSL settings
putStr "Creating server SSL settings..."
let servSettings = makeServerSettings cred Nothing
success "success\n"
-- Reading registered users database
putStr "Reading registered users database..."
regDb <- getRegisteredDb
dbFile <- case regDb of
Left err ->
do
failed ("failed\n" ++ err ++ "\n")
exitFailure
Right file ->
return file
-- De-serialize registered users list from file
raw <- withFile dbFile ReadMode $ \h ->
do !contents <- L.hGetContents h
return contents
let reg = case L.null raw of
True -> Map.empty
False -> decode raw :: Map.Map UserName HashPassword
success "success\n"
-- Create internal state
putStr "Initializing currently connected users list..."
aliveUsers <- atomically $ newTVar (Map.empty)
success "success\n"
putStr "Creating empty registered users list..."
registeredUsers <- atomically $ newTVar reg
success "success\n"
putStr "Creating internal state..."
let state = DispatcherState {
dsAlive = aliveUsers
, dsRegistered = registeredUsers
}
success "success\n"
-- Start the server
hSetBuffering stdout NoBuffering
printf "Starting dispatcher on port %s...\n\n" port
-- server_tId <- forkIO $ serve servSettings HostIPv6 port (handleClient state)
server_tId <- forkIO $ serve servSettings HostIPv4 port (handleClient state)
-- Start the thread that saves registered user list every 5 minutes
saveRegistered_tId <- forkIO $ forever $ threadDelay ((5*60 * 10^6)::Int) >> saveDb state dbFile
-- Loop and parse dispatcher administrative commands
loop state server_tId dbFile
putStrLn "Server exiting..."
where
loop state server_tId dbFile = do
putStr "Administrative dispatcher command : "
cmd <- getLine
putStr "\n"
case cmd of
"help" -> putStrLn ("Available commands : help, stop, list alive, list registered, save") >> loop state server_tId dbFile
"stop" -> putStrLn "Dispatcher exiting..." >> throwTo server_tId ThreadKilled
"list alive" -> do
clientsmap <- atomically $ readTVar (dsAlive state)
putStrLn ("Alive users : \n" ++ show clientsmap)
loop state server_tId dbFile
"list registered" -> do
regmap <- atomically $ readTVar (dsRegistered state)
putStrLn ("Registered users : \n" ++ show regmap)
loop state server_tId dbFile
"save" -> do
putStr "Saving..."
saveDb state dbFile
success "success\n"
loop state server_tId dbFile
_ -> putStrLn ("Unknown command : " ++ cmd) >> loop state server_tId dbFile
-- | Deal with a client connecting | 4,096 | server = withSocketsDo $ do
-- Construct Credential information
putStr "Loading certificate..."
certFile <- getCertificateFile
certificate <- case certFile of
Left err ->
do
failed ("failed\n" ++ err ++ "\n")
exitFailure
Right certificateFile ->
do
fileReadCertificate certificateFile
success "success\n"
putStr "Loading private key..."
keyFile <- getPrivateKeyFile
privKey <- case keyFile of
Left err ->
do
failed ("failed\n" ++ err ++ "\n")
exitFailure
Right privateKeyFile ->
do
fileReadPrivateKey privateKeyFile
success "success\n"
putStr "Creating server credential..."
let cred = Credential certificate privKey []
success "success\n"
-- Create server SSL settings
putStr "Creating server SSL settings..."
let servSettings = makeServerSettings cred Nothing
success "success\n"
-- Reading registered users database
putStr "Reading registered users database..."
regDb <- getRegisteredDb
dbFile <- case regDb of
Left err ->
do
failed ("failed\n" ++ err ++ "\n")
exitFailure
Right file ->
return file
-- De-serialize registered users list from file
raw <- withFile dbFile ReadMode $ \h ->
do !contents <- L.hGetContents h
return contents
let reg = case L.null raw of
True -> Map.empty
False -> decode raw :: Map.Map UserName HashPassword
success "success\n"
-- Create internal state
putStr "Initializing currently connected users list..."
aliveUsers <- atomically $ newTVar (Map.empty)
success "success\n"
putStr "Creating empty registered users list..."
registeredUsers <- atomically $ newTVar reg
success "success\n"
putStr "Creating internal state..."
let state = DispatcherState {
dsAlive = aliveUsers
, dsRegistered = registeredUsers
}
success "success\n"
-- Start the server
hSetBuffering stdout NoBuffering
printf "Starting dispatcher on port %s...\n\n" port
-- server_tId <- forkIO $ serve servSettings HostIPv6 port (handleClient state)
server_tId <- forkIO $ serve servSettings HostIPv4 port (handleClient state)
-- Start the thread that saves registered user list every 5 minutes
saveRegistered_tId <- forkIO $ forever $ threadDelay ((5*60 * 10^6)::Int) >> saveDb state dbFile
-- Loop and parse dispatcher administrative commands
loop state server_tId dbFile
putStrLn "Server exiting..."
where
loop state server_tId dbFile = do
putStr "Administrative dispatcher command : "
cmd <- getLine
putStr "\n"
case cmd of
"help" -> putStrLn ("Available commands : help, stop, list alive, list registered, save") >> loop state server_tId dbFile
"stop" -> putStrLn "Dispatcher exiting..." >> throwTo server_tId ThreadKilled
"list alive" -> do
clientsmap <- atomically $ readTVar (dsAlive state)
putStrLn ("Alive users : \n" ++ show clientsmap)
loop state server_tId dbFile
"list registered" -> do
regmap <- atomically $ readTVar (dsRegistered state)
putStrLn ("Registered users : \n" ++ show regmap)
loop state server_tId dbFile
"save" -> do
putStr "Saving..."
saveDb state dbFile
success "success\n"
loop state server_tId dbFile
_ -> putStrLn ("Unknown command : " ++ cmd) >> loop state server_tId dbFile
-- | Deal with a client connecting | 4,080 | false | true | 0 | 18 | 1,474 | 836 | 369 | 467 | null | null |
elegios/datalang | src/Inference.hs | mit | applyRestriction errF IPointer{} (IRestriction _ as NoRestrKind) =
mapM_ (attemptCompoundExpand errF) as | 106 | applyRestriction errF IPointer{} (IRestriction _ as NoRestrKind) =
mapM_ (attemptCompoundExpand errF) as | 106 | applyRestriction errF IPointer{} (IRestriction _ as NoRestrKind) =
mapM_ (attemptCompoundExpand errF) as | 106 | false | false | 0 | 7 | 13 | 38 | 18 | 20 | null | null |
lostbean/VirMat | src/VirMat/IO/Export/ANG/RasterEngine.hs | gpl-3.0 | -- | Information describing the measuriment.
einfo :: ANGinfo
einfo = ANGinfo
{ workDist = 16 -- Double
, pixperum = 1 -- Double
, operator = "VirMat" -- String
, sampleID = "007" -- String
, scanID = "666" -- String
} | 251 | einfo :: ANGinfo
einfo = ANGinfo
{ workDist = 16 -- Double
, pixperum = 1 -- Double
, operator = "VirMat" -- String
, sampleID = "007" -- String
, scanID = "666" -- String
} | 206 | einfo = ANGinfo
{ workDist = 16 -- Double
, pixperum = 1 -- Double
, operator = "VirMat" -- String
, sampleID = "007" -- String
, scanID = "666" -- String
} | 189 | true | true | 0 | 7 | 75 | 59 | 35 | 24 | null | null |
ksaveljev/hake-2 | src/Game/Monsters/MPlayer.hs | bsd-3-clause | framePain201 :: Int
framePain201 = 58 | 37 | framePain201 :: Int
framePain201 = 58 | 37 | framePain201 = 58 | 17 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
themoritz/cabal | cabal-install/Distribution/Client/ProjectOrchestration.hs | bsd-3-clause | selectBuildableTargets :: [AvailableTarget k] -> [k]
selectBuildableTargets ts =
[ k | AvailableTarget _ _ (TargetBuildable k _) _ <- ts ] | 142 | selectBuildableTargets :: [AvailableTarget k] -> [k]
selectBuildableTargets ts =
[ k | AvailableTarget _ _ (TargetBuildable k _) _ <- ts ] | 142 | selectBuildableTargets ts =
[ k | AvailableTarget _ _ (TargetBuildable k _) _ <- ts ] | 89 | false | true | 0 | 10 | 25 | 55 | 28 | 27 | null | null |
snoyberg/ghc | compiler/coreSyn/CoreFVs.hs | bsd-3-clause | -- Look through type synonyms (Trac #4912)
orphNamesOfType (TyVarTy _) = emptyNameSet | 94 | orphNamesOfType (TyVarTy _) = emptyNameSet | 51 | orphNamesOfType (TyVarTy _) = emptyNameSet | 51 | true | false | 0 | 7 | 20 | 16 | 8 | 8 | null | null |
DaMSL/K3 | src/Language/K3/Codegen/CPP/Program.hs | apache-2.0 | prettifyExpr :: K3 Type -> R.Expression -> CPPGenM R.Expression
prettifyExpr base_t e =
return $ R.Literal $ R.LString "disabled" | 130 | prettifyExpr :: K3 Type -> R.Expression -> CPPGenM R.Expression
prettifyExpr base_t e =
return $ R.Literal $ R.LString "disabled" | 130 | prettifyExpr base_t e =
return $ R.Literal $ R.LString "disabled" | 66 | false | true | 0 | 8 | 19 | 49 | 23 | 26 | null | null |
lfritz/python-type-inference | python-type-inference/src/Language/Python/TypeInference/Analysis/TypeLattice.hs | bsd-3-clause | splitAndMerge [] l = l | 37 | splitAndMerge [] l = l | 37 | splitAndMerge [] l = l | 37 | false | false | 1 | 6 | 19 | 16 | 6 | 10 | null | null |
jwodder/Chess.hs | tests/startFEN.hs | mit | main = putStrLn $ showsFEN (start, 0, 1) "" | 43 | main = putStrLn $ showsFEN (start, 0, 1) "" | 43 | main = putStrLn $ showsFEN (start, 0, 1) "" | 43 | false | false | 1 | 7 | 8 | 27 | 13 | 14 | null | null |
projectorhq/haskell-liquid | test/Text/Liquid/ParserTests.hs | bsd-3-clause | --------------------------------------------------------------------------------
-- * Filter Cell
--------------------------------------------------------------------------------
case_filterCell1 = parseOnly filterCell "toUpper " @?= Right (FilterCell "toUpper" []) | 266 | case_filterCell1 = parseOnly filterCell "toUpper " @?= Right (FilterCell "toUpper" []) | 86 | case_filterCell1 = parseOnly filterCell "toUpper " @?= Right (FilterCell "toUpper" []) | 86 | true | false | 1 | 9 | 17 | 35 | 16 | 19 | null | null |
ghc-android/ghc | testsuite/tests/ghci/should_run/ghcirun004.hs | bsd-3-clause | 3137 = 3136 | 11 | 3137 = 3136 | 11 | 3137 = 3136 | 11 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
tjakway/ghcjvm | compiler/prelude/TysWiredIn.hs | bsd-3-clause | typeNatKind, typeSymbolKind :: Kind
typeNatKind = mkTyConTy typeNatKindCon | 77 | typeNatKind, typeSymbolKind :: Kind
typeNatKind = mkTyConTy typeNatKindCon | 77 | typeNatKind = mkTyConTy typeNatKindCon | 41 | false | true | 2 | 6 | 10 | 23 | 9 | 14 | null | null |
allanderek/ipclib | web/interface/IpcWeb.hs | gpl-2.0 | {-|
The title of a results page
-}
resultsPageTitle :: String
resultsPageTitle = demoPageTitle ++ " - Results" | 112 | resultsPageTitle :: String
resultsPageTitle = demoPageTitle ++ " - Results" | 75 | resultsPageTitle = demoPageTitle ++ " - Results" | 48 | true | true | 0 | 5 | 19 | 16 | 9 | 7 | null | null |
AndreasPK/stack | src/System/Process/PagerEditor.hs | bsd-3-clause | pageByteString :: ByteString -> IO ()
pageByteString = pageWriter . flip hPut | 77 | pageByteString :: ByteString -> IO ()
pageByteString = pageWriter . flip hPut | 77 | pageByteString = pageWriter . flip hPut | 39 | false | true | 1 | 8 | 11 | 33 | 14 | 19 | null | null |
lambdageek/insomnia | src/Insomnia/SurfaceSyntax/ToastMonad.hs | bsd-3-clause | await :: Monad m => ImportFileSpec -> TA m Toplevel
await spec = do
ans <- Pipes.request spec
case ans of
Left err -> throwToastError $ importFileErrorMsg err
Right ok -> return ok | 192 | await :: Monad m => ImportFileSpec -> TA m Toplevel
await spec = do
ans <- Pipes.request spec
case ans of
Left err -> throwToastError $ importFileErrorMsg err
Right ok -> return ok | 192 | await spec = do
ans <- Pipes.request spec
case ans of
Left err -> throwToastError $ importFileErrorMsg err
Right ok -> return ok | 140 | false | true | 0 | 12 | 44 | 81 | 35 | 46 | null | null |
olsner/ghc | compiler/cmm/CmmContFlowOpt.hs | bsd-3-clause | callContinuation_maybe (CmmForeignCall { succ = b }) = Just b | 63 | callContinuation_maybe (CmmForeignCall { succ = b }) = Just b | 63 | callContinuation_maybe (CmmForeignCall { succ = b }) = Just b | 63 | false | false | 0 | 8 | 11 | 25 | 12 | 13 | null | null |
pjones/xmonad-test | vendor/xmonad-contrib/XMonad/Actions/FindEmptyWorkspace.hs | bsd-2-clause | viewEmptyWorkspace :: X ()
viewEmptyWorkspace = withEmptyWorkspace (windows . view) | 83 | viewEmptyWorkspace :: X ()
viewEmptyWorkspace = withEmptyWorkspace (windows . view) | 83 | viewEmptyWorkspace = withEmptyWorkspace (windows . view) | 56 | false | true | 0 | 7 | 9 | 26 | 13 | 13 | null | null |
alexander-at-github/eta | compiler/ETA/Prelude/PrelNames.hs | bsd-3-clause | csel1CoercionTyConKey = mkPreludeTyConUnique 99 | 65 | csel1CoercionTyConKey = mkPreludeTyConUnique 99 | 65 | csel1CoercionTyConKey = mkPreludeTyConUnique 99 | 65 | false | false | 0 | 5 | 21 | 9 | 4 | 5 | null | null |
christiaanb/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | tldeclared _ = [] | 17 | tldeclared _ = [] | 17 | tldeclared _ = [] | 17 | false | false | 0 | 5 | 3 | 11 | 5 | 6 | null | null |
WSCU/JSEuterpea | Euterpea Examples/SimpleEuterpea.hs | gpl-3.0 | q = dot . q
| 12 | dq = dot . q | 12 | dq = dot . q | 12 | false | false | 1 | 5 | 5 | 13 | 5 | 8 | null | null |
urbanslug/ghc | compiler/main/DriverMkDepend.hs | bsd-3-clause | processDeps :: DynFlags
-> HscEnv
-> [ModuleName]
-> FilePath
-> Handle -- Write dependencies to here
-> SCC ModSummary
-> IO ()
-- Write suitable dependencies to handle
-- Always:
-- this.o : this.hs
--
-- If the dependency is on something other than a .hi file:
-- this.o this.p_o ... : dep
-- otherwise
-- this.o ... : dep.hi
-- this.p_o ... : dep.p_hi
-- ...
-- (where .o is $osuf, and the other suffixes come from
-- the cmdline -s options).
--
-- For {-# SOURCE #-} imports the "hi" will be "hi-boot".
processDeps dflags _ _ _ _ (CyclicSCC nodes)
= -- There shouldn't be any cycles; report them
throwGhcExceptionIO (ProgramError (showSDoc dflags $ GHC.cyclicModuleErr nodes)) | 881 | processDeps :: DynFlags
-> HscEnv
-> [ModuleName]
-> FilePath
-> Handle -- Write dependencies to here
-> SCC ModSummary
-> IO ()
processDeps dflags _ _ _ _ (CyclicSCC nodes)
= -- There shouldn't be any cycles; report them
throwGhcExceptionIO (ProgramError (showSDoc dflags $ GHC.cyclicModuleErr nodes)) | 394 | processDeps dflags _ _ _ _ (CyclicSCC nodes)
= -- There shouldn't be any cycles; report them
throwGhcExceptionIO (ProgramError (showSDoc dflags $ GHC.cyclicModuleErr nodes)) | 183 | true | true | 0 | 14 | 318 | 110 | 60 | 50 | null | null |
patrikja/testing-feat | Test/Feat/Enumerate.hs | bsd-3-clause | union :: Enumerate a -> Enumerate a -> Enumerate a
union (Enumerate xs1) (Enumerate xs2) = Enumerate (xs1 `mappend` xs2) | 120 | union :: Enumerate a -> Enumerate a -> Enumerate a
union (Enumerate xs1) (Enumerate xs2) = Enumerate (xs1 `mappend` xs2) | 120 | union (Enumerate xs1) (Enumerate xs2) = Enumerate (xs1 `mappend` xs2) | 69 | false | true | 0 | 7 | 19 | 57 | 28 | 29 | null | null |
bachase/cis194 | hw1.hs | mit | sumDigits :: [Integer] -> Integer
sumDigits = foldl (\acc x -> acc + (sum $ toDigits x)) 0 | 90 | sumDigits :: [Integer] -> Integer
sumDigits = foldl (\acc x -> acc + (sum $ toDigits x)) 0 | 90 | sumDigits = foldl (\acc x -> acc + (sum $ toDigits x)) 0 | 56 | false | true | 0 | 11 | 17 | 47 | 25 | 22 | null | null |
MichaelBurge/yxdb-utils | src/Database/Alteryx/StreamingYxdb.hs | gpl-3.0 | readCalgaryFileNoRecords :: FilePath -> IO CalgaryFile
readCalgaryFileNoRecords filepath = do
handle <- openBinaryFile filepath ReadMode
headerBS <- BSL.hGet handle calgaryHeaderSize
let header = decode $ headerBS :: CalgaryHeader
recordInfoNumCharacters <- runGet getWord32le <$> BSL.hGet handle 4 :: IO Word32
let recordInfoNumBytes = fromIntegral $ 2 * recordInfoNumCharacters
recordInfoBs <- BSL.toStrict <$> BSL.hGet handle recordInfoNumBytes
let recordInfo = decode $ seq recordInfoBs $ BSL.fromStrict recordInfoBs
hSeek handle AbsoluteSeek $ fromIntegral $ header ^. calgaryHeaderIndexPosition
indexBs <- BSL.hGetContents handle
let indices = runGet getCalgaryBlockIndex indexBs :: CalgaryBlockIndex
return CalgaryFile {
_calgaryFileHeader = header,
_calgaryFileRecordInfo = recordInfo,
_calgaryFileRecords = [],
_calgaryFileIndex = indices
} | 954 | readCalgaryFileNoRecords :: FilePath -> IO CalgaryFile
readCalgaryFileNoRecords filepath = do
handle <- openBinaryFile filepath ReadMode
headerBS <- BSL.hGet handle calgaryHeaderSize
let header = decode $ headerBS :: CalgaryHeader
recordInfoNumCharacters <- runGet getWord32le <$> BSL.hGet handle 4 :: IO Word32
let recordInfoNumBytes = fromIntegral $ 2 * recordInfoNumCharacters
recordInfoBs <- BSL.toStrict <$> BSL.hGet handle recordInfoNumBytes
let recordInfo = decode $ seq recordInfoBs $ BSL.fromStrict recordInfoBs
hSeek handle AbsoluteSeek $ fromIntegral $ header ^. calgaryHeaderIndexPosition
indexBs <- BSL.hGetContents handle
let indices = runGet getCalgaryBlockIndex indexBs :: CalgaryBlockIndex
return CalgaryFile {
_calgaryFileHeader = header,
_calgaryFileRecordInfo = recordInfo,
_calgaryFileRecords = [],
_calgaryFileIndex = indices
} | 954 | readCalgaryFileNoRecords filepath = do
handle <- openBinaryFile filepath ReadMode
headerBS <- BSL.hGet handle calgaryHeaderSize
let header = decode $ headerBS :: CalgaryHeader
recordInfoNumCharacters <- runGet getWord32le <$> BSL.hGet handle 4 :: IO Word32
let recordInfoNumBytes = fromIntegral $ 2 * recordInfoNumCharacters
recordInfoBs <- BSL.toStrict <$> BSL.hGet handle recordInfoNumBytes
let recordInfo = decode $ seq recordInfoBs $ BSL.fromStrict recordInfoBs
hSeek handle AbsoluteSeek $ fromIntegral $ header ^. calgaryHeaderIndexPosition
indexBs <- BSL.hGetContents handle
let indices = runGet getCalgaryBlockIndex indexBs :: CalgaryBlockIndex
return CalgaryFile {
_calgaryFileHeader = header,
_calgaryFileRecordInfo = recordInfo,
_calgaryFileRecords = [],
_calgaryFileIndex = indices
} | 899 | false | true | 0 | 12 | 205 | 235 | 111 | 124 | null | null |
juanbono/my-scheme | src/Environment.hs | bsd-3-clause | liftThrows (Right val) = return val | 35 | liftThrows (Right val) = return val | 35 | liftThrows (Right val) = return val | 35 | false | false | 0 | 6 | 5 | 19 | 8 | 11 | null | null |
noughtmare/yi | yi-keymap-vim/src/Yi/Keymap/Vim/Digraph.hs | gpl-2.0 | -- KATAKANA LETTER SMALL YU
switch 'Y' 'u' = '\x30E6' | 53 | switch 'Y' 'u' = '\x30E6' | 25 | switch 'Y' 'u' = '\x30E6' | 25 | true | false | 0 | 5 | 9 | 12 | 6 | 6 | null | null |
vikraman/ghc | compiler/coreSyn/MkCore.hs | bsd-3-clause | mkCoreConApps :: DataCon -> [CoreExpr] -> CoreExpr
mkCoreConApps con args = mkCoreApps (Var (dataConWorkId con)) args | 117 | mkCoreConApps :: DataCon -> [CoreExpr] -> CoreExpr
mkCoreConApps con args = mkCoreApps (Var (dataConWorkId con)) args | 117 | mkCoreConApps con args = mkCoreApps (Var (dataConWorkId con)) args | 66 | false | true | 0 | 9 | 15 | 50 | 23 | 27 | null | null |
nushio3/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | uAddrHash_RDR = varQual_RDR gHC_GENERICS (fsLit "uAddr#") | 59 | uAddrHash_RDR = varQual_RDR gHC_GENERICS (fsLit "uAddr#") | 59 | uAddrHash_RDR = varQual_RDR gHC_GENERICS (fsLit "uAddr#") | 59 | false | false | 1 | 7 | 7 | 20 | 8 | 12 | null | null |
olsner/m3 | CppToken.hs | bsd-3-clause | swap (x,y) = (y,x) | 18 | swap (x,y) = (y,x) | 18 | swap (x,y) = (y,x) | 18 | false | false | 0 | 6 | 3 | 21 | 12 | 9 | null | null |
snapframework/snap | src/Snap/Snaplet/Internal/Initializer.hs | bsd-3-clause | upHook' :: Monad m => ALens' b a -> (a -> m (Either e a)) -> b -> m (Either e b)
upHook' l h b = do
v <- h (b ^# l)
return $ case v of
Left e -> Left e
Right v' -> Right $ storing l v' b
------------------------------------------------------------------------------
-- | Modifies the Initializer's SnapletConfig. | 352 | upHook' :: Monad m => ALens' b a -> (a -> m (Either e a)) -> b -> m (Either e b)
upHook' l h b = do
v <- h (b ^# l)
return $ case v of
Left e -> Left e
Right v' -> Right $ storing l v' b
------------------------------------------------------------------------------
-- | Modifies the Initializer's SnapletConfig. | 352 | upHook' l h b = do
v <- h (b ^# l)
return $ case v of
Left e -> Left e
Right v' -> Right $ storing l v' b
------------------------------------------------------------------------------
-- | Modifies the Initializer's SnapletConfig. | 271 | false | true | 0 | 12 | 99 | 133 | 63 | 70 | null | null |
herngyi/hmol | Rendering.hs | gpl-3.0 | [filterMassDensity, filterChargeDensity, filterElectronegativity, filterElectronDensity, continuousBondColoring, showLonePairs, showEmptyOrbitals, showConvexHulls] = [0 .. optionNumber - 1] | 189 | [filterMassDensity, filterChargeDensity, filterElectronegativity, filterElectronDensity, continuousBondColoring, showLonePairs, showEmptyOrbitals, showConvexHulls] = [0 .. optionNumber - 1] | 189 | [filterMassDensity, filterChargeDensity, filterElectronegativity, filterElectronDensity, continuousBondColoring, showLonePairs, showEmptyOrbitals, showConvexHulls] = [0 .. optionNumber - 1] | 189 | false | false | 0 | 6 | 13 | 41 | 25 | 16 | null | null |
rvion/ride | jetpack/src/System/Process/AsEnv.hs | bsd-3-clause | get_env_std_in o = I.std_in o | 29 | get_env_std_in o = I.std_in o | 29 | get_env_std_in o = I.std_in o | 29 | false | false | 0 | 6 | 4 | 14 | 6 | 8 | null | null |
DanielWaterworth/Idris-dev | src/IRTS/CodegenLLVM.hs | bsd-3-clause | ftyToTy FPtr = PointerType (IntegerType 8) (AddrSpace 0) | 56 | ftyToTy FPtr = PointerType (IntegerType 8) (AddrSpace 0) | 56 | ftyToTy FPtr = PointerType (IntegerType 8) (AddrSpace 0) | 56 | false | false | 0 | 7 | 7 | 26 | 12 | 14 | null | null |
mfejzer/knuth-bendix-completion | KnuthBendixCompletion/Tests.hs | bsd-3-clause | r4 = ReductionRule {rule=Func "+" [Func "-" [Var "v0"],Func "+" [Var "v0",Var "v1"]],result=Var "v1"} | 102 | r4 = ReductionRule {rule=Func "+" [Func "-" [Var "v0"],Func "+" [Var "v0",Var "v1"]],result=Var "v1"} | 102 | r4 = ReductionRule {rule=Func "+" [Func "-" [Var "v0"],Func "+" [Var "v0",Var "v1"]],result=Var "v1"} | 102 | false | false | 1 | 11 | 14 | 65 | 32 | 33 | null | null |
jamesdabbs/pi-base-2 | test/Spec/Action.hs | bsd-3-clause | space :: Action SpaceId
space = runDB . insert $ Space "" "" Nothing | 68 | space :: Action SpaceId
space = runDB . insert $ Space "" "" Nothing | 68 | space = runDB . insert $ Space "" "" Nothing | 44 | false | true | 1 | 6 | 13 | 32 | 14 | 18 | null | null |
spacekitteh/smcghc | compiler/cmm/CLabel.hs | bsd-3-clause | externallyVisibleIdLabel LocalEntry = False | 48 | externallyVisibleIdLabel LocalEntry = False | 48 | externallyVisibleIdLabel LocalEntry = False | 48 | false | false | 0 | 5 | 8 | 9 | 4 | 5 | null | null |
wfleming/advent-of-code-2016 | 2017/D11/src/D11Lib.hs | bsd-3-clause | dir "se" = SE | 13 | dir "se" = SE | 13 | dir "se" = SE | 13 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
brendanhay/gogol | gogol-dfareporting/gen/Network/Google/DFAReporting/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'TagSetting' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'tsKeywordOption'
--
-- * 'tsIncludeClickThroughURLs'
--
-- * 'tsIncludeClickTracking'
--
-- * 'tsAdditionalKeyValues'
tagSetting
:: TagSetting
tagSetting =
TagSetting'
{ _tsKeywordOption = Nothing
, _tsIncludeClickThroughURLs = Nothing
, _tsIncludeClickTracking = Nothing
, _tsAdditionalKeyValues = Nothing
} | 505 | tagSetting
:: TagSetting
tagSetting =
TagSetting'
{ _tsKeywordOption = Nothing
, _tsIncludeClickThroughURLs = Nothing
, _tsIncludeClickTracking = Nothing
, _tsAdditionalKeyValues = Nothing
} | 216 | tagSetting =
TagSetting'
{ _tsKeywordOption = Nothing
, _tsIncludeClickThroughURLs = Nothing
, _tsIncludeClickTracking = Nothing
, _tsAdditionalKeyValues = Nothing
} | 187 | true | true | 0 | 7 | 94 | 58 | 36 | 22 | null | null |
CulpaBS/wbBach | src/Futhark/CodeGen/ImpCode.hs | bsd-3-clause | memoryUsage _ DeclareScalar{} =
HM.empty | 43 | memoryUsage _ DeclareScalar{} =
HM.empty | 43 | memoryUsage _ DeclareScalar{} =
HM.empty | 43 | false | false | 0 | 6 | 7 | 17 | 8 | 9 | null | null |
eightyeight/atom-msp430 | Language/Atom/MSP430/Compile.hs | mit | -- | Easy settings for a program with just a setup function.
simpleProgram :: Atom () -> MSP430Compilation
simpleProgram s = mspProgram {
setupFn = Just s
} | 161 | simpleProgram :: Atom () -> MSP430Compilation
simpleProgram s = mspProgram {
setupFn = Just s
} | 100 | simpleProgram s = mspProgram {
setupFn = Just s
} | 54 | true | true | 0 | 8 | 32 | 44 | 20 | 24 | null | null |
prydonius/Oxo | Player.hs | mit | readPlayerString "X" = X | 34 | readPlayerString "X" = X | 34 | readPlayerString "X" = X | 34 | false | false | 0 | 5 | 13 | 9 | 4 | 5 | null | null |
olsner/ghc | compiler/codeGen/StgCmmMonad.hs | bsd-3-clause | forkClosureBody :: FCode () -> FCode ()
-- forkClosureBody compiles body_code in environment where:
-- - sequel, update stack frame and self loop info are
-- set to fresh values
-- - state is set to a fresh value, except for local bindings
-- that are passed in unchanged. It's up to the enclosed code to
-- re-bind the free variables to a field of the closure.
forkClosureBody body_code
= do { dflags <- getDynFlags
; info <- getInfoDown
; us <- newUniqSupply
; state <- getState
; let body_info_down = info { cgd_sequel = initSequel
, cgd_updfr_off = initUpdFrameOff dflags
, cgd_self_loop = Nothing }
fork_state_in = (initCgState us) { cgs_binds = cgs_binds state }
((),fork_state_out) = doFCode body_code body_info_down fork_state_in
; setState $ state `addCodeBlocksFrom` fork_state_out } | 963 | forkClosureBody :: FCode () -> FCode ()
forkClosureBody body_code
= do { dflags <- getDynFlags
; info <- getInfoDown
; us <- newUniqSupply
; state <- getState
; let body_info_down = info { cgd_sequel = initSequel
, cgd_updfr_off = initUpdFrameOff dflags
, cgd_self_loop = Nothing }
fork_state_in = (initCgState us) { cgs_binds = cgs_binds state }
((),fork_state_out) = doFCode body_code body_info_down fork_state_in
; setState $ state `addCodeBlocksFrom` fork_state_out } | 624 | forkClosureBody body_code
= do { dflags <- getDynFlags
; info <- getInfoDown
; us <- newUniqSupply
; state <- getState
; let body_info_down = info { cgd_sequel = initSequel
, cgd_updfr_off = initUpdFrameOff dflags
, cgd_self_loop = Nothing }
fork_state_in = (initCgState us) { cgs_binds = cgs_binds state }
((),fork_state_out) = doFCode body_code body_info_down fork_state_in
; setState $ state `addCodeBlocksFrom` fork_state_out } | 584 | true | true | 0 | 13 | 298 | 162 | 87 | 75 | null | null |
TransformingMusicology/libaudioDB-haskell | src/Sound/Audio/Database/Query.hs | gpl-3.0 | reverseResults :: ADBQueryResults -> ADBQueryResults
reverseResults r = r { query_results_results = reverse $ query_results_results r } | 135 | reverseResults :: ADBQueryResults -> ADBQueryResults
reverseResults r = r { query_results_results = reverse $ query_results_results r } | 135 | reverseResults r = r { query_results_results = reverse $ query_results_results r } | 82 | false | true | 0 | 8 | 16 | 33 | 17 | 16 | null | null |
gbataille/pandoc | src/Text/Pandoc/Readers/Markdown.hs | gpl-2.0 | hrule :: Parser [Char] st (F Blocks)
hrule = try $ do
skipSpaces
start <- satisfy isHruleChar
count 2 (skipSpaces >> char start)
skipMany (spaceChar <|> char start)
newline
optional blanklines
return $ return B.horizontalRule
--
-- code blocks
-- | 261 | hrule :: Parser [Char] st (F Blocks)
hrule = try $ do
skipSpaces
start <- satisfy isHruleChar
count 2 (skipSpaces >> char start)
skipMany (spaceChar <|> char start)
newline
optional blanklines
return $ return B.horizontalRule
--
-- code blocks
-- | 261 | hrule = try $ do
skipSpaces
start <- satisfy isHruleChar
count 2 (skipSpaces >> char start)
skipMany (spaceChar <|> char start)
newline
optional blanklines
return $ return B.horizontalRule
--
-- code blocks
-- | 224 | false | true | 0 | 11 | 54 | 102 | 47 | 55 | null | null |
apauley/git-fetch-daemon | app/Main.hs | bsd-3-clause | defaultSleepSeconds = 120 | 25 | defaultSleepSeconds = 120 | 25 | defaultSleepSeconds = 120 | 25 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
mkscrg/hashring | Data/HashRing.hs | bsd-2-clause | (!) :: Hashable b => HashRing a -> b -> a
ring ! msg = find msg ring | 68 | (!) :: Hashable b => HashRing a -> b -> a
ring ! msg = find msg ring | 68 | ring ! msg = find msg ring | 26 | false | true | 0 | 10 | 17 | 47 | 21 | 26 | null | null |
Saulzar/scribble | src/Scribble5.hs | bsd-3-clause | main = playSceneGraph display background frequency widget
where
display = InWindow "Scribble3" (600, 600) (0, 0)
background = white
frequency = 30 | 161 | main = playSceneGraph display background frequency widget
where
display = InWindow "Scribble3" (600, 600) (0, 0)
background = white
frequency = 30 | 161 | main = playSceneGraph display background frequency widget
where
display = InWindow "Scribble3" (600, 600) (0, 0)
background = white
frequency = 30 | 161 | false | false | 3 | 6 | 36 | 62 | 28 | 34 | null | null |
spacekitteh/smcghc | compiler/nativeGen/SPARC/CodeGen.hs | bsd-3-clause | assign_code _ _
= panic "SPARC.CodeGen.GenCCall: no match" | 66 | assign_code _ _
= panic "SPARC.CodeGen.GenCCall: no match" | 66 | assign_code _ _
= panic "SPARC.CodeGen.GenCCall: no match" | 66 | false | false | 0 | 5 | 15 | 14 | 6 | 8 | null | null |
holoed/Rx.hs | Observables.hs | apache-2.0 | takeUntil :: Observable b -> Observable a -> Observable a
takeUntil sig xs = Observable (\o -> do ref <- liftIO $ newIORef False
(combine sig xs) |> subscribe (obs ref o))
where obs ref o = Observer (\x -> do b <- liftIO $ readIORef ref
if (b) then return ()
else if (isLeft x) then liftIO $ writeIORef ref True
else let (Right v) = x in o|> onNext v) | 583 | takeUntil :: Observable b -> Observable a -> Observable a
takeUntil sig xs = Observable (\o -> do ref <- liftIO $ newIORef False
(combine sig xs) |> subscribe (obs ref o))
where obs ref o = Observer (\x -> do b <- liftIO $ readIORef ref
if (b) then return ()
else if (isLeft x) then liftIO $ writeIORef ref True
else let (Right v) = x in o|> onNext v) | 583 | takeUntil sig xs = Observable (\o -> do ref <- liftIO $ newIORef False
(combine sig xs) |> subscribe (obs ref o))
where obs ref o = Observer (\x -> do b <- liftIO $ readIORef ref
if (b) then return ()
else if (isLeft x) then liftIO $ writeIORef ref True
else let (Right v) = x in o|> onNext v) | 525 | false | true | 0 | 17 | 303 | 192 | 91 | 101 | null | null |
bendmorris/scotch | Scotch/Eval/Calc.hs | gpl-3.0 | vprod _ (Val (NumInt 1)) b = b | 30 | vprod _ (Val (NumInt 1)) b = b | 30 | vprod _ (Val (NumInt 1)) b = b | 30 | false | false | 2 | 8 | 7 | 31 | 12 | 19 | null | null |
bergmark/http2 | test-hpack/HPACKEncode.hs | bsd-3-clause | run d stgy (Test _ _ ccs@(c:_)) = do
let siz = maybe 4096 id $ size c
ehdrtbl <- newDynamicTableForEncoding siz
let conf = Conf { debug = d, enc = encodeHeader stgy }
testLoop conf ccs ehdrtbl [] | 211 | run d stgy (Test _ _ ccs@(c:_)) = do
let siz = maybe 4096 id $ size c
ehdrtbl <- newDynamicTableForEncoding siz
let conf = Conf { debug = d, enc = encodeHeader stgy }
testLoop conf ccs ehdrtbl [] | 211 | run d stgy (Test _ _ ccs@(c:_)) = do
let siz = maybe 4096 id $ size c
ehdrtbl <- newDynamicTableForEncoding siz
let conf = Conf { debug = d, enc = encodeHeader stgy }
testLoop conf ccs ehdrtbl [] | 211 | false | false | 0 | 12 | 55 | 104 | 50 | 54 | null | null |
genos/online_problems | advent_of_code_2016/day7/src/Main.hs | mit | parseIPv7 :: AC.Parser IPv7
parseIPv7 = IPv7 <$> AC.many' (parseHyper <|> parseSuper) | 85 | parseIPv7 :: AC.Parser IPv7
parseIPv7 = IPv7 <$> AC.many' (parseHyper <|> parseSuper) | 85 | parseIPv7 = IPv7 <$> AC.many' (parseHyper <|> parseSuper) | 57 | false | true | 0 | 8 | 11 | 32 | 16 | 16 | null | null |
ku-fpg/ldpc | src/Data/Matrix/SparseMatrixLDPC.hs | bsd-2-clause | --- for use with Worker/Wrapper
-- we rely on these two assumptions (in Data.Array.Matrix)
-- type V a = Array Int a -- We assume that we index (1,length array)
-- type M a = Array (Int,Int) a -- We assume that we index ((1,1),(length A,length B))
-- FIXME Is it an error if: mask ! (i,j) == Zero AND dense ! (i,j) /= zeroValue ???
toSparse :: (Eq e) => M Bit -> e -> M e -> SML e
toSparse mask zeroVal dense = (mask, values, zeroVal)
where values= vector [ dense ! index | index <- maskIndices mask ] | 522 | toSparse :: (Eq e) => M Bit -> e -> M e -> SML e
toSparse mask zeroVal dense = (mask, values, zeroVal)
where values= vector [ dense ! index | index <- maskIndices mask ] | 174 | toSparse mask zeroVal dense = (mask, values, zeroVal)
where values= vector [ dense ! index | index <- maskIndices mask ] | 124 | true | true | 0 | 11 | 122 | 90 | 48 | 42 | null | null |
adinapoli/api-tools | src/Data/API/Changes.hs | bsd-3-clause | typeFreeVars TyJSON = Set.empty | 36 | typeFreeVars TyJSON = Set.empty | 36 | typeFreeVars TyJSON = Set.empty | 36 | false | false | 1 | 6 | 8 | 15 | 5 | 10 | null | null |
TomMD/ghc | compiler/types/TyCon.hs | bsd-3-clause | isImplicitTyCon (SynonymTyCon {}) = False | 44 | isImplicitTyCon (SynonymTyCon {}) = False | 44 | isImplicitTyCon (SynonymTyCon {}) = False | 44 | false | false | 0 | 6 | 7 | 17 | 8 | 9 | null | null |
sherwoodwang/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxPREVIEW_LAST :: Int
wxPREVIEW_LAST = 32 | 41 | wxPREVIEW_LAST :: Int
wxPREVIEW_LAST = 32 | 41 | wxPREVIEW_LAST = 32 | 19 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
emwap/annotations | src/Annot.hs | bsd-3-clause | fft :: (Syntax a, Num a)
=> Vector a -> Vector a -> Vector a
fft ws vs = forLoop (ilog2 len) (alloc vs) (copy stage)
where
len = length vs
stage s = chunk (len .>>. s) (butterfly dft2 (ixmap (.<<. s) ws)) | 222 | fft :: (Syntax a, Num a)
=> Vector a -> Vector a -> Vector a
fft ws vs = forLoop (ilog2 len) (alloc vs) (copy stage)
where
len = length vs
stage s = chunk (len .>>. s) (butterfly dft2 (ixmap (.<<. s) ws)) | 222 | fft ws vs = forLoop (ilog2 len) (alloc vs) (copy stage)
where
len = length vs
stage s = chunk (len .>>. s) (butterfly dft2 (ixmap (.<<. s) ws)) | 157 | false | true | 1 | 10 | 61 | 123 | 61 | 62 | null | null |
plow-technologies/cobalt-kiosk-data-template | src/Kiosk/Backend/Data/InvoiceTemplate.hs | bsd-3-clause | dataTemplateItems
:: DataTemplate
-> [(Text,InputType)]
dataTemplateItems DataTemplate{templateItems} =
fmap (\TemplateItem{..} -> (label,templateValue)) templateItems | 174 | dataTemplateItems
:: DataTemplate
-> [(Text,InputType)]
dataTemplateItems DataTemplate{templateItems} =
fmap (\TemplateItem{..} -> (label,templateValue)) templateItems | 173 | dataTemplateItems DataTemplate{templateItems} =
fmap (\TemplateItem{..} -> (label,templateValue)) templateItems | 113 | false | true | 2 | 9 | 19 | 64 | 33 | 31 | null | null |
mzini/hosa | hosa/Main.hs | mit | main :: IO ()
main = do
cfg <- cmdArgs defaultConfig
r <- runUniqueT $ flip runReaderT cfg $ runExceptT $ do
abstr <- reader abstraction
p <- readProgram
status "Input program" (PP.pretty p)
let p' = withCallContexts abstr p
status "Specialised program" (PP.pretty p')
analysis <- reader analyse
case analysis of
Time -> timeAnalysis p'
Size -> sizeAnalysis p'
case r of
Left e@SizeTypeError{} -> putDocLn e >> exitSuccess
Left e -> putDocLn e >> exitWith (ExitFailure (-1))
_ -> exitSuccess | 553 | main :: IO ()
main = do
cfg <- cmdArgs defaultConfig
r <- runUniqueT $ flip runReaderT cfg $ runExceptT $ do
abstr <- reader abstraction
p <- readProgram
status "Input program" (PP.pretty p)
let p' = withCallContexts abstr p
status "Specialised program" (PP.pretty p')
analysis <- reader analyse
case analysis of
Time -> timeAnalysis p'
Size -> sizeAnalysis p'
case r of
Left e@SizeTypeError{} -> putDocLn e >> exitSuccess
Left e -> putDocLn e >> exitWith (ExitFailure (-1))
_ -> exitSuccess | 553 | main = do
cfg <- cmdArgs defaultConfig
r <- runUniqueT $ flip runReaderT cfg $ runExceptT $ do
abstr <- reader abstraction
p <- readProgram
status "Input program" (PP.pretty p)
let p' = withCallContexts abstr p
status "Specialised program" (PP.pretty p')
analysis <- reader analyse
case analysis of
Time -> timeAnalysis p'
Size -> sizeAnalysis p'
case r of
Left e@SizeTypeError{} -> putDocLn e >> exitSuccess
Left e -> putDocLn e >> exitWith (ExitFailure (-1))
_ -> exitSuccess | 539 | false | true | 0 | 15 | 143 | 214 | 96 | 118 | null | null |
olsner/ghc | compiler/main/ErrUtils.hs | bsd-3-clause | isWarnMsgFatal dflags _ = gopt Opt_WarnIsError dflags | 53 | isWarnMsgFatal dflags _ = gopt Opt_WarnIsError dflags | 53 | isWarnMsgFatal dflags _ = gopt Opt_WarnIsError dflags | 53 | false | false | 0 | 5 | 6 | 16 | 7 | 9 | null | null |
polachok/hs-nginx | src/Nginx/Http/Ssl.hs | mit | sslCertificate = SslCertificate <$> textValueDirective "ssl_certificate" | 72 | sslCertificate = SslCertificate <$> textValueDirective "ssl_certificate" | 72 | sslCertificate = SslCertificate <$> textValueDirective "ssl_certificate" | 72 | false | false | 1 | 6 | 5 | 16 | 6 | 10 | null | null |
t4sk/upenn-cis194 | hw-07/JoinList.hs | mit | dropJ i s@(Single _ a)
| i > 0 = Empty
| otherwise = s | 58 | dropJ i s@(Single _ a)
| i > 0 = Empty
| otherwise = s | 58 | dropJ i s@(Single _ a)
| i > 0 = Empty
| otherwise = s | 58 | false | false | 1 | 8 | 18 | 40 | 19 | 21 | null | null |
juhp/network-uri | Network/URI.hs | bsd-3-clause | pathRootLess :: URIParser String
pathRootLess =
do { s1 <- segmentNz
; ss <- many slashSegment
; return $ concat (s1:ss)
} | 151 | pathRootLess :: URIParser String
pathRootLess =
do { s1 <- segmentNz
; ss <- many slashSegment
; return $ concat (s1:ss)
} | 151 | pathRootLess =
do { s1 <- segmentNz
; ss <- many slashSegment
; return $ concat (s1:ss)
} | 118 | false | true | 0 | 10 | 50 | 52 | 26 | 26 | null | null |
GaloisInc/sk-dev-platform | user/sklite/src/Sklite/Config.hs | bsd-3-clause | aPeriod = name "period" | 23 | aPeriod = name "period" | 23 | aPeriod = name "period" | 23 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
danidiaz/concsplit | src/Util/Iteratee.hs | mit | cappedIterHandle:: Int -> Handle -> ByteIter
cappedIterHandle n = I.joinI . I.take n . iterHandle | 97 | cappedIterHandle:: Int -> Handle -> ByteIter
cappedIterHandle n = I.joinI . I.take n . iterHandle | 97 | cappedIterHandle n = I.joinI . I.take n . iterHandle | 52 | false | true | 0 | 8 | 14 | 37 | 18 | 19 | null | null |
nightscape/platform | shared/src/Unison/Parsers.hs | mit | unsafeParseType' :: Var v => [(v, Type v)] -> String -> Type v
unsafeParseType' tr = unsafeGetSucceed . parseType' tr | 117 | unsafeParseType' :: Var v => [(v, Type v)] -> String -> Type v
unsafeParseType' tr = unsafeGetSucceed . parseType' tr | 117 | unsafeParseType' tr = unsafeGetSucceed . parseType' tr | 54 | false | true | 0 | 9 | 19 | 51 | 25 | 26 | null | null |
kmcallister/safe-globals | Data/Global.hs | bsd-3-clause | polymorphic (TupleT _) = False | 35 | polymorphic (TupleT _) = False | 35 | polymorphic (TupleT _) = False | 35 | false | false | 0 | 7 | 9 | 15 | 7 | 8 | null | null |
sol/uu-parsinglib | src/Text/ParserCombinators/UU/Demo/Examples.hs | mit | same_prio ops = foldr (<|>) empty [ op <$ pSym c | (c, op) <- ops] | 68 | same_prio ops = foldr (<|>) empty [ op <$ pSym c | (c, op) <- ops] | 68 | same_prio ops = foldr (<|>) empty [ op <$ pSym c | (c, op) <- ops] | 68 | false | false | 0 | 9 | 17 | 42 | 22 | 20 | null | null |
FiveEye/playground | lang/frp.hs | gpl-2.0 | infinity = 1.0 / 0.0::Time | 26 | infinity = 1.0 / 0.0::Time | 26 | infinity = 1.0 / 0.0::Time | 26 | false | false | 4 | 5 | 4 | 21 | 7 | 14 | null | null |
bholst/blog | Handler/NewUpload.hs | mit | fileUploadForm :: Maybe (FileInfo, Text) -> Form (FileInfo, Text)
fileUploadForm x = renderDivs $ (,)
<$> areq fileField (bfs MsgUploadFileField) (fst <$> x)
<*> areq textField (bfs MsgUploadFileDescription) (snd <$> x)
<* bootstrapSubmit (BootstrapSubmit MsgUploadFileSubmit "" []) | 288 | fileUploadForm :: Maybe (FileInfo, Text) -> Form (FileInfo, Text)
fileUploadForm x = renderDivs $ (,)
<$> areq fileField (bfs MsgUploadFileField) (fst <$> x)
<*> areq textField (bfs MsgUploadFileDescription) (snd <$> x)
<* bootstrapSubmit (BootstrapSubmit MsgUploadFileSubmit "" []) | 288 | fileUploadForm x = renderDivs $ (,)
<$> areq fileField (bfs MsgUploadFileField) (fst <$> x)
<*> areq textField (bfs MsgUploadFileDescription) (snd <$> x)
<* bootstrapSubmit (BootstrapSubmit MsgUploadFileSubmit "" []) | 222 | false | true | 0 | 10 | 42 | 110 | 56 | 54 | null | null |
danr/hipspec | testsuite/prod/zeno_version/PropT33.hs | gpl-3.0 | length (_:xs) = S (length xs) | 29 | length (_:xs) = S (length xs) | 29 | length (_:xs) = S (length xs) | 29 | false | false | 0 | 6 | 5 | 26 | 12 | 14 | null | null |
NatureShade/SymbolicHaskell | src/Math/Symbolic/Simplify2.hs | mit | collectMLike x = x | 18 | collectMLike x = x | 18 | collectMLike x = x | 18 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
toothbrush/diaspec | src/Diaspec/Backend/GenerateJava.hs | gpl-3.0 | wrapAG s = wrap_Specification
(sem_Specification s)
Inh_Specification{} | 89 | wrapAG s = wrap_Specification
(sem_Specification s)
Inh_Specification{} | 89 | wrapAG s = wrap_Specification
(sem_Specification s)
Inh_Specification{} | 89 | false | false | 0 | 7 | 24 | 25 | 12 | 13 | null | null |
RichCreameryButter/my-xmonad-ubuntu-conf | xmonad.hs | mit | -- changes the mod key to "super"
myFocusedBorderColor = "#cb4b16" | 66 | myFocusedBorderColor = "#cb4b16" | 32 | myFocusedBorderColor = "#cb4b16" | 32 | true | false | 1 | 5 | 9 | 11 | 4 | 7 | null | null |
hesiod/OpenGL | src/Graphics/Rendering/OpenGL/GL/FlushFinish.hs | bsd-3-clause | -- | 'finish' does not return until the effects of all previously called GL
-- commands are complete. Such effects include all changes to GL state, all
-- changes to connection state, and all changes to the frame buffer contents.
--
-- Note that 'finish' requires a round trip to the server.
finish :: IO ()
finish = glFinish | 327 | finish :: IO ()
finish = glFinish | 33 | finish = glFinish | 17 | true | true | 0 | 6 | 60 | 21 | 13 | 8 | null | null |
anton-dessiatov/stack | src/Stack/BuildPlan.hs | bsd-3-clause | selectPackageBuildPlan
:: Platform
-> CompilerVersion 'CVActual
-> Map PackageName Version
-> GenericPackageDescription
-> (Map PackageName (Map FlagName Bool), DepErrors)
selectPackageBuildPlan platform compiler pool gpd =
(selectPlan . limitSearchSpace . NonEmpty.map makePlan) flagCombinations
where
selectPlan :: NonEmpty (a, DepErrors) -> (a, DepErrors)
selectPlan = F.foldr1 fewerErrors
where
fewerErrors p1 p2
| nErrors p1 == 0 = p1
| nErrors p1 <= nErrors p2 = p1
| otherwise = p2
where nErrors = Map.size . snd
-- Avoid exponential complexity in flag combinations making us sad pandas.
-- See: https://github.com/commercialhaskell/stack/issues/543
limitSearchSpace :: NonEmpty a -> NonEmpty a
limitSearchSpace (x :| xs) = x :| take (maxFlagCombinations - 1) xs
where maxFlagCombinations = 128
makePlan :: [(FlagName, Bool)] -> (Map PackageName (Map FlagName Bool), DepErrors)
makePlan flags = checkPackageBuildPlan platform compiler pool (Map.fromList flags) gpd
flagCombinations :: NonEmpty [(FlagName, Bool)]
flagCombinations = mapM getOptions (genPackageFlags gpd)
where
getOptions :: C.Flag -> NonEmpty (FlagName, Bool)
getOptions f
| flagManual f = (fname, flagDefault f) :| []
| flagDefault f = (fname, True) :| [(fname, False)]
| otherwise = (fname, False) :| [(fname, True)]
where fname = (fromCabalFlagName . flagName) f
-- | Check whether with the given set of flags a package's dependency
-- constraints can be satisfied against a given build plan or pool of packages. | 1,692 | selectPackageBuildPlan
:: Platform
-> CompilerVersion 'CVActual
-> Map PackageName Version
-> GenericPackageDescription
-> (Map PackageName (Map FlagName Bool), DepErrors)
selectPackageBuildPlan platform compiler pool gpd =
(selectPlan . limitSearchSpace . NonEmpty.map makePlan) flagCombinations
where
selectPlan :: NonEmpty (a, DepErrors) -> (a, DepErrors)
selectPlan = F.foldr1 fewerErrors
where
fewerErrors p1 p2
| nErrors p1 == 0 = p1
| nErrors p1 <= nErrors p2 = p1
| otherwise = p2
where nErrors = Map.size . snd
-- Avoid exponential complexity in flag combinations making us sad pandas.
-- See: https://github.com/commercialhaskell/stack/issues/543
limitSearchSpace :: NonEmpty a -> NonEmpty a
limitSearchSpace (x :| xs) = x :| take (maxFlagCombinations - 1) xs
where maxFlagCombinations = 128
makePlan :: [(FlagName, Bool)] -> (Map PackageName (Map FlagName Bool), DepErrors)
makePlan flags = checkPackageBuildPlan platform compiler pool (Map.fromList flags) gpd
flagCombinations :: NonEmpty [(FlagName, Bool)]
flagCombinations = mapM getOptions (genPackageFlags gpd)
where
getOptions :: C.Flag -> NonEmpty (FlagName, Bool)
getOptions f
| flagManual f = (fname, flagDefault f) :| []
| flagDefault f = (fname, True) :| [(fname, False)]
| otherwise = (fname, False) :| [(fname, True)]
where fname = (fromCabalFlagName . flagName) f
-- | Check whether with the given set of flags a package's dependency
-- constraints can be satisfied against a given build plan or pool of packages. | 1,692 | selectPackageBuildPlan platform compiler pool gpd =
(selectPlan . limitSearchSpace . NonEmpty.map makePlan) flagCombinations
where
selectPlan :: NonEmpty (a, DepErrors) -> (a, DepErrors)
selectPlan = F.foldr1 fewerErrors
where
fewerErrors p1 p2
| nErrors p1 == 0 = p1
| nErrors p1 <= nErrors p2 = p1
| otherwise = p2
where nErrors = Map.size . snd
-- Avoid exponential complexity in flag combinations making us sad pandas.
-- See: https://github.com/commercialhaskell/stack/issues/543
limitSearchSpace :: NonEmpty a -> NonEmpty a
limitSearchSpace (x :| xs) = x :| take (maxFlagCombinations - 1) xs
where maxFlagCombinations = 128
makePlan :: [(FlagName, Bool)] -> (Map PackageName (Map FlagName Bool), DepErrors)
makePlan flags = checkPackageBuildPlan platform compiler pool (Map.fromList flags) gpd
flagCombinations :: NonEmpty [(FlagName, Bool)]
flagCombinations = mapM getOptions (genPackageFlags gpd)
where
getOptions :: C.Flag -> NonEmpty (FlagName, Bool)
getOptions f
| flagManual f = (fname, flagDefault f) :| []
| flagDefault f = (fname, True) :| [(fname, False)]
| otherwise = (fname, False) :| [(fname, True)]
where fname = (fromCabalFlagName . flagName) f
-- | Check whether with the given set of flags a package's dependency
-- constraints can be satisfied against a given build plan or pool of packages. | 1,500 | false | true | 0 | 14 | 416 | 476 | 244 | 232 | null | null |
scott-fleischman/greek-grammar | haskell/greek-grammar/src/Data/Unicode/DecomposeChar.hs | mit | decomposeChar '\x1F1A' = "\x0395\x0313\x0300" | 45 | decomposeChar '\x1F1A' = "\x0395\x0313\x0300" | 45 | decomposeChar '\x1F1A' = "\x0395\x0313\x0300" | 45 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
tychon/phrases | BasicUI.hs | mit | replaceEntry :: SEntry -> Storage -> Storage
replaceEntry repl s@(Storage _ _ entries) =
s{ entries=(replaceEntry' repl entries) } | 132 | replaceEntry :: SEntry -> Storage -> Storage
replaceEntry repl s@(Storage _ _ entries) =
s{ entries=(replaceEntry' repl entries) } | 132 | replaceEntry repl s@(Storage _ _ entries) =
s{ entries=(replaceEntry' repl entries) } | 87 | false | true | 5 | 7 | 20 | 58 | 29 | 29 | null | null |
brendanhay/gogol | gogol-compute/gen/Network/Google/Resource/Compute/PublicAdvertisedPrefixes/List.hs | mpl-2.0 | -- | A filter expression that filters resources listed in the response. The
-- expression must specify the field name, a comparison operator, and the
-- value that you want to use for filtering. The value must be a string, a
-- number, or a boolean. The comparison operator must be either \`=\`,
-- \`!=\`, \`>\`, or \`\<\`. For example, if you are filtering Compute
-- Engine instances, you can exclude instances named \`example-instance\`
-- by specifying \`name != example-instance\`. You can also filter nested
-- fields. For example, you could specify \`scheduling.automaticRestart =
-- false\` to include instances only if they are not scheduled for
-- automatic restarts. You can use filtering on nested fields to filter
-- based on resource labels. To filter on multiple expressions, provide
-- each separate expression within parentheses. For example: \`\`\`
-- (scheduling.automaticRestart = true) (cpuPlatform = \"Intel Skylake\")
-- \`\`\` By default, each expression is an \`AND\` expression. However,
-- you can include \`AND\` and \`OR\` expressions explicitly. For example:
-- \`\`\` (cpuPlatform = \"Intel Skylake\") OR (cpuPlatform = \"Intel
-- Broadwell\") AND (scheduling.automaticRestart = true) \`\`\`
paplFilter :: Lens' PublicAdvertisedPrefixesList (Maybe Text)
paplFilter
= lens _paplFilter (\ s a -> s{_paplFilter = a}) | 1,347 | paplFilter :: Lens' PublicAdvertisedPrefixesList (Maybe Text)
paplFilter
= lens _paplFilter (\ s a -> s{_paplFilter = a}) | 123 | paplFilter
= lens _paplFilter (\ s a -> s{_paplFilter = a}) | 61 | true | true | 0 | 9 | 203 | 64 | 41 | 23 | null | null |
garetxe/cabal | cabal-install/Distribution/Client/Dependency/Modular/Linking.hs | bsd-3-clause | pickPOption :: QPN -> POption -> FlaggedDeps comp QPN -> UpdateState ()
pickPOption qpn (POption i Nothing) _deps = pickConcrete qpn i | 137 | pickPOption :: QPN -> POption -> FlaggedDeps comp QPN -> UpdateState ()
pickPOption qpn (POption i Nothing) _deps = pickConcrete qpn i | 137 | pickPOption qpn (POption i Nothing) _deps = pickConcrete qpn i | 65 | false | true | 0 | 9 | 24 | 53 | 25 | 28 | null | null |
iamkingmaker/HLearn | src/HLearn/Optimization/Multivariate.hs | bsd-3-clause | backtracking ::
( Hilbert v
, Optimizable v
) => StopCondition_ (Backtracking v)
-> MultivariateLineSearch v
backtracking stops f f' x0 f'x0 stepGuess = {-# SCC backtracking #-} do
let g y = {-# SCC backtracking_g #-} f $ x0 + y *. f'x0
let grow=2.1
fmap _bt_x $ iterate (step_backtracking 0.5 f f')
(Backtracking
{ _bt_x = (grow*stepGuess)
, _bt_fx = g (grow*stepGuess)
, _bt_f'x = grow *. (f' $ x0 + grow*stepGuess *. f'x0)
, _init_dir = f'x0
, _init_x = x0
, _init_fx = f x0
, _init_f'x = f'x0
})
stops | 648 | backtracking ::
( Hilbert v
, Optimizable v
) => StopCondition_ (Backtracking v)
-> MultivariateLineSearch v
backtracking stops f f' x0 f'x0 stepGuess = {-# SCC backtracking #-} do
let g y = {-# SCC backtracking_g #-} f $ x0 + y *. f'x0
let grow=2.1
fmap _bt_x $ iterate (step_backtracking 0.5 f f')
(Backtracking
{ _bt_x = (grow*stepGuess)
, _bt_fx = g (grow*stepGuess)
, _bt_f'x = grow *. (f' $ x0 + grow*stepGuess *. f'x0)
, _init_dir = f'x0
, _init_x = x0
, _init_fx = f x0
, _init_f'x = f'x0
})
stops | 648 | backtracking stops f f' x0 f'x0 stepGuess = {-# SCC backtracking #-} do
let g y = {-# SCC backtracking_g #-} f $ x0 + y *. f'x0
let grow=2.1
fmap _bt_x $ iterate (step_backtracking 0.5 f f')
(Backtracking
{ _bt_x = (grow*stepGuess)
, _bt_fx = g (grow*stepGuess)
, _bt_f'x = grow *. (f' $ x0 + grow*stepGuess *. f'x0)
, _init_dir = f'x0
, _init_x = x0
, _init_fx = f x0
, _init_f'x = f'x0
})
stops | 521 | false | true | 0 | 17 | 237 | 207 | 109 | 98 | null | null |
tavisrudd/ghcjs-base | JavaScript/TypedArray/DataView.hs | mit | getUint16LE, getUint16BE, unsafeGetUint16LE, unsafeGetUint16BE
:: Int -> DataView -> Word16
getUint16LE idx dv = I.js_i_getUint16LE idx dv | 152 | getUint16LE, getUint16BE, unsafeGetUint16LE, unsafeGetUint16BE
:: Int -> DataView -> Word16
getUint16LE idx dv = I.js_i_getUint16LE idx dv | 152 | getUint16LE idx dv = I.js_i_getUint16LE idx dv | 58 | false | true | 4 | 6 | 30 | 44 | 21 | 23 | null | null |
bitemyapp/hips | Hips.hs | bsd-3-clause | failWith ∷ IO α → IO β
failWith a = a >> (exitWith =<< exitFailure) | 67 | failWith ∷ IO α → IO β
failWith a = a >> (exitWith =<< exitFailure) | 67 | failWith a = a >> (exitWith =<< exitFailure) | 44 | false | true | 0 | 7 | 14 | 35 | 17 | 18 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.