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
5outh/textlunky
src/Types/Player.hs
mit
moveToEntity v _ = loc .~ v
27
moveToEntity v _ = loc .~ v
27
moveToEntity v _ = loc .~ v
27
false
false
0
5
6
15
7
8
null
null
keera-studios/gtk-helpers
gtk3/src/Graphics/UI/Gtk/Board/TiledBoard.hs
bsd-3-clause
boardStartDrag :: Ix index => Board index tile piece -> (index, index) -> IO() boardStartDrag board ix@(i,j) = do writeIORef (draggingFrom board) (Just ix) ((xm, ym), (xM, yM)) <- gameBoardGetBoundaries $ boardPieces board let (w,h) = tileSize board x = round ((0.5 + fromIntegral (rangeSize (xm, i))) * fromIntegral w) y = round ((0.5 + fromIntegral (rangeSize (ym, j))) * fromIntegral h) writeIORef (draggingMouseOrig board) (Just (x, y))
468
boardStartDrag :: Ix index => Board index tile piece -> (index, index) -> IO() boardStartDrag board ix@(i,j) = do writeIORef (draggingFrom board) (Just ix) ((xm, ym), (xM, yM)) <- gameBoardGetBoundaries $ boardPieces board let (w,h) = tileSize board x = round ((0.5 + fromIntegral (rangeSize (xm, i))) * fromIntegral w) y = round ((0.5 + fromIntegral (rangeSize (ym, j))) * fromIntegral h) writeIORef (draggingMouseOrig board) (Just (x, y))
468
boardStartDrag board ix@(i,j) = do writeIORef (draggingFrom board) (Just ix) ((xm, ym), (xM, yM)) <- gameBoardGetBoundaries $ boardPieces board let (w,h) = tileSize board x = round ((0.5 + fromIntegral (rangeSize (xm, i))) * fromIntegral w) y = round ((0.5 + fromIntegral (rangeSize (ym, j))) * fromIntegral h) writeIORef (draggingMouseOrig board) (Just (x, y))
389
false
true
0
18
95
235
121
114
null
null
vladimir-ipatov/ganeti
src/Ganeti/Constants.hs
gpl-2.0
opPrioHigh :: Int opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh
69
opPrioHigh :: Int opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh
69
opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh
51
false
true
0
6
6
22
9
13
null
null
noughtmare/hypercube
src/Hypercube/Error.hs
gpl-3.0
showError :: GLuint-> String showError = \case GL_INVALID_ENUM -> "GL_INVALID_ENUM" GL_INVALID_VALUE -> "GL_INVALID_VALUE" GL_INVALID_OPERATION -> "GL_INVALID_OPERATION" GL_INVALID_FRAMEBUFFER_OPERATION -> "GL_INVALID_FRAMEBUFFER_OPERATION" GL_OUT_OF_MEMORY -> "GL_OUT_OF_MEMORY" GL_STACK_UNDERFLOW -> "GL_STACK_UNDERFLOW" GL_STACK_OVERFLOW -> "GL_STACK_OVERFLOW" x -> "GL Error " ++ show x
527
showError :: GLuint-> String showError = \case GL_INVALID_ENUM -> "GL_INVALID_ENUM" GL_INVALID_VALUE -> "GL_INVALID_VALUE" GL_INVALID_OPERATION -> "GL_INVALID_OPERATION" GL_INVALID_FRAMEBUFFER_OPERATION -> "GL_INVALID_FRAMEBUFFER_OPERATION" GL_OUT_OF_MEMORY -> "GL_OUT_OF_MEMORY" GL_STACK_UNDERFLOW -> "GL_STACK_UNDERFLOW" GL_STACK_OVERFLOW -> "GL_STACK_OVERFLOW" x -> "GL Error " ++ show x
527
showError = \case GL_INVALID_ENUM -> "GL_INVALID_ENUM" GL_INVALID_VALUE -> "GL_INVALID_VALUE" GL_INVALID_OPERATION -> "GL_INVALID_OPERATION" GL_INVALID_FRAMEBUFFER_OPERATION -> "GL_INVALID_FRAMEBUFFER_OPERATION" GL_OUT_OF_MEMORY -> "GL_OUT_OF_MEMORY" GL_STACK_UNDERFLOW -> "GL_STACK_UNDERFLOW" GL_STACK_OVERFLOW -> "GL_STACK_OVERFLOW" x -> "GL Error " ++ show x
498
false
true
8
6
172
87
36
51
null
null
rfw/cosanostra
glue/new-rng.hs
mit
main :: IO () main = newStdGen >>= print
40
main :: IO () main = newStdGen >>= print
40
main = newStdGen >>= print
26
false
true
2
7
8
28
12
16
null
null
juretta/course
src/L02/List.hs
bsd-3-clause
foldRight f b (h :| t) = f h (foldRight f b t)
46
foldRight f b (h :| t) = f h (foldRight f b t)
46
foldRight f b (h :| t) = f h (foldRight f b t)
46
false
false
0
7
12
35
17
18
null
null
themoritz/cabal
Cabal/Distribution/PackageDescription/PrettyPrint.hs
bsd-3-clause
-- | Recompile with false for regression testing simplifiedPrinting :: Bool simplifiedPrinting = False
102
simplifiedPrinting :: Bool simplifiedPrinting = False
53
simplifiedPrinting = False
26
true
true
0
4
13
12
7
5
null
null
Proclivis/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxSTC_H_SGML_COMMENT :: Int wxSTC_H_SGML_COMMENT = 29
53
wxSTC_H_SGML_COMMENT :: Int wxSTC_H_SGML_COMMENT = 29
53
wxSTC_H_SGML_COMMENT = 29
25
false
true
0
4
5
11
6
5
null
null
brendanhay/gogol
gogol-monitoring/gen/Network/Google/Resource/Monitoring/Services/Delete.hs
mpl-2.0
-- | Upload protocol for media (e.g. \"raw\", \"multipart\"). sdUploadProtocol :: Lens' ServicesDelete (Maybe Text) sdUploadProtocol = lens _sdUploadProtocol (\ s a -> s{_sdUploadProtocol = a})
201
sdUploadProtocol :: Lens' ServicesDelete (Maybe Text) sdUploadProtocol = lens _sdUploadProtocol (\ s a -> s{_sdUploadProtocol = a})
139
sdUploadProtocol = lens _sdUploadProtocol (\ s a -> s{_sdUploadProtocol = a})
85
true
true
0
9
33
48
25
23
null
null
CGenie/platform
shared/src/Unison/Note.hs
mit
liftMaybe :: Applicative m => String -> Maybe a -> Noted m a liftMaybe msg Nothing = failure msg
96
liftMaybe :: Applicative m => String -> Maybe a -> Noted m a liftMaybe msg Nothing = failure msg
96
liftMaybe msg Nothing = failure msg
35
false
true
0
9
18
47
20
27
null
null
zaxtax/hakaru-old
Examples/Examples.hs
bsd-3-clause
latent_dirichelt_allocation = undefined
39
latent_dirichelt_allocation = undefined
39
latent_dirichelt_allocation = undefined
39
false
false
0
4
2
6
3
3
null
null
scott-fleischman/greek-grammar
haskell/greek-grammar/src/Text/Greek/Morphology/Noun.hs
mit
allGenders :: [Gender] allGenders = [Feminine, Masculine, Neuter]
65
allGenders :: [Gender] allGenders = [Feminine, Masculine, Neuter]
65
allGenders = [Feminine, Masculine, Neuter]
42
false
true
0
5
7
23
14
9
null
null
centromere/cacophony
src/Crypto/Noise/Internal/Handshake/Validation.hs
unlicense
inspectToken m (S next) = do case m of PreInitiator _ _ -> checkInit PreResponder _ _ -> checkResp Initiator _ _ -> checkInit Responder _ _ -> checkResp continueToken next where checkInit = do initSSent <- use iInitSSent if initSSent then addError InitMultipleSTokens else iInitSSent .= True checkResp = do respSSent <- use iRespSSent if respSSent then addError RespMultipleSTokens else iRespSSent .= True
500
inspectToken m (S next) = do case m of PreInitiator _ _ -> checkInit PreResponder _ _ -> checkResp Initiator _ _ -> checkInit Responder _ _ -> checkResp continueToken next where checkInit = do initSSent <- use iInitSSent if initSSent then addError InitMultipleSTokens else iInitSSent .= True checkResp = do respSSent <- use iRespSSent if respSSent then addError RespMultipleSTokens else iRespSSent .= True
500
inspectToken m (S next) = do case m of PreInitiator _ _ -> checkInit PreResponder _ _ -> checkResp Initiator _ _ -> checkInit Responder _ _ -> checkResp continueToken next where checkInit = do initSSent <- use iInitSSent if initSSent then addError InitMultipleSTokens else iInitSSent .= True checkResp = do respSSent <- use iRespSSent if respSSent then addError RespMultipleSTokens else iRespSSent .= True
500
false
false
2
10
158
152
66
86
null
null
wavewave/lhc-analysis-collection
heavyhiggs/lhcoparser.hs
gpl-3.0
getSigma :: HROOT.TF1 -> IO Double getSigma f = realToFrac <$> HROOT.tFormulaGetParameter (HROOT.upcastTFormula f) "Sigma"
122
getSigma :: HROOT.TF1 -> IO Double getSigma f = realToFrac <$> HROOT.tFormulaGetParameter (HROOT.upcastTFormula f) "Sigma"
122
getSigma f = realToFrac <$> HROOT.tFormulaGetParameter (HROOT.upcastTFormula f) "Sigma"
87
false
true
0
9
14
42
20
22
null
null
thsutton/mf
lib/Flow.hs
bsd-3-clause
initialFlow :: DynGraph g => g a FlowCap -> Node -> AFlow g initialFlow graph source = Flow capacity flow where capacity = gfiltermap (\(ins, n, _, outs) -> Just (ins, n, h n, outs)) graph h n = if n == source then v else 0 flow = gfiltermap ctx graph v = order graph ctx (ine, n, _, oute) = Just (map ((0,) . snd) ine , n, 0, map ((0,) . snd) oute) -- | Push excess flow accumulated at u to v.
425
initialFlow :: DynGraph g => g a FlowCap -> Node -> AFlow g initialFlow graph source = Flow capacity flow where capacity = gfiltermap (\(ins, n, _, outs) -> Just (ins, n, h n, outs)) graph h n = if n == source then v else 0 flow = gfiltermap ctx graph v = order graph ctx (ine, n, _, oute) = Just (map ((0,) . snd) ine , n, 0, map ((0,) . snd) oute) -- | Push excess flow accumulated at u to v.
425
initialFlow graph source = Flow capacity flow where capacity = gfiltermap (\(ins, n, _, outs) -> Just (ins, n, h n, outs)) graph h n = if n == source then v else 0 flow = gfiltermap ctx graph v = order graph ctx (ine, n, _, oute) = Just (map ((0,) . snd) ine , n, 0, map ((0,) . snd) oute) -- | Push excess flow accumulated at u to v.
357
false
true
3
10
116
214
110
104
null
null
myShoggoth/shakespeare
Text/Hamlet.hs
mit
varName scope v@(_:_) = fromMaybe (strToExp v) $ lookup (Ident v) scope
71
varName scope v@(_:_) = fromMaybe (strToExp v) $ lookup (Ident v) scope
71
varName scope v@(_:_) = fromMaybe (strToExp v) $ lookup (Ident v) scope
71
false
false
0
8
11
46
22
24
null
null
uuhan/Idris-dev
src/Idris/Core/TT.hs
bsd-3-clause
intTyName (ITChar) = "Char"
27
intTyName (ITChar) = "Char"
27
intTyName (ITChar) = "Char"
27
false
false
0
6
3
12
6
6
null
null
zephyr-dev/flow-api
src/PivotalTracker/Story.hs
mit
extractInteger _ = Nothing
35
extractInteger _ = Nothing
35
extractInteger _ = Nothing
35
false
false
0
5
12
9
4
5
null
null
JPMoresmau/leksah
src/IDE/Command.hs
gpl-2.0
viewDetachInstrumented :: IDEAction viewDetachInstrumented = do mbPair <- viewDetach case mbPair of Nothing -> return () Just (win,wid) -> do instrumentSecWindow win widgetShowAll win
235
viewDetachInstrumented :: IDEAction viewDetachInstrumented = do mbPair <- viewDetach case mbPair of Nothing -> return () Just (win,wid) -> do instrumentSecWindow win widgetShowAll win
235
viewDetachInstrumented = do mbPair <- viewDetach case mbPair of Nothing -> return () Just (win,wid) -> do instrumentSecWindow win widgetShowAll win
199
false
true
0
12
75
63
29
34
null
null
adarqui/ekg-push
System/Remote/Monitoring/Push.hs
bsd-2-clause
diffSamples :: PushOptions -> Metrics.Sample -> Metrics.Sample -> Metrics.Sample diffSamples opts prev curr = M.foldlWithKey' combine M.empty curr where combine m name new = case M.lookup name prev of Just old -> case diffMetric old new of Just val -> M.insert name' val m Nothing -> m _ -> M.insert name' new m where name' = T.append (prefix opts) (T.append name (suffix opts)) diffMetric :: Metrics.Value -> Metrics.Value -> Maybe Metrics.Value diffMetric (Metrics.Counter n1) (Metrics.Counter n2) | n1 == n2 = Nothing | otherwise = Just $! Metrics.Counter $ n2 - n1 diffMetric (Metrics.Gauge n1) (Metrics.Gauge n2) | n1 == n2 = Nothing | otherwise = Just $ Metrics.Gauge n2 diffMetric (Metrics.Label n1) (Metrics.Label n2) | n1 == n2 = Nothing | otherwise = Just $ Metrics.Label n2 -- Distributions are assumed to be non-equal. diffMetric _ _ = Nothing ------------------------------------------------------------------------ -- Backwards compatibility shims #if __GLASGOW_HASKELL__ < 706
1,144
diffSamples :: PushOptions -> Metrics.Sample -> Metrics.Sample -> Metrics.Sample diffSamples opts prev curr = M.foldlWithKey' combine M.empty curr where combine m name new = case M.lookup name prev of Just old -> case diffMetric old new of Just val -> M.insert name' val m Nothing -> m _ -> M.insert name' new m where name' = T.append (prefix opts) (T.append name (suffix opts)) diffMetric :: Metrics.Value -> Metrics.Value -> Maybe Metrics.Value diffMetric (Metrics.Counter n1) (Metrics.Counter n2) | n1 == n2 = Nothing | otherwise = Just $! Metrics.Counter $ n2 - n1 diffMetric (Metrics.Gauge n1) (Metrics.Gauge n2) | n1 == n2 = Nothing | otherwise = Just $ Metrics.Gauge n2 diffMetric (Metrics.Label n1) (Metrics.Label n2) | n1 == n2 = Nothing | otherwise = Just $ Metrics.Label n2 -- Distributions are assumed to be non-equal. diffMetric _ _ = Nothing ------------------------------------------------------------------------ -- Backwards compatibility shims #if __GLASGOW_HASKELL__ < 706
1,144
diffSamples opts prev curr = M.foldlWithKey' combine M.empty curr where combine m name new = case M.lookup name prev of Just old -> case diffMetric old new of Just val -> M.insert name' val m Nothing -> m _ -> M.insert name' new m where name' = T.append (prefix opts) (T.append name (suffix opts)) diffMetric :: Metrics.Value -> Metrics.Value -> Maybe Metrics.Value diffMetric (Metrics.Counter n1) (Metrics.Counter n2) | n1 == n2 = Nothing | otherwise = Just $! Metrics.Counter $ n2 - n1 diffMetric (Metrics.Gauge n1) (Metrics.Gauge n2) | n1 == n2 = Nothing | otherwise = Just $ Metrics.Gauge n2 diffMetric (Metrics.Label n1) (Metrics.Label n2) | n1 == n2 = Nothing | otherwise = Just $ Metrics.Label n2 -- Distributions are assumed to be non-equal. diffMetric _ _ = Nothing ------------------------------------------------------------------------ -- Backwards compatibility shims #if __GLASGOW_HASKELL__ < 706
1,063
false
true
3
12
301
402
184
218
null
null
cdettmering/tae
IO.hs
gpl-3.0
parse ("look":"at":l) w = look (L.intercalate " " l) w
54
parse ("look":"at":l) w = look (L.intercalate " " l) w
54
parse ("look":"at":l) w = look (L.intercalate " " l) w
54
false
false
1
8
9
41
18
23
null
null
sixohsix/hmidi
System/Win32/MIDI.hs
bsd-3-clause
im 0x3C5 = MIM_ERROR
21
mim 0x3C5 = MIM_ERROR
21
mim 0x3C5 = MIM_ERROR
21
false
false
0
5
4
9
4
5
null
null
Fuuzetsu/haddock
haddock-api/src/Haddock/Backends/Hyperlinker/Renderer.hs
bsd-2-clause
header :: Maybe FilePath -> Maybe FilePath -> Html header mcss mjs | isNothing mcss && isNothing mjs = Html.noHtml
118
header :: Maybe FilePath -> Maybe FilePath -> Html header mcss mjs | isNothing mcss && isNothing mjs = Html.noHtml
118
header mcss mjs | isNothing mcss && isNothing mjs = Html.noHtml
67
false
true
0
9
23
48
21
27
null
null
stevezhee/grm
grm.hs
bsd-3-clause
argsDesc :: Args argsDesc = Args { files = def &= args , locations = def &= help "generate location information" } &= summary summ &= program prog where summ = prog ++ " v" ++ display version ++ ", " ++ copyright prog = "grm" copyright = "(C) Brett Letner 2011-2012"
280
argsDesc :: Args argsDesc = Args { files = def &= args , locations = def &= help "generate location information" } &= summary summ &= program prog where summ = prog ++ " v" ++ display version ++ ", " ++ copyright prog = "grm" copyright = "(C) Brett Letner 2011-2012"
280
argsDesc = Args { files = def &= args , locations = def &= help "generate location information" } &= summary summ &= program prog where summ = prog ++ " v" ++ display version ++ ", " ++ copyright prog = "grm" copyright = "(C) Brett Letner 2011-2012"
263
false
true
10
8
65
107
49
58
null
null
josuf107/Adverb
Adverb/Common.hs
gpl-3.0
conspicuously = id
18
conspicuously = id
18
conspicuously = id
18
false
false
0
4
2
6
3
3
null
null
write-you-a-scheme-v2/scheme
src/Prim.hs
mit
notOp :: LispVal -> Eval LispVal notOp (Bool True) = return $ Bool False
72
notOp :: LispVal -> Eval LispVal notOp (Bool True) = return $ Bool False
72
notOp (Bool True) = return $ Bool False
39
false
true
0
6
13
38
17
21
null
null
benma/bitd
src/BitD/Sync.hs
bsd-3-clause
buildChain :: DB.DBBlockchainIndex -> (ByteOffset, ByteOffset, BC.Block) -> P.Producer BlockEvent (ResourceT IO) () buildChain db (offsetBefore, offsetAfter, block) = do let curHash = block ^. blockHash let liftDB' = lift let storeTip curHeight = do P.yield $ BlockProcessed block curHeight offsetBefore offsetAfter tip <- liftDB' $ DB.getTip db case tip of Nothing -> storeTip (DB.Height 0) Just (DB.Height tipHeight, tip') -> do let curHeight = DB.Height (tipHeight + 1) -- log' $ BS.concat ["handle block #", (BSC.pack $ show curHeight), " - ", toBS curHash] case (tip' /= block ^. prevHash) of False -> storeTip curHeight True -> do log' ("Current block does not connect to tip!" :: String) log' ("Prev: " `BS.append` toBS (block ^. prevHash . hexHash)) log' ("Cur: " `BS.append` toBS curHash) log' ("Tip: " `BS.append` toBS tip') log' ("Tip height: " ++ (show tipHeight)) -- TODO errs isMainHeight <- liftDB' (isOnMainChain db block) case isMainHeight of Just height -> do log' ("orphanize from " `BS.append` (BSC.pack $ show height) `BS.append` " because of new main chain branch: " `BS.append` toBS curHash) orphanizeFrom db height storeTip height Nothing -> log' ("skipping over orphan " `BS.append` toBS (curHash ^. hexHash))
1,469
buildChain :: DB.DBBlockchainIndex -> (ByteOffset, ByteOffset, BC.Block) -> P.Producer BlockEvent (ResourceT IO) () buildChain db (offsetBefore, offsetAfter, block) = do let curHash = block ^. blockHash let liftDB' = lift let storeTip curHeight = do P.yield $ BlockProcessed block curHeight offsetBefore offsetAfter tip <- liftDB' $ DB.getTip db case tip of Nothing -> storeTip (DB.Height 0) Just (DB.Height tipHeight, tip') -> do let curHeight = DB.Height (tipHeight + 1) -- log' $ BS.concat ["handle block #", (BSC.pack $ show curHeight), " - ", toBS curHash] case (tip' /= block ^. prevHash) of False -> storeTip curHeight True -> do log' ("Current block does not connect to tip!" :: String) log' ("Prev: " `BS.append` toBS (block ^. prevHash . hexHash)) log' ("Cur: " `BS.append` toBS curHash) log' ("Tip: " `BS.append` toBS tip') log' ("Tip height: " ++ (show tipHeight)) -- TODO errs isMainHeight <- liftDB' (isOnMainChain db block) case isMainHeight of Just height -> do log' ("orphanize from " `BS.append` (BSC.pack $ show height) `BS.append` " because of new main chain branch: " `BS.append` toBS curHash) orphanizeFrom db height storeTip height Nothing -> log' ("skipping over orphan " `BS.append` toBS (curHash ^. hexHash))
1,469
buildChain db (offsetBefore, offsetAfter, block) = do let curHash = block ^. blockHash let liftDB' = lift let storeTip curHeight = do P.yield $ BlockProcessed block curHeight offsetBefore offsetAfter tip <- liftDB' $ DB.getTip db case tip of Nothing -> storeTip (DB.Height 0) Just (DB.Height tipHeight, tip') -> do let curHeight = DB.Height (tipHeight + 1) -- log' $ BS.concat ["handle block #", (BSC.pack $ show curHeight), " - ", toBS curHash] case (tip' /= block ^. prevHash) of False -> storeTip curHeight True -> do log' ("Current block does not connect to tip!" :: String) log' ("Prev: " `BS.append` toBS (block ^. prevHash . hexHash)) log' ("Cur: " `BS.append` toBS curHash) log' ("Tip: " `BS.append` toBS tip') log' ("Tip height: " ++ (show tipHeight)) -- TODO errs isMainHeight <- liftDB' (isOnMainChain db block) case isMainHeight of Just height -> do log' ("orphanize from " `BS.append` (BSC.pack $ show height) `BS.append` " because of new main chain branch: " `BS.append` toBS curHash) orphanizeFrom db height storeTip height Nothing -> log' ("skipping over orphan " `BS.append` toBS (curHash ^. hexHash))
1,353
false
true
5
29
426
451
226
225
null
null
eigengrau/hlint
data/Default.hs
bsd-3-clause
error "Use any" = null (filter f x) ==> not (any f x)
53
error "Use any" = null (filter f x) ==> not (any f x)
53
error "Use any" = null (filter f x) ==> not (any f x)
53
false
false
0
8
12
36
16
20
null
null
sdiehl/ghc
compiler/main/DynFlags.hs
bsd-3-clause
setWarningFlag, unSetWarningFlag :: WarningFlag -> DynP () setWarningFlag f = upd (\dfs -> wopt_set dfs f)
108
setWarningFlag, unSetWarningFlag :: WarningFlag -> DynP () setWarningFlag f = upd (\dfs -> wopt_set dfs f)
108
setWarningFlag f = upd (\dfs -> wopt_set dfs f)
49
false
true
0
8
17
41
21
20
null
null
crzysdrs/griddle
src/Main.hs
gpl-2.0
where es = case Steam.Shortcuts.tags s of (VDFList l) -> l
68
where es = case Steam.Shortcuts.tags s of (VDFList l) -> l
68
where es = case Steam.Shortcuts.tags s of (VDFList l) -> l
68
false
false
1
9
20
35
15
20
null
null
cocreature/stack
src/Stack/Setup.hs
bsd-3-clause
sanityCheck :: (MonadIO m, MonadMask m, MonadLogger m, MonadBaseControl IO m) => EnvOverride -> m () sanityCheck menv = withSystemTempDirectory "stack-sanity-check" $ \dir -> do dir' <- parseAbsDir dir let fp = toFilePath $ dir' </> $(mkRelFile "Main.hs") liftIO $ writeFile fp $ unlines [ "import Distribution.Simple" -- ensure Cabal library is present , "main = putStrLn \"Hello World\"" ] ghc <- join $ findExecutable menv "ghc" $logDebug $ "Performing a sanity check on: " <> T.pack (toFilePath ghc) eres <- tryProcessStdout (Just dir') menv "ghc" [ fp , "-no-user-package-db" ] case eres of Left e -> throwM $ GHCSanityCheckCompileFailed e ghc Right _ -> return () -- TODO check that the output of running the command is correct
849
sanityCheck :: (MonadIO m, MonadMask m, MonadLogger m, MonadBaseControl IO m) => EnvOverride -> m () sanityCheck menv = withSystemTempDirectory "stack-sanity-check" $ \dir -> do dir' <- parseAbsDir dir let fp = toFilePath $ dir' </> $(mkRelFile "Main.hs") liftIO $ writeFile fp $ unlines [ "import Distribution.Simple" -- ensure Cabal library is present , "main = putStrLn \"Hello World\"" ] ghc <- join $ findExecutable menv "ghc" $logDebug $ "Performing a sanity check on: " <> T.pack (toFilePath ghc) eres <- tryProcessStdout (Just dir') menv "ghc" [ fp , "-no-user-package-db" ] case eres of Left e -> throwM $ GHCSanityCheckCompileFailed e ghc Right _ -> return () -- TODO check that the output of running the command is correct
849
sanityCheck menv = withSystemTempDirectory "stack-sanity-check" $ \dir -> do dir' <- parseAbsDir dir let fp = toFilePath $ dir' </> $(mkRelFile "Main.hs") liftIO $ writeFile fp $ unlines [ "import Distribution.Simple" -- ensure Cabal library is present , "main = putStrLn \"Hello World\"" ] ghc <- join $ findExecutable menv "ghc" $logDebug $ "Performing a sanity check on: " <> T.pack (toFilePath ghc) eres <- tryProcessStdout (Just dir') menv "ghc" [ fp , "-no-user-package-db" ] case eres of Left e -> throwM $ GHCSanityCheckCompileFailed e ghc Right _ -> return () -- TODO check that the output of running the command is correct
724
false
true
0
15
234
229
108
121
null
null
mgrabmueller/harpy
Harpy/X86CodeGen.hs
bsd-3-clause
x86_cc_nz = 1
14
x86_cc_nz = 1
14
x86_cc_nz = 1
14
false
false
0
4
3
6
3
3
null
null
chadbrewbaker/combinat
Math/Combinat/Sets.hs
bsd-3-clause
- | A synonym for 'combine'. compose :: Int -> [a] -> [[a]] compose = combine
78
compose :: Int -> [a] -> [[a]] compose = combine
48
compose = combine
17
true
true
2
10
16
46
24
22
null
null
sphynx/turnir
src/Types.hs
bsd-3-clause
result2score Win = AllPoints
28
result2score Win = AllPoints
28
result2score Win = AllPoints
28
false
false
0
5
3
9
4
5
null
null
brunjlar/heap
src/Data/Logic.hs
mit
-- | Elimination of /or/: If @a@ or @b@ are known, and if both @a@ and @b@ imply @c@, -- then @c@ is known. -- alternative :: Either (Dict a) (Dict b) -> (a => c) -> (b => c) -> c alternative (Left Dict) x _ = x
214
alternative :: Either (Dict a) (Dict b) -> (a => c) -> (b => c) -> c alternative (Left Dict) x _ = x
101
alternative (Left Dict) x _ = x
32
true
true
0
10
51
72
37
35
null
null
Alex-Diez/haskell-tdd-kata
old-katas/test/FruitShopKata/Day7Spec.hs
bsd-3-clause
spec :: Spec spec = do it "should add product and sum" $ do process ["Pommes"] `shouldBe` [100] process ["Bananes"] `shouldBe` [150] process ["Pommes", "Cerises"] `shouldBe` [100, 175] it "should allow for discount" $ do process ["Pommes", "Cerises", "Cerises"] `shouldBe` [100, 175, 230] process ["Cerises", "Cerises", "Cerises", "Cerises"] `shouldBe` [75, 130, 205, 260] process ["Cerises", "Pommes", "Cerises", "Bananes", "Cerises", "Cerises", "Pommes"] `shouldBe` [75, 175, 230, 380, 455, 510, 610] process ["Bananes", "Bananes"] `shouldBe` [150, 150] process ["Cerises", "Pommes", "Cerises", "Bananes", "Pommes", "Bananes", "Cerises"] `shouldBe` [75, 175, 230, 380, 480, 480, 555]
802
spec :: Spec spec = do it "should add product and sum" $ do process ["Pommes"] `shouldBe` [100] process ["Bananes"] `shouldBe` [150] process ["Pommes", "Cerises"] `shouldBe` [100, 175] it "should allow for discount" $ do process ["Pommes", "Cerises", "Cerises"] `shouldBe` [100, 175, 230] process ["Cerises", "Cerises", "Cerises", "Cerises"] `shouldBe` [75, 130, 205, 260] process ["Cerises", "Pommes", "Cerises", "Bananes", "Cerises", "Cerises", "Pommes"] `shouldBe` [75, 175, 230, 380, 455, 510, 610] process ["Bananes", "Bananes"] `shouldBe` [150, 150] process ["Cerises", "Pommes", "Cerises", "Bananes", "Pommes", "Bananes", "Cerises"] `shouldBe` [75, 175, 230, 380, 480, 480, 555]
798
spec = do it "should add product and sum" $ do process ["Pommes"] `shouldBe` [100] process ["Bananes"] `shouldBe` [150] process ["Pommes", "Cerises"] `shouldBe` [100, 175] it "should allow for discount" $ do process ["Pommes", "Cerises", "Cerises"] `shouldBe` [100, 175, 230] process ["Cerises", "Cerises", "Cerises", "Cerises"] `shouldBe` [75, 130, 205, 260] process ["Cerises", "Pommes", "Cerises", "Bananes", "Cerises", "Cerises", "Pommes"] `shouldBe` [75, 175, 230, 380, 455, 510, 610] process ["Bananes", "Bananes"] `shouldBe` [150, 150] process ["Cerises", "Pommes", "Cerises", "Bananes", "Pommes", "Bananes", "Cerises"] `shouldBe` [75, 175, 230, 380, 480, 480, 555]
785
false
true
1
15
207
294
170
124
null
null
brendanhay/gogol
gogol-driveactivity/gen/Network/Google/DriveActivity/Types/Product.hs
mpl-2.0
-- | The activity occurred over this time range. daTimeRange :: Lens' DriveActivity (Maybe TimeRange) daTimeRange = lens _daTimeRange (\ s a -> s{_daTimeRange = a})
166
daTimeRange :: Lens' DriveActivity (Maybe TimeRange) daTimeRange = lens _daTimeRange (\ s a -> s{_daTimeRange = a})
117
daTimeRange = lens _daTimeRange (\ s a -> s{_daTimeRange = a})
64
true
true
0
9
27
48
25
23
null
null
sebmathguy/icfp-2015
library/GameState.hs
mit
-- | Turn a number of anticlockwise turns into an 'ACWRotation' mkACWRot :: Int -> ACWRotation mkACWRot x = ACWRot $ x `mod` 6
126
mkACWRot :: Int -> ACWRotation mkACWRot x = ACWRot $ x `mod` 6
62
mkACWRot x = ACWRot $ x `mod` 6
31
true
true
2
7
23
38
18
20
null
null
bgamari/linear
src/Linear/Matrix.hs
bsd-3-clause
-- |The identity matrix for any dimension vector. -- -- >>> identity :: M44 Int -- V4 (V4 1 0 0 0) (V4 0 1 0 0) (V4 0 0 1 0) (V4 0 0 0 1) -- >>> identity :: V3 (V3 Int) -- V3 (V3 1 0 0) (V3 0 1 0) (V3 0 0 1) identity :: (Num a, Traversable t, Applicative t) => t (t a) identity = scaled (pure 1)
295
identity :: (Num a, Traversable t, Applicative t) => t (t a) identity = scaled (pure 1)
87
identity = scaled (pure 1)
26
true
true
0
8
74
56
31
25
null
null
alephnil/h99
36.hs
apache-2.0
primeFactors' :: Int -> Int -> [Int] primeFactors' m n | m > n = [] | n `mod` m > 0 = primeFactors' (m + 1) n | otherwise = m : (primeFactors' m (n `div` m))
163
primeFactors' :: Int -> Int -> [Int] primeFactors' m n | m > n = [] | n `mod` m > 0 = primeFactors' (m + 1) n | otherwise = m : (primeFactors' m (n `div` m))
163
primeFactors' m n | m > n = [] | n `mod` m > 0 = primeFactors' (m + 1) n | otherwise = m : (primeFactors' m (n `div` m))
126
false
true
1
10
43
101
52
49
null
null
jml/haverer
lib/Haverer/Action.hs
apache-2.0
_validatePlay player Clown play@(Attack target) | player == target = throwError SelfTarget | otherwise = return play
120
_validatePlay player Clown play@(Attack target) | player == target = throwError SelfTarget | otherwise = return play
120
_validatePlay player Clown play@(Attack target) | player == target = throwError SelfTarget | otherwise = return play
120
false
false
0
8
20
57
23
34
null
null
imccoy/utopia
src/Lam.hs
mit
argNamesFromBindings :: (Ord i) => Map Name i -> [BindingWithId i] -> Either (ArgNameDuplicates i) (Map Name i) argNamesFromBindings builtinsArgsIds bindings = argNamesFromExps builtinsArgsIds (catMaybes $ typeishArgIds <$> bindings) (bindingExps bindings)
256
argNamesFromBindings :: (Ord i) => Map Name i -> [BindingWithId i] -> Either (ArgNameDuplicates i) (Map Name i) argNamesFromBindings builtinsArgsIds bindings = argNamesFromExps builtinsArgsIds (catMaybes $ typeishArgIds <$> bindings) (bindingExps bindings)
256
argNamesFromBindings builtinsArgsIds bindings = argNamesFromExps builtinsArgsIds (catMaybes $ typeishArgIds <$> bindings) (bindingExps bindings)
144
false
true
0
11
30
91
44
47
null
null
mstksg/auto
src/Control/Auto/Interval.hs
mit
-- | For @'onFor' n@, the first @n@ items in the output stream are always -- "on" (passing through with exactly the value of the corresponding -- input); for the rest, the output stream is always "off", suppressing all -- input values forevermore. -- -- If a number less than 0 is passed, 0 is used. -- onFor :: Int -- ^ amount of steps to stay "on" for -> Interval m a a onFor = mkState f . Just . max 0 where f x (Just i) | i > 0 = (Just x , Just (i - 1)) f _ _ = (Nothing, Nothing) -- | For @'offFor' n@, the first @n@ items in the output stream are always -- "off", suppressing all input; for the rest, the output stream is always -- "on", outputting exactly the value of the corresponding input.
737
onFor :: Int -- ^ amount of steps to stay "on" for -> Interval m a a onFor = mkState f . Just . max 0 where f x (Just i) | i > 0 = (Just x , Just (i - 1)) f _ _ = (Nothing, Nothing) -- | For @'offFor' n@, the first @n@ items in the output stream are always -- "off", suppressing all input; for the rest, the output stream is always -- "on", outputting exactly the value of the corresponding input.
434
onFor = mkState f . Just . max 0 where f x (Just i) | i > 0 = (Just x , Just (i - 1)) f _ _ = (Nothing, Nothing) -- | For @'offFor' n@, the first @n@ items in the output stream are always -- "off", suppressing all input; for the rest, the output stream is always -- "on", outputting exactly the value of the corresponding input.
354
true
true
2
9
180
120
61
59
null
null
GaloisInc/halvm-ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
liftMIdKey = mkPreludeMiscIdUnique 195
43
liftMIdKey = mkPreludeMiscIdUnique 195
43
liftMIdKey = mkPreludeMiscIdUnique 195
43
false
false
1
5
8
12
4
8
null
null
ice1000/OI-codes
codewars/1-100/get-list-run-recursively.hs
agpl-3.0
sumR (a : b) = a + sumR b
25
sumR (a : b) = a + sumR b
25
sumR (a : b) = a + sumR b
25
false
false
0
7
8
23
11
12
null
null
Fuuzetsu/osz-loader
src/Game/Osu/OszLoader/OsuParser/Events.hs
gpl-3.0
eventLayerP ∷ Parser EventLayer eventLayerP = "Background" *> return Background <|> "Fail" *> return Fail <|> "Pass" *> return Pass <|> "Foreground" *> return Foreground
211
eventLayerP ∷ Parser EventLayer eventLayerP = "Background" *> return Background <|> "Fail" *> return Fail <|> "Pass" *> return Pass <|> "Foreground" *> return Foreground
211
eventLayerP = "Background" *> return Background <|> "Fail" *> return Fail <|> "Pass" *> return Pass <|> "Foreground" *> return Foreground
179
false
true
0
12
66
54
25
29
null
null
tpsinnem/Idris-dev
src/Idris/Core/Elaborate.hs
bsd-3-clause
getNameFrom :: Name -> Elab' aux Name getNameFrom n = do (ES (p, a) s e) <- get let next = nextname p let p' = p { nextname = next + 1 } put (ES (p', a) s e) let n' = case n of UN x -> MN (next+100) x MN i x -> if i == 99999 then MN (next+500) x else MN (next+100) x NS (UN x) s -> MN (next+100) x _ -> n return $! n'
582
getNameFrom :: Name -> Elab' aux Name getNameFrom n = do (ES (p, a) s e) <- get let next = nextname p let p' = p { nextname = next + 1 } put (ES (p', a) s e) let n' = case n of UN x -> MN (next+100) x MN i x -> if i == 99999 then MN (next+500) x else MN (next+100) x NS (UN x) s -> MN (next+100) x _ -> n return $! n'
582
getNameFrom n = do (ES (p, a) s e) <- get let next = nextname p let p' = p { nextname = next + 1 } put (ES (p', a) s e) let n' = case n of UN x -> MN (next+100) x MN i x -> if i == 99999 then MN (next+500) x else MN (next+100) x NS (UN x) s -> MN (next+100) x _ -> n return $! n'
544
false
true
0
16
346
229
111
118
null
null
LeoMingo/RPNMathParser
Functions/InfixOpParser.hs
gpl-3.0
infFMValList :: [ (Double->Double->Double) ] infFMValList = getFMVals infixFunctionMap
86
infFMValList :: [ (Double->Double->Double) ] infFMValList = getFMVals infixFunctionMap
86
infFMValList = getFMVals infixFunctionMap
41
false
true
0
8
8
28
15
13
null
null
beni55/binary
tests/QuickCheckUtils.hs
bsd-3-clause
mycheck :: Testable a => Config -> a -> IO () mycheck config a = do rnd <- newStdGen performGC -- >> threadDelay 100 t <- mytests config (evaluate a) rnd 0 0 [] 0 -- 0 printf " %0.3f seconds\n" (t :: Double) hFlush stdout
246
mycheck :: Testable a => Config -> a -> IO () mycheck config a = do rnd <- newStdGen performGC -- >> threadDelay 100 t <- mytests config (evaluate a) rnd 0 0 [] 0 -- 0 printf " %0.3f seconds\n" (t :: Double) hFlush stdout
246
mycheck config a = do rnd <- newStdGen performGC -- >> threadDelay 100 t <- mytests config (evaluate a) rnd 0 0 [] 0 -- 0 printf " %0.3f seconds\n" (t :: Double) hFlush stdout
200
false
true
0
11
70
103
47
56
null
null
tamarin-prover/tamarin-prover
lib/theory/src/Theory/Model/Rule.hs
gpl-3.0
-- | @lookupPrem i ru@ returns the @i@-th premise of rule @ru@, if possible. lookupPrem :: PremIdx -> Rule i -> Maybe LNFact lookupPrem i = (`atMay` getPremIdx i) . L.get rPrems
177
lookupPrem :: PremIdx -> Rule i -> Maybe LNFact lookupPrem i = (`atMay` getPremIdx i) . L.get rPrems
100
lookupPrem i = (`atMay` getPremIdx i) . L.get rPrems
52
true
true
0
7
31
47
24
23
null
null
flipstone/kioku
src/Database/Kioku/Memorizable.hs
mit
recallWord16 :: BS.ByteString -> Word16 recallWord16 bs = {-# SCC recallWord16 #-} ( fromIntegral (bs `UBS.unsafeIndex` 0) `unsafeShiftL` 8 .|. fromIntegral (bs `UBS.unsafeIndex` 1) )
195
recallWord16 :: BS.ByteString -> Word16 recallWord16 bs = {-# SCC recallWord16 #-} ( fromIntegral (bs `UBS.unsafeIndex` 0) `unsafeShiftL` 8 .|. fromIntegral (bs `UBS.unsafeIndex` 1) )
195
recallWord16 bs = {-# SCC recallWord16 #-} ( fromIntegral (bs `UBS.unsafeIndex` 0) `unsafeShiftL` 8 .|. fromIntegral (bs `UBS.unsafeIndex` 1) )
155
false
true
0
10
36
62
35
27
null
null
na4zagin3/uhim-dict
app/Main.hs
gpl-3.0
opts :: Parser Command opts = subparser ( command "skk-yomi" (info (helper <*> (CommandSKKYomi <$> skkYomiOption)) (progDesc "Generate SKK yomi dictionary")) <> command "latex" (info (helper <*> (CommandLaTeX <$> latexOption)) (progDesc "Generate LaTeX file")) <> command "tcvime" (info (helper <*> (CommandTcvime <$> tcvimeOption)) (progDesc "Generate Tcvime files")) <> command "tcel" (info (helper <*> (CommandTcEl <$> tcElOption)) (progDesc "Generate Tc.el files")) <> command "check" (info (helper <*> (CommandCheck <$> checkOption)) (progDesc "Check dictionary files")) )
590
opts :: Parser Command opts = subparser ( command "skk-yomi" (info (helper <*> (CommandSKKYomi <$> skkYomiOption)) (progDesc "Generate SKK yomi dictionary")) <> command "latex" (info (helper <*> (CommandLaTeX <$> latexOption)) (progDesc "Generate LaTeX file")) <> command "tcvime" (info (helper <*> (CommandTcvime <$> tcvimeOption)) (progDesc "Generate Tcvime files")) <> command "tcel" (info (helper <*> (CommandTcEl <$> tcElOption)) (progDesc "Generate Tc.el files")) <> command "check" (info (helper <*> (CommandCheck <$> checkOption)) (progDesc "Check dictionary files")) )
590
opts = subparser ( command "skk-yomi" (info (helper <*> (CommandSKKYomi <$> skkYomiOption)) (progDesc "Generate SKK yomi dictionary")) <> command "latex" (info (helper <*> (CommandLaTeX <$> latexOption)) (progDesc "Generate LaTeX file")) <> command "tcvime" (info (helper <*> (CommandTcvime <$> tcvimeOption)) (progDesc "Generate Tcvime files")) <> command "tcel" (info (helper <*> (CommandTcEl <$> tcElOption)) (progDesc "Generate Tc.el files")) <> command "check" (info (helper <*> (CommandCheck <$> checkOption)) (progDesc "Check dictionary files")) )
567
false
true
0
16
86
201
103
98
null
null
JPMoresmau/BuildWrapper
src/Language/Haskell/BuildWrapper/GHC.hs
bsd-3-clause
tokenType ITctype= "P"
22
tokenType ITctype= "P"
22
tokenType ITctype= "P"
22
false
false
1
5
2
14
4
10
null
null
noinia/balbst
src/Data/MergeableDict.hs
bsd-3-clause
extractMin' (Node _ _ l x r) = (\l' -> join' l' x r) <$> extractMin' l
73
extractMin' (Node _ _ l x r) = (\l' -> join' l' x r) <$> extractMin' l
73
extractMin' (Node _ _ l x r) = (\l' -> join' l' x r) <$> extractMin' l
73
false
false
0
8
19
46
22
24
null
null
oforero/DiG
src/Main.hs
mit
(</>) :: ByteString -> ByteString -> ByteString a </> b = append a $ append "/" b
81
(</>) :: ByteString -> ByteString -> ByteString a </> b = append a $ append "/" b
81
a </> b = append a $ append "/" b
33
false
true
2
9
16
44
20
24
null
null
danplubell/hbase-haskell
src/Database/HBase/Client.hs
mit
-----------Utility Functions----------------- strToWord8s :: String -> [Word8] strToWord8s = BSI.unpackBytes . BC.pack
118
strToWord8s :: String -> [Word8] strToWord8s = BSI.unpackBytes . BC.pack
72
strToWord8s = BSI.unpackBytes . BC.pack
39
true
true
1
8
11
35
16
19
null
null
DanielRS/marquee
src/Text/Marquee/Writers/HTML.hs
mit
writeElement (Indented str) = codeblock "" str
49
writeElement (Indented str) = codeblock "" str
49
writeElement (Indented str) = codeblock "" str
49
false
false
0
7
9
20
9
11
null
null
jrahm/Radiation
src/Main.hs
bsd-2-clause
withLogFile :: (Handle -> IO ()) -> IO () withLogFile fn = do dirname <- tempFolder withFile (dirname </> "radiation.log") WriteMode fn
143
withLogFile :: (Handle -> IO ()) -> IO () withLogFile fn = do dirname <- tempFolder withFile (dirname </> "radiation.log") WriteMode fn
143
withLogFile fn = do dirname <- tempFolder withFile (dirname </> "radiation.log") WriteMode fn
101
false
true
0
10
29
64
29
35
null
null
TomMD/ghc
compiler/basicTypes/RdrName.hs
bsd-3-clause
isUnqual :: RdrName -> Bool isUnqual (Unqual _) = True
54
isUnqual :: RdrName -> Bool isUnqual (Unqual _) = True
54
isUnqual (Unqual _) = True
26
false
true
0
7
9
24
12
12
null
null
creichert/persistent
persistent-mongoDB/Database/Persist/MongoDB.hs
mit
-- | No intersection of lists: if no value in the field is found in the list. ninList :: PersistField typ => EntityField v [typ] -> [typ] -> Filter v f `ninList` a = Filter (unsafeCoerce f) (FilterValues a) In
209
ninList :: PersistField typ => EntityField v [typ] -> [typ] -> Filter v f `ninList` a = Filter (unsafeCoerce f) (FilterValues a) In
131
f `ninList` a = Filter (unsafeCoerce f) (FilterValues a) In
59
true
true
0
8
39
71
35
36
null
null
sgillespie/ghc
compiler/rename/RnBinds.hs
bsd-3-clause
rnGRHS :: HsMatchContext Name -> (Located (body RdrName) -> RnM (Located (body Name), FreeVars)) -> LGRHS RdrName (Located (body RdrName)) -> RnM (LGRHS Name (Located (body Name)), FreeVars) rnGRHS ctxt rnBody = wrapLocFstM (rnGRHS' ctxt rnBody)
266
rnGRHS :: HsMatchContext Name -> (Located (body RdrName) -> RnM (Located (body Name), FreeVars)) -> LGRHS RdrName (Located (body RdrName)) -> RnM (LGRHS Name (Located (body Name)), FreeVars) rnGRHS ctxt rnBody = wrapLocFstM (rnGRHS' ctxt rnBody)
266
rnGRHS ctxt rnBody = wrapLocFstM (rnGRHS' ctxt rnBody)
54
false
true
0
14
56
119
58
61
null
null
wavewave/lhc-analysis-collection
analysis/ATLAS0L2to6JMET8TeV.hs
gpl-3.0
checkFor1Set :: (CreateRdirBName a, Show (Param a) ) => (Param a, Proc a) -> SetNum -> EitherT String (ReaderT WebDAVConfig IO) () checkFor1Set (param,proc) sn = do let (wdavrdir,bname) = createRdirBName (param,proc,sn) zerolepfile = bname ++ "_ATLAS8TeV0L2to6JBkgTest.json" totalcountfile = bname ++ "_total_count.json" wdavcfg <- lift ask guardEitherM (show param ++ " not complete") $ (&&) <$> liftIO (doesFileExistInDAV wdavcfg wdavrdir zerolepfile) <*> liftIO (doesFileExistInDAV wdavcfg wdavrdir totalcountfile)
599
checkFor1Set :: (CreateRdirBName a, Show (Param a) ) => (Param a, Proc a) -> SetNum -> EitherT String (ReaderT WebDAVConfig IO) () checkFor1Set (param,proc) sn = do let (wdavrdir,bname) = createRdirBName (param,proc,sn) zerolepfile = bname ++ "_ATLAS8TeV0L2to6JBkgTest.json" totalcountfile = bname ++ "_total_count.json" wdavcfg <- lift ask guardEitherM (show param ++ " not complete") $ (&&) <$> liftIO (doesFileExistInDAV wdavcfg wdavrdir zerolepfile) <*> liftIO (doesFileExistInDAV wdavcfg wdavrdir totalcountfile)
599
checkFor1Set (param,proc) sn = do let (wdavrdir,bname) = createRdirBName (param,proc,sn) zerolepfile = bname ++ "_ATLAS8TeV0L2to6JBkgTest.json" totalcountfile = bname ++ "_total_count.json" wdavcfg <- lift ask guardEitherM (show param ++ " not complete") $ (&&) <$> liftIO (doesFileExistInDAV wdavcfg wdavrdir zerolepfile) <*> liftIO (doesFileExistInDAV wdavcfg wdavrdir totalcountfile)
422
false
true
0
13
148
192
97
95
null
null
urbanslug/ghc
testsuite/tests/perf/compiler/T783.hs
bsd-3-clause
foo x | x == 425 = 425
22
foo x | x == 425 = 425
22
foo x | x == 425 = 425
22
false
false
0
8
7
23
9
14
null
null
maximilianhuber/softwareProjekt
benchmarks/DivBench.hs
bsd-3-clause
myConfig = defaultConfig { cfgSamples = M.Last (Just (10::Int))}
68
myConfig = defaultConfig { cfgSamples = M.Last (Just (10::Int))}
68
myConfig = defaultConfig { cfgSamples = M.Last (Just (10::Int))}
68
false
false
0
10
12
31
17
14
null
null
aufheben/Y86
Compiler/lab/C/SkelC.hs
mit
transInitializer :: Initializer -> Result transInitializer x = case x of InitExpr exp -> failure x InitListOne initializers -> failure x InitListTwo initializers -> failure x
180
transInitializer :: Initializer -> Result transInitializer x = case x of InitExpr exp -> failure x InitListOne initializers -> failure x InitListTwo initializers -> failure x
180
transInitializer x = case x of InitExpr exp -> failure x InitListOne initializers -> failure x InitListTwo initializers -> failure x
138
false
true
4
5
31
53
26
27
null
null
vladimir-ipatov/ganeti
src/Ganeti/OpParams.hs
gpl-2.0
pRemoveUids :: Field pRemoveUids = withDoc "Shrink UID pool, must be list of lists describing UID\ \ ranges (two items, start and end inclusive) to be removed" . optionalField $ simpleField "remove_uids" [t| [(Int, Int)] |]
237
pRemoveUids :: Field pRemoveUids = withDoc "Shrink UID pool, must be list of lists describing UID\ \ ranges (two items, start and end inclusive) to be removed" . optionalField $ simpleField "remove_uids" [t| [(Int, Int)] |]
237
pRemoveUids = withDoc "Shrink UID pool, must be list of lists describing UID\ \ ranges (two items, start and end inclusive) to be removed" . optionalField $ simpleField "remove_uids" [t| [(Int, Int)] |]
216
false
true
0
7
49
31
17
14
null
null
DavidAlphaFox/ghc
libraries/Cabal/Cabal/Distribution/Simple/Command.hs
bsd-3-clause
--TODO: eliminate this function and turn it into a variant on commandAddAction -- instead like commandAddActionNoArgs that doesn't supply the [String] -- | Helper function for creating globalCommand description getNormalCommandDescriptions :: [Command action] -> [(String, String)] getNormalCommandDescriptions cmds = [ (name, description) | Command name description _ NormalCommand <- cmds ]
403
getNormalCommandDescriptions :: [Command action] -> [(String, String)] getNormalCommandDescriptions cmds = [ (name, description) | Command name description _ NormalCommand <- cmds ]
186
getNormalCommandDescriptions cmds = [ (name, description) | Command name description _ NormalCommand <- cmds ]
115
true
true
0
9
61
68
36
32
null
null
david415/tails
wiki/src/promote/slides/Tails-SIT_conference-201206/pandoc-filters/pygments.hs
gpl-3.0
pygments:: String -> [String] -> String pygments code options | (length options) == 1 = unsafePerformIO $ readProcess "pygmentize" ["-l", (map toLower (head options)), "-f", "html"] code | (length options) == 2 = unsafePerformIO $ readProcess "pygmentize" ["-l", (map toLower (head options)), "-O linenos=inline", "-f", "html"] code | otherwise = "<div class =\"highlight\"><pre>" ++ code ++ "</pre></div>"
443
pygments:: String -> [String] -> String pygments code options | (length options) == 1 = unsafePerformIO $ readProcess "pygmentize" ["-l", (map toLower (head options)), "-f", "html"] code | (length options) == 2 = unsafePerformIO $ readProcess "pygmentize" ["-l", (map toLower (head options)), "-O linenos=inline", "-f", "html"] code | otherwise = "<div class =\"highlight\"><pre>" ++ code ++ "</pre></div>"
443
pygments code options | (length options) == 1 = unsafePerformIO $ readProcess "pygmentize" ["-l", (map toLower (head options)), "-f", "html"] code | (length options) == 2 = unsafePerformIO $ readProcess "pygmentize" ["-l", (map toLower (head options)), "-O linenos=inline", "-f", "html"] code | otherwise = "<div class =\"highlight\"><pre>" ++ code ++ "</pre></div>"
403
false
true
1
12
93
163
82
81
null
null
josefs/autosar
ARSim/arsim/AUTOSAR/ARSim.hs
bsd-3-clause
printlog id val = singleton $ Printlog id val
57
printlog id val = singleton $ Printlog id val
57
printlog id val = singleton $ Printlog id val
57
false
false
0
6
20
20
9
11
null
null
jberthold/diamond
src/Web/Diamond/API.hs
bsd-3-clause
cfList :<|> cfGet = quClient
28
cfList :<|> cfGet = quClient
28
cfList :<|> cfGet = quClient
28
false
false
4
5
4
17
7
10
null
null
VictorDenisov/vim-netbeans
src/Test/AllTests.hs
gpl-2.0
printDefineAnnoType :: Assertion printDefineAnnoType = "0:defineAnnoType!1 2 \"typeName\" \"toolTip\" \"glyphFile\" Red Green" @?= (N.printMessage $ N.CommandMessage (N.BufId 0) 1 $ N.DefineAnnoType (N.AnnoTypeNum 2) "typeName" "toolTip" "glyphFile" N.Red N.Green)
664
printDefineAnnoType :: Assertion printDefineAnnoType = "0:defineAnnoType!1 2 \"typeName\" \"toolTip\" \"glyphFile\" Red Green" @?= (N.printMessage $ N.CommandMessage (N.BufId 0) 1 $ N.DefineAnnoType (N.AnnoTypeNum 2) "typeName" "toolTip" "glyphFile" N.Red N.Green)
664
printDefineAnnoType = "0:defineAnnoType!1 2 \"typeName\" \"toolTip\" \"glyphFile\" Red Green" @?= (N.printMessage $ N.CommandMessage (N.BufId 0) 1 $ N.DefineAnnoType (N.AnnoTypeNum 2) "typeName" "toolTip" "glyphFile" N.Red N.Green)
631
false
true
0
12
427
70
35
35
null
null
shayan-najd/QFeldspar
QFeldspar/Prelude/HaskellEnvironment.hs
gpl-3.0
hshTbl :: Ary Word32 hshTbl = PH.hashTable
42
hshTbl :: Ary Word32 hshTbl = PH.hashTable
42
hshTbl = PH.hashTable
21
false
true
0
5
6
16
8
8
null
null
abau/co4
src/CO4/Util.hs
gpl-3.0
pCon :: Namelike n => n -> [Pattern] -> Pattern pCon n = PCon $ name n
70
pCon :: Namelike n => n -> [Pattern] -> Pattern pCon n = PCon $ name n
70
pCon n = PCon $ name n
22
false
true
2
9
16
45
20
25
null
null
manyoo/ghcjs
test/pkg/base/t5943.hs
mit
delay :: IO Int -- ^ the signal to delay -> IO (IO (), IO (), IO Int) -- ^ the delayed signal delay s = do ref <- newIORef (Ready 0) let upd = do v <- readIORef ref case v of Ready x -> do putStrLn "upd: Ready"; x' <- s; putStrLn (show x'); writeIORef ref (Updated x' x) _ -> return () fin = do v <- readIORef ref case v of Updated x _ -> do putStrLn "fin: Updated"; writeIORef ref $! Ready x _ -> error "Signal not updated!" sig = do v <- readIORef ref case v of Ready x -> do putStrLn "sig: Ready"; return x Updated _ x -> do putStrLn "sig: Updated"; return x return (upd,fin,sig)
798
delay :: IO Int -- ^ the signal to delay -> IO (IO (), IO (), IO Int) delay s = do ref <- newIORef (Ready 0) let upd = do v <- readIORef ref case v of Ready x -> do putStrLn "upd: Ready"; x' <- s; putStrLn (show x'); writeIORef ref (Updated x' x) _ -> return () fin = do v <- readIORef ref case v of Updated x _ -> do putStrLn "fin: Updated"; writeIORef ref $! Ready x _ -> error "Signal not updated!" sig = do v <- readIORef ref case v of Ready x -> do putStrLn "sig: Ready"; return x Updated _ x -> do putStrLn "sig: Updated"; return x return (upd,fin,sig)
772
delay s = do ref <- newIORef (Ready 0) let upd = do v <- readIORef ref case v of Ready x -> do putStrLn "upd: Ready"; x' <- s; putStrLn (show x'); writeIORef ref (Updated x' x) _ -> return () fin = do v <- readIORef ref case v of Updated x _ -> do putStrLn "fin: Updated"; writeIORef ref $! Ready x _ -> error "Signal not updated!" sig = do v <- readIORef ref case v of Ready x -> do putStrLn "sig: Ready"; return x Updated _ x -> do putStrLn "sig: Updated"; return x return (upd,fin,sig)
682
true
true
0
19
340
299
135
164
null
null
RaphaelJ/getwebb.org
Handler/Upload/Processing.hs
gpl-3.0
moveToUpload :: FilePath -> FilePath -> IO () moveToUpload path destPath = do createDirectoryIfMissing True (takeDirectory destPath) renameFile path destPath
165
moveToUpload :: FilePath -> FilePath -> IO () moveToUpload path destPath = do createDirectoryIfMissing True (takeDirectory destPath) renameFile path destPath
165
moveToUpload path destPath = do createDirectoryIfMissing True (takeDirectory destPath) renameFile path destPath
119
false
true
0
10
27
56
24
32
null
null
AndrewRademacher/wai
wai-app-static/WaiAppStatic/CmdLine.hs
mit
args :: Parser Args args = Args <$> strOption ( long "docroot" <> short 'd' <> metavar "DOCROOT" <> value "." <> help "directory containing files to serve") <*> (defIndex <$> many (strOption ( long "index" <> short 'i' <> metavar "INDEX" <> help "index files to serve when a directory is required" ))) <*> option' ( long "port" <> short 'p' <> metavar "PORT" <> value 3000) <*> switch ( long "noindex" <> short 'n') <*> switch ( long "quiet" <> short 'q') <*> switch ( long "verbose" <> short 'v') <*> many (toPair <$> strOption ( long "mime" <> short 'm' <> metavar "MIME" <> help "extra file extension/mime type mappings")) <*> strOption ( long "host" <> short 'h' <> metavar "HOST" <> value "*" <> help "interface to bind to, special values: *, *4, *6") where toPair = second (drop 1) . break (== '=') defIndex [] = ["index.html", "index.htm"] defIndex x = x -- | Run with the given middleware and parsing options from the command line. -- -- Since 2.0.1
1,332
args :: Parser Args args = Args <$> strOption ( long "docroot" <> short 'd' <> metavar "DOCROOT" <> value "." <> help "directory containing files to serve") <*> (defIndex <$> many (strOption ( long "index" <> short 'i' <> metavar "INDEX" <> help "index files to serve when a directory is required" ))) <*> option' ( long "port" <> short 'p' <> metavar "PORT" <> value 3000) <*> switch ( long "noindex" <> short 'n') <*> switch ( long "quiet" <> short 'q') <*> switch ( long "verbose" <> short 'v') <*> many (toPair <$> strOption ( long "mime" <> short 'm' <> metavar "MIME" <> help "extra file extension/mime type mappings")) <*> strOption ( long "host" <> short 'h' <> metavar "HOST" <> value "*" <> help "interface to bind to, special values: *, *4, *6") where toPair = second (drop 1) . break (== '=') defIndex [] = ["index.html", "index.htm"] defIndex x = x -- | Run with the given middleware and parsing options from the command line. -- -- Since 2.0.1
1,332
args = Args <$> strOption ( long "docroot" <> short 'd' <> metavar "DOCROOT" <> value "." <> help "directory containing files to serve") <*> (defIndex <$> many (strOption ( long "index" <> short 'i' <> metavar "INDEX" <> help "index files to serve when a directory is required" ))) <*> option' ( long "port" <> short 'p' <> metavar "PORT" <> value 3000) <*> switch ( long "noindex" <> short 'n') <*> switch ( long "quiet" <> short 'q') <*> switch ( long "verbose" <> short 'v') <*> many (toPair <$> strOption ( long "mime" <> short 'm' <> metavar "MIME" <> help "extra file extension/mime type mappings")) <*> strOption ( long "host" <> short 'h' <> metavar "HOST" <> value "*" <> help "interface to bind to, special values: *, *4, *6") where toPair = second (drop 1) . break (== '=') defIndex [] = ["index.html", "index.htm"] defIndex x = x -- | Run with the given middleware and parsing options from the command line. -- -- Since 2.0.1
1,312
false
true
26
14
549
373
172
201
null
null
khibino/haskell-debian-build.rebuild
src/Debian/Package/Build/Command.hs
bsd-3-clause
-- | Rename directory action. e.g. /renameDirectory from to/ renameDirectory :: String -> String -> Trace () renameDirectory src dst = do traceCommand $ renameMsg "renameDirectory" src dst lift $ D.renameDirectory src dst -- | Rename file action. e.g. /renameFile from to/
277
renameDirectory :: String -> String -> Trace () renameDirectory src dst = do traceCommand $ renameMsg "renameDirectory" src dst lift $ D.renameDirectory src dst -- | Rename file action. e.g. /renameFile from to/
216
renameDirectory src dst = do traceCommand $ renameMsg "renameDirectory" src dst lift $ D.renameDirectory src dst -- | Rename file action. e.g. /renameFile from to/
168
true
true
0
9
46
59
28
31
null
null
Brightgalrs/con-lang-gen
app/Main.hs
mit
newSample :: RVar a -> IO a newSample i = do g1 <- getStdGen let out = sampleState i g1 setStdGen $ snd out return $ fst out
132
newSample :: RVar a -> IO a newSample i = do g1 <- getStdGen let out = sampleState i g1 setStdGen $ snd out return $ fst out
132
newSample i = do g1 <- getStdGen let out = sampleState i g1 setStdGen $ snd out return $ fst out
104
false
true
0
11
35
70
29
41
null
null
nevrenato/Hets_Fork
SoftFOL/ParseTPTP.hs
gpl-2.0
singleQuoted :: Parser String singleQuoted = let quote = '\'' in fmap concat $ char quote >> many1 (tryString "\\'" <|> single (satisfy $ \ c -> printable c && c /= quote)) << char quote
201
singleQuoted :: Parser String singleQuoted = let quote = '\'' in fmap concat $ char quote >> many1 (tryString "\\'" <|> single (satisfy $ \ c -> printable c && c /= quote)) << char quote
201
singleQuoted = let quote = '\'' in fmap concat $ char quote >> many1 (tryString "\\'" <|> single (satisfy $ \ c -> printable c && c /= quote)) << char quote
171
false
true
5
13
50
91
40
51
null
null
reflex-frp/reflex-dom
reflex-dom-core/src/Reflex/Dom/Xhr.hs
bsd-3-clause
xhrRequest :: Text -> Text -> XhrRequestConfig a -> XhrRequest a xhrRequest = XhrRequest
88
xhrRequest :: Text -> Text -> XhrRequestConfig a -> XhrRequest a xhrRequest = XhrRequest
88
xhrRequest = XhrRequest
23
false
true
0
8
13
29
14
15
null
null
hiratara/doukaku-past-questions-advent-2013
src/Doukaku/Tortoise.hs
bsd-3-clause
move :: Op -> (Char, Int) -> Maybe (Char, Int) move L (c, n) = Just (c, (n + 3) `mod` 4)
88
move :: Op -> (Char, Int) -> Maybe (Char, Int) move L (c, n) = Just (c, (n + 3) `mod` 4)
88
move L (c, n) = Just (c, (n + 3) `mod` 4)
41
false
true
0
9
21
67
38
29
null
null
mbrock/HBEAM
src/Language/Erlang/BEAM/Opcodes.hs
gpl-3.0
opcodeInfo 50 = ("is_reference", 2)
35
opcodeInfo 50 = ("is_reference", 2)
35
opcodeInfo 50 = ("is_reference", 2)
35
false
false
0
5
4
15
8
7
null
null
osa1/fast-tags
src/FastTags.hs
bsd-3-clause
mkTag :: SrcPos -> Text -> Type -> Tag mkTag pos name typ = Tag $ Pos pos (TagVal name typ)
91
mkTag :: SrcPos -> Text -> Type -> Tag mkTag pos name typ = Tag $ Pos pos (TagVal name typ)
91
mkTag pos name typ = Tag $ Pos pos (TagVal name typ)
52
false
true
0
8
20
51
24
27
null
null
genos/online_problems
exercism/haskell/all-your-base/test/Tests.hs
mit
test Case{..} = it description assertion where assertion = expression `shouldBe` outputDigits expression = rebase inputBase outputBase inputDigits
169
test Case{..} = it description assertion where assertion = expression `shouldBe` outputDigits expression = rebase inputBase outputBase inputDigits
169
test Case{..} = it description assertion where assertion = expression `shouldBe` outputDigits expression = rebase inputBase outputBase inputDigits
169
false
false
2
5
40
55
24
31
null
null
ComputationWithBoundedResources/ara-inference
doc/tpdb_trs/Haskell/basic_haskell/max_5.hs
mit
max1 x y MyTrue = y
19
max1 x y MyTrue = y
19
max1 x y MyTrue = y
19
false
false
0
5
5
15
6
9
null
null
phaazon/OpenGLRaw
src/Graphics/Rendering/OpenGL/Raw/Tokens.hs
bsd-3-clause
gl_RGB_422_APPLE :: GLenum gl_RGB_422_APPLE = 0x8A1F
52
gl_RGB_422_APPLE :: GLenum gl_RGB_422_APPLE = 0x8A1F
52
gl_RGB_422_APPLE = 0x8A1F
25
false
true
0
4
5
11
6
5
null
null
begriffs/hasql-postgres
library/Hasql/Postgres/ErrorCode.hs
mit
invalid_function_definition :: ErrorCode = "42P13"
75
invalid_function_definition :: ErrorCode = "42P13"
75
invalid_function_definition :: ErrorCode = "42P13"
75
false
false
0
5
29
11
5
6
null
null
input-output-hk/pos-haskell-prototype
wallet/src/Cardano/Wallet/Kernel/DB/BlockContext.hs
mit
-- | Check if one checkpoint succeeds another -- -- The second argument is a 'Maybe', because the first checkpoint in an account -- will have no context. The first argument is /not/ a 'Maybe' because /ONLY/ -- the first checkpoint in an account can have no context. blockContextSucceeds :: BlockContext -> Maybe BlockContext -> Bool _ `blockContextSucceeds` Nothing = True
373
blockContextSucceeds :: BlockContext -> Maybe BlockContext -> Bool _ `blockContextSucceeds` Nothing = True
107
_ `blockContextSucceeds` Nothing = True
40
true
true
0
7
61
35
20
15
null
null
olorin/amazonka
amazonka-storagegateway/gen/Network/AWS/StorageGateway/AddTagsToResource.hs
mpl-2.0
-- | The Amazon Resource Name (ARN) of the resource you want to add tags to. attrResourceARN :: Lens' AddTagsToResource Text attrResourceARN = lens _attrResourceARN (\ s a -> s{_attrResourceARN = a})
199
attrResourceARN :: Lens' AddTagsToResource Text attrResourceARN = lens _attrResourceARN (\ s a -> s{_attrResourceARN = a})
122
attrResourceARN = lens _attrResourceARN (\ s a -> s{_attrResourceARN = a})
74
true
true
0
9
31
40
22
18
null
null
domenicosolazzo/practice-haskell
courses/cis194/01/01.hs
mit
foo :: Integer -> Integer foo 0 = 16
36
foo :: Integer -> Integer foo 0 = 16
36
foo 0 = 16
10
false
true
0
7
8
24
10
14
null
null
snoyberg/ghc
testsuite/tests/concurrent/prog001/Thread.hs
bsd-3-clause
t1 m (1:0:x) (0:1:y) = putMVar m 104
36
t1 m (1:0:x) (0:1:y) = putMVar m 104
36
t1 m (1:0:x) (0:1:y) = putMVar m 104
36
false
false
0
7
7
44
20
24
null
null
AndrewRademacher/stack
src/Stack/Build/Source.hs
bsd-3-clause
loadLocalPackage :: forall m env. (MonadReader env m, HasEnvConfig env, MonadMask m, MonadLogger m, MonadIO m, MonadBaseControl IO m) => BuildOptsCLI -> Map PackageName SimpleTarget -> (PackageName, (LocalPackageView, GenericPackageDescription)) -> m LocalPackage loadLocalPackage boptsCli targets (name, (lpv, gpkg)) = do let mtarget = Map.lookup name targets config <- getPackageConfig boptsCli name (isJust mtarget) True bopts <- asks (configBuild . getConfig) let pkg = resolvePackage config gpkg (exes, tests, benches) = case mtarget of Just (STLocalComps comps) -> splitComponents $ Set.toList comps Just STLocalAll -> ( packageExes pkg , if boptsTests bopts then Map.keysSet (packageTests pkg) else Set.empty , if boptsBenchmarks bopts then packageBenchmarks pkg else Set.empty ) Just STNonLocal -> assert False mempty Just STUnknown -> assert False mempty Nothing -> mempty toComponents e t b = Set.unions [ Set.map CExe e , Set.map CTest t , Set.map CBench b ] btconfig = config { packageConfigEnableTests = not $ Set.null tests , packageConfigEnableBenchmarks = not $ Set.null benches } testconfig = config { packageConfigEnableTests = True , packageConfigEnableBenchmarks = False } benchconfig = config { packageConfigEnableTests = False , packageConfigEnableBenchmarks = True } btpkg | Set.null tests && Set.null benches = Nothing | otherwise = Just (resolvePackage btconfig gpkg) testpkg = resolvePackage testconfig gpkg benchpkg = resolvePackage benchconfig gpkg mbuildCache <- tryGetBuildCache $ lpvRoot lpv (files,_) <- getPackageFilesSimple pkg (lpvCabalFP lpv) (dirtyFiles, newBuildCache) <- checkBuildCache (fromMaybe Map.empty mbuildCache) (Set.toList files) return LocalPackage { lpPackage = pkg , lpTestDeps = packageDeps testpkg , lpBenchDeps = packageDeps benchpkg , lpTestBench = btpkg , lpFiles = files , lpForceDirty = boptsForceDirty bopts , lpDirtyFiles = if not (Set.null dirtyFiles) then let tryStripPrefix y = fromMaybe y (stripPrefix (toFilePath $ lpvRoot lpv) y) in Just $ Set.map tryStripPrefix dirtyFiles else Nothing , lpNewBuildCache = newBuildCache , lpCabalFile = lpvCabalFP lpv , lpDir = lpvRoot lpv , lpWanted = isJust mtarget , lpComponents = toComponents exes tests benches -- TODO: refactor this so that it's easier to be sure that these -- components are indeed unbuildable. -- -- The reasoning here is that if the STLocalComps specification -- made it through component parsing, but the components aren't -- present, then they must not be buildable. , lpUnbuildable = toComponents (exes `Set.difference` packageExes pkg) (tests `Set.difference` Map.keysSet (packageTests pkg)) (benches `Set.difference` packageBenchmarks pkg) } -- | Ensure that the flags specified in the stack.yaml file and on the command -- line are used.
3,654
loadLocalPackage :: forall m env. (MonadReader env m, HasEnvConfig env, MonadMask m, MonadLogger m, MonadIO m, MonadBaseControl IO m) => BuildOptsCLI -> Map PackageName SimpleTarget -> (PackageName, (LocalPackageView, GenericPackageDescription)) -> m LocalPackage loadLocalPackage boptsCli targets (name, (lpv, gpkg)) = do let mtarget = Map.lookup name targets config <- getPackageConfig boptsCli name (isJust mtarget) True bopts <- asks (configBuild . getConfig) let pkg = resolvePackage config gpkg (exes, tests, benches) = case mtarget of Just (STLocalComps comps) -> splitComponents $ Set.toList comps Just STLocalAll -> ( packageExes pkg , if boptsTests bopts then Map.keysSet (packageTests pkg) else Set.empty , if boptsBenchmarks bopts then packageBenchmarks pkg else Set.empty ) Just STNonLocal -> assert False mempty Just STUnknown -> assert False mempty Nothing -> mempty toComponents e t b = Set.unions [ Set.map CExe e , Set.map CTest t , Set.map CBench b ] btconfig = config { packageConfigEnableTests = not $ Set.null tests , packageConfigEnableBenchmarks = not $ Set.null benches } testconfig = config { packageConfigEnableTests = True , packageConfigEnableBenchmarks = False } benchconfig = config { packageConfigEnableTests = False , packageConfigEnableBenchmarks = True } btpkg | Set.null tests && Set.null benches = Nothing | otherwise = Just (resolvePackage btconfig gpkg) testpkg = resolvePackage testconfig gpkg benchpkg = resolvePackage benchconfig gpkg mbuildCache <- tryGetBuildCache $ lpvRoot lpv (files,_) <- getPackageFilesSimple pkg (lpvCabalFP lpv) (dirtyFiles, newBuildCache) <- checkBuildCache (fromMaybe Map.empty mbuildCache) (Set.toList files) return LocalPackage { lpPackage = pkg , lpTestDeps = packageDeps testpkg , lpBenchDeps = packageDeps benchpkg , lpTestBench = btpkg , lpFiles = files , lpForceDirty = boptsForceDirty bopts , lpDirtyFiles = if not (Set.null dirtyFiles) then let tryStripPrefix y = fromMaybe y (stripPrefix (toFilePath $ lpvRoot lpv) y) in Just $ Set.map tryStripPrefix dirtyFiles else Nothing , lpNewBuildCache = newBuildCache , lpCabalFile = lpvCabalFP lpv , lpDir = lpvRoot lpv , lpWanted = isJust mtarget , lpComponents = toComponents exes tests benches -- TODO: refactor this so that it's easier to be sure that these -- components are indeed unbuildable. -- -- The reasoning here is that if the STLocalComps specification -- made it through component parsing, but the components aren't -- present, then they must not be buildable. , lpUnbuildable = toComponents (exes `Set.difference` packageExes pkg) (tests `Set.difference` Map.keysSet (packageTests pkg)) (benches `Set.difference` packageBenchmarks pkg) } -- | Ensure that the flags specified in the stack.yaml file and on the command -- line are used.
3,654
loadLocalPackage boptsCli targets (name, (lpv, gpkg)) = do let mtarget = Map.lookup name targets config <- getPackageConfig boptsCli name (isJust mtarget) True bopts <- asks (configBuild . getConfig) let pkg = resolvePackage config gpkg (exes, tests, benches) = case mtarget of Just (STLocalComps comps) -> splitComponents $ Set.toList comps Just STLocalAll -> ( packageExes pkg , if boptsTests bopts then Map.keysSet (packageTests pkg) else Set.empty , if boptsBenchmarks bopts then packageBenchmarks pkg else Set.empty ) Just STNonLocal -> assert False mempty Just STUnknown -> assert False mempty Nothing -> mempty toComponents e t b = Set.unions [ Set.map CExe e , Set.map CTest t , Set.map CBench b ] btconfig = config { packageConfigEnableTests = not $ Set.null tests , packageConfigEnableBenchmarks = not $ Set.null benches } testconfig = config { packageConfigEnableTests = True , packageConfigEnableBenchmarks = False } benchconfig = config { packageConfigEnableTests = False , packageConfigEnableBenchmarks = True } btpkg | Set.null tests && Set.null benches = Nothing | otherwise = Just (resolvePackage btconfig gpkg) testpkg = resolvePackage testconfig gpkg benchpkg = resolvePackage benchconfig gpkg mbuildCache <- tryGetBuildCache $ lpvRoot lpv (files,_) <- getPackageFilesSimple pkg (lpvCabalFP lpv) (dirtyFiles, newBuildCache) <- checkBuildCache (fromMaybe Map.empty mbuildCache) (Set.toList files) return LocalPackage { lpPackage = pkg , lpTestDeps = packageDeps testpkg , lpBenchDeps = packageDeps benchpkg , lpTestBench = btpkg , lpFiles = files , lpForceDirty = boptsForceDirty bopts , lpDirtyFiles = if not (Set.null dirtyFiles) then let tryStripPrefix y = fromMaybe y (stripPrefix (toFilePath $ lpvRoot lpv) y) in Just $ Set.map tryStripPrefix dirtyFiles else Nothing , lpNewBuildCache = newBuildCache , lpCabalFile = lpvCabalFP lpv , lpDir = lpvRoot lpv , lpWanted = isJust mtarget , lpComponents = toComponents exes tests benches -- TODO: refactor this so that it's easier to be sure that these -- components are indeed unbuildable. -- -- The reasoning here is that if the STLocalComps specification -- made it through component parsing, but the components aren't -- present, then they must not be buildable. , lpUnbuildable = toComponents (exes `Set.difference` packageExes pkg) (tests `Set.difference` Map.keysSet (packageTests pkg)) (benches `Set.difference` packageBenchmarks pkg) } -- | Ensure that the flags specified in the stack.yaml file and on the command -- line are used.
3,363
false
true
0
20
1,279
822
427
395
null
null
RefactoringTools/HaRe
test/testdata/RmOneParameter/A1.hs
bsd-3-clause
main = sumSq [1..4]
19
main = sumSq [1..4]
19
main = sumSq [1..4]
19
false
false
0
6
3
14
7
7
null
null
dimara/ganeti
src/Ganeti/WConfd/Core.hs
bsd-2-clause
-- *** DRBD computeDRBDMap :: WConfdMonad T.DRBDMap computeDRBDMap = uncurry T.computeDRBDMap =<< readTempResState
115
computeDRBDMap :: WConfdMonad T.DRBDMap computeDRBDMap = uncurry T.computeDRBDMap =<< readTempResState
102
computeDRBDMap = uncurry T.computeDRBDMap =<< readTempResState
62
true
true
0
7
13
26
13
13
null
null
sinelaw/language-ecmascript
test/Test/Pretty.hs
bsd-3-clause
adaptTryBlock :: JavaScript () -> JavaScript () adaptTryBlock = transformBi adaptTryBlock_ where adaptTryBlock_ s = case s of TryStmt a tb mc mf -> TryStmt a (blockerize tb) (blockerizeCC <$> mc) (blockerize <$> mf) _ -> s blockerize s = case s of BlockStmt _ _ -> s _ -> BlockStmt () [s] blockerizeCC (CatchClause a id s) = CatchClause a id (blockerize s)
476
adaptTryBlock :: JavaScript () -> JavaScript () adaptTryBlock = transformBi adaptTryBlock_ where adaptTryBlock_ s = case s of TryStmt a tb mc mf -> TryStmt a (blockerize tb) (blockerizeCC <$> mc) (blockerize <$> mf) _ -> s blockerize s = case s of BlockStmt _ _ -> s _ -> BlockStmt () [s] blockerizeCC (CatchClause a id s) = CatchClause a id (blockerize s)
476
adaptTryBlock = transformBi adaptTryBlock_ where adaptTryBlock_ s = case s of TryStmt a tb mc mf -> TryStmt a (blockerize tb) (blockerizeCC <$> mc) (blockerize <$> mf) _ -> s blockerize s = case s of BlockStmt _ _ -> s _ -> BlockStmt () [s] blockerizeCC (CatchClause a id s) = CatchClause a id (blockerize s)
428
false
true
3
11
183
143
74
69
null
null
danchoi/jsontsv
Main.hs
mit
evalKeyPath config (TupleKey k:ks) (Array v) = -- array must be an array of 2-tuples let vs :: [(Value, Value)] vs = [(V.head tuple, tuple V.! 1) | Array tuple <- V.toList v , V.length tuple == 2] e = listToMaybe [v' | (String k', v') <- vs, k' == k] in maybe Null (evalKeyPath config ks) e
329
evalKeyPath config (TupleKey k:ks) (Array v) = -- array must be an array of 2-tuples let vs :: [(Value, Value)] vs = [(V.head tuple, tuple V.! 1) | Array tuple <- V.toList v , V.length tuple == 2] e = listToMaybe [v' | (String k', v') <- vs, k' == k] in maybe Null (evalKeyPath config ks) e
329
evalKeyPath config (TupleKey k:ks) (Array v) = -- array must be an array of 2-tuples let vs :: [(Value, Value)] vs = [(V.head tuple, tuple V.! 1) | Array tuple <- V.toList v , V.length tuple == 2] e = listToMaybe [v' | (String k', v') <- vs, k' == k] in maybe Null (evalKeyPath config ks) e
329
false
false
0
14
96
157
79
78
null
null
felixsch/moonbase-ng
src/Moonbase/Panel/Items/Expand.hs
lgpl-2.1
expandR :: Maybe String -> PanelItems expandR mlabel = item $ do label <- liftIO $ Gtk.labelNew mlabel return $ PanelItem "spacer-right" (Gtk.toWidget label) Gtk.PackGrow
174
expandR :: Maybe String -> PanelItems expandR mlabel = item $ do label <- liftIO $ Gtk.labelNew mlabel return $ PanelItem "spacer-right" (Gtk.toWidget label) Gtk.PackGrow
174
expandR mlabel = item $ do label <- liftIO $ Gtk.labelNew mlabel return $ PanelItem "spacer-right" (Gtk.toWidget label) Gtk.PackGrow
136
false
true
0
12
28
65
30
35
null
null
dblia/elastic-rolling-restart
src/Elastic/RollingRestart/Client.hs
mit
getNodeIDsByRole :: URLString -> IO [String] getNodeIDsByRole hname = do node_ids <- getNodeIDs hname master_id <- getMasterNodeID hname return $ delete master_id node_ids ++ [master_id] -- | Retrieve the http_address field of the given node ID.
252
getNodeIDsByRole :: URLString -> IO [String] getNodeIDsByRole hname = do node_ids <- getNodeIDs hname master_id <- getMasterNodeID hname return $ delete master_id node_ids ++ [master_id] -- | Retrieve the http_address field of the given node ID.
252
getNodeIDsByRole hname = do node_ids <- getNodeIDs hname master_id <- getMasterNodeID hname return $ delete master_id node_ids ++ [master_id] -- | Retrieve the http_address field of the given node ID.
207
false
true
0
9
42
69
31
38
null
null
castaway/pandoc
src/Text/Pandoc/Writers/RST.hs
gpl-2.0
blockToRST (DefinitionList items) = do contents <- mapM definitionListItemToRST items -- ensure that sublists have preceding blank line return $ blankline $$ vcat contents $$ blankline -- | Convert bullet list item (list of blocks) to RST.
246
blockToRST (DefinitionList items) = do contents <- mapM definitionListItemToRST items -- ensure that sublists have preceding blank line return $ blankline $$ vcat contents $$ blankline -- | Convert bullet list item (list of blocks) to RST.
246
blockToRST (DefinitionList items) = do contents <- mapM definitionListItemToRST items -- ensure that sublists have preceding blank line return $ blankline $$ vcat contents $$ blankline -- | Convert bullet list item (list of blocks) to RST.
246
false
false
0
9
43
47
22
25
null
null
printedheart/Dao
src/Dao/Text/Location.hs
agpl-3.0
textPointTuple :: Monad m => Lens m TextPoint (LineNumber, ColumnNumber) textPointTuple = newLens (\ (TextPoint o) -> o) (\o _ -> TextPoint o)
142
textPointTuple :: Monad m => Lens m TextPoint (LineNumber, ColumnNumber) textPointTuple = newLens (\ (TextPoint o) -> o) (\o _ -> TextPoint o)
142
textPointTuple = newLens (\ (TextPoint o) -> o) (\o _ -> TextPoint o)
69
false
true
0
9
22
69
34
35
null
null