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
gitfoxi/vcd-haskell
app/vcd-strip.hs
agpl-3.0
hunkSize :: Int chunkSize = 262144 `div` 2
43
chunkSize :: Int chunkSize = 262144 `div` 2
43
chunkSize = 262144 `div` 2
26
false
true
0
5
8
17
10
7
null
null
bigs/elevators
src/Cole/Elevators.hs
bsd-3-clause
-- when stepping, invert the elevator direction if it was previously stationary setElevatorDirectionIfNecessary :: Direction -> Elevator -> Elevator setElevatorDirectionIfNecessary dir = elevatorDirection %~ go where go Stationary = dir go x = x -- add a destination to the elevator's list
300
setElevatorDirectionIfNecessary :: Direction -> Elevator -> Elevator setElevatorDirectionIfNecessary dir = elevatorDirection %~ go where go Stationary = dir go x = x -- add a destination to the elevator's list
220
setElevatorDirectionIfNecessary dir = elevatorDirection %~ go where go Stationary = dir go x = x -- add a destination to the elevator's list
151
true
true
1
6
52
47
24
23
null
null
tamarin-prover/tamarin-prover
lib/theory/src/Theory/Constraint/Solver/Simplify.hs
gpl-3.0
evalFormulaAtoms :: Reduction ChangeIndicator evalFormulaAtoms = do ctxt <- ask valuation <- gets (partialAtomValuation ctxt) formulas <- getM sFormulas applyChangeList $ do fm <- S.toList formulas case simplifyGuarded valuation fm of Just fm' -> return $ do case fm of GDisj disj -> markGoalAsSolved "simplified" (DisjG disj) _ -> return () modM sFormulas $ S.delete fm modM sSolvedFormulas $ S.insert fm insertFormula fm' Nothing -> [] -- | A partial valuation for atoms. The return value of this function is -- interpreted as follows. -- -- @partialAtomValuation ctxt sys ato == Just True@ if for every valuation -- @theta@ satisfying the graph constraints and all atoms in the constraint -- system @sys@, the atom @ato@ is also satisfied by @theta@. -- -- The interpretation for @Just False@ is analogous. @Nothing@ is used to -- represent *unknown*. --
1,020
evalFormulaAtoms :: Reduction ChangeIndicator evalFormulaAtoms = do ctxt <- ask valuation <- gets (partialAtomValuation ctxt) formulas <- getM sFormulas applyChangeList $ do fm <- S.toList formulas case simplifyGuarded valuation fm of Just fm' -> return $ do case fm of GDisj disj -> markGoalAsSolved "simplified" (DisjG disj) _ -> return () modM sFormulas $ S.delete fm modM sSolvedFormulas $ S.insert fm insertFormula fm' Nothing -> [] -- | A partial valuation for atoms. The return value of this function is -- interpreted as follows. -- -- @partialAtomValuation ctxt sys ato == Just True@ if for every valuation -- @theta@ satisfying the graph constraints and all atoms in the constraint -- system @sys@, the atom @ato@ is also satisfied by @theta@. -- -- The interpretation for @Just False@ is analogous. @Nothing@ is used to -- represent *unknown*. --
1,020
evalFormulaAtoms = do ctxt <- ask valuation <- gets (partialAtomValuation ctxt) formulas <- getM sFormulas applyChangeList $ do fm <- S.toList formulas case simplifyGuarded valuation fm of Just fm' -> return $ do case fm of GDisj disj -> markGoalAsSolved "simplified" (DisjG disj) _ -> return () modM sFormulas $ S.delete fm modM sSolvedFormulas $ S.insert fm insertFormula fm' Nothing -> [] -- | A partial valuation for atoms. The return value of this function is -- interpreted as follows. -- -- @partialAtomValuation ctxt sys ato == Just True@ if for every valuation -- @theta@ satisfying the graph constraints and all atoms in the constraint -- system @sys@, the atom @ato@ is also satisfied by @theta@. -- -- The interpretation for @Just False@ is analogous. @Nothing@ is used to -- represent *unknown*. --
974
false
true
0
21
299
183
85
98
null
null
fmapfmapfmap/amazonka
gen/src/Gen/AST/Data/Syntax.hs
mpl-2.0
dataD :: Id -> [QualConDecl] -> [Derive] -> Decl dataD n fs cs = DataDecl noLoc arity [] (ident (typeId n)) [] fs ds where arity = case fs of [QualConDecl _ _ _ (RecDecl _ [_])] -> NewType _ -> DataType ds = map ((,[]) . UnQual . Ident . drop 1 . show) cs
316
dataD :: Id -> [QualConDecl] -> [Derive] -> Decl dataD n fs cs = DataDecl noLoc arity [] (ident (typeId n)) [] fs ds where arity = case fs of [QualConDecl _ _ _ (RecDecl _ [_])] -> NewType _ -> DataType ds = map ((,[]) . UnQual . Ident . drop 1 . show) cs
316
dataD n fs cs = DataDecl noLoc arity [] (ident (typeId n)) [] fs ds where arity = case fs of [QualConDecl _ _ _ (RecDecl _ [_])] -> NewType _ -> DataType ds = map ((,[]) . UnQual . Ident . drop 1 . show) cs
267
false
true
1
13
116
151
77
74
null
null
sdiehl/ghc
libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs
bsd-3-clause
-- * Type Literals -- MonadFail here complicates things (a lot) because it would mean we would -- have to emit a MonadFail constraint during typechecking if there was any -- chance the desugaring would use numTyLit, which in general is hard to -- predict. numTyLit :: Quote m => Integer -> m TyLit numTyLit n = if n >= 0 then pure (NumTyLit n) else error ("Negative type-level number: " ++ show n)
421
numTyLit :: Quote m => Integer -> m TyLit numTyLit n = if n >= 0 then pure (NumTyLit n) else error ("Negative type-level number: " ++ show n)
164
numTyLit n = if n >= 0 then pure (NumTyLit n) else error ("Negative type-level number: " ++ show n)
122
true
true
0
9
97
67
35
32
null
null
ublubu/wyascheme
src/Types.hs
mit
showVal (Bool False) = "#f"
27
showVal (Bool False) = "#f"
27
showVal (Bool False) = "#f"
27
false
false
0
7
4
15
7
8
null
null
danr/stm-promise
tptp/Test.hs
lgpl-3.0
{- | A tree for this file structure: ├── mul-commutative │   ├── induction_x_0.tptp │   ├── induction_x_1.tptp │   ├── induction_x_y_0.tptp │   ├── induction_x_y_1.tptp │   ├── induction_x_y_2.tptp │   ├── induction_x_y_3.tptp │   ├── induction_y_0.tptp │   ├── induction_y_1.tptp │   └── no_induction_0.tptp └── plus-commutative    ├── induction_x_0.tptp    ├── induction_x_1.tptp    ├── induction_x_y_0.tptp    ├── induction_x_y_1.tptp    ├── induction_x_y_2.tptp    ├── induction_x_y_3.tptp    ├── induction_y_0.tptp    ├── induction_y_1.tptp    └── no_induction_0.tptp -} file_tree :: Tree FilePath file_tree = fmap (++ ".tptp") $ tryAll [ fmap ("mul-commutative/" ++) $ requireAny [ fmap ("induction_x_" ++) $ requireAll $ map Leaf ["0","1"] , fmap ("induction_y_" ++) $ requireAll $ map Leaf ["0","1"] , fmap ("induction_x_y_" ++) $ requireAll $ map Leaf ["0","1","2","3"] , Leaf "no_induction_0" ] , fmap ("plus-commutative/" ++) $ requireAny [ fmap ("induction_x_" ++) $ requireAll $ map Leaf ["0","1"] , fmap ("induction_y_" ++) $ requireAll $ map Leaf ["0","1"] , fmap ("induction_x_y_" ++) $ requireAll $ map Leaf ["0","1","2","3"] , Leaf "no_induction_0" ] ]
1,298
file_tree :: Tree FilePath file_tree = fmap (++ ".tptp") $ tryAll [ fmap ("mul-commutative/" ++) $ requireAny [ fmap ("induction_x_" ++) $ requireAll $ map Leaf ["0","1"] , fmap ("induction_y_" ++) $ requireAll $ map Leaf ["0","1"] , fmap ("induction_x_y_" ++) $ requireAll $ map Leaf ["0","1","2","3"] , Leaf "no_induction_0" ] , fmap ("plus-commutative/" ++) $ requireAny [ fmap ("induction_x_" ++) $ requireAll $ map Leaf ["0","1"] , fmap ("induction_y_" ++) $ requireAll $ map Leaf ["0","1"] , fmap ("induction_x_y_" ++) $ requireAll $ map Leaf ["0","1","2","3"] , Leaf "no_induction_0" ] ]
653
file_tree = fmap (++ ".tptp") $ tryAll [ fmap ("mul-commutative/" ++) $ requireAny [ fmap ("induction_x_" ++) $ requireAll $ map Leaf ["0","1"] , fmap ("induction_y_" ++) $ requireAll $ map Leaf ["0","1"] , fmap ("induction_x_y_" ++) $ requireAll $ map Leaf ["0","1","2","3"] , Leaf "no_induction_0" ] , fmap ("plus-commutative/" ++) $ requireAny [ fmap ("induction_x_" ++) $ requireAll $ map Leaf ["0","1"] , fmap ("induction_y_" ++) $ requireAll $ map Leaf ["0","1"] , fmap ("induction_x_y_" ++) $ requireAll $ map Leaf ["0","1","2","3"] , Leaf "no_induction_0" ] ]
626
true
true
2
13
322
268
144
124
null
null
IMOKURI/bulk-snmptrap-tool
src/ReadConfig.hs
mit
makeVarBind :: [[String]] -> Either CPError [ASN1] makeVarBind [] = Right []
76
makeVarBind :: [[String]] -> Either CPError [ASN1] makeVarBind [] = Right []
76
makeVarBind [] = Right []
25
false
true
0
8
11
44
21
23
null
null
ancientlanguage/haskell-analysis
grammar/src/Grammar/Common/Decompose.hs
mit
decomposeChar '\x0457' = "\x0456\x0308"
39
decomposeChar '\x0457' = "\x0456\x0308"
39
decomposeChar '\x0457' = "\x0456\x0308"
39
false
false
0
5
3
9
4
5
null
null
forked-upstream-packages-for-ghcjs/ghc
compiler/types/Type.hs
bsd-3-clause
mkAppTy ty1 ty2 = AppTy ty1 ty2
45
mkAppTy ty1 ty2 = AppTy ty1 ty2
45
mkAppTy ty1 ty2 = AppTy ty1 ty2
45
false
false
0
5
20
17
7
10
null
null
barrucadu/search-party
tests/CountDown.hs
mit
solutions :: [Int] -> Int -> [Expr] solutions ns n = [e | ns' <- choices ns , e <- exprs ns' , eval e == [n]]
219
solutions :: [Int] -> Int -> [Expr] solutions ns n = [e | ns' <- choices ns , e <- exprs ns' , eval e == [n]]
219
solutions ns n = [e | ns' <- choices ns , e <- exprs ns' , eval e == [n]]
163
false
true
0
8
136
69
35
34
null
null
tumarkin/vandelay
src/Vandelay/DSL/Core/Text.hs
bsd-3-clause
doSubstitution ∷ Text -- Input → [(Text, Text)] -- Substitutions → Text -- Transformed string doSubstitution = foldl' (\s (a,b) → T.replace a b s)
198
doSubstitution ∷ Text -- Input → [(Text, Text)] -- Substitutions → Text doSubstitution = foldl' (\s (a,b) → T.replace a b s)
166
doSubstitution = foldl' (\s (a,b) → T.replace a b s)
54
true
true
0
9
76
59
34
25
null
null
olsner/ghc
compiler/hsSyn/HsExpr.hs
bsd-3-clause
pprBinds :: (OutputableBndrId idL, OutputableBndrId idR) => HsLocalBindsLR idL idR -> SDoc pprBinds b = pprDeeper (ppr b)
130
pprBinds :: (OutputableBndrId idL, OutputableBndrId idR) => HsLocalBindsLR idL idR -> SDoc pprBinds b = pprDeeper (ppr b)
130
pprBinds b = pprDeeper (ppr b)
30
false
true
0
7
26
47
23
24
null
null
Lexer747/Haskell-Fractals
Core/CoreSVG.hs
gpl-3.0
{- The actual fromula for finding the boundingbox It works by receiving a pair of (all x's,all y's) and simply orders them correctly. -} findBB_help :: ([Float],[Float]) -> Polygon findBB_help (x,y) = [(minx, miny),(minx, maxy), (maxx, maxy),(maxx, miny)] where minx = minimum x maxx = maximum x miny = minimum y maxy = maximum y
346
findBB_help :: ([Float],[Float]) -> Polygon findBB_help (x,y) = [(minx, miny),(minx, maxy), (maxx, maxy),(maxx, miny)] where minx = minimum x maxx = maximum x miny = minimum y maxy = maximum y
208
findBB_help (x,y) = [(minx, miny),(minx, maxy), (maxx, maxy),(maxx, miny)] where minx = minimum x maxx = maximum x miny = minimum y maxy = maximum y
164
true
true
0
8
71
112
64
48
null
null
stulli/projectEuler
eu04.hs
bsd-3-clause
is_pal :: Int -> Bool is_pal n = reverse (show n) == show n
59
is_pal :: Int -> Bool is_pal n = reverse (show n) == show n
59
is_pal n = reverse (show n) == show n
37
false
true
0
8
13
34
16
18
null
null
phischu/fragnix
tests/packages/scotty/Control.Concurrent.Async.hs
bsd-3-clause
-- | Cancel an asynchronous action by throwing the supplied exception -- to it. -- -- > cancelWith a x = throwTo (asyncThreadId a) x -- -- The notes about the synchronous nature of 'cancel' also apply to -- 'cancelWith'. cancelWith :: Exception e => Async a -> e -> IO () cancelWith a@(Async t _) e = throwTo t e <* waitCatch a
327
cancelWith :: Exception e => Async a -> e -> IO () cancelWith a@(Async t _) e = throwTo t e <* waitCatch a
106
cancelWith a@(Async t _) e = throwTo t e <* waitCatch a
55
true
true
5
7
63
71
38
33
null
null
shlevy/ghc
libraries/base/GHC/Stable.hs
bsd-3-clause
-- | -- Create a stable pointer referring to the given Haskell value. -- newStablePtr :: a -> IO (StablePtr a) newStablePtr a = IO $ \ s -> case makeStablePtr# a s of (# s', sp #) -> (# s', StablePtr sp #) -- | -- Obtain the Haskell value referenced by a stable pointer, i.e., the -- same value that was passed to the corresponding call to -- 'makeStablePtr'. If the argument to 'deRefStablePtr' has -- already been freed using 'freeStablePtr', the behaviour of -- 'deRefStablePtr' is undefined. --
506
newStablePtr :: a -> IO (StablePtr a) newStablePtr a = IO $ \ s -> case makeStablePtr# a s of (# s', sp #) -> (# s', StablePtr sp #) -- | -- Obtain the Haskell value referenced by a stable pointer, i.e., the -- same value that was passed to the corresponding call to -- 'makeStablePtr'. If the argument to 'deRefStablePtr' has -- already been freed using 'freeStablePtr', the behaviour of -- 'deRefStablePtr' is undefined. --
433
newStablePtr a = IO $ \ s -> case makeStablePtr# a s of (# s', sp #) -> (# s', StablePtr sp #) -- | -- Obtain the Haskell value referenced by a stable pointer, i.e., the -- same value that was passed to the corresponding call to -- 'makeStablePtr'. If the argument to 'deRefStablePtr' has -- already been freed using 'freeStablePtr', the behaviour of -- 'deRefStablePtr' is undefined. --
393
true
true
0
11
98
74
42
32
null
null
urbanslug/ghc
compiler/prelude/THNames.hs
bsd-3-clause
-- type FieldExp = ... fieldExpName :: Name fieldExpName = libFun (fsLit "fieldExp") fieldExpIdKey
98
fieldExpName :: Name fieldExpName = libFun (fsLit "fieldExp") fieldExpIdKey
75
fieldExpName = libFun (fsLit "fieldExp") fieldExpIdKey
54
true
true
0
7
13
30
13
17
null
null
nejla/nejla-common
src/NejlaCommon/Persistence.hs
bsd-3-clause
-- | Convert Boolean value to Checkmark ('True' to 'Active', 'False' to -- 'Inactive') boolToCheckmark :: Bool -> Checkmark boolToCheckmark True = Active
153
boolToCheckmark :: Bool -> Checkmark boolToCheckmark True = Active
66
boolToCheckmark True = Active
29
true
true
0
5
22
24
12
12
null
null
yugr/sudoku
src/CNF.hs
mit
solve :: Bool -> CNF -> IO (Maybe [Lit]) solve keep_files cnf = do let dimacs = print_dimacs cnf (input_path, input_h) <- System.IO.openTempFile "." "board_in.cnf" System.IO.hPutStr input_h dimacs System.IO.hClose input_h (output_path, output_h) <- System.IO.openTempFile "." "board_out.cnf" System.IO.hClose output_h tic <- Data.Time.Clock.getCurrentTime (status, out, err) <- run_minisat input_path output_path tac <- Data.Time.Clock.getCurrentTime let dt = Data.Time.Clock.diffUTCTime tac tic putStrLn ("#variables: " ++ show (nvars cnf)) putStrLn ("#equations: " ++ show (neqs cnf)) putStrLn ("MiniSAT wall time: " ++ show dt) file_out <- readFile output_path -- putStr file_out if keep_files then return () else System.Directory.removeFile input_path -- System.Directory.removeFile output_path See https://ghc.haskell.org/trac/ghc/ticket/3231 case read_minisat_out file_out of Left msg -> error msg Right sol -> return sol
994
solve :: Bool -> CNF -> IO (Maybe [Lit]) solve keep_files cnf = do let dimacs = print_dimacs cnf (input_path, input_h) <- System.IO.openTempFile "." "board_in.cnf" System.IO.hPutStr input_h dimacs System.IO.hClose input_h (output_path, output_h) <- System.IO.openTempFile "." "board_out.cnf" System.IO.hClose output_h tic <- Data.Time.Clock.getCurrentTime (status, out, err) <- run_minisat input_path output_path tac <- Data.Time.Clock.getCurrentTime let dt = Data.Time.Clock.diffUTCTime tac tic putStrLn ("#variables: " ++ show (nvars cnf)) putStrLn ("#equations: " ++ show (neqs cnf)) putStrLn ("MiniSAT wall time: " ++ show dt) file_out <- readFile output_path -- putStr file_out if keep_files then return () else System.Directory.removeFile input_path -- System.Directory.removeFile output_path See https://ghc.haskell.org/trac/ghc/ticket/3231 case read_minisat_out file_out of Left msg -> error msg Right sol -> return sol
994
solve keep_files cnf = do let dimacs = print_dimacs cnf (input_path, input_h) <- System.IO.openTempFile "." "board_in.cnf" System.IO.hPutStr input_h dimacs System.IO.hClose input_h (output_path, output_h) <- System.IO.openTempFile "." "board_out.cnf" System.IO.hClose output_h tic <- Data.Time.Clock.getCurrentTime (status, out, err) <- run_minisat input_path output_path tac <- Data.Time.Clock.getCurrentTime let dt = Data.Time.Clock.diffUTCTime tac tic putStrLn ("#variables: " ++ show (nvars cnf)) putStrLn ("#equations: " ++ show (neqs cnf)) putStrLn ("MiniSAT wall time: " ++ show dt) file_out <- readFile output_path -- putStr file_out if keep_files then return () else System.Directory.removeFile input_path -- System.Directory.removeFile output_path See https://ghc.haskell.org/trac/ghc/ticket/3231 case read_minisat_out file_out of Left msg -> error msg Right sol -> return sol
953
false
true
0
13
179
313
149
164
null
null
pgj/bead
src/Bead/View/ResetPassword.hs
bsd-3-clause
readParameter :: (MonadSnap m) => Parameter a -> m (Maybe a) readParameter param = do reqParam <- getParam . fromString . name $ param return (reqParam >>= decode param . B.unpack) -- * Helpers
198
readParameter :: (MonadSnap m) => Parameter a -> m (Maybe a) readParameter param = do reqParam <- getParam . fromString . name $ param return (reqParam >>= decode param . B.unpack) -- * Helpers
198
readParameter param = do reqParam <- getParam . fromString . name $ param return (reqParam >>= decode param . B.unpack) -- * Helpers
137
false
true
0
11
38
81
39
42
null
null
ezyang/ghc
testsuite/tests/polykinds/T11480b.hs
bsd-3-clause
-- comment required for cpp (\\) :: a => (b => r) -> (a :- b) -> r r \\ Sub Dict = r
84
(\\) :: a => (b => r) -> (a :- b) -> r r \\ Sub Dict = r
56
r \\ Sub Dict = r
17
true
true
0
10
23
52
26
26
null
null
CRogers/stack
src/Stack/Build/Execute.hs
bsd-3-clause
executePlan' :: M env m => Plan -> ExecuteEnv -> m () executePlan' plan ee@ExecuteEnv {..} = do case Map.toList $ planUnregisterLocal plan of [] -> return () ids -> do localDB <- packageDatabaseLocal forM_ ids $ \(id', reason) -> do $logInfo $ T.concat [ T.pack $ ghcPkgIdString id' , ": unregistering (" , reason , ")" ] unregisterGhcPkgId eeEnvOverride localDB id' -- Yes, we're explicitly discarding result values, which in general would -- be bad. monad-unlift does this all properly at the type system level, -- but I don't want to pull it in for this one use case, when we know that -- stack always using transformer stacks that are safe for this use case. runInBase <- liftBaseWith $ \run -> return (void . run) let actions = concatMap (toActions runInBase ee) $ Map.elems $ Map.mergeWithKey (\_ b f -> Just (Just b, Just f)) (fmap (\b -> (Just b, Nothing))) (fmap (\f -> (Nothing, Just f))) (planTasks plan) (planFinals plan) threads <- asks $ configJobs . getConfig concurrentTests <- asks $ configConcurrentTests . getConfig let keepGoing = case boptsKeepGoing eeBuildOpts of Just kg -> kg Nothing -> case boptsFinalAction eeBuildOpts of DoNothing -> False _ -> True concurrentFinal = case boptsFinalAction eeBuildOpts of DoTests _ -> concurrentTests _ -> True terminal <- asks getTerminal errs <- liftIO $ runActions threads keepGoing concurrentFinal actions $ \doneVar -> do let total = length actions loop prev | prev == total = runInBase $ $logStickyDone ("Completed all " <> T.pack (show total) <> " actions.") | otherwise = do when terminal $ runInBase $ $logSticky ("Progress: " <> T.pack (show prev) <> "/" <> T.pack (show total)) done <- atomically $ do done <- readTVar doneVar check $ done /= prev return done loop done if total > 1 then loop 0 else return () unless (null errs) $ throwM $ ExecutionFailure errs when (boptsHaddock eeBuildOpts && not (null actions)) (generateHaddockIndex eeEnvOverride eeBaseConfigOpts eeLocals)
2,710
executePlan' :: M env m => Plan -> ExecuteEnv -> m () executePlan' plan ee@ExecuteEnv {..} = do case Map.toList $ planUnregisterLocal plan of [] -> return () ids -> do localDB <- packageDatabaseLocal forM_ ids $ \(id', reason) -> do $logInfo $ T.concat [ T.pack $ ghcPkgIdString id' , ": unregistering (" , reason , ")" ] unregisterGhcPkgId eeEnvOverride localDB id' -- Yes, we're explicitly discarding result values, which in general would -- be bad. monad-unlift does this all properly at the type system level, -- but I don't want to pull it in for this one use case, when we know that -- stack always using transformer stacks that are safe for this use case. runInBase <- liftBaseWith $ \run -> return (void . run) let actions = concatMap (toActions runInBase ee) $ Map.elems $ Map.mergeWithKey (\_ b f -> Just (Just b, Just f)) (fmap (\b -> (Just b, Nothing))) (fmap (\f -> (Nothing, Just f))) (planTasks plan) (planFinals plan) threads <- asks $ configJobs . getConfig concurrentTests <- asks $ configConcurrentTests . getConfig let keepGoing = case boptsKeepGoing eeBuildOpts of Just kg -> kg Nothing -> case boptsFinalAction eeBuildOpts of DoNothing -> False _ -> True concurrentFinal = case boptsFinalAction eeBuildOpts of DoTests _ -> concurrentTests _ -> True terminal <- asks getTerminal errs <- liftIO $ runActions threads keepGoing concurrentFinal actions $ \doneVar -> do let total = length actions loop prev | prev == total = runInBase $ $logStickyDone ("Completed all " <> T.pack (show total) <> " actions.") | otherwise = do when terminal $ runInBase $ $logSticky ("Progress: " <> T.pack (show prev) <> "/" <> T.pack (show total)) done <- atomically $ do done <- readTVar doneVar check $ done /= prev return done loop done if total > 1 then loop 0 else return () unless (null errs) $ throwM $ ExecutionFailure errs when (boptsHaddock eeBuildOpts && not (null actions)) (generateHaddockIndex eeEnvOverride eeBaseConfigOpts eeLocals)
2,710
executePlan' plan ee@ExecuteEnv {..} = do case Map.toList $ planUnregisterLocal plan of [] -> return () ids -> do localDB <- packageDatabaseLocal forM_ ids $ \(id', reason) -> do $logInfo $ T.concat [ T.pack $ ghcPkgIdString id' , ": unregistering (" , reason , ")" ] unregisterGhcPkgId eeEnvOverride localDB id' -- Yes, we're explicitly discarding result values, which in general would -- be bad. monad-unlift does this all properly at the type system level, -- but I don't want to pull it in for this one use case, when we know that -- stack always using transformer stacks that are safe for this use case. runInBase <- liftBaseWith $ \run -> return (void . run) let actions = concatMap (toActions runInBase ee) $ Map.elems $ Map.mergeWithKey (\_ b f -> Just (Just b, Just f)) (fmap (\b -> (Just b, Nothing))) (fmap (\f -> (Nothing, Just f))) (planTasks plan) (planFinals plan) threads <- asks $ configJobs . getConfig concurrentTests <- asks $ configConcurrentTests . getConfig let keepGoing = case boptsKeepGoing eeBuildOpts of Just kg -> kg Nothing -> case boptsFinalAction eeBuildOpts of DoNothing -> False _ -> True concurrentFinal = case boptsFinalAction eeBuildOpts of DoTests _ -> concurrentTests _ -> True terminal <- asks getTerminal errs <- liftIO $ runActions threads keepGoing concurrentFinal actions $ \doneVar -> do let total = length actions loop prev | prev == total = runInBase $ $logStickyDone ("Completed all " <> T.pack (show total) <> " actions.") | otherwise = do when terminal $ runInBase $ $logSticky ("Progress: " <> T.pack (show prev) <> "/" <> T.pack (show total)) done <- atomically $ do done <- readTVar doneVar check $ done /= prev return done loop done if total > 1 then loop 0 else return () unless (null errs) $ throwM $ ExecutionFailure errs when (boptsHaddock eeBuildOpts && not (null actions)) (generateHaddockIndex eeEnvOverride eeBaseConfigOpts eeLocals)
2,617
false
true
81
12
1,084
647
342
305
null
null
madelgi/linear
src/Algebra/Matrix/Base.hs
mit
-- | Checks if two matrices have the same dimensions sameDim :: (Num a) => Matrix a -> Matrix a -> Bool sameDim m1 m2 = (rows m1 == rows m2) && (cols m1 == cols m2)
164
sameDim :: (Num a) => Matrix a -> Matrix a -> Bool sameDim m1 m2 = (rows m1 == rows m2) && (cols m1 == cols m2)
111
sameDim m1 m2 = (rows m1 == rows m2) && (cols m1 == cols m2)
60
true
true
0
9
36
76
35
41
null
null
danplubell/CTG1371
library/Data/CTG1371/Internal/Types.hs
mit
setMonitorOn :: Bool -> CTGStatus -> CTGStatus setMonitorOn = set monitorOn
75
setMonitorOn :: Bool -> CTGStatus -> CTGStatus setMonitorOn = set monitorOn
75
setMonitorOn = set monitorOn
28
false
true
0
6
10
22
11
11
null
null
phillc/agentvsagent
cards-agents-in-a-box/hearts/haskell/MyAgent.hs
mit
noHearts :: [Card] -> [Card] noHearts cards = filter (\card -> suit card /= HEARTS) cards
89
noHearts :: [Card] -> [Card] noHearts cards = filter (\card -> suit card /= HEARTS) cards
89
noHearts cards = filter (\card -> suit card /= HEARTS) cards
60
false
true
0
9
15
50
24
26
null
null
ekalosak/haskell-practice
pr9.hs
lgpl-3.0
h1 (x:xs) = if xs == [] then ([x], []) else if x == head(xs) then let y = h1 xs in ([x] ++ fst(y), snd(y)) else ([x], xs)
137
h1 (x:xs) = if xs == [] then ([x], []) else if x == head(xs) then let y = h1 xs in ([x] ++ fst(y), snd(y)) else ([x], xs)
137
h1 (x:xs) = if xs == [] then ([x], []) else if x == head(xs) then let y = h1 xs in ([x] ++ fst(y), snd(y)) else ([x], xs)
137
false
false
0
12
44
108
59
49
null
null
andorp/grin
grin/experiments/FreshNames.hs
bsd-3-clause
-- TODO: Better probabilites varCodeSlow :: forall s . (Show s, Eq s, Bounded s, Enum s) => Cofree ExpF [s] -> Cofree ExpF Natural varCodeSlow = fmap (encode (ans_iso $ classify_prob (replicate 11 (1.0 / 11))))
210
varCodeSlow :: forall s . (Show s, Eq s, Bounded s, Enum s) => Cofree ExpF [s] -> Cofree ExpF Natural varCodeSlow = fmap (encode (ans_iso $ classify_prob (replicate 11 (1.0 / 11))))
181
varCodeSlow = fmap (encode (ans_iso $ classify_prob (replicate 11 (1.0 / 11))))
79
true
true
0
14
36
95
49
46
null
null
input-output-hk/pos-haskell-prototype
util/test/Test/Pos/Util/WlogSpec.hs
mit
prop_large :: Property prop_large = monadicIO $ do (diffTime,_) <- run (run_logging Debug 100 200 100) assert (diffTime > 0) -- | Count as many lines as you intended to log.
194
prop_large :: Property prop_large = monadicIO $ do (diffTime,_) <- run (run_logging Debug 100 200 100) assert (diffTime > 0) -- | Count as many lines as you intended to log.
194
prop_large = monadicIO $ do (diffTime,_) <- run (run_logging Debug 100 200 100) assert (diffTime > 0) -- | Count as many lines as you intended to log.
171
false
true
0
11
51
57
29
28
null
null
DanielSchuessler/hstri
Simplicial/SimplicialComplex.hs
gpl-3.0
fromEdges :: Ord v => [Pair v] -> SC1 v fromEdges = fromOrderedEdges . map asc2
79
fromEdges :: Ord v => [Pair v] -> SC1 v fromEdges = fromOrderedEdges . map asc2
79
fromEdges = fromOrderedEdges . map asc2
39
false
true
0
8
15
38
18
20
null
null
uduki/hsQt
Qtc/Enums/Core/QUuid.hs
bsd-2-clause
eEmbeddedPOSIX :: QUuidVersion eEmbeddedPOSIX = ieQUuidVersion $ 2
68
eEmbeddedPOSIX :: QUuidVersion eEmbeddedPOSIX = ieQUuidVersion $ 2
68
eEmbeddedPOSIX = ieQUuidVersion $ 2
37
false
true
0
6
9
18
8
10
null
null
rhennigan/code
haskell/pcdSimplification/src/paperFunctions.hs
gpl-2.0
acc' x (yh:yt) = acc' (x ++ [last' x + yh]) yt
46
acc' x (yh:yt) = acc' (x ++ [last' x + yh]) yt
46
acc' x (yh:yt) = acc' (x ++ [last' x + yh]) yt
46
false
false
0
10
11
43
20
23
null
null
jean-edouard/manager
updatemgr/UpdateMgr/Logic.hs
gpl-2.0
releasesInfoPath :: FilePath releasesInfoPath = updateDirBase </> "releases"
76
releasesInfoPath :: FilePath releasesInfoPath = updateDirBase </> "releases"
76
releasesInfoPath = updateDirBase </> "releases"
47
false
true
0
6
7
22
9
13
null
null
sjakobi/zsh-battery
Files.hs
bsd-3-clause
batteryfile :: ErrorT String IO FilePath batteryfile = do all <- liftIO $ getDirectoryContents batterydir case filter (("BAT" `isPrefixOf`)) all of [] -> throwError "No batteries present" (x:_) -> return $ batterydir </> x
240
batteryfile :: ErrorT String IO FilePath batteryfile = do all <- liftIO $ getDirectoryContents batterydir case filter (("BAT" `isPrefixOf`)) all of [] -> throwError "No batteries present" (x:_) -> return $ batterydir </> x
240
batteryfile = do all <- liftIO $ getDirectoryContents batterydir case filter (("BAT" `isPrefixOf`)) all of [] -> throwError "No batteries present" (x:_) -> return $ batterydir </> x
199
false
true
0
11
51
85
43
42
null
null
siddhanathan/ghc
compiler/basicTypes/NameEnv.hs
bsd-3-clause
extendNameEnv x y z = addToUFM x y z
38
extendNameEnv x y z = addToUFM x y z
38
extendNameEnv x y z = addToUFM x y z
38
false
false
0
5
10
22
9
13
null
null
nevrenato/HetsAlloy
CASL/CompositionTable/ParseSparQ.hs
gpl-2.0
inParens :: Parser a -> Parser a inParens p = oParenT >> p << cParenT
69
inParens :: Parser a -> Parser a inParens p = oParenT >> p << cParenT
69
inParens p = oParenT >> p << cParenT
36
false
true
0
6
14
32
15
17
null
null
d0kt0r0/estuary
client/src/Estuary/Types/View/Parser.hs
gpl-3.0
rouletteViewViewFunc :: Int -> Int -> View rouletteViewViewFunc x y = RouletteView x y
86
rouletteViewViewFunc :: Int -> Int -> View rouletteViewViewFunc x y = RouletteView x y
86
rouletteViewViewFunc x y = RouletteView x y
43
false
true
0
6
13
29
14
15
null
null
brendanhay/gogol
gogol-gmail/gen/Network/Google/Gmail/Types/Product.hs
mpl-2.0
-- | Whether this SmimeInfo is the default one for this user\'s send-as -- address. siIsDefault :: Lens' SmimeInfo (Maybe Bool) siIsDefault = lens _siIsDefault (\ s a -> s{_siIsDefault = a})
192
siIsDefault :: Lens' SmimeInfo (Maybe Bool) siIsDefault = lens _siIsDefault (\ s a -> s{_siIsDefault = a})
108
siIsDefault = lens _siIsDefault (\ s a -> s{_siIsDefault = a})
64
true
true
2
9
33
56
26
30
null
null
WSCU/JSEuterpea
Euterpea Examples/SimpleEuterpea.hs
gpl-3.0
f1 = pitchToMusic 28
21
ff1 = pitchToMusic 28
21
ff1 = pitchToMusic 28
21
false
false
0
5
4
9
4
5
null
null
phischu/fragnix
tests/packages/scotty/System.Posix.Terminal.hs
bsd-3-clause
getControllingTerminalName = do s <- throwErrnoIfNull "getControllingTerminalName" (c_ctermid nullPtr) peekFilePath s
121
getControllingTerminalName = do s <- throwErrnoIfNull "getControllingTerminalName" (c_ctermid nullPtr) peekFilePath s
121
getControllingTerminalName = do s <- throwErrnoIfNull "getControllingTerminalName" (c_ctermid nullPtr) peekFilePath s
121
false
false
0
10
14
30
13
17
null
null
mettekou/ghc
compiler/prelude/TysWiredIn.hs
bsd-3-clause
false_RDR = nameRdrName falseDataConName
46
false_RDR = nameRdrName falseDataConName
46
false_RDR = nameRdrName falseDataConName
46
false
false
0
5
9
9
4
5
null
null
rfranek/duckling
Duckling/Time/DA/Rules.hs
bsd-3-clause
ruleTheCycleAfterTime :: Rule ruleTheCycleAfterTime = Rule { name = "the <cycle> after <time>" , pattern = [ dimension TimeGrain , regex "(en|tet|et)? efter" , dimension Time ] , prod = \tokens -> case tokens of (Token TimeGrain grain:_:Token Time td:_) -> tt $ cycleNthAfter False grain 1 td _ -> Nothing }
351
ruleTheCycleAfterTime :: Rule ruleTheCycleAfterTime = Rule { name = "the <cycle> after <time>" , pattern = [ dimension TimeGrain , regex "(en|tet|et)? efter" , dimension Time ] , prod = \tokens -> case tokens of (Token TimeGrain grain:_:Token Time td:_) -> tt $ cycleNthAfter False grain 1 td _ -> Nothing }
351
ruleTheCycleAfterTime = Rule { name = "the <cycle> after <time>" , pattern = [ dimension TimeGrain , regex "(en|tet|et)? efter" , dimension Time ] , prod = \tokens -> case tokens of (Token TimeGrain grain:_:Token Time td:_) -> tt $ cycleNthAfter False grain 1 td _ -> Nothing }
321
false
true
0
16
95
112
58
54
null
null
sjakobi/bloodhound
src/Database/Bloodhound/Types.hs
bsd-3-clause
{-| 'mkSort' defaults everything but the 'FieldName' and the 'SortOrder' so that you can concisely describe the usual kind of 'SortSpec's you want. -} mkSort :: FieldName -> SortOrder -> DefaultSort mkSort fieldName sOrder = DefaultSort fieldName sOrder False Nothing Nothing Nothing
287
mkSort :: FieldName -> SortOrder -> DefaultSort mkSort fieldName sOrder = DefaultSort fieldName sOrder False Nothing Nothing Nothing
132
mkSort fieldName sOrder = DefaultSort fieldName sOrder False Nothing Nothing Nothing
84
true
true
0
6
45
38
19
19
null
null
ekmett/structures
src/Data/Vector/Set/Fusion.hs
bsd-2-clause
-- | This is the internal stream fusion combinator used to merge streams for addition. merge :: (Monad m, Ord k) => Stream m k -> Stream m k -> Stream m k merge (Stream stepa sa0 na) (Stream stepb sb0 nb) = Stream step (MergeStart sa0 sb0) (toMax na + toMax nb) where step (MergeStart sa sb) = do r <- stepa sa return $ case r of Yield i sa' -> Skip (MergeL sa' sb i) Skip sa' -> Skip (MergeStart sa' sb) Done -> Skip (MergeLeftEnded sb) step (MergeL sa sb i) = do r <- stepb sb return $ case r of Yield j sb' -> case compare i j of LT -> Yield i (MergeR sa sb' j) EQ -> Yield i (MergeStart sa sb') GT -> Yield j (MergeL sa sb' i) Skip sb' -> Skip (MergeL sa sb' i) Done -> Yield i (MergeRightEnded sa) step (MergeR sa sb j) = do r <- stepa sa return $ case r of Yield i sa' -> case compare i j of LT -> Yield i (MergeR sa' sb j) EQ -> Yield i (MergeStart sa' sb) GT -> Yield j (MergeL sa' sb i) Skip sa' -> Skip (MergeR sa' sb j) Done -> Yield j (MergeLeftEnded sb) step (MergeLeftEnded sb) = do r <- stepb sb return $ case r of Yield j sb' -> Yield j (MergeLeftEnded sb') Skip sb' -> Skip (MergeLeftEnded sb') Done -> Done step (MergeRightEnded sa) = do r <- stepa sa return $ case r of Yield i sa' -> Yield i (MergeRightEnded sa') Skip sa' -> Skip (MergeRightEnded sa') Done -> Done {-# INLINE [0] step #-}
1,548
merge :: (Monad m, Ord k) => Stream m k -> Stream m k -> Stream m k merge (Stream stepa sa0 na) (Stream stepb sb0 nb) = Stream step (MergeStart sa0 sb0) (toMax na + toMax nb) where step (MergeStart sa sb) = do r <- stepa sa return $ case r of Yield i sa' -> Skip (MergeL sa' sb i) Skip sa' -> Skip (MergeStart sa' sb) Done -> Skip (MergeLeftEnded sb) step (MergeL sa sb i) = do r <- stepb sb return $ case r of Yield j sb' -> case compare i j of LT -> Yield i (MergeR sa sb' j) EQ -> Yield i (MergeStart sa sb') GT -> Yield j (MergeL sa sb' i) Skip sb' -> Skip (MergeL sa sb' i) Done -> Yield i (MergeRightEnded sa) step (MergeR sa sb j) = do r <- stepa sa return $ case r of Yield i sa' -> case compare i j of LT -> Yield i (MergeR sa' sb j) EQ -> Yield i (MergeStart sa' sb) GT -> Yield j (MergeL sa' sb i) Skip sa' -> Skip (MergeR sa' sb j) Done -> Yield j (MergeLeftEnded sb) step (MergeLeftEnded sb) = do r <- stepb sb return $ case r of Yield j sb' -> Yield j (MergeLeftEnded sb') Skip sb' -> Skip (MergeLeftEnded sb') Done -> Done step (MergeRightEnded sa) = do r <- stepa sa return $ case r of Yield i sa' -> Yield i (MergeRightEnded sa') Skip sa' -> Skip (MergeRightEnded sa') Done -> Done {-# INLINE [0] step #-}
1,461
merge (Stream stepa sa0 na) (Stream stepb sb0 nb) = Stream step (MergeStart sa0 sb0) (toMax na + toMax nb) where step (MergeStart sa sb) = do r <- stepa sa return $ case r of Yield i sa' -> Skip (MergeL sa' sb i) Skip sa' -> Skip (MergeStart sa' sb) Done -> Skip (MergeLeftEnded sb) step (MergeL sa sb i) = do r <- stepb sb return $ case r of Yield j sb' -> case compare i j of LT -> Yield i (MergeR sa sb' j) EQ -> Yield i (MergeStart sa sb') GT -> Yield j (MergeL sa sb' i) Skip sb' -> Skip (MergeL sa sb' i) Done -> Yield i (MergeRightEnded sa) step (MergeR sa sb j) = do r <- stepa sa return $ case r of Yield i sa' -> case compare i j of LT -> Yield i (MergeR sa' sb j) EQ -> Yield i (MergeStart sa' sb) GT -> Yield j (MergeL sa' sb i) Skip sa' -> Skip (MergeR sa' sb j) Done -> Yield j (MergeLeftEnded sb) step (MergeLeftEnded sb) = do r <- stepb sb return $ case r of Yield j sb' -> Yield j (MergeLeftEnded sb') Skip sb' -> Skip (MergeLeftEnded sb') Done -> Done step (MergeRightEnded sa) = do r <- stepa sa return $ case r of Yield i sa' -> Yield i (MergeRightEnded sa') Skip sa' -> Skip (MergeRightEnded sa') Done -> Done {-# INLINE [0] step #-}
1,393
true
true
0
18
519
682
318
364
null
null
spire/spire
src/Spire/Surface/PrettyPrinter.hs
bsd-3-clause
pairAssoc = AssocRight
27
pairAssoc = AssocRight
27
pairAssoc = AssocRight
27
false
false
1
5
7
10
3
7
null
null
nevrenato/HetsAlloy
CSL/InteractiveTests.hs
gpl-2.0
getMathState :: Maybe CASState -> MathState getMathState (Just (MathematicaState mst)) = mst
92
getMathState :: Maybe CASState -> MathState getMathState (Just (MathematicaState mst)) = mst
92
getMathState (Just (MathematicaState mst)) = mst
48
false
true
0
9
11
33
16
17
null
null
karamellpelle/grid
designer/source/OpenGL/Helpers/Drawings.hs
gpl-3.0
drawGroundTile :: MonadIO m => m () drawGroundTile = liftIO $ GL.unsafeRenderPrimitive Quads $ do vertex3 0 0 0 vertex3 0 0 1 vertex3 1 0 1 vertex3 1 0 0 -- | draw grid in xz-plane, with range [a, b)
217
drawGroundTile :: MonadIO m => m () drawGroundTile = liftIO $ GL.unsafeRenderPrimitive Quads $ do vertex3 0 0 0 vertex3 0 0 1 vertex3 1 0 1 vertex3 1 0 0 -- | draw grid in xz-plane, with range [a, b)
217
drawGroundTile = liftIO $ GL.unsafeRenderPrimitive Quads $ do vertex3 0 0 0 vertex3 0 0 1 vertex3 1 0 1 vertex3 1 0 0 -- | draw grid in xz-plane, with range [a, b)
181
false
true
2
9
58
84
35
49
null
null
CindyLinz/Haskell.js
trans/src/Desugar/CaseReorder.hs
mit
deCaseReorderInstDecl :: SymbolTableDataCon' l -> InstDecl l -> InstDecl l deCaseReorderInstDecl a1 (InsDecl l decl) = InsDecl (id l) (deCaseReorderDecl a1 decl)
161
deCaseReorderInstDecl :: SymbolTableDataCon' l -> InstDecl l -> InstDecl l deCaseReorderInstDecl a1 (InsDecl l decl) = InsDecl (id l) (deCaseReorderDecl a1 decl)
161
deCaseReorderInstDecl a1 (InsDecl l decl) = InsDecl (id l) (deCaseReorderDecl a1 decl)
86
false
true
0
7
21
60
28
32
null
null
copton/ocram
ocram/src/Ocram/Names.hs
gpl-2.0
-- |The type alias for a T-stack frame tframe :: String -> String tframe = printf "%stframe_%s_t" ecPrefix
106
tframe :: String -> String tframe = printf "%stframe_%s_t" ecPrefix
67
tframe = printf "%stframe_%s_t" ecPrefix
40
true
true
0
7
17
29
12
17
null
null
oldmanmike/ghc
compiler/basicTypes/VarEnv.hs
bsd-3-clause
foldVarEnv = foldUFM
26
foldVarEnv = foldUFM
26
foldVarEnv = foldUFM
26
false
false
1
5
8
10
3
7
null
null
phipsgabler/mini-lambda
src/MiniLambda.hs
unlicense
evalStepWith :: Env -> Expr -> Expr evalStepWith env expr = runReader (normalizeStep expr) env
94
evalStepWith :: Env -> Expr -> Expr evalStepWith env expr = runReader (normalizeStep expr) env
94
evalStepWith env expr = runReader (normalizeStep expr) env
58
false
true
0
8
14
40
18
22
null
null
bmmoore/logic
Logic/Orders.hs
bsd-3-clause
termWeight _ (VarTerm _) = 1
28
termWeight _ (VarTerm _) = 1
28
termWeight _ (VarTerm _) = 1
28
false
false
0
7
5
17
8
9
null
null
kinoru/unbreak
lib/Unbreak/Crypto.hs
agpl-3.0
encrypt :: ByteString -- ^ nonce (12 random bytes, must be different each time) -> ByteString -- ^ the secret symmetric key -> ByteString -- ^ the plaintext to be encrypted -> CryptoFailable ByteString -- ^ ciphertext with a 128-bit tag attached encrypt nonce key plaintext = (nonce ++) <$> encrypt' nonce key "" plaintext
338
encrypt :: ByteString -- ^ nonce (12 random bytes, must be different each time) -> ByteString -- ^ the secret symmetric key -> ByteString -- ^ the plaintext to be encrypted -> CryptoFailable ByteString encrypt nonce key plaintext = (nonce ++) <$> encrypt' nonce key "" plaintext
294
encrypt nonce key plaintext = (nonce ++) <$> encrypt' nonce key "" plaintext
76
true
true
0
9
70
58
30
28
null
null
JCGrant/JLang
src/Backend/Interpreter.hs
bsd-3-clause
eval (Add lExpr rExpr) env = eval lExpr env + eval rExpr env
61
eval (Add lExpr rExpr) env = eval lExpr env + eval rExpr env
61
eval (Add lExpr rExpr) env = eval lExpr env + eval rExpr env
61
false
false
0
6
13
34
15
19
null
null
tomjefferys/fuligite
src/Scripting/Fuligite/Eval.hs
mit
boolValue _ = True
24
boolValue _ = True
24
boolValue _ = True
24
false
false
0
4
9
10
4
6
null
null
iliastsi/gac
src/typecheck/TypeCheck.hs
mit
typeCheckStmt _ (L loc (UStmtFun lf@(L _ (UFuncCall fname _)))) = do afunc@(AFuncCall _ ftype) <- typeCheckFunc lf flags <- getDynFlags when ((ATypeF ftype)/=(ATypeF $ TTypeRetIO TTypeProc) && (ATypeF ftype)/=(ATypeF $ TTypeRetIO TTypeUnknown) && (dopt Opt_WarnUnusedResult flags)) $ addTypeWarning loc (UnusedRsError (unLoc fname)) "" return (False, TStmtFun afunc) -- UStmtIf
427
typeCheckStmt _ (L loc (UStmtFun lf@(L _ (UFuncCall fname _)))) = do afunc@(AFuncCall _ ftype) <- typeCheckFunc lf flags <- getDynFlags when ((ATypeF ftype)/=(ATypeF $ TTypeRetIO TTypeProc) && (ATypeF ftype)/=(ATypeF $ TTypeRetIO TTypeUnknown) && (dopt Opt_WarnUnusedResult flags)) $ addTypeWarning loc (UnusedRsError (unLoc fname)) "" return (False, TStmtFun afunc) -- UStmtIf
427
typeCheckStmt _ (L loc (UStmtFun lf@(L _ (UFuncCall fname _)))) = do afunc@(AFuncCall _ ftype) <- typeCheckFunc lf flags <- getDynFlags when ((ATypeF ftype)/=(ATypeF $ TTypeRetIO TTypeProc) && (ATypeF ftype)/=(ATypeF $ TTypeRetIO TTypeUnknown) && (dopt Opt_WarnUnusedResult flags)) $ addTypeWarning loc (UnusedRsError (unLoc fname)) "" return (False, TStmtFun afunc) -- UStmtIf
427
false
false
0
16
99
176
86
90
null
null
FPtje/GLuaFixer
src/GLua/PSParser.hs
lgpl-2.1
-- | Parse variable list (var1, var2, var3) parseVarList :: AParser [PrefixExp] parseVarList = sepBy1 parseVar (pMTok Comma)
124
parseVarList :: AParser [PrefixExp] parseVarList = sepBy1 parseVar (pMTok Comma)
80
parseVarList = sepBy1 parseVar (pMTok Comma)
44
true
true
0
7
17
29
15
14
null
null
oldmanmike/ghc
libraries/template-haskell/Language/Haskell/TH/Syntax.hs
bsd-3-clause
{- Note [Role of TExp] ~~~~~~~~~~~~~~~~~~~~~~ TExp's argument must have a nominal role, not phantom as would be inferred (Trac #8459). Consider e :: TExp Age e = MkAge 3 foo = $(coerce e) + 4::Int The splice will evaluate to (MkAge 3) and you can't add that to 4::Int. So you can't coerce a (TExp Age) to a (TExp Int). -} ---------------------------------------------------- -- Packaged versions for the programmer, hiding the Quasi-ness {- | Generate a fresh name, which cannot be captured. For example, this: @f = $(do nm1 <- newName \"x\" let nm2 = 'mkName' \"x\" return ('LamE' ['VarP' nm1] (LamE [VarP nm2] ('VarE' nm1))) )@ will produce the splice >f = \x0 -> \x -> x0 In particular, the occurrence @VarE nm1@ refers to the binding @VarP nm1@, and is not captured by the binding @VarP nm2@. Although names generated by @newName@ cannot /be captured/, they can /capture/ other names. For example, this: >g = $(do > nm1 <- newName "x" > let nm2 = mkName "x" > return (LamE [VarP nm2] (LamE [VarP nm1] (VarE nm2))) > ) will produce the splice >g = \x -> \x0 -> x0 since the occurrence @VarE nm2@ is captured by the innermost binding of @x@, namely @VarP nm1@. -} newName :: String -> Q Name newName s = Q (qNewName s)
1,252
newName :: String -> Q Name newName s = Q (qNewName s)
54
newName s = Q (qNewName s)
26
true
true
0
7
252
37
19
18
null
null
tiffany352/permuto
src/main.hs
mit
libDip (Quote (c,q):b:st) = fmap (\(st',c)-> push b st') $ evalExprs c st q
75
libDip (Quote (c,q):b:st) = fmap (\(st',c)-> push b st') $ evalExprs c st q
75
libDip (Quote (c,q):b:st) = fmap (\(st',c)-> push b st') $ evalExprs c st q
75
false
false
0
8
13
63
32
31
null
null
Tener/HaNS
src/Network/TCP/Type/Base.hs
bsd-3-clause
bufferchain_split_at :: Int -> BufferChain -> (BufferChain,BufferChain) bufferchain_split_at = L.splitAt . fromIntegral
120
bufferchain_split_at :: Int -> BufferChain -> (BufferChain,BufferChain) bufferchain_split_at = L.splitAt . fromIntegral
120
bufferchain_split_at = L.splitAt . fromIntegral
48
false
true
0
7
12
31
17
14
null
null
ddssff/lens
src/Control/Lens/Internal/TH.hs
bsd-3-clause
-- | Return 'Name' contained in a 'TyVarBndr'. bndrName :: TyVarBndr -> Name bndrName (PlainTV n ) = n
104
bndrName :: TyVarBndr -> Name bndrName (PlainTV n ) = n
57
bndrName (PlainTV n ) = n
27
true
true
0
7
20
25
13
12
null
null
DavidAlphaFox/ghc
libraries/Cabal/Cabal/Distribution/Simple/Utils.hs
bsd-3-clause
defaultTempFileOptions :: TempFileOptions defaultTempFileOptions = TempFileOptions { optKeepTempFiles = False }
111
defaultTempFileOptions :: TempFileOptions defaultTempFileOptions = TempFileOptions { optKeepTempFiles = False }
111
defaultTempFileOptions = TempFileOptions { optKeepTempFiles = False }
69
false
true
0
6
10
19
11
8
null
null
ComputationWithBoundedResources/ara-inference
doc/tpdb_trs/Haskell/basic_haskell/maximum_4.hs
mit
primCmpInt (Neg Zero) (Neg Zero) = EQ
37
primCmpInt (Neg Zero) (Neg Zero) = EQ
37
primCmpInt (Neg Zero) (Neg Zero) = EQ
37
false
false
0
7
6
23
11
12
null
null
jgm/texmath
src/Text/TeXMath/Readers/TeX.hs
gpl-2.0
-- \overbrace isUnderover (EOver _ _ (ESymbol TOver "\x23B4")) = True
69
isUnderover (EOver _ _ (ESymbol TOver "\x23B4")) = True
55
isUnderover (EOver _ _ (ESymbol TOver "\x23B4")) = True
55
true
false
0
9
10
28
14
14
null
null
dsorokin/aivika-experiment-chart
Simulation/Aivika/Experiment/Chart/FinalXYChartView.hs
bsd-3-clause
finaliseFinalXYChart :: ChartRendering r => FinalXYChartViewState r -> ExperimentWriter () finaliseFinalXYChart st = do let view = finalXYChartView st title = finalXYChartTitle view plotTitle = finalXYChartPlotTitle view plotTitle' = replace "$TITLE" title plotTitle width = finalXYChartWidth view height = finalXYChartHeight view plotLines = finalXYChartPlotLines view plotBottomAxis = finalXYChartBottomAxis view plotLayout = finalXYChartLayout view renderer = finalXYChartRenderer st file <- resolveFilePath (finalXYChartDir st) $ mapFilePath (flip replaceExtension $ renderableChartExtension renderer) $ expandFilePath (finalXYChartFileName view) $ M.fromList [("$TITLE", title)] results <- liftIO $ readMVar $ finalXYChartResults st case results of Nothing -> return () Just results -> liftIO $ do let xname = finalXYChartXName results ynames = finalXYChartYNames results xys = finalXYChartXY results ps <- forM (zip3 ynames xys plotLines) $ \(name, xy, plotLines) -> do zs <- getElems xy let p = toPlot $ plotLines $ plot_lines_values .~ filterPlotLinesValues zs $ plot_lines_title .~ either id id name $ def r = case name of Left _ -> Left p Right _ -> Right p return r let axis = plotBottomAxis $ laxis_title .~ xname $ def updateLeftAxis = if null $ lefts ps then layoutlr_left_axis_visibility .~ AxisVisibility False False False else id updateRightAxis = if null $ rights ps then layoutlr_right_axis_visibility .~ AxisVisibility False False False else id chart = plotLayout . renderingLayoutLR renderer . updateLeftAxis . updateRightAxis $ layoutlr_x_axis .~ axis $ layoutlr_title .~ plotTitle' $ layoutlr_plots .~ ps $ def renderChart renderer (width, height) file (toRenderable chart) when (experimentVerbose $ finalXYChartExperiment st) $ putStr "Generated file " >> putStrLn file writeIORef (finalXYChartFile st) $ Just file -- | Remove the NaN and inifity values.
2,754
finaliseFinalXYChart :: ChartRendering r => FinalXYChartViewState r -> ExperimentWriter () finaliseFinalXYChart st = do let view = finalXYChartView st title = finalXYChartTitle view plotTitle = finalXYChartPlotTitle view plotTitle' = replace "$TITLE" title plotTitle width = finalXYChartWidth view height = finalXYChartHeight view plotLines = finalXYChartPlotLines view plotBottomAxis = finalXYChartBottomAxis view plotLayout = finalXYChartLayout view renderer = finalXYChartRenderer st file <- resolveFilePath (finalXYChartDir st) $ mapFilePath (flip replaceExtension $ renderableChartExtension renderer) $ expandFilePath (finalXYChartFileName view) $ M.fromList [("$TITLE", title)] results <- liftIO $ readMVar $ finalXYChartResults st case results of Nothing -> return () Just results -> liftIO $ do let xname = finalXYChartXName results ynames = finalXYChartYNames results xys = finalXYChartXY results ps <- forM (zip3 ynames xys plotLines) $ \(name, xy, plotLines) -> do zs <- getElems xy let p = toPlot $ plotLines $ plot_lines_values .~ filterPlotLinesValues zs $ plot_lines_title .~ either id id name $ def r = case name of Left _ -> Left p Right _ -> Right p return r let axis = plotBottomAxis $ laxis_title .~ xname $ def updateLeftAxis = if null $ lefts ps then layoutlr_left_axis_visibility .~ AxisVisibility False False False else id updateRightAxis = if null $ rights ps then layoutlr_right_axis_visibility .~ AxisVisibility False False False else id chart = plotLayout . renderingLayoutLR renderer . updateLeftAxis . updateRightAxis $ layoutlr_x_axis .~ axis $ layoutlr_title .~ plotTitle' $ layoutlr_plots .~ ps $ def renderChart renderer (width, height) file (toRenderable chart) when (experimentVerbose $ finalXYChartExperiment st) $ putStr "Generated file " >> putStrLn file writeIORef (finalXYChartFile st) $ Just file -- | Remove the NaN and inifity values.
2,754
finaliseFinalXYChart st = do let view = finalXYChartView st title = finalXYChartTitle view plotTitle = finalXYChartPlotTitle view plotTitle' = replace "$TITLE" title plotTitle width = finalXYChartWidth view height = finalXYChartHeight view plotLines = finalXYChartPlotLines view plotBottomAxis = finalXYChartBottomAxis view plotLayout = finalXYChartLayout view renderer = finalXYChartRenderer st file <- resolveFilePath (finalXYChartDir st) $ mapFilePath (flip replaceExtension $ renderableChartExtension renderer) $ expandFilePath (finalXYChartFileName view) $ M.fromList [("$TITLE", title)] results <- liftIO $ readMVar $ finalXYChartResults st case results of Nothing -> return () Just results -> liftIO $ do let xname = finalXYChartXName results ynames = finalXYChartYNames results xys = finalXYChartXY results ps <- forM (zip3 ynames xys plotLines) $ \(name, xy, plotLines) -> do zs <- getElems xy let p = toPlot $ plotLines $ plot_lines_values .~ filterPlotLinesValues zs $ plot_lines_title .~ either id id name $ def r = case name of Left _ -> Left p Right _ -> Right p return r let axis = plotBottomAxis $ laxis_title .~ xname $ def updateLeftAxis = if null $ lefts ps then layoutlr_left_axis_visibility .~ AxisVisibility False False False else id updateRightAxis = if null $ rights ps then layoutlr_right_axis_visibility .~ AxisVisibility False False False else id chart = plotLayout . renderingLayoutLR renderer . updateLeftAxis . updateRightAxis $ layoutlr_x_axis .~ axis $ layoutlr_title .~ plotTitle' $ layoutlr_plots .~ ps $ def renderChart renderer (width, height) file (toRenderable chart) when (experimentVerbose $ finalXYChartExperiment st) $ putStr "Generated file " >> putStrLn file writeIORef (finalXYChartFile st) $ Just file -- | Remove the NaN and inifity values.
2,663
false
true
0
26
1,140
600
286
314
null
null
hvr/lens
tests/properties.hs
bsd-3-clause
prop_2_2 = isLens (_2._2 :: Lens' (Int,(Int,Bool),Double) Bool)
91
prop_2_2 = isLens (_2._2 :: Lens' (Int,(Int,Bool),Double) Bool)
91
prop_2_2 = isLens (_2._2 :: Lens' (Int,(Int,Bool),Double) Bool)
91
false
false
0
9
35
37
21
16
null
null
np/ling
Ling/Prelude.hs
bsd-3-clause
mnot _ Just{} = Nothing
24
mnot _ Just{} = Nothing
24
mnot _ Just{} = Nothing
24
false
false
0
6
5
15
7
8
null
null
music-suite/music-score
src/Music/Time/Score.hs
bsd-3-clause
-- | View a 'Score' as a list of 'Event' values. events :: Lens (Score a) (Score b) [Event a] [Event b] events = _Wrapped . _2 . _Wrapped . sorted where -- TODO should not have to sort... sorted = iso (List.sortBy (Ord.comparing (^.onset))) (List.sortBy (Ord.comparing (^.onset)))
291
events :: Lens (Score a) (Score b) [Event a] [Event b] events = _Wrapped . _2 . _Wrapped . sorted where -- TODO should not have to sort... sorted = iso (List.sortBy (Ord.comparing (^.onset))) (List.sortBy (Ord.comparing (^.onset)))
242
events = _Wrapped . _2 . _Wrapped . sorted where -- TODO should not have to sort... sorted = iso (List.sortBy (Ord.comparing (^.onset))) (List.sortBy (Ord.comparing (^.onset)))
187
true
true
0
10
58
111
58
53
null
null
sherwoodwang/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxCONFIG_TYPE_FLOAT :: Int wxCONFIG_TYPE_FLOAT = 4
50
wxCONFIG_TYPE_FLOAT :: Int wxCONFIG_TYPE_FLOAT = 4
50
wxCONFIG_TYPE_FLOAT = 4
23
false
true
0
6
5
18
7
11
null
null
alexander-at-github/eta
compiler/ETA/Types/TypeRep.hs
bsd-3-clause
tyVarsOfType :: Type -> VarSet -- ^ NB: for type synonyms tyVarsOfType does /not/ expand the synonym -- tyVarsOfType returns only the free variables of a type -- For example, tyVarsOfType (a::k) returns {a}, not including the -- kind variable {k} tyVarsOfType (TyVarTy v) = unitVarSet v
294
tyVarsOfType :: Type -> VarSet tyVarsOfType (TyVarTy v) = unitVarSet v
78
tyVarsOfType (TyVarTy v) = unitVarSet v
47
true
true
0
9
54
36
18
18
null
null
ganeti-github-testing/ganeti-test-1
test/hs/Test/Ganeti/HTools/Cluster.hs
bsd-2-clause
-- * Helpers -- | Make a small cluster, both nodes and instances. makeSmallEmptyCluster :: Node.Node -> Int -> Instance.Instance -> (Node.List, Instance.List, Instance.Instance) makeSmallEmptyCluster node count inst = (makeSmallCluster node count, Container.empty, setInstanceSmallerThanNode node inst)
330
makeSmallEmptyCluster :: Node.Node -> Int -> Instance.Instance -> (Node.List, Instance.List, Instance.Instance) makeSmallEmptyCluster node count inst = (makeSmallCluster node count, Container.empty, setInstanceSmallerThanNode node inst)
263
makeSmallEmptyCluster node count inst = (makeSmallCluster node count, Container.empty, setInstanceSmallerThanNode node inst)
129
true
true
0
9
63
72
39
33
null
null
ku-fpg/blank-canvas
Graphics/Blank/Generated.hs
bsd-3-clause
-- | Sets the horizontal distance that a shadow will be offset (@0.0@ by default). shadowOffsetX :: Double -> Canvas () shadowOffsetX a1 = primitiveAttribute "shadowOffsetX" [showJSB a1]
186
shadowOffsetX :: Double -> Canvas () shadowOffsetX a1 = primitiveAttribute "shadowOffsetX" [showJSB a1]
103
shadowOffsetX a1 = primitiveAttribute "shadowOffsetX" [showJSB a1]
66
true
true
0
7
27
35
17
18
null
null
tjakway/ghcjvm
compiler/hsSyn/HsExpr.hs
bsd-3-clause
pprStmtContext GhciStmtCtxt = text "interactive GHCi command"
64
pprStmtContext GhciStmtCtxt = text "interactive GHCi command"
64
pprStmtContext GhciStmtCtxt = text "interactive GHCi command"
64
false
false
0
5
9
13
5
8
null
null
fpco/hlint
src/HSE/FreeVars.hs
bsd-3-clause
unqualOp :: QOp S -> [String] unqualOp (QVarOp _ x) = unqualNames x
67
unqualOp :: QOp S -> [String] unqualOp (QVarOp _ x) = unqualNames x
67
unqualOp (QVarOp _ x) = unqualNames x
37
false
true
0
9
12
40
18
22
null
null
mzini/qlogic
Qlogic/Diophantine.hs
gpl-3.0
powerBound :: SR.Semiring b => b -> VPower a -> b powerBound n (VPower _ m) = SR.bigProd $ replicate m n
104
powerBound :: SR.Semiring b => b -> VPower a -> b powerBound n (VPower _ m) = SR.bigProd $ replicate m n
104
powerBound n (VPower _ m) = SR.bigProd $ replicate m n
54
false
true
0
8
21
55
26
29
null
null
wfleming/advent-of-code-2016
2016/src/D16Lib.hs
bsd-3-clause
checksum :: String -> String checksum input | null input = error "can't calc checksum of empty str" | odd (length input) = error "can't calc checksum of odd length str" | otherwise = until (odd . length) cs input where cs str = seq' (reverse $ cs' "" str) cs' memo (c0:c1:t) = cs' (seq' nextMemo) t where nextChar = if c0 == c1 then '1' else '0' nextMemo = nextChar : memo cs' memo [] = memo
439
checksum :: String -> String checksum input | null input = error "can't calc checksum of empty str" | odd (length input) = error "can't calc checksum of odd length str" | otherwise = until (odd . length) cs input where cs str = seq' (reverse $ cs' "" str) cs' memo (c0:c1:t) = cs' (seq' nextMemo) t where nextChar = if c0 == c1 then '1' else '0' nextMemo = nextChar : memo cs' memo [] = memo
439
checksum input | null input = error "can't calc checksum of empty str" | odd (length input) = error "can't calc checksum of odd length str" | otherwise = until (odd . length) cs input where cs str = seq' (reverse $ cs' "" str) cs' memo (c0:c1:t) = cs' (seq' nextMemo) t where nextChar = if c0 == c1 then '1' else '0' nextMemo = nextChar : memo cs' memo [] = memo
410
false
true
2
10
126
164
80
84
null
null
wochinge/CacheSimulator
test/Util/AverageFileSizeSpec.hs
bsd-3-clause
spec :: Spec spec = describe "Testing creation of file size statistics" $ do it "3 different files with average size of 1 byte" $ calculateAverageFileSize twoBytesPerFile `shouldBe` (2, 4) it "3 different files with average size of 100 bytes" $ calculateAverageFileSize onlySameSizes `shouldBe` (100, 3)
327
spec :: Spec spec = describe "Testing creation of file size statistics" $ do it "3 different files with average size of 1 byte" $ calculateAverageFileSize twoBytesPerFile `shouldBe` (2, 4) it "3 different files with average size of 100 bytes" $ calculateAverageFileSize onlySameSizes `shouldBe` (100, 3)
327
spec = describe "Testing creation of file size statistics" $ do it "3 different files with average size of 1 byte" $ calculateAverageFileSize twoBytesPerFile `shouldBe` (2, 4) it "3 different files with average size of 100 bytes" $ calculateAverageFileSize onlySameSizes `shouldBe` (100, 3)
314
false
true
0
10
69
68
35
33
null
null
DanielSchuessler/hstri
Math/SparseVector.hs
gpl-3.0
--sparse_bindWithKey f m = sparse_fromMap :: (Num r, Ord k, Eq r) => Map k r -> SparseVector k r sparse_fromMap = SparseV
122
sparse_fromMap :: (Num r, Ord k, Eq r) => Map k r -> SparseVector k r sparse_fromMap = SparseV
94
sparse_fromMap = SparseV
24
true
true
0
8
23
53
25
28
null
null
mattias-lundell/timber-llvm
src/Kindle2LLVM.hs
bsd-3-clause
k2llvmCmd CCont = getContinueLabel >>= br
41
k2llvmCmd CCont = getContinueLabel >>= br
41
k2llvmCmd CCont = getContinueLabel >>= br
41
false
false
0
5
5
13
6
7
null
null
kolmodin/cabal
Cabal/Distribution/PackageDescription.hs
bsd-3-clause
hcSharedOptions :: CompilerFlavor -> BuildInfo -> [String] hcSharedOptions = lookupHcOptions sharedOptions
106
hcSharedOptions :: CompilerFlavor -> BuildInfo -> [String] hcSharedOptions = lookupHcOptions sharedOptions
106
hcSharedOptions = lookupHcOptions sharedOptions
47
false
true
0
7
10
25
13
12
null
null
sitewisely/zellige
test/Data/Geometry/ClipSpec.hs
apache-2.0
geoGiantPolyTst :: Geospatial.GeoPolygon geoGiantPolyTst = Geospatial.GeoPolygon (Sequence.singleton geoGiantLinearRingTst)
123
geoGiantPolyTst :: Geospatial.GeoPolygon geoGiantPolyTst = Geospatial.GeoPolygon (Sequence.singleton geoGiantLinearRingTst)
123
geoGiantPolyTst = Geospatial.GeoPolygon (Sequence.singleton geoGiantLinearRingTst)
82
false
true
0
8
7
26
13
13
null
null
bitemyapp/wai-devel
src/Devel/Config.hs
gpl-3.0
getPath :: (String, String) -> String getPath (key,value) | key == "bin-path" = dropWhile (==':') $ filter (/=' ') value | otherwise = ""
153
getPath :: (String, String) -> String getPath (key,value) | key == "bin-path" = dropWhile (==':') $ filter (/=' ') value | otherwise = ""
153
getPath (key,value) | key == "bin-path" = dropWhile (==':') $ filter (/=' ') value | otherwise = ""
115
false
true
0
8
39
69
36
33
null
null
stgm/prac-testing
week5/Week5.hs
mit
ext_gcd :: Integer -> Integer -> (Integer,Integer) ext_gcd a b = let x = 0 y = 1 lastx = 1 lasty = 0 in ext_gcd' a b x y (lastx,lasty)
150
ext_gcd :: Integer -> Integer -> (Integer,Integer) ext_gcd a b = let x = 0 y = 1 lastx = 1 lasty = 0 in ext_gcd' a b x y (lastx,lasty)
149
ext_gcd a b = let x = 0 y = 1 lastx = 1 lasty = 0 in ext_gcd' a b x y (lastx,lasty)
98
false
true
0
8
46
73
39
34
null
null
robdockins/edison
edison-core/src/Data/Edison/Assoc/AssocList.hs
mit
strictWith _ n@E = n
20
strictWith _ n@E = n
20
strictWith _ n@E = n
20
false
false
0
6
4
14
7
7
null
null
sdiehl/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
uDoubleHash_RDR = varQual_RDR gHC_GENERICS (fsLit "uDouble#")
61
uDoubleHash_RDR = varQual_RDR gHC_GENERICS (fsLit "uDouble#")
61
uDoubleHash_RDR = varQual_RDR gHC_GENERICS (fsLit "uDouble#")
61
false
false
0
7
5
17
8
9
null
null
fffej/sql-server-gen
src/Database/SqlServer/Create/DataType.hs
bsd-2-clause
precisionStorageSize :: PrecisionStorage -> Int precisionStorageSize (PrecisionStorage x) | x <= 24 = 4 * 8 | x <= 53 = 8 * 8 | otherwise = error em where em = "Failed to calculate precision storage size (" ++ show x ++ ")" -- Storage size in bits
260
precisionStorageSize :: PrecisionStorage -> Int precisionStorageSize (PrecisionStorage x) | x <= 24 = 4 * 8 | x <= 53 = 8 * 8 | otherwise = error em where em = "Failed to calculate precision storage size (" ++ show x ++ ")" -- Storage size in bits
260
precisionStorageSize (PrecisionStorage x) | x <= 24 = 4 * 8 | x <= 53 = 8 * 8 | otherwise = error em where em = "Failed to calculate precision storage size (" ++ show x ++ ")" -- Storage size in bits
212
false
true
1
8
61
88
42
46
null
null
kmels/dart-haskell
src/Language/Core/Interpreter/Libraries/GHC/Show.hs
bsd-3-clause
-- | The function that converts a showable to a string show' :: (Id, Either Thunk Value) show' = (id, Right $ Fun (monomophy_1 "(show)" showVal) "polymorphic(show)") where showVal :: Value -> IM Value showVal v = showValue v >>= return . String id = "base:GHC.Show.show"
290
show' :: (Id, Either Thunk Value) show' = (id, Right $ Fun (monomophy_1 "(show)" showVal) "polymorphic(show)") where showVal :: Value -> IM Value showVal v = showValue v >>= return . String id = "base:GHC.Show.show"
229
show' = (id, Right $ Fun (monomophy_1 "(show)" showVal) "polymorphic(show)") where showVal :: Value -> IM Value showVal v = showValue v >>= return . String id = "base:GHC.Show.show"
195
true
true
4
9
65
100
46
54
null
null
ComputationWithBoundedResources/jat
src/Jat/PState/Step.hs
bsd-3-clause
-- | Performs an refinement step constrained with top . topRefinement :: [b] -> Step a b topRefinement bs = Refinement $ zip bs (repeat top)
141
topRefinement :: [b] -> Step a b topRefinement bs = Refinement $ zip bs (repeat top)
84
topRefinement bs = Refinement $ zip bs (repeat top)
51
true
true
0
8
26
42
21
21
null
null
fcharlie/hgit
src/Git/Store/ObjectStore.hs
bsd-3-clause
readTree :: GitRepository -> ObjectId -> IO (Maybe Tree) readTree repo sha = do treeBlob <- readObject repo sha return $ parseTree sha (getBlobContent $ fromJust treeBlob) -- header: "type size\0" -- sha1 $ header ++ content
233
readTree :: GitRepository -> ObjectId -> IO (Maybe Tree) readTree repo sha = do treeBlob <- readObject repo sha return $ parseTree sha (getBlobContent $ fromJust treeBlob) -- header: "type size\0" -- sha1 $ header ++ content
233
readTree repo sha = do treeBlob <- readObject repo sha return $ parseTree sha (getBlobContent $ fromJust treeBlob) -- header: "type size\0" -- sha1 $ header ++ content
176
false
true
0
12
45
74
34
40
null
null
keera-studios/pang-a-lambda
src/Game/Objects.hs
gpl-3.0
playerEnergy :: Object -> Int playerEnergy o = case objectProperties o of p@(PlayerProps _ _ _ e) -> e _ -> 0 -- Partial function!
157
playerEnergy :: Object -> Int playerEnergy o = case objectProperties o of p@(PlayerProps _ _ _ e) -> e _ -> 0 -- Partial function!
157
playerEnergy o = case objectProperties o of p@(PlayerProps _ _ _ e) -> e _ -> 0 -- Partial function!
127
false
true
0
10
51
53
27
26
null
null
gridaphobe/target
examples/Data/ByteString/Fusion.hs
mit
fuseMapAccEFL :: MapEFL -> AccEFL acc -> AccEFL (PairS noAcc acc) fuseMapAccEFL f g (noAcc :*: acc) e1 = case g acc (f e1) of (acc' :*: res) -> (noAcc :*: acc') :*: res
180
fuseMapAccEFL :: MapEFL -> AccEFL acc -> AccEFL (PairS noAcc acc) fuseMapAccEFL f g (noAcc :*: acc) e1 = case g acc (f e1) of (acc' :*: res) -> (noAcc :*: acc') :*: res
180
fuseMapAccEFL f g (noAcc :*: acc) e1 = case g acc (f e1) of (acc' :*: res) -> (noAcc :*: acc') :*: res
114
false
true
1
9
45
88
44
44
null
null
trobertson/merch
src/Merchandise/Types/Item.hs
bsd-3-clause
-- accumulates the effects of the equipped Items into a single Map accumEffects :: Equipment -> E.Effects accumEffects e = E.mergeEffects $ map _effects (equipToList e)
168
accumEffects :: Equipment -> E.Effects accumEffects e = E.mergeEffects $ map _effects (equipToList e)
101
accumEffects e = E.mergeEffects $ map _effects (equipToList e)
62
true
true
0
8
25
43
20
23
null
null
droundy/franchise
Distribution/Franchise/ConfigureState.hs
bsd-3-clause
-- | Same as the POSIX @dirname(1)@. Returns the directory a file is -- in. dirname :: FilePath -> FilePath dirname = reverse . drop 1 . dropWhile (not . isSep) . dropWhile isSep . reverse
190
dirname :: FilePath -> FilePath dirname = reverse . drop 1 . dropWhile (not . isSep) . dropWhile isSep . reverse
112
dirname = reverse . drop 1 . dropWhile (not . isSep) . dropWhile isSep . reverse
80
true
true
0
10
37
49
25
24
null
null
jamesdabbs/keenser
src/Keenser/Util.hs
bsd-3-clause
mkJob :: MonadIO m => Worker m a -> a -> m (Job a) mkJob Worker{..} args = liftIO $ do _id <- BSC.pack <$> randomHex 12 now <- getCurrentTime return $! Job workerName args _id True now workerQueue
202
mkJob :: MonadIO m => Worker m a -> a -> m (Job a) mkJob Worker{..} args = liftIO $ do _id <- BSC.pack <$> randomHex 12 now <- getCurrentTime return $! Job workerName args _id True now workerQueue
202
mkJob Worker{..} args = liftIO $ do _id <- BSC.pack <$> randomHex 12 now <- getCurrentTime return $! Job workerName args _id True now workerQueue
151
false
true
0
10
44
98
45
53
null
null
ricca509/haskellFP101x
src/book/chapter5.hs
mit
isPerfect n = n == sum (init (factors n))
41
isPerfect n = n == sum (init (factors n))
41
isPerfect n = n == sum (init (factors n))
41
false
false
0
10
8
28
13
15
null
null
avaitla/Haskell-to-C---Bridge
src/GCCXML/Declarations/PatternParser.hs
bsd-3-clause
findArgs p s (Just x) = elemIndex (beginChar p) s >>= result where result i = go (i + 1) (findArgsSep p s (i+1)) s >>= \x -> Just (i, x) go _ Nothing _ = Nothing go _ _ [] = Nothing go prevFound (Just z) (x:xs) | x == (endChar p) = Just z | otherwise = go (z + 1) (findArgsSep p s prevFound) xs
349
findArgs p s (Just x) = elemIndex (beginChar p) s >>= result where result i = go (i + 1) (findArgsSep p s (i+1)) s >>= \x -> Just (i, x) go _ Nothing _ = Nothing go _ _ [] = Nothing go prevFound (Just z) (x:xs) | x == (endChar p) = Just z | otherwise = go (z + 1) (findArgsSep p s prevFound) xs
349
findArgs p s (Just x) = elemIndex (beginChar p) s >>= result where result i = go (i + 1) (findArgsSep p s (i+1)) s >>= \x -> Just (i, x) go _ Nothing _ = Nothing go _ _ [] = Nothing go prevFound (Just z) (x:xs) | x == (endChar p) = Just z | otherwise = go (z + 1) (findArgsSep p s prevFound) xs
349
false
false
0
10
122
195
97
98
null
null
elginer/shpider
Network/Shpider.hs
mit
getLinksByTextRegex :: String -> Shpider [ Link ] getLinksByTextRegex r = do cls <- currentLinks return $ filter ( flip (=~) r . linkText ) cls -- | Get all forms whose action matches the given action
226
getLinksByTextRegex :: String -> Shpider [ Link ] getLinksByTextRegex r = do cls <- currentLinks return $ filter ( flip (=~) r . linkText ) cls -- | Get all forms whose action matches the given action
226
getLinksByTextRegex r = do cls <- currentLinks return $ filter ( flip (=~) r . linkText ) cls -- | Get all forms whose action matches the given action
176
false
true
0
12
62
63
30
33
null
null
beni55/fay
src/Fay/Compiler/FFI.hs
bsd-3-clause
emitFayToJs :: Name a -> [TyVarBind b] -> [([Name c], Type d)] -> Compile () emitFayToJs (unAnn -> name) (map unAnn -> tyvars) (explodeFields -> fieldTypes) = do qname <- qualify name let ctrName = printJSString $ unQual qname tell $ mempty { writerFayToJs = [(ctrName, translator)] } where translator = JsFun Nothing [JsNameVar "type", argTypes, transcodingObjForced] (obj : fieldStmts (map (getIndex name tyvars) fieldTypes)) (Just $ JsName obj_) obj :: JsStmt obj = JsVar obj_ $ JsObj [("instance",JsLit (JsStr (printJSString (unAnn name))))] fieldStmts :: [(Int,(N.Name,N.Type))] -> [JsStmt] fieldStmts [] = [] fieldStmts ((i,fieldType):fts) = JsVar obj_v field : JsIf (JsNeq JsUndefined (JsName obj_v)) [JsSetPropExtern obj_ decl (JsName obj_v)] [] : fieldStmts fts where obj_v = JsNameVar $ UnQual () (Ident () $ "obj_" ++ d) decl = JsNameVar $ UnQual () (Ident () d) (d, field) = declField i fieldType obj_ = JsNameVar "obj_" -- Declare/encode Fay→JS field declField :: Int -> (N.Name,N.Type) -> (String,JsExp) declField i (fname,typ) = (prettyPrint fname ,fayToJs (SerializeUserArg i) (argType typ) (JsGetProp (JsName transcodingObjForced) (JsNameVar (UnQual () fname)))) -- | A name used for transcoding.
1,455
emitFayToJs :: Name a -> [TyVarBind b] -> [([Name c], Type d)] -> Compile () emitFayToJs (unAnn -> name) (map unAnn -> tyvars) (explodeFields -> fieldTypes) = do qname <- qualify name let ctrName = printJSString $ unQual qname tell $ mempty { writerFayToJs = [(ctrName, translator)] } where translator = JsFun Nothing [JsNameVar "type", argTypes, transcodingObjForced] (obj : fieldStmts (map (getIndex name tyvars) fieldTypes)) (Just $ JsName obj_) obj :: JsStmt obj = JsVar obj_ $ JsObj [("instance",JsLit (JsStr (printJSString (unAnn name))))] fieldStmts :: [(Int,(N.Name,N.Type))] -> [JsStmt] fieldStmts [] = [] fieldStmts ((i,fieldType):fts) = JsVar obj_v field : JsIf (JsNeq JsUndefined (JsName obj_v)) [JsSetPropExtern obj_ decl (JsName obj_v)] [] : fieldStmts fts where obj_v = JsNameVar $ UnQual () (Ident () $ "obj_" ++ d) decl = JsNameVar $ UnQual () (Ident () d) (d, field) = declField i fieldType obj_ = JsNameVar "obj_" -- Declare/encode Fay→JS field declField :: Int -> (N.Name,N.Type) -> (String,JsExp) declField i (fname,typ) = (prettyPrint fname ,fayToJs (SerializeUserArg i) (argType typ) (JsGetProp (JsName transcodingObjForced) (JsNameVar (UnQual () fname)))) -- | A name used for transcoding.
1,455
emitFayToJs (unAnn -> name) (map unAnn -> tyvars) (explodeFields -> fieldTypes) = do qname <- qualify name let ctrName = printJSString $ unQual qname tell $ mempty { writerFayToJs = [(ctrName, translator)] } where translator = JsFun Nothing [JsNameVar "type", argTypes, transcodingObjForced] (obj : fieldStmts (map (getIndex name tyvars) fieldTypes)) (Just $ JsName obj_) obj :: JsStmt obj = JsVar obj_ $ JsObj [("instance",JsLit (JsStr (printJSString (unAnn name))))] fieldStmts :: [(Int,(N.Name,N.Type))] -> [JsStmt] fieldStmts [] = [] fieldStmts ((i,fieldType):fts) = JsVar obj_v field : JsIf (JsNeq JsUndefined (JsName obj_v)) [JsSetPropExtern obj_ decl (JsName obj_v)] [] : fieldStmts fts where obj_v = JsNameVar $ UnQual () (Ident () $ "obj_" ++ d) decl = JsNameVar $ UnQual () (Ident () d) (d, field) = declField i fieldType obj_ = JsNameVar "obj_" -- Declare/encode Fay→JS field declField :: Int -> (N.Name,N.Type) -> (String,JsExp) declField i (fname,typ) = (prettyPrint fname ,fayToJs (SerializeUserArg i) (argType typ) (JsGetProp (JsName transcodingObjForced) (JsNameVar (UnQual () fname)))) -- | A name used for transcoding.
1,378
false
true
0
15
422
561
291
270
null
null
adamse/hindent
src/HIndent/Pretty.hs
bsd-3-clause
-- | Wrap in brackets. brackets :: MonadState (PrintState s) m => m a -> m a brackets p = depend (write "[") (do v <- p write "]" return v)
176
brackets :: MonadState (PrintState s) m => m a -> m a brackets p = depend (write "[") (do v <- p write "]" return v)
153
brackets p = depend (write "[") (do v <- p write "]" return v)
99
true
true
0
9
67
73
33
40
null
null
sol/pandoc
src/Text/Pandoc/Readers/Markdown.hs
gpl-2.0
nonindentSpaces :: GenParser Char ParserState [Char] nonindentSpaces = do state <- getState let tabStop = stateTabStop state sps <- many (char ' ') if length sps < tabStop then return sps else unexpected "indented line"
238
nonindentSpaces :: GenParser Char ParserState [Char] nonindentSpaces = do state <- getState let tabStop = stateTabStop state sps <- many (char ' ') if length sps < tabStop then return sps else unexpected "indented line"
238
nonindentSpaces = do state <- getState let tabStop = stateTabStop state sps <- many (char ' ') if length sps < tabStop then return sps else unexpected "indented line"
185
false
true
0
10
53
80
37
43
null
null