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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
NikolayS/postgrest | test/SpecHelper.hs | mit | clearTable :: Text -> IO ()
clearTable table = do
pool <- testPool
void . liftIO $ H.session pool $ H.tx Nothing $
H.unitEx $ B.Stmt ("truncate table test." <> table <> " cascade") V.empty True | 201 | clearTable :: Text -> IO ()
clearTable table = do
pool <- testPool
void . liftIO $ H.session pool $ H.tx Nothing $
H.unitEx $ B.Stmt ("truncate table test." <> table <> " cascade") V.empty True | 201 | clearTable table = do
pool <- testPool
void . liftIO $ H.session pool $ H.tx Nothing $
H.unitEx $ B.Stmt ("truncate table test." <> table <> " cascade") V.empty True | 173 | false | true | 0 | 13 | 43 | 92 | 42 | 50 | null | null |
candidtim/euler | src/Problem18.hs | bsd-3-clause | -- in (head.head $ xss) + maxTrianglePathSum' sub
-- |Weight of a triangle is sum of all of its items
weight :: [[Int]] -> Int
weight xss = foldl addRow 0 xss
where addRow acc row = acc + sum row | 198 | weight :: [[Int]] -> Int
weight xss = foldl addRow 0 xss
where addRow acc row = acc + sum row | 95 | weight xss = foldl addRow 0 xss
where addRow acc row = acc + sum row | 70 | true | true | 0 | 8 | 43 | 56 | 28 | 28 | null | null |
greydot/dns | Network/DNS/Encode.hs | bsd-3-clause | putQuestion :: Question -> SPut
putQuestion Question{..} = putDomain qname
<> put16 (typeToInt qtype)
<> put16 1 | 166 | putQuestion :: Question -> SPut
putQuestion Question{..} = putDomain qname
<> put16 (typeToInt qtype)
<> put16 1 | 166 | putQuestion Question{..} = putDomain qname
<> put16 (typeToInt qtype)
<> put16 1 | 134 | false | true | 0 | 9 | 70 | 47 | 22 | 25 | null | null |
jdnavarro/graphql-haskell | tests/Test/StarWars/Data.hs | bsd-3-clause | getHuman :: Alternative f => ID -> f Character
getHuman = fmap Right . getHuman' | 80 | getHuman :: Alternative f => ID -> f Character
getHuman = fmap Right . getHuman' | 80 | getHuman = fmap Right . getHuman' | 33 | false | true | 0 | 7 | 14 | 32 | 15 | 17 | null | null |
christiaanb/cabal | Cabal/Distribution/Simple/Build.hs | bsd-3-clause | benchmarkExeV10asExe Benchmark{} _ = error "benchmarkExeV10asExe: wrong kind" | 77 | benchmarkExeV10asExe Benchmark{} _ = error "benchmarkExeV10asExe: wrong kind" | 77 | benchmarkExeV10asExe Benchmark{} _ = error "benchmarkExeV10asExe: wrong kind" | 77 | false | false | 0 | 6 | 7 | 18 | 8 | 10 | null | null |
Lotterleben/meisel.hs | src/Meisel.hs | gpl-3.0 | -- kg
gravitation :: Double
gravitation = 66.743*10**(-12) | 58 | gravitation :: Double
gravitation = 66.743*10**(-12) | 52 | gravitation = 66.743*10**(-12) | 30 | true | true | 0 | 7 | 7 | 25 | 14 | 11 | null | null |
AlexanderPankiv/ghc | compiler/basicTypes/Id.hs | bsd-3-clause | setIdSpecialisation :: Id -> RuleInfo -> Id
setIdSpecialisation id spec_info = modifyIdInfo (`setRuleInfo` spec_info) id | 120 | setIdSpecialisation :: Id -> RuleInfo -> Id
setIdSpecialisation id spec_info = modifyIdInfo (`setRuleInfo` spec_info) id | 120 | setIdSpecialisation id spec_info = modifyIdInfo (`setRuleInfo` spec_info) id | 76 | false | true | 0 | 6 | 14 | 35 | 19 | 16 | null | null |
vincenthz/hs-foundation | basement/Basement/PrimType.hs | bsd-3-clause | primOffsetRecastBytes (Offset o) = Offset (szA `Prelude.quot` o)
where !(CountOf szA) = primSizeInBytes (Proxy :: Proxy b)
| 125 | primOffsetRecastBytes (Offset o) = Offset (szA `Prelude.quot` o)
where !(CountOf szA) = primSizeInBytes (Proxy :: Proxy b)
| 125 | primOffsetRecastBytes (Offset o) = Offset (szA `Prelude.quot` o)
where !(CountOf szA) = primSizeInBytes (Proxy :: Proxy b)
| 125 | false | false | 0 | 8 | 19 | 56 | 28 | 28 | null | null |
bytbox/lhe.hs | Data/LHE.hs | mit | makeParticle :: [String] -> Particle
makeParticle (pdg:stat:m1:m2:c1:c2:px:py:pz:e:m:lt:spin:[]) = Particle
{ partPDG = read pdg
, status = statusFromInt $ read stat
, mothers = PBoth (read m1, read m2)
, iColor = (read c1, read c2)
, partPx = parseDouble px
, partPy = parseDouble py
, partPz = parseDouble pz
, partE = parseDouble e
, partM = parseDouble m
, lifetime = parseDouble lt
, spin = parseDouble spin
} | 471 | makeParticle :: [String] -> Particle
makeParticle (pdg:stat:m1:m2:c1:c2:px:py:pz:e:m:lt:spin:[]) = Particle
{ partPDG = read pdg
, status = statusFromInt $ read stat
, mothers = PBoth (read m1, read m2)
, iColor = (read c1, read c2)
, partPx = parseDouble px
, partPy = parseDouble py
, partPz = parseDouble pz
, partE = parseDouble e
, partM = parseDouble m
, lifetime = parseDouble lt
, spin = parseDouble spin
} | 471 | makeParticle (pdg:stat:m1:m2:c1:c2:px:py:pz:e:m:lt:spin:[]) = Particle
{ partPDG = read pdg
, status = statusFromInt $ read stat
, mothers = PBoth (read m1, read m2)
, iColor = (read c1, read c2)
, partPx = parseDouble px
, partPy = parseDouble py
, partPz = parseDouble pz
, partE = parseDouble e
, partM = parseDouble m
, lifetime = parseDouble lt
, spin = parseDouble spin
} | 434 | false | true | 0 | 20 | 128 | 208 | 110 | 98 | null | null |
plow-technologies/persistent | persistent/Database/Persist/Class/PersistEntity.hs | mit | -- | Convenience function for getting a free 'PersistField' instance
-- from a type with JSON instances.
--
--
-- Example usage in combination with 'fromPersistValueJSON':
--
-- @
-- instance PersistField MyData where
-- fromPersistValue = fromPersistValueJSON
-- toPersistValue = toPersistValueJSON
-- @
toPersistValueJSON :: ToJSON a => a -> PersistValue
toPersistValueJSON = PersistText . LT.toStrict . TB.toLazyText . encodeToTextBuilder . toJSON | 454 | toPersistValueJSON :: ToJSON a => a -> PersistValue
toPersistValueJSON = PersistText . LT.toStrict . TB.toLazyText . encodeToTextBuilder . toJSON | 145 | toPersistValueJSON = PersistText . LT.toStrict . TB.toLazyText . encodeToTextBuilder . toJSON | 93 | true | true | 0 | 9 | 66 | 53 | 32 | 21 | null | null |
fmapfmapfmap/amazonka | amazonka-devicefarm/test/Test/AWS/Gen/DeviceFarm.hs | mpl-2.0 | testListJobsResponse :: ListJobsResponse -> TestTree
testListJobsResponse = res
"ListJobsResponse"
"fixture/ListJobsResponse.proto"
deviceFarm
(Proxy :: Proxy ListJobs) | 184 | testListJobsResponse :: ListJobsResponse -> TestTree
testListJobsResponse = res
"ListJobsResponse"
"fixture/ListJobsResponse.proto"
deviceFarm
(Proxy :: Proxy ListJobs) | 184 | testListJobsResponse = res
"ListJobsResponse"
"fixture/ListJobsResponse.proto"
deviceFarm
(Proxy :: Proxy ListJobs) | 131 | false | true | 0 | 7 | 30 | 33 | 17 | 16 | null | null |
laurencer/confluence-sync | vendor/http-streams/tests/SecureSocketsSnippet.hs | bsd-3-clause | example2 = do
get "https://api.github.com/users/afcowie" debugHandler
get "https://github.com/afcowie" debugHandler
--
-- Does nesting 'withOpenSSL' break things? Apparently not:
-- | 190 | example2 = do
get "https://api.github.com/users/afcowie" debugHandler
get "https://github.com/afcowie" debugHandler
--
-- Does nesting 'withOpenSSL' break things? Apparently not:
-- | 190 | example2 = do
get "https://api.github.com/users/afcowie" debugHandler
get "https://github.com/afcowie" debugHandler
--
-- Does nesting 'withOpenSSL' break things? Apparently not:
-- | 190 | false | false | 0 | 7 | 27 | 25 | 12 | 13 | null | null |
sinelaw/language-ecmascript | src/Language/ECMAScript3/Syntax.hs | bsd-3-clause | -- | Checks if the 'String' represents a valid identifier name
isValidIdentifierName :: String -> Bool
isValidIdentifierName name = case name of
"" -> False
(c:cs) -> isValidIdStart c && and (map isValidIdPart cs) && (not $ isReservedWord name)
-- | Checks if a string is in the list of reserved ECMAScript words | 317 | isValidIdentifierName :: String -> Bool
isValidIdentifierName name = case name of
"" -> False
(c:cs) -> isValidIdStart c && and (map isValidIdPart cs) && (not $ isReservedWord name)
-- | Checks if a string is in the list of reserved ECMAScript words | 254 | isValidIdentifierName name = case name of
"" -> False
(c:cs) -> isValidIdStart c && and (map isValidIdPart cs) && (not $ isReservedWord name)
-- | Checks if a string is in the list of reserved ECMAScript words | 214 | true | true | 0 | 12 | 57 | 75 | 38 | 37 | null | null |
mightybyte/reflex-dom-stubs | src/GHCJS/DOM/NamedNodeMap.hs | bsd-3-clause | gTypeNamedNodeMap = undefined | 29 | gTypeNamedNodeMap = undefined | 29 | gTypeNamedNodeMap = undefined | 29 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
alonho/bottle | src/Graphics/UI/GLFW/Events.hs | gpl-3.0 | translate ((modState, RawKeyEvent isPress key) : xs) =
GLFWKeyEvent (KeyEvent isPress modState Nothing key) : translate xs | 124 | translate ((modState, RawKeyEvent isPress key) : xs) =
GLFWKeyEvent (KeyEvent isPress modState Nothing key) : translate xs | 124 | translate ((modState, RawKeyEvent isPress key) : xs) =
GLFWKeyEvent (KeyEvent isPress modState Nothing key) : translate xs | 124 | false | false | 0 | 8 | 18 | 50 | 24 | 26 | null | null |
chadbrewbaker/shellcheck | ShellCheck/Parser.hs | gpl-3.0 | keywordSeparator =
eof <|> disregard whitespace <|> disregard (oneOf ";()[<>&|") | 84 | keywordSeparator =
eof <|> disregard whitespace <|> disregard (oneOf ";()[<>&|") | 84 | keywordSeparator =
eof <|> disregard whitespace <|> disregard (oneOf ";()[<>&|") | 84 | false | false | 4 | 8 | 13 | 32 | 14 | 18 | null | null |
JacquesCarette/literate-scientific-software | code/drasil-code/Language/Drasil/Code/Imperative/Build/AST.hs | bsd-2-clause | interpMM :: InterpreterCommand -> Runnable
interpMM = Runnable mainModuleFile nameOpts . Interpreter . makeS | 108 | interpMM :: InterpreterCommand -> Runnable
interpMM = Runnable mainModuleFile nameOpts . Interpreter . makeS | 108 | interpMM = Runnable mainModuleFile nameOpts . Interpreter . makeS | 65 | false | true | 0 | 7 | 13 | 28 | 14 | 14 | null | null |
andorp/grin | grin/src/AbstractInterpretation/HeapPointsTo/Pretty.hs | bsd-3-clause | prettyHPTFunction :: (Name, (R.TypeSet, Vector R.TypeSet)) -> Doc
prettyHPTFunction = prettyFunction | 100 | prettyHPTFunction :: (Name, (R.TypeSet, Vector R.TypeSet)) -> Doc
prettyHPTFunction = prettyFunction | 100 | prettyHPTFunction = prettyFunction | 34 | false | true | 2 | 8 | 10 | 35 | 18 | 17 | null | null |
pparkkin/eta | compiler/ETA/Prelude/PrimOp.hs | bsd-3-clause | primOpHasSideEffects ReadJDoubleArrayOp = True | 48 | primOpHasSideEffects ReadJDoubleArrayOp = True | 48 | primOpHasSideEffects ReadJDoubleArrayOp = True | 48 | false | false | 0 | 5 | 5 | 9 | 4 | 5 | null | null |
energyflowanalysis/efa-2.1 | src/EFA/Flow/State/Quantity.hs | bsd-3-clause | addSum _ Nothing Nothing = Nothing | 34 | addSum _ Nothing Nothing = Nothing | 34 | addSum _ Nothing Nothing = Nothing | 34 | false | false | 0 | 5 | 5 | 13 | 6 | 7 | null | null |
onponomarev/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | inststNodedown :: String
inststNodedown = Types.instanceStatusToRaw NodeDown | 76 | inststNodedown :: String
inststNodedown = Types.instanceStatusToRaw NodeDown | 76 | inststNodedown = Types.instanceStatusToRaw NodeDown | 51 | false | true | 0 | 6 | 6 | 22 | 9 | 13 | null | null |
luigy/stack | src/Stack/Package.hs | bsd-3-clause | -- | Get all dependencies of a package, including library,
-- executables, tests, benchmarks.
resolvePackageDescription :: PackageConfig
-> GenericPackageDescription
-> PackageDescription
resolvePackageDescription packageConfig (GenericPackageDescription desc defaultFlags mlib exes tests benches) =
desc {library =
fmap (resolveConditions rc updateLibDeps) mlib
,executables =
map (\(n, v) -> (resolveConditions rc updateExeDeps v){exeName=n})
exes
,testSuites =
map (\(n,v) -> (resolveConditions rc updateTestDeps v){testName=n})
tests
,benchmarks =
map (\(n,v) -> (resolveConditions rc updateBenchmarkDeps v){benchmarkName=n})
benches}
where flags =
M.union (packageConfigFlags packageConfig)
(flagMap defaultFlags)
rc = mkResolveConditions
(packageConfigCompilerVersion packageConfig)
(packageConfigPlatform packageConfig)
flags
updateLibDeps lib deps =
lib {libBuildInfo =
(libBuildInfo lib) {targetBuildDepends = deps}}
updateExeDeps exe deps =
exe {buildInfo =
(buildInfo exe) {targetBuildDepends = deps}}
updateTestDeps test deps =
test {testBuildInfo =
(testBuildInfo test) {targetBuildDepends = deps}
,testEnabled = packageConfigEnableTests packageConfig}
updateBenchmarkDeps benchmark deps =
benchmark {benchmarkBuildInfo =
(benchmarkBuildInfo benchmark) {targetBuildDepends = deps}
,benchmarkEnabled = packageConfigEnableBenchmarks packageConfig}
-- | Make a map from a list of flag specifications.
--
-- What is @flagManual@ for? | 1,870 | resolvePackageDescription :: PackageConfig
-> GenericPackageDescription
-> PackageDescription
resolvePackageDescription packageConfig (GenericPackageDescription desc defaultFlags mlib exes tests benches) =
desc {library =
fmap (resolveConditions rc updateLibDeps) mlib
,executables =
map (\(n, v) -> (resolveConditions rc updateExeDeps v){exeName=n})
exes
,testSuites =
map (\(n,v) -> (resolveConditions rc updateTestDeps v){testName=n})
tests
,benchmarks =
map (\(n,v) -> (resolveConditions rc updateBenchmarkDeps v){benchmarkName=n})
benches}
where flags =
M.union (packageConfigFlags packageConfig)
(flagMap defaultFlags)
rc = mkResolveConditions
(packageConfigCompilerVersion packageConfig)
(packageConfigPlatform packageConfig)
flags
updateLibDeps lib deps =
lib {libBuildInfo =
(libBuildInfo lib) {targetBuildDepends = deps}}
updateExeDeps exe deps =
exe {buildInfo =
(buildInfo exe) {targetBuildDepends = deps}}
updateTestDeps test deps =
test {testBuildInfo =
(testBuildInfo test) {targetBuildDepends = deps}
,testEnabled = packageConfigEnableTests packageConfig}
updateBenchmarkDeps benchmark deps =
benchmark {benchmarkBuildInfo =
(benchmarkBuildInfo benchmark) {targetBuildDepends = deps}
,benchmarkEnabled = packageConfigEnableBenchmarks packageConfig}
-- | Make a map from a list of flag specifications.
--
-- What is @flagManual@ for? | 1,776 | resolvePackageDescription packageConfig (GenericPackageDescription desc defaultFlags mlib exes tests benches) =
desc {library =
fmap (resolveConditions rc updateLibDeps) mlib
,executables =
map (\(n, v) -> (resolveConditions rc updateExeDeps v){exeName=n})
exes
,testSuites =
map (\(n,v) -> (resolveConditions rc updateTestDeps v){testName=n})
tests
,benchmarks =
map (\(n,v) -> (resolveConditions rc updateBenchmarkDeps v){benchmarkName=n})
benches}
where flags =
M.union (packageConfigFlags packageConfig)
(flagMap defaultFlags)
rc = mkResolveConditions
(packageConfigCompilerVersion packageConfig)
(packageConfigPlatform packageConfig)
flags
updateLibDeps lib deps =
lib {libBuildInfo =
(libBuildInfo lib) {targetBuildDepends = deps}}
updateExeDeps exe deps =
exe {buildInfo =
(buildInfo exe) {targetBuildDepends = deps}}
updateTestDeps test deps =
test {testBuildInfo =
(testBuildInfo test) {targetBuildDepends = deps}
,testEnabled = packageConfigEnableTests packageConfig}
updateBenchmarkDeps benchmark deps =
benchmark {benchmarkBuildInfo =
(benchmarkBuildInfo benchmark) {targetBuildDepends = deps}
,benchmarkEnabled = packageConfigEnableBenchmarks packageConfig}
-- | Make a map from a list of flag specifications.
--
-- What is @flagManual@ for? | 1,630 | true | true | 2 | 12 | 586 | 417 | 223 | 194 | null | null |
benkolera/phb | hs/Site/Internal.hs | mit | userOrIndex :: PhbHandler () -> PhbHandler ()
userOrIndex = requireUser auth notLoggedIn
where
notLoggedIn = do
p <- rqURI <$> getRequest
flashError "You must be logged in to view this page"
redirect $ "/login?andThen=" <> urlEncode p | 253 | userOrIndex :: PhbHandler () -> PhbHandler ()
userOrIndex = requireUser auth notLoggedIn
where
notLoggedIn = do
p <- rqURI <$> getRequest
flashError "You must be logged in to view this page"
redirect $ "/login?andThen=" <> urlEncode p | 253 | userOrIndex = requireUser auth notLoggedIn
where
notLoggedIn = do
p <- rqURI <$> getRequest
flashError "You must be logged in to view this page"
redirect $ "/login?andThen=" <> urlEncode p | 207 | false | true | 0 | 8 | 55 | 69 | 31 | 38 | null | null |
jaccokrijnen/leksah | src/IDE/Core/Types.hs | gpl-2.0 | -- | Gets the package name
ipdPackageName :: IDEPackage -> Text
ipdPackageName = T.pack . (\(PackageName s) -> s) . pkgName . ipdPackageId | 138 | ipdPackageName :: IDEPackage -> Text
ipdPackageName = T.pack . (\(PackageName s) -> s) . pkgName . ipdPackageId | 111 | ipdPackageName = T.pack . (\(PackageName s) -> s) . pkgName . ipdPackageId | 74 | true | true | 0 | 11 | 22 | 44 | 24 | 20 | null | null |
ezyang/hoopl | prototypes/RG.hs | bsd-3-clause | theFact :: Fact e f -> MaybeC e Label -> f
theFact f NothingC = f | 65 | theFact :: Fact e f -> MaybeC e Label -> f
theFact f NothingC = f | 65 | theFact f NothingC = f | 22 | false | true | 0 | 8 | 15 | 40 | 17 | 23 | null | null |
hanshoglund/sox2 | src/Sound/Sox2.hs | bsd-3-clause | newOutput :: Sox FilePath
newOutput = do
System.Process.system "mkdir -p /tmp/sox2"
(p,_) <- System.IO.Temp.openTempFile "/tmp/sox2" "sox2.wav"
return p | 159 | newOutput :: Sox FilePath
newOutput = do
System.Process.system "mkdir -p /tmp/sox2"
(p,_) <- System.IO.Temp.openTempFile "/tmp/sox2" "sox2.wav"
return p | 159 | newOutput = do
System.Process.system "mkdir -p /tmp/sox2"
(p,_) <- System.IO.Temp.openTempFile "/tmp/sox2" "sox2.wav"
return p | 133 | false | true | 0 | 9 | 24 | 51 | 25 | 26 | null | null |
CindyLinz/Haskell.js | trans/src/Desugar/CaseReorder.hs | mit | deCaseReorderBangType :: SymbolTableDataCon' l -> BangType l -> BangType l
deCaseReorderBangType a1 (BangedTy l) = BangedTy (id l) | 130 | deCaseReorderBangType :: SymbolTableDataCon' l -> BangType l -> BangType l
deCaseReorderBangType a1 (BangedTy l) = BangedTy (id l) | 130 | deCaseReorderBangType a1 (BangedTy l) = BangedTy (id l) | 55 | false | true | 0 | 7 | 17 | 48 | 22 | 26 | null | null |
mgold/package.elm-lang.org | src/backend/Routes.hs | bsd-3-clause | packages :: Snap ()
packages =
ifTop (redirect' "/" 301)
<|> route [ (":user/:name", package) ]
<|> serveDirectory "packages" | 137 | packages :: Snap ()
packages =
ifTop (redirect' "/" 301)
<|> route [ (":user/:name", package) ]
<|> serveDirectory "packages" | 137 | packages =
ifTop (redirect' "/" 301)
<|> route [ (":user/:name", package) ]
<|> serveDirectory "packages" | 117 | false | true | 4 | 7 | 30 | 57 | 28 | 29 | null | null |
AlexeyRaga/eta | compiler/ETA/CodeGen/Prim.hs | bsd-3-clause | simpleOp Int64Ge = Just $ typedCmp jlong ifge | 45 | simpleOp Int64Ge = Just $ typedCmp jlong ifge | 45 | simpleOp Int64Ge = Just $ typedCmp jlong ifge | 45 | false | false | 0 | 6 | 7 | 18 | 8 | 10 | null | null |
brendanhay/gogol | gogol-dataproc/gen/Network/Google/Resource/Dataproc/Projects/Locations/WorkflowTemplates/Delete.hs | mpl-2.0 | -- | Required. The resource name of the workflow template, as described in
-- https:\/\/cloud.google.com\/apis\/design\/resource_names. For
-- projects.regions.workflowTemplates.delete, the resource name of the
-- template has the following format:
-- projects\/{project_id}\/regions\/{region}\/workflowTemplates\/{template_id}
-- For projects.locations.workflowTemplates.instantiate, the resource name
-- of the template has the following format:
-- projects\/{project_id}\/locations\/{location}\/workflowTemplates\/{template_id}
plwtdName :: Lens' ProjectsLocationsWorkflowTemplatesDelete Text
plwtdName
= lens _plwtdName (\ s a -> s{_plwtdName = a}) | 654 | plwtdName :: Lens' ProjectsLocationsWorkflowTemplatesDelete Text
plwtdName
= lens _plwtdName (\ s a -> s{_plwtdName = a}) | 123 | plwtdName
= lens _plwtdName (\ s a -> s{_plwtdName = a}) | 58 | true | true | 0 | 9 | 64 | 49 | 29 | 20 | null | null |
fmapfmapfmap/amazonka | amazonka-codepipeline/test/Test/AWS/Gen/CodePipeline.hs | mpl-2.0 | testPutThirdPartyJobSuccessResult :: PutThirdPartyJobSuccessResult -> TestTree
testPutThirdPartyJobSuccessResult = req
"PutThirdPartyJobSuccessResult"
"fixture/PutThirdPartyJobSuccessResult.yaml" | 203 | testPutThirdPartyJobSuccessResult :: PutThirdPartyJobSuccessResult -> TestTree
testPutThirdPartyJobSuccessResult = req
"PutThirdPartyJobSuccessResult"
"fixture/PutThirdPartyJobSuccessResult.yaml" | 203 | testPutThirdPartyJobSuccessResult = req
"PutThirdPartyJobSuccessResult"
"fixture/PutThirdPartyJobSuccessResult.yaml" | 124 | false | true | 0 | 5 | 17 | 21 | 10 | 11 | null | null |
sarahn/ganeti | src/Ganeti/OpParams.hs | gpl-2.0 | -- | Default node parameters for group.
pGroupNodeParams :: Field
pGroupNodeParams = optionalField $ simpleField "ndparams" [t| UncheckedDict |] | 144 | pGroupNodeParams :: Field
pGroupNodeParams = optionalField $ simpleField "ndparams" [t| UncheckedDict |] | 104 | pGroupNodeParams = optionalField $ simpleField "ndparams" [t| UncheckedDict |] | 78 | true | true | 0 | 6 | 18 | 25 | 15 | 10 | null | null |
mydaum/cabal | Cabal/Distribution/Backpack/UnifyM.hs | bsd-3-clause | extendMooEnv :: MooEnv -> UnitIdUnique -> MooEnv
extendMooEnv (m, i) k = (IntMap.insert k (i + 1) m, i + 1) | 107 | extendMooEnv :: MooEnv -> UnitIdUnique -> MooEnv
extendMooEnv (m, i) k = (IntMap.insert k (i + 1) m, i + 1) | 107 | extendMooEnv (m, i) k = (IntMap.insert k (i + 1) m, i + 1) | 58 | false | true | 0 | 8 | 20 | 56 | 30 | 26 | null | null |
snoyberg/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | augmentName = varQual gHC_BASE (fsLit "augment") augmentIdKey | 70 | augmentName = varQual gHC_BASE (fsLit "augment") augmentIdKey | 70 | augmentName = varQual gHC_BASE (fsLit "augment") augmentIdKey | 70 | false | false | 0 | 7 | 15 | 19 | 9 | 10 | null | null |
NICTA/lets-lens | src/Lets/GetSetLens.hs | bsd-3-clause | -- | The set/get law of lenses. This function should always return @True@.
setgetLaw ::
Eq b =>
Lens a b
-> a
-> b
-> Bool
setgetLaw l a b =
get l (set l a b) == b | 175 | setgetLaw ::
Eq b =>
Lens a b
-> a
-> b
-> Bool
setgetLaw l a b =
get l (set l a b) == b | 100 | setgetLaw l a b =
get l (set l a b) == b | 42 | true | true | 0 | 10 | 51 | 64 | 30 | 34 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/course/2014-07-utrecht/src/Assignment3.hs | unlicense | -- * Exercise 5
-- Note : you could factor this by defining an "unbox" type class to generalize Sum and Product then use here.
fsum, fproduct :: (Foldable f, Num a) => f a -> a
fsum fa = let (Sum result) = foldMap Sum fa in result | 242 | fsum, fproduct :: (Foldable f, Num a) => f a -> a
fsum fa = let (Sum result) = foldMap Sum fa in result | 115 | fsum fa = let (Sum result) = foldMap Sum fa in result | 65 | true | true | 2 | 10 | 60 | 73 | 33 | 40 | null | null |
tibbe/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | callishOp DoubleLogOp = Just MO_F64_Log | 42 | callishOp DoubleLogOp = Just MO_F64_Log | 42 | callishOp DoubleLogOp = Just MO_F64_Log | 42 | false | false | 0 | 5 | 7 | 12 | 5 | 7 | null | null |
hvr/text | tests/Tests/Properties.hs | bsd-2-clause | t_replicate n = replicate m `eq` (unpackS . T.replicate m . packS)
where m = fromIntegral (n :: Word8) | 110 | t_replicate n = replicate m `eq` (unpackS . T.replicate m . packS)
where m = fromIntegral (n :: Word8) | 110 | t_replicate n = replicate m `eq` (unpackS . T.replicate m . packS)
where m = fromIntegral (n :: Word8) | 110 | false | false | 0 | 10 | 26 | 51 | 26 | 25 | null | null |
gencer/bond | compiler/src/Language/Bond/Parser.hs | mit | enum :: [Attribute] -> Parser Declaration
enum attr = Enum <$> asks currentNamespaces <*> pure attr <*> name <*> consts <* optional semi <?> "enum definition"
where
name = try (keyword "enum") *> identifier <?> "enum identifier"
consts = braces (semiOrCommaSepEnd1 constant <?> "enum constant")
constant = Constant <$> identifier <*> optional value
value = equal *> (fromIntegral <$> integer)
-- basic types parser | 433 | enum :: [Attribute] -> Parser Declaration
enum attr = Enum <$> asks currentNamespaces <*> pure attr <*> name <*> consts <* optional semi <?> "enum definition"
where
name = try (keyword "enum") *> identifier <?> "enum identifier"
consts = braces (semiOrCommaSepEnd1 constant <?> "enum constant")
constant = Constant <$> identifier <*> optional value
value = equal *> (fromIntegral <$> integer)
-- basic types parser | 433 | enum attr = Enum <$> asks currentNamespaces <*> pure attr <*> name <*> consts <* optional semi <?> "enum definition"
where
name = try (keyword "enum") *> identifier <?> "enum identifier"
consts = braces (semiOrCommaSepEnd1 constant <?> "enum constant")
constant = Constant <$> identifier <*> optional value
value = equal *> (fromIntegral <$> integer)
-- basic types parser | 391 | false | true | 0 | 11 | 82 | 133 | 66 | 67 | null | null |
mcschroeder/ctrie | Control/Concurrent/Map.hs | mit | compress _ x = return x | 23 | compress _ x = return x | 23 | compress _ x = return x | 23 | false | false | 1 | 5 | 5 | 15 | 6 | 9 | null | null |
MauriceIsAG/HaskellScratch | app/Main.hs | bsd-3-clause | combinations :: (Eq a) => Int -> [a] -> [[a]]
combinations 0 _ = [[]] | 69 | combinations :: (Eq a) => Int -> [a] -> [[a]]
combinations 0 _ = [[]] | 69 | combinations 0 _ = [[]] | 23 | false | true | 0 | 9 | 14 | 47 | 26 | 21 | null | null |
yogeshsajanikar/stl | stl/harness/Main.hs | mit | main :: IO Int
main = do
let tolerance = 0.001 :: Float
(path:_) <- getArgs
putStrLn $ "Parsing STL file: " ++ path
putStrLn $ "Default tolerance " ++ show tolerance
--run_ $ EB.enumFile path $$ streamSTL tolerance (E.printChunks False)
fs <- run_ $ EB.enumFile path $$ stlIterate tolerance
putStrLn $ "Num facets : " ++ show (Prelude.length fs)
-- putStrLn $ "Num facets : " ++ show (Prelude.length fs)
-- s <- readSTL tolerance path
-- putStrLn "Parsing complete"
-- case s of
-- Left e -> putStrLn $ show e
-- Right s' -> putStrLn $ "Num facets : " ++ show (numFacets s')
-- forM_ fs (putStrLn . show)
return 0 | 655 | main :: IO Int
main = do
let tolerance = 0.001 :: Float
(path:_) <- getArgs
putStrLn $ "Parsing STL file: " ++ path
putStrLn $ "Default tolerance " ++ show tolerance
--run_ $ EB.enumFile path $$ streamSTL tolerance (E.printChunks False)
fs <- run_ $ EB.enumFile path $$ stlIterate tolerance
putStrLn $ "Num facets : " ++ show (Prelude.length fs)
-- putStrLn $ "Num facets : " ++ show (Prelude.length fs)
-- s <- readSTL tolerance path
-- putStrLn "Parsing complete"
-- case s of
-- Left e -> putStrLn $ show e
-- Right s' -> putStrLn $ "Num facets : " ++ show (numFacets s')
-- forM_ fs (putStrLn . show)
return 0 | 655 | main = do
let tolerance = 0.001 :: Float
(path:_) <- getArgs
putStrLn $ "Parsing STL file: " ++ path
putStrLn $ "Default tolerance " ++ show tolerance
--run_ $ EB.enumFile path $$ streamSTL tolerance (E.printChunks False)
fs <- run_ $ EB.enumFile path $$ stlIterate tolerance
putStrLn $ "Num facets : " ++ show (Prelude.length fs)
-- putStrLn $ "Num facets : " ++ show (Prelude.length fs)
-- s <- readSTL tolerance path
-- putStrLn "Parsing complete"
-- case s of
-- Left e -> putStrLn $ show e
-- Right s' -> putStrLn $ "Num facets : " ++ show (numFacets s')
-- forM_ fs (putStrLn . show)
return 0 | 640 | false | true | 0 | 11 | 156 | 124 | 61 | 63 | null | null |
apvanzanten/learningMeAHaskell | note.hs | gpl-3.0 | readMode :: [String] -> IO ()
readMode args@((_:_:n):params) = do
let numNotes = tryParseInt n 1
notes <- getNotes
if numNotes < 0
then putStr $ concat $ take (-numNotes) notes
else putStr $ concat $ takeLast numNotes notes | 237 | readMode :: [String] -> IO ()
readMode args@((_:_:n):params) = do
let numNotes = tryParseInt n 1
notes <- getNotes
if numNotes < 0
then putStr $ concat $ take (-numNotes) notes
else putStr $ concat $ takeLast numNotes notes | 237 | readMode args@((_:_:n):params) = do
let numNotes = tryParseInt n 1
notes <- getNotes
if numNotes < 0
then putStr $ concat $ take (-numNotes) notes
else putStr $ concat $ takeLast numNotes notes | 207 | false | true | 0 | 11 | 52 | 114 | 57 | 57 | null | null |
christiaanb/ghc | compiler/typecheck/FamInst.hs | bsd-3-clause | tcInstNewTyCon_maybe :: TyCon -> [TcType] -> Maybe (TcType, TcCoercion)
tcInstNewTyCon_maybe tc tys = fmap (second TcCoercion) $
instNewTyCon_maybe tc tys | 184 | tcInstNewTyCon_maybe :: TyCon -> [TcType] -> Maybe (TcType, TcCoercion)
tcInstNewTyCon_maybe tc tys = fmap (second TcCoercion) $
instNewTyCon_maybe tc tys | 184 | tcInstNewTyCon_maybe tc tys = fmap (second TcCoercion) $
instNewTyCon_maybe tc tys | 112 | false | true | 0 | 8 | 49 | 54 | 27 | 27 | null | null |
flowbox-public/accelerate-cuda | Data/Array/Accelerate/CUDA/CodeGen/Stencil.hs | bsd-3-clause | mkStencil2'
:: forall aenv sh stencil1 stencil2 a b c.
(Stencil sh a stencil1, Stencil sh b stencil2, Elt c)
=> DeviceProperties
-> Bool -- are the source arrays the same extent?
-> Gamma aenv
-> CUFun2 aenv (stencil1 -> stencil2 -> c)
-> Boundary (CUExp aenv a)
-> Boundary (CUExp aenv b)
-> CUTranslSkel aenv (Array sh c)
mkStencil2' dev sameExtent aenv (CUFun2 dce1 dce2 f) boundary1 boundary2
= CUTranslSkel "stencil2" [cunit|
$esc:("#include <accelerate_cuda.h>")
$edecls:texIn
$edecls:texS1
$edecls:texS2
extern "C" __global__ void
stencil2
(
$params:argIn,
$params:argOut,
$params:argS1,
$params:argS2
)
{
const int shapeSize = $exp:(csize shOut);
const int gridSize = $exp:(gridSize dev);
int ix;
for ( ix = $exp:(threadIdx dev)
; ix < shapeSize
; ix += gridSize )
{
$items:(sh .=. cfromIndex shOut "ix" "tmp")
$items:stencilBody
}
}
|]
where
(texIn, argIn) = environment dev aenv
(argOut, shOut, setOut) = writeArray "Out" (undefined :: Array sh c)
(sh, _, _) = locals "sh" (undefined :: sh)
(xs,_,_) = locals "x" (undefined :: stencil1)
(ys,_,_) = locals "y" (undefined :: stencil2)
grp1 = "Stencil1"
grp2 = "Stencil2"
-- If the source arrays are the same extent, twiddle the names a bit so that
-- code generation refers to the same set of shape variables. Then, if there
-- are any duplicate calculations, hope that the CUDA compiler is smart
-- enough and spots this.
--
sh1 = grp1
sh2 | sameExtent = sh1
| otherwise = grp2
(dx1, dx2) = offsets2 (undefined :: Fun aenv (stencil1 -> stencil2 -> c))
(undefined :: OpenAcc aenv (Array sh a))
(undefined :: OpenAcc aenv (Array sh b))
border = zipWith max (borderRegion dx1) (borderRegion dx2)
(texS1, argS1, safeIndex1) = stencilAccess dev sameExtent True grp1 sh1 "w" "ix" dx1 boundary1 dce1
(_, _, unsafeIndex1) = stencilAccess dev sameExtent False grp1 sh1 "w" "ix" dx1 boundary1 dce1
(texS2, argS2, safeIndex2) = stencilAccess dev sameExtent True grp2 sh2 "z" "ix" dx2 boundary2 dce2
(_, _, unsafeIndex2) = stencilAccess dev sameExtent False grp2 sh2 "z" "ix" dx2 boundary2 dce2
stencilBody
| computeCapability dev < Compute 1 2 = with safeIndex1 safeIndex2
| otherwise =
[[citem| if ( __all( $exp:(insideRegion shOut border (map rvalue sh)) ) ) {
$items:(with unsafeIndex1 unsafeIndex2)
} else {
$items:(with safeIndex1 safeIndex2)
} |]]
where
with stencil1 stencil2 =
(dce1 xs .=. stencil1 sh) ++
(dce2 ys .=. stencil2 sh) ++
(setOut "ix" .=. f xs ys) | 3,230 | mkStencil2'
:: forall aenv sh stencil1 stencil2 a b c.
(Stencil sh a stencil1, Stencil sh b stencil2, Elt c)
=> DeviceProperties
-> Bool -- are the source arrays the same extent?
-> Gamma aenv
-> CUFun2 aenv (stencil1 -> stencil2 -> c)
-> Boundary (CUExp aenv a)
-> Boundary (CUExp aenv b)
-> CUTranslSkel aenv (Array sh c)
mkStencil2' dev sameExtent aenv (CUFun2 dce1 dce2 f) boundary1 boundary2
= CUTranslSkel "stencil2" [cunit|
$esc:("#include <accelerate_cuda.h>")
$edecls:texIn
$edecls:texS1
$edecls:texS2
extern "C" __global__ void
stencil2
(
$params:argIn,
$params:argOut,
$params:argS1,
$params:argS2
)
{
const int shapeSize = $exp:(csize shOut);
const int gridSize = $exp:(gridSize dev);
int ix;
for ( ix = $exp:(threadIdx dev)
; ix < shapeSize
; ix += gridSize )
{
$items:(sh .=. cfromIndex shOut "ix" "tmp")
$items:stencilBody
}
}
|]
where
(texIn, argIn) = environment dev aenv
(argOut, shOut, setOut) = writeArray "Out" (undefined :: Array sh c)
(sh, _, _) = locals "sh" (undefined :: sh)
(xs,_,_) = locals "x" (undefined :: stencil1)
(ys,_,_) = locals "y" (undefined :: stencil2)
grp1 = "Stencil1"
grp2 = "Stencil2"
-- If the source arrays are the same extent, twiddle the names a bit so that
-- code generation refers to the same set of shape variables. Then, if there
-- are any duplicate calculations, hope that the CUDA compiler is smart
-- enough and spots this.
--
sh1 = grp1
sh2 | sameExtent = sh1
| otherwise = grp2
(dx1, dx2) = offsets2 (undefined :: Fun aenv (stencil1 -> stencil2 -> c))
(undefined :: OpenAcc aenv (Array sh a))
(undefined :: OpenAcc aenv (Array sh b))
border = zipWith max (borderRegion dx1) (borderRegion dx2)
(texS1, argS1, safeIndex1) = stencilAccess dev sameExtent True grp1 sh1 "w" "ix" dx1 boundary1 dce1
(_, _, unsafeIndex1) = stencilAccess dev sameExtent False grp1 sh1 "w" "ix" dx1 boundary1 dce1
(texS2, argS2, safeIndex2) = stencilAccess dev sameExtent True grp2 sh2 "z" "ix" dx2 boundary2 dce2
(_, _, unsafeIndex2) = stencilAccess dev sameExtent False grp2 sh2 "z" "ix" dx2 boundary2 dce2
stencilBody
| computeCapability dev < Compute 1 2 = with safeIndex1 safeIndex2
| otherwise =
[[citem| if ( __all( $exp:(insideRegion shOut border (map rvalue sh)) ) ) {
$items:(with unsafeIndex1 unsafeIndex2)
} else {
$items:(with safeIndex1 safeIndex2)
} |]]
where
with stencil1 stencil2 =
(dce1 xs .=. stencil1 sh) ++
(dce2 ys .=. stencil2 sh) ++
(setOut "ix" .=. f xs ys) | 3,230 | mkStencil2' dev sameExtent aenv (CUFun2 dce1 dce2 f) boundary1 boundary2
= CUTranslSkel "stencil2" [cunit|
$esc:("#include <accelerate_cuda.h>")
$edecls:texIn
$edecls:texS1
$edecls:texS2
extern "C" __global__ void
stencil2
(
$params:argIn,
$params:argOut,
$params:argS1,
$params:argS2
)
{
const int shapeSize = $exp:(csize shOut);
const int gridSize = $exp:(gridSize dev);
int ix;
for ( ix = $exp:(threadIdx dev)
; ix < shapeSize
; ix += gridSize )
{
$items:(sh .=. cfromIndex shOut "ix" "tmp")
$items:stencilBody
}
}
|]
where
(texIn, argIn) = environment dev aenv
(argOut, shOut, setOut) = writeArray "Out" (undefined :: Array sh c)
(sh, _, _) = locals "sh" (undefined :: sh)
(xs,_,_) = locals "x" (undefined :: stencil1)
(ys,_,_) = locals "y" (undefined :: stencil2)
grp1 = "Stencil1"
grp2 = "Stencil2"
-- If the source arrays are the same extent, twiddle the names a bit so that
-- code generation refers to the same set of shape variables. Then, if there
-- are any duplicate calculations, hope that the CUDA compiler is smart
-- enough and spots this.
--
sh1 = grp1
sh2 | sameExtent = sh1
| otherwise = grp2
(dx1, dx2) = offsets2 (undefined :: Fun aenv (stencil1 -> stencil2 -> c))
(undefined :: OpenAcc aenv (Array sh a))
(undefined :: OpenAcc aenv (Array sh b))
border = zipWith max (borderRegion dx1) (borderRegion dx2)
(texS1, argS1, safeIndex1) = stencilAccess dev sameExtent True grp1 sh1 "w" "ix" dx1 boundary1 dce1
(_, _, unsafeIndex1) = stencilAccess dev sameExtent False grp1 sh1 "w" "ix" dx1 boundary1 dce1
(texS2, argS2, safeIndex2) = stencilAccess dev sameExtent True grp2 sh2 "z" "ix" dx2 boundary2 dce2
(_, _, unsafeIndex2) = stencilAccess dev sameExtent False grp2 sh2 "z" "ix" dx2 boundary2 dce2
stencilBody
| computeCapability dev < Compute 1 2 = with safeIndex1 safeIndex2
| otherwise =
[[citem| if ( __all( $exp:(insideRegion shOut border (map rvalue sh)) ) ) {
$items:(with unsafeIndex1 unsafeIndex2)
} else {
$items:(with safeIndex1 safeIndex2)
} |]]
where
with stencil1 stencil2 =
(dce1 xs .=. stencil1 sh) ++
(dce2 ys .=. stencil2 sh) ++
(setOut "ix" .=. f xs ys) | 2,831 | false | true | 6 | 16 | 1,207 | 716 | 365 | 351 | null | null |
mapinguari/SC_HS_Proxy | src/Proxy/Math/DeltaGraph.hs | mit | propCond (PlusND (n', _, n'', e, _)) n pi upsilon = n' /= n && n' /= n'' && propCond (MinusE e) n pi upsilon | 108 | propCond (PlusND (n', _, n'', e, _)) n pi upsilon = n' /= n && n' /= n'' && propCond (MinusE e) n pi upsilon | 108 | propCond (PlusND (n', _, n'', e, _)) n pi upsilon = n' /= n && n' /= n'' && propCond (MinusE e) n pi upsilon | 108 | false | false | 0 | 8 | 24 | 67 | 35 | 32 | null | null |
thielema/gitit | Network/Gitit/Feed.hs | gpl-2.0 | generateFeed :: FeedConfig -> Generator -> FileStore -> Maybe FilePath -> IO Feed
generateFeed cfg generator fs mbPath = do
now <- getCurrentTime
revs <- changeLog (fcFeedDays cfg) fs mbPath now
let home = fcBaseUrl cfg ++ "/"
-- TODO: 'nub . sort' `persons` - but no Eq or Ord instances!
persons = map authorToPerson $ nub $ sortBy (comparing authorName) $ map revAuthor revs
basefeed = generateEmptyfeed generator (fcTitle cfg) home mbPath persons (formatFeedTime now)
revisions = map (revisionToEntry home) revs
return basefeed {feedEntries = revisions}
-- | Get the last N days history. | 619 | generateFeed :: FeedConfig -> Generator -> FileStore -> Maybe FilePath -> IO Feed
generateFeed cfg generator fs mbPath = do
now <- getCurrentTime
revs <- changeLog (fcFeedDays cfg) fs mbPath now
let home = fcBaseUrl cfg ++ "/"
-- TODO: 'nub . sort' `persons` - but no Eq or Ord instances!
persons = map authorToPerson $ nub $ sortBy (comparing authorName) $ map revAuthor revs
basefeed = generateEmptyfeed generator (fcTitle cfg) home mbPath persons (formatFeedTime now)
revisions = map (revisionToEntry home) revs
return basefeed {feedEntries = revisions}
-- | Get the last N days history. | 619 | generateFeed cfg generator fs mbPath = do
now <- getCurrentTime
revs <- changeLog (fcFeedDays cfg) fs mbPath now
let home = fcBaseUrl cfg ++ "/"
-- TODO: 'nub . sort' `persons` - but no Eq or Ord instances!
persons = map authorToPerson $ nub $ sortBy (comparing authorName) $ map revAuthor revs
basefeed = generateEmptyfeed generator (fcTitle cfg) home mbPath persons (formatFeedTime now)
revisions = map (revisionToEntry home) revs
return basefeed {feedEntries = revisions}
-- | Get the last N days history. | 537 | false | true | 0 | 15 | 123 | 188 | 89 | 99 | null | null |
brendanhay/gogol | gogol-monitoring/gen/Network/Google/Monitoring/Types/Product.hs | mpl-2.0 | -- | The option\'s value packed in an Any message. If the value is a
-- primitive, the corresponding wrapper type defined in
-- google\/protobuf\/wrappers.proto should be used. If the value is an
-- enum, it should be stored as an int32 value using the
-- google.protobuf.Int32Value type.
oValue :: Lens' Option (Maybe OptionValue)
oValue = lens _oValue (\ s a -> s{_oValue = a}) | 379 | oValue :: Lens' Option (Maybe OptionValue)
oValue = lens _oValue (\ s a -> s{_oValue = a}) | 90 | oValue = lens _oValue (\ s a -> s{_oValue = a}) | 47 | true | true | 1 | 9 | 64 | 53 | 29 | 24 | null | null |
sordina/bramble | src/Bramble/IO.hs | mit | -- Unified errors
--
loadSchema :: FilePath -> EitherT ValidationError IO R.RamlFile
loadSchema = mapLeft ParseError . loadGeneric | 130 | loadSchema :: FilePath -> EitherT ValidationError IO R.RamlFile
loadSchema = mapLeft ParseError . loadGeneric | 109 | loadSchema = mapLeft ParseError . loadGeneric | 45 | true | true | 0 | 7 | 17 | 33 | 17 | 16 | null | null |
tolysz/prepare-ghcjs | spec-lts8/base/Text/Printf.hs | bsd-3-clause | stoi :: String -> (Int, String)
stoi cs =
let (as, cs') = span isDigit cs in
case as of
"" -> (0, cs')
_ -> (read as, cs')
-- Figure out the FormatAdjustment, given:
-- width, precision, left-adjust, zero-fill | 224 | stoi :: String -> (Int, String)
stoi cs =
let (as, cs') = span isDigit cs in
case as of
"" -> (0, cs')
_ -> (read as, cs')
-- Figure out the FormatAdjustment, given:
-- width, precision, left-adjust, zero-fill | 224 | stoi cs =
let (as, cs') = span isDigit cs in
case as of
"" -> (0, cs')
_ -> (read as, cs')
-- Figure out the FormatAdjustment, given:
-- width, precision, left-adjust, zero-fill | 192 | false | true | 0 | 12 | 54 | 86 | 44 | 42 | null | null |
liwanwei/pandoc | src/Text/Pandoc/Readers/Markdown.hs | gpl-2.0 | parenthesizedChars :: MarkdownParser [Char]
parenthesizedChars = do
result <- charsInBalanced '(' ')' litChar
return $ '(' : result ++ ")"
-- source for a link, with optional title | 185 | parenthesizedChars :: MarkdownParser [Char]
parenthesizedChars = do
result <- charsInBalanced '(' ')' litChar
return $ '(' : result ++ ")"
-- source for a link, with optional title | 185 | parenthesizedChars = do
result <- charsInBalanced '(' ')' litChar
return $ '(' : result ++ ")"
-- source for a link, with optional title | 141 | false | true | 0 | 9 | 32 | 47 | 23 | 24 | null | null |
kawu/skladnica-with-walenty | src/NLP/Skladnica/Walenty/Search.hs | bsd-2-clause | agreeNumQ :: W.Agree W.Number -> Expr S.Node
agreeNumQ agreeNum = case agreeNum of
W.Agree -> Satisfy2 $ \parent child -> isJust $ do
x <- getAttr liczba parent
y <- getAttr liczba child
guard $ x == y
W.Value v -> hasAttr liczba $ liczbaSKL v
-- W.Value v -> B True
-- | Check if the node is a terminal node with one of the given base values. | 363 | agreeNumQ :: W.Agree W.Number -> Expr S.Node
agreeNumQ agreeNum = case agreeNum of
W.Agree -> Satisfy2 $ \parent child -> isJust $ do
x <- getAttr liczba parent
y <- getAttr liczba child
guard $ x == y
W.Value v -> hasAttr liczba $ liczbaSKL v
-- W.Value v -> B True
-- | Check if the node is a terminal node with one of the given base values. | 363 | agreeNumQ agreeNum = case agreeNum of
W.Agree -> Satisfy2 $ \parent child -> isJust $ do
x <- getAttr liczba parent
y <- getAttr liczba child
guard $ x == y
W.Value v -> hasAttr liczba $ liczbaSKL v
-- W.Value v -> B True
-- | Check if the node is a terminal node with one of the given base values. | 318 | false | true | 4 | 11 | 88 | 116 | 54 | 62 | null | null |
OpenXT/idl | rpcgen/Backend/Haskell.hs | gpl-2.0 | outputClientFile :: Input -> String
outputClientFile input =
camelise (objectname input) ++ "Client.hs" | 107 | outputClientFile :: Input -> String
outputClientFile input =
camelise (objectname input) ++ "Client.hs" | 107 | outputClientFile input =
camelise (objectname input) ++ "Client.hs" | 71 | false | true | 0 | 8 | 16 | 31 | 15 | 16 | null | null |
karknu/rws | src/IPv6.hs | bsd-3-clause | ipv6ToPktStr :: IPv6 -> String
ipv6ToPktStr ip = "ipv6 ver=" ++ show (ipv6Ver ip) ++ " tcl=" ++ show (ipv6Tcl ip) ++
" flow=" ++ show (ipv6Flow ip) ++ " len=" ++ show (ipv6Length ip) ++
" nh=" ++ show (ipv6Nh ip) ++ " hl=" ++ show (ipv6Hl ip) ++
" src=" ++ show (ipv6Src ip) ++ " dst=" ++ show (ipv6Dst ip) | 360 | ipv6ToPktStr :: IPv6 -> String
ipv6ToPktStr ip = "ipv6 ver=" ++ show (ipv6Ver ip) ++ " tcl=" ++ show (ipv6Tcl ip) ++
" flow=" ++ show (ipv6Flow ip) ++ " len=" ++ show (ipv6Length ip) ++
" nh=" ++ show (ipv6Nh ip) ++ " hl=" ++ show (ipv6Hl ip) ++
" src=" ++ show (ipv6Src ip) ++ " dst=" ++ show (ipv6Dst ip) | 360 | ipv6ToPktStr ip = "ipv6 ver=" ++ show (ipv6Ver ip) ++ " tcl=" ++ show (ipv6Tcl ip) ++
" flow=" ++ show (ipv6Flow ip) ++ " len=" ++ show (ipv6Length ip) ++
" nh=" ++ show (ipv6Nh ip) ++ " hl=" ++ show (ipv6Hl ip) ++
" src=" ++ show (ipv6Src ip) ++ " dst=" ++ show (ipv6Dst ip) | 329 | false | true | 2 | 15 | 116 | 156 | 72 | 84 | null | null |
utdemir/wai | wai-app-static/Network/Wai/Application/Static.hs | mit | filterButLast f (x:xs)
| f x = x : filterButLast f xs
| otherwise = filterButLast f xs | 94 | filterButLast f (x:xs)
| f x = x : filterButLast f xs
| otherwise = filterButLast f xs | 94 | filterButLast f (x:xs)
| f x = x : filterButLast f xs
| otherwise = filterButLast f xs | 94 | false | false | 1 | 8 | 25 | 48 | 22 | 26 | null | null |
aurapm/aura | aura/lib/Aura/Languages.hs | gpl-3.0 | -- \32
langFromLocale :: Text -> Maybe Language
langFromLocale = T.take 2 >>> \case
"ja" -> Just Japanese
"pl" -> Just Polish
"hr" -> Just Croatian
"sv" -> Just Swedish
"de" -> Just German
"es" -> Just Spanish
"pt" -> Just Portuguese
"fr" -> Just French
"ru" -> Just Russian
"it" -> Just Italian
"sr" -> Just Serbian
"nb" -> Just Norwegian
"id" -> Just Indonesia
"zh" -> Just Chinese
"eo" -> Just Esperanto
"nl" -> Just Dutch
"en" -> Just English
_ -> Nothing
----------------------
-- Aura/Core functions
----------------------
-- NEEDS TRANSLATION | 590 | langFromLocale :: Text -> Maybe Language
langFromLocale = T.take 2 >>> \case
"ja" -> Just Japanese
"pl" -> Just Polish
"hr" -> Just Croatian
"sv" -> Just Swedish
"de" -> Just German
"es" -> Just Spanish
"pt" -> Just Portuguese
"fr" -> Just French
"ru" -> Just Russian
"it" -> Just Italian
"sr" -> Just Serbian
"nb" -> Just Norwegian
"id" -> Just Indonesia
"zh" -> Just Chinese
"eo" -> Just Esperanto
"nl" -> Just Dutch
"en" -> Just English
_ -> Nothing
----------------------
-- Aura/Core functions
----------------------
-- NEEDS TRANSLATION | 582 | langFromLocale = T.take 2 >>> \case
"ja" -> Just Japanese
"pl" -> Just Polish
"hr" -> Just Croatian
"sv" -> Just Swedish
"de" -> Just German
"es" -> Just Spanish
"pt" -> Just Portuguese
"fr" -> Just French
"ru" -> Just Russian
"it" -> Just Italian
"sr" -> Just Serbian
"nb" -> Just Norwegian
"id" -> Just Indonesia
"zh" -> Just Chinese
"eo" -> Just Esperanto
"nl" -> Just Dutch
"en" -> Just English
_ -> Nothing
----------------------
-- Aura/Core functions
----------------------
-- NEEDS TRANSLATION | 541 | true | true | 0 | 9 | 133 | 193 | 90 | 103 | null | null |
scravy/nicify-lib | src/Text/Nicify.hs | mit | escape :: Parser Char
escape = do
char '\\'
c <- anyChar
case c of
'n' -> return '\n'
'r' -> return '\r'
't' -> return '\t'
any -> return any | 185 | escape :: Parser Char
escape = do
char '\\'
c <- anyChar
case c of
'n' -> return '\n'
'r' -> return '\r'
't' -> return '\t'
any -> return any | 185 | escape = do
char '\\'
c <- anyChar
case c of
'n' -> return '\n'
'r' -> return '\r'
't' -> return '\t'
any -> return any | 163 | false | true | 0 | 11 | 74 | 76 | 32 | 44 | null | null |
chadbrewbaker/combinat | Math/Combinat/Permutations.hs | bsd-3-clause | permutationsNaive :: Int -> [[Int]]
_permutationsNaive 0 = [[]]
| 66 | _permutationsNaive :: Int -> [[Int]]
_permutationsNaive 0 = [[]] | 64 | _permutationsNaive 0 = [[]] | 27 | false | true | 0 | 7 | 11 | 29 | 16 | 13 | null | null |
altschuler/kite | src/Kite/Syntax.hs | mit | --- Pretty printing
-- | Free types in nodes
free f@(PTypeVar _) = [f] | 71 | free f@(PTypeVar _) = [f] | 25 | free f@(PTypeVar _) = [f] | 25 | true | false | 0 | 8 | 14 | 23 | 13 | 10 | null | null |
gcampax/ghc | compiler/coreSyn/CoreUtils.hs | bsd-3-clause | bindStats (Rec prs) = sumCS (\(v,r) -> bindingStats v r) prs | 63 | bindStats (Rec prs) = sumCS (\(v,r) -> bindingStats v r) prs | 63 | bindStats (Rec prs) = sumCS (\(v,r) -> bindingStats v r) prs | 63 | false | false | 0 | 8 | 13 | 40 | 20 | 20 | null | null |
apunktbau/co4 | test/CO4/Thesis/WCB_MatrixStandalone.hs | gpl-3.0 | costM :: Energy -> List Base -> List (List Energy)
costM zero p =
let addX m = append' m (Conss (map' (\x -> zero) (head' m)) Nill)
dropY m = map' (\row -> Conss zero row) m
in
gap Z zero (dropY (addX
(for (zipNats p) (\zip1 -> case zip1 of
Pair i x -> for (zipNats p) (\zip2 -> case zip2 of
Pair j y -> case ltN i j of
False -> zero
True -> cost x y))))) | 423 | costM :: Energy -> List Base -> List (List Energy)
costM zero p =
let addX m = append' m (Conss (map' (\x -> zero) (head' m)) Nill)
dropY m = map' (\row -> Conss zero row) m
in
gap Z zero (dropY (addX
(for (zipNats p) (\zip1 -> case zip1 of
Pair i x -> for (zipNats p) (\zip2 -> case zip2 of
Pair j y -> case ltN i j of
False -> zero
True -> cost x y))))) | 423 | costM zero p =
let addX m = append' m (Conss (map' (\x -> zero) (head' m)) Nill)
dropY m = map' (\row -> Conss zero row) m
in
gap Z zero (dropY (addX
(for (zipNats p) (\zip1 -> case zip1 of
Pair i x -> for (zipNats p) (\zip2 -> case zip2 of
Pair j y -> case ltN i j of
False -> zero
True -> cost x y))))) | 372 | false | true | 0 | 28 | 148 | 227 | 111 | 116 | null | null |
Michaelt293/isotope | src/Isotope/Parsers.hs | gpl-3.0 | empiricalFormula :: Parser EmpiricalFormula
empiricalFormula = mkEmpiricalFormula <$> many subFormula | 101 | empiricalFormula :: Parser EmpiricalFormula
empiricalFormula = mkEmpiricalFormula <$> many subFormula | 101 | empiricalFormula = mkEmpiricalFormula <$> many subFormula | 57 | false | true | 0 | 6 | 9 | 21 | 10 | 11 | null | null |
coursestitch/coursestitch-api | lib/CourseStitch/Handlers/Relationship.hs | apache-2.0 | relationships :: RunDB -> ActionM ()
relationships runDB = do
relationshipList <- runDB getRelationships
content relationshipList | 137 | relationships :: RunDB -> ActionM ()
relationships runDB = do
relationshipList <- runDB getRelationships
content relationshipList | 137 | relationships runDB = do
relationshipList <- runDB getRelationships
content relationshipList | 100 | false | true | 0 | 8 | 23 | 39 | 17 | 22 | null | null |
psibi/yesod | yesod-core/Yesod/Core/Handler.hs | mit | waiRequest :: MonadHandler m => m W.Request
waiRequest = reqWaiRequest <$> getRequest | 85 | waiRequest :: MonadHandler m => m W.Request
waiRequest = reqWaiRequest <$> getRequest | 85 | waiRequest = reqWaiRequest <$> getRequest | 41 | false | true | 0 | 7 | 11 | 27 | 13 | 14 | null | null |
rjackson90/cartographer | src/Path.hs | mit | plot :: Point -> Point -> Point -> Int -> [Point]
plot start control end samples =
[(
(quadratic_bezier t (fst start) (fst control) (fst end))
, (quadratic_bezier t (snd start) (snd control) (snd end)) )
| t <- ts]
where increment = 1.0 / (fromIntegral samples)
ts = map (\a -> (fromIntegral a) * increment) [0, 1..samples] :: [Float] | 375 | plot :: Point -> Point -> Point -> Int -> [Point]
plot start control end samples =
[(
(quadratic_bezier t (fst start) (fst control) (fst end))
, (quadratic_bezier t (snd start) (snd control) (snd end)) )
| t <- ts]
where increment = 1.0 / (fromIntegral samples)
ts = map (\a -> (fromIntegral a) * increment) [0, 1..samples] :: [Float] | 375 | plot start control end samples =
[(
(quadratic_bezier t (fst start) (fst control) (fst end))
, (quadratic_bezier t (snd start) (snd control) (snd end)) )
| t <- ts]
where increment = 1.0 / (fromIntegral samples)
ts = map (\a -> (fromIntegral a) * increment) [0, 1..samples] :: [Float] | 325 | false | true | 0 | 12 | 100 | 175 | 93 | 82 | null | null |
mapinguari/SC_HS_Proxy | src/Proxy/Query/Upgrade.hs | mit | mineralsBase PneumatizedCarapace = 150 | 38 | mineralsBase PneumatizedCarapace = 150 | 38 | mineralsBase PneumatizedCarapace = 150 | 38 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
ghc-android/ghc | compiler/prelude/TysPrim.hs | bsd-3-clause | doublePrimTyConName = mkPrimTc (fsLit "Double#") doublePrimTyConKey doublePrimTyCon | 93 | doublePrimTyConName = mkPrimTc (fsLit "Double#") doublePrimTyConKey doublePrimTyCon | 93 | doublePrimTyConName = mkPrimTc (fsLit "Double#") doublePrimTyConKey doublePrimTyCon | 93 | false | false | 0 | 7 | 16 | 19 | 9 | 10 | null | null |
andyarvanitis/Idris-dev | src/Idris/Core/Elaborate.hs | bsd-3-clause | start_unify :: Name -> Elab' aux ()
start_unify n = processTactic' (StartUnify n) | 81 | start_unify :: Name -> Elab' aux ()
start_unify n = processTactic' (StartUnify n) | 81 | start_unify n = processTactic' (StartUnify n) | 45 | false | true | 0 | 8 | 12 | 38 | 17 | 21 | null | null |
ku00/h-book | src/CurriedFunction.hs | bsd-3-clause | map' f (x:xs) = f x : map' f xs | 31 | map' f (x:xs) = f x : map' f xs | 31 | map' f (x:xs) = f x : map' f xs | 31 | false | false | 0 | 7 | 9 | 30 | 14 | 16 | null | null |
corngood/cabal | Cabal/Distribution/Simple/Utils.hs | bsd-3-clause | -- ------------------------------------------------------------
-- * Unicode stuff
-- ------------------------------------------------------------
-- This is a modification of the UTF8 code from gtk2hs and the
-- utf8-string package.
fromUTF8 :: String -> String
fromUTF8 [] = [] | 285 | fromUTF8 :: String -> String
fromUTF8 [] = [] | 49 | fromUTF8 [] = [] | 20 | true | true | 0 | 6 | 38 | 27 | 16 | 11 | null | null |
pranjaltale16/codeworld | codeworld-base/src/Internal/CodeWorld.hs | apache-2.0 | collaborationOf ::
( Number
, [Number] -> state
, (state, Number) -> state
, (state, Event, Number) -> state
, (state, Number) -> Picture)
-> Program
collaborationOf (players, initial, step, event, picture)
-- This is safe ONLY because codeworld-base does not export the
-- IO combinators that allow for choosing divergent clients.
=
CW.unsafeCollaborationOf
(toInt players)
(initial . randomsFrom)
(\dt state -> step (state, fromDouble dt))
(\player ev state -> event (state, fromCWEvent ev, fromInt player + 1))
(\player state -> toCWPic (picture (state, fromInt player + 1))) `catch`
reportError | 694 | collaborationOf ::
( Number
, [Number] -> state
, (state, Number) -> state
, (state, Event, Number) -> state
, (state, Number) -> Picture)
-> Program
collaborationOf (players, initial, step, event, picture)
-- This is safe ONLY because codeworld-base does not export the
-- IO combinators that allow for choosing divergent clients.
=
CW.unsafeCollaborationOf
(toInt players)
(initial . randomsFrom)
(\dt state -> step (state, fromDouble dt))
(\player ev state -> event (state, fromCWEvent ev, fromInt player + 1))
(\player state -> toCWPic (picture (state, fromInt player + 1))) `catch`
reportError | 694 | collaborationOf (players, initial, step, event, picture)
-- This is safe ONLY because codeworld-base does not export the
-- IO combinators that allow for choosing divergent clients.
=
CW.unsafeCollaborationOf
(toInt players)
(initial . randomsFrom)
(\dt state -> step (state, fromDouble dt))
(\player ev state -> event (state, fromCWEvent ev, fromInt player + 1))
(\player state -> toCWPic (picture (state, fromInt player + 1))) `catch`
reportError | 505 | false | true | 0 | 13 | 185 | 220 | 120 | 100 | null | null |
mydaum/cabal | cabal-install/Distribution/Client/ProjectPlanning.hs | bsd-3-clause | fromPrunedPackage :: PrunedPackage -> ElaboratedConfiguredPackage
fromPrunedPackage (PrunedPackage elab _) = elab | 113 | fromPrunedPackage :: PrunedPackage -> ElaboratedConfiguredPackage
fromPrunedPackage (PrunedPackage elab _) = elab | 113 | fromPrunedPackage (PrunedPackage elab _) = elab | 47 | false | true | 0 | 7 | 10 | 26 | 13 | 13 | null | null |
sdiehl/ghc | testsuite/tests/quotes/T9824.hs | bsd-3-clause | foo = [p| (x, y) |] | 19 | foo = [p| (x, y) |] | 19 | foo = [p| (x, y) |] | 19 | false | false | 1 | 5 | 5 | 14 | 7 | 7 | null | null |
phischu/fragnix | tests/packages/scotty/Data.Text.hs | bsd-3-clause | -- | /O(n)/ Group characters in a string according to a predicate.
groupBy :: (Char -> Char -> Bool) -> Text -> [Text]
groupBy p = loop
where
loop t@(Text arr off len)
| null t = []
| otherwise = text arr off n : loop (text arr (off+n) (len-n))
where Iter c d = iter t 0
n = d + findAIndexOrEnd (not . p c) (Text arr (off+d) (len-d))
-- | Returns the /array/ index (in units of 'Word16') at which a
-- character may be found. This is /not/ the same as the logical
-- index returned by e.g. 'findIndex'. | 555 | groupBy :: (Char -> Char -> Bool) -> Text -> [Text]
groupBy p = loop
where
loop t@(Text arr off len)
| null t = []
| otherwise = text arr off n : loop (text arr (off+n) (len-n))
where Iter c d = iter t 0
n = d + findAIndexOrEnd (not . p c) (Text arr (off+d) (len-d))
-- | Returns the /array/ index (in units of 'Word16') at which a
-- character may be found. This is /not/ the same as the logical
-- index returned by e.g. 'findIndex'. | 488 | groupBy p = loop
where
loop t@(Text arr off len)
| null t = []
| otherwise = text arr off n : loop (text arr (off+n) (len-n))
where Iter c d = iter t 0
n = d + findAIndexOrEnd (not . p c) (Text arr (off+d) (len-d))
-- | Returns the /array/ index (in units of 'Word16') at which a
-- character may be found. This is /not/ the same as the logical
-- index returned by e.g. 'findIndex'. | 436 | true | true | 1 | 11 | 156 | 204 | 98 | 106 | null | null |
laanwj/Purecoin | Purecoin/Core/Script.hs | mit | putOp OP_2DUP = putWord8 110 | 28 | putOp OP_2DUP = putWord8 110 | 28 | putOp OP_2DUP = putWord8 110 | 28 | false | false | 0 | 5 | 4 | 12 | 5 | 7 | null | null |
Axure/elm-compiler | src/Reporting/Result.hs | bsd-3-clause | merge :: (Maybe a, [b]) -> (Maybe a, [b]) -> (Maybe a, [b])
merge (dealiaser, warnings) (dealiaser', warnings') =
( dealiaser <|> dealiaser'
, warnings ++ warnings'
) | 172 | merge :: (Maybe a, [b]) -> (Maybe a, [b]) -> (Maybe a, [b])
merge (dealiaser, warnings) (dealiaser', warnings') =
( dealiaser <|> dealiaser'
, warnings ++ warnings'
) | 172 | merge (dealiaser, warnings) (dealiaser', warnings') =
( dealiaser <|> dealiaser'
, warnings ++ warnings'
) | 112 | false | true | 0 | 10 | 33 | 92 | 50 | 42 | null | null |
total-git/missingno | yesodMissingNo/Settings.hs | mit | -- The rest of this file contains settings which rarely need changing by a
-- user.
widgetFile :: String -> Q Exp
widgetFile = (if appReloadTemplates compileTimeAppSettings
then widgetFileReload
else widgetFileNoReload)
widgetFileSettings | 285 | widgetFile :: String -> Q Exp
widgetFile = (if appReloadTemplates compileTimeAppSettings
then widgetFileReload
else widgetFileNoReload)
widgetFileSettings | 200 | widgetFile = (if appReloadTemplates compileTimeAppSettings
then widgetFileReload
else widgetFileNoReload)
widgetFileSettings | 170 | true | true | 0 | 8 | 78 | 37 | 20 | 17 | null | null |
brendanhay/gogol | gogol-logging/gen/Network/Google/Logging/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'ListMonitoredResourceDescriptorsResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'lmrdrNextPageToken'
--
-- * 'lmrdrResourceDescriptors'
listMonitoredResourceDescriptorsResponse
:: ListMonitoredResourceDescriptorsResponse
listMonitoredResourceDescriptorsResponse =
ListMonitoredResourceDescriptorsResponse'
{_lmrdrNextPageToken = Nothing, _lmrdrResourceDescriptors = Nothing} | 504 | listMonitoredResourceDescriptorsResponse
:: ListMonitoredResourceDescriptorsResponse
listMonitoredResourceDescriptorsResponse =
ListMonitoredResourceDescriptorsResponse'
{_lmrdrNextPageToken = Nothing, _lmrdrResourceDescriptors = Nothing} | 248 | listMonitoredResourceDescriptorsResponse =
ListMonitoredResourceDescriptorsResponse'
{_lmrdrNextPageToken = Nothing, _lmrdrResourceDescriptors = Nothing} | 159 | true | true | 1 | 7 | 59 | 39 | 23 | 16 | null | null |
clchiou/gwab | lib/Telnet.hs | gpl-3.0 | setBoolOpt _ nvtOpt@(NvtOptAlways _) = nvtOpt | 51 | setBoolOpt _ nvtOpt@(NvtOptAlways _) = nvtOpt | 51 | setBoolOpt _ nvtOpt@(NvtOptAlways _) = nvtOpt | 51 | false | false | 0 | 8 | 11 | 20 | 10 | 10 | null | null |
shlevy/ghc | compiler/prelude/THNames.hs | bsd-3-clause | -- data Pat = ...
litPName, varPName, tupPName, unboxedTupPName, unboxedSumPName, conPName,
infixPName, tildePName, bangPName, asPName, wildPName, recPName, listPName,
sigPName, viewPName :: Name
litPName = libFun (fsLit "litP") litPIdKey | 250 | litPName, varPName, tupPName, unboxedTupPName, unboxedSumPName, conPName,
infixPName, tildePName, bangPName, asPName, wildPName, recPName, listPName,
sigPName, viewPName :: Name
litPName = libFun (fsLit "litP") litPIdKey | 232 | litPName = libFun (fsLit "litP") litPIdKey | 46 | true | true | 0 | 7 | 39 | 51 | 40 | 11 | null | null |
riccardotommasini/plp16 | haskell/prepared/ESE20181120/E20170705.hs | apache-2.0 | -- 1) Define a tcompose operation,
-- which takes a function f and two trees, t1 and t2,
-- and returns a tree with the same structure as t1,
-- but with leaves replaced by subtrees
-- having the same structure of t2:
-- each leaf is obtained by applying f
-- to the value stored in the
-- previous leaf, and the corresponding value in t2.
tmap :: (a -> b) -> Tree a -> Tree b
tmap _ Nil = Nil | 421 | tmap :: (a -> b) -> Tree a -> Tree b
tmap _ Nil = Nil | 53 | tmap _ Nil = Nil | 16 | true | true | 0 | 7 | 110 | 45 | 26 | 19 | null | null |
osa1/rho-torrent | src/Rho/Tracker.hs | bsd-3-clause | -- | Try to parse an IP address and port from given bytestring.
--
-- >>> parseUDPAddr (B.pack "192.168.1.2:5432")
-- Right ("192.168.1.2",5432)
--
-- >>> parseUDPAddr (B.pack "tracker.openbittorrent.com:1234/announce")
-- Right ("tracker.openbittorrent.com",1234)
--
parseUDPAddr :: B.ByteString -> Either String (B.ByteString, PortNumber)
parseUDPAddr bs =
let (hostAddr, portStrWColon) = B.span (/= ':') bs in
case B.uncons portStrWColon of
Nothing -> Left $ "Can't parse port number in " ++ B.unpack bs
Just (_, rest) ->
let portStr = B.takeWhile isNumber rest in
case B.readInt portStr of
Nothing -> Left $ "Can't parse port number from " ++ B.unpack portStr
Just (port, _) -> Right (hostAddr, fromIntegral port) | 787 | parseUDPAddr :: B.ByteString -> Either String (B.ByteString, PortNumber)
parseUDPAddr bs =
let (hostAddr, portStrWColon) = B.span (/= ':') bs in
case B.uncons portStrWColon of
Nothing -> Left $ "Can't parse port number in " ++ B.unpack bs
Just (_, rest) ->
let portStr = B.takeWhile isNumber rest in
case B.readInt portStr of
Nothing -> Left $ "Can't parse port number from " ++ B.unpack portStr
Just (port, _) -> Right (hostAddr, fromIntegral port) | 519 | parseUDPAddr bs =
let (hostAddr, portStrWColon) = B.span (/= ':') bs in
case B.uncons portStrWColon of
Nothing -> Left $ "Can't parse port number in " ++ B.unpack bs
Just (_, rest) ->
let portStr = B.takeWhile isNumber rest in
case B.readInt portStr of
Nothing -> Left $ "Can't parse port number from " ++ B.unpack portStr
Just (port, _) -> Right (hostAddr, fromIntegral port) | 446 | true | true | 0 | 17 | 174 | 186 | 96 | 90 | null | null |
dalaing/sdl2 | src/SDL/Exception.hs | bsd-3-clause | throwIfNot0_ :: (Eq a, MonadIO m, Num a) => Text -> Text -> m a -> m ()
throwIfNot0_ = throwIf_ (/= 0) | 102 | throwIfNot0_ :: (Eq a, MonadIO m, Num a) => Text -> Text -> m a -> m ()
throwIfNot0_ = throwIf_ (/= 0) | 102 | throwIfNot0_ = throwIf_ (/= 0) | 30 | false | true | 0 | 10 | 22 | 59 | 30 | 29 | null | null |
bgwines/hueue | lib/Utils.hs | bsd-3-clause | hush (Right r) = Just r | 23 | hush (Right r) = Just r | 23 | hush (Right r) = Just r | 23 | false | false | 0 | 6 | 5 | 19 | 8 | 11 | null | null |
beni55/haste-compiler | libraries/ghc-7.8/base/GHC/Event/Array.hs | bsd-3-clause | new :: Storable a => Int -> IO (Array a)
new c = do
es <- allocArray cap
fmap Array (newIORef (AC es 0 cap))
where
cap = firstPowerOf2 c | 150 | new :: Storable a => Int -> IO (Array a)
new c = do
es <- allocArray cap
fmap Array (newIORef (AC es 0 cap))
where
cap = firstPowerOf2 c | 150 | new c = do
es <- allocArray cap
fmap Array (newIORef (AC es 0 cap))
where
cap = firstPowerOf2 c | 109 | false | true | 0 | 11 | 43 | 79 | 36 | 43 | null | null |
ucsd-progsys/nanomaly | src/NanoML/Step.hs | bsd-3-clause | isFun (PrimN {}) = True | 23 | isFun (PrimN {}) = True | 23 | isFun (PrimN {}) = True | 23 | false | false | 0 | 7 | 4 | 16 | 8 | 8 | null | null |
bitemyapp/fit | src/Fit/Internal/FitParser.hs | bsd-3-clause | defEmpty :: Definitions
defEmpty = Defs (IntMap.empty) | 54 | defEmpty :: Definitions
defEmpty = Defs (IntMap.empty) | 54 | defEmpty = Defs (IntMap.empty) | 30 | false | true | 0 | 7 | 6 | 26 | 11 | 15 | null | null |
karamellpelle/grid | source/OpenGL/ES2/Values.hs | gpl-3.0 | gl_RENDERBUFFER_ALPHA_SIZE :: GLenum
gl_RENDERBUFFER_ALPHA_SIZE = 0x8D53 | 95 | gl_RENDERBUFFER_ALPHA_SIZE :: GLenum
gl_RENDERBUFFER_ALPHA_SIZE = 0x8D53 | 95 | gl_RENDERBUFFER_ALPHA_SIZE = 0x8D53 | 58 | false | true | 0 | 4 | 28 | 11 | 6 | 5 | null | null |
chemist/highlighter | src/Text/Highlighter/Lexers/Python3Traceback.hs | bsd-3-clause | root' :: TokenMatcher
root' =
[ tok "\\n" (Arbitrary "Text")
, tokNext "^Traceback \\(most recent call last\\):\\n" (Arbitrary "Generic" :. Arbitrary "Traceback") (GoTo intb')
, tok "^During handling of the above exception, another exception occurred:\\n\\n" (Arbitrary "Generic" :. Arbitrary "Traceback")
, tok "^The above exception was the direct cause of the following exception:\\n\\n" (Arbitrary "Generic" :. Arbitrary "Traceback")
] | 458 | root' :: TokenMatcher
root' =
[ tok "\\n" (Arbitrary "Text")
, tokNext "^Traceback \\(most recent call last\\):\\n" (Arbitrary "Generic" :. Arbitrary "Traceback") (GoTo intb')
, tok "^During handling of the above exception, another exception occurred:\\n\\n" (Arbitrary "Generic" :. Arbitrary "Traceback")
, tok "^The above exception was the direct cause of the following exception:\\n\\n" (Arbitrary "Generic" :. Arbitrary "Traceback")
] | 458 | root' =
[ tok "\\n" (Arbitrary "Text")
, tokNext "^Traceback \\(most recent call last\\):\\n" (Arbitrary "Generic" :. Arbitrary "Traceback") (GoTo intb')
, tok "^During handling of the above exception, another exception occurred:\\n\\n" (Arbitrary "Generic" :. Arbitrary "Traceback")
, tok "^The above exception was the direct cause of the following exception:\\n\\n" (Arbitrary "Generic" :. Arbitrary "Traceback")
] | 436 | false | true | 0 | 10 | 78 | 103 | 48 | 55 | null | null |
matthewscottgordon/gramophone | src/Gramophone/Core/Database.hs | gpl-3.0 | queryDB :: (MonadDB m) => String -> [SqlValue] -> m [[SqlValue]]
queryDB sql values = do
conn <- getConn
liftIO $ quickQuery' conn sql values | 145 | queryDB :: (MonadDB m) => String -> [SqlValue] -> m [[SqlValue]]
queryDB sql values = do
conn <- getConn
liftIO $ quickQuery' conn sql values | 145 | queryDB sql values = do
conn <- getConn
liftIO $ quickQuery' conn sql values | 80 | false | true | 0 | 11 | 28 | 71 | 34 | 37 | null | null |
PipocaQuemada/ermine | src/Ermine/Core/Lint.hs | bsd-2-clause | inferCore (Data cc _ _ ps) = do
when (length cc /= length ps) $ fail "bad data arguments"
zipWithM_ checkCore cc ps
return $ Form [] C | 140 | inferCore (Data cc _ _ ps) = do
when (length cc /= length ps) $ fail "bad data arguments"
zipWithM_ checkCore cc ps
return $ Form [] C | 140 | inferCore (Data cc _ _ ps) = do
when (length cc /= length ps) $ fail "bad data arguments"
zipWithM_ checkCore cc ps
return $ Form [] C | 140 | false | false | 0 | 11 | 33 | 72 | 31 | 41 | null | null |
zhy0216/haskell-learning | yosog/Foundation.hs | mit | getExtra :: Handler Extra
getExtra = fmap (appExtra . settings) getYesod | 72 | getExtra :: Handler Extra
getExtra = fmap (appExtra . settings) getYesod | 72 | getExtra = fmap (appExtra . settings) getYesod | 46 | false | true | 0 | 6 | 10 | 33 | 14 | 19 | null | null |
TomMD/ghc | compiler/typecheck/TcRnTypes.hs | bsd-3-clause | pprEvVars :: [EvVar] -> SDoc -- Print with their types
pprEvVars ev_vars = vcat (map pprEvVarWithType ev_vars) | 113 | pprEvVars :: [EvVar] -> SDoc
pprEvVars ev_vars = vcat (map pprEvVarWithType ev_vars) | 84 | pprEvVars ev_vars = vcat (map pprEvVarWithType ev_vars) | 55 | true | true | 0 | 7 | 19 | 38 | 18 | 20 | null | null |
ombocomp/repl-toolkit | System/REPL/Types.hs | apache-2.0 | -- |Constructor for 'GenericTypeError' which wraps the value into a 'SomeException'.
genericPredicateError :: T.Text -> SomeException
genericPredicateError = SomeException . GenericPredicateError | 195 | genericPredicateError :: T.Text -> SomeException
genericPredicateError = SomeException . GenericPredicateError | 110 | genericPredicateError = SomeException . GenericPredicateError | 61 | true | true | 0 | 7 | 20 | 29 | 13 | 16 | null | null |
gergoerdi/chip8-haskell | src/Chip8/OpCode.hs | bsd-3-clause | decode :: (Word8, Word8) -> Op
decode code@(hi, lo) = case codes of
(0x0, 0x0, 0xe, 0x0) -> ClearScreen
(0x0, 0x0, 0xe, 0xe) -> Ret
(0x0, _, _, _) -> Sys addr
(0x1, _, _, _) -> Jump addr
(0x2, _, _, _) -> Call addr
(0x3, x, _, _) -> SkipEqImm (R x) imm True
(0x4, x, _, _) -> SkipEqImm (R x) imm False
(0x5, x, y, 0x0) -> SkipEqReg (R x) (R y) True
(0x6, x, _, _) -> PutImm (R x) imm
(0x7, x, _, _) -> AddImm (R x) imm
(0x8, x, y, fun) -> Move (R x) (R y) (decodeFun fun)
(0x9, x, y, 0x0) -> SkipEqReg (R x) (R y) False
(0xa, _, _, _) -> SetPtr addr
(0xb, _, _, _) -> JumpPlusR0 addr
(0xc, x, _, _) -> Randomize (R x) imm
(0xd, x, y, n) -> DrawSprite (R x) (R y) n
(0xe, x, 0x9, 0xe) -> SkipKey (R x) True
(0xe, x, 0xa, 0x1) -> SkipKey (R x) False
(0xf, x, 0x0, 0x7) -> GetTimer (R x)
(0xf, x, 0x0, 0xa) -> WaitKey (R x)
(0xf, x, 0x1, 0x5) -> SetTimer (R x)
(0xf, x, 0x1, 0x8) -> SetSound (R x)
(0xf, x, 0x1, 0xe) -> AddPtr (R x)
(0xf, x, 0x2, 0x9) -> LoadFont (R x)
(0xf, x, 0x3, 0x3) -> StoreBCD (R x)
(0xf, x, 0x5, 0x5) -> StoreRegs (R x)
(0xf, x, 0x6, 0x5) -> LoadRegs (R x)
_ -> fatal "Unknown opcode" code
where
codes@(a1, a2, a3, a4) = unpack code
addr = packAddr a2 a3 a4
imm = lo
decodeFun :: Nibble -> Fun
decodeFun 0x0 = Id
decodeFun 0x1 = Or
decodeFun 0x2 = And
decodeFun 0x3 = XOr
decodeFun 0x4 = Add
decodeFun 0x5 = Subtract
decodeFun 0x6 = ShiftRight
decodeFun 0x7 = SubtractFlip
decodeFun 0xe = ShiftLeft
decodeFun n = fatal "Unknown Move function" n
fatal :: (Show a) => String -> a -> b
fatal s x = error $ s ++ ": " ++ show x | 1,843 | decode :: (Word8, Word8) -> Op
decode code@(hi, lo) = case codes of
(0x0, 0x0, 0xe, 0x0) -> ClearScreen
(0x0, 0x0, 0xe, 0xe) -> Ret
(0x0, _, _, _) -> Sys addr
(0x1, _, _, _) -> Jump addr
(0x2, _, _, _) -> Call addr
(0x3, x, _, _) -> SkipEqImm (R x) imm True
(0x4, x, _, _) -> SkipEqImm (R x) imm False
(0x5, x, y, 0x0) -> SkipEqReg (R x) (R y) True
(0x6, x, _, _) -> PutImm (R x) imm
(0x7, x, _, _) -> AddImm (R x) imm
(0x8, x, y, fun) -> Move (R x) (R y) (decodeFun fun)
(0x9, x, y, 0x0) -> SkipEqReg (R x) (R y) False
(0xa, _, _, _) -> SetPtr addr
(0xb, _, _, _) -> JumpPlusR0 addr
(0xc, x, _, _) -> Randomize (R x) imm
(0xd, x, y, n) -> DrawSprite (R x) (R y) n
(0xe, x, 0x9, 0xe) -> SkipKey (R x) True
(0xe, x, 0xa, 0x1) -> SkipKey (R x) False
(0xf, x, 0x0, 0x7) -> GetTimer (R x)
(0xf, x, 0x0, 0xa) -> WaitKey (R x)
(0xf, x, 0x1, 0x5) -> SetTimer (R x)
(0xf, x, 0x1, 0x8) -> SetSound (R x)
(0xf, x, 0x1, 0xe) -> AddPtr (R x)
(0xf, x, 0x2, 0x9) -> LoadFont (R x)
(0xf, x, 0x3, 0x3) -> StoreBCD (R x)
(0xf, x, 0x5, 0x5) -> StoreRegs (R x)
(0xf, x, 0x6, 0x5) -> LoadRegs (R x)
_ -> fatal "Unknown opcode" code
where
codes@(a1, a2, a3, a4) = unpack code
addr = packAddr a2 a3 a4
imm = lo
decodeFun :: Nibble -> Fun
decodeFun 0x0 = Id
decodeFun 0x1 = Or
decodeFun 0x2 = And
decodeFun 0x3 = XOr
decodeFun 0x4 = Add
decodeFun 0x5 = Subtract
decodeFun 0x6 = ShiftRight
decodeFun 0x7 = SubtractFlip
decodeFun 0xe = ShiftLeft
decodeFun n = fatal "Unknown Move function" n
fatal :: (Show a) => String -> a -> b
fatal s x = error $ s ++ ": " ++ show x | 1,843 | decode code@(hi, lo) = case codes of
(0x0, 0x0, 0xe, 0x0) -> ClearScreen
(0x0, 0x0, 0xe, 0xe) -> Ret
(0x0, _, _, _) -> Sys addr
(0x1, _, _, _) -> Jump addr
(0x2, _, _, _) -> Call addr
(0x3, x, _, _) -> SkipEqImm (R x) imm True
(0x4, x, _, _) -> SkipEqImm (R x) imm False
(0x5, x, y, 0x0) -> SkipEqReg (R x) (R y) True
(0x6, x, _, _) -> PutImm (R x) imm
(0x7, x, _, _) -> AddImm (R x) imm
(0x8, x, y, fun) -> Move (R x) (R y) (decodeFun fun)
(0x9, x, y, 0x0) -> SkipEqReg (R x) (R y) False
(0xa, _, _, _) -> SetPtr addr
(0xb, _, _, _) -> JumpPlusR0 addr
(0xc, x, _, _) -> Randomize (R x) imm
(0xd, x, y, n) -> DrawSprite (R x) (R y) n
(0xe, x, 0x9, 0xe) -> SkipKey (R x) True
(0xe, x, 0xa, 0x1) -> SkipKey (R x) False
(0xf, x, 0x0, 0x7) -> GetTimer (R x)
(0xf, x, 0x0, 0xa) -> WaitKey (R x)
(0xf, x, 0x1, 0x5) -> SetTimer (R x)
(0xf, x, 0x1, 0x8) -> SetSound (R x)
(0xf, x, 0x1, 0xe) -> AddPtr (R x)
(0xf, x, 0x2, 0x9) -> LoadFont (R x)
(0xf, x, 0x3, 0x3) -> StoreBCD (R x)
(0xf, x, 0x5, 0x5) -> StoreRegs (R x)
(0xf, x, 0x6, 0x5) -> LoadRegs (R x)
_ -> fatal "Unknown opcode" code
where
codes@(a1, a2, a3, a4) = unpack code
addr = packAddr a2 a3 a4
imm = lo
decodeFun :: Nibble -> Fun
decodeFun 0x0 = Id
decodeFun 0x1 = Or
decodeFun 0x2 = And
decodeFun 0x3 = XOr
decodeFun 0x4 = Add
decodeFun 0x5 = Subtract
decodeFun 0x6 = ShiftRight
decodeFun 0x7 = SubtractFlip
decodeFun 0xe = ShiftLeft
decodeFun n = fatal "Unknown Move function" n
fatal :: (Show a) => String -> a -> b
fatal s x = error $ s ++ ": " ++ show x | 1,812 | false | true | 1 | 10 | 635 | 985 | 536 | 449 | null | null |
ulikoehler/ProjectEuler | Euler47.hs | apache-2.0 | main = do
let num4 = zip4 [1..] [2..] [3..] [4..]
let num3 = zip3 [1..] [2..] [3..]
print $ head $ filter pf4 num4 | 126 | main = do
let num4 = zip4 [1..] [2..] [3..] [4..]
let num3 = zip3 [1..] [2..] [3..]
print $ head $ filter pf4 num4 | 126 | main = do
let num4 = zip4 [1..] [2..] [3..] [4..]
let num3 = zip3 [1..] [2..] [3..]
print $ head $ filter pf4 num4 | 126 | false | false | 1 | 12 | 36 | 81 | 39 | 42 | null | null |
vTurbine/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | rootMainKey, runMainKey :: Unique
rootMainKey = mkPreludeMiscIdUnique 101 | 91 | rootMainKey, runMainKey :: Unique
rootMainKey = mkPreludeMiscIdUnique 101 | 91 | rootMainKey = mkPreludeMiscIdUnique 101 | 57 | false | true | 0 | 5 | 25 | 16 | 9 | 7 | null | null |
noughtmare/yi | yi-mode-javascript/src/Yi/Syntax/JavaScript.hs | gpl-2.0 | -- * Simple parsers
-- | Parses a comment.
comment :: P TT TT
comment = symbol (\t -> case fromTT t of
Comment _ -> True
_ -> False) | 193 | comment :: P TT TT
comment = symbol (\t -> case fromTT t of
Comment _ -> True
_ -> False) | 149 | comment = symbol (\t -> case fromTT t of
Comment _ -> True
_ -> False) | 130 | true | true | 0 | 11 | 90 | 57 | 27 | 30 | null | null |
DavidAlphaFox/ghc | libraries/haskeline/System/Console/Haskeline/Key.hs | bsd-3-clause | parseModifier :: String -> (Modifier -> Modifier)
parseModifier str m = case map toLower str of
"ctrl" -> m {hasControl = True}
"control" -> m {hasControl = True}
"meta" -> m {hasMeta = True}
"shift" -> m {hasShift = True}
_ -> m | 249 | parseModifier :: String -> (Modifier -> Modifier)
parseModifier str m = case map toLower str of
"ctrl" -> m {hasControl = True}
"control" -> m {hasControl = True}
"meta" -> m {hasMeta = True}
"shift" -> m {hasShift = True}
_ -> m | 249 | parseModifier str m = case map toLower str of
"ctrl" -> m {hasControl = True}
"control" -> m {hasControl = True}
"meta" -> m {hasMeta = True}
"shift" -> m {hasShift = True}
_ -> m | 199 | false | true | 5 | 7 | 62 | 107 | 53 | 54 | null | null |
tiqwab/md-parser | src/Text/Md/MdParser.hs | bsd-3-clause | pStr = P.try $ do
str <- P.many1 P.alphaNum
return $ Str str
-- FIXME: Summarize `pStrWithHtmlEscape` and `pStrWithHtmlEscapeForce`
-- | Parse a string. Accept any marks as well as alphanums and perform html-escaping. | 222 | pStr = P.try $ do
str <- P.many1 P.alphaNum
return $ Str str
-- FIXME: Summarize `pStrWithHtmlEscape` and `pStrWithHtmlEscapeForce`
-- | Parse a string. Accept any marks as well as alphanums and perform html-escaping. | 222 | pStr = P.try $ do
str <- P.many1 P.alphaNum
return $ Str str
-- FIXME: Summarize `pStrWithHtmlEscape` and `pStrWithHtmlEscapeForce`
-- | Parse a string. Accept any marks as well as alphanums and perform html-escaping. | 222 | false | false | 3 | 10 | 38 | 43 | 18 | 25 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.