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
tjakway/ghcjvm
compiler/basicTypes/Id.hs
bsd-3-clause
idDemandInfo :: Id -> Demand idDemandInfo id = demandInfo (idInfo id)
81
idDemandInfo :: Id -> Demand idDemandInfo id = demandInfo (idInfo id)
81
idDemandInfo id = demandInfo (idInfo id)
46
false
true
0
7
22
33
14
19
null
null
meiersi/blaze-builder
benchmarks/Throughput/BlazePut.hs
bsd-3-clause
writeWord16N2Big = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return () loop s n = do Put.putWrite ( writeWord16be (s+0) `mappend` writeWord16be (s+1)) loop (s+2) (n-2)
257
writeWord16N2Big = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return () loop s n = do Put.putWrite ( writeWord16be (s+0) `mappend` writeWord16be (s+1)) loop (s+2) (n-2)
257
writeWord16N2Big = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return () loop s n = do Put.putWrite ( writeWord16be (s+0) `mappend` writeWord16be (s+1)) loop (s+2) (n-2)
257
false
false
2
14
99
123
62
61
null
null
danr/stm-promise
Control/Concurrent/STM/Promise/Process.hs
lgpl-3.0
processPromiseCallback :: (ProcessResult -> IO ()) -- ^ Callback -> FilePath -- ^ Program to run -> [String] -- ^ Arguments -> String -- ^ Input string (stdin) -> IO (Promise ProcessResult) -- ^ Promise object processPromiseCallback callback cmd args input = do pid_var <- newTVarIO Nothing result_var <- newTVarIO Unfinished spawn_ok <- newTVarIO True let silent io = io `catchError` const (return ()) spawn = do -- Check that the process hasn't been spawned before spawn_now <- atomically $ swapTVar spawn_ok False when spawn_now $ do (Just inh, Just outh, Just errh, pid) <- createProcess $ (proc cmd args) { std_in = CreatePipe , std_out = CreatePipe , std_err = CreatePipe } atomically $ writeTVar pid_var (Just pid) unless (null input) $ do silent (hPutStr inh input) silent (hFlush inh) silent (hClose inh) let go = do ex_code <- waitForProcess pid out <- hGetContents outh err <- hGetContents errh a <- evaluate (length out) b <- evaluate (length err) a `seq` b `seq` do silent (hClose outh) silent (hClose errh) let res = ProcessResult { stderr = err , stdout = out , excode = ex_code } atomically $ writeTVar result_var (An res) callback res go `catchError` \ _ -> atomically (writeTVar result_var Cancelled) cancel = do m_pid <- atomically $ do v <- readTVar result_var when (v == Unfinished) (writeTVar result_var Cancelled) writeTVar spawn_ok False swapTVar pid_var Nothing case m_pid of Just pid -> void $ forkIO $ silent $ do -- terminateProcess pid terminateProcess9 pid ex_code <- waitForProcess pid ex_code `seq` return () Nothing -> return () result = readTVar result_var return Promise {..} -- from http://stackoverflow.com/questions/8820903
2,670
processPromiseCallback :: (ProcessResult -> IO ()) -- ^ Callback -> FilePath -- ^ Program to run -> [String] -- ^ Arguments -> String -- ^ Input string (stdin) -> IO (Promise ProcessResult) processPromiseCallback callback cmd args input = do pid_var <- newTVarIO Nothing result_var <- newTVarIO Unfinished spawn_ok <- newTVarIO True let silent io = io `catchError` const (return ()) spawn = do -- Check that the process hasn't been spawned before spawn_now <- atomically $ swapTVar spawn_ok False when spawn_now $ do (Just inh, Just outh, Just errh, pid) <- createProcess $ (proc cmd args) { std_in = CreatePipe , std_out = CreatePipe , std_err = CreatePipe } atomically $ writeTVar pid_var (Just pid) unless (null input) $ do silent (hPutStr inh input) silent (hFlush inh) silent (hClose inh) let go = do ex_code <- waitForProcess pid out <- hGetContents outh err <- hGetContents errh a <- evaluate (length out) b <- evaluate (length err) a `seq` b `seq` do silent (hClose outh) silent (hClose errh) let res = ProcessResult { stderr = err , stdout = out , excode = ex_code } atomically $ writeTVar result_var (An res) callback res go `catchError` \ _ -> atomically (writeTVar result_var Cancelled) cancel = do m_pid <- atomically $ do v <- readTVar result_var when (v == Unfinished) (writeTVar result_var Cancelled) writeTVar spawn_ok False swapTVar pid_var Nothing case m_pid of Just pid -> void $ forkIO $ silent $ do -- terminateProcess pid terminateProcess9 pid ex_code <- waitForProcess pid ex_code `seq` return () Nothing -> return () result = readTVar result_var return Promise {..} -- from http://stackoverflow.com/questions/8820903
2,650
processPromiseCallback callback cmd args input = do pid_var <- newTVarIO Nothing result_var <- newTVarIO Unfinished spawn_ok <- newTVarIO True let silent io = io `catchError` const (return ()) spawn = do -- Check that the process hasn't been spawned before spawn_now <- atomically $ swapTVar spawn_ok False when spawn_now $ do (Just inh, Just outh, Just errh, pid) <- createProcess $ (proc cmd args) { std_in = CreatePipe , std_out = CreatePipe , std_err = CreatePipe } atomically $ writeTVar pid_var (Just pid) unless (null input) $ do silent (hPutStr inh input) silent (hFlush inh) silent (hClose inh) let go = do ex_code <- waitForProcess pid out <- hGetContents outh err <- hGetContents errh a <- evaluate (length out) b <- evaluate (length err) a `seq` b `seq` do silent (hClose outh) silent (hClose errh) let res = ProcessResult { stderr = err , stdout = out , excode = ex_code } atomically $ writeTVar result_var (An res) callback res go `catchError` \ _ -> atomically (writeTVar result_var Cancelled) cancel = do m_pid <- atomically $ do v <- readTVar result_var when (v == Unfinished) (writeTVar result_var Cancelled) writeTVar spawn_ok False swapTVar pid_var Nothing case m_pid of Just pid -> void $ forkIO $ silent $ do -- terminateProcess pid terminateProcess9 pid ex_code <- waitForProcess pid ex_code `seq` return () Nothing -> return () result = readTVar result_var return Promise {..} -- from http://stackoverflow.com/questions/8820903
2,382
true
true
0
28
1,278
636
301
335
null
null
literate-unitb/literate-unitb
src/Documentation/SummaryGen.hs
mit
transient_sum :: Machine -> M () transient_sum m = do let prop = m!.props section kw $ put_all_expr_with' toString (style .= Tagged) "" (M.toAscList $ prop^.transient) where kw = "\\textbf{transient}" toString (Tr _ p evts hint) = [s|%s \\qquad \\text{(%s$%s$%s)}|] p' evts' sub'' lt' where TrHint sub lt = hint evts' :: String evts' = intercalate "," $ L.map ([s|\\ref{%s}|] . pretty) (NE.toList evts) sub' = M.toList sub & traverse._2 %~ (prettyPrint . snd) isNotIdent n (getExpr -> Word (Var n' _)) = n /= n' isNotIdent _ _ = True sub'' :: String sub'' | M.null $ M.filterWithKey isNotIdent $ M.map snd sub = "" | otherwise = [s|: [%s]|] (intercalate ", " $ L.map asgnString sub') asgnString (v,e) = [s|%s := %s'~|~%s|] (render v) (render v) e lt' :: String lt' = maybe "" ([s|, with \\eqref{%s}|] . pretty) lt p' = prettyPrint p
1,187
transient_sum :: Machine -> M () transient_sum m = do let prop = m!.props section kw $ put_all_expr_with' toString (style .= Tagged) "" (M.toAscList $ prop^.transient) where kw = "\\textbf{transient}" toString (Tr _ p evts hint) = [s|%s \\qquad \\text{(%s$%s$%s)}|] p' evts' sub'' lt' where TrHint sub lt = hint evts' :: String evts' = intercalate "," $ L.map ([s|\\ref{%s}|] . pretty) (NE.toList evts) sub' = M.toList sub & traverse._2 %~ (prettyPrint . snd) isNotIdent n (getExpr -> Word (Var n' _)) = n /= n' isNotIdent _ _ = True sub'' :: String sub'' | M.null $ M.filterWithKey isNotIdent $ M.map snd sub = "" | otherwise = [s|: [%s]|] (intercalate ", " $ L.map asgnString sub') asgnString (v,e) = [s|%s := %s'~|~%s|] (render v) (render v) e lt' :: String lt' = maybe "" ([s|, with \\eqref{%s}|] . pretty) lt p' = prettyPrint p
1,187
transient_sum m = do let prop = m!.props section kw $ put_all_expr_with' toString (style .= Tagged) "" (M.toAscList $ prop^.transient) where kw = "\\textbf{transient}" toString (Tr _ p evts hint) = [s|%s \\qquad \\text{(%s$%s$%s)}|] p' evts' sub'' lt' where TrHint sub lt = hint evts' :: String evts' = intercalate "," $ L.map ([s|\\ref{%s}|] . pretty) (NE.toList evts) sub' = M.toList sub & traverse._2 %~ (prettyPrint . snd) isNotIdent n (getExpr -> Word (Var n' _)) = n /= n' isNotIdent _ _ = True sub'' :: String sub'' | M.null $ M.filterWithKey isNotIdent $ M.map snd sub = "" | otherwise = [s|: [%s]|] (intercalate ", " $ L.map asgnString sub') asgnString (v,e) = [s|%s := %s'~|~%s|] (render v) (render v) e lt' :: String lt' = maybe "" ([s|, with \\eqref{%s}|] . pretty) lt p' = prettyPrint p
1,154
false
true
5
12
500
421
204
217
null
null
MasseR/xmonadcontrib
XMonad/Layout/ImageButtonDecoration.hs
bsd-3-clause
menuButton :: [[Bool]] menuButton = convertToBool menuButton'
61
menuButton :: [[Bool]] menuButton = convertToBool menuButton'
61
menuButton = convertToBool menuButton'
38
false
true
0
8
6
26
12
14
null
null
adarqui/ToyBox
haskell/haskell-wiki/functions-not-data-structures/src/TB/Wiki/FunctionsNotDataStructures.hs
gpl-3.0
lookup :: Eq k => k -> FiniteMap k v -> Maybe v lookup k m = m k
64
lookup :: Eq k => k -> FiniteMap k v -> Maybe v lookup k m = m k
64
lookup k m = m k
16
false
true
0
9
18
47
20
27
null
null
anton-dessiatov/stack
src/Stack/Build/ConstructPlan.hs
bsd-3-clause
psDirty PSIndex{} = Nothing
27
psDirty PSIndex{} = Nothing
27
psDirty PSIndex{} = Nothing
27
false
false
1
5
3
16
6
10
null
null
VictorCMiraldo/mmm
MMM/Core/FuncComb.hs
mit
-- (5) Natural isomorphisms ---------------------------------------------------- swap :: (a,b) -> (b,a) swap = split snd fst
125
swap :: (a,b) -> (b,a) swap = split snd fst
43
swap = split snd fst
20
true
true
0
6
15
33
19
14
null
null
forsyde/forsyde-atom
src/ForSyDe/Atom/MoC/DE/Lib.hs
bsd-3-clause
stated12 ns i = MoC.stated12 ns (unit2 i)
41
stated12 ns i = MoC.stated12 ns (unit2 i)
41
stated12 ns i = MoC.stated12 ns (unit2 i)
41
false
false
1
7
7
28
11
17
null
null
mettekou/ghc
compiler/simplCore/SetLevels.hs
bsd-3-clause
add_id :: IdEnv ([Var], LevelledExpr) -> (Var, Var) -> IdEnv ([Var], LevelledExpr) add_id id_env (v, v1) | isTyVar v = delVarEnv id_env v | otherwise = extendVarEnv id_env v ([v1], ASSERT(not (isCoVar v1)) Var v1)
220
add_id :: IdEnv ([Var], LevelledExpr) -> (Var, Var) -> IdEnv ([Var], LevelledExpr) add_id id_env (v, v1) | isTyVar v = delVarEnv id_env v | otherwise = extendVarEnv id_env v ([v1], ASSERT(not (isCoVar v1)) Var v1)
220
add_id id_env (v, v1) | isTyVar v = delVarEnv id_env v | otherwise = extendVarEnv id_env v ([v1], ASSERT(not (isCoVar v1)) Var v1)
137
false
true
1
11
41
116
61
55
null
null
bacchanalia/KitchenSink
KitchenSink/Qualified.hs
gpl-3.0
-- |'BC.hGet' bc_hGet = BC.hGet
31
bc_hGet = BC.hGet
17
bc_hGet = BC.hGet
17
true
false
0
5
4
9
5
4
null
null
bagl/takusen-oracle
Database/Test/Enumerator.hs
bsd-3-clause
iterCursor :: (Monad m) => Int -> IterAct m [Int] iterCursor i acc = result $ i:acc
84
iterCursor :: (Monad m) => Int -> IterAct m [Int] iterCursor i acc = result $ i:acc
83
iterCursor i acc = result $ i:acc
33
false
true
2
9
17
50
24
26
null
null
dcreager/cabal
Distribution/Version.hs
bsd-3-clause
-- | The empty version range, that is a version range containing no versions. -- -- This can be constructed using any unsatisfiable version range expression, -- for example @> 1 && < 1@. -- -- > withinRange v anyVersion = False -- noVersion :: VersionRange noVersion = IntersectVersionRanges (LaterVersion v) (EarlierVersion v) where v = Version [1] [] -- | The version range @== v@ -- -- > withinRange v' (thisVersion v) = v' == v --
437
noVersion :: VersionRange noVersion = IntersectVersionRanges (LaterVersion v) (EarlierVersion v) where v = Version [1] [] -- | The version range @== v@ -- -- > withinRange v' (thisVersion v) = v' == v --
206
noVersion = IntersectVersionRanges (LaterVersion v) (EarlierVersion v) where v = Version [1] [] -- | The version range @== v@ -- -- > withinRange v' (thisVersion v) = v' == v --
180
true
true
0
7
80
57
34
23
null
null
acowley/ghc
compiler/utils/Pretty.hs
bsd-3-clause
quote p = char '\'' <> p
31
quote p = char '\'' <> p
31
quote p = char '\'' <> p
31
false
false
0
6
13
16
7
9
null
null
Fuuzetsu/haddock
haddock-api/src/Haddock/Options.hs
bsd-2-clause
optTitle :: [Flag] -> Maybe String optTitle flags = case [str | Flag_Heading str <- flags] of [] -> Nothing (t:_) -> Just t
133
optTitle :: [Flag] -> Maybe String optTitle flags = case [str | Flag_Heading str <- flags] of [] -> Nothing (t:_) -> Just t
133
optTitle flags = case [str | Flag_Heading str <- flags] of [] -> Nothing (t:_) -> Just t
98
false
true
4
9
33
66
33
33
null
null
ucsd-progsys/nanomaly
src/NanoML/Gen.hs
bsd-3-clause
oneof xs = getRandomR (0, length xs - 1) >>= (xs !!)
52
oneof xs = getRandomR (0, length xs - 1) >>= (xs !!)
52
oneof xs = getRandomR (0, length xs - 1) >>= (xs !!)
52
false
false
0
9
11
33
17
16
null
null
ezyang/ghc
testsuite/tests/typecheck/should_run/T10284.hs
bsd-3-clause
:: Int a = 'a'
14
:: Int a = 'a'
14
:: Int a = 'a'
14
false
false
0
6
4
15
6
9
null
null
ganeti-github-testing/ganeti-test-1
src/Ganeti/Query/Common.hs
bsd-2-clause
-- | Helper to declare a result from 'ErrorResult Maybe'. This version -- should be used if an error signals there was no data and at the same -- time when we have optional fields that may not be setted (i.e. we -- want to return a 'RSUnavail' in case of 'Nothing'). rsErrorMaybeUnavail :: (JSON a) => ErrorResult (Maybe a) -> ResultEntry rsErrorMaybeUnavail res = case res of Ok x -> rsMaybeUnavail x Bad _ -> rsNoData -- | Helper for unknown field result.
469
rsErrorMaybeUnavail :: (JSON a) => ErrorResult (Maybe a) -> ResultEntry rsErrorMaybeUnavail res = case res of Ok x -> rsMaybeUnavail x Bad _ -> rsNoData -- | Helper for unknown field result.
202
rsErrorMaybeUnavail res = case res of Ok x -> rsMaybeUnavail x Bad _ -> rsNoData -- | Helper for unknown field result.
130
true
true
3
9
95
64
34
30
null
null
urbanslug/ghc
compiler/codeGen/StgCmmProf.hs
bsd-3-clause
zero :: DynFlags -> CmmLit zero dflags = mkIntCLit dflags 0
59
zero :: DynFlags -> CmmLit zero dflags = mkIntCLit dflags 0
59
zero dflags = mkIntCLit dflags 0
32
false
true
0
7
10
29
12
17
null
null
JamieBeverley/InnerEar
src/InnerEar/Types/User.hs
gpl-3.0
canSeeUserList (Just Manager) = True
36
canSeeUserList (Just Manager) = True
36
canSeeUserList (Just Manager) = True
36
false
false
0
6
4
16
7
9
null
null
anton-k/sharc-timbre
src/Sharc/Instruments/Clarinet.hs
bsd-3-clause
note13 :: Note note13 = Note (Pitch 311.127 51 "d#4") 14 (Range (NoteRange (NoteRangeAmplitude 9956.06 32 0.64) (NoteRangeHarmonicFreq 1 311.12)) (NoteRange (NoteRangeAmplitude 1555.63 5 1477.0) (NoteRangeHarmonicFreq 32 9956.06))) [Harmonic 1 0.693 1260.06 ,Harmonic 2 (-1.416) 72.5 ,Harmonic 3 (-1.136) 762.25 ,Harmonic 4 2.809 272.77 ,Harmonic 5 1.488 1477.0 ,Harmonic 6 (-2.88) 238.59 ,Harmonic 7 2.723 443.13 ,Harmonic 8 (-2.857) 210.17 ,Harmonic 9 (-0.489) 103.95 ,Harmonic 10 (-0.883) 296.26 ,Harmonic 11 (-1.027) 164.18 ,Harmonic 12 1.418 420.65 ,Harmonic 13 1.931 89.51 ,Harmonic 14 2.177 159.16 ,Harmonic 15 (-2.144) 149.33 ,Harmonic 16 (-1.929) 28.43 ,Harmonic 17 7.8e-2 86.96 ,Harmonic 18 0.935 28.24 ,Harmonic 19 1.762 66.56 ,Harmonic 20 2.871 36.75 ,Harmonic 21 1.576 4.53 ,Harmonic 22 (-1.046) 12.51 ,Harmonic 23 (-0.965) 5.13 ,Harmonic 24 2.452 1.15 ,Harmonic 25 (-0.476) 4.09 ,Harmonic 26 0.512 4.04 ,Harmonic 27 3.111 4.77 ,Harmonic 28 1.683 1.78 ,Harmonic 29 (-3.067) 3.32 ,Harmonic 30 (-0.887) 4.52 ,Harmonic 31 (-3.012) 1.52 ,Harmonic 32 (-2.956) 0.64]
1,277
note13 :: Note note13 = Note (Pitch 311.127 51 "d#4") 14 (Range (NoteRange (NoteRangeAmplitude 9956.06 32 0.64) (NoteRangeHarmonicFreq 1 311.12)) (NoteRange (NoteRangeAmplitude 1555.63 5 1477.0) (NoteRangeHarmonicFreq 32 9956.06))) [Harmonic 1 0.693 1260.06 ,Harmonic 2 (-1.416) 72.5 ,Harmonic 3 (-1.136) 762.25 ,Harmonic 4 2.809 272.77 ,Harmonic 5 1.488 1477.0 ,Harmonic 6 (-2.88) 238.59 ,Harmonic 7 2.723 443.13 ,Harmonic 8 (-2.857) 210.17 ,Harmonic 9 (-0.489) 103.95 ,Harmonic 10 (-0.883) 296.26 ,Harmonic 11 (-1.027) 164.18 ,Harmonic 12 1.418 420.65 ,Harmonic 13 1.931 89.51 ,Harmonic 14 2.177 159.16 ,Harmonic 15 (-2.144) 149.33 ,Harmonic 16 (-1.929) 28.43 ,Harmonic 17 7.8e-2 86.96 ,Harmonic 18 0.935 28.24 ,Harmonic 19 1.762 66.56 ,Harmonic 20 2.871 36.75 ,Harmonic 21 1.576 4.53 ,Harmonic 22 (-1.046) 12.51 ,Harmonic 23 (-0.965) 5.13 ,Harmonic 24 2.452 1.15 ,Harmonic 25 (-0.476) 4.09 ,Harmonic 26 0.512 4.04 ,Harmonic 27 3.111 4.77 ,Harmonic 28 1.683 1.78 ,Harmonic 29 (-3.067) 3.32 ,Harmonic 30 (-0.887) 4.52 ,Harmonic 31 (-3.012) 1.52 ,Harmonic 32 (-2.956) 0.64]
1,277
note13 = Note (Pitch 311.127 51 "d#4") 14 (Range (NoteRange (NoteRangeAmplitude 9956.06 32 0.64) (NoteRangeHarmonicFreq 1 311.12)) (NoteRange (NoteRangeAmplitude 1555.63 5 1477.0) (NoteRangeHarmonicFreq 32 9956.06))) [Harmonic 1 0.693 1260.06 ,Harmonic 2 (-1.416) 72.5 ,Harmonic 3 (-1.136) 762.25 ,Harmonic 4 2.809 272.77 ,Harmonic 5 1.488 1477.0 ,Harmonic 6 (-2.88) 238.59 ,Harmonic 7 2.723 443.13 ,Harmonic 8 (-2.857) 210.17 ,Harmonic 9 (-0.489) 103.95 ,Harmonic 10 (-0.883) 296.26 ,Harmonic 11 (-1.027) 164.18 ,Harmonic 12 1.418 420.65 ,Harmonic 13 1.931 89.51 ,Harmonic 14 2.177 159.16 ,Harmonic 15 (-2.144) 149.33 ,Harmonic 16 (-1.929) 28.43 ,Harmonic 17 7.8e-2 86.96 ,Harmonic 18 0.935 28.24 ,Harmonic 19 1.762 66.56 ,Harmonic 20 2.871 36.75 ,Harmonic 21 1.576 4.53 ,Harmonic 22 (-1.046) 12.51 ,Harmonic 23 (-0.965) 5.13 ,Harmonic 24 2.452 1.15 ,Harmonic 25 (-0.476) 4.09 ,Harmonic 26 0.512 4.04 ,Harmonic 27 3.111 4.77 ,Harmonic 28 1.683 1.78 ,Harmonic 29 (-3.067) 3.32 ,Harmonic 30 (-0.887) 4.52 ,Harmonic 31 (-3.012) 1.52 ,Harmonic 32 (-2.956) 0.64]
1,262
false
true
0
11
359
490
253
237
null
null
AlexeyRaga/eta
compiler/ETA/Main/DynFlags.hs
bsd-3-clause
checkTemplateHaskellOk :: TurnOnFlag -> DynP () -- TODO: #ifdef GHCI checkTemplateHaskellOk _ = getCurLoc >>= \l -> upd (\d -> d { thOnLoc = l })
147
checkTemplateHaskellOk :: TurnOnFlag -> DynP () checkTemplateHaskellOk _ = getCurLoc >>= \l -> upd (\d -> d { thOnLoc = l })
126
checkTemplateHaskellOk _ = getCurLoc >>= \l -> upd (\d -> d { thOnLoc = l })
78
true
true
2
10
27
58
30
28
null
null
ghcjs/ghcjs
src/Compiler/GhcjsPlatform.hs
mit
-- | configure the GHC API for building 32 bit JavaScript code setGhcjsPlatform :: GhcjsSettings -> GhcjsEnv -> [FilePath] -- ^ JS objects for linking against -> FilePath -- ^ GHCJS base dir, usually "~/.ghcjs/platform-version/ghcjs" -> DynFlags -> DynFlags setGhcjsPlatform set js_env js_objs basePath df = addPlatformDefines basePath $ setDfOpts $ installGhcjsHooks js_env set js_objs $ installDriverHooks set js_env $ df { targetPlatform = ghcjsPlatform , platformConstants = ghcjsPlatformConstants , ghcNameVersion = GhcNameVersion "ghcjs" Info.getFullCompilerVersion } -- settings = settings' } where -- settings' = (settings df) { sTargetPlatform = ghcjsPlatform -- , sPlatformConstants = ghcjsPlatformConstants -- #if __GLASGOW_HASKELL__ >= 709 -- , sProgramName = "ghcjs" -- , sProjectVersion = Info.getFullCompilerVersion -- #endif -- } ghcjsPlatform = (targetPlatform df) { platformMini = PlatformMini ArchJavaScript OSUnknown -- }platformArch = ArchJavaScript , platformWordSize = PW4 , platformIsCrossCompiling = True } ghcjsPlatformConstants = (platformConstants df) { pc_WORD_SIZE = 4 , pc_DOUBLE_SIZE = 8 , pc_CINT_SIZE = 4 , pc_CLONG_SIZE = 4 , pc_CLONG_LONG_SIZE = 8 , pc_WORDS_BIGENDIAN = False }
1,632
setGhcjsPlatform :: GhcjsSettings -> GhcjsEnv -> [FilePath] -- ^ JS objects for linking against -> FilePath -- ^ GHCJS base dir, usually "~/.ghcjs/platform-version/ghcjs" -> DynFlags -> DynFlags setGhcjsPlatform set js_env js_objs basePath df = addPlatformDefines basePath $ setDfOpts $ installGhcjsHooks js_env set js_objs $ installDriverHooks set js_env $ df { targetPlatform = ghcjsPlatform , platformConstants = ghcjsPlatformConstants , ghcNameVersion = GhcNameVersion "ghcjs" Info.getFullCompilerVersion } -- settings = settings' } where -- settings' = (settings df) { sTargetPlatform = ghcjsPlatform -- , sPlatformConstants = ghcjsPlatformConstants -- #if __GLASGOW_HASKELL__ >= 709 -- , sProgramName = "ghcjs" -- , sProjectVersion = Info.getFullCompilerVersion -- #endif -- } ghcjsPlatform = (targetPlatform df) { platformMini = PlatformMini ArchJavaScript OSUnknown -- }platformArch = ArchJavaScript , platformWordSize = PW4 , platformIsCrossCompiling = True } ghcjsPlatformConstants = (platformConstants df) { pc_WORD_SIZE = 4 , pc_DOUBLE_SIZE = 8 , pc_CINT_SIZE = 4 , pc_CLONG_SIZE = 4 , pc_CLONG_LONG_SIZE = 8 , pc_WORDS_BIGENDIAN = False }
1,569
setGhcjsPlatform set js_env js_objs basePath df = addPlatformDefines basePath $ setDfOpts $ installGhcjsHooks js_env set js_objs $ installDriverHooks set js_env $ df { targetPlatform = ghcjsPlatform , platformConstants = ghcjsPlatformConstants , ghcNameVersion = GhcNameVersion "ghcjs" Info.getFullCompilerVersion } -- settings = settings' } where -- settings' = (settings df) { sTargetPlatform = ghcjsPlatform -- , sPlatformConstants = ghcjsPlatformConstants -- #if __GLASGOW_HASKELL__ >= 709 -- , sProgramName = "ghcjs" -- , sProjectVersion = Info.getFullCompilerVersion -- #endif -- } ghcjsPlatform = (targetPlatform df) { platformMini = PlatformMini ArchJavaScript OSUnknown -- }platformArch = ArchJavaScript , platformWordSize = PW4 , platformIsCrossCompiling = True } ghcjsPlatformConstants = (platformConstants df) { pc_WORD_SIZE = 4 , pc_DOUBLE_SIZE = 8 , pc_CINT_SIZE = 4 , pc_CLONG_SIZE = 4 , pc_CLONG_LONG_SIZE = 8 , pc_WORDS_BIGENDIAN = False }
1,288
true
true
8
9
584
214
120
94
null
null
ktvoelker/helium
src/He/Error.hs
gpl-3.0
vSepBy :: Doc -> Doc -> Doc -> Doc vSepBy sep above below = above $+$ sep $+$ below
83
vSepBy :: Doc -> Doc -> Doc -> Doc vSepBy sep above below = above $+$ sep $+$ below
83
vSepBy sep above below = above $+$ sep $+$ below
48
false
true
0
7
18
38
19
19
null
null
matusfi/euler
haskell/4.hs
unlicense
-- Set.toDescList converts the Set to a list in descending order -- This is faster than sorting the list afterwards main :: IO () main = print . find isPalindrome . Set.toDescList $ products 999 999
198
main :: IO () main = print . find isPalindrome . Set.toDescList $ products 999 999
82
main = print . find isPalindrome . Set.toDescList $ products 999 999
68
true
true
1
7
35
46
21
25
null
null
awagner83/powermap
src/Data/Wikipedia/Request.hs
bsd-3-clause
prop x = simpleRequest ("prop", x)
41
prop x = simpleRequest ("prop", x)
41
prop x = simpleRequest ("prop", x)
41
false
false
1
6
12
21
9
12
null
null
chpatrick/language-glsl
Language/GLSL/Parser.hs
bsd-3-clause
assignmentTable :: [[Operator Char S Expr]] assignmentTable = [ [infixRight "=" Equal] , [infixRight "+=" AddAssign] , [infixRight "-=" SubAssign] , [infixRight "*=" MulAssign] , [infixRight "/=" DivAssign] , [infixRight "%=" ModAssign] , [infixRight "<<=" LeftAssign] , [infixRight ">>=" RightAssign] , [infixRight "&=" AndAssign] , [infixRight "^=" XorAssign] , [infixRight "|=" OrAssign] ]
416
assignmentTable :: [[Operator Char S Expr]] assignmentTable = [ [infixRight "=" Equal] , [infixRight "+=" AddAssign] , [infixRight "-=" SubAssign] , [infixRight "*=" MulAssign] , [infixRight "/=" DivAssign] , [infixRight "%=" ModAssign] , [infixRight "<<=" LeftAssign] , [infixRight ">>=" RightAssign] , [infixRight "&=" AndAssign] , [infixRight "^=" XorAssign] , [infixRight "|=" OrAssign] ]
416
assignmentTable = [ [infixRight "=" Equal] , [infixRight "+=" AddAssign] , [infixRight "-=" SubAssign] , [infixRight "*=" MulAssign] , [infixRight "/=" DivAssign] , [infixRight "%=" ModAssign] , [infixRight "<<=" LeftAssign] , [infixRight ">>=" RightAssign] , [infixRight "&=" AndAssign] , [infixRight "^=" XorAssign] , [infixRight "|=" OrAssign] ]
372
false
true
0
7
76
145
79
66
null
null
haskell-lisp/historic-lisk
src/Language/Lisk/Parser.hs
bsd-3-clause
liskPApp = fmap PParen $ parens $ do op <- liskQName -- TODO: Restrict to constructor args <- many1 $ spaces1 *> liskPat return $ PApp op $ args
150
liskPApp = fmap PParen $ parens $ do op <- liskQName -- TODO: Restrict to constructor args <- many1 $ spaces1 *> liskPat return $ PApp op $ args
150
liskPApp = fmap PParen $ parens $ do op <- liskQName -- TODO: Restrict to constructor args <- many1 $ spaces1 *> liskPat return $ PApp op $ args
150
false
false
0
10
34
54
25
29
null
null
joehillen/aura
src/Bash/Simplify.hs
gpl-3.0
replaceStr (NoQuote s) = NoQuote `fmap` replaceStr' s
55
replaceStr (NoQuote s) = NoQuote `fmap` replaceStr' s
55
replaceStr (NoQuote s) = NoQuote `fmap` replaceStr' s
55
false
false
0
7
9
24
12
12
null
null
jgoerzen/photoset
Data/PhotoSet/Gallery.hs
gpl-2.0
createGR :: String -> GalleryRemote createGR = GalleryRemote
60
createGR :: String -> GalleryRemote createGR = GalleryRemote
60
createGR = GalleryRemote
24
false
true
0
5
7
15
8
7
null
null
kRITZCREEK/dickminer
src/Dickmine/Parse.hs
bsd-3-clause
parseLogEntry' x = case parseOldLogEntry x of Just l -> Just l Nothing -> parseLogEntry x
93
parseLogEntry' x = case parseOldLogEntry x of Just l -> Just l Nothing -> parseLogEntry x
93
parseLogEntry' x = case parseOldLogEntry x of Just l -> Just l Nothing -> parseLogEntry x
93
false
false
1
8
19
40
16
24
null
null
bergmark/wl-pprint
Text/PrettyPrint/Leijen.hs
bsd-2-clause
-- | The document @dot@ contains a single dot, \".\". dot :: Doc dot = char '.'
91
dot :: Doc dot = char '.'
37
dot = char '.'
26
true
true
0
6
28
21
9
12
null
null
filib/gh-delta
src/Lib.hs
bsd-3-clause
-- | Setter for owner. setDeltaParamsOwner :: String -> DeltaParams -> DeltaParams setDeltaParamsOwner x params = params { deltaParamsOwner = fromString x }
156
setDeltaParamsOwner :: String -> DeltaParams -> DeltaParams setDeltaParamsOwner x params = params { deltaParamsOwner = fromString x }
133
setDeltaParamsOwner x params = params { deltaParamsOwner = fromString x }
73
true
true
0
7
22
36
19
17
null
null
hguenther/smtlib2
Language/SMTLib2/Internals/Expression.hs
gpl-3.0
expressionType _ _ _ _ _ _ (Const v) = return $ valueType v
59
expressionType _ _ _ _ _ _ (Const v) = return $ valueType v
59
expressionType _ _ _ _ _ _ (Const v) = return $ valueType v
59
false
false
1
6
13
30
15
15
null
null
uuhan/Idris-dev
src/Idris/Core/TT.hs
bsd-3-clause
-- | Get the largest span containing the two FCs spanFC :: FC -> FC -> FC spanFC (FC f start end) (FC f' start' end') | f == f' = FC f (minLocation start start') (maxLocation end end') | otherwise = NoFC where minLocation (l, c) (l', c') = case compare l l' of LT -> (l, c) EQ -> (l, min c c') GT -> (l', c') maxLocation (l, c) (l', c') = case compare l l' of LT -> (l', c') EQ -> (l, max c c') GT -> (l, c)
517
spanFC :: FC -> FC -> FC spanFC (FC f start end) (FC f' start' end') | f == f' = FC f (minLocation start start') (maxLocation end end') | otherwise = NoFC where minLocation (l, c) (l', c') = case compare l l' of LT -> (l, c) EQ -> (l, min c c') GT -> (l', c') maxLocation (l, c) (l', c') = case compare l l' of LT -> (l', c') EQ -> (l, max c c') GT -> (l, c)
468
spanFC (FC f start end) (FC f' start' end') | f == f' = FC f (minLocation start start') (maxLocation end end') | otherwise = NoFC where minLocation (l, c) (l', c') = case compare l l' of LT -> (l, c) EQ -> (l, min c c') GT -> (l', c') maxLocation (l, c) (l', c') = case compare l l' of LT -> (l', c') EQ -> (l, max c c') GT -> (l, c)
443
true
true
1
11
203
237
124
113
null
null
Skyfold/postgrest
test/Main.hs
mit
main :: IO () main = do testDbConn <- getEnvVarWithDefault "POSTGREST_TEST_CONNECTION" "postgres://postgrest_test@localhost/postgrest_test" setupDb testDbConn pool <- P.acquire (3, 10, toS testDbConn) -- ask for the OS time at most once per second getTime <- mkAutoUpdate defaultUpdateSettings { updateAction = getPOSIXTime } result <- P.use pool $ getDbStructure "test" refDbStructure <- newIORef $ Just $ either (panic.show) id result let withApp = return $ postgrest (testCfg testDbConn) refDbStructure pool getTime $ pure () ltdApp = return $ postgrest (testLtdRowsCfg testDbConn) refDbStructure pool getTime $ pure () unicodeApp = return $ postgrest (testUnicodeCfg testDbConn) refDbStructure pool getTime $ pure () proxyApp = return $ postgrest (testProxyCfg testDbConn) refDbStructure pool getTime $ pure () noJwtApp = return $ postgrest (testCfgNoJWT testDbConn) refDbStructure pool getTime $ pure () binaryJwtApp = return $ postgrest (testCfgBinaryJWT testDbConn) refDbStructure pool getTime $ pure () let reset = resetDb testDbConn hspec $ do mapM_ (beforeAll_ reset . before withApp) specs -- this test runs with a different server flag beforeAll_ reset . before ltdApp $ describe "Feature.QueryLimitedSpec" Feature.QueryLimitedSpec.spec -- this test runs with a different schema beforeAll_ reset . before unicodeApp $ describe "Feature.UnicodeSpec" Feature.UnicodeSpec.spec -- this test runs with a proxy beforeAll_ reset . before proxyApp $ describe "Feature.ProxySpec" Feature.ProxySpec.spec -- this test runs without a JWT secret beforeAll_ reset . before noJwtApp $ describe "Feature.NoJwtSpec" Feature.NoJwtSpec.spec -- this test runs with a binary JWT secret beforeAll_ reset . before binaryJwtApp $ describe "Feature.BinaryJwtSecretSpec" Feature.BinaryJwtSecretSpec.spec where specs = map (uncurry describe) [ ("Feature.AuthSpec" , Feature.AuthSpec.spec) , ("Feature.ConcurrentSpec" , Feature.ConcurrentSpec.spec) , ("Feature.CorsSpec" , Feature.CorsSpec.spec) , ("Feature.DeleteSpec" , Feature.DeleteSpec.spec) , ("Feature.InsertSpec" , Feature.InsertSpec.spec) , ("Feature.QuerySpec" , Feature.QuerySpec.spec) , ("Feature.RangeSpec" , Feature.RangeSpec.spec) , ("Feature.SingularSpec" , Feature.SingularSpec.spec) , ("Feature.StructureSpec" , Feature.StructureSpec.spec) , ("Feature.AndOrParamsSpec" , Feature.AndOrParamsSpec.spec) ]
2,635
main :: IO () main = do testDbConn <- getEnvVarWithDefault "POSTGREST_TEST_CONNECTION" "postgres://postgrest_test@localhost/postgrest_test" setupDb testDbConn pool <- P.acquire (3, 10, toS testDbConn) -- ask for the OS time at most once per second getTime <- mkAutoUpdate defaultUpdateSettings { updateAction = getPOSIXTime } result <- P.use pool $ getDbStructure "test" refDbStructure <- newIORef $ Just $ either (panic.show) id result let withApp = return $ postgrest (testCfg testDbConn) refDbStructure pool getTime $ pure () ltdApp = return $ postgrest (testLtdRowsCfg testDbConn) refDbStructure pool getTime $ pure () unicodeApp = return $ postgrest (testUnicodeCfg testDbConn) refDbStructure pool getTime $ pure () proxyApp = return $ postgrest (testProxyCfg testDbConn) refDbStructure pool getTime $ pure () noJwtApp = return $ postgrest (testCfgNoJWT testDbConn) refDbStructure pool getTime $ pure () binaryJwtApp = return $ postgrest (testCfgBinaryJWT testDbConn) refDbStructure pool getTime $ pure () let reset = resetDb testDbConn hspec $ do mapM_ (beforeAll_ reset . before withApp) specs -- this test runs with a different server flag beforeAll_ reset . before ltdApp $ describe "Feature.QueryLimitedSpec" Feature.QueryLimitedSpec.spec -- this test runs with a different schema beforeAll_ reset . before unicodeApp $ describe "Feature.UnicodeSpec" Feature.UnicodeSpec.spec -- this test runs with a proxy beforeAll_ reset . before proxyApp $ describe "Feature.ProxySpec" Feature.ProxySpec.spec -- this test runs without a JWT secret beforeAll_ reset . before noJwtApp $ describe "Feature.NoJwtSpec" Feature.NoJwtSpec.spec -- this test runs with a binary JWT secret beforeAll_ reset . before binaryJwtApp $ describe "Feature.BinaryJwtSecretSpec" Feature.BinaryJwtSecretSpec.spec where specs = map (uncurry describe) [ ("Feature.AuthSpec" , Feature.AuthSpec.spec) , ("Feature.ConcurrentSpec" , Feature.ConcurrentSpec.spec) , ("Feature.CorsSpec" , Feature.CorsSpec.spec) , ("Feature.DeleteSpec" , Feature.DeleteSpec.spec) , ("Feature.InsertSpec" , Feature.InsertSpec.spec) , ("Feature.QuerySpec" , Feature.QuerySpec.spec) , ("Feature.RangeSpec" , Feature.RangeSpec.spec) , ("Feature.SingularSpec" , Feature.SingularSpec.spec) , ("Feature.StructureSpec" , Feature.StructureSpec.spec) , ("Feature.AndOrParamsSpec" , Feature.AndOrParamsSpec.spec) ]
2,635
main = do testDbConn <- getEnvVarWithDefault "POSTGREST_TEST_CONNECTION" "postgres://postgrest_test@localhost/postgrest_test" setupDb testDbConn pool <- P.acquire (3, 10, toS testDbConn) -- ask for the OS time at most once per second getTime <- mkAutoUpdate defaultUpdateSettings { updateAction = getPOSIXTime } result <- P.use pool $ getDbStructure "test" refDbStructure <- newIORef $ Just $ either (panic.show) id result let withApp = return $ postgrest (testCfg testDbConn) refDbStructure pool getTime $ pure () ltdApp = return $ postgrest (testLtdRowsCfg testDbConn) refDbStructure pool getTime $ pure () unicodeApp = return $ postgrest (testUnicodeCfg testDbConn) refDbStructure pool getTime $ pure () proxyApp = return $ postgrest (testProxyCfg testDbConn) refDbStructure pool getTime $ pure () noJwtApp = return $ postgrest (testCfgNoJWT testDbConn) refDbStructure pool getTime $ pure () binaryJwtApp = return $ postgrest (testCfgBinaryJWT testDbConn) refDbStructure pool getTime $ pure () let reset = resetDb testDbConn hspec $ do mapM_ (beforeAll_ reset . before withApp) specs -- this test runs with a different server flag beforeAll_ reset . before ltdApp $ describe "Feature.QueryLimitedSpec" Feature.QueryLimitedSpec.spec -- this test runs with a different schema beforeAll_ reset . before unicodeApp $ describe "Feature.UnicodeSpec" Feature.UnicodeSpec.spec -- this test runs with a proxy beforeAll_ reset . before proxyApp $ describe "Feature.ProxySpec" Feature.ProxySpec.spec -- this test runs without a JWT secret beforeAll_ reset . before noJwtApp $ describe "Feature.NoJwtSpec" Feature.NoJwtSpec.spec -- this test runs with a binary JWT secret beforeAll_ reset . before binaryJwtApp $ describe "Feature.BinaryJwtSecretSpec" Feature.BinaryJwtSecretSpec.spec where specs = map (uncurry describe) [ ("Feature.AuthSpec" , Feature.AuthSpec.spec) , ("Feature.ConcurrentSpec" , Feature.ConcurrentSpec.spec) , ("Feature.CorsSpec" , Feature.CorsSpec.spec) , ("Feature.DeleteSpec" , Feature.DeleteSpec.spec) , ("Feature.InsertSpec" , Feature.InsertSpec.spec) , ("Feature.QuerySpec" , Feature.QuerySpec.spec) , ("Feature.RangeSpec" , Feature.RangeSpec.spec) , ("Feature.SingularSpec" , Feature.SingularSpec.spec) , ("Feature.StructureSpec" , Feature.StructureSpec.spec) , ("Feature.AndOrParamsSpec" , Feature.AndOrParamsSpec.spec) ]
2,621
false
true
0
14
565
634
321
313
null
null
ezyang/ghc
compiler/codeGen/CgUtils.hs
bsd-3-clause
baseRegOffset dflags (FloatReg 1) = oFFSET_StgRegTable_rF1 dflags
72
baseRegOffset dflags (FloatReg 1) = oFFSET_StgRegTable_rF1 dflags
72
baseRegOffset dflags (FloatReg 1) = oFFSET_StgRegTable_rF1 dflags
72
false
false
0
7
13
20
9
11
null
null
ezyang/ghc
compiler/nativeGen/Dwarf/Types.hs
bsd-3-clause
-- | Assembly for a two-byte constant integer pprHalf :: Word16 -> SDoc pprHalf x = text "\t.short" <+> ppr (fromIntegral x :: Word)
132
pprHalf :: Word16 -> SDoc pprHalf x = text "\t.short" <+> ppr (fromIntegral x :: Word)
86
pprHalf x = text "\t.short" <+> ppr (fromIntegral x :: Word)
60
true
true
0
8
23
38
19
19
null
null
urbanslug/ghc
libraries/template-haskell/Language/Haskell/TH/Lib.hs
bsd-3-clause
kindedTV :: Name -> Kind -> TyVarBndr kindedTV = KindedTV
57
kindedTV :: Name -> Kind -> TyVarBndr kindedTV = KindedTV
57
kindedTV = KindedTV
19
false
true
0
6
9
19
10
9
null
null
pepincho/Functional-Programming
exercise-2.hs
mit
countOccurences x [] = 0
24
countOccurences x [] = 0
24
countOccurences x [] = 0
24
false
false
1
5
4
18
6
12
null
null
rueshyna/gogol
gogol-analytics/gen/Network/Google/Resource/Analytics/Data/Mcf/Get.hs
mpl-2.0
-- | A comma-separated list of Multi-Channel Funnels metrics. E.g., -- \'mcf:totalConversions,mcf:totalConversionValue\'. At least one metric -- must be specified. dmgMetrics :: Lens' DataMcfGet Text dmgMetrics = lens _dmgMetrics (\ s a -> s{_dmgMetrics = a})
261
dmgMetrics :: Lens' DataMcfGet Text dmgMetrics = lens _dmgMetrics (\ s a -> s{_dmgMetrics = a})
97
dmgMetrics = lens _dmgMetrics (\ s a -> s{_dmgMetrics = a})
61
true
true
0
9
37
44
24
20
null
null
brendanhay/gogol
gogol-sheets/gen/Network/Google/Sheets/Types/Product.hs
mpl-2.0
-- | Deletes a protected range. reqDeleteProtectedRange :: Lens' Request' (Maybe DeleteProtectedRangeRequest) reqDeleteProtectedRange = lens _reqDeleteProtectedRange (\ s a -> s{_reqDeleteProtectedRange = a})
216
reqDeleteProtectedRange :: Lens' Request' (Maybe DeleteProtectedRangeRequest) reqDeleteProtectedRange = lens _reqDeleteProtectedRange (\ s a -> s{_reqDeleteProtectedRange = a})
184
reqDeleteProtectedRange = lens _reqDeleteProtectedRange (\ s a -> s{_reqDeleteProtectedRange = a})
106
true
true
1
9
30
51
25
26
null
null
sonyandy/tnt
Control/Monad/Code/Opcode.hs
bsd-3-clause
d2i :: Word8 d2i = 0x8e
23
d2i :: Word8 d2i = 0x8e
23
d2i = 0x8e
10
false
true
0
6
5
18
7
11
null
null
haskellbr/hackage-downloads
bin/HackageDownloadsApi.hs
mit
scraperWorkerHandler :: WorkHandler () () (TVar [PackageDownloads]) () scraperWorkerHandler = const $ do liftIO $ putStrLn "Scrapping Hackage..." mpkgDs <- liftIO scrapePackageDownloads case mpkgDs of Just pkgDs -> do st <- getState liftIO $ atomically (writeTVar st pkgDs) return WorkComplete Nothing -> return WorkError
385
scraperWorkerHandler :: WorkHandler () () (TVar [PackageDownloads]) () scraperWorkerHandler = const $ do liftIO $ putStrLn "Scrapping Hackage..." mpkgDs <- liftIO scrapePackageDownloads case mpkgDs of Just pkgDs -> do st <- getState liftIO $ atomically (writeTVar st pkgDs) return WorkComplete Nothing -> return WorkError
385
scraperWorkerHandler = const $ do liftIO $ putStrLn "Scrapping Hackage..." mpkgDs <- liftIO scrapePackageDownloads case mpkgDs of Just pkgDs -> do st <- getState liftIO $ atomically (writeTVar st pkgDs) return WorkComplete Nothing -> return WorkError
314
false
true
0
16
107
115
52
63
null
null
haroldcarr/learn-haskell-coq-ml-etc
haskell/topic/monads/m/src/UseWriter.hs
unlicense
useLInt = do a <- lInt 1; b <- lInt 2; c <- lInt 3; _ <- lInt 0; tell [1] ; return (a+b+c)
92
useLInt = do a <- lInt 1; b <- lInt 2; c <- lInt 3; _ <- lInt 0; tell [1] ; return (a+b+c)
92
useLInt = do a <- lInt 1; b <- lInt 2; c <- lInt 3; _ <- lInt 0; tell [1] ; return (a+b+c)
92
false
false
1
11
25
81
36
45
null
null
matonix/pfds
src/PFDS/Sec9/Ex13.hs
bsd-3-clause
unconsTree :: RList a -> (Tree a, RList a) unconsTree [] = error "Empty"
72
unconsTree :: RList a -> (Tree a, RList a) unconsTree [] = error "Empty"
72
unconsTree [] = error "Empty"
29
false
true
0
9
13
44
19
25
null
null
lostbean/sphermonics
tablegen/Main.hs
gpl-3.0
run :: TableGen -> IO () run TableGen{..} = do maybe (return ()) (genLegendre outdir) gen_legendre maybe (return ()) (genHSHCoeff outdir) gen_hsh_coeff
157
run :: TableGen -> IO () run TableGen{..} = do maybe (return ()) (genLegendre outdir) gen_legendre maybe (return ()) (genHSHCoeff outdir) gen_hsh_coeff
157
run TableGen{..} = do maybe (return ()) (genLegendre outdir) gen_legendre maybe (return ()) (genHSHCoeff outdir) gen_hsh_coeff
132
false
true
0
10
27
77
36
41
null
null
prasmussen/glot-www
Yesod/Auth/Simple.hs
mit
-- Re-encode to regular base64 decodeToken :: Text -> ByteString decodeToken = B64.encode . B64Url.decodeLenient . encodeUtf8
125
decodeToken :: Text -> ByteString decodeToken = B64.encode . B64Url.decodeLenient . encodeUtf8
94
decodeToken = B64.encode . B64Url.decodeLenient . encodeUtf8
60
true
true
0
7
16
28
15
13
null
null
copumpkin/picklers
src/Data/Pickler.hs
bsd-3-clause
-- Should I just use a two-element type? either :: Integral i => Pickler ts l -> Pickler ts r -> Pickler (i ': ts) (Either l r) either (Pickler gl pl) (Pickler gr pr) = Pickler g p where g (0 :> cs) = Left <$> gl cs g (1 :> cs) = Right <$> gr cs p (Left (pl -> (cs, b))) = (0 :> cs, b) p (Right (pr -> (cs, b))) = (1 :> cs, b)
338
either :: Integral i => Pickler ts l -> Pickler ts r -> Pickler (i ': ts) (Either l r) either (Pickler gl pl) (Pickler gr pr) = Pickler g p where g (0 :> cs) = Left <$> gl cs g (1 :> cs) = Right <$> gr cs p (Left (pl -> (cs, b))) = (0 :> cs, b) p (Right (pr -> (cs, b))) = (1 :> cs, b)
297
either (Pickler gl pl) (Pickler gr pr) = Pickler g p where g (0 :> cs) = Left <$> gl cs g (1 :> cs) = Right <$> gr cs p (Left (pl -> (cs, b))) = (0 :> cs, b) p (Right (pr -> (cs, b))) = (1 :> cs, b)
210
true
true
0
10
91
206
106
100
null
null
frenetic-lang/netcore-1.0
src/Frenetic/Slices/Sat.hs
bsd-3-clause
diagnose :: [IO (Maybe String)] -> IO () diagnose cases = mapM_ printResult cases
81
diagnose :: [IO (Maybe String)] -> IO () diagnose cases = mapM_ printResult cases
81
diagnose cases = mapM_ printResult cases
40
false
true
0
9
13
40
19
21
null
null
shlevy/hnix-store
hnix-store-core/tests/NarFormat.hs
mit
-- * For each sample above, feed it into `nix-store --dump`, -- and base64 encode the resulting NAR binary. This lets us -- check our Haskell NAR generator against `nix-store` -- "hi" file turned to a NAR with `nix-store --dump`, Base64 encoded sampleRegularBaseline :: BSL.ByteString sampleRegularBaseline = B64.decodeLenient $ BSL.concat ["DQAAAAAAAABuaXgtYXJjaGl2ZS0xAAAAAQAAAAAAAAAoAAAAAAA" ,"AAAQAAAAAAAAAdHlwZQAAAAAHAAAAAAAAAHJlZ3VsYXIACAAAAA" ,"AAAABjb250ZW50cwMAAAAAAAAAaGkKAAAAAAABAAAAAAAAACkAA" ,"AAAAAAA" ]
528
sampleRegularBaseline :: BSL.ByteString sampleRegularBaseline = B64.decodeLenient $ BSL.concat ["DQAAAAAAAABuaXgtYXJjaGl2ZS0xAAAAAQAAAAAAAAAoAAAAAAA" ,"AAAQAAAAAAAAAdHlwZQAAAAAHAAAAAAAAAHJlZ3VsYXIACAAAAA" ,"AAAABjb250ZW50cwMAAAAAAAAAaGkKAAAAAAABAAAAAAAAACkAA" ,"AAAAAAA" ]
282
sampleRegularBaseline = B64.decodeLenient $ BSL.concat ["DQAAAAAAAABuaXgtYXJjaGl2ZS0xAAAAAQAAAAAAAAAoAAAAAAA" ,"AAAQAAAAAAAAAdHlwZQAAAAAHAAAAAAAAAHJlZ3VsYXIACAAAAA" ,"AAAABjb250ZW50cwMAAAAAAAAAaGkKAAAAAAABAAAAAAAAACkAA" ,"AAAAAAA" ]
242
true
true
2
7
65
47
25
22
null
null
rahulmutt/ghcvm
compiler/Eta/HsSyn/HsBinds.hs
bsd-3-clause
ppr_sig (IdSig id) = pprVarSig [id] (ppr (varType id))
69
ppr_sig (IdSig id) = pprVarSig [id] (ppr (varType id))
69
ppr_sig (IdSig id) = pprVarSig [id] (ppr (varType id))
69
false
false
0
9
23
35
17
18
null
null
quakehead/haskell-scheme
Types.hs
gpl-3.0
showVal (String s) = "\"" ++ s ++ "\""
38
showVal (String s) = "\"" ++ s ++ "\""
38
showVal (String s) = "\"" ++ s ++ "\""
38
false
false
2
6
8
25
11
14
null
null
nightscape/platform
node/src/Unison/Runtime/Multiplex.hs
mit
subscribeTimed :: Serial a => Microseconds -> Channel a -> Multiplex (Multiplex (Maybe a), Multiplex ()) subscribeTimed micros chan = do (fetch, cancel) <- subscribe chan result <- liftIO . atomically $ newEmptyTMVar activity <- liftIO . atomically . newTVar $ False fetch' <- pure $ do void . fork $ do r <- fetch liftIO . atomically $ do putTMVar result (Just r) writeTVar activity True liftIO . atomically $ takeTMVar result watchdog <- do env <- ask l <- logger liftIO . C.forkIO $ loop l activity result (run env cancel) cancel' <- pure $ cancel >> liftIO (C.killThread watchdog) pure (fetch', cancel') where loop logger activity result cancel = do atomically $ writeTVar activity False C.threadDelay micros active <- atomically $ readTVar activity case active of False -> do L.debug logger $ "timed out on " ++ show chan void $ atomically (tryPutTMVar result Nothing) <* cancel L.debug logger $ "cancelled subscription to " ++ show chan True -> do L.trace logger $ "still activity on " ++ show chan loop logger activity result cancel
1,173
subscribeTimed :: Serial a => Microseconds -> Channel a -> Multiplex (Multiplex (Maybe a), Multiplex ()) subscribeTimed micros chan = do (fetch, cancel) <- subscribe chan result <- liftIO . atomically $ newEmptyTMVar activity <- liftIO . atomically . newTVar $ False fetch' <- pure $ do void . fork $ do r <- fetch liftIO . atomically $ do putTMVar result (Just r) writeTVar activity True liftIO . atomically $ takeTMVar result watchdog <- do env <- ask l <- logger liftIO . C.forkIO $ loop l activity result (run env cancel) cancel' <- pure $ cancel >> liftIO (C.killThread watchdog) pure (fetch', cancel') where loop logger activity result cancel = do atomically $ writeTVar activity False C.threadDelay micros active <- atomically $ readTVar activity case active of False -> do L.debug logger $ "timed out on " ++ show chan void $ atomically (tryPutTMVar result Nothing) <* cancel L.debug logger $ "cancelled subscription to " ++ show chan True -> do L.trace logger $ "still activity on " ++ show chan loop logger activity result cancel
1,173
subscribeTimed micros chan = do (fetch, cancel) <- subscribe chan result <- liftIO . atomically $ newEmptyTMVar activity <- liftIO . atomically . newTVar $ False fetch' <- pure $ do void . fork $ do r <- fetch liftIO . atomically $ do putTMVar result (Just r) writeTVar activity True liftIO . atomically $ takeTMVar result watchdog <- do env <- ask l <- logger liftIO . C.forkIO $ loop l activity result (run env cancel) cancel' <- pure $ cancel >> liftIO (C.killThread watchdog) pure (fetch', cancel') where loop logger activity result cancel = do atomically $ writeTVar activity False C.threadDelay micros active <- atomically $ readTVar activity case active of False -> do L.debug logger $ "timed out on " ++ show chan void $ atomically (tryPutTMVar result Nothing) <* cancel L.debug logger $ "cancelled subscription to " ++ show chan True -> do L.trace logger $ "still activity on " ++ show chan loop logger activity result cancel
1,068
false
true
0
19
311
433
195
238
null
null
goldfirere/singletons
singletons-base/src/Data/List/Singletons/Internal/Disambiguation.hs
bsd-3-clause
listtake :: Natural -> [a] -> [a] listtake = undefined
54
listtake :: Natural -> [a] -> [a] listtake = undefined
54
listtake = undefined
20
false
true
0
7
9
25
14
11
null
null
kmilner/tamarin-prover
lib/theory/src/Theory/Model/Rule.hs
gpl-3.0
prettyProtoRuleE :: HighlightDocument d => ProtoRuleE -> d prettyProtoRuleE = prettyNamedRule (kwRuleModulo "E") (const emptyDoc)
129
prettyProtoRuleE :: HighlightDocument d => ProtoRuleE -> d prettyProtoRuleE = prettyNamedRule (kwRuleModulo "E") (const emptyDoc)
129
prettyProtoRuleE = prettyNamedRule (kwRuleModulo "E") (const emptyDoc)
70
false
true
0
7
14
39
19
20
null
null
rzil/honours
LeavittPathAlgebras/Matrix.hs
mit
rank :: (Num a, Eq a) => Matrix a -> Int rank m = nrows m - nullity m
69
rank :: (Num a, Eq a) => Matrix a -> Int rank m = nrows m - nullity m
69
rank m = nrows m - nullity m
28
false
true
0
7
18
46
22
24
null
null
jaiyalas/haha
experiment/v0.hs
mit
cW = \f x -> f x x
20
cW = \f x -> f x x
20
cW = \f x -> f x x
20
false
false
0
6
9
18
9
9
null
null
asr/apia
src/Apia/Options.hs
mit
ithtptp4XOpt name opts = Right opts { optWithtptp4X = name }
61
withtptp4XOpt name opts = Right opts { optWithtptp4X = name }
61
withtptp4XOpt name opts = Right opts { optWithtptp4X = name }
61
false
false
1
6
11
29
12
17
null
null
garrettoreilly/Hunt-The-Wumpus
Player.hs
mit
getAdjRooms :: Player -> Map -> [Int] getAdjRooms p m = connections $ m !! (location p - 1)
91
getAdjRooms :: Player -> Map -> [Int] getAdjRooms p m = connections $ m !! (location p - 1)
91
getAdjRooms p m = connections $ m !! (location p - 1)
53
false
true
0
8
18
45
23
22
null
null
dancor/xiangqiboard
src/xiangqiboard.hs
gpl-2.0
secondsDiff :: TimeDiff -> Double secondsDiff timediff = fromIntegral (getSeco (timediff))
90
secondsDiff :: TimeDiff -> Double secondsDiff timediff = fromIntegral (getSeco (timediff))
90
secondsDiff timediff = fromIntegral (getSeco (timediff))
56
false
true
0
8
10
30
15
15
null
null
Schpin/schpin-chassis
schpin_robot_lib/src/Data/Walker.hs
gpl-3.0
getURDF :: Walker -> URDF.URDF getURDF walker = URDF.URDF (walker_name walker) joints links where joints = concatMap getLegJoints ( legs walker ) links = getBodyLink ( body walker) : (concatMap getLegLinks $ legs walker)
240
getURDF :: Walker -> URDF.URDF getURDF walker = URDF.URDF (walker_name walker) joints links where joints = concatMap getLegJoints ( legs walker ) links = getBodyLink ( body walker) : (concatMap getLegLinks $ legs walker)
240
getURDF walker = URDF.URDF (walker_name walker) joints links where joints = concatMap getLegJoints ( legs walker ) links = getBodyLink ( body walker) : (concatMap getLegLinks $ legs walker)
209
false
true
0
10
53
84
41
43
null
null
frantisekfarka/ghc-dsi
testsuite/tests/th/T4135a.hs
bsd-3-clause
createInstance' :: Q Type -> Q Dec createInstance' t = liftM head [d| instance Foo $t where type FooType $t = String |]
129
createInstance' :: Q Type -> Q Dec createInstance' t = liftM head [d| instance Foo $t where type FooType $t = String |]
129
createInstance' t = liftM head [d| instance Foo $t where type FooType $t = String |]
94
false
true
0
6
32
33
17
16
null
null
rcook/pansite
app/PansiteApp/PandocTool.hs
mit
mathJaxUrl :: String mathJaxUrl = "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML-full"
111
mathJaxUrl :: String mathJaxUrl = "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML-full"
111
mathJaxUrl = "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML-full"
90
false
true
0
6
5
18
7
11
null
null
parsonsmatt/servant-persistent
src/Config.hs
mit
-- | This returns a 'Middleware' based on the environment that we're in. setLogger :: Environment -> Middleware setLogger Test = id
138
setLogger :: Environment -> Middleware setLogger Test = id
65
setLogger Test = id
26
true
true
0
5
28
19
10
9
null
null
cmwilhelm/dusky
src/Dusky/Locality.hs
mit
lngToXCoord :: Float -> Int lngToXCoord = round . getXCoord where getXCoord = deriveLineFromPoints upperLeft lowerRight upperLeft = (fromIntegral upperLeftLongitude, fromIntegral upperLeftXCoord) lowerRight = (fromIntegral lowerRightLongitude, fromIntegral lowerRightXCoord)
295
lngToXCoord :: Float -> Int lngToXCoord = round . getXCoord where getXCoord = deriveLineFromPoints upperLeft lowerRight upperLeft = (fromIntegral upperLeftLongitude, fromIntegral upperLeftXCoord) lowerRight = (fromIntegral lowerRightLongitude, fromIntegral lowerRightXCoord)
295
lngToXCoord = round . getXCoord where getXCoord = deriveLineFromPoints upperLeft lowerRight upperLeft = (fromIntegral upperLeftLongitude, fromIntegral upperLeftXCoord) lowerRight = (fromIntegral lowerRightLongitude, fromIntegral lowerRightXCoord)
267
false
true
2
7
48
68
34
34
null
null
alanz/Blobs
lib/DData/IntMap.hs
lgpl-2.1
intersection Nil t = Nil
24
intersection Nil t = Nil
24
intersection Nil t = Nil
24
false
false
1
5
4
16
5
11
null
null
fffej/HS-Poker
LookupPatternMatch.hs
bsd-3-clause
getValueFromProduct 19220 = 2829
32
getValueFromProduct 19220 = 2829
32
getValueFromProduct 19220 = 2829
32
false
false
0
5
3
9
4
5
null
null
aninhumer/mantle
src/Mantle/Logic.hs
bsd-3-clause
(<), (>), (<=), (>=) :: Num a => Output a -> Output a -> Output Bool (<) = binOp OpLT
89
(<), (>), (<=), (>=) :: Num a => Output a -> Output a -> Output Bool (<) = binOp OpLT
89
(<) = binOp OpLT
16
false
true
3
8
23
61
33
28
null
null
the-real-blackh/sodium-2d-game-engine
FRP/Sodium/GameEngine2D/Geometry.hs
bsd-3-clause
splitBottomP :: Float -> Rect -> (Rect, Rect) splitBottomP p rect = splitBottom (p * h * 0.01) rect where h = rectHeight rect -- | Chop /chop/ off the top of the rectangle, returning the top and the remainder (bottom).
221
splitBottomP :: Float -> Rect -> (Rect, Rect) splitBottomP p rect = splitBottom (p * h * 0.01) rect where h = rectHeight rect -- | Chop /chop/ off the top of the rectangle, returning the top and the remainder (bottom).
221
splitBottomP p rect = splitBottom (p * h * 0.01) rect where h = rectHeight rect -- | Chop /chop/ off the top of the rectangle, returning the top and the remainder (bottom).
175
false
true
1
9
43
67
31
36
null
null
dsabel/stmshf
Control/Concurrent/SHFSTM/Internal/TransactionLog.hs
bsd-3-clause
-- | 'emptyTLOG' constructs an empty transaction log of type 'TLOG' emptyTLOG :: IO (TLOG) emptyTLOG = do p <- newIORef (Log Set.empty [(Set.empty,Set.empty,Set.empty)] Set.empty) return (TLOG p)
204
emptyTLOG :: IO (TLOG) emptyTLOG = do p <- newIORef (Log Set.empty [(Set.empty,Set.empty,Set.empty)] Set.empty) return (TLOG p)
135
emptyTLOG = do p <- newIORef (Log Set.empty [(Set.empty,Set.empty,Set.empty)] Set.empty) return (TLOG p)
112
true
true
0
14
36
78
38
40
null
null
ganeti/ganeti
src/Ganeti/Constants.hs
bsd-2-clause
instanceCommunicationNetworkMode :: String instanceCommunicationNetworkMode = nicModeRouted
91
instanceCommunicationNetworkMode :: String instanceCommunicationNetworkMode = nicModeRouted
91
instanceCommunicationNetworkMode = nicModeRouted
48
false
true
0
4
5
11
6
5
null
null
input-output-hk/pos-haskell-prototype
chain/src/Pos/Chain/Genesis/Config.hs
mit
configVssMaxTTL :: Integral i => Config -> i configVssMaxTTL = vssMaxTTL . configProtocolConstants
98
configVssMaxTTL :: Integral i => Config -> i configVssMaxTTL = vssMaxTTL . configProtocolConstants
98
configVssMaxTTL = vssMaxTTL . configProtocolConstants
53
false
true
0
8
12
33
14
19
null
null
artems/FlashBit
src/Process/Console.hs
bsd-3-clause
writer :: TChan String -> IO Reason writer outChan = do _ <- forever $ do message <- atomically . readTChan $ outChan putStrLn message return Normal
172
writer :: TChan String -> IO Reason writer outChan = do _ <- forever $ do message <- atomically . readTChan $ outChan putStrLn message return Normal
172
writer outChan = do _ <- forever $ do message <- atomically . readTChan $ outChan putStrLn message return Normal
136
false
true
0
13
50
62
27
35
null
null
alexander-at-github/eta
compiler/ETA/Utils/Util.hs
bsd-3-clause
zipWithEqual _ = zipWith
25
zipWithEqual _ = zipWith
25
zipWithEqual _ = zipWith
25
false
false
0
4
4
10
4
6
null
null
meiersi/blaze-builder
benchmarks/Throughput/BinaryPut.hs
bsd-3-clause
putWord32N16Little = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return () loop s n = do putWord32le (s+0) putWord32le (s+1) putWord32le (s+2) putWord32le (s+3) putWord32le (s+4) putWord32le (s+5) putWord32le (s+6) putWord32le (s+7) putWord32le (s+8) putWord32le (s+9) putWord32le (s+10) putWord32le (s+11) putWord32le (s+12) putWord32le (s+13) putWord32le (s+14) putWord32le (s+15) loop (s+16) (n-16) ------------------------------------------------------------------------
688
putWord32N16Little = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return () loop s n = do putWord32le (s+0) putWord32le (s+1) putWord32le (s+2) putWord32le (s+3) putWord32le (s+4) putWord32le (s+5) putWord32le (s+6) putWord32le (s+7) putWord32le (s+8) putWord32le (s+9) putWord32le (s+10) putWord32le (s+11) putWord32le (s+12) putWord32le (s+13) putWord32le (s+14) putWord32le (s+15) loop (s+16) (n-16) ------------------------------------------------------------------------
688
putWord32N16Little = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return () loop s n = do putWord32le (s+0) putWord32le (s+1) putWord32le (s+2) putWord32le (s+3) putWord32le (s+4) putWord32le (s+5) putWord32le (s+6) putWord32le (s+7) putWord32le (s+8) putWord32le (s+9) putWord32le (s+10) putWord32le (s+11) putWord32le (s+12) putWord32le (s+13) putWord32le (s+14) putWord32le (s+15) loop (s+16) (n-16) ------------------------------------------------------------------------
688
false
false
2
11
251
295
140
155
null
null
asr/apia
src/Apia/Options.hs
mit
ithEquinoxOpt ∷ String → OM withEquinoxOpt [] _ = Left $ pretty "option " <> scquotes "--with-equinox" <> pretty " requires an argument PATH"
146
withEquinoxOpt ∷ String → OM withEquinoxOpt [] _ = Left $ pretty "option " <> scquotes "--with-equinox" <> pretty " requires an argument PATH"
146
withEquinoxOpt [] _ = Left $ pretty "option " <> scquotes "--with-equinox" <> pretty " requires an argument PATH"
117
false
true
6
8
28
51
21
30
null
null
olsner/ghc
compiler/codeGen/StgCmmClosure.hs
bsd-3-clause
-- For the non-updatable (single-entry case): -- -- True if has fvs (in which case we need access to them, and we -- should black-hole it) -- or profiling (in which case we need to recover the cost centre -- from inside it) ToDo: do we need this even for -- top-level thunks? If not, -- isNotTopLevel subsumes this nodeMustPointToIt _ (LFThunk {}) -- Node must point to a standard-form thunk = True
584
nodeMustPointToIt _ (LFThunk {}) -- Node must point to a standard-form thunk = True
92
nodeMustPointToIt _ (LFThunk {}) -- Node must point to a standard-form thunk = True
92
true
false
1
6
258
30
18
12
null
null
juretta/course
test/src/L02/List/Tests.hs
bsd-3-clause
prop_flatMap_id_flattens :: List (List Int) -> Bool prop_flatMap_id_flattens x = flatMap id x == flatten x
112
prop_flatMap_id_flattens :: List (List Int) -> Bool prop_flatMap_id_flattens x = flatMap id x == flatten x
112
prop_flatMap_id_flattens x = flatMap id x == flatten x
56
false
true
1
9
21
43
18
25
null
null
FranklinChen/hugs98-plus-Sep2006
packages/HaXml/src/Text/ParserCombinators/PolyState.hs
bsd-3-clause
-- | @x `discard` y@ parses both x and y, but discards the result of y discard :: Parser s t a -> Parser s t b -> Parser s t a px `discard` py = do { x <- px; _ <- py; return x }
178
discard :: Parser s t a -> Parser s t b -> Parser s t a px `discard` py = do { x <- px; _ <- py; return x }
107
px `discard` py = do { x <- px; _ <- py; return x }
51
true
true
0
8
46
80
38
42
null
null
cshung/MiscLab
Haskell99/q24.hs
mit
diffSelectTest :: Int -> Int -> Either [Int] String diffSelectTest numRandomElements numElements = let check :: Int -> Int -> Either [Int] String check numRandomElements numElements | numRandomElements < 1 = Right "Selecting less than one element is not supported" | numRandomElements > numElements = Right "Selecting more than one numElements is not supported" | otherwise = Left (diffSelectTest' numRandomElements numElements) diffSelectTest' :: Int -> Int -> [Int] diffSelectTest' numRandomElements numElements = rndSelect (range 1 numElements) numRandomElements in check numRandomElements numElements
680
diffSelectTest :: Int -> Int -> Either [Int] String diffSelectTest numRandomElements numElements = let check :: Int -> Int -> Either [Int] String check numRandomElements numElements | numRandomElements < 1 = Right "Selecting less than one element is not supported" | numRandomElements > numElements = Right "Selecting more than one numElements is not supported" | otherwise = Left (diffSelectTest' numRandomElements numElements) diffSelectTest' :: Int -> Int -> [Int] diffSelectTest' numRandomElements numElements = rndSelect (range 1 numElements) numRandomElements in check numRandomElements numElements
680
diffSelectTest numRandomElements numElements = let check :: Int -> Int -> Either [Int] String check numRandomElements numElements | numRandomElements < 1 = Right "Selecting less than one element is not supported" | numRandomElements > numElements = Right "Selecting more than one numElements is not supported" | otherwise = Left (diffSelectTest' numRandomElements numElements) diffSelectTest' :: Int -> Int -> [Int] diffSelectTest' numRandomElements numElements = rndSelect (range 1 numElements) numRandomElements in check numRandomElements numElements
628
false
true
0
12
156
168
78
90
null
null
fmthoma/ghc
compiler/basicTypes/BasicTypes.hs
bsd-3-clause
failed Failed = True
23
failed Failed = True
23
failed Failed = True
23
false
false
0
5
6
9
4
5
null
null
kolmodin/cabal
cabal-install/Distribution/Client/ProjectPlanning.hs
bsd-3-clause
defaultSetupDeps :: Compiler -> Platform -> PD.PackageDescription -> Maybe [Dependency] defaultSetupDeps compiler platform pkg = case packageSetupScriptStyle pkg of -- For packages with build type custom that do not specify explicit -- setup dependencies, we add a dependency on Cabal and a number -- of other packages. SetupCustomImplicitDeps -> Just $ [ Dependency depPkgname anyVersion | depPkgname <- legacyCustomSetupPkgs compiler platform ] ++ [ Dependency cabalPkgname cabalConstraint | packageName pkg /= cabalPkgname ] where -- The Cabal dep is slightly special: -- * We omit the dep for the Cabal lib itself, since it bootstraps. -- * We constrain it to be >= 1.18 < 2 -- cabalConstraint = orLaterVersion cabalCompatMinVer `intersectVersionRanges` orLaterVersion (PD.specVersion pkg) `intersectVersionRanges` earlierVersion cabalCompatMaxVer -- The idea here is that at some point we will make significant -- breaking changes to the Cabal API that Setup.hs scripts use. -- So for old custom Setup scripts that do not specify explicit -- constraints, we constrain them to use a compatible Cabal version. -- The exact version where we'll make this API break has not yet been -- decided, so for the meantime we guess at 2.x. cabalCompatMaxVer = Version [2] [] -- In principle we can talk to any old Cabal version, and we need to -- be able to do that for custom Setup scripts that require older -- Cabal lib versions. However in practice we have currently have -- problems with Cabal-1.16. (1.16 does not know about build targets) -- If this is fixed we can relax this constraint. cabalCompatMinVer = Version [1,18] [] -- For other build types (like Simple) if we still need to compile an -- external Setup.hs, it'll be one of the simple ones that only depends -- on Cabal and base. SetupNonCustomExternalLib -> Just [ Dependency cabalPkgname cabalConstraint , Dependency basePkgname anyVersion ] where cabalConstraint = orLaterVersion (PD.specVersion pkg) -- The internal setup wrapper method has no deps at all. SetupNonCustomInternalLib -> Just [] SetupCustomExplicitDeps -> error $ "defaultSetupDeps: called for a package with explicit " ++ "setup deps: " ++ display (packageId pkg) -- | Work out which version of the Cabal spec we will be using to talk to the -- Setup.hs interface for this package. -- -- This depends somewhat on the 'SetupScriptStyle' but most cases are a result -- of what the solver picked for us, based on the explicit setup deps or the -- ones added implicitly by 'defaultSetupDeps'. --
3,046
defaultSetupDeps :: Compiler -> Platform -> PD.PackageDescription -> Maybe [Dependency] defaultSetupDeps compiler platform pkg = case packageSetupScriptStyle pkg of -- For packages with build type custom that do not specify explicit -- setup dependencies, we add a dependency on Cabal and a number -- of other packages. SetupCustomImplicitDeps -> Just $ [ Dependency depPkgname anyVersion | depPkgname <- legacyCustomSetupPkgs compiler platform ] ++ [ Dependency cabalPkgname cabalConstraint | packageName pkg /= cabalPkgname ] where -- The Cabal dep is slightly special: -- * We omit the dep for the Cabal lib itself, since it bootstraps. -- * We constrain it to be >= 1.18 < 2 -- cabalConstraint = orLaterVersion cabalCompatMinVer `intersectVersionRanges` orLaterVersion (PD.specVersion pkg) `intersectVersionRanges` earlierVersion cabalCompatMaxVer -- The idea here is that at some point we will make significant -- breaking changes to the Cabal API that Setup.hs scripts use. -- So for old custom Setup scripts that do not specify explicit -- constraints, we constrain them to use a compatible Cabal version. -- The exact version where we'll make this API break has not yet been -- decided, so for the meantime we guess at 2.x. cabalCompatMaxVer = Version [2] [] -- In principle we can talk to any old Cabal version, and we need to -- be able to do that for custom Setup scripts that require older -- Cabal lib versions. However in practice we have currently have -- problems with Cabal-1.16. (1.16 does not know about build targets) -- If this is fixed we can relax this constraint. cabalCompatMinVer = Version [1,18] [] -- For other build types (like Simple) if we still need to compile an -- external Setup.hs, it'll be one of the simple ones that only depends -- on Cabal and base. SetupNonCustomExternalLib -> Just [ Dependency cabalPkgname cabalConstraint , Dependency basePkgname anyVersion ] where cabalConstraint = orLaterVersion (PD.specVersion pkg) -- The internal setup wrapper method has no deps at all. SetupNonCustomInternalLib -> Just [] SetupCustomExplicitDeps -> error $ "defaultSetupDeps: called for a package with explicit " ++ "setup deps: " ++ display (packageId pkg) -- | Work out which version of the Cabal spec we will be using to talk to the -- Setup.hs interface for this package. -- -- This depends somewhat on the 'SetupScriptStyle' but most cases are a result -- of what the solver picked for us, based on the explicit setup deps or the -- ones added implicitly by 'defaultSetupDeps'. --
3,046
defaultSetupDeps compiler platform pkg = case packageSetupScriptStyle pkg of -- For packages with build type custom that do not specify explicit -- setup dependencies, we add a dependency on Cabal and a number -- of other packages. SetupCustomImplicitDeps -> Just $ [ Dependency depPkgname anyVersion | depPkgname <- legacyCustomSetupPkgs compiler platform ] ++ [ Dependency cabalPkgname cabalConstraint | packageName pkg /= cabalPkgname ] where -- The Cabal dep is slightly special: -- * We omit the dep for the Cabal lib itself, since it bootstraps. -- * We constrain it to be >= 1.18 < 2 -- cabalConstraint = orLaterVersion cabalCompatMinVer `intersectVersionRanges` orLaterVersion (PD.specVersion pkg) `intersectVersionRanges` earlierVersion cabalCompatMaxVer -- The idea here is that at some point we will make significant -- breaking changes to the Cabal API that Setup.hs scripts use. -- So for old custom Setup scripts that do not specify explicit -- constraints, we constrain them to use a compatible Cabal version. -- The exact version where we'll make this API break has not yet been -- decided, so for the meantime we guess at 2.x. cabalCompatMaxVer = Version [2] [] -- In principle we can talk to any old Cabal version, and we need to -- be able to do that for custom Setup scripts that require older -- Cabal lib versions. However in practice we have currently have -- problems with Cabal-1.16. (1.16 does not know about build targets) -- If this is fixed we can relax this constraint. cabalCompatMinVer = Version [1,18] [] -- For other build types (like Simple) if we still need to compile an -- external Setup.hs, it'll be one of the simple ones that only depends -- on Cabal and base. SetupNonCustomExternalLib -> Just [ Dependency cabalPkgname cabalConstraint , Dependency basePkgname anyVersion ] where cabalConstraint = orLaterVersion (PD.specVersion pkg) -- The internal setup wrapper method has no deps at all. SetupNonCustomInternalLib -> Just [] SetupCustomExplicitDeps -> error $ "defaultSetupDeps: called for a package with explicit " ++ "setup deps: " ++ display (packageId pkg) -- | Work out which version of the Cabal spec we will be using to talk to the -- Setup.hs interface for this package. -- -- This depends somewhat on the 'SetupScriptStyle' but most cases are a result -- of what the solver picked for us, based on the explicit setup deps or the -- ones added implicitly by 'defaultSetupDeps'. --
2,924
false
true
0
15
929
278
153
125
null
null
mettekou/ghc
compiler/ghci/ByteCodeGen.hs
bsd-3-clause
-- treated just like a variable V -- See Note [Empty case alternatives] in coreSyn/CoreSyn.hs -- and Note [Bottoming expressions] in coreSyn/CoreUtils.hs: -- The scrutinee of an empty case evaluates to bottom pushAtom d p (AnnCase (_, a) _ _ []) -- trac #12128 = pushAtom d p a
281
pushAtom d p (AnnCase (_, a) _ _ []) -- trac #12128 = pushAtom d p a
71
pushAtom d p (AnnCase (_, a) _ _ []) -- trac #12128 = pushAtom d p a
71
true
false
0
7
52
50
25
25
null
null
DavidAlphaFox/ghc
libraries/bytestring/Data/ByteString/Lazy.hs
bsd-3-clause
-- --------------------------------------------------------------------- -- Low level constructors -- | /O(n)/ Make a copy of the 'ByteString' with its own storage. -- This is mainly useful to allow the rest of the data pointed -- to by the 'ByteString' to be garbage collected, for example -- if a large string has been read in, and only a small part of it -- is needed in the rest of the program. copy :: ByteString -> ByteString copy cs = foldrChunks (Chunk . S.copy) Empty cs
488
copy :: ByteString -> ByteString copy cs = foldrChunks (Chunk . S.copy) Empty cs
80
copy cs = foldrChunks (Chunk . S.copy) Empty cs
47
true
true
0
8
90
47
25
22
null
null
kadena-io/pact
tests/Analyze/Eval.hs
bsd-3-clause
mkEvalEnv :: GenState -> IO (EvalEnv LibState) mkEvalEnv (GenState _ registryKSs txKSs txDecs txInts txStrs) = do evalEnv <- liftIO $ initPureEvalEnv Nothing let xformKsMap = HM.fromList . fmap (\(k, (pks, _ks)) -> (T.pack k, toJSON pks)) . Map.toList registryKSs' = xformKsMap registryKSs txKSs' = xformKsMap txKSs txDecs' = HM.fromList $ fmap (\(k, v) -> (T.pack k, toJSON (show (toPact decimalIso v)))) $ Map.toList txDecs txInts' = HM.fromList $ fmap (\(k, v) -> (T.pack k, toJSON v)) $ Map.toList txInts txStrs' = HM.fromList $ fmap (\(k, Str v) -> (T.pack k, toJSON v)) $ Map.toList txStrs body = Object $ HM.unions [registryKSs', txKSs', txDecs', txInts', txStrs'] pure $ evalEnv & eeMsgBody .~ body
813
mkEvalEnv :: GenState -> IO (EvalEnv LibState) mkEvalEnv (GenState _ registryKSs txKSs txDecs txInts txStrs) = do evalEnv <- liftIO $ initPureEvalEnv Nothing let xformKsMap = HM.fromList . fmap (\(k, (pks, _ks)) -> (T.pack k, toJSON pks)) . Map.toList registryKSs' = xformKsMap registryKSs txKSs' = xformKsMap txKSs txDecs' = HM.fromList $ fmap (\(k, v) -> (T.pack k, toJSON (show (toPact decimalIso v)))) $ Map.toList txDecs txInts' = HM.fromList $ fmap (\(k, v) -> (T.pack k, toJSON v)) $ Map.toList txInts txStrs' = HM.fromList $ fmap (\(k, Str v) -> (T.pack k, toJSON v)) $ Map.toList txStrs body = Object $ HM.unions [registryKSs', txKSs', txDecs', txInts', txStrs'] pure $ evalEnv & eeMsgBody .~ body
813
mkEvalEnv (GenState _ registryKSs txKSs txDecs txInts txStrs) = do evalEnv <- liftIO $ initPureEvalEnv Nothing let xformKsMap = HM.fromList . fmap (\(k, (pks, _ks)) -> (T.pack k, toJSON pks)) . Map.toList registryKSs' = xformKsMap registryKSs txKSs' = xformKsMap txKSs txDecs' = HM.fromList $ fmap (\(k, v) -> (T.pack k, toJSON (show (toPact decimalIso v)))) $ Map.toList txDecs txInts' = HM.fromList $ fmap (\(k, v) -> (T.pack k, toJSON v)) $ Map.toList txInts txStrs' = HM.fromList $ fmap (\(k, Str v) -> (T.pack k, toJSON v)) $ Map.toList txStrs body = Object $ HM.unions [registryKSs', txKSs', txDecs', txInts', txStrs'] pure $ evalEnv & eeMsgBody .~ body
766
false
true
0
20
219
345
179
166
null
null
fmapfmapfmap/amazonka
amazonka-sdb/gen/Network/AWS/SDB/Types/Product.hs
mpl-2.0
-- | A list of attributes. iAttributes :: Lens' Item [Attribute] iAttributes = lens _iAttributes (\ s a -> s{_iAttributes = a}) . _Coerce
137
iAttributes :: Lens' Item [Attribute] iAttributes = lens _iAttributes (\ s a -> s{_iAttributes = a}) . _Coerce
110
iAttributes = lens _iAttributes (\ s a -> s{_iAttributes = a}) . _Coerce
72
true
true
0
10
23
47
26
21
null
null
periodic/Simple-Yesod-ToDo
Settings.hs
bsd-2-clause
-- | The base URL for your static files. As you can see by the default -- value, this can simply be "static" appended to your application root. -- A powerful optimization can be serving static files from a separate -- domain name. This allows you to use a web server optimized for static -- files, more easily set expires and cache values, and avoid possibly -- costly transference of cookies on static files. For more information, -- please see: -- http://code.google.com/speed/page-speed/docs/request.html#ServeFromCookielessDomain -- -- If you change the resource pattern for StaticR in Foundation.hs, you will -- have to make a corresponding change here. -- -- To see how this value is used, see urlRenderOverride in Foundation.hs staticRoot :: AppConfig DefaultEnv -> Text staticRoot conf = [st|#{appRoot conf}/static|]
827
staticRoot :: AppConfig DefaultEnv -> Text staticRoot conf = [st|#{appRoot conf}/static|]
90
staticRoot conf = [st|#{appRoot conf}/static|]
46
true
true
0
7
130
44
28
16
null
null
mengcz13/haskell_project
src/Lib.hs
bsd-3-clause
evalexpr (Geq expr1 expr2) = vgeq (evalexpr expr1) (evalexpr expr2)
67
evalexpr (Geq expr1 expr2) = vgeq (evalexpr expr1) (evalexpr expr2)
67
evalexpr (Geq expr1 expr2) = vgeq (evalexpr expr1) (evalexpr expr2)
67
false
false
0
7
9
35
16
19
null
null
nevrenato/Hets_Fork
HasCASL/Subst.hs
gpl-2.0
-- this function is a nice example where the usage of an abstract functor -- makes the implementation cleaner -- | reduce the topleft-most occurence of a let-expression if possible -- , i.e, if the let doesn't contain function-definitions nor patterns redLet :: Term -> ReductionResult Term redLet t = case t of -- LetTerm LetBrand [ProgEq] Term Range LetTerm _ eqs term _ -> substEqs term eqs ApplTerm t1 t2 rg -> (\ [r1,r2] -> ApplTerm r1 r2 rg) <$> redLetList [t1,t2] TupleTerm l rg -> (\x -> TupleTerm x rg) <$> redLetList l TypedTerm term tq typ rg -> (\x -> TypedTerm x tq typ rg) <$> redLet term QuantifiedTerm q vars term rg -> (\x -> QuantifiedTerm q vars x rg) <$> redLet term LambdaTerm vars p term rg -> (\x -> LambdaTerm vars p x rg) <$> redLet term CaseTerm term eqs rg -> (\ (xeqs, xt) -> CaseTerm xt xeqs rg) <$> redLetProg (eqs, term) _ -> NotReduced t
969
redLet :: Term -> ReductionResult Term redLet t = case t of -- LetTerm LetBrand [ProgEq] Term Range LetTerm _ eqs term _ -> substEqs term eqs ApplTerm t1 t2 rg -> (\ [r1,r2] -> ApplTerm r1 r2 rg) <$> redLetList [t1,t2] TupleTerm l rg -> (\x -> TupleTerm x rg) <$> redLetList l TypedTerm term tq typ rg -> (\x -> TypedTerm x tq typ rg) <$> redLet term QuantifiedTerm q vars term rg -> (\x -> QuantifiedTerm q vars x rg) <$> redLet term LambdaTerm vars p term rg -> (\x -> LambdaTerm vars p x rg) <$> redLet term CaseTerm term eqs rg -> (\ (xeqs, xt) -> CaseTerm xt xeqs rg) <$> redLetProg (eqs, term) _ -> NotReduced t
716
redLet t = case t of -- LetTerm LetBrand [ProgEq] Term Range LetTerm _ eqs term _ -> substEqs term eqs ApplTerm t1 t2 rg -> (\ [r1,r2] -> ApplTerm r1 r2 rg) <$> redLetList [t1,t2] TupleTerm l rg -> (\x -> TupleTerm x rg) <$> redLetList l TypedTerm term tq typ rg -> (\x -> TypedTerm x tq typ rg) <$> redLet term QuantifiedTerm q vars term rg -> (\x -> QuantifiedTerm q vars x rg) <$> redLet term LambdaTerm vars p term rg -> (\x -> LambdaTerm vars p x rg) <$> redLet term CaseTerm term eqs rg -> (\ (xeqs, xt) -> CaseTerm xt xeqs rg) <$> redLetProg (eqs, term) _ -> NotReduced t
677
true
true
0
11
263
305
153
152
null
null
pkamenarsky/macos-statusbar
System/Statusbar.hs
apache-2.0
setStatusItemTitle :: Ptr NSStatusItem -> String -> IO () setStatusItemTitle item title = withCString title (setStatusItemTitleC item)
134
setStatusItemTitle :: Ptr NSStatusItem -> String -> IO () setStatusItemTitle item title = withCString title (setStatusItemTitleC item)
134
setStatusItemTitle item title = withCString title (setStatusItemTitleC item)
76
false
true
0
8
16
43
20
23
null
null
kyren/hsgb
lib/Gameboy/Instructions.hs
unlicense
encodeInstruction (ADD_A_R ARegister) = [0x87]
46
encodeInstruction (ADD_A_R ARegister) = [0x87]
46
encodeInstruction (ADD_A_R ARegister) = [0x87]
46
false
false
0
6
4
19
9
10
null
null
antalsz/hs-to-coq
src/lib/HsToCoq/Coq/Gallina/Util.hs
mit
collectArgs (App t args) = do (f, args1) <- collectArgs t args2 <- mapM fromArg (toList args) return $ (f, args1 ++ args2) where fromArg (PosArg t) = return t fromArg _ = Left "non-positional argument"
232
collectArgs (App t args) = do (f, args1) <- collectArgs t args2 <- mapM fromArg (toList args) return $ (f, args1 ++ args2) where fromArg (PosArg t) = return t fromArg _ = Left "non-positional argument"
232
collectArgs (App t args) = do (f, args1) <- collectArgs t args2 <- mapM fromArg (toList args) return $ (f, args1 ++ args2) where fromArg (PosArg t) = return t fromArg _ = Left "non-positional argument"
232
false
false
1
10
66
97
47
50
null
null
gnn/Hets
CMDL/Utils.hs
gpl-2.0
{- | Giben a listof edgenamesand numbered edge names and the list of all nodes and edges the function identifies the edges that appearin the name list and are also goals -} obtainGoalEdgeList :: [String] -> [String] -> [LNode DGNodeLab] -> [LEdge DGLinkLab] -> ([String], [LEdge DGLinkLab]) obtainGoalEdgeList ls1 ls2 ls3 ls4 = let (l1, l2) = obtainEdgeList ls1 ls2 ls3 ls4 in (l1, filter edgeContainsGoals l2)
443
obtainGoalEdgeList :: [String] -> [String] -> [LNode DGNodeLab] -> [LEdge DGLinkLab] -> ([String], [LEdge DGLinkLab]) obtainGoalEdgeList ls1 ls2 ls3 ls4 = let (l1, l2) = obtainEdgeList ls1 ls2 ls3 ls4 in (l1, filter edgeContainsGoals l2)
264
obtainGoalEdgeList ls1 ls2 ls3 ls4 = let (l1, l2) = obtainEdgeList ls1 ls2 ls3 ls4 in (l1, filter edgeContainsGoals l2)
127
true
true
0
11
99
108
57
51
null
null
headprogrammingczar/cabal
cabal-install/Distribution/Client/ProjectPlanning.hs
bsd-3-clause
planPackages :: Compiler -> Platform -> Solver -> SolverSettings -> InstalledPackageIndex -> SourcePackageDb -> PkgConfigDb -> [UnresolvedSourcePackage] -> Map PackageName (Map OptionalStanza Bool) -> Progress String String SolverInstallPlan planPackages comp platform solver SolverSettings{..} installedPkgIndex sourcePkgDb pkgConfigDB localPackages pkgStanzasEnable = resolveDependencies platform (compilerInfo comp) pkgConfigDB solver resolverParams where --TODO: [nice to have] disable multiple instances restriction in the solver, but then -- make sure we can cope with that in the output. resolverParams = setMaxBackjumps solverSettingMaxBackjumps --TODO: [required eventually] should only be configurable for custom installs -- . setIndependentGoals solverSettingIndependentGoals . setReorderGoals solverSettingReorderGoals --TODO: [required eventually] should only be configurable for custom installs -- . setAvoidReinstalls solverSettingAvoidReinstalls --TODO: [required eventually] should only be configurable for custom installs -- . setShadowPkgs solverSettingShadowPkgs . setStrongFlags solverSettingStrongFlags --TODO: [required eventually] decide if we need to prefer installed for -- global packages, or prefer latest even for global packages. Perhaps -- should be configurable but with a different name than "upgrade-dependencies". . setPreferenceDefault PreferLatestForSelected {-(if solverSettingUpgradeDeps then PreferAllLatest else PreferLatestForSelected)-} . removeUpperBounds solverSettingAllowNewer . addDefaultSetupDependencies (defaultSetupDeps comp platform . PD.packageDescription . packageDescription) . addPreferences -- preferences from the config file or command line [ PackageVersionPreference name ver | Dependency name ver <- solverSettingPreferences ] . addConstraints -- version constraints from the config file or command line [ LabeledPackageConstraint (userToPackageConstraint pc) src | (pc, src) <- solverSettingConstraints ] . addPreferences -- enable stanza preference where the user did not specify [ PackageStanzasPreference pkgname stanzas | pkg <- localPackages , let pkgname = packageName pkg stanzaM = Map.findWithDefault Map.empty pkgname pkgStanzasEnable stanzas = [ stanza | stanza <- [minBound..maxBound] , Map.lookup stanza stanzaM == Nothing ] , not (null stanzas) ] . addConstraints -- enable stanza constraints where the user asked to enable [ LabeledPackageConstraint (PackageConstraintStanzas pkgname stanzas) ConstraintSourceConfigFlagOrTarget | pkg <- localPackages , let pkgname = packageName pkg stanzaM = Map.findWithDefault Map.empty pkgname pkgStanzasEnable stanzas = [ stanza | stanza <- [minBound..maxBound] , Map.lookup stanza stanzaM == Just True ] , not (null stanzas) ] . addConstraints --TODO: [nice to have] should have checked at some point that the -- package in question actually has these flags. [ LabeledPackageConstraint (PackageConstraintFlags pkgname flags) ConstraintSourceConfigFlagOrTarget | (pkgname, flags) <- Map.toList solverSettingFlagAssignments ] . addConstraints --TODO: [nice to have] we have user-supplied flags for unspecified -- local packages (as well as specific per-package flags). For the -- former we just apply all these flags to all local targets which -- is silly. We should check if the flags are appropriate. [ LabeledPackageConstraint (PackageConstraintFlags pkgname flags) ConstraintSourceConfigFlagOrTarget | let flags = solverSettingFlagAssignment , not (null flags) , pkg <- localPackages , let pkgname = packageName pkg ] $ stdResolverParams stdResolverParams = -- Note: we don't use the standardInstallPolicy here, since that uses -- its own addDefaultSetupDependencies that is not appropriate for us. basicInstallPolicy installedPkgIndex sourcePkgDb (map SpecificSourcePackage localPackages) ------------------------------------------------------------------------------ -- * Install plan post-processing ------------------------------------------------------------------------------ -- This phase goes from the InstallPlan we get from the solver and has to -- make an elaborated install plan. -- -- We go in two steps: -- -- 1. elaborate all the source packages that the solver has chosen. -- 2. swap source packages for pre-existing installed packages wherever -- possible. -- -- We do it in this order, elaborating and then replacing, because the easiest -- way to calculate the installed package ids used for the replacement step is -- from the elaborated configuration for each package. ------------------------------------------------------------------------------ -- * Install plan elaboration ------------------------------------------------------------------------------ -- | Produce an elaborated install plan using the policy for local builds with -- a nix-style shared store. -- -- In theory should be able to make an elaborated install plan with a policy -- matching that of the classic @cabal install --user@ or @--global@ --
6,005
planPackages :: Compiler -> Platform -> Solver -> SolverSettings -> InstalledPackageIndex -> SourcePackageDb -> PkgConfigDb -> [UnresolvedSourcePackage] -> Map PackageName (Map OptionalStanza Bool) -> Progress String String SolverInstallPlan planPackages comp platform solver SolverSettings{..} installedPkgIndex sourcePkgDb pkgConfigDB localPackages pkgStanzasEnable = resolveDependencies platform (compilerInfo comp) pkgConfigDB solver resolverParams where --TODO: [nice to have] disable multiple instances restriction in the solver, but then -- make sure we can cope with that in the output. resolverParams = setMaxBackjumps solverSettingMaxBackjumps --TODO: [required eventually] should only be configurable for custom installs -- . setIndependentGoals solverSettingIndependentGoals . setReorderGoals solverSettingReorderGoals --TODO: [required eventually] should only be configurable for custom installs -- . setAvoidReinstalls solverSettingAvoidReinstalls --TODO: [required eventually] should only be configurable for custom installs -- . setShadowPkgs solverSettingShadowPkgs . setStrongFlags solverSettingStrongFlags --TODO: [required eventually] decide if we need to prefer installed for -- global packages, or prefer latest even for global packages. Perhaps -- should be configurable but with a different name than "upgrade-dependencies". . setPreferenceDefault PreferLatestForSelected {-(if solverSettingUpgradeDeps then PreferAllLatest else PreferLatestForSelected)-} . removeUpperBounds solverSettingAllowNewer . addDefaultSetupDependencies (defaultSetupDeps comp platform . PD.packageDescription . packageDescription) . addPreferences -- preferences from the config file or command line [ PackageVersionPreference name ver | Dependency name ver <- solverSettingPreferences ] . addConstraints -- version constraints from the config file or command line [ LabeledPackageConstraint (userToPackageConstraint pc) src | (pc, src) <- solverSettingConstraints ] . addPreferences -- enable stanza preference where the user did not specify [ PackageStanzasPreference pkgname stanzas | pkg <- localPackages , let pkgname = packageName pkg stanzaM = Map.findWithDefault Map.empty pkgname pkgStanzasEnable stanzas = [ stanza | stanza <- [minBound..maxBound] , Map.lookup stanza stanzaM == Nothing ] , not (null stanzas) ] . addConstraints -- enable stanza constraints where the user asked to enable [ LabeledPackageConstraint (PackageConstraintStanzas pkgname stanzas) ConstraintSourceConfigFlagOrTarget | pkg <- localPackages , let pkgname = packageName pkg stanzaM = Map.findWithDefault Map.empty pkgname pkgStanzasEnable stanzas = [ stanza | stanza <- [minBound..maxBound] , Map.lookup stanza stanzaM == Just True ] , not (null stanzas) ] . addConstraints --TODO: [nice to have] should have checked at some point that the -- package in question actually has these flags. [ LabeledPackageConstraint (PackageConstraintFlags pkgname flags) ConstraintSourceConfigFlagOrTarget | (pkgname, flags) <- Map.toList solverSettingFlagAssignments ] . addConstraints --TODO: [nice to have] we have user-supplied flags for unspecified -- local packages (as well as specific per-package flags). For the -- former we just apply all these flags to all local targets which -- is silly. We should check if the flags are appropriate. [ LabeledPackageConstraint (PackageConstraintFlags pkgname flags) ConstraintSourceConfigFlagOrTarget | let flags = solverSettingFlagAssignment , not (null flags) , pkg <- localPackages , let pkgname = packageName pkg ] $ stdResolverParams stdResolverParams = -- Note: we don't use the standardInstallPolicy here, since that uses -- its own addDefaultSetupDependencies that is not appropriate for us. basicInstallPolicy installedPkgIndex sourcePkgDb (map SpecificSourcePackage localPackages) ------------------------------------------------------------------------------ -- * Install plan post-processing ------------------------------------------------------------------------------ -- This phase goes from the InstallPlan we get from the solver and has to -- make an elaborated install plan. -- -- We go in two steps: -- -- 1. elaborate all the source packages that the solver has chosen. -- 2. swap source packages for pre-existing installed packages wherever -- possible. -- -- We do it in this order, elaborating and then replacing, because the easiest -- way to calculate the installed package ids used for the replacement step is -- from the elaborated configuration for each package. ------------------------------------------------------------------------------ -- * Install plan elaboration ------------------------------------------------------------------------------ -- | Produce an elaborated install plan using the policy for local builds with -- a nix-style shared store. -- -- In theory should be able to make an elaborated install plan with a policy -- matching that of the classic @cabal install --user@ or @--global@ --
6,005
planPackages comp platform solver SolverSettings{..} installedPkgIndex sourcePkgDb pkgConfigDB localPackages pkgStanzasEnable = resolveDependencies platform (compilerInfo comp) pkgConfigDB solver resolverParams where --TODO: [nice to have] disable multiple instances restriction in the solver, but then -- make sure we can cope with that in the output. resolverParams = setMaxBackjumps solverSettingMaxBackjumps --TODO: [required eventually] should only be configurable for custom installs -- . setIndependentGoals solverSettingIndependentGoals . setReorderGoals solverSettingReorderGoals --TODO: [required eventually] should only be configurable for custom installs -- . setAvoidReinstalls solverSettingAvoidReinstalls --TODO: [required eventually] should only be configurable for custom installs -- . setShadowPkgs solverSettingShadowPkgs . setStrongFlags solverSettingStrongFlags --TODO: [required eventually] decide if we need to prefer installed for -- global packages, or prefer latest even for global packages. Perhaps -- should be configurable but with a different name than "upgrade-dependencies". . setPreferenceDefault PreferLatestForSelected {-(if solverSettingUpgradeDeps then PreferAllLatest else PreferLatestForSelected)-} . removeUpperBounds solverSettingAllowNewer . addDefaultSetupDependencies (defaultSetupDeps comp platform . PD.packageDescription . packageDescription) . addPreferences -- preferences from the config file or command line [ PackageVersionPreference name ver | Dependency name ver <- solverSettingPreferences ] . addConstraints -- version constraints from the config file or command line [ LabeledPackageConstraint (userToPackageConstraint pc) src | (pc, src) <- solverSettingConstraints ] . addPreferences -- enable stanza preference where the user did not specify [ PackageStanzasPreference pkgname stanzas | pkg <- localPackages , let pkgname = packageName pkg stanzaM = Map.findWithDefault Map.empty pkgname pkgStanzasEnable stanzas = [ stanza | stanza <- [minBound..maxBound] , Map.lookup stanza stanzaM == Nothing ] , not (null stanzas) ] . addConstraints -- enable stanza constraints where the user asked to enable [ LabeledPackageConstraint (PackageConstraintStanzas pkgname stanzas) ConstraintSourceConfigFlagOrTarget | pkg <- localPackages , let pkgname = packageName pkg stanzaM = Map.findWithDefault Map.empty pkgname pkgStanzasEnable stanzas = [ stanza | stanza <- [minBound..maxBound] , Map.lookup stanza stanzaM == Just True ] , not (null stanzas) ] . addConstraints --TODO: [nice to have] should have checked at some point that the -- package in question actually has these flags. [ LabeledPackageConstraint (PackageConstraintFlags pkgname flags) ConstraintSourceConfigFlagOrTarget | (pkgname, flags) <- Map.toList solverSettingFlagAssignments ] . addConstraints --TODO: [nice to have] we have user-supplied flags for unspecified -- local packages (as well as specific per-package flags). For the -- former we just apply all these flags to all local targets which -- is silly. We should check if the flags are appropriate. [ LabeledPackageConstraint (PackageConstraintFlags pkgname flags) ConstraintSourceConfigFlagOrTarget | let flags = solverSettingFlagAssignment , not (null flags) , pkg <- localPackages , let pkgname = packageName pkg ] $ stdResolverParams stdResolverParams = -- Note: we don't use the standardInstallPolicy here, since that uses -- its own addDefaultSetupDependencies that is not appropriate for us. basicInstallPolicy installedPkgIndex sourcePkgDb (map SpecificSourcePackage localPackages) ------------------------------------------------------------------------------ -- * Install plan post-processing ------------------------------------------------------------------------------ -- This phase goes from the InstallPlan we get from the solver and has to -- make an elaborated install plan. -- -- We go in two steps: -- -- 1. elaborate all the source packages that the solver has chosen. -- 2. swap source packages for pre-existing installed packages wherever -- possible. -- -- We do it in this order, elaborating and then replacing, because the easiest -- way to calculate the installed package ids used for the replacement step is -- from the elaborated configuration for each package. ------------------------------------------------------------------------------ -- * Install plan elaboration ------------------------------------------------------------------------------ -- | Produce an elaborated install plan using the policy for local builds with -- a nix-style shared store. -- -- In theory should be able to make an elaborated install plan with a policy -- matching that of the classic @cabal install --user@ or @--global@ --
5,659
false
true
0
20
1,668
633
333
300
null
null
AlexanderPankiv/ghc
compiler/coreSyn/MkCore.hs
bsd-3-clause
mkIntExpr :: DynFlags -> Integer -> CoreExpr -- Result = I# i :: Int mkIntExpr dflags i = mkConApp intDataCon [mkIntLit dflags i]
137
mkIntExpr :: DynFlags -> Integer -> CoreExpr mkIntExpr dflags i = mkConApp intDataCon [mkIntLit dflags i]
106
mkIntExpr dflags i = mkConApp intDataCon [mkIntLit dflags i]
61
true
true
0
7
30
38
19
19
null
null
mettekou/ghc
compiler/utils/Bag.hs
bsd-3-clause
partitionBagWith :: (a -> Either b c) -> Bag a -> (Bag b {- Left -}, Bag c {- Right -}) partitionBagWith _ EmptyBag = (EmptyBag, EmptyBag)
186
partitionBagWith :: (a -> Either b c) -> Bag a -> (Bag b {- Left -}, Bag c {- Right -}) partitionBagWith _ EmptyBag = (EmptyBag, EmptyBag)
186
partitionBagWith _ EmptyBag = (EmptyBag, EmptyBag)
53
false
true
0
8
74
59
31
28
null
null
zeniuseducation/poly-euler
haskell/next/one.hs
epl-1.0
count_divs :: Int -> Int count_divs n | 0 == rem n 2 = looper 2 1 2 | otherwise = looper 3 2 2 where looper :: Int -> Int -> Int -> Int looper i j res | i*i >= n = if i*i == n then 1+res else res | 0 == rem n i = looper (j + i) j (res + 2) | otherwise = looper (j + i) j res
319
count_divs :: Int -> Int count_divs n | 0 == rem n 2 = looper 2 1 2 | otherwise = looper 3 2 2 where looper :: Int -> Int -> Int -> Int looper i j res | i*i >= n = if i*i == n then 1+res else res | 0 == rem n i = looper (j + i) j (res + 2) | otherwise = looper (j + i) j res
319
count_divs n | 0 == rem n 2 = looper 2 1 2 | otherwise = looper 3 2 2 where looper :: Int -> Int -> Int -> Int looper i j res | i*i >= n = if i*i == n then 1+res else res | 0 == rem n i = looper (j + i) j (res + 2) | otherwise = looper (j + i) j res
294
false
true
5
9
120
182
88
94
null
null
frontrowed/stratosphere
gen/src/Gen/Render/Types.hs
mit
normalizeTypeName _ "AWS::EC2::SecurityGroup" "Ingress" = computeModuleName "AWS::EC2::SecurityGroup.IngressProperty"
117
normalizeTypeName _ "AWS::EC2::SecurityGroup" "Ingress" = computeModuleName "AWS::EC2::SecurityGroup.IngressProperty"
117
normalizeTypeName _ "AWS::EC2::SecurityGroup" "Ingress" = computeModuleName "AWS::EC2::SecurityGroup.IngressProperty"
117
false
false
0
5
6
16
7
9
null
null
ocramz/petsc-hs
src/Numerical/PETSc/Internal/PutGet/TAO.hs
gpl-3.0
taoLineSearchCreate :: Comm -> IO TaoLineSearch taoLineSearchCreate cc = chk1 $ taoLineSearchCreate' cc
103
taoLineSearchCreate :: Comm -> IO TaoLineSearch taoLineSearchCreate cc = chk1 $ taoLineSearchCreate' cc
103
taoLineSearchCreate cc = chk1 $ taoLineSearchCreate' cc
55
false
true
2
7
12
33
14
19
null
null