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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
forsyde/forsyde-atom | src/ForSyDe/Atom/Utility/Tuple.hs | bsd-3-clause | f ><<<<<<< (a1, a2, a3, a4, a5, a6, a7, a8) = f a1 a2 a3 a4 a5 a6 a7 a8 | 76 | f ><<<<<<< (a1, a2, a3, a4, a5, a6, a7, a8) = f a1 a2 a3 a4 a5 a6 a7 a8 | 76 | f ><<<<<<< (a1, a2, a3, a4, a5, a6, a7, a8) = f a1 a2 a3 a4 a5 a6 a7 a8 | 76 | false | false | 2 | 5 | 24 | 53 | 29 | 24 | null | null |
nick8325/kbc | src/Twee/Proof.hs | bsd-3-clause | generaliseProof :: Function f => [Derivation f] -> [Derivation f]
generaliseProof =
simplificationPass (const generaliseLemma) (const generaliseGoal)
where
generaliseLemma p = lemma (certify q) sub
where
(q, sub) = generalise p
generaliseGoal p = subst sub q
where
(q, sub) = generalise (certify p)
generalise p = (q, sub)
where
eq = equation p
n = freshVar eq
qs = evalState (mapM generaliseStep (steps (derivation p))) n
Just sub1 = unifyMany (stepsConstraints qs)
q = canonicalise (fromSteps eq (subst sub1 qs))
Just sub = matchEquation (equation (certify q)) eq
generaliseStep (UseAxiom axiom _) =
freshen (vars (axiom_eqn axiom)) (UseAxiom axiom)
generaliseStep (UseLemma lemma _) =
freshen (vars (equation lemma)) (UseLemma lemma)
generaliseStep (Refl _) = do
n <- get
put (n+1)
return (Refl (build (var (V n))))
generaliseStep (Symm p) =
Symm <$> generaliseStep p
generaliseStep (Trans p q) =
liftM2 Trans (generaliseStep p) (generaliseStep q)
generaliseStep (Cong f ps) =
Cong f <$> mapM generaliseStep ps
freshen xs f = do
n <- get
put (n + length xs)
let Just sub = listToSubst [(x, build (var (V i))) | (x, i) <- zip (usort xs) [n..]]
return (f sub)
stepsConstraints ps = zipWith combine eqs (tail eqs)
where
eqs = map (equation . certify) ps
combine (_ :=: t) (u :=: _) = (t, u) | 1,518 | generaliseProof :: Function f => [Derivation f] -> [Derivation f]
generaliseProof =
simplificationPass (const generaliseLemma) (const generaliseGoal)
where
generaliseLemma p = lemma (certify q) sub
where
(q, sub) = generalise p
generaliseGoal p = subst sub q
where
(q, sub) = generalise (certify p)
generalise p = (q, sub)
where
eq = equation p
n = freshVar eq
qs = evalState (mapM generaliseStep (steps (derivation p))) n
Just sub1 = unifyMany (stepsConstraints qs)
q = canonicalise (fromSteps eq (subst sub1 qs))
Just sub = matchEquation (equation (certify q)) eq
generaliseStep (UseAxiom axiom _) =
freshen (vars (axiom_eqn axiom)) (UseAxiom axiom)
generaliseStep (UseLemma lemma _) =
freshen (vars (equation lemma)) (UseLemma lemma)
generaliseStep (Refl _) = do
n <- get
put (n+1)
return (Refl (build (var (V n))))
generaliseStep (Symm p) =
Symm <$> generaliseStep p
generaliseStep (Trans p q) =
liftM2 Trans (generaliseStep p) (generaliseStep q)
generaliseStep (Cong f ps) =
Cong f <$> mapM generaliseStep ps
freshen xs f = do
n <- get
put (n + length xs)
let Just sub = listToSubst [(x, build (var (V i))) | (x, i) <- zip (usort xs) [n..]]
return (f sub)
stepsConstraints ps = zipWith combine eqs (tail eqs)
where
eqs = map (equation . certify) ps
combine (_ :=: t) (u :=: _) = (t, u) | 1,518 | generaliseProof =
simplificationPass (const generaliseLemma) (const generaliseGoal)
where
generaliseLemma p = lemma (certify q) sub
where
(q, sub) = generalise p
generaliseGoal p = subst sub q
where
(q, sub) = generalise (certify p)
generalise p = (q, sub)
where
eq = equation p
n = freshVar eq
qs = evalState (mapM generaliseStep (steps (derivation p))) n
Just sub1 = unifyMany (stepsConstraints qs)
q = canonicalise (fromSteps eq (subst sub1 qs))
Just sub = matchEquation (equation (certify q)) eq
generaliseStep (UseAxiom axiom _) =
freshen (vars (axiom_eqn axiom)) (UseAxiom axiom)
generaliseStep (UseLemma lemma _) =
freshen (vars (equation lemma)) (UseLemma lemma)
generaliseStep (Refl _) = do
n <- get
put (n+1)
return (Refl (build (var (V n))))
generaliseStep (Symm p) =
Symm <$> generaliseStep p
generaliseStep (Trans p q) =
liftM2 Trans (generaliseStep p) (generaliseStep q)
generaliseStep (Cong f ps) =
Cong f <$> mapM generaliseStep ps
freshen xs f = do
n <- get
put (n + length xs)
let Just sub = listToSubst [(x, build (var (V i))) | (x, i) <- zip (usort xs) [n..]]
return (f sub)
stepsConstraints ps = zipWith combine eqs (tail eqs)
where
eqs = map (equation . certify) ps
combine (_ :=: t) (u :=: _) = (t, u) | 1,452 | false | true | 0 | 17 | 444 | 665 | 325 | 340 | null | null |
david-caro/shellcheck | ShellCheck/Analytics.hs | gpl-3.0 | checkOrNeq _ (TA_Binary id "||" (TA_Binary _ "!=" word1 _) (TA_Binary _ "!=" word2 _))
| word1 == word2 =
warn id 2056 "You probably wanted && here." | 161 | checkOrNeq _ (TA_Binary id "||" (TA_Binary _ "!=" word1 _) (TA_Binary _ "!=" word2 _))
| word1 == word2 =
warn id 2056 "You probably wanted && here." | 161 | checkOrNeq _ (TA_Binary id "||" (TA_Binary _ "!=" word1 _) (TA_Binary _ "!=" word2 _))
| word1 == word2 =
warn id 2056 "You probably wanted && here." | 161 | false | false | 0 | 9 | 39 | 64 | 30 | 34 | null | null |
oldmanmike/ghc | compiler/cmm/CmmType.hs | bsd-3-clause | isFloat32 _other = False | 40 | isFloat32 _other = False | 40 | isFloat32 _other = False | 40 | false | false | 0 | 4 | 19 | 9 | 4 | 5 | null | null |
brendanhay/gogol | gogol-youtube/gen/Network/Google/YouTube/Types/Product.hs | mpl-2.0 | -- | The broadcast\'s privacy status. Note that the broadcast represents
-- exactly one YouTube video, so the privacy settings are identical to
-- those supported for videos. In addition, you can set this field by
-- modifying the broadcast resource or by setting the privacyStatus field
-- of the corresponding video resource.
lbsPrivacyStatus :: Lens' LiveBroadcastStatus (Maybe LiveBroadcastStatusPrivacyStatus)
lbsPrivacyStatus
= lens _lbsPrivacyStatus
(\ s a -> s{_lbsPrivacyStatus = a}) | 500 | lbsPrivacyStatus :: Lens' LiveBroadcastStatus (Maybe LiveBroadcastStatusPrivacyStatus)
lbsPrivacyStatus
= lens _lbsPrivacyStatus
(\ s a -> s{_lbsPrivacyStatus = a}) | 172 | lbsPrivacyStatus
= lens _lbsPrivacyStatus
(\ s a -> s{_lbsPrivacyStatus = a}) | 85 | true | true | 0 | 9 | 77 | 52 | 29 | 23 | null | null |
tweag/distributed-process | src/Control/Distributed/Process/Node.hs | bsd-3-clause | ncEffectRegister :: ProcessId -> String -> NodeId -> Maybe ProcessId -> Bool -> NC ()
ncEffectRegister from label atnode mPid reregistration = do
node <- ask
currentVal <- gets (^. registeredHereFor label)
isOk <-
case mPid of
Nothing -> -- unregister request
return $ isJust currentVal
Just thepid -> -- register request
do isvalidlocal <- isValidLocalIdentifier (ProcessIdentifier thepid)
return $ (isNothing currentVal /= reregistration) &&
(not (isLocal node (ProcessIdentifier thepid) ) || isvalidlocal )
if isLocal node (NodeIdentifier atnode)
then do when isOk $
do modify' $ registeredHereFor label ^= mPid
updateRemote node currentVal mPid
case mPid of
(Just p) -> liftIO $ trace node (MxRegistered p label)
Nothing -> liftIO $ trace node (MxUnRegistered (fromJust currentVal) label)
newVal <- gets (^. registeredHereFor label)
liftIO $ sendMessage node
(NodeIdentifier (localNodeId node))
(ProcessIdentifier from)
WithImplicitReconnect
(RegisterReply label isOk newVal)
else let operation =
case reregistration of
True -> flip decList
False -> flip incList
in case mPid of
Nothing -> return ()
Just pid -> modify' $ registeredOnNodesFor pid ^: (maybeify $ operation atnode)
where updateRemote node (Just oldval) (Just newval) | processNodeId oldval /= processNodeId newval =
do forward node (processNodeId oldval) (Register label atnode (Just oldval) True)
forward node (processNodeId newval) (Register label atnode (Just newval) False)
updateRemote node Nothing (Just newval) =
forward node (processNodeId newval) (Register label atnode (Just newval) False)
updateRemote node (Just oldval) Nothing =
forward node (processNodeId oldval) (Register label atnode (Just oldval) True)
updateRemote _ _ _ = return ()
maybeify f Nothing = unmaybeify $ f []
maybeify f (Just x) = unmaybeify $ f x
unmaybeify [] = Nothing
unmaybeify x = Just x
incList [] tag = [(tag,1)]
incList ((atag,acount):xs) tag | tag==atag = (atag,acount+1) : xs
incList (x:xs) tag = x : incList xs tag
decList [] _ = []
decList ((atag,1):xs) tag | atag == tag = xs
decList ((atag,n):xs) tag | atag == tag = (atag,n-1):xs
decList (x:xs) tag = x:decList xs tag
forward node to reg =
when (not $ isLocal node (NodeIdentifier to)) $
liftIO $ sendBinary node
(ProcessIdentifier from)
(NodeIdentifier to)
WithImplicitReconnect
NCMsg
{ ctrlMsgSender = ProcessIdentifier from
, ctrlMsgSignal = reg
}
-- Unified semantics does not explicitly describe 'whereis' | 3,403 | ncEffectRegister :: ProcessId -> String -> NodeId -> Maybe ProcessId -> Bool -> NC ()
ncEffectRegister from label atnode mPid reregistration = do
node <- ask
currentVal <- gets (^. registeredHereFor label)
isOk <-
case mPid of
Nothing -> -- unregister request
return $ isJust currentVal
Just thepid -> -- register request
do isvalidlocal <- isValidLocalIdentifier (ProcessIdentifier thepid)
return $ (isNothing currentVal /= reregistration) &&
(not (isLocal node (ProcessIdentifier thepid) ) || isvalidlocal )
if isLocal node (NodeIdentifier atnode)
then do when isOk $
do modify' $ registeredHereFor label ^= mPid
updateRemote node currentVal mPid
case mPid of
(Just p) -> liftIO $ trace node (MxRegistered p label)
Nothing -> liftIO $ trace node (MxUnRegistered (fromJust currentVal) label)
newVal <- gets (^. registeredHereFor label)
liftIO $ sendMessage node
(NodeIdentifier (localNodeId node))
(ProcessIdentifier from)
WithImplicitReconnect
(RegisterReply label isOk newVal)
else let operation =
case reregistration of
True -> flip decList
False -> flip incList
in case mPid of
Nothing -> return ()
Just pid -> modify' $ registeredOnNodesFor pid ^: (maybeify $ operation atnode)
where updateRemote node (Just oldval) (Just newval) | processNodeId oldval /= processNodeId newval =
do forward node (processNodeId oldval) (Register label atnode (Just oldval) True)
forward node (processNodeId newval) (Register label atnode (Just newval) False)
updateRemote node Nothing (Just newval) =
forward node (processNodeId newval) (Register label atnode (Just newval) False)
updateRemote node (Just oldval) Nothing =
forward node (processNodeId oldval) (Register label atnode (Just oldval) True)
updateRemote _ _ _ = return ()
maybeify f Nothing = unmaybeify $ f []
maybeify f (Just x) = unmaybeify $ f x
unmaybeify [] = Nothing
unmaybeify x = Just x
incList [] tag = [(tag,1)]
incList ((atag,acount):xs) tag | tag==atag = (atag,acount+1) : xs
incList (x:xs) tag = x : incList xs tag
decList [] _ = []
decList ((atag,1):xs) tag | atag == tag = xs
decList ((atag,n):xs) tag | atag == tag = (atag,n-1):xs
decList (x:xs) tag = x:decList xs tag
forward node to reg =
when (not $ isLocal node (NodeIdentifier to)) $
liftIO $ sendBinary node
(ProcessIdentifier from)
(NodeIdentifier to)
WithImplicitReconnect
NCMsg
{ ctrlMsgSender = ProcessIdentifier from
, ctrlMsgSignal = reg
}
-- Unified semantics does not explicitly describe 'whereis' | 3,403 | ncEffectRegister from label atnode mPid reregistration = do
node <- ask
currentVal <- gets (^. registeredHereFor label)
isOk <-
case mPid of
Nothing -> -- unregister request
return $ isJust currentVal
Just thepid -> -- register request
do isvalidlocal <- isValidLocalIdentifier (ProcessIdentifier thepid)
return $ (isNothing currentVal /= reregistration) &&
(not (isLocal node (ProcessIdentifier thepid) ) || isvalidlocal )
if isLocal node (NodeIdentifier atnode)
then do when isOk $
do modify' $ registeredHereFor label ^= mPid
updateRemote node currentVal mPid
case mPid of
(Just p) -> liftIO $ trace node (MxRegistered p label)
Nothing -> liftIO $ trace node (MxUnRegistered (fromJust currentVal) label)
newVal <- gets (^. registeredHereFor label)
liftIO $ sendMessage node
(NodeIdentifier (localNodeId node))
(ProcessIdentifier from)
WithImplicitReconnect
(RegisterReply label isOk newVal)
else let operation =
case reregistration of
True -> flip decList
False -> flip incList
in case mPid of
Nothing -> return ()
Just pid -> modify' $ registeredOnNodesFor pid ^: (maybeify $ operation atnode)
where updateRemote node (Just oldval) (Just newval) | processNodeId oldval /= processNodeId newval =
do forward node (processNodeId oldval) (Register label atnode (Just oldval) True)
forward node (processNodeId newval) (Register label atnode (Just newval) False)
updateRemote node Nothing (Just newval) =
forward node (processNodeId newval) (Register label atnode (Just newval) False)
updateRemote node (Just oldval) Nothing =
forward node (processNodeId oldval) (Register label atnode (Just oldval) True)
updateRemote _ _ _ = return ()
maybeify f Nothing = unmaybeify $ f []
maybeify f (Just x) = unmaybeify $ f x
unmaybeify [] = Nothing
unmaybeify x = Just x
incList [] tag = [(tag,1)]
incList ((atag,acount):xs) tag | tag==atag = (atag,acount+1) : xs
incList (x:xs) tag = x : incList xs tag
decList [] _ = []
decList ((atag,1):xs) tag | atag == tag = xs
decList ((atag,n):xs) tag | atag == tag = (atag,n-1):xs
decList (x:xs) tag = x:decList xs tag
forward node to reg =
when (not $ isLocal node (NodeIdentifier to)) $
liftIO $ sendBinary node
(ProcessIdentifier from)
(NodeIdentifier to)
WithImplicitReconnect
NCMsg
{ ctrlMsgSender = ProcessIdentifier from
, ctrlMsgSignal = reg
}
-- Unified semantics does not explicitly describe 'whereis' | 3,317 | false | true | 0 | 27 | 1,342 | 1,017 | 494 | 523 | null | null |
faylang/fay-server | src/Language/Fay/Ref.hs | bsd-3-clause | writeRef :: Ref a -> a -> Fay ()
writeRef = ffi "Fay$$writeRef(%1,%2)" | 70 | writeRef :: Ref a -> a -> Fay ()
writeRef = ffi "Fay$$writeRef(%1,%2)" | 70 | writeRef = ffi "Fay$$writeRef(%1,%2)" | 37 | false | true | 0 | 8 | 12 | 30 | 14 | 16 | null | null |
m-alvarez/jhc | src/Interactive.hs | mit | nameTag :: NameType -> Char
nameTag TypeConstructor = 'T' | 57 | nameTag :: NameType -> Char
nameTag TypeConstructor = 'T' | 57 | nameTag TypeConstructor = 'T' | 29 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
rueshyna/gogol | gogol-adexchange-buyer/gen/Network/Google/AdExchangeBuyer/Types/Product.hs | mpl-2.0 | -- | The time (ms since epoch) of the deal creation. (readonly)
mdCreationTimeMs :: Lens' MarketplaceDeal (Maybe Int64)
mdCreationTimeMs
= lens _mdCreationTimeMs
(\ s a -> s{_mdCreationTimeMs = a})
. mapping _Coerce | 229 | mdCreationTimeMs :: Lens' MarketplaceDeal (Maybe Int64)
mdCreationTimeMs
= lens _mdCreationTimeMs
(\ s a -> s{_mdCreationTimeMs = a})
. mapping _Coerce | 165 | mdCreationTimeMs
= lens _mdCreationTimeMs
(\ s a -> s{_mdCreationTimeMs = a})
. mapping _Coerce | 109 | true | true | 2 | 8 | 45 | 59 | 28 | 31 | null | null |
xmonad/xmonad-contrib | XMonad/Actions/WindowNavigation.hs | bsd-3-clause | inr R (Point px py) (Rectangle rx ry w h) = px < rx + fromIntegral w &&
py >= ry && py < ry + fromIntegral h | 164 | inr R (Point px py) (Rectangle rx ry w h) = px < rx + fromIntegral w &&
py >= ry && py < ry + fromIntegral h | 164 | inr R (Point px py) (Rectangle rx ry w h) = px < rx + fromIntegral w &&
py >= ry && py < ry + fromIntegral h | 164 | false | false | 0 | 11 | 83 | 67 | 32 | 35 | null | null |
vinnymac/glot-www | Model/Language.hs | mit | languageLogoPng D = img_d_svg_png | 33 | languageLogoPng D = img_d_svg_png | 33 | languageLogoPng D = img_d_svg_png | 33 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
hpacheco/HAAP | examples/plab/svn/2017li1g186/src/OracleT3.hs | mit | {-
Testes para avaliação: com replicação, e para dar erros maiores.
Tempo: 1.1, velocidade: 0.9 (distância será 0.99)
-}
evaluationTests :: [(Tabuleiro,Tempo,Carro)]
evaluationTests = [
--- apenas 1 PASSO RECURSIVO
-- 1. rectas: passa percurso
(testeMapa , 1.1, Carro (5.9,1.5) 0 (0.9,0.1))
-- 2. rectas: cai adjacente
, (testeMapa , 1.1, Carro (5.5,2.1) 0 (0.1,-0.9))
-- 3. rectas: passa adjacente
, (testeMapa , 1.1, Carro (8.5,1.9) 0 (0.1,0.9))
-- 4. rectas: choca adjacente
, (testeMapa , 1.1, Carro (5.5,1.9) 0 (0.1,0.9))
-- 5. rectas: cai lava
, (testeMapa , 1.1, Carro (3.5,1.1) 0 (0.1,-0.9))
-- 6. rectas: passa lava (mesma altura)
, (testeMapa , 1.1, Carro (5.5,1.1) 0 (0.1,-0.9))
-- 7. rectas: choca lava
, (testeMapa , 1.1, Carro (8.5,1.1) 0 (0.1,-0.9))
-- 8. curva: choca lava
, (testeMapa , 1.1, Carro (13.4,1.5) 0 (0.3,-0.1))
-- 9. curva: cai lava (mesma altura)
, (testeMapa , 1.1, Carro (1.6,1.5) 0 (-0.3,-0.1))
-- 10. recta->curva: cai
, (testeCurvas , 1.1, Carro (8.5,3.1) 0 (0.1,-0.9))
-- 11. recta->curva: lava
, (testeCurvas , 1.1, Carro (5.5,3.1) 0 (0.1,-0.9))
-- 12. recta->curva: choca
, (testeCurvas , 1.1, Carro (3.5,3.1) 0 (0.1,-0.9))
-- 13. curva->lava: choca
, (testeCurvas , 1.1, Carro (3.55,2.45) 45 (-0.9,0.1))
-- 14. curva->lava: choca
, (testeCurvas , 1.1, Carro (1.55,1.55) 45 (-0.9,-0.1))
-- 15. rectas: adjacente + choca lava 2
, (testeMapa , 1.1, Carro (8.5,1.5) 0 (0.1,1.9))
-- 16. rectas: choca lava + adjacente 2
, (testeMapa , 1.1, Carro (8.5,2.5) 0 (0.1,1.9))
-- 17. rectas: choca lava + adjacente + choca lava 3
, (testeMapa , 1.1, Carro (8.5,2.5) 0 (0.1,2.3))
-- 18. rectas: choca lava + adjacente + choca lava + adjacente 4
, (testeMapa , 1.1, Carro (8.5,2.5) 0 (0.1,3.3))
-- 19. rectas: choca adjacente + cai lava (mesma altura) 2
, (testeMapa , 1.1, Carro (5.5,1.5) 0 (0.1,1.9))
-- 20. curvas: adjacente + choca lava 3
, (testeMapa , 1.1, Carro (11.6,1.5) 0 (2.1,0.1))
-- 21. curva: adjacente + cai lava 2
, (testeMapa , 1.1, Carro (1.6,2.5) 0 (-0.1,-1.1))
-- 22. curva: choca lava 2
, (testeMapa , 1.1, Carro (12.5,1.5) 0 (2.8,-0.1))
---- 25. curva: cai 2 (passa a lava) -- @nmm nao percebo a particularidade deste teste!
--, (testeMapa , 1.1, Carro (1.6,2.5) 0 (-0.3,-0.1))
----- Rampas horizontais
----- (cai se queda >= 1, choca se degrau >= 1, passa se diff. entre 1 e -1)
-- 23. rampas: cai
, (testeMapa , 1.1, Carro (10.5,1.9) 0 (-0.1,0.9))
-- 24. rampas: choca
, (testeMapa , 1.1, Carro (10.5,2.1) 0 (0.1,-0.9))
-- 25. rampas: passa (igual)
, (testeMapa , 1.1, Carro (2.5,1.9) 0 (0.1,0.9))
-- 26. rampas x2: passa (um pouco maior)
, (testeMapa , 1.1, Carro (4.5,1.9) 0 (0.1,0.9))
-- 27. rampas x2: passa (um pouco menor)
, (testeMapa , 1.1, Carro (4.5,1.9) 0 (-0.1,0.9))
---- casos difíceis (sobe/desce Bom Jesus)
-- 28. rampas: choca (tricky)
, (testeMapa , 1.1, Carro (9.5,2.1) 0 (0.1,-0.9))
-- 29. rampas: não choca (tricky)
, (testeMapa , 1.1, Carro (9.5,2.1) 0 (-0.1,-0.9))
-- 30. rampas: passa (tricky)
, (testeMapa , 1.1, Carro (9.5,1.9) 0 (0.1,0.9))
-- 31. rampas: não passa (tricky)
, (testeMapa , 1.1, Carro (9.5,1.9) 0 (-0.1,0.9))
-- 32. rampas: choca rés-vés (tricky x2)
, (testeMapa , 1.1, Carro (9.5,2.1) 0 (0,-0.9))
-- 33. rampas: choca lava
, (testeMapa , 1.1, Carro (9.5,2.9) 0 (0.1,0.9))
-- 34. rampas: cai lava
, (testeMapa , 1.1, Carro (9.5,1.1) 0 (0.1,-0.9))
------ Rampas paralelas
-- 35. rampas, paralelas cai
, (testeMapa', 1.1, Carro (4.5,2.1) 0 (0.1,-0.9))
-- 36. rampas, paralelas choca
, (testeMapa', 1.1, Carro (4.5,1.9) 0 (0.1,0.9))
----- Rampas verticais
-- 37. rampas verticais 1 - segue percurso
,(testeMapaV, 3, Carro (2.5,3.5) 0 (0,2))
-- 38. rampas verticais 2 - segue percurso
,(testeMapaV, 3, Carro (2.5,9.5) 0 (0,-2))
-- 39. rampas verticais 3 - passa para recta paralela igual
,(testeMapaV, 1.1, Carro (2.1,9.5) 0 (-0.9,-0.1))
----- 2+ PASSOS RECURSIVOS
-- 40. rectas: passa percurso 2
, (testeMapa , 1.2, Carro (3.6,1.5) 0 (-1.6,0.1))
-- 41. rectas: passa percurso 3
, (testeMapa , 1.2, Carro (4.6,1.5) 0 (-2.6,0.1))
-- 42. curvas: cai lava (mesma altura) 3
, (testeMapa , 1.1, Carro (3.6,1.5) 0 (-2.6,0.1))
-- 43. rectas: adjacente + cai lava (mesma altura) 10
, (testeMapa , 5.5, Carro (12.5,1.2) 0 (-2.1,0.1))
-- 44. rectas: adjacente + choca lava 2
, (testeMapa , 3.0, Carro (7.5,2.5) 90 (0.7,0.4))
-- CORNER CASES (0 tempo/velocidade)
-- 45. tempo = 0
, (testeMapa, 0, Carro (9.5,1.5) 0 (0.1,-0.9))
-- 46. velocidade = 0
, (testeMapa, 2, Carro (9.5,1.5) 0 (0,0))
] | 4,699 | evaluationTests :: [(Tabuleiro,Tempo,Carro)]
evaluationTests = [
--- apenas 1 PASSO RECURSIVO
-- 1. rectas: passa percurso
(testeMapa , 1.1, Carro (5.9,1.5) 0 (0.9,0.1))
-- 2. rectas: cai adjacente
, (testeMapa , 1.1, Carro (5.5,2.1) 0 (0.1,-0.9))
-- 3. rectas: passa adjacente
, (testeMapa , 1.1, Carro (8.5,1.9) 0 (0.1,0.9))
-- 4. rectas: choca adjacente
, (testeMapa , 1.1, Carro (5.5,1.9) 0 (0.1,0.9))
-- 5. rectas: cai lava
, (testeMapa , 1.1, Carro (3.5,1.1) 0 (0.1,-0.9))
-- 6. rectas: passa lava (mesma altura)
, (testeMapa , 1.1, Carro (5.5,1.1) 0 (0.1,-0.9))
-- 7. rectas: choca lava
, (testeMapa , 1.1, Carro (8.5,1.1) 0 (0.1,-0.9))
-- 8. curva: choca lava
, (testeMapa , 1.1, Carro (13.4,1.5) 0 (0.3,-0.1))
-- 9. curva: cai lava (mesma altura)
, (testeMapa , 1.1, Carro (1.6,1.5) 0 (-0.3,-0.1))
-- 10. recta->curva: cai
, (testeCurvas , 1.1, Carro (8.5,3.1) 0 (0.1,-0.9))
-- 11. recta->curva: lava
, (testeCurvas , 1.1, Carro (5.5,3.1) 0 (0.1,-0.9))
-- 12. recta->curva: choca
, (testeCurvas , 1.1, Carro (3.5,3.1) 0 (0.1,-0.9))
-- 13. curva->lava: choca
, (testeCurvas , 1.1, Carro (3.55,2.45) 45 (-0.9,0.1))
-- 14. curva->lava: choca
, (testeCurvas , 1.1, Carro (1.55,1.55) 45 (-0.9,-0.1))
-- 15. rectas: adjacente + choca lava 2
, (testeMapa , 1.1, Carro (8.5,1.5) 0 (0.1,1.9))
-- 16. rectas: choca lava + adjacente 2
, (testeMapa , 1.1, Carro (8.5,2.5) 0 (0.1,1.9))
-- 17. rectas: choca lava + adjacente + choca lava 3
, (testeMapa , 1.1, Carro (8.5,2.5) 0 (0.1,2.3))
-- 18. rectas: choca lava + adjacente + choca lava + adjacente 4
, (testeMapa , 1.1, Carro (8.5,2.5) 0 (0.1,3.3))
-- 19. rectas: choca adjacente + cai lava (mesma altura) 2
, (testeMapa , 1.1, Carro (5.5,1.5) 0 (0.1,1.9))
-- 20. curvas: adjacente + choca lava 3
, (testeMapa , 1.1, Carro (11.6,1.5) 0 (2.1,0.1))
-- 21. curva: adjacente + cai lava 2
, (testeMapa , 1.1, Carro (1.6,2.5) 0 (-0.1,-1.1))
-- 22. curva: choca lava 2
, (testeMapa , 1.1, Carro (12.5,1.5) 0 (2.8,-0.1))
---- 25. curva: cai 2 (passa a lava) -- @nmm nao percebo a particularidade deste teste!
--, (testeMapa , 1.1, Carro (1.6,2.5) 0 (-0.3,-0.1))
----- Rampas horizontais
----- (cai se queda >= 1, choca se degrau >= 1, passa se diff. entre 1 e -1)
-- 23. rampas: cai
, (testeMapa , 1.1, Carro (10.5,1.9) 0 (-0.1,0.9))
-- 24. rampas: choca
, (testeMapa , 1.1, Carro (10.5,2.1) 0 (0.1,-0.9))
-- 25. rampas: passa (igual)
, (testeMapa , 1.1, Carro (2.5,1.9) 0 (0.1,0.9))
-- 26. rampas x2: passa (um pouco maior)
, (testeMapa , 1.1, Carro (4.5,1.9) 0 (0.1,0.9))
-- 27. rampas x2: passa (um pouco menor)
, (testeMapa , 1.1, Carro (4.5,1.9) 0 (-0.1,0.9))
---- casos difíceis (sobe/desce Bom Jesus)
-- 28. rampas: choca (tricky)
, (testeMapa , 1.1, Carro (9.5,2.1) 0 (0.1,-0.9))
-- 29. rampas: não choca (tricky)
, (testeMapa , 1.1, Carro (9.5,2.1) 0 (-0.1,-0.9))
-- 30. rampas: passa (tricky)
, (testeMapa , 1.1, Carro (9.5,1.9) 0 (0.1,0.9))
-- 31. rampas: não passa (tricky)
, (testeMapa , 1.1, Carro (9.5,1.9) 0 (-0.1,0.9))
-- 32. rampas: choca rés-vés (tricky x2)
, (testeMapa , 1.1, Carro (9.5,2.1) 0 (0,-0.9))
-- 33. rampas: choca lava
, (testeMapa , 1.1, Carro (9.5,2.9) 0 (0.1,0.9))
-- 34. rampas: cai lava
, (testeMapa , 1.1, Carro (9.5,1.1) 0 (0.1,-0.9))
------ Rampas paralelas
-- 35. rampas, paralelas cai
, (testeMapa', 1.1, Carro (4.5,2.1) 0 (0.1,-0.9))
-- 36. rampas, paralelas choca
, (testeMapa', 1.1, Carro (4.5,1.9) 0 (0.1,0.9))
----- Rampas verticais
-- 37. rampas verticais 1 - segue percurso
,(testeMapaV, 3, Carro (2.5,3.5) 0 (0,2))
-- 38. rampas verticais 2 - segue percurso
,(testeMapaV, 3, Carro (2.5,9.5) 0 (0,-2))
-- 39. rampas verticais 3 - passa para recta paralela igual
,(testeMapaV, 1.1, Carro (2.1,9.5) 0 (-0.9,-0.1))
----- 2+ PASSOS RECURSIVOS
-- 40. rectas: passa percurso 2
, (testeMapa , 1.2, Carro (3.6,1.5) 0 (-1.6,0.1))
-- 41. rectas: passa percurso 3
, (testeMapa , 1.2, Carro (4.6,1.5) 0 (-2.6,0.1))
-- 42. curvas: cai lava (mesma altura) 3
, (testeMapa , 1.1, Carro (3.6,1.5) 0 (-2.6,0.1))
-- 43. rectas: adjacente + cai lava (mesma altura) 10
, (testeMapa , 5.5, Carro (12.5,1.2) 0 (-2.1,0.1))
-- 44. rectas: adjacente + choca lava 2
, (testeMapa , 3.0, Carro (7.5,2.5) 90 (0.7,0.4))
-- CORNER CASES (0 tempo/velocidade)
-- 45. tempo = 0
, (testeMapa, 0, Carro (9.5,1.5) 0 (0.1,-0.9))
-- 46. velocidade = 0
, (testeMapa, 2, Carro (9.5,1.5) 0 (0,0))
] | 4,574 | evaluationTests = [
--- apenas 1 PASSO RECURSIVO
-- 1. rectas: passa percurso
(testeMapa , 1.1, Carro (5.9,1.5) 0 (0.9,0.1))
-- 2. rectas: cai adjacente
, (testeMapa , 1.1, Carro (5.5,2.1) 0 (0.1,-0.9))
-- 3. rectas: passa adjacente
, (testeMapa , 1.1, Carro (8.5,1.9) 0 (0.1,0.9))
-- 4. rectas: choca adjacente
, (testeMapa , 1.1, Carro (5.5,1.9) 0 (0.1,0.9))
-- 5. rectas: cai lava
, (testeMapa , 1.1, Carro (3.5,1.1) 0 (0.1,-0.9))
-- 6. rectas: passa lava (mesma altura)
, (testeMapa , 1.1, Carro (5.5,1.1) 0 (0.1,-0.9))
-- 7. rectas: choca lava
, (testeMapa , 1.1, Carro (8.5,1.1) 0 (0.1,-0.9))
-- 8. curva: choca lava
, (testeMapa , 1.1, Carro (13.4,1.5) 0 (0.3,-0.1))
-- 9. curva: cai lava (mesma altura)
, (testeMapa , 1.1, Carro (1.6,1.5) 0 (-0.3,-0.1))
-- 10. recta->curva: cai
, (testeCurvas , 1.1, Carro (8.5,3.1) 0 (0.1,-0.9))
-- 11. recta->curva: lava
, (testeCurvas , 1.1, Carro (5.5,3.1) 0 (0.1,-0.9))
-- 12. recta->curva: choca
, (testeCurvas , 1.1, Carro (3.5,3.1) 0 (0.1,-0.9))
-- 13. curva->lava: choca
, (testeCurvas , 1.1, Carro (3.55,2.45) 45 (-0.9,0.1))
-- 14. curva->lava: choca
, (testeCurvas , 1.1, Carro (1.55,1.55) 45 (-0.9,-0.1))
-- 15. rectas: adjacente + choca lava 2
, (testeMapa , 1.1, Carro (8.5,1.5) 0 (0.1,1.9))
-- 16. rectas: choca lava + adjacente 2
, (testeMapa , 1.1, Carro (8.5,2.5) 0 (0.1,1.9))
-- 17. rectas: choca lava + adjacente + choca lava 3
, (testeMapa , 1.1, Carro (8.5,2.5) 0 (0.1,2.3))
-- 18. rectas: choca lava + adjacente + choca lava + adjacente 4
, (testeMapa , 1.1, Carro (8.5,2.5) 0 (0.1,3.3))
-- 19. rectas: choca adjacente + cai lava (mesma altura) 2
, (testeMapa , 1.1, Carro (5.5,1.5) 0 (0.1,1.9))
-- 20. curvas: adjacente + choca lava 3
, (testeMapa , 1.1, Carro (11.6,1.5) 0 (2.1,0.1))
-- 21. curva: adjacente + cai lava 2
, (testeMapa , 1.1, Carro (1.6,2.5) 0 (-0.1,-1.1))
-- 22. curva: choca lava 2
, (testeMapa , 1.1, Carro (12.5,1.5) 0 (2.8,-0.1))
---- 25. curva: cai 2 (passa a lava) -- @nmm nao percebo a particularidade deste teste!
--, (testeMapa , 1.1, Carro (1.6,2.5) 0 (-0.3,-0.1))
----- Rampas horizontais
----- (cai se queda >= 1, choca se degrau >= 1, passa se diff. entre 1 e -1)
-- 23. rampas: cai
, (testeMapa , 1.1, Carro (10.5,1.9) 0 (-0.1,0.9))
-- 24. rampas: choca
, (testeMapa , 1.1, Carro (10.5,2.1) 0 (0.1,-0.9))
-- 25. rampas: passa (igual)
, (testeMapa , 1.1, Carro (2.5,1.9) 0 (0.1,0.9))
-- 26. rampas x2: passa (um pouco maior)
, (testeMapa , 1.1, Carro (4.5,1.9) 0 (0.1,0.9))
-- 27. rampas x2: passa (um pouco menor)
, (testeMapa , 1.1, Carro (4.5,1.9) 0 (-0.1,0.9))
---- casos difíceis (sobe/desce Bom Jesus)
-- 28. rampas: choca (tricky)
, (testeMapa , 1.1, Carro (9.5,2.1) 0 (0.1,-0.9))
-- 29. rampas: não choca (tricky)
, (testeMapa , 1.1, Carro (9.5,2.1) 0 (-0.1,-0.9))
-- 30. rampas: passa (tricky)
, (testeMapa , 1.1, Carro (9.5,1.9) 0 (0.1,0.9))
-- 31. rampas: não passa (tricky)
, (testeMapa , 1.1, Carro (9.5,1.9) 0 (-0.1,0.9))
-- 32. rampas: choca rés-vés (tricky x2)
, (testeMapa , 1.1, Carro (9.5,2.1) 0 (0,-0.9))
-- 33. rampas: choca lava
, (testeMapa , 1.1, Carro (9.5,2.9) 0 (0.1,0.9))
-- 34. rampas: cai lava
, (testeMapa , 1.1, Carro (9.5,1.1) 0 (0.1,-0.9))
------ Rampas paralelas
-- 35. rampas, paralelas cai
, (testeMapa', 1.1, Carro (4.5,2.1) 0 (0.1,-0.9))
-- 36. rampas, paralelas choca
, (testeMapa', 1.1, Carro (4.5,1.9) 0 (0.1,0.9))
----- Rampas verticais
-- 37. rampas verticais 1 - segue percurso
,(testeMapaV, 3, Carro (2.5,3.5) 0 (0,2))
-- 38. rampas verticais 2 - segue percurso
,(testeMapaV, 3, Carro (2.5,9.5) 0 (0,-2))
-- 39. rampas verticais 3 - passa para recta paralela igual
,(testeMapaV, 1.1, Carro (2.1,9.5) 0 (-0.9,-0.1))
----- 2+ PASSOS RECURSIVOS
-- 40. rectas: passa percurso 2
, (testeMapa , 1.2, Carro (3.6,1.5) 0 (-1.6,0.1))
-- 41. rectas: passa percurso 3
, (testeMapa , 1.2, Carro (4.6,1.5) 0 (-2.6,0.1))
-- 42. curvas: cai lava (mesma altura) 3
, (testeMapa , 1.1, Carro (3.6,1.5) 0 (-2.6,0.1))
-- 43. rectas: adjacente + cai lava (mesma altura) 10
, (testeMapa , 5.5, Carro (12.5,1.2) 0 (-2.1,0.1))
-- 44. rectas: adjacente + choca lava 2
, (testeMapa , 3.0, Carro (7.5,2.5) 90 (0.7,0.4))
-- CORNER CASES (0 tempo/velocidade)
-- 45. tempo = 0
, (testeMapa, 0, Carro (9.5,1.5) 0 (0.1,-0.9))
-- 46. velocidade = 0
, (testeMapa, 2, Carro (9.5,1.5) 0 (0,0))
] | 4,529 | true | true | 0 | 9 | 981 | 1,574 | 979 | 595 | null | null |
Happy0/snowdrift | Model/Comment.hs | agpl-3.0 | -- | Get the depth of a comment, given (maybe) its parent's CommentId.
fetchCommentDepthFromMaybeParentIdDB :: Maybe CommentId -> DB Int
fetchCommentDepthFromMaybeParentIdDB = maybe (return 0) (fmap (+1) . fetchCommentDepthDB) | 226 | fetchCommentDepthFromMaybeParentIdDB :: Maybe CommentId -> DB Int
fetchCommentDepthFromMaybeParentIdDB = maybe (return 0) (fmap (+1) . fetchCommentDepthDB) | 155 | fetchCommentDepthFromMaybeParentIdDB = maybe (return 0) (fmap (+1) . fetchCommentDepthDB) | 89 | true | true | 0 | 9 | 28 | 47 | 24 | 23 | null | null |
edgarklerks/document-indexer | Config.hs | bsd-2-clause | getList :: Typeable a => Section -> Label -> Config -> Maybe [a]
getList s l (Config c) = do
sec <- L.lookup s c
l <- L.lookup l sec
case l of
(L xs) -> sequence $ gconvert . GHC.Generics.from <$> xs
(S xs) -> cast xs
_ -> Nothing | 302 | getList :: Typeable a => Section -> Label -> Config -> Maybe [a]
getList s l (Config c) = do
sec <- L.lookup s c
l <- L.lookup l sec
case l of
(L xs) -> sequence $ gconvert . GHC.Generics.from <$> xs
(S xs) -> cast xs
_ -> Nothing | 302 | getList s l (Config c) = do
sec <- L.lookup s c
l <- L.lookup l sec
case l of
(L xs) -> sequence $ gconvert . GHC.Generics.from <$> xs
(S xs) -> cast xs
_ -> Nothing | 237 | false | true | 0 | 13 | 122 | 138 | 64 | 74 | null | null |
ben-schulz/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | inferOpts = [] | 14 | inferOpts = [] | 14 | inferOpts = [] | 14 | false | false | 1 | 6 | 2 | 12 | 4 | 8 | null | null |
RefactoringTools/HaRe | test/testdata/Layout/Move1.hs | bsd-3-clause | hsBinds = undefined | 19 | hsBinds = undefined | 19 | hsBinds = undefined | 19 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
eric-stanley/cabal | Cabal/Distribution/Simple/Utils.hs | bsd-3-clause | matchDirFileGlob :: FilePath -> FilePath -> IO [FilePath]
matchDirFileGlob dir filepath = case parseFileGlob filepath of
Nothing -> die $ "invalid file glob '" ++ filepath
++ "'. Wildcards '*' are only allowed in place of the file"
++ " name, not in the directory name or file extension."
++ " If a wildcard is used it must be with an file extension."
Just (NoGlob filepath') -> return [filepath']
Just (FileGlob dir' ext) -> do
files <- getDirectoryContents (dir </> dir')
case [ dir' </> file
| file <- files
, let (name, ext') = splitExtensions file
, not (null name) && ext' == ext ] of
[] -> die $ "filepath wildcard '" ++ filepath
++ "' does not match any files."
matches -> return matches
--------------------
-- Modification time
-- | Compare the modification times of two files to see if the first is newer
-- than the second. The first file must exist but the second need not.
-- The expected use case is when the second file is generated using the first.
-- In this use case, if the result is True then the second file is out of date.
-- | 1,184 | matchDirFileGlob :: FilePath -> FilePath -> IO [FilePath]
matchDirFileGlob dir filepath = case parseFileGlob filepath of
Nothing -> die $ "invalid file glob '" ++ filepath
++ "'. Wildcards '*' are only allowed in place of the file"
++ " name, not in the directory name or file extension."
++ " If a wildcard is used it must be with an file extension."
Just (NoGlob filepath') -> return [filepath']
Just (FileGlob dir' ext) -> do
files <- getDirectoryContents (dir </> dir')
case [ dir' </> file
| file <- files
, let (name, ext') = splitExtensions file
, not (null name) && ext' == ext ] of
[] -> die $ "filepath wildcard '" ++ filepath
++ "' does not match any files."
matches -> return matches
--------------------
-- Modification time
-- | Compare the modification times of two files to see if the first is newer
-- than the second. The first file must exist but the second need not.
-- The expected use case is when the second file is generated using the first.
-- In this use case, if the result is True then the second file is out of date.
-- | 1,184 | matchDirFileGlob dir filepath = case parseFileGlob filepath of
Nothing -> die $ "invalid file glob '" ++ filepath
++ "'. Wildcards '*' are only allowed in place of the file"
++ " name, not in the directory name or file extension."
++ " If a wildcard is used it must be with an file extension."
Just (NoGlob filepath') -> return [filepath']
Just (FileGlob dir' ext) -> do
files <- getDirectoryContents (dir </> dir')
case [ dir' </> file
| file <- files
, let (name, ext') = splitExtensions file
, not (null name) && ext' == ext ] of
[] -> die $ "filepath wildcard '" ++ filepath
++ "' does not match any files."
matches -> return matches
--------------------
-- Modification time
-- | Compare the modification times of two files to see if the first is newer
-- than the second. The first file must exist but the second need not.
-- The expected use case is when the second file is generated using the first.
-- In this use case, if the result is True then the second file is out of date.
-- | 1,126 | false | true | 3 | 15 | 330 | 218 | 109 | 109 | null | null |
bjpop/haskell-mpi | test/OtherTests.hs | bsd-3-clause | initializedTest :: IO ()
initializedTest = do
isInit <- initialized
isInit == True @? "initialized return False, but was expected to return True" | 151 | initializedTest :: IO ()
initializedTest = do
isInit <- initialized
isInit == True @? "initialized return False, but was expected to return True" | 151 | initializedTest = do
isInit <- initialized
isInit == True @? "initialized return False, but was expected to return True" | 126 | false | true | 0 | 8 | 28 | 34 | 16 | 18 | null | null |
tvh/llvm-general-quote | src/LLVM/General/Quote/SSA.hs | bsd-3-clause | typeOfOperand (ConstantOperand c) = typeOfConstant c | 52 | typeOfOperand (ConstantOperand c) = typeOfConstant c | 52 | typeOfOperand (ConstantOperand c) = typeOfConstant c | 52 | false | false | 0 | 7 | 5 | 18 | 8 | 10 | null | null |
d0kt0r0/estuary | client/src/Estuary/Help/Imagina.hs | gpl-3.0 | referenceText "cantando" = "returns TidalCycles' fast" | 54 | referenceText "cantando" = "returns TidalCycles' fast" | 54 | referenceText "cantando" = "returns TidalCycles' fast" | 54 | false | false | 1 | 5 | 5 | 13 | 4 | 9 | null | null |
ian-ross/cabal | Cabal/Distribution/PackageDescription/Check.hs | bsd-3-clause | checkBenchmark :: PackageDescription -> Benchmark -> [PackageCheck]
checkBenchmark pkg bm =
catMaybes [
case benchmarkInterface bm of
BenchmarkUnsupported tt@(BenchmarkTypeUnknown _ _) -> Just $
PackageBuildWarning $
quote (display tt) ++ " is not a known type of benchmark. "
++ "The known benchmark types are: "
++ commaSep (map display knownBenchmarkTypes)
BenchmarkUnsupported tt -> Just $
PackageBuildWarning $
quote (display tt) ++ " is not a supported benchmark version. "
++ "The known benchmark types are: "
++ commaSep (map display knownBenchmarkTypes)
_ -> Nothing
, check (not $ null moduleDuplicates) $
PackageBuildImpossible $
"Duplicate modules in benchmark '" ++ benchmarkName bm ++ "': "
++ commaSep (map display moduleDuplicates)
, check mainIsWrongExt $
PackageBuildImpossible $
"The 'main-is' field must specify a '.hs' or '.lhs' file "
++ "(even if it is generated by a preprocessor)."
-- See comment for similar check on test suites.
, check libNameClash $
PackageBuildImpossible $
"The benchmark " ++ benchmarkName bm
++ " has the same name as the package."
]
where
moduleDuplicates = dups $ benchmarkModules bm
mainIsWrongExt = case benchmarkInterface bm of
BenchmarkExeV10 _ f -> takeExtension f `notElem` [".hs", ".lhs"]
_ -> False
libNameClash = benchmarkName bm `elem` [ libName
| _lib <- maybeToList (library pkg)
, let PackageName libName =
pkgName (package pkg) ]
-- ------------------------------------------------------------
-- * Additional pure checks
-- ------------------------------------------------------------ | 1,932 | checkBenchmark :: PackageDescription -> Benchmark -> [PackageCheck]
checkBenchmark pkg bm =
catMaybes [
case benchmarkInterface bm of
BenchmarkUnsupported tt@(BenchmarkTypeUnknown _ _) -> Just $
PackageBuildWarning $
quote (display tt) ++ " is not a known type of benchmark. "
++ "The known benchmark types are: "
++ commaSep (map display knownBenchmarkTypes)
BenchmarkUnsupported tt -> Just $
PackageBuildWarning $
quote (display tt) ++ " is not a supported benchmark version. "
++ "The known benchmark types are: "
++ commaSep (map display knownBenchmarkTypes)
_ -> Nothing
, check (not $ null moduleDuplicates) $
PackageBuildImpossible $
"Duplicate modules in benchmark '" ++ benchmarkName bm ++ "': "
++ commaSep (map display moduleDuplicates)
, check mainIsWrongExt $
PackageBuildImpossible $
"The 'main-is' field must specify a '.hs' or '.lhs' file "
++ "(even if it is generated by a preprocessor)."
-- See comment for similar check on test suites.
, check libNameClash $
PackageBuildImpossible $
"The benchmark " ++ benchmarkName bm
++ " has the same name as the package."
]
where
moduleDuplicates = dups $ benchmarkModules bm
mainIsWrongExt = case benchmarkInterface bm of
BenchmarkExeV10 _ f -> takeExtension f `notElem` [".hs", ".lhs"]
_ -> False
libNameClash = benchmarkName bm `elem` [ libName
| _lib <- maybeToList (library pkg)
, let PackageName libName =
pkgName (package pkg) ]
-- ------------------------------------------------------------
-- * Additional pure checks
-- ------------------------------------------------------------ | 1,932 | checkBenchmark pkg bm =
catMaybes [
case benchmarkInterface bm of
BenchmarkUnsupported tt@(BenchmarkTypeUnknown _ _) -> Just $
PackageBuildWarning $
quote (display tt) ++ " is not a known type of benchmark. "
++ "The known benchmark types are: "
++ commaSep (map display knownBenchmarkTypes)
BenchmarkUnsupported tt -> Just $
PackageBuildWarning $
quote (display tt) ++ " is not a supported benchmark version. "
++ "The known benchmark types are: "
++ commaSep (map display knownBenchmarkTypes)
_ -> Nothing
, check (not $ null moduleDuplicates) $
PackageBuildImpossible $
"Duplicate modules in benchmark '" ++ benchmarkName bm ++ "': "
++ commaSep (map display moduleDuplicates)
, check mainIsWrongExt $
PackageBuildImpossible $
"The 'main-is' field must specify a '.hs' or '.lhs' file "
++ "(even if it is generated by a preprocessor)."
-- See comment for similar check on test suites.
, check libNameClash $
PackageBuildImpossible $
"The benchmark " ++ benchmarkName bm
++ " has the same name as the package."
]
where
moduleDuplicates = dups $ benchmarkModules bm
mainIsWrongExt = case benchmarkInterface bm of
BenchmarkExeV10 _ f -> takeExtension f `notElem` [".hs", ".lhs"]
_ -> False
libNameClash = benchmarkName bm `elem` [ libName
| _lib <- maybeToList (library pkg)
, let PackageName libName =
pkgName (package pkg) ]
-- ------------------------------------------------------------
-- * Additional pure checks
-- ------------------------------------------------------------ | 1,864 | false | true | 2 | 15 | 604 | 379 | 183 | 196 | null | null |
fmapfmapfmap/amazonka | amazonka-cognito-sync/gen/Network/AWS/CognitoSync/GetCognitoEvents.hs | mpl-2.0 | -- | The response status code.
gcersResponseStatus :: Lens' GetCognitoEventsResponse Int
gcersResponseStatus = lens _gcersResponseStatus (\ s a -> s{_gcersResponseStatus = a}) | 175 | gcersResponseStatus :: Lens' GetCognitoEventsResponse Int
gcersResponseStatus = lens _gcersResponseStatus (\ s a -> s{_gcersResponseStatus = a}) | 144 | gcersResponseStatus = lens _gcersResponseStatus (\ s a -> s{_gcersResponseStatus = a}) | 86 | true | true | 0 | 9 | 21 | 40 | 22 | 18 | null | null |
svenssonjoel/EmbArBB | Intel/ArBB/Backend/ArBB/CodeGen.hs | bsd-3-clause | isOpDynamic Ln = False | 23 | isOpDynamic Ln = False | 23 | isOpDynamic Ln = False | 23 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
jacekszymanski/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxSTC_LEX_HTML :: Int
wxSTC_LEX_HTML = 4 | 40 | wxSTC_LEX_HTML :: Int
wxSTC_LEX_HTML = 4 | 40 | wxSTC_LEX_HTML = 4 | 18 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
schell/odin | src/Odin/Core/Common.hs | mit | queryKeycodeEvent
:: UIState s m
=> Keycode
-- ^ The key code to query for
-> InputMotion
-- ^ Pressed or Released
-> Bool
-- ^ True if querying for a repeating key press from the user
-- holding the key down.
-> m Bool
queryKeycodeEvent k im rep = do
q <- use (ui . queryKey)
return $ q k im rep | 318 | queryKeycodeEvent
:: UIState s m
=> Keycode
-- ^ The key code to query for
-> InputMotion
-- ^ Pressed or Released
-> Bool
-- ^ True if querying for a repeating key press from the user
-- holding the key down.
-> m Bool
queryKeycodeEvent k im rep = do
q <- use (ui . queryKey)
return $ q k im rep | 318 | queryKeycodeEvent k im rep = do
q <- use (ui . queryKey)
return $ q k im rep | 80 | false | true | 0 | 11 | 84 | 82 | 39 | 43 | null | null |
athanclark/Idris-dev | src/Idris/IBC.hs | bsd-3-clause | ibc i (IBCMetavar n) f =
case lookup n (idris_metavars i) of
Nothing -> return f
Just t -> return f { ibc_metavars = (n, t) : ibc_metavars f } | 167 | ibc i (IBCMetavar n) f =
case lookup n (idris_metavars i) of
Nothing -> return f
Just t -> return f { ibc_metavars = (n, t) : ibc_metavars f } | 167 | ibc i (IBCMetavar n) f =
case lookup n (idris_metavars i) of
Nothing -> return f
Just t -> return f { ibc_metavars = (n, t) : ibc_metavars f } | 167 | false | false | 1 | 12 | 54 | 81 | 37 | 44 | null | null |
BeautifulDestinations/CV | CV/Sampling.hs | bsd-3-clause | discardAroundEdges (iw,ih) (vb,hb) coords = filter inRange coords
where
inRange (x,y) = vb<x && x< iw-vb
&& hb<y && y< ih-hb
-- Retrive coordinates of white pixels (>0.9, arbitarily) of
-- image `marks` | 234 | discardAroundEdges (iw,ih) (vb,hb) coords = filter inRange coords
where
inRange (x,y) = vb<x && x< iw-vb
&& hb<y && y< ih-hb
-- Retrive coordinates of white pixels (>0.9, arbitarily) of
-- image `marks` | 234 | discardAroundEdges (iw,ih) (vb,hb) coords = filter inRange coords
where
inRange (x,y) = vb<x && x< iw-vb
&& hb<y && y< ih-hb
-- Retrive coordinates of white pixels (>0.9, arbitarily) of
-- image `marks` | 234 | false | false | 14 | 5 | 64 | 101 | 45 | 56 | null | null |
m-lopez/jack | test/ElaborationSpec.hs | mit | mkPassingTypeCheckTests :: [CheckTest] -> Test
mkPassingTypeCheckTests = TestList . map mkPassingTypeCheckTest | 110 | mkPassingTypeCheckTests :: [CheckTest] -> Test
mkPassingTypeCheckTests = TestList . map mkPassingTypeCheckTest | 110 | mkPassingTypeCheckTests = TestList . map mkPassingTypeCheckTest | 63 | false | true | 0 | 6 | 10 | 25 | 13 | 12 | null | null |
rsasse/tamarin-prover | lib/theory/src/Theory/Constraint/Solver/Contradictions.hs | gpl-3.0 | -- | 'True' if the constraint system is contradictory.
contradictorySystem :: ProofContext -> System -> Bool
contradictorySystem ctxt = not . null . contradictions ctxt | 168 | contradictorySystem :: ProofContext -> System -> Bool
contradictorySystem ctxt = not . null . contradictions ctxt | 113 | contradictorySystem ctxt = not . null . contradictions ctxt | 59 | true | true | 0 | 6 | 24 | 34 | 17 | 17 | null | null |
ownclo/slotties | Slotties/Slot.hs | gpl-3.0 | -- remove all slots that are older than provided one.
-- NOTE: filter is O(n), so we check for min beforehand.
-- NOTE: in case this is a bottleneck, try to recursively
-- 'findMin' and remove it while necessary. Supposing
-- that map is large and there are few outdated slots, this
-- can be a win.
removeOldSlots :: Slot -> Schedule -> Schedule
removeOldSlots now schedule
| now < fst (BM.findMin schedule) = schedule -- up-to-date
| otherwise = BM.filter older schedule
where older slot _ = slot < now | 521 | removeOldSlots :: Slot -> Schedule -> Schedule
removeOldSlots now schedule
| now < fst (BM.findMin schedule) = schedule -- up-to-date
| otherwise = BM.filter older schedule
where older slot _ = slot < now | 221 | removeOldSlots now schedule
| now < fst (BM.findMin schedule) = schedule -- up-to-date
| otherwise = BM.filter older schedule
where older slot _ = slot < now | 174 | true | true | 0 | 12 | 107 | 95 | 45 | 50 | null | null |
flowbox-public/imagemagick | Graphics/ImageMagick/MagickWand/MagickWand.hs | apache-2.0 | magickIterateReverse :: (MonadResource m) => Ptr MagickWand -> (Ptr MagickWand -> m ()) -> m ()
magickIterateReverse = magickIterateF F.magickSetLastIterator F.magickPreviousImage | 179 | magickIterateReverse :: (MonadResource m) => Ptr MagickWand -> (Ptr MagickWand -> m ()) -> m ()
magickIterateReverse = magickIterateF F.magickSetLastIterator F.magickPreviousImage | 179 | magickIterateReverse = magickIterateF F.magickSetLastIterator F.magickPreviousImage | 83 | false | true | 0 | 11 | 20 | 60 | 29 | 31 | null | null |
gridaphobe/liquid-fixpoint | src/Language/Fixpoint/Misc.hs | bsd-3-clause | repeats n = concat . replicate n | 33 | repeats n = concat . replicate n | 33 | repeats n = concat . replicate n | 33 | false | false | 0 | 6 | 7 | 16 | 7 | 9 | null | null |
fmapfmapfmap/amazonka | amazonka-elasticache/gen/Network/AWS/ElastiCache/AuthorizeCacheSecurityGroupIngress.hs | mpl-2.0 | -- | Undocumented member.
acsgirsCacheSecurityGroup :: Lens' AuthorizeCacheSecurityGroupIngressResponse (Maybe CacheSecurityGroup)
acsgirsCacheSecurityGroup = lens _acsgirsCacheSecurityGroup (\ s a -> s{_acsgirsCacheSecurityGroup = a}) | 235 | acsgirsCacheSecurityGroup :: Lens' AuthorizeCacheSecurityGroupIngressResponse (Maybe CacheSecurityGroup)
acsgirsCacheSecurityGroup = lens _acsgirsCacheSecurityGroup (\ s a -> s{_acsgirsCacheSecurityGroup = a}) | 209 | acsgirsCacheSecurityGroup = lens _acsgirsCacheSecurityGroup (\ s a -> s{_acsgirsCacheSecurityGroup = a}) | 104 | true | true | 0 | 9 | 20 | 46 | 25 | 21 | null | null |
antalsz/hs-to-coq | examples/graph/graph/Data/Graph/Inductive/Monad/STArray.hs | mit | emptyN :: Int -> ST s (SGr s a b)
emptyN n = do m <- newArray (1,n) False
return (SGr (0,array (1,n) [(i,Nothing) | i <- [1..n]],m))
----------------------------------------------------------------------
-- UTILITIES
----------------------------------------------------------------------
-- | filter list (of successors\/predecessors) through a boolean ST array
-- representing deleted marks | 409 | emptyN :: Int -> ST s (SGr s a b)
emptyN n = do m <- newArray (1,n) False
return (SGr (0,array (1,n) [(i,Nothing) | i <- [1..n]],m))
----------------------------------------------------------------------
-- UTILITIES
----------------------------------------------------------------------
-- | filter list (of successors\/predecessors) through a boolean ST array
-- representing deleted marks | 409 | emptyN n = do m <- newArray (1,n) False
return (SGr (0,array (1,n) [(i,Nothing) | i <- [1..n]],m))
----------------------------------------------------------------------
-- UTILITIES
----------------------------------------------------------------------
-- | filter list (of successors\/predecessors) through a boolean ST array
-- representing deleted marks | 375 | false | true | 0 | 15 | 64 | 110 | 60 | 50 | null | null |
peter-sa/sdtpl | src/Development/SDTPL.hs | apache-2.0 | -- | Create a function named by a string which performs the processing
-- described in the specified file.
compileSDTPL :: String -> FilePath -> Q [Dec]
compileSDTPL n f = do
p <- parse progP f <$> runIO (readFile f)
let prog = either (const $ fail "Unparseable input") id p
(Take vars) <- maybe (fail "No TAKE statement") return $ find isTake prog
body <- generateBody prog
let varNames = map varName vars
return [FunD (mkName n) [Clause (map (VarP . mkName) varNames)
(NormalB body)
[]]]
where varName :: Var -> String
varName (Var _ x) = x | 632 | compileSDTPL :: String -> FilePath -> Q [Dec]
compileSDTPL n f = do
p <- parse progP f <$> runIO (readFile f)
let prog = either (const $ fail "Unparseable input") id p
(Take vars) <- maybe (fail "No TAKE statement") return $ find isTake prog
body <- generateBody prog
let varNames = map varName vars
return [FunD (mkName n) [Clause (map (VarP . mkName) varNames)
(NormalB body)
[]]]
where varName :: Var -> String
varName (Var _ x) = x | 525 | compileSDTPL n f = do
p <- parse progP f <$> runIO (readFile f)
let prog = either (const $ fail "Unparseable input") id p
(Take vars) <- maybe (fail "No TAKE statement") return $ find isTake prog
body <- generateBody prog
let varNames = map varName vars
return [FunD (mkName n) [Clause (map (VarP . mkName) varNames)
(NormalB body)
[]]]
where varName :: Var -> String
varName (Var _ x) = x | 479 | true | true | 0 | 15 | 189 | 230 | 107 | 123 | null | null |
dgvncsz0f/nws | src/Jerimum/Storage/PostgreSQL/Setup.hs | bsd-3-clause | openSegment :: T.Text -> UUID -> SqlMonad Context
openSegment dbname uuid = do
performSQL $ \conn ->
PQ.withTransaction conn $ do
insertSegment conn
createSchemasTable conn
createEventsTable conn
pure context
where
context = makeContext dbname uuid
insertSegment conn =
let query =
"INSERT INTO segments " <> " ( segment_id, dbname, is_open )" <>
" VALUES (?, ?, true)"
in void $ PQ.execute conn query (uuid, dbname)
createSchemasTable conn =
let query =
"CREATE TABLE ?" <> " ( CHECK (segment_id = ?)" <>
" , PRIMARY KEY (schema_id)" <>
" , UNIQUE (schema_version)" <>
" , FOREIGN KEY (segment_id) REFERENCES segments (segment_id)" <>
" )" <>
" INHERITS (schemas)"
in void $ PQ.execute conn query (schemasTable context, uuid)
createEventsTable conn =
let query =
"CREATE TABLE ?" <> " ( CHECK (segment_id = ?)" <>
" , PRIMARY KEY (lsn, xno)" <>
" , FOREIGN KEY (segment_id) REFERENCES segments (segment_id)" <>
" )" <>
" INHERITS (events)"
in void $ PQ.execute conn query (eventsTable context, uuid) | 1,236 | openSegment :: T.Text -> UUID -> SqlMonad Context
openSegment dbname uuid = do
performSQL $ \conn ->
PQ.withTransaction conn $ do
insertSegment conn
createSchemasTable conn
createEventsTable conn
pure context
where
context = makeContext dbname uuid
insertSegment conn =
let query =
"INSERT INTO segments " <> " ( segment_id, dbname, is_open )" <>
" VALUES (?, ?, true)"
in void $ PQ.execute conn query (uuid, dbname)
createSchemasTable conn =
let query =
"CREATE TABLE ?" <> " ( CHECK (segment_id = ?)" <>
" , PRIMARY KEY (schema_id)" <>
" , UNIQUE (schema_version)" <>
" , FOREIGN KEY (segment_id) REFERENCES segments (segment_id)" <>
" )" <>
" INHERITS (schemas)"
in void $ PQ.execute conn query (schemasTable context, uuid)
createEventsTable conn =
let query =
"CREATE TABLE ?" <> " ( CHECK (segment_id = ?)" <>
" , PRIMARY KEY (lsn, xno)" <>
" , FOREIGN KEY (segment_id) REFERENCES segments (segment_id)" <>
" )" <>
" INHERITS (events)"
in void $ PQ.execute conn query (eventsTable context, uuid) | 1,236 | openSegment dbname uuid = do
performSQL $ \conn ->
PQ.withTransaction conn $ do
insertSegment conn
createSchemasTable conn
createEventsTable conn
pure context
where
context = makeContext dbname uuid
insertSegment conn =
let query =
"INSERT INTO segments " <> " ( segment_id, dbname, is_open )" <>
" VALUES (?, ?, true)"
in void $ PQ.execute conn query (uuid, dbname)
createSchemasTable conn =
let query =
"CREATE TABLE ?" <> " ( CHECK (segment_id = ?)" <>
" , PRIMARY KEY (schema_id)" <>
" , UNIQUE (schema_version)" <>
" , FOREIGN KEY (segment_id) REFERENCES segments (segment_id)" <>
" )" <>
" INHERITS (schemas)"
in void $ PQ.execute conn query (schemasTable context, uuid)
createEventsTable conn =
let query =
"CREATE TABLE ?" <> " ( CHECK (segment_id = ?)" <>
" , PRIMARY KEY (lsn, xno)" <>
" , FOREIGN KEY (segment_id) REFERENCES segments (segment_id)" <>
" )" <>
" INHERITS (events)"
in void $ PQ.execute conn query (eventsTable context, uuid) | 1,186 | false | true | 7 | 14 | 401 | 269 | 124 | 145 | null | null |
nushio3/typelevel-tensor | Data/Tensor/TypeLevel.hs | bsd-3-clause | vec4 :: a -> a -> a -> a -> Vec4 a
vec4 x0 x1 x2 x3 = Vec :~ x0 :~ x1 :~ x2 :~ x3 | 81 | vec4 :: a -> a -> a -> a -> Vec4 a
vec4 x0 x1 x2 x3 = Vec :~ x0 :~ x1 :~ x2 :~ x3 | 81 | vec4 x0 x1 x2 x3 = Vec :~ x0 :~ x1 :~ x2 :~ x3 | 46 | false | true | 0 | 9 | 26 | 55 | 27 | 28 | null | null |
TeofilC/Turing | Widget.hs | mit | configWidget (Config {..}) sy st = div $ do
span (text $ "Current m-config: " ++ show (st IM.! curState))
table $ do
"class" =. "table table-bordered table-sm scroll monospace"
tr $ do
mapM col (reverse ltape)
td $ do
"class" =. "table-info"
text $ if cur == 0 then " " else sy IM.! cur
mapM col rtape
where
col sym = td $ (text $ if sym == 0 then " " else sy IM.! sym) | 423 | configWidget (Config {..}) sy st = div $ do
span (text $ "Current m-config: " ++ show (st IM.! curState))
table $ do
"class" =. "table table-bordered table-sm scroll monospace"
tr $ do
mapM col (reverse ltape)
td $ do
"class" =. "table-info"
text $ if cur == 0 then " " else sy IM.! cur
mapM col rtape
where
col sym = td $ (text $ if sym == 0 then " " else sy IM.! sym) | 423 | configWidget (Config {..}) sy st = div $ do
span (text $ "Current m-config: " ++ show (st IM.! curState))
table $ do
"class" =. "table table-bordered table-sm scroll monospace"
tr $ do
mapM col (reverse ltape)
td $ do
"class" =. "table-info"
text $ if cur == 0 then " " else sy IM.! cur
mapM col rtape
where
col sym = td $ (text $ if sym == 0 then " " else sy IM.! sym) | 423 | false | false | 0 | 19 | 131 | 177 | 85 | 92 | null | null |
rahulmutt/ghcvm | compiler/Eta/StrAnal/WwLib.hs | bsd-3-clause | deepSplitCprType_maybe _ _ _ = Nothing | 38 | deepSplitCprType_maybe _ _ _ = Nothing | 38 | deepSplitCprType_maybe _ _ _ = Nothing | 38 | false | false | 0 | 5 | 5 | 13 | 6 | 7 | null | null |
gentoo-haskell/hackport | Portage/Dependency/Normalize.hs | gpl-3.0 | s_uniq :: [Dependency] -> [Dependency]
s_uniq = S.toList . S.fromList | 69 | s_uniq :: [Dependency] -> [Dependency]
s_uniq = S.toList . S.fromList | 69 | s_uniq = S.toList . S.fromList | 30 | false | true | 0 | 6 | 9 | 29 | 16 | 13 | null | null |
ocramz/petsc-hs | examples/Test2.hs | gpl-3.0 | vecCreateMPI c m1 m2 = withPtr (vecCreateMPI' c m1 m2) >>= handleErrTup | 71 | vecCreateMPI c m1 m2 = withPtr (vecCreateMPI' c m1 m2) >>= handleErrTup | 71 | vecCreateMPI c m1 m2 = withPtr (vecCreateMPI' c m1 m2) >>= handleErrTup | 71 | false | false | 0 | 8 | 11 | 30 | 14 | 16 | null | null |
mcschroeder/ghc | libraries/base/GHC/Conc/Sync.hs | bsd-3-clause | -- |Compose two alternative STM actions (GHC only). If the first action
-- completes without retrying then it forms the result of the orElse.
-- Otherwise, if the first action retries, then the second action is
-- tried in its place. If both actions retry then the orElse as a
-- whole retries.
orElse :: STM a -> STM a -> STM a
orElse (STM m) e = STM $ \s -> catchRetry# m (unSTM e) s | 387 | orElse :: STM a -> STM a -> STM a
orElse (STM m) e = STM $ \s -> catchRetry# m (unSTM e) s | 90 | orElse (STM m) e = STM $ \s -> catchRetry# m (unSTM e) s | 56 | true | true | 0 | 9 | 78 | 66 | 34 | 32 | null | null |
farnoy/torrent | src/Network/BitTorrent/Types.hs | bsd-3-clause | -- | Create a new 'PeerData' structure.
newPeer :: BitField -> SockAddr -> ByteString -> PeerData
newPeer bf addr peer =
PeerData True False True False addr peer bf 0 False | 174 | newPeer :: BitField -> SockAddr -> ByteString -> PeerData
newPeer bf addr peer =
PeerData True False True False addr peer bf 0 False | 134 | newPeer bf addr peer =
PeerData True False True False addr peer bf 0 False | 76 | true | true | 0 | 9 | 32 | 61 | 26 | 35 | null | null |
hsyl20/ViperVM | haskus-system/src/lib/Haskus/Format/Dwarf.hs | bsd-3-clause | -- | Build a tree from a list of DebugEntry (with Nothing = NULL etnries)
--
-- The first entry must be valid and the top level must not be a forest
debugEntryTree :: [Maybe DebugEntry] -> Tree DebugEntry
debugEntryTree es = case rec es of
([x],[]) -> x
([],[]) -> error "Cannot make a tree from the Debug entries: there is no entry"
(_,[]) -> error "Cannot make a tree from the Debug entries: they form a forest"
(_,_) -> error "Cannot make a tree from the Debug entries: there are remaining entries"
where
rec :: [Maybe DebugEntry] -> ([Tree DebugEntry], [Maybe DebugEntry])
rec (Just x:xs)
| debugEntryHasChildren x = let (cs,r) = rec xs
(ss,r2) = rec r
in (Node x cs : ss, r2)
| otherwise = let (cs,r) = rec xs in (Node x [] : cs, r)
rec (Nothing:xs) = ([],xs)
rec [] = ([],[])
-- | Getter for a debug entry | 1,016 | debugEntryTree :: [Maybe DebugEntry] -> Tree DebugEntry
debugEntryTree es = case rec es of
([x],[]) -> x
([],[]) -> error "Cannot make a tree from the Debug entries: there is no entry"
(_,[]) -> error "Cannot make a tree from the Debug entries: they form a forest"
(_,_) -> error "Cannot make a tree from the Debug entries: there are remaining entries"
where
rec :: [Maybe DebugEntry] -> ([Tree DebugEntry], [Maybe DebugEntry])
rec (Just x:xs)
| debugEntryHasChildren x = let (cs,r) = rec xs
(ss,r2) = rec r
in (Node x cs : ss, r2)
| otherwise = let (cs,r) = rec xs in (Node x [] : cs, r)
rec (Nothing:xs) = ([],xs)
rec [] = ([],[])
-- | Getter for a debug entry | 867 | debugEntryTree es = case rec es of
([x],[]) -> x
([],[]) -> error "Cannot make a tree from the Debug entries: there is no entry"
(_,[]) -> error "Cannot make a tree from the Debug entries: they form a forest"
(_,_) -> error "Cannot make a tree from the Debug entries: there are remaining entries"
where
rec :: [Maybe DebugEntry] -> ([Tree DebugEntry], [Maybe DebugEntry])
rec (Just x:xs)
| debugEntryHasChildren x = let (cs,r) = rec xs
(ss,r2) = rec r
in (Node x cs : ss, r2)
| otherwise = let (cs,r) = rec xs in (Node x [] : cs, r)
rec (Nothing:xs) = ([],xs)
rec [] = ([],[])
-- | Getter for a debug entry | 811 | true | true | 4 | 12 | 361 | 311 | 161 | 150 | null | null |
nevrenato/Hets_Fork | GUI/HTkProofDetails.hs | gpl-2.0 | -- * GUI for show proof details
-- ** help functions
-- | Return number of new lines in a string.
numberOfLines :: String
-> Int
numberOfLines =
foldr (\ ch -> if ch == '\n' then (+ 1) else id) 0 | 215 | numberOfLines :: String
-> Int
numberOfLines =
foldr (\ ch -> if ch == '\n' then (+ 1) else id) 0 | 115 | numberOfLines =
foldr (\ ch -> if ch == '\n' then (+ 1) else id) 0 | 70 | true | true | 0 | 9 | 61 | 54 | 29 | 25 | null | null |
vTurbine/ghc | libraries/base/Data/Semigroup.hs | bsd-3-clause | stimesMonoid :: (Integral b, Monoid a) => b -> a -> a
stimesMonoid n x0 = case compare n 0 of
LT -> errorWithoutStackTrace "stimesMonoid: negative multiplier"
EQ -> mempty
GT -> f x0 n
where
f x y
| even y = f (x `mappend` x) (y `quot` 2)
| y == 1 = x
| otherwise = g (x `mappend` x) (pred y `quot` 2) x
g x y z
| even y = g (x `mappend` x) (y `quot` 2) z
| y == 1 = x `mappend` z
| otherwise = g (x `mappend` x) (pred y `quot` 2) (x `mappend` z)
-- | This is a valid definition of 'stimes' for an idempotent 'Monoid'.
--
-- When @mappend x x = x@, this definition should be preferred, because it
-- works in /O(1)/ rather than /O(log n)/ | 710 | stimesMonoid :: (Integral b, Monoid a) => b -> a -> a
stimesMonoid n x0 = case compare n 0 of
LT -> errorWithoutStackTrace "stimesMonoid: negative multiplier"
EQ -> mempty
GT -> f x0 n
where
f x y
| even y = f (x `mappend` x) (y `quot` 2)
| y == 1 = x
| otherwise = g (x `mappend` x) (pred y `quot` 2) x
g x y z
| even y = g (x `mappend` x) (y `quot` 2) z
| y == 1 = x `mappend` z
| otherwise = g (x `mappend` x) (pred y `quot` 2) (x `mappend` z)
-- | This is a valid definition of 'stimes' for an idempotent 'Monoid'.
--
-- When @mappend x x = x@, this definition should be preferred, because it
-- works in /O(1)/ rather than /O(log n)/ | 710 | stimesMonoid n x0 = case compare n 0 of
LT -> errorWithoutStackTrace "stimesMonoid: negative multiplier"
EQ -> mempty
GT -> f x0 n
where
f x y
| even y = f (x `mappend` x) (y `quot` 2)
| y == 1 = x
| otherwise = g (x `mappend` x) (pred y `quot` 2) x
g x y z
| even y = g (x `mappend` x) (y `quot` 2) z
| y == 1 = x `mappend` z
| otherwise = g (x `mappend` x) (pred y `quot` 2) (x `mappend` z)
-- | This is a valid definition of 'stimes' for an idempotent 'Monoid'.
--
-- When @mappend x x = x@, this definition should be preferred, because it
-- works in /O(1)/ rather than /O(log n)/ | 656 | false | true | 0 | 14 | 213 | 288 | 150 | 138 | null | null |
rueshyna/gogol | gogol-adexchange-seller/gen/Network/Google/AdExchangeSeller/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'CustomChannels' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ccEtag'
--
-- * 'ccNextPageToken'
--
-- * 'ccKind'
--
-- * 'ccItems'
customChannels
:: CustomChannels
customChannels =
CustomChannels'
{ _ccEtag = Nothing
, _ccNextPageToken = Nothing
, _ccKind = "adexchangeseller#customChannels"
, _ccItems = Nothing
} | 455 | customChannels
:: CustomChannels
customChannels =
CustomChannels'
{ _ccEtag = Nothing
, _ccNextPageToken = Nothing
, _ccKind = "adexchangeseller#customChannels"
, _ccItems = Nothing
} | 211 | customChannels =
CustomChannels'
{ _ccEtag = Nothing
, _ccNextPageToken = Nothing
, _ccKind = "adexchangeseller#customChannels"
, _ccItems = Nothing
} | 174 | true | true | 1 | 7 | 96 | 55 | 35 | 20 | null | null |
tjakway/ghcjvm | utils/hpc/HpcMarkup.hs | bsd-3-clause | green = "#60de51" | 18 | green = "#60de51" | 18 | green = "#60de51" | 18 | false | false | 0 | 4 | 3 | 6 | 3 | 3 | null | null |
wfleming/advent-of-code-2016 | 2017/D12/src/D12Lib.hs | bsd-3-clause | parser :: Parser [(Int, [Int])]
parser = parseLine `endBy` eol | 62 | parser :: Parser [(Int, [Int])]
parser = parseLine `endBy` eol | 62 | parser = parseLine `endBy` eol | 30 | false | true | 2 | 7 | 9 | 41 | 20 | 21 | null | null |
dysinger/amazonka | amazonka-opsworks/gen/Network/AWS/OpsWorks/Types.hs | mpl-2.0 | -- | The URL of the command log.
cLogUrl :: Lens' Command (Maybe Text)
cLogUrl = lens _cLogUrl (\s a -> s { _cLogUrl = a }) | 123 | cLogUrl :: Lens' Command (Maybe Text)
cLogUrl = lens _cLogUrl (\s a -> s { _cLogUrl = a }) | 90 | cLogUrl = lens _cLogUrl (\s a -> s { _cLogUrl = a }) | 52 | true | true | 0 | 9 | 26 | 46 | 25 | 21 | null | null |
UU-ComputerScience/uulib | src/UU/Scanner/Position.hs | bsd-3-clause | adv :: Pos -> Char -> Pos
adv pos c = case c of
'\t' -> advc (tabWidth (column pos)) pos
'\n' -> advl 1 pos
_ -> advc 1 pos | 132 | adv :: Pos -> Char -> Pos
adv pos c = case c of
'\t' -> advc (tabWidth (column pos)) pos
'\n' -> advl 1 pos
_ -> advc 1 pos | 132 | adv pos c = case c of
'\t' -> advc (tabWidth (column pos)) pos
'\n' -> advl 1 pos
_ -> advc 1 pos | 106 | false | true | 0 | 12 | 39 | 78 | 36 | 42 | null | null |
JacquesCarette/literate-scientific-software | code/drasil-data/Data/Drasil/Concepts/Thermodynamics.hs | bsd-2-clause | enerSrc = dcc "enerSrc" (compoundPhrase' (energy ^. term) (source ^. term))
"a source from which useful energy can be extracted" | 167 | enerSrc = dcc "enerSrc" (compoundPhrase' (energy ^. term) (source ^. term))
"a source from which useful energy can be extracted" | 167 | enerSrc = dcc "enerSrc" (compoundPhrase' (energy ^. term) (source ^. term))
"a source from which useful energy can be extracted" | 167 | false | false | 1 | 9 | 58 | 41 | 18 | 23 | null | null |
ml9951/ghc | compiler/main/DynFlags.hs | bsd-3-clause | dynamicTooMkDynamicDynFlags :: DynFlags -> DynFlags
dynamicTooMkDynamicDynFlags dflags0
= let dflags1 = addWay' WayDyn dflags0
dflags2 = dflags1 {
outputFile = dynOutputFile dflags1,
hiSuf = dynHiSuf dflags1,
objectSuf = dynObjectSuf dflags1
}
dflags3 = updateWays dflags2
dflags4 = gopt_unset dflags3 Opt_BuildDynamicToo
in dflags4 | 464 | dynamicTooMkDynamicDynFlags :: DynFlags -> DynFlags
dynamicTooMkDynamicDynFlags dflags0
= let dflags1 = addWay' WayDyn dflags0
dflags2 = dflags1 {
outputFile = dynOutputFile dflags1,
hiSuf = dynHiSuf dflags1,
objectSuf = dynObjectSuf dflags1
}
dflags3 = updateWays dflags2
dflags4 = gopt_unset dflags3 Opt_BuildDynamicToo
in dflags4 | 464 | dynamicTooMkDynamicDynFlags dflags0
= let dflags1 = addWay' WayDyn dflags0
dflags2 = dflags1 {
outputFile = dynOutputFile dflags1,
hiSuf = dynHiSuf dflags1,
objectSuf = dynObjectSuf dflags1
}
dflags3 = updateWays dflags2
dflags4 = gopt_unset dflags3 Opt_BuildDynamicToo
in dflags4 | 412 | false | true | 0 | 11 | 173 | 86 | 44 | 42 | null | null |
phaazon/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/Tokens.hs | bsd-3-clause | gl_MAX_TEXTURE_UNITS :: GLenum
gl_MAX_TEXTURE_UNITS = 0x84E2 | 60 | gl_MAX_TEXTURE_UNITS :: GLenum
gl_MAX_TEXTURE_UNITS = 0x84E2 | 60 | gl_MAX_TEXTURE_UNITS = 0x84E2 | 29 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
brendanhay/gogol | gogol-bigtableadmin/gen/Network/Google/Resource/BigtableAdmin/Projects/Instances/Clusters/Delete.hs | mpl-2.0 | -- | Upload protocol for media (e.g. \"raw\", \"multipart\").
picdUploadProtocol :: Lens' ProjectsInstancesClustersDelete (Maybe Text)
picdUploadProtocol
= lens _picdUploadProtocol
(\ s a -> s{_picdUploadProtocol = a}) | 226 | picdUploadProtocol :: Lens' ProjectsInstancesClustersDelete (Maybe Text)
picdUploadProtocol
= lens _picdUploadProtocol
(\ s a -> s{_picdUploadProtocol = a}) | 164 | picdUploadProtocol
= lens _picdUploadProtocol
(\ s a -> s{_picdUploadProtocol = a}) | 91 | true | true | 0 | 8 | 33 | 49 | 25 | 24 | null | null |
jystic/river | src/River/Bifunctor.hs | bsd-3-clause | ------------------------------------------------------------------------
bimapA :: (Applicative f, Bitraversable t) => (a -> f c) -> (b -> f d) -> t a b -> f (t c d)
bimapA =
bitraverse | 188 | bimapA :: (Applicative f, Bitraversable t) => (a -> f c) -> (b -> f d) -> t a b -> f (t c d)
bimapA =
bitraverse | 114 | bimapA =
bitraverse | 21 | true | true | 0 | 11 | 31 | 75 | 38 | 37 | null | null |
tabemann/amphibian | src_old/Network/IRC/Client/Amphibian/Commands.hs | bsd-3-clause | err_NOADMININFO :: MessageCommand
err_NOADMININFO = "423" | 57 | err_NOADMININFO :: MessageCommand
err_NOADMININFO = "423" | 57 | err_NOADMININFO = "423" | 23 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
bixuanzju/SCore | src/Language.hs | gpl-3.0 | flatten _ ((INewline, n) : seqs) = '\n' : (space n) ++ flatten n seqs | 69 | flatten _ ((INewline, n) : seqs) = '\n' : (space n) ++ flatten n seqs | 69 | flatten _ ((INewline, n) : seqs) = '\n' : (space n) ++ flatten n seqs | 69 | false | false | 0 | 8 | 14 | 43 | 22 | 21 | null | null |
beni55/combinatorrent | src/Process/Peer/SenderQ.hs | bsd-2-clause | readBlock :: PieceNum -> Block -> Process CF ST B.ByteString
readBlock pn blk = do
v <- asks readBlockTV
fch <- asks fsCh
liftIO $ do
atomically $ writeTChan fch (ReadBlock pn blk v)
atomically $ takeTMVar v | 235 | readBlock :: PieceNum -> Block -> Process CF ST B.ByteString
readBlock pn blk = do
v <- asks readBlockTV
fch <- asks fsCh
liftIO $ do
atomically $ writeTChan fch (ReadBlock pn blk v)
atomically $ takeTMVar v | 235 | readBlock pn blk = do
v <- asks readBlockTV
fch <- asks fsCh
liftIO $ do
atomically $ writeTChan fch (ReadBlock pn blk v)
atomically $ takeTMVar v | 174 | false | true | 0 | 13 | 65 | 92 | 41 | 51 | null | null |
acowley/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | isSigmaTy (ForAllTy _ _) = True | 31 | isSigmaTy (ForAllTy _ _) = True | 31 | isSigmaTy (ForAllTy _ _) = True | 31 | false | false | 0 | 6 | 5 | 18 | 8 | 10 | null | null |
merijn/GPU-benchmarks | benchmark-analysis/src/FormattedOutput.hs | gpl-3.0 | findPager :: MonadIO m => m (Maybe CreateProcess)
findPager = runMaybeT $ asum
[ Process.proc <$> find "less" <*> pure ["-RS", "-+X"]
, Process.proc <$> find "more" <*> pure []
]
where
find = MaybeT . liftIO . findExecutable | 242 | findPager :: MonadIO m => m (Maybe CreateProcess)
findPager = runMaybeT $ asum
[ Process.proc <$> find "less" <*> pure ["-RS", "-+X"]
, Process.proc <$> find "more" <*> pure []
]
where
find = MaybeT . liftIO . findExecutable | 242 | findPager = runMaybeT $ asum
[ Process.proc <$> find "less" <*> pure ["-RS", "-+X"]
, Process.proc <$> find "more" <*> pure []
]
where
find = MaybeT . liftIO . findExecutable | 192 | false | true | 0 | 8 | 56 | 96 | 47 | 49 | null | null |
vshatskyi/i3wm-config-haskell | app/Main.hs | bsd-3-clause | execAlwaysList :: [String] -> Free TopLevelF ()
execAlwaysList = mapM_ execAlways | 81 | execAlwaysList :: [String] -> Free TopLevelF ()
execAlwaysList = mapM_ execAlways | 81 | execAlwaysList = mapM_ execAlways | 33 | false | true | 0 | 7 | 10 | 28 | 14 | 14 | null | null |
lambd0x/Programming_Languages | Haskell/basis/lista2-e-extras.hs | gpl-3.0 | shorten (((l:ls),s):xs) = ((l:dropWhile (==(l)) ls),s): shorten xs | 66 | shorten (((l:ls),s):xs) = ((l:dropWhile (==(l)) ls),s): shorten xs | 66 | shorten (((l:ls),s):xs) = ((l:dropWhile (==(l)) ls),s): shorten xs | 66 | false | false | 0 | 11 | 7 | 61 | 34 | 27 | null | null |
k-bx/snap-server | src/Snap/Internal/Http/Server/TimeoutManager.hs | bsd-3-clause | ------------------------------------------------------------------------------
-- | Create a new TimeoutManager.
initialize :: Double -- ^ default timeout
-> Double -- ^ poll interval
-> IO ClockTime -- ^ function to get current time
-> IO TimeoutManager
initialize defaultTimeout interval getTime = E.uninterruptibleMask_ $ do
conns <- newIORef []
mp <- newEmptyMVar
mthr <- newEmptyMVar
let tm = TimeoutManager (Clock.fromSecs defaultTimeout)
(Clock.fromSecs interval)
getTime
conns
mp
mthr
thr <- T.fork "snap-server: timeout manager" $ managerThread tm
putMVar mthr thr
return tm
------------------------------------------------------------------------------
-- | Stop a TimeoutManager. | 926 | initialize :: Double -- ^ default timeout
-> Double -- ^ poll interval
-> IO ClockTime -- ^ function to get current time
-> IO TimeoutManager
initialize defaultTimeout interval getTime = E.uninterruptibleMask_ $ do
conns <- newIORef []
mp <- newEmptyMVar
mthr <- newEmptyMVar
let tm = TimeoutManager (Clock.fromSecs defaultTimeout)
(Clock.fromSecs interval)
getTime
conns
mp
mthr
thr <- T.fork "snap-server: timeout manager" $ managerThread tm
putMVar mthr thr
return tm
------------------------------------------------------------------------------
-- | Stop a TimeoutManager. | 813 | initialize defaultTimeout interval getTime = E.uninterruptibleMask_ $ do
conns <- newIORef []
mp <- newEmptyMVar
mthr <- newEmptyMVar
let tm = TimeoutManager (Clock.fromSecs defaultTimeout)
(Clock.fromSecs interval)
getTime
conns
mp
mthr
thr <- T.fork "snap-server: timeout manager" $ managerThread tm
putMVar mthr thr
return tm
------------------------------------------------------------------------------
-- | Stop a TimeoutManager. | 611 | true | true | 0 | 14 | 318 | 146 | 69 | 77 | null | null |
portnov/dates | Data/Dates.hs | bsd-3-clause | date ∷ Int → Int → Int → DateTime
date y m d = DateTime y m d 0 0 0 | 68 | date ∷ Int → Int → Int → DateTime
date y m d = DateTime y m d 0 0 0 | 68 | date y m d = DateTime y m d 0 0 0 | 33 | false | true | 0 | 7 | 21 | 43 | 21 | 22 | null | null |
lukexi/ghc-7.8-arm64 | compiler/cmm/CmmNode.hs | bsd-3-clause | foldExp _ (CmmBranch _) z = z | 53 | foldExp _ (CmmBranch _) z = z | 53 | foldExp _ (CmmBranch _) z = z | 53 | false | false | 1 | 6 | 30 | 21 | 9 | 12 | null | null |
atupal/xmonad-mirror | xmonad/src/XMonad/Config.hs | mit | clientMask :: EventMask
clientMask = structureNotifyMask .|. enterWindowMask .|. propertyChangeMask | 99 | clientMask :: EventMask
clientMask = structureNotifyMask .|. enterWindowMask .|. propertyChangeMask | 99 | clientMask = structureNotifyMask .|. enterWindowMask .|. propertyChangeMask | 75 | false | true | 0 | 6 | 9 | 19 | 10 | 9 | null | null |
arnihermann/timedreb2erl | src/Language/Rebeca/Printrebeca.hs | mit | parenth :: Doc -> Doc
parenth ss = doc (showChar '(') . ss . doc (showChar ')') | 79 | parenth :: Doc -> Doc
parenth ss = doc (showChar '(') . ss . doc (showChar ')') | 79 | parenth ss = doc (showChar '(') . ss . doc (showChar ')') | 57 | false | true | 0 | 8 | 16 | 49 | 22 | 27 | null | null |
jwbuurlage/category-theory-programmers | examples/gameoflife/src/GameOfLife.hs | mit | left :: Tape a -> Tape a
left (Tape (Cons x xs) y zs) = Tape xs x (Cons y zs) | 77 | left :: Tape a -> Tape a
left (Tape (Cons x xs) y zs) = Tape xs x (Cons y zs) | 77 | left (Tape (Cons x xs) y zs) = Tape xs x (Cons y zs) | 52 | false | true | 0 | 9 | 20 | 57 | 27 | 30 | null | null |
green-haskell/ghc | compiler/basicTypes/DataCon.hs | bsd-3-clause | dataConUserType :: DataCon -> Type
-- ^ The user-declared type of the data constructor
-- in the nice-to-read form:
--
-- > T :: forall a b. a -> b -> T [a]
--
-- rather than:
--
-- > T :: forall a c. forall b. (c~[a]) => a -> b -> T c
--
-- NB: If the constructor is part of a data instance, the result type
-- mentions the family tycon, not the internal one.
dataConUserType (MkData { dcUnivTyVars = univ_tvs,
dcExTyVars = ex_tvs, dcEqSpec = eq_spec,
dcOtherTheta = theta, dcOrigArgTys = arg_tys,
dcOrigResTy = res_ty })
= mkForAllTys ((univ_tvs `minusList` map fst eq_spec) ++ ex_tvs) $
mkFunTys theta $
mkFunTys arg_tys $
res_ty | 728 | dataConUserType :: DataCon -> Type
dataConUserType (MkData { dcUnivTyVars = univ_tvs,
dcExTyVars = ex_tvs, dcEqSpec = eq_spec,
dcOtherTheta = theta, dcOrigArgTys = arg_tys,
dcOrigResTy = res_ty })
= mkForAllTys ((univ_tvs `minusList` map fst eq_spec) ++ ex_tvs) $
mkFunTys theta $
mkFunTys arg_tys $
res_ty | 402 | dataConUserType (MkData { dcUnivTyVars = univ_tvs,
dcExTyVars = ex_tvs, dcEqSpec = eq_spec,
dcOtherTheta = theta, dcOrigArgTys = arg_tys,
dcOrigResTy = res_ty })
= mkForAllTys ((univ_tvs `minusList` map fst eq_spec) ++ ex_tvs) $
mkFunTys theta $
mkFunTys arg_tys $
res_ty | 367 | true | true | 0 | 13 | 213 | 113 | 68 | 45 | null | null |
jsgf/SigFromNoise | src/slurp.hs | bsd-3-clause | updateTweetUser :: R.Connection -> R.Key -> ContentT TweetIDs -> IO (ContentT TweetIDs, R.VClock)
updateTweetUser c k v = head `liftM` updateMulti c "TweetUsers" [k] [v] | 169 | updateTweetUser :: R.Connection -> R.Key -> ContentT TweetIDs -> IO (ContentT TweetIDs, R.VClock)
updateTweetUser c k v = head `liftM` updateMulti c "TweetUsers" [k] [v] | 169 | updateTweetUser c k v = head `liftM` updateMulti c "TweetUsers" [k] [v] | 71 | false | true | 0 | 10 | 24 | 72 | 37 | 35 | null | null |
ambiata/snooze | test/Test/Snooze/Balance/Core.hs | bsd-3-clause | runResult :: BalanceTableResult -> Either Text BalanceTable
runResult = \case
OkBalanceTable b ->
Right b
ErrBalanceTable t ->
Left t | 145 | runResult :: BalanceTableResult -> Either Text BalanceTable
runResult = \case
OkBalanceTable b ->
Right b
ErrBalanceTable t ->
Left t | 145 | runResult = \case
OkBalanceTable b ->
Right b
ErrBalanceTable t ->
Left t | 85 | false | true | 3 | 6 | 31 | 43 | 21 | 22 | null | null |
andregr/bot | exec/Main.hs | bsd-3-clause | main :: IO ()
main = getArgs >>= run | 36 | main :: IO ()
main = getArgs >>= run | 36 | main = getArgs >>= run | 22 | false | true | 2 | 7 | 8 | 28 | 12 | 16 | null | null |
chreekat/snowdrift | Handler/ProjectBlog.hs | agpl-3.0 | postEditBlogPostCommentR :: Text -> Text -> CommentId -> Handler Html
postEditBlogPostCommentR project_handle post_name comment_id = do
(user, Entity project_id _, comment) <- checkCommentRequireAuth project_handle post_name comment_id
checkBlogPostCommentActionPermission can_edit user project_handle (Entity comment_id comment)
postEditComment
user
(Entity comment_id comment)
(projectCommentHandlerInfo (Just user) project_id project_handle)
>>= \case
Nothing -> redirect $ BlogPostCommentR project_handle post_name comment_id -- Edit made.
Just (widget, form) -> defaultLayout $ previewWidget form "post" $ projectBlogDiscussionPage project_handle post_name widget
--------------------------------------------------------------------------------
-- /p/#Text/blog/#Text/c/#CommentId/flag | 852 | postEditBlogPostCommentR :: Text -> Text -> CommentId -> Handler Html
postEditBlogPostCommentR project_handle post_name comment_id = do
(user, Entity project_id _, comment) <- checkCommentRequireAuth project_handle post_name comment_id
checkBlogPostCommentActionPermission can_edit user project_handle (Entity comment_id comment)
postEditComment
user
(Entity comment_id comment)
(projectCommentHandlerInfo (Just user) project_id project_handle)
>>= \case
Nothing -> redirect $ BlogPostCommentR project_handle post_name comment_id -- Edit made.
Just (widget, form) -> defaultLayout $ previewWidget form "post" $ projectBlogDiscussionPage project_handle post_name widget
--------------------------------------------------------------------------------
-- /p/#Text/blog/#Text/c/#CommentId/flag | 852 | postEditBlogPostCommentR project_handle post_name comment_id = do
(user, Entity project_id _, comment) <- checkCommentRequireAuth project_handle post_name comment_id
checkBlogPostCommentActionPermission can_edit user project_handle (Entity comment_id comment)
postEditComment
user
(Entity comment_id comment)
(projectCommentHandlerInfo (Just user) project_id project_handle)
>>= \case
Nothing -> redirect $ BlogPostCommentR project_handle post_name comment_id -- Edit made.
Just (widget, form) -> defaultLayout $ previewWidget form "post" $ projectBlogDiscussionPage project_handle post_name widget
--------------------------------------------------------------------------------
-- /p/#Text/blog/#Text/c/#CommentId/flag | 782 | false | true | 0 | 13 | 134 | 176 | 86 | 90 | null | null |
google/codeworld | codeworld-server/src/Util.hs | apache-2.0 | deployRootDir :: BuildMode -> FilePath
deployRootDir (BuildMode m) = "data" </> m </> "deploy" | 94 | deployRootDir :: BuildMode -> FilePath
deployRootDir (BuildMode m) = "data" </> m </> "deploy" | 94 | deployRootDir (BuildMode m) = "data" </> m </> "deploy" | 55 | false | true | 0 | 7 | 13 | 32 | 16 | 16 | null | null |
fffej/haskellprojects | 6502/Em6502.hs | bsd-2-clause | setFlagValue :: CPU -> Flag -> Bool -> IO ()
setFlagValue c f True = setFlag c f | 80 | setFlagValue :: CPU -> Flag -> Bool -> IO ()
setFlagValue c f True = setFlag c f | 80 | setFlagValue c f True = setFlag c f | 35 | false | true | 0 | 9 | 17 | 40 | 19 | 21 | null | null |
chrra/htiled | tests/Data/Tiled/Test/Arbitrary.hs | bsd-3-clause | arbitraryTile :: Word32 -> Maybe Animation -> Gen Tile
arbitraryTile tileId tileAnimation = do
tileImage <- arbMaybe $ arbitraryImage 10 10
tileProperties <- getProperties <$> arbitrary
tileType <- getType <$> arbitrary
return Tile {..}
where
tileImage = Nothing
tileObjectGroup = [] | 301 | arbitraryTile :: Word32 -> Maybe Animation -> Gen Tile
arbitraryTile tileId tileAnimation = do
tileImage <- arbMaybe $ arbitraryImage 10 10
tileProperties <- getProperties <$> arbitrary
tileType <- getType <$> arbitrary
return Tile {..}
where
tileImage = Nothing
tileObjectGroup = [] | 301 | arbitraryTile tileId tileAnimation = do
tileImage <- arbMaybe $ arbitraryImage 10 10
tileProperties <- getProperties <$> arbitrary
tileType <- getType <$> arbitrary
return Tile {..}
where
tileImage = Nothing
tileObjectGroup = [] | 246 | false | true | 0 | 9 | 58 | 94 | 44 | 50 | null | null |
michaelficarra/purescript | src/Language/PureScript/Bundle.hs | mit | moduleName :: ModuleIdentifier -> String
moduleName (ModuleIdentifier name _) = name | 84 | moduleName :: ModuleIdentifier -> String
moduleName (ModuleIdentifier name _) = name | 84 | moduleName (ModuleIdentifier name _) = name | 43 | false | true | 0 | 7 | 10 | 26 | 13 | 13 | null | null |
mlite/hLLVM | src/LlvmTest.hs | bsd-3-clause | closeFileOrStdout (Just _) h = hClose h | 39 | closeFileOrStdout (Just _) h = hClose h | 39 | closeFileOrStdout (Just _) h = hClose h | 39 | false | false | 1 | 6 | 6 | 20 | 9 | 11 | null | null |
RossMeikleham/Project-Euler-Haskell | 67.hs | mit | maxPathRowCol :: Int -> [Int] -> [Int] -> Int
maxPathRowCol x curRow prevRow = (curRow !! x) + max leftPLen rightPLen
where
leftPLen = if (x == 0) then 0 else prevRow !! (x - 1)
rightPLen = if (x == (length curRow) - 1) then 0 else prevRow !! x | 264 | maxPathRowCol :: Int -> [Int] -> [Int] -> Int
maxPathRowCol x curRow prevRow = (curRow !! x) + max leftPLen rightPLen
where
leftPLen = if (x == 0) then 0 else prevRow !! (x - 1)
rightPLen = if (x == (length curRow) - 1) then 0 else prevRow !! x | 264 | maxPathRowCol x curRow prevRow = (curRow !! x) + max leftPLen rightPLen
where
leftPLen = if (x == 0) then 0 else prevRow !! (x - 1)
rightPLen = if (x == (length curRow) - 1) then 0 else prevRow !! x | 218 | false | true | 1 | 13 | 70 | 122 | 65 | 57 | null | null |
Alxandr/Phidoc | src/Text/Phidoc/Walk.hs | bsd-3-clause | process :: MonadFS m => FilePath -> m [FileContent]
process file | takeExtension file == ".md" = processMD file | 113 | process :: MonadFS m => FilePath -> m [FileContent]
process file | takeExtension file == ".md" = processMD file | 113 | process file | takeExtension file == ".md" = processMD file | 61 | false | true | 0 | 9 | 20 | 47 | 21 | 26 | null | null |
kmilner/tamarin-prover | lib/theory/src/Theory/Sapic.hs | gpl-3.0 | -- | Add another element to the existing annotations, e.g., yet another identifier.
paddAnn :: Process -> ProcessAnnotation -> Process
paddAnn (ProcessNull ann) ann' = ProcessNull $ ann `mappend` ann' | 200 | paddAnn :: Process -> ProcessAnnotation -> Process
paddAnn (ProcessNull ann) ann' = ProcessNull $ ann `mappend` ann' | 116 | paddAnn (ProcessNull ann) ann' = ProcessNull $ ann `mappend` ann' | 65 | true | true | 0 | 7 | 29 | 41 | 22 | 19 | null | null |
karamellpelle/grid | source/Game/Values.hs | gpl-3.0 | valueRunIterationBeginT1 :: Tick
valueRunIterationBeginT1 = 20.0 | 64 | valueRunIterationBeginT1 :: Tick
valueRunIterationBeginT1 = 20.0 | 64 | valueRunIterationBeginT1 = 20.0 | 31 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
nevrenato/HetsAlloy | Propositional/AS_BASIC_Propositional.der.hs | gpl-2.0 | sepByArbitrary :: Doc -> [Doc] -> Doc
sepByArbitrary d = fsep . prepPunctuate (d <> space) | 90 | sepByArbitrary :: Doc -> [Doc] -> Doc
sepByArbitrary d = fsep . prepPunctuate (d <> space) | 90 | sepByArbitrary d = fsep . prepPunctuate (d <> space) | 52 | false | true | 1 | 8 | 15 | 45 | 21 | 24 | null | null |
wxwxwwxxx/ghc | compiler/types/FamInstEnv.hs | bsd-3-clause | normaliseType _ role ty@(TyVarTy _)
= (mkReflCo role ty,ty) | 62 | normaliseType _ role ty@(TyVarTy _)
= (mkReflCo role ty,ty) | 62 | normaliseType _ role ty@(TyVarTy _)
= (mkReflCo role ty,ty) | 62 | false | false | 0 | 8 | 11 | 33 | 17 | 16 | null | null |
daleooo/barrelfish | tools/flounder/THCStubsBackend.hs | mit | ptr_msg_argdecl :: String -> MessageArgument -> [C.Param]
ptr_msg_argdecl ifn (Arg tr (Name n)) =
[ C.Param (C.Ptr $ BC.type_c_type ifn tr) n ] | 148 | ptr_msg_argdecl :: String -> MessageArgument -> [C.Param]
ptr_msg_argdecl ifn (Arg tr (Name n)) =
[ C.Param (C.Ptr $ BC.type_c_type ifn tr) n ] | 148 | ptr_msg_argdecl ifn (Arg tr (Name n)) =
[ C.Param (C.Ptr $ BC.type_c_type ifn tr) n ] | 90 | false | true | 0 | 10 | 27 | 69 | 35 | 34 | null | null |
ekr/tamarin-prover | lib/term/src/Term/Maude/Parser.hs | gpl-3.0 | parseUnifyReply :: MaudeSig -> ByteString -> Either String [MSubst]
parseUnifyReply msig reply = flip parseOnly reply $
choice [ string "No unifier." *> endOfLine *> pure []
, many1 (parseSubstitution msig) ]
<* endOfInput | 245 | parseUnifyReply :: MaudeSig -> ByteString -> Either String [MSubst]
parseUnifyReply msig reply = flip parseOnly reply $
choice [ string "No unifier." *> endOfLine *> pure []
, many1 (parseSubstitution msig) ]
<* endOfInput | 245 | parseUnifyReply msig reply = flip parseOnly reply $
choice [ string "No unifier." *> endOfLine *> pure []
, many1 (parseSubstitution msig) ]
<* endOfInput | 177 | false | true | 0 | 11 | 56 | 79 | 38 | 41 | null | null |
rahulmutt/ghcvm | compiler/Eta/Core/CoreFVs.hs | bsd-3-clause | freeVars (App fun arg)
= (freeVarsOf fun2 `unionFVs` freeVarsOf arg2, AnnApp fun2 arg2)
where
fun2 = freeVars fun
arg2 = freeVars arg | 145 | freeVars (App fun arg)
= (freeVarsOf fun2 `unionFVs` freeVarsOf arg2, AnnApp fun2 arg2)
where
fun2 = freeVars fun
arg2 = freeVars arg | 145 | freeVars (App fun arg)
= (freeVarsOf fun2 `unionFVs` freeVarsOf arg2, AnnApp fun2 arg2)
where
fun2 = freeVars fun
arg2 = freeVars arg | 145 | false | false | 0 | 7 | 33 | 59 | 29 | 30 | null | null |
jyh1/mini | src/Parser/Rename.hs | bsd-3-clause | renameCommand (Read var) = fmap Read (useVar var) | 49 | renameCommand (Read var) = fmap Read (useVar var) | 49 | renameCommand (Read var) = fmap Read (useVar var) | 49 | false | false | 0 | 7 | 7 | 26 | 12 | 14 | null | null |
Helium4Haskell/helium | src/Helium/StaticAnalysis/Miscellaneous/TypeConversion.hs | gpl-3.0 | predicatesFromContext _ _ = [] | 32 | predicatesFromContext _ _ = [] | 32 | predicatesFromContext _ _ = [] | 32 | false | false | 0 | 5 | 6 | 13 | 6 | 7 | null | null |
OS2World/DEV-UTIL-HUGS | libraries/Graphics/Rendering/OpenGL/GL/QueryUtils.hs | bsd-3-clause | getDouble4 ::
(GLdouble -> GLdouble -> GLdouble -> GLdouble -> a) -> GetPName -> IO a
getDouble4 f n = allocaArray 4 $ \buf -> do
getDoublev n buf
peek4 f buf | 167 | getDouble4 ::
(GLdouble -> GLdouble -> GLdouble -> GLdouble -> a) -> GetPName -> IO a
getDouble4 f n = allocaArray 4 $ \buf -> do
getDoublev n buf
peek4 f buf | 167 | getDouble4 f n = allocaArray 4 $ \buf -> do
getDoublev n buf
peek4 f buf | 78 | false | true | 0 | 11 | 40 | 79 | 36 | 43 | null | null |
DanielG/kvm-in-a-box | src/Passwd.hs | agpl-3.0 | nextKibId = nextId | 18 | nextKibId = nextId | 18 | nextKibId = nextId | 18 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
gust/feature-creature | legacy/lib/Retry.hs | mit | defaultRetryPolicy :: (MonadIO m, MonadMask m) => CR.RetryPolicyM m
defaultRetryPolicy = everySecondForTwoMinutes | 113 | defaultRetryPolicy :: (MonadIO m, MonadMask m) => CR.RetryPolicyM m
defaultRetryPolicy = everySecondForTwoMinutes | 113 | defaultRetryPolicy = everySecondForTwoMinutes | 45 | false | true | 0 | 8 | 11 | 37 | 17 | 20 | null | null |
jstolarek/slicer | lib/Language/Slicer/Eval.hs | gpl-3.0 | evalOp f [VDouble i, VDouble j] | isOrdOp f
= return (ORet ((ordOps ! f) (i,j))) | 85 | evalOp f [VDouble i, VDouble j] | isOrdOp f
= return (ORet ((ordOps ! f) (i,j))) | 85 | evalOp f [VDouble i, VDouble j] | isOrdOp f
= return (ORet ((ordOps ! f) (i,j))) | 85 | false | false | 0 | 10 | 20 | 62 | 29 | 33 | null | null |
rueshyna/gogol | gogol-compute/gen/Network/Google/Resource/Compute/Instances/Delete.hs | mpl-2.0 | -- | Project ID for this request.
idProject :: Lens' InstancesDelete Text
idProject
= lens _idProject (\ s a -> s{_idProject = a}) | 132 | idProject :: Lens' InstancesDelete Text
idProject
= lens _idProject (\ s a -> s{_idProject = a}) | 98 | idProject
= lens _idProject (\ s a -> s{_idProject = a}) | 58 | true | true | 0 | 9 | 24 | 42 | 22 | 20 | null | null |
apyrgio/ganeti | src/Ganeti/OpCodes.hs | bsd-2-clause | opSummaryVal OpTagsSearch { opTagSearchPattern = s } = Just (fromNonEmpty s) | 76 | opSummaryVal OpTagsSearch { opTagSearchPattern = s } = Just (fromNonEmpty s) | 76 | opSummaryVal OpTagsSearch { opTagSearchPattern = s } = Just (fromNonEmpty s) | 76 | false | false | 0 | 7 | 10 | 28 | 13 | 15 | null | null |
noughtmare/yi | yi-snippet/src/Yi/Snippet/Internal.hs | gpl-2.0 | filename :: Var
filename = FilenameVar | 38 | filename :: Var
filename = FilenameVar | 38 | filename = FilenameVar | 22 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
sol/pandoc | src/Text/Pandoc/Writers/HTML.hs | gpl-2.0 | tableItemToHtml :: WriterOptions
-> (Html -> Html)
-> Alignment
-> [Block]
-> State WriterState Html
tableItemToHtml opts tag' align' item = do
contents <- blockListToHtml opts item
let alignStr = alignmentToString align'
let attribs = if writerHtml5 opts
then A.style (toValue $ "text-align: " ++ alignStr ++ ";")
else A.align (toValue alignStr)
return $ (tag' ! attribs $ contents) >> nl opts | 504 | tableItemToHtml :: WriterOptions
-> (Html -> Html)
-> Alignment
-> [Block]
-> State WriterState Html
tableItemToHtml opts tag' align' item = do
contents <- blockListToHtml opts item
let alignStr = alignmentToString align'
let attribs = if writerHtml5 opts
then A.style (toValue $ "text-align: " ++ alignStr ++ ";")
else A.align (toValue alignStr)
return $ (tag' ! attribs $ contents) >> nl opts | 504 | tableItemToHtml opts tag' align' item = do
contents <- blockListToHtml opts item
let alignStr = alignmentToString align'
let attribs = if writerHtml5 opts
then A.style (toValue $ "text-align: " ++ alignStr ++ ";")
else A.align (toValue alignStr)
return $ (tag' ! attribs $ contents) >> nl opts | 339 | false | true | 0 | 16 | 171 | 156 | 74 | 82 | null | null |
tanakh/tanakh.jp | tools/copipe-gen-gen.hs | bsd-3-clause | genTemplate :: [Template] -> Element -> Fay ()
genTemplate ots elm = f 0 ots where
f _ [] = return ()
f ix (Literal lit: ts) = do
c <- createTextNode $ T.concatMap crToBr lit
appendChild c elm
f ix ts
f ix (Variable "": ts) = f ix ts
f ix (Variable var: ts) = do
let iid = "plh-" <> T.pack (show ix)
c <- createElement "input"
setId c iid
appendChild c elm
select ("#" <> iid)
>>= setAttr "type" "text"
>>= setAttr "width" (T.pack $ show $ T.length var)
>>= setAttr "placeholder" var
>>= setAttr "style" ("width:" <> T.pack (show (T.length var * 2)) <> "ex")
>>= onChange (update ots)
>>= keyup (const $ update ots)
f (ix+1 :: Int) ts
f ix (Br: ts) = do
c <- createElement "br"
appendChild c elm
f ix ts | 821 | genTemplate :: [Template] -> Element -> Fay ()
genTemplate ots elm = f 0 ots where
f _ [] = return ()
f ix (Literal lit: ts) = do
c <- createTextNode $ T.concatMap crToBr lit
appendChild c elm
f ix ts
f ix (Variable "": ts) = f ix ts
f ix (Variable var: ts) = do
let iid = "plh-" <> T.pack (show ix)
c <- createElement "input"
setId c iid
appendChild c elm
select ("#" <> iid)
>>= setAttr "type" "text"
>>= setAttr "width" (T.pack $ show $ T.length var)
>>= setAttr "placeholder" var
>>= setAttr "style" ("width:" <> T.pack (show (T.length var * 2)) <> "ex")
>>= onChange (update ots)
>>= keyup (const $ update ots)
f (ix+1 :: Int) ts
f ix (Br: ts) = do
c <- createElement "br"
appendChild c elm
f ix ts | 820 | genTemplate ots elm = f 0 ots where
f _ [] = return ()
f ix (Literal lit: ts) = do
c <- createTextNode $ T.concatMap crToBr lit
appendChild c elm
f ix ts
f ix (Variable "": ts) = f ix ts
f ix (Variable var: ts) = do
let iid = "plh-" <> T.pack (show ix)
c <- createElement "input"
setId c iid
appendChild c elm
select ("#" <> iid)
>>= setAttr "type" "text"
>>= setAttr "width" (T.pack $ show $ T.length var)
>>= setAttr "placeholder" var
>>= setAttr "style" ("width:" <> T.pack (show (T.length var * 2)) <> "ex")
>>= onChange (update ots)
>>= keyup (const $ update ots)
f (ix+1 :: Int) ts
f ix (Br: ts) = do
c <- createElement "br"
appendChild c elm
f ix ts | 773 | false | true | 0 | 22 | 258 | 402 | 185 | 217 | null | null |
CloudI/CloudI | src/api/haskell/external/zlib-0.6.2.1/test/Test.hs | mit | assertDataFormatError :: DecompressError -> IO String
assertDataFormatError (DataFormatError detail) = return detail | 116 | assertDataFormatError :: DecompressError -> IO String
assertDataFormatError (DataFormatError detail) = return detail | 116 | assertDataFormatError (DataFormatError detail) = return detail | 62 | false | true | 0 | 7 | 11 | 30 | 14 | 16 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.