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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
joshuaclayton/unused | src/Unused/ResponseFilter.hs | mit | updateMatches :: ([TermMatch] -> [TermMatch]) -> TermMatchSet -> TermMatchSet
updateMatches fm = Map.map (updateMatchesWith $ fm . trMatches)
where
updateMatchesWith f tr = tr {trMatches = f tr} | 200 | updateMatches :: ([TermMatch] -> [TermMatch]) -> TermMatchSet -> TermMatchSet
updateMatches fm = Map.map (updateMatchesWith $ fm . trMatches)
where
updateMatchesWith f tr = tr {trMatches = f tr} | 200 | updateMatches fm = Map.map (updateMatchesWith $ fm . trMatches)
where
updateMatchesWith f tr = tr {trMatches = f tr} | 122 | false | true | 1 | 9 | 33 | 88 | 41 | 47 | null | null |
mb64/unit-calc | src/Units/Units.hs | gpl-3.0 | mile = miles | 12 | mile = miles | 12 | mile = miles | 12 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
markuspf/Idris-dev | src/Idris/Core/Evaluate.hs | bsd-3-clause | lookupP_all :: Bool -> Bool -> Name -> Context -> [Term]
lookupP_all all exact n ctxt
= do (n', def) <- names
p <- case def of
(Function ty tm, _, inj, a, _, _) -> return (P Ref n' ty, a)
(TyDecl nt ty, _, _, a, _, _) -> return (P nt n' ty, a)
(CaseOp _ ty _ _ _ _, _, inj, a, _, _) -> return (P Ref n' ty, a)
(Operator ty _ _, _, inj, a, _, _) -> return (P Ref n' ty, a)
case snd p of
Hidden -> if all then return (fst p) else []
Private -> if all then return (fst p) else []
_ -> return (fst p)
where
names = let ns = lookupCtxtName n (definitions ctxt) in
if exact
then filter (\ (n', d) -> n' == n) ns
else ns | 783 | lookupP_all :: Bool -> Bool -> Name -> Context -> [Term]
lookupP_all all exact n ctxt
= do (n', def) <- names
p <- case def of
(Function ty tm, _, inj, a, _, _) -> return (P Ref n' ty, a)
(TyDecl nt ty, _, _, a, _, _) -> return (P nt n' ty, a)
(CaseOp _ ty _ _ _ _, _, inj, a, _, _) -> return (P Ref n' ty, a)
(Operator ty _ _, _, inj, a, _, _) -> return (P Ref n' ty, a)
case snd p of
Hidden -> if all then return (fst p) else []
Private -> if all then return (fst p) else []
_ -> return (fst p)
where
names = let ns = lookupCtxtName n (definitions ctxt) in
if exact
then filter (\ (n', d) -> n' == n) ns
else ns | 783 | lookupP_all all exact n ctxt
= do (n', def) <- names
p <- case def of
(Function ty tm, _, inj, a, _, _) -> return (P Ref n' ty, a)
(TyDecl nt ty, _, _, a, _, _) -> return (P nt n' ty, a)
(CaseOp _ ty _ _ _ _, _, inj, a, _, _) -> return (P Ref n' ty, a)
(Operator ty _ _, _, inj, a, _, _) -> return (P Ref n' ty, a)
case snd p of
Hidden -> if all then return (fst p) else []
Private -> if all then return (fst p) else []
_ -> return (fst p)
where
names = let ns = lookupCtxtName n (definitions ctxt) in
if exact
then filter (\ (n', d) -> n' == n) ns
else ns | 726 | false | true | 0 | 13 | 315 | 389 | 206 | 183 | null | null |
fredokun/piexplorer | src/Syntax.hs | gpl-3.0 | simplifyProc1 (Match a b p _) | a == b = p | 42 | simplifyProc1 (Match a b p _) | a == b = p | 42 | simplifyProc1 (Match a b p _) | a == b = p | 42 | false | false | 0 | 8 | 11 | 31 | 14 | 17 | null | null |
yiannist/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | jqtExec :: String
jqtExec = "exec" | 34 | jqtExec :: String
jqtExec = "exec" | 34 | jqtExec = "exec" | 16 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
derkyjadex/tracks | Tracks/Layout.hs | mit | vertexDelta :: Graph -> Vertex -> Vertex -> Vector
vertexDelta g v u =
let pv = vertexPosition g v
pu = vertexPosition g u
in delta pv pu | 166 | vertexDelta :: Graph -> Vertex -> Vertex -> Vector
vertexDelta g v u =
let pv = vertexPosition g v
pu = vertexPosition g u
in delta pv pu | 166 | vertexDelta g v u =
let pv = vertexPosition g v
pu = vertexPosition g u
in delta pv pu | 115 | false | true | 0 | 9 | 57 | 65 | 30 | 35 | null | null |
seereason/wl-pprint-text | Text/PrettyPrint/Leijen/Text.hs | bsd-3-clause | consB :: Char -> Builder -> Builder
c `consB` b = B.singleton c `mappend` b | 81 | consB :: Char -> Builder -> Builder
c `consB` b = B.singleton c `mappend` b | 81 | c `consB` b = B.singleton c `mappend` b | 39 | false | true | 0 | 7 | 20 | 42 | 21 | 21 | null | null |
lukexi/ghc-7.8-arm64 | compiler/codeGen/StgCmmHeap.hs | bsd-3-clause | mkStaticClosure :: DynFlags -> CLabel -> CostCentreStack -> [CmmLit]
-> [CmmLit] -> [CmmLit] -> [CmmLit] -> [CmmLit]
mkStaticClosure dflags info_lbl ccs payload padding static_link_field saved_info_field
= [CmmLabel info_lbl]
++ staticProfHdr dflags ccs
++ concatMap (padLitToWord dflags) payload
++ padding
++ static_link_field
++ saved_info_field | 363 | mkStaticClosure :: DynFlags -> CLabel -> CostCentreStack -> [CmmLit]
-> [CmmLit] -> [CmmLit] -> [CmmLit] -> [CmmLit]
mkStaticClosure dflags info_lbl ccs payload padding static_link_field saved_info_field
= [CmmLabel info_lbl]
++ staticProfHdr dflags ccs
++ concatMap (padLitToWord dflags) payload
++ padding
++ static_link_field
++ saved_info_field | 363 | mkStaticClosure dflags info_lbl ccs payload padding static_link_field saved_info_field
= [CmmLabel info_lbl]
++ staticProfHdr dflags ccs
++ concatMap (padLitToWord dflags) payload
++ padding
++ static_link_field
++ saved_info_field | 244 | false | true | 10 | 14 | 57 | 119 | 57 | 62 | null | null |
flipstone/orville | orville-postgresql-libpq/src/Orville/PostgreSQL/Plan.hs | mit | {- |
'askParam' allows the input parameter for the plan to be retrieved as the
result of the plan. Together with 'bind' you can use this to get access to
the input parameter as a 'Planned' value.
-}
askParam :: Plan scope param param
askParam =
planOperation Op.askParam | 278 | askParam :: Plan scope param param
askParam =
planOperation Op.askParam | 73 | askParam =
planOperation Op.askParam | 38 | true | true | 1 | 6 | 55 | 29 | 12 | 17 | null | null |
adept/hagll | GSS.hs | bsd-3-clause | add :: (Eq lab, Ord lab) => lab -> Pos -> GState lab -> GState lab
add l i oldgs =
if not (desc `S.member` yu_)
then oldgs {er = desc:r, yu = S.insert desc yu_}
else oldgs
where
desc = (l, curr_u oldgs, i)
r = er oldgs
yu_ = yu oldgs
-- | @pop i@ adds descriptors (@label(u)@, @v@, @i@) to /R/ for every parent @v@ of
-- @u@, where @u@ is the current node. | 393 | add :: (Eq lab, Ord lab) => lab -> Pos -> GState lab -> GState lab
add l i oldgs =
if not (desc `S.member` yu_)
then oldgs {er = desc:r, yu = S.insert desc yu_}
else oldgs
where
desc = (l, curr_u oldgs, i)
r = er oldgs
yu_ = yu oldgs
-- | @pop i@ adds descriptors (@label(u)@, @v@, @i@) to /R/ for every parent @v@ of
-- @u@, where @u@ is the current node. | 393 | add l i oldgs =
if not (desc `S.member` yu_)
then oldgs {er = desc:r, yu = S.insert desc yu_}
else oldgs
where
desc = (l, curr_u oldgs, i)
r = er oldgs
yu_ = yu oldgs
-- | @pop i@ adds descriptors (@label(u)@, @v@, @i@) to /R/ for every parent @v@ of
-- @u@, where @u@ is the current node. | 326 | false | true | 0 | 9 | 113 | 140 | 74 | 66 | null | null |
eddywestbrook/hobbits | archival/TermFList.hs | bsd-3-clause | eval1 (App (Lam t) u) = Just <$> subst t u | 42 | eval1 (App (Lam t) u) = Just <$> subst t u | 42 | eval1 (App (Lam t) u) = Just <$> subst t u | 42 | false | false | 0 | 8 | 10 | 33 | 15 | 18 | null | null |
pegartillo95/CaseGenerator | src/Sets.hs | bsd-3-clause | -- Sets intersection
inter::Ord a => Set a -> Set a -> Set a
inter = S.intersection | 83 | inter::Ord a => Set a -> Set a -> Set a
inter = S.intersection | 62 | inter = S.intersection | 22 | true | true | 0 | 8 | 16 | 38 | 18 | 20 | null | null |
lpsmith/cabal-sign | src/Main.hs | bsd-3-clause | posixPath :: Tar.Entry -> PosixPath
posixPath = Tar.fromTarPathToPosixPath . Tar.entryTarPath | 93 | posixPath :: Tar.Entry -> PosixPath
posixPath = Tar.fromTarPathToPosixPath . Tar.entryTarPath | 93 | posixPath = Tar.fromTarPathToPosixPath . Tar.entryTarPath | 57 | false | true | 0 | 6 | 9 | 25 | 13 | 12 | null | null |
cdornan/idiot | Text/RE/PCRE/String.hs | bsd-3-clause | -- | find first match in text
(?=~) :: String
-> RE
-> Match String
(?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs | 163 | (?=~) :: String
-> RE
-> Match String
(?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs | 133 | (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs | 83 | true | true | 0 | 8 | 38 | 60 | 30 | 30 | null | null |
raek/toasters | Action.hs | mit | actions = sort (concatMap expand specs)
where
expand (move, start, count, step) =
let prios = take count (iterate (+step) start)
wrap prio = Action prio move
in map wrap prios
specs = [ (UTurn, 10, 6, 10)
, (TurnLeft, 70, 18, 20)
, (TurnRight, 80, 18, 20)
, (BackUp, 430, 6, 10)
, (Move1, 490, 18, 10)
, (Move2, 670, 12, 10)
, (Move3, 790, 6, 10)
] | 523 | actions = sort (concatMap expand specs)
where
expand (move, start, count, step) =
let prios = take count (iterate (+step) start)
wrap prio = Action prio move
in map wrap prios
specs = [ (UTurn, 10, 6, 10)
, (TurnLeft, 70, 18, 20)
, (TurnRight, 80, 18, 20)
, (BackUp, 430, 6, 10)
, (Move1, 490, 18, 10)
, (Move2, 670, 12, 10)
, (Move3, 790, 6, 10)
] | 523 | actions = sort (concatMap expand specs)
where
expand (move, start, count, step) =
let prios = take count (iterate (+step) start)
wrap prio = Action prio move
in map wrap prios
specs = [ (UTurn, 10, 6, 10)
, (TurnLeft, 70, 18, 20)
, (TurnRight, 80, 18, 20)
, (BackUp, 430, 6, 10)
, (Move1, 490, 18, 10)
, (Move2, 670, 12, 10)
, (Move3, 790, 6, 10)
] | 523 | false | false | 2 | 12 | 243 | 203 | 116 | 87 | null | null |
eijian/raytracer | src/Scene.hs | bsd-3-clause | --
-- PUBLIC
--
readScene :: String -> IO (Material, V.Vector Light, V.Vector Object)
readScene file = do
lines <- readConfig file
(lgts, objs) <- parseConfig ((intercalate "\n" lines) ++ "\n")
return (m_air, lgts, objs)
--
-- PRIVATE
-- | 245 | readScene :: String -> IO (Material, V.Vector Light, V.Vector Object)
readScene file = do
lines <- readConfig file
(lgts, objs) <- parseConfig ((intercalate "\n" lines) ++ "\n")
return (m_air, lgts, objs)
--
-- PRIVATE
-- | 228 | readScene file = do
lines <- readConfig file
(lgts, objs) <- parseConfig ((intercalate "\n" lines) ++ "\n")
return (m_air, lgts, objs)
--
-- PRIVATE
-- | 158 | true | true | 0 | 12 | 46 | 102 | 54 | 48 | null | null |
tangboyun/miranda | src/MiRanda/Diagram/HeatMap.hs | gpl-3.0 | plotCeRNAHeatmap !gr grs =
let colorOpt1 = Two white blue
colorOpt2 = Two blue white
clustOpt1 = ClustOpt colorOpt1
(Just (euclidAndCorr,CompleteLinkage,LeftTree))
(Just (euclidAndCorr,CompleteLinkage,TopTree))
clustOpt2 = ClustOpt colorOpt2
(Just (euclidAndCorr,CompleteLinkage,LeftTree))
(Just (euclidAndCorr,CompleteLinkage,TopTree))
mH = fromIntegral (nRow $ datM dset1) * 12
mW = fromIntegral (nCol $ datM dset1) * 12
treeH = (min mH mW) * 0.25
lineW = (min mH mW) * 5.0e-5
fontS = 10
fontN = "Arial"
dp@(!dset1,!dset2) = mkDataset gr grs
toColorV = (\(i,a) ->
ColorVal i ((i+a)*0.5) a
) . minMax . dat . datM
-- toColorV2 = (\v ->
-- let i = continuousBy medianUnbiased 2 100 v
-- a = UV.maximum v
-- in ColorVal i ((i+a)*0.5) a
-- ) . dat . datM
colorV1 = toColorV dset1
colorV2 = toColorV dset2
para1 = Para clustOpt1 colorV1 mH mW treeH lineW treeH
lineW fontS fontS fontS fontN Horizontal Quality
para2 = para1 { clustOpt = clustOpt2
, colorVal = colorV2 }
in (fst . plotHeatMap para1) ***
(fst . plotHeatMap para2) $ dp | 1,421 | plotCeRNAHeatmap !gr grs =
let colorOpt1 = Two white blue
colorOpt2 = Two blue white
clustOpt1 = ClustOpt colorOpt1
(Just (euclidAndCorr,CompleteLinkage,LeftTree))
(Just (euclidAndCorr,CompleteLinkage,TopTree))
clustOpt2 = ClustOpt colorOpt2
(Just (euclidAndCorr,CompleteLinkage,LeftTree))
(Just (euclidAndCorr,CompleteLinkage,TopTree))
mH = fromIntegral (nRow $ datM dset1) * 12
mW = fromIntegral (nCol $ datM dset1) * 12
treeH = (min mH mW) * 0.25
lineW = (min mH mW) * 5.0e-5
fontS = 10
fontN = "Arial"
dp@(!dset1,!dset2) = mkDataset gr grs
toColorV = (\(i,a) ->
ColorVal i ((i+a)*0.5) a
) . minMax . dat . datM
-- toColorV2 = (\v ->
-- let i = continuousBy medianUnbiased 2 100 v
-- a = UV.maximum v
-- in ColorVal i ((i+a)*0.5) a
-- ) . dat . datM
colorV1 = toColorV dset1
colorV2 = toColorV dset2
para1 = Para clustOpt1 colorV1 mH mW treeH lineW treeH
lineW fontS fontS fontS fontN Horizontal Quality
para2 = para1 { clustOpt = clustOpt2
, colorVal = colorV2 }
in (fst . plotHeatMap para1) ***
(fst . plotHeatMap para2) $ dp | 1,421 | plotCeRNAHeatmap !gr grs =
let colorOpt1 = Two white blue
colorOpt2 = Two blue white
clustOpt1 = ClustOpt colorOpt1
(Just (euclidAndCorr,CompleteLinkage,LeftTree))
(Just (euclidAndCorr,CompleteLinkage,TopTree))
clustOpt2 = ClustOpt colorOpt2
(Just (euclidAndCorr,CompleteLinkage,LeftTree))
(Just (euclidAndCorr,CompleteLinkage,TopTree))
mH = fromIntegral (nRow $ datM dset1) * 12
mW = fromIntegral (nCol $ datM dset1) * 12
treeH = (min mH mW) * 0.25
lineW = (min mH mW) * 5.0e-5
fontS = 10
fontN = "Arial"
dp@(!dset1,!dset2) = mkDataset gr grs
toColorV = (\(i,a) ->
ColorVal i ((i+a)*0.5) a
) . minMax . dat . datM
-- toColorV2 = (\v ->
-- let i = continuousBy medianUnbiased 2 100 v
-- a = UV.maximum v
-- in ColorVal i ((i+a)*0.5) a
-- ) . dat . datM
colorV1 = toColorV dset1
colorV2 = toColorV dset2
para1 = Para clustOpt1 colorV1 mH mW treeH lineW treeH
lineW fontS fontS fontS fontN Horizontal Quality
para2 = para1 { clustOpt = clustOpt2
, colorVal = colorV2 }
in (fst . plotHeatMap para1) ***
(fst . plotHeatMap para2) $ dp | 1,421 | false | false | 1 | 18 | 559 | 387 | 207 | 180 | null | null |
input-output-hk/pos-haskell-prototype | chain/test/Test/Pos/Chain/Genesis/Gen.hs | mit | genGenesisSpec :: ProtocolMagic -> Gen GenesisSpec
genGenesisSpec pm = mkGenSpec >>= either (error . toText) pure
where
mkGenSpec = mkGenesisSpec
<$> genGenesisAvvmBalances
<*> genSharedSeed
<*> genGenesisDelegation pm
<*> genBlockVersionData
<*> genGenesisProtocolConstants pm
<*> genGenesisInitializer | 448 | genGenesisSpec :: ProtocolMagic -> Gen GenesisSpec
genGenesisSpec pm = mkGenSpec >>= either (error . toText) pure
where
mkGenSpec = mkGenesisSpec
<$> genGenesisAvvmBalances
<*> genSharedSeed
<*> genGenesisDelegation pm
<*> genBlockVersionData
<*> genGenesisProtocolConstants pm
<*> genGenesisInitializer | 448 | genGenesisSpec pm = mkGenSpec >>= either (error . toText) pure
where
mkGenSpec = mkGenesisSpec
<$> genGenesisAvvmBalances
<*> genSharedSeed
<*> genGenesisDelegation pm
<*> genBlockVersionData
<*> genGenesisProtocolConstants pm
<*> genGenesisInitializer | 397 | false | true | 0 | 10 | 178 | 75 | 36 | 39 | null | null |
urbit/urbit | pkg/hs/urbit-king/lib/Urbit/Vere/Eyre/Wai.hs | mit | sendResponse
:: HasLogFunc e
=> (W.Response -> IO W.ResponseReceived)
-> STM RespAct
-> RIO e W.ResponseReceived
sendResponse cb waitAct = do
env <- ask
atomically waitAct >>= \case
RADone -> io $ cb $ W.responseLBS (H.mkStatus 444 "No Response") [] ""
RAFull s h b -> io $ cb $ W.responseLBS s h $ fromStrict b
RAHead s h b -> io $ cb $ W.responseSource s h $ streamBlocks env b waitAct
RABloc _ -> noHeader | 446 | sendResponse
:: HasLogFunc e
=> (W.Response -> IO W.ResponseReceived)
-> STM RespAct
-> RIO e W.ResponseReceived
sendResponse cb waitAct = do
env <- ask
atomically waitAct >>= \case
RADone -> io $ cb $ W.responseLBS (H.mkStatus 444 "No Response") [] ""
RAFull s h b -> io $ cb $ W.responseLBS s h $ fromStrict b
RAHead s h b -> io $ cb $ W.responseSource s h $ streamBlocks env b waitAct
RABloc _ -> noHeader | 446 | sendResponse cb waitAct = do
env <- ask
atomically waitAct >>= \case
RADone -> io $ cb $ W.responseLBS (H.mkStatus 444 "No Response") [] ""
RAFull s h b -> io $ cb $ W.responseLBS s h $ fromStrict b
RAHead s h b -> io $ cb $ W.responseSource s h $ streamBlocks env b waitAct
RABloc _ -> noHeader | 325 | false | true | 0 | 15 | 114 | 197 | 90 | 107 | null | null |
mokus0/s-expression | src/Text/SExpr/Type.hs | bsd-3-clause | -- |Deconstruct a hinted atom.
fromHinted :: Hinted h a -> (Maybe h, a)
fromHinted (Hinted h a) = (Just h, a) | 110 | fromHinted :: Hinted h a -> (Maybe h, a)
fromHinted (Hinted h a) = (Just h, a) | 79 | fromHinted (Hinted h a) = (Just h, a) | 38 | true | true | 0 | 9 | 22 | 56 | 27 | 29 | null | null |
brianshourd/haskell-Calypso | Calypso/Core.hs | bsd-3-clause | {- |
Cap the velocity at the magnitude of the given @Integer -> a@ (fed by
the current iteration).
-}
upVMaxDynamic :: (PsoSized a, Grade b) => (Integer -> Double) -> Updater a b
upVMaxDynamic max = Updater f
where
f gen (Particle _ v _) _ i = case compare (pSqMag v) ((max i)^2) of
GT -> (pScale (max i) (unitV v), gen)
_ -> (v, gen)
unitV v = pScale ((/) 1 . sqrt . pSqMag $ v) v
{- $updaters
These updaters are some of the updaters that I could find in papers on
PSO. In particular, the @'upStandard'@ updater is recent and performs
well in a myriad of situations.
-}
{- |
Create an @'Updater'@ using the so-called /standard PSO/ parameters,
given in
Bratton, Daniel, and James Kennedy. \"Defining a standard for particle
swarm optimization.\" Swarm Intelligence Symposium, 2007. SIS 2007. IEEE.
IEEE, 2007.
If in doubt, the paper suggests that the constriction parameter be given
by the formula chi = 2 / abs(2 - phi - sqrt(phi^2 - 4 * phi)) where phi
= c1 + c2 and phi > 4.
-} | 1,012 | upVMaxDynamic :: (PsoSized a, Grade b) => (Integer -> Double) -> Updater a b
upVMaxDynamic max = Updater f
where
f gen (Particle _ v _) _ i = case compare (pSqMag v) ((max i)^2) of
GT -> (pScale (max i) (unitV v), gen)
_ -> (v, gen)
unitV v = pScale ((/) 1 . sqrt . pSqMag $ v) v
{- $updaters
These updaters are some of the updaters that I could find in papers on
PSO. In particular, the @'upStandard'@ updater is recent and performs
well in a myriad of situations.
-}
{- |
Create an @'Updater'@ using the so-called /standard PSO/ parameters,
given in
Bratton, Daniel, and James Kennedy. \"Defining a standard for particle
swarm optimization.\" Swarm Intelligence Symposium, 2007. SIS 2007. IEEE.
IEEE, 2007.
If in doubt, the paper suggests that the constriction parameter be given
by the formula chi = 2 / abs(2 - phi - sqrt(phi^2 - 4 * phi)) where phi
= c1 + c2 and phi > 4.
-} | 910 | upVMaxDynamic max = Updater f
where
f gen (Particle _ v _) _ i = case compare (pSqMag v) ((max i)^2) of
GT -> (pScale (max i) (unitV v), gen)
_ -> (v, gen)
unitV v = pScale ((/) 1 . sqrt . pSqMag $ v) v
{- $updaters
These updaters are some of the updaters that I could find in papers on
PSO. In particular, the @'upStandard'@ updater is recent and performs
well in a myriad of situations.
-}
{- |
Create an @'Updater'@ using the so-called /standard PSO/ parameters,
given in
Bratton, Daniel, and James Kennedy. \"Defining a standard for particle
swarm optimization.\" Swarm Intelligence Symposium, 2007. SIS 2007. IEEE.
IEEE, 2007.
If in doubt, the paper suggests that the constriction parameter be given
by the formula chi = 2 / abs(2 - phi - sqrt(phi^2 - 4 * phi)) where phi
= c1 + c2 and phi > 4.
-} | 833 | true | true | 0 | 11 | 217 | 181 | 93 | 88 | null | null |
brendanhay/gogol | gogol-ml/gen/Network/Google/MachineLearning/Types/Product.hs | mpl-2.0 | -- | Required. The name specified for the version when it was created. The
-- version name must be unique within the model it is created in.
gcmvvName :: Lens' GoogleCloudMlV1__Version (Maybe Text)
gcmvvName
= lens _gcmvvName (\ s a -> s{_gcmvvName = a}) | 256 | gcmvvName :: Lens' GoogleCloudMlV1__Version (Maybe Text)
gcmvvName
= lens _gcmvvName (\ s a -> s{_gcmvvName = a}) | 115 | gcmvvName
= lens _gcmvvName (\ s a -> s{_gcmvvName = a}) | 58 | true | true | 0 | 9 | 45 | 49 | 26 | 23 | null | null |
ggreif/clash-compiler | clash-lib/src/CLaSH/Rewrite/Combinators.hs | bsd-2-clause | bottomupWhenR :: (Monad m, Fresh m, Functor m)
=> ([CoreContext] -> Term -> m Bool)
-> Transform m
-> Transform m
bottomupWhenR f r ctx expr = do
b <- f ctx expr
if b
then (allR True (bottomupWhenR f r) >-> r) ctx expr
else r ctx expr | 288 | bottomupWhenR :: (Monad m, Fresh m, Functor m)
=> ([CoreContext] -> Term -> m Bool)
-> Transform m
-> Transform m
bottomupWhenR f r ctx expr = do
b <- f ctx expr
if b
then (allR True (bottomupWhenR f r) >-> r) ctx expr
else r ctx expr | 288 | bottomupWhenR f r ctx expr = do
b <- f ctx expr
if b
then (allR True (bottomupWhenR f r) >-> r) ctx expr
else r ctx expr | 132 | false | true | 0 | 13 | 102 | 125 | 61 | 64 | null | null |
kylcarte/threepenny-extras | src/Foundation/Common.hs | bsd-3-clause | foundationGUI :: Config -> (Window -> IO ()) -> IO ()
foundationGUI c f = startGUI c $ \w -> void $ do
_ <- getHead w #+ [ script # set UI.src "/static/js/custom.modernizr.js" ]
UI.addStyleSheet w "normalize.css"
UI.addStyleSheet w "foundation.css"
f w
getBody w #+
[ script # set UI.src "/static/js/foundation.min.js"
, script # set UI.src "/static/js/foundation.forms.js"
, script #~ "$(document).foundation();"
]
-- Label {{{ | 455 | foundationGUI :: Config -> (Window -> IO ()) -> IO ()
foundationGUI c f = startGUI c $ \w -> void $ do
_ <- getHead w #+ [ script # set UI.src "/static/js/custom.modernizr.js" ]
UI.addStyleSheet w "normalize.css"
UI.addStyleSheet w "foundation.css"
f w
getBody w #+
[ script # set UI.src "/static/js/foundation.min.js"
, script # set UI.src "/static/js/foundation.forms.js"
, script #~ "$(document).foundation();"
]
-- Label {{{ | 455 | foundationGUI c f = startGUI c $ \w -> void $ do
_ <- getHead w #+ [ script # set UI.src "/static/js/custom.modernizr.js" ]
UI.addStyleSheet w "normalize.css"
UI.addStyleSheet w "foundation.css"
f w
getBody w #+
[ script # set UI.src "/static/js/foundation.min.js"
, script # set UI.src "/static/js/foundation.forms.js"
, script #~ "$(document).foundation();"
]
-- Label {{{ | 401 | false | true | 0 | 15 | 92 | 157 | 74 | 83 | null | null |
eklavya/Idris-dev | src/Idris/REPL.hs | bsd-3-clause | edit :: FilePath -> IState -> Idris ()
edit "" orig = iputStrLn "Nothing to edit" | 81 | edit :: FilePath -> IState -> Idris ()
edit "" orig = iputStrLn "Nothing to edit" | 81 | edit "" orig = iputStrLn "Nothing to edit" | 42 | false | true | 0 | 8 | 15 | 32 | 15 | 17 | null | null |
oulgen/CudaPy | py2cuda/src/AST/Operations.hs | mit | isAssociative Mul = True | 24 | isAssociative Mul = True | 24 | isAssociative Mul = True | 24 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
shapr/adventofcode2016 | src/Twelve/Main.hs | bsd-3-clause | getlens 'd' = d | 15 | getlens 'd' = d | 15 | getlens 'd' = d | 15 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
oldmanmike/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | emitPrimOp _ [] CopyMutableByteArrayOp [src,src_off,dst,dst_off,n] =
doCopyMutableByteArrayOp src src_off dst dst_off n | 128 | emitPrimOp _ [] CopyMutableByteArrayOp [src,src_off,dst,dst_off,n] =
doCopyMutableByteArrayOp src src_off dst dst_off n | 128 | emitPrimOp _ [] CopyMutableByteArrayOp [src,src_off,dst,dst_off,n] =
doCopyMutableByteArrayOp src src_off dst dst_off n | 128 | false | false | 0 | 6 | 20 | 43 | 23 | 20 | null | null |
lubomir/machacek | Main.hs | gpl-3.0 | filterVars :: Char -> [(String, Double)] -> IntMap Double
filterVars v = I.fromList . map (first (read . tail))
. filter ((==v) . head . fst) | 167 | filterVars :: Char -> [(String, Double)] -> IntMap Double
filterVars v = I.fromList . map (first (read . tail))
. filter ((==v) . head . fst) | 167 | filterVars v = I.fromList . map (first (read . tail))
. filter ((==v) . head . fst) | 109 | false | true | 0 | 11 | 51 | 78 | 41 | 37 | null | null |
JakeWheat/Chaos-2010 | Games/Chaos2010/Database/Wizard_spell_choices_imaginary.hs | bsd-3-clause | wizard_spell_choices_imaginary ::
Table Wizard_spell_choices_imaginary
wizard_spell_choices_imaginary
= baseTable "wizard_spell_choices_imaginary" | 179 | wizard_spell_choices_imaginary ::
Table Wizard_spell_choices_imaginary
wizard_spell_choices_imaginary
= baseTable "wizard_spell_choices_imaginary" | 179 | wizard_spell_choices_imaginary
= baseTable "wizard_spell_choices_imaginary" | 77 | false | true | 0 | 6 | 40 | 23 | 9 | 14 | null | null |
happlebao/Core-Haskell | SyntaxChecker.hs | bsd-3-clause | isCoreSpecialCon src FunCon = Left (NotAllowed "FunCon" src) | 60 | isCoreSpecialCon src FunCon = Left (NotAllowed "FunCon" src) | 60 | isCoreSpecialCon src FunCon = Left (NotAllowed "FunCon" src) | 60 | false | false | 0 | 7 | 7 | 23 | 10 | 13 | null | null |
uduki/hsQt | Qtc/Enums/Core/QRegExp.hs | bsd-2-clause | iePatternSyntax :: Int -> PatternSyntax
iePatternSyntax x = QEnum (CPatternSyntax x) | 84 | iePatternSyntax :: Int -> PatternSyntax
iePatternSyntax x = QEnum (CPatternSyntax x) | 84 | iePatternSyntax x = QEnum (CPatternSyntax x) | 44 | false | true | 0 | 7 | 10 | 27 | 13 | 14 | null | null |
petabricks/petabricks | scripts/oldtuner2/src/GP/Genetic.hs | mit | -- Evolves a new syntax tree from a population
evolveTree :: [EvaluatedSyntaxTree] -> EvolverState a b c EvaluatedSyntaxTree
evolveTree trees = do state <- get
r1 <- randDouble
r2 <- randDouble
parent1 <- if r1 >= (randomSelectionProbability state)
then selectForReproduction fitness trees
else randElt trees
parent2 <- if r2 >= (randomSelectionProbability state)
then selectForReproduction fitness trees
else randElt trees
offspring <- crossover parent1 parent2
mutatedOffspring <- mutate offspring
return mutatedOffspring
-- evolves a population of syntax trees | 943 | evolveTree :: [EvaluatedSyntaxTree] -> EvolverState a b c EvaluatedSyntaxTree
evolveTree trees = do state <- get
r1 <- randDouble
r2 <- randDouble
parent1 <- if r1 >= (randomSelectionProbability state)
then selectForReproduction fitness trees
else randElt trees
parent2 <- if r2 >= (randomSelectionProbability state)
then selectForReproduction fitness trees
else randElt trees
offspring <- crossover parent1 parent2
mutatedOffspring <- mutate offspring
return mutatedOffspring
-- evolves a population of syntax trees | 896 | evolveTree trees = do state <- get
r1 <- randDouble
r2 <- randDouble
parent1 <- if r1 >= (randomSelectionProbability state)
then selectForReproduction fitness trees
else randElt trees
parent2 <- if r2 >= (randomSelectionProbability state)
then selectForReproduction fitness trees
else randElt trees
offspring <- crossover parent1 parent2
mutatedOffspring <- mutate offspring
return mutatedOffspring
-- evolves a population of syntax trees | 818 | true | true | 0 | 12 | 456 | 152 | 70 | 82 | null | null |
uduki/hsQt | Qtc/Enums/Gui/QGradient.hs | bsd-2-clause | eObjectBoundingMode :: CoordinateMode
eObjectBoundingMode
= ieCoordinateMode $ 2 | 82 | eObjectBoundingMode :: CoordinateMode
eObjectBoundingMode
= ieCoordinateMode $ 2 | 82 | eObjectBoundingMode
= ieCoordinateMode $ 2 | 44 | false | true | 2 | 6 | 9 | 23 | 9 | 14 | null | null |
bkoropoff/Idris-dev | src/IRTS/CodegenC.hs | bsd-3-clause | doOp v (LSExt ITChar (ITFixed to)) [x]
= doOp v (LSExt ITNative (ITFixed to)) [x] | 85 | doOp v (LSExt ITChar (ITFixed to)) [x]
= doOp v (LSExt ITNative (ITFixed to)) [x] | 85 | doOp v (LSExt ITChar (ITFixed to)) [x]
= doOp v (LSExt ITNative (ITFixed to)) [x] | 85 | false | false | 1 | 9 | 18 | 61 | 27 | 34 | null | null |
brendanhay/gogol | gogol-spanner/gen/Network/Google/Spanner/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'CommitStats' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'csMutationCount'
commitStats
:: CommitStats
commitStats = CommitStats' {_csMutationCount = Nothing} | 275 | commitStats
:: CommitStats
commitStats = CommitStats' {_csMutationCount = Nothing} | 86 | commitStats = CommitStats' {_csMutationCount = Nothing} | 55 | true | true | 0 | 7 | 46 | 31 | 17 | 14 | null | null |
gr-a-m/GrCal | src/GrCal/Group.hs | mpl-2.0 | -- |Build the group Z_n from the provided integer.
groupZ :: Int -> Group
groupZ n =
let
groupMembers = [0 .. (n - 1)]
opm = zMap n groupMembers
in
Group (S.fromList $ map (Element . show) groupMembers) opm | 222 | groupZ :: Int -> Group
groupZ n =
let
groupMembers = [0 .. (n - 1)]
opm = zMap n groupMembers
in
Group (S.fromList $ map (Element . show) groupMembers) opm | 171 | groupZ n =
let
groupMembers = [0 .. (n - 1)]
opm = zMap n groupMembers
in
Group (S.fromList $ map (Element . show) groupMembers) opm | 148 | true | true | 0 | 11 | 55 | 85 | 42 | 43 | null | null |
geophf/1HaskellADay | exercises/HAD/Control/Presentation.hs | mit | laxmi :: Int -> Rational -> String
laxmi digs x = let dollars = floor x
expon = 10 ^ digs
cents = floor (x * fromIntegral expon) - dollars * expon
in show dollars ++ ('.':showAllDa digs (show cents))
where showAllDa n x = replicate (n - length x) '0' ++ x
{--
*Analytics.Trading.Data.Strategy> USD 10.01 ~> $10.1 ... uh, oh!
... geophf puts in fix, then:
*Analytics.Trading.Data.Strategy> USD 10.01 ~> $10.01
*Analytics.Trading.Data.Strategy> USD 10.1 ~> $10.10
*Analytics.Trading.Data.Strategy> USD 10.012134 ~> $10.01
WHEW!
--}
{--
An example definition of a Univ-type using shower is:
instance Univ Analysis where
explode = map show . shower [S . dayo, Sr . closo, Sr . rato]
--} | 758 | laxmi :: Int -> Rational -> String
laxmi digs x = let dollars = floor x
expon = 10 ^ digs
cents = floor (x * fromIntegral expon) - dollars * expon
in show dollars ++ ('.':showAllDa digs (show cents))
where showAllDa n x = replicate (n - length x) '0' ++ x
{--
*Analytics.Trading.Data.Strategy> USD 10.01 ~> $10.1 ... uh, oh!
... geophf puts in fix, then:
*Analytics.Trading.Data.Strategy> USD 10.01 ~> $10.01
*Analytics.Trading.Data.Strategy> USD 10.1 ~> $10.10
*Analytics.Trading.Data.Strategy> USD 10.012134 ~> $10.01
WHEW!
--}
{--
An example definition of a Univ-type using shower is:
instance Univ Analysis where
explode = map show . shower [S . dayo, Sr . closo, Sr . rato]
--} | 758 | laxmi digs x = let dollars = floor x
expon = 10 ^ digs
cents = floor (x * fromIntegral expon) - dollars * expon
in show dollars ++ ('.':showAllDa digs (show cents))
where showAllDa n x = replicate (n - length x) '0' ++ x
{--
*Analytics.Trading.Data.Strategy> USD 10.01 ~> $10.1 ... uh, oh!
... geophf puts in fix, then:
*Analytics.Trading.Data.Strategy> USD 10.01 ~> $10.01
*Analytics.Trading.Data.Strategy> USD 10.1 ~> $10.10
*Analytics.Trading.Data.Strategy> USD 10.012134 ~> $10.01
WHEW!
--}
{--
An example definition of a Univ-type using shower is:
instance Univ Analysis where
explode = map show . shower [S . dayo, Sr . closo, Sr . rato]
--} | 723 | false | true | 0 | 14 | 190 | 137 | 66 | 71 | null | null |
phadej/boolean-normal-forms | src/Data/Algebra/Boolean/CNF/Set.hs | mit | fromLeft :: Either a b -> a
fromLeft (Left x) = x | 49 | fromLeft :: Either a b -> a
fromLeft (Left x) = x | 49 | fromLeft (Left x) = x | 21 | false | true | 0 | 9 | 11 | 35 | 15 | 20 | null | null |
vimus/vimus | src/Data/List/Zipper.hs | mit | {-
takeLeft :: ListZipper a -> Maybe a
takeLeft (ListZipper (x:_) _) = Just x
takeLeft _ = Nothing
takeRight :: ListZipper a -> Maybe a
takeRight (ListZipper _ (y:_)) = Just y
takeRight _ = Nothing
-}
dropLeft :: ListZipper a -> ListZipper a
dropLeft (ListZipper (_:xs) ys) = ListZipper xs ys | 294 | dropLeft :: ListZipper a -> ListZipper a
dropLeft (ListZipper (_:xs) ys) = ListZipper xs ys | 91 | dropLeft (ListZipper (_:xs) ys) = ListZipper xs ys | 50 | true | true | 0 | 9 | 54 | 45 | 22 | 23 | null | null |
brendanhay/gogol | gogol-cloudsearch/gen/Network/Google/Resource/CloudSearch/Stats/GetSession.hs | mpl-2.0 | -- | Month of date. Must be from 1 to 12.
sgsToDateMonth :: Lens' StatsGetSession (Maybe Int32)
sgsToDateMonth
= lens _sgsToDateMonth
(\ s a -> s{_sgsToDateMonth = a})
. mapping _Coerce | 199 | sgsToDateMonth :: Lens' StatsGetSession (Maybe Int32)
sgsToDateMonth
= lens _sgsToDateMonth
(\ s a -> s{_sgsToDateMonth = a})
. mapping _Coerce | 157 | sgsToDateMonth
= lens _sgsToDateMonth
(\ s a -> s{_sgsToDateMonth = a})
. mapping _Coerce | 103 | true | true | 0 | 10 | 44 | 55 | 28 | 27 | null | null |
expipiplus1/vulkan | generate-new/src/Render/Element.hs | bsd-3-clause | tellReexportMod
:: MemberWithError (State RenderElement) r => ModName -> Sem r ()
tellReexportMod e =
modify' (\r -> r { reReexportedModules = insert e (reReexportedModules r) }) | 182 | tellReexportMod
:: MemberWithError (State RenderElement) r => ModName -> Sem r ()
tellReexportMod e =
modify' (\r -> r { reReexportedModules = insert e (reReexportedModules r) }) | 182 | tellReexportMod e =
modify' (\r -> r { reReexportedModules = insert e (reReexportedModules r) }) | 98 | false | true | 5 | 12 | 30 | 78 | 36 | 42 | null | null |
Brightgalrs/con-lang-gen | src/Out/Roman.hs | mit | romanizePhonemes :: [Phoneme] -> Text
romanizePhonemes ps = intercalate "\'" $ map (concatMap romanizePhoneme) $ groupBy (\x y -> not (isVowel x && isVowel y)) ps | 162 | romanizePhonemes :: [Phoneme] -> Text
romanizePhonemes ps = intercalate "\'" $ map (concatMap romanizePhoneme) $ groupBy (\x y -> not (isVowel x && isVowel y)) ps | 162 | romanizePhonemes ps = intercalate "\'" $ map (concatMap romanizePhoneme) $ groupBy (\x y -> not (isVowel x && isVowel y)) ps | 124 | false | true | 0 | 12 | 25 | 77 | 36 | 41 | null | null |
spechub/Hets | Maude/PreComorphism.hs | gpl-2.0 | getVars :: CAS.CASLFORMULA -> Map.Map Id (Set.Set Token)
getVars (CAS.Quantification _ _ f _) = getVars f | 105 | getVars :: CAS.CASLFORMULA -> Map.Map Id (Set.Set Token)
getVars (CAS.Quantification _ _ f _) = getVars f | 105 | getVars (CAS.Quantification _ _ f _) = getVars f | 48 | false | true | 0 | 9 | 16 | 52 | 25 | 27 | null | null |
JoeyEremondi/haskelm | src/Language/Elm/TH/Util.hs | bsd-3-clause | subTypes (VarT _) = [] | 22 | subTypes (VarT _) = [] | 22 | subTypes (VarT _) = [] | 22 | false | false | 0 | 7 | 4 | 17 | 8 | 9 | null | null |
olsner/ghc | compiler/main/ErrUtils.hs | bsd-3-clause | ----------------
emptyMessages :: Messages
emptyMessages = (emptyBag, emptyBag) | 79 | emptyMessages :: Messages
emptyMessages = (emptyBag, emptyBag) | 62 | emptyMessages = (emptyBag, emptyBag) | 36 | true | true | 0 | 5 | 7 | 18 | 11 | 7 | null | null |
ktvoelker/airline | src/Types/Time.hs | gpl-3.0 | unpackTimeOfWeek :: TimeOfWeek -> (DayOfWeek, TimeOfDay)
unpackTimeOfWeek TimeOfWeek{..} =
over _1 (toEnum . fromInteger) . over _2 (TimeOfDay . Minutes)
$ unMinutes towOffset `divMod` minutesPerDay | 204 | unpackTimeOfWeek :: TimeOfWeek -> (DayOfWeek, TimeOfDay)
unpackTimeOfWeek TimeOfWeek{..} =
over _1 (toEnum . fromInteger) . over _2 (TimeOfDay . Minutes)
$ unMinutes towOffset `divMod` minutesPerDay | 204 | unpackTimeOfWeek TimeOfWeek{..} =
over _1 (toEnum . fromInteger) . over _2 (TimeOfDay . Minutes)
$ unMinutes towOffset `divMod` minutesPerDay | 147 | false | true | 2 | 8 | 30 | 77 | 38 | 39 | null | null |
RoboNickBot/interactive-tree-demos | src/Hyper/TreesExtra.hs | bsd-2-clause | zDepthOf :: ZTree a -> Int
zDepthOf (ZTree _ Top) = 1 | 53 | zDepthOf :: ZTree a -> Int
zDepthOf (ZTree _ Top) = 1 | 53 | zDepthOf (ZTree _ Top) = 1 | 26 | false | true | 0 | 9 | 11 | 35 | 15 | 20 | null | null |
iamkingmaker/HLearn | src/HLearn/Data/SpaceTree.hs | bsd-3-clause | stToSeqBFS :: SpaceTree t dp => t dp -> Seq dp
stToSeqBFS t = stNode t `cons` go t
where
go t = (fromList $ toList $ stLeaves t)
+ (fromList $ map stNode $ toList $ stChildren t)
+ (foldl' (+) empty $ map go $ stChildrenList t)
| 267 | stToSeqBFS :: SpaceTree t dp => t dp -> Seq dp
stToSeqBFS t = stNode t `cons` go t
where
go t = (fromList $ toList $ stLeaves t)
+ (fromList $ map stNode $ toList $ stChildren t)
+ (foldl' (+) empty $ map go $ stChildrenList t)
| 267 | stToSeqBFS t = stNode t `cons` go t
where
go t = (fromList $ toList $ stLeaves t)
+ (fromList $ map stNode $ toList $ stChildren t)
+ (foldl' (+) empty $ map go $ stChildrenList t)
| 220 | false | true | 0 | 13 | 88 | 122 | 59 | 63 | null | null |
batterseapower/context-semantics | Language/ContextSemantics/LinearLambdaExplicit.hs | bsd-3-clause | graphToDot :: Graph Router -> String
graphToDot = toDot node_attrs edge_attrs
where node_attrs (Fan _ _ _) = [("shape", "triangle")]
node_attrs (FV s _) = [("shape", "dot"), ("label", s)]
edge_attrs from to = [("arrowtail", selector_shape from), ("arrowhead", selector_shape to),
("tailport", selector_port from), ("headport", selector_port to)]
selector_shape FanPr = "none"
selector_shape FanWh = "odot"
selector_shape FanBl = "dot"
selector_shape FVPr = "none"
selector_port FanPr = "n"
selector_port FanWh = "sw"
selector_port FanBl = "se"
selector_port FVPr = "n" | 712 | graphToDot :: Graph Router -> String
graphToDot = toDot node_attrs edge_attrs
where node_attrs (Fan _ _ _) = [("shape", "triangle")]
node_attrs (FV s _) = [("shape", "dot"), ("label", s)]
edge_attrs from to = [("arrowtail", selector_shape from), ("arrowhead", selector_shape to),
("tailport", selector_port from), ("headport", selector_port to)]
selector_shape FanPr = "none"
selector_shape FanWh = "odot"
selector_shape FanBl = "dot"
selector_shape FVPr = "none"
selector_port FanPr = "n"
selector_port FanWh = "sw"
selector_port FanBl = "se"
selector_port FVPr = "n" | 712 | graphToDot = toDot node_attrs edge_attrs
where node_attrs (Fan _ _ _) = [("shape", "triangle")]
node_attrs (FV s _) = [("shape", "dot"), ("label", s)]
edge_attrs from to = [("arrowtail", selector_shape from), ("arrowhead", selector_shape to),
("tailport", selector_port from), ("headport", selector_port to)]
selector_shape FanPr = "none"
selector_shape FanWh = "odot"
selector_shape FanBl = "dot"
selector_shape FVPr = "none"
selector_port FanPr = "n"
selector_port FanWh = "sw"
selector_port FanBl = "se"
selector_port FVPr = "n" | 675 | false | true | 0 | 7 | 220 | 209 | 112 | 97 | null | null |
gereeter/bounded-intmap | src/Data/IntMap/Bounded/Base.hs | mit | -- | /O(min(n,W))/. Retrieves the minimal key of the map, and the map
-- stripped of that element, or 'Nothing' if passed an empty map.
minView :: IntMap a -> Maybe (a, IntMap a)
minView (IntMap (WordMap Empty)) = Nothing | 221 | minView :: IntMap a -> Maybe (a, IntMap a)
minView (IntMap (WordMap Empty)) = Nothing | 85 | minView (IntMap (WordMap Empty)) = Nothing | 42 | true | true | 0 | 9 | 39 | 47 | 24 | 23 | null | null |
mdsteele/fallback | src/Fallback/State/Resources.hs | gpl-3.0 | loadHealthManaEtc :: IO HealthManaEtc
loadHealthManaEtc = do
texture <- loadTexture "gui/health-mana-etc.png"
return HealthManaEtc
{ hmeFocusPipSprite = makeSubSprite (Rect 53 30 4 15) texture,
hmeIngredientsSprite = makeSubSprite (Rect 0 15 80 15) texture,
hmeLongBarSprite = makeSubSprite (Rect 0 0 80 15) texture,
hmeShortBarSprite = makeSubSprite (Rect 0 30 52 15) texture,
hmeTimePipSprite = makeSubSprite (Rect 58 30 12 15) texture }
------------------------------------------------------------------------------- | 552 | loadHealthManaEtc :: IO HealthManaEtc
loadHealthManaEtc = do
texture <- loadTexture "gui/health-mana-etc.png"
return HealthManaEtc
{ hmeFocusPipSprite = makeSubSprite (Rect 53 30 4 15) texture,
hmeIngredientsSprite = makeSubSprite (Rect 0 15 80 15) texture,
hmeLongBarSprite = makeSubSprite (Rect 0 0 80 15) texture,
hmeShortBarSprite = makeSubSprite (Rect 0 30 52 15) texture,
hmeTimePipSprite = makeSubSprite (Rect 58 30 12 15) texture }
------------------------------------------------------------------------------- | 552 | loadHealthManaEtc = do
texture <- loadTexture "gui/health-mana-etc.png"
return HealthManaEtc
{ hmeFocusPipSprite = makeSubSprite (Rect 53 30 4 15) texture,
hmeIngredientsSprite = makeSubSprite (Rect 0 15 80 15) texture,
hmeLongBarSprite = makeSubSprite (Rect 0 0 80 15) texture,
hmeShortBarSprite = makeSubSprite (Rect 0 30 52 15) texture,
hmeTimePipSprite = makeSubSprite (Rect 58 30 12 15) texture }
------------------------------------------------------------------------------- | 514 | false | true | 0 | 13 | 93 | 154 | 76 | 78 | null | null |
beni55/ghcjs | src/Gen2/Profiling.hs | mit | emitCostCentreStackDecl :: CostCentreStack -> G ()
emitCostCentreStackDecl ccs = do
case maybeSingletonCCS ccs of
Just cc -> do
ccsLbl <- singletonCCSLbl cc
ccLbl <- costCentreLbl cc
let js =
decl ccsLbl <>
[j| `ccsLbl` = new h$CCS(null, `ccLbl`); |]
emitGlobal js
Nothing -> pprPanic "emitCostCentreStackDecl" (ppr ccs)
--------------------------------------------------------------------------------
-- Entering to cost-centres | 507 | emitCostCentreStackDecl :: CostCentreStack -> G ()
emitCostCentreStackDecl ccs = do
case maybeSingletonCCS ccs of
Just cc -> do
ccsLbl <- singletonCCSLbl cc
ccLbl <- costCentreLbl cc
let js =
decl ccsLbl <>
[j| `ccsLbl` = new h$CCS(null, `ccLbl`); |]
emitGlobal js
Nothing -> pprPanic "emitCostCentreStackDecl" (ppr ccs)
--------------------------------------------------------------------------------
-- Entering to cost-centres | 507 | emitCostCentreStackDecl ccs = do
case maybeSingletonCCS ccs of
Just cc -> do
ccsLbl <- singletonCCSLbl cc
ccLbl <- costCentreLbl cc
let js =
decl ccsLbl <>
[j| `ccsLbl` = new h$CCS(null, `ccLbl`); |]
emitGlobal js
Nothing -> pprPanic "emitCostCentreStackDecl" (ppr ccs)
--------------------------------------------------------------------------------
-- Entering to cost-centres | 456 | false | true | 0 | 16 | 129 | 107 | 50 | 57 | null | null |
rvion/ride | jetpack/src/Data/List/NonEmpty/AsNe.hs | bsd-3-clause | -- ne_reverse :: forall a. NonEmpty a -> NonEmpty a
ne_reverse = I.reverse | 74 | ne_reverse = I.reverse | 22 | ne_reverse = I.reverse | 22 | true | false | 1 | 6 | 12 | 13 | 5 | 8 | null | null |
rueshyna/gogol | gogol-genomics/gen/Network/Google/Genomics/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'ListDataSetsResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ldsrNextPageToken'
--
-- * 'ldsrDataSets'
listDataSetsResponse
:: ListDataSetsResponse
listDataSetsResponse =
ListDataSetsResponse'
{ _ldsrNextPageToken = Nothing
, _ldsrDataSets = Nothing
} | 391 | listDataSetsResponse
:: ListDataSetsResponse
listDataSetsResponse =
ListDataSetsResponse'
{ _ldsrNextPageToken = Nothing
, _ldsrDataSets = Nothing
} | 168 | listDataSetsResponse =
ListDataSetsResponse'
{ _ldsrNextPageToken = Nothing
, _ldsrDataSets = Nothing
} | 119 | true | true | 1 | 7 | 72 | 39 | 23 | 16 | null | null |
svdberg/yesod-milk | Application.hs | bsd-2-clause | canonicalizeKey pair = pair | 27 | canonicalizeKey pair = pair | 27 | canonicalizeKey pair = pair | 27 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
haskellGardener/yusic | src/Yusic.hs | mit | fromMidi 91 = Just G6 | 22 | fromMidi 91 = Just G6 | 22 | fromMidi 91 = Just G6 | 22 | false | false | 0 | 5 | 5 | 12 | 5 | 7 | null | null |
Teino1978-Corp/Teino1978-Corp-alex | src/CharSet.hs | bsd-3-clause | -- TODO: More efficient generated code!
charSetQuote :: CharSet -> String
charSetQuote s = "(\\c -> " ++ foldr (\x y -> x ++ " || " ++ y) "False" (map quoteRange (rSetRanges s)) ++ ")"
where quoteRange (Range l h) = quoteL l ++ " && " ++ quoteH h
quoteL (BoundaryAbove a) = "c > " ++ show a
quoteL (BoundaryBelow a) = "c >= " ++ show a
quoteL (BoundaryAboveAll) = "False"
quoteL (BoundaryBelowAll) = "True"
quoteH (BoundaryAbove a) = "c <= " ++ show a
quoteH (BoundaryBelow a) = "c < " ++ show a
quoteH (BoundaryAboveAll) = "True"
quoteH (BoundaryBelowAll) = "False" | 650 | charSetQuote :: CharSet -> String
charSetQuote s = "(\\c -> " ++ foldr (\x y -> x ++ " || " ++ y) "False" (map quoteRange (rSetRanges s)) ++ ")"
where quoteRange (Range l h) = quoteL l ++ " && " ++ quoteH h
quoteL (BoundaryAbove a) = "c > " ++ show a
quoteL (BoundaryBelow a) = "c >= " ++ show a
quoteL (BoundaryAboveAll) = "False"
quoteL (BoundaryBelowAll) = "True"
quoteH (BoundaryAbove a) = "c <= " ++ show a
quoteH (BoundaryBelow a) = "c < " ++ show a
quoteH (BoundaryAboveAll) = "True"
quoteH (BoundaryBelowAll) = "False" | 610 | charSetQuote s = "(\\c -> " ++ foldr (\x y -> x ++ " || " ++ y) "False" (map quoteRange (rSetRanges s)) ++ ")"
where quoteRange (Range l h) = quoteL l ++ " && " ++ quoteH h
quoteL (BoundaryAbove a) = "c > " ++ show a
quoteL (BoundaryBelow a) = "c >= " ++ show a
quoteL (BoundaryAboveAll) = "False"
quoteL (BoundaryBelowAll) = "True"
quoteH (BoundaryAbove a) = "c <= " ++ show a
quoteH (BoundaryBelow a) = "c < " ++ show a
quoteH (BoundaryAboveAll) = "True"
quoteH (BoundaryBelowAll) = "False" | 576 | true | true | 8 | 12 | 190 | 226 | 113 | 113 | null | null |
alexander-at-github/eta | compiler/ETA/CodeGen/Rts.hs | bsd-3-clause | stgByteArray = io "StgByteArray" | 33 | stgByteArray = io "StgByteArray" | 33 | stgByteArray = io "StgByteArray" | 33 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
anchor/haskell-netsuite | lib/Netsuite/Restlet/Response.hs | bsd-3-clause | httpClientErrorCodeBody :: HttpRestletError -> (Int, BS.ByteString)
httpClientErrorCodeBody (HttpRestletError code _ _ body) = (code, body) | 139 | httpClientErrorCodeBody :: HttpRestletError -> (Int, BS.ByteString)
httpClientErrorCodeBody (HttpRestletError code _ _ body) = (code, body) | 139 | httpClientErrorCodeBody (HttpRestletError code _ _ body) = (code, body) | 71 | false | true | 0 | 7 | 14 | 44 | 24 | 20 | null | null |
gridaphobe/ghc | compiler/nativeGen/SPARC/Ppr.hs | bsd-3-clause | pprInstr (CALL (Left imm) n _)
= hcat [ text "\tcall\t", pprImm imm, comma, int n ] | 85 | pprInstr (CALL (Left imm) n _)
= hcat [ text "\tcall\t", pprImm imm, comma, int n ] | 85 | pprInstr (CALL (Left imm) n _)
= hcat [ text "\tcall\t", pprImm imm, comma, int n ] | 85 | false | false | 0 | 9 | 18 | 49 | 24 | 25 | null | null |
DavidAlphaFox/ghc | compiler/hsSyn/HsDecls.hs | bsd-3-clause | mkTyClGroup :: [LTyClDecl name] -> TyClGroup name
mkTyClGroup decls = TyClGroup { group_tyclds = decls, group_roles = [] } | 122 | mkTyClGroup :: [LTyClDecl name] -> TyClGroup name
mkTyClGroup decls = TyClGroup { group_tyclds = decls, group_roles = [] } | 122 | mkTyClGroup decls = TyClGroup { group_tyclds = decls, group_roles = [] } | 72 | false | true | 0 | 7 | 18 | 43 | 23 | 20 | null | null |
keithodulaigh/Hets | LF/Sign.hs | gpl-2.0 | prec Appl {} = 1 | 16 | prec Appl {} = 1 | 16 | prec Appl {} = 1 | 16 | false | false | 1 | 5 | 4 | 15 | 6 | 9 | null | null |
lueck/standoff-tools | src/StandOff/TextRange.hs | gpl-3.0 | -- | sort a list of text ranges
sortTextRanges :: (TextRange a) => [a] -> [a]
sortTextRanges = sortBy compareRanges
where compareRanges x y
| start x == start y = end y `compare` end x
| otherwise = start x `compare` start y
-- | length | 260 | sortTextRanges :: (TextRange a) => [a] -> [a]
sortTextRanges = sortBy compareRanges
where compareRanges x y
| start x == start y = end y `compare` end x
| otherwise = start x `compare` start y
-- | length | 228 | sortTextRanges = sortBy compareRanges
where compareRanges x y
| start x == start y = end y `compare` end x
| otherwise = start x `compare` start y
-- | length | 182 | true | true | 0 | 9 | 70 | 96 | 48 | 48 | null | null |
DominikDitoIvosevic/Uni | IRG/src/Irg/Lab1/Lab1.hs | mit | m2 :: M.Matrix
m2 = M.multiply m01 $ M.transpose m02 | 52 | m2 :: M.Matrix
m2 = M.multiply m01 $ M.transpose m02 | 52 | m2 = M.multiply m01 $ M.transpose m02 | 37 | false | true | 0 | 7 | 9 | 27 | 13 | 14 | null | null |
cobbpg/elerea | FRP/Elerea/Simple.hs | bsd-3-clause | start :: SignalGen (Signal a) -- ^ the generator of the top-level signal
-> IO (IO a) -- ^ the computation to sample the signal
start (SG gen) = do
pool <- newIORef []
S sample <- gen pool
return $ do
res <- sample
superstep pool
return res
-- | Performing the two-phase superstep. | 335 | start :: SignalGen (Signal a) -- ^ the generator of the top-level signal
-> IO (IO a)
start (SG gen) = do
pool <- newIORef []
S sample <- gen pool
return $ do
res <- sample
superstep pool
return res
-- | Performing the two-phase superstep. | 282 | start (SG gen) = do
pool <- newIORef []
S sample <- gen pool
return $ do
res <- sample
superstep pool
return res
-- | Performing the two-phase superstep. | 190 | true | true | 0 | 10 | 108 | 96 | 43 | 53 | null | null |
ksaveljev/hake-2 | src/Constants.hs | bsd-3-clause | -- armour does not protect from this damage
damageEnergy = 0x00000004 :: Int | 83 | damageEnergy = 0x00000004 :: Int | 38 | damageEnergy = 0x00000004 :: Int | 38 | true | false | 0 | 4 | 19 | 10 | 6 | 4 | null | null |
christiaanb/Idris-dev | src/Core/CoreParser.hs | bsd-3-clause | parseFile = runParser pTestFile () "(input)" | 44 | parseFile = runParser pTestFile () "(input)" | 44 | parseFile = runParser pTestFile () "(input)" | 44 | false | false | 1 | 6 | 5 | 19 | 7 | 12 | null | null |
choener/RNAdraw | RNAdraw3.hs | gpl-3.0 | -- ** test data
testX = [ (0,0), (2,0), (0,2), (2,2) ] | 55 | testX = [ (0,0), (2,0), (0,2), (2,2) ] | 38 | testX = [ (0,0), (2,0), (0,2), (2,2) ] | 38 | true | false | 1 | 6 | 12 | 46 | 28 | 18 | null | null |
andreagenso/java2scala | test/Main.hs | apache-2.0 | test "tp001" = test001Parser | 28 | test "tp001" = test001Parser | 28 | test "tp001" = test001Parser | 28 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
djeik/fuckdown2 | src/Asm.hs | mit | irbx :: Val label addr
irbx = IR Rbx | 36 | irbx :: Val label addr
irbx = IR Rbx | 36 | irbx = IR Rbx | 13 | false | true | 0 | 5 | 8 | 19 | 9 | 10 | null | null |
jmitchell/Idris-dev | src/IRTS/CodegenC.hs | bsd-3-clause | doOp v (LLt ITNative) [l, r] = v ++ "UINTOP(<," ++ creg l ++ ", " ++ creg r ++ ")" | 82 | doOp v (LLt ITNative) [l, r] = v ++ "UINTOP(<," ++ creg l ++ ", " ++ creg r ++ ")" | 82 | doOp v (LLt ITNative) [l, r] = v ++ "UINTOP(<," ++ creg l ++ ", " ++ creg r ++ ")" | 82 | false | false | 0 | 9 | 20 | 51 | 25 | 26 | null | null |
bergey/panther | tests/Types.hs | bsd-3-clause | getOoG :: OutOfGamut a -> V3 a
getOoG (OutOfGamut b) = b | 56 | getOoG :: OutOfGamut a -> V3 a
getOoG (OutOfGamut b) = b | 56 | getOoG (OutOfGamut b) = b | 25 | false | true | 0 | 7 | 11 | 30 | 14 | 16 | null | null |
spacekitteh/smcghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | vecElemInjectCast dflags IntVec W16 = Just (mo_WordTo16 dflags) | 66 | vecElemInjectCast dflags IntVec W16 = Just (mo_WordTo16 dflags) | 66 | vecElemInjectCast dflags IntVec W16 = Just (mo_WordTo16 dflags) | 66 | false | false | 0 | 7 | 10 | 25 | 10 | 15 | null | null |
fmapfmapfmap/amazonka | amazonka-elasticache/gen/Network/AWS/ElastiCache/Types/Product.hs | mpl-2.0 | -- | Undocumented member.
ccPendingModifiedValues :: Lens' CacheCluster (Maybe PendingModifiedValues)
ccPendingModifiedValues = lens _ccPendingModifiedValues (\ s a -> s{_ccPendingModifiedValues = a}) | 200 | ccPendingModifiedValues :: Lens' CacheCluster (Maybe PendingModifiedValues)
ccPendingModifiedValues = lens _ccPendingModifiedValues (\ s a -> s{_ccPendingModifiedValues = a}) | 174 | ccPendingModifiedValues = lens _ccPendingModifiedValues (\ s a -> s{_ccPendingModifiedValues = a}) | 98 | true | true | 0 | 9 | 20 | 46 | 25 | 21 | null | null |
mightymoose/liquidhaskell | benchmarks/unordered-containers-0.2.1.0/Data/HashMap/Array.hs | bsd-3-clause | -- | /O(1)/ Update the element at the given position in this array,
-- without copying.
unsafeUpdate' :: Array e -> Int -> e -> ST s ()
unsafeUpdate' ary idx b =
CHECK_BOUNDS("unsafeUpdate'", length ary, idx)
do mary <- unsafeThaw ary
write mary idx b
_ <- unsafeFreeze mary
return ()
| 330 | unsafeUpdate' :: Array e -> Int -> e -> ST s ()
unsafeUpdate' ary idx b =
CHECK_BOUNDS("unsafeUpdate'", length ary, idx)
do mary <- unsafeThaw ary
write mary idx b
_ <- unsafeFreeze mary
return ()
| 242 | unsafeUpdate' ary idx b =
CHECK_BOUNDS("unsafeUpdate'", length ary, idx)
do mary <- unsafeThaw ary
write mary idx b
_ <- unsafeFreeze mary
return ()
| 194 | true | true | 0 | 10 | 97 | 102 | 46 | 56 | null | null |
transient-haskell/transient-universe | app/server/Transient/Move/Services/controlServices.hs | mit | cloudControl= do
localIO $ putStrLn "\n...........VISIBLE NODES AND PROCESSES............"
callService monitorService () :: Cloud () -- start/ping monitor if not started
localIO $ do
putStr $ nodeHost monitorNode
putChar ':'
putStr $ show $ nodePort monitorNode
putChar '/'
putStrLn $ fromJust $ lookup "service" $ nodeServices monitorNode
squeezeMonitor 4 monitorNode
where
squeezeMonitor tab nod= do
nodes <- callService' nod GetNodes :: Cloud [Node]
vis <- local $ do
visited <- getState <|> return []
let vis = nod `elem` visited
when (not vis) $ setState $ nod:visited
return vis
when (not vis) $ spawn $ controlMonitor nod
mapM_ squeeze $ tail nodes
where
squeeze node= do
vis <- local $ do
visited <- getState <|> return []
let vis= node `elem` visited
when (not vis) $ setState $ node:visited
return vis
when (not vis) $ do
localIO $ do
putStr $ take tab $ repeat ' '
putStr $ nodeHost node
putChar ':'
putStr $ show $ nodePort node
putChar '/'
putStrLn $ fromJust $ lookup "service" $ nodeServices node
case lookup "service" $ nodeServices node of
Just "monitor" -> do
spawn $ controlMonitor node
visited <- local $ getState <|> return []
when (not $ node `elem` visited) $ do
local $ setState $ node:visited
localIO $ do
putStr $ take tab $ repeat ' '
putStr " "
putStrLn "Services:"
squeezeMonitor (tab+4) node
Just "executor" -> do
spawn $ controlService node
procs <- callService' node GetProcesses :: Cloud [String]
when (not $ null procs) $ do
localIO $ do
putStr $ take tab $ repeat ' '
putStrLn " Running processes:"
mapM_ ( spawn . controlProcess) procs
_ -> return ()
controlMonitor node= do
local $ do
n <- getState <|> return (0 :: Int)
setState $ n +1
liftIO $ putStr "\t\t"
option1 n "control this node\n"
abduce
controlNode node
controlService node= do
local $ do
n <- getState <|> return (0 :: Int)
setState $ n +1
liftIO $ putStr "\t\t"
option1 n "control this node\n"
abduce
controlNodeService node
spawn f= (f >> empty) <|> return ()
controlProcess str= do
local $ do
n <- getState <|> return (0 :: Int)
setState $ n +1
liftIO $ do
putStr $ take tab $ repeat ' '
putStr " "
putStrLn str
putStr "\t\t"
option1 n "control this process\n"
abduce
controlNodeProcess str
{-
registerUpdate= do
local $ option "reg" "simulate a two way reactive database update service"
reg <- input (const True) "enter register content "
reg' <- updateDistributedDatabase reg
localIO $ putStr "new register changed: " >> putStrLn reg'
in the service, made by the same service executable running in different machines and connected among them:
updateDistributedDatabaseIt= clustered $ do
update reg
return reg
-} | 4,088 | cloudControl= do
localIO $ putStrLn "\n...........VISIBLE NODES AND PROCESSES............"
callService monitorService () :: Cloud () -- start/ping monitor if not started
localIO $ do
putStr $ nodeHost monitorNode
putChar ':'
putStr $ show $ nodePort monitorNode
putChar '/'
putStrLn $ fromJust $ lookup "service" $ nodeServices monitorNode
squeezeMonitor 4 monitorNode
where
squeezeMonitor tab nod= do
nodes <- callService' nod GetNodes :: Cloud [Node]
vis <- local $ do
visited <- getState <|> return []
let vis = nod `elem` visited
when (not vis) $ setState $ nod:visited
return vis
when (not vis) $ spawn $ controlMonitor nod
mapM_ squeeze $ tail nodes
where
squeeze node= do
vis <- local $ do
visited <- getState <|> return []
let vis= node `elem` visited
when (not vis) $ setState $ node:visited
return vis
when (not vis) $ do
localIO $ do
putStr $ take tab $ repeat ' '
putStr $ nodeHost node
putChar ':'
putStr $ show $ nodePort node
putChar '/'
putStrLn $ fromJust $ lookup "service" $ nodeServices node
case lookup "service" $ nodeServices node of
Just "monitor" -> do
spawn $ controlMonitor node
visited <- local $ getState <|> return []
when (not $ node `elem` visited) $ do
local $ setState $ node:visited
localIO $ do
putStr $ take tab $ repeat ' '
putStr " "
putStrLn "Services:"
squeezeMonitor (tab+4) node
Just "executor" -> do
spawn $ controlService node
procs <- callService' node GetProcesses :: Cloud [String]
when (not $ null procs) $ do
localIO $ do
putStr $ take tab $ repeat ' '
putStrLn " Running processes:"
mapM_ ( spawn . controlProcess) procs
_ -> return ()
controlMonitor node= do
local $ do
n <- getState <|> return (0 :: Int)
setState $ n +1
liftIO $ putStr "\t\t"
option1 n "control this node\n"
abduce
controlNode node
controlService node= do
local $ do
n <- getState <|> return (0 :: Int)
setState $ n +1
liftIO $ putStr "\t\t"
option1 n "control this node\n"
abduce
controlNodeService node
spawn f= (f >> empty) <|> return ()
controlProcess str= do
local $ do
n <- getState <|> return (0 :: Int)
setState $ n +1
liftIO $ do
putStr $ take tab $ repeat ' '
putStr " "
putStrLn str
putStr "\t\t"
option1 n "control this process\n"
abduce
controlNodeProcess str
{-
registerUpdate= do
local $ option "reg" "simulate a two way reactive database update service"
reg <- input (const True) "enter register content "
reg' <- updateDistributedDatabase reg
localIO $ putStr "new register changed: " >> putStrLn reg'
in the service, made by the same service executable running in different machines and connected among them:
updateDistributedDatabaseIt= clustered $ do
update reg
return reg
-} | 4,088 | cloudControl= do
localIO $ putStrLn "\n...........VISIBLE NODES AND PROCESSES............"
callService monitorService () :: Cloud () -- start/ping monitor if not started
localIO $ do
putStr $ nodeHost monitorNode
putChar ':'
putStr $ show $ nodePort monitorNode
putChar '/'
putStrLn $ fromJust $ lookup "service" $ nodeServices monitorNode
squeezeMonitor 4 monitorNode
where
squeezeMonitor tab nod= do
nodes <- callService' nod GetNodes :: Cloud [Node]
vis <- local $ do
visited <- getState <|> return []
let vis = nod `elem` visited
when (not vis) $ setState $ nod:visited
return vis
when (not vis) $ spawn $ controlMonitor nod
mapM_ squeeze $ tail nodes
where
squeeze node= do
vis <- local $ do
visited <- getState <|> return []
let vis= node `elem` visited
when (not vis) $ setState $ node:visited
return vis
when (not vis) $ do
localIO $ do
putStr $ take tab $ repeat ' '
putStr $ nodeHost node
putChar ':'
putStr $ show $ nodePort node
putChar '/'
putStrLn $ fromJust $ lookup "service" $ nodeServices node
case lookup "service" $ nodeServices node of
Just "monitor" -> do
spawn $ controlMonitor node
visited <- local $ getState <|> return []
when (not $ node `elem` visited) $ do
local $ setState $ node:visited
localIO $ do
putStr $ take tab $ repeat ' '
putStr " "
putStrLn "Services:"
squeezeMonitor (tab+4) node
Just "executor" -> do
spawn $ controlService node
procs <- callService' node GetProcesses :: Cloud [String]
when (not $ null procs) $ do
localIO $ do
putStr $ take tab $ repeat ' '
putStrLn " Running processes:"
mapM_ ( spawn . controlProcess) procs
_ -> return ()
controlMonitor node= do
local $ do
n <- getState <|> return (0 :: Int)
setState $ n +1
liftIO $ putStr "\t\t"
option1 n "control this node\n"
abduce
controlNode node
controlService node= do
local $ do
n <- getState <|> return (0 :: Int)
setState $ n +1
liftIO $ putStr "\t\t"
option1 n "control this node\n"
abduce
controlNodeService node
spawn f= (f >> empty) <|> return ()
controlProcess str= do
local $ do
n <- getState <|> return (0 :: Int)
setState $ n +1
liftIO $ do
putStr $ take tab $ repeat ' '
putStr " "
putStrLn str
putStr "\t\t"
option1 n "control this process\n"
abduce
controlNodeProcess str
{-
registerUpdate= do
local $ option "reg" "simulate a two way reactive database update service"
reg <- input (const True) "enter register content "
reg' <- updateDistributedDatabase reg
localIO $ putStr "new register changed: " >> putStrLn reg'
in the service, made by the same service executable running in different machines and connected among them:
updateDistributedDatabaseIt= clustered $ do
update reg
return reg
-} | 4,088 | false | false | 0 | 25 | 1,920 | 966 | 423 | 543 | null | null |
CulpaBS/wbBach | src/Futhark/Analysis/AlgSimplify.hs | bsd-3-clause | negateSimplified (SMinus e1 e2) = do -- return $ SMinus e2 e1
e1' <- negateSimplified e1
return $ SPlus e1' e2 | 118 | negateSimplified (SMinus e1 e2) = do -- return $ SMinus e2 e1
e1' <- negateSimplified e1
return $ SPlus e1' e2 | 118 | negateSimplified (SMinus e1 e2) = do -- return $ SMinus e2 e1
e1' <- negateSimplified e1
return $ SPlus e1' e2 | 118 | false | false | 0 | 8 | 28 | 40 | 18 | 22 | null | null |
kmate/raw-feldspar | examples/Tut3_Vectors.hs | bsd-3-clause | sumSqRun = connectStdIO $ return . sumSq | 40 | sumSqRun = connectStdIO $ return . sumSq | 40 | sumSqRun = connectStdIO $ return . sumSq | 40 | false | false | 1 | 6 | 6 | 18 | 7 | 11 | null | null |
TheBB/hess | src/Game/MagicTemplates.hs | mit | -- {{{ Occupancy masks and magic numbers
-- These are generated a priori and hardcoded
occMasksR =
[ 0x000101010101017e, 0x000202020202027c, 0x000404040404047a, 0x0008080808080876
, 0x001010101010106e, 0x002020202020205e, 0x004040404040403e, 0x008080808080807e
, 0x0001010101017e00, 0x0002020202027c00, 0x0004040404047a00, 0x0008080808087600
, 0x0010101010106e00, 0x0020202020205e00, 0x0040404040403e00, 0x0080808080807e00
, 0x00010101017e0100, 0x00020202027c0200, 0x00040404047a0400, 0x0008080808760800
, 0x00101010106e1000, 0x00202020205e2000, 0x00404040403e4000, 0x00808080807e8000
, 0x000101017e010100, 0x000202027c020200, 0x000404047a040400, 0x0008080876080800
, 0x001010106e101000, 0x002020205e202000, 0x004040403e404000, 0x008080807e808000
, 0x0001017e01010100, 0x0002027c02020200, 0x0004047a04040400, 0x0008087608080800
, 0x0010106e10101000, 0x0020205e20202000, 0x0040403e40404000, 0x0080807e80808000
, 0x00017e0101010100, 0x00027c0202020200, 0x00047a0404040400, 0x0008760808080800
, 0x00106e1010101000, 0x00205e2020202000, 0x00403e4040404000, 0x00807e8080808000
, 0x007e010101010100, 0x007c020202020200, 0x007a040404040400, 0x0076080808080800
, 0x006e101010101000, 0x005e202020202000, 0x003e404040404000, 0x007e808080808000
, 0x7e01010101010100, 0x7c02020202020200, 0x7a04040404040400, 0x7608080808080800
, 0x6e10101010101000, 0x5e20202020202000, 0x3e40404040404000, 0x7e80808080808000
] :: [BoardMask] | 1,481 | occMasksR =
[ 0x000101010101017e, 0x000202020202027c, 0x000404040404047a, 0x0008080808080876
, 0x001010101010106e, 0x002020202020205e, 0x004040404040403e, 0x008080808080807e
, 0x0001010101017e00, 0x0002020202027c00, 0x0004040404047a00, 0x0008080808087600
, 0x0010101010106e00, 0x0020202020205e00, 0x0040404040403e00, 0x0080808080807e00
, 0x00010101017e0100, 0x00020202027c0200, 0x00040404047a0400, 0x0008080808760800
, 0x00101010106e1000, 0x00202020205e2000, 0x00404040403e4000, 0x00808080807e8000
, 0x000101017e010100, 0x000202027c020200, 0x000404047a040400, 0x0008080876080800
, 0x001010106e101000, 0x002020205e202000, 0x004040403e404000, 0x008080807e808000
, 0x0001017e01010100, 0x0002027c02020200, 0x0004047a04040400, 0x0008087608080800
, 0x0010106e10101000, 0x0020205e20202000, 0x0040403e40404000, 0x0080807e80808000
, 0x00017e0101010100, 0x00027c0202020200, 0x00047a0404040400, 0x0008760808080800
, 0x00106e1010101000, 0x00205e2020202000, 0x00403e4040404000, 0x00807e8080808000
, 0x007e010101010100, 0x007c020202020200, 0x007a040404040400, 0x0076080808080800
, 0x006e101010101000, 0x005e202020202000, 0x003e404040404000, 0x007e808080808000
, 0x7e01010101010100, 0x7c02020202020200, 0x7a04040404040400, 0x7608080808080800
, 0x6e10101010101000, 0x5e20202020202000, 0x3e40404040404000, 0x7e80808080808000
] :: [BoardMask] | 1,392 | occMasksR =
[ 0x000101010101017e, 0x000202020202027c, 0x000404040404047a, 0x0008080808080876
, 0x001010101010106e, 0x002020202020205e, 0x004040404040403e, 0x008080808080807e
, 0x0001010101017e00, 0x0002020202027c00, 0x0004040404047a00, 0x0008080808087600
, 0x0010101010106e00, 0x0020202020205e00, 0x0040404040403e00, 0x0080808080807e00
, 0x00010101017e0100, 0x00020202027c0200, 0x00040404047a0400, 0x0008080808760800
, 0x00101010106e1000, 0x00202020205e2000, 0x00404040403e4000, 0x00808080807e8000
, 0x000101017e010100, 0x000202027c020200, 0x000404047a040400, 0x0008080876080800
, 0x001010106e101000, 0x002020205e202000, 0x004040403e404000, 0x008080807e808000
, 0x0001017e01010100, 0x0002027c02020200, 0x0004047a04040400, 0x0008087608080800
, 0x0010106e10101000, 0x0020205e20202000, 0x0040403e40404000, 0x0080807e80808000
, 0x00017e0101010100, 0x00027c0202020200, 0x00047a0404040400, 0x0008760808080800
, 0x00106e1010101000, 0x00205e2020202000, 0x00403e4040404000, 0x00807e8080808000
, 0x007e010101010100, 0x007c020202020200, 0x007a040404040400, 0x0076080808080800
, 0x006e101010101000, 0x005e202020202000, 0x003e404040404000, 0x007e808080808000
, 0x7e01010101010100, 0x7c02020202020200, 0x7a04040404040400, 0x7608080808080800
, 0x6e10101010101000, 0x5e20202020202000, 0x3e40404040404000, 0x7e80808080808000
] :: [BoardMask] | 1,392 | true | false | 1 | 5 | 169 | 208 | 137 | 71 | null | null |
ilexius/spf-ips | src/Parser/SPF.hs | gpl-3.0 | appIp6 = (\r -> over ip6 (r:)) <$> pIp6 | 39 | appIp6 = (\r -> over ip6 (r:)) <$> pIp6 | 39 | appIp6 = (\r -> over ip6 (r:)) <$> pIp6 | 39 | false | false | 3 | 8 | 8 | 32 | 15 | 17 | null | null |
spacekitteh/smcghc | compiler/cmm/CmmNode.hs | bsd-3-clause | wrapRecExpM f n@(CmmLoad addr ty) = maybe (f n) (f . flip CmmLoad ty) (wrapRecExpM f addr) | 91 | wrapRecExpM f n@(CmmLoad addr ty) = maybe (f n) (f . flip CmmLoad ty) (wrapRecExpM f addr) | 91 | wrapRecExpM f n@(CmmLoad addr ty) = maybe (f n) (f . flip CmmLoad ty) (wrapRecExpM f addr) | 91 | false | false | 0 | 8 | 17 | 55 | 27 | 28 | null | null |
hguenther/smtlib2 | Language/SMTLib2/Internals/Evaluate.hs | gpl-3.0 | evaluateFun _ _ Not ((ValueResult (BoolValue x)) ::: Nil)
= return $ ValueResult $ BoolValue $ not x | 102 | evaluateFun _ _ Not ((ValueResult (BoolValue x)) ::: Nil)
= return $ ValueResult $ BoolValue $ not x | 102 | evaluateFun _ _ Not ((ValueResult (BoolValue x)) ::: Nil)
= return $ ValueResult $ BoolValue $ not x | 102 | false | false | 0 | 11 | 19 | 49 | 24 | 25 | null | null |
Mahdi89/eTeak | src/Type.hs | bsd-3-clause | typeEquiv :: [Context Decl] -> Type -> Type -> Bool
typeEquiv cs typ1 typ2 = equiv (unaliasType cs typ1) (unaliasType cs typ2)
where
equiv (Bits w1) (Bits w2) = w1 == w2
equiv (SignedBits w1) (SignedBits w2) = w1 == w2
equiv (Type ref1) (Type ref2) = ref1 == ref2 -- for the same context path
equiv (BuiltinType name1) (BuiltinType name2) = name1 == name2
equiv (ArrayType interval1 elemType1) (ArrayType interval2 elemType2) = interval1 == interval2 &&
elemType1 `equiv` elemType2
equiv _ _ = False | 599 | typeEquiv :: [Context Decl] -> Type -> Type -> Bool
typeEquiv cs typ1 typ2 = equiv (unaliasType cs typ1) (unaliasType cs typ2)
where
equiv (Bits w1) (Bits w2) = w1 == w2
equiv (SignedBits w1) (SignedBits w2) = w1 == w2
equiv (Type ref1) (Type ref2) = ref1 == ref2 -- for the same context path
equiv (BuiltinType name1) (BuiltinType name2) = name1 == name2
equiv (ArrayType interval1 elemType1) (ArrayType interval2 elemType2) = interval1 == interval2 &&
elemType1 `equiv` elemType2
equiv _ _ = False | 595 | typeEquiv cs typ1 typ2 = equiv (unaliasType cs typ1) (unaliasType cs typ2)
where
equiv (Bits w1) (Bits w2) = w1 == w2
equiv (SignedBits w1) (SignedBits w2) = w1 == w2
equiv (Type ref1) (Type ref2) = ref1 == ref2 -- for the same context path
equiv (BuiltinType name1) (BuiltinType name2) = name1 == name2
equiv (ArrayType interval1 elemType1) (ArrayType interval2 elemType2) = interval1 == interval2 &&
elemType1 `equiv` elemType2
equiv _ _ = False | 543 | false | true | 5 | 14 | 184 | 219 | 108 | 111 | null | null |
ddssff/lens | src/System/FilePath/Lens.hs | bsd-3-clause | -- | A 'Lens' for reading and writing to the full filename
--
-- Note: This is /not/ a legal 'Lens', unless you are careful to ensure that generated
-- filename 'FilePath' components are not null and do not contain any
-- elements of 'System.FilePath.pathSeparators's.
--
-- >>> (filename .~ "name.txt" $ "path" </> "name.png") == "path" </> "name.txt"
-- True
filename :: Lens' FilePath FilePath
filename f p = (takeDirectory p </>) <$> f (takeFileName p) | 456 | filename :: Lens' FilePath FilePath
filename f p = (takeDirectory p </>) <$> f (takeFileName p) | 95 | filename f p = (takeDirectory p </>) <$> f (takeFileName p) | 59 | true | true | 0 | 8 | 76 | 49 | 28 | 21 | null | null |
kumasento/accelerate | Data/Array/Accelerate/Analysis/Match.hs | bsd-3-clause | hashPrimFun (PrimMod _) = hash "PrimMod" | 56 | hashPrimFun (PrimMod _) = hash "PrimMod" | 56 | hashPrimFun (PrimMod _) = hash "PrimMod" | 56 | false | false | 0 | 7 | 21 | 18 | 8 | 10 | null | null |
rahulmutt/ghcvm | compiler/Eta/TypeCheck/TcEvidence.hs | bsd-3-clause | evVarsOfTerm :: EvTerm -> VarSet
evVarsOfTerm (EvId v) = unitVarSet v | 81 | evVarsOfTerm :: EvTerm -> VarSet
evVarsOfTerm (EvId v) = unitVarSet v | 81 | evVarsOfTerm (EvId v) = unitVarSet v | 48 | false | true | 0 | 7 | 22 | 27 | 13 | 14 | null | null |
headprogrammingczar/cabal | Cabal/Distribution/PackageDescription/Check.hs | bsd-3-clause | quote :: String -> String
quote s = "'" ++ s ++ "'" | 51 | quote :: String -> String
quote s = "'" ++ s ++ "'" | 51 | quote s = "'" ++ s ++ "'" | 25 | false | true | 4 | 7 | 12 | 34 | 14 | 20 | null | null |
andreagenso/java2scala | src/J2s/Scanner/Lexical.hs | apache-2.0 | constantBool ::[Constant]
constantBool = ["true","false"] | 57 | constantBool ::[Constant]
constantBool = ["true","false"] | 57 | constantBool = ["true","false"] | 31 | false | true | 0 | 5 | 4 | 20 | 12 | 8 | null | null |
brendanhay/gogol | gogol-android-enterprise/gen/Network/Google/Resource/AndroidEnterprise/Users/GenerateToken.hs | mpl-2.0 | -- | The ID of the enterprise.
ugtEnterpriseId :: Lens' UsersGenerateToken Text
ugtEnterpriseId
= lens _ugtEnterpriseId
(\ s a -> s{_ugtEnterpriseId = a}) | 162 | ugtEnterpriseId :: Lens' UsersGenerateToken Text
ugtEnterpriseId
= lens _ugtEnterpriseId
(\ s a -> s{_ugtEnterpriseId = a}) | 131 | ugtEnterpriseId
= lens _ugtEnterpriseId
(\ s a -> s{_ugtEnterpriseId = a}) | 82 | true | true | 0 | 9 | 30 | 42 | 22 | 20 | null | null |
kim/amazonka | amazonka-elasticache/gen/Network/AWS/ElastiCache/RevokeCacheSecurityGroupIngress.hs | mpl-2.0 | rcsgirCacheSecurityGroup :: Lens' RevokeCacheSecurityGroupIngressResponse (Maybe CacheSecurityGroup)
rcsgirCacheSecurityGroup =
lens _rcsgirCacheSecurityGroup
(\s a -> s { _rcsgirCacheSecurityGroup = a }) | 216 | rcsgirCacheSecurityGroup :: Lens' RevokeCacheSecurityGroupIngressResponse (Maybe CacheSecurityGroup)
rcsgirCacheSecurityGroup =
lens _rcsgirCacheSecurityGroup
(\s a -> s { _rcsgirCacheSecurityGroup = a }) | 216 | rcsgirCacheSecurityGroup =
lens _rcsgirCacheSecurityGroup
(\s a -> s { _rcsgirCacheSecurityGroup = a }) | 115 | false | true | 0 | 9 | 30 | 45 | 24 | 21 | null | null |
droundy/franchise | Distribution/Franchise/Buildable.hs | bsd-3-clause | -- | install in the data path. This location may be modified at
-- configure time via the environment variable PREFIX or DATADIR.
installData :: FilePath -> C ()
installData = installHelper getDataDir id | 205 | installData :: FilePath -> C ()
installData = installHelper getDataDir id | 73 | installData = installHelper getDataDir id | 41 | true | true | 0 | 8 | 35 | 33 | 15 | 18 | null | null |
nh2/wordwang | server/Server.hs | gpl-3.0 | createGroup :: (MonadIO m) => TVar ServerState -> GroupId -> m GroupChan
createGroup serverStateVar gid = liftIO $
do let group = Group { groupId = gid
, groupUsers = Map.empty
, groupStory = []
, groupCloud = newCloud
}
groupChan <- newTChanIO
atomically $
do serverState@ServerState {serverGroups = gs} <- readTVar serverStateVar
writeTVar serverStateVar
(serverState { serverGroups = Map.insert gid groupChan gs
, serverCounter = max (gid + 1) (serverCounter serverState)})
_ <- forkIO (runGroup serverStateVar
group
(GroupState {groupSinks = Map.empty, groupCounter = 0})
groupChan
`CE.finally` do _ <- printf "\n######## GROUP %d DIED ########\n\n" gid
-- You should NEVER see the above message.
return ())
return groupChan | 1,122 | createGroup :: (MonadIO m) => TVar ServerState -> GroupId -> m GroupChan
createGroup serverStateVar gid = liftIO $
do let group = Group { groupId = gid
, groupUsers = Map.empty
, groupStory = []
, groupCloud = newCloud
}
groupChan <- newTChanIO
atomically $
do serverState@ServerState {serverGroups = gs} <- readTVar serverStateVar
writeTVar serverStateVar
(serverState { serverGroups = Map.insert gid groupChan gs
, serverCounter = max (gid + 1) (serverCounter serverState)})
_ <- forkIO (runGroup serverStateVar
group
(GroupState {groupSinks = Map.empty, groupCounter = 0})
groupChan
`CE.finally` do _ <- printf "\n######## GROUP %d DIED ########\n\n" gid
-- You should NEVER see the above message.
return ())
return groupChan | 1,122 | createGroup serverStateVar gid = liftIO $
do let group = Group { groupId = gid
, groupUsers = Map.empty
, groupStory = []
, groupCloud = newCloud
}
groupChan <- newTChanIO
atomically $
do serverState@ServerState {serverGroups = gs} <- readTVar serverStateVar
writeTVar serverStateVar
(serverState { serverGroups = Map.insert gid groupChan gs
, serverCounter = max (gid + 1) (serverCounter serverState)})
_ <- forkIO (runGroup serverStateVar
group
(GroupState {groupSinks = Map.empty, groupCounter = 0})
groupChan
`CE.finally` do _ <- printf "\n######## GROUP %d DIED ########\n\n" gid
-- You should NEVER see the above message.
return ())
return groupChan | 1,049 | false | true | 0 | 17 | 502 | 246 | 126 | 120 | null | null |
keera-studios/hsQt | Qtc/Enums/Gui/QPrinter.hs | bsd-2-clause | eFirstPageFirst :: PageOrder
eFirstPageFirst
= iePageOrder $ 0 | 64 | eFirstPageFirst :: PageOrder
eFirstPageFirst
= iePageOrder $ 0 | 64 | eFirstPageFirst
= iePageOrder $ 0 | 35 | false | true | 2 | 6 | 9 | 23 | 9 | 14 | null | null |
m-alvarez/jhc | lib/haskell-extras/Control/Exception.hs | mit | catchJust :: (Exception -> Maybe b) -> IO a -> (b -> IO a) -> IO a
catchJust et c h = catch c $ \e -> maybe (throwIO e) h (et e) | 128 | catchJust :: (Exception -> Maybe b) -> IO a -> (b -> IO a) -> IO a
catchJust et c h = catch c $ \e -> maybe (throwIO e) h (et e) | 128 | catchJust et c h = catch c $ \e -> maybe (throwIO e) h (et e) | 61 | false | true | 0 | 10 | 32 | 87 | 42 | 45 | null | null |
apyrgio/snf-ganeti | src/Ganeti/Constants.hs | bsd-2-clause | osScriptExport :: String
osScriptExport = "export" | 50 | osScriptExport :: String
osScriptExport = "export" | 50 | osScriptExport = "export" | 25 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
rnons/ted2srt | backend/src/Static.hs | bsd-3-clause | bundles :: [String]
bundles =
[ "common.js"
, "common.css"
, "Home.js"
, "Home.css"
, "Talk.js"
, "Talk.css"
, "Search.js"
, "Search.css"
] | 157 | bundles :: [String]
bundles =
[ "common.js"
, "common.css"
, "Home.js"
, "Home.css"
, "Talk.js"
, "Talk.css"
, "Search.js"
, "Search.css"
] | 157 | bundles =
[ "common.js"
, "common.css"
, "Home.js"
, "Home.css"
, "Talk.js"
, "Talk.css"
, "Search.js"
, "Search.css"
] | 137 | false | true | 0 | 5 | 39 | 38 | 24 | 14 | null | null |
andreasfrom/truths | Table.hs | mit | latexConnective (Or _ _) = "\\lor " | 36 | latexConnective (Or _ _) = "\\lor " | 36 | latexConnective (Or _ _) = "\\lor " | 36 | false | false | 0 | 7 | 7 | 17 | 8 | 9 | null | null |
randen/cabal | cabal-install/Distribution/Client/Tar.hs | bsd-3-clause | interleave :: [IO a] -> IO [a]
interleave = unsafeInterleaveIO . go
where
go [] = return []
go (x:xs) = do
x' <- x
xs' <- interleave xs
return (x':xs') | 184 | interleave :: [IO a] -> IO [a]
interleave = unsafeInterleaveIO . go
where
go [] = return []
go (x:xs) = do
x' <- x
xs' <- interleave xs
return (x':xs') | 184 | interleave = unsafeInterleaveIO . go
where
go [] = return []
go (x:xs) = do
x' <- x
xs' <- interleave xs
return (x':xs') | 153 | false | true | 0 | 9 | 63 | 94 | 45 | 49 | null | null |
markflorisson/hpack | testrepo/bytestring-0.10.2.0/Data/ByteString/Builder/Prim/Extra.hs | bsd-3-clause | -- | The bound on the size of the sequence of bytes generated by this
-- 'BoundedPrim'.
sizeBound :: BoundedPrim a -> Word
sizeBound = fromIntegral . I.sizeBound | 161 | sizeBound :: BoundedPrim a -> Word
sizeBound = fromIntegral . I.sizeBound | 73 | sizeBound = fromIntegral . I.sizeBound | 38 | true | true | 1 | 7 | 27 | 34 | 15 | 19 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.