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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pascal-knodel/haskell-craft | _/links/E'9'15.hs | mit | prop_FacFac2 :: Integer -> Bool
prop_FacFac2 integer
= fac integer == fac2 integer | 85 | prop_FacFac2 :: Integer -> Bool
prop_FacFac2 integer
= fac integer == fac2 integer | 85 | prop_FacFac2 integer
= fac integer == fac2 integer | 53 | false | true | 0 | 6 | 15 | 28 | 13 | 15 | null | null |
rkrzr/shcrabble | src/Lib.hs | bsd-3-clause | -- TODO: Placed pieces are *not* ordered - we must make sure that pp is actually the first
-- character of the word!
isWordFitting pf (mt, (pp:pps)) =
isFirstValid && (all (isEqualOrEmpty pf mt) (init pps)) && isLastValid
-- Note: If the field is empty, then all three surrounding fields must be empty
-- If the field is not empty, then only the field in the same direction must be empty
where
isFieldValid (PlacedPiece c cs) d ds =
case Map.lookup cs pf of
Just (PlacedPiece c' _) -> c == c' && isNeighborEmpty cs pf d
Nothing -> emptyNeighbors cs ds pf
isFirstValid =
case mt of
Horizontal -> isFieldValid pp L [Up, Down, L]
Vertical -> isFieldValid pp Down [L, R, Down]
isLastValid =
case mt of
Horizontal -> isFieldValid (last pps) R [Up, Down, R]
Vertical -> isFieldValid (last pps) Up [L, R, Up] | 891 | isWordFitting pf (mt, (pp:pps)) =
isFirstValid && (all (isEqualOrEmpty pf mt) (init pps)) && isLastValid
-- Note: If the field is empty, then all three surrounding fields must be empty
-- If the field is not empty, then only the field in the same direction must be empty
where
isFieldValid (PlacedPiece c cs) d ds =
case Map.lookup cs pf of
Just (PlacedPiece c' _) -> c == c' && isNeighborEmpty cs pf d
Nothing -> emptyNeighbors cs ds pf
isFirstValid =
case mt of
Horizontal -> isFieldValid pp L [Up, Down, L]
Vertical -> isFieldValid pp Down [L, R, Down]
isLastValid =
case mt of
Horizontal -> isFieldValid (last pps) R [Up, Down, R]
Vertical -> isFieldValid (last pps) Up [L, R, Up] | 774 | isWordFitting pf (mt, (pp:pps)) =
isFirstValid && (all (isEqualOrEmpty pf mt) (init pps)) && isLastValid
-- Note: If the field is empty, then all three surrounding fields must be empty
-- If the field is not empty, then only the field in the same direction must be empty
where
isFieldValid (PlacedPiece c cs) d ds =
case Map.lookup cs pf of
Just (PlacedPiece c' _) -> c == c' && isNeighborEmpty cs pf d
Nothing -> emptyNeighbors cs ds pf
isFirstValid =
case mt of
Horizontal -> isFieldValid pp L [Up, Down, L]
Vertical -> isFieldValid pp Down [L, R, Down]
isLastValid =
case mt of
Horizontal -> isFieldValid (last pps) R [Up, Down, R]
Vertical -> isFieldValid (last pps) Up [L, R, Up] | 774 | true | false | 0 | 10 | 236 | 255 | 133 | 122 | null | null |
haskell-opengl/OpenGLRaw | src/Graphics/GL/Functions/F09.hs | bsd-3-clause | ptr_glGetBufferParameteriv :: FunPtr (GLenum -> GLenum -> Ptr GLint -> IO ())
ptr_glGetBufferParameteriv = unsafePerformIO $ getCommand "glGetBufferParameteriv" | 160 | ptr_glGetBufferParameteriv :: FunPtr (GLenum -> GLenum -> Ptr GLint -> IO ())
ptr_glGetBufferParameteriv = unsafePerformIO $ getCommand "glGetBufferParameteriv" | 160 | ptr_glGetBufferParameteriv = unsafePerformIO $ getCommand "glGetBufferParameteriv" | 82 | false | true | 0 | 11 | 17 | 44 | 21 | 23 | null | null |
nevrenato/Hets_Fork | QBF/ProveDepQBF.hs | gpl-2.0 | runDepQBF :: QBFProverState
{- ^ logical part containing the input Sign and axioms and possibly
goals that have been proved earlier as additional axioms -}
-> GenericConfig ProofTree -- ^ configuration to use
-> Bool -- ^ True means save QDIMACS file
-> String -- ^ name of the theory in the DevGraph
-> AS_Anno.Named AS.FORMULA -- ^ goal to prove
-> IO (ATPRetval, GenericConfig ProofTree)
-- ^ (retval, configuration with proof status and complete output)
runDepQBF ps cfg saveQDIMACS thName nGoal = do
let saveFile = basename thName ++ '_' : AS_Anno.senAttr nGoal ++ ".qdimacs"
tl = configTimeLimit cfg
prob <- showQDIMACSProblem thName ps nGoal []
when saveQDIMACS (writeFile saveFile prob)
stpTmpFile <- getTempFile prob saveFile
t_start <- getHetsTime
(exitCode, stdoutC, stderrC) <- readProcessWithExitCode "depqbf"
(show tl : extraOpts cfg ++ [stpTmpFile]) ""
t_end <- getHetsTime
removeFile stpTmpFile
let t_u = diffHetsTime t_end t_start
exitCode' = case exitCode of
ExitSuccess -> 0
ExitFailure i -> i
(pStat, ret) <- examineProof ps cfg stdoutC stderrC exitCode' nGoal t_u tl
return (pStat, cfg
{ proofStatus = ret
, resultOutput = lines (stdoutC ++ stderrC)
, timeUsed = usedTime ret })
-- | examine Prover output | 1,463 | runDepQBF :: QBFProverState
{- ^ logical part containing the input Sign and axioms and possibly
goals that have been proved earlier as additional axioms -}
-> GenericConfig ProofTree -- ^ configuration to use
-> Bool -- ^ True means save QDIMACS file
-> String -- ^ name of the theory in the DevGraph
-> AS_Anno.Named AS.FORMULA -- ^ goal to prove
-> IO (ATPRetval, GenericConfig ProofTree)
runDepQBF ps cfg saveQDIMACS thName nGoal = do
let saveFile = basename thName ++ '_' : AS_Anno.senAttr nGoal ++ ".qdimacs"
tl = configTimeLimit cfg
prob <- showQDIMACSProblem thName ps nGoal []
when saveQDIMACS (writeFile saveFile prob)
stpTmpFile <- getTempFile prob saveFile
t_start <- getHetsTime
(exitCode, stdoutC, stderrC) <- readProcessWithExitCode "depqbf"
(show tl : extraOpts cfg ++ [stpTmpFile]) ""
t_end <- getHetsTime
removeFile stpTmpFile
let t_u = diffHetsTime t_end t_start
exitCode' = case exitCode of
ExitSuccess -> 0
ExitFailure i -> i
(pStat, ret) <- examineProof ps cfg stdoutC stderrC exitCode' nGoal t_u tl
return (pStat, cfg
{ proofStatus = ret
, resultOutput = lines (stdoutC ++ stderrC)
, timeUsed = usedTime ret })
-- | examine Prover output | 1,385 | runDepQBF ps cfg saveQDIMACS thName nGoal = do
let saveFile = basename thName ++ '_' : AS_Anno.senAttr nGoal ++ ".qdimacs"
tl = configTimeLimit cfg
prob <- showQDIMACSProblem thName ps nGoal []
when saveQDIMACS (writeFile saveFile prob)
stpTmpFile <- getTempFile prob saveFile
t_start <- getHetsTime
(exitCode, stdoutC, stderrC) <- readProcessWithExitCode "depqbf"
(show tl : extraOpts cfg ++ [stpTmpFile]) ""
t_end <- getHetsTime
removeFile stpTmpFile
let t_u = diffHetsTime t_end t_start
exitCode' = case exitCode of
ExitSuccess -> 0
ExitFailure i -> i
(pStat, ret) <- examineProof ps cfg stdoutC stderrC exitCode' nGoal t_u tl
return (pStat, cfg
{ proofStatus = ret
, resultOutput = lines (stdoutC ++ stderrC)
, timeUsed = usedTime ret })
-- | examine Prover output | 917 | true | true | 0 | 13 | 430 | 330 | 163 | 167 | null | null |
roberth/uu-helium | src/Helium/Parser/Lexer.hs | gpl-3.0 | isName :: String -> Bool
isName [] = False | 42 | isName :: String -> Bool
isName [] = False | 42 | isName [] = False | 17 | false | true | 0 | 8 | 8 | 26 | 11 | 15 | null | null |
junjihashimoto/persistent | persistent/Database/Persist/Sql/Orphan/PersistQuery.hs | mit | decorateSQLWithLimitOffset::Text -> (Int,Int) -> Bool -> Text -> Text
decorateSQLWithLimitOffset nolimit (limit,offset) _ sql =
let
lim = case (limit, offset) of
(0, 0) -> ""
(0, _) -> T.cons ' ' nolimit
(_, _) -> " LIMIT " <> T.pack (show limit)
off = if offset == 0
then ""
else " OFFSET " <> T.pack (show offset)
in mconcat
[ sql
, lim
, off
] | 508 | decorateSQLWithLimitOffset::Text -> (Int,Int) -> Bool -> Text -> Text
decorateSQLWithLimitOffset nolimit (limit,offset) _ sql =
let
lim = case (limit, offset) of
(0, 0) -> ""
(0, _) -> T.cons ' ' nolimit
(_, _) -> " LIMIT " <> T.pack (show limit)
off = if offset == 0
then ""
else " OFFSET " <> T.pack (show offset)
in mconcat
[ sql
, lim
, off
] | 507 | decorateSQLWithLimitOffset nolimit (limit,offset) _ sql =
let
lim = case (limit, offset) of
(0, 0) -> ""
(0, _) -> T.cons ' ' nolimit
(_, _) -> " LIMIT " <> T.pack (show limit)
off = if offset == 0
then ""
else " OFFSET " <> T.pack (show offset)
in mconcat
[ sql
, lim
, off
] | 437 | false | true | 0 | 15 | 229 | 171 | 92 | 79 | null | null |
Pieterjaninfo/PP | FP/block1s1.hs | unlicense | allEqual (x:y:xs)
| x == y = allEqual (y:xs)
| otherwise = False | 72 | allEqual (x:y:xs)
| x == y = allEqual (y:xs)
| otherwise = False | 72 | allEqual (x:y:xs)
| x == y = allEqual (y:xs)
| otherwise = False | 72 | false | false | 1 | 8 | 20 | 48 | 23 | 25 | null | null |
yliu120/K3 | src/Language/K3/Codegen/CPP/Representation.hs | apache-2.0 | binaryParens _ _ = parens | 25 | binaryParens _ _ = parens | 25 | binaryParens _ _ = parens | 25 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
ricardopenyamari/ir2haskell | clir-parser-haskell-master/lib/sexp-grammar/examples/Lang.hs | gpl-2.0 | gatherFreeVars :: Expr -> M.Map Ident Int
gatherFreeVars e = runReader (cata alg e) S.empty
where
alg :: ExprF (FreeVarsM (M.Map Ident Int)) -> FreeVarsM (M.Map Ident Int)
alg (Let n e r) = do
e' <- e
r' <- local (S.insert n) r
return $ e' <> r'
alg (Var n) = do
bound <- asks (S.member n)
return $ if bound then M.empty else M.singleton n 1
alg other = foldl (M.unionWith (+)) M.empty <$> sequence other | 452 | gatherFreeVars :: Expr -> M.Map Ident Int
gatherFreeVars e = runReader (cata alg e) S.empty
where
alg :: ExprF (FreeVarsM (M.Map Ident Int)) -> FreeVarsM (M.Map Ident Int)
alg (Let n e r) = do
e' <- e
r' <- local (S.insert n) r
return $ e' <> r'
alg (Var n) = do
bound <- asks (S.member n)
return $ if bound then M.empty else M.singleton n 1
alg other = foldl (M.unionWith (+)) M.empty <$> sequence other | 452 | gatherFreeVars e = runReader (cata alg e) S.empty
where
alg :: ExprF (FreeVarsM (M.Map Ident Int)) -> FreeVarsM (M.Map Ident Int)
alg (Let n e r) = do
e' <- e
r' <- local (S.insert n) r
return $ e' <> r'
alg (Var n) = do
bound <- asks (S.member n)
return $ if bound then M.empty else M.singleton n 1
alg other = foldl (M.unionWith (+)) M.empty <$> sequence other | 410 | false | true | 0 | 11 | 126 | 228 | 109 | 119 | null | null |
lunaris/hindent | src/HIndent/Styles/Gibiansky.hs | bsd-3-clause | collectTypes ty = [ty] | 22 | collectTypes ty = [ty] | 22 | collectTypes ty = [ty] | 22 | false | false | 0 | 5 | 3 | 12 | 6 | 6 | null | null |
8c6794b6/tokyodystopia-haskell | Database/TokyoDystopia/JDB.hs | bsd-3-clause | setcache :: JDB -> Int64 -> Int -> IO Bool
setcache db icsiz lcnum = FJ.c_setcache (unJDB db) icsiz (fromIntegral lcnum) | 120 | setcache :: JDB -> Int64 -> Int -> IO Bool
setcache db icsiz lcnum = FJ.c_setcache (unJDB db) icsiz (fromIntegral lcnum) | 120 | setcache db icsiz lcnum = FJ.c_setcache (unJDB db) icsiz (fromIntegral lcnum) | 77 | false | true | 0 | 8 | 20 | 54 | 26 | 28 | null | null |
ashnikel/haskellbook | ch11/ch11.14_ex.hs | mit | -- 4 ^ 4 = 256
-- 4
prodTBool :: (Bool, Bool, Bool)
prodTBool = undefined | 74 | prodTBool :: (Bool, Bool, Bool)
prodTBool = undefined | 53 | prodTBool = undefined | 21 | true | true | 0 | 5 | 16 | 22 | 14 | 8 | null | null |
MaxGabriel/yesod | yesod-form/Yesod/Form/Bootstrap3.hs | mit | toOffset (ColXs columns) = "col-xs-offset-" ++ show columns | 59 | toOffset (ColXs columns) = "col-xs-offset-" ++ show columns | 59 | toOffset (ColXs columns) = "col-xs-offset-" ++ show columns | 59 | false | false | 0 | 7 | 7 | 22 | 10 | 12 | null | null |
glguy/config-schema | src/Config/Schema/Docs.hs | isc | disjunction False xs = hsep (intersperse "or" xs) | 57 | disjunction False xs = hsep (intersperse "or" xs) | 57 | disjunction False xs = hsep (intersperse "or" xs) | 57 | false | false | 1 | 7 | 15 | 26 | 10 | 16 | null | null |
iand675/digital-ocean | src/DigitalOcean.hs | mit | creds :: DigitalOcean Credentials
creds = DigitalOcean ask | 58 | creds :: DigitalOcean Credentials
creds = DigitalOcean ask | 58 | creds = DigitalOcean ask | 24 | false | true | 0 | 5 | 7 | 17 | 8 | 9 | null | null |
ekmett/ghc | compiler/nativeGen/X86/Instr.hs | bsd-3-clause | shortcutStatics :: (BlockId -> Maybe JumpDest) -> (Alignment, CmmStatics) -> (Alignment, CmmStatics)
shortcutStatics fn (align, Statics lbl statics)
= (align, Statics lbl $ map (shortcutStatic fn) statics) | 207 | shortcutStatics :: (BlockId -> Maybe JumpDest) -> (Alignment, CmmStatics) -> (Alignment, CmmStatics)
shortcutStatics fn (align, Statics lbl statics)
= (align, Statics lbl $ map (shortcutStatic fn) statics) | 207 | shortcutStatics fn (align, Statics lbl statics)
= (align, Statics lbl $ map (shortcutStatic fn) statics) | 106 | false | true | 0 | 9 | 28 | 81 | 43 | 38 | null | null |
snoyberg/ghc | libraries/base/GHC/List.hs | bsd-3-clause | product = foldl (*) 1 | 38 | product = foldl (*) 1 | 38 | product = foldl (*) 1 | 38 | false | false | 0 | 5 | 21 | 13 | 7 | 6 | null | null |
pauloborba/plc | src/Prova2016.hs | cc0-1.0 | discard 1 (x:xs) = xs | 21 | discard 1 (x:xs) = xs | 21 | discard 1 (x:xs) = xs | 21 | false | false | 0 | 7 | 4 | 18 | 9 | 9 | null | null |
neongreen/megaparsec | Text/Megaparsec/Char.hs | bsd-2-clause | -- | @charCategory cat@ Parses character in Unicode General Category @cat@,
-- see 'Data.Char.GeneralCategory'.
charCategory :: MonadParsec s m Char => GeneralCategory -> m Char
charCategory cat = satisfy ((== cat) . generalCategory) <?> categoryName cat | 255 | charCategory :: MonadParsec s m Char => GeneralCategory -> m Char
charCategory cat = satisfy ((== cat) . generalCategory) <?> categoryName cat | 142 | charCategory cat = satisfy ((== cat) . generalCategory) <?> categoryName cat | 76 | true | true | 0 | 9 | 36 | 55 | 28 | 27 | null | null |
phaazon/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/Tokens.hs | bsd-3-clause | gl_INTERLACE_SGIX :: GLenum
gl_INTERLACE_SGIX = 0x8094 | 54 | gl_INTERLACE_SGIX :: GLenum
gl_INTERLACE_SGIX = 0x8094 | 54 | gl_INTERLACE_SGIX = 0x8094 | 26 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
gnn/Hets | OWL2/XMLKeywords.hs | gpl-2.0 | objectPropertyAssertionK :: String
objectPropertyAssertionK = "ObjectPropertyAssertion" | 87 | objectPropertyAssertionK :: String
objectPropertyAssertionK = "ObjectPropertyAssertion" | 87 | objectPropertyAssertionK = "ObjectPropertyAssertion" | 52 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
josefs/autosar | oldARSim/NewABS.hs | bsd-3-clause | newtest = do
(velos_in, accels_r_in, accels_p_in, valves_r_out, valves_p_out) <- abs_system
env <- environment
connectAll (repeat env) velos_in
connectAll (repeat env) accels_r_in
connectAll (repeat env) accels_p_in
connectAll valves_r_out (repeat env)
connectAll valves_p_out (repeat env)
where a0 = [(1,-5)]
v0 = (0,18) : minim 0 (integrate 0.01 a0) | 437 | newtest = do
(velos_in, accels_r_in, accels_p_in, valves_r_out, valves_p_out) <- abs_system
env <- environment
connectAll (repeat env) velos_in
connectAll (repeat env) accels_r_in
connectAll (repeat env) accels_p_in
connectAll valves_r_out (repeat env)
connectAll valves_p_out (repeat env)
where a0 = [(1,-5)]
v0 = (0,18) : minim 0 (integrate 0.01 a0) | 437 | newtest = do
(velos_in, accels_r_in, accels_p_in, valves_r_out, valves_p_out) <- abs_system
env <- environment
connectAll (repeat env) velos_in
connectAll (repeat env) accels_r_in
connectAll (repeat env) accels_p_in
connectAll valves_r_out (repeat env)
connectAll valves_p_out (repeat env)
where a0 = [(1,-5)]
v0 = (0,18) : minim 0 (integrate 0.01 a0) | 437 | false | false | 1 | 9 | 131 | 154 | 75 | 79 | null | null |
brendanhay/gogol | gogol-games/gen/Network/Google/Games/Types/Product.hs | mpl-2.0 | -- | Uniquely identifies the type of this resource. Value is always the fixed
-- string \`games#instance\`.
iKind :: Lens' Instance (Maybe Text)
iKind = lens _iKind (\ s a -> s{_iKind = a}) | 189 | iKind :: Lens' Instance (Maybe Text)
iKind = lens _iKind (\ s a -> s{_iKind = a}) | 81 | iKind = lens _iKind (\ s a -> s{_iKind = a}) | 44 | true | true | 0 | 9 | 33 | 47 | 26 | 21 | null | null |
keithodulaigh/Hets | GMP/Proof.hs | gpl-2.0 | negI :: Sequent -> [[Sequent]]
negI xs = [ [p : delete f xs] | f@(Not (Not p)) <- xs] | 85 | negI :: Sequent -> [[Sequent]]
negI xs = [ [p : delete f xs] | f@(Not (Not p)) <- xs] | 85 | negI xs = [ [p : delete f xs] | f@(Not (Not p)) <- xs] | 54 | false | true | 0 | 12 | 19 | 62 | 33 | 29 | null | null |
rueshyna/gogol | gogol-maps-engine/gen/Network/Google/Resource/MapsEngine/Maps/Publish.hs | mpl-2.0 | -- | Creates a value of 'MapsPublish' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'mapForce'
--
-- * 'mapId'
mapsPublish
:: Text -- ^ 'mapId'
-> MapsPublish
mapsPublish pMapId_ =
MapsPublish'
{ _mapForce = Nothing
, _mapId = pMapId_
} | 347 | mapsPublish
:: Text -- ^ 'mapId'
-> MapsPublish
mapsPublish pMapId_ =
MapsPublish'
{ _mapForce = Nothing
, _mapId = pMapId_
} | 149 | mapsPublish pMapId_ =
MapsPublish'
{ _mapForce = Nothing
, _mapId = pMapId_
} | 93 | true | true | 0 | 6 | 82 | 40 | 26 | 14 | null | null |
keera-studios/hsQt | Qtc/ClassTypes/Core.hs | bsd-2-clause | qFileFromPtr :: Ptr (TQFile a) -> IO (QFile a)
qFileFromPtr p
= objectFromPtr qtc_QFile_getFinalizer p | 104 | qFileFromPtr :: Ptr (TQFile a) -> IO (QFile a)
qFileFromPtr p
= objectFromPtr qtc_QFile_getFinalizer p | 104 | qFileFromPtr p
= objectFromPtr qtc_QFile_getFinalizer p | 57 | false | true | 0 | 8 | 16 | 41 | 19 | 22 | null | null |
alexisVallet/hnn | src/HNN/Data.hs | bsd-3-clause | randomize :: (MonadIO m, MonadRandom m) => [a] -> (a -> m b) -> Producer b m ()
randomize xs f = do
sxs <- lift $ shuffle xs
forM_ sxs $ \x -> do
fx <- lift $ f x
yield fx
-- converts an image to a (nb_channels, height, width) shaped row-major
-- vector.
-- img_to_chw :: (Storable a, Image i, Pixel (ImagePixel i))
-- => (PixelChannel (ImagePixel i) -> a) -> i -> V.Vector a
-- img_to_chw conv img = V.fromList [conv $ pixIndex (index img (ix2 i j)) k
-- | k <- [0..c-1],
-- i <- [0..h-1],
-- j <- [0..w-1]]
-- where Z :. h :. w = Friday.shape img
-- c = nChannels img
-- img_to_chw :: (Storable a, Image i, Pixel (ImagePixel i))
-- => (PixelChannel (ImagePixel i) -> a) -> i -> V.Vector a
-- img_to_chw conv img = runST $ do
-- let Z :. h :. w = Friday.shape img
-- c = nChannels img
-- imgVector = vector img
-- out <- MV.new $ c * h * w
-- forM_ [0..h-1] $ \i -> do
-- forM_ [0..w-1] $ \j -> do
-- forM_ [0..c-1] $ \k -> do
-- MV.unsafeWrite out (j + w * (i + h * k)) $ conv $ pixIndex (V.unsafeIndex imgVector (j + w * i)) k
-- V.unsafeFreeze out
-- Converts an image to a storable-based vector by casting and sharing the inner
-- data foreign pointer. | 1,333 | randomize :: (MonadIO m, MonadRandom m) => [a] -> (a -> m b) -> Producer b m ()
randomize xs f = do
sxs <- lift $ shuffle xs
forM_ sxs $ \x -> do
fx <- lift $ f x
yield fx
-- converts an image to a (nb_channels, height, width) shaped row-major
-- vector.
-- img_to_chw :: (Storable a, Image i, Pixel (ImagePixel i))
-- => (PixelChannel (ImagePixel i) -> a) -> i -> V.Vector a
-- img_to_chw conv img = V.fromList [conv $ pixIndex (index img (ix2 i j)) k
-- | k <- [0..c-1],
-- i <- [0..h-1],
-- j <- [0..w-1]]
-- where Z :. h :. w = Friday.shape img
-- c = nChannels img
-- img_to_chw :: (Storable a, Image i, Pixel (ImagePixel i))
-- => (PixelChannel (ImagePixel i) -> a) -> i -> V.Vector a
-- img_to_chw conv img = runST $ do
-- let Z :. h :. w = Friday.shape img
-- c = nChannels img
-- imgVector = vector img
-- out <- MV.new $ c * h * w
-- forM_ [0..h-1] $ \i -> do
-- forM_ [0..w-1] $ \j -> do
-- forM_ [0..c-1] $ \k -> do
-- MV.unsafeWrite out (j + w * (i + h * k)) $ conv $ pixIndex (V.unsafeIndex imgVector (j + w * i)) k
-- V.unsafeFreeze out
-- Converts an image to a storable-based vector by casting and sharing the inner
-- data foreign pointer. | 1,333 | randomize xs f = do
sxs <- lift $ shuffle xs
forM_ sxs $ \x -> do
fx <- lift $ f x
yield fx
-- converts an image to a (nb_channels, height, width) shaped row-major
-- vector.
-- img_to_chw :: (Storable a, Image i, Pixel (ImagePixel i))
-- => (PixelChannel (ImagePixel i) -> a) -> i -> V.Vector a
-- img_to_chw conv img = V.fromList [conv $ pixIndex (index img (ix2 i j)) k
-- | k <- [0..c-1],
-- i <- [0..h-1],
-- j <- [0..w-1]]
-- where Z :. h :. w = Friday.shape img
-- c = nChannels img
-- img_to_chw :: (Storable a, Image i, Pixel (ImagePixel i))
-- => (PixelChannel (ImagePixel i) -> a) -> i -> V.Vector a
-- img_to_chw conv img = runST $ do
-- let Z :. h :. w = Friday.shape img
-- c = nChannels img
-- imgVector = vector img
-- out <- MV.new $ c * h * w
-- forM_ [0..h-1] $ \i -> do
-- forM_ [0..w-1] $ \j -> do
-- forM_ [0..c-1] $ \k -> do
-- MV.unsafeWrite out (j + w * (i + h * k)) $ conv $ pixIndex (V.unsafeIndex imgVector (j + w * i)) k
-- V.unsafeFreeze out
-- Converts an image to a storable-based vector by casting and sharing the inner
-- data foreign pointer. | 1,253 | false | true | 0 | 13 | 422 | 134 | 76 | 58 | null | null |
phaazon/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/Tokens.hs | bsd-3-clause | gl_FRAMEBUFFER_BARRIER_BIT :: GLbitfield
gl_FRAMEBUFFER_BARRIER_BIT = 0x00000400 | 80 | gl_FRAMEBUFFER_BARRIER_BIT :: GLbitfield
gl_FRAMEBUFFER_BARRIER_BIT = 0x00000400 | 80 | gl_FRAMEBUFFER_BARRIER_BIT = 0x00000400 | 39 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
NCrashed/servant-auth-token | src/Servant/Server/Auth/Token/Common.hs | bsd-3-clause | -- | Helper to print a value to lazy bytestring
showb :: Show a => a -> BSL.ByteString
showb = BSL.pack . show | 110 | showb :: Show a => a -> BSL.ByteString
showb = BSL.pack . show | 62 | showb = BSL.pack . show | 23 | true | true | 0 | 7 | 22 | 31 | 16 | 15 | null | null |
kmate/zeldspar | src/Ziria.hs | bsd-3-clause | fuse p (Return y) k1 k2 = k2 p y | 43 | fuse p (Return y) k1 k2 = k2 p y | 43 | fuse p (Return y) k1 k2 = k2 p y | 43 | false | false | 0 | 7 | 20 | 27 | 12 | 15 | null | null |
petester42/haskell-hockey | src/Hockey/Playoffs.hs | mit | groupWinningSeeds :: [(String, PlayoffSeed)] -> Int -> String -> Int -> [Int] -> [PlayoffSeed]
groupWinningSeeds winningSeeds year conference round series
| round == 1 && series == [1,2] = winningTeamsToPlayoffSeed teams year conference 2 1
| round == 1 && series == [3,4] = winningTeamsToPlayoffSeed teams year conference 2 2
| round == 2 = winningTeamsToPlayoffSeed teams year conference 3 1
| round == 3 = winningTeamsToPlayoffSeed teams year "f" 4 1
| otherwise = []
where teams = groupWinningTeams round $ (List.filter (\x -> filterWinningSeed x conference round series) winningSeeds) | 614 | groupWinningSeeds :: [(String, PlayoffSeed)] -> Int -> String -> Int -> [Int] -> [PlayoffSeed]
groupWinningSeeds winningSeeds year conference round series
| round == 1 && series == [1,2] = winningTeamsToPlayoffSeed teams year conference 2 1
| round == 1 && series == [3,4] = winningTeamsToPlayoffSeed teams year conference 2 2
| round == 2 = winningTeamsToPlayoffSeed teams year conference 3 1
| round == 3 = winningTeamsToPlayoffSeed teams year "f" 4 1
| otherwise = []
where teams = groupWinningTeams round $ (List.filter (\x -> filterWinningSeed x conference round series) winningSeeds) | 614 | groupWinningSeeds winningSeeds year conference round series
| round == 1 && series == [1,2] = winningTeamsToPlayoffSeed teams year conference 2 1
| round == 1 && series == [3,4] = winningTeamsToPlayoffSeed teams year conference 2 2
| round == 2 = winningTeamsToPlayoffSeed teams year conference 3 1
| round == 3 = winningTeamsToPlayoffSeed teams year "f" 4 1
| otherwise = []
where teams = groupWinningTeams round $ (List.filter (\x -> filterWinningSeed x conference round series) winningSeeds) | 518 | false | true | 3 | 11 | 115 | 232 | 116 | 116 | null | null |
pgavin/tfp | Test.hs | bsd-3-clause | testAdd2 :: DN1 :+: D1 -> D0
testAdd2 = Prelude.id | 50 | testAdd2 :: DN1 :+: D1 -> D0
testAdd2 = Prelude.id | 50 | testAdd2 = Prelude.id | 21 | false | true | 0 | 6 | 9 | 21 | 11 | 10 | null | null |
jstolarek/haddock | haddock-api/src/Haddock.hs | bsd-2-clause | renderStep :: DynFlags -> [Flag] -> QualOption -> [(DocPaths, InterfaceFile)] -> [Interface] -> IO ()
renderStep dflags flags qual pkgs interfaces = do
updateHTMLXRefs pkgs
let
ifaceFiles = map snd pkgs
installedIfaces = concatMap ifInstalledIfaces ifaceFiles
srcMap = Map.fromList [ (ifPackageKey if_, x) | ((_, Just x), if_) <- pkgs ]
render dflags flags qual interfaces installedIfaces srcMap
-- | Render the interfaces with whatever backend is specified in the flags. | 491 | renderStep :: DynFlags -> [Flag] -> QualOption -> [(DocPaths, InterfaceFile)] -> [Interface] -> IO ()
renderStep dflags flags qual pkgs interfaces = do
updateHTMLXRefs pkgs
let
ifaceFiles = map snd pkgs
installedIfaces = concatMap ifInstalledIfaces ifaceFiles
srcMap = Map.fromList [ (ifPackageKey if_, x) | ((_, Just x), if_) <- pkgs ]
render dflags flags qual interfaces installedIfaces srcMap
-- | Render the interfaces with whatever backend is specified in the flags. | 491 | renderStep dflags flags qual pkgs interfaces = do
updateHTMLXRefs pkgs
let
ifaceFiles = map snd pkgs
installedIfaces = concatMap ifInstalledIfaces ifaceFiles
srcMap = Map.fromList [ (ifPackageKey if_, x) | ((_, Just x), if_) <- pkgs ]
render dflags flags qual interfaces installedIfaces srcMap
-- | Render the interfaces with whatever backend is specified in the flags. | 389 | false | true | 0 | 17 | 90 | 159 | 80 | 79 | null | null |
grtlr/wyas | src/Wyas/Evaluator.hs | bsd-3-clause | symbol2string _ = String "" | 36 | symbol2string _ = String "" | 36 | symbol2string _ = String "" | 36 | false | false | 0 | 5 | 13 | 13 | 5 | 8 | null | null |
NatureShade/SymbolicHaskell | src/Math/Symbolic/Simplify.hs | mit | mathCompare Sym{} _ = LT | 24 | mathCompare Sym{} _ = LT | 24 | mathCompare Sym{} _ = LT | 24 | false | false | 1 | 5 | 4 | 18 | 7 | 11 | null | null |
jdavidberger/project-euler | prob124.hs | lgpl-3.0 | main = putStrLn $ show $ snd $ (!! (want-1)) $ prob124 limit | 60 | main = putStrLn $ show $ snd $ (!! (want-1)) $ prob124 limit | 60 | main = putStrLn $ show $ snd $ (!! (want-1)) $ prob124 limit | 60 | false | false | 7 | 8 | 12 | 42 | 19 | 23 | null | null |
m4lvin/robbed | src/Data/ROBDD.hs | bsd-3-clause | -- Note: the reverse node maps of each input BDD are ignored because
-- we need to build a new one on the fly for the result BDD.
-- This is the main implementation of apply, but also re-used for the
-- combined apply/quantify operations.
applyInner :: BinBoolFunc -> EvaluationContext -> BDD -> BDD ->
BDDContext (Int, NodeId, NodeId) BDD BDD
applyInner op ctxt bdd1 bdd2 = appBase bdd1 bdd2
where
appBase :: BDD -> BDD -> BDDContext (EvaluationContext, NodeId, NodeId) BDD BDD
appBase lhs rhs = memoize (ctxt, nodeUID lhs, nodeUID rhs) $
case maybeApply op lhs rhs of
Just True -> return One
Just False -> return Zero
Nothing -> appRec lhs rhs
appRec :: BDD -> BDD -> BDDContext (EvaluationContext, NodeId, NodeId) BDD BDD
appRec lhs rhs = do
(v, l', h') <- genApplySubproblems appBase lhs rhs
mk v l' h' | 884 | applyInner :: BinBoolFunc -> EvaluationContext -> BDD -> BDD ->
BDDContext (Int, NodeId, NodeId) BDD BDD
applyInner op ctxt bdd1 bdd2 = appBase bdd1 bdd2
where
appBase :: BDD -> BDD -> BDDContext (EvaluationContext, NodeId, NodeId) BDD BDD
appBase lhs rhs = memoize (ctxt, nodeUID lhs, nodeUID rhs) $
case maybeApply op lhs rhs of
Just True -> return One
Just False -> return Zero
Nothing -> appRec lhs rhs
appRec :: BDD -> BDD -> BDDContext (EvaluationContext, NodeId, NodeId) BDD BDD
appRec lhs rhs = do
(v, l', h') <- genApplySubproblems appBase lhs rhs
mk v l' h' | 642 | applyInner op ctxt bdd1 bdd2 = appBase bdd1 bdd2
where
appBase :: BDD -> BDD -> BDDContext (EvaluationContext, NodeId, NodeId) BDD BDD
appBase lhs rhs = memoize (ctxt, nodeUID lhs, nodeUID rhs) $
case maybeApply op lhs rhs of
Just True -> return One
Just False -> return Zero
Nothing -> appRec lhs rhs
appRec :: BDD -> BDD -> BDDContext (EvaluationContext, NodeId, NodeId) BDD BDD
appRec lhs rhs = do
(v, l', h') <- genApplySubproblems appBase lhs rhs
mk v l' h' | 523 | true | true | 7 | 10 | 221 | 236 | 123 | 113 | null | null |
cullina/Extractor | src/GraphAlgorithms.hs | bsd-3-clause | keepNeighbors (v:vs) ((x,ys):es) =
case compare v x of
LT -> keepNeighbors vs ((x,ys):es)
EQ -> (x,ys) : keepNeighbors vs es
GT -> keepNeighbors (v:vs) es | 170 | keepNeighbors (v:vs) ((x,ys):es) =
case compare v x of
LT -> keepNeighbors vs ((x,ys):es)
EQ -> (x,ys) : keepNeighbors vs es
GT -> keepNeighbors (v:vs) es | 170 | keepNeighbors (v:vs) ((x,ys):es) =
case compare v x of
LT -> keepNeighbors vs ((x,ys):es)
EQ -> (x,ys) : keepNeighbors vs es
GT -> keepNeighbors (v:vs) es | 170 | false | false | 0 | 11 | 41 | 103 | 54 | 49 | null | null |
thielema/wxhaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcTypes.hs | lgpl-2.1 | -- marshalling 1
-- | Returns a red color component
colorRed :: (Num a) => Color -> a
colorRed (Color rgba) = fromIntegral ((shiftR rgba 24) .&. 0xFF) | 154 | colorRed :: (Num a) => Color -> a
colorRed (Color rgba) = fromIntegral ((shiftR rgba 24) .&. 0xFF) | 102 | colorRed (Color rgba) = fromIntegral ((shiftR rgba 24) .&. 0xFF) | 66 | true | true | 0 | 9 | 31 | 53 | 28 | 25 | null | null |
gnn/Hets | CSL/Parse_Test.hs | gpl-2.0 | -- | In addition to scanFloat, also '1.', '.1' and '2.e-13' are recognized
scanMyFloat :: CharParser st String
scanMyFloat =
let -- the 'E' component
compE = oneOf "eE" <:> getSNumber
-- the '.' component
compD n = char '.' <:> n
-- an optional number
getNumber' = option "0" getNumber
checkSign' '+' = []
checkSign' _ = "-"
checkSp "-." = "-0."
checkSp _ = "0."
getSNumber = withS getNumber
withS p = optionL (oneOf "+-" >-> checkSign') <++> p
in -- '1.' or '2.e-13' or '1.213'
try (getSNumber <++> (optionL (try $ compD getNumber') <++> optionL compE))
-- everything starting with a dot
<|> (choice (map string ["+.", "-.", "."]) >-> checkSp) <++> getNumber <++> optionL compE | 792 | scanMyFloat :: CharParser st String
scanMyFloat =
let -- the 'E' component
compE = oneOf "eE" <:> getSNumber
-- the '.' component
compD n = char '.' <:> n
-- an optional number
getNumber' = option "0" getNumber
checkSign' '+' = []
checkSign' _ = "-"
checkSp "-." = "-0."
checkSp _ = "0."
getSNumber = withS getNumber
withS p = optionL (oneOf "+-" >-> checkSign') <++> p
in -- '1.' or '2.e-13' or '1.213'
try (getSNumber <++> (optionL (try $ compD getNumber') <++> optionL compE))
-- everything starting with a dot
<|> (choice (map string ["+.", "-.", "."]) >-> checkSp) <++> getNumber <++> optionL compE | 717 | scanMyFloat =
let -- the 'E' component
compE = oneOf "eE" <:> getSNumber
-- the '.' component
compD n = char '.' <:> n
-- an optional number
getNumber' = option "0" getNumber
checkSign' '+' = []
checkSign' _ = "-"
checkSp "-." = "-0."
checkSp _ = "0."
getSNumber = withS getNumber
withS p = optionL (oneOf "+-" >-> checkSign') <++> p
in -- '1.' or '2.e-13' or '1.213'
try (getSNumber <++> (optionL (try $ compD getNumber') <++> optionL compE))
-- everything starting with a dot
<|> (choice (map string ["+.", "-.", "."]) >-> checkSp) <++> getNumber <++> optionL compE | 681 | true | true | 4 | 13 | 232 | 213 | 107 | 106 | null | null |
loskutov/logic-hw | Lambdas.hs | mit | freeVars :: Lambda → Set String
freeVars (Var s) = singleton s | 74 | freeVars :: Lambda → Set String
freeVars (Var s) = singleton s | 74 | freeVars (Var s) = singleton s | 42 | false | true | 0 | 7 | 23 | 30 | 14 | 16 | null | null |
feliposz/learning-stuff | haskell/c9lectures-ch5.hs | mit | fszip [] _ = [] | 15 | fszip [] _ = [] | 15 | fszip [] _ = [] | 15 | false | false | 0 | 6 | 4 | 15 | 7 | 8 | null | null |
dsorokin/aivika-lattice | Simulation/Aivika/Lattice/Internal/Event.hs | bsd-3-clause | -- | Process the events.
processEvents :: EventProcessing -> Dynamics LIO ()
processEvents CurrentEvents = processEventsIncludingCurrent | 136 | processEvents :: EventProcessing -> Dynamics LIO ()
processEvents CurrentEvents = processEventsIncludingCurrent | 111 | processEvents CurrentEvents = processEventsIncludingCurrent | 59 | true | true | 0 | 7 | 15 | 26 | 13 | 13 | null | null |
PhDP/Sphinx-AI | Faun/Parser/FOL.hs | mit | parseNot :: Parser (FOL -> FOL)
parseNot = reservedOps ["Not", "NOT", "not", "~", "!", "¬"] >> return Not | 105 | parseNot :: Parser (FOL -> FOL)
parseNot = reservedOps ["Not", "NOT", "not", "~", "!", "¬"] >> return Not | 105 | parseNot = reservedOps ["Not", "NOT", "not", "~", "!", "¬"] >> return Not | 73 | false | true | 1 | 7 | 17 | 52 | 27 | 25 | null | null |
tomleb/portfolio | src/Web/Views/Nav.hs | mit | navBase :: _ -> H.Html
navBase mLink =
H.body ! A.class_ "full f f-col f-sb fi-stretch white black-text" $ do
case mLink of
Just l -> H.header ! A.class_ "right" $
H.a ! A.class_ "close right m4" ! A.href (toHref l) $ do
H.span mempty
H.span mempty
Nothing -> mempty
H.main ! A.class_ "f-g5 f f-row f-center fi-stretch" $
H.ul ! A.class_ "f f-col f-center" $ forM_ (map navLi links) id | 497 | navBase :: _ -> H.Html
navBase mLink =
H.body ! A.class_ "full f f-col f-sb fi-stretch white black-text" $ do
case mLink of
Just l -> H.header ! A.class_ "right" $
H.a ! A.class_ "close right m4" ! A.href (toHref l) $ do
H.span mempty
H.span mempty
Nothing -> mempty
H.main ! A.class_ "f-g5 f f-row f-center fi-stretch" $
H.ul ! A.class_ "f f-col f-center" $ forM_ (map navLi links) id | 497 | navBase mLink =
H.body ! A.class_ "full f f-col f-sb fi-stretch white black-text" $ do
case mLink of
Just l -> H.header ! A.class_ "right" $
H.a ! A.class_ "close right m4" ! A.href (toHref l) $ do
H.span mempty
H.span mempty
Nothing -> mempty
H.main ! A.class_ "f-g5 f f-row f-center fi-stretch" $
H.ul ! A.class_ "f f-col f-center" $ forM_ (map navLi links) id | 474 | false | true | 0 | 17 | 182 | 164 | 75 | 89 | null | null |
kindl/Hypatia | src/Parser.hs | mit | alts = curlyBraces (sepBy' alt (token ";")) | 43 | alts = curlyBraces (sepBy' alt (token ";")) | 43 | alts = curlyBraces (sepBy' alt (token ";")) | 43 | false | false | 0 | 9 | 6 | 23 | 11 | 12 | null | null |
biegunka/biegunka | src/Control/Biegunka/Patience.hs | mit | extract :: Piles t -> [(Int, t)]
extract = maybe [] (walk . NonEmpty.head . fst) . IntMap.maxView
where
walk (Card x a c) = (x, a) : maybe [] walk c | 151 | extract :: Piles t -> [(Int, t)]
extract = maybe [] (walk . NonEmpty.head . fst) . IntMap.maxView
where
walk (Card x a c) = (x, a) : maybe [] walk c | 151 | extract = maybe [] (walk . NonEmpty.head . fst) . IntMap.maxView
where
walk (Card x a c) = (x, a) : maybe [] walk c | 118 | false | true | 0 | 10 | 34 | 93 | 48 | 45 | null | null |
csrhodes/pandoc | src/Text/Pandoc/Writers/Docx.hs | gpl-2.0 | popParaProp :: WS ()
popParaProp = modify $ \s -> s{ stParaProperties = drop 1 $ stParaProperties s } | 101 | popParaProp :: WS ()
popParaProp = modify $ \s -> s{ stParaProperties = drop 1 $ stParaProperties s } | 101 | popParaProp = modify $ \s -> s{ stParaProperties = drop 1 $ stParaProperties s } | 80 | false | true | 2 | 9 | 18 | 54 | 24 | 30 | null | null |
ambiata/highlighting-kate | Text/Highlighting/Kate/Syntax/Prolog.hs | gpl-2.0 | parseRules ("Prolog","list_functor") =
(((pDetectChar False '.' >>= withAttribute FunctionTok) >>~ (popContext))
<|>
(currentContext >>= \x -> guard (x == ("Prolog","list_functor")) >> pDefault >>= withAttribute ErrorTok)) | 230 | parseRules ("Prolog","list_functor") =
(((pDetectChar False '.' >>= withAttribute FunctionTok) >>~ (popContext))
<|>
(currentContext >>= \x -> guard (x == ("Prolog","list_functor")) >> pDefault >>= withAttribute ErrorTok)) | 230 | parseRules ("Prolog","list_functor") =
(((pDetectChar False '.' >>= withAttribute FunctionTok) >>~ (popContext))
<|>
(currentContext >>= \x -> guard (x == ("Prolog","list_functor")) >> pDefault >>= withAttribute ErrorTok)) | 230 | false | false | 0 | 15 | 32 | 86 | 46 | 40 | null | null |
Daniel-Diaz/processing | examples/pacman.hs | bsd-3-clause | when :: Proc_Bool -> EventM c () -> EventM c ()
when b x = ifM b x $ return () | 78 | when :: Proc_Bool -> EventM c () -> EventM c ()
when b x = ifM b x $ return () | 78 | when b x = ifM b x $ return () | 30 | false | true | 0 | 8 | 20 | 52 | 24 | 28 | null | null |
mightymoose/liquidhaskell | docs/blog/todo/index-dependent-maps.hs | bsd-3-clause | -- The signature for `empty` states that its domain is empty (ie is the set of indices satisfying the predicate `False`), and that the range satisfies _any_ invariant. The signature for `create`, instead, defines a _constant_ vector that maps every index to the constant `x`.
-- Accessing Vectors
-- -----------------
-- We can write the following `get` function for reading the contents of a vector at a given index:
{-@ get :: forall a <d :: x0:Int -> Prop, r :: x0: Int -> x1:a -> Prop>.
i: Int<d> ->
a: (j: Int<d> -> a<r j>) ->
a<r i>
@-}
get :: Int -> Vec a -> a
get i a = a i | 626 | get :: Int -> Vec a -> a
get i a = a i | 38 | get i a = a i | 13 | true | true | 0 | 7 | 158 | 39 | 20 | 19 | null | null |
RefactoringTools/HaRe | test/testdata/NoMod.hs | bsd-3-clause | foo' x = case (odd x) of
True -> "Odd"
False -> "Even" | 58 | foo' x = case (odd x) of
True -> "Odd"
False -> "Even" | 58 | foo' x = case (odd x) of
True -> "Odd"
False -> "Even" | 58 | false | false | 1 | 8 | 16 | 35 | 15 | 20 | null | null |
koba-e964/tigress | src/TigressEval.hs | bsd-3-clause | readVar :: (PrimMonad m, Monad m) => VarRef m a -> TigressT r m a
readVar var = lift $ readMutVar var | 101 | readVar :: (PrimMonad m, Monad m) => VarRef m a -> TigressT r m a
readVar var = lift $ readMutVar var | 101 | readVar var = lift $ readMutVar var | 35 | false | true | 0 | 7 | 21 | 52 | 25 | 27 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | emitPrimOp _ res IndexByteArrayOp_Int64 args = doIndexByteArrayOp Nothing b64 res args | 105 | emitPrimOp _ res IndexByteArrayOp_Int64 args = doIndexByteArrayOp Nothing b64 res args | 105 | emitPrimOp _ res IndexByteArrayOp_Int64 args = doIndexByteArrayOp Nothing b64 res args | 105 | false | false | 0 | 5 | 29 | 24 | 11 | 13 | null | null |
TransformingMusicology/adb-test-framework | src/AudioDB/Test.hs | gpl-3.0 | runTest :: Bool -> Test -> IO TestRun
runTest withEval test = do
log' $ "Starting test: " `T.append` (T.pack $ t_identifier test)
libaudioDB <- audiodb_lib_build_id >>= peekCString
os <- return Sys.os
arch <- return Sys.arch
method <- return Serial
startTime <- getCurrentTime
results <- mapM (runQuery withEval) (t_queries test)
endTime <- getCurrentTime
return TestRun {
tr_test = test
, tr_results = results
, tr_startTime = startTime
, tr_endTime = endTime
, tr_libaudioDBv = libaudioDB
, tr_systemName = os
, tr_systemArch = arch
, tr_execMethod = method } | 661 | runTest :: Bool -> Test -> IO TestRun
runTest withEval test = do
log' $ "Starting test: " `T.append` (T.pack $ t_identifier test)
libaudioDB <- audiodb_lib_build_id >>= peekCString
os <- return Sys.os
arch <- return Sys.arch
method <- return Serial
startTime <- getCurrentTime
results <- mapM (runQuery withEval) (t_queries test)
endTime <- getCurrentTime
return TestRun {
tr_test = test
, tr_results = results
, tr_startTime = startTime
, tr_endTime = endTime
, tr_libaudioDBv = libaudioDB
, tr_systemName = os
, tr_systemArch = arch
, tr_execMethod = method } | 661 | runTest withEval test = do
log' $ "Starting test: " `T.append` (T.pack $ t_identifier test)
libaudioDB <- audiodb_lib_build_id >>= peekCString
os <- return Sys.os
arch <- return Sys.arch
method <- return Serial
startTime <- getCurrentTime
results <- mapM (runQuery withEval) (t_queries test)
endTime <- getCurrentTime
return TestRun {
tr_test = test
, tr_results = results
, tr_startTime = startTime
, tr_endTime = endTime
, tr_libaudioDBv = libaudioDB
, tr_systemName = os
, tr_systemArch = arch
, tr_execMethod = method } | 623 | false | true | 0 | 10 | 187 | 193 | 98 | 95 | null | null |
Gurrt/software-testing | week-5/Exercise5.hs | mit | iqueSol :: Node -> Bool
uniqueSol node = singleton (solveNs [node]) where
singleton [] = False
singleton [x] = True
singleton (x:y:zs) = False
| 158 | uniqueSol :: Node -> Bool
uniqueSol node = singleton (solveNs [node]) where
singleton [] = False
singleton [x] = True
singleton (x:y:zs) = False | 156 | uniqueSol node = singleton (solveNs [node]) where
singleton [] = False
singleton [x] = True
singleton (x:y:zs) = False | 130 | false | true | 0 | 10 | 39 | 77 | 38 | 39 | null | null |
icostan/haskell-lang | dist/build/autogen/Paths_haskell_lang.hs | lgpl-3.0 | libdir = "/Users/icostan/.cabal/lib/x86_64-osx-ghc-7.10.1/haske_DYAsM7lZ8KFK9XmNGG9nLi" | 91 | libdir = "/Users/icostan/.cabal/lib/x86_64-osx-ghc-7.10.1/haske_DYAsM7lZ8KFK9XmNGG9nLi" | 91 | libdir = "/Users/icostan/.cabal/lib/x86_64-osx-ghc-7.10.1/haske_DYAsM7lZ8KFK9XmNGG9nLi" | 91 | false | false | 0 | 4 | 6 | 6 | 3 | 3 | null | null |
graninas/ICFPC2007 | Endo/Test/EndoDnaTest.hs | gpl-3.0 | prop_basicSubsequence8 = toDna "ICFP" |- only 6 == emptyDna | 68 | prop_basicSubsequence8 = toDna "ICFP" |- only 6 == emptyDna | 68 | prop_basicSubsequence8 = toDna "ICFP" |- only 6 == emptyDna | 68 | false | false | 0 | 7 | 17 | 20 | 9 | 11 | null | null |
ihc/futhark | src/Language/Futhark/TypeChecker/Terms.hs | isc | patternUses (PatternParens p _) = patternUses p | 47 | patternUses (PatternParens p _) = patternUses p | 47 | patternUses (PatternParens p _) = patternUses p | 47 | false | false | 0 | 7 | 6 | 20 | 9 | 11 | null | null |
ml9951/ghc | compiler/codeGen/StgCmmLayout.hs | bsd-3-clause | ------------------------------------------------------------------------
-- Call and return sequences
------------------------------------------------------------------------
-- | Return multiple values to the sequel
--
-- If the sequel is @Return@
--
-- > return (x,y)
--
-- If the sequel is @AssignTo [p,q]@
--
-- > p=x; q=y;
--
emitReturn :: [CmmExpr] -> FCode ReturnKind
emitReturn results
= do { dflags <- getDynFlags
; sequel <- getSequel
; updfr_off <- getUpdFrameOff
; case sequel of
Return _ ->
do { adjustHpBackwards
; let e = CmmLoad (CmmStackSlot Old updfr_off) (gcWord dflags)
; emit (mkReturn dflags (entryCode dflags e) results updfr_off)
}
AssignTo regs adjust ->
do { when adjust adjustHpBackwards
; emitMultiAssign regs results }
; return AssignedDirectly
} | 954 | emitReturn :: [CmmExpr] -> FCode ReturnKind
emitReturn results
= do { dflags <- getDynFlags
; sequel <- getSequel
; updfr_off <- getUpdFrameOff
; case sequel of
Return _ ->
do { adjustHpBackwards
; let e = CmmLoad (CmmStackSlot Old updfr_off) (gcWord dflags)
; emit (mkReturn dflags (entryCode dflags e) results updfr_off)
}
AssignTo regs adjust ->
do { when adjust adjustHpBackwards
; emitMultiAssign regs results }
; return AssignedDirectly
} | 600 | emitReturn results
= do { dflags <- getDynFlags
; sequel <- getSequel
; updfr_off <- getUpdFrameOff
; case sequel of
Return _ ->
do { adjustHpBackwards
; let e = CmmLoad (CmmStackSlot Old updfr_off) (gcWord dflags)
; emit (mkReturn dflags (entryCode dflags e) results updfr_off)
}
AssignTo regs adjust ->
do { when adjust adjustHpBackwards
; emitMultiAssign regs results }
; return AssignedDirectly
} | 556 | true | true | 0 | 18 | 289 | 182 | 94 | 88 | null | null |
snoyberg/ghc | compiler/types/Type.hs | bsd-3-clause | getCastedTyVar_maybe (TyVarTy tv)
= Just (tv, mkReflCo Nominal (tyVarKind tv)) | 80 | getCastedTyVar_maybe (TyVarTy tv)
= Just (tv, mkReflCo Nominal (tyVarKind tv)) | 80 | getCastedTyVar_maybe (TyVarTy tv)
= Just (tv, mkReflCo Nominal (tyVarKind tv)) | 80 | false | false | 0 | 8 | 11 | 35 | 17 | 18 | null | null |
achirkin/ghcjs-webgl | src/JavaScript/WebGL/Const.hs | mit | gl_RENDERBUFFER_INTERNAL_FORMAT :: GLenum
gl_RENDERBUFFER_INTERNAL_FORMAT = 0x8D44 | 82 | gl_RENDERBUFFER_INTERNAL_FORMAT :: GLenum
gl_RENDERBUFFER_INTERNAL_FORMAT = 0x8D44 | 82 | gl_RENDERBUFFER_INTERNAL_FORMAT = 0x8D44 | 40 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
aelve/json-x | lib/Json/Internal/TH.hs | bsd-3-clause | (<%>) :: ExpQ -> ExpQ -> ExpQ
(<%>) a b = a <^> [|B.char7 ','|] <^> b | 69 | (<%>) :: ExpQ -> ExpQ -> ExpQ
(<%>) a b = a <^> [|B.char7 ','|] <^> b | 69 | (<%>) a b = a <^> [|B.char7 ','|] <^> b | 39 | false | true | 4 | 8 | 16 | 47 | 24 | 23 | null | null |
snoyberg/ghc | libraries/base/GHC/List.hs | bsd-3-clause | dropWhile p xs@(x:xs')
| p x = dropWhile p xs'
| otherwise = xs | 95 | dropWhile p xs@(x:xs')
| p x = dropWhile p xs'
| otherwise = xs | 95 | dropWhile p xs@(x:xs')
| p x = dropWhile p xs'
| otherwise = xs | 95 | false | false | 0 | 8 | 45 | 54 | 22 | 32 | null | null |
rodrigo-machado/verigraph | src/library/Abstract/Rewriting/DPO/Process.hs | gpl-3.0 | allCoproduct :: (DPO morph, Cocomplete morph) => [Production morph] -> [morph]
allCoproduct = calculateNCoproduct . fromList . getAllObjects | 140 | allCoproduct :: (DPO morph, Cocomplete morph) => [Production morph] -> [morph]
allCoproduct = calculateNCoproduct . fromList . getAllObjects | 140 | allCoproduct = calculateNCoproduct . fromList . getAllObjects | 61 | false | true | 0 | 9 | 17 | 54 | 26 | 28 | null | null |
ardumont/snake | deps/gloss-rendering/Graphics/Gloss/Internals/Data/Color.hs | bsd-3-clause | -- | Make a custom color, taking pre-clamped components.
makeRawColorI :: Int -> Int -> Int -> Int -> Color
makeRawColorI r g b a
= RGBA (fromIntegral r / 255)
(fromIntegral g / 255)
(fromIntegral b / 255)
(fromIntegral a / 255) | 286 | makeRawColorI :: Int -> Int -> Int -> Int -> Color
makeRawColorI r g b a
= RGBA (fromIntegral r / 255)
(fromIntegral g / 255)
(fromIntegral b / 255)
(fromIntegral a / 255) | 229 | makeRawColorI r g b a
= RGBA (fromIntegral r / 255)
(fromIntegral g / 255)
(fromIntegral b / 255)
(fromIntegral a / 255) | 178 | true | true | 0 | 8 | 100 | 86 | 43 | 43 | null | null |
NinjaTrappeur/DobadoBots | src/DobadoBots/Graphics/Utils.hs | bsd-3-clause | getBmpTex :: String -> SDL.Renderer -> IO (SDL.Texture, SDL.V2 CInt)
getBmpTex path r = do
surf <- SDL.loadBMP path
tex <- SDL.createTextureFromSurface r surf
dim <- SDL.surfaceDimensions surf
SDL.freeSurface surf
return (tex, dim)
-- We know when a point is in a rectangle when
-- for a rectangle A, B, C (where ab and bc are perpendicular)
-- we have 0 <= dot(AB,AM) <= dot(AB,AB) && 0 <= dot(bc, bm) <= dot(bc, bc) | 472 | getBmpTex :: String -> SDL.Renderer -> IO (SDL.Texture, SDL.V2 CInt)
getBmpTex path r = do
surf <- SDL.loadBMP path
tex <- SDL.createTextureFromSurface r surf
dim <- SDL.surfaceDimensions surf
SDL.freeSurface surf
return (tex, dim)
-- We know when a point is in a rectangle when
-- for a rectangle A, B, C (where ab and bc are perpendicular)
-- we have 0 <= dot(AB,AM) <= dot(AB,AB) && 0 <= dot(bc, bm) <= dot(bc, bc) | 472 | getBmpTex path r = do
surf <- SDL.loadBMP path
tex <- SDL.createTextureFromSurface r surf
dim <- SDL.surfaceDimensions surf
SDL.freeSurface surf
return (tex, dim)
-- We know when a point is in a rectangle when
-- for a rectangle A, B, C (where ab and bc are perpendicular)
-- we have 0 <= dot(AB,AM) <= dot(AB,AB) && 0 <= dot(bc, bm) <= dot(bc, bc) | 403 | false | true | 0 | 10 | 127 | 103 | 49 | 54 | null | null |
vdweegen/UvA-Software_Testing | Lab4/Willem/Exercises.hs | gpl-3.0 | -- | Difference props
prop_difference_subset :: Set Int -> Set Int -> Bool
prop_difference_subset a b = s `subSet` a where s = a `differenceSet` b | 146 | prop_difference_subset :: Set Int -> Set Int -> Bool
prop_difference_subset a b = s `subSet` a where s = a `differenceSet` b | 124 | prop_difference_subset a b = s `subSet` a where s = a `differenceSet` b | 71 | true | true | 0 | 7 | 25 | 50 | 27 | 23 | null | null |
dmagyar/scurry | src/Scurry/Comm/SockWrite.hs | bsd-3-clause | sendToAddr :: Socket -> ScurryMsg -> EndPoint -> IO Int
sendToAddr s m = sendTo s (BSS.concat . BS.toChunks $ encode m) . epToSa | 128 | sendToAddr :: Socket -> ScurryMsg -> EndPoint -> IO Int
sendToAddr s m = sendTo s (BSS.concat . BS.toChunks $ encode m) . epToSa | 128 | sendToAddr s m = sendTo s (BSS.concat . BS.toChunks $ encode m) . epToSa | 72 | false | true | 0 | 10 | 23 | 58 | 28 | 30 | null | null |
uduki/hsQt | Qtc/ClassTypes/Network.hs | bsd-2-clause | withQListQTcpServerResult :: (Ptr (Ptr (TQTcpServer a)) -> IO CInt) -> IO [QTcpServer a]
withQListQTcpServerResult f
= withQListObjectResult qtc_QTcpServer_getFinalizer f | 172 | withQListQTcpServerResult :: (Ptr (Ptr (TQTcpServer a)) -> IO CInt) -> IO [QTcpServer a]
withQListQTcpServerResult f
= withQListObjectResult qtc_QTcpServer_getFinalizer f | 172 | withQListQTcpServerResult f
= withQListObjectResult qtc_QTcpServer_getFinalizer f | 83 | false | true | 0 | 12 | 20 | 57 | 27 | 30 | null | null |
brendanhay/gogol | gogol-oslogin/gen/Network/Google/OSLogin/Types.hs | mpl-2.0 | -- | View and manage your Google Compute Engine resources
computeScope :: Proxy '["https://www.googleapis.com/auth/compute"]
computeScope = Proxy | 145 | computeScope :: Proxy '["https://www.googleapis.com/auth/compute"]
computeScope = Proxy | 87 | computeScope = Proxy | 20 | true | true | 0 | 8 | 16 | 26 | 12 | 14 | null | null |
ezyang/ghc | compiler/basicTypes/SrcLoc.hs | bsd-3-clause | isOneLineSpan (UnhelpfulSpan _) = False | 39 | isOneLineSpan (UnhelpfulSpan _) = False | 39 | isOneLineSpan (UnhelpfulSpan _) = False | 39 | false | false | 0 | 6 | 4 | 16 | 7 | 9 | null | null |
joehillen/ultron | app/Main.hs | mit | runCommand :: ChannelId -> UserId -> [FilePath] -> Text -> [Text] -> IO Text
runCommand cid uid dirpaths cmd args = handle handler go
where
handler :: SomeException -> IO Text
handler e = return $ "*ERROR:* "<>tshow e
go | cmd == "help" = help dirpaths
| otherwise =
getBin dirpaths cmd >>= \case
Nothing -> return $ "*ERROR:* Unknown command: " <> cmd
Just bin -> runbin bin
cmdErrorResponse stdout stderr errNum =
"<@"<>uid ^. getId<>">\n"
<>"*ERROR:* `"<>cmd<>"` failed with exit code: "<>tshow errNum<>"\n"
<>emptyIfNull "stdout" stdout
<>emptyIfNull "stderr" stderr
emptyIfNull _ "" = ""
emptyIfNull name s = (T.intercalate "\n" [ "*" <> name <> ":*"
, "```"
, s
, "```"
]) <> "\n"
mkProc bin = (proc bin (map T.unpack args))
{ env = Just [ ("ULTRON_CID", (cid ^. getId . unpacked))
, ("ULTRON_UID", (uid ^. getId . unpacked))
]
, close_fds = True
}
runbin bin = do
(ec, stdout, stderr) <- PT.readCreateProcessWithExitCode (mkProc bin) ""
return $ case ec of
ExitSuccess -> stdout
ExitFailure errNum -> cmdErrorResponse stdout stderr errNum | 1,445 | runCommand :: ChannelId -> UserId -> [FilePath] -> Text -> [Text] -> IO Text
runCommand cid uid dirpaths cmd args = handle handler go
where
handler :: SomeException -> IO Text
handler e = return $ "*ERROR:* "<>tshow e
go | cmd == "help" = help dirpaths
| otherwise =
getBin dirpaths cmd >>= \case
Nothing -> return $ "*ERROR:* Unknown command: " <> cmd
Just bin -> runbin bin
cmdErrorResponse stdout stderr errNum =
"<@"<>uid ^. getId<>">\n"
<>"*ERROR:* `"<>cmd<>"` failed with exit code: "<>tshow errNum<>"\n"
<>emptyIfNull "stdout" stdout
<>emptyIfNull "stderr" stderr
emptyIfNull _ "" = ""
emptyIfNull name s = (T.intercalate "\n" [ "*" <> name <> ":*"
, "```"
, s
, "```"
]) <> "\n"
mkProc bin = (proc bin (map T.unpack args))
{ env = Just [ ("ULTRON_CID", (cid ^. getId . unpacked))
, ("ULTRON_UID", (uid ^. getId . unpacked))
]
, close_fds = True
}
runbin bin = do
(ec, stdout, stderr) <- PT.readCreateProcessWithExitCode (mkProc bin) ""
return $ case ec of
ExitSuccess -> stdout
ExitFailure errNum -> cmdErrorResponse stdout stderr errNum | 1,445 | runCommand cid uid dirpaths cmd args = handle handler go
where
handler :: SomeException -> IO Text
handler e = return $ "*ERROR:* "<>tshow e
go | cmd == "help" = help dirpaths
| otherwise =
getBin dirpaths cmd >>= \case
Nothing -> return $ "*ERROR:* Unknown command: " <> cmd
Just bin -> runbin bin
cmdErrorResponse stdout stderr errNum =
"<@"<>uid ^. getId<>">\n"
<>"*ERROR:* `"<>cmd<>"` failed with exit code: "<>tshow errNum<>"\n"
<>emptyIfNull "stdout" stdout
<>emptyIfNull "stderr" stderr
emptyIfNull _ "" = ""
emptyIfNull name s = (T.intercalate "\n" [ "*" <> name <> ":*"
, "```"
, s
, "```"
]) <> "\n"
mkProc bin = (proc bin (map T.unpack args))
{ env = Just [ ("ULTRON_CID", (cid ^. getId . unpacked))
, ("ULTRON_UID", (uid ^. getId . unpacked))
]
, close_fds = True
}
runbin bin = do
(ec, stdout, stderr) <- PT.readCreateProcessWithExitCode (mkProc bin) ""
return $ case ec of
ExitSuccess -> stdout
ExitFailure errNum -> cmdErrorResponse stdout stderr errNum | 1,368 | false | true | 10 | 12 | 576 | 431 | 214 | 217 | null | null |
ctford/Idris-Elba-dev | src/IRTS/System.hs | bsd-3-clause | getExecutablePom = do dir <- getDataDir
return $ dir </> "java" </> "executable_pom.xml" | 110 | getExecutablePom = do dir <- getDataDir
return $ dir </> "java" </> "executable_pom.xml" | 110 | getExecutablePom = do dir <- getDataDir
return $ dir </> "java" </> "executable_pom.xml" | 110 | false | false | 0 | 9 | 34 | 28 | 13 | 15 | null | null |
jwiegley/ghc-release | utils/haddock/src/Haddock/Interface/Rename.hs | gpl-3.0 | getLookupRn :: RnM (Name -> (Bool, DocName))
getLookupRn = RnM (\lkp -> (lkp,[])) | 81 | getLookupRn :: RnM (Name -> (Bool, DocName))
getLookupRn = RnM (\lkp -> (lkp,[])) | 81 | getLookupRn = RnM (\lkp -> (lkp,[])) | 36 | false | true | 0 | 9 | 12 | 46 | 26 | 20 | null | null |
athanclark/Idris-dev | src/Idris/Reflection.hs | bsd-3-clause | rawBool :: Bool -> Raw
rawBool True = Var (sNS (sUN "True") ["Bool", "Prelude"]) | 81 | rawBool :: Bool -> Raw
rawBool True = Var (sNS (sUN "True") ["Bool", "Prelude"]) | 81 | rawBool True = Var (sNS (sUN "True") ["Bool", "Prelude"]) | 58 | false | true | 0 | 9 | 14 | 45 | 22 | 23 | null | null |
SavinaRoja/SavinaRoja.github.io | assets/centraldogma_algebraic.hs | mit | geneticCode (Codon Adenine Thymine Guanosine) = Methionine | 62 | geneticCode (Codon Adenine Thymine Guanosine) = Methionine | 62 | geneticCode (Codon Adenine Thymine Guanosine) = Methionine | 62 | false | false | 0 | 7 | 10 | 19 | 9 | 10 | null | null |
PipocaQuemada/ermine | src/Ermine/Syntax/Scope.hs | bsd-2-clause | splitScope :: (Applicative c, Monad c)
=> Scope (Var b1 b2) c a -> Scope b1 (Scope b2 c) a
-- c (Var (Var b1 b2) (c a))
-- Scope b2 c (Var b1 (Scope b2 c a))
splitScope (Scope e) = Scope . lift $ swizzle <$> e
where
swizzle (B (B b1)) = B b1
swizzle (B (F b2)) = F . Scope . pure . B $ b2
swizzle (F a) = F $ lift a
-- | Enables a partial rebinding and instantiation of the bound variables in a
-- 'Scope'. | 427 | splitScope :: (Applicative c, Monad c)
=> Scope (Var b1 b2) c a -> Scope b1 (Scope b2 c) a
splitScope (Scope e) = Scope . lift $ swizzle <$> e
where
swizzle (B (B b1)) = B b1
swizzle (B (F b2)) = F . Scope . pure . B $ b2
swizzle (F a) = F $ lift a
-- | Enables a partial rebinding and instantiation of the bound variables in a
-- 'Scope'. | 360 | splitScope (Scope e) = Scope . lift $ swizzle <$> e
where
swizzle (B (B b1)) = B b1
swizzle (B (F b2)) = F . Scope . pure . B $ b2
swizzle (F a) = F $ lift a
-- | Enables a partial rebinding and instantiation of the bound variables in a
-- 'Scope'. | 258 | true | true | 5 | 10 | 115 | 180 | 85 | 95 | null | null |
vincenthz/language-c | src/Language/C/Analysis/TypeCheck.hs | bsd-3-clause | notFound :: Ident -> Either String a
notFound i = Left $ "not found: " ++ identToString i | 89 | notFound :: Ident -> Either String a
notFound i = Left $ "not found: " ++ identToString i | 89 | notFound i = Left $ "not found: " ++ identToString i | 52 | false | true | 0 | 6 | 17 | 34 | 16 | 18 | null | null |
UU-ComputerScience/uulib | src/UU/Parsing/Derived.hs | bsd-3-clause | pFoldr1Sep :: (IsParser p s) => (a -> b -> b, b) -> p a1 -> p a -> p b
pFoldr1Sep alg sep p = pFoldr1Sep_gr alg sep p | 128 | pFoldr1Sep :: (IsParser p s) => (a -> b -> b, b) -> p a1 -> p a -> p b
pFoldr1Sep alg sep p = pFoldr1Sep_gr alg sep p | 128 | pFoldr1Sep alg sep p = pFoldr1Sep_gr alg sep p | 57 | false | true | 0 | 10 | 40 | 75 | 36 | 39 | null | null |
dsorokin/aivika-experiment-chart | examples/TruckHaulingSituation/Experiment.hs | bsd-3-clause | truckQueue = T.Queue $ resultByName "truckQueue" | 58 | truckQueue = T.Queue $ resultByName "truckQueue" | 58 | truckQueue = T.Queue $ resultByName "truckQueue" | 58 | false | false | 0 | 6 | 15 | 15 | 7 | 8 | null | null |
brendanhay/gogol | gogol-dlp/gen/Network/Google/DLP/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'GooglePrivacyDlpV2CategoricalStatsResult' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gpdvcsrValueFrequencyHistogramBuckets'
googlePrivacyDlpV2CategoricalStatsResult
:: GooglePrivacyDlpV2CategoricalStatsResult
googlePrivacyDlpV2CategoricalStatsResult =
GooglePrivacyDlpV2CategoricalStatsResult'
{_gpdvcsrValueFrequencyHistogramBuckets = Nothing} | 470 | googlePrivacyDlpV2CategoricalStatsResult
:: GooglePrivacyDlpV2CategoricalStatsResult
googlePrivacyDlpV2CategoricalStatsResult =
GooglePrivacyDlpV2CategoricalStatsResult'
{_gpdvcsrValueFrequencyHistogramBuckets = Nothing} | 230 | googlePrivacyDlpV2CategoricalStatsResult =
GooglePrivacyDlpV2CategoricalStatsResult'
{_gpdvcsrValueFrequencyHistogramBuckets = Nothing} | 141 | true | true | 0 | 6 | 52 | 24 | 16 | 8 | null | null |
erantapaa/happstack-server | src/Happstack/Server/Internal/TimeoutTable.hs | bsd-3-clause | killAll :: TimeoutTable -> IO ()
killAll (TimeoutTable maps _) = do
V.mapM_ k maps
where
k psqMV = modifyMVar_ psqMV $ \psq -> do
mapM_ killThread $ PSQ.keys psq
return PSQ.empty | 205 | killAll :: TimeoutTable -> IO ()
killAll (TimeoutTable maps _) = do
V.mapM_ k maps
where
k psqMV = modifyMVar_ psqMV $ \psq -> do
mapM_ killThread $ PSQ.keys psq
return PSQ.empty | 205 | killAll (TimeoutTable maps _) = do
V.mapM_ k maps
where
k psqMV = modifyMVar_ psqMV $ \psq -> do
mapM_ killThread $ PSQ.keys psq
return PSQ.empty | 172 | false | true | 0 | 11 | 58 | 87 | 39 | 48 | null | null |
pseudonom/persistent | persistent-test/src/HtmlTest.hs | mit | cleanDB :: (MonadIO m, PersistQuery backend, PersistEntityBackend HtmlTable ~ backend) => ReaderT backend m ()
cleanDB = do
deleteWhere ([] :: [Filter HtmlTable]) | 164 | cleanDB :: (MonadIO m, PersistQuery backend, PersistEntityBackend HtmlTable ~ backend) => ReaderT backend m ()
cleanDB = do
deleteWhere ([] :: [Filter HtmlTable]) | 164 | cleanDB = do
deleteWhere ([] :: [Filter HtmlTable]) | 53 | false | true | 0 | 10 | 24 | 66 | 33 | 33 | null | null |
luisgepeto/HaskellLearning | 10 Functionally Solving Problems/02_heathrow_to_london.hs | mit | --make a function that splits a list into a list of lists of same size
groupsOf :: Int -> [a] -> [[a]]
groupsOf 0 _ = undefined | 127 | groupsOf :: Int -> [a] -> [[a]]
groupsOf 0 _ = undefined | 56 | groupsOf 0 _ = undefined | 24 | true | true | 0 | 8 | 26 | 34 | 19 | 15 | null | null |
leshchevds/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | oobCommands :: FrozenSet String
oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..] | 106 | oobCommands :: FrozenSet String
oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..] | 106 | oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..] | 74 | false | true | 0 | 7 | 10 | 30 | 15 | 15 | null | null |
andrewthad/yesod | yesod-core/Yesod/Core/Handler.hs | mit | -- | Get the URL rendering function.
getUrlRender :: MonadHandler m => m (Route (HandlerSite m) -> Text)
getUrlRender = do
x <- rheRender `liftM` askHandlerEnv
return $ flip x []
-- | The URL rendering function with query-string parameters. | 249 | getUrlRender :: MonadHandler m => m (Route (HandlerSite m) -> Text)
getUrlRender = do
x <- rheRender `liftM` askHandlerEnv
return $ flip x []
-- | The URL rendering function with query-string parameters. | 212 | getUrlRender = do
x <- rheRender `liftM` askHandlerEnv
return $ flip x []
-- | The URL rendering function with query-string parameters. | 144 | true | true | 0 | 11 | 48 | 66 | 33 | 33 | null | null |
luzhuomi/xhaskell-regex-deriv | Text/Regex/Deriv/ByteString/BitCode.hs | bsd-3-clause | -- not in used
extractSR (PChoice [p] _) (Choice [r] _) u start_index = extractSR p r u start_index | 99 | extractSR (PChoice [p] _) (Choice [r] _) u start_index = extractSR p r u start_index | 84 | extractSR (PChoice [p] _) (Choice [r] _) u start_index = extractSR p r u start_index | 84 | true | false | 1 | 8 | 18 | 49 | 24 | 25 | null | null |
brendanhay/gogol | gogol-storage/gen/Network/Google/Storage/Types/Product.hs | mpl-2.0 | -- | A Boolean value to indicate whether payload is wanted. Optional.
cPayload :: Lens' Channel (Maybe Bool)
cPayload = lens _cPayload (\ s a -> s{_cPayload = a}) | 162 | cPayload :: Lens' Channel (Maybe Bool)
cPayload = lens _cPayload (\ s a -> s{_cPayload = a}) | 92 | cPayload = lens _cPayload (\ s a -> s{_cPayload = a}) | 53 | true | true | 0 | 9 | 28 | 46 | 25 | 21 | null | null |
aavogt/DimMat | examples/controlspace.hs | bsd-3-clause | testIsLTI =
(\ a b c d -> case isLTI (1 *~ second) x u y a (colMat b) c (colMat d) of
_ -> do
print $ vsep
[text "A = " </> indent 0 (pretty (zeroes `asTypeOf` a)),
text "B = " </> indent 0 (pretty (zeroes `asTypeOf` b)),
text "C = " </> indent 0 (pretty (zeroes `asTypeOf` c)),
text "D = " </> indent 0 (pretty (zeroes `asTypeOf` d))]
) undefined undefined undefined undefined | 425 | testIsLTI =
(\ a b c d -> case isLTI (1 *~ second) x u y a (colMat b) c (colMat d) of
_ -> do
print $ vsep
[text "A = " </> indent 0 (pretty (zeroes `asTypeOf` a)),
text "B = " </> indent 0 (pretty (zeroes `asTypeOf` b)),
text "C = " </> indent 0 (pretty (zeroes `asTypeOf` c)),
text "D = " </> indent 0 (pretty (zeroes `asTypeOf` d))]
) undefined undefined undefined undefined | 425 | testIsLTI =
(\ a b c d -> case isLTI (1 *~ second) x u y a (colMat b) c (colMat d) of
_ -> do
print $ vsep
[text "A = " </> indent 0 (pretty (zeroes `asTypeOf` a)),
text "B = " </> indent 0 (pretty (zeroes `asTypeOf` b)),
text "C = " </> indent 0 (pretty (zeroes `asTypeOf` c)),
text "D = " </> indent 0 (pretty (zeroes `asTypeOf` d))]
) undefined undefined undefined undefined | 425 | false | false | 0 | 21 | 125 | 205 | 106 | 99 | null | null |
ChristopherKing42/tagsoup | Text/HTML/TagSoup/Type.hs | bsd-3-clause | -- | Extract the string from within 'TagText', crashes if not a 'TagText'
fromTagText :: Show str => Tag str -> str
fromTagText (TagText x) = x | 143 | fromTagText :: Show str => Tag str -> str
fromTagText (TagText x) = x | 69 | fromTagText (TagText x) = x | 27 | true | true | 0 | 10 | 26 | 41 | 18 | 23 | null | null |
farrellm/advent | src/Template.hs | mit | p1 = 0 | 6 | p1 = 0 | 6 | p1 = 0 | 6 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
saclark/wyas | src/Wyas/Eval.hs | mit | eval (List [Atom "quote", val]) = return val | 44 | eval (List [Atom "quote", val]) = return val | 44 | eval (List [Atom "quote", val]) = return val | 44 | false | false | 0 | 9 | 7 | 27 | 13 | 14 | null | null |
urbanslug/ghc | compiler/ghci/ByteCodeAsm.hs | bsd-3-clause | inspectAsm :: DynFlags -> Bool -> Word -> Assembler a -> (Word, LabelEnvMap)
inspectAsm dflags long_jumps initial_offset
= go (InspectState initial_offset 0 0 Map.empty)
where
go s (NullAsm _) = (instrCount s, lblEnv s)
go s (AllocPtr _ k) = go (s { ptrCount = n + 1 }) (k n)
where n = ptrCount s
go s (AllocLit ls k) = go (s { litCount = n + genericLength ls }) (k n)
where n = litCount s
go s (AllocLabel lbl k) = go s' k
where s' = s { lblEnv = Map.insert lbl (instrCount s) (lblEnv s) }
go s (Emit _ ops k) = go s' k
where
s' = s { instrCount = instrCount s + size }
size = sum (map count ops) + 1
largeOps = any (largeOp long_jumps) ops
count (SmallOp _) = 1
count (LabelOp _) = count (Op 0)
count (Op _) = if largeOps then largeArg16s dflags else 1
-- count (LargeOp _) = largeArg16s dflags
-- Bring in all the bci_ bytecode constants.
#include "rts/Bytecodes.h" | 970 | inspectAsm :: DynFlags -> Bool -> Word -> Assembler a -> (Word, LabelEnvMap)
inspectAsm dflags long_jumps initial_offset
= go (InspectState initial_offset 0 0 Map.empty)
where
go s (NullAsm _) = (instrCount s, lblEnv s)
go s (AllocPtr _ k) = go (s { ptrCount = n + 1 }) (k n)
where n = ptrCount s
go s (AllocLit ls k) = go (s { litCount = n + genericLength ls }) (k n)
where n = litCount s
go s (AllocLabel lbl k) = go s' k
where s' = s { lblEnv = Map.insert lbl (instrCount s) (lblEnv s) }
go s (Emit _ ops k) = go s' k
where
s' = s { instrCount = instrCount s + size }
size = sum (map count ops) + 1
largeOps = any (largeOp long_jumps) ops
count (SmallOp _) = 1
count (LabelOp _) = count (Op 0)
count (Op _) = if largeOps then largeArg16s dflags else 1
-- count (LargeOp _) = largeArg16s dflags
-- Bring in all the bci_ bytecode constants.
#include "rts/Bytecodes.h" | 970 | inspectAsm dflags long_jumps initial_offset
= go (InspectState initial_offset 0 0 Map.empty)
where
go s (NullAsm _) = (instrCount s, lblEnv s)
go s (AllocPtr _ k) = go (s { ptrCount = n + 1 }) (k n)
where n = ptrCount s
go s (AllocLit ls k) = go (s { litCount = n + genericLength ls }) (k n)
where n = litCount s
go s (AllocLabel lbl k) = go s' k
where s' = s { lblEnv = Map.insert lbl (instrCount s) (lblEnv s) }
go s (Emit _ ops k) = go s' k
where
s' = s { instrCount = instrCount s + size }
size = sum (map count ops) + 1
largeOps = any (largeOp long_jumps) ops
count (SmallOp _) = 1
count (LabelOp _) = count (Op 0)
count (Op _) = if largeOps then largeArg16s dflags else 1
-- count (LargeOp _) = largeArg16s dflags
-- Bring in all the bci_ bytecode constants.
#include "rts/Bytecodes.h" | 893 | false | true | 0 | 10 | 279 | 418 | 208 | 210 | null | null |
brendanhay/gogol | gogol-gmail/gen/Network/Google/Gmail/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'ImapSettings' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'isEnabled'
--
-- * 'isExpungeBehavior'
--
-- * 'isAutoExpunge'
--
-- * 'isMaxFolderSize'
imapSettings
:: ImapSettings
imapSettings =
ImapSettings'
{ _isEnabled = Nothing
, _isExpungeBehavior = Nothing
, _isAutoExpunge = Nothing
, _isMaxFolderSize = Nothing
} | 457 | imapSettings
:: ImapSettings
imapSettings =
ImapSettings'
{ _isEnabled = Nothing
, _isExpungeBehavior = Nothing
, _isAutoExpunge = Nothing
, _isMaxFolderSize = Nothing
} | 195 | imapSettings =
ImapSettings'
{ _isEnabled = Nothing
, _isExpungeBehavior = Nothing
, _isAutoExpunge = Nothing
, _isMaxFolderSize = Nothing
} | 162 | true | true | 0 | 7 | 94 | 58 | 36 | 22 | null | null |
GaloisInc/galua | galua/src/Galua/MachUtils.hs | mit | newMachineEnv :: AllocRef -> MachConfig -> IO MachineEnv
newMachineEnv aref machConfig =
do let refLoc = RefLoc { refLocCaller = MachSetup
, refLocSite = MachSetup
}
machGlobals <- newTable aref refLoc 0 0
machRegistry <- newTable aref refLoc 0 0
machNextChunkId <- newIORef 0
machMetatablesRef <- newIORef Map.empty
machLuaServer <- atomically newEmptyTMVar
machCServer <- newEmptyMVar
machGarbage <- newIORef []
machStablePtr <- newStablePtr ExternalLuaState
{ extLuaStateLuaServer = machLuaServer
, extLuaStateCServer = machCServer
}
machMainThreadRef <- allocNewThread machStablePtr aref refLoc ThreadRunning
setTableRaw machRegistry (Number 1) (Thread machMainThreadRef)
setTableRaw machRegistry (Number 2) (Table machGlobals)
machNameCache <- newIORef (cacheEmpty 50000)
machCFunInfo <- cfunInfoFun
machJIT <- newIORef Map.empty
return MachineEnv { .. } | 1,063 | newMachineEnv :: AllocRef -> MachConfig -> IO MachineEnv
newMachineEnv aref machConfig =
do let refLoc = RefLoc { refLocCaller = MachSetup
, refLocSite = MachSetup
}
machGlobals <- newTable aref refLoc 0 0
machRegistry <- newTable aref refLoc 0 0
machNextChunkId <- newIORef 0
machMetatablesRef <- newIORef Map.empty
machLuaServer <- atomically newEmptyTMVar
machCServer <- newEmptyMVar
machGarbage <- newIORef []
machStablePtr <- newStablePtr ExternalLuaState
{ extLuaStateLuaServer = machLuaServer
, extLuaStateCServer = machCServer
}
machMainThreadRef <- allocNewThread machStablePtr aref refLoc ThreadRunning
setTableRaw machRegistry (Number 1) (Thread machMainThreadRef)
setTableRaw machRegistry (Number 2) (Table machGlobals)
machNameCache <- newIORef (cacheEmpty 50000)
machCFunInfo <- cfunInfoFun
machJIT <- newIORef Map.empty
return MachineEnv { .. } | 1,063 | newMachineEnv aref machConfig =
do let refLoc = RefLoc { refLocCaller = MachSetup
, refLocSite = MachSetup
}
machGlobals <- newTable aref refLoc 0 0
machRegistry <- newTable aref refLoc 0 0
machNextChunkId <- newIORef 0
machMetatablesRef <- newIORef Map.empty
machLuaServer <- atomically newEmptyTMVar
machCServer <- newEmptyMVar
machGarbage <- newIORef []
machStablePtr <- newStablePtr ExternalLuaState
{ extLuaStateLuaServer = machLuaServer
, extLuaStateCServer = machCServer
}
machMainThreadRef <- allocNewThread machStablePtr aref refLoc ThreadRunning
setTableRaw machRegistry (Number 1) (Thread machMainThreadRef)
setTableRaw machRegistry (Number 2) (Table machGlobals)
machNameCache <- newIORef (cacheEmpty 50000)
machCFunInfo <- cfunInfoFun
machJIT <- newIORef Map.empty
return MachineEnv { .. } | 1,006 | false | true | 0 | 12 | 311 | 268 | 122 | 146 | null | null |
xixi4Den/BSUIR-Haskell-lw1 | src/FCM.hs | mit | hammingDistance :: [Double] -> [Double] -> Double
hammingDistance a b = sum $ zipWith (\ai bi -> abs (ai - bi)) a b | 115 | hammingDistance :: [Double] -> [Double] -> Double
hammingDistance a b = sum $ zipWith (\ai bi -> abs (ai - bi)) a b | 115 | hammingDistance a b = sum $ zipWith (\ai bi -> abs (ai - bi)) a b | 65 | false | true | 0 | 11 | 22 | 65 | 33 | 32 | null | null |
lspitzner/brittany | source/library/Language/Haskell/Brittany/Internal/Utils.hs | agpl-3.0 | traceIfDumpConf
:: (MonadMultiReader Config m, Show a)
=> String
-> (DebugConfig -> Identity (Semigroup.Last Bool))
-> a
-> m ()
traceIfDumpConf s accessor val = do
whenM (mAsk <&> _conf_debug .> accessor .> confUnpack) $ do
trace ("---- " ++ s ++ " ----\n" ++ show val) $ return () | 298 | traceIfDumpConf
:: (MonadMultiReader Config m, Show a)
=> String
-> (DebugConfig -> Identity (Semigroup.Last Bool))
-> a
-> m ()
traceIfDumpConf s accessor val = do
whenM (mAsk <&> _conf_debug .> accessor .> confUnpack) $ do
trace ("---- " ++ s ++ " ----\n" ++ show val) $ return () | 298 | traceIfDumpConf s accessor val = do
whenM (mAsk <&> _conf_debug .> accessor .> confUnpack) $ do
trace ("---- " ++ s ++ " ----\n" ++ show val) $ return () | 159 | false | true | 0 | 16 | 65 | 133 | 63 | 70 | null | null |
oldmanmike/ghc | compiler/utils/Outputable.hs | bsd-3-clause | text s = docToSDoc $ Pretty.text s | 39 | text s = docToSDoc $ Pretty.text s | 39 | text s = docToSDoc $ Pretty.text s | 39 | false | false | 0 | 7 | 11 | 18 | 8 | 10 | null | null |
aelve/sqlite-simple-x | lib/Database/SQLite/Simple/X.hs | bsd-3-clause | notNull :: TableSpec -> TableSpec
notNull = censor (map (<> " NOT NULL")) | 73 | notNull :: TableSpec -> TableSpec
notNull = censor (map (<> " NOT NULL")) | 73 | notNull = censor (map (<> " NOT NULL")) | 39 | false | true | 0 | 8 | 12 | 34 | 16 | 18 | null | null |