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
HaskellForCats/HaskellForCats
MenaBeginning/002mena/session01/2014-0228ifThenElse.hs
mit
-- : set number linebreak expandtab ts=4 -- syntax enable -- retab posOrNeg x = if x >= 0 then "Pos" else "Neg"
129
posOrNeg x = if x >= 0 then "Pos" else "Neg"
60
posOrNeg x = if x >= 0 then "Pos" else "Neg"
60
true
false
0
6
40
24
14
10
null
null
k0001/haskell-opaleye
Opaleye/Order.hs
bsd-3-clause
asc :: (a -> C.Column b) -> O.OrderSpec a asc = O.orderSpec HPQ.OpAsc
69
asc :: (a -> C.Column b) -> O.OrderSpec a asc = O.orderSpec HPQ.OpAsc
69
asc = O.orderSpec HPQ.OpAsc
27
false
true
0
10
12
45
20
25
null
null
HJvT/hdirect
src/Parser.hs
bsd-3-clause
action_327 (46#) = happyGoto action_189
39
action_327 (46#) = happyGoto action_189
39
action_327 (46#) = happyGoto action_189
39
false
false
0
6
4
15
7
8
null
null
HackerFoo/peg
Peg/Constraints.hs
gpl-3.0
op21 :: (ValueT a, ValueT b, ValueT c, Eq c) => (a -> b -> c) -> Value -> Value -> Value -> Peg Bool op21 op x y z | Just x' <- fromValue x, Just y' <- fromValue y = ensure z $ x' `op` y' | otherwise = return False
218
op21 :: (ValueT a, ValueT b, ValueT c, Eq c) => (a -> b -> c) -> Value -> Value -> Value -> Peg Bool op21 op x y z | Just x' <- fromValue x, Just y' <- fromValue y = ensure z $ x' `op` y' | otherwise = return False
218
op21 op x y z | Just x' <- fromValue x, Just y' <- fromValue y = ensure z $ x' `op` y' | otherwise = return False
117
false
true
0
11
56
138
65
73
null
null
ihc/futhark
src/Futhark/CodeGen/Backends/GenericPython.hs
isc
-- The value returned will be used when reading binary arrays, to indicate what -- the expected type is readTypeEnum :: PrimType -> Imp.Signedness -> String readTypeEnum (IntType Int8) Imp.TypeUnsigned = "FUTHARK_UINT8"
220
readTypeEnum :: PrimType -> Imp.Signedness -> String readTypeEnum (IntType Int8) Imp.TypeUnsigned = "FUTHARK_UINT8"
116
readTypeEnum (IntType Int8) Imp.TypeUnsigned = "FUTHARK_UINT8"
63
true
true
0
7
32
36
19
17
null
null
yuroyoro/stashh
src/Stashh/Repos/List.hs
bsd-3-clause
modeRepos :: Mode (CmdArgs ReposCommand) modeRepos = cmdArgsMode $ ReposCommand { projectKey = "" &= argPos 0 &= typ "PROJECT_KEY" , cmdargs = [] &= args } &= name "repos"
182
modeRepos :: Mode (CmdArgs ReposCommand) modeRepos = cmdArgsMode $ ReposCommand { projectKey = "" &= argPos 0 &= typ "PROJECT_KEY" , cmdargs = [] &= args } &= name "repos"
182
modeRepos = cmdArgsMode $ ReposCommand { projectKey = "" &= argPos 0 &= typ "PROJECT_KEY" , cmdargs = [] &= args } &= name "repos"
141
false
true
2
10
40
67
34
33
null
null
kyl27/htree
htree.hs
gpl-3.0
main :: IO () main = do args <- getArgs case args of arg:_ -> putStrLn "Header include tree:" >> getFullPath arg >>= htree 0 [] -> putStrLn "Must provide file name in current directory."
213
main :: IO () main = do args <- getArgs case args of arg:_ -> putStrLn "Header include tree:" >> getFullPath arg >>= htree 0 [] -> putStrLn "Must provide file name in current directory."
213
main = do args <- getArgs case args of arg:_ -> putStrLn "Header include tree:" >> getFullPath arg >>= htree 0 [] -> putStrLn "Must provide file name in current directory."
199
false
true
0
12
61
68
31
37
null
null
brendanhay/gogol
gogol-cloudkms/gen/Network/Google/CloudKMS/Types/Product.hs
mpl-2.0
-- | Specifies cloud audit logging configuration for this policy. pAuditConfigs :: Lens' Policy [AuditConfig] pAuditConfigs = lens _pAuditConfigs (\ s a -> s{_pAuditConfigs = a}) . _Default . _Coerce
219
pAuditConfigs :: Lens' Policy [AuditConfig] pAuditConfigs = lens _pAuditConfigs (\ s a -> s{_pAuditConfigs = a}) . _Default . _Coerce
153
pAuditConfigs = lens _pAuditConfigs (\ s a -> s{_pAuditConfigs = a}) . _Default . _Coerce
109
true
true
0
11
49
53
28
25
null
null
MikePors/FizzBuzzWarz
src/GameMechanics.hs
bsd-3-clause
executeAiTurn :: GameState Int -> Int -> GameState (Clue Int) executeAiTurn gameState seed = let human = humanPlayer gameState dmg = length $ filter ((>0).playerHealth) $ aiPlayers gameState damagedHuman = damagePlayer human dmg livingAis = filter isAlive $ aiPlayers gameState (indexOfAiToReveal, _) = randomR (0, length livingAis - 1) $ mkStdGen seed aiToReveal = livingAis !! indexOfAiToReveal tileToReveal = playerPosition aiToReveal boardWithReveal = map (\i -> if i == tileToReveal then EnemyHere i else NoInfo i) (board gameState) in updateGameBoard gameState damagedHuman (aiPlayers gameState) boardWithReveal
879
executeAiTurn :: GameState Int -> Int -> GameState (Clue Int) executeAiTurn gameState seed = let human = humanPlayer gameState dmg = length $ filter ((>0).playerHealth) $ aiPlayers gameState damagedHuman = damagePlayer human dmg livingAis = filter isAlive $ aiPlayers gameState (indexOfAiToReveal, _) = randomR (0, length livingAis - 1) $ mkStdGen seed aiToReveal = livingAis !! indexOfAiToReveal tileToReveal = playerPosition aiToReveal boardWithReveal = map (\i -> if i == tileToReveal then EnemyHere i else NoInfo i) (board gameState) in updateGameBoard gameState damagedHuman (aiPlayers gameState) boardWithReveal
879
executeAiTurn gameState seed = let human = humanPlayer gameState dmg = length $ filter ((>0).playerHealth) $ aiPlayers gameState damagedHuman = damagePlayer human dmg livingAis = filter isAlive $ aiPlayers gameState (indexOfAiToReveal, _) = randomR (0, length livingAis - 1) $ mkStdGen seed aiToReveal = livingAis !! indexOfAiToReveal tileToReveal = playerPosition aiToReveal boardWithReveal = map (\i -> if i == tileToReveal then EnemyHere i else NoInfo i) (board gameState) in updateGameBoard gameState damagedHuman (aiPlayers gameState) boardWithReveal
817
false
true
0
14
346
212
106
106
null
null
dysinger/amazonka
amazonka-ec2/gen/Network/AWS/EC2/Types.hs
mpl-2.0
-- | The status. issStatus :: Lens' InstanceStatusSummary (Maybe SummaryStatus) issStatus = lens _issStatus (\s a -> s { _issStatus = a })
138
issStatus :: Lens' InstanceStatusSummary (Maybe SummaryStatus) issStatus = lens _issStatus (\s a -> s { _issStatus = a })
121
issStatus = lens _issStatus (\s a -> s { _issStatus = a })
58
true
true
0
9
22
46
25
21
null
null
ctlab/gShell
src/Gshell/Run.hs
mit
findProjectRoot path = (path, undefined)
40
findProjectRoot path = (path, undefined)
40
findProjectRoot path = (path, undefined)
40
false
false
0
5
4
15
8
7
null
null
mcschroeder/ghc
compiler/prelude/TysPrim.hs
bsd-3-clause
smallArrayPrimTyCon = pcPrimTyCon smallArrayPrimTyConName [Representational] PtrRep
97
smallArrayPrimTyCon = pcPrimTyCon smallArrayPrimTyConName [Representational] PtrRep
97
smallArrayPrimTyCon = pcPrimTyCon smallArrayPrimTyConName [Representational] PtrRep
97
false
false
0
6
19
16
8
8
null
null
hdbc/hdbc-sqlite3
testsrc/Testbasics.hs
bsd-3-clause
testExecuteMany = dbTestCase (\dbh -> do sth <- prepare dbh "INSERT INTO hdbctest1 VALUES ('multi',?,?,?)" executeMany sth rows commit dbh sth <- prepare dbh "SELECT testid, testint, testtext FROM hdbctest1 WHERE testname = 'multi'" execute sth [] r <- fetchAllRows sth assertEqual "" rows r ) where rows = [map toSql ["1", "1234", "foo"], map toSql ["2", "1341", "bar"], [toSql "3", SqlNull, SqlNull]]
514
testExecuteMany = dbTestCase (\dbh -> do sth <- prepare dbh "INSERT INTO hdbctest1 VALUES ('multi',?,?,?)" executeMany sth rows commit dbh sth <- prepare dbh "SELECT testid, testint, testtext FROM hdbctest1 WHERE testname = 'multi'" execute sth [] r <- fetchAllRows sth assertEqual "" rows r ) where rows = [map toSql ["1", "1234", "foo"], map toSql ["2", "1341", "bar"], [toSql "3", SqlNull, SqlNull]]
514
testExecuteMany = dbTestCase (\dbh -> do sth <- prepare dbh "INSERT INTO hdbctest1 VALUES ('multi',?,?,?)" executeMany sth rows commit dbh sth <- prepare dbh "SELECT testid, testint, testtext FROM hdbctest1 WHERE testname = 'multi'" execute sth [] r <- fetchAllRows sth assertEqual "" rows r ) where rows = [map toSql ["1", "1234", "foo"], map toSql ["2", "1341", "bar"], [toSql "3", SqlNull, SqlNull]]
514
false
false
0
11
174
142
69
73
null
null
fredmorcos/attic
projects/pet/archive/pet_haskell_master_complete/Expense.hs
isc
allMonths :: [Expense] -> [(Month, Year)] allMonths l = unique $ map (\e -> (monthOf e, yearOf e)) l
100
allMonths :: [Expense] -> [(Month, Year)] allMonths l = unique $ map (\e -> (monthOf e, yearOf e)) l
100
allMonths l = unique $ map (\e -> (monthOf e, yearOf e)) l
58
false
true
0
10
18
59
32
27
null
null
verement/etamoo
src/MOO/Types.hs
bsd-3-clause
toBuilder' (Waf x) = TLB.fromString (show x)
44
toBuilder' (Waf x) = TLB.fromString (show x)
44
toBuilder' (Waf x) = TLB.fromString (show x)
44
false
false
0
7
6
26
12
14
null
null
castaway/pandoc
src/Text/Pandoc/Writers/ConTeXt.hs
gpl-2.0
-- | Convert inline element to ConTeXt inlineToConTeXt :: Inline -- ^ Inline to convert -> State WriterState Doc inlineToConTeXt (Emph lst) = do contents <- inlineListToConTeXt lst return $ braces $ "\\em " <> contents
242
inlineToConTeXt :: Inline -- ^ Inline to convert -> State WriterState Doc inlineToConTeXt (Emph lst) = do contents <- inlineListToConTeXt lst return $ braces $ "\\em " <> contents
203
inlineToConTeXt (Emph lst) = do contents <- inlineListToConTeXt lst return $ braces $ "\\em " <> contents
110
true
true
0
9
59
56
27
29
null
null
stevezhee/pec
src/PecGen.hs
bsd-3-clause
hModule :: FilePath -> P.Module -> H.Module hModule outdir (P.Module a bs cs hs ds es fs) = H.Module nl (ModuleName a) hPragmas Nothing (Just $ map hExport bs) (map hImport_ (["Pec.Base"] ++ [ "Cnt" ++ h | CountD h <- hs]) ++ map hImport cs) (mainD outdir a cs fs : map hDataDecl ds ++ map hInstD es ++ catMaybes (map hTyped ds) ++ catMaybes (map hTagged ds) ++ map hVarD fs)
405
hModule :: FilePath -> P.Module -> H.Module hModule outdir (P.Module a bs cs hs ds es fs) = H.Module nl (ModuleName a) hPragmas Nothing (Just $ map hExport bs) (map hImport_ (["Pec.Base"] ++ [ "Cnt" ++ h | CountD h <- hs]) ++ map hImport cs) (mainD outdir a cs fs : map hDataDecl ds ++ map hInstD es ++ catMaybes (map hTyped ds) ++ catMaybes (map hTagged ds) ++ map hVarD fs)
405
hModule outdir (P.Module a bs cs hs ds es fs) = H.Module nl (ModuleName a) hPragmas Nothing (Just $ map hExport bs) (map hImport_ (["Pec.Base"] ++ [ "Cnt" ++ h | CountD h <- hs]) ++ map hImport cs) (mainD outdir a cs fs : map hDataDecl ds ++ map hInstD es ++ catMaybes (map hTyped ds) ++ catMaybes (map hTagged ds) ++ map hVarD fs)
361
false
true
0
13
102
202
96
106
null
null
AlexanderPankiv/ghc
compiler/prelude/THNames.hs
bsd-3-clause
-- data InjectivityAnn = ... injectivityAnnName :: Name injectivityAnnName = libFun (fsLit "injectivityAnn") injectivityAnnIdKey
128
injectivityAnnName :: Name injectivityAnnName = libFun (fsLit "injectivityAnn") injectivityAnnIdKey
99
injectivityAnnName = libFun (fsLit "injectivityAnn") injectivityAnnIdKey
72
true
true
0
7
13
29
13
16
null
null
jsinglet/Paradox
src/TypeCheck.hs
gpl-3.0
checkFunctionAlreadyDefined :: Ident -> BlockStatement-> TCParserState Env () checkFunctionAlreadyDefined ident node = do cl <- currLevel found <- getIdentAtLevel ident cl case found of (Just _) -> throw (VarAlreadyDefined $ "Variable already defined: " ++ chomp (unparse node 0 "") ++ " [checkAlreadyDefined]") Nothing -> return ()
350
checkFunctionAlreadyDefined :: Ident -> BlockStatement-> TCParserState Env () checkFunctionAlreadyDefined ident node = do cl <- currLevel found <- getIdentAtLevel ident cl case found of (Just _) -> throw (VarAlreadyDefined $ "Variable already defined: " ++ chomp (unparse node 0 "") ++ " [checkAlreadyDefined]") Nothing -> return ()
350
checkFunctionAlreadyDefined ident node = do cl <- currLevel found <- getIdentAtLevel ident cl case found of (Just _) -> throw (VarAlreadyDefined $ "Variable already defined: " ++ chomp (unparse node 0 "") ++ " [checkAlreadyDefined]") Nothing -> return ()
272
false
true
0
16
64
111
52
59
null
null
Pold87/Haggressive
testsuite/tests/My.hs
gpl-2.0
testFrequency3 = H.frequency vec3 HU.~?= M.empty
48
testFrequency3 = H.frequency vec3 HU.~?= M.empty
48
testFrequency3 = H.frequency vec3 HU.~?= M.empty
48
false
false
0
7
5
19
9
10
null
null
snoyberg/ghc
compiler/hsSyn/HsExpr.hs
bsd-3-clause
isAtomicHsExpr (HsPar e) = isAtomicHsExpr (unLoc e)
59
isAtomicHsExpr (HsPar e) = isAtomicHsExpr (unLoc e)
59
isAtomicHsExpr (HsPar e) = isAtomicHsExpr (unLoc e)
59
false
false
0
7
14
24
11
13
null
null
geraldus/yesod
yesod-core/src/Yesod/Core/Handler.hs
mit
-- | Clear all session variables. -- -- @since: 1.0.1 clearSession :: MonadHandler m => m () clearSession = modify $ \x -> x { ghsSession = Map.empty }
151
clearSession :: MonadHandler m => m () clearSession = modify $ \x -> x { ghsSession = Map.empty }
97
clearSession = modify $ \x -> x { ghsSession = Map.empty }
58
true
true
0
9
28
45
25
20
null
null
ghcjs/jsaddle-dom
src/JSDOM/Generated/HTMLFrameElement.hs
mit
-- | <https://developer.mozilla.org/en-US/docs/Web/API/HTMLFrameElement.width Mozilla HTMLFrameElement.width documentation> getWidth :: (MonadDOM m) => HTMLFrameElement -> m Int getWidth self = liftDOM (round <$> ((self ^. js "width") >>= valToNumber))
255
getWidth :: (MonadDOM m) => HTMLFrameElement -> m Int getWidth self = liftDOM (round <$> ((self ^. js "width") >>= valToNumber))
130
getWidth self = liftDOM (round <$> ((self ^. js "width") >>= valToNumber))
76
true
true
0
12
29
63
31
32
null
null
egaburov/funstuff
Haskell/tytag/xproblem_src/samples/expressions/Haskell/FunctorialStyle/Functor.hs
apache-2.0
unIn (In x) = x
15
unIn (In x) = x
15
unIn (In x) = x
15
false
false
0
6
4
16
7
9
null
null
tidalcycles/tidal-midi
Sound/Tidal/MIDI/Blofeld.hs
gpl-3.0
(osc3detune, osc3detune_p) = pF "osc3detune" (Just 0)
53
(osc3detune, osc3detune_p) = pF "osc3detune" (Just 0)
53
(osc3detune, osc3detune_p) = pF "osc3detune" (Just 0)
53
false
false
0
7
6
24
12
12
null
null
fmthoma/ghc
compiler/main/HscMain.hs
bsd-3-clause
genericHscFrontend :: ModSummary -> Hsc TcGblEnv genericHscFrontend mod_summary = getHooked hscFrontendHook genericHscFrontend' >>= ($ mod_summary)
149
genericHscFrontend :: ModSummary -> Hsc TcGblEnv genericHscFrontend mod_summary = getHooked hscFrontendHook genericHscFrontend' >>= ($ mod_summary)
149
genericHscFrontend mod_summary = getHooked hscFrontendHook genericHscFrontend' >>= ($ mod_summary)
100
false
true
0
6
16
34
17
17
null
null
alanz/Blobs
lib/DData/IntMap.hs
lgpl-2.1
insertLookupWithKey :: (Key -> a -> a -> a) -> Key -> a -> IntMap a -> (Maybe a, IntMap a) insertLookupWithKey f k x t = case t of Bin p m l r | nomatch k p m -> (Nothing,join k (Tip k x) p t) | zero k m -> let (found,l') = insertLookupWithKey f k x l in (found,Bin p m l' r) | otherwise -> let (found,r') = insertLookupWithKey f k x r in (found,Bin p m l r') Tip ky y | k==ky -> (Just y,Tip k (f k x y)) | otherwise -> (Nothing,join k (Tip k x) ky t) Nil -> (Nothing,Tip k x) {-------------------------------------------------------------------- Deletion [delete] is the inlined version of [deleteWith (\k x -> Nothing)] --------------------------------------------------------------------} -- | /O(min(n,W))/. Delete a key and its value from the map. When the key is not -- a member of the map, the original map is returned.
915
insertLookupWithKey :: (Key -> a -> a -> a) -> Key -> a -> IntMap a -> (Maybe a, IntMap a) insertLookupWithKey f k x t = case t of Bin p m l r | nomatch k p m -> (Nothing,join k (Tip k x) p t) | zero k m -> let (found,l') = insertLookupWithKey f k x l in (found,Bin p m l' r) | otherwise -> let (found,r') = insertLookupWithKey f k x r in (found,Bin p m l r') Tip ky y | k==ky -> (Just y,Tip k (f k x y)) | otherwise -> (Nothing,join k (Tip k x) ky t) Nil -> (Nothing,Tip k x) {-------------------------------------------------------------------- Deletion [delete] is the inlined version of [deleteWith (\k x -> Nothing)] --------------------------------------------------------------------} -- | /O(min(n,W))/. Delete a key and its value from the map. When the key is not -- a member of the map, the original map is returned.
915
insertLookupWithKey f k x t = case t of Bin p m l r | nomatch k p m -> (Nothing,join k (Tip k x) p t) | zero k m -> let (found,l') = insertLookupWithKey f k x l in (found,Bin p m l' r) | otherwise -> let (found,r') = insertLookupWithKey f k x r in (found,Bin p m l r') Tip ky y | k==ky -> (Just y,Tip k (f k x y)) | otherwise -> (Nothing,join k (Tip k x) ky t) Nil -> (Nothing,Tip k x) {-------------------------------------------------------------------- Deletion [delete] is the inlined version of [deleteWith (\k x -> Nothing)] --------------------------------------------------------------------} -- | /O(min(n,W))/. Delete a key and its value from the map. When the key is not -- a member of the map, the original map is returned.
824
false
true
0
13
242
331
161
170
null
null
urbanslug/ghc
testsuite/tests/programs/andy_cherry/InterpUtils.hs
bsd-3-clause
findAMove :: Piece -> ExBoardPos -> ExBoardPos -> Board -> (String,Board) findAMove move_piece move_src move_dest brd@(Board arr mv _) = debug (move_txt,new_brd) where move_colour = getMoveColour mv debug = {- trace ( {- userFormat brd ++ -} userFormat (getMoveColour mv) ++ " (" ++ {- userFormat absmove ++ -} ")" ++ "\nALL :" ++ unwords (map userFormat all_moves) ++ "\nDEST :" ++ unwords (map userFormat correct_dest) ++ "\nSRC :" ++ unwords (map userFormat correct_move) ++ "\n") -} id all_moves = allValidMoves brd move_piece (const True) correct_dest = filter (compExBPandBP move_dest.extractDestFromPlayMove) all_moves correct_move = filter (compExBPandBP move_src.extractSrcFromPlayMove) correct_dest the_correct_move = if (length correct_move /= 1) then error ("\nAmbiguous move:" ++ show (unwords (map userFormat correct_move)) ++ ":" {- ++ userFormat absmove -} ++ "\n" ++ userFormat brd) else head correct_move disamb = case move_dest of (Just _,Nothing) -> "" -- fg => fxg4, no disambig. _ -> disAmb (extractSrcFromPlayMove the_correct_move) (map (extractSrcFromPlayMove) correct_dest) move_txt = createShortMove the_correct_move disamb brd corr_txt = userFormatBoardPos (extractSrcFromPlayMove the_correct_move) ++ userFormatBoardPos (extractDestFromPlayMove the_correct_move) {- queening -} new_brd = makeAMove brd the_correct_move --partain: findAMove _ _ _ brd = error ("strange move: ")
1,980
findAMove :: Piece -> ExBoardPos -> ExBoardPos -> Board -> (String,Board) findAMove move_piece move_src move_dest brd@(Board arr mv _) = debug (move_txt,new_brd) where move_colour = getMoveColour mv debug = {- trace ( {- userFormat brd ++ -} userFormat (getMoveColour mv) ++ " (" ++ {- userFormat absmove ++ -} ")" ++ "\nALL :" ++ unwords (map userFormat all_moves) ++ "\nDEST :" ++ unwords (map userFormat correct_dest) ++ "\nSRC :" ++ unwords (map userFormat correct_move) ++ "\n") -} id all_moves = allValidMoves brd move_piece (const True) correct_dest = filter (compExBPandBP move_dest.extractDestFromPlayMove) all_moves correct_move = filter (compExBPandBP move_src.extractSrcFromPlayMove) correct_dest the_correct_move = if (length correct_move /= 1) then error ("\nAmbiguous move:" ++ show (unwords (map userFormat correct_move)) ++ ":" {- ++ userFormat absmove -} ++ "\n" ++ userFormat brd) else head correct_move disamb = case move_dest of (Just _,Nothing) -> "" -- fg => fxg4, no disambig. _ -> disAmb (extractSrcFromPlayMove the_correct_move) (map (extractSrcFromPlayMove) correct_dest) move_txt = createShortMove the_correct_move disamb brd corr_txt = userFormatBoardPos (extractSrcFromPlayMove the_correct_move) ++ userFormatBoardPos (extractDestFromPlayMove the_correct_move) {- queening -} new_brd = makeAMove brd the_correct_move --partain: findAMove _ _ _ brd = error ("strange move: ")
1,978
findAMove move_piece move_src move_dest brd@(Board arr mv _) = debug (move_txt,new_brd) where move_colour = getMoveColour mv debug = {- trace ( {- userFormat brd ++ -} userFormat (getMoveColour mv) ++ " (" ++ {- userFormat absmove ++ -} ")" ++ "\nALL :" ++ unwords (map userFormat all_moves) ++ "\nDEST :" ++ unwords (map userFormat correct_dest) ++ "\nSRC :" ++ unwords (map userFormat correct_move) ++ "\n") -} id all_moves = allValidMoves brd move_piece (const True) correct_dest = filter (compExBPandBP move_dest.extractDestFromPlayMove) all_moves correct_move = filter (compExBPandBP move_src.extractSrcFromPlayMove) correct_dest the_correct_move = if (length correct_move /= 1) then error ("\nAmbiguous move:" ++ show (unwords (map userFormat correct_move)) ++ ":" {- ++ userFormat absmove -} ++ "\n" ++ userFormat brd) else head correct_move disamb = case move_dest of (Just _,Nothing) -> "" -- fg => fxg4, no disambig. _ -> disAmb (extractSrcFromPlayMove the_correct_move) (map (extractSrcFromPlayMove) correct_dest) move_txt = createShortMove the_correct_move disamb brd corr_txt = userFormatBoardPos (extractSrcFromPlayMove the_correct_move) ++ userFormatBoardPos (extractDestFromPlayMove the_correct_move) {- queening -} new_brd = makeAMove brd the_correct_move --partain: findAMove _ _ _ brd = error ("strange move: ")
1,867
false
true
1
16
761
314
160
154
null
null
rueshyna/gogol
gogol-servicemanagement/gen/Network/Google/ServiceManagement/Types/Product.hs
mpl-2.0
-- | Creates a value of 'DocumentationRule' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'drSelector' -- -- * 'drDeprecationDescription' -- -- * 'drDescription' documentationRule :: DocumentationRule documentationRule = DocumentationRule' { _drSelector = Nothing , _drDeprecationDescription = Nothing , _drDescription = Nothing }
441
documentationRule :: DocumentationRule documentationRule = DocumentationRule' { _drSelector = Nothing , _drDeprecationDescription = Nothing , _drDescription = Nothing }
192
documentationRule = DocumentationRule' { _drSelector = Nothing , _drDeprecationDescription = Nothing , _drDescription = Nothing }
149
true
true
0
6
84
40
28
12
null
null
databrary/databrary
src/Service/Notification.hs
agpl-3.0
triggerNotifications :: Maybe Period -> Notifications -> IO () triggerNotifications p Notifications{ notificationsTrigger = t } = write p where -- poor man's LVar: would be much simpler with a nested MVar, but then the reader is harder (and ours is dumb anyway) write x = do r <- tryPutMVar t x unless r $ do y <- tryTakeMVar t write $ maybe id max y x
376
triggerNotifications :: Maybe Period -> Notifications -> IO () triggerNotifications p Notifications{ notificationsTrigger = t } = write p where -- poor man's LVar: would be much simpler with a nested MVar, but then the reader is harder (and ours is dumb anyway) write x = do r <- tryPutMVar t x unless r $ do y <- tryTakeMVar t write $ maybe id max y x
376
triggerNotifications p Notifications{ notificationsTrigger = t } = write p where -- poor man's LVar: would be much simpler with a nested MVar, but then the reader is harder (and ours is dumb anyway) write x = do r <- tryPutMVar t x unless r $ do y <- tryTakeMVar t write $ maybe id max y x
313
false
true
3
12
90
108
48
60
null
null
GaloisInc/saw-script
cryptol-saw-core/src/Verifier/SAW/CryptolEnv.hs
bsd-3-clause
declareName :: (?fileReader :: FilePath -> IO ByteString) => CryptolEnv -> P.ModName -> String -> IO (T.Name, CryptolEnv) declareName env mname input = do let pname = P.mkUnqual (packIdent input) let modEnv = eModuleEnv env (cname, modEnv') <- liftModuleM modEnv $ MM.interactive $ MN.liftSupply (MN.mkDeclared C.NSValue (C.TopModule mname) MN.UserName (P.getIdent pname) Nothing P.emptyRange) let env' = env { eModuleEnv = modEnv' } return (cname, env')
476
declareName :: (?fileReader :: FilePath -> IO ByteString) => CryptolEnv -> P.ModName -> String -> IO (T.Name, CryptolEnv) declareName env mname input = do let pname = P.mkUnqual (packIdent input) let modEnv = eModuleEnv env (cname, modEnv') <- liftModuleM modEnv $ MM.interactive $ MN.liftSupply (MN.mkDeclared C.NSValue (C.TopModule mname) MN.UserName (P.getIdent pname) Nothing P.emptyRange) let env' = env { eModuleEnv = modEnv' } return (cname, env')
476
declareName env mname input = do let pname = P.mkUnqual (packIdent input) let modEnv = eModuleEnv env (cname, modEnv') <- liftModuleM modEnv $ MM.interactive $ MN.liftSupply (MN.mkDeclared C.NSValue (C.TopModule mname) MN.UserName (P.getIdent pname) Nothing P.emptyRange) let env' = env { eModuleEnv = modEnv' } return (cname, env')
350
false
true
0
14
86
191
95
96
null
null
meiersi/scyther-proof
src/Scyther/Message.hs
gpl-3.0
splitNonTrivial m = do guard (not $ trivial m) return m ------------------------------------------------------------------------------ -- ISAR Output ------------------------------------------------------------------------------ -- | Textual symbolic application of the substitution. -- TODO: Remove hack about thread identifier to state assignment.
368
splitNonTrivial m = do guard (not $ trivial m) return m ------------------------------------------------------------------------------ -- ISAR Output ------------------------------------------------------------------------------ -- | Textual symbolic application of the substitution. -- TODO: Remove hack about thread identifier to state assignment.
368
splitNonTrivial m = do guard (not $ trivial m) return m ------------------------------------------------------------------------------ -- ISAR Output ------------------------------------------------------------------------------ -- | Textual symbolic application of the substitution. -- TODO: Remove hack about thread identifier to state assignment.
368
false
false
0
10
52
36
18
18
null
null
tcoenraad/functioneel-programmeren
practica/serie1/6.my-list.hs
mit
myconcat :: [[n]] -> [n] myconcat [] = []
41
myconcat :: [[n]] -> [n] myconcat [] = []
41
myconcat [] = []
16
false
true
0
7
8
35
18
17
null
null
allegroCoder/scenco-1
Test.hs
bsd-3-clause
techLibPath :: FilePath techLibPath = (testPath </> "90nm.genlib")
66
techLibPath :: FilePath techLibPath = (testPath </> "90nm.genlib")
66
techLibPath = (testPath </> "90nm.genlib")
42
false
true
0
6
7
18
10
8
null
null
aelve/json-x
tests/Encoders.hs
bsd-3-clause
thApproxToJsonDefault :: Approx String -> Json thApproxToJsonDefault = $(mkToJson defaultOptions ''Approx)
106
thApproxToJsonDefault :: Approx String -> Json thApproxToJsonDefault = $(mkToJson defaultOptions ''Approx)
106
thApproxToJsonDefault = $(mkToJson defaultOptions ''Approx)
59
false
true
0
8
10
29
14
15
null
null
dawedawe/kripkeweb
src/WebSpider.hs
bsd-3-clause
spider :: Maybe Proxy -> Int -> (S.Set T.Text, S.Set OneToN) -> T.Text -> IO (S.Set T.Text, S.Set OneToN) spider prx i (v, aSets) u | transparentUrls dom `S.intersection` v /= S.empty = do putStrLn ("already visited " ++ T.unpack dom) return (v, aSets) | i == 1 = do as <- accessabilitySet prx u return (S.insert dom v, S.insert as aSets) | i > 1 = do as <- accessabilitySet prx u let v' = S.insert dom v let aSets' = S.insert as aSets foldlM (spider prx (pred i)) (v', aSets') (S.toList (nEntities as)) | otherwise = error "spider: undefined arguments" where dom = getDomainAsText u -- |Higher Order version of spider. Apply given function to every -- accessabilitySet while spidering. Return Set of visited domains. -- Don't visit any part of a domain a second time.
983
spider :: Maybe Proxy -> Int -> (S.Set T.Text, S.Set OneToN) -> T.Text -> IO (S.Set T.Text, S.Set OneToN) spider prx i (v, aSets) u | transparentUrls dom `S.intersection` v /= S.empty = do putStrLn ("already visited " ++ T.unpack dom) return (v, aSets) | i == 1 = do as <- accessabilitySet prx u return (S.insert dom v, S.insert as aSets) | i > 1 = do as <- accessabilitySet prx u let v' = S.insert dom v let aSets' = S.insert as aSets foldlM (spider prx (pred i)) (v', aSets') (S.toList (nEntities as)) | otherwise = error "spider: undefined arguments" where dom = getDomainAsText u -- |Higher Order version of spider. Apply given function to every -- accessabilitySet while spidering. Return Set of visited domains. -- Don't visit any part of a domain a second time.
983
spider prx i (v, aSets) u | transparentUrls dom `S.intersection` v /= S.empty = do putStrLn ("already visited " ++ T.unpack dom) return (v, aSets) | i == 1 = do as <- accessabilitySet prx u return (S.insert dom v, S.insert as aSets) | i > 1 = do as <- accessabilitySet prx u let v' = S.insert dom v let aSets' = S.insert as aSets foldlM (spider prx (pred i)) (v', aSets') (S.toList (nEntities as)) | otherwise = error "spider: undefined arguments" where dom = getDomainAsText u -- |Higher Order version of spider. Apply given function to every -- accessabilitySet while spidering. Return Set of visited domains. -- Don't visit any part of a domain a second time.
867
false
true
2
13
352
330
154
176
null
null
paf31/typescript-docs
src/Main.hs
mit
inputFiles :: Term [FilePath] inputFiles = nonEmpty $ posAny [] $ posInfo { posDoc = "The input .d.ts file" }
114
inputFiles :: Term [FilePath] inputFiles = nonEmpty $ posAny [] $ posInfo { posDoc = "The input .d.ts file" }
114
inputFiles = nonEmpty $ posAny [] $ posInfo { posDoc = "The input .d.ts file" }
84
false
true
0
8
24
42
21
21
null
null
facebookincubator/duckling
Duckling/Time/BG/Rules.hs
bsd-3-clause
ruleNthTimeAfterTime :: Rule ruleNthTimeAfterTime = Rule { name = "nth <time> after <time>" , pattern = [ dimension Ordinal , dimension Time , regex "след|от" , dimension Time ] , prod = \case (Token Ordinal od:Token Time td1:_:Token Time td2:_) -> tt $ predNthAfter (TOrdinal.value od - 1) td1 td2 _ -> Nothing }
361
ruleNthTimeAfterTime :: Rule ruleNthTimeAfterTime = Rule { name = "nth <time> after <time>" , pattern = [ dimension Ordinal , dimension Time , regex "след|от" , dimension Time ] , prod = \case (Token Ordinal od:Token Time td1:_:Token Time td2:_) -> tt $ predNthAfter (TOrdinal.value od - 1) td1 td2 _ -> Nothing }
361
ruleNthTimeAfterTime = Rule { name = "nth <time> after <time>" , pattern = [ dimension Ordinal , dimension Time , regex "след|от" , dimension Time ] , prod = \case (Token Ordinal od:Token Time td1:_:Token Time td2:_) -> tt $ predNthAfter (TOrdinal.value od - 1) td1 td2 _ -> Nothing }
332
false
true
0
16
101
130
66
64
null
null
spechub/Hets
Maude/Maude2DG.hs
gpl-2.0
insertSpecs (s : ss) pdg ptim tim vm ths dg = insertSpecs ss pdg ptim' tim' vm' ths' dg' where (ptim', tim', vm', ths', dg') = insertSpec s pdg ptim tim vm ths dg
166
insertSpecs (s : ss) pdg ptim tim vm ths dg = insertSpecs ss pdg ptim' tim' vm' ths' dg' where (ptim', tim', vm', ths', dg') = insertSpec s pdg ptim tim vm ths dg
166
insertSpecs (s : ss) pdg ptim tim vm ths dg = insertSpecs ss pdg ptim' tim' vm' ths' dg' where (ptim', tim', vm', ths', dg') = insertSpec s pdg ptim tim vm ths dg
166
false
false
0
7
37
81
42
39
null
null
mdunsmuir/routequery-service
src/Com/Google/Transit/Realtime/Alert/Cause.hs
gpl-3.0
toMaybe'Enum 12 = Prelude'.Just MEDICAL_EMERGENCY
49
toMaybe'Enum 12 = Prelude'.Just MEDICAL_EMERGENCY
49
toMaybe'Enum 12 = Prelude'.Just MEDICAL_EMERGENCY
49
false
false
0
6
4
14
6
8
null
null
phischu/fragnix
builtins/base/System.Environment.hs
bsd-3-clause
{-| 'withArgs' @args act@ - while executing action @act@, have 'getArgs' return @args@. -} withArgs :: [String] -> IO a -> IO a withArgs xs act = do p <- System.Environment.getProgName withArgv (p:xs) act {-| 'withProgName' @name act@ - while executing action @act@, have 'getProgName' return @name@. -}
310
withArgs :: [String] -> IO a -> IO a withArgs xs act = do p <- System.Environment.getProgName withArgv (p:xs) act {-| 'withProgName' @name act@ - while executing action @act@, have 'getProgName' return @name@. -}
219
withArgs xs act = do p <- System.Environment.getProgName withArgv (p:xs) act {-| 'withProgName' @name act@ - while executing action @act@, have 'getProgName' return @name@. -}
182
true
true
0
9
54
60
30
30
null
null
portnov/simple-stacked-vm
Language/SSVM/Interpreter.hs
lgpl-3.0
interpretOne _ (SString x) = push x >> step
44
interpretOne _ (SString x) = push x >> step
44
interpretOne _ (SString x) = push x >> step
44
false
false
1
6
9
27
11
16
null
null
jspahrsummers/RxHaskell
Disposable.hs
mit
-- | Creates a set of disposables. newDisposableSet :: IO DisposableSet newDisposableSet = do mref <- newIORef $ Just Seq.empty return $ DisposableSet mref -- | Converts a set of disposables into a disposable. -- The constructed disposable will dispose of all disposables in the set.
294
newDisposableSet :: IO DisposableSet newDisposableSet = do mref <- newIORef $ Just Seq.empty return $ DisposableSet mref -- | Converts a set of disposables into a disposable. -- The constructed disposable will dispose of all disposables in the set.
259
newDisposableSet = do mref <- newIORef $ Just Seq.empty return $ DisposableSet mref -- | Converts a set of disposables into a disposable. -- The constructed disposable will dispose of all disposables in the set.
222
true
true
0
10
56
43
21
22
null
null
black0range/BufferedSocket
Network/BufferedSocket/Writer.hs
mit
sendLazy :: BS.BufferedSocket -> BL.ByteString -> IO () sendLazy bSocket lazyBytestring = sendLazyReal bSocket $ BL.toChunks lazyBytestring
139
sendLazy :: BS.BufferedSocket -> BL.ByteString -> IO () sendLazy bSocket lazyBytestring = sendLazyReal bSocket $ BL.toChunks lazyBytestring
139
sendLazy bSocket lazyBytestring = sendLazyReal bSocket $ BL.toChunks lazyBytestring
83
false
true
0
8
16
45
21
24
null
null
sitewisely/zellige
src/Data/Geometry/GeoJsonStreamingToMvt.hs
apache-2.0
vtToBytes :: TypesConfig.Config -> TypesMvtFeatures.StreamingLayer -> ByteString.ByteString vtToBytes config sl = ByteStringLazy.toStrict . WireMessage.messagePut $ createTileFromStreamingLayer config sl
203
vtToBytes :: TypesConfig.Config -> TypesMvtFeatures.StreamingLayer -> ByteString.ByteString vtToBytes config sl = ByteStringLazy.toStrict . WireMessage.messagePut $ createTileFromStreamingLayer config sl
203
vtToBytes config sl = ByteStringLazy.toStrict . WireMessage.messagePut $ createTileFromStreamingLayer config sl
111
false
true
0
7
17
47
23
24
null
null
SumAll/haskell-concurrent-lists
src/Control/Concurrent/ConcurrentLists.hs
apache-2.0
concurrentN_ :: Int -> [IO a] -> IO () concurrentN_ n = -- we could probably be more memory efficient here. void . concurrentN n
132
concurrentN_ :: Int -> [IO a] -> IO () concurrentN_ n = -- we could probably be more memory efficient here. void . concurrentN n
132
concurrentN_ n = -- we could probably be more memory efficient here. void . concurrentN n
93
false
true
1
8
28
42
20
22
null
null
haroldcarr/learn-haskell-coq-ml-etc
haskell/course/2014-10-edx-delft-fp101x-intro-to-fp-erik-meijer/lab6.hs
unlicense
num2 = mappend (Sum 3) (mappend mempty (mappend (mappend (mappend (Sum 2) mempty) (Sum (-1))) (Sum 3)))
103
num2 = mappend (Sum 3) (mappend mempty (mappend (mappend (mappend (Sum 2) mempty) (Sum (-1))) (Sum 3)))
103
num2 = mappend (Sum 3) (mappend mempty (mappend (mappend (mappend (Sum 2) mempty) (Sum (-1))) (Sum 3)))
103
false
false
0
15
16
72
36
36
null
null
uduki/hsQt
Qtc/ClassTypes/Opengl.hs
bsd-2-clause
qCast_QGL :: Object a -> IO (QGL ()) qCast_QGL _qobj = return (objectCast _qobj)
82
qCast_QGL :: Object a -> IO (QGL ()) qCast_QGL _qobj = return (objectCast _qobj)
82
qCast_QGL _qobj = return (objectCast _qobj)
45
false
true
0
10
15
46
20
26
null
null
mapinguari/SC_HS_Proxy
src/Hope.hs
mit
astarF' :: (WeightedGraph g b, Real b) => g a b -> Node -> Heuristic b -> [(Node,Maybe Node)] astarF' g s h = loop (adjaWeights g) h (decrease (s,(F 0,Nothing)) q0) where q0 = fromList [v :-> (Inf,Nothing) | v <- nodes g]
223
astarF' :: (WeightedGraph g b, Real b) => g a b -> Node -> Heuristic b -> [(Node,Maybe Node)] astarF' g s h = loop (adjaWeights g) h (decrease (s,(F 0,Nothing)) q0) where q0 = fromList [v :-> (Inf,Nothing) | v <- nodes g]
223
astarF' g s h = loop (adjaWeights g) h (decrease (s,(F 0,Nothing)) q0) where q0 = fromList [v :-> (Inf,Nothing) | v <- nodes g]
129
false
true
0
11
45
138
71
67
null
null
xpika/chord-diagrams
Music/Instrument/Backend/Diagrams/Guitar.hs
gpl-3.0
dotGrid = foldr1 (|||) (map vdots (zip ( map (map show) (frettedGuitarStrings standardTuning) ) [0..]) )
104
dotGrid = foldr1 (|||) (map vdots (zip ( map (map show) (frettedGuitarStrings standardTuning) ) [0..]) )
104
dotGrid = foldr1 (|||) (map vdots (zip ( map (map show) (frettedGuitarStrings standardTuning) ) [0..]) )
104
false
false
1
13
15
55
27
28
null
null
leshchevds/ganeti
src/Ganeti/HTools/Loader.hs
bsd-2-clause
-- | Update instance with desired location tags list. updateDesiredLocationTags :: [String] -> Instance.Instance -> Instance.Instance updateDesiredLocationTags tl inst = let allTags = Instance.allTags inst dsrdLocTags = filter (\tag -> any (`isPrefixOf` tag) tl) allTags in inst { Instance.dsrdLocTags = Set.fromList dsrdLocTags }
340
updateDesiredLocationTags :: [String] -> Instance.Instance -> Instance.Instance updateDesiredLocationTags tl inst = let allTags = Instance.allTags inst dsrdLocTags = filter (\tag -> any (`isPrefixOf` tag) tl) allTags in inst { Instance.dsrdLocTags = Set.fromList dsrdLocTags }
286
updateDesiredLocationTags tl inst = let allTags = Instance.allTags inst dsrdLocTags = filter (\tag -> any (`isPrefixOf` tag) tl) allTags in inst { Instance.dsrdLocTags = Set.fromList dsrdLocTags }
206
true
true
0
13
52
92
49
43
null
null
ozgurakgun/Idris-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
defined :: PDecl -> [Name] defined (PFix _ _ _) = []
81
defined :: PDecl -> [Name] defined (PFix _ _ _) = []
81
defined (PFix _ _ _) = []
54
false
true
0
6
40
37
18
19
null
null
AlexeyRaga/eta
compiler/ETA/Prelude/PrelNames.hs
bsd-3-clause
unmarshalStringIdKey = mkPreludeMiscIdUnique 153
57
unmarshalStringIdKey = mkPreludeMiscIdUnique 153
57
unmarshalStringIdKey = mkPreludeMiscIdUnique 153
57
false
false
0
5
12
9
4
5
null
null
mplamann/magic-spieler
src/CardSelector.hs
mit
selectType :: Type -> CardSelector selectType t _ = pred where pred (CardTarget cID) = use (nonRecursiveCard cID) >>= \c -> return (t `elem` c^.cardType) pred (PlayerTarget _) = return False
210
selectType :: Type -> CardSelector selectType t _ = pred where pred (CardTarget cID) = use (nonRecursiveCard cID) >>= \c -> return (t `elem` c^.cardType) pred (PlayerTarget _) = return False
210
selectType t _ = pred where pred (CardTarget cID) = use (nonRecursiveCard cID) >>= \c -> return (t `elem` c^.cardType) pred (PlayerTarget _) = return False
175
false
true
1
10
50
86
44
42
null
null
amccausl/Swish
Swish/HaskellRDF/RDFGraphTest.hs
lgpl-2.1
testClass78 = testClass "testClass78" isBlank cm1 False
64
testClass78 = testClass "testClass78" isBlank cm1 False
64
testClass78 = testClass "testClass78" isBlank cm1 False
64
false
false
0
5
15
15
7
8
null
null
acowley/ghc
compiler/typecheck/TcType.hs
bsd-3-clause
isRhoTy (ForAllTy {}) = False
29
isRhoTy (ForAllTy {}) = False
29
isRhoTy (ForAllTy {}) = False
29
false
false
0
6
4
17
8
9
null
null
nevrenato/HetsAlloy
VSE/Prove.hs
gpl-2.0
parseSymbol :: Parser SExpr parseSymbol = skipWhite $ fmap SSymbol $ many1 $ satisfy $ \ c -> not (isSpace c || elem c "()")
126
parseSymbol :: Parser SExpr parseSymbol = skipWhite $ fmap SSymbol $ many1 $ satisfy $ \ c -> not (isSpace c || elem c "()")
126
parseSymbol = skipWhite $ fmap SSymbol $ many1 $ satisfy $ \ c -> not (isSpace c || elem c "()")
98
false
true
2
10
26
57
27
30
null
null
twittner/cql-io
src/Database/CQL/IO/Jobs.hs
mpl-2.0
destroy :: MonadIO m => Jobs k -> m () destroy (Jobs d) = liftIO $ do items <- Map.elems <$> atomically (swapTVar d Map.empty) mapM_ f items where f (Running _ a) = ignore (cancel a) f _ = return ()
228
destroy :: MonadIO m => Jobs k -> m () destroy (Jobs d) = liftIO $ do items <- Map.elems <$> atomically (swapTVar d Map.empty) mapM_ f items where f (Running _ a) = ignore (cancel a) f _ = return ()
228
destroy (Jobs d) = liftIO $ do items <- Map.elems <$> atomically (swapTVar d Map.empty) mapM_ f items where f (Running _ a) = ignore (cancel a) f _ = return ()
189
false
true
0
13
71
120
54
66
null
null
candu/haskellbook
ch12/binaryTree.hs
mit
main :: IO () main = do print $ treeBuild 2
45
main :: IO () main = do print $ treeBuild 2
45
main = do print $ treeBuild 2
31
false
true
0
8
12
26
12
14
null
null
Skyfold/postgrest
src/PostgREST/DbRequestBuilder.hs
mit
readRequest :: Maybe Integer -> [Relation] -> M.HashMap Text ProcDescription -> ApiRequest -> Either Response ReadRequest readRequest maxRows allRels allProcs apiRequest = mapLeft apiRequestError $ treeRestrictRange maxRows =<< augumentRequestWithJoin schema relations =<< parseReadRequest where (schema, rootTableName) = fromJust $ -- Make it safe let target = iTarget apiRequest in case target of (TargetIdent (QualifiedIdentifier s t) ) -> Just (s, t) (TargetProc (QualifiedIdentifier s proc) ) -> Just (s, tName) where retType = pdReturnType <$> M.lookup proc allProcs tName = case retType of Just (SetOf (Composite qi)) -> qiName qi Just (Single (Composite qi)) -> qiName qi _ -> proc _ -> Nothing action :: Action action = iAction apiRequest parseReadRequest :: Either ApiRequestError ReadRequest parseReadRequest = addFiltersOrdersRanges apiRequest <*> pRequestSelect rootName selStr where selStr = iSelect apiRequest rootName = if action == ActionRead then rootTableName else sourceCTEName relations :: [Relation] relations = case action of ActionCreate -> fakeSourceRelations ++ allRels ActionUpdate -> fakeSourceRelations ++ allRels ActionDelete -> fakeSourceRelations ++ allRels ActionInvoke -> fakeSourceRelations ++ allRels _ -> allRels where fakeSourceRelations = mapMaybe (toSourceRelation rootTableName) allRels -- see comment in toSourceRelation
1,608
readRequest :: Maybe Integer -> [Relation] -> M.HashMap Text ProcDescription -> ApiRequest -> Either Response ReadRequest readRequest maxRows allRels allProcs apiRequest = mapLeft apiRequestError $ treeRestrictRange maxRows =<< augumentRequestWithJoin schema relations =<< parseReadRequest where (schema, rootTableName) = fromJust $ -- Make it safe let target = iTarget apiRequest in case target of (TargetIdent (QualifiedIdentifier s t) ) -> Just (s, t) (TargetProc (QualifiedIdentifier s proc) ) -> Just (s, tName) where retType = pdReturnType <$> M.lookup proc allProcs tName = case retType of Just (SetOf (Composite qi)) -> qiName qi Just (Single (Composite qi)) -> qiName qi _ -> proc _ -> Nothing action :: Action action = iAction apiRequest parseReadRequest :: Either ApiRequestError ReadRequest parseReadRequest = addFiltersOrdersRanges apiRequest <*> pRequestSelect rootName selStr where selStr = iSelect apiRequest rootName = if action == ActionRead then rootTableName else sourceCTEName relations :: [Relation] relations = case action of ActionCreate -> fakeSourceRelations ++ allRels ActionUpdate -> fakeSourceRelations ++ allRels ActionDelete -> fakeSourceRelations ++ allRels ActionInvoke -> fakeSourceRelations ++ allRels _ -> allRels where fakeSourceRelations = mapMaybe (toSourceRelation rootTableName) allRels -- see comment in toSourceRelation
1,608
readRequest maxRows allRels allProcs apiRequest = mapLeft apiRequestError $ treeRestrictRange maxRows =<< augumentRequestWithJoin schema relations =<< parseReadRequest where (schema, rootTableName) = fromJust $ -- Make it safe let target = iTarget apiRequest in case target of (TargetIdent (QualifiedIdentifier s t) ) -> Just (s, t) (TargetProc (QualifiedIdentifier s proc) ) -> Just (s, tName) where retType = pdReturnType <$> M.lookup proc allProcs tName = case retType of Just (SetOf (Composite qi)) -> qiName qi Just (Single (Composite qi)) -> qiName qi _ -> proc _ -> Nothing action :: Action action = iAction apiRequest parseReadRequest :: Either ApiRequestError ReadRequest parseReadRequest = addFiltersOrdersRanges apiRequest <*> pRequestSelect rootName selStr where selStr = iSelect apiRequest rootName = if action == ActionRead then rootTableName else sourceCTEName relations :: [Relation] relations = case action of ActionCreate -> fakeSourceRelations ++ allRels ActionUpdate -> fakeSourceRelations ++ allRels ActionDelete -> fakeSourceRelations ++ allRels ActionInvoke -> fakeSourceRelations ++ allRels _ -> allRels where fakeSourceRelations = mapMaybe (toSourceRelation rootTableName) allRels -- see comment in toSourceRelation
1,486
false
true
1
20
426
429
208
221
null
null
sdiehl/ghc
compiler/prelude/THNames.hs
bsd-3-clause
{- ********************************************************************* * * Id keys * * ********************************************************************* -} -- IdUniques available: 200-499 -- If you want to change this, make sure you check in PrelNames returnQIdKey, bindQIdKey, sequenceQIdKey, liftIdKey, newNameIdKey, mkNameIdKey, mkNameG_vIdKey, mkNameG_dIdKey, mkNameG_tcIdKey, mkNameLIdKey, mkNameSIdKey, unTypeIdKey, unTypeQIdKey, unsafeTExpCoerceIdKey, liftTypedIdKey :: Unique returnQIdKey = mkPreludeMiscIdUnique 200
710
returnQIdKey, bindQIdKey, sequenceQIdKey, liftIdKey, newNameIdKey, mkNameIdKey, mkNameG_vIdKey, mkNameG_dIdKey, mkNameG_tcIdKey, mkNameLIdKey, mkNameSIdKey, unTypeIdKey, unTypeQIdKey, unsafeTExpCoerceIdKey, liftTypedIdKey :: Unique returnQIdKey = mkPreludeMiscIdUnique 200
291
returnQIdKey = mkPreludeMiscIdUnique 200
47
true
true
0
5
227
45
38
7
null
null
andyhorng/phpns
src/Parser.hs
mit
parseStatement :: Parser Statement parseStatement = parseNamespace <|> parseUse <|> parseClass
123
parseStatement :: Parser Statement parseStatement = parseNamespace <|> parseUse <|> parseClass
123
parseStatement = parseNamespace <|> parseUse <|> parseClass
88
false
true
0
6
39
22
11
11
null
null
kelnage/tamarin-prover
lib/theory/src/Theory/Constraint/Solver/Contradictions.hs
gpl-3.0
-- | All CR-rules reducing a constraint system to *⟂* represented as a list of -- trivial contradictions. Note that some constraint systems are also removed -- because they have no unifier. This is part of unification. Note also that -- *S_{¬,\@}* is handled as part of *S_∀*. contradictions :: ProofContext -> System -> [Contradiction] contradictions ctxt sys = F.asum -- CR-rule ** [ guard (D.cyclic $ rawLessRel sys) *> pure Cyclic -- CR-rule *N1* , guard (hasNonNormalTerms sig sys) *> pure NonNormalTerms -- FIXME: add CR-rule , guard (hasForbiddenKD sys) *> pure ForbiddenKD -- FIXME: add CR-rule , guard (hasImpossibleChain ctxt sys) *> pure ImpossibleChain -- CR-rule *N7* , guard (enableDH msig && hasForbiddenExp sys) *> pure ForbiddenExp -- FIXME: add CR-rule , guard (enableBP msig && hasForbiddenBP sys) *> pure ForbiddenBP -- New CR-Rule *N6'* , guard (hasForbiddenChain sys) *> pure ForbiddenChain -- CR-rules *S_≐* and *S_≈* are implemented via the equation store , guard (eqsIsFalse $ L.get sEqStore sys) *> pure IncompatibleEqs -- CR-rules *S_⟂*, *S_{¬,last,1}*, *S_{¬,≐}*, *S_{¬,≈}* , guard (S.member gfalse $ L.get sFormulas sys) *> pure FormulasFalse ] ++ -- This rule is not yet documented. It removes constraint systems that -- require a unique fact to be present in the system state more than once. -- Unique facts are declared as part of the specification of the rule -- system. (NonInjectiveFactInstance <$> nonInjectiveFactInstances ctxt sys) ++ -- TODO: Document corresponding constraint reduction rule. (NodeAfterLast <$> nodesAfterLast sys) where sig = L.get pcSignature ctxt msig = mhMaudeSig . L.get pcMaudeHandle $ ctxt -- | New normal form condition: -- We do not allow @KD(t)@ facts if @t@ does not contain -- any fresh names or private functions.
1,984
contradictions :: ProofContext -> System -> [Contradiction] contradictions ctxt sys = F.asum -- CR-rule ** [ guard (D.cyclic $ rawLessRel sys) *> pure Cyclic -- CR-rule *N1* , guard (hasNonNormalTerms sig sys) *> pure NonNormalTerms -- FIXME: add CR-rule , guard (hasForbiddenKD sys) *> pure ForbiddenKD -- FIXME: add CR-rule , guard (hasImpossibleChain ctxt sys) *> pure ImpossibleChain -- CR-rule *N7* , guard (enableDH msig && hasForbiddenExp sys) *> pure ForbiddenExp -- FIXME: add CR-rule , guard (enableBP msig && hasForbiddenBP sys) *> pure ForbiddenBP -- New CR-Rule *N6'* , guard (hasForbiddenChain sys) *> pure ForbiddenChain -- CR-rules *S_≐* and *S_≈* are implemented via the equation store , guard (eqsIsFalse $ L.get sEqStore sys) *> pure IncompatibleEqs -- CR-rules *S_⟂*, *S_{¬,last,1}*, *S_{¬,≐}*, *S_{¬,≈}* , guard (S.member gfalse $ L.get sFormulas sys) *> pure FormulasFalse ] ++ -- This rule is not yet documented. It removes constraint systems that -- require a unique fact to be present in the system state more than once. -- Unique facts are declared as part of the specification of the rule -- system. (NonInjectiveFactInstance <$> nonInjectiveFactInstances ctxt sys) ++ -- TODO: Document corresponding constraint reduction rule. (NodeAfterLast <$> nodesAfterLast sys) where sig = L.get pcSignature ctxt msig = mhMaudeSig . L.get pcMaudeHandle $ ctxt -- | New normal form condition: -- We do not allow @KD(t)@ facts if @t@ does not contain -- any fresh names or private functions.
1,707
contradictions ctxt sys = F.asum -- CR-rule ** [ guard (D.cyclic $ rawLessRel sys) *> pure Cyclic -- CR-rule *N1* , guard (hasNonNormalTerms sig sys) *> pure NonNormalTerms -- FIXME: add CR-rule , guard (hasForbiddenKD sys) *> pure ForbiddenKD -- FIXME: add CR-rule , guard (hasImpossibleChain ctxt sys) *> pure ImpossibleChain -- CR-rule *N7* , guard (enableDH msig && hasForbiddenExp sys) *> pure ForbiddenExp -- FIXME: add CR-rule , guard (enableBP msig && hasForbiddenBP sys) *> pure ForbiddenBP -- New CR-Rule *N6'* , guard (hasForbiddenChain sys) *> pure ForbiddenChain -- CR-rules *S_≐* and *S_≈* are implemented via the equation store , guard (eqsIsFalse $ L.get sEqStore sys) *> pure IncompatibleEqs -- CR-rules *S_⟂*, *S_{¬,last,1}*, *S_{¬,≐}*, *S_{¬,≈}* , guard (S.member gfalse $ L.get sFormulas sys) *> pure FormulasFalse ] ++ -- This rule is not yet documented. It removes constraint systems that -- require a unique fact to be present in the system state more than once. -- Unique facts are declared as part of the specification of the rule -- system. (NonInjectiveFactInstance <$> nonInjectiveFactInstances ctxt sys) ++ -- TODO: Document corresponding constraint reduction rule. (NodeAfterLast <$> nodesAfterLast sys) where sig = L.get pcSignature ctxt msig = mhMaudeSig . L.get pcMaudeHandle $ ctxt -- | New normal form condition: -- We do not allow @KD(t)@ facts if @t@ does not contain -- any fresh names or private functions.
1,647
true
true
1
14
483
333
170
163
null
null
bitemyapp/Haskell-Turtle-Library
src/Turtle/Prelude.hs
bsd-3-clause
-- | Retrieve all environment variables env :: MonadIO io => io [(Text, Text)] env = liftIO (fmap (fmap toTexts) getEnvironment) where toTexts (key, val) = (pack key, pack val) -- | Change the current directory
217
env :: MonadIO io => io [(Text, Text)] env = liftIO (fmap (fmap toTexts) getEnvironment) where toTexts (key, val) = (pack key, pack val) -- | Change the current directory
177
env = liftIO (fmap (fmap toTexts) getEnvironment) where toTexts (key, val) = (pack key, pack val) -- | Change the current directory
138
true
true
0
9
42
84
42
42
null
null
Teaspot-Studio/netwire
Control/Wire/Event.hs
bsd-3-clause
takeE n = fix $ \again -> mkSFN $ \mev -> (mev, if occurred mev then takeE (pred n) else again)
111
takeE n = fix $ \again -> mkSFN $ \mev -> (mev, if occurred mev then takeE (pred n) else again)
111
takeE n = fix $ \again -> mkSFN $ \mev -> (mev, if occurred mev then takeE (pred n) else again)
111
false
false
0
13
36
53
28
25
null
null
sdiehl/ghc
utils/genapply/Main.hs
bsd-3-clause
mkBitmap :: [ArgRep] -> Word32 mkBitmap args = foldr f 0 args where f arg bm | isPtr arg = bm `shiftL` 1 | otherwise = (bm `shiftL` size) .|. ((1 `shiftL` size) - 1) where size = argSize arg -- ----------------------------------------------------------------------------- -- Generating the application functions -- A SUBTLE POINT about stg_ap functions (can't think of a better -- place to put this comment --SDM): -- -- The entry convention to an stg_ap_ function is as follows: all the -- arguments are on the stack (we might revisit this at some point, -- but it doesn't make any difference on x86), and THERE IS AN EXTRA -- EMPTY STACK SLOT at the top of the stack. -- -- Why? Because in several cases, stg_ap_* will need an extra stack -- slot, eg. to push a return address in the THUNK case, and this is a -- way of pushing the stack check up into the caller which is probably -- doing one anyway. Allocating the extra stack slot in the caller is -- also probably free, because it will be adjusting Sp after pushing -- the args anyway (this might not be true of register-rich machines -- when we start passing args to stg_ap_* in regs).
1,179
mkBitmap :: [ArgRep] -> Word32 mkBitmap args = foldr f 0 args where f arg bm | isPtr arg = bm `shiftL` 1 | otherwise = (bm `shiftL` size) .|. ((1 `shiftL` size) - 1) where size = argSize arg -- ----------------------------------------------------------------------------- -- Generating the application functions -- A SUBTLE POINT about stg_ap functions (can't think of a better -- place to put this comment --SDM): -- -- The entry convention to an stg_ap_ function is as follows: all the -- arguments are on the stack (we might revisit this at some point, -- but it doesn't make any difference on x86), and THERE IS AN EXTRA -- EMPTY STACK SLOT at the top of the stack. -- -- Why? Because in several cases, stg_ap_* will need an extra stack -- slot, eg. to push a return address in the THUNK case, and this is a -- way of pushing the stack check up into the caller which is probably -- doing one anyway. Allocating the extra stack slot in the caller is -- also probably free, because it will be adjusting Sp after pushing -- the args anyway (this might not be true of register-rich machines -- when we start passing args to stg_ap_* in regs).
1,179
mkBitmap args = foldr f 0 args where f arg bm | isPtr arg = bm `shiftL` 1 | otherwise = (bm `shiftL` size) .|. ((1 `shiftL` size) - 1) where size = argSize arg -- ----------------------------------------------------------------------------- -- Generating the application functions -- A SUBTLE POINT about stg_ap functions (can't think of a better -- place to put this comment --SDM): -- -- The entry convention to an stg_ap_ function is as follows: all the -- arguments are on the stack (we might revisit this at some point, -- but it doesn't make any difference on x86), and THERE IS AN EXTRA -- EMPTY STACK SLOT at the top of the stack. -- -- Why? Because in several cases, stg_ap_* will need an extra stack -- slot, eg. to push a return address in the THUNK case, and this is a -- way of pushing the stack check up into the caller which is probably -- doing one anyway. Allocating the extra stack slot in the caller is -- also probably free, because it will be adjusting Sp after pushing -- the args anyway (this might not be true of register-rich machines -- when we start passing args to stg_ap_* in regs).
1,148
false
true
0
10
243
120
71
49
null
null
vTurbine/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
divModIntegerName = varQual gHC_INTEGER_TYPE (fsLit "divModInteger") divModIntegerIdKey
95
divModIntegerName = varQual gHC_INTEGER_TYPE (fsLit "divModInteger") divModIntegerIdKey
95
divModIntegerName = varQual gHC_INTEGER_TYPE (fsLit "divModInteger") divModIntegerIdKey
95
false
false
0
7
14
19
9
10
null
null
rueshyna/gogol
gogol-youtube/gen/Network/Google/YouTube/Types/Product.hs
mpl-2.0
-- | Creates a value of 'ChannelContentOwnerDetails' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'ccodTimeLinked' -- -- * 'ccodContentOwner' channelContentOwnerDetails :: ChannelContentOwnerDetails channelContentOwnerDetails = ChannelContentOwnerDetails' { _ccodTimeLinked = Nothing , _ccodContentOwner = Nothing }
423
channelContentOwnerDetails :: ChannelContentOwnerDetails channelContentOwnerDetails = ChannelContentOwnerDetails' { _ccodTimeLinked = Nothing , _ccodContentOwner = Nothing }
193
channelContentOwnerDetails = ChannelContentOwnerDetails' { _ccodTimeLinked = Nothing , _ccodContentOwner = Nothing }
132
true
true
0
6
72
32
22
10
null
null
ancientlanguage/haskell-analysis
prepare/src/Prepare/Decompose.hs
mit
decomposeChar '\x2F9CC' = "\x27966"
35
decomposeChar '\x2F9CC' = "\x27966"
35
decomposeChar '\x2F9CC' = "\x27966"
35
false
false
1
5
3
13
4
9
null
null
CarstenKoenig/DOS2015
CountdownGame/src/web/CountdownGame/Database.hs
unlicense
getPlayersMap :: ConnectionPool -> IO P.PlayersMap getPlayersMap pool = do ps <- map (\ p -> (P.playerId p, p)) <$> getPlayers pool return $ M.fromList ps
158
getPlayersMap :: ConnectionPool -> IO P.PlayersMap getPlayersMap pool = do ps <- map (\ p -> (P.playerId p, p)) <$> getPlayers pool return $ M.fromList ps
158
getPlayersMap pool = do ps <- map (\ p -> (P.playerId p, p)) <$> getPlayers pool return $ M.fromList ps
107
false
true
0
14
29
71
34
37
null
null
pepincho/Functional-Programming
Homework-1/45121-homework-solution.hs
mit
--Task 4 intercalate' str [x] = x
34
intercalate' str [x] = x
24
intercalate' str [x] = x
24
true
false
0
6
7
15
8
7
null
null
ihc/futhark
src/Futhark/Pass/ExtractKernels/Distribution.hs
isc
ppNestings :: Nestings -> String ppNestings (nesting, nestings) = unlines $ map ppNesting $ nestings ++ [nesting] where ppNesting (Nesting _ loop) = ppLoopNesting loop
181
ppNestings :: Nestings -> String ppNestings (nesting, nestings) = unlines $ map ppNesting $ nestings ++ [nesting] where ppNesting (Nesting _ loop) = ppLoopNesting loop
181
ppNestings (nesting, nestings) = unlines $ map ppNesting $ nestings ++ [nesting] where ppNesting (Nesting _ loop) = ppLoopNesting loop
148
false
true
0
8
38
63
32
31
null
null
ekmett/concurrent
src/Concurrent/Capability/LocalArray.hs
bsd-2-clause
withSmallLocalArray :: forall m a r. ReifiesCapability m => SmallLocalArray a -> (SmallMutableArray RealWorld a -> m r) -> m r withSmallLocalArray l f = f $ untag (reflectSmallLocalArray l :: Tagged m (SmallMutableArray RealWorld a))
233
withSmallLocalArray :: forall m a r. ReifiesCapability m => SmallLocalArray a -> (SmallMutableArray RealWorld a -> m r) -> m r withSmallLocalArray l f = f $ untag (reflectSmallLocalArray l :: Tagged m (SmallMutableArray RealWorld a))
233
withSmallLocalArray l f = f $ untag (reflectSmallLocalArray l :: Tagged m (SmallMutableArray RealWorld a))
106
false
true
0
11
35
88
43
45
null
null
cbpark/hep-kinematics
src/HEP/Kinematics/Vector/TwoVector.hs
bsd-3-clause
setPtPhi :: Double -> Double -> TwoVector Double setPtPhi pt phi = let !px = pt * cos phi !py = pt * sin phi in TwoVector (V2 px py)
172
setPtPhi :: Double -> Double -> TwoVector Double setPtPhi pt phi = let !px = pt * cos phi !py = pt * sin phi in TwoVector (V2 px py)
172
setPtPhi pt phi = let !px = pt * cos phi !py = pt * sin phi in TwoVector (V2 px py)
123
false
true
0
10
69
76
33
43
null
null
tamarin-prover/tamarin-prover
lib/theory/src/Theory/Model/Formula.hs
gpl-3.0
quantify :: (Ord c, Ord v, Functor syn) => v -> ProtoFormula syn s c v -> ProtoFormula syn s c v quantify x = mapAtoms (\i a -> fmap (mapLits (fmap (>>= subst i))) a) where subst i v | v == x = Bound i | otherwise = Free v -- | Create a universal quantification with a sort hint for the bound variable.
330
quantify :: (Ord c, Ord v, Functor syn) => v -> ProtoFormula syn s c v -> ProtoFormula syn s c v quantify x = mapAtoms (\i a -> fmap (mapLits (fmap (>>= subst i))) a) where subst i v | v == x = Bound i | otherwise = Free v -- | Create a universal quantification with a sort hint for the bound variable.
330
quantify x = mapAtoms (\i a -> fmap (mapLits (fmap (>>= subst i))) a) where subst i v | v == x = Bound i | otherwise = Free v -- | Create a universal quantification with a sort hint for the bound variable.
233
false
true
0
14
93
137
66
71
null
null
swamp-agr/an-pro.org
site.hs
mit
-------------------------------------------------------------------------------- postsP :: Pattern postsP = fromGlob "posts/*"
127
postsP :: Pattern postsP = fromGlob "posts/*"
45
postsP = fromGlob "posts/*"
27
true
true
0
5
8
15
8
7
null
null
MichaelXavier/Bucketeer
Bucketeer/Testing/Persistence.hs
bsd-2-clause
describe_deleteFeature :: Connection -> Specs describe_deleteFeature conn = describe "Bucketeer.Persistence.deleteFeature" [ it "when key is missing: keeps the key missing?" $ withCleanup conn $ do overwriteKey conn "2" doDeleteFeature conn cns $ Feature "wat" assertDeletedBucket conn $ Feature "wat", it "when key is present: deletes the key" $ withCleanup conn $ do overwriteKey conn "2" doDeleteFeature conn cns feat assertDeletedBucket conn feat ] where assertDeletedBucket conn (Feature f) = assertEqual (assertMsg f) (Right False) =<< runRedis conn (hexists "bucketeer:test:summer" f) assertMsg f = "Deleted " ++ unpack f doDeleteFeature conn cns feat = runRedis conn $ deleteFeature ns cns feat
952
describe_deleteFeature :: Connection -> Specs describe_deleteFeature conn = describe "Bucketeer.Persistence.deleteFeature" [ it "when key is missing: keeps the key missing?" $ withCleanup conn $ do overwriteKey conn "2" doDeleteFeature conn cns $ Feature "wat" assertDeletedBucket conn $ Feature "wat", it "when key is present: deletes the key" $ withCleanup conn $ do overwriteKey conn "2" doDeleteFeature conn cns feat assertDeletedBucket conn feat ] where assertDeletedBucket conn (Feature f) = assertEqual (assertMsg f) (Right False) =<< runRedis conn (hexists "bucketeer:test:summer" f) assertMsg f = "Deleted " ++ unpack f doDeleteFeature conn cns feat = runRedis conn $ deleteFeature ns cns feat
952
describe_deleteFeature conn = describe "Bucketeer.Persistence.deleteFeature" [ it "when key is missing: keeps the key missing?" $ withCleanup conn $ do overwriteKey conn "2" doDeleteFeature conn cns $ Feature "wat" assertDeletedBucket conn $ Feature "wat", it "when key is present: deletes the key" $ withCleanup conn $ do overwriteKey conn "2" doDeleteFeature conn cns feat assertDeletedBucket conn feat ] where assertDeletedBucket conn (Feature f) = assertEqual (assertMsg f) (Right False) =<< runRedis conn (hexists "bucketeer:test:summer" f) assertMsg f = "Deleted " ++ unpack f doDeleteFeature conn cns feat = runRedis conn $ deleteFeature ns cns feat
880
false
true
6
10
349
236
96
140
null
null
FranklinChen/hugs98-plus-Sep2006
packages/HaXml/src/Text/XML/HaXml/Types.hs
bsd-3-clause
info (CString _ _ i) = i
24
info (CString _ _ i) = i
24
info (CString _ _ i) = i
24
false
false
0
6
6
20
9
11
null
null
k0001/gtk2hs
pango/Gtk2HsSetup.hs
gpl-3.0
generateMacros :: [PackageId] -> String generateMacros cPkgs = concat $ "/* DO NOT EDIT: This file is automatically generated by Gtk2HsSetup.hs */\n\n" : [ concat ["/* package ",display pkgid," */\n" ,"#define VERSION_",pkgname," ",show (display version),"\n" ,"#define MIN_VERSION_",pkgname,"(major1,major2,minor) (\\\n" ," (major1) < ",major1," || \\\n" ," (major1) == ",major1," && (major2) < ",major2," || \\\n" ," (major1) == ",major1," && (major2) == ",major2," && (minor) <= ",minor,")" ,"\n\n" ] | pkgid@(PackageIdentifier name version) <- cPkgs , let (major1:major2:minor:_) = map show (versionBranch version ++ repeat 0) pkgname = map fixchar (display name) ] where fixchar '-' = '_' fixchar '.' = '_' fixchar c = c --FIXME: Cabal should tell us the selected pkg-config package versions in the -- LocalBuildInfo or equivalent. -- In the mean time, ask pkg-config again.
967
generateMacros :: [PackageId] -> String generateMacros cPkgs = concat $ "/* DO NOT EDIT: This file is automatically generated by Gtk2HsSetup.hs */\n\n" : [ concat ["/* package ",display pkgid," */\n" ,"#define VERSION_",pkgname," ",show (display version),"\n" ,"#define MIN_VERSION_",pkgname,"(major1,major2,minor) (\\\n" ," (major1) < ",major1," || \\\n" ," (major1) == ",major1," && (major2) < ",major2," || \\\n" ," (major1) == ",major1," && (major2) == ",major2," && (minor) <= ",minor,")" ,"\n\n" ] | pkgid@(PackageIdentifier name version) <- cPkgs , let (major1:major2:minor:_) = map show (versionBranch version ++ repeat 0) pkgname = map fixchar (display name) ] where fixchar '-' = '_' fixchar '.' = '_' fixchar c = c --FIXME: Cabal should tell us the selected pkg-config package versions in the -- LocalBuildInfo or equivalent. -- In the mean time, ask pkg-config again.
967
generateMacros cPkgs = concat $ "/* DO NOT EDIT: This file is automatically generated by Gtk2HsSetup.hs */\n\n" : [ concat ["/* package ",display pkgid," */\n" ,"#define VERSION_",pkgname," ",show (display version),"\n" ,"#define MIN_VERSION_",pkgname,"(major1,major2,minor) (\\\n" ," (major1) < ",major1," || \\\n" ," (major1) == ",major1," && (major2) < ",major2," || \\\n" ," (major1) == ",major1," && (major2) == ",major2," && (minor) <= ",minor,")" ,"\n\n" ] | pkgid@(PackageIdentifier name version) <- cPkgs , let (major1:major2:minor:_) = map show (versionBranch version ++ repeat 0) pkgname = map fixchar (display name) ] where fixchar '-' = '_' fixchar '.' = '_' fixchar c = c --FIXME: Cabal should tell us the selected pkg-config package versions in the -- LocalBuildInfo or equivalent. -- In the mean time, ask pkg-config again.
927
false
true
2
14
216
237
132
105
null
null
elieux/ghc
compiler/hsSyn/HsUtils.hs
bsd-3-clause
collectStmtBinders :: StmtLR idL idR body -> [idL] -- Id Binders for a Stmt... [but what about pattern-sig type vars]? collectStmtBinders (BindStmt pat _ _ _) = collectPatBinders pat
185
collectStmtBinders :: StmtLR idL idR body -> [idL] collectStmtBinders (BindStmt pat _ _ _) = collectPatBinders pat
115
collectStmtBinders (BindStmt pat _ _ _) = collectPatBinders pat
64
true
true
0
9
31
49
23
26
null
null
jseaton/ttasm
Instructions.hs
gpl-3.0
sround = byte 0x76
20
sround = byte 0x76
20
sround = byte 0x76
20
false
false
0
5
5
9
4
5
null
null
alexander-at-github/eta
compiler/ETA/TypeCheck/TcGenGenerics.hs
bsd-3-clause
mkM1_P :: LPat RdrName -> LPat RdrName mkM1_P p = m1DataCon_RDR `nlConPat` [p]
78
mkM1_P :: LPat RdrName -> LPat RdrName mkM1_P p = m1DataCon_RDR `nlConPat` [p]
78
mkM1_P p = m1DataCon_RDR `nlConPat` [p]
39
false
true
0
6
12
33
17
16
null
null
ddssff/pretty-listlike
src/Text/PrettyPrint/HughesPJClass.hs
bsd-3-clause
prettyParen :: Bool -> Doc -> Doc prettyParen = maybeParens
59
prettyParen :: Bool -> Doc -> Doc prettyParen = maybeParens
59
prettyParen = maybeParens
25
false
true
0
8
9
26
11
15
null
null
nushio3/ghc
compiler/typecheck/FamInst.hs
bsd-3-clause
checkFamInstConsistency :: [Module] -> [Module] -> TcM () checkFamInstConsistency famInstMods directlyImpMods = do { dflags <- getDynFlags ; (eps, hpt) <- getEpsAndHpt ; let { -- Fetch the iface of a given module. Must succeed as -- all directly imported modules must already have been loaded. modIface mod = case lookupIfaceByModule dflags hpt (eps_PIT eps) mod of Nothing -> panicDoc "FamInst.checkFamInstConsistency" (ppr mod $$ pprHPT hpt) Just iface -> iface ; hmiModule = mi_module . hm_iface ; hmiFamInstEnv = extendFamInstEnvList emptyFamInstEnv . md_fam_insts . hm_details ; hpt_fam_insts = mkModuleEnv [ (hmiModule hmi, hmiFamInstEnv hmi) | hmi <- eltsUFM hpt] ; groups = map (dep_finsts . mi_deps . modIface) directlyImpMods ; okPairs = listToSet $ concatMap allPairs groups -- instances of okPairs are consistent ; criticalPairs = listToSet $ allPairs famInstMods -- all pairs that we need to consider ; toCheckPairs = Map.keys $ criticalPairs `Map.difference` okPairs -- the difference gives us the pairs we need to check now } ; mapM_ (check hpt_fam_insts) toCheckPairs } where allPairs [] = [] allPairs (m:ms) = map (ModulePair m) ms ++ allPairs ms check hpt_fam_insts (ModulePair m1 m2) = do { env1 <- getFamInsts hpt_fam_insts m1 ; env2 <- getFamInsts hpt_fam_insts m2 ; mapM_ (checkForConflicts (emptyFamInstEnv, env2)) (famInstEnvElts env1) ; mapM_ (checkForInjectivityConflicts (emptyFamInstEnv,env2)) (famInstEnvElts env1) }
1,991
checkFamInstConsistency :: [Module] -> [Module] -> TcM () checkFamInstConsistency famInstMods directlyImpMods = do { dflags <- getDynFlags ; (eps, hpt) <- getEpsAndHpt ; let { -- Fetch the iface of a given module. Must succeed as -- all directly imported modules must already have been loaded. modIface mod = case lookupIfaceByModule dflags hpt (eps_PIT eps) mod of Nothing -> panicDoc "FamInst.checkFamInstConsistency" (ppr mod $$ pprHPT hpt) Just iface -> iface ; hmiModule = mi_module . hm_iface ; hmiFamInstEnv = extendFamInstEnvList emptyFamInstEnv . md_fam_insts . hm_details ; hpt_fam_insts = mkModuleEnv [ (hmiModule hmi, hmiFamInstEnv hmi) | hmi <- eltsUFM hpt] ; groups = map (dep_finsts . mi_deps . modIface) directlyImpMods ; okPairs = listToSet $ concatMap allPairs groups -- instances of okPairs are consistent ; criticalPairs = listToSet $ allPairs famInstMods -- all pairs that we need to consider ; toCheckPairs = Map.keys $ criticalPairs `Map.difference` okPairs -- the difference gives us the pairs we need to check now } ; mapM_ (check hpt_fam_insts) toCheckPairs } where allPairs [] = [] allPairs (m:ms) = map (ModulePair m) ms ++ allPairs ms check hpt_fam_insts (ModulePair m1 m2) = do { env1 <- getFamInsts hpt_fam_insts m1 ; env2 <- getFamInsts hpt_fam_insts m2 ; mapM_ (checkForConflicts (emptyFamInstEnv, env2)) (famInstEnvElts env1) ; mapM_ (checkForInjectivityConflicts (emptyFamInstEnv,env2)) (famInstEnvElts env1) }
1,991
checkFamInstConsistency famInstMods directlyImpMods = do { dflags <- getDynFlags ; (eps, hpt) <- getEpsAndHpt ; let { -- Fetch the iface of a given module. Must succeed as -- all directly imported modules must already have been loaded. modIface mod = case lookupIfaceByModule dflags hpt (eps_PIT eps) mod of Nothing -> panicDoc "FamInst.checkFamInstConsistency" (ppr mod $$ pprHPT hpt) Just iface -> iface ; hmiModule = mi_module . hm_iface ; hmiFamInstEnv = extendFamInstEnvList emptyFamInstEnv . md_fam_insts . hm_details ; hpt_fam_insts = mkModuleEnv [ (hmiModule hmi, hmiFamInstEnv hmi) | hmi <- eltsUFM hpt] ; groups = map (dep_finsts . mi_deps . modIface) directlyImpMods ; okPairs = listToSet $ concatMap allPairs groups -- instances of okPairs are consistent ; criticalPairs = listToSet $ allPairs famInstMods -- all pairs that we need to consider ; toCheckPairs = Map.keys $ criticalPairs `Map.difference` okPairs -- the difference gives us the pairs we need to check now } ; mapM_ (check hpt_fam_insts) toCheckPairs } where allPairs [] = [] allPairs (m:ms) = map (ModulePair m) ms ++ allPairs ms check hpt_fam_insts (ModulePair m1 m2) = do { env1 <- getFamInsts hpt_fam_insts m1 ; env2 <- getFamInsts hpt_fam_insts m2 ; mapM_ (checkForConflicts (emptyFamInstEnv, env2)) (famInstEnvElts env1) ; mapM_ (checkForInjectivityConflicts (emptyFamInstEnv,env2)) (famInstEnvElts env1) }
1,933
false
true
0
16
758
424
220
204
null
null
jkff/timeplot
Tools/TimePlot.hs
bsd-3-clause
-- Assume events are sorted. -- Pass 1: -- * Compute min/max times -- * Compute unique track names -- -- Then map track names to plotters (track types). -- -- Pass 2: -- * Generate plot data (one-pass multiplexed to tracks) -- makeChart :: (S.ByteString -> [(ChartKind LocalTime, S.ByteString)]) -> IO (ParseResult LocalTime) -> Maybe LocalTime -> Maybe LocalTime -> (LocalTime -> String -> String) -> IO (Renderable ()) makeChart chartKindF parseEvents minT maxT transformLabel = do ParseResult events unparseable <- parseEvents when (not (null unparseable)) $ do putStrLn $ "Unparseable lines found" ++ (if null (drop 10 unparseable) then ":" else " (showing first 10):") mapM_ (putStrLn . S.unpack) (take 10 unparseable) if null events then return emptyRenderable else do let dropLateEvents es = case maxT of Just t -> takeWhile ((<t) . fst) es ; Nothing -> es -- Pass 1: find out min/max time and final track names. let i2o t (KindNone, _) = [] i2o t (KindWithin mapName sk, suf) = [(S.append (mapName t) suf, sk)] i2o t (k, suf) = [(S.append t suf, k)] let i2oTracks t = concatMap (i2o t) (chartKindF t) let t0 = fst (head events) let (minTime, maxTime, outTracks) = foldl' (\(!mi,!ma,!ts) (t,e) -> (min t mi, max t ma, foldr (uncurry M.insert) ts (i2oTracks $ evt_track e))) (t0, t0, M.empty) (dropLateEvents events) let minOutTime = case minT of Just t -> t ; Nothing -> minTime let maxOutTime = case maxT of Just t -> t ; Nothing -> maxTime let transformLabels axis = axis & axis_labels %~ map (map (\(t, s) -> (t, transformLabel t s))) let commonTimeAxis = transformLabels $ autoAxis [minOutTime, maxOutTime] -- Pass 2 events' <- (dropLateEvents . parsedData) `fmap` parseEvents let eventsToTracks = [(outTrack, (t,e)) | (t,e) <- events', (outTrack,_) <- i2oTracks (evt_track e)] let initPlot track = initGen (outTracks M.! track) (S.unpack track) minTime maxTime let plots = I.runStreamSummary (I.byKey initPlot) eventsToTracks -- Render return $ renderStackedLayouts $ slayouts_layouts .~ map (dataToPlot commonTimeAxis (minOutTime,maxOutTime)) (M.elems plots) $ def
2,388
makeChart :: (S.ByteString -> [(ChartKind LocalTime, S.ByteString)]) -> IO (ParseResult LocalTime) -> Maybe LocalTime -> Maybe LocalTime -> (LocalTime -> String -> String) -> IO (Renderable ()) makeChart chartKindF parseEvents minT maxT transformLabel = do ParseResult events unparseable <- parseEvents when (not (null unparseable)) $ do putStrLn $ "Unparseable lines found" ++ (if null (drop 10 unparseable) then ":" else " (showing first 10):") mapM_ (putStrLn . S.unpack) (take 10 unparseable) if null events then return emptyRenderable else do let dropLateEvents es = case maxT of Just t -> takeWhile ((<t) . fst) es ; Nothing -> es -- Pass 1: find out min/max time and final track names. let i2o t (KindNone, _) = [] i2o t (KindWithin mapName sk, suf) = [(S.append (mapName t) suf, sk)] i2o t (k, suf) = [(S.append t suf, k)] let i2oTracks t = concatMap (i2o t) (chartKindF t) let t0 = fst (head events) let (minTime, maxTime, outTracks) = foldl' (\(!mi,!ma,!ts) (t,e) -> (min t mi, max t ma, foldr (uncurry M.insert) ts (i2oTracks $ evt_track e))) (t0, t0, M.empty) (dropLateEvents events) let minOutTime = case minT of Just t -> t ; Nothing -> minTime let maxOutTime = case maxT of Just t -> t ; Nothing -> maxTime let transformLabels axis = axis & axis_labels %~ map (map (\(t, s) -> (t, transformLabel t s))) let commonTimeAxis = transformLabels $ autoAxis [minOutTime, maxOutTime] -- Pass 2 events' <- (dropLateEvents . parsedData) `fmap` parseEvents let eventsToTracks = [(outTrack, (t,e)) | (t,e) <- events', (outTrack,_) <- i2oTracks (evt_track e)] let initPlot track = initGen (outTracks M.! track) (S.unpack track) minTime maxTime let plots = I.runStreamSummary (I.byKey initPlot) eventsToTracks -- Render return $ renderStackedLayouts $ slayouts_layouts .~ map (dataToPlot commonTimeAxis (minOutTime,maxOutTime)) (M.elems plots) $ def
2,155
makeChart chartKindF parseEvents minT maxT transformLabel = do ParseResult events unparseable <- parseEvents when (not (null unparseable)) $ do putStrLn $ "Unparseable lines found" ++ (if null (drop 10 unparseable) then ":" else " (showing first 10):") mapM_ (putStrLn . S.unpack) (take 10 unparseable) if null events then return emptyRenderable else do let dropLateEvents es = case maxT of Just t -> takeWhile ((<t) . fst) es ; Nothing -> es -- Pass 1: find out min/max time and final track names. let i2o t (KindNone, _) = [] i2o t (KindWithin mapName sk, suf) = [(S.append (mapName t) suf, sk)] i2o t (k, suf) = [(S.append t suf, k)] let i2oTracks t = concatMap (i2o t) (chartKindF t) let t0 = fst (head events) let (minTime, maxTime, outTracks) = foldl' (\(!mi,!ma,!ts) (t,e) -> (min t mi, max t ma, foldr (uncurry M.insert) ts (i2oTracks $ evt_track e))) (t0, t0, M.empty) (dropLateEvents events) let minOutTime = case minT of Just t -> t ; Nothing -> minTime let maxOutTime = case maxT of Just t -> t ; Nothing -> maxTime let transformLabels axis = axis & axis_labels %~ map (map (\(t, s) -> (t, transformLabel t s))) let commonTimeAxis = transformLabels $ autoAxis [minOutTime, maxOutTime] -- Pass 2 events' <- (dropLateEvents . parsedData) `fmap` parseEvents let eventsToTracks = [(outTrack, (t,e)) | (t,e) <- events', (outTrack,_) <- i2oTracks (evt_track e)] let initPlot track = initGen (outTracks M.! track) (S.unpack track) minTime maxTime let plots = I.runStreamSummary (I.byKey initPlot) eventsToTracks -- Render return $ renderStackedLayouts $ slayouts_layouts .~ map (dataToPlot commonTimeAxis (minOutTime,maxOutTime)) (M.elems plots) $ def
1,907
true
true
0
20
645
854
438
416
null
null
dogweather/nevada-revised-statutes-parser
src/Models/Section.hs
bsd-3-clause
parseName :: Text -> Text parseName = normalizeWhiteSpace . removeAnnotation where removeAnnotation = T.takeWhile isLegalNameChar
131
parseName :: Text -> Text parseName = normalizeWhiteSpace . removeAnnotation where removeAnnotation = T.takeWhile isLegalNameChar
131
parseName = normalizeWhiteSpace . removeAnnotation where removeAnnotation = T.takeWhile isLegalNameChar
105
false
true
0
7
16
38
17
21
null
null
chaosim/peasy
coffee/samples/latex.hs
mit
acute 'r' = "ŕ"
15
acute 'r' = "ŕ"
15
acute 'r' = "ŕ"
15
false
false
1
5
3
13
4
9
null
null
nyirog/cis194
lec04.hs
unlicense
maze3 (C (-5) (-4)) = Wall
26
maze3 (C (-5) (-4)) = Wall
26
maze3 (C (-5) (-4)) = Wall
26
false
false
0
9
5
27
14
13
null
null
spechub/Hets
Propositional/Analysis.hs
gpl-2.0
symbToSymbol :: AS_BASIC.SYMB -> Symbol.Symbol symbToSymbol (AS_BASIC.Symb_id tok) = Symbol.Symbol {Symbol.symName = Id.simpleIdToId tok}
141
symbToSymbol :: AS_BASIC.SYMB -> Symbol.Symbol symbToSymbol (AS_BASIC.Symb_id tok) = Symbol.Symbol {Symbol.symName = Id.simpleIdToId tok}
141
symbToSymbol (AS_BASIC.Symb_id tok) = Symbol.Symbol {Symbol.symName = Id.simpleIdToId tok}
94
false
true
0
8
17
47
24
23
null
null
stevely/hspirv
src/SpirV/Builder/Raw.hs
bsd-3-clause
-- Id 1: Result type, must be float type -- Id 2: Operand fWidthFine :: Id -> Id -> Builder Id fWidthFine = threeOp OpFwidthFine
128
fWidthFine :: Id -> Id -> Builder Id fWidthFine = threeOp OpFwidthFine
70
fWidthFine = threeOp OpFwidthFine
33
true
true
0
7
24
27
14
13
null
null
jtdubs/Light
src/Light/Geometry/Quaternion.hs
mit
(Quaternion v w) @-@ (Quaternion x y) = Quaternion (v ^-^ x) (w+y)
66
(Quaternion v w) @-@ (Quaternion x y) = Quaternion (v ^-^ x) (w+y)
66
(Quaternion v w) @-@ (Quaternion x y) = Quaternion (v ^-^ x) (w+y)
66
false
false
0
7
12
47
23
24
null
null
Teaspot-Studio/Urho3D-Haskell
src/Graphics/Urho3D/UI/LineEdit.hs
mit
lineEditIsTextCopyable :: (Parent LineEdit a, Pointer ptr a, MonadIO m) => ptr -- ^ Pointer to Text or ascentor -> m Bool lineEditIsTextCopyable p = liftIO $ do let ptr = parentPointer p toBool <$> [C.exp| int { (int)$(LineEdit* ptr)->IsTextCopyable() } |] -- | Return text element. -- Text* GetTextElement() const { return text_; }
341
lineEditIsTextCopyable :: (Parent LineEdit a, Pointer ptr a, MonadIO m) => ptr -- ^ Pointer to Text or ascentor -> m Bool lineEditIsTextCopyable p = liftIO $ do let ptr = parentPointer p toBool <$> [C.exp| int { (int)$(LineEdit* ptr)->IsTextCopyable() } |] -- | Return text element. -- Text* GetTextElement() const { return text_; }
341
lineEditIsTextCopyable p = liftIO $ do let ptr = parentPointer p toBool <$> [C.exp| int { (int)$(LineEdit* ptr)->IsTextCopyable() } |] -- | Return text element. -- Text* GetTextElement() const { return text_; }
215
false
true
0
11
63
79
41
38
null
null
rueshyna/gogol
gogol-compute/gen/Network/Google/Resource/Compute/Disks/Delete.hs
mpl-2.0
-- | Project ID for this request. ddProject :: Lens' DisksDelete Text ddProject = lens _ddProject (\ s a -> s{_ddProject = a})
128
ddProject :: Lens' DisksDelete Text ddProject = lens _ddProject (\ s a -> s{_ddProject = a})
94
ddProject = lens _ddProject (\ s a -> s{_ddProject = a})
58
true
true
0
9
24
42
22
20
null
null
kazu-yamamoto/network-uri
tests/uri001.hs
bsd-3-clause
testURIRef107 = testURIRef InvRf "http://example.org/abc#[2010:836B:4179::836B:4179]"
85
testURIRef107 = testURIRef InvRf "http://example.org/abc#[2010:836B:4179::836B:4179]"
85
testURIRef107 = testURIRef InvRf "http://example.org/abc#[2010:836B:4179::836B:4179]"
85
false
false
0
5
4
11
5
6
null
null
scturtle/turtlelang
Codegen.hs
unlicense
phi :: Type -> [(Operand, Name)] -> Codegen Operand phi ty incoming = instr $ Phi ty incoming []
96
phi :: Type -> [(Operand, Name)] -> Codegen Operand phi ty incoming = instr $ Phi ty incoming []
96
phi ty incoming = instr $ Phi ty incoming []
44
false
true
0
8
18
49
25
24
null
null
fibsifan/pandoc
src/Text/Pandoc/Readers/Markdown.hs
gpl-2.0
alignType strLst len = let nonempties = filter (not . null) $ map trimr strLst (leftSpace, rightSpace) = case sortBy (comparing length) nonempties of (x:_) -> (head x `elem` " \t", length x < len) [] -> (False, False) in case (leftSpace, rightSpace) of (True, False) -> AlignRight (False, True) -> AlignLeft (True, True) -> AlignCenter (False, False) -> AlignDefault -- Parse a table footer - dashed lines followed by blank line.
535
alignType strLst len = let nonempties = filter (not . null) $ map trimr strLst (leftSpace, rightSpace) = case sortBy (comparing length) nonempties of (x:_) -> (head x `elem` " \t", length x < len) [] -> (False, False) in case (leftSpace, rightSpace) of (True, False) -> AlignRight (False, True) -> AlignLeft (True, True) -> AlignCenter (False, False) -> AlignDefault -- Parse a table footer - dashed lines followed by blank line.
535
alignType strLst len = let nonempties = filter (not . null) $ map trimr strLst (leftSpace, rightSpace) = case sortBy (comparing length) nonempties of (x:_) -> (head x `elem` " \t", length x < len) [] -> (False, False) in case (leftSpace, rightSpace) of (True, False) -> AlignRight (False, True) -> AlignLeft (True, True) -> AlignCenter (False, False) -> AlignDefault -- Parse a table footer - dashed lines followed by blank line.
535
false
false
1
14
177
181
95
86
null
null
jmtd/rdifffs
RDiffFS.hs
bsd-3-clause
unRdiffBackup :: RdiffBackup -> String unRdiffBackup (Current x) = x
68
unRdiffBackup :: RdiffBackup -> String unRdiffBackup (Current x) = x
68
unRdiffBackup (Current x) = x
29
false
true
0
7
9
24
12
12
null
null
ttmtran/efficient-library
src/Knights problem in Haskell/knightsProblem.hs
mit
removeKnightPositions [] board = board
38
removeKnightPositions [] board = board
38
removeKnightPositions [] board = board
38
false
false
0
6
4
13
6
7
null
null
c089/haskell-craft3e
Chapter9.hs
mit
-- (++.1) (w:ws) ++ zs = w:(ws++zs)
35
(w:ws) ++ zs = w:(ws++zs)
25
(w:ws) ++ zs = w:(ws++zs)
25
true
false
0
7
6
31
16
15
null
null
rbonifacio/funsat
src/Funsat/Circuit.hs
bsd-3-clause
lseHash, trueHash :: CircuitHash falseHash = 0 t
48
falseHash, trueHash :: CircuitHash falseHash = 0
48
falseHash = 0
13
false
true
0
4
7
16
9
7
null
null