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
CodaFi/language-swift
src/Language/Swift/Parser.hs
mit
-- <|> try classDeclaration -- <|> try protocolDeclaration -- <|> try initializerDeclaration -- <|> try deinitializeDeclaration -- <|> try extensionDeclaration parameters :: Parser [TypeParam] parameters = option [] (angles $ commaSep1 $ TypeParam <$> identifier) <?> "type parameters"
322
parameters :: Parser [TypeParam] parameters = option [] (angles $ commaSep1 $ TypeParam <$> identifier) <?> "type parameters"
125
parameters = option [] (angles $ commaSep1 $ TypeParam <$> identifier) <?> "type parameters"
92
true
true
0
10
74
48
27
21
null
null
kmate/raw-feldspar
src/Feldspar/Run/Frontend.hs
bsd-3-clause
-- | Put a primitive value to a handle fput :: (Formattable a, PrimType a) => Handle -> String -- Prefix -> Data a -- Expression to print -> String -- Suffix -> Run () fput h pre e post = Run $ Imp.fput h pre e post
238
fput :: (Formattable a, PrimType a) => Handle -> String -- Prefix -> Data a -- Expression to print -> String -- Suffix -> Run () fput h pre e post = Run $ Imp.fput h pre e post
199
fput h pre e post = Run $ Imp.fput h pre e post
47
true
true
0
12
70
79
40
39
null
null
fffej/HS-Poker
LookupPatternMatch.hs
bsd-3-clause
getValueFromProduct 106375 = 2283
33
getValueFromProduct 106375 = 2283
33
getValueFromProduct 106375 = 2283
33
false
false
0
5
3
9
4
5
null
null
spoqa/nirum
src/Nirum/Targets/Python/CodeGen.hs
gpl-3.0
toAttributeName' :: Name -> Text toAttributeName' = toAttributeName . facialName
80
toAttributeName' :: Name -> Text toAttributeName' = toAttributeName . facialName
80
toAttributeName' = toAttributeName . facialName
47
false
true
0
7
9
26
11
15
null
null
diagrams/diagrams-test
misc/Kennedy.hs
bsd-3-clause
fullTree 1 = Node 1 []
22
fullTree 1 = Node 1 []
22
fullTree 1 = Node 1 []
22
false
false
0
6
5
16
7
9
null
null
fgaray/shakespeare
Text/IndentToBrace.hs
mit
nest (Right l:rest) = Nest l 0 (nest inside) : nest outside where (inside, outside) = span isNested rest isNested Left{} = True isNested (Right l2) = lineIndent l2 > lineIndent l
196
nest (Right l:rest) = Nest l 0 (nest inside) : nest outside where (inside, outside) = span isNested rest isNested Left{} = True isNested (Right l2) = lineIndent l2 > lineIndent l
196
nest (Right l:rest) = Nest l 0 (nest inside) : nest outside where (inside, outside) = span isNested rest isNested Left{} = True isNested (Right l2) = lineIndent l2 > lineIndent l
196
false
false
0
8
49
95
45
50
null
null
ghc-android/ghc
testsuite/tests/ghci/should_run/ghcirun004.hs
bsd-3-clause
3822 = 3821
11
3822 = 3821
11
3822 = 3821
11
false
false
1
5
2
10
3
7
null
null
olsner/ghc
compiler/codeGen/StgCmmClosure.hs
bsd-3-clause
closureSingleEntry :: ClosureInfo -> Bool closureSingleEntry (ClosureInfo { closureLFInfo = LFThunk _ _ upd _ _}) = not upd
123
closureSingleEntry :: ClosureInfo -> Bool closureSingleEntry (ClosureInfo { closureLFInfo = LFThunk _ _ upd _ _}) = not upd
123
closureSingleEntry (ClosureInfo { closureLFInfo = LFThunk _ _ upd _ _}) = not upd
81
false
true
0
9
18
48
23
25
null
null
siddhanathan/ghc
testsuite/tests/typecheck/should_fail/tcfail186.hs
bsd-3-clause
foo = f "hoo"
13
foo = f "hoo"
13
foo = f "hoo"
13
false
false
1
5
3
13
4
9
null
null
seereason/cabal
cabal-install/Distribution/Client/InstallPlan.hs
bsd-3-clause
showPackageProblem (MissingFlag (FlagName flag)) = "missing an assignment for the flag: " ++ flag
99
showPackageProblem (MissingFlag (FlagName flag)) = "missing an assignment for the flag: " ++ flag
99
showPackageProblem (MissingFlag (FlagName flag)) = "missing an assignment for the flag: " ++ flag
99
false
false
0
9
15
25
12
13
null
null
ekmett/ghc
compiler/cmm/CmmUtils.hs
bsd-3-clause
cmmLabelOff lbl byte_off = CmmLabelOff lbl byte_off
51
cmmLabelOff lbl byte_off = CmmLabelOff lbl byte_off
51
cmmLabelOff lbl byte_off = CmmLabelOff lbl byte_off
51
false
false
0
5
6
16
7
9
null
null
brendanhay/gogol
gogol-logging/gen/Network/Google/Resource/Logging/Projects/Sinks/Update.hs
mpl-2.0
-- | V1 error format. psuXgafv :: Lens' ProjectsSinksUpdate (Maybe Xgafv) psuXgafv = lens _psuXgafv (\ s a -> s{_psuXgafv = a})
127
psuXgafv :: Lens' ProjectsSinksUpdate (Maybe Xgafv) psuXgafv = lens _psuXgafv (\ s a -> s{_psuXgafv = a})
105
psuXgafv = lens _psuXgafv (\ s a -> s{_psuXgafv = a})
53
true
true
0
9
21
46
25
21
null
null
ekmett/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxSTC_MSSQL_DATATYPE :: Int wxSTC_MSSQL_DATATYPE = 10
53
wxSTC_MSSQL_DATATYPE :: Int wxSTC_MSSQL_DATATYPE = 10
53
wxSTC_MSSQL_DATATYPE = 10
25
false
true
0
6
5
18
7
11
null
null
msakai/folkung
Haskell/Paradox/SolveInstances.hs
mit
{- data Loc = Loc newLoc = undefined addClauses = undefined data Arg = ArgV Int | ArgN Int data Atm = Loc :@ [Arg] getLit = undefined -} ------------------------------------------------------------------------- -- solver solveInstances :: Flags -> [(Symbol,Bool)] -> Int -> [(Int,Bool,Symbol,[ClauseSet])] -> IO (Answer,Int) solveInstances flags predsPure minSize css = do ref <- newIORef (M.empty,M.empty) let getFunLoc f = do (tabf,tabp) <- lift $ readIORef ref case M.lookup f tabf of Nothing -> do loc <- newLoc (arity f+1) lift $ writeIORef ref (M.insert f loc tabf,tabp) return loc Just loc -> do return loc getPredLoc p = do (tabf,tabp) <- lift $ readIORef ref case M.lookup p tabp of Nothing -> do loc <- newLoc (arity p) lift $ writeIORef ref (tabf,M.insert p loc tabp) return loc Just loc -> do return loc processClauseSet k (ForAll cs) = do sequence_ [ processClause Nothing k c | c <- cs ] processClauseSet k (ForAllNew k' cs) = do sequence_ [ processClause (Just k') k c | c <- cs ] processClause mn k c = do ls' <- mapM processLit ls let args = [ isize t | v <- vs, let V t = typing v ] {- lift $ putStr {- printStderr -} $ (++ "\n") $ unwords $ [ "==>" ] ++ [ show n | Just n <- [mn] ] ++ [ show (vs `zip` args) , "[" ] ++ (intersperse "|" [ show l | l <- c ]) ++ [ "]" ] -} addClauses mn args ls' where ls = c vs = S.toList (free c) isize t = case tdomain t of Just n -> n `min` k Nothing -> k processLit l = do a <- processAtom (the l) return (fmap (const a) l) processAtom (Fun f xs :=: y) | y /= truth && not (isElt f) = do loc <- getFunLoc f if arity f /= length xs then error ("arity fel! " ++ show (f,typing f)) else return () return (loc :@ (xs' ++ [y'])) where xs' = map processTerm xs y' = processTerm y processAtom (Fun p xs :=: b) | b == truth = do loc <- getPredLoc p return (loc :@ xs') where xs' = map processTerm xs processAtom (a :=: b) = do loc <- getPredLoc (eq ::: ([top,top] :-> bool)) return (loc :@ (map processTerm [a,b])) processTerm (Var v) = ArgV (v `ind` vs) processTerm (Fun (c ::: _) []) | isEltName c = ArgN (getIndex c) x `ind` (y:ys) | x == y = 1 | otherwise = 1 + (x `ind` ys) domains minSize [] = do return (GaveUp,minSize) domains minSize ((k,check,assump,clauses):rest) = do lift $ putStrLn ("domain size " ++ show k) --lift $ sequence_ [ putStrLn s | c <- clauses, s <- showClauseSet c ] let clauses' = flat clauses flat [] = [] flat (ForAll cs : ds) = map (\c -> ForAll [c]) cs ++ flat ds flat (ForAllNew k' cs : ds) = map (\c -> ForAllNew k' [c]) cs ++ flat ds tot = length clauses' sequence_ [ do --lift $ print c processClauseSet k c | (i,c) <- [1..] `zip` clauses' ] assumption <- getPredLoc assump >>= \l -> return (Pos (l :@ [])) ass <- getLit assumption --simplify True False r <- if minSize > k then return False else solve [ass] if r then do if printModel flags then printTheModel flags k ref predsPure else return () return (Satisfiable,k) else do c <- okay if not c then do return (Unsatisfiable,k) else do addClause [-ass] let minSize' | k == minSize = k+1 | otherwise = minSize domains minSize' rest run $ do --Sat.verbose 1 domains minSize css
5,029
solveInstances :: Flags -> [(Symbol,Bool)] -> Int -> [(Int,Bool,Symbol,[ClauseSet])] -> IO (Answer,Int) solveInstances flags predsPure minSize css = do ref <- newIORef (M.empty,M.empty) let getFunLoc f = do (tabf,tabp) <- lift $ readIORef ref case M.lookup f tabf of Nothing -> do loc <- newLoc (arity f+1) lift $ writeIORef ref (M.insert f loc tabf,tabp) return loc Just loc -> do return loc getPredLoc p = do (tabf,tabp) <- lift $ readIORef ref case M.lookup p tabp of Nothing -> do loc <- newLoc (arity p) lift $ writeIORef ref (tabf,M.insert p loc tabp) return loc Just loc -> do return loc processClauseSet k (ForAll cs) = do sequence_ [ processClause Nothing k c | c <- cs ] processClauseSet k (ForAllNew k' cs) = do sequence_ [ processClause (Just k') k c | c <- cs ] processClause mn k c = do ls' <- mapM processLit ls let args = [ isize t | v <- vs, let V t = typing v ] {- lift $ putStr {- printStderr -} $ (++ "\n") $ unwords $ [ "==>" ] ++ [ show n | Just n <- [mn] ] ++ [ show (vs `zip` args) , "[" ] ++ (intersperse "|" [ show l | l <- c ]) ++ [ "]" ] -} addClauses mn args ls' where ls = c vs = S.toList (free c) isize t = case tdomain t of Just n -> n `min` k Nothing -> k processLit l = do a <- processAtom (the l) return (fmap (const a) l) processAtom (Fun f xs :=: y) | y /= truth && not (isElt f) = do loc <- getFunLoc f if arity f /= length xs then error ("arity fel! " ++ show (f,typing f)) else return () return (loc :@ (xs' ++ [y'])) where xs' = map processTerm xs y' = processTerm y processAtom (Fun p xs :=: b) | b == truth = do loc <- getPredLoc p return (loc :@ xs') where xs' = map processTerm xs processAtom (a :=: b) = do loc <- getPredLoc (eq ::: ([top,top] :-> bool)) return (loc :@ (map processTerm [a,b])) processTerm (Var v) = ArgV (v `ind` vs) processTerm (Fun (c ::: _) []) | isEltName c = ArgN (getIndex c) x `ind` (y:ys) | x == y = 1 | otherwise = 1 + (x `ind` ys) domains minSize [] = do return (GaveUp,minSize) domains minSize ((k,check,assump,clauses):rest) = do lift $ putStrLn ("domain size " ++ show k) --lift $ sequence_ [ putStrLn s | c <- clauses, s <- showClauseSet c ] let clauses' = flat clauses flat [] = [] flat (ForAll cs : ds) = map (\c -> ForAll [c]) cs ++ flat ds flat (ForAllNew k' cs : ds) = map (\c -> ForAllNew k' [c]) cs ++ flat ds tot = length clauses' sequence_ [ do --lift $ print c processClauseSet k c | (i,c) <- [1..] `zip` clauses' ] assumption <- getPredLoc assump >>= \l -> return (Pos (l :@ [])) ass <- getLit assumption --simplify True False r <- if minSize > k then return False else solve [ass] if r then do if printModel flags then printTheModel flags k ref predsPure else return () return (Satisfiable,k) else do c <- okay if not c then do return (Unsatisfiable,k) else do addClause [-ass] let minSize' | k == minSize = k+1 | otherwise = minSize domains minSize' rest run $ do --Sat.verbose 1 domains minSize css
4,801
solveInstances flags predsPure minSize css = do ref <- newIORef (M.empty,M.empty) let getFunLoc f = do (tabf,tabp) <- lift $ readIORef ref case M.lookup f tabf of Nothing -> do loc <- newLoc (arity f+1) lift $ writeIORef ref (M.insert f loc tabf,tabp) return loc Just loc -> do return loc getPredLoc p = do (tabf,tabp) <- lift $ readIORef ref case M.lookup p tabp of Nothing -> do loc <- newLoc (arity p) lift $ writeIORef ref (tabf,M.insert p loc tabp) return loc Just loc -> do return loc processClauseSet k (ForAll cs) = do sequence_ [ processClause Nothing k c | c <- cs ] processClauseSet k (ForAllNew k' cs) = do sequence_ [ processClause (Just k') k c | c <- cs ] processClause mn k c = do ls' <- mapM processLit ls let args = [ isize t | v <- vs, let V t = typing v ] {- lift $ putStr {- printStderr -} $ (++ "\n") $ unwords $ [ "==>" ] ++ [ show n | Just n <- [mn] ] ++ [ show (vs `zip` args) , "[" ] ++ (intersperse "|" [ show l | l <- c ]) ++ [ "]" ] -} addClauses mn args ls' where ls = c vs = S.toList (free c) isize t = case tdomain t of Just n -> n `min` k Nothing -> k processLit l = do a <- processAtom (the l) return (fmap (const a) l) processAtom (Fun f xs :=: y) | y /= truth && not (isElt f) = do loc <- getFunLoc f if arity f /= length xs then error ("arity fel! " ++ show (f,typing f)) else return () return (loc :@ (xs' ++ [y'])) where xs' = map processTerm xs y' = processTerm y processAtom (Fun p xs :=: b) | b == truth = do loc <- getPredLoc p return (loc :@ xs') where xs' = map processTerm xs processAtom (a :=: b) = do loc <- getPredLoc (eq ::: ([top,top] :-> bool)) return (loc :@ (map processTerm [a,b])) processTerm (Var v) = ArgV (v `ind` vs) processTerm (Fun (c ::: _) []) | isEltName c = ArgN (getIndex c) x `ind` (y:ys) | x == y = 1 | otherwise = 1 + (x `ind` ys) domains minSize [] = do return (GaveUp,minSize) domains minSize ((k,check,assump,clauses):rest) = do lift $ putStrLn ("domain size " ++ show k) --lift $ sequence_ [ putStrLn s | c <- clauses, s <- showClauseSet c ] let clauses' = flat clauses flat [] = [] flat (ForAll cs : ds) = map (\c -> ForAll [c]) cs ++ flat ds flat (ForAllNew k' cs : ds) = map (\c -> ForAllNew k' [c]) cs ++ flat ds tot = length clauses' sequence_ [ do --lift $ print c processClauseSet k c | (i,c) <- [1..] `zip` clauses' ] assumption <- getPredLoc assump >>= \l -> return (Pos (l :@ [])) ass <- getLit assumption --simplify True False r <- if minSize > k then return False else solve [ass] if r then do if printModel flags then printTheModel flags k ref predsPure else return () return (Satisfiable,k) else do c <- okay if not c then do return (Unsatisfiable,k) else do addClause [-ass] let minSize' | k == minSize = k+1 | otherwise = minSize domains minSize' rest run $ do --Sat.verbose 1 domains minSize css
4,697
true
true
0
24
2,533
1,461
712
749
null
null
tolysz/prepare-ghcjs
spec-lts8/base/GHC/Conc/Sync.hs
bsd-3-clause
readTVarIO :: TVar a -> IO a readTVarIO (TVar tvar#) = IO $ \s# -> readTVarIO# tvar# s#
87
readTVarIO :: TVar a -> IO a readTVarIO (TVar tvar#) = IO $ \s# -> readTVarIO# tvar# s#
87
readTVarIO (TVar tvar#) = IO $ \s# -> readTVarIO# tvar# s#
58
false
true
0
7
17
44
21
23
null
null
bgold-cosmos/Tidal
src/Sound/Tidal/Core.hs
gpl-3.0
in118 :: Pattern Double in118 = cF 0 "118"
42
in118 :: Pattern Double in118 = cF 0 "118"
42
in118 = cF 0 "118"
18
false
true
0
6
8
26
10
16
null
null
ulricha/dsh
src/Database/DSH/CL/Opt/PartialEval.hs
bsd-3-clause
-------------------------------------------------------------------------------- -- Partial evaluation rules -- | Eliminate tuple construction if the elements are first and second of the -- same pair: -- pair (fst x) (snd x) => x identityPairR :: RewriteC CL identityPairR = do MkTuple _ [ AppE1 _ (TupElem First) v@(Var tupleTy x) , AppE1 _ (TupElem (Next First)) (Var _ x') ] <- promoteT idR -- Check that the original value actually was a /pair/ and that no -- elements are discarded. TupleT [_, _] <- return tupleTy guardM $ x == x' return $ inject v
610
identityPairR :: RewriteC CL identityPairR = do MkTuple _ [ AppE1 _ (TupElem First) v@(Var tupleTy x) , AppE1 _ (TupElem (Next First)) (Var _ x') ] <- promoteT idR -- Check that the original value actually was a /pair/ and that no -- elements are discarded. TupleT [_, _] <- return tupleTy guardM $ x == x' return $ inject v
379
identityPairR = do MkTuple _ [ AppE1 _ (TupElem First) v@(Var tupleTy x) , AppE1 _ (TupElem (Next First)) (Var _ x') ] <- promoteT idR -- Check that the original value actually was a /pair/ and that no -- elements are discarded. TupleT [_, _] <- return tupleTy guardM $ x == x' return $ inject v
350
true
true
0
14
147
133
67
66
null
null
ben-schulz/Idris-dev
src/IRTS/CodegenJavaScript.hs
bsd-3-clause
translateConstant (Str s) = JSString $ concatMap translateChar s
81
translateConstant (Str s) = JSString $ concatMap translateChar s
81
translateConstant (Str s) = JSString $ concatMap translateChar s
81
false
false
0
7
25
24
11
13
null
null
Proclivis/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxAUI_DOCKART_BACKGROUND_COLOUR :: Int wxAUI_DOCKART_BACKGROUND_COLOUR = 5
74
wxAUI_DOCKART_BACKGROUND_COLOUR :: Int wxAUI_DOCKART_BACKGROUND_COLOUR = 5
74
wxAUI_DOCKART_BACKGROUND_COLOUR = 5
35
false
true
0
4
5
11
6
5
null
null
sordina/Deadpan-DDP
src/Data/EJson.hs
mit
isEJUser _ = False
33
isEJUser _ = False
33
isEJUser _ = False
33
false
false
0
5
18
9
4
5
null
null
Altech/haScm
src/Scheme/Internal/Environment.hs
gpl-3.0
showBindings :: Env -> IO String showBindings envRef = do bindings <- readFrames envRef >>= mapM (mapM (\(sym,cell) -> readIORef cell >>= (\val -> return (Symbol sym,val)))) return $ "[\n" ++ showBindings (reverse bindings) ++ "]" where showBindings bindings = case bindings of (frame:[]) -> showFrame frame ++ "\n" (frame:frames) -> showFrame frame ++ ",\n" ++ showBindings frames [] -> "" showFrame frame = " " ++ show frame
472
showBindings :: Env -> IO String showBindings envRef = do bindings <- readFrames envRef >>= mapM (mapM (\(sym,cell) -> readIORef cell >>= (\val -> return (Symbol sym,val)))) return $ "[\n" ++ showBindings (reverse bindings) ++ "]" where showBindings bindings = case bindings of (frame:[]) -> showFrame frame ++ "\n" (frame:frames) -> showFrame frame ++ ",\n" ++ showBindings frames [] -> "" showFrame frame = " " ++ show frame
472
showBindings envRef = do bindings <- readFrames envRef >>= mapM (mapM (\(sym,cell) -> readIORef cell >>= (\val -> return (Symbol sym,val)))) return $ "[\n" ++ showBindings (reverse bindings) ++ "]" where showBindings bindings = case bindings of (frame:[]) -> showFrame frame ++ "\n" (frame:frames) -> showFrame frame ++ ",\n" ++ showBindings frames [] -> "" showFrame frame = " " ++ show frame
439
false
true
2
19
114
184
92
92
null
null
gaetjen/FunFreakyPatMan
src/HasseTree.hs
mit
-- removes the infrequent item sets from the Hasse Tree removeInfrequent :: Int -> HasseTree -> Int -> HasseTree removeInfrequent _ [] _ = []
141
removeInfrequent :: Int -> HasseTree -> Int -> HasseTree removeInfrequent _ [] _ = []
85
removeInfrequent _ [] _ = []
28
true
true
0
7
24
35
18
17
null
null
Frefreak/hnem
src/UI.hs
bsd-3-clause
updateTime :: St -> EventM n (Next St) updateTime st = case st ^. stmplayer of Nothing -> error "this should not happen!!!" Just mp -> do t <- liftIO $ ( \a b -> do tp <- a tl <- b return (tp, tl) ) <$> getTimePosition mp <*> getTimeLength mp case t of Nothing -> continue st Just (tp', tl') -> do let flag | tp' / tl' > 0.9 = if st ^. stnextsongappended then 0 -- do nothing else 1 -- append song | st ^. stnextsongappended = 2 -- appended song playing -- clear it | otherwise = 0 -- do nothing case flag of 0 -> continue $ st & sttimeline .~ (tp', tl') 1 -> do let n = st ^. stcurrentSongNumber if n < Prelude.length (st ^. stlog . currentPlayingList) - 1 then do uri <- liftIO $ evalStateT (getMusicUrl (n+1) _currentPlayingList) (st ^. stlog) let newTuple = (takeFileName uri, unpack . fst $ (st^.stlog.currentPlayingList) !! (n+1)) exeMplayer (appendMusic uri) $ st & stisplaying .~ True & stflag .~ True & stfilenameMap .~ [newTuple, Prelude.head $ st^.stfilenameMap] & stcurrentSongNumber .~ (n + 1) & sttimeline .~ (tp', tl') & stnextsongappended .~ True else continue $ st & sttimeline .~ (tp', tl') & stnextsongappended .~ True 2 -> continue $ st & sttimeline .~ (tp', tl') & stnextsongappended .~ False
2,310
updateTime :: St -> EventM n (Next St) updateTime st = case st ^. stmplayer of Nothing -> error "this should not happen!!!" Just mp -> do t <- liftIO $ ( \a b -> do tp <- a tl <- b return (tp, tl) ) <$> getTimePosition mp <*> getTimeLength mp case t of Nothing -> continue st Just (tp', tl') -> do let flag | tp' / tl' > 0.9 = if st ^. stnextsongappended then 0 -- do nothing else 1 -- append song | st ^. stnextsongappended = 2 -- appended song playing -- clear it | otherwise = 0 -- do nothing case flag of 0 -> continue $ st & sttimeline .~ (tp', tl') 1 -> do let n = st ^. stcurrentSongNumber if n < Prelude.length (st ^. stlog . currentPlayingList) - 1 then do uri <- liftIO $ evalStateT (getMusicUrl (n+1) _currentPlayingList) (st ^. stlog) let newTuple = (takeFileName uri, unpack . fst $ (st^.stlog.currentPlayingList) !! (n+1)) exeMplayer (appendMusic uri) $ st & stisplaying .~ True & stflag .~ True & stfilenameMap .~ [newTuple, Prelude.head $ st^.stfilenameMap] & stcurrentSongNumber .~ (n + 1) & sttimeline .~ (tp', tl') & stnextsongappended .~ True else continue $ st & sttimeline .~ (tp', tl') & stnextsongappended .~ True 2 -> continue $ st & sttimeline .~ (tp', tl') & stnextsongappended .~ False
2,310
updateTime st = case st ^. stmplayer of Nothing -> error "this should not happen!!!" Just mp -> do t <- liftIO $ ( \a b -> do tp <- a tl <- b return (tp, tl) ) <$> getTimePosition mp <*> getTimeLength mp case t of Nothing -> continue st Just (tp', tl') -> do let flag | tp' / tl' > 0.9 = if st ^. stnextsongappended then 0 -- do nothing else 1 -- append song | st ^. stnextsongappended = 2 -- appended song playing -- clear it | otherwise = 0 -- do nothing case flag of 0 -> continue $ st & sttimeline .~ (tp', tl') 1 -> do let n = st ^. stcurrentSongNumber if n < Prelude.length (st ^. stlog . currentPlayingList) - 1 then do uri <- liftIO $ evalStateT (getMusicUrl (n+1) _currentPlayingList) (st ^. stlog) let newTuple = (takeFileName uri, unpack . fst $ (st^.stlog.currentPlayingList) !! (n+1)) exeMplayer (appendMusic uri) $ st & stisplaying .~ True & stflag .~ True & stfilenameMap .~ [newTuple, Prelude.head $ st^.stfilenameMap] & stcurrentSongNumber .~ (n + 1) & sttimeline .~ (tp', tl') & stnextsongappended .~ True else continue $ st & sttimeline .~ (tp', tl') & stnextsongappended .~ True 2 -> continue $ st & sttimeline .~ (tp', tl') & stnextsongappended .~ False
2,271
false
true
3
35
1,323
534
267
267
null
null
Teaspot-Studio/Urho3D-Haskell
src/Graphics/Urho3D/Graphics/Camera.hs
mit
cameraGetFov :: (Parent Camera a, Pointer p a, MonadIO m) => p -- ^ Camera pointer or child -> m Float cameraGetFov p = liftIO $ do let ptr = parentPointer p realToFrac <$> [C.exp| float {$(Camera* ptr)->GetFov()} |] -- | Return orthographic mode size. -- float GetOrthoSize() const { return orthoSize_; }
312
cameraGetFov :: (Parent Camera a, Pointer p a, MonadIO m) => p -- ^ Camera pointer or child -> m Float cameraGetFov p = liftIO $ do let ptr = parentPointer p realToFrac <$> [C.exp| float {$(Camera* ptr)->GetFov()} |] -- | Return orthographic mode size. -- float GetOrthoSize() const { return orthoSize_; }
312
cameraGetFov p = liftIO $ do let ptr = parentPointer p realToFrac <$> [C.exp| float {$(Camera* ptr)->GetFov()} |] -- | Return orthographic mode size. -- float GetOrthoSize() const { return orthoSize_; }
207
false
true
2
10
59
84
42
42
null
null
ComputationWithBoundedResources/ara-inference
doc/tpdb_trs/Haskell/basic_haskell/enumFromThen_3.hs
mit
numericEnumFromThenToP1 xu xv xw MyTrue = flip ltEsMyInt xu
59
numericEnumFromThenToP1 xu xv xw MyTrue = flip ltEsMyInt xu
59
numericEnumFromThenToP1 xu xv xw MyTrue = flip ltEsMyInt xu
59
false
false
0
5
8
20
9
11
null
null
cryptica/slapnet
src/Printer/SARA.hs
gpl-3.0
renderTerm :: Term Place -> Builder renderTerm (t :+: u) = renderTerm t <> "+" <> renderSimpleTerm 1 u
102
renderTerm :: Term Place -> Builder renderTerm (t :+: u) = renderTerm t <> "+" <> renderSimpleTerm 1 u
102
renderTerm (t :+: u) = renderTerm t <> "+" <> renderSimpleTerm 1 u
66
false
true
0
7
18
44
21
23
null
null
jstolarek/ghc
compiler/cmm/PprC.hs
bsd-3-clause
floatComparison (MO_F_Le _) = True
36
floatComparison (MO_F_Le _) = True
36
floatComparison (MO_F_Le _) = True
36
false
false
0
6
6
16
7
9
null
null
kawu/ltag
src/NLP/LTAG/Earley5.hs
bsd-2-clause
compile :: (View n, View t, Ord i, Ord f, Ord a) => R.Rule n t i f a -> Rule n t ID f a compile R.Rule{..} = unJust $ do ((x, xs), J.Res{..}) <- FT.runCon $ (,) <$> conLab headR <*> mapM conLab bodyR return $ Rule (mapID convID x) (map (mapID convID) xs) resGraph where conLab R.NonT{..} = NonT nonTerm labID <$> FT.fromFN rootTopFS <*> FT.fromFN rootBotFS conLab (R.Term x) = return $ Term x conLab R.AuxRoot{..} = AuxRoot nonTerm <$> FT.fromFN rootTopFS <*> FT.fromFN rootBotFS <*> FT.fromFN footTopFS <*> FT.fromFN footBotFS conLab (R.AuxFoot x) = return $ AuxFoot x conLab R.AuxVert{..} = AuxVert nonTerm symID <$> FT.fromFN rootTopFS <*> FT.fromFN rootBotFS -- | Print the state.
828
compile :: (View n, View t, Ord i, Ord f, Ord a) => R.Rule n t i f a -> Rule n t ID f a compile R.Rule{..} = unJust $ do ((x, xs), J.Res{..}) <- FT.runCon $ (,) <$> conLab headR <*> mapM conLab bodyR return $ Rule (mapID convID x) (map (mapID convID) xs) resGraph where conLab R.NonT{..} = NonT nonTerm labID <$> FT.fromFN rootTopFS <*> FT.fromFN rootBotFS conLab (R.Term x) = return $ Term x conLab R.AuxRoot{..} = AuxRoot nonTerm <$> FT.fromFN rootTopFS <*> FT.fromFN rootBotFS <*> FT.fromFN footTopFS <*> FT.fromFN footBotFS conLab (R.AuxFoot x) = return $ AuxFoot x conLab R.AuxVert{..} = AuxVert nonTerm symID <$> FT.fromFN rootTopFS <*> FT.fromFN rootBotFS -- | Print the state.
828
compile R.Rule{..} = unJust $ do ((x, xs), J.Res{..}) <- FT.runCon $ (,) <$> conLab headR <*> mapM conLab bodyR return $ Rule (mapID convID x) (map (mapID convID) xs) resGraph where conLab R.NonT{..} = NonT nonTerm labID <$> FT.fromFN rootTopFS <*> FT.fromFN rootBotFS conLab (R.Term x) = return $ Term x conLab R.AuxRoot{..} = AuxRoot nonTerm <$> FT.fromFN rootTopFS <*> FT.fromFN rootBotFS <*> FT.fromFN footTopFS <*> FT.fromFN footBotFS conLab (R.AuxFoot x) = return $ AuxFoot x conLab R.AuxVert{..} = AuxVert nonTerm symID <$> FT.fromFN rootTopFS <*> FT.fromFN rootBotFS -- | Print the state.
732
false
true
4
17
263
353
172
181
null
null
HIPERFIT/futhark
src/Futhark/IR/Prop/Types.hs
isc
-- | Construct an array whose rows are the given type, and the outer -- size is the given t'Shape'. This is just a convenient wrapper -- around 'arrayOf'. arrayOfShape :: Type -> Shape -> Type arrayOfShape t shape = arrayOf t shape NoUniqueness
245
arrayOfShape :: Type -> Shape -> Type arrayOfShape t shape = arrayOf t shape NoUniqueness
89
arrayOfShape t shape = arrayOf t shape NoUniqueness
51
true
true
0
6
44
34
18
16
null
null
phischu/fragnix
tests/packages/scotty/Data.Aeson.Parser.Internal.hs
bsd-3-clause
object_ :: Parser Value object_ = {-# SCC "object_" #-} Object <$> objectValues jstring value
93
object_ :: Parser Value object_ = {-# SCC "object_" #-} Object <$> objectValues jstring value
93
object_ = {-# SCC "object_" #-} Object <$> objectValues jstring value
69
false
true
1
6
14
27
12
15
null
null
tjakway/ghcjvm
compiler/basicTypes/BasicTypes.hs
bsd-3-clause
isOneOcc :: OccInfo -> Bool isOneOcc (OneOcc {}) = True
55
isOneOcc :: OccInfo -> Bool isOneOcc (OneOcc {}) = True
55
isOneOcc (OneOcc {}) = True
27
false
true
1
8
9
30
14
16
null
null
BartAdv/Idris-dev
src/Idris/IdeMode.hs
bsd-3-clause
sexpToCommand (SexpList [SymbolAtom "show-term-implicits", StringAtom encoded]) = let (bnd, tm) = decodeTerm encoded in Just (TermShowImplicits bnd tm)
249
sexpToCommand (SexpList [SymbolAtom "show-term-implicits", StringAtom encoded]) = let (bnd, tm) = decodeTerm encoded in Just (TermShowImplicits bnd tm)
249
sexpToCommand (SexpList [SymbolAtom "show-term-implicits", StringAtom encoded]) = let (bnd, tm) = decodeTerm encoded in Just (TermShowImplicits bnd tm)
249
false
false
0
9
115
60
28
32
null
null
jimsnow/polink
PolinkState.hs
gpl-2.0
permTest :: Int64 -> Perm -> Bool permTest i p = testBit i (fromEnum p)
71
permTest :: Int64 -> Perm -> Bool permTest i p = testBit i (fromEnum p)
71
permTest i p = testBit i (fromEnum p)
37
false
true
0
8
14
40
18
22
null
null
nwf/trifecta
src/Text/Trifecta/Parser.hs
bsd-3-clause
parseString :: Parser a -> Delta -> String -> Result a parseString p d inp = starve $ feed inp $ stepParser (release d *> p) mempty mempty
138
parseString :: Parser a -> Delta -> String -> Result a parseString p d inp = starve $ feed inp $ stepParser (release d *> p) mempty mempty
138
parseString p d inp = starve $ feed inp $ stepParser (release d *> p) mempty mempty
83
false
true
0
9
27
64
30
34
null
null
Jefffrey/Titim
src/Titim/IO.hs
gpl-3.0
gameStep :: Game -> IO Game gameStep game = do clearScreen print game askLabel "Give me a word: " word <- askWord game updateGame . hitGame word $ game -- Repeats the steps until the game is in a game over -- status.
237
gameStep :: Game -> IO Game gameStep game = do clearScreen print game askLabel "Give me a word: " word <- askWord game updateGame . hitGame word $ game -- Repeats the steps until the game is in a game over -- status.
237
gameStep game = do clearScreen print game askLabel "Give me a word: " word <- askWord game updateGame . hitGame word $ game -- Repeats the steps until the game is in a game over -- status.
209
false
true
0
9
63
62
27
35
null
null
bokesan/skred
tools/CombGen.hs
mit
genBinOpInt :: String -> String -> Bool -> IO () genBinOpInt name op rev = do h <- openFile fileName WriteMode hPutStrLn h "package de.bokeh.skred.red;\n" hPutStrLn h "/**" hPutStrLn h (" * Int " ++ name) hPutStrLn h " */" hPutStrLn h ("class " ++ className ++ " extends Function {\n") hPutStrLn h (" public " ++ className ++ "() {") hPutStrLn h (" super(\"" ++ name ++ "\", 2);") hPutStrLn h " }\n\n\ \ @Override\n\ \ Node exec(RedContext c) {\n\ \ c.rearrange2();\n\ \ c.eval();\n\ \ c.swap();\n\ \ c.eval();\n\ \ Node a2 = c.getTos();\n\ \ Node a1 = c.get1();\n\ \ int n1 = a1.intValue();\n\ \ int n2 = a2.intValue();" hPutStrLn h (if rev then " int r = n2 " ++ op ++ " n1;" else " int r = n1 " ++ op ++ " n2;") hPutStrLn h " Node result = Int.valueOf(r);\n\ \ c.pop2();\n\ \ c.getTos().overwriteInd(result);\n\ \ c.setTos(result);\n\ \ return result;\n\ \ }\n\n\ \}" hClose h where className = "Prim" ++ initCap name ++ "Int" fileName = className ++ ".java"
1,945
genBinOpInt :: String -> String -> Bool -> IO () genBinOpInt name op rev = do h <- openFile fileName WriteMode hPutStrLn h "package de.bokeh.skred.red;\n" hPutStrLn h "/**" hPutStrLn h (" * Int " ++ name) hPutStrLn h " */" hPutStrLn h ("class " ++ className ++ " extends Function {\n") hPutStrLn h (" public " ++ className ++ "() {") hPutStrLn h (" super(\"" ++ name ++ "\", 2);") hPutStrLn h " }\n\n\ \ @Override\n\ \ Node exec(RedContext c) {\n\ \ c.rearrange2();\n\ \ c.eval();\n\ \ c.swap();\n\ \ c.eval();\n\ \ Node a2 = c.getTos();\n\ \ Node a1 = c.get1();\n\ \ int n1 = a1.intValue();\n\ \ int n2 = a2.intValue();" hPutStrLn h (if rev then " int r = n2 " ++ op ++ " n1;" else " int r = n1 " ++ op ++ " n2;") hPutStrLn h " Node result = Int.valueOf(r);\n\ \ c.pop2();\n\ \ c.getTos().overwriteInd(result);\n\ \ c.setTos(result);\n\ \ return result;\n\ \ }\n\n\ \}" hClose h where className = "Prim" ++ initCap name ++ "Int" fileName = className ++ ".java"
1,945
genBinOpInt name op rev = do h <- openFile fileName WriteMode hPutStrLn h "package de.bokeh.skred.red;\n" hPutStrLn h "/**" hPutStrLn h (" * Int " ++ name) hPutStrLn h " */" hPutStrLn h ("class " ++ className ++ " extends Function {\n") hPutStrLn h (" public " ++ className ++ "() {") hPutStrLn h (" super(\"" ++ name ++ "\", 2);") hPutStrLn h " }\n\n\ \ @Override\n\ \ Node exec(RedContext c) {\n\ \ c.rearrange2();\n\ \ c.eval();\n\ \ c.swap();\n\ \ c.eval();\n\ \ Node a2 = c.getTos();\n\ \ Node a1 = c.get1();\n\ \ int n1 = a1.intValue();\n\ \ int n2 = a2.intValue();" hPutStrLn h (if rev then " int r = n2 " ++ op ++ " n1;" else " int r = n1 " ++ op ++ " n2;") hPutStrLn h " Node result = Int.valueOf(r);\n\ \ c.pop2();\n\ \ c.getTos().overwriteInd(result);\n\ \ c.setTos(result);\n\ \ return result;\n\ \ }\n\n\ \}" hClose h where className = "Prim" ++ initCap name ++ "Int" fileName = className ++ ".java"
1,896
false
true
8
11
1,155
242
106
136
null
null
notcome/indescript
src/Language/Indescript/Parser/Lexer.hs
bsd-3-clause
tBlockComment = string "{-"
27
tBlockComment = string "{-"
27
tBlockComment = string "{-"
27
false
false
0
5
3
9
4
5
null
null
liamoc/tea-hs
Tea/Input.hs
bsd-3-clause
sdlKey SDL.SDLK_DELETE = KeyDelete
40
sdlKey SDL.SDLK_DELETE = KeyDelete
40
sdlKey SDL.SDLK_DELETE = KeyDelete
40
false
false
0
6
9
11
5
6
null
null
amccausl/Swish
Swish/HaskellRDF/RDFRuleset.hs
lgpl-2.1
makeN3ClosureAllocatorRule :: Namespace -> String -> String -> String -> RDFVarBindingModify -> ( [RDFLabel] -> RDFVarBindingModify ) -> RDFRule makeN3ClosureAllocatorRule scope local ant con vflt aloc = makeRDFClosureRule (ScopedName scope local) [antgr] congr modc where antgr = makeRDFGraphFromN3String ant congr = makeRDFGraphFromN3String con vmod = aloc (allLabels labelIsVar antgr) modc = case vbmCompose vmod vflt of Just x -> x Nothing -> varBindingId ------------------------------------------------------------ -- Query binding modifier for "allocated to" logic ------------------------------------------------------------ -- |This function defines a variable binding mofifier that -- allocates a new blank node for each value bound to -- a query variable, and binds it to another variable -- in each query binding. -- -- This provides a single binding for query variables that would -- otherwise be unbound by a query. For example, consider the -- inference pattern: -- ?a hasUncle ?c => ?a hasFather ?b . ?b hasBrother ?c . -- For a given ?a and ?c, there is insufficient information -- here to instantiate a value for variable ?b. Using this -- function as part of a graph instance closure rule allows -- forward chaining to allocate a single bnode for each -- occurrence of ?a, so that given: -- Jimmy hasUncle Fred . -- Jimmy hasUncle Bob . -- leads to exactly one bnode inference of: -- Jimmy hasFather _:f . -- giving: -- Jimmy hasFather _:f . -- _:f hasBrother Fred . -- _:f hasBrother Bob . -- rather than: -- Jimmy hasFather _:f1 . -- _:f1 hasBrother Fred . -- Jimmy hasFather _:f2 . -- _:f2 hasBrother Bob . -- -- This form of constrained allocation of bnodes is also required for -- some of the inference patterns described by the RDF formal semantics, -- particularly those where bnodes are substituted for URIs or literals. -- -- bindvar is a variable node to which a new blank node is bound -- alocvar is a variable which is bound in each query to a graph -- node to which new blank nodes are allocated. --
2,236
makeN3ClosureAllocatorRule :: Namespace -> String -> String -> String -> RDFVarBindingModify -> ( [RDFLabel] -> RDFVarBindingModify ) -> RDFRule makeN3ClosureAllocatorRule scope local ant con vflt aloc = makeRDFClosureRule (ScopedName scope local) [antgr] congr modc where antgr = makeRDFGraphFromN3String ant congr = makeRDFGraphFromN3String con vmod = aloc (allLabels labelIsVar antgr) modc = case vbmCompose vmod vflt of Just x -> x Nothing -> varBindingId ------------------------------------------------------------ -- Query binding modifier for "allocated to" logic ------------------------------------------------------------ -- |This function defines a variable binding mofifier that -- allocates a new blank node for each value bound to -- a query variable, and binds it to another variable -- in each query binding. -- -- This provides a single binding for query variables that would -- otherwise be unbound by a query. For example, consider the -- inference pattern: -- ?a hasUncle ?c => ?a hasFather ?b . ?b hasBrother ?c . -- For a given ?a and ?c, there is insufficient information -- here to instantiate a value for variable ?b. Using this -- function as part of a graph instance closure rule allows -- forward chaining to allocate a single bnode for each -- occurrence of ?a, so that given: -- Jimmy hasUncle Fred . -- Jimmy hasUncle Bob . -- leads to exactly one bnode inference of: -- Jimmy hasFather _:f . -- giving: -- Jimmy hasFather _:f . -- _:f hasBrother Fred . -- _:f hasBrother Bob . -- rather than: -- Jimmy hasFather _:f1 . -- _:f1 hasBrother Fred . -- Jimmy hasFather _:f2 . -- _:f2 hasBrother Bob . -- -- This form of constrained allocation of bnodes is also required for -- some of the inference patterns described by the RDF formal semantics, -- particularly those where bnodes are substituted for URIs or literals. -- -- bindvar is a variable node to which a new blank node is bound -- alocvar is a variable which is bound in each query to a graph -- node to which new blank nodes are allocated. --
2,235
makeN3ClosureAllocatorRule scope local ant con vflt aloc = makeRDFClosureRule (ScopedName scope local) [antgr] congr modc where antgr = makeRDFGraphFromN3String ant congr = makeRDFGraphFromN3String con vmod = aloc (allLabels labelIsVar antgr) modc = case vbmCompose vmod vflt of Just x -> x Nothing -> varBindingId ------------------------------------------------------------ -- Query binding modifier for "allocated to" logic ------------------------------------------------------------ -- |This function defines a variable binding mofifier that -- allocates a new blank node for each value bound to -- a query variable, and binds it to another variable -- in each query binding. -- -- This provides a single binding for query variables that would -- otherwise be unbound by a query. For example, consider the -- inference pattern: -- ?a hasUncle ?c => ?a hasFather ?b . ?b hasBrother ?c . -- For a given ?a and ?c, there is insufficient information -- here to instantiate a value for variable ?b. Using this -- function as part of a graph instance closure rule allows -- forward chaining to allocate a single bnode for each -- occurrence of ?a, so that given: -- Jimmy hasUncle Fred . -- Jimmy hasUncle Bob . -- leads to exactly one bnode inference of: -- Jimmy hasFather _:f . -- giving: -- Jimmy hasFather _:f . -- _:f hasBrother Fred . -- _:f hasBrother Bob . -- rather than: -- Jimmy hasFather _:f1 . -- _:f1 hasBrother Fred . -- Jimmy hasFather _:f2 . -- _:f2 hasBrother Bob . -- -- This form of constrained allocation of bnodes is also required for -- some of the inference patterns described by the RDF formal semantics, -- particularly those where bnodes are substituted for URIs or literals. -- -- bindvar is a variable node to which a new blank node is bound -- alocvar is a variable which is bound in each query to a graph -- node to which new blank nodes are allocated. --
2,070
false
true
0
14
539
183
110
73
null
null
ryanfan/courseography
dependencies/HaXml-1.25.3/src/Text/XML/HaXml/Schema/Schema.hs
gpl-3.0
-- | Given a TextParser for a SimpleType, make it into an XMLParser, i.e. -- consuming textual XML content as input rather than a String. parseSimpleType :: SimpleType t => XMLParser t parseSimpleType = do s <- text case runParser acceptingParser s of (Left err, _) -> fail err (Right v, "") -> return v (Right v, _) -> return v -- ignore trailing text -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | Between is a list parser that tries to ensure that any range -- specification (min and max elements) is obeyed when parsing.
657
parseSimpleType :: SimpleType t => XMLParser t parseSimpleType = do s <- text case runParser acceptingParser s of (Left err, _) -> fail err (Right v, "") -> return v (Right v, _) -> return v -- ignore trailing text -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | Between is a list parser that tries to ensure that any range -- specification (min and max elements) is obeyed when parsing.
517
parseSimpleType = do s <- text case runParser acceptingParser s of (Left err, _) -> fail err (Right v, "") -> return v (Right v, _) -> return v -- ignore trailing text -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | Between is a list parser that tries to ensure that any range -- specification (min and max elements) is obeyed when parsing.
470
true
true
0
12
211
106
52
54
null
null
AlexanderPankiv/ghc
ghc/Main.hs
bsd-3-clause
isDoEvalMode :: Mode -> Bool isDoEvalMode (Right (Right (DoEval _))) = True
75
isDoEvalMode :: Mode -> Bool isDoEvalMode (Right (Right (DoEval _))) = True
75
isDoEvalMode (Right (Right (DoEval _))) = True
46
false
true
0
10
11
40
19
21
null
null
blanu/Dust-tools
Dust/Services/File/upload-client.hs
gpl-2.0
main :: IO() main = do args <- getArgs case args of (host:filepath:_) -> upload host filepath otherwise -> do putStrLn "Usage: upload <host> <filepath>" putStrLn "Example: upload 74.125.227.196 report.txt"
259
main :: IO() main = do args <- getArgs case args of (host:filepath:_) -> upload host filepath otherwise -> do putStrLn "Usage: upload <host> <filepath>" putStrLn "Example: upload 74.125.227.196 report.txt"
259
main = do args <- getArgs case args of (host:filepath:_) -> upload host filepath otherwise -> do putStrLn "Usage: upload <host> <filepath>" putStrLn "Example: upload 74.125.227.196 report.txt"
246
false
true
0
12
83
70
32
38
null
null
wjzz/GoStat
src/Server.hs
bsd-3-clause
gameDetailsUrlMaker :: Language -> Int -> String gameDetailsUrlMaker lang idd = printf "/game?lang=%s&id=%d" lang idd
117
gameDetailsUrlMaker :: Language -> Int -> String gameDetailsUrlMaker lang idd = printf "/game?lang=%s&id=%d" lang idd
117
gameDetailsUrlMaker lang idd = printf "/game?lang=%s&id=%d" lang idd
68
false
true
0
6
14
31
15
16
null
null
jimsnow/glome
GlomeTrace/Data/Glome/Csg.hs
gpl-2.0
inside_difference :: Difference tag mat -> Vec -> Bool inside_difference (Difference sa sb useatex) pt = (inside sa pt) && (not $ inside sb pt)
144
inside_difference :: Difference tag mat -> Vec -> Bool inside_difference (Difference sa sb useatex) pt = (inside sa pt) && (not $ inside sb pt)
144
inside_difference (Difference sa sb useatex) pt = (inside sa pt) && (not $ inside sb pt)
89
false
true
0
8
25
63
31
32
null
null
BartAdv/idris-cil
src/IRTS/CodegenCil.hs
bsd-3-clause
cgConst c = unsupported "const" c
33
cgConst c = unsupported "const" c
33
cgConst c = unsupported "const" c
33
false
false
1
5
5
17
6
11
null
null
TK009/loyly
Mixins.hs
mit
darker02 = blend 0.2 (rgba 0 0 0 1)
35
darker02 = blend 0.2 (rgba 0 0 0 1)
35
darker02 = blend 0.2 (rgba 0 0 0 1)
35
false
false
0
7
8
23
11
12
null
null
SKA-ScienceDataProcessor/RC
MS6/dna/flow/Flow/Kernel.hs
apache-2.0
allocReturns :: forall rep a. (DataRepr rep, Storable a) => (Int -> IO (Vector a)) -> rep -> [RegionBox] -> IO [(RegionBox, Vector a)] allocReturns alloc rep = mapM $ \rbox -> case reprSize rep rbox of Just size | let elemSize = sizeOf (undefined :: a) , size `mod` elemSize == 0 -> fmap ((,) rbox) $ alloc (size `div` elemSize) other -> fail $ "allocReturnBufs: Could not automatically allocate return data for " ++ "data representation " ++ show rep ++ " size " ++ show other ++ "!"
546
allocReturns :: forall rep a. (DataRepr rep, Storable a) => (Int -> IO (Vector a)) -> rep -> [RegionBox] -> IO [(RegionBox, Vector a)] allocReturns alloc rep = mapM $ \rbox -> case reprSize rep rbox of Just size | let elemSize = sizeOf (undefined :: a) , size `mod` elemSize == 0 -> fmap ((,) rbox) $ alloc (size `div` elemSize) other -> fail $ "allocReturnBufs: Could not automatically allocate return data for " ++ "data representation " ++ show rep ++ " size " ++ show other ++ "!"
546
allocReturns alloc rep = mapM $ \rbox -> case reprSize rep rbox of Just size | let elemSize = sizeOf (undefined :: a) , size `mod` elemSize == 0 -> fmap ((,) rbox) $ alloc (size `div` elemSize) other -> fail $ "allocReturnBufs: Could not automatically allocate return data for " ++ "data representation " ++ show rep ++ " size " ++ show other ++ "!"
398
false
true
0
17
152
209
107
102
null
null
ti1024/hacq
src/Control/Monad/Quantum/Base/CircuitBuilder.hs
bsd-3-clause
buildCircuitBase :: IsCircuit g Wire c => CircuitBuilderBase (CircuitInvert (MinimizeWireIndices c)) a -> c buildCircuitBase m = minimizeWireIndices $ runCircuitInvert $ evalCircuitBuilderBase_ m 0
201
buildCircuitBase :: IsCircuit g Wire c => CircuitBuilderBase (CircuitInvert (MinimizeWireIndices c)) a -> c buildCircuitBase m = minimizeWireIndices $ runCircuitInvert $ evalCircuitBuilderBase_ m 0
201
buildCircuitBase m = minimizeWireIndices $ runCircuitInvert $ evalCircuitBuilderBase_ m 0
93
false
true
0
11
27
59
28
31
null
null
emhoracek/smooch
app/src/ParseCNF.hs
gpl-3.0
parseCNFJunk :: Parser CNFLine parseCNFJunk = do oneOf "\SUB\FS \t\r" <?> "whitespace" return CNFJunkLine
113
parseCNFJunk :: Parser CNFLine parseCNFJunk = do oneOf "\SUB\FS \t\r" <?> "whitespace" return CNFJunkLine
113
parseCNFJunk = do oneOf "\SUB\FS \t\r" <?> "whitespace" return CNFJunkLine
82
false
true
0
8
21
30
13
17
null
null
rueshyna/gogol
gogol-sheets/gen/Network/Google/Sheets/Types/Product.hs
mpl-2.0
-- | Moves rows or columns to another location in a sheet. reqMoveDimension :: Lens' Request' (Maybe MoveDimensionRequest) reqMoveDimension = lens _reqMoveDimension (\ s a -> s{_reqMoveDimension = a})
208
reqMoveDimension :: Lens' Request' (Maybe MoveDimensionRequest) reqMoveDimension = lens _reqMoveDimension (\ s a -> s{_reqMoveDimension = a})
149
reqMoveDimension = lens _reqMoveDimension (\ s a -> s{_reqMoveDimension = a})
85
true
true
0
8
36
49
25
24
null
null
bsloane1650/gi-gtk-hs
src/Data/GI/Gtk/ModelView/CustomStore.hs
lgpl-2.1
treeModelIfaceGetValue_static :: StablePtr (CustomStoreImplementation model row) -> Ptr TreeIter -> CInt -> Ptr GValue -> IO () treeModelIfaceGetValue_static storePtr iterPtr column gVal = do store <- deRefStablePtr storePtr iter <- newBoxed TreeIter iterPtr row <- treeModelIfaceGetRow (customStoreIface store) iter cols <- readIORef (customStoreColumns store) -- TODO add code to do this check -- 0 <- {# get GValue->g_type #} gVal case drop (fromIntegral column) cols of [] -> void $ g_value_init gVal (gtypeToCGType gtypeInvalid) -- column number out of range (acc:_) -> case acc of (CAInt ca) -> g_value_init gVal (gtypeToCGType gtypeInt) >> _set_int32 gVal (fromIntegral $ ca row) (CABool ca) -> g_value_init gVal (gtypeToCGType gtypeBoolean) >> _set_boolean gVal (fromIntegral . fromEnum $ ca row) (CAString ca) -> g_value_init gVal (gtypeToCGType gtypeString) >> (withTextCString (ca row) $ _set_string gVal) (CAPixbuf ca) -> g_value_init gVal (gtypeToCGType gtypePixbuf) >> (withManagedPtr (ca row) $ _set_object gVal) CAInvalid -> g_value_init gVal (gtypeToCGType gtypeInvalid) >> _set_int32 gVal 0 -- to avoid warnings of functions that iterate through all columns
1,228
treeModelIfaceGetValue_static :: StablePtr (CustomStoreImplementation model row) -> Ptr TreeIter -> CInt -> Ptr GValue -> IO () treeModelIfaceGetValue_static storePtr iterPtr column gVal = do store <- deRefStablePtr storePtr iter <- newBoxed TreeIter iterPtr row <- treeModelIfaceGetRow (customStoreIface store) iter cols <- readIORef (customStoreColumns store) -- TODO add code to do this check -- 0 <- {# get GValue->g_type #} gVal case drop (fromIntegral column) cols of [] -> void $ g_value_init gVal (gtypeToCGType gtypeInvalid) -- column number out of range (acc:_) -> case acc of (CAInt ca) -> g_value_init gVal (gtypeToCGType gtypeInt) >> _set_int32 gVal (fromIntegral $ ca row) (CABool ca) -> g_value_init gVal (gtypeToCGType gtypeBoolean) >> _set_boolean gVal (fromIntegral . fromEnum $ ca row) (CAString ca) -> g_value_init gVal (gtypeToCGType gtypeString) >> (withTextCString (ca row) $ _set_string gVal) (CAPixbuf ca) -> g_value_init gVal (gtypeToCGType gtypePixbuf) >> (withManagedPtr (ca row) $ _set_object gVal) CAInvalid -> g_value_init gVal (gtypeToCGType gtypeInvalid) >> _set_int32 gVal 0 -- to avoid warnings of functions that iterate through all columns
1,228
treeModelIfaceGetValue_static storePtr iterPtr column gVal = do store <- deRefStablePtr storePtr iter <- newBoxed TreeIter iterPtr row <- treeModelIfaceGetRow (customStoreIface store) iter cols <- readIORef (customStoreColumns store) -- TODO add code to do this check -- 0 <- {# get GValue->g_type #} gVal case drop (fromIntegral column) cols of [] -> void $ g_value_init gVal (gtypeToCGType gtypeInvalid) -- column number out of range (acc:_) -> case acc of (CAInt ca) -> g_value_init gVal (gtypeToCGType gtypeInt) >> _set_int32 gVal (fromIntegral $ ca row) (CABool ca) -> g_value_init gVal (gtypeToCGType gtypeBoolean) >> _set_boolean gVal (fromIntegral . fromEnum $ ca row) (CAString ca) -> g_value_init gVal (gtypeToCGType gtypeString) >> (withTextCString (ca row) $ _set_string gVal) (CAPixbuf ca) -> g_value_init gVal (gtypeToCGType gtypePixbuf) >> (withManagedPtr (ca row) $ _set_object gVal) CAInvalid -> g_value_init gVal (gtypeToCGType gtypeInvalid) >> _set_int32 gVal 0 -- to avoid warnings of functions that iterate through all columns
1,100
false
true
0
18
216
382
181
201
null
null
Mokosha/Lambency
lib/Lambency/Shader/Program.hs
mit
updateStmt (CustomOutput _ v1) s@(LocalDecl v2 Nothing) | v1 == v2 = [] | otherwise = [s]
93
updateStmt (CustomOutput _ v1) s@(LocalDecl v2 Nothing) | v1 == v2 = [] | otherwise = [s]
93
updateStmt (CustomOutput _ v1) s@(LocalDecl v2 Nothing) | v1 == v2 = [] | otherwise = [s]
93
false
false
1
8
20
53
26
27
null
null
siddhanathan/ghc
compiler/nativeGen/SPARC/Ppr.hs
bsd-3-clause
pprInstr (DELTA d) = pprInstr (COMMENT (mkFastString ("\tdelta = " ++ show d)))
87
pprInstr (DELTA d) = pprInstr (COMMENT (mkFastString ("\tdelta = " ++ show d)))
87
pprInstr (DELTA d) = pprInstr (COMMENT (mkFastString ("\tdelta = " ++ show d)))
87
false
false
0
12
20
40
19
21
null
null
ramin32/ChessEngine
ChessPiece.hs
gpl-3.0
value :: ChessPiece -> Int value (ChessPiece name _) = case name of Pawn -> 1 Knight -> 3 Bishop -> 3 Rook -> 5 Queen -> 9 King -> 200
164
value :: ChessPiece -> Int value (ChessPiece name _) = case name of Pawn -> 1 Knight -> 3 Bishop -> 3 Rook -> 5 Queen -> 9 King -> 200
164
value (ChessPiece name _) = case name of Pawn -> 1 Knight -> 3 Bishop -> 3 Rook -> 5 Queen -> 9 King -> 200
137
false
true
0
9
60
72
34
38
null
null
mightymoose/liquidhaskell
benchmarks/containers-0.5.0.0/Data/Sequence.hs
bsd-3-clause
appendTree1 :: FingerTree (Node a) -> Node a -> FingerTree (Node a) -> FingerTree (Node a) appendTree1 Empty a xs = a `consTree` xs
135
appendTree1 :: FingerTree (Node a) -> Node a -> FingerTree (Node a) -> FingerTree (Node a) appendTree1 Empty a xs = a `consTree` xs
135
appendTree1 Empty a xs = a `consTree` xs
44
false
true
0
11
27
73
34
39
null
null
mcmaniac/ghc
compiler/cmm/BlockId.hs
bsd-3-clause
infoTblLbl :: BlockId -> CLabel infoTblLbl label = mkInfoTableLabel (mkFCallName (getUnique label) "block") NoCafRefs
117
infoTblLbl :: BlockId -> CLabel infoTblLbl label = mkInfoTableLabel (mkFCallName (getUnique label) "block") NoCafRefs
117
infoTblLbl label = mkInfoTableLabel (mkFCallName (getUnique label) "block") NoCafRefs
85
false
true
0
9
13
42
19
23
null
null
mathfur/grep-tree
src/Types.hs
mit
fnameToRailsDirectory :: FilePath -> Maybe RailsDirectory fnameToRailsDirectory path | "app/controllers/" `isPrefixOf` fn = Just RailsController | "app/models/" `isPrefixOf` fn = Just RailsModel | "app/views/" `isPrefixOf` fn = Just RailsView | "app/helper/" `isPrefixOf` fn = Just RailsHelper | "lib/" `isPrefixOf` fn = Just RailsLib | "vendor/" `isPrefixOf` fn = Just RailsVendor | "config/" `isPrefixOf` fn = Just RailsConfig | "public/javascripts/" `isPrefixOf` fn = Just RailsJs | "publis/stylesheets/" `isPrefixOf` fn = Just RailsStyleSheet | "db/" `isPrefixOf` fn = Just RailsDb | "test/" `isPrefixOf` fn || "spec/" `isPrefixOf` fn = Just RailsTest | otherwise = Nothing where fn = encodeString path
851
fnameToRailsDirectory :: FilePath -> Maybe RailsDirectory fnameToRailsDirectory path | "app/controllers/" `isPrefixOf` fn = Just RailsController | "app/models/" `isPrefixOf` fn = Just RailsModel | "app/views/" `isPrefixOf` fn = Just RailsView | "app/helper/" `isPrefixOf` fn = Just RailsHelper | "lib/" `isPrefixOf` fn = Just RailsLib | "vendor/" `isPrefixOf` fn = Just RailsVendor | "config/" `isPrefixOf` fn = Just RailsConfig | "public/javascripts/" `isPrefixOf` fn = Just RailsJs | "publis/stylesheets/" `isPrefixOf` fn = Just RailsStyleSheet | "db/" `isPrefixOf` fn = Just RailsDb | "test/" `isPrefixOf` fn || "spec/" `isPrefixOf` fn = Just RailsTest | otherwise = Nothing where fn = encodeString path
851
fnameToRailsDirectory path | "app/controllers/" `isPrefixOf` fn = Just RailsController | "app/models/" `isPrefixOf` fn = Just RailsModel | "app/views/" `isPrefixOf` fn = Just RailsView | "app/helper/" `isPrefixOf` fn = Just RailsHelper | "lib/" `isPrefixOf` fn = Just RailsLib | "vendor/" `isPrefixOf` fn = Just RailsVendor | "config/" `isPrefixOf` fn = Just RailsConfig | "public/javascripts/" `isPrefixOf` fn = Just RailsJs | "publis/stylesheets/" `isPrefixOf` fn = Just RailsStyleSheet | "db/" `isPrefixOf` fn = Just RailsDb | "test/" `isPrefixOf` fn || "spec/" `isPrefixOf` fn = Just RailsTest | otherwise = Nothing where fn = encodeString path
793
false
true
10
10
242
245
123
122
null
null
Mokosha/Lambency
lib/Lambency/Font.hs
mit
mkFont :: Sprite -> [Char] -> [V2 Int] -> [V2 Int] -> Font mkFont sprite string advances offsets = Font $ flip Map.lookup $ Map.fromList $ zip string (zip (cyclicToList $ spriteFrames sprite) (zip advances offsets))
223
mkFont :: Sprite -> [Char] -> [V2 Int] -> [V2 Int] -> Font mkFont sprite string advances offsets = Font $ flip Map.lookup $ Map.fromList $ zip string (zip (cyclicToList $ spriteFrames sprite) (zip advances offsets))
223
mkFont sprite string advances offsets = Font $ flip Map.lookup $ Map.fromList $ zip string (zip (cyclicToList $ spriteFrames sprite) (zip advances offsets))
164
false
true
6
11
43
111
51
60
null
null
rrnewton/hgdata_trash
src/Network/Google/Storage.hs
mit
deleteObjectImpl :: (Request (ResourceT IO) -> IO [(String, String)]) -- ^ The function for performing the request. -> ProjectId -- ^ The project ID. -> BucketName -- ^ The bucket. -> KeyName -- ^ The object's key. -> AccessToken -- ^ The OAuth 2.0 access token. -> IO [(String, String)] -- ^ The action to delete the object and return the response header. deleteObjectImpl doer projectId bucket key accessToken = do let request = makeProjectRequest projectId accessToken storageApi "DELETE" (makeHost bucket, makePath key) doer request
760
deleteObjectImpl :: (Request (ResourceT IO) -> IO [(String, String)]) -- ^ The function for performing the request. -> ProjectId -- ^ The project ID. -> BucketName -- ^ The bucket. -> KeyName -- ^ The object's key. -> AccessToken -- ^ The OAuth 2.0 access token. -> IO [(String, String)] deleteObjectImpl doer projectId bucket key accessToken = do let request = makeProjectRequest projectId accessToken storageApi "DELETE" (makeHost bucket, makePath key) doer request
662
deleteObjectImpl doer projectId bucket key accessToken = do let request = makeProjectRequest projectId accessToken storageApi "DELETE" (makeHost bucket, makePath key) doer request
195
true
true
0
13
308
127
66
61
null
null
brendanhay/gogol
gogol-run/gen/Network/Google/Resource/Run/Namespaces/Services/Get.hs
mpl-2.0
-- | V1 error format. nsgXgafv :: Lens' NamespacesServicesGet (Maybe Xgafv) nsgXgafv = lens _nsgXgafv (\ s a -> s{_nsgXgafv = a})
129
nsgXgafv :: Lens' NamespacesServicesGet (Maybe Xgafv) nsgXgafv = lens _nsgXgafv (\ s a -> s{_nsgXgafv = a})
107
nsgXgafv = lens _nsgXgafv (\ s a -> s{_nsgXgafv = a})
53
true
true
1
9
21
51
25
26
null
null
olorin/amazonka
amazonka-ec2/gen/Network/AWS/EC2/Types/Product.hs
mpl-2.0
-- | The ID of the instance profile. iapId :: Lens' IAMInstanceProfile (Maybe Text) iapId = lens _iapId (\ s a -> s{_iapId = a})
128
iapId :: Lens' IAMInstanceProfile (Maybe Text) iapId = lens _iapId (\ s a -> s{_iapId = a})
91
iapId = lens _iapId (\ s a -> s{_iapId = a})
44
true
true
0
9
24
46
25
21
null
null
sethfowler/hsbugzilla
src/Web/Bugzilla/Internal/Types.hs
bsd-3-clause
fieldName :: Field a -> T.Text fieldName AliasField = "Alias"
80
fieldName :: Field a -> T.Text fieldName AliasField = "Alias"
80
fieldName AliasField = "Alias"
49
false
true
0
6
28
23
11
12
null
null
BlackBrane/microsoft-translator
src/Microsoft/Translator/Language.hs
mit
toLangCode English = "en"
36
toLangCode English = "en"
36
toLangCode English = "en"
36
false
false
0
5
14
9
4
5
null
null
trenttobler/hs-asteroids
src/Asteroids/GameLogic/Asteroid.hs
bsd-3-clause
randomAngleBias :: Coord randomAngleBias = 6.0
47
randomAngleBias :: Coord randomAngleBias = 6.0
46
randomAngleBias = 6.0
21
false
true
0
4
6
11
6
5
null
null
mlite/hLLVM
src/Llvm/Pass/RewriteUse.hs
bsd-3-clause
rwRhs f (RiE a) = rwInsertElem (tv2v f) a >>= return . RiE
58
rwRhs f (RiE a) = rwInsertElem (tv2v f) a >>= return . RiE
58
rwRhs f (RiE a) = rwInsertElem (tv2v f) a >>= return . RiE
58
false
false
0
9
12
38
17
21
null
null
dysinger/amazonka
amazonka-ec2/gen/Network/AWS/EC2/Types.hs
mpl-2.0
-- | 'Subnet' constructor. -- -- The fields accessible through corresponding lenses are: -- -- * 's1AvailabilityZone' @::@ 'Text' -- -- * 's1AvailableIpAddressCount' @::@ 'Int' -- -- * 's1CidrBlock' @::@ 'Text' -- -- * 's1DefaultForAz' @::@ 'Bool' -- -- * 's1MapPublicIpOnLaunch' @::@ 'Bool' -- -- * 's1State' @::@ 'SubnetState' -- -- * 's1SubnetId' @::@ 'Text' -- -- * 's1Tags' @::@ ['Tag'] -- -- * 's1VpcId' @::@ 'Text' -- subnet :: Text -- ^ 's1SubnetId' -> SubnetState -- ^ 's1State' -> Text -- ^ 's1VpcId' -> Text -- ^ 's1CidrBlock' -> Int -- ^ 's1AvailableIpAddressCount' -> Text -- ^ 's1AvailabilityZone' -> Bool -- ^ 's1DefaultForAz' -> Bool -- ^ 's1MapPublicIpOnLaunch' -> Subnet subnet p1 p2 p3 p4 p5 p6 p7 p8 = Subnet { _s1SubnetId = p1 , _s1State = p2 , _s1VpcId = p3 , _s1CidrBlock = p4 , _s1AvailableIpAddressCount = p5 , _s1AvailabilityZone = p6 , _s1DefaultForAz = p7 , _s1MapPublicIpOnLaunch = p8 , _s1Tags = mempty }
1,136
subnet :: Text -- ^ 's1SubnetId' -> SubnetState -- ^ 's1State' -> Text -- ^ 's1VpcId' -> Text -- ^ 's1CidrBlock' -> Int -- ^ 's1AvailableIpAddressCount' -> Text -- ^ 's1AvailabilityZone' -> Bool -- ^ 's1DefaultForAz' -> Bool -- ^ 's1MapPublicIpOnLaunch' -> Subnet subnet p1 p2 p3 p4 p5 p6 p7 p8 = Subnet { _s1SubnetId = p1 , _s1State = p2 , _s1VpcId = p3 , _s1CidrBlock = p4 , _s1AvailableIpAddressCount = p5 , _s1AvailabilityZone = p6 , _s1DefaultForAz = p7 , _s1MapPublicIpOnLaunch = p8 , _s1Tags = mempty }
711
subnet p1 p2 p3 p4 p5 p6 p7 p8 = Subnet { _s1SubnetId = p1 , _s1State = p2 , _s1VpcId = p3 , _s1CidrBlock = p4 , _s1AvailableIpAddressCount = p5 , _s1AvailabilityZone = p6 , _s1DefaultForAz = p7 , _s1MapPublicIpOnLaunch = p8 , _s1Tags = mempty }
391
true
true
0
14
360
155
99
56
null
null
thomasjm/ot.hs
test/Control/OperationalTransformation/JSON/Specs.hs
mit
-- These tests are taken directly from -- https://github.com/ottypes/json0/blob/master/test/json0.coffee apply :: A.Value -> JSONOperation -> A.Value apply input op = case C.apply op input of Left err -> error err Right x -> x
231
apply :: A.Value -> JSONOperation -> A.Value apply input op = case C.apply op input of Left err -> error err Right x -> x
125
apply input op = case C.apply op input of Left err -> error err Right x -> x
80
true
true
0
9
38
68
31
37
null
null
pharpend/puffytools
src/PuffyTools/Journal.hs
bsd-3-clause
-- |Makes a journal, given a slug mkJournal :: Slug -> IO Journal mkJournal s = getCurrentTime >>= \t -> return $ Journal s mempty t t mempty mempty
148
mkJournal :: Slug -> IO Journal mkJournal s = getCurrentTime >>= \t -> return $ Journal s mempty t t mempty mempty
114
mkJournal s = getCurrentTime >>= \t -> return $ Journal s mempty t t mempty mempty
82
true
true
0
8
28
48
24
24
null
null
ekmett/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxSTC_SQL_OPERATOR :: Int wxSTC_SQL_OPERATOR = 10
49
wxSTC_SQL_OPERATOR :: Int wxSTC_SQL_OPERATOR = 10
49
wxSTC_SQL_OPERATOR = 10
23
false
true
0
6
5
18
7
11
null
null
fffej/HS-Poker
LookupPatternMatch.hs
bsd-3-clause
getValueFromProduct 61828 = 5988
32
getValueFromProduct 61828 = 5988
32
getValueFromProduct 61828 = 5988
32
false
false
0
5
3
9
4
5
null
null
uwitty/mosquitto
src/Network/Mosquitto.hs
mit
publish :: Mosquitto -> String -> BS.ByteString -> Int -> Bool -> IO (Int, Int) publish mosquitto topicName payload qos retain = do midC <- (malloc :: IO (Ptr CInt)) let (payloadFP, off, _len) = toForeignPtr payload res <- fmap fromIntegral $ withCString topicName $ \topicNameC -> withForeignPtr payloadFP $ \payloadP -> c_mosquitto_publish (mosquittoObject mosquitto) midC topicNameC (fromIntegral (BS.length payload)) (payloadP `plusPtr` off) (fromIntegral qos) (fromBool retain) mid <- fromIntegral <$> peek midC free midC return (res, mid) -- Utility
962
publish :: Mosquitto -> String -> BS.ByteString -> Int -> Bool -> IO (Int, Int) publish mosquitto topicName payload qos retain = do midC <- (malloc :: IO (Ptr CInt)) let (payloadFP, off, _len) = toForeignPtr payload res <- fmap fromIntegral $ withCString topicName $ \topicNameC -> withForeignPtr payloadFP $ \payloadP -> c_mosquitto_publish (mosquittoObject mosquitto) midC topicNameC (fromIntegral (BS.length payload)) (payloadP `plusPtr` off) (fromIntegral qos) (fromBool retain) mid <- fromIntegral <$> peek midC free midC return (res, mid) -- Utility
962
publish mosquitto topicName payload qos retain = do midC <- (malloc :: IO (Ptr CInt)) let (payloadFP, off, _len) = toForeignPtr payload res <- fmap fromIntegral $ withCString topicName $ \topicNameC -> withForeignPtr payloadFP $ \payloadP -> c_mosquitto_publish (mosquittoObject mosquitto) midC topicNameC (fromIntegral (BS.length payload)) (payloadP `plusPtr` off) (fromIntegral qos) (fromBool retain) mid <- fromIntegral <$> peek midC free midC return (res, mid) -- Utility
882
false
true
0
17
486
224
111
113
null
null
Helium4Haskell/helium
lib/PreludeA.hs
gpl-3.0
span p xs@(x:xs') | p x = (x:ys, zs) | otherwise = ([],xs) where (ys,zs) = span p xs'
124
span p xs@(x:xs') | p x = (x:ys, zs) | otherwise = ([],xs) where (ys,zs) = span p xs'
124
span p xs@(x:xs') | p x = (x:ys, zs) | otherwise = ([],xs) where (ys,zs) = span p xs'
124
false
false
0
8
57
76
39
37
null
null
verement/etamoo
src/MOO/Connection.hs
bsd-3-clause
notify :: ObjId -> StrT -> MOO Bool notify = notify' False
58
notify :: ObjId -> StrT -> MOO Bool notify = notify' False
58
notify = notify' False
22
false
true
0
7
11
25
12
13
null
null
Saeron/haskell
data.structures/haskell/Demos/Queue/Josephus.hs
apache-2.0
josephus :: Int -> Int -> [Int] josephus n m = execute $ mkQueue n where execute q | isEmpty q = [] | otherwise = x : execute q'' where q' = skip m q x = first q' q'' = dequeue q'
215
josephus :: Int -> Int -> [Int] josephus n m = execute $ mkQueue n where execute q | isEmpty q = [] | otherwise = x : execute q'' where q' = skip m q x = first q' q'' = dequeue q'
214
josephus n m = execute $ mkQueue n where execute q | isEmpty q = [] | otherwise = x : execute q'' where q' = skip m q x = first q' q'' = dequeue q'
182
false
true
0
8
79
100
47
53
null
null
alphaHeavy/hlint
src/Settings.hs
gpl-2.0
getNames [] (InfixApp _ lhs op rhs) | opExp op ~= "==>" = map ("Use "++) names where lnames = map f $ childrenS lhs rnames = map f $ childrenS rhs names = filter (not . isUnifyVar) $ (rnames \\ lnames) ++ rnames f (Ident _ x) = x f (Symbol _ x) = x
292
getNames [] (InfixApp _ lhs op rhs) | opExp op ~= "==>" = map ("Use "++) names where lnames = map f $ childrenS lhs rnames = map f $ childrenS rhs names = filter (not . isUnifyVar) $ (rnames \\ lnames) ++ rnames f (Ident _ x) = x f (Symbol _ x) = x
292
getNames [] (InfixApp _ lhs op rhs) | opExp op ~= "==>" = map ("Use "++) names where lnames = map f $ childrenS lhs rnames = map f $ childrenS rhs names = filter (not . isUnifyVar) $ (rnames \\ lnames) ++ rnames f (Ident _ x) = x f (Symbol _ x) = x
292
false
false
5
9
99
150
69
81
null
null
elieux/ghc
compiler/hsSyn/HsBinds.hs
bsd-3-clause
hsSigDoc (IdSig {}) = ptext (sLit "id signature")
61
hsSigDoc (IdSig {}) = ptext (sLit "id signature")
61
hsSigDoc (IdSig {}) = ptext (sLit "id signature")
61
false
false
0
7
19
26
12
14
null
null
harendra-kumar/asyncly
test/Main.hs
bsd-3-clause
_composeWithMonadError :: ( IsStream t , Semigroup (t (ExceptT String IO) Int) , MonadError String (t (ExceptT String IO)) ) => (t (ExceptT String IO) Int -> SerialT (ExceptT String IO) Int) -> Spec _composeWithMonadError t = do let tl = S.toList . t it "Compose throwError, nil" $ runExceptT (tl (throwError "E" <> S.nil)) `shouldReturn` Left "E" it "Compose nil, error" $ runExceptT (tl (S.nil <> throwError "E")) `shouldReturn` Left "E"
496
_composeWithMonadError :: ( IsStream t , Semigroup (t (ExceptT String IO) Int) , MonadError String (t (ExceptT String IO)) ) => (t (ExceptT String IO) Int -> SerialT (ExceptT String IO) Int) -> Spec _composeWithMonadError t = do let tl = S.toList . t it "Compose throwError, nil" $ runExceptT (tl (throwError "E" <> S.nil)) `shouldReturn` Left "E" it "Compose nil, error" $ runExceptT (tl (S.nil <> throwError "E")) `shouldReturn` Left "E"
496
_composeWithMonadError t = do let tl = S.toList . t it "Compose throwError, nil" $ runExceptT (tl (throwError "E" <> S.nil)) `shouldReturn` Left "E" it "Compose nil, error" $ runExceptT (tl (S.nil <> throwError "E")) `shouldReturn` Left "E"
268
false
true
0
15
128
205
98
107
null
null
GallagherCommaJack/scheming-machine
ParserEvaluator.hs
gpl-3.0
stringAppend :: [LispVal] -> ThrowsError LispVal stringAppend ((String s1):(String s2):xs) = stringAppend ((String (s1 ++ s2)):xs)
130
stringAppend :: [LispVal] -> ThrowsError LispVal stringAppend ((String s1):(String s2):xs) = stringAppend ((String (s1 ++ s2)):xs)
130
stringAppend ((String s1):(String s2):xs) = stringAppend ((String (s1 ++ s2)):xs)
81
false
true
0
12
15
74
37
37
null
null
jaapweel/bloop
OptimizeC.hs
gpl-2.0
labels _ other = return $ other
42
labels _ other = return $ other
42
labels _ other = return $ other
42
false
false
0
5
17
15
7
8
null
null
mightymoose/liquidhaskell
tests/pos/RBTree-ord.hs
bsd-3-clause
balS k l r = error "nein"
52
rbalS k l r = error "nein"
52
rbalS k l r = error "nein"
52
false
false
0
5
33
16
7
9
null
null
green-haskell/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
toListClassOpKey = mkPreludeMiscIdUnique 501
44
toListClassOpKey = mkPreludeMiscIdUnique 501
44
toListClassOpKey = mkPreludeMiscIdUnique 501
44
false
false
0
5
3
9
4
5
null
null
fredyr/copilot-libraries
src/Copilot/Library/Utils.hs
bsd-3-clause
nscanl :: ( Typed a, Typed b ) => Int -> ( Stream a -> Stream b -> Stream a ) -> Stream a -> Stream b -> [ Stream a ] nscanl n f e s = scanl f e $ take n s
175
nscanl :: ( Typed a, Typed b ) => Int -> ( Stream a -> Stream b -> Stream a ) -> Stream a -> Stream b -> [ Stream a ] nscanl n f e s = scanl f e $ take n s
175
nscanl n f e s = scanl f e $ take n s
37
false
true
0
11
64
97
46
51
null
null
joelburget/Cologne
Cologne/ParseNFF.hs
bsd-3-clause
--background = char 'b' *> (Vec3 <$> count 3 float) --background = char 'b' *> (Vec3 <$> (chainr1 float (<*>))) --nToken 1 comb1 comb2 = comb1 <$> comb2 --nToken n comb1 comb2 = (nToken (n-1) comb1 comb2) <*> comb2 {- viewpoint - - Where the camera is located and where it points. We expect - it at the beginning of the file. -} viewpoint :: ObjParser (Vec3, Vec3) viewpoint = do char 'v' >> spaces from <- string "from " *> (Vec3 <$> float <*> float <*> float) <* spaces at <- string "at " *> (Vec3 <$> float <*> float <*> float) <* spaces return (from, normalize at) -- If we were complying fully to the nff spec we would implement these but we -- have no need for them yet -- up <- string "up " *> (Vec3 <$> float <*> float <*> float) <* spaces -- angle <- string "angle " *> float <* spaces -- hither <- string "hither " *> float -- return (from, at, up, angle, hither)
902
viewpoint :: ObjParser (Vec3, Vec3) viewpoint = do char 'v' >> spaces from <- string "from " *> (Vec3 <$> float <*> float <*> float) <* spaces at <- string "at " *> (Vec3 <$> float <*> float <*> float) <* spaces return (from, normalize at) -- If we were complying fully to the nff spec we would implement these but we -- have no need for them yet -- up <- string "up " *> (Vec3 <$> float <*> float <*> float) <* spaces -- angle <- string "angle " *> float <* spaces -- hither <- string "hither " *> float -- return (from, at, up, angle, hither)
568
viewpoint = do char 'v' >> spaces from <- string "from " *> (Vec3 <$> float <*> float <*> float) <* spaces at <- string "at " *> (Vec3 <$> float <*> float <*> float) <* spaces return (from, normalize at) -- If we were complying fully to the nff spec we would implement these but we -- have no need for them yet -- up <- string "up " *> (Vec3 <$> float <*> float <*> float) <* spaces -- angle <- string "angle " *> float <* spaces -- hither <- string "hither " *> float -- return (from, at, up, angle, hither)
532
true
true
0
14
201
128
66
62
null
null
noughtmare/yi
yi-core/src/Yi/Buffer/Misc.hs
gpl-2.0
deleteN :: Int -> BufferM () deleteN n = pointB >>= deleteNAt Forward n
71
deleteN :: Int -> BufferM () deleteN n = pointB >>= deleteNAt Forward n
71
deleteN n = pointB >>= deleteNAt Forward n
42
false
true
0
7
13
32
15
17
null
null
sgillespie/ghc
compiler/hsSyn/HsUtils.hs
bsd-3-clause
mkNPlusKPat id lit = NPlusKPat id lit (unLoc lit) noSyntaxExpr noSyntaxExpr placeHolderType
91
mkNPlusKPat id lit = NPlusKPat id lit (unLoc lit) noSyntaxExpr noSyntaxExpr placeHolderType
91
mkNPlusKPat id lit = NPlusKPat id lit (unLoc lit) noSyntaxExpr noSyntaxExpr placeHolderType
91
false
false
0
7
11
30
14
16
null
null
brendanhay/gogol
gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs
mpl-2.0
-- | Users with access to the account. Every account (except for subaccounts) -- must have at least one admin user. aaUsers :: Lens' Account [AccountUser] aaUsers = lens _aaUsers (\ s a -> s{_aaUsers = a}) . _Default . _Coerce
234
aaUsers :: Lens' Account [AccountUser] aaUsers = lens _aaUsers (\ s a -> s{_aaUsers = a}) . _Default . _Coerce
118
aaUsers = lens _aaUsers (\ s a -> s{_aaUsers = a}) . _Default . _Coerce
79
true
true
0
11
48
54
29
25
null
null
alexandersgreen/alex-haskell
Poker/Cards.hs
apache-2.0
dealCards :: IO (Hand,String) dealCards = do cards <- shuffleCards return (hand cards,show (whatWin (hand cards)))
129
dealCards :: IO (Hand,String) dealCards = do cards <- shuffleCards return (hand cards,show (whatWin (hand cards)))
129
dealCards = do cards <- shuffleCards return (hand cards,show (whatWin (hand cards)))
99
false
true
0
13
30
57
28
29
null
null
ecaustin/haskhol-core
src/HaskHOL/Core/Kernel.hs
bsd-2-clause
primMK_COMB th _ = throwM $! HOLThmError th "primMK_COMB: not both equations"
77
primMK_COMB th _ = throwM $! HOLThmError th "primMK_COMB: not both equations"
77
primMK_COMB th _ = throwM $! HOLThmError th "primMK_COMB: not both equations"
77
false
false
0
6
11
20
9
11
null
null
geophf/1HaskellADay
exercises/HAD/Y2017/M12/D11/Exercise.hs
mit
-- 2. Generate 10,000 random numbers from the exponential distribution -- in the Integer range from 5000 - 25000 rndExpRange :: RandomGen g => (Integer, Integer) -> g -> (Integer, g) rndExpRange rng gen = undefined
218
rndExpRange :: RandomGen g => (Integer, Integer) -> g -> (Integer, g) rndExpRange rng gen = undefined
101
rndExpRange rng gen = undefined
31
true
true
0
10
39
51
26
25
null
null
sarangj/eulerhs
src/Problems/Problem2.hs
bsd-3-clause
nextFib (Just t2, Just t1, currSum) = (Just t1, Just (t2 + t1), updateSum currSum (t2+t1))
93
nextFib (Just t2, Just t1, currSum) = (Just t1, Just (t2 + t1), updateSum currSum (t2+t1))
93
nextFib (Just t2, Just t1, currSum) = (Just t1, Just (t2 + t1), updateSum currSum (t2+t1))
93
false
false
0
8
18
59
30
29
null
null
trenttobler/hs-asteroids
src/Asteroids/UILogic/Letters.hs
bsd-3-clause
drawRightText :: DrawableLetters -> Pt2 Coord -> [String] -> IO () drawRightText letters pos s = drawText rightOrient letters pos backwardLines where rightOrient = standardOrient {orientNextC = pt2 (-1) 0 } backwardLines = fmap reverse s
250
drawRightText :: DrawableLetters -> Pt2 Coord -> [String] -> IO () drawRightText letters pos s = drawText rightOrient letters pos backwardLines where rightOrient = standardOrient {orientNextC = pt2 (-1) 0 } backwardLines = fmap reverse s
249
drawRightText letters pos s = drawText rightOrient letters pos backwardLines where rightOrient = standardOrient {orientNextC = pt2 (-1) 0 } backwardLines = fmap reverse s
182
false
true
1
10
48
87
43
44
null
null
lawrencelomax/ResultWorthy
ResultWorthy/SwiftParsers.hs
bsd-3-clause
containerAnnotationParser :: Parser ContainerAnnotation containerAnnotationParser = liftM4 ContainerAnnotation accessModifierParser containerP typeP extendsP where containerP = padded containerTypeParser typeP = padded swiftTypeParser extendsP = option [] (spaces *> char ':' *> sepBy (padded swiftTypeParser) (char ',')) -- Parses a Container (struct, class, extension) TODO enum
406
containerAnnotationParser :: Parser ContainerAnnotation containerAnnotationParser = liftM4 ContainerAnnotation accessModifierParser containerP typeP extendsP where containerP = padded containerTypeParser typeP = padded swiftTypeParser extendsP = option [] (spaces *> char ':' *> sepBy (padded swiftTypeParser) (char ',')) -- Parses a Container (struct, class, extension) TODO enum
406
containerAnnotationParser = liftM4 ContainerAnnotation accessModifierParser containerP typeP extendsP where containerP = padded containerTypeParser typeP = padded swiftTypeParser extendsP = option [] (spaces *> char ':' *> sepBy (padded swiftTypeParser) (char ',')) -- Parses a Container (struct, class, extension) TODO enum
350
false
true
0
10
69
88
43
45
null
null
kmate/HaRe
old/refactorer/RefacGenDef.hs
bsd-3-clause
- Create the auxiliary function name. Suppose the original function name is 'f', then the auxiliary function name is like 'f_gen_i', where i is an integer. -} mkNewFunPName pn e modName inscopeNames =do (f1,d1) <- hsFDsFromInside e let name=mkNewName ((pNtoName pn)++"_gen") (nub ((map pNtoName (f1 `union` d1)) `union` inscopeNames)) 0 return (PN (UnQual name) (G modName name (N (Just loc0))))
419
mkNewFunPName pn e modName inscopeNames =do (f1,d1) <- hsFDsFromInside e let name=mkNewName ((pNtoName pn)++"_gen") (nub ((map pNtoName (f1 `union` d1)) `union` inscopeNames)) 0 return (PN (UnQual name) (G modName name (N (Just loc0))))
256
mkNewFunPName pn e modName inscopeNames =do (f1,d1) <- hsFDsFromInside e let name=mkNewName ((pNtoName pn)++"_gen") (nub ((map pNtoName (f1 `union` d1)) `union` inscopeNames)) 0 return (PN (UnQual name) (G modName name (N (Just loc0))))
256
true
false
5
18
83
208
101
107
null
null
JakDar/lab6-project
src/Ex1.hs
bsd-3-clause
f1 :: (Ord a, Num a) => a -> Maybe a f1 x = if x > 0 then Just (x + 1) else Nothing
83
f1 :: (Ord a, Num a) => a -> Maybe a f1 x = if x > 0 then Just (x + 1) else Nothing
83
f1 x = if x > 0 then Just (x + 1) else Nothing
46
false
true
0
8
24
62
31
31
null
null
hpacheco/HAAP
examples/plab/svn/2017li1g186/src/OracleT1.hs
mit
printTipoPeca :: Tipo -> String printTipoPeca Recta = "[]"
59
printTipoPeca :: Tipo -> String printTipoPeca Recta = "[]"
59
printTipoPeca Recta = "[]"
27
false
true
0
7
9
24
10
14
null
null
wavewave/hoodle-core
src/Hoodle/Type/HoodleState.hs
gpl-3.0
-- | statusBar :: Simple Lens HoodleState (Maybe Statusbar) statusBar = lens _statusBar (\f a -> f { _statusBar = a })
119
statusBar :: Simple Lens HoodleState (Maybe Statusbar) statusBar = lens _statusBar (\f a -> f { _statusBar = a })
113
statusBar = lens _statusBar (\f a -> f { _statusBar = a })
58
true
true
1
9
22
53
26
27
null
null
pdownen/sequent-core
src/Language/SequentCore/Simpl/ExprSize.hs
bsd-3-clause
commandSize :: DynFlags -> Int -> SeqCoreCommand -> Maybe ExprSize termSize dflags cap term@(Lam {}) = let (xs, body) = lambdas term valBinders = filter isId xs (sizeT, _, _) = sizeFuncs dflags cap valBinders in body2ExprSize valBinders $ sizeT body
272
commandSize :: DynFlags -> Int -> SeqCoreCommand -> Maybe ExprSize termSize dflags cap term@(Lam {}) = let (xs, body) = lambdas term valBinders = filter isId xs (sizeT, _, _) = sizeFuncs dflags cap valBinders in body2ExprSize valBinders $ sizeT body
271
termSize dflags cap term@(Lam {}) = let (xs, body) = lambdas term valBinders = filter isId xs (sizeT, _, _) = sizeFuncs dflags cap valBinders in body2ExprSize valBinders $ sizeT body
204
false
true
9
6
63
100
54
46
null
null
ghcjs/ghcjs
src/Gen2/TH.hs
mit
ghcjsRunMeta :: GhcjsEnv -> GhcjsSettings -> MetaRequest -> LHsExpr GhcTc -> TcM MetaResult ghcjsRunMeta js_env js_settings req expr = let m :: (hs_syn -> MetaResult) -> String -> TH.THResultType -> Bool -> (hs_syn -> SDoc) -> (SrcSpan -> ByteString -> TcM hs_syn) -> TcM MetaResult m r desc th_type show_code ppr_code convert_res = r <$> ghcjsRunMeta' js_env js_settings desc th_type show_code ppr_code convert_res expr in case req of MetaE r -> m r "expression" TH.THExp True ppr convertE MetaP r -> m r "pattern" TH.THPat True ppr convertP MetaT r -> m r "type" TH.THType True ppr convertT MetaD r -> m r "declarations" TH.THDec True ppr convertD MetaAW r -> m r "annotation" TH.THAnnWrapper False ppr convertAnn
1,091
ghcjsRunMeta :: GhcjsEnv -> GhcjsSettings -> MetaRequest -> LHsExpr GhcTc -> TcM MetaResult ghcjsRunMeta js_env js_settings req expr = let m :: (hs_syn -> MetaResult) -> String -> TH.THResultType -> Bool -> (hs_syn -> SDoc) -> (SrcSpan -> ByteString -> TcM hs_syn) -> TcM MetaResult m r desc th_type show_code ppr_code convert_res = r <$> ghcjsRunMeta' js_env js_settings desc th_type show_code ppr_code convert_res expr in case req of MetaE r -> m r "expression" TH.THExp True ppr convertE MetaP r -> m r "pattern" TH.THPat True ppr convertP MetaT r -> m r "type" TH.THType True ppr convertT MetaD r -> m r "declarations" TH.THDec True ppr convertD MetaAW r -> m r "annotation" TH.THAnnWrapper False ppr convertAnn
1,091
ghcjsRunMeta js_env js_settings req expr = let m :: (hs_syn -> MetaResult) -> String -> TH.THResultType -> Bool -> (hs_syn -> SDoc) -> (SrcSpan -> ByteString -> TcM hs_syn) -> TcM MetaResult m r desc th_type show_code ppr_code convert_res = r <$> ghcjsRunMeta' js_env js_settings desc th_type show_code ppr_code convert_res expr in case req of MetaE r -> m r "expression" TH.THExp True ppr convertE MetaP r -> m r "pattern" TH.THPat True ppr convertP MetaT r -> m r "type" TH.THType True ppr convertT MetaD r -> m r "declarations" TH.THDec True ppr convertD MetaAW r -> m r "annotation" TH.THAnnWrapper False ppr convertAnn
947
false
true
0
18
493
273
130
143
null
null
mightymoose/liquidhaskell
tests/pos/OrdList.hs
bsd-3-clause
snocOL as b = Snoc as b
28
snocOL as b = Snoc as b
28
snocOL as b = Snoc as b
28
false
false
1
5
11
21
7
14
null
null
johnyhlee/baseball-sim
src/Baseball.hs
gpl-2.0
onSecond :: BaseState onSecond = BaseState { first=False, second=True, third=False }
84
onSecond :: BaseState onSecond = BaseState { first=False, second=True, third=False }
84
onSecond = BaseState { first=False, second=True, third=False }
62
false
true
0
6
10
31
19
12
null
null