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
ghcjs/jsaddle-dom
src/JSDOM/Generated/Response.hs
mit
-- | <https://developer.mozilla.org/en-US/docs/Web/API/Response.redirect Mozilla Response.redirect documentation> redirect_ :: (MonadDOM m, ToJSString url) => url -> Maybe Word -> m () redirect_ url status = liftDOM (void ((jsg "Response") ^. jsf "redirect" [toJSVal url, toJSVal status]))
317
redirect_ :: (MonadDOM m, ToJSString url) => url -> Maybe Word -> m () redirect_ url status = liftDOM (void ((jsg "Response") ^. jsf "redirect" [toJSVal url, toJSVal status]))
202
redirect_ url status = liftDOM (void ((jsg "Response") ^. jsf "redirect" [toJSVal url, toJSVal status]))
121
true
true
0
12
62
87
43
44
null
null
brendanhay/gogol
gogol-android-publisher/gen/Network/Google/Resource/AndroidPublisher/Edits/Testers/Patch.hs
mpl-2.0
-- | Creates a value of 'EditsTestersPatch' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'etpXgafv' -- -- * 'etpTrack' -- -- * 'etpUploadProtocol' -- -- * 'etpPackageName' -- -- * 'etpAccessToken' -- -- * 'etpUploadType' -- -- * 'etpPayload' -- -- * 'etpEditId' -- -- * 'etpCallback' editsTestersPatch :: Text -- ^ 'etpTrack' -> Text -- ^ 'etpPackageName' -> Testers -- ^ 'etpPayload' -> Text -- ^ 'etpEditId' -> EditsTestersPatch editsTestersPatch pEtpTrack_ pEtpPackageName_ pEtpPayload_ pEtpEditId_ = EditsTestersPatch' { _etpXgafv = Nothing , _etpTrack = pEtpTrack_ , _etpUploadProtocol = Nothing , _etpPackageName = pEtpPackageName_ , _etpAccessToken = Nothing , _etpUploadType = Nothing , _etpPayload = pEtpPayload_ , _etpEditId = pEtpEditId_ , _etpCallback = Nothing }
925
editsTestersPatch :: Text -- ^ 'etpTrack' -> Text -- ^ 'etpPackageName' -> Testers -- ^ 'etpPayload' -> Text -- ^ 'etpEditId' -> EditsTestersPatch editsTestersPatch pEtpTrack_ pEtpPackageName_ pEtpPayload_ pEtpEditId_ = EditsTestersPatch' { _etpXgafv = Nothing , _etpTrack = pEtpTrack_ , _etpUploadProtocol = Nothing , _etpPackageName = pEtpPackageName_ , _etpAccessToken = Nothing , _etpUploadType = Nothing , _etpPayload = pEtpPayload_ , _etpEditId = pEtpEditId_ , _etpCallback = Nothing }
553
editsTestersPatch pEtpTrack_ pEtpPackageName_ pEtpPayload_ pEtpEditId_ = EditsTestersPatch' { _etpXgafv = Nothing , _etpTrack = pEtpTrack_ , _etpUploadProtocol = Nothing , _etpPackageName = pEtpPackageName_ , _etpAccessToken = Nothing , _etpUploadType = Nothing , _etpPayload = pEtpPayload_ , _etpEditId = pEtpEditId_ , _etpCallback = Nothing }
386
true
true
0
8
194
117
80
37
null
null
olsner/ghc
compiler/nativeGen/PPC/CodeGen.hs
bsd-3-clause
shiftCode :: Width -> (Format-> Reg -> Reg -> RI -> Instr) -> CmmExpr -> CmmExpr -> NatM Register shiftCode width instr x (CmmLit (CmmInt y _)) | Just imm <- makeImmediate width False y = do (src1, code1) <- getSomeReg x let format = intFormat width let code dst = code1 `snocOL` instr format dst src1 (RIImm imm) return (Any format code)
418
shiftCode :: Width -> (Format-> Reg -> Reg -> RI -> Instr) -> CmmExpr -> CmmExpr -> NatM Register shiftCode width instr x (CmmLit (CmmInt y _)) | Just imm <- makeImmediate width False y = do (src1, code1) <- getSomeReg x let format = intFormat width let code dst = code1 `snocOL` instr format dst src1 (RIImm imm) return (Any format code)
418
shiftCode width instr x (CmmLit (CmmInt y _)) | Just imm <- makeImmediate width False y = do (src1, code1) <- getSomeReg x let format = intFormat width let code dst = code1 `snocOL` instr format dst src1 (RIImm imm) return (Any format code)
280
false
true
0
15
142
172
80
92
null
null
utsav2601/cmpe295A
hake/RuleDefs.hs
mit
inRule _ = True
15
inRule _ = True
15
inRule _ = True
15
false
false
0
4
3
10
4
6
null
null
dalaing/free
src/Control/Comonad/Cofree.hs
bsd-3-clause
-- | This is a lens that can be used to read or write to the tails of a 'Cofree' 'Comonad'. -- -- Using (^.) from the @lens@ package: -- -- @foo ^. '_unwrap' == 'unwrap' foo@ -- -- For more on lenses see the @lens@ package on hackage -- -- @'_unwrap' :: Lens' ('Cofree' g a) (g ('Cofree' g a))@ _unwrap :: Functor f => (g (Cofree g a) -> f (g (Cofree g a))) -> Cofree g a -> f (Cofree g a) _unwrap f (a :< as) = (a :<) <$> f as
428
_unwrap :: Functor f => (g (Cofree g a) -> f (g (Cofree g a))) -> Cofree g a -> f (Cofree g a) _unwrap f (a :< as) = (a :<) <$> f as
133
_unwrap f (a :< as) = (a :<) <$> f as
38
true
true
0
14
96
113
59
54
null
null
rawlep/EQS
sourceCode/ResultTypes.hs
mit
maybe5 :: Maybe a -> Maybe b -> Maybe c -> Maybe d -> Maybe e -> Maybe (a,((b,c),(d,e))) maybe5 a b c d e = maybe2 a (maybe2 (maybe2 b c) (maybe2 d e))
153
maybe5 :: Maybe a -> Maybe b -> Maybe c -> Maybe d -> Maybe e -> Maybe (a,((b,c),(d,e))) maybe5 a b c d e = maybe2 a (maybe2 (maybe2 b c) (maybe2 d e))
153
maybe5 a b c d e = maybe2 a (maybe2 (maybe2 b c) (maybe2 d e))
63
false
true
0
14
36
119
58
61
null
null
simonmar/Haxl
Haxl/Core/Monad.hs
bsd-3-clause
toHaxl :: Cont u a -> GenHaxl u a toHaxl (Cont haxl) = haxl
59
toHaxl :: Cont u a -> GenHaxl u a toHaxl (Cont haxl) = haxl
59
toHaxl (Cont haxl) = haxl
25
false
true
0
7
13
34
16
18
null
null
GoorMoon/orientdb
src/Orientdb/Core.hs
mit
printConnection :: Connection -> IO () printConnection c = do sid <- printSessionId c putStrLn $ unwords ["<",U.toString . orientDbDatabase . connectionInfo $ c, "(" ,U.toString . orientDbDatabaseType . connectionInfo $ c, ")"," : ",sid,">"] where printSessionId :: Connection -> IO String printSessionId con = do sid <- readIORef (sessionId con) return $ show sid
444
printConnection :: Connection -> IO () printConnection c = do sid <- printSessionId c putStrLn $ unwords ["<",U.toString . orientDbDatabase . connectionInfo $ c, "(" ,U.toString . orientDbDatabaseType . connectionInfo $ c, ")"," : ",sid,">"] where printSessionId :: Connection -> IO String printSessionId con = do sid <- readIORef (sessionId con) return $ show sid
443
printConnection c = do sid <- printSessionId c putStrLn $ unwords ["<",U.toString . orientDbDatabase . connectionInfo $ c, "(" ,U.toString . orientDbDatabaseType . connectionInfo $ c, ")"," : ",sid,">"] where printSessionId :: Connection -> IO String printSessionId con = do sid <- readIORef (sessionId con) return $ show sid
404
false
true
0
13
134
143
71
72
null
null
poiuj/pfcc
src/Semant.hs
bsd-3-clause
stringType = (Type "String")
28
stringType = (Type "String")
28
stringType = (Type "String")
28
false
false
0
6
3
12
6
6
null
null
ttylec/positive-maps
HPositive.hs
gpl-2.0
-- i-th basis vector in dim-dimensional Hilbert space basis :: Int -> Int-> HVec basis dim i = fromList $ prefix ++ [unit] ++ suffix where unit = 1.0 :: Complex Double prefix = replicate (i-1) 0.0 :: [Complex Double] suffix = replicate (dim-i) 0.0 :: [Complex Double] -- Schmidt rank of vector
323
basis :: Int -> Int-> HVec basis dim i = fromList $ prefix ++ [unit] ++ suffix where unit = 1.0 :: Complex Double prefix = replicate (i-1) 0.0 :: [Complex Double] suffix = replicate (dim-i) 0.0 :: [Complex Double] -- Schmidt rank of vector
268
basis dim i = fromList $ prefix ++ [unit] ++ suffix where unit = 1.0 :: Complex Double prefix = replicate (i-1) 0.0 :: [Complex Double] suffix = replicate (dim-i) 0.0 :: [Complex Double] -- Schmidt rank of vector
241
true
true
4
8
82
121
59
62
null
null
revnull/fixfile
src/Data/FixFile/Tree23.hs
lgpl-3.0
-- | Return a list of values in a map. valuesMap :: (Fixed g, Ord k, f ~ Tree23 (Map k v)) => g f -> [v] valuesMap = fmap snd . toListMap
137
valuesMap :: (Fixed g, Ord k, f ~ Tree23 (Map k v)) => g f -> [v] valuesMap = fmap snd . toListMap
98
valuesMap = fmap snd . toListMap
32
true
true
1
11
32
71
33
38
null
null
Lythimus/lptv
sites/all/modules/jgm-pandoc-8be6cc2/src/Text/Pandoc/Pretty.hs
gpl-2.0
-- | Uses the specified string as a prefix for every line of -- the inside document (except the first, if not at the beginning -- of the line). prefixed :: String -> Doc -> Doc prefixed pref doc = Doc $ singleton $ Prefixed pref doc
232
prefixed :: String -> Doc -> Doc prefixed pref doc = Doc $ singleton $ Prefixed pref doc
88
prefixed pref doc = Doc $ singleton $ Prefixed pref doc
55
true
true
0
6
46
40
21
19
null
null
NCrashed/hjass
src/library/Language/Jass/Utils.hs
mit
-- | Converts implicit Except monad to explicit liftExcept :: (Functor m, Monad m, Show e) => m (Either e a) -> ExceptT String m a liftExcept action = ExceptT $ mapLeft show <$> action
184
liftExcept :: (Functor m, Monad m, Show e) => m (Either e a) -> ExceptT String m a liftExcept action = ExceptT $ mapLeft show <$> action
136
liftExcept action = ExceptT $ mapLeft show <$> action
53
true
true
0
9
34
69
34
35
null
null
takayuki/natume
ScmParse.hs
gpl-2.0
fmt1 d n (ExprAlt es) = fmt1 d n (ExprList es)
48
fmt1 d n (ExprAlt es) = fmt1 d n (ExprList es)
48
fmt1 d n (ExprAlt es) = fmt1 d n (ExprList es)
48
false
false
0
7
12
32
15
17
null
null
spacekitteh/smcghc
compiler/cmm/PprC.hs
bsd-3-clause
-- StgChar mkW_ = ptext (sLit "(W_)")
38
mkW_ = ptext (sLit "(W_)")
27
mkW_ = ptext (sLit "(W_)")
27
true
false
0
7
7
16
8
8
null
null
merijn/trifecta
src/Text/Trifecta/Util/Array.hs
bsd-3-clause
singleton :: a -> Array a singleton x = run (new 1 x)
53
singleton :: a -> Array a singleton x = run (new 1 x)
53
singleton x = run (new 1 x)
27
false
true
0
7
12
37
16
21
null
null
gangsterveggies/julia-pinheiro-compiler
StaticAnalysis.hs
gpl-2.0
sAnalyse sc (OpPAt, UVar var1, UVar var2, UVar var3) = ((OpPAt, TVar (var1, TPointer tp), TVar (var2, TInt), TVar (var3, tp)), sc) where tp = getType (UVar var3) sc _ = fromJust ("") (setType var1 (TPointer tp) sc) _ = fromJust ("variable in array offset needs to be of type " ++ (show TInt)) (setType var2 TInt sc)
333
sAnalyse sc (OpPAt, UVar var1, UVar var2, UVar var3) = ((OpPAt, TVar (var1, TPointer tp), TVar (var2, TInt), TVar (var3, tp)), sc) where tp = getType (UVar var3) sc _ = fromJust ("") (setType var1 (TPointer tp) sc) _ = fromJust ("variable in array offset needs to be of type " ++ (show TInt)) (setType var2 TInt sc)
333
sAnalyse sc (OpPAt, UVar var1, UVar var2, UVar var3) = ((OpPAt, TVar (var1, TPointer tp), TVar (var2, TInt), TVar (var3, tp)), sc) where tp = getType (UVar var3) sc _ = fromJust ("") (setType var1 (TPointer tp) sc) _ = fromJust ("variable in array offset needs to be of type " ++ (show TInt)) (setType var2 TInt sc)
333
false
false
2
9
75
161
85
76
null
null
opentower/carnap
Carnap/src/Carnap/Calculi/NaturalDeduction/Checker.hs
gpl-3.0
hoReduceProofTreeMemo :: ( Inference r lex sem , MonadVar (ClassicalSequentOver lex) (State Int) , FirstOrder (ClassicalSequentOver lex) , ACUI (ClassicalSequentOver lex) , StaticVar (ClassicalSequentOver lex) , Hashable (ProofTree r lex sem) , Typeable sem ) => ProofMemoRef lex sem r -> Restrictor r lex -> ProofTree r lex sem -> IO (FeedbackLine lex sem) hoReduceProofTreeMemo ref res pt@(Node (ProofLine no cont rules) ts) = do thememo <- readIORef ref let thehash = hash pt case M.lookup thehash thememo of Just x -> return $ reduceResult no $ parallelCheckResult res no $ x Nothing -> do prems <- mapM (hoReduceProofTreeMemo ref res) ts case sequence prems of Left olderror -> return (Left olderror) Right prems -> do let y = do errOrRslts <- hoseqFromNode no rules prems cont return $ errOrRslts >>= Right . map (\(r,z,w) -> (evalState (stateRebuild r >>= toBNF) (0 :: Int),z,w)) writeIORef ref (M.insert thehash y thememo) return $ reduceResult no $ parallelCheckResult res no $ y
1,337
hoReduceProofTreeMemo :: ( Inference r lex sem , MonadVar (ClassicalSequentOver lex) (State Int) , FirstOrder (ClassicalSequentOver lex) , ACUI (ClassicalSequentOver lex) , StaticVar (ClassicalSequentOver lex) , Hashable (ProofTree r lex sem) , Typeable sem ) => ProofMemoRef lex sem r -> Restrictor r lex -> ProofTree r lex sem -> IO (FeedbackLine lex sem) hoReduceProofTreeMemo ref res pt@(Node (ProofLine no cont rules) ts) = do thememo <- readIORef ref let thehash = hash pt case M.lookup thehash thememo of Just x -> return $ reduceResult no $ parallelCheckResult res no $ x Nothing -> do prems <- mapM (hoReduceProofTreeMemo ref res) ts case sequence prems of Left olderror -> return (Left olderror) Right prems -> do let y = do errOrRslts <- hoseqFromNode no rules prems cont return $ errOrRslts >>= Right . map (\(r,z,w) -> (evalState (stateRebuild r >>= toBNF) (0 :: Int),z,w)) writeIORef ref (M.insert thehash y thememo) return $ reduceResult no $ parallelCheckResult res no $ y
1,337
hoReduceProofTreeMemo ref res pt@(Node (ProofLine no cont rules) ts) = do thememo <- readIORef ref let thehash = hash pt case M.lookup thehash thememo of Just x -> return $ reduceResult no $ parallelCheckResult res no $ x Nothing -> do prems <- mapM (hoReduceProofTreeMemo ref res) ts case sequence prems of Left olderror -> return (Left olderror) Right prems -> do let y = do errOrRslts <- hoseqFromNode no rules prems cont return $ errOrRslts >>= Right . map (\(r,z,w) -> (evalState (stateRebuild r >>= toBNF) (0 :: Int),z,w)) writeIORef ref (M.insert thehash y thememo) return $ reduceResult no $ parallelCheckResult res no $ y
944
false
true
0
30
508
433
207
226
null
null
IanConnolly/aws-sdk-fork
AWS/Util.hs
bsd-3-clause
toS :: BSL.ByteString -> ByteString toS = BS.concat . BSL.toChunks
66
toS :: BSL.ByteString -> ByteString toS = BS.concat . BSL.toChunks
66
toS = BS.concat . BSL.toChunks
30
false
true
1
7
9
33
14
19
null
null
andyarvanitis/Idris-dev
src/IRTS/CodegenC.hs
bsd-3-clause
bcc i (ADDTOP n) = indent i ++ "ADDTOP(" ++ show n ++ ");\n"
60
bcc i (ADDTOP n) = indent i ++ "ADDTOP(" ++ show n ++ ");\n"
60
bcc i (ADDTOP n) = indent i ++ "ADDTOP(" ++ show n ++ ");\n"
60
false
false
0
8
13
36
16
20
null
null
jml/hazard
lib/Hazard/Routes.hs
apache-2.0
-- | Page for a single user. user :: Path '[UserID] user = "user" <//> var
74
user :: Path '[UserID] user = "user" <//> var
45
user = "user" <//> var
22
true
true
2
8
15
31
14
17
null
null
batebobo/fp1718
class/06.types.hs
mit
-- Последен вариант, обещавам. Използваме guards -- guards са тези вертикални черти (pipe), които работят досущ като cond в Racket -- тук започваме с шаблон - ако имаме празен списък, каквото и да искаме да махнем от него, -- резултатът си остава празен списък -- общият случай се покрива от втория шаблон - element (x:xs) -- тук деконструираме списъка, с който е извикана функцията, на глава и опашка -- в тялото на функцията `x` е първият елемент на списъка, а `xs` - останалите. remove''' :: Eq a => [a] -> a -> [a] remove''' [] _ = []
538
remove''' :: Eq a => [a] -> a -> [a] remove''' [] _ = []
56
remove''' [] _ = []
19
true
true
0
8
97
48
28
20
null
null
keera-studios/hsQt
Qtc/Core/QIODevice.hs
bsd-2-clause
isOpen :: QIODevice a -> (()) -> IO (Bool) isOpen x0 () = withBoolResult $ withObjectPtr x0 $ \cobj_x0 -> qtc_QIODevice_isOpen cobj_x0
144
isOpen :: QIODevice a -> (()) -> IO (Bool) isOpen x0 () = withBoolResult $ withObjectPtr x0 $ \cobj_x0 -> qtc_QIODevice_isOpen cobj_x0
144
isOpen x0 () = withBoolResult $ withObjectPtr x0 $ \cobj_x0 -> qtc_QIODevice_isOpen cobj_x0
101
false
true
0
8
31
59
29
30
null
null
uduki/hsQt
Qtc/Gui/QComboBox.hs
bsd-2-clause
setRootModelIndex :: QComboBox a -> ((QModelIndex t1)) -> IO () setRootModelIndex x0 (x1) = withObjectPtr x0 $ \cobj_x0 -> withObjectPtr x1 $ \cobj_x1 -> qtc_QComboBox_setRootModelIndex cobj_x0 cobj_x1
211
setRootModelIndex :: QComboBox a -> ((QModelIndex t1)) -> IO () setRootModelIndex x0 (x1) = withObjectPtr x0 $ \cobj_x0 -> withObjectPtr x1 $ \cobj_x1 -> qtc_QComboBox_setRootModelIndex cobj_x0 cobj_x1
211
setRootModelIndex x0 (x1) = withObjectPtr x0 $ \cobj_x0 -> withObjectPtr x1 $ \cobj_x1 -> qtc_QComboBox_setRootModelIndex cobj_x0 cobj_x1
147
false
true
4
9
36
80
37
43
null
null
janschulz/pandoc
src/Text/Pandoc/Readers/MediaWiki.hs
gpl-2.0
parseWidth :: String -> Maybe Double parseWidth s = case reverse s of ('%':ds) | all isDigit ds -> safeRead ('0':'.':reverse ds) _ -> Nothing
157
parseWidth :: String -> Maybe Double parseWidth s = case reverse s of ('%':ds) | all isDigit ds -> safeRead ('0':'.':reverse ds) _ -> Nothing
157
parseWidth s = case reverse s of ('%':ds) | all isDigit ds -> safeRead ('0':'.':reverse ds) _ -> Nothing
120
false
true
0
12
40
75
35
40
null
null
jasdennison/scrabble-solver
src/Board.hs
bsd-3-clause
connected :: Board -> Position -> Bool connected b (i, j) = or [onBoard b p && not (empty b p) | p<-adjacents (i, j)]
117
connected :: Board -> Position -> Bool connected b (i, j) = or [onBoard b p && not (empty b p) | p<-adjacents (i, j)]
117
connected b (i, j) = or [onBoard b p && not (empty b p) | p<-adjacents (i, j)]
78
false
true
0
10
24
78
38
40
null
null
wat-aro/scheme
app/Main.hs
bsd-3-clause
runIOThrows :: IOThrowsError String -> IO String runIOThrows action = fmap extractValue (runExceptT (trapError action))
119
runIOThrows :: IOThrowsError String -> IO String runIOThrows action = fmap extractValue (runExceptT (trapError action))
119
runIOThrows action = fmap extractValue (runExceptT (trapError action))
70
false
true
0
9
14
44
20
24
null
null
rvion/lamdu
bottlelib/Graphics/UI/Bottle/Widgets/FlyNav.hs
gpl-3.0
addMovement :: Functor f => String -> [GLFW.Key] -> Vector2 Widget.R -> Vector2 Widget.R -> [Movement] -> (Maybe ActiveState -> f ()) -> Widget.EventHandlers f addMovement name keys dir pos movements setState | name `elem` map (^. mName) movements = mempty | otherwise = mconcat [ mkKeyMap GLFW.KeyState'Pressed mk (EventMap.Doc ["Navigation", "FlyNav", name]) . setState . Just $ ActiveState pos (Movement name mk dir : movements) | key <- keys , let mk = modKey key ]
561
addMovement :: Functor f => String -> [GLFW.Key] -> Vector2 Widget.R -> Vector2 Widget.R -> [Movement] -> (Maybe ActiveState -> f ()) -> Widget.EventHandlers f addMovement name keys dir pos movements setState | name `elem` map (^. mName) movements = mempty | otherwise = mconcat [ mkKeyMap GLFW.KeyState'Pressed mk (EventMap.Doc ["Navigation", "FlyNav", name]) . setState . Just $ ActiveState pos (Movement name mk dir : movements) | key <- keys , let mk = modKey key ]
561
addMovement name keys dir pos movements setState | name `elem` map (^. mName) movements = mempty | otherwise = mconcat [ mkKeyMap GLFW.KeyState'Pressed mk (EventMap.Doc ["Navigation", "FlyNav", name]) . setState . Just $ ActiveState pos (Movement name mk dir : movements) | key <- keys , let mk = modKey key ]
369
false
true
0
16
168
214
104
110
null
null
wxwxwwxxx/ghc
compiler/typecheck/TcEvidence.hs
bsd-3-clause
mkTcAxInstCo :: Role -> CoAxiom br -> Int -> [TcType] -> TcCoercion mkTcAxInstCo role ax index tys | ASSERT2( not (role == Nominal && ax_role == Representational) , ppr (ax, tys) ) arity == n_tys = tcDowngradeRole role ax_role $ TcAxiomInstCo ax_br index rtys | otherwise = ASSERT( arity < n_tys ) tcDowngradeRole role ax_role $ foldl TcAppCo (TcAxiomInstCo ax_br index (take arity rtys)) (drop arity rtys) where n_tys = length tys ax_br = toBranchedAxiom ax branch = coAxiomNthBranch ax_br index arity = length $ coAxBranchTyVars branch ax_role = coAxiomRole ax arg_roles = coAxBranchRoles branch rtys = zipWith mkTcReflCo (arg_roles ++ repeat Nominal) tys
820
mkTcAxInstCo :: Role -> CoAxiom br -> Int -> [TcType] -> TcCoercion mkTcAxInstCo role ax index tys | ASSERT2( not (role == Nominal && ax_role == Representational) , ppr (ax, tys) ) arity == n_tys = tcDowngradeRole role ax_role $ TcAxiomInstCo ax_br index rtys | otherwise = ASSERT( arity < n_tys ) tcDowngradeRole role ax_role $ foldl TcAppCo (TcAxiomInstCo ax_br index (take arity rtys)) (drop arity rtys) where n_tys = length tys ax_br = toBranchedAxiom ax branch = coAxiomNthBranch ax_br index arity = length $ coAxBranchTyVars branch ax_role = coAxiomRole ax arg_roles = coAxBranchRoles branch rtys = zipWith mkTcReflCo (arg_roles ++ repeat Nominal) tys
820
mkTcAxInstCo role ax index tys | ASSERT2( not (role == Nominal && ax_role == Representational) , ppr (ax, tys) ) arity == n_tys = tcDowngradeRole role ax_role $ TcAxiomInstCo ax_br index rtys | otherwise = ASSERT( arity < n_tys ) tcDowngradeRole role ax_role $ foldl TcAppCo (TcAxiomInstCo ax_br index (take arity rtys)) (drop arity rtys) where n_tys = length tys ax_br = toBranchedAxiom ax branch = coAxiomNthBranch ax_br index arity = length $ coAxBranchTyVars branch ax_role = coAxiomRole ax arg_roles = coAxBranchRoles branch rtys = zipWith mkTcReflCo (arg_roles ++ repeat Nominal) tys
752
false
true
7
15
266
275
122
153
null
null
wfleming/advent-of-code-2016
2016/src/D12Lib.hs
bsd-3-clause
newVM :: [Instruction] -> VM newVM ops = VM { registers = [('a', 0), ('b', 0), ('c', 0), ('d', 0)] , tape = ops , pos = 0 }
139
newVM :: [Instruction] -> VM newVM ops = VM { registers = [('a', 0), ('b', 0), ('c', 0), ('d', 0)] , tape = ops , pos = 0 }
139
newVM ops = VM { registers = [('a', 0), ('b', 0), ('c', 0), ('d', 0)] , tape = ops , pos = 0 }
110
false
true
0
9
44
86
50
36
null
null
erantapaa/henigma
src/Enigma/Base.hs
bsd-3-clause
isTurnOver :: Wheel -> Position -> Bool isTurnOver wheel pos = elem (windowLetter wheel pos) (_turnovers wheel) where window = elem (windowLetter wheel pos) (_turnovers wheel) -- note: -2 here because both pos and ring setting are 1 based
248
isTurnOver :: Wheel -> Position -> Bool isTurnOver wheel pos = elem (windowLetter wheel pos) (_turnovers wheel) where window = elem (windowLetter wheel pos) (_turnovers wheel) -- note: -2 here because both pos and ring setting are 1 based
248
isTurnOver wheel pos = elem (windowLetter wheel pos) (_turnovers wheel) where window = elem (windowLetter wheel pos) (_turnovers wheel) -- note: -2 here because both pos and ring setting are 1 based
208
false
true
0
7
48
71
35
36
null
null
YuichiroSato/Scheme
src/Parser/SchemeParser.hs
bsd-3-clause
createQuoteAST :: Exp -> AST createQuoteAST (Exps ps) = ListOperatorAST $ ListAST (map toAST ps)
96
createQuoteAST :: Exp -> AST createQuoteAST (Exps ps) = ListOperatorAST $ ListAST (map toAST ps)
96
createQuoteAST (Exps ps) = ListOperatorAST $ ListAST (map toAST ps)
67
false
true
0
8
14
39
19
20
null
null
UBMLtonGroup/timberc
src/Desugar2.hs
bsd-3-clause
dsEqns ((LPat p,rh):eqns) = do v <- newNamePos patSym p eqns <- dsEqns ((LPat p, RExp (EVar v)) : eqns) e <- dsExp (rh2exp rh) return ((LFun v [],RExp e) : eqns)
278
dsEqns ((LPat p,rh):eqns) = do v <- newNamePos patSym p eqns <- dsEqns ((LPat p, RExp (EVar v)) : eqns) e <- dsExp (rh2exp rh) return ((LFun v [],RExp e) : eqns)
278
dsEqns ((LPat p,rh):eqns) = do v <- newNamePos patSym p eqns <- dsEqns ((LPat p, RExp (EVar v)) : eqns) e <- dsExp (rh2exp rh) return ((LFun v [],RExp e) : eqns)
278
false
false
0
14
148
117
56
61
null
null
RTS2013/RTS
server/src/Mod/Setup.hs
mit
terrainNoise :: Int -> (Int,Int) -> GU.Grid (Int,Bool) terrainNoise mapRN (w,h) = let arr = randomPerlin mapRN 0 (0,0) (w,h) (rangeMap (2::Int,True) [(-0.9,(0,False)),(0.25,(1,True))]) in GU.fromVector (w,h) $! R.toUnboxed arr
234
terrainNoise :: Int -> (Int,Int) -> GU.Grid (Int,Bool) terrainNoise mapRN (w,h) = let arr = randomPerlin mapRN 0 (0,0) (w,h) (rangeMap (2::Int,True) [(-0.9,(0,False)),(0.25,(1,True))]) in GU.fromVector (w,h) $! R.toUnboxed arr
234
terrainNoise mapRN (w,h) = let arr = randomPerlin mapRN 0 (0,0) (w,h) (rangeMap (2::Int,True) [(-0.9,(0,False)),(0.25,(1,True))]) in GU.fromVector (w,h) $! R.toUnboxed arr
179
false
true
0
14
36
150
85
65
null
null
iustin/prefix-units
Data/Prefix/Units.hs
bsd-3-clause
unitSymbol Atto = "a"
22
unitSymbol Atto = "a"
22
unitSymbol Atto = "a"
22
false
false
0
5
4
9
4
5
null
null
alancocanour/glutton
src/Glutton/Gui.hs
bsd-3-clause
createGui :: IO ( Int -> Updater -> IO () , [SubscriptionHandle] -> IO ()) -- ^ A function to start the GUI given the port to run on and an 'Updater' and a function to update the GUI when the subscriptions change createGui = do (unreadCountE, trigger) <- newEvent unreadCountB <- stepper [] unreadCountE return (\p u -> UI.startGUI defaultConfig { jsPort = Just p, jsStatic = Nothing } $ setup unreadCountB u ,trigger <=< mapM unreadCount) -- | A feed title, number of unread items, and 'SubscriptionHandle'
533
createGui :: IO ( Int -> Updater -> IO () , [SubscriptionHandle] -> IO ()) createGui = do (unreadCountE, trigger) <- newEvent unreadCountB <- stepper [] unreadCountE return (\p u -> UI.startGUI defaultConfig { jsPort = Just p, jsStatic = Nothing } $ setup unreadCountB u ,trigger <=< mapM unreadCount) -- | A feed title, number of unread items, and 'SubscriptionHandle'
395
createGui = do (unreadCountE, trigger) <- newEvent unreadCountB <- stepper [] unreadCountE return (\p u -> UI.startGUI defaultConfig { jsPort = Just p, jsStatic = Nothing } $ setup unreadCountB u ,trigger <=< mapM unreadCount) -- | A feed title, number of unread items, and 'SubscriptionHandle'
310
true
true
1
15
114
135
67
68
null
null
psibi/cabal2nix
src/Distribution/Nixpkgs/Haskell/FromCabal/Name.hs
bsd-3-clause
libNixName "gdk-2.0" = return "gtk"
62
libNixName "gdk-2.0" = return "gtk"
62
libNixName "gdk-2.0" = return "gtk"
62
false
false
0
5
31
12
5
7
null
null
mstksg/hledger
hledger-lib/Hledger/Reports/ReportOptions.hs
gpl-3.0
intervalFromRawOpts :: RawOpts -> Interval intervalFromRawOpts = lastDef NoInterval . catMaybes . map intervalfromrawopt where intervalfromrawopt (n,v) | n == "period" = either (\e -> usageError $ "could not parse period option: "++parseErrorPretty e) (Just . fst) $ parsePeriodExpr nulldate (stripquotes $ T.pack v) -- reference date does not affect the interval | n == "daily" = Just $ Days 1 | n == "weekly" = Just $ Weeks 1 | n == "monthly" = Just $ Months 1 | n == "quarterly" = Just $ Quarters 1 | n == "yearly" = Just $ Years 1 | otherwise = Nothing -- | Get any statuses to be matched, as specified by -U/--unmarked, -- -P/--pending, -C/--cleared flags. -UPC is equivalent to no flags, -- so this returns a list of 0-2 unique statuses.
824
intervalFromRawOpts :: RawOpts -> Interval intervalFromRawOpts = lastDef NoInterval . catMaybes . map intervalfromrawopt where intervalfromrawopt (n,v) | n == "period" = either (\e -> usageError $ "could not parse period option: "++parseErrorPretty e) (Just . fst) $ parsePeriodExpr nulldate (stripquotes $ T.pack v) -- reference date does not affect the interval | n == "daily" = Just $ Days 1 | n == "weekly" = Just $ Weeks 1 | n == "monthly" = Just $ Months 1 | n == "quarterly" = Just $ Quarters 1 | n == "yearly" = Just $ Years 1 | otherwise = Nothing -- | Get any statuses to be matched, as specified by -U/--unmarked, -- -P/--pending, -C/--cleared flags. -UPC is equivalent to no flags, -- so this returns a list of 0-2 unique statuses.
824
intervalFromRawOpts = lastDef NoInterval . catMaybes . map intervalfromrawopt where intervalfromrawopt (n,v) | n == "period" = either (\e -> usageError $ "could not parse period option: "++parseErrorPretty e) (Just . fst) $ parsePeriodExpr nulldate (stripquotes $ T.pack v) -- reference date does not affect the interval | n == "daily" = Just $ Days 1 | n == "weekly" = Just $ Weeks 1 | n == "monthly" = Just $ Months 1 | n == "quarterly" = Just $ Quarters 1 | n == "yearly" = Just $ Years 1 | otherwise = Nothing -- | Get any statuses to be matched, as specified by -U/--unmarked, -- -P/--pending, -C/--cleared flags. -UPC is equivalent to no flags, -- so this returns a list of 0-2 unique statuses.
781
false
true
0
10
213
242
113
129
null
null
dsaenztagarro/haskellbook
src/chapter10/Exercises.hs
bsd-3-clause
tuplesWithAp :: [(Char, Char, Char)] tuplesWithAp = filter go tuples3 where go ('p', _, _) = True go _ = False
120
tuplesWithAp :: [(Char, Char, Char)] tuplesWithAp = filter go tuples3 where go ('p', _, _) = True go _ = False
120
tuplesWithAp = filter go tuples3 where go ('p', _, _) = True go _ = False
83
false
true
1
6
30
56
31
25
null
null
egaburov/funstuff
Haskell/tytag/codes/PushNegF.hs
apache-2.0
-- "(8 + ((-1) + (-2)))" -- The result of the standard evaluation (the `meaning') is preserved tf1_norm_eval = eval tf1_norm
124
tf1_norm_eval = eval tf1_norm
29
tf1_norm_eval = eval tf1_norm
29
true
false
0
5
20
11
6
5
null
null
Lokidottir/unify-terms
src/Term/Unifiable.hs
bsd-3-clause
-- | Apply renames to two terms such that they no longer share any variable names. renameTerms :: Unifiable term => term -> term -> (term, term) renameTerms term1 term2 = both applyRenames (rename term1 term2) <<*>> (term1, term2)
230
renameTerms :: Unifiable term => term -> term -> (term, term) renameTerms term1 term2 = both applyRenames (rename term1 term2) <<*>> (term1, term2)
147
renameTerms term1 term2 = both applyRenames (rename term1 term2) <<*>> (term1, term2)
85
true
true
0
8
38
61
32
29
null
null
tcoenraad/functioneel-programmeren
2014/opg4b.hs
mit
cut :: Graph -> [Node] -> (Graph, Graph) cut Graph{nodes=ns, edges=es} ns1 = (g1, g2) where es1 = filter (\(a,b) -> a `elem` ns1 && b `elem` ns1) es g1 = Graph{nodes=ns1, edges=es1} ns2 = filter (not . (flip elem) ns1) ns es2 = filter (\(a,b) -> a `elem` ns2 && b `elem` ns2) es g2 = Graph{nodes=ns2, edges=es2}
321
cut :: Graph -> [Node] -> (Graph, Graph) cut Graph{nodes=ns, edges=es} ns1 = (g1, g2) where es1 = filter (\(a,b) -> a `elem` ns1 && b `elem` ns1) es g1 = Graph{nodes=ns1, edges=es1} ns2 = filter (not . (flip elem) ns1) ns es2 = filter (\(a,b) -> a `elem` ns2 && b `elem` ns2) es g2 = Graph{nodes=ns2, edges=es2}
321
cut Graph{nodes=ns, edges=es} ns1 = (g1, g2) where es1 = filter (\(a,b) -> a `elem` ns1 && b `elem` ns1) es g1 = Graph{nodes=ns1, edges=es1} ns2 = filter (not . (flip elem) ns1) ns es2 = filter (\(a,b) -> a `elem` ns2 && b `elem` ns2) es g2 = Graph{nodes=ns2, edges=es2}
280
false
true
5
12
68
213
118
95
null
null
andyarvanitis/Idris-dev
src/IRTS/Simplified.hs
bsd-3-clause
ldefs :: State (DDefs, Int) DDefs ldefs = do (l, h) <- get return l
78
ldefs :: State (DDefs, Int) DDefs ldefs = do (l, h) <- get return l
78
ldefs = do (l, h) <- get return l
44
false
true
1
9
25
45
21
24
null
null
blamario/grampa
grammatical-parsers/examples/Arithmetic.hs
bsd-2-clause
arithmetic :: (LexicalParsing (Parser g String), ArithmeticDomain e) => GrammarBuilder (Arithmetic e) g Parser String arithmetic Arithmetic{..} = Arithmetic{ expr= lexicalWhiteSpace *> sum, sum= product <|> symbol "-" *> (negate <$> product) <|> add <$> sum <* symbol "+" <*> product <|> subtract <$> sum <* symbol "-" <*> product, product= factor <|> multiply <$> product <* symbol "*" <*> factor <|> divide <$> product <* symbol "/" <*> factor, factor= primary <|> symbol "(" *> expr <* symbol ")", primary= lexicalToken ((number . read) <$> takeCharsWhile1 isDigit) <?> "digits"}
653
arithmetic :: (LexicalParsing (Parser g String), ArithmeticDomain e) => GrammarBuilder (Arithmetic e) g Parser String arithmetic Arithmetic{..} = Arithmetic{ expr= lexicalWhiteSpace *> sum, sum= product <|> symbol "-" *> (negate <$> product) <|> add <$> sum <* symbol "+" <*> product <|> subtract <$> sum <* symbol "-" <*> product, product= factor <|> multiply <$> product <* symbol "*" <*> factor <|> divide <$> product <* symbol "/" <*> factor, factor= primary <|> symbol "(" *> expr <* symbol ")", primary= lexicalToken ((number . read) <$> takeCharsWhile1 isDigit) <?> "digits"}
653
arithmetic Arithmetic{..} = Arithmetic{ expr= lexicalWhiteSpace *> sum, sum= product <|> symbol "-" *> (negate <$> product) <|> add <$> sum <* symbol "+" <*> product <|> subtract <$> sum <* symbol "-" <*> product, product= factor <|> multiply <$> product <* symbol "*" <*> factor <|> divide <$> product <* symbol "/" <*> factor, factor= primary <|> symbol "(" *> expr <* symbol ")", primary= lexicalToken ((number . read) <$> takeCharsWhile1 isDigit) <?> "digits"}
535
false
true
1
18
160
240
119
121
null
null
geggo98/backup-octo-wookie
src/Main.hs
unlicense
perm :: [a] -> [[a]] perm [] = [[]]
35
perm :: [a] -> [[a]] perm [] = [[]]
35
perm [] = [[]]
14
false
true
0
9
8
40
20
20
null
null
alexbiehl/hoop
hadoop-protos/src/Hadoop/Protos/DataTransferProtos/DataTransferEncryptorMessageProto/DataTransferEncryptorStatus.hs
mit
toMaybe'Enum 1 = Prelude'.Just ERROR_UNKNOWN_KEY
48
toMaybe'Enum 1 = Prelude'.Just ERROR_UNKNOWN_KEY
48
toMaybe'Enum 1 = Prelude'.Just ERROR_UNKNOWN_KEY
48
false
false
0
6
4
14
6
8
null
null
christiaanb/clash-compiler
clash-vhdl/src/CLaSH/Backend/VHDL.hs
bsd-2-clause
vhdlTypeErrValue (BitVector _) = "(others => 'X')"
56
vhdlTypeErrValue (BitVector _) = "(others => 'X')"
56
vhdlTypeErrValue (BitVector _) = "(others => 'X')"
56
false
false
0
7
12
15
7
8
null
null
gridaphobe/ghc
compiler/typecheck/TcRnTypes.hs
bsd-3-clause
pprEvVarTheta :: [EvVar] -> SDoc pprEvVarTheta ev_vars = pprTheta (map evVarPred ev_vars)
89
pprEvVarTheta :: [EvVar] -> SDoc pprEvVarTheta ev_vars = pprTheta (map evVarPred ev_vars)
89
pprEvVarTheta ev_vars = pprTheta (map evVarPred ev_vars)
56
false
true
0
7
11
37
17
20
null
null
fmapfmapfmap/amazonka
amazonka-sns/test/Test/AWS/Gen/SNS.hs
mpl-2.0
testListPlatformApplications :: ListPlatformApplications -> TestTree testListPlatformApplications = req "ListPlatformApplications" "fixture/ListPlatformApplications.yaml"
178
testListPlatformApplications :: ListPlatformApplications -> TestTree testListPlatformApplications = req "ListPlatformApplications" "fixture/ListPlatformApplications.yaml"
178
testListPlatformApplications = req "ListPlatformApplications" "fixture/ListPlatformApplications.yaml"
109
false
true
0
5
17
20
10
10
null
null
urv/fixhs
src/Data/FIX/Spec/FIX42.hs
lgpl-2.1
tLiquidityIndType :: FIXTag tLiquidityIndType = FIXTag { tName = "LiquidityIndType" , tnum = 409 , tparser = toFIXInt , arbitraryValue = FIXInt <$> arbitrary }
172
tLiquidityIndType :: FIXTag tLiquidityIndType = FIXTag { tName = "LiquidityIndType" , tnum = 409 , tparser = toFIXInt , arbitraryValue = FIXInt <$> arbitrary }
172
tLiquidityIndType = FIXTag { tName = "LiquidityIndType" , tnum = 409 , tparser = toFIXInt , arbitraryValue = FIXInt <$> arbitrary }
144
false
true
0
8
37
45
26
19
null
null
mapinguari/SC_HS_Proxy
src/Proxy/Query/Unit.hs
mit
groundDamage ZergSporeColony = 0
32
groundDamage ZergSporeColony = 0
32
groundDamage ZergSporeColony = 0
32
false
false
0
5
3
9
4
5
null
null
bergmark/hlint
data/Default.hs
bsd-3-clause
warn = (case x of Just a -> a; Nothing -> y) ==> fromMaybe y x
64
warn = (case x of Just a -> a; Nothing -> y) ==> fromMaybe y x
64
warn = (case x of Just a -> a; Nothing -> y) ==> fromMaybe y x
64
false
false
0
10
17
38
19
19
null
null
gridaphobe/ghc
compiler/typecheck/TcBinds.hs
bsd-3-clause
instTcTySigFromId :: Id -> TcM TcIdSigInfo -- Used for instance methods and record selectors instTcTySigFromId id = do { let name = idName id loc = getSrcSpan name ; (tvs, theta, tau) <- tcInstType (tcInstSigTyVarsLoc loc) (idType id) ; return $ TISI { sig_bndr = CompleteSig id , sig_skols = [(tyVarName tv, tv) | tv <- tvs] -- These are freshly instantiated, so although -- we put them in the type envt, doing so has -- no effect , sig_theta = theta , sig_tau = tau , sig_ctxt = FunSigCtxt name False -- False: do not report redundant constraints -- The user has no control over the signature! , sig_loc = loc } }
937
instTcTySigFromId :: Id -> TcM TcIdSigInfo instTcTySigFromId id = do { let name = idName id loc = getSrcSpan name ; (tvs, theta, tau) <- tcInstType (tcInstSigTyVarsLoc loc) (idType id) ; return $ TISI { sig_bndr = CompleteSig id , sig_skols = [(tyVarName tv, tv) | tv <- tvs] -- These are freshly instantiated, so although -- we put them in the type envt, doing so has -- no effect , sig_theta = theta , sig_tau = tau , sig_ctxt = FunSigCtxt name False -- False: do not report redundant constraints -- The user has no control over the signature! , sig_loc = loc } }
887
instTcTySigFromId id = do { let name = idName id loc = getSrcSpan name ; (tvs, theta, tau) <- tcInstType (tcInstSigTyVarsLoc loc) (idType id) ; return $ TISI { sig_bndr = CompleteSig id , sig_skols = [(tyVarName tv, tv) | tv <- tvs] -- These are freshly instantiated, so although -- we put them in the type envt, doing so has -- no effect , sig_theta = theta , sig_tau = tau , sig_ctxt = FunSigCtxt name False -- False: do not report redundant constraints -- The user has no control over the signature! , sig_loc = loc } }
844
true
true
0
12
435
157
88
69
null
null
jstolarek/ghc
compiler/nativeGen/X86/Ppr.hs
bsd-3-clause
pprInstr g@(GDTOF src dst) = pprG g (vcat [gtab <> gpush src 0, gtab <> text "subl $4,%esp ; fstps (%esp) ; flds (%esp) ; addl $4,%esp ;", gtab <> gpop dst 1])
197
pprInstr g@(GDTOF src dst) = pprG g (vcat [gtab <> gpush src 0, gtab <> text "subl $4,%esp ; fstps (%esp) ; flds (%esp) ; addl $4,%esp ;", gtab <> gpop dst 1])
197
pprInstr g@(GDTOF src dst) = pprG g (vcat [gtab <> gpush src 0, gtab <> text "subl $4,%esp ; fstps (%esp) ; flds (%esp) ; addl $4,%esp ;", gtab <> gpop dst 1])
197
false
false
0
10
70
65
32
33
null
null
seL4/capDL-tool
CapDL/PrintDot.hs
bsd-2-clause
getCover :: ObjID -> CoverMap -> ObjSet getCover ut covers = case Map.lookup ut covers of Nothing -> Set.empty Just cover -> cover
150
getCover :: ObjID -> CoverMap -> ObjSet getCover ut covers = case Map.lookup ut covers of Nothing -> Set.empty Just cover -> cover
150
getCover ut covers = case Map.lookup ut covers of Nothing -> Set.empty Just cover -> cover
110
false
true
3
7
42
54
25
29
null
null
bezirg/hlogo
bench/hlogo/Flocking.hs
bsd-3-clause
go = forever $ do t <- ticks when (t > 10000) stop ask flock =<< turtles --repeat_ 5 (ask (atomic $ fd 0.2) =<< turtles) ask (atomic $ fd 1) =<< turtles tick
169
go = forever $ do t <- ticks when (t > 10000) stop ask flock =<< turtles --repeat_ 5 (ask (atomic $ fd 0.2) =<< turtles) ask (atomic $ fd 1) =<< turtles tick
169
go = forever $ do t <- ticks when (t > 10000) stop ask flock =<< turtles --repeat_ 5 (ask (atomic $ fd 0.2) =<< turtles) ask (atomic $ fd 1) =<< turtles tick
169
false
false
1
12
45
70
30
40
null
null
rickardlindberg/codemonitor
tests/KillThreadThatHasRunningProcess.hs
bsd-3-clause
longCommand = do (exit, stdout, stderr) <- myReadProcessWithExitCode "sh" ["-c", "while true; do echo 1; sleep 1; done"] "" return ()
141
longCommand = do (exit, stdout, stderr) <- myReadProcessWithExitCode "sh" ["-c", "while true; do echo 1; sleep 1; done"] "" return ()
141
longCommand = do (exit, stdout, stderr) <- myReadProcessWithExitCode "sh" ["-c", "while true; do echo 1; sleep 1; done"] "" return ()
141
false
false
0
9
28
43
22
21
null
null
PseudoPower/AFSM
src/Control/AFSM/Core.hs
mit
(^<<<) = flip absorbR
21
(^<<<) = flip absorbR
21
(^<<<) = flip absorbR
21
false
false
0
5
3
11
6
5
null
null
sol/doctest
ghci-wrapper/src/Language/Haskell/GhciWrapper.hs
mit
close :: Interpreter -> IO () close repl = do hClose $ hIn repl -- It is crucial not to close `hOut` before calling `waitForProcess`, -- otherwise ghci may not cleanly terminate on SIGINT (ctrl-c) and hang -- around consuming 100% CPU. This happens when ghci tries to print -- something to stdout in its signal handler (e.g. when it is blocked in -- threadDelay it writes "Interrupted." on SIGINT). e <- waitForProcess $ process repl hClose $ hOut repl when (e /= ExitSuccess) $ do throwIO (userError $ "Language.Haskell.GhciWrapper.close: Interpreter exited with an error (" ++ show e ++ ")")
618
close :: Interpreter -> IO () close repl = do hClose $ hIn repl -- It is crucial not to close `hOut` before calling `waitForProcess`, -- otherwise ghci may not cleanly terminate on SIGINT (ctrl-c) and hang -- around consuming 100% CPU. This happens when ghci tries to print -- something to stdout in its signal handler (e.g. when it is blocked in -- threadDelay it writes "Interrupted." on SIGINT). e <- waitForProcess $ process repl hClose $ hOut repl when (e /= ExitSuccess) $ do throwIO (userError $ "Language.Haskell.GhciWrapper.close: Interpreter exited with an error (" ++ show e ++ ")")
618
close repl = do hClose $ hIn repl -- It is crucial not to close `hOut` before calling `waitForProcess`, -- otherwise ghci may not cleanly terminate on SIGINT (ctrl-c) and hang -- around consuming 100% CPU. This happens when ghci tries to print -- something to stdout in its signal handler (e.g. when it is blocked in -- threadDelay it writes "Interrupted." on SIGINT). e <- waitForProcess $ process repl hClose $ hOut repl when (e /= ExitSuccess) $ do throwIO (userError $ "Language.Haskell.GhciWrapper.close: Interpreter exited with an error (" ++ show e ++ ")")
588
false
true
0
14
125
103
49
54
null
null
rodrigo-machado/verigraph
src/library/GrLang/Value.hs
gpl-3.0
-- | Add names to unnamed elements, based on their types. -- If an unnamed element has an unnamed type, it remains unnamed. -- -- May leave distinct elements with the same names, so using 'normalizeValue' is recommended. addNamesFromTypes :: Value -> Value addNamesFromTypes (VGraph g) = VGraph $ addNamesFromTypesToGraph g
323
addNamesFromTypes :: Value -> Value addNamesFromTypes (VGraph g) = VGraph $ addNamesFromTypesToGraph g
102
addNamesFromTypes (VGraph g) = VGraph $ addNamesFromTypesToGraph g
66
true
true
0
7
50
35
19
16
null
null
ulricha/dsh
src/Database/DSH/SL/Typing.hs
bsd-3-clause
tyUnOp t Segment = vecTy t >>= plTy >>= \ty -> pure $ T1 $ DVec ty
70
tyUnOp t Segment = vecTy t >>= plTy >>= \ty -> pure $ T1 $ DVec ty
70
tyUnOp t Segment = vecTy t >>= plTy >>= \ty -> pure $ T1 $ DVec ty
70
false
false
0
8
20
38
18
20
null
null
edgarklerks/document-indexer
DSL/Results.hs
bsd-2-clause
parseDist :: (A.FromJSON a, A.FromJSON b, A.FromJSON c, A.FromJSON d) => (a -> b -> c -> d -> e) -> Maybe Value -> Maybe Value -> Maybe Value -> Maybe Value -> Maybe [Tag] parseDist f tag src off def | any isJust [tag, src, off, def] = Just $ L.zipWith4 Tag (distParse tag :: [Maybe String]) (distParse src :: [Maybe Integer]) (distParse off :: [Maybe Integer]) (distParse def :: [Maybe String]) | otherwise = Nothing
703
parseDist :: (A.FromJSON a, A.FromJSON b, A.FromJSON c, A.FromJSON d) => (a -> b -> c -> d -> e) -> Maybe Value -> Maybe Value -> Maybe Value -> Maybe Value -> Maybe [Tag] parseDist f tag src off def | any isJust [tag, src, off, def] = Just $ L.zipWith4 Tag (distParse tag :: [Maybe String]) (distParse src :: [Maybe Integer]) (distParse off :: [Maybe Integer]) (distParse def :: [Maybe String]) | otherwise = Nothing
703
parseDist f tag src off def | any isJust [tag, src, off, def] = Just $ L.zipWith4 Tag (distParse tag :: [Maybe String]) (distParse src :: [Maybe Integer]) (distParse off :: [Maybe Integer]) (distParse def :: [Maybe String]) | otherwise = Nothing
481
false
true
1
13
362
226
113
113
null
null
houshuang/frame
src/Data/Frame/Types.hs
mit
typeVal (I _) = IT
18
typeVal (I _) = IT
18
typeVal (I _) = IT
18
false
false
0
7
4
15
7
8
null
null
pxqr/intset
tests/Main.hs
bsd-3-clause
prop_mapping :: [Int] -> Bool prop_mapping xs = toList (S.map (*2) (fromList xs)) == L.map (*2) (nub (sort xs))
111
prop_mapping :: [Int] -> Bool prop_mapping xs = toList (S.map (*2) (fromList xs)) == L.map (*2) (nub (sort xs))
111
prop_mapping xs = toList (S.map (*2) (fromList xs)) == L.map (*2) (nub (sort xs))
81
false
true
0
10
18
74
38
36
null
null
yliu120/K3
src/Language/K3/Interpreter/Evaluation.hs
apache-2.0
-- | Monadic message passing primitive for the interpreter. sendE :: Address -> Identifier -> Value -> Interpretation () sendE addr n val = liftEngine $ send addr n val
168
sendE :: Address -> Identifier -> Value -> Interpretation () sendE addr n val = liftEngine $ send addr n val
108
sendE addr n val = liftEngine $ send addr n val
47
true
true
0
9
29
47
23
24
null
null
jaiyalas/sdl2-examples
src/Lesson09.hs
mit
viewportRU = Just $ SDL.Rectangle (P $ V2 (Config.winW `div` 2) 0) (fmap (`div` 2) Config.winV2)
102
viewportRU = Just $ SDL.Rectangle (P $ V2 (Config.winW `div` 2) 0) (fmap (`div` 2) Config.winV2)
102
viewportRU = Just $ SDL.Rectangle (P $ V2 (Config.winW `div` 2) 0) (fmap (`div` 2) Config.winV2)
102
false
false
3
10
21
62
31
31
null
null
kavigupta/N-programming-language
test/Tests.hs
gpl-3.0
doctest :: [String] -> IO () doctest [] = return ()
51
doctest :: [String] -> IO () doctest [] = return ()
51
doctest [] = return ()
22
false
true
0
8
10
38
17
21
null
null
jacekszymanski/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxLANGUAGE_TURKMEN :: Int wxLANGUAGE_TURKMEN = 211
50
wxLANGUAGE_TURKMEN :: Int wxLANGUAGE_TURKMEN = 211
50
wxLANGUAGE_TURKMEN = 211
24
false
true
0
4
5
11
6
5
null
null
chadbrewbaker/combinat
Math/Combinat/Numbers/Series.hs
bsd-3-clause
ndList :: (RandomGen g, Random a) => Int -> (a, a) -> g -> ([a], g) rndList n minmax g = swap $ mapAccumL f g [1..n] where f g _ = swap $ randomR minmax g
158
rndList :: (RandomGen g, Random a) => Int -> (a, a) -> g -> ([a], g) rndList n minmax g = swap $ mapAccumL f g [1..n] where f g _ = swap $ randomR minmax g
158
rndList n minmax g = swap $ mapAccumL f g [1..n] where f g _ = swap $ randomR minmax g
89
false
true
0
10
40
96
51
45
null
null
danr/hipspec
testsuite/prod/zeno_version/PropT05.hs
gpl-3.0
one, zero :: Nat zero = Z
25
one, zero :: Nat zero = Z
25
zero = Z
8
false
true
0
4
6
13
8
5
null
null
mightymoose/liquidhaskell
benchmarks/unordered-containers-0.2.1.0/Data/HashSet.hs
bsd-3-clause
-- | /O(n)/ Transform this set by applying a function to every value. -- The resulting set may be smaller than the source. map :: (Hashable b, Eq b) => (a -> b) -> HashSet a -> HashSet b map f = fromList . List.map f . toList
225
map :: (Hashable b, Eq b) => (a -> b) -> HashSet a -> HashSet b map f = fromList . List.map f . toList
102
map f = fromList . List.map f . toList
38
true
true
1
9
47
71
34
37
null
null
fmapfmapfmap/amazonka
amazonka-iam/gen/Network/AWS/IAM/EnableMFADevice.hs
mpl-2.0
-- | Creates a value of 'EnableMFADevice' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'emdUserName' -- -- * 'emdSerialNumber' -- -- * 'emdAuthenticationCode1' -- -- * 'emdAuthenticationCode2' enableMFADevice :: Text -- ^ 'emdUserName' -> Text -- ^ 'emdSerialNumber' -> Text -- ^ 'emdAuthenticationCode1' -> Text -- ^ 'emdAuthenticationCode2' -> EnableMFADevice enableMFADevice pUserName_ pSerialNumber_ pAuthenticationCode1_ pAuthenticationCode2_ = EnableMFADevice' { _emdUserName = pUserName_ , _emdSerialNumber = pSerialNumber_ , _emdAuthenticationCode1 = pAuthenticationCode1_ , _emdAuthenticationCode2 = pAuthenticationCode2_ }
764
enableMFADevice :: Text -- ^ 'emdUserName' -> Text -- ^ 'emdSerialNumber' -> Text -- ^ 'emdAuthenticationCode1' -> Text -- ^ 'emdAuthenticationCode2' -> EnableMFADevice enableMFADevice pUserName_ pSerialNumber_ pAuthenticationCode1_ pAuthenticationCode2_ = EnableMFADevice' { _emdUserName = pUserName_ , _emdSerialNumber = pSerialNumber_ , _emdAuthenticationCode1 = pAuthenticationCode1_ , _emdAuthenticationCode2 = pAuthenticationCode2_ }
483
enableMFADevice pUserName_ pSerialNumber_ pAuthenticationCode1_ pAuthenticationCode2_ = EnableMFADevice' { _emdUserName = pUserName_ , _emdSerialNumber = pSerialNumber_ , _emdAuthenticationCode1 = pAuthenticationCode1_ , _emdAuthenticationCode2 = pAuthenticationCode2_ }
294
true
true
0
10
136
86
52
34
null
null
fpco/fay
src/Fay/Compiler/Optimizer.hs
bsd-3-clause
inlineMonad :: [JsStmt] -> [JsStmt] inlineMonad = map go where go stmt = case stmt of JsVar name exp -> JsVar name (inline exp) JsIf exp stmts stmts' -> JsIf (inline exp) (map go stmts) (map go stmts') JsEarlyReturn exp -> JsEarlyReturn (inline exp) JsThrow exp -> JsThrow (inline exp) JsWhile exp stmts -> JsWhile (inline exp) (map go stmts) JsUpdate name exp -> JsUpdate name (inline exp) JsSetProp a b exp -> JsSetProp a b (inline exp) JsSetQName s a exp -> JsSetQName s a (inline exp) JsSetModule a exp -> JsSetModule a (inline exp) JsSetConstructor a exp -> JsSetConstructor a (inline exp) JsSetPropExtern a b exp -> JsSetPropExtern a b (inline exp) JsContinue -> JsContinue JsBlock stmts -> JsBlock (map go stmts) JsExpStmt exp -> JsExpStmt (inline exp) inline expr = case expr of -- Optimizations JsApp op args -> fromMaybe (JsApp (inline op) $ map inline args) (flatten expr) -- Plumbing JsFun nm names stmts mexp -> JsFun nm names (map go stmts) (fmap inline mexp) JsNegApp exp -> JsNegApp (inline exp) JsTernaryIf exp1 exp2 exp3 -> JsTernaryIf (inline exp1) (inline exp2) (inline exp3) JsParen exp -> JsParen (inline exp) JsGetProp exp name -> JsGetProp (inline exp) name JsLookup exp exp2 -> JsLookup (inline exp) (inline exp2) JsUpdateProp exp name exp2 -> JsUpdateProp (inline exp) name (inline exp2) JsGetPropExtern exp string -> JsGetPropExtern (inline exp) string JsUpdatePropExtern exp name exp2 -> JsUpdatePropExtern (inline exp) name (inline exp2) JsList exps -> JsList (map inline exps) JsNew name exps -> JsNew name (map inline exps) JsThrowExp exp -> JsThrowExp (inline exp) JsInstanceOf exp name -> JsInstanceOf (inline exp) name JsIndex i exp -> JsIndex i (inline exp) JsEq exp exp2 -> JsEq (inline exp) (inline exp2) JsNeq exp exp2 -> JsNeq (inline exp) (inline exp2) JsInfix string exp exp2 -> JsInfix string (inline exp) (inline exp2) JsObj keyvals -> JsObj keyvals rest -> rest -- | Flatten a a>>(b>>c) to [a,b,c].
2,460
inlineMonad :: [JsStmt] -> [JsStmt] inlineMonad = map go where go stmt = case stmt of JsVar name exp -> JsVar name (inline exp) JsIf exp stmts stmts' -> JsIf (inline exp) (map go stmts) (map go stmts') JsEarlyReturn exp -> JsEarlyReturn (inline exp) JsThrow exp -> JsThrow (inline exp) JsWhile exp stmts -> JsWhile (inline exp) (map go stmts) JsUpdate name exp -> JsUpdate name (inline exp) JsSetProp a b exp -> JsSetProp a b (inline exp) JsSetQName s a exp -> JsSetQName s a (inline exp) JsSetModule a exp -> JsSetModule a (inline exp) JsSetConstructor a exp -> JsSetConstructor a (inline exp) JsSetPropExtern a b exp -> JsSetPropExtern a b (inline exp) JsContinue -> JsContinue JsBlock stmts -> JsBlock (map go stmts) JsExpStmt exp -> JsExpStmt (inline exp) inline expr = case expr of -- Optimizations JsApp op args -> fromMaybe (JsApp (inline op) $ map inline args) (flatten expr) -- Plumbing JsFun nm names stmts mexp -> JsFun nm names (map go stmts) (fmap inline mexp) JsNegApp exp -> JsNegApp (inline exp) JsTernaryIf exp1 exp2 exp3 -> JsTernaryIf (inline exp1) (inline exp2) (inline exp3) JsParen exp -> JsParen (inline exp) JsGetProp exp name -> JsGetProp (inline exp) name JsLookup exp exp2 -> JsLookup (inline exp) (inline exp2) JsUpdateProp exp name exp2 -> JsUpdateProp (inline exp) name (inline exp2) JsGetPropExtern exp string -> JsGetPropExtern (inline exp) string JsUpdatePropExtern exp name exp2 -> JsUpdatePropExtern (inline exp) name (inline exp2) JsList exps -> JsList (map inline exps) JsNew name exps -> JsNew name (map inline exps) JsThrowExp exp -> JsThrowExp (inline exp) JsInstanceOf exp name -> JsInstanceOf (inline exp) name JsIndex i exp -> JsIndex i (inline exp) JsEq exp exp2 -> JsEq (inline exp) (inline exp2) JsNeq exp exp2 -> JsNeq (inline exp) (inline exp2) JsInfix string exp exp2 -> JsInfix string (inline exp) (inline exp2) JsObj keyvals -> JsObj keyvals rest -> rest -- | Flatten a a>>(b>>c) to [a,b,c].
2,460
inlineMonad = map go where go stmt = case stmt of JsVar name exp -> JsVar name (inline exp) JsIf exp stmts stmts' -> JsIf (inline exp) (map go stmts) (map go stmts') JsEarlyReturn exp -> JsEarlyReturn (inline exp) JsThrow exp -> JsThrow (inline exp) JsWhile exp stmts -> JsWhile (inline exp) (map go stmts) JsUpdate name exp -> JsUpdate name (inline exp) JsSetProp a b exp -> JsSetProp a b (inline exp) JsSetQName s a exp -> JsSetQName s a (inline exp) JsSetModule a exp -> JsSetModule a (inline exp) JsSetConstructor a exp -> JsSetConstructor a (inline exp) JsSetPropExtern a b exp -> JsSetPropExtern a b (inline exp) JsContinue -> JsContinue JsBlock stmts -> JsBlock (map go stmts) JsExpStmt exp -> JsExpStmt (inline exp) inline expr = case expr of -- Optimizations JsApp op args -> fromMaybe (JsApp (inline op) $ map inline args) (flatten expr) -- Plumbing JsFun nm names stmts mexp -> JsFun nm names (map go stmts) (fmap inline mexp) JsNegApp exp -> JsNegApp (inline exp) JsTernaryIf exp1 exp2 exp3 -> JsTernaryIf (inline exp1) (inline exp2) (inline exp3) JsParen exp -> JsParen (inline exp) JsGetProp exp name -> JsGetProp (inline exp) name JsLookup exp exp2 -> JsLookup (inline exp) (inline exp2) JsUpdateProp exp name exp2 -> JsUpdateProp (inline exp) name (inline exp2) JsGetPropExtern exp string -> JsGetPropExtern (inline exp) string JsUpdatePropExtern exp name exp2 -> JsUpdatePropExtern (inline exp) name (inline exp2) JsList exps -> JsList (map inline exps) JsNew name exps -> JsNew name (map inline exps) JsThrowExp exp -> JsThrowExp (inline exp) JsInstanceOf exp name -> JsInstanceOf (inline exp) name JsIndex i exp -> JsIndex i (inline exp) JsEq exp exp2 -> JsEq (inline exp) (inline exp2) JsNeq exp exp2 -> JsNeq (inline exp) (inline exp2) JsInfix string exp exp2 -> JsInfix string (inline exp) (inline exp2) JsObj keyvals -> JsObj keyvals rest -> rest -- | Flatten a a>>(b>>c) to [a,b,c].
2,424
false
true
0
13
839
875
408
467
null
null
kwangkim/pigment
src-lib/Tactics/Record.hs
mit
-- This is modeled in Records.agda -- What things do we need: -- -- create a label -- -- create an empty record sig -- add a label to a record sig -- remove a label from a record sig -- modify a label in a record sig -- -- -- instantiate a record makeEmptyRecord :: String -> ProofState Name makeEmptyRecord name = freshRef (name :<: RSIG) $ \ref -> do nsupply <- askNSupply let meta = Metadata False "" False ref' = refName ref := DEFN REMPTY :<: RSIG dev = Dev { devEntries = B0 , devTip = Defined REMPTY (RSIG :=>: RSIG) , devNSupply = freshNSpace nsupply name , devSuspendState = SuspendNone } putEntryAbove $ EDEF ref' (mkLastName ref') LETG dev RSIG emptyMetadata return $ refName ref -- TODO non-elab version! -- XXX ref doesn't get updated with new defn... what do refs actually mean? -- -- TODO when the definition of a record changes we need to invalidate some -- (maybe not all) uses. I'm picturing: -- -- * consumers of the record will continue to execute without failure as they -- only depend on the subset of the new record's tags that were present in -- the old record. *However*, they may not want to say they accept the new -- record, since the old one was more precise. Example: -- -- oldRec = { x, y } -- newRec = { x, y, z } -- -- f { x, y } = ... -- -- f, a consumer of the old record, likely doesn't want to advertise itself -- as a consumer of newRec, since that will work, but is not precise. -- -- * producers of the record will certainly need to change. -- -- * additionally, we need to think about subtyping. -- -- * what happens when you try to add a tag that's already present? (I think -- the right answer here is probably in the interface -- you're simply not -- allowed to do that)
1,864
makeEmptyRecord :: String -> ProofState Name makeEmptyRecord name = freshRef (name :<: RSIG) $ \ref -> do nsupply <- askNSupply let meta = Metadata False "" False ref' = refName ref := DEFN REMPTY :<: RSIG dev = Dev { devEntries = B0 , devTip = Defined REMPTY (RSIG :=>: RSIG) , devNSupply = freshNSpace nsupply name , devSuspendState = SuspendNone } putEntryAbove $ EDEF ref' (mkLastName ref') LETG dev RSIG emptyMetadata return $ refName ref -- TODO non-elab version! -- XXX ref doesn't get updated with new defn... what do refs actually mean? -- -- TODO when the definition of a record changes we need to invalidate some -- (maybe not all) uses. I'm picturing: -- -- * consumers of the record will continue to execute without failure as they -- only depend on the subset of the new record's tags that were present in -- the old record. *However*, they may not want to say they accept the new -- record, since the old one was more precise. Example: -- -- oldRec = { x, y } -- newRec = { x, y, z } -- -- f { x, y } = ... -- -- f, a consumer of the old record, likely doesn't want to advertise itself -- as a consumer of newRec, since that will work, but is not precise. -- -- * producers of the record will certainly need to change. -- -- * additionally, we need to think about subtyping. -- -- * what happens when you try to add a tag that's already present? (I think -- the right answer here is probably in the interface -- you're simply not -- allowed to do that)
1,614
makeEmptyRecord name = freshRef (name :<: RSIG) $ \ref -> do nsupply <- askNSupply let meta = Metadata False "" False ref' = refName ref := DEFN REMPTY :<: RSIG dev = Dev { devEntries = B0 , devTip = Defined REMPTY (RSIG :=>: RSIG) , devNSupply = freshNSpace nsupply name , devSuspendState = SuspendNone } putEntryAbove $ EDEF ref' (mkLastName ref') LETG dev RSIG emptyMetadata return $ refName ref -- TODO non-elab version! -- XXX ref doesn't get updated with new defn... what do refs actually mean? -- -- TODO when the definition of a record changes we need to invalidate some -- (maybe not all) uses. I'm picturing: -- -- * consumers of the record will continue to execute without failure as they -- only depend on the subset of the new record's tags that were present in -- the old record. *However*, they may not want to say they accept the new -- record, since the old one was more precise. Example: -- -- oldRec = { x, y } -- newRec = { x, y, z } -- -- f { x, y } = ... -- -- f, a consumer of the old record, likely doesn't want to advertise itself -- as a consumer of newRec, since that will work, but is not precise. -- -- * producers of the record will certainly need to change. -- -- * additionally, we need to think about subtyping. -- -- * what happens when you try to add a tag that's already present? (I think -- the right answer here is probably in the interface -- you're simply not -- allowed to do that)
1,569
true
true
0
16
486
204
121
83
null
null
sw17ch/Scurry
src/Scurry/NetTask.hs
bsd-3-clause
netDbg :: String -> IO () -- netDbg = putStrLn netDbg _ = do return ()
70
netDbg :: String -> IO () netDbg _ = do return ()
49
netDbg _ = do return ()
23
true
true
0
8
15
32
15
17
null
null
brendanhay/gogol
gogol-storage/gen/Network/Google/Resource/Storage/Objects/WatchAll.hs
mpl-2.0
-- | Returns results in a directory-like mode. items will contain only -- objects whose names, aside from the prefix, do not contain delimiter. -- Objects whose names, aside from the prefix, contain delimiter will have -- their name, truncated after the delimiter, returned in prefixes. -- Duplicate prefixes are omitted. owaDelimiter :: Lens' ObjectsWatchAll (Maybe Text) owaDelimiter = lens _owaDelimiter (\ s a -> s{_owaDelimiter = a})
440
owaDelimiter :: Lens' ObjectsWatchAll (Maybe Text) owaDelimiter = lens _owaDelimiter (\ s a -> s{_owaDelimiter = a})
118
owaDelimiter = lens _owaDelimiter (\ s a -> s{_owaDelimiter = a})
67
true
true
1
9
69
56
29
27
null
null
sawatani/bitcoin-hall
src/Fathens/Bitcoin/Binary/Hash.hs
gpl-3.0
hmac512 :: ByteString -> ByteString -> Hash512 hmac512 key body = (Hash512 . BS.pack . unpack) h where a = BS.toStrict key b = BS.toStrict body h = hmac a b :: HMAC SHA512 -- Utilities
199
hmac512 :: ByteString -> ByteString -> Hash512 hmac512 key body = (Hash512 . BS.pack . unpack) h where a = BS.toStrict key b = BS.toStrict body h = hmac a b :: HMAC SHA512 -- Utilities
199
hmac512 key body = (Hash512 . BS.pack . unpack) h where a = BS.toStrict key b = BS.toStrict body h = hmac a b :: HMAC SHA512 -- Utilities
152
false
true
0
9
50
80
40
40
null
null
ml9951/ghc
compiler/coreSyn/MkCore.hs
bsd-3-clause
sortQuantVars :: [Var] -> [Var] -- Sort the variables (KindVars, TypeVars, and Ids) -- into order: Kind, then Type, then Id sortQuantVars = sortBy (comparing withCategory) where withCategory v = (category v, v) category :: Var -> Int category v | isKindVar v = 1 | isTyVar v = 2 | otherwise = 3 -- | Bind a binding group over an expression, using a @let@ or @case@ as -- appropriate (see "CoreSyn#let_app_invariant")
450
sortQuantVars :: [Var] -> [Var] sortQuantVars = sortBy (comparing withCategory) where withCategory v = (category v, v) category :: Var -> Int category v | isKindVar v = 1 | isTyVar v = 2 | otherwise = 3 -- | Bind a binding group over an expression, using a @let@ or @case@ as -- appropriate (see "CoreSyn#let_app_invariant")
358
sortQuantVars = sortBy (comparing withCategory) where withCategory v = (category v, v) category :: Var -> Int category v | isKindVar v = 1 | isTyVar v = 2 | otherwise = 3 -- | Bind a binding group over an expression, using a @let@ or @case@ as -- appropriate (see "CoreSyn#let_app_invariant")
326
true
true
0
8
106
101
51
50
null
null
SKA-ScienceDataProcessor/RC
MS4/lib/DNA/Logging.hs
apache-2.0
-- | Generate the specified eventlog message rawMessage :: String -- ^ Message tag -> [Attr] -- ^ Message attributes -> String -- ^ Message body -> Bool -- ^ If True then message is written to stdout too -> IO () rawMessage tag attrs msg logStdout = do -- Make message text let formatAttr (attr, val) = ' ':'[':attr ++ '=': val ++ "]" text = concat (tag : map formatAttr attrs) ++ ' ':msg -- Check whether it's too long for the RTS to output in one -- piece. This is rare, but we don't want to lose information. when logStdout $ putStrLn text let splitThreshold = 512 if length text < splitThreshold then traceEventIO text else do -- Determine marker. We need this because the message chunks -- might get split up. msgId <- atomicModifyIORef' loggerMsgId (\x -> (x+1,x)) let mark = "[[" ++ show msgId ++ "]]" -- Now split message up and output it. Every message but the -- last gets the continuation marker at the end, and every -- message but the first is a continuation. let split "" = Nothing split str = Just $ splitAt (splitThreshold - 20) str pieces = unfoldr split text start = head pieces; (mid, end:_) = splitAt (length pieces-2) (tail pieces) traceEventIO (start ++ mark) forM_ mid $ \m -> traceEventIO (mark ++ m ++ mark) traceEventIO (mark ++ end) -- | Generate identification attributes it uses 'logSource' method for -- getting name of PID
1,549
rawMessage :: String -- ^ Message tag -> [Attr] -- ^ Message attributes -> String -- ^ Message body -> Bool -- ^ If True then message is written to stdout too -> IO () rawMessage tag attrs msg logStdout = do -- Make message text let formatAttr (attr, val) = ' ':'[':attr ++ '=': val ++ "]" text = concat (tag : map formatAttr attrs) ++ ' ':msg -- Check whether it's too long for the RTS to output in one -- piece. This is rare, but we don't want to lose information. when logStdout $ putStrLn text let splitThreshold = 512 if length text < splitThreshold then traceEventIO text else do -- Determine marker. We need this because the message chunks -- might get split up. msgId <- atomicModifyIORef' loggerMsgId (\x -> (x+1,x)) let mark = "[[" ++ show msgId ++ "]]" -- Now split message up and output it. Every message but the -- last gets the continuation marker at the end, and every -- message but the first is a continuation. let split "" = Nothing split str = Just $ splitAt (splitThreshold - 20) str pieces = unfoldr split text start = head pieces; (mid, end:_) = splitAt (length pieces-2) (tail pieces) traceEventIO (start ++ mark) forM_ mid $ \m -> traceEventIO (mark ++ m ++ mark) traceEventIO (mark ++ end) -- | Generate identification attributes it uses 'logSource' method for -- getting name of PID
1,504
rawMessage tag attrs msg logStdout = do -- Make message text let formatAttr (attr, val) = ' ':'[':attr ++ '=': val ++ "]" text = concat (tag : map formatAttr attrs) ++ ' ':msg -- Check whether it's too long for the RTS to output in one -- piece. This is rare, but we don't want to lose information. when logStdout $ putStrLn text let splitThreshold = 512 if length text < splitThreshold then traceEventIO text else do -- Determine marker. We need this because the message chunks -- might get split up. msgId <- atomicModifyIORef' loggerMsgId (\x -> (x+1,x)) let mark = "[[" ++ show msgId ++ "]]" -- Now split message up and output it. Every message but the -- last gets the continuation marker at the end, and every -- message but the first is a continuation. let split "" = Nothing split str = Just $ splitAt (splitThreshold - 20) str pieces = unfoldr split text start = head pieces; (mid, end:_) = splitAt (length pieces-2) (tail pieces) traceEventIO (start ++ mark) forM_ mid $ \m -> traceEventIO (mark ++ m ++ mark) traceEventIO (mark ++ end) -- | Generate identification attributes it uses 'logSource' method for -- getting name of PID
1,290
true
true
0
16
443
365
186
179
null
null
riwsky/wiwinwlh
src/hlist.hs
mit
hlength :: HList x -> Int hlength Nil = 0
41
hlength :: HList x -> Int hlength Nil = 0
41
hlength Nil = 0
15
false
true
0
6
9
21
10
11
null
null
dblia/nosql-ganeti
test/hs/Test/Ganeti/HTools/Cluster.hs
gpl-2.0
-- | Helper function to check if we can allocate an instance on a -- given node list. Successful allocation is denoted by 'Nothing', -- otherwise the 'Just' value will contain the error message. canAllocOn :: Node.List -> Int -> Instance.Instance -> Maybe String canAllocOn nl reqnodes inst = case Cluster.genAllocNodes defGroupList nl reqnodes True >>= Cluster.tryAlloc nl Container.empty inst of Bad msg -> Just $ "Can't allocate: " ++ msg Ok as -> case Cluster.asSolution as of Nothing -> Just $ "No allocation solution; failures: " ++ show (Cluster.collapseFailures $ Cluster.asFailures as) Just _ -> Nothing -- | Checks that allocation obeys minimum and maximum instance -- policies. The unittest generates a random node, duplicates it /count/ -- times, and generates a random instance that can be allocated on -- this mini-cluster; it then checks that after applying a policy that -- the instance doesn't fits, the allocation fails.
1,015
canAllocOn :: Node.List -> Int -> Instance.Instance -> Maybe String canAllocOn nl reqnodes inst = case Cluster.genAllocNodes defGroupList nl reqnodes True >>= Cluster.tryAlloc nl Container.empty inst of Bad msg -> Just $ "Can't allocate: " ++ msg Ok as -> case Cluster.asSolution as of Nothing -> Just $ "No allocation solution; failures: " ++ show (Cluster.collapseFailures $ Cluster.asFailures as) Just _ -> Nothing -- | Checks that allocation obeys minimum and maximum instance -- policies. The unittest generates a random node, duplicates it /count/ -- times, and generates a random instance that can be allocated on -- this mini-cluster; it then checks that after applying a policy that -- the instance doesn't fits, the allocation fails.
820
canAllocOn nl reqnodes inst = case Cluster.genAllocNodes defGroupList nl reqnodes True >>= Cluster.tryAlloc nl Container.empty inst of Bad msg -> Just $ "Can't allocate: " ++ msg Ok as -> case Cluster.asSolution as of Nothing -> Just $ "No allocation solution; failures: " ++ show (Cluster.collapseFailures $ Cluster.asFailures as) Just _ -> Nothing -- | Checks that allocation obeys minimum and maximum instance -- policies. The unittest generates a random node, duplicates it /count/ -- times, and generates a random instance that can be allocated on -- this mini-cluster; it then checks that after applying a policy that -- the instance doesn't fits, the allocation fails.
752
true
true
8
8
226
120
68
52
null
null
NucHorseStudios/HaskellDevBot
HaskellBot.hs
mit
setUser :: String -> Net () setUser u = write "USER" u
54
setUser :: String -> Net () setUser u = write "USER" u
54
setUser u = write "USER" u
26
false
true
0
8
11
34
14
20
null
null
Batou99/pivot_table
src/Lib.hs
bsd-3-clause
getRow :: Int -> Int -> [Int] -> [Int] getRow columnsPerRow rowNum values = take columnsPerRow $ drop valuesToDrop values where valuesToDrop = (rowNum - 1) * columnsPerRow
179
getRow :: Int -> Int -> [Int] -> [Int] getRow columnsPerRow rowNum values = take columnsPerRow $ drop valuesToDrop values where valuesToDrop = (rowNum - 1) * columnsPerRow
179
getRow columnsPerRow rowNum values = take columnsPerRow $ drop valuesToDrop values where valuesToDrop = (rowNum - 1) * columnsPerRow
140
false
true
0
8
35
67
34
33
null
null
sdiehl/ghc
compiler/utils/UniqFM.hs
bsd-3-clause
listToUFM_Directly :: [(Unique, elt)] -> UniqFM elt listToUFM_Directly = foldl' (\m (u, v) -> addToUFM_Directly m u v) emptyUFM
127
listToUFM_Directly :: [(Unique, elt)] -> UniqFM elt listToUFM_Directly = foldl' (\m (u, v) -> addToUFM_Directly m u v) emptyUFM
127
listToUFM_Directly = foldl' (\m (u, v) -> addToUFM_Directly m u v) emptyUFM
75
false
true
0
8
18
55
30
25
null
null
jessekempf/hsh
src/HSH/CommandLineParse.hs
bsd-2-clause
{- END outputDirection -} {- Build a process specification from a command string -} commandFromString :: String -> Command commandFromString string = Command cmd args input output where (cmd : tokens) = words string (inputless_args, input) = inputDirection tokens (args, output) = outputDirection inputless_args {- -- End of I/O Redirection Syntax Parsing -}
376
commandFromString :: String -> Command commandFromString string = Command cmd args input output where (cmd : tokens) = words string (inputless_args, input) = inputDirection tokens (args, output) = outputDirection inputless_args {- -- End of I/O Redirection Syntax Parsing -}
291
commandFromString string = Command cmd args input output where (cmd : tokens) = words string (inputless_args, input) = inputDirection tokens (args, output) = outputDirection inputless_args {- -- End of I/O Redirection Syntax Parsing -}
252
true
true
0
6
70
80
41
39
null
null
nevrenato/Hets_Fork
LF/Sign.hs
gpl-2.0
-- constructs the intersection of two signatures sigIntersection :: Sign -> Sign -> Result Sign sigIntersection sig1 sig2 = do let defs1 = Set.fromList $ getDefs sig1 let defs2 = Set.fromList $ getDefs sig2 let defs = Set.difference defs1 defs2 let syms = Set.map getSym defs coGenSig syms sig1 -- constructs the signature generated by the specified symbol set
371
sigIntersection :: Sign -> Sign -> Result Sign sigIntersection sig1 sig2 = do let defs1 = Set.fromList $ getDefs sig1 let defs2 = Set.fromList $ getDefs sig2 let defs = Set.difference defs1 defs2 let syms = Set.map getSym defs coGenSig syms sig1 -- constructs the signature generated by the specified symbol set
322
sigIntersection sig1 sig2 = do let defs1 = Set.fromList $ getDefs sig1 let defs2 = Set.fromList $ getDefs sig2 let defs = Set.difference defs1 defs2 let syms = Set.map getSym defs coGenSig syms sig1 -- constructs the signature generated by the specified symbol set
275
true
true
1
7
69
97
48
49
null
null
mcschroeder/ghc
compiler/hsSyn/HsExpr.hs
bsd-3-clause
hsExprNeedsParens (HsLit {}) = False
45
hsExprNeedsParens (HsLit {}) = False
45
hsExprNeedsParens (HsLit {}) = False
45
false
false
0
6
13
17
8
9
null
null
chrisdone/ace
src/ACE/Parsers.hs
bsd-3-clause
ap = (APTrans <$> transitiveAdjective <*> pp) <|> (APIntrans <$> intransitiveAdjective)
91
ap = (APTrans <$> transitiveAdjective <*> pp) <|> (APIntrans <$> intransitiveAdjective)
91
ap = (APTrans <$> transitiveAdjective <*> pp) <|> (APIntrans <$> intransitiveAdjective)
91
false
false
1
8
14
32
15
17
null
null
qrilka/xlsx
src/Codec/Xlsx/Types/ConditionalFormatting.hs
mit
conditionData DuplicateValues = ("duplicateValues", M.empty, [])
71
conditionData DuplicateValues = ("duplicateValues", M.empty, [])
71
conditionData DuplicateValues = ("duplicateValues", M.empty, [])
71
false
false
0
6
12
23
12
11
null
null
andorp/grin
grin/src/AbstractInterpretation/PrettyIR.hs
bsd-3-clause
prettyInstruction :: Maybe IRMap -> Instruction -> Doc prettyInstruction mirm = \case If {..} -> keyword "if" <+> prettyCondition mirm condition <+> ppR srcReg <$$> indent 2 (vsep . map (prettyInstruction mirm) $ instructions) Project {..} -> keyword "project" <+> ppS srcSelector <+> ppR srcReg <+> arr <+> ppR dstReg Extend {..} -> keyword "extend" <+> ppR srcReg <+> ppS dstSelector <+> arr <+> ppR dstReg Move {..} -> keyword "move" <+> ppR srcReg <+> arr <+> ppR dstReg RestrictedMove {..} -> keyword "restricted move" <+> ppR srcReg <+> arr <+> ppR dstReg ConditionalMove {..} -> keyword "conditional move" <+> parens (prettyPredicate mirm predicate False) <+> ppR srcReg <+> arr <+> ppR dstReg Fetch {..} -> keyword "fetch" <+> ppR addressReg <+> arr <+> ppR dstReg Store {..} -> keyword "store" <+> ppR srcReg <+> arr <+> pretty address Update {..} -> keyword "update" <+> ppR srcReg <+> arr <+> ppR addressReg RestrictedUpdate {..} -> keyword "restricted update" <+> ppR srcReg <+> arr <+> ppR addressReg Set {..} -> keyword "set" <+> prettyConstant mirm constant <+> arr <+> ppR dstReg where ppR = prettyReg mirm ppS = prettySelector mirm arr = text "-->"
1,242
prettyInstruction :: Maybe IRMap -> Instruction -> Doc prettyInstruction mirm = \case If {..} -> keyword "if" <+> prettyCondition mirm condition <+> ppR srcReg <$$> indent 2 (vsep . map (prettyInstruction mirm) $ instructions) Project {..} -> keyword "project" <+> ppS srcSelector <+> ppR srcReg <+> arr <+> ppR dstReg Extend {..} -> keyword "extend" <+> ppR srcReg <+> ppS dstSelector <+> arr <+> ppR dstReg Move {..} -> keyword "move" <+> ppR srcReg <+> arr <+> ppR dstReg RestrictedMove {..} -> keyword "restricted move" <+> ppR srcReg <+> arr <+> ppR dstReg ConditionalMove {..} -> keyword "conditional move" <+> parens (prettyPredicate mirm predicate False) <+> ppR srcReg <+> arr <+> ppR dstReg Fetch {..} -> keyword "fetch" <+> ppR addressReg <+> arr <+> ppR dstReg Store {..} -> keyword "store" <+> ppR srcReg <+> arr <+> pretty address Update {..} -> keyword "update" <+> ppR srcReg <+> arr <+> ppR addressReg RestrictedUpdate {..} -> keyword "restricted update" <+> ppR srcReg <+> arr <+> ppR addressReg Set {..} -> keyword "set" <+> prettyConstant mirm constant <+> arr <+> ppR dstReg where ppR = prettyReg mirm ppS = prettySelector mirm arr = text "-->"
1,242
prettyInstruction mirm = \case If {..} -> keyword "if" <+> prettyCondition mirm condition <+> ppR srcReg <$$> indent 2 (vsep . map (prettyInstruction mirm) $ instructions) Project {..} -> keyword "project" <+> ppS srcSelector <+> ppR srcReg <+> arr <+> ppR dstReg Extend {..} -> keyword "extend" <+> ppR srcReg <+> ppS dstSelector <+> arr <+> ppR dstReg Move {..} -> keyword "move" <+> ppR srcReg <+> arr <+> ppR dstReg RestrictedMove {..} -> keyword "restricted move" <+> ppR srcReg <+> arr <+> ppR dstReg ConditionalMove {..} -> keyword "conditional move" <+> parens (prettyPredicate mirm predicate False) <+> ppR srcReg <+> arr <+> ppR dstReg Fetch {..} -> keyword "fetch" <+> ppR addressReg <+> arr <+> ppR dstReg Store {..} -> keyword "store" <+> ppR srcReg <+> arr <+> pretty address Update {..} -> keyword "update" <+> ppR srcReg <+> arr <+> ppR addressReg RestrictedUpdate {..} -> keyword "restricted update" <+> ppR srcReg <+> arr <+> ppR addressReg Set {..} -> keyword "set" <+> prettyConstant mirm constant <+> arr <+> ppR dstReg where ppR = prettyReg mirm ppS = prettySelector mirm arr = text "-->"
1,187
false
true
3
15
269
492
220
272
null
null
hgiddens/virtue
test/InterpSpec.hs
mit
commandp (BInt _) = False
25
commandp (BInt _) = False
25
commandp (BInt _) = False
25
false
false
0
6
4
16
7
9
null
null
hamishmack/haskell-gi
lib/Data/GI/CodeGen/Overrides.hs
lgpl-2.1
filterAPIsAndDeps :: Overrides -> GIRInfo -> [GIRInfo] -> (M.Map Name API, M.Map Name API) filterAPIsAndDeps ovs doc deps = let toMap = M.fromList . filterAPIs ovs . girAPIs in (toMap doc, M.unions (map toMap deps))
237
filterAPIsAndDeps :: Overrides -> GIRInfo -> [GIRInfo] -> (M.Map Name API, M.Map Name API) filterAPIsAndDeps ovs doc deps = let toMap = M.fromList . filterAPIs ovs . girAPIs in (toMap doc, M.unions (map toMap deps))
237
filterAPIsAndDeps ovs doc deps = let toMap = M.fromList . filterAPIs ovs . girAPIs in (toMap doc, M.unions (map toMap deps))
128
false
true
0
12
56
105
50
55
null
null
shlevy/ghc
compiler/simplCore/CSE.hs
bsd-3-clause
lookupSubst :: CSEnv -> Id -> OutExpr lookupSubst (CS { cs_subst = sub}) x = lookupIdSubst (text "CSE.lookupSubst") sub x
121
lookupSubst :: CSEnv -> Id -> OutExpr lookupSubst (CS { cs_subst = sub}) x = lookupIdSubst (text "CSE.lookupSubst") sub x
121
lookupSubst (CS { cs_subst = sub}) x = lookupIdSubst (text "CSE.lookupSubst") sub x
83
false
true
3
8
19
53
25
28
null
null
jcristovao/persistent
persistent-mysql/Database/Persist/MySQL.hs
mit
-- Controversial conversions getGetter MySQLBase.Set = convertPV PersistText
83
getGetter MySQLBase.Set = convertPV PersistText
54
getGetter MySQLBase.Set = convertPV PersistText
54
true
false
0
5
14
16
7
9
null
null
soupi/hablog
src/Web/Hablog/Utils.hs
mit
hd :: [a] -> Maybe a hd [] = Nothing
36
hd :: [a] -> Maybe a hd [] = Nothing
36
hd [] = Nothing
15
false
true
0
8
9
31
14
17
null
null
astro/haskell-torrent
src/TimerP.hs
bsd-2-clause
register :: MonadIO m => Integer -> a -> Channel a -> m () register secs v c = liftIO $ registerL secs v c
106
register :: MonadIO m => Integer -> a -> Channel a -> m () register secs v c = liftIO $ registerL secs v c
106
register secs v c = liftIO $ registerL secs v c
47
false
true
0
11
24
60
27
33
null
null
peteg/ADHOC
Tests/08_Kesterel/145_nondet_bits.hs
gpl-2.0
nextBitP = "next bit"
21
nextBitP = "next bit"
21
nextBitP = "next bit"
21
false
false
0
4
3
6
3
3
null
null
rueshyna/gogol
gogol-play-moviespartner/gen/Network/Google/Resource/PlayMoviesPartner/Accounts/Orders/Get.hs
mpl-2.0
-- | Upload protocol for media (e.g. \"raw\", \"multipart\"). aogUploadProtocol :: Lens' AccountsOrdersGet (Maybe Text) aogUploadProtocol = lens _aogUploadProtocol (\ s a -> s{_aogUploadProtocol = a})
208
aogUploadProtocol :: Lens' AccountsOrdersGet (Maybe Text) aogUploadProtocol = lens _aogUploadProtocol (\ s a -> s{_aogUploadProtocol = a})
146
aogUploadProtocol = lens _aogUploadProtocol (\ s a -> s{_aogUploadProtocol = a})
88
true
true
0
9
33
48
25
23
null
null
guoguo12/aether
src/Aether/WikipediaPage.hs
mit
-- | Returns the URLs of the images on the given page. -- Works for up to 500 images. images :: WikipediaPage -> IO (Maybe [String]) images pg = do let queries = stdQueries ++ [ ("generator", "images") , ("gimlimit", "max") , ("prop", "imageinfo") , ("iiprop", "url") , ("titles", title pg) ] maybeResults <- wikiRequest queries return $ fmap (extractAllAttrValues " url") maybeResults -- | Returns the URLs of the description pages for the images -- on the given page. Works for up to 500 images.
656
images :: WikipediaPage -> IO (Maybe [String]) images pg = do let queries = stdQueries ++ [ ("generator", "images") , ("gimlimit", "max") , ("prop", "imageinfo") , ("iiprop", "url") , ("titles", title pg) ] maybeResults <- wikiRequest queries return $ fmap (extractAllAttrValues " url") maybeResults -- | Returns the URLs of the description pages for the images -- on the given page. Works for up to 500 images.
570
images pg = do let queries = stdQueries ++ [ ("generator", "images") , ("gimlimit", "max") , ("prop", "imageinfo") , ("iiprop", "url") , ("titles", title pg) ] maybeResults <- wikiRequest queries return $ fmap (extractAllAttrValues " url") maybeResults -- | Returns the URLs of the description pages for the images -- on the given page. Works for up to 500 images.
523
true
true
0
14
244
128
69
59
null
null
kellino/TypeSystems
fullSub/Parser.hs
mit
var :: Parser Term var = do n <- identifier return $ TmVar (string2Name n)
82
var :: Parser Term var = do n <- identifier return $ TmVar (string2Name n)
82
var = do n <- identifier return $ TmVar (string2Name n)
63
false
true
0
10
22
37
17
20
null
null