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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ezyang/ghc | compiler/types/Type.hs | bsd-3-clause | resultIsLevPoly :: Type -> Bool
resultIsLevPoly = isTypeLevPoly . snd . splitPiTys | 82 | resultIsLevPoly :: Type -> Bool
resultIsLevPoly = isTypeLevPoly . snd . splitPiTys | 82 | resultIsLevPoly = isTypeLevPoly . snd . splitPiTys | 50 | false | true | 0 | 7 | 11 | 30 | 13 | 17 | null | null |
rueshyna/gogol | gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs | mpl-2.0 | -- | The retrieved or updated account shipping settings.
acbre1AccountShipping :: Lens' AccountshippingCustomBatchResponseEntry (Maybe AccountShipping)
acbre1AccountShipping
= lens _acbre1AccountShipping
(\ s a -> s{_acbre1AccountShipping = a}) | 252 | acbre1AccountShipping :: Lens' AccountshippingCustomBatchResponseEntry (Maybe AccountShipping)
acbre1AccountShipping
= lens _acbre1AccountShipping
(\ s a -> s{_acbre1AccountShipping = a}) | 195 | acbre1AccountShipping
= lens _acbre1AccountShipping
(\ s a -> s{_acbre1AccountShipping = a}) | 100 | true | true | 0 | 8 | 33 | 49 | 25 | 24 | null | null |
uduki/hsQt | Qtc/Enums/Gui/QStyleOptionToolBar.hs | bsd-2-clause | fEnd :: ToolBarPositions
fEnd
= ifToolBarPositions $ 2 | 56 | fEnd :: ToolBarPositions
fEnd
= ifToolBarPositions $ 2 | 56 | fEnd
= ifToolBarPositions $ 2 | 31 | false | true | 0 | 6 | 9 | 18 | 8 | 10 | null | null |
np/ling | Ling/Fmt/Benjamin/Migrate.hs | bsd-3-clause | transAllocTerm :: AllocTerm -> L.AllocTerm
transAllocTerm (AVar d) = L.AVar (transName d) | 89 | transAllocTerm :: AllocTerm -> L.AllocTerm
transAllocTerm (AVar d) = L.AVar (transName d) | 89 | transAllocTerm (AVar d) = L.AVar (transName d) | 46 | false | true | 0 | 7 | 11 | 37 | 18 | 19 | null | null |
ulikoehler/graph-generators | GraphGeneratorsTest.hs | apache-2.0 | hasNumEdges :: Int -> GraphInfo -> Bool
hasNumEdges n = (==n) . numEdges | 72 | hasNumEdges :: Int -> GraphInfo -> Bool
hasNumEdges n = (==n) . numEdges | 72 | hasNumEdges n = (==n) . numEdges | 32 | false | true | 1 | 8 | 12 | 37 | 17 | 20 | null | null |
qua-bla/hamsql | src/Database/HamSql/Internal/Stmt.hs | gpl-3.0 | stmtIdType :: SqlStmt -> SqlStmtType
stmtIdType (SqlStmt x _) = stmtType x | 74 | stmtIdType :: SqlStmt -> SqlStmtType
stmtIdType (SqlStmt x _) = stmtType x | 74 | stmtIdType (SqlStmt x _) = stmtType x | 37 | false | true | 0 | 9 | 11 | 34 | 15 | 19 | null | null |
josefs/autosar | oldARSim/ARXML.hs | bsd-3-clause | toDest "PR-PORT-PROTOTYPE" = RSEPrPortPrototype | 47 | toDest "PR-PORT-PROTOTYPE" = RSEPrPortPrototype | 47 | toDest "PR-PORT-PROTOTYPE" = RSEPrPortPrototype | 47 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
timtylin/scholdoc | src/Text/Pandoc/Parsing.hs | gpl-2.0 | lineBlockLine :: Stream [Char] m Char => ParserT [Char] st m String
lineBlockLine = try $ do
char '|'
char ' '
white <- many (spaceChar >> return '\160')
notFollowedBy newline
line <- anyLine
continuations <- many (try $ char ' ' >> anyLine)
return $ white ++ unwords (line : continuations)
-- | Parses an RST-style line block and returns a list of strings. | 372 | lineBlockLine :: Stream [Char] m Char => ParserT [Char] st m String
lineBlockLine = try $ do
char '|'
char ' '
white <- many (spaceChar >> return '\160')
notFollowedBy newline
line <- anyLine
continuations <- many (try $ char ' ' >> anyLine)
return $ white ++ unwords (line : continuations)
-- | Parses an RST-style line block and returns a list of strings. | 372 | lineBlockLine = try $ do
char '|'
char ' '
white <- many (spaceChar >> return '\160')
notFollowedBy newline
line <- anyLine
continuations <- many (try $ char ' ' >> anyLine)
return $ white ++ unwords (line : continuations)
-- | Parses an RST-style line block and returns a list of strings. | 304 | false | true | 0 | 13 | 79 | 132 | 61 | 71 | null | null |
slogsdon/haskell-exercises | pe/src/Euler/Problem2.hs | mit | fib :: Integral n => n -> n
fib = fst . fib2 | 44 | fib :: Integral n => n -> n
fib = fst . fib2 | 44 | fib = fst . fib2 | 16 | false | true | 0 | 6 | 12 | 26 | 13 | 13 | null | null |
pgavin/tfp | Test.hs | bsd-3-clause | testSub5 :: D0 :-: DN1 -> D1
testSub5 = Prelude.id | 50 | testSub5 :: D0 :-: DN1 -> D1
testSub5 = Prelude.id | 50 | testSub5 = Prelude.id | 21 | false | true | 0 | 6 | 9 | 21 | 11 | 10 | null | null |
nevrenato/Hets_Fork | ExtModal/ATC_ExtModal.hs | gpl-2.0 | _tcEM_SIG_ITEMTc :: TyCon
_tcEM_SIG_ITEMTc = mkTyCon "ExtModal.AS_ExtModal.EM_SIG_ITEM" | 87 | _tcEM_SIG_ITEMTc :: TyCon
_tcEM_SIG_ITEMTc = mkTyCon "ExtModal.AS_ExtModal.EM_SIG_ITEM" | 87 | _tcEM_SIG_ITEMTc = mkTyCon "ExtModal.AS_ExtModal.EM_SIG_ITEM" | 61 | false | true | 0 | 5 | 6 | 14 | 7 | 7 | null | null |
rueshyna/gogol | gogol-analytics/gen/Network/Google/Analytics/Types/Product.hs | mpl-2.0 | -- | Goal type. Possible values are URL_DESTINATION, VISIT_TIME_ON_SITE,
-- VISIT_NUM_PAGES, AND EVENT.
goaType :: Lens' Goal (Maybe Text)
goaType = lens _goaType (\ s a -> s{_goaType = a}) | 189 | goaType :: Lens' Goal (Maybe Text)
goaType = lens _goaType (\ s a -> s{_goaType = a}) | 85 | goaType = lens _goaType (\ s a -> s{_goaType = a}) | 50 | true | true | 0 | 9 | 29 | 47 | 26 | 21 | null | null |
kumasento/accelerate | Data/Array/Accelerate/Analysis/Match.hs | bsd-3-clause | matchTupleIdx _ _ = Nothing | 53 | matchTupleIdx _ _ = Nothing | 53 | matchTupleIdx _ _ = Nothing | 53 | false | false | 0 | 5 | 30 | 11 | 5 | 6 | null | null |
mb21/qua-kit | apps/hs/qua-server/src/Handler/Mooc/Admin/ReviewRequest.hs | mit | reviewRequest :: SendReviewParams -> Handler Html
reviewRequest params = do
let whereTask = maybe [] (\tId -> [CurrentScenarioTaskId P.==. tId]) (mtaskId params)
scenarios <- runDB $ selectList (whereTask ++ [
CurrentScenarioGrade P.==. Nothing
, CurrentScenarioLastUpdate P.<. onlyBefore params
]) []
statusTxt <-
if length scenarios > 0 then do
render <- getUrlRender
let toLink (Entity _ sc) = render $ SubmissionViewerR
(currentScenarioTaskId sc)
(currentScenarioAuthorId sc)
let scLinks = fmap toLink scenarios
browseLink =
case mtaskId params of
Nothing -> render BrowseProposalsForExpertsR
Just i -> render BrowseProposalsForExpertsR <>
"?exercise_id=" <> tshow (P.fromSqlKey i)
case mexpertId params of
Just expertId -> do
mexpert <- runDB $ get expertId
case mexpert of
Just expert -> do
sendReviewRequestMail (onlyBefore params) browseLink scLinks expert
return "Email sent..."
Nothing -> return "Expert not found"
Nothing -> do
experts <- selectExperts
_ <- forM experts $ \(Entity _ ex) -> sendReviewRequestMail (onlyBefore params) browseLink scLinks ex
return "Emails sent..."
else
return "No scenarios to review. Email not sent."
setMessage statusTxt
redirect AdminReviewRequestR | 1,576 | reviewRequest :: SendReviewParams -> Handler Html
reviewRequest params = do
let whereTask = maybe [] (\tId -> [CurrentScenarioTaskId P.==. tId]) (mtaskId params)
scenarios <- runDB $ selectList (whereTask ++ [
CurrentScenarioGrade P.==. Nothing
, CurrentScenarioLastUpdate P.<. onlyBefore params
]) []
statusTxt <-
if length scenarios > 0 then do
render <- getUrlRender
let toLink (Entity _ sc) = render $ SubmissionViewerR
(currentScenarioTaskId sc)
(currentScenarioAuthorId sc)
let scLinks = fmap toLink scenarios
browseLink =
case mtaskId params of
Nothing -> render BrowseProposalsForExpertsR
Just i -> render BrowseProposalsForExpertsR <>
"?exercise_id=" <> tshow (P.fromSqlKey i)
case mexpertId params of
Just expertId -> do
mexpert <- runDB $ get expertId
case mexpert of
Just expert -> do
sendReviewRequestMail (onlyBefore params) browseLink scLinks expert
return "Email sent..."
Nothing -> return "Expert not found"
Nothing -> do
experts <- selectExperts
_ <- forM experts $ \(Entity _ ex) -> sendReviewRequestMail (onlyBefore params) browseLink scLinks ex
return "Emails sent..."
else
return "No scenarios to review. Email not sent."
setMessage statusTxt
redirect AdminReviewRequestR | 1,576 | reviewRequest params = do
let whereTask = maybe [] (\tId -> [CurrentScenarioTaskId P.==. tId]) (mtaskId params)
scenarios <- runDB $ selectList (whereTask ++ [
CurrentScenarioGrade P.==. Nothing
, CurrentScenarioLastUpdate P.<. onlyBefore params
]) []
statusTxt <-
if length scenarios > 0 then do
render <- getUrlRender
let toLink (Entity _ sc) = render $ SubmissionViewerR
(currentScenarioTaskId sc)
(currentScenarioAuthorId sc)
let scLinks = fmap toLink scenarios
browseLink =
case mtaskId params of
Nothing -> render BrowseProposalsForExpertsR
Just i -> render BrowseProposalsForExpertsR <>
"?exercise_id=" <> tshow (P.fromSqlKey i)
case mexpertId params of
Just expertId -> do
mexpert <- runDB $ get expertId
case mexpert of
Just expert -> do
sendReviewRequestMail (onlyBefore params) browseLink scLinks expert
return "Email sent..."
Nothing -> return "Expert not found"
Nothing -> do
experts <- selectExperts
_ <- forM experts $ \(Entity _ ex) -> sendReviewRequestMail (onlyBefore params) browseLink scLinks ex
return "Emails sent..."
else
return "No scenarios to review. Email not sent."
setMessage statusTxt
redirect AdminReviewRequestR | 1,526 | false | true | 0 | 23 | 547 | 402 | 185 | 217 | null | null |
kolmodin/cabal | Cabal/Distribution/PackageDescription/Check.hs | bsd-3-clause | -- ------------------------------------------------------------
-- * Checks on the GenericPackageDescription
-- ------------------------------------------------------------
-- | Check the build-depends fields for any weirdness or bad practise.
--
checkPackageVersions :: GenericPackageDescription -> [PackageCheck]
checkPackageVersions pkg =
catMaybes [
-- Check that the version of base is bounded above.
-- For example this bans "build-depends: base >= 3".
-- It should probably be "build-depends: base >= 3 && < 4"
-- which is the same as "build-depends: base == 3.*"
check (not (boundedAbove baseDependency)) $
PackageDistInexcusable $
"The dependency 'build-depends: base' does not specify an upper "
++ "bound on the version number. Each major release of the 'base' "
++ "package changes the API in various ways and most packages will "
++ "need some changes to compile with it. The recommended practise "
++ "is to specify an upper bound on the version of the 'base' "
++ "package. This ensures your package will continue to build when a "
++ "new major version of the 'base' package is released. If you are "
++ "not sure what upper bound to use then use the next major "
++ "version. For example if you have tested your package with 'base' "
++ "version 4.5 and 4.6 then use 'build-depends: base >= 4.5 && < 4.7'."
]
where
-- TODO: What we really want to do is test if there exists any
-- configuration in which the base version is unbounded above.
-- However that's a bit tricky because there are many possible
-- configurations. As a cheap easy and safe approximation we will
-- pick a single "typical" configuration and check if that has an
-- open upper bound. To get a typical configuration we finalise
-- using no package index and the current platform.
finalised = finalizePackageDescription
[] (const True) buildPlatform
(unknownCompilerInfo
(CompilerId buildCompilerFlavor (Version [] [])) NoAbiTag)
[] pkg
baseDependency = case finalised of
Right (pkg', _) | not (null baseDeps) ->
foldr intersectVersionRanges anyVersion baseDeps
where
baseDeps =
[ vr | Dependency (PackageName "base") vr <- buildDepends pkg' ]
-- Just in case finalizePackageDescription fails for any reason,
-- or if the package doesn't depend on the base package at all,
-- then we will just skip the check, since boundedAbove noVersion = True
_ -> noVersion
boundedAbove :: VersionRange -> Bool
boundedAbove vr = case asVersionIntervals vr of
[] -> True -- this is the inconsistent version range.
intervals -> case last intervals of
(_, UpperBound _ _) -> True
(_, NoUpperBound ) -> False | 2,986 | checkPackageVersions :: GenericPackageDescription -> [PackageCheck]
checkPackageVersions pkg =
catMaybes [
-- Check that the version of base is bounded above.
-- For example this bans "build-depends: base >= 3".
-- It should probably be "build-depends: base >= 3 && < 4"
-- which is the same as "build-depends: base == 3.*"
check (not (boundedAbove baseDependency)) $
PackageDistInexcusable $
"The dependency 'build-depends: base' does not specify an upper "
++ "bound on the version number. Each major release of the 'base' "
++ "package changes the API in various ways and most packages will "
++ "need some changes to compile with it. The recommended practise "
++ "is to specify an upper bound on the version of the 'base' "
++ "package. This ensures your package will continue to build when a "
++ "new major version of the 'base' package is released. If you are "
++ "not sure what upper bound to use then use the next major "
++ "version. For example if you have tested your package with 'base' "
++ "version 4.5 and 4.6 then use 'build-depends: base >= 4.5 && < 4.7'."
]
where
-- TODO: What we really want to do is test if there exists any
-- configuration in which the base version is unbounded above.
-- However that's a bit tricky because there are many possible
-- configurations. As a cheap easy and safe approximation we will
-- pick a single "typical" configuration and check if that has an
-- open upper bound. To get a typical configuration we finalise
-- using no package index and the current platform.
finalised = finalizePackageDescription
[] (const True) buildPlatform
(unknownCompilerInfo
(CompilerId buildCompilerFlavor (Version [] [])) NoAbiTag)
[] pkg
baseDependency = case finalised of
Right (pkg', _) | not (null baseDeps) ->
foldr intersectVersionRanges anyVersion baseDeps
where
baseDeps =
[ vr | Dependency (PackageName "base") vr <- buildDepends pkg' ]
-- Just in case finalizePackageDescription fails for any reason,
-- or if the package doesn't depend on the base package at all,
-- then we will just skip the check, since boundedAbove noVersion = True
_ -> noVersion
boundedAbove :: VersionRange -> Bool
boundedAbove vr = case asVersionIntervals vr of
[] -> True -- this is the inconsistent version range.
intervals -> case last intervals of
(_, UpperBound _ _) -> True
(_, NoUpperBound ) -> False | 2,738 | checkPackageVersions pkg =
catMaybes [
-- Check that the version of base is bounded above.
-- For example this bans "build-depends: base >= 3".
-- It should probably be "build-depends: base >= 3 && < 4"
-- which is the same as "build-depends: base == 3.*"
check (not (boundedAbove baseDependency)) $
PackageDistInexcusable $
"The dependency 'build-depends: base' does not specify an upper "
++ "bound on the version number. Each major release of the 'base' "
++ "package changes the API in various ways and most packages will "
++ "need some changes to compile with it. The recommended practise "
++ "is to specify an upper bound on the version of the 'base' "
++ "package. This ensures your package will continue to build when a "
++ "new major version of the 'base' package is released. If you are "
++ "not sure what upper bound to use then use the next major "
++ "version. For example if you have tested your package with 'base' "
++ "version 4.5 and 4.6 then use 'build-depends: base >= 4.5 && < 4.7'."
]
where
-- TODO: What we really want to do is test if there exists any
-- configuration in which the base version is unbounded above.
-- However that's a bit tricky because there are many possible
-- configurations. As a cheap easy and safe approximation we will
-- pick a single "typical" configuration and check if that has an
-- open upper bound. To get a typical configuration we finalise
-- using no package index and the current platform.
finalised = finalizePackageDescription
[] (const True) buildPlatform
(unknownCompilerInfo
(CompilerId buildCompilerFlavor (Version [] [])) NoAbiTag)
[] pkg
baseDependency = case finalised of
Right (pkg', _) | not (null baseDeps) ->
foldr intersectVersionRanges anyVersion baseDeps
where
baseDeps =
[ vr | Dependency (PackageName "base") vr <- buildDepends pkg' ]
-- Just in case finalizePackageDescription fails for any reason,
-- or if the package doesn't depend on the base package at all,
-- then we will just skip the check, since boundedAbove noVersion = True
_ -> noVersion
boundedAbove :: VersionRange -> Bool
boundedAbove vr = case asVersionIntervals vr of
[] -> True -- this is the inconsistent version range.
intervals -> case last intervals of
(_, UpperBound _ _) -> True
(_, NoUpperBound ) -> False | 2,670 | true | true | 2 | 21 | 821 | 338 | 173 | 165 | null | null |
uuhan/Idris-dev | src/IRTS/CodegenC.hs | bsd-3-clause | bcc i (FOREIGNCALL l rty (FStr fn) (x:xs)) | fn == "%wrapper"
= indent i ++
c_irts (toFType rty) (creg l ++ " = ")
("_idris_get_wrapper(" ++ creg (snd x) ++ ")") ++ ";\n" | 196 | bcc i (FOREIGNCALL l rty (FStr fn) (x:xs)) | fn == "%wrapper"
= indent i ++
c_irts (toFType rty) (creg l ++ " = ")
("_idris_get_wrapper(" ++ creg (snd x) ++ ")") ++ ";\n" | 196 | bcc i (FOREIGNCALL l rty (FStr fn) (x:xs)) | fn == "%wrapper"
= indent i ++
c_irts (toFType rty) (creg l ++ " = ")
("_idris_get_wrapper(" ++ creg (snd x) ++ ")") ++ ";\n" | 196 | false | false | 0 | 14 | 59 | 102 | 48 | 54 | null | null |
Teaspot-Studio/Urho3D-Haskell | src/Graphics/Urho3D/Scene/CustomLogicComponent.hs | mit | createCustomComponentFactory :: (Parent Context a, Pointer p a, MonadIO m)
=> p -- ^ Pointer to context
-> String -- ^ Name of component type
-> state -- ^ Inital state of component
-> CustomLogicComponentSetup state -- ^ Config of custom component
-> m (Ptr CustomFactory, Ptr TypeInfo) -- ^ Return new factory and new type info
createCustomComponentFactory p name a setup = liftIO $ do
let ptr = parentPointer p
maker :: Ptr Context -> IO (Ptr Object)
maker cntx = do
pobj <- newCustomLogicComponent cntx a setup
return . castToParent $ pobj
customType <- newTypeInfo name customComponentTypeInfo
factory <- newCustomFactory ptr customType maker
return (factory, customType)
-- | Register component in system, after that you can create the component with Node methods | 816 | createCustomComponentFactory :: (Parent Context a, Pointer p a, MonadIO m)
=> p -- ^ Pointer to context
-> String -- ^ Name of component type
-> state -- ^ Inital state of component
-> CustomLogicComponentSetup state -- ^ Config of custom component
-> m (Ptr CustomFactory, Ptr TypeInfo)
createCustomComponentFactory p name a setup = liftIO $ do
let ptr = parentPointer p
maker :: Ptr Context -> IO (Ptr Object)
maker cntx = do
pobj <- newCustomLogicComponent cntx a setup
return . castToParent $ pobj
customType <- newTypeInfo name customComponentTypeInfo
factory <- newCustomFactory ptr customType maker
return (factory, customType)
-- | Register component in system, after that you can create the component with Node methods | 774 | createCustomComponentFactory p name a setup = liftIO $ do
let ptr = parentPointer p
maker :: Ptr Context -> IO (Ptr Object)
maker cntx = do
pobj <- newCustomLogicComponent cntx a setup
return . castToParent $ pobj
customType <- newTypeInfo name customComponentTypeInfo
factory <- newCustomFactory ptr customType maker
return (factory, customType)
-- | Register component in system, after that you can create the component with Node methods | 476 | true | true | 0 | 14 | 170 | 195 | 94 | 101 | null | null |
rfranek/duckling | Duckling/Time/IT/Rules.hs | bsd-3-clause | ruleToday :: Rule
ruleToday = Rule
{ name = "today"
, pattern =
[ regex "(di )?oggi|in giornata"
]
, prod = \_ -> tt $ cycleNth TG.Day 0
} | 154 | ruleToday :: Rule
ruleToday = Rule
{ name = "today"
, pattern =
[ regex "(di )?oggi|in giornata"
]
, prod = \_ -> tt $ cycleNth TG.Day 0
} | 154 | ruleToday = Rule
{ name = "today"
, pattern =
[ regex "(di )?oggi|in giornata"
]
, prod = \_ -> tt $ cycleNth TG.Day 0
} | 136 | false | true | 0 | 11 | 45 | 63 | 32 | 31 | null | null |
jonathan-laurent/copilot-kind | src/Copilot/Kind/Kind2/Translate.hs | bsd-3-clause | transLocals :: Node -> [K.Term]
transLocals node =
concatMap f (Map.toList $ nodeLocalVars node)
where
f (v, VarDescr _ def) =
case def of
Pre _ v' -> [mkEquality (trPrimedVar v) (trVar v')]
Expr e -> [mkEquality (trPrimedVar v) (trExpr True e)]
Constrs cs -> map (trExpr True) cs | 323 | transLocals :: Node -> [K.Term]
transLocals node =
concatMap f (Map.toList $ nodeLocalVars node)
where
f (v, VarDescr _ def) =
case def of
Pre _ v' -> [mkEquality (trPrimedVar v) (trVar v')]
Expr e -> [mkEquality (trPrimedVar v) (trExpr True e)]
Constrs cs -> map (trExpr True) cs | 323 | transLocals node =
concatMap f (Map.toList $ nodeLocalVars node)
where
f (v, VarDescr _ def) =
case def of
Pre _ v' -> [mkEquality (trPrimedVar v) (trVar v')]
Expr e -> [mkEquality (trPrimedVar v) (trExpr True e)]
Constrs cs -> map (trExpr True) cs | 291 | false | true | 0 | 11 | 91 | 148 | 72 | 76 | null | null |
ssaavedra/liquidhaskell | benchmarks/vector-0.10.0.1/Data/Vector.hs | bsd-3-clause | slice = G.slice | 15 | slice = G.slice | 15 | slice = G.slice | 15 | false | false | 0 | 5 | 2 | 8 | 4 | 4 | null | null |
olorin/amazonka | amazonka-storagegateway/gen/Network/AWS/StorageGateway/DescribeUploadBuffer.hs | mpl-2.0 | -- | Undocumented member.
dubrsDiskIds :: Lens' DescribeUploadBufferResponse [Text]
dubrsDiskIds = lens _dubrsDiskIds (\ s a -> s{_dubrsDiskIds = a}) . _Default . _Coerce | 170 | dubrsDiskIds :: Lens' DescribeUploadBufferResponse [Text]
dubrsDiskIds = lens _dubrsDiskIds (\ s a -> s{_dubrsDiskIds = a}) . _Default . _Coerce | 144 | dubrsDiskIds = lens _dubrsDiskIds (\ s a -> s{_dubrsDiskIds = a}) . _Default . _Coerce | 86 | true | true | 1 | 11 | 23 | 57 | 28 | 29 | null | null |
sgillespie/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | isFFIPrimArgumentTy :: DynFlags -> Type -> Validity
-- Checks for valid argument type for a 'foreign import prim'
-- Currently they must all be simple unlifted types, or the well-known type
-- Any, which can be used to pass the address to a Haskell object on the heap to
-- the foreign function.
isFFIPrimArgumentTy dflags ty
| isAnyTy ty = IsValid
| otherwise = checkRepTyCon (legalFIPrimArgTyCon dflags) ty | 413 | isFFIPrimArgumentTy :: DynFlags -> Type -> Validity
isFFIPrimArgumentTy dflags ty
| isAnyTy ty = IsValid
| otherwise = checkRepTyCon (legalFIPrimArgTyCon dflags) ty | 169 | isFFIPrimArgumentTy dflags ty
| isAnyTy ty = IsValid
| otherwise = checkRepTyCon (legalFIPrimArgTyCon dflags) ty | 117 | true | true | 0 | 8 | 72 | 63 | 30 | 33 | null | null |
wrengr/bytestring-trie | src/Data/Trie/Internal.hs | bsd-3-clause | intersectMaybe _ _ _ = Nothing | 46 | intersectMaybe _ _ _ = Nothing | 46 | intersectMaybe _ _ _ = Nothing | 46 | false | false | 0 | 5 | 21 | 13 | 6 | 7 | null | null |
skogsbaer/HTF | Test/Framework/Colors.hs | lgpl-2.1 | emptyColorString :: ColorString
emptyColorString = noColor "" | 61 | emptyColorString :: ColorString
emptyColorString = noColor "" | 61 | emptyColorString = noColor "" | 29 | false | true | 0 | 5 | 6 | 14 | 7 | 7 | null | null |
mettekou/ghc | compiler/prelude/THNames.hs | bsd-3-clause | mkNameSIdKey = mkPreludeMiscIdUnique 210 | 48 | mkNameSIdKey = mkPreludeMiscIdUnique 210 | 48 | mkNameSIdKey = mkPreludeMiscIdUnique 210 | 48 | false | false | 0 | 5 | 11 | 9 | 4 | 5 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/playpen/hcpn/src/NetAux.hs | unlicense | transGuardColour = darkgrey | 27 | transGuardColour = darkgrey | 27 | transGuardColour = darkgrey | 27 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
ddssff/lens | src/Control/Lens/Prism.hs | bsd-3-clause | -- | Given a pair of prisms, project sums.
--
-- Viewing a 'Prism' as a co-'Lens', this combinator can be seen to be dual to 'Control.Lens.Lens.alongside'.
without :: APrism s t a b
-> APrism u v c d
-> Prism (Either s u) (Either t v) (Either a c) (Either b d)
without k =
withPrism k $ \bt seta k' ->
withPrism k' $ \dv uevc ->
prism (bimap bt dv) $ \su ->
case su of
Left s -> bimap Left Left (seta s)
Right u -> bimap Right Right (uevc u)
| 493 | without :: APrism s t a b
-> APrism u v c d
-> Prism (Either s u) (Either t v) (Either a c) (Either b d)
without k =
withPrism k $ \bt seta k' ->
withPrism k' $ \dv uevc ->
prism (bimap bt dv) $ \su ->
case su of
Left s -> bimap Left Left (seta s)
Right u -> bimap Right Right (uevc u)
| 337 | without k =
withPrism k $ \bt seta k' ->
withPrism k' $ \dv uevc ->
prism (bimap bt dv) $ \su ->
case su of
Left s -> bimap Left Left (seta s)
Right u -> bimap Right Right (uevc u)
| 216 | true | true | 0 | 12 | 147 | 186 | 90 | 96 | null | null |
np/ling | Ling/Check/Core.hs | bsd-3-clause | checkRSession :: RSession -> TC ()
checkRSession (s `Repl` r) = checkSession s >> checkRFactor r | 96 | checkRSession :: RSession -> TC ()
checkRSession (s `Repl` r) = checkSession s >> checkRFactor r | 96 | checkRSession (s `Repl` r) = checkSession s >> checkRFactor r | 61 | false | true | 0 | 7 | 15 | 42 | 21 | 21 | null | null |
shlevy/ghc | compiler/typecheck/TcRnTypes.hs | bsd-3-clause | ctEvExpr :: CtEvidence -> EvExpr
ctEvExpr ev@(CtWanted { ctev_dest = HoleDest _ }) = evCoercion $ ctEvCoercion ev | 113 | ctEvExpr :: CtEvidence -> EvExpr
ctEvExpr ev@(CtWanted { ctev_dest = HoleDest _ }) = evCoercion $ ctEvCoercion ev | 113 | ctEvExpr ev@(CtWanted { ctev_dest = HoleDest _ }) = evCoercion $ ctEvCoercion ev | 80 | false | true | 5 | 6 | 17 | 46 | 23 | 23 | null | null |
tabemann/botwars | src/Robots/Genetic/HunterKiller/Utility.hs | bsd-3-clause | addVector :: (Double, Double) -> (Double, Double) -> (Double, Double)
addVector (x0, y0) (x1, y1) = (x0 + x1, y0 + y1) | 118 | addVector :: (Double, Double) -> (Double, Double) -> (Double, Double)
addVector (x0, y0) (x1, y1) = (x0 + x1, y0 + y1) | 118 | addVector (x0, y0) (x1, y1) = (x0 + x1, y0 + y1) | 48 | false | true | 0 | 7 | 21 | 68 | 40 | 28 | null | null |
LouisJenkinsCS/Minimal-JVM | LLVMFrontend/Helpers.hs | bsd-3-clause | -- Effects
call :: Operand -> [Operand] -> Instruction
call fn args = Call Nothing LCC.C [] (Right fn) (toArgs args) [] [] | 127 | call :: Operand -> [Operand] -> Instruction
call fn args = Call Nothing LCC.C [] (Right fn) (toArgs args) [] [] | 112 | call fn args = Call Nothing LCC.C [] (Right fn) (toArgs args) [] [] | 68 | true | true | 0 | 7 | 27 | 67 | 33 | 34 | null | null |
jean-edouard/manager | rpc-proxy/Msg/Json.hs | gpl-2.0 | newJConvContext :: (FreezeIOM ctx (Either e) m, MonadRpc e m) => m (JConvContext m)
newJConvContext =
do f <- sigFinder
return JConvContext {
findSig = \m ->
case m of
JMsgReq r ->
let q = QSig <$> Just (mkBusName_ (jreqDest r))
<*> Just (mkObjectPath_ (jreqPath r))
<*> Just (mkInterfaceName_ (jreqInterface r))
<*> Just (mkMemberName_ (jreqMethod r))
in case q of
Just (QSig b o i m) -> f b o i m
_ -> return Nothing
_ -> return Nothing
} | 617 | newJConvContext :: (FreezeIOM ctx (Either e) m, MonadRpc e m) => m (JConvContext m)
newJConvContext =
do f <- sigFinder
return JConvContext {
findSig = \m ->
case m of
JMsgReq r ->
let q = QSig <$> Just (mkBusName_ (jreqDest r))
<*> Just (mkObjectPath_ (jreqPath r))
<*> Just (mkInterfaceName_ (jreqInterface r))
<*> Just (mkMemberName_ (jreqMethod r))
in case q of
Just (QSig b o i m) -> f b o i m
_ -> return Nothing
_ -> return Nothing
} | 617 | newJConvContext =
do f <- sigFinder
return JConvContext {
findSig = \m ->
case m of
JMsgReq r ->
let q = QSig <$> Just (mkBusName_ (jreqDest r))
<*> Just (mkObjectPath_ (jreqPath r))
<*> Just (mkInterfaceName_ (jreqInterface r))
<*> Just (mkMemberName_ (jreqMethod r))
in case q of
Just (QSig b o i m) -> f b o i m
_ -> return Nothing
_ -> return Nothing
} | 533 | false | true | 0 | 26 | 258 | 225 | 108 | 117 | null | null |
coolhacks/scripts-hacks | examples/shellcheck-master/ShellCheck/Parser.hs | mit | prop_readForClause = isOk readForClause "for f in *; do rm \"$f\"; done" | 72 | prop_readForClause = isOk readForClause "for f in *; do rm \"$f\"; done" | 72 | prop_readForClause = isOk readForClause "for f in *; do rm \"$f\"; done" | 72 | false | false | 0 | 5 | 11 | 11 | 5 | 6 | null | null |
wouwouwou/2017_module_8 | src/haskell/series2/series2.hs | apache-2.0 | mmsort xs = [min] ++ mmsort (xs \\ [min,max]) ++ [max]
where
min = minimum xs
max = maximum xs | 117 | mmsort xs = [min] ++ mmsort (xs \\ [min,max]) ++ [max]
where
min = minimum xs
max = maximum xs | 117 | mmsort xs = [min] ++ mmsort (xs \\ [min,max]) ++ [max]
where
min = minimum xs
max = maximum xs | 117 | false | false | 0 | 10 | 42 | 58 | 30 | 28 | null | null |
CovenantEyes/log2sql | src/Converter.hs | mit | runWith :: Options -> [Text] -> IO ()
runWith (Options name outf fields delim) xs = withConnection fileName $ \c -> do
execute_ c createQuery
withTransaction c $
forM_ (zip [1..] xs) $ \(i, x) ->
execute c insertQuery (parseLine x) `catch` handleError i
where
fileName = T.unpack outf
tableName = name `enclosedBy` "\""
createQuery = toQ $ "CREATE TABLE IF NOT EXISTS " <> tableName <> " " <> columnDef
columnDef = "(id INTEGER PRIMARY KEY, " <> T.intercalate ", " (sqlColumn <$> fields) <> ")"
where sqlColumn = encloseWith "\"" >>> (<> " TEXT")
insertQuery = toQ $ "INSERT INTO " <> tableName <> " ("
<> T.intercalate ", " fields
<> ") VALUES ("
<> T.intercalate ", " (replicate (length fields) "?")
<> ")"
parseLine :: Text -> [Text]
parseLine x = clean <$> limitedSplitOn (length fields) delim x
where clean = T.dropAround (`elem` (" \"'" :: String))
handleError :: Int -> FormatError -> IO ()
handleError idx e = hPutStrLn stderr $ "Error on line " ++ show idx ++ ": " ++ show e | 1,182 | runWith :: Options -> [Text] -> IO ()
runWith (Options name outf fields delim) xs = withConnection fileName $ \c -> do
execute_ c createQuery
withTransaction c $
forM_ (zip [1..] xs) $ \(i, x) ->
execute c insertQuery (parseLine x) `catch` handleError i
where
fileName = T.unpack outf
tableName = name `enclosedBy` "\""
createQuery = toQ $ "CREATE TABLE IF NOT EXISTS " <> tableName <> " " <> columnDef
columnDef = "(id INTEGER PRIMARY KEY, " <> T.intercalate ", " (sqlColumn <$> fields) <> ")"
where sqlColumn = encloseWith "\"" >>> (<> " TEXT")
insertQuery = toQ $ "INSERT INTO " <> tableName <> " ("
<> T.intercalate ", " fields
<> ") VALUES ("
<> T.intercalate ", " (replicate (length fields) "?")
<> ")"
parseLine :: Text -> [Text]
parseLine x = clean <$> limitedSplitOn (length fields) delim x
where clean = T.dropAround (`elem` (" \"'" :: String))
handleError :: Int -> FormatError -> IO ()
handleError idx e = hPutStrLn stderr $ "Error on line " ++ show idx ++ ": " ++ show e | 1,181 | runWith (Options name outf fields delim) xs = withConnection fileName $ \c -> do
execute_ c createQuery
withTransaction c $
forM_ (zip [1..] xs) $ \(i, x) ->
execute c insertQuery (parseLine x) `catch` handleError i
where
fileName = T.unpack outf
tableName = name `enclosedBy` "\""
createQuery = toQ $ "CREATE TABLE IF NOT EXISTS " <> tableName <> " " <> columnDef
columnDef = "(id INTEGER PRIMARY KEY, " <> T.intercalate ", " (sqlColumn <$> fields) <> ")"
where sqlColumn = encloseWith "\"" >>> (<> " TEXT")
insertQuery = toQ $ "INSERT INTO " <> tableName <> " ("
<> T.intercalate ", " fields
<> ") VALUES ("
<> T.intercalate ", " (replicate (length fields) "?")
<> ")"
parseLine :: Text -> [Text]
parseLine x = clean <$> limitedSplitOn (length fields) delim x
where clean = T.dropAround (`elem` (" \"'" :: String))
handleError :: Int -> FormatError -> IO ()
handleError idx e = hPutStrLn stderr $ "Error on line " ++ show idx ++ ": " ++ show e | 1,143 | false | true | 21 | 14 | 377 | 436 | 203 | 233 | null | null |
goshakkk/Poker.hs | src/Cards.hs | mit | deckWithout :: [Card] -> Deck
deckWithout = (\\) deck | 53 | deckWithout :: [Card] -> Deck
deckWithout = (\\) deck | 53 | deckWithout = (\\) deck | 23 | false | true | 0 | 6 | 8 | 23 | 13 | 10 | null | null |
urbanslug/ghc | compiler/typecheck/TcGenDeriv.hs | bsd-3-clause | genAuxBindSpec loc (DerivMaxTag tycon)
= (mkHsVarBind loc rdr_name rhs,
L loc (TypeSig [L loc rdr_name] (L loc sig_ty) PlaceHolder))
where
rdr_name = maxtag_RDR tycon
sig_ty = HsCoreTy intTy
rhs = nlHsApp (nlHsVar intDataCon_RDR) (nlHsLit (HsIntPrim "" max_tag))
max_tag = case (tyConDataCons tycon) of
data_cons -> toInteger ((length data_cons) - fIRST_TAG) | 401 | genAuxBindSpec loc (DerivMaxTag tycon)
= (mkHsVarBind loc rdr_name rhs,
L loc (TypeSig [L loc rdr_name] (L loc sig_ty) PlaceHolder))
where
rdr_name = maxtag_RDR tycon
sig_ty = HsCoreTy intTy
rhs = nlHsApp (nlHsVar intDataCon_RDR) (nlHsLit (HsIntPrim "" max_tag))
max_tag = case (tyConDataCons tycon) of
data_cons -> toInteger ((length data_cons) - fIRST_TAG) | 401 | genAuxBindSpec loc (DerivMaxTag tycon)
= (mkHsVarBind loc rdr_name rhs,
L loc (TypeSig [L loc rdr_name] (L loc sig_ty) PlaceHolder))
where
rdr_name = maxtag_RDR tycon
sig_ty = HsCoreTy intTy
rhs = nlHsApp (nlHsVar intDataCon_RDR) (nlHsLit (HsIntPrim "" max_tag))
max_tag = case (tyConDataCons tycon) of
data_cons -> toInteger ((length data_cons) - fIRST_TAG) | 401 | false | false | 3 | 12 | 92 | 155 | 73 | 82 | null | null |
cirquit/hjc | src/Cmm/ControlFlowGraph.hs | mit | -- zipping instructions with their line number to created unique ids in order to allow same instructions to
-- have different activities
createControlFlowGraph :: (MachineFunction f i, Ord i, Show i) => f -> DirectedGraph (Unique i)
createControlFlowGraph f = addInstructionsToGraph emptyGraph body body
where
body = zip [1..] (machineFunctionBody f)
-- | creates a directed graph of the instructions and by connecting
-- subsequent instructions and the labels if it is a jump | 492 | createControlFlowGraph :: (MachineFunction f i, Ord i, Show i) => f -> DirectedGraph (Unique i)
createControlFlowGraph f = addInstructionsToGraph emptyGraph body body
where
body = zip [1..] (machineFunctionBody f)
-- | creates a directed graph of the instructions and by connecting
-- subsequent instructions and the labels if it is a jump | 354 | createControlFlowGraph f = addInstructionsToGraph emptyGraph body body
where
body = zip [1..] (machineFunctionBody f)
-- | creates a directed graph of the instructions and by connecting
-- subsequent instructions and the labels if it is a jump | 258 | true | true | 0 | 9 | 89 | 82 | 43 | 39 | null | null |
conal/lambda-ccc | src/LambdaCCC/Monomorphize.hs | bsd-3-clause | mySimplifiers :: [ReExpr]
mySimplifiers = [ watchR "castFloatAppUnivR" castFloatAppUnivR -- or castFloatAppR'
, watchR "castCastR" castCastR
, watchR "castTransitiveUnivR" castTransitiveUnivR
, watchR "letSubstTrivialR" letSubstTrivialR -- instead of letNonRecSubstSafeR
-- , letSubstOneOccR -- delay
-- Previous two lead to nontermination. Investigate.
-- , watchR "recastR" recastR -- Experimental
, nowatchR "caseReduceUnfoldsDictR" caseReduceUnfoldsDictR
, watchR "caseDefaultR" caseDefaultR
, watchR "reprAbstR" reprAbstR
, watchR "fromLitInteger" fromLitInteger
] | 745 | mySimplifiers :: [ReExpr]
mySimplifiers = [ watchR "castFloatAppUnivR" castFloatAppUnivR -- or castFloatAppR'
, watchR "castCastR" castCastR
, watchR "castTransitiveUnivR" castTransitiveUnivR
, watchR "letSubstTrivialR" letSubstTrivialR -- instead of letNonRecSubstSafeR
-- , letSubstOneOccR -- delay
-- Previous two lead to nontermination. Investigate.
-- , watchR "recastR" recastR -- Experimental
, nowatchR "caseReduceUnfoldsDictR" caseReduceUnfoldsDictR
, watchR "caseDefaultR" caseDefaultR
, watchR "reprAbstR" reprAbstR
, watchR "fromLitInteger" fromLitInteger
] | 745 | mySimplifiers = [ watchR "castFloatAppUnivR" castFloatAppUnivR -- or castFloatAppR'
, watchR "castCastR" castCastR
, watchR "castTransitiveUnivR" castTransitiveUnivR
, watchR "letSubstTrivialR" letSubstTrivialR -- instead of letNonRecSubstSafeR
-- , letSubstOneOccR -- delay
-- Previous two lead to nontermination. Investigate.
-- , watchR "recastR" recastR -- Experimental
, nowatchR "caseReduceUnfoldsDictR" caseReduceUnfoldsDictR
, watchR "caseDefaultR" caseDefaultR
, watchR "reprAbstR" reprAbstR
, watchR "fromLitInteger" fromLitInteger
] | 719 | false | true | 0 | 6 | 239 | 83 | 45 | 38 | null | null |
snoyberg/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | mapName = varQual gHC_BASE (fsLit "map") mapIdKey | 66 | mapName = varQual gHC_BASE (fsLit "map") mapIdKey | 66 | mapName = varQual gHC_BASE (fsLit "map") mapIdKey | 66 | false | false | 0 | 7 | 23 | 19 | 9 | 10 | null | null |
np/mime-bytestring | Codec/MIME/Base64.hs | bsd-3-clause | -- upper 4 bits of second val are known to be 0.
decoder [x,y,z] = take 2 (decode4 x y z 0 []) | 94 | decoder [x,y,z] = take 2 (decode4 x y z 0 []) | 45 | decoder [x,y,z] = take 2 (decode4 x y z 0 []) | 45 | true | false | 0 | 8 | 22 | 42 | 21 | 21 | null | null |
fumieval/combinator-interactive | Data/Combinator.hs | bsd-3-clause | ccParser :: Parser (Expr String)
ccParser = token $ foldl (:$) <$> term <*> many term where
term = token $ parens ccParser
<|> S <$ char 'S'
<|> K <$ char 'K'
<|> I <$ char 'I'
<|> lambda
<|> vacuous <$> stringLit
<|> vacuous <$> intLit
<|> Var <$> variable | 317 | ccParser :: Parser (Expr String)
ccParser = token $ foldl (:$) <$> term <*> many term where
term = token $ parens ccParser
<|> S <$ char 'S'
<|> K <$ char 'K'
<|> I <$ char 'I'
<|> lambda
<|> vacuous <$> stringLit
<|> vacuous <$> intLit
<|> Var <$> variable | 317 | ccParser = token $ foldl (:$) <$> term <*> many term where
term = token $ parens ccParser
<|> S <$ char 'S'
<|> K <$ char 'K'
<|> I <$ char 'I'
<|> lambda
<|> vacuous <$> stringLit
<|> vacuous <$> intLit
<|> Var <$> variable | 284 | false | true | 42 | 6 | 111 | 155 | 70 | 85 | null | null |
momomimachli/Hedsql | tests/Database/Hedsql/Statements/Create.hs | gpl-3.0 | simpleTable :: Create dbVendor
simpleTable = createTable "People"
[wrap (col "firstName" $ varchar 256)]
|> end | 119 | simpleTable :: Create dbVendor
simpleTable = createTable "People"
[wrap (col "firstName" $ varchar 256)]
|> end | 119 | simpleTable = createTable "People"
[wrap (col "firstName" $ varchar 256)]
|> end | 88 | false | true | 0 | 11 | 23 | 42 | 20 | 22 | null | null |
shlevy/ghc | compiler/codeGen/StgCmmClosure.hs | bsd-3-clause | lfUpdatable _ = False | 21 | lfUpdatable _ = False | 21 | lfUpdatable _ = False | 21 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
trobertson/merch | src/Merchandise/Types/Skill.hs | bsd-3-clause | modMax :: Float -> Skill -> Skill
modMax n s = s { _maxVal = newMax
, _currentVal = bounded (_minVal s) newMax (_currentVal s)
}
where newMax = n + (_maxVal s) | 197 | modMax :: Float -> Skill -> Skill
modMax n s = s { _maxVal = newMax
, _currentVal = bounded (_minVal s) newMax (_currentVal s)
}
where newMax = n + (_maxVal s) | 197 | modMax n s = s { _maxVal = newMax
, _currentVal = bounded (_minVal s) newMax (_currentVal s)
}
where newMax = n + (_maxVal s) | 163 | false | true | 0 | 9 | 70 | 75 | 39 | 36 | null | null |
tjakway/ghcjvm | compiler/prelude/PrelNames.hs | bsd-3-clause | quotRemIntegerName = varQual gHC_INTEGER_TYPE (fsLit "quotRemInteger") quotRemIntegerIdKey | 96 | quotRemIntegerName = varQual gHC_INTEGER_TYPE (fsLit "quotRemInteger") quotRemIntegerIdKey | 96 | quotRemIntegerName = varQual gHC_INTEGER_TYPE (fsLit "quotRemInteger") quotRemIntegerIdKey | 96 | false | false | 0 | 7 | 12 | 19 | 9 | 10 | null | null |
katydid/haslapse | test/Suite.hs | bsd-3-clause | newTestCase :: Algo -> TestSuiteCase -> T.TestTree
newTestCase algo c@(TestSuiteCase name g (XMLData t) want) =
HUnit.testCase (testName algo c) $ testDeriv algo name g t want | 177 | newTestCase :: Algo -> TestSuiteCase -> T.TestTree
newTestCase algo c@(TestSuiteCase name g (XMLData t) want) =
HUnit.testCase (testName algo c) $ testDeriv algo name g t want | 177 | newTestCase algo c@(TestSuiteCase name g (XMLData t) want) =
HUnit.testCase (testName algo c) $ testDeriv algo name g t want | 126 | false | true | 0 | 10 | 28 | 75 | 37 | 38 | null | null |
tdidriksen/copatterns | src/findus/examples.hs | mit | dataNat = DData "nat" nat | 25 | dataNat = DData "nat" nat | 25 | dataNat = DData "nat" nat | 25 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
jacekszymanski/wxHaskell | wxdirect/src/ParseC.hs | lgpl-2.1 | readHeaderFile :: FilePath -> IO [String]
readHeaderFile fname =
do
includeDirectories <- getIncludeDirectories
putStrLn ("Preprocessing and parsing file: " ++ fname ++
",\n using include directories: " ++ (unwords includeDirectories))
flattenComments .
filter (not . isPrefixOf "//") .
filter (not . isPrefixOf "#") .
lines <$>
readProcess
"cpp"
( includeDirectories ++
[ "-C" -- Keep the comments
, "-DWXC_TYPES_H" -- Make sure wxc_types.h is not preprocessed,
-- so the type macros are not replaced
-- (the parser scans for certain macros)
, fname -- The file to process
]
)
"" | 799 | readHeaderFile :: FilePath -> IO [String]
readHeaderFile fname =
do
includeDirectories <- getIncludeDirectories
putStrLn ("Preprocessing and parsing file: " ++ fname ++
",\n using include directories: " ++ (unwords includeDirectories))
flattenComments .
filter (not . isPrefixOf "//") .
filter (not . isPrefixOf "#") .
lines <$>
readProcess
"cpp"
( includeDirectories ++
[ "-C" -- Keep the comments
, "-DWXC_TYPES_H" -- Make sure wxc_types.h is not preprocessed,
-- so the type macros are not replaced
-- (the parser scans for certain macros)
, fname -- The file to process
]
)
"" | 799 | readHeaderFile fname =
do
includeDirectories <- getIncludeDirectories
putStrLn ("Preprocessing and parsing file: " ++ fname ++
",\n using include directories: " ++ (unwords includeDirectories))
flattenComments .
filter (not . isPrefixOf "//") .
filter (not . isPrefixOf "#") .
lines <$>
readProcess
"cpp"
( includeDirectories ++
[ "-C" -- Keep the comments
, "-DWXC_TYPES_H" -- Make sure wxc_types.h is not preprocessed,
-- so the type macros are not replaced
-- (the parser scans for certain macros)
, fname -- The file to process
]
)
"" | 757 | false | true | 0 | 14 | 309 | 131 | 67 | 64 | null | null |
beni55/haste-compiler | libraries/ghc-7.10/base/Data/Fixed.hs | bsd-3-clause | withDot :: String -> String
withDot "" = "" | 43 | withDot :: String -> String
withDot "" = "" | 43 | withDot "" = "" | 15 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
ggreif/clash-compiler | tests/shouldwork/Testbench/TB.hs | bsd-2-clause | testInput :: Signal Inp
testInput = stimuliGenerator $(v ([ (1,(Just (4,True), 0))
, (3,(Nothing, 1))
]::[(Signed 4,(Maybe (Signed 8,Bool),Bit))])) | 215 | testInput :: Signal Inp
testInput = stimuliGenerator $(v ([ (1,(Just (4,True), 0))
, (3,(Nothing, 1))
]::[(Signed 4,(Maybe (Signed 8,Bool),Bit))])) | 215 | testInput = stimuliGenerator $(v ([ (1,(Just (4,True), 0))
, (3,(Nothing, 1))
]::[(Signed 4,(Maybe (Signed 8,Bool),Bit))])) | 191 | false | true | 0 | 15 | 86 | 105 | 58 | 47 | null | null |
pparkkin/eta | compiler/ETA/CodeGen/Prim.hs | bsd-3-clause | emitPrimOp WordQuotRemOp args = do
codes1 <- emitPrimOp WordQuotOp args
codes2 <- emitPrimOp WordRemOp args
return $ codes1 ++ codes2 | 139 | emitPrimOp WordQuotRemOp args = do
codes1 <- emitPrimOp WordQuotOp args
codes2 <- emitPrimOp WordRemOp args
return $ codes1 ++ codes2 | 139 | emitPrimOp WordQuotRemOp args = do
codes1 <- emitPrimOp WordQuotOp args
codes2 <- emitPrimOp WordRemOp args
return $ codes1 ++ codes2 | 139 | false | false | 0 | 8 | 25 | 46 | 20 | 26 | null | null |
rudymatela/leancheck | test/Test.hs | bsd-3-clause | strictlyOrderedBy _ [_] = True | 30 | strictlyOrderedBy _ [_] = True | 30 | strictlyOrderedBy _ [_] = True | 30 | false | false | 0 | 6 | 4 | 14 | 7 | 7 | null | null |
Super-Fluid/heqet | Heqet/Types.hs | gpl-3.0 | lyGraceType = typeOf (LyGrace undefined) | 40 | lyGraceType = typeOf (LyGrace undefined) | 40 | lyGraceType = typeOf (LyGrace undefined) | 40 | false | false | 0 | 7 | 4 | 15 | 7 | 8 | null | null |
write-you-a-scheme-v2/scheme | src/Prim.hs | mit | cdr [] = return Nil | 30 | cdr [] = return Nil | 30 | cdr [] = return Nil | 30 | false | false | 0 | 5 | 15 | 15 | 6 | 9 | null | null |
cocreature/leksah | src/IDE/SourceCandy.hs | gpl-2.0 | positionToCandy :: TextEditor editor => CandyTable -> EditorBuffer editor -> (Int,Int) -> IDEM (Int,Int)
positionToCandy candyTable ebuf (line,column) = do
i1 <- getIterAtLine ebuf (max 0 (line - 1))
i2 <- forwardToLineEndC i1
text <- getText ebuf i1 i2 True
workBuffer <- simpleGtkBuffer text
transformFromCandy candyTable workBuffer
i3 <- getIterAtOffset workBuffer column
mark <- createTextMark workBuffer i3 True
transformToCandy candyTable workBuffer (const False)
i4 <- getIterAtTextMark workBuffer mark
columnNew <- getLineOffset i4
return (line,columnNew) | 662 | positionToCandy :: TextEditor editor => CandyTable -> EditorBuffer editor -> (Int,Int) -> IDEM (Int,Int)
positionToCandy candyTable ebuf (line,column) = do
i1 <- getIterAtLine ebuf (max 0 (line - 1))
i2 <- forwardToLineEndC i1
text <- getText ebuf i1 i2 True
workBuffer <- simpleGtkBuffer text
transformFromCandy candyTable workBuffer
i3 <- getIterAtOffset workBuffer column
mark <- createTextMark workBuffer i3 True
transformToCandy candyTable workBuffer (const False)
i4 <- getIterAtTextMark workBuffer mark
columnNew <- getLineOffset i4
return (line,columnNew) | 662 | positionToCandy candyTable ebuf (line,column) = do
i1 <- getIterAtLine ebuf (max 0 (line - 1))
i2 <- forwardToLineEndC i1
text <- getText ebuf i1 i2 True
workBuffer <- simpleGtkBuffer text
transformFromCandy candyTable workBuffer
i3 <- getIterAtOffset workBuffer column
mark <- createTextMark workBuffer i3 True
transformToCandy candyTable workBuffer (const False)
i4 <- getIterAtTextMark workBuffer mark
columnNew <- getLineOffset i4
return (line,columnNew) | 557 | false | true | 0 | 12 | 172 | 208 | 96 | 112 | null | null |
ezyang/ghc | compiler/typecheck/TcGenFunctor.hs | bsd-3-clause | bs_Vars = map nlHsVar bs_RDRs | 29 | bs_Vars = map nlHsVar bs_RDRs | 29 | bs_Vars = map nlHsVar bs_RDRs | 29 | false | false | 1 | 5 | 4 | 14 | 5 | 9 | null | null |
ahmadsalim/micro-dsl-properties | src/FJ.hs | gpl-3.0 | wellTypednessPropertySC :: Transformation a -> (Prog, a) -> LSC.Property
wellTypednessPropertySC tran (prog, aux) =
let
cprog = makeCached prog
progTy = checkTypes =<< cprog
tinput = TransformationInput (fromJust cprog) aux
in
LSC.lift (isJust progTy) LSC.*&* LSC.lift (tPrecond tran tinput)
LSC.*=>* let
progOut = tTrans tran tinput
in LSC.lift (isJust (checkTypes <$> (makeCached =<< (forgetTypeAnnotations <$> progOut)))) | 482 | wellTypednessPropertySC :: Transformation a -> (Prog, a) -> LSC.Property
wellTypednessPropertySC tran (prog, aux) =
let
cprog = makeCached prog
progTy = checkTypes =<< cprog
tinput = TransformationInput (fromJust cprog) aux
in
LSC.lift (isJust progTy) LSC.*&* LSC.lift (tPrecond tran tinput)
LSC.*=>* let
progOut = tTrans tran tinput
in LSC.lift (isJust (checkTypes <$> (makeCached =<< (forgetTypeAnnotations <$> progOut)))) | 482 | wellTypednessPropertySC tran (prog, aux) =
let
cprog = makeCached prog
progTy = checkTypes =<< cprog
tinput = TransformationInput (fromJust cprog) aux
in
LSC.lift (isJust progTy) LSC.*&* LSC.lift (tPrecond tran tinput)
LSC.*=>* let
progOut = tTrans tran tinput
in LSC.lift (isJust (checkTypes <$> (makeCached =<< (forgetTypeAnnotations <$> progOut)))) | 409 | false | true | 1 | 15 | 113 | 166 | 84 | 82 | null | null |
coubeatczech/product-profunctors | Data/Profunctor/Product/Flatten.hs | bsd-3-clause | flatten16 (a, (b, (c, (a4, (a5, (a6, (a7, (a8, (a9, (a10, (a11, (a12,
(a13, (a14, (a15, a16)))))))))))))))
= (a, b, c, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) | 190 | flatten16 (a, (b, (c, (a4, (a5, (a6, (a7, (a8, (a9, (a10, (a11, (a12,
(a13, (a14, (a15, a16)))))))))))))))
= (a, b, c, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) | 190 | flatten16 (a, (b, (c, (a4, (a5, (a6, (a7, (a8, (a9, (a10, (a11, (a12,
(a13, (a14, (a15, a16)))))))))))))))
= (a, b, c, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) | 190 | false | false | 0 | 20 | 46 | 147 | 96 | 51 | null | null |
hesiod/OpenGL | src/Graphics/Rendering/OpenGL/GL/Texturing/Specification.hs | bsd-3-clause | --------------------------------------------------------------------------------
texSubImage2D :: TwoDimensionalTextureTarget t => t -> Level -> TexturePosition2D -> TextureSize2D -> PixelData a -> IO ()
texSubImage2D target level (TexturePosition2D xOff yOff) (TextureSize2D w h) pd =
withPixelData pd $
glTexSubImage2D (marshalTwoDimensionalTextureTarget NoProxy target) level xOff yOff w h | 402 | texSubImage2D :: TwoDimensionalTextureTarget t => t -> Level -> TexturePosition2D -> TextureSize2D -> PixelData a -> IO ()
texSubImage2D target level (TexturePosition2D xOff yOff) (TextureSize2D w h) pd =
withPixelData pd $
glTexSubImage2D (marshalTwoDimensionalTextureTarget NoProxy target) level xOff yOff w h | 320 | texSubImage2D target level (TexturePosition2D xOff yOff) (TextureSize2D w h) pd =
withPixelData pd $
glTexSubImage2D (marshalTwoDimensionalTextureTarget NoProxy target) level xOff yOff w h | 197 | true | true | 0 | 12 | 51 | 102 | 49 | 53 | null | null |
andreagenso/java2scala | src/J2s/Ast/Syntax.hs | apache-2.0 | sem_PrimNNAClassOrInterfaceType_TypeZPrimNNAClassOrInterfaceType = TypeZPrimNNAClassOrInterfaceType | 99 | sem_PrimNNAClassOrInterfaceType_TypeZPrimNNAClassOrInterfaceType = TypeZPrimNNAClassOrInterfaceType | 99 | sem_PrimNNAClassOrInterfaceType_TypeZPrimNNAClassOrInterfaceType = TypeZPrimNNAClassOrInterfaceType | 99 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
facebook/fbthrift | thrift/lib/hs/Thrift/Transport/IOBuffer.hs | apache-2.0 | readBuf :: ReadBuffer -> Int -> IO LBS.ByteString
readBuf r n = do
bs <- readIORef r
let (hd, tl) = LBS.splitAt (fromIntegral n) bs
writeIORef r tl
return hd | 165 | readBuf :: ReadBuffer -> Int -> IO LBS.ByteString
readBuf r n = do
bs <- readIORef r
let (hd, tl) = LBS.splitAt (fromIntegral n) bs
writeIORef r tl
return hd | 165 | readBuf r n = do
bs <- readIORef r
let (hd, tl) = LBS.splitAt (fromIntegral n) bs
writeIORef r tl
return hd | 115 | false | true | 0 | 13 | 37 | 87 | 38 | 49 | null | null |
guibou/AdventOfCode2016 | src/Day4.hs | bsd-3-clause | parseName :: P.Parser String
parseName = P.many (P.oneOf ['a' .. 'z']) | 70 | parseName :: P.Parser String
parseName = P.many (P.oneOf ['a' .. 'z']) | 70 | parseName = P.many (P.oneOf ['a' .. 'z']) | 41 | false | true | 1 | 8 | 10 | 38 | 18 | 20 | null | null |
batterseapower/chsc | Core/Tag.hs | bsd-3-clause | mkDetag :: (forall a b. (a -> b) -> ann a -> ann' b)
-> (ann (TermF ann) -> ann' (TermF ann'),
[AltF ann] -> [AltF ann'],
ann (ValueF ann) -> ann' (ValueF ann'),
ValueF ann -> ValueF ann')
mkDetag rec = (term, alternatives, value, value')
where
term = rec term'
term' e = case e of
Var x -> Var x
Value v -> Value (value' v)
App e x -> App (term e) x
PrimOp pop es -> PrimOp pop (map term es)
Case e alts -> Case (term e) (alternatives alts)
LetRec xes e -> LetRec (map (second term) xes) (term e)
value = rec value'
value' (Indirect x) = Indirect x
value' (Lambda x e) = Lambda x (term e)
value' (Data dc xs) = Data dc xs
value' (Literal l) = Literal l
alternatives = map (second term) | 851 | mkDetag :: (forall a b. (a -> b) -> ann a -> ann' b)
-> (ann (TermF ann) -> ann' (TermF ann'),
[AltF ann] -> [AltF ann'],
ann (ValueF ann) -> ann' (ValueF ann'),
ValueF ann -> ValueF ann')
mkDetag rec = (term, alternatives, value, value')
where
term = rec term'
term' e = case e of
Var x -> Var x
Value v -> Value (value' v)
App e x -> App (term e) x
PrimOp pop es -> PrimOp pop (map term es)
Case e alts -> Case (term e) (alternatives alts)
LetRec xes e -> LetRec (map (second term) xes) (term e)
value = rec value'
value' (Indirect x) = Indirect x
value' (Lambda x e) = Lambda x (term e)
value' (Data dc xs) = Data dc xs
value' (Literal l) = Literal l
alternatives = map (second term) | 851 | mkDetag rec = (term, alternatives, value, value')
where
term = rec term'
term' e = case e of
Var x -> Var x
Value v -> Value (value' v)
App e x -> App (term e) x
PrimOp pop es -> PrimOp pop (map term es)
Case e alts -> Case (term e) (alternatives alts)
LetRec xes e -> LetRec (map (second term) xes) (term e)
value = rec value'
value' (Indirect x) = Indirect x
value' (Lambda x e) = Lambda x (term e)
value' (Data dc xs) = Data dc xs
value' (Literal l) = Literal l
alternatives = map (second term) | 605 | false | true | 16 | 12 | 307 | 402 | 199 | 203 | null | null |
BeautifulDestinations/caret | lib/Caret/BFGS.hs | mit | nanMsg :: Point -> Maybe Double -> Maybe Gradient -> String
nanMsg p fval grad = "NaNs produced: p = " ++ show p ++
maybe "" ((" fval = " ++) . show) fval ++
maybe "" ((" grad = " ++) . show) grad | 240 | nanMsg :: Point -> Maybe Double -> Maybe Gradient -> String
nanMsg p fval grad = "NaNs produced: p = " ++ show p ++
maybe "" ((" fval = " ++) . show) fval ++
maybe "" ((" grad = " ++) . show) grad | 240 | nanMsg p fval grad = "NaNs produced: p = " ++ show p ++
maybe "" ((" fval = " ++) . show) fval ++
maybe "" ((" grad = " ++) . show) grad | 180 | false | true | 0 | 10 | 89 | 87 | 44 | 43 | null | null |
DanielSchuessler/hstri | QuadCoordinates/Class.hs | gpl-3.0 | quadDominates
:: (QuadCoords q r, QuadCoords q1 r1) => q -> q1 -> Bool
quadDominates x y =
all
(\q -> quadCount x q /= 0)
(quadSupport y) | 160 | quadDominates
:: (QuadCoords q r, QuadCoords q1 r1) => q -> q1 -> Bool
quadDominates x y =
all
(\q -> quadCount x q /= 0)
(quadSupport y) | 160 | quadDominates x y =
all
(\q -> quadCount x q /= 0)
(quadSupport y) | 87 | false | true | 0 | 9 | 50 | 74 | 37 | 37 | null | null |
wouwouwou/2017_module_8 | src/haskell/PP-project-2017/lib/sprockell-2017/src/Sprockell/BasicFunctions.hs | apache-2.0 | -- regSprID: contains the sprockellID
regA = 2 :: Int | 65 | regA = 2 :: Int | 27 | regA = 2 :: Int | 27 | true | false | 0 | 4 | 21 | 13 | 7 | 6 | null | null |
kmate/HaRe | old/testing/demote/D1_AstOut.hs | bsd-3-clause | pow = 2 | 7 | pow = 2 | 7 | pow = 2 | 7 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
carlohamalainen/imagetrove-uploader | src/Network/MyTardis/API.hs | bsd-2-clause | getDataset :: URI -> ReaderT MyTardisConfig IO (Result RestDataset)
getDataset = getResource | 92 | getDataset :: URI -> ReaderT MyTardisConfig IO (Result RestDataset)
getDataset = getResource | 92 | getDataset = getResource | 24 | false | true | 0 | 9 | 11 | 34 | 15 | 19 | null | null |
marcelosousa/poet | src/Exploration/POR/ODPOR.hs | gpl-2.0 | pairEvents e (x:xs) =
let le = map ((,) e) (x:xs)
lx = pairEvents x xs
in le ++ lx | 99 | pairEvents e (x:xs) =
let le = map ((,) e) (x:xs)
lx = pairEvents x xs
in le ++ lx | 99 | pairEvents e (x:xs) =
let le = map ((,) e) (x:xs)
lx = pairEvents x xs
in le ++ lx | 99 | false | false | 0 | 12 | 36 | 64 | 32 | 32 | null | null |
adp-multi/adp-multi | tests/ADP/Tests/Suite.hs | bsd-3-clause | genAlphabetString typ alph =
sized $ \n ->
do s <- mapM (\_ -> elements alph) [0..round (sqrt (fromIntegral n))]
return $ typ s | 142 | genAlphabetString typ alph =
sized $ \n ->
do s <- mapM (\_ -> elements alph) [0..round (sqrt (fromIntegral n))]
return $ typ s | 142 | genAlphabetString typ alph =
sized $ \n ->
do s <- mapM (\_ -> elements alph) [0..round (sqrt (fromIntegral n))]
return $ typ s | 142 | false | false | 0 | 16 | 38 | 73 | 35 | 38 | null | null |
suhailshergill/liboleg | Language/TEval/TEvalNR.hs | bsd-3-clause | term2b = L "x" (TInt :> TInt) (L "y" TInt (vx `A` vy)) | 54 | term2b = L "x" (TInt :> TInt) (L "y" TInt (vx `A` vy)) | 54 | term2b = L "x" (TInt :> TInt) (L "y" TInt (vx `A` vy)) | 54 | false | false | 0 | 9 | 12 | 39 | 21 | 18 | null | null |
jgoerzen/dtmconv | HaXml-1.12/src/Text/XML/HaXml/Html/Pretty.hs | gpl-2.0 | --ev (EVPERef p e) = peref p
ev (EVRef r) = reference r | 87 | ev (EVRef r) = reference r | 44 | ev (EVRef r) = reference r | 44 | true | false | 0 | 7 | 44 | 19 | 9 | 10 | null | null |
jdimond/diplomarbeit | tools/Cluster.hs | bsd-3-clause | main :: IO ()
main = do
opts <- A.cmdArgs fmfArgs
when (length (clusterFiles opts) == 0) $ error "At least one clusterfile has to be given!"
putInfo $ "Loading Document collection in " ++ (show $ collection opts)
!coll <- C.loadDocCollection $ collection opts
!tps <- case (queryLogFile opts) of
Just f -> do putInfo "Loading Dictionary..."
!dict <- liftM D.buildWordMap $ C.loadTokenMap coll
putInfo "Loading queries..."
--Somewhere TIO.readFile is slow on large files, so
--read with ByteString instead
!queries <- liftM E.decodeUtf8 $ BS.readFile f
putInfo "Filtering query words..."
let terms = concatMap extractWords $ T.lines queries
let tokens = catMaybes $ map (D.lookupWord dict) terms
--return $ calcProbs (C.dictionarySize coll) tokens
return $ countTerms (C.dictionarySize coll) tokens
Nothing -> let (S.TFCounter arr) = C.tfCounter coll
in return arr
--return $ calcProbsFromTFs (C.tfCounter coll)
elemsV <- case (docLimit opts,randomDocs opts) of
(Just _, Just _) -> error "invalid configuration: use either doc-limit or random-docs"
(Just limit, Nothing) -> return $! VU.fromList $ take limit $ C.enumerateDocIds coll
(Nothing, Just rDocs) ->
do gen <- withSystemRandom (return :: (GenIO -> IO (GenIO)))
let allDocIds = VU.fromList $ C.enumerateDocIds coll
shuffled <- shuffleV gen allDocIds
return $! VU.fromList $ L.sort $ VU.toList $ VU.take rDocs shuffled
(Nothing, Nothing) -> return $! VU.fromList $ C.enumerateDocIds coll
putInfo "Loading collection..."
clustercoll <- FFI.loadCollection coll elemsV tps (numTerms opts)
let useTopDown = case (clusteringMode opts) of { CMNormal -> False; CMTopDown -> True }
putInfo "Clustering..."
forM_ (clusterFiles opts) $ \file ->
do putInfo $ "Running clustering for " ++ file
(time, as) <- time $ FFI.cluster clustercoll (numClusters opts) (shrinkFactor opts) useTopDown (not $ exactScoring opts)
let actualNumClusters = 1 + (fromIntegral $ Cl.unClusterId $ VU.maximum as)
clustering <- Cl.clusteringFromList actualNumClusters $ VU.toList $ VU.zip elemsV as
putInfo $ "Clustering took " ++ (show time) ++ "s"
putInfo "Saving clustering..."
encodeFile file clustering
putInfo "Done..." | 2,770 | main :: IO ()
main = do
opts <- A.cmdArgs fmfArgs
when (length (clusterFiles opts) == 0) $ error "At least one clusterfile has to be given!"
putInfo $ "Loading Document collection in " ++ (show $ collection opts)
!coll <- C.loadDocCollection $ collection opts
!tps <- case (queryLogFile opts) of
Just f -> do putInfo "Loading Dictionary..."
!dict <- liftM D.buildWordMap $ C.loadTokenMap coll
putInfo "Loading queries..."
--Somewhere TIO.readFile is slow on large files, so
--read with ByteString instead
!queries <- liftM E.decodeUtf8 $ BS.readFile f
putInfo "Filtering query words..."
let terms = concatMap extractWords $ T.lines queries
let tokens = catMaybes $ map (D.lookupWord dict) terms
--return $ calcProbs (C.dictionarySize coll) tokens
return $ countTerms (C.dictionarySize coll) tokens
Nothing -> let (S.TFCounter arr) = C.tfCounter coll
in return arr
--return $ calcProbsFromTFs (C.tfCounter coll)
elemsV <- case (docLimit opts,randomDocs opts) of
(Just _, Just _) -> error "invalid configuration: use either doc-limit or random-docs"
(Just limit, Nothing) -> return $! VU.fromList $ take limit $ C.enumerateDocIds coll
(Nothing, Just rDocs) ->
do gen <- withSystemRandom (return :: (GenIO -> IO (GenIO)))
let allDocIds = VU.fromList $ C.enumerateDocIds coll
shuffled <- shuffleV gen allDocIds
return $! VU.fromList $ L.sort $ VU.toList $ VU.take rDocs shuffled
(Nothing, Nothing) -> return $! VU.fromList $ C.enumerateDocIds coll
putInfo "Loading collection..."
clustercoll <- FFI.loadCollection coll elemsV tps (numTerms opts)
let useTopDown = case (clusteringMode opts) of { CMNormal -> False; CMTopDown -> True }
putInfo "Clustering..."
forM_ (clusterFiles opts) $ \file ->
do putInfo $ "Running clustering for " ++ file
(time, as) <- time $ FFI.cluster clustercoll (numClusters opts) (shrinkFactor opts) useTopDown (not $ exactScoring opts)
let actualNumClusters = 1 + (fromIntegral $ Cl.unClusterId $ VU.maximum as)
clustering <- Cl.clusteringFromList actualNumClusters $ VU.toList $ VU.zip elemsV as
putInfo $ "Clustering took " ++ (show time) ++ "s"
putInfo "Saving clustering..."
encodeFile file clustering
putInfo "Done..." | 2,770 | main = do
opts <- A.cmdArgs fmfArgs
when (length (clusterFiles opts) == 0) $ error "At least one clusterfile has to be given!"
putInfo $ "Loading Document collection in " ++ (show $ collection opts)
!coll <- C.loadDocCollection $ collection opts
!tps <- case (queryLogFile opts) of
Just f -> do putInfo "Loading Dictionary..."
!dict <- liftM D.buildWordMap $ C.loadTokenMap coll
putInfo "Loading queries..."
--Somewhere TIO.readFile is slow on large files, so
--read with ByteString instead
!queries <- liftM E.decodeUtf8 $ BS.readFile f
putInfo "Filtering query words..."
let terms = concatMap extractWords $ T.lines queries
let tokens = catMaybes $ map (D.lookupWord dict) terms
--return $ calcProbs (C.dictionarySize coll) tokens
return $ countTerms (C.dictionarySize coll) tokens
Nothing -> let (S.TFCounter arr) = C.tfCounter coll
in return arr
--return $ calcProbsFromTFs (C.tfCounter coll)
elemsV <- case (docLimit opts,randomDocs opts) of
(Just _, Just _) -> error "invalid configuration: use either doc-limit or random-docs"
(Just limit, Nothing) -> return $! VU.fromList $ take limit $ C.enumerateDocIds coll
(Nothing, Just rDocs) ->
do gen <- withSystemRandom (return :: (GenIO -> IO (GenIO)))
let allDocIds = VU.fromList $ C.enumerateDocIds coll
shuffled <- shuffleV gen allDocIds
return $! VU.fromList $ L.sort $ VU.toList $ VU.take rDocs shuffled
(Nothing, Nothing) -> return $! VU.fromList $ C.enumerateDocIds coll
putInfo "Loading collection..."
clustercoll <- FFI.loadCollection coll elemsV tps (numTerms opts)
let useTopDown = case (clusteringMode opts) of { CMNormal -> False; CMTopDown -> True }
putInfo "Clustering..."
forM_ (clusterFiles opts) $ \file ->
do putInfo $ "Running clustering for " ++ file
(time, as) <- time $ FFI.cluster clustercoll (numClusters opts) (shrinkFactor opts) useTopDown (not $ exactScoring opts)
let actualNumClusters = 1 + (fromIntegral $ Cl.unClusterId $ VU.maximum as)
clustering <- Cl.clusteringFromList actualNumClusters $ VU.toList $ VU.zip elemsV as
putInfo $ "Clustering took " ++ (show time) ++ "s"
putInfo "Saving clustering..."
encodeFile file clustering
putInfo "Done..." | 2,756 | false | true | 1 | 21 | 936 | 764 | 352 | 412 | null | null |
rvion/lamdu | Lamdu/GUI/ExpressionGui.hs | gpl-3.0 | listWithDelDests :: k -> k -> (a -> k) -> [a] -> [(k, k, a)]
listWithDelDests = ListUtils.withPrevNext | 102 | listWithDelDests :: k -> k -> (a -> k) -> [a] -> [(k, k, a)]
listWithDelDests = ListUtils.withPrevNext | 102 | listWithDelDests = ListUtils.withPrevNext | 41 | false | true | 0 | 10 | 17 | 51 | 29 | 22 | null | null |
vTurbine/ghc | compiler/cmm/CLabel.hs | bsd-3-clause | pprCLabel platform (DynamicLinkerLabel info lbl)
| cGhcWithNativeCodeGen == "YES"
= pprDynamicLinkerAsmLabel platform info lbl | 130 | pprCLabel platform (DynamicLinkerLabel info lbl)
| cGhcWithNativeCodeGen == "YES"
= pprDynamicLinkerAsmLabel platform info lbl | 130 | pprCLabel platform (DynamicLinkerLabel info lbl)
| cGhcWithNativeCodeGen == "YES"
= pprDynamicLinkerAsmLabel platform info lbl | 130 | false | false | 0 | 8 | 17 | 38 | 16 | 22 | null | null |
lukexi/haskell-opencv | src/OpenCV/Core/ArrayOps.hs | bsd-3-clause | matScalarMult
:: Mat shape channels depth -- ^
-> Double
-> Mat shape channels depth
matScalarMult src x = unsafePerformIO $ do
dst <- newEmptyMat
withPtr dst $ \dstPtr ->
withPtr src $ \srcPtr ->
[C.block| void {
*$(Mat * dstPtr) = *$(Mat * srcPtr) * $(double c'x);
}|]
pure $ unsafeCoerceMat dst
where
c'x = realToFrac x
{- | Calculates an absolute value of each matrix element.
<http://docs.opencv.org/3.0-last-rst/modules/core/doc/operations_on_arrays.html#abs OpenCV Sphinx doc>
-} | 550 | matScalarMult
:: Mat shape channels depth -- ^
-> Double
-> Mat shape channels depth
matScalarMult src x = unsafePerformIO $ do
dst <- newEmptyMat
withPtr dst $ \dstPtr ->
withPtr src $ \srcPtr ->
[C.block| void {
*$(Mat * dstPtr) = *$(Mat * srcPtr) * $(double c'x);
}|]
pure $ unsafeCoerceMat dst
where
c'x = realToFrac x
{- | Calculates an absolute value of each matrix element.
<http://docs.opencv.org/3.0-last-rst/modules/core/doc/operations_on_arrays.html#abs OpenCV Sphinx doc>
-} | 550 | matScalarMult src x = unsafePerformIO $ do
dst <- newEmptyMat
withPtr dst $ \dstPtr ->
withPtr src $ \srcPtr ->
[C.block| void {
*$(Mat * dstPtr) = *$(Mat * srcPtr) * $(double c'x);
}|]
pure $ unsafeCoerceMat dst
where
c'x = realToFrac x
{- | Calculates an absolute value of each matrix element.
<http://docs.opencv.org/3.0-last-rst/modules/core/doc/operations_on_arrays.html#abs OpenCV Sphinx doc>
-} | 453 | false | true | 1 | 12 | 136 | 113 | 53 | 60 | null | null |
DavidAlphaFox/darcs | hashed-storage/Storage/Hashed/Hash.hs | gpl-2.0 | encodeBase16 (SHA1 bs) = base16 bs | 34 | encodeBase16 (SHA1 bs) = base16 bs | 34 | encodeBase16 (SHA1 bs) = base16 bs | 34 | false | false | 0 | 7 | 5 | 18 | 8 | 10 | null | null |
snoyberg/ghc | compiler/llvmGen/Llvm/PpLlvm.hs | bsd-3-clause | ppSyncOrdering :: LlvmSyncOrdering -> SDoc
ppSyncOrdering SyncUnord = text "unordered" | 90 | ppSyncOrdering :: LlvmSyncOrdering -> SDoc
ppSyncOrdering SyncUnord = text "unordered" | 90 | ppSyncOrdering SyncUnord = text "unordered" | 47 | false | true | 0 | 5 | 13 | 21 | 10 | 11 | null | null |
meiersi/bytestring | Data/ByteString/Lazy/Char8.hs | bsd-3-clause | -- | 'minimum' returns the minimum value from a 'ByteString'
minimum :: ByteString -> Char
minimum = w2c . L.minimum | 116 | minimum :: ByteString -> Char
minimum = w2c . L.minimum | 55 | minimum = w2c . L.minimum | 25 | true | true | 0 | 6 | 19 | 22 | 12 | 10 | null | null |
apyrgio/snf-ganeti | test/hs/Test/Ganeti/HTools/Instance.hs | bsd-2-clause | -- * Arbitrary instances
-- | Generates a random instance with maximum disk/mem/cpu values.
genInstanceSmallerThan :: Int -> Int -> Int -> Maybe Int ->
Gen Instance.Instance
genInstanceSmallerThan lim_mem lim_dsk lim_cpu lim_spin = do
name <- genFQDN
mem <- choose (0, lim_mem)
dsk <- choose (0, lim_dsk)
run_st <- arbitrary
pn <- arbitrary
sn <- arbitrary
vcpus <- choose (0, lim_cpu)
dt <- arbitrary
spindles <- case lim_spin of
Nothing -> genMaybe $ choose (0, maxSpindles)
Just ls -> liftM Just $ choose (0, ls)
let disk = Instance.Disk dsk spindles
return $ Instance.create
name mem dsk [disk] vcpus run_st [] True pn sn dt 1 []
-- | Generates an instance smaller than a node. | 743 | genInstanceSmallerThan :: Int -> Int -> Int -> Maybe Int ->
Gen Instance.Instance
genInstanceSmallerThan lim_mem lim_dsk lim_cpu lim_spin = do
name <- genFQDN
mem <- choose (0, lim_mem)
dsk <- choose (0, lim_dsk)
run_st <- arbitrary
pn <- arbitrary
sn <- arbitrary
vcpus <- choose (0, lim_cpu)
dt <- arbitrary
spindles <- case lim_spin of
Nothing -> genMaybe $ choose (0, maxSpindles)
Just ls -> liftM Just $ choose (0, ls)
let disk = Instance.Disk dsk spindles
return $ Instance.create
name mem dsk [disk] vcpus run_st [] True pn sn dt 1 []
-- | Generates an instance smaller than a node. | 650 | genInstanceSmallerThan lim_mem lim_dsk lim_cpu lim_spin = do
name <- genFQDN
mem <- choose (0, lim_mem)
dsk <- choose (0, lim_dsk)
run_st <- arbitrary
pn <- arbitrary
sn <- arbitrary
vcpus <- choose (0, lim_cpu)
dt <- arbitrary
spindles <- case lim_spin of
Nothing -> genMaybe $ choose (0, maxSpindles)
Just ls -> liftM Just $ choose (0, ls)
let disk = Instance.Disk dsk spindles
return $ Instance.create
name mem dsk [disk] vcpus run_st [] True pn sn dt 1 []
-- | Generates an instance smaller than a node. | 542 | true | true | 0 | 13 | 177 | 244 | 118 | 126 | null | null |
zhangjiji/real-world-haskell | ch3.hs | mit | isPalindrome [] = True | 22 | isPalindrome [] = True | 22 | isPalindrome [] = True | 22 | false | false | 1 | 5 | 3 | 15 | 5 | 10 | null | null |
input-output-hk/pos-haskell-prototype | chain/src/Pos/Chain/Lrc/Fts.hs | mit | -- | Initialize the internal state for the 'followTheSatoshiM' algorithm by
-- the first stakeholder.
ftsStateInit :: (StakeholderId, Coin) -> FtsState
ftsStateInit (adr, val) = FtsState adr (coinIndexOffset val 0) | 214 | ftsStateInit :: (StakeholderId, Coin) -> FtsState
ftsStateInit (adr, val) = FtsState adr (coinIndexOffset val 0) | 112 | ftsStateInit (adr, val) = FtsState adr (coinIndexOffset val 0) | 62 | true | true | 0 | 7 | 29 | 45 | 25 | 20 | null | null |
jrockway/c2hs | src/C2HS/CHS/Lexer.hs | gpl-2.0 | whitespace :: CHSLexer
whitespace = (char ' ' `lexaction` \_ _ -> Nothing)
>||< ctrlLexer | 109 | whitespace :: CHSLexer
whitespace = (char ' ' `lexaction` \_ _ -> Nothing)
>||< ctrlLexer | 109 | whitespace = (char ' ' `lexaction` \_ _ -> Nothing)
>||< ctrlLexer | 86 | false | true | 0 | 8 | 34 | 34 | 19 | 15 | null | null |
iostat/relapse | src/Data/RLP.hs | mit | shortParser :: Word8 -> (a -> RLPObject) -> (S.ByteString -> Parser a) -> a -> Parser RLPObject
shortParser base constructor postProcessor def = do
len <- fromIntegral . subtract base <$> satisfy (\x -> x >= base && x <= (base + 55))
if len == 0
then return (constructor def)
else constructor <$> (take len >>= postProcessor) | 341 | shortParser :: Word8 -> (a -> RLPObject) -> (S.ByteString -> Parser a) -> a -> Parser RLPObject
shortParser base constructor postProcessor def = do
len <- fromIntegral . subtract base <$> satisfy (\x -> x >= base && x <= (base + 55))
if len == 0
then return (constructor def)
else constructor <$> (take len >>= postProcessor) | 341 | shortParser base constructor postProcessor def = do
len <- fromIntegral . subtract base <$> satisfy (\x -> x >= base && x <= (base + 55))
if len == 0
then return (constructor def)
else constructor <$> (take len >>= postProcessor) | 245 | false | true | 0 | 14 | 73 | 149 | 73 | 76 | null | null |
AlexMckey/FP101x-ItFP_Haskell | Sources/CaesarCipher.hs | cc0-1.0 | int2let :: Int -> Char
int2let n = chr (ord 'a' + n) | 52 | int2let :: Int -> Char
int2let n = chr (ord 'a' + n) | 52 | int2let n = chr (ord 'a' + n) | 29 | false | true | 0 | 8 | 12 | 37 | 16 | 21 | null | null |
jgonggrijp/net-prove | src/LG/TestGraph.hs | bsd-3-clause | c13u = Active 13 | 19 | c13u = Active 13 | 19 | c13u = Active 13 | 19 | false | false | 1 | 5 | 6 | 13 | 4 | 9 | null | null |
martin-kolinek/stack | src/Stack/Types/PackageDump.hs | bsd-3-clause | installedCacheVC :: VersionConfig InstalledCacheInner
installedCacheVC = storeVersionConfig "installed-v1" "GGyaE6qY9FOqeWtozuadKqS7_QM=" | 137 | installedCacheVC :: VersionConfig InstalledCacheInner
installedCacheVC = storeVersionConfig "installed-v1" "GGyaE6qY9FOqeWtozuadKqS7_QM=" | 137 | installedCacheVC = storeVersionConfig "installed-v1" "GGyaE6qY9FOqeWtozuadKqS7_QM=" | 83 | false | true | 1 | 5 | 8 | 22 | 9 | 13 | null | null |
eborden/website | src/Interpreter/JavaScript.hs | bsd-3-clause | keyCodeToOp :: Int -> Maybe Op
keyCodeToOp = \case
37 -> Just LeftOp
38 -> Just UpOp
39 -> Just RightOp
40 -> Just DownOp
_ -> Nothing | 144 | keyCodeToOp :: Int -> Maybe Op
keyCodeToOp = \case
37 -> Just LeftOp
38 -> Just UpOp
39 -> Just RightOp
40 -> Just DownOp
_ -> Nothing | 144 | keyCodeToOp = \case
37 -> Just LeftOp
38 -> Just UpOp
39 -> Just RightOp
40 -> Just DownOp
_ -> Nothing | 113 | false | true | 0 | 8 | 37 | 68 | 30 | 38 | null | null |
dbp/migrate | src/Database/Migrate.hs | gpl-3.0 | runMain :: MigrateT IO () -> IO ()
runMain act = do e <- getEnvSettings
runReaderT act e | 105 | runMain :: MigrateT IO () -> IO ()
runMain act = do e <- getEnvSettings
runReaderT act e | 105 | runMain act = do e <- getEnvSettings
runReaderT act e | 70 | false | true | 0 | 7 | 34 | 45 | 20 | 25 | null | null |
ancientlanguage/haskell-analysis | grammar/src/Grammar/Common/Decompose.hs | mit | decomposeChar '\x22E1' = "\x227D\x0338" | 39 | decomposeChar '\x22E1' = "\x227D\x0338" | 39 | decomposeChar '\x22E1' = "\x227D\x0338" | 39 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
rahulmutt/ghcvm | libraries/base/GHC/Natural.hs | bsd-3-clause | enumDeltaToNatural :: Natural -> Natural -> Natural -> [Natural]
enumDeltaToNatural x0 delta lim = go x0
where
go x | x > lim = []
| otherwise = x : go (x+delta) | 178 | enumDeltaToNatural :: Natural -> Natural -> Natural -> [Natural]
enumDeltaToNatural x0 delta lim = go x0
where
go x | x > lim = []
| otherwise = x : go (x+delta) | 178 | enumDeltaToNatural x0 delta lim = go x0
where
go x | x > lim = []
| otherwise = x : go (x+delta) | 113 | false | true | 2 | 8 | 48 | 93 | 42 | 51 | null | null |
vdweegen/UvA-Software_Testing | Lab5/Willem/Lecture5'.hs | gpl-3.0 | rowConstrnt, columnConstrnt, blockConstrnt, nrcConstrnt, allConstrnt :: Constrnt
rowConstrnt = [[(r,c)| c <- values ] | r <- values ] | 133 | rowConstrnt, columnConstrnt, blockConstrnt, nrcConstrnt, allConstrnt :: Constrnt
rowConstrnt = [[(r,c)| c <- values ] | r <- values ] | 133 | rowConstrnt = [[(r,c)| c <- values ] | r <- values ] | 52 | false | true | 0 | 8 | 18 | 47 | 30 | 17 | null | null |
bitemyapp/mustache | src/lib/Text/Mustache/Parser.hs | bsd-3-clause | parseSection ∷ MNodeParser
parseSection = do
sectionName ← genParseTag sectionBegin mempty
MustacheSection sectionName <$> parseText (return sectionName) | 157 | parseSection ∷ MNodeParser
parseSection = do
sectionName ← genParseTag sectionBegin mempty
MustacheSection sectionName <$> parseText (return sectionName) | 157 | parseSection = do
sectionName ← genParseTag sectionBegin mempty
MustacheSection sectionName <$> parseText (return sectionName) | 130 | false | true | 0 | 11 | 20 | 49 | 20 | 29 | null | null |
markus-git/imperative-edsl-vhdl | src/Language/Embedded/Hardware/Command/Frontend.hs | bsd-3-clause | -- | Thaw an immutable array to a mutable array without making a copy.
unsafeThawArray :: (ArrayCMD :<: instr, pred a)
=> IArray a -> ProgramT instr (Param2 exp pred) m (Array a)
unsafeThawArray = singleInj . UnsafeThawArray | 226 | unsafeThawArray :: (ArrayCMD :<: instr, pred a)
=> IArray a -> ProgramT instr (Param2 exp pred) m (Array a)
unsafeThawArray = singleInj . UnsafeThawArray | 155 | unsafeThawArray = singleInj . UnsafeThawArray | 45 | true | true | 1 | 10 | 39 | 70 | 33 | 37 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Generated/CanvasRenderingContext2D.hs | mit | -- | <https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D.transform Mozilla CanvasRenderingContext2D.transform documentation>
transform ::
(MonadDOM m) =>
CanvasRenderingContext2D ->
Float -> Float -> Float -> Float -> Float -> Float -> m ()
transform self m11 m12 m21 m22 dx dy
= liftDOM
(void
(self ^. jsf "transform"
[toJSVal m11, toJSVal m12, toJSVal m21, toJSVal m22, toJSVal dx,
toJSVal dy])) | 499 | transform ::
(MonadDOM m) =>
CanvasRenderingContext2D ->
Float -> Float -> Float -> Float -> Float -> Float -> m ()
transform self m11 m12 m21 m22 dx dy
= liftDOM
(void
(self ^. jsf "transform"
[toJSVal m11, toJSVal m12, toJSVal m21, toJSVal m22, toJSVal dx,
toJSVal dy])) | 350 | transform self m11 m12 m21 m22 dx dy
= liftDOM
(void
(self ^. jsf "transform"
[toJSVal m11, toJSVal m12, toJSVal m21, toJSVal m22, toJSVal dx,
toJSVal dy])) | 198 | true | true | 0 | 14 | 132 | 126 | 63 | 63 | null | null |
sampou-org/pfad | Code/Code05.hs | bsd-3-clause | table :: [A] -> [A] -> [(Int,Int,Int)]
table xs ys = map snd (map (tag 1) xxs /\/\ map (tag 2) yys)
where xxs = sortsubs' xs
yys = sortsubs' ys | 216 | table :: [A] -> [A] -> [(Int,Int,Int)]
table xs ys = map snd (map (tag 1) xxs /\/\ map (tag 2) yys)
where xxs = sortsubs' xs
yys = sortsubs' ys | 216 | table xs ys = map snd (map (tag 1) xxs /\/\ map (tag 2) yys)
where xxs = sortsubs' xs
yys = sortsubs' ys | 165 | false | true | 0 | 10 | 103 | 94 | 49 | 45 | null | null |
vTurbine/ghc | compiler/cmm/PprC.hs | bsd-3-clause | strangeRegType :: CmmReg -> Maybe SDoc
strangeRegType (CmmGlobal CCCS) = Just (text "struct CostCentreStack_ *") | 112 | strangeRegType :: CmmReg -> Maybe SDoc
strangeRegType (CmmGlobal CCCS) = Just (text "struct CostCentreStack_ *") | 112 | strangeRegType (CmmGlobal CCCS) = Just (text "struct CostCentreStack_ *") | 73 | false | true | 0 | 7 | 14 | 36 | 17 | 19 | null | null |
DavidAlphaFox/darcs | src/Darcs/UI/Commands/Pull.hs | gpl-2.0 | pull :: DarcsCommand [DarcsFlag]
pull = DarcsCommand
{ commandProgramName = "darcs"
, commandName = "pull"
, commandHelp = pullHelp
, commandDescription = pullDescription
, commandExtraArgs = -1
, commandExtraArgHelp = ["[REPOSITORY]..."]
, commandCommand = pullCmd StandardPatchApplier
, commandPrereq = amInHashedRepository
, commandGetArgPossibilities = getPreflist "repos"
, commandArgdefaults = defaultRepo
, commandAdvancedOptions = odesc pullAdvancedOpts
, commandBasicOptions = odesc pullBasicOpts
, commandDefaults = defaultFlags pullOpts
, commandCheckOptions = ocheck pullOpts
, commandParseOptions = onormalise pullOpts
} | 697 | pull :: DarcsCommand [DarcsFlag]
pull = DarcsCommand
{ commandProgramName = "darcs"
, commandName = "pull"
, commandHelp = pullHelp
, commandDescription = pullDescription
, commandExtraArgs = -1
, commandExtraArgHelp = ["[REPOSITORY]..."]
, commandCommand = pullCmd StandardPatchApplier
, commandPrereq = amInHashedRepository
, commandGetArgPossibilities = getPreflist "repos"
, commandArgdefaults = defaultRepo
, commandAdvancedOptions = odesc pullAdvancedOpts
, commandBasicOptions = odesc pullBasicOpts
, commandDefaults = defaultFlags pullOpts
, commandCheckOptions = ocheck pullOpts
, commandParseOptions = onormalise pullOpts
} | 697 | pull = DarcsCommand
{ commandProgramName = "darcs"
, commandName = "pull"
, commandHelp = pullHelp
, commandDescription = pullDescription
, commandExtraArgs = -1
, commandExtraArgHelp = ["[REPOSITORY]..."]
, commandCommand = pullCmd StandardPatchApplier
, commandPrereq = amInHashedRepository
, commandGetArgPossibilities = getPreflist "repos"
, commandArgdefaults = defaultRepo
, commandAdvancedOptions = odesc pullAdvancedOpts
, commandBasicOptions = odesc pullBasicOpts
, commandDefaults = defaultFlags pullOpts
, commandCheckOptions = ocheck pullOpts
, commandParseOptions = onormalise pullOpts
} | 664 | false | true | 1 | 8 | 138 | 142 | 81 | 61 | null | null |
kim/amazonka | amazonka-autoscaling/gen/Network/AWS/AutoScaling/Types.hs | mpl-2.0 | -- | A value between 0 and 100 that indicates the progress of the activity.
aProgress :: Lens' Activity (Maybe Int)
aProgress = lens _aProgress (\s a -> s { _aProgress = a }) | 174 | aProgress :: Lens' Activity (Maybe Int)
aProgress = lens _aProgress (\s a -> s { _aProgress = a }) | 98 | aProgress = lens _aProgress (\s a -> s { _aProgress = a }) | 58 | true | true | 0 | 9 | 33 | 46 | 25 | 21 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.