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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jtojnar/haste-compiler
|
libraries/ghc-7.8/base/Foreign/Marshal/Array.hs
|
bsd-3-clause
|
-- allocation
-- ----------
-- |Allocate storage for the given number of elements of a storable type
-- (like 'Foreign.Marshal.Alloc.malloc', but for multiple elements).
--
mallocArray :: Storable a => Int -> IO (Ptr a)
mallocArray = doMalloc undefined
where
doMalloc :: Storable a' => a' -> Int -> IO (Ptr a')
doMalloc dummy size = mallocBytes (size * sizeOf dummy)
-- |Like 'mallocArray', but add an extra position to hold a special
-- termination element.
--
| 486
|
mallocArray :: Storable a => Int -> IO (Ptr a)
mallocArray = doMalloc undefined
where
doMalloc :: Storable a' => a' -> Int -> IO (Ptr a')
doMalloc dummy size = mallocBytes (size * sizeOf dummy)
-- |Like 'mallocArray', but add an extra position to hold a special
-- termination element.
--
| 312
|
mallocArray = doMalloc undefined
where
doMalloc :: Storable a' => a' -> Int -> IO (Ptr a')
doMalloc dummy size = mallocBytes (size * sizeOf dummy)
-- |Like 'mallocArray', but add an extra position to hold a special
-- termination element.
--
| 265
| true
| true
| 4
| 9
| 101
| 95
| 50
| 45
| null | null |
peterbb/depend
|
test/test-typecheck1.hs
|
bsd-3-clause
|
test :: (String, [Expr], [Maybe Expr], Expr, Expr) -> IO ()
test (name, g, d, ast, expected_type) = case type_check_expr 0 g d ast of
Left _ -> do putStrLn $ name ++ ": " ++(show ast) ++ " has no type."
exitFailure
Right typ -> if typ == expected_type
then return ()
else do putStrLn $ name ++ ": got type " ++ (show typ) ++
" expected " ++ (show expected_type)
exitFailure
| 493
|
test :: (String, [Expr], [Maybe Expr], Expr, Expr) -> IO ()
test (name, g, d, ast, expected_type) = case type_check_expr 0 g d ast of
Left _ -> do putStrLn $ name ++ ": " ++(show ast) ++ " has no type."
exitFailure
Right typ -> if typ == expected_type
then return ()
else do putStrLn $ name ++ ": got type " ++ (show typ) ++
" expected " ++ (show expected_type)
exitFailure
| 493
|
test (name, g, d, ast, expected_type) = case type_check_expr 0 g d ast of
Left _ -> do putStrLn $ name ++ ": " ++(show ast) ++ " has no type."
exitFailure
Right typ -> if typ == expected_type
then return ()
else do putStrLn $ name ++ ": got type " ++ (show typ) ++
" expected " ++ (show expected_type)
exitFailure
| 433
| false
| true
| 0
| 15
| 193
| 181
| 91
| 90
| null | null |
Siprj/xmonadrc
|
src/Expand.hs
|
mit
|
expand :: String -> IO String
{- |
Expand string using environment variables, shell syntax are supported.
Examples:
>>> epxand "$HOME/Pictures"
"/home/user/Pictures"
>>> expand "${HOME}ABC"
"/home/userABC"
-}
expand str = do
let ast = parse str
concat <$> mapM interpolate ast
| 286
|
expand :: String -> IO String
expand str = do
let ast = parse str
concat <$> mapM interpolate ast
| 105
|
expand str = do
let ast = parse str
concat <$> mapM interpolate ast
| 75
| true
| true
| 0
| 11
| 50
| 50
| 22
| 28
| null | null |
VictorDenisov/jdi
|
src/Language/Java/Jdwp.hs
|
gpl-2.0
|
parseTaggedValue :: IdSizes -> Get Value
parseTaggedValue idsizes = do
tg <- parseTag
parseUntaggedValue idsizes tg
| 123
|
parseTaggedValue :: IdSizes -> Get Value
parseTaggedValue idsizes = do
tg <- parseTag
parseUntaggedValue idsizes tg
| 123
|
parseTaggedValue idsizes = do
tg <- parseTag
parseUntaggedValue idsizes tg
| 82
| false
| true
| 0
| 8
| 23
| 41
| 17
| 24
| null | null |
mpickering/ghc-exactprint
|
tests/examples/ghc710/OptSig2.hs
|
bsd-3-clause
|
errors= do
let ls :: Int = undefined
return ()
| 50
|
errors= do
let ls :: Int = undefined
return ()
| 50
|
errors= do
let ls :: Int = undefined
return ()
| 50
| false
| false
| 1
| 11
| 13
| 33
| 12
| 21
| null | null |
mbakke/ganeti
|
src/Ganeti/OpCodes.hs
|
bsd-2-clause
|
opSummaryVal OpGroupVerifyDisks { opGroupName = s } = Just (fromNonEmpty s)
| 75
|
opSummaryVal OpGroupVerifyDisks { opGroupName = s } = Just (fromNonEmpty s)
| 75
|
opSummaryVal OpGroupVerifyDisks { opGroupName = s } = Just (fromNonEmpty s)
| 75
| false
| false
| 0
| 8
| 10
| 27
| 13
| 14
| null | null |
mrordinaire/data-analysis
|
src/DataAnalysis02.hs
|
bsd-3-clause
|
applyToColumnInCSV :: ([String] -> b) -> CSV -> String -> Either String b
applyToColumnInCSV func csv column = fmap (func . elements) columnIndex
where columnIndex = getColumnInCSV csv column
nfieldsInFile = length $ head csv
records = tail $ filter (\record -> nfieldsInFile == length record) csv
elements ci = map (`genericIndex` ci) records
| 369
|
applyToColumnInCSV :: ([String] -> b) -> CSV -> String -> Either String b
applyToColumnInCSV func csv column = fmap (func . elements) columnIndex
where columnIndex = getColumnInCSV csv column
nfieldsInFile = length $ head csv
records = tail $ filter (\record -> nfieldsInFile == length record) csv
elements ci = map (`genericIndex` ci) records
| 369
|
applyToColumnInCSV func csv column = fmap (func . elements) columnIndex
where columnIndex = getColumnInCSV csv column
nfieldsInFile = length $ head csv
records = tail $ filter (\record -> nfieldsInFile == length record) csv
elements ci = map (`genericIndex` ci) records
| 295
| false
| true
| 3
| 10
| 79
| 131
| 67
| 64
| null | null |
NightRa/Idris-dev
|
src/IRTS/CodegenC.hs
|
bsd-3-clause
|
bcc :: Int -> BC -> String
bcc i (ASSIGN l r) = indent i ++ creg l ++ " = " ++ creg r ++ ";\n"
| 94
|
bcc :: Int -> BC -> String
bcc i (ASSIGN l r) = indent i ++ creg l ++ " = " ++ creg r ++ ";\n"
| 94
|
bcc i (ASSIGN l r) = indent i ++ creg l ++ " = " ++ creg r ++ ";\n"
| 67
| false
| true
| 0
| 9
| 26
| 62
| 28
| 34
| null | null |
alokpndy/haskell-learn
|
src/monads/monadTExcersies.hs
|
mit
|
checkLength :: String -> Either LengthError String
checkLength xs
| ln == 0 = Left EmptyString
| ln <= 5 = Left $ OtherError "Not much to deduce"
| ln > 20 = Left $ StringTooLong ln
| otherwise = Right xs
where
ln = length xs
| 277
|
checkLength :: String -> Either LengthError String
checkLength xs
| ln == 0 = Left EmptyString
| ln <= 5 = Left $ OtherError "Not much to deduce"
| ln > 20 = Left $ StringTooLong ln
| otherwise = Right xs
where
ln = length xs
| 277
|
checkLength xs
| ln == 0 = Left EmptyString
| ln <= 5 = Left $ OtherError "Not much to deduce"
| ln > 20 = Left $ StringTooLong ln
| otherwise = Right xs
where
ln = length xs
| 226
| false
| true
| 0
| 8
| 98
| 98
| 44
| 54
| null | null |
icyfork/shellcheck
|
ShellCheck/Analytics.hs
|
gpl-3.0
|
findSubshelled (Reference (_, readToken, str):rest) scopes deadVars = do
unless (shouldIgnore str) $ case Map.findWithDefault Alive str deadVars of
Alive -> return ()
Dead writeToken reason -> do
info (getId writeToken) 2030 $ "Modification of " ++ str ++ " is local (to subshell caused by "++ reason ++")."
info (getId readToken) 2031 $ str ++ " was modified in a subshell. That change might be lost."
findSubshelled rest scopes deadVars
where
shouldIgnore str =
str `elem` ["@", "*", "IFS"]
| 570
|
findSubshelled (Reference (_, readToken, str):rest) scopes deadVars = do
unless (shouldIgnore str) $ case Map.findWithDefault Alive str deadVars of
Alive -> return ()
Dead writeToken reason -> do
info (getId writeToken) 2030 $ "Modification of " ++ str ++ " is local (to subshell caused by "++ reason ++")."
info (getId readToken) 2031 $ str ++ " was modified in a subshell. That change might be lost."
findSubshelled rest scopes deadVars
where
shouldIgnore str =
str `elem` ["@", "*", "IFS"]
| 570
|
findSubshelled (Reference (_, readToken, str):rest) scopes deadVars = do
unless (shouldIgnore str) $ case Map.findWithDefault Alive str deadVars of
Alive -> return ()
Dead writeToken reason -> do
info (getId writeToken) 2030 $ "Modification of " ++ str ++ " is local (to subshell caused by "++ reason ++")."
info (getId readToken) 2031 $ str ++ " was modified in a subshell. That change might be lost."
findSubshelled rest scopes deadVars
where
shouldIgnore str =
str `elem` ["@", "*", "IFS"]
| 570
| false
| false
| 1
| 21
| 157
| 181
| 86
| 95
| null | null |
green-haskell/ghc
|
compiler/typecheck/TcEvidence.hs
|
bsd-3-clause
|
ppr_co p (TcLRCo lr co) = pprPrefixApp p (ppr lr) [pprParendTcCo co]
| 74
|
ppr_co p (TcLRCo lr co) = pprPrefixApp p (ppr lr) [pprParendTcCo co]
| 74
|
ppr_co p (TcLRCo lr co) = pprPrefixApp p (ppr lr) [pprParendTcCo co]
| 74
| false
| false
| 0
| 7
| 17
| 38
| 18
| 20
| null | null |
DavidAlphaFox/ghc
|
libraries/Cabal/Cabal/Distribution/System.hs
|
bsd-3-clause
|
archAliases _ Mips = ["mipsel", "mipseb"]
| 47
|
archAliases _ Mips = ["mipsel", "mipseb"]
| 47
|
archAliases _ Mips = ["mipsel", "mipseb"]
| 47
| false
| false
| 1
| 6
| 11
| 19
| 9
| 10
| null | null |
ghc-android/ghc
|
testsuite/tests/ghci/should_run/ghcirun004.hs
|
bsd-3-clause
|
336 = 335
| 9
|
336 = 335
| 9
|
336 = 335
| 9
| false
| false
| 1
| 5
| 2
| 10
| 3
| 7
| null | null |
mettekou/ghc
|
compiler/basicTypes/Module.hs
|
bsd-3-clause
|
moduleNameColons :: ModuleName -> String
moduleNameColons = dots_to_colons . moduleNameString
where dots_to_colons = map (\c -> if c == '.' then ':' else c)
{-
************************************************************************
* *
\subsection{A fully qualified module}
* *
************************************************************************
-}
-- | A Module is a pair of a 'UnitId' and a 'ModuleName'.
--
-- Module variables (i.e. @<H>@) which can be instantiated to a
-- specific module at some later point in time are represented
-- with 'moduleUnitId' set to 'holeUnitId' (this allows us to
-- avoid having to make 'moduleUnitId' a partial operation.)
--
| 810
|
moduleNameColons :: ModuleName -> String
moduleNameColons = dots_to_colons . moduleNameString
where dots_to_colons = map (\c -> if c == '.' then ':' else c)
{-
************************************************************************
* *
\subsection{A fully qualified module}
* *
************************************************************************
-}
-- | A Module is a pair of a 'UnitId' and a 'ModuleName'.
--
-- Module variables (i.e. @<H>@) which can be instantiated to a
-- specific module at some later point in time are represented
-- with 'moduleUnitId' set to 'holeUnitId' (this allows us to
-- avoid having to make 'moduleUnitId' a partial operation.)
--
| 810
|
moduleNameColons = dots_to_colons . moduleNameString
where dots_to_colons = map (\c -> if c == '.' then ':' else c)
{-
************************************************************************
* *
\subsection{A fully qualified module}
* *
************************************************************************
-}
-- | A Module is a pair of a 'UnitId' and a 'ModuleName'.
--
-- Module variables (i.e. @<H>@) which can be instantiated to a
-- specific module at some later point in time are represented
-- with 'moduleUnitId' set to 'holeUnitId' (this allows us to
-- avoid having to make 'moduleUnitId' a partial operation.)
--
| 769
| false
| true
| 0
| 9
| 233
| 58
| 35
| 23
| null | null |
lukexi/rumpus
|
src/Rumpus/Systems/Creator.hs
|
bsd-3-clause
|
activeDestructorOrbSize :: V3 GLfloat
activeDestructorOrbSize = 0.6
| 67
|
activeDestructorOrbSize :: V3 GLfloat
activeDestructorOrbSize = 0.6
| 67
|
activeDestructorOrbSize = 0.6
| 29
| false
| true
| 0
| 5
| 6
| 14
| 7
| 7
| null | null |
nakamuray/htig
|
HTIG/Database.hs
|
bsd-3-clause
|
clearUnreferencedStatuses :: Connection -> IO ()
clearUnreferencedStatuses conn = do
c <- run conn "DELETE FROM status \
\ WHERE (SELECT COUNT(*) FROM timeline WHERE status_id = id) = 0 \
\ AND (SELECT COUNT(*) FROM mention WHERE status_id = id) = 0 \
\ AND (SELECT COUNT(*) FROM status as s WHERE s.retweeted_status_id = status.id) = 0" []
print ("delete", c, "unreferenced statuses") -- debug print
| 466
|
clearUnreferencedStatuses :: Connection -> IO ()
clearUnreferencedStatuses conn = do
c <- run conn "DELETE FROM status \
\ WHERE (SELECT COUNT(*) FROM timeline WHERE status_id = id) = 0 \
\ AND (SELECT COUNT(*) FROM mention WHERE status_id = id) = 0 \
\ AND (SELECT COUNT(*) FROM status as s WHERE s.retweeted_status_id = status.id) = 0" []
print ("delete", c, "unreferenced statuses") -- debug print
| 466
|
clearUnreferencedStatuses conn = do
c <- run conn "DELETE FROM status \
\ WHERE (SELECT COUNT(*) FROM timeline WHERE status_id = id) = 0 \
\ AND (SELECT COUNT(*) FROM mention WHERE status_id = id) = 0 \
\ AND (SELECT COUNT(*) FROM status as s WHERE s.retweeted_status_id = status.id) = 0" []
print ("delete", c, "unreferenced statuses") -- debug print
| 417
| false
| true
| 0
| 9
| 132
| 55
| 27
| 28
| null | null |
mightymoose/liquidhaskell
|
src/Language/Haskell/Liquid/GhcPlay.hs
|
bsd-3-clause
|
substTysWith s (FunTy t1 t2) = FunTy (substTysWith s t1) (substTysWith s t2)
| 78
|
substTysWith s (FunTy t1 t2) = FunTy (substTysWith s t1) (substTysWith s t2)
| 78
|
substTysWith s (FunTy t1 t2) = FunTy (substTysWith s t1) (substTysWith s t2)
| 78
| false
| false
| 0
| 7
| 14
| 42
| 19
| 23
| null | null |
eckyputrady/haskell-scotty-realworld-example-app
|
src/Feature/Common/HTTP.hs
|
mit
|
inputMalformedJSONErrorHandler :: (ScottyError e, Monad m) => err -> ActionT e m a
inputMalformedJSONErrorHandler _ = do
status status422
json $ ErrorsWrapper $ asText "Malformed JSON payload"
finish
| 205
|
inputMalformedJSONErrorHandler :: (ScottyError e, Monad m) => err -> ActionT e m a
inputMalformedJSONErrorHandler _ = do
status status422
json $ ErrorsWrapper $ asText "Malformed JSON payload"
finish
| 205
|
inputMalformedJSONErrorHandler _ = do
status status422
json $ ErrorsWrapper $ asText "Malformed JSON payload"
finish
| 122
| false
| true
| 0
| 8
| 33
| 63
| 29
| 34
| null | null |
DanielSchiavini/ampersand
|
src/Database/Design/Ampersand/Input/ADL1/Lexer.hs
|
gpl-3.0
|
-----------------------------------------------------------
-- String clean-up functions / comments
-----------------------------------------------------------
lexNest :: Lexer -> Lexer
lexNest c p ('-':'}':s) = c (addPos 2 p) s
| 229
|
lexNest :: Lexer -> Lexer
lexNest c p ('-':'}':s) = c (addPos 2 p) s
| 68
|
lexNest c p ('-':'}':s) = c (addPos 2 p) s
| 42
| true
| true
| 0
| 10
| 23
| 55
| 27
| 28
| null | null |
tphyahoo/haskoin-wallet
|
Network/Haskoin/Wallet/Transaction.hs
|
unlicense
|
spendableCoinsSource
:: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m)
=> KeyRingAccountId -- ^ Account key
-> Word32 -- ^ Minimum confirmations
-> ( SqlExpr (Entity KeyRingCoin)
-> SqlExpr (Entity KeyRingTx)
-> [SqlExpr OrderBy]
)
-- ^ Coin ordering policy
-> Source (SqlPersistT m) InCoinData
-- ^ Spendable coins
spendableCoinsSource ai minConf orderPolicy =
mapOutput f $ selectSource $ spendableCoinsFrom ai minConf orderPolicy
where
f (c, t, x) = InCoinData c (entityVal t) (entityVal x)
| 589
|
spendableCoinsSource
:: (MonadIO m, MonadThrow m, MonadBase IO m, MonadResource m)
=> KeyRingAccountId -- ^ Account key
-> Word32 -- ^ Minimum confirmations
-> ( SqlExpr (Entity KeyRingCoin)
-> SqlExpr (Entity KeyRingTx)
-> [SqlExpr OrderBy]
)
-- ^ Coin ordering policy
-> Source (SqlPersistT m) InCoinData
spendableCoinsSource ai minConf orderPolicy =
mapOutput f $ selectSource $ spendableCoinsFrom ai minConf orderPolicy
where
f (c, t, x) = InCoinData c (entityVal t) (entityVal x)
| 560
|
spendableCoinsSource ai minConf orderPolicy =
mapOutput f $ selectSource $ spendableCoinsFrom ai minConf orderPolicy
where
f (c, t, x) = InCoinData c (entityVal t) (entityVal x)
| 187
| true
| true
| 0
| 15
| 159
| 171
| 85
| 86
| null | null |
victorgan/intolerable-bot
|
src/Bot.hs
|
bsd-3-clause
|
shouldRespond :: Username -> Text -> Bool
shouldRespond (Username u) = Text.isInfixOf (Text.toCaseFold $ "u/" <> u) . Text.toCaseFold
| 133
|
shouldRespond :: Username -> Text -> Bool
shouldRespond (Username u) = Text.isInfixOf (Text.toCaseFold $ "u/" <> u) . Text.toCaseFold
| 133
|
shouldRespond (Username u) = Text.isInfixOf (Text.toCaseFold $ "u/" <> u) . Text.toCaseFold
| 91
| false
| true
| 0
| 10
| 18
| 52
| 26
| 26
| null | null |
rzil/honours
|
LeavittPathAlgebras/LPA.hs
|
mit
|
shouldUseLeftParen (Op op (Op leftOp _ _) y) = operatorPrecedence op > operatorPrecedence leftOp || (operatorPrecedence op == operatorPrecedence leftOp && operatorIsRightAssociative op)
| 185
|
shouldUseLeftParen (Op op (Op leftOp _ _) y) = operatorPrecedence op > operatorPrecedence leftOp || (operatorPrecedence op == operatorPrecedence leftOp && operatorIsRightAssociative op)
| 185
|
shouldUseLeftParen (Op op (Op leftOp _ _) y) = operatorPrecedence op > operatorPrecedence leftOp || (operatorPrecedence op == operatorPrecedence leftOp && operatorIsRightAssociative op)
| 185
| false
| false
| 0
| 9
| 22
| 63
| 29
| 34
| null | null |
nikai3d/ce-challenges
|
easy/real_fake.hs
|
bsd-3-clause
|
dobSec xs (y:ys) = dobSec (xs ++ [y, 2 * head ys]) (tail ys)
| 60
|
dobSec xs (y:ys) = dobSec (xs ++ [y, 2 * head ys]) (tail ys)
| 60
|
dobSec xs (y:ys) = dobSec (xs ++ [y, 2 * head ys]) (tail ys)
| 60
| false
| false
| 0
| 10
| 13
| 49
| 25
| 24
| null | null |
Minoru/hakyll
|
src/Hakyll/Core/Identifier.hs
|
bsd-3-clause
|
fromFilePath :: String -> Identifier
fromFilePath = Identifier Nothing .
intercalate "/" . filter (not . null) . split'
where
split' = map dropTrailingPathSeparator . splitPath
--------------------------------------------------------------------------------
-- | Convert an identifier to a relative 'FilePath'
| 321
|
fromFilePath :: String -> Identifier
fromFilePath = Identifier Nothing .
intercalate "/" . filter (not . null) . split'
where
split' = map dropTrailingPathSeparator . splitPath
--------------------------------------------------------------------------------
-- | Convert an identifier to a relative 'FilePath'
| 321
|
fromFilePath = Identifier Nothing .
intercalate "/" . filter (not . null) . split'
where
split' = map dropTrailingPathSeparator . splitPath
--------------------------------------------------------------------------------
-- | Convert an identifier to a relative 'FilePath'
| 284
| false
| true
| 0
| 9
| 47
| 60
| 30
| 30
| null | null |
kmate/HaRe
|
old/testing/foldPatterns/MultiDefIn1.hs
|
bsd-3-clause
|
tl = tail
| 9
|
tl = tail
| 9
|
tl = tail
| 9
| false
| false
| 0
| 4
| 2
| 6
| 3
| 3
| null | null |
zlizta/PiSigma
|
src/Language/PiSigma/Evaluate.hs
|
bsd-3-clause
|
eval (Unfold _ t (x, u), s) = flip unfold (x, (u, s)) =<< eval (t,s)
| 72
|
eval (Unfold _ t (x, u), s) = flip unfold (x, (u, s)) =<< eval (t,s)
| 72
|
eval (Unfold _ t (x, u), s) = flip unfold (x, (u, s)) =<< eval (t,s)
| 72
| false
| false
| 0
| 8
| 19
| 58
| 32
| 26
| null | null |
keera-studios/hsQt
|
Qtc/Enums/Core/QChar.hs
|
bsd-2-clause
|
eParagraphSeparator :: SpecialCharacter
eParagraphSeparator
= ieSpecialCharacter $ 8233
| 89
|
eParagraphSeparator :: SpecialCharacter
eParagraphSeparator
= ieSpecialCharacter $ 8233
| 89
|
eParagraphSeparator
= ieSpecialCharacter $ 8233
| 49
| false
| true
| 0
| 6
| 9
| 18
| 8
| 10
| null | null |
green-haskell/ghc
|
compiler/nativeGen/SPARC/Ppr.hs
|
bsd-3-clause
|
-- | Pretty print a condition code.
pprCond :: Cond -> SDoc
pprCond c
= ptext
(case c of
ALWAYS -> sLit ""
NEVER -> sLit "n"
GEU -> sLit "geu"
LU -> sLit "lu"
EQQ -> sLit "e"
GTT -> sLit "g"
GE -> sLit "ge"
GU -> sLit "gu"
LTT -> sLit "l"
LE -> sLit "le"
LEU -> sLit "leu"
NE -> sLit "ne"
NEG -> sLit "neg"
POS -> sLit "pos"
VC -> sLit "vc"
VS -> sLit "vs")
| 556
|
pprCond :: Cond -> SDoc
pprCond c
= ptext
(case c of
ALWAYS -> sLit ""
NEVER -> sLit "n"
GEU -> sLit "geu"
LU -> sLit "lu"
EQQ -> sLit "e"
GTT -> sLit "g"
GE -> sLit "ge"
GU -> sLit "gu"
LTT -> sLit "l"
LE -> sLit "le"
LEU -> sLit "leu"
NE -> sLit "ne"
NEG -> sLit "neg"
POS -> sLit "pos"
VC -> sLit "vc"
VS -> sLit "vs")
| 520
|
pprCond c
= ptext
(case c of
ALWAYS -> sLit ""
NEVER -> sLit "n"
GEU -> sLit "geu"
LU -> sLit "lu"
EQQ -> sLit "e"
GTT -> sLit "g"
GE -> sLit "ge"
GU -> sLit "gu"
LTT -> sLit "l"
LE -> sLit "le"
LEU -> sLit "leu"
NE -> sLit "ne"
NEG -> sLit "neg"
POS -> sLit "pos"
VC -> sLit "vc"
VS -> sLit "vs")
| 496
| true
| true
| 0
| 10
| 281
| 179
| 80
| 99
| null | null |
mrmonday/Idris-dev
|
src/IRTS/CodegenC.hs
|
bsd-3-clause
|
c_irts (FArith (ATInt (ITFixed ity))) l x
= l ++ "idris_b" ++ show (nativeTyWidth ity) ++ "const(vm, " ++ x ++ ")"
| 118
|
c_irts (FArith (ATInt (ITFixed ity))) l x
= l ++ "idris_b" ++ show (nativeTyWidth ity) ++ "const(vm, " ++ x ++ ")"
| 118
|
c_irts (FArith (ATInt (ITFixed ity))) l x
= l ++ "idris_b" ++ show (nativeTyWidth ity) ++ "const(vm, " ++ x ++ ")"
| 118
| false
| false
| 0
| 11
| 25
| 60
| 29
| 31
| null | null |
nushio3/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
---------------- Template Haskell -------------------
-- THNames.hs: USES ClassUniques 200-299
-----------------------------------------------------
{-
************************************************************************
* *
\subsubsection[Uniques-prelude-TyCons]{@Uniques@ for wired-in @TyCons@}
* *
************************************************************************
-}
addrPrimTyConKey, arrayPrimTyConKey, arrayArrayPrimTyConKey, boolTyConKey,
byteArrayPrimTyConKey, charPrimTyConKey, charTyConKey, doublePrimTyConKey,
doubleTyConKey, floatPrimTyConKey, floatTyConKey, funTyConKey,
intPrimTyConKey, intTyConKey, int8TyConKey, int16TyConKey,
int32PrimTyConKey, int32TyConKey, int64PrimTyConKey, int64TyConKey,
integerTyConKey, listTyConKey, foreignObjPrimTyConKey, maybeTyConKey,
weakPrimTyConKey, mutableArrayPrimTyConKey, mutableArrayArrayPrimTyConKey,
mutableByteArrayPrimTyConKey, orderingTyConKey, mVarPrimTyConKey,
ratioTyConKey, rationalTyConKey, realWorldTyConKey, stablePtrPrimTyConKey,
stablePtrTyConKey, anyTyConKey, eqTyConKey, heqTyConKey,
smallArrayPrimTyConKey, smallMutableArrayPrimTyConKey :: Unique
addrPrimTyConKey = mkPreludeTyConUnique 1
| 1,378
|
addrPrimTyConKey, arrayPrimTyConKey, arrayArrayPrimTyConKey, boolTyConKey,
byteArrayPrimTyConKey, charPrimTyConKey, charTyConKey, doublePrimTyConKey,
doubleTyConKey, floatPrimTyConKey, floatTyConKey, funTyConKey,
intPrimTyConKey, intTyConKey, int8TyConKey, int16TyConKey,
int32PrimTyConKey, int32TyConKey, int64PrimTyConKey, int64TyConKey,
integerTyConKey, listTyConKey, foreignObjPrimTyConKey, maybeTyConKey,
weakPrimTyConKey, mutableArrayPrimTyConKey, mutableArrayArrayPrimTyConKey,
mutableByteArrayPrimTyConKey, orderingTyConKey, mVarPrimTyConKey,
ratioTyConKey, rationalTyConKey, realWorldTyConKey, stablePtrPrimTyConKey,
stablePtrTyConKey, anyTyConKey, eqTyConKey, heqTyConKey,
smallArrayPrimTyConKey, smallMutableArrayPrimTyConKey :: Unique
addrPrimTyConKey = mkPreludeTyConUnique 1
| 852
|
addrPrimTyConKey = mkPreludeTyConUnique 1
| 65
| true
| true
| 2
| 5
| 276
| 100
| 89
| 11
| null | null |
fffej/HS-Poker
|
LookupPatternMatch.hs
|
bsd-3-clause
|
getValueFromProduct 6439537 = 4095
| 34
|
getValueFromProduct 6439537 = 4095
| 34
|
getValueFromProduct 6439537 = 4095
| 34
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
snowleopard/shaking-up-ghc
|
src/CommandLine.hs
|
bsd-3-clause
|
optDescrs :: [OptDescr (Either String (CommandLineArgs -> CommandLineArgs))]
optDescrs =
[ Option ['c'] ["configure"] (NoArg readConfigure)
"Run the boot and configure scripts (if you do not want to run them manually)."
, Option ['o'] ["build-root"] (OptArg readBuildRoot "BUILD_ROOT")
"Where to store build artifacts. (Default _build)."
, Option [] ["flavour"] (OptArg readFlavour "FLAVOUR")
"Build flavour (Default, Devel1, Devel2, Perf, Prof, Quick or Quickest)."
, Option [] ["freeze1"] (NoArg readFreeze1)
"Freeze Stage1 GHC."
, Option [] ["integer-simple"] (NoArg readIntegerSimple)
"Build GHC with integer-simple library."
, Option [] ["progress-colour"] (OptArg readProgressColour "MODE")
"Use colours in progress info (Never, Auto or Always)."
, Option [] ["progress-info"] (OptArg readProgressInfo "STYLE")
"Progress info style (None, Brief, Normal or Unicorn)."
, Option [] ["split-objects"] (NoArg readSplitObjects)
"Generate split objects (requires a full clean rebuild)."
, Option [] ["test-compiler"] (OptArg readTestCompiler "TEST_COMPILER")
"Use given compiler [Default=stage2]."
, Option [] ["test-config-file"] (OptArg readTestConfigFile "CONFIG_FILE")
"congiguration file for testsuite. Default=testsuite/config/ghc"
, Option [] ["config"] (OptArg readTestConfig "EXTRA_TEST_CONFIG")
"Configurations to run test, in key=value format."
, Option [] ["summary-junit"] (OptArg readTestJUnit "TEST_SUMMARY_JUNIT")
"Output testsuite summary in JUnit format."
, Option [] ["only"] (OptArg readTestOnly "TESTS")
"Test cases to run."
, Option [] ["only-perf"] (NoArg readTestOnlyPerf)
"Only run performance tests."
, Option [] ["skip-perf"] (NoArg readTestSkipPerf)
"Skip performance tests."
, Option [] ["test-speed"] (OptArg readTestSpeed "SPEED")
"fast, slow or normal. Normal by default"
, Option [] ["summary"] (OptArg readTestSummary "TEST_SUMMARY")
"Where to output the test summary file."
, Option [] ["test-verbose"] (OptArg readTestVerbose "TEST_VERBOSE")
"A verbosity value between 0 and 5. 0 is silent, 4 and higher activates extra output."
, Option [] ["test-way"] (OptArg readTestWay "TEST_WAY")
"only run these ways" ]
| 2,334
|
optDescrs :: [OptDescr (Either String (CommandLineArgs -> CommandLineArgs))]
optDescrs =
[ Option ['c'] ["configure"] (NoArg readConfigure)
"Run the boot and configure scripts (if you do not want to run them manually)."
, Option ['o'] ["build-root"] (OptArg readBuildRoot "BUILD_ROOT")
"Where to store build artifacts. (Default _build)."
, Option [] ["flavour"] (OptArg readFlavour "FLAVOUR")
"Build flavour (Default, Devel1, Devel2, Perf, Prof, Quick or Quickest)."
, Option [] ["freeze1"] (NoArg readFreeze1)
"Freeze Stage1 GHC."
, Option [] ["integer-simple"] (NoArg readIntegerSimple)
"Build GHC with integer-simple library."
, Option [] ["progress-colour"] (OptArg readProgressColour "MODE")
"Use colours in progress info (Never, Auto or Always)."
, Option [] ["progress-info"] (OptArg readProgressInfo "STYLE")
"Progress info style (None, Brief, Normal or Unicorn)."
, Option [] ["split-objects"] (NoArg readSplitObjects)
"Generate split objects (requires a full clean rebuild)."
, Option [] ["test-compiler"] (OptArg readTestCompiler "TEST_COMPILER")
"Use given compiler [Default=stage2]."
, Option [] ["test-config-file"] (OptArg readTestConfigFile "CONFIG_FILE")
"congiguration file for testsuite. Default=testsuite/config/ghc"
, Option [] ["config"] (OptArg readTestConfig "EXTRA_TEST_CONFIG")
"Configurations to run test, in key=value format."
, Option [] ["summary-junit"] (OptArg readTestJUnit "TEST_SUMMARY_JUNIT")
"Output testsuite summary in JUnit format."
, Option [] ["only"] (OptArg readTestOnly "TESTS")
"Test cases to run."
, Option [] ["only-perf"] (NoArg readTestOnlyPerf)
"Only run performance tests."
, Option [] ["skip-perf"] (NoArg readTestSkipPerf)
"Skip performance tests."
, Option [] ["test-speed"] (OptArg readTestSpeed "SPEED")
"fast, slow or normal. Normal by default"
, Option [] ["summary"] (OptArg readTestSummary "TEST_SUMMARY")
"Where to output the test summary file."
, Option [] ["test-verbose"] (OptArg readTestVerbose "TEST_VERBOSE")
"A verbosity value between 0 and 5. 0 is silent, 4 and higher activates extra output."
, Option [] ["test-way"] (OptArg readTestWay "TEST_WAY")
"only run these ways" ]
| 2,334
|
optDescrs =
[ Option ['c'] ["configure"] (NoArg readConfigure)
"Run the boot and configure scripts (if you do not want to run them manually)."
, Option ['o'] ["build-root"] (OptArg readBuildRoot "BUILD_ROOT")
"Where to store build artifacts. (Default _build)."
, Option [] ["flavour"] (OptArg readFlavour "FLAVOUR")
"Build flavour (Default, Devel1, Devel2, Perf, Prof, Quick or Quickest)."
, Option [] ["freeze1"] (NoArg readFreeze1)
"Freeze Stage1 GHC."
, Option [] ["integer-simple"] (NoArg readIntegerSimple)
"Build GHC with integer-simple library."
, Option [] ["progress-colour"] (OptArg readProgressColour "MODE")
"Use colours in progress info (Never, Auto or Always)."
, Option [] ["progress-info"] (OptArg readProgressInfo "STYLE")
"Progress info style (None, Brief, Normal or Unicorn)."
, Option [] ["split-objects"] (NoArg readSplitObjects)
"Generate split objects (requires a full clean rebuild)."
, Option [] ["test-compiler"] (OptArg readTestCompiler "TEST_COMPILER")
"Use given compiler [Default=stage2]."
, Option [] ["test-config-file"] (OptArg readTestConfigFile "CONFIG_FILE")
"congiguration file for testsuite. Default=testsuite/config/ghc"
, Option [] ["config"] (OptArg readTestConfig "EXTRA_TEST_CONFIG")
"Configurations to run test, in key=value format."
, Option [] ["summary-junit"] (OptArg readTestJUnit "TEST_SUMMARY_JUNIT")
"Output testsuite summary in JUnit format."
, Option [] ["only"] (OptArg readTestOnly "TESTS")
"Test cases to run."
, Option [] ["only-perf"] (NoArg readTestOnlyPerf)
"Only run performance tests."
, Option [] ["skip-perf"] (NoArg readTestSkipPerf)
"Skip performance tests."
, Option [] ["test-speed"] (OptArg readTestSpeed "SPEED")
"fast, slow or normal. Normal by default"
, Option [] ["summary"] (OptArg readTestSummary "TEST_SUMMARY")
"Where to output the test summary file."
, Option [] ["test-verbose"] (OptArg readTestVerbose "TEST_VERBOSE")
"A verbosity value between 0 and 5. 0 is silent, 4 and higher activates extra output."
, Option [] ["test-way"] (OptArg readTestWay "TEST_WAY")
"only run these ways" ]
| 2,257
| false
| true
| 0
| 10
| 459
| 497
| 260
| 237
| null | null |
xkollar/handy-haskell
|
irc/IRCParser.hs
|
gpl-3.0
|
hostP :: Parser String
hostP = hostnameP `mplus` hostaddrP
| 58
|
hostP :: Parser String
hostP = hostnameP `mplus` hostaddrP
| 58
|
hostP = hostnameP `mplus` hostaddrP
| 35
| false
| true
| 0
| 6
| 8
| 28
| 13
| 15
| null | null |
oldmanmike/ghc
|
compiler/main/PprTyThing.hs
|
bsd-3-clause
|
pprFamInst (FamInst { fi_flavor = SynFamilyInst, fi_axiom = axiom
, fi_tys = lhs_tys, fi_rhs = rhs })
= showWithLoc (pprDefinedAt (getName axiom)) $
hang (text "type instance" <+> pprTypeApp (coAxiomTyCon axiom) lhs_tys)
2 (equals <+> ppr rhs)
| 276
|
pprFamInst (FamInst { fi_flavor = SynFamilyInst, fi_axiom = axiom
, fi_tys = lhs_tys, fi_rhs = rhs })
= showWithLoc (pprDefinedAt (getName axiom)) $
hang (text "type instance" <+> pprTypeApp (coAxiomTyCon axiom) lhs_tys)
2 (equals <+> ppr rhs)
| 276
|
pprFamInst (FamInst { fi_flavor = SynFamilyInst, fi_axiom = axiom
, fi_tys = lhs_tys, fi_rhs = rhs })
= showWithLoc (pprDefinedAt (getName axiom)) $
hang (text "type instance" <+> pprTypeApp (coAxiomTyCon axiom) lhs_tys)
2 (equals <+> ppr rhs)
| 276
| false
| false
| 0
| 9
| 69
| 99
| 50
| 49
| null | null |
NicolasDP/hs-memory
|
Data/Memory/PtrMethods.hs
|
bsd-3-clause
|
memXor d s1 s2 n = do
(xor <$> peek s1 <*> peek s2) >>= poke d
memXor (d `plusPtr` 1) (s1 `plusPtr` 1) (s2 `plusPtr` 1) (n-1)
-- | xor bytes from source with a specific value to destination
--
-- d = replicate (sizeof s) v `xor` s
| 239
|
memXor d s1 s2 n = do
(xor <$> peek s1 <*> peek s2) >>= poke d
memXor (d `plusPtr` 1) (s1 `plusPtr` 1) (s2 `plusPtr` 1) (n-1)
-- | xor bytes from source with a specific value to destination
--
-- d = replicate (sizeof s) v `xor` s
| 239
|
memXor d s1 s2 n = do
(xor <$> peek s1 <*> peek s2) >>= poke d
memXor (d `plusPtr` 1) (s1 `plusPtr` 1) (s2 `plusPtr` 1) (n-1)
-- | xor bytes from source with a specific value to destination
--
-- d = replicate (sizeof s) v `xor` s
| 239
| false
| false
| 0
| 11
| 58
| 91
| 49
| 42
| null | null |
Blaisorblade/Haskell-Adaptive
|
Control/Monad/Adaptive.hs
|
bsd-3-clause
|
inAd :: Ref m r => Adaptive m r a -> Changeable m r a
inAd m = Ch $ (m >>=)
| 75
|
inAd :: Ref m r => Adaptive m r a -> Changeable m r a
inAd m = Ch $ (m >>=)
| 75
|
inAd m = Ch $ (m >>=)
| 21
| false
| true
| 0
| 7
| 21
| 49
| 24
| 25
| null | null |
amccausl/Swish
|
Swish/HaskellRDF/BuiltInMapTest.hs
|
lgpl-2.1
|
testVarMod06 = testJust "testVarMod06" $
findRDFOpenVarBindingModifier (ScopedName namespaceXsdInteger "divmod")
| 117
|
testVarMod06 = testJust "testVarMod06" $
findRDFOpenVarBindingModifier (ScopedName namespaceXsdInteger "divmod")
| 117
|
testVarMod06 = testJust "testVarMod06" $
findRDFOpenVarBindingModifier (ScopedName namespaceXsdInteger "divmod")
| 117
| false
| false
| 0
| 8
| 13
| 24
| 11
| 13
| null | null |
anton-k/sharc-timbre
|
src/Sharc/Instruments/ContrabassMarteleBowing.hs
|
bsd-3-clause
|
note35 :: Note
note35 = Note
(Pitch 261.626 48 "c4")
36
(Range
(NoteRange
(NoteRangeAmplitude 10988.29 42 1.74)
(NoteRangeHarmonicFreq 1 261.62))
(NoteRange
(NoteRangeAmplitude 261.62 1 6126.0)
(NoteRangeHarmonicFreq 42 10988.29)))
[Harmonic 1 1.21 6126.0
,Harmonic 2 (-2.933) 644.18
,Harmonic 3 (-2.451) 775.0
,Harmonic 4 (-2.464) 631.46
,Harmonic 5 (-1.187) 943.57
,Harmonic 6 (-1.005) 326.4
,Harmonic 7 0.368 76.78
,Harmonic 8 (-1.664) 23.2
,Harmonic 9 (-1.054) 66.89
,Harmonic 10 (-0.962) 41.62
,Harmonic 11 2.168 56.25
,Harmonic 12 (-6.4e-2) 44.32
,Harmonic 13 1.669 20.99
,Harmonic 14 0.936 117.28
,Harmonic 15 0.804 38.87
,Harmonic 16 0.238 21.48
,Harmonic 17 (-2.852) 44.92
,Harmonic 18 0.533 26.84
,Harmonic 19 1.668 52.73
,Harmonic 20 0.789 36.22
,Harmonic 21 2.404 9.41
,Harmonic 22 2.033 10.48
,Harmonic 23 (-2.903) 9.93
,Harmonic 24 (-2.635) 8.91
,Harmonic 25 (-0.454) 8.69
,Harmonic 26 (-2.884) 2.51
,Harmonic 27 3.117 11.18
,Harmonic 28 (-1.75) 11.29
,Harmonic 29 2.42 5.21
,Harmonic 30 0.409 6.2
,Harmonic 31 (-1.801) 12.73
,Harmonic 32 1.635 6.16
,Harmonic 33 (-1.062) 5.93
,Harmonic 34 (-0.934) 4.52
,Harmonic 35 1.595 4.18
,Harmonic 36 (-1.093) 5.84
,Harmonic 37 (-2.077) 4.76
,Harmonic 38 0.216 2.51
,Harmonic 39 (-2.014) 7.46
,Harmonic 40 0.931 1.93
,Harmonic 41 2.961 3.34
,Harmonic 42 0.984 1.74]
| 1,563
|
note35 :: Note
note35 = Note
(Pitch 261.626 48 "c4")
36
(Range
(NoteRange
(NoteRangeAmplitude 10988.29 42 1.74)
(NoteRangeHarmonicFreq 1 261.62))
(NoteRange
(NoteRangeAmplitude 261.62 1 6126.0)
(NoteRangeHarmonicFreq 42 10988.29)))
[Harmonic 1 1.21 6126.0
,Harmonic 2 (-2.933) 644.18
,Harmonic 3 (-2.451) 775.0
,Harmonic 4 (-2.464) 631.46
,Harmonic 5 (-1.187) 943.57
,Harmonic 6 (-1.005) 326.4
,Harmonic 7 0.368 76.78
,Harmonic 8 (-1.664) 23.2
,Harmonic 9 (-1.054) 66.89
,Harmonic 10 (-0.962) 41.62
,Harmonic 11 2.168 56.25
,Harmonic 12 (-6.4e-2) 44.32
,Harmonic 13 1.669 20.99
,Harmonic 14 0.936 117.28
,Harmonic 15 0.804 38.87
,Harmonic 16 0.238 21.48
,Harmonic 17 (-2.852) 44.92
,Harmonic 18 0.533 26.84
,Harmonic 19 1.668 52.73
,Harmonic 20 0.789 36.22
,Harmonic 21 2.404 9.41
,Harmonic 22 2.033 10.48
,Harmonic 23 (-2.903) 9.93
,Harmonic 24 (-2.635) 8.91
,Harmonic 25 (-0.454) 8.69
,Harmonic 26 (-2.884) 2.51
,Harmonic 27 3.117 11.18
,Harmonic 28 (-1.75) 11.29
,Harmonic 29 2.42 5.21
,Harmonic 30 0.409 6.2
,Harmonic 31 (-1.801) 12.73
,Harmonic 32 1.635 6.16
,Harmonic 33 (-1.062) 5.93
,Harmonic 34 (-0.934) 4.52
,Harmonic 35 1.595 4.18
,Harmonic 36 (-1.093) 5.84
,Harmonic 37 (-2.077) 4.76
,Harmonic 38 0.216 2.51
,Harmonic 39 (-2.014) 7.46
,Harmonic 40 0.931 1.93
,Harmonic 41 2.961 3.34
,Harmonic 42 0.984 1.74]
| 1,563
|
note35 = Note
(Pitch 261.626 48 "c4")
36
(Range
(NoteRange
(NoteRangeAmplitude 10988.29 42 1.74)
(NoteRangeHarmonicFreq 1 261.62))
(NoteRange
(NoteRangeAmplitude 261.62 1 6126.0)
(NoteRangeHarmonicFreq 42 10988.29)))
[Harmonic 1 1.21 6126.0
,Harmonic 2 (-2.933) 644.18
,Harmonic 3 (-2.451) 775.0
,Harmonic 4 (-2.464) 631.46
,Harmonic 5 (-1.187) 943.57
,Harmonic 6 (-1.005) 326.4
,Harmonic 7 0.368 76.78
,Harmonic 8 (-1.664) 23.2
,Harmonic 9 (-1.054) 66.89
,Harmonic 10 (-0.962) 41.62
,Harmonic 11 2.168 56.25
,Harmonic 12 (-6.4e-2) 44.32
,Harmonic 13 1.669 20.99
,Harmonic 14 0.936 117.28
,Harmonic 15 0.804 38.87
,Harmonic 16 0.238 21.48
,Harmonic 17 (-2.852) 44.92
,Harmonic 18 0.533 26.84
,Harmonic 19 1.668 52.73
,Harmonic 20 0.789 36.22
,Harmonic 21 2.404 9.41
,Harmonic 22 2.033 10.48
,Harmonic 23 (-2.903) 9.93
,Harmonic 24 (-2.635) 8.91
,Harmonic 25 (-0.454) 8.69
,Harmonic 26 (-2.884) 2.51
,Harmonic 27 3.117 11.18
,Harmonic 28 (-1.75) 11.29
,Harmonic 29 2.42 5.21
,Harmonic 30 0.409 6.2
,Harmonic 31 (-1.801) 12.73
,Harmonic 32 1.635 6.16
,Harmonic 33 (-1.062) 5.93
,Harmonic 34 (-0.934) 4.52
,Harmonic 35 1.595 4.18
,Harmonic 36 (-1.093) 5.84
,Harmonic 37 (-2.077) 4.76
,Harmonic 38 0.216 2.51
,Harmonic 39 (-2.014) 7.46
,Harmonic 40 0.931 1.93
,Harmonic 41 2.961 3.34
,Harmonic 42 0.984 1.74]
| 1,548
| false
| true
| 0
| 11
| 439
| 615
| 318
| 297
| null | null |
xmonad/xmonad-contrib
|
XMonad/Layout/HintedTile.hs
|
bsd-3-clause
|
-- Divide the screen vertically (horizontally) into n subrectangles
divide :: Alignment -> Orientation -> [D -> D] -> Rectangle -> [Rectangle]
divide _ _ [] _ = []
| 163
|
divide :: Alignment -> Orientation -> [D -> D] -> Rectangle -> [Rectangle]
divide _ _ [] _ = []
| 95
|
divide _ _ [] _ = []
| 20
| true
| true
| 0
| 9
| 28
| 51
| 27
| 24
| null | null |
fpco/inline-c
|
inline-c-cpp/test/TemplateSpec.hs
|
mit
|
returns_vec_of_unsigned_int = do
[C.block| std::vector<unsigned int>* {
return ( (std::vector<unsigned int>*) NULL);
}
|] :: IO (Ptr (CppVector CUInt))
-- compiles: we can return long*
| 217
|
returns_vec_of_unsigned_int = do
[C.block| std::vector<unsigned int>* {
return ( (std::vector<unsigned int>*) NULL);
}
|] :: IO (Ptr (CppVector CUInt))
-- compiles: we can return long*
| 217
|
returns_vec_of_unsigned_int = do
[C.block| std::vector<unsigned int>* {
return ( (std::vector<unsigned int>*) NULL);
}
|] :: IO (Ptr (CppVector CUInt))
-- compiles: we can return long*
| 217
| false
| false
| 0
| 11
| 57
| 34
| 19
| 15
| null | null |
lodvaer/machines-network
|
src/Data/Machine/AltWye.hs
|
bsd-3-clause
|
-- | Alternative implementation of 'wye' for monads that can fail.
--
-- Different in 'Z' in that if the left fails it is kept unchanged as the left
-- input while the right is attempted.
--
-- Useful e.g. for implementing select behaviour for machines over STM.
altWye :: (Monad m, Alternative m)
=> ProcessT m a a'
-> ProcessT m b b'
-> WyeT m a' b' c
-> WyeT m a b c
altWye ma mb m = MachineT $ runMachineT m >>= \v -> case v of
Yield o k ->
return $ Yield o (altWye ma mb k)
Stop ->
return Stop
Await f X ff -> runMachineT ma >>= \case
Yield a k ->
runMachineT . altWye k mb $ f a
Stop ->
runMachineT $ wye stopped mb ff
Await g Refl fg ->
return . Await (\a -> altWye (g a) mb $ encased v) X
. altWye fg mb $ encased v
Await f Y ff -> runMachineT mb >>= \case
Yield b k ->
runMachineT . altWye ma k $ f b
Stop ->
runMachineT $ wye ma stopped ff
Await g Refl fg ->
return . Await (\b -> altWye ma (g b) $ encased v) Y
. altWye ma fg $ encased v
Await f Z ff -> optional (runMachineT ma) >>= \case
Nothing ->
runMachineT mb >>= \case
Yield b k ->
runMachineT . altWye ma k $ f $ Right b
Stop -> runMachineT ma >>= \x -> case x of
Yield b k ->
runMachineT . wye k stopped . f $ Left b
Stop ->
runMachineT $ wye stopped stopped ff
Await g Refl fg ->
return . Await (\b -> wye (g b) stopped $ encased v) X
. wye fg stopped $ encased v
Await g Refl fg ->
return . Await (\b -> altWye ma (g b) $ encased v) Y
. altWye ma fg $ encased v
Just (Yield a k) ->
runMachineT . altWye k mb . f $ Left a
Just Stop ->
runMachineT mb >>= \case
Yield b k ->
runMachineT . wye stopped k . f $ Right b
Stop ->
runMachineT $ wye stopped stopped ff
Await g Refl fg ->
return . Await (\b -> wye stopped (g b) $ encased v) Y
. wye stopped fg $ encased v
Just u@(Await g Refl fg) ->
runMachineT mb >>= \w -> case w of
Yield b k ->
runMachineT . altWye (encased u) k . f $ Right b
Stop ->
return . Await (\a -> wye (g a) stopped $ encased v) X
. wye fg stopped $ encased v
Await h Refl fh ->
return . Await (\case
Left a ->
altWye (g a) (encased w) $
encased v
Right b ->
altWye (encased u) (h b) $
encased v)
Z
. altWye fg fh $ encased v
-- Copy/paste job with slight alterations:
-- | Precompose a pipe onto the left input of a wye.
| 3,378
|
altWye :: (Monad m, Alternative m)
=> ProcessT m a a'
-> ProcessT m b b'
-> WyeT m a' b' c
-> WyeT m a b c
altWye ma mb m = MachineT $ runMachineT m >>= \v -> case v of
Yield o k ->
return $ Yield o (altWye ma mb k)
Stop ->
return Stop
Await f X ff -> runMachineT ma >>= \case
Yield a k ->
runMachineT . altWye k mb $ f a
Stop ->
runMachineT $ wye stopped mb ff
Await g Refl fg ->
return . Await (\a -> altWye (g a) mb $ encased v) X
. altWye fg mb $ encased v
Await f Y ff -> runMachineT mb >>= \case
Yield b k ->
runMachineT . altWye ma k $ f b
Stop ->
runMachineT $ wye ma stopped ff
Await g Refl fg ->
return . Await (\b -> altWye ma (g b) $ encased v) Y
. altWye ma fg $ encased v
Await f Z ff -> optional (runMachineT ma) >>= \case
Nothing ->
runMachineT mb >>= \case
Yield b k ->
runMachineT . altWye ma k $ f $ Right b
Stop -> runMachineT ma >>= \x -> case x of
Yield b k ->
runMachineT . wye k stopped . f $ Left b
Stop ->
runMachineT $ wye stopped stopped ff
Await g Refl fg ->
return . Await (\b -> wye (g b) stopped $ encased v) X
. wye fg stopped $ encased v
Await g Refl fg ->
return . Await (\b -> altWye ma (g b) $ encased v) Y
. altWye ma fg $ encased v
Just (Yield a k) ->
runMachineT . altWye k mb . f $ Left a
Just Stop ->
runMachineT mb >>= \case
Yield b k ->
runMachineT . wye stopped k . f $ Right b
Stop ->
runMachineT $ wye stopped stopped ff
Await g Refl fg ->
return . Await (\b -> wye stopped (g b) $ encased v) Y
. wye stopped fg $ encased v
Just u@(Await g Refl fg) ->
runMachineT mb >>= \w -> case w of
Yield b k ->
runMachineT . altWye (encased u) k . f $ Right b
Stop ->
return . Await (\a -> wye (g a) stopped $ encased v) X
. wye fg stopped $ encased v
Await h Refl fh ->
return . Await (\case
Left a ->
altWye (g a) (encased w) $
encased v
Right b ->
altWye (encased u) (h b) $
encased v)
Z
. altWye fg fh $ encased v
-- Copy/paste job with slight alterations:
-- | Precompose a pipe onto the left input of a wye.
| 3,115
|
altWye ma mb m = MachineT $ runMachineT m >>= \v -> case v of
Yield o k ->
return $ Yield o (altWye ma mb k)
Stop ->
return Stop
Await f X ff -> runMachineT ma >>= \case
Yield a k ->
runMachineT . altWye k mb $ f a
Stop ->
runMachineT $ wye stopped mb ff
Await g Refl fg ->
return . Await (\a -> altWye (g a) mb $ encased v) X
. altWye fg mb $ encased v
Await f Y ff -> runMachineT mb >>= \case
Yield b k ->
runMachineT . altWye ma k $ f b
Stop ->
runMachineT $ wye ma stopped ff
Await g Refl fg ->
return . Await (\b -> altWye ma (g b) $ encased v) Y
. altWye ma fg $ encased v
Await f Z ff -> optional (runMachineT ma) >>= \case
Nothing ->
runMachineT mb >>= \case
Yield b k ->
runMachineT . altWye ma k $ f $ Right b
Stop -> runMachineT ma >>= \x -> case x of
Yield b k ->
runMachineT . wye k stopped . f $ Left b
Stop ->
runMachineT $ wye stopped stopped ff
Await g Refl fg ->
return . Await (\b -> wye (g b) stopped $ encased v) X
. wye fg stopped $ encased v
Await g Refl fg ->
return . Await (\b -> altWye ma (g b) $ encased v) Y
. altWye ma fg $ encased v
Just (Yield a k) ->
runMachineT . altWye k mb . f $ Left a
Just Stop ->
runMachineT mb >>= \case
Yield b k ->
runMachineT . wye stopped k . f $ Right b
Stop ->
runMachineT $ wye stopped stopped ff
Await g Refl fg ->
return . Await (\b -> wye stopped (g b) $ encased v) Y
. wye stopped fg $ encased v
Just u@(Await g Refl fg) ->
runMachineT mb >>= \w -> case w of
Yield b k ->
runMachineT . altWye (encased u) k . f $ Right b
Stop ->
return . Await (\a -> wye (g a) stopped $ encased v) X
. wye fg stopped $ encased v
Await h Refl fh ->
return . Await (\case
Left a ->
altWye (g a) (encased w) $
encased v
Right b ->
altWye (encased u) (h b) $
encased v)
Z
. altWye fg fh $ encased v
-- Copy/paste job with slight alterations:
-- | Precompose a pipe onto the left input of a wye.
| 2,980
| true
| true
| 0
| 32
| 1,669
| 1,084
| 510
| 574
| null | null |
AlexanderPankiv/ghc
|
compiler/typecheck/TcRnTypes.hs
|
bsd-3-clause
|
-- | Union two ImportAvails
--
-- This function is a key part of Import handling, basically
-- for each import we create a separate ImportAvails structure
-- and then union them all together with this function.
plusImportAvails :: ImportAvails -> ImportAvails -> ImportAvails
plusImportAvails
(ImportAvails { imp_mods = mods1,
imp_dep_mods = dmods1, imp_dep_pkgs = dpkgs1,
imp_trust_pkgs = tpkgs1, imp_trust_own_pkg = tself1,
imp_orphs = orphs1, imp_finsts = finsts1 })
(ImportAvails { imp_mods = mods2,
imp_dep_mods = dmods2, imp_dep_pkgs = dpkgs2,
imp_trust_pkgs = tpkgs2, imp_trust_own_pkg = tself2,
imp_orphs = orphs2, imp_finsts = finsts2 })
= ImportAvails { imp_mods = plusModuleEnv_C (++) mods1 mods2,
imp_dep_mods = plusUFM_C plus_mod_dep dmods1 dmods2,
imp_dep_pkgs = dpkgs1 `unionLists` dpkgs2,
imp_trust_pkgs = tpkgs1 `unionLists` tpkgs2,
imp_trust_own_pkg = tself1 || tself2,
imp_orphs = orphs1 `unionLists` orphs2,
imp_finsts = finsts1 `unionLists` finsts2 }
where
plus_mod_dep (m1, boot1) (m2, boot2)
= WARN( not (m1 == m2), (ppr m1 <+> ppr m2) $$ (ppr boot1 <+> ppr boot2) )
-- Check mod-names match
(m1, boot1 && boot2) -- If either side can "see" a non-hi-boot interface, use that
{-
************************************************************************
* *
\subsection{Where from}
* *
************************************************************************
The @WhereFrom@ type controls where the renamer looks for an interface file
-}
| 1,905
|
plusImportAvails :: ImportAvails -> ImportAvails -> ImportAvails
plusImportAvails
(ImportAvails { imp_mods = mods1,
imp_dep_mods = dmods1, imp_dep_pkgs = dpkgs1,
imp_trust_pkgs = tpkgs1, imp_trust_own_pkg = tself1,
imp_orphs = orphs1, imp_finsts = finsts1 })
(ImportAvails { imp_mods = mods2,
imp_dep_mods = dmods2, imp_dep_pkgs = dpkgs2,
imp_trust_pkgs = tpkgs2, imp_trust_own_pkg = tself2,
imp_orphs = orphs2, imp_finsts = finsts2 })
= ImportAvails { imp_mods = plusModuleEnv_C (++) mods1 mods2,
imp_dep_mods = plusUFM_C plus_mod_dep dmods1 dmods2,
imp_dep_pkgs = dpkgs1 `unionLists` dpkgs2,
imp_trust_pkgs = tpkgs1 `unionLists` tpkgs2,
imp_trust_own_pkg = tself1 || tself2,
imp_orphs = orphs1 `unionLists` orphs2,
imp_finsts = finsts1 `unionLists` finsts2 }
where
plus_mod_dep (m1, boot1) (m2, boot2)
= WARN( not (m1 == m2), (ppr m1 <+> ppr m2) $$ (ppr boot1 <+> ppr boot2) )
-- Check mod-names match
(m1, boot1 && boot2) -- If either side can "see" a non-hi-boot interface, use that
{-
************************************************************************
* *
\subsection{Where from}
* *
************************************************************************
The @WhereFrom@ type controls where the renamer looks for an interface file
-}
| 1,694
|
plusImportAvails
(ImportAvails { imp_mods = mods1,
imp_dep_mods = dmods1, imp_dep_pkgs = dpkgs1,
imp_trust_pkgs = tpkgs1, imp_trust_own_pkg = tself1,
imp_orphs = orphs1, imp_finsts = finsts1 })
(ImportAvails { imp_mods = mods2,
imp_dep_mods = dmods2, imp_dep_pkgs = dpkgs2,
imp_trust_pkgs = tpkgs2, imp_trust_own_pkg = tself2,
imp_orphs = orphs2, imp_finsts = finsts2 })
= ImportAvails { imp_mods = plusModuleEnv_C (++) mods1 mods2,
imp_dep_mods = plusUFM_C plus_mod_dep dmods1 dmods2,
imp_dep_pkgs = dpkgs1 `unionLists` dpkgs2,
imp_trust_pkgs = tpkgs1 `unionLists` tpkgs2,
imp_trust_own_pkg = tself1 || tself2,
imp_orphs = orphs1 `unionLists` orphs2,
imp_finsts = finsts1 `unionLists` finsts2 }
where
plus_mod_dep (m1, boot1) (m2, boot2)
= WARN( not (m1 == m2), (ppr m1 <+> ppr m2) $$ (ppr boot1 <+> ppr boot2) )
-- Check mod-names match
(m1, boot1 && boot2) -- If either side can "see" a non-hi-boot interface, use that
{-
************************************************************************
* *
\subsection{Where from}
* *
************************************************************************
The @WhereFrom@ type controls where the renamer looks for an interface file
-}
| 1,626
| true
| true
| 0
| 10
| 646
| 303
| 182
| 121
| null | null |
msullivan/advent-of-code
|
2015/A22a.hs
|
mit
|
name (n, _, _) = n
| 18
|
name (n, _, _) = n
| 18
|
name (n, _, _) = n
| 18
| false
| false
| 0
| 5
| 5
| 19
| 10
| 9
| null | null |
peterkmurphy/preference
|
src/ElectionClasses.hs
|
bsd-3-clause
|
combtransandorigpiles :: [[[Int]]] -> [[[Int]]] -> Int -> Int -> [[[Int]]]
combtransandorigpiles transballotpile origballotpile nocand excludindex =
[zipornot transballotpile origballotpile excludindex i | i <- [0..(nocand-1)]]
| 231
|
combtransandorigpiles :: [[[Int]]] -> [[[Int]]] -> Int -> Int -> [[[Int]]]
combtransandorigpiles transballotpile origballotpile nocand excludindex =
[zipornot transballotpile origballotpile excludindex i | i <- [0..(nocand-1)]]
| 231
|
combtransandorigpiles transballotpile origballotpile nocand excludindex =
[zipornot transballotpile origballotpile excludindex i | i <- [0..(nocand-1)]]
| 156
| false
| true
| 0
| 11
| 29
| 100
| 54
| 46
| null | null |
themoritz/cabal
|
cabal-install/Distribution/Client/TargetSelector.hs
|
bsd-3-clause
|
guardPackageFile str _ = matchErrorExpected "package .cabal file" str
| 69
|
guardPackageFile str _ = matchErrorExpected "package .cabal file" str
| 69
|
guardPackageFile str _ = matchErrorExpected "package .cabal file" str
| 69
| false
| false
| 0
| 5
| 8
| 16
| 7
| 9
| null | null |
seckcoder/vector
|
Data/Vector/Storable.hs
|
bsd-3-clause
|
ifoldr = G.ifoldr
| 17
|
ifoldr = G.ifoldr
| 17
|
ifoldr = G.ifoldr
| 17
| false
| false
| 1
| 6
| 2
| 12
| 4
| 8
| null | null |
samvher/translatethenews
|
app/TTN/Routes.hs
|
mit
|
-- | Arguments are first article id, then language
autoTranslationR, newTranslationR, viewTranslationR
:: Path '[Key Article, Language] Open
autoTranslationR = "articles" <//> var <//> "translations" <//> var <//> "auto"
| 222
|
autoTranslationR, newTranslationR, viewTranslationR
:: Path '[Key Article, Language] Open
autoTranslationR = "articles" <//> var <//> "translations" <//> var <//> "auto"
| 171
|
autoTranslationR = "articles" <//> var <//> "translations" <//> var <//> "auto"
| 79
| true
| true
| 0
| 8
| 30
| 48
| 27
| 21
| null | null |
keera-studios/hsQt
|
Qtc/Classes/Script.hs
|
bsd-2-clause
|
connectDynamicSlot :: QObject a -> QScriptEngine () -> String -> String -> QScriptValue () -> QScriptValue () -> IO ()
connectDynamicSlot _this _eng _sig_nam _slt_nam _sfv _stv
| (isSuffixOf "()" _sig_nam) && (isSuffixOf "()" _slt_nam)
= connectSlot _this _sig_nam _this _slt_nam $ scriptSlot_nll _eng _sfv _stv
| (isSuffixOf "(int)" _sig_nam) && (isSuffixOf "(int)" _slt_nam)
= connectSlot _this _sig_nam _this _slt_nam $ scriptSlot_int _eng _sfv _stv
| (isSuffixOf "(bool)" _sig_nam) && (isSuffixOf "(bool)" _slt_nam)
= connectSlot _this _sig_nam _this _slt_nam $ scriptSlot_bool _eng _sfv _stv
| (isPtrSuffix _sig_nam) && (isPtrSuffix _slt_nam)
= connectSlot _this _sig_nam _this _slt_nam $ scriptSlot_ptr _eng _sfv _stv $ getSigPtrTyp _sig_nam
| otherwise
= return ()
| 805
|
connectDynamicSlot :: QObject a -> QScriptEngine () -> String -> String -> QScriptValue () -> QScriptValue () -> IO ()
connectDynamicSlot _this _eng _sig_nam _slt_nam _sfv _stv
| (isSuffixOf "()" _sig_nam) && (isSuffixOf "()" _slt_nam)
= connectSlot _this _sig_nam _this _slt_nam $ scriptSlot_nll _eng _sfv _stv
| (isSuffixOf "(int)" _sig_nam) && (isSuffixOf "(int)" _slt_nam)
= connectSlot _this _sig_nam _this _slt_nam $ scriptSlot_int _eng _sfv _stv
| (isSuffixOf "(bool)" _sig_nam) && (isSuffixOf "(bool)" _slt_nam)
= connectSlot _this _sig_nam _this _slt_nam $ scriptSlot_bool _eng _sfv _stv
| (isPtrSuffix _sig_nam) && (isPtrSuffix _slt_nam)
= connectSlot _this _sig_nam _this _slt_nam $ scriptSlot_ptr _eng _sfv _stv $ getSigPtrTyp _sig_nam
| otherwise
= return ()
| 805
|
connectDynamicSlot _this _eng _sig_nam _slt_nam _sfv _stv
| (isSuffixOf "()" _sig_nam) && (isSuffixOf "()" _slt_nam)
= connectSlot _this _sig_nam _this _slt_nam $ scriptSlot_nll _eng _sfv _stv
| (isSuffixOf "(int)" _sig_nam) && (isSuffixOf "(int)" _slt_nam)
= connectSlot _this _sig_nam _this _slt_nam $ scriptSlot_int _eng _sfv _stv
| (isSuffixOf "(bool)" _sig_nam) && (isSuffixOf "(bool)" _slt_nam)
= connectSlot _this _sig_nam _this _slt_nam $ scriptSlot_bool _eng _sfv _stv
| (isPtrSuffix _sig_nam) && (isPtrSuffix _slt_nam)
= connectSlot _this _sig_nam _this _slt_nam $ scriptSlot_ptr _eng _sfv _stv $ getSigPtrTyp _sig_nam
| otherwise
= return ()
| 686
| false
| true
| 0
| 13
| 142
| 306
| 135
| 171
| null | null |
lpalma/hamerkop
|
test/CommandsSpec.hs
|
bsd-3-clause
|
multiplePostsEnv :: Env
multiplePostsEnv = addUser (createUser ("foo", stubPosts, [])) env
where env = createEnv (Map.empty, Map.empty, secAfterMidnight 121)
| 159
|
multiplePostsEnv :: Env
multiplePostsEnv = addUser (createUser ("foo", stubPosts, [])) env
where env = createEnv (Map.empty, Map.empty, secAfterMidnight 121)
| 159
|
multiplePostsEnv = addUser (createUser ("foo", stubPosts, [])) env
where env = createEnv (Map.empty, Map.empty, secAfterMidnight 121)
| 135
| false
| true
| 1
| 9
| 20
| 69
| 33
| 36
| null | null |
atilaneves/mqtt_hs
|
tests/Mqtt/Broker/Test.hs
|
bsd-3-clause
|
testConnack = testGroup "Connect" [ testCase "Test MQTT reply includes CONNACK" testDecodeMqttConnect
]
| 137
|
testConnack = testGroup "Connect" [ testCase "Test MQTT reply includes CONNACK" testDecodeMqttConnect
]
| 137
|
testConnack = testGroup "Connect" [ testCase "Test MQTT reply includes CONNACK" testDecodeMqttConnect
]
| 137
| false
| false
| 0
| 7
| 46
| 19
| 9
| 10
| null | null |
infotroph/pandoc
|
src/Text/Pandoc/Writers/HTML.hs
|
gpl-2.0
|
blockToHtml opts (BlockQuote blocks) =
-- in S5, treat list in blockquote specially
-- if default is incremental, make it nonincremental;
-- otherwise incremental
if writerSlideVariant opts /= NoSlides
then let inc = not (writerIncremental opts) in
case blocks of
[BulletList lst] -> blockToHtml (opts {writerIncremental = inc})
(BulletList lst)
[OrderedList attribs lst] ->
blockToHtml (opts {writerIncremental = inc})
(OrderedList attribs lst)
[DefinitionList lst] ->
blockToHtml (opts {writerIncremental = inc})
(DefinitionList lst)
_ -> do contents <- blockListToHtml opts blocks
return $ H.blockquote
$ nl opts >> contents >> nl opts
else do
contents <- blockListToHtml opts blocks
return $ H.blockquote $ nl opts >> contents >> nl opts
| 1,103
|
blockToHtml opts (BlockQuote blocks) =
-- in S5, treat list in blockquote specially
-- if default is incremental, make it nonincremental;
-- otherwise incremental
if writerSlideVariant opts /= NoSlides
then let inc = not (writerIncremental opts) in
case blocks of
[BulletList lst] -> blockToHtml (opts {writerIncremental = inc})
(BulletList lst)
[OrderedList attribs lst] ->
blockToHtml (opts {writerIncremental = inc})
(OrderedList attribs lst)
[DefinitionList lst] ->
blockToHtml (opts {writerIncremental = inc})
(DefinitionList lst)
_ -> do contents <- blockListToHtml opts blocks
return $ H.blockquote
$ nl opts >> contents >> nl opts
else do
contents <- blockListToHtml opts blocks
return $ H.blockquote $ nl opts >> contents >> nl opts
| 1,103
|
blockToHtml opts (BlockQuote blocks) =
-- in S5, treat list in blockquote specially
-- if default is incremental, make it nonincremental;
-- otherwise incremental
if writerSlideVariant opts /= NoSlides
then let inc = not (writerIncremental opts) in
case blocks of
[BulletList lst] -> blockToHtml (opts {writerIncremental = inc})
(BulletList lst)
[OrderedList attribs lst] ->
blockToHtml (opts {writerIncremental = inc})
(OrderedList attribs lst)
[DefinitionList lst] ->
blockToHtml (opts {writerIncremental = inc})
(DefinitionList lst)
_ -> do contents <- blockListToHtml opts blocks
return $ H.blockquote
$ nl opts >> contents >> nl opts
else do
contents <- blockListToHtml opts blocks
return $ H.blockquote $ nl opts >> contents >> nl opts
| 1,103
| false
| false
| 0
| 17
| 470
| 249
| 123
| 126
| null | null |
mrmonday/Idris-dev
|
src/Idris/Imports.hs
|
bsd-3-clause
|
installedPackages :: IO [String]
installedPackages = do
idir <- getIdrisLibDir
filterM (goodDir idir) =<< dirContents idir
where
allFilesInDir base fp = do
let fullpath = base </> fp
isDir <- doesDirectoryExist' fullpath
if isDir
then fmap concat (mapM (allFilesInDir fullpath) =<< dirContents fullpath)
else return [fp]
dirContents = fmap (filter (not . (`elem` [".", ".."]))) . getDirectoryContents
goodDir idir d = any (".ibc" `isSuffixOf`) <$> allFilesInDir idir d
-- Case sensitive file existence check for Mac OS X.
| 559
|
installedPackages :: IO [String]
installedPackages = do
idir <- getIdrisLibDir
filterM (goodDir idir) =<< dirContents idir
where
allFilesInDir base fp = do
let fullpath = base </> fp
isDir <- doesDirectoryExist' fullpath
if isDir
then fmap concat (mapM (allFilesInDir fullpath) =<< dirContents fullpath)
else return [fp]
dirContents = fmap (filter (not . (`elem` [".", ".."]))) . getDirectoryContents
goodDir idir d = any (".ibc" `isSuffixOf`) <$> allFilesInDir idir d
-- Case sensitive file existence check for Mac OS X.
| 559
|
installedPackages = do
idir <- getIdrisLibDir
filterM (goodDir idir) =<< dirContents idir
where
allFilesInDir base fp = do
let fullpath = base </> fp
isDir <- doesDirectoryExist' fullpath
if isDir
then fmap concat (mapM (allFilesInDir fullpath) =<< dirContents fullpath)
else return [fp]
dirContents = fmap (filter (not . (`elem` [".", ".."]))) . getDirectoryContents
goodDir idir d = any (".ibc" `isSuffixOf`) <$> allFilesInDir idir d
-- Case sensitive file existence check for Mac OS X.
| 526
| false
| true
| 3
| 13
| 115
| 202
| 95
| 107
| null | null |
ryantrinkle/reflex
|
src/Reflex/Dynamic.hs
|
bsd-3-clause
|
-- | Print the result of applying the provided function to the value
-- of the 'Dynamic' when it is first read and on each subsequent change
-- that is observed (as 'traceEvent'). This should /only/ be used for
-- debugging.
--
-- Note: Just like Debug.Trace.trace, the value will only be shown if something
-- else in the system is depending on it.
traceDynWith :: Reflex t => (a -> String) -> Dynamic t a -> Dynamic t a
traceDynWith f d =
let e' = traceEventWith f $ updated d
getV0 = do
x <- sample $ current d
trace (f x) $ return x
in unsafeBuildDynamic getV0 e'
| 593
|
traceDynWith :: Reflex t => (a -> String) -> Dynamic t a -> Dynamic t a
traceDynWith f d =
let e' = traceEventWith f $ updated d
getV0 = do
x <- sample $ current d
trace (f x) $ return x
in unsafeBuildDynamic getV0 e'
| 243
|
traceDynWith f d =
let e' = traceEventWith f $ updated d
getV0 = do
x <- sample $ current d
trace (f x) $ return x
in unsafeBuildDynamic getV0 e'
| 171
| true
| true
| 0
| 14
| 136
| 119
| 58
| 61
| null | null |
ku-fpg/kansas-amber
|
System/Hardware/Haskino/ShallowDeepPlugin/Utils.hs
|
bsd-3-clause
|
stringToId :: PassCoreM m => String -> m Id
stringToId str = do
id_m <- stringToId_maybe str
case id_m of
(Just id') -> return id'
_ -> error $ "Error unable to Lookup ID " ++ str ++ "."
| 207
|
stringToId :: PassCoreM m => String -> m Id
stringToId str = do
id_m <- stringToId_maybe str
case id_m of
(Just id') -> return id'
_ -> error $ "Error unable to Lookup ID " ++ str ++ "."
| 207
|
stringToId str = do
id_m <- stringToId_maybe str
case id_m of
(Just id') -> return id'
_ -> error $ "Error unable to Lookup ID " ++ str ++ "."
| 163
| false
| true
| 0
| 13
| 59
| 84
| 37
| 47
| null | null |
DanielG/iproute
|
Data/IP/RouteTable/Internal.hs
|
bsd-3-clause
|
link :: Routable k => IPRTable k a -> IPRTable k a -> IPRTable k a
link s1@(Node k1 _ _ _ _) s2@(Node k2 _ _ _ _)
| isLeft k1 tbg = Node kg tbg Nothing s1 s2
| otherwise = Node kg tbg Nothing s2 s1
where
kg = glue 0 k1 k2
tbg = keyToTestBit kg
| 261
|
link :: Routable k => IPRTable k a -> IPRTable k a -> IPRTable k a
link s1@(Node k1 _ _ _ _) s2@(Node k2 _ _ _ _)
| isLeft k1 tbg = Node kg tbg Nothing s1 s2
| otherwise = Node kg tbg Nothing s2 s1
where
kg = glue 0 k1 k2
tbg = keyToTestBit kg
| 261
|
link s1@(Node k1 _ _ _ _) s2@(Node k2 _ _ _ _)
| isLeft k1 tbg = Node kg tbg Nothing s1 s2
| otherwise = Node kg tbg Nothing s2 s1
where
kg = glue 0 k1 k2
tbg = keyToTestBit kg
| 194
| false
| true
| 9
| 7
| 77
| 141
| 69
| 72
| null | null |
bermanjosh/bloodhound
|
tests/V5/tests.hs
|
bsd-3-clause
|
createExampleIndex :: (MonadBH m) => m Reply
createExampleIndex = createIndex (IndexSettings (ShardCount 1) (ReplicaCount 0)) testIndex
| 135
|
createExampleIndex :: (MonadBH m) => m Reply
createExampleIndex = createIndex (IndexSettings (ShardCount 1) (ReplicaCount 0)) testIndex
| 135
|
createExampleIndex = createIndex (IndexSettings (ShardCount 1) (ReplicaCount 0)) testIndex
| 90
| false
| true
| 0
| 9
| 15
| 48
| 24
| 24
| null | null |
write-you-a-scheme-v2/scheme
|
src/Parser.hs
|
mit
|
readExprFile :: SourceName -> T.Text -> Either ParseError LispVal
readExprFile = parse (contents (List <$> manyLispVal))
| 120
|
readExprFile :: SourceName -> T.Text -> Either ParseError LispVal
readExprFile = parse (contents (List <$> manyLispVal))
| 120
|
readExprFile = parse (contents (List <$> manyLispVal))
| 54
| false
| true
| 0
| 9
| 15
| 42
| 21
| 21
| null | null |
dmcclean/dimensional-dk
|
src/Numeric/Units/Dimensional/NonSI.hs
|
bsd-3-clause
|
-- | One mil is one thousandth of an 'inch'.
--
-- This mil is based on the international 'inch'.
--
-- See <https://en.wikipedia.org/wiki/Thousandth_of_an_inch here> for further information.
--
-- >>> 1 *~ mil
-- 2.54e-5 m
--
-- prop> 1000 *~ mil === 1 *~ inch
--
-- >>> 1 *~ mil :: Length Rational
-- 127 % 5000000 m
mil :: Fractional a => Unit 'NonMetric DLength a
mil = mkUnitQ (ucum "[mil_i]" "mil" "mil") 0.001 $ inch
| 423
|
mil :: Fractional a => Unit 'NonMetric DLength a
mil = mkUnitQ (ucum "[mil_i]" "mil" "mil") 0.001 $ inch
| 104
|
mil = mkUnitQ (ucum "[mil_i]" "mil" "mil") 0.001 $ inch
| 55
| true
| true
| 0
| 8
| 79
| 66
| 36
| 30
| null | null |
elblake/expiring-cache-map
|
tests/TestECMWithTestSequenceCommon.hs
|
bsd-3-clause
|
printOutFailedPattern from_where filt_events' filt_events'' filt_events''' filt_events'''' = do
putStrLn $ "Failed sequence test in " ++ from_where ++ ":"
if not (pattern' (filt_events'))
then putStrLn $ "Failed: pattern 1: " ++ (show filt_events')
else return ()
if not (pattern'' (filt_events''))
then putStrLn $ "Failed: pattern 2: " ++ (show filt_events'')
else return ()
if not (pattern''' (filt_events'''))
then putStrLn $ "Failed: pattern 3: " ++ (show filt_events''')
else return ()
if not (pattern'''' (filt_events''''))
then putStrLn $ "Failed: pattern 4: " ++ (show filt_events'''')
else return ()
return ()
| 662
|
printOutFailedPattern from_where filt_events' filt_events'' filt_events''' filt_events'''' = do
putStrLn $ "Failed sequence test in " ++ from_where ++ ":"
if not (pattern' (filt_events'))
then putStrLn $ "Failed: pattern 1: " ++ (show filt_events')
else return ()
if not (pattern'' (filt_events''))
then putStrLn $ "Failed: pattern 2: " ++ (show filt_events'')
else return ()
if not (pattern''' (filt_events'''))
then putStrLn $ "Failed: pattern 3: " ++ (show filt_events''')
else return ()
if not (pattern'''' (filt_events''''))
then putStrLn $ "Failed: pattern 4: " ++ (show filt_events'''')
else return ()
return ()
| 662
|
printOutFailedPattern from_where filt_events' filt_events'' filt_events''' filt_events'''' = do
putStrLn $ "Failed sequence test in " ++ from_where ++ ":"
if not (pattern' (filt_events'))
then putStrLn $ "Failed: pattern 1: " ++ (show filt_events')
else return ()
if not (pattern'' (filt_events''))
then putStrLn $ "Failed: pattern 2: " ++ (show filt_events'')
else return ()
if not (pattern''' (filt_events'''))
then putStrLn $ "Failed: pattern 3: " ++ (show filt_events''')
else return ()
if not (pattern'''' (filt_events''''))
then putStrLn $ "Failed: pattern 4: " ++ (show filt_events'''')
else return ()
return ()
| 662
| false
| false
| 0
| 11
| 132
| 208
| 102
| 106
| null | null |
mit-plv/riscv-semantics
|
src/Spec/ExecuteF.hs
|
bsd-3-clause
|
execute (Fsgnjn_s rd rs1 rs2) = do
x <- getFPRegister rs1
y <- getFPRegister rs2
setFPRegister rd (bitSlice x 0 31 .|. (complement y .&. bit 31))
| 151
|
execute (Fsgnjn_s rd rs1 rs2) = do
x <- getFPRegister rs1
y <- getFPRegister rs2
setFPRegister rd (bitSlice x 0 31 .|. (complement y .&. bit 31))
| 151
|
execute (Fsgnjn_s rd rs1 rs2) = do
x <- getFPRegister rs1
y <- getFPRegister rs2
setFPRegister rd (bitSlice x 0 31 .|. (complement y .&. bit 31))
| 151
| false
| false
| 0
| 12
| 32
| 75
| 33
| 42
| null | null |
demhydraz/waffle
|
src/Backend/Lua/Lua.hs
|
bsd-3-clause
|
isOp "*" = P.True
| 19
|
isOp "*" = P.True
| 19
|
isOp "*" = P.True
| 19
| false
| false
| 0
| 5
| 5
| 11
| 5
| 6
| null | null |
sdiehl/ghc
|
libraries/base/Control/Monad/ST/Lazy/Imp.hs
|
bsd-3-clause
|
-- | Allow the result of an 'ST' computation to be used (lazily)
-- inside the computation.
-- Note that if @f@ is strict, @'fixST' f = _|_@.
fixST :: (a -> ST s a) -> ST s a
fixST m = ST (\ s ->
let
q@(r,_s') = unST (m r) s
in q)
| 283
|
fixST :: (a -> ST s a) -> ST s a
fixST m = ST (\ s ->
let
q@(r,_s') = unST (m r) s
in q)
| 141
|
fixST m = ST (\ s ->
let
q@(r,_s') = unST (m r) s
in q)
| 108
| true
| true
| 0
| 14
| 107
| 86
| 43
| 43
| null | null |
seereason/ghcjs
|
src/Gen2/Prim.hs
|
mit
|
genPrim _ _ ClzOp [r] [x] = PrimInline [j| `r` = h$clz32(`x`); |]
| 104
|
genPrim _ _ ClzOp [r] [x] = PrimInline [j| `r` = h$clz32(`x`); |]
| 104
|
genPrim _ _ ClzOp [r] [x] = PrimInline [j| `r` = h$clz32(`x`); |]
| 104
| false
| false
| 0
| 6
| 51
| 30
| 17
| 13
| null | null |
fedelebron/AVL
|
Data/Tree/AVL/Static/Internal.hs
|
bsd-3-clause
|
insertUnbalancedAt (Rightie b g q) (LLC a d ctx) = zipUp (+1) z
where
z = Zipper t ctx
t = case q of
Rightie p t1 t2 -> Balanced p (Leftie b g t1) (Balanced a t2 d)
Leftie p t1 t2 -> Balanced p (Balanced b g t1) (Rightie a t2 d)
Balanced p t1 t2 -> Balanced p (Balanced b g t1) (Balanced a t2 d)
| 335
|
insertUnbalancedAt (Rightie b g q) (LLC a d ctx) = zipUp (+1) z
where
z = Zipper t ctx
t = case q of
Rightie p t1 t2 -> Balanced p (Leftie b g t1) (Balanced a t2 d)
Leftie p t1 t2 -> Balanced p (Balanced b g t1) (Rightie a t2 d)
Balanced p t1 t2 -> Balanced p (Balanced b g t1) (Balanced a t2 d)
| 335
|
insertUnbalancedAt (Rightie b g q) (LLC a d ctx) = zipUp (+1) z
where
z = Zipper t ctx
t = case q of
Rightie p t1 t2 -> Balanced p (Leftie b g t1) (Balanced a t2 d)
Leftie p t1 t2 -> Balanced p (Balanced b g t1) (Rightie a t2 d)
Balanced p t1 t2 -> Balanced p (Balanced b g t1) (Balanced a t2 d)
| 335
| false
| false
| 1
| 10
| 108
| 185
| 88
| 97
| null | null |
bitemyapp/ghc
|
compiler/hsSyn/HsExpr.hs
|
bsd-3-clause
|
matchSeparator ThPatQuote = panic "unused"
| 44
|
matchSeparator ThPatQuote = panic "unused"
| 44
|
matchSeparator ThPatQuote = panic "unused"
| 44
| false
| false
| 0
| 5
| 6
| 12
| 5
| 7
| null | null |
homam/fsm-conversational-ui
|
src/Survey.hs
|
bsd-3-clause
|
personal :: Survey (Name, Age)
personal = Group "Your personal infromation" person
| 82
|
personal :: Survey (Name, Age)
personal = Group "Your personal infromation" person
| 82
|
personal = Group "Your personal infromation" person
| 51
| false
| true
| 0
| 6
| 11
| 25
| 13
| 12
| null | null |
sdiehl/ghc
|
hadrian/src/Oracles/Setting.hs
|
bsd-3-clause
|
-- | Check whether the host OS setting matches one of the given strings.
anyHostOs :: [String] -> Action Bool
anyHostOs = matchSetting HostOs
| 141
|
anyHostOs :: [String] -> Action Bool
anyHostOs = matchSetting HostOs
| 68
|
anyHostOs = matchSetting HostOs
| 31
| true
| true
| 0
| 6
| 23
| 25
| 13
| 12
| null | null |
JacquesCarette/literate-scientific-software
|
code/drasil-example/Drasil/GamePhysics/Unitals.hs
|
bsd-2-clause
|
angParam, momtParam, perpParam, rigidParam, velBodyParam, velParam :: String -> Symbol -> UnitalChunk
angParam n w = ucs'
(dccWDS ("angular velocity" ++ n) (compoundPhrase'
(cn $ n ++ " body's") (QP.angularVelocity ^. term))
(phrase QP.angularVelocity)) (sub (eqSymb QP.angularVelocity) w) Real angVelU
| 308
|
angParam, momtParam, perpParam, rigidParam, velBodyParam, velParam :: String -> Symbol -> UnitalChunk
angParam n w = ucs'
(dccWDS ("angular velocity" ++ n) (compoundPhrase'
(cn $ n ++ " body's") (QP.angularVelocity ^. term))
(phrase QP.angularVelocity)) (sub (eqSymb QP.angularVelocity) w) Real angVelU
| 307
|
angParam n w = ucs'
(dccWDS ("angular velocity" ++ n) (compoundPhrase'
(cn $ n ++ " body's") (QP.angularVelocity ^. term))
(phrase QP.angularVelocity)) (sub (eqSymb QP.angularVelocity) w) Real angVelU
| 205
| false
| true
| 3
| 12
| 45
| 121
| 62
| 59
| null | null |
tolysz/prepare-ghcjs
|
spec-lts8/aeson/Data/Aeson/Types/Internal.hs
|
bsd-3-clause
|
-- | Default encoding 'Options':
--
-- @
-- 'Options'
-- { 'fieldLabelModifier' = id
-- , 'constructorTagModifier' = id
-- , 'allNullaryToStringTag' = True
-- , 'omitNothingFields' = False
-- , 'sumEncoding' = 'defaultTaggedObject'
-- , 'unwrapUnaryRecords' = False
-- }
-- @
defaultOptions :: Options
defaultOptions = Options
{ fieldLabelModifier = id
, constructorTagModifier = id
, allNullaryToStringTag = True
, omitNothingFields = False
, sumEncoding = defaultTaggedObject
, unwrapUnaryRecords = False
}
| 689
|
defaultOptions :: Options
defaultOptions = Options
{ fieldLabelModifier = id
, constructorTagModifier = id
, allNullaryToStringTag = True
, omitNothingFields = False
, sumEncoding = defaultTaggedObject
, unwrapUnaryRecords = False
}
| 382
|
defaultOptions = Options
{ fieldLabelModifier = id
, constructorTagModifier = id
, allNullaryToStringTag = True
, omitNothingFields = False
, sumEncoding = defaultTaggedObject
, unwrapUnaryRecords = False
}
| 356
| true
| true
| 0
| 6
| 255
| 61
| 43
| 18
| null | null |
DaMSL/K3
|
src/Language/K3/Metaprogram/Evaluation.hs
|
apache-2.0
|
spliceType :: K3 Type -> TypeGenerator
spliceType = mapTree doSplice
where
doSplice [] t@(tag -> TDeclaredVar i) = expectTypeSplicer i >>= \nt -> return $! foldl (@+) nt $! annotations t
doSplice ch t@(tag -> TRecord ids) = mapM spliceIdentifier ids >>= \nids -> return $! Node (TRecord nids :@: annotations t) ch
doSplice ch (Node tg _) = return $! Node tg ch
| 385
|
spliceType :: K3 Type -> TypeGenerator
spliceType = mapTree doSplice
where
doSplice [] t@(tag -> TDeclaredVar i) = expectTypeSplicer i >>= \nt -> return $! foldl (@+) nt $! annotations t
doSplice ch t@(tag -> TRecord ids) = mapM spliceIdentifier ids >>= \nids -> return $! Node (TRecord nids :@: annotations t) ch
doSplice ch (Node tg _) = return $! Node tg ch
| 385
|
spliceType = mapTree doSplice
where
doSplice [] t@(tag -> TDeclaredVar i) = expectTypeSplicer i >>= \nt -> return $! foldl (@+) nt $! annotations t
doSplice ch t@(tag -> TRecord ids) = mapM spliceIdentifier ids >>= \nids -> return $! Node (TRecord nids :@: annotations t) ch
doSplice ch (Node tg _) = return $! Node tg ch
| 346
| false
| true
| 0
| 11
| 88
| 165
| 81
| 84
| null | null |
siddhanathan/ghc
|
compiler/typecheck/TcGenDeriv.hs
|
bsd-3-clause
|
true_Expr = nlHsVar true_RDR
| 34
|
true_Expr = nlHsVar true_RDR
| 34
|
true_Expr = nlHsVar true_RDR
| 34
| false
| false
| 1
| 5
| 9
| 12
| 4
| 8
| null | null |
JacquesCarette/literate-scientific-software
|
code/drasil-lang/Language/Drasil/Chunk/UnitDefn.hs
|
bsd-2-clause
|
-- | We don't want an Ord on units, but this still allows us to compare them
compUnitDefn :: UnitDefn -> UnitDefn -> Ordering
compUnitDefn a b = compUSymb (usymb a) (usymb b)
| 174
|
compUnitDefn :: UnitDefn -> UnitDefn -> Ordering
compUnitDefn a b = compUSymb (usymb a) (usymb b)
| 97
|
compUnitDefn a b = compUSymb (usymb a) (usymb b)
| 48
| true
| true
| 0
| 7
| 32
| 42
| 21
| 21
| null | null |
ComputationWithBoundedResources/ara-inference
|
doc/tpdb_trs/Haskell/basic_haskell/enumFromThen_3.hs
|
mit
|
toEnum3 wv = toEnum1 wv
| 23
|
toEnum3 wv = toEnum1 wv
| 23
|
toEnum3 wv = toEnum1 wv
| 23
| false
| false
| 0
| 5
| 4
| 12
| 5
| 7
| null | null |
achirkin/BuildWrapper
|
src-exe/Language/Haskell/BuildWrapper/CMD.hs
|
bsd-3-clause
|
mgenerateUsage :: BWCmd
mgenerateUsage=GenerateUsage tf cp cf uf co ra cc lc
| 77
|
mgenerateUsage :: BWCmd
mgenerateUsage=GenerateUsage tf cp cf uf co ra cc lc
| 76
|
mgenerateUsage=GenerateUsage tf cp cf uf co ra cc lc
| 52
| false
| true
| 0
| 5
| 12
| 28
| 14
| 14
| null | null |
dat2/haskell-scheme
|
src/Eval.hs
|
mit
|
symbolToString :: [LispVal] -> Throws LispVal
symbolToString [Atom n] = return $ String n
| 89
|
symbolToString :: [LispVal] -> Throws LispVal
symbolToString [Atom n] = return $ String n
| 89
|
symbolToString [Atom n] = return $ String n
| 43
| false
| true
| 0
| 7
| 13
| 37
| 18
| 19
| null | null |
paraseba/haskell-brainfuck
|
src/HaskBF/Tape.hs
|
mit
|
blankTape :: BFTape
blankTape = constTape 0
| 43
|
blankTape :: BFTape
blankTape = constTape 0
| 43
|
blankTape = constTape 0
| 23
| false
| true
| 0
| 5
| 6
| 14
| 7
| 7
| null | null |
unisonweb/platform
|
parser-typechecker/src/Unison/Builtin.hs
|
mit
|
forall4
:: Var v
=> Text -> Text -> Text -> Text
-> (Type v -> Type v -> Type v -> Type v -> Type v)
-> Type v
forall4 na nb nc nd body = Type.foralls () [a,b,c,d] (body ta tb tc td)
where
a = Var.named na
b = Var.named nb
c = Var.named nc
d = Var.named nd
ta = Type.var () a
tb = Type.var () b
tc = Type.var () c
td = Type.var () d
| 358
|
forall4
:: Var v
=> Text -> Text -> Text -> Text
-> (Type v -> Type v -> Type v -> Type v -> Type v)
-> Type v
forall4 na nb nc nd body = Type.foralls () [a,b,c,d] (body ta tb tc td)
where
a = Var.named na
b = Var.named nb
c = Var.named nc
d = Var.named nd
ta = Type.var () a
tb = Type.var () b
tc = Type.var () c
td = Type.var () d
| 358
|
forall4 na nb nc nd body = Type.foralls () [a,b,c,d] (body ta tb tc td)
where
a = Var.named na
b = Var.named nb
c = Var.named nc
d = Var.named nd
ta = Type.var () a
tb = Type.var () b
tc = Type.var () c
td = Type.var () d
| 239
| false
| true
| 8
| 17
| 107
| 248
| 109
| 139
| null | null |
lipemorais/haskellando
|
RaytracerEtapa1_1113331018.hs
|
mit
|
--Some contants to write a .ppm image
p3 = "P3\n"
| 49
|
p3 = "P3\n"
| 11
|
p3 = "P3\n"
| 11
| true
| false
| 1
| 5
| 9
| 11
| 4
| 7
| null | null |
bflyblue/eventsource
|
src/Datastore/Aggregates/Participant.hs
|
bsd-3-clause
|
newParticipant :: PgStore ParticipantId
newParticipant = StreamId <$> newStream "Participant"
| 93
|
newParticipant :: PgStore ParticipantId
newParticipant = StreamId <$> newStream "Participant"
| 93
|
newParticipant = StreamId <$> newStream "Participant"
| 53
| false
| true
| 1
| 6
| 9
| 24
| 10
| 14
| null | null |
tolysz/prepare-ghcjs
|
spec-lts8/cabal/cabal-install/Distribution/Client/Dependency/Modular/Index.hs
|
bsd-3-clause
|
mkIndex :: [(PN, I, PInfo)] -> Index
mkIndex xs = M.map M.fromList (groupMap (L.map (\ (pn, i, pi) -> (pn, (i, pi))) xs))
| 121
|
mkIndex :: [(PN, I, PInfo)] -> Index
mkIndex xs = M.map M.fromList (groupMap (L.map (\ (pn, i, pi) -> (pn, (i, pi))) xs))
| 121
|
mkIndex xs = M.map M.fromList (groupMap (L.map (\ (pn, i, pi) -> (pn, (i, pi))) xs))
| 84
| false
| true
| 0
| 13
| 22
| 84
| 48
| 36
| null | null |
allanderek/ipclib
|
Language/Pepa/Compile/States.hs
|
gpl-2.0
|
getSatisfyingStates :: StateCondition -> StateSpace -> Set StateId
getSatisfyingStates expression =
findSatisfyingStates condition
where
condition :: State -> Bool
condition state =
conditionSatisfied (stateConcentrations state) expression
{-|
The same as 'conditionSatisfied' except that we do not assume that
the given state condition has had the names qualified
see 'getSatisfyingStates'
-}
| 415
|
getSatisfyingStates :: StateCondition -> StateSpace -> Set StateId
getSatisfyingStates expression =
findSatisfyingStates condition
where
condition :: State -> Bool
condition state =
conditionSatisfied (stateConcentrations state) expression
{-|
The same as 'conditionSatisfied' except that we do not assume that
the given state condition has had the names qualified
see 'getSatisfyingStates'
-}
| 415
|
getSatisfyingStates expression =
findSatisfyingStates condition
where
condition :: State -> Bool
condition state =
conditionSatisfied (stateConcentrations state) expression
{-|
The same as 'conditionSatisfied' except that we do not assume that
the given state condition has had the names qualified
see 'getSatisfyingStates'
-}
| 348
| false
| true
| 0
| 7
| 71
| 60
| 29
| 31
| null | null |
raboof/xmobar
|
src/Plugins/XMonadLog.hs
|
bsd-3-clause
|
decodeCChar = UTF8.decode . map fromIntegral
| 44
|
decodeCChar = UTF8.decode . map fromIntegral
| 44
|
decodeCChar = UTF8.decode . map fromIntegral
| 44
| false
| false
| 2
| 5
| 5
| 20
| 7
| 13
| null | null |
OurPrInstH/InstH
|
src/Routes.hs
|
bsd-3-clause
|
getFileContent :: FileInfo L.ByteString -> L.ByteString
getFileContent (FileInfo _ _ content) = content
| 103
|
getFileContent :: FileInfo L.ByteString -> L.ByteString
getFileContent (FileInfo _ _ content) = content
| 103
|
getFileContent (FileInfo _ _ content) = content
| 47
| false
| true
| 0
| 7
| 12
| 35
| 17
| 18
| null | null |
olsner/ghc
|
compiler/types/InstEnv.hs
|
bsd-3-clause
|
-- See Note [InstEnv determinism]
-- | Test if an instance is visible, by checking that its origin module
-- is in 'VisibleOrphanModules'.
-- See Note [Instance lookup and orphan instances]
instIsVisible :: VisibleOrphanModules -> ClsInst -> Bool
instIsVisible vis_mods ispec
-- NB: Instances from the interactive package always are visible. We can't
-- add interactive modules to the set since we keep creating new ones
-- as a GHCi session progresses.
| isInteractiveModule mod = True
| IsOrphan <- is_orphan ispec = mod `elemModuleSet` vis_mods
| otherwise = True
where
mod = nameModule $ is_dfun_name ispec
| 651
|
instIsVisible :: VisibleOrphanModules -> ClsInst -> Bool
instIsVisible vis_mods ispec
-- NB: Instances from the interactive package always are visible. We can't
-- add interactive modules to the set since we keep creating new ones
-- as a GHCi session progresses.
| isInteractiveModule mod = True
| IsOrphan <- is_orphan ispec = mod `elemModuleSet` vis_mods
| otherwise = True
where
mod = nameModule $ is_dfun_name ispec
| 460
|
instIsVisible vis_mods ispec
-- NB: Instances from the interactive package always are visible. We can't
-- add interactive modules to the set since we keep creating new ones
-- as a GHCi session progresses.
| isInteractiveModule mod = True
| IsOrphan <- is_orphan ispec = mod `elemModuleSet` vis_mods
| otherwise = True
where
mod = nameModule $ is_dfun_name ispec
| 403
| true
| true
| 1
| 9
| 137
| 86
| 45
| 41
| null | null |
sdiehl/ghc
|
compiler/utils/ListSetOps.hs
|
bsd-3-clause
|
unionLists :: (HasDebugCallStack, Outputable a, Eq a) => [a] -> [a] -> [a]
-- We special case some reasonable common patterns.
unionLists xs [] = xs
| 148
|
unionLists :: (HasDebugCallStack, Outputable a, Eq a) => [a] -> [a] -> [a]
unionLists xs [] = xs
| 96
|
unionLists xs [] = xs
| 21
| true
| true
| 0
| 8
| 25
| 55
| 30
| 25
| null | null |
jtobin/dates
|
Data/Time/Dates.hs
|
bsd-3-clause
|
clip :: (Ord t) => t -> t -> t -> t
clip a _ x | x < a = a
| 58
|
clip :: (Ord t) => t -> t -> t -> t
clip a _ x | x < a = a
| 58
|
clip a _ x | x < a = a
| 22
| false
| true
| 0
| 10
| 21
| 55
| 25
| 30
| null | null |
a143753/AOJ
|
1210.hs
|
apache-2.0
|
ini = [1,2,3]
| 13
|
ini = [1,2,3]
| 13
|
ini = [1,2,3]
| 13
| false
| false
| 1
| 5
| 2
| 18
| 9
| 9
| null | null |
himura/twitter-conduit
|
sample/oauth_callback.hs
|
bsd-2-clause
|
storeCredential :: OAuthToken -> Credential -> IORef (M.Map OAuthToken Credential) -> IO ()
storeCredential k cred ioref =
atomicModifyIORef ioref $ \m -> (M.insert k cred m, ())
| 182
|
storeCredential :: OAuthToken -> Credential -> IORef (M.Map OAuthToken Credential) -> IO ()
storeCredential k cred ioref =
atomicModifyIORef ioref $ \m -> (M.insert k cred m, ())
| 182
|
storeCredential k cred ioref =
atomicModifyIORef ioref $ \m -> (M.insert k cred m, ())
| 90
| false
| true
| 0
| 11
| 31
| 83
| 39
| 44
| null | null |
gambogi/csh-eval
|
src/CSH/Eval/DB/Statements.hs
|
mit
|
-- | Update a given member's housing points.
upMemberHousingPointsP :: Int -- ^ Housing points
-> Word64 -- ^ Member ID
-> H.Stmt HP.Postgres
upMemberHousingPointsP = [H.stmt|update "member" set "housing_points" = ? where "id" = ?|]
| 281
|
upMemberHousingPointsP :: Int -- ^ Housing points
-> Word64 -- ^ Member ID
-> H.Stmt HP.Postgres
upMemberHousingPointsP = [H.stmt|update "member" set "housing_points" = ? where "id" = ?|]
| 236
|
upMemberHousingPointsP = [H.stmt|update "member" set "housing_points" = ? where "id" = ?|]
| 90
| true
| true
| 0
| 8
| 84
| 35
| 21
| 14
| null | null |
dylanmann/CurriersOfCatan
|
src/Actions.hs
|
gpl-3.0
|
cardVP _ = 0
| 23
|
cardVP _ = 0
| 23
|
cardVP _ = 0
| 23
| false
| false
| 0
| 5
| 14
| 9
| 4
| 5
| null | null |
netogallo/MoCap
|
Data/MotionCapture/AMC/AMCExporter.hs
|
bsd-3-clause
|
orderCoords (dof:xs) (x,y,z) (rx,ry,rz) = case dof of
TX -> contOrder x
TY -> contOrder y
TZ -> contOrder z
RX -> contOrder rx
RY -> contOrder ry
RZ -> contOrder rz
where
contOrder v = (show x) ++ " " ++ (orderCoords xs (x,y,z) (rx,ry,rz))
| 257
|
orderCoords (dof:xs) (x,y,z) (rx,ry,rz) = case dof of
TX -> contOrder x
TY -> contOrder y
TZ -> contOrder z
RX -> contOrder rx
RY -> contOrder ry
RZ -> contOrder rz
where
contOrder v = (show x) ++ " " ++ (orderCoords xs (x,y,z) (rx,ry,rz))
| 257
|
orderCoords (dof:xs) (x,y,z) (rx,ry,rz) = case dof of
TX -> contOrder x
TY -> contOrder y
TZ -> contOrder z
RX -> contOrder rx
RY -> contOrder ry
RZ -> contOrder rz
where
contOrder v = (show x) ++ " " ++ (orderCoords xs (x,y,z) (rx,ry,rz))
| 257
| false
| false
| 0
| 8
| 63
| 149
| 77
| 72
| null | null |
ciderpunx/rsstwit
|
src/Twitter.hs
|
gpl-3.0
|
eHandler :: TwitterError -> IO (Maybe T.Text)
eHandler e = do
print $ "Error: problem tweeting\n\t" ++ show e
return Nothing
---- test function, get timeline
--getHomeTimeLine :: IO ()
--getHomeTimeLine = do
-- mgr <- newManager tlsManagerSettings
-- timeline <- call twInfo mgr homeTimeline
-- mapM_ (\s -> liftIO . print $ s ^. statusText) timeline
| 368
|
eHandler :: TwitterError -> IO (Maybe T.Text)
eHandler e = do
print $ "Error: problem tweeting\n\t" ++ show e
return Nothing
---- test function, get timeline
--getHomeTimeLine :: IO ()
--getHomeTimeLine = do
-- mgr <- newManager tlsManagerSettings
-- timeline <- call twInfo mgr homeTimeline
-- mapM_ (\s -> liftIO . print $ s ^. statusText) timeline
| 368
|
eHandler e = do
print $ "Error: problem tweeting\n\t" ++ show e
return Nothing
---- test function, get timeline
--getHomeTimeLine :: IO ()
--getHomeTimeLine = do
-- mgr <- newManager tlsManagerSettings
-- timeline <- call twInfo mgr homeTimeline
-- mapM_ (\s -> liftIO . print $ s ^. statusText) timeline
| 322
| false
| true
| 0
| 9
| 74
| 55
| 28
| 27
| null | null |
xpika/mohws
|
src/Network/MoHWS/Server/Environment.hs
|
bsd-3-clause
|
-- * Read accessors
options :: T body ext -> Options.T
options = ServerContext.options . context
| 97
|
options :: T body ext -> Options.T
options = ServerContext.options . context
| 76
|
options = ServerContext.options . context
| 41
| true
| true
| 0
| 6
| 16
| 29
| 15
| 14
| null | null |
spell-music/temporal-music-notation-demo
|
examples/choral.hs
|
bsd-3-clause
|
solo22 = mel [
-- 5 bar
dhn ef, qn ef,
-- 6 bar
qn af, qn af, qn bf, qn bf,
-- 7 bar
high $ mel [dhn c, qn df],
-- 8 bar
high $ qn c, qn bf, qn af, den f, sn g,
-- 9 bar
qn af, qn g, qn f
]
| 224
|
solo22 = mel [
-- 5 bar
dhn ef, qn ef,
-- 6 bar
qn af, qn af, qn bf, qn bf,
-- 7 bar
high $ mel [dhn c, qn df],
-- 8 bar
high $ qn c, qn bf, qn af, den f, sn g,
-- 9 bar
qn af, qn g, qn f
]
| 224
|
solo22 = mel [
-- 5 bar
dhn ef, qn ef,
-- 6 bar
qn af, qn af, qn bf, qn bf,
-- 7 bar
high $ mel [dhn c, qn df],
-- 8 bar
high $ qn c, qn bf, qn af, den f, sn g,
-- 9 bar
qn af, qn g, qn f
]
| 224
| false
| false
| 1
| 10
| 91
| 128
| 64
| 64
| null | null |
acfoltzer/text-register-machine
|
Language/TRM/Base.hs
|
bsd-3-clause
|
toLabeledProgram :: Program -> LProgram
toLabeledProgram p = Vector.concat (insertLabels 0)
where labels = exposeLabels p
p' = Vector.imap substLabel p
substLabel _ (SnocOne r) = LSnocOne r
substLabel _ (SnocHash r) = LSnocHash r
substLabel _ (Case r) = LCase r
substLabel pos (Forward rel) =
case Map.lookup (pos+rel) labels of
Just lab -> LGoto lab
Nothing -> error "couldn't find label for position"
substLabel pos (Backward rel) =
case Map.lookup (pos-rel) labels of
Just lab -> LGoto lab
Nothing -> error "couldn't find label for position"
insertLabels i | i == Vector.length p' =
case Map.lookup i labels of
Nothing -> []
Just lab -> [Vector.singleton $ LLabel lab]
insertLabels i =
case Map.lookup i labels of
Nothing -> (Vector.singleton $ p' Vector.! i) : insertLabels (i+1)
Just lab -> (Vector.fromList $ [LLabel lab, p' Vector.! i])
: insertLabels (i+1)
| 1,124
|
toLabeledProgram :: Program -> LProgram
toLabeledProgram p = Vector.concat (insertLabels 0)
where labels = exposeLabels p
p' = Vector.imap substLabel p
substLabel _ (SnocOne r) = LSnocOne r
substLabel _ (SnocHash r) = LSnocHash r
substLabel _ (Case r) = LCase r
substLabel pos (Forward rel) =
case Map.lookup (pos+rel) labels of
Just lab -> LGoto lab
Nothing -> error "couldn't find label for position"
substLabel pos (Backward rel) =
case Map.lookup (pos-rel) labels of
Just lab -> LGoto lab
Nothing -> error "couldn't find label for position"
insertLabels i | i == Vector.length p' =
case Map.lookup i labels of
Nothing -> []
Just lab -> [Vector.singleton $ LLabel lab]
insertLabels i =
case Map.lookup i labels of
Nothing -> (Vector.singleton $ p' Vector.! i) : insertLabels (i+1)
Just lab -> (Vector.fromList $ [LLabel lab, p' Vector.! i])
: insertLabels (i+1)
| 1,124
|
toLabeledProgram p = Vector.concat (insertLabels 0)
where labels = exposeLabels p
p' = Vector.imap substLabel p
substLabel _ (SnocOne r) = LSnocOne r
substLabel _ (SnocHash r) = LSnocHash r
substLabel _ (Case r) = LCase r
substLabel pos (Forward rel) =
case Map.lookup (pos+rel) labels of
Just lab -> LGoto lab
Nothing -> error "couldn't find label for position"
substLabel pos (Backward rel) =
case Map.lookup (pos-rel) labels of
Just lab -> LGoto lab
Nothing -> error "couldn't find label for position"
insertLabels i | i == Vector.length p' =
case Map.lookup i labels of
Nothing -> []
Just lab -> [Vector.singleton $ LLabel lab]
insertLabels i =
case Map.lookup i labels of
Nothing -> (Vector.singleton $ p' Vector.! i) : insertLabels (i+1)
Just lab -> (Vector.fromList $ [LLabel lab, p' Vector.! i])
: insertLabels (i+1)
| 1,084
| false
| true
| 12
| 15
| 401
| 375
| 183
| 192
| null | null |
ku-fpg/kansas-amber
|
System/Hardware/Haskino/Protocol.hs
|
bsd-3-clause
|
packageExpr (OrW8 e1 e2) = packageTwoSubExpr (exprCmdVal EXPR_WORD8 EXPR_OR) e1 e2
| 82
|
packageExpr (OrW8 e1 e2) = packageTwoSubExpr (exprCmdVal EXPR_WORD8 EXPR_OR) e1 e2
| 82
|
packageExpr (OrW8 e1 e2) = packageTwoSubExpr (exprCmdVal EXPR_WORD8 EXPR_OR) e1 e2
| 82
| false
| false
| 0
| 7
| 10
| 32
| 15
| 17
| null | null |
innovimax/bond
|
compiler/Bond/Parser.hs
|
mit
|
userType :: Parser Type
userType = do
name <- qualifiedName
params <- asks currentParams
case find (isParam name) params of
Just param -> return $ BT_TypeParam param
Nothing -> do
decl <- findSymbol name
args <- option [] (angles $ commaSep1 arg)
if length args /= paramsCount decl then
fail $ declName decl ++
if paramsCount decl /= 0 then
" requires " ++ show (paramsCount decl) ++ " type argument(s)"
else
" is not a generic type"
else
return $ BT_UserDefined decl args
where
paramsCount Enum{} = 0
paramsCount decl = length $ declParams decl
arg = type_ <|> BT_IntTypeArg <$> (fromIntegral <$> integer)
where
isParam [name] = (name ==) . paramName
isParam _ = const False
-- type parser
| 959
|
userType :: Parser Type
userType = do
name <- qualifiedName
params <- asks currentParams
case find (isParam name) params of
Just param -> return $ BT_TypeParam param
Nothing -> do
decl <- findSymbol name
args <- option [] (angles $ commaSep1 arg)
if length args /= paramsCount decl then
fail $ declName decl ++
if paramsCount decl /= 0 then
" requires " ++ show (paramsCount decl) ++ " type argument(s)"
else
" is not a generic type"
else
return $ BT_UserDefined decl args
where
paramsCount Enum{} = 0
paramsCount decl = length $ declParams decl
arg = type_ <|> BT_IntTypeArg <$> (fromIntegral <$> integer)
where
isParam [name] = (name ==) . paramName
isParam _ = const False
-- type parser
| 959
|
userType = do
name <- qualifiedName
params <- asks currentParams
case find (isParam name) params of
Just param -> return $ BT_TypeParam param
Nothing -> do
decl <- findSymbol name
args <- option [] (angles $ commaSep1 arg)
if length args /= paramsCount decl then
fail $ declName decl ++
if paramsCount decl /= 0 then
" requires " ++ show (paramsCount decl) ++ " type argument(s)"
else
" is not a generic type"
else
return $ BT_UserDefined decl args
where
paramsCount Enum{} = 0
paramsCount decl = length $ declParams decl
arg = type_ <|> BT_IntTypeArg <$> (fromIntegral <$> integer)
where
isParam [name] = (name ==) . paramName
isParam _ = const False
-- type parser
| 935
| false
| true
| 0
| 19
| 389
| 261
| 125
| 136
| null | null |
AubreyEAnderson/shellcheck
|
ShellCheck/Analytics.hs
|
gpl-3.0
|
prop_checkSingleQuotedVariables2 = verify checkSingleQuotedVariables "echo 'lol$1.jpg'"
| 87
|
prop_checkSingleQuotedVariables2 = verify checkSingleQuotedVariables "echo 'lol$1.jpg'"
| 87
|
prop_checkSingleQuotedVariables2 = verify checkSingleQuotedVariables "echo 'lol$1.jpg'"
| 87
| false
| false
| 0
| 5
| 5
| 11
| 5
| 6
| null | null |
adityagupta1089/Project-Euler-Haskell
|
src/problems/Problem187.hs
|
bsd-3-clause
|
main :: IO ()
-- p*q < n & p<=q => p^2<n & q < ceil[n/p]
main = print $ go (zip (takeWhile (\p -> p * p < n) ps) [1 ..]) (reverse $ zip ps [1 ..])
where
go [] _ = 0
go ((p, np) : ps) qs =
let qs'@((_, nq) : _) = go' p qs in (nq - np + 1) + go ps qs'
go' p qs@((q, _) : qs')
| p * q >= n = go' p qs'
| otherwise = qs
| 354
|
main :: IO ()
main = print $ go (zip (takeWhile (\p -> p * p < n) ps) [1 ..]) (reverse $ zip ps [1 ..])
where
go [] _ = 0
go ((p, np) : ps) qs =
let qs'@((_, nq) : _) = go' p qs in (nq - np + 1) + go ps qs'
go' p qs@((q, _) : qs')
| p * q >= n = go' p qs'
| otherwise = qs
| 311
|
main = print $ go (zip (takeWhile (\p -> p * p < n) ps) [1 ..]) (reverse $ zip ps [1 ..])
where
go [] _ = 0
go ((p, np) : ps) qs =
let qs'@((_, nq) : _) = go' p qs in (nq - np + 1) + go ps qs'
go' p qs@((q, _) : qs')
| p * q >= n = go' p qs'
| otherwise = qs
| 297
| true
| true
| 0
| 14
| 129
| 223
| 116
| 107
| null | null |
ganeti/ganeti
|
src/Ganeti/HTools/Cluster/Evacuate.hs
|
bsd-2-clause
|
-- The algorithm for ChangeAll is as follows:
--
-- * generate all (primary, secondary) node pairs for the target groups
-- * for each pair, execute the needed moves (r:s, f, r:s) and compute
-- the final node list state and group score
-- * select the best choice via a foldl that uses the same Either
-- String solution as the ChangeSecondary mode
nodeEvacInstance opts nl il ChangeAll
inst@(Instance.Instance {Instance.diskTemplate = DTDrbd8})
gdx avail_nodes =
do
let no_nodes = Left "no nodes available"
node_pairs = [(p,s) | p <- avail_nodes, s <- avail_nodes, p /= s]
(nl', il', ops, _) <-
annotateResult "Can't find any good nodes for relocation" .
eitherToResult $
foldl'
(\accu nodes -> case evacDrbdAllInner opts nl il inst gdx nodes of
Bad msg ->
case accu of
Right _ -> accu
-- we don't need more details (which
-- nodes, etc.) as we only selected
-- this group if we can allocate on
-- it, hence failures will not
-- propagate out of this fold loop
Left _ -> Left $ "Allocation failed: " ++ msg
Ok result@(_, _, _, new_cv) ->
let new_accu = Right result in
case accu of
Left _ -> new_accu
Right (_, _, _, old_cv) ->
if old_cv < new_cv
then accu
else new_accu
) no_nodes node_pairs
return (nl', il', ops)
-- | Updates the evac solution with the results of an instance
-- evacuation.
| 1,935
|
nodeEvacInstance opts nl il ChangeAll
inst@(Instance.Instance {Instance.diskTemplate = DTDrbd8})
gdx avail_nodes =
do
let no_nodes = Left "no nodes available"
node_pairs = [(p,s) | p <- avail_nodes, s <- avail_nodes, p /= s]
(nl', il', ops, _) <-
annotateResult "Can't find any good nodes for relocation" .
eitherToResult $
foldl'
(\accu nodes -> case evacDrbdAllInner opts nl il inst gdx nodes of
Bad msg ->
case accu of
Right _ -> accu
-- we don't need more details (which
-- nodes, etc.) as we only selected
-- this group if we can allocate on
-- it, hence failures will not
-- propagate out of this fold loop
Left _ -> Left $ "Allocation failed: " ++ msg
Ok result@(_, _, _, new_cv) ->
let new_accu = Right result in
case accu of
Left _ -> new_accu
Right (_, _, _, old_cv) ->
if old_cv < new_cv
then accu
else new_accu
) no_nodes node_pairs
return (nl', il', ops)
-- | Updates the evac solution with the results of an instance
-- evacuation.
| 1,581
|
nodeEvacInstance opts nl il ChangeAll
inst@(Instance.Instance {Instance.diskTemplate = DTDrbd8})
gdx avail_nodes =
do
let no_nodes = Left "no nodes available"
node_pairs = [(p,s) | p <- avail_nodes, s <- avail_nodes, p /= s]
(nl', il', ops, _) <-
annotateResult "Can't find any good nodes for relocation" .
eitherToResult $
foldl'
(\accu nodes -> case evacDrbdAllInner opts nl il inst gdx nodes of
Bad msg ->
case accu of
Right _ -> accu
-- we don't need more details (which
-- nodes, etc.) as we only selected
-- this group if we can allocate on
-- it, hence failures will not
-- propagate out of this fold loop
Left _ -> Left $ "Allocation failed: " ++ msg
Ok result@(_, _, _, new_cv) ->
let new_accu = Right result in
case accu of
Left _ -> new_accu
Right (_, _, _, old_cv) ->
if old_cv < new_cv
then accu
else new_accu
) no_nodes node_pairs
return (nl', il', ops)
-- | Updates the evac solution with the results of an instance
-- evacuation.
| 1,581
| true
| false
| 0
| 21
| 875
| 308
| 165
| 143
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.