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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bmsherman/haskell-vect | Data/Vect2.hs | bsd-3-clause | transpose :: Natural pnat => pnat n -> Vect m (Vect n a) -> Vect n (Vect m a)
transpose n Nil = replicate n Nil | 111 | transpose :: Natural pnat => pnat n -> Vect m (Vect n a) -> Vect n (Vect m a)
transpose n Nil = replicate n Nil | 111 | transpose n Nil = replicate n Nil | 33 | false | true | 0 | 11 | 25 | 69 | 31 | 38 | null | null |
SonOfLilit/purewars | Matrix.hs | bsd-3-clause | toNormal :: Vector2 -> (Vector2, Scalar)
toNormal v@(x, y) = (a, r)
where r = sqrt(x*x + y*y)
a = (1/r) .*: v | 119 | toNormal :: Vector2 -> (Vector2, Scalar)
toNormal v@(x, y) = (a, r)
where r = sqrt(x*x + y*y)
a = (1/r) .*: v | 119 | toNormal v@(x, y) = (a, r)
where r = sqrt(x*x + y*y)
a = (1/r) .*: v | 78 | false | true | 3 | 9 | 32 | 96 | 46 | 50 | null | null |
nevrenato/Hets_Fork | OWL2/Sublogic.hs | gpl-2.0 | slDataRange :: DataRange -> OWLSub
slDataRange rn = case rn of
DataType ur _ -> slDatatype ur
DataComplementOf c -> slDataRange c
DataOneOf _ -> requireNominals slBottom
DataJunction _ drl -> foldl slMax slBottom $ map slDataRange drl | 250 | slDataRange :: DataRange -> OWLSub
slDataRange rn = case rn of
DataType ur _ -> slDatatype ur
DataComplementOf c -> slDataRange c
DataOneOf _ -> requireNominals slBottom
DataJunction _ drl -> foldl slMax slBottom $ map slDataRange drl | 250 | slDataRange rn = case rn of
DataType ur _ -> slDatatype ur
DataComplementOf c -> slDataRange c
DataOneOf _ -> requireNominals slBottom
DataJunction _ drl -> foldl slMax slBottom $ map slDataRange drl | 215 | false | true | 0 | 9 | 53 | 90 | 39 | 51 | null | null |
Peaker/FreeTypeGL | src/Graphics/FreetypeGL/Shaders.hs | bsd-3-clause | commonShader ::
(GL.BlendingFactor, GL.BlendingFactor) -> ByteString ->
IO TextShaderProgram
commonShader blend fragShader =
do
prog <- loadProgram Shaders.textShaderVert fragShader
TextShaderProgram prog blend <$>
traverse (getUniformLocation prog) uniformNames
where
uniformNames =
TextShaderUniforms
{ uniformTexture = "tex"
, uniformMPixel = Just "pixel"
, uniformModel = "model"
, uniformView = "view"
, uniformProjection = "projection"
, uniformMColor = Nothing
} | 617 | commonShader ::
(GL.BlendingFactor, GL.BlendingFactor) -> ByteString ->
IO TextShaderProgram
commonShader blend fragShader =
do
prog <- loadProgram Shaders.textShaderVert fragShader
TextShaderProgram prog blend <$>
traverse (getUniformLocation prog) uniformNames
where
uniformNames =
TextShaderUniforms
{ uniformTexture = "tex"
, uniformMPixel = Just "pixel"
, uniformModel = "model"
, uniformView = "view"
, uniformProjection = "projection"
, uniformMColor = Nothing
} | 617 | commonShader blend fragShader =
do
prog <- loadProgram Shaders.textShaderVert fragShader
TextShaderProgram prog blend <$>
traverse (getUniformLocation prog) uniformNames
where
uniformNames =
TextShaderUniforms
{ uniformTexture = "tex"
, uniformMPixel = Just "pixel"
, uniformModel = "model"
, uniformView = "view"
, uniformProjection = "projection"
, uniformMColor = Nothing
} | 516 | false | true | 0 | 10 | 204 | 122 | 65 | 57 | null | null |
fmapfmapfmap/amazonka | amazonka-ds/gen/Network/AWS/DirectoryService/Types/Product.hs | mpl-2.0 | -- | The alias for the directory.
ddAlias :: Lens' DirectoryDescription (Maybe Text)
ddAlias = lens _ddAlias (\ s a -> s{_ddAlias = a}) | 135 | ddAlias :: Lens' DirectoryDescription (Maybe Text)
ddAlias = lens _ddAlias (\ s a -> s{_ddAlias = a}) | 101 | ddAlias = lens _ddAlias (\ s a -> s{_ddAlias = a}) | 50 | true | true | 1 | 9 | 23 | 51 | 25 | 26 | null | null |
rootzlevel/hledger-add | src/main/Main.hs | bsd-3-clause | parseEnvVariables :: IO (CommonOptions Maybe)
parseEnvVariables = do
maybeFilePath <- lookupEnv "LEDGER_FILE"
return mempty
{ optLedgerFile = maybeFilePath } | 165 | parseEnvVariables :: IO (CommonOptions Maybe)
parseEnvVariables = do
maybeFilePath <- lookupEnv "LEDGER_FILE"
return mempty
{ optLedgerFile = maybeFilePath } | 165 | parseEnvVariables = do
maybeFilePath <- lookupEnv "LEDGER_FILE"
return mempty
{ optLedgerFile = maybeFilePath } | 119 | false | true | 0 | 9 | 26 | 44 | 21 | 23 | null | null |
gitrookie/functionalcode | code/Haskell/sicp/chap1/first.hs | mit | expSquare base power = expSquare base power 1
where expSquare base power a | power == 0 = a
| even power = expSquare (base * base) (power `div` 2) a
| otherwise = expSquare (base) (power-1) (a * base) | 265 | expSquare base power = expSquare base power 1
where expSquare base power a | power == 0 = a
| even power = expSquare (base * base) (power `div` 2) a
| otherwise = expSquare (base) (power-1) (a * base) | 265 | expSquare base power = expSquare base power 1
where expSquare base power a | power == 0 = a
| even power = expSquare (base * base) (power `div` 2) a
| otherwise = expSquare (base) (power-1) (a * base) | 265 | false | false | 0 | 8 | 104 | 110 | 54 | 56 | null | null |
fmapfmapfmap/amazonka | amazonka-codedeploy/test/Test/AWS/Gen/CodeDeploy.hs | mpl-2.0 | testRegisterOnPremisesInstance :: RegisterOnPremisesInstance -> TestTree
testRegisterOnPremisesInstance = req
"RegisterOnPremisesInstance"
"fixture/RegisterOnPremisesInstance.yaml" | 188 | testRegisterOnPremisesInstance :: RegisterOnPremisesInstance -> TestTree
testRegisterOnPremisesInstance = req
"RegisterOnPremisesInstance"
"fixture/RegisterOnPremisesInstance.yaml" | 188 | testRegisterOnPremisesInstance = req
"RegisterOnPremisesInstance"
"fixture/RegisterOnPremisesInstance.yaml" | 115 | false | true | 0 | 7 | 17 | 28 | 11 | 17 | null | null |
Shou/Tombot | Tombot/Funcs.hs | gpl-2.0 | hadify :: Text -> Mind s Text
shadify str = do
let form :: [(B.ByteString, B.ByteString)]
form = [ ("oourl", Text.encodeUtf8 str)
, ("category", "shadify")
]
er <- try $ Wreq.post "http://urlify.io/murl.php" form
flip (either $ \l -> liftIO (print l) >> pure "") er $ \r -> do
let parser = A.string "<a href='" >> A.takeWhile1 (/= '\'')
responseText = Text.decodeUtf8
. BL.toStrict $ r ^. Wreq.responseBody
murl = A.parseOnly parser responseText
either (\_ -> return "") return murl
-- XXX What purpose does this serve now?
-- - Perhaps we can use it for the planned `load' function.
-- | Delete something.
| 731 | shadify :: Text -> Mind s Text
shadify str = do
let form :: [(B.ByteString, B.ByteString)]
form = [ ("oourl", Text.encodeUtf8 str)
, ("category", "shadify")
]
er <- try $ Wreq.post "http://urlify.io/murl.php" form
flip (either $ \l -> liftIO (print l) >> pure "") er $ \r -> do
let parser = A.string "<a href='" >> A.takeWhile1 (/= '\'')
responseText = Text.decodeUtf8
. BL.toStrict $ r ^. Wreq.responseBody
murl = A.parseOnly parser responseText
either (\_ -> return "") return murl
-- XXX What purpose does this serve now?
-- - Perhaps we can use it for the planned `load' function.
-- | Delete something. | 731 | shadify str = do
let form :: [(B.ByteString, B.ByteString)]
form = [ ("oourl", Text.encodeUtf8 str)
, ("category", "shadify")
]
er <- try $ Wreq.post "http://urlify.io/murl.php" form
flip (either $ \l -> liftIO (print l) >> pure "") er $ \r -> do
let parser = A.string "<a href='" >> A.takeWhile1 (/= '\'')
responseText = Text.decodeUtf8
. BL.toStrict $ r ^. Wreq.responseBody
murl = A.parseOnly parser responseText
either (\_ -> return "") return murl
-- XXX What purpose does this serve now?
-- - Perhaps we can use it for the planned `load' function.
-- | Delete something. | 700 | false | true | 0 | 17 | 228 | 222 | 114 | 108 | null | null |
siddhanathan/ghc | compiler/basicTypes/MkId.hs | bsd-3-clause | dataConSrcToImplBang _ _ _ (HsSrcBang _ _ SrcLazy)
= HsLazy | 61 | dataConSrcToImplBang _ _ _ (HsSrcBang _ _ SrcLazy)
= HsLazy | 61 | dataConSrcToImplBang _ _ _ (HsSrcBang _ _ SrcLazy)
= HsLazy | 61 | false | false | 0 | 7 | 11 | 25 | 12 | 13 | null | null |
zaxtax/hakaru | haskell/Language/Hakaru/Parser/Parser.hs | bsd-3-clause | ops, types, names :: [String]
ops = ["+","*","-","^", "**", ":",".", "<~","==", "=", "_", "<|>"] | 98 | ops, types, names :: [String]
ops = ["+","*","-","^", "**", ":",".", "<~","==", "=", "_", "<|>"] | 98 | ops = ["+","*","-","^", "**", ":",".", "<~","==", "=", "_", "<|>"] | 68 | false | true | 0 | 5 | 15 | 54 | 36 | 18 | null | null |
benekastah/ebitor | test/Ebitor/RopeTest.hs | bsd-3-clause | test_remove3 = assertEqual (R.remove "hi there!" 2 1) "hithere!" | 64 | test_remove3 = assertEqual (R.remove "hi there!" 2 1) "hithere!" | 64 | test_remove3 = assertEqual (R.remove "hi there!" 2 1) "hithere!" | 64 | false | false | 0 | 8 | 8 | 23 | 11 | 12 | null | null |
romanb/amazonka | amazonka-opsworks/gen/Network/AWS/OpsWorks/CreateStack.hs | mpl-2.0 | -- | The configuration manager. When you clone a stack we recommend that you use
-- the configuration manager to specify the Chef version, 0.9, 11.4, or 11.10.
-- The default value is currently 11.4.
csConfigurationManager :: Lens' CreateStack (Maybe StackConfigurationManager)
csConfigurationManager =
lens _csConfigurationManager (\s a -> s { _csConfigurationManager = a }) | 379 | csConfigurationManager :: Lens' CreateStack (Maybe StackConfigurationManager)
csConfigurationManager =
lens _csConfigurationManager (\s a -> s { _csConfigurationManager = a }) | 179 | csConfigurationManager =
lens _csConfigurationManager (\s a -> s { _csConfigurationManager = a }) | 101 | true | true | 0 | 9 | 57 | 49 | 27 | 22 | null | null |
csabahruska/GFXDemo | Utils.hs | bsd-3-clause | cube' :: Mesh
cube' = Mesh [("position", pos)] $ TrianglesI idx
where
quads = [[6,2,3,7]
,[5,1,0,4]
,[7,3,1,5]
,[4,0,2,6]
,[3,2,0,1]
,[6,7,5,4]]
mkVertex :: Int -> Vec3
mkVertex n = Vec3 x y z
where
x = if testBit n 2 then 1 else -1
y = if testBit n 1 then 1 else -1
z = if testBit n 0 then 1 else -1
pos = A_Vec3 $ V.fromList [mkVertex i | i <- [0..7]]
idx = V.fromList $ concat [[a,b,c,c,d,a] | [a,b,c,d] <- quads] | 528 | cube' :: Mesh
cube' = Mesh [("position", pos)] $ TrianglesI idx
where
quads = [[6,2,3,7]
,[5,1,0,4]
,[7,3,1,5]
,[4,0,2,6]
,[3,2,0,1]
,[6,7,5,4]]
mkVertex :: Int -> Vec3
mkVertex n = Vec3 x y z
where
x = if testBit n 2 then 1 else -1
y = if testBit n 1 then 1 else -1
z = if testBit n 0 then 1 else -1
pos = A_Vec3 $ V.fromList [mkVertex i | i <- [0..7]]
idx = V.fromList $ concat [[a,b,c,c,d,a] | [a,b,c,d] <- quads] | 528 | cube' = Mesh [("position", pos)] $ TrianglesI idx
where
quads = [[6,2,3,7]
,[5,1,0,4]
,[7,3,1,5]
,[4,0,2,6]
,[3,2,0,1]
,[6,7,5,4]]
mkVertex :: Int -> Vec3
mkVertex n = Vec3 x y z
where
x = if testBit n 2 then 1 else -1
y = if testBit n 1 then 1 else -1
z = if testBit n 0 then 1 else -1
pos = A_Vec3 $ V.fromList [mkVertex i | i <- [0..7]]
idx = V.fromList $ concat [[a,b,c,c,d,a] | [a,b,c,d] <- quads] | 514 | false | true | 0 | 10 | 195 | 302 | 176 | 126 | null | null |
siddhanathan/yi | yi-core/src/Yi/Buffer/Misc.hs | gpl-2.0 | getInsMark :: BufferM Mark
getInsMark = insMark <$> askMarks | 60 | getInsMark :: BufferM Mark
getInsMark = insMark <$> askMarks | 60 | getInsMark = insMark <$> askMarks | 33 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
dylex/range-set | src/Data/RangeSet/IntMap.hs | mit | {- Filter -}
-- | /O(log n)/. The expression (@'split' x set@) is a pair @(set1,set2)@
-- where @set1@ comprises the elements of @set@ less than @x@ and @set2@
-- comprises the elements of @set@ greater than @x@.
split :: Int -> RIntSet -> (RIntSet, RIntSet)
split x s = (l, r) where (l, _, r) = splitMember x s
-- | /O(log n)/. Performs a 'split' but also returns whether the pivot
-- element was found in the original set. | 426 | split :: Int -> RIntSet -> (RIntSet, RIntSet)
split x s = (l, r) where (l, _, r) = splitMember x s
-- | /O(log n)/. Performs a 'split' but also returns whether the pivot
-- element was found in the original set. | 212 | split x s = (l, r) where (l, _, r) = splitMember x s
-- | /O(log n)/. Performs a 'split' but also returns whether the pivot
-- element was found in the original set. | 166 | true | true | 0 | 7 | 82 | 64 | 38 | 26 | null | null |
aurapm/aura | aura/lib/Aura/Install.hs | gpl-3.0 | confirmIgnored :: Set PkgName -> RIO Env (Set PkgName)
confirmIgnored (toList -> ps) = do
ss <- asks settings
S.fromList <$> filterM (liftIO . optionalPrompt ss . confirmIgnored_1) ps
-- | The nested `NonEmpty`s represent the package "hierarchy", namely, what can
-- be built/installed before what. | 303 | confirmIgnored :: Set PkgName -> RIO Env (Set PkgName)
confirmIgnored (toList -> ps) = do
ss <- asks settings
S.fromList <$> filterM (liftIO . optionalPrompt ss . confirmIgnored_1) ps
-- | The nested `NonEmpty`s represent the package "hierarchy", namely, what can
-- be built/installed before what. | 303 | confirmIgnored (toList -> ps) = do
ss <- asks settings
S.fromList <$> filterM (liftIO . optionalPrompt ss . confirmIgnored_1) ps
-- | The nested `NonEmpty`s represent the package "hierarchy", namely, what can
-- be built/installed before what. | 248 | false | true | 0 | 12 | 50 | 79 | 38 | 41 | null | null |
d3sformal/bacon-core | src/System/Expression.hs | mit | isNeg _ = False | 35 | isNeg _ = False | 35 | isNeg _ = False | 35 | false | false | 0 | 4 | 23 | 10 | 4 | 6 | null | null |
dkandalov/katas | haskell/knight-quest/knight.hs | unlicense | in3 :: KnightPos -> [KnightPos]
in3 fromPos = return fromPos >>= moveKnight >>= moveKnight >>= moveKnight | 105 | in3 :: KnightPos -> [KnightPos]
in3 fromPos = return fromPos >>= moveKnight >>= moveKnight >>= moveKnight | 105 | in3 fromPos = return fromPos >>= moveKnight >>= moveKnight >>= moveKnight | 73 | false | true | 0 | 8 | 15 | 40 | 19 | 21 | null | null |
beni55/bloodhound | src/Database/Bloodhound/Types.hs | bsd-3-clause | toTerms :: Text -> AggregationResults -> Maybe (Bucket TermsResult)
toTerms t a = M.lookup t a >>= deserialize
where deserialize = parseMaybe parseJSON | 154 | toTerms :: Text -> AggregationResults -> Maybe (Bucket TermsResult)
toTerms t a = M.lookup t a >>= deserialize
where deserialize = parseMaybe parseJSON | 154 | toTerms t a = M.lookup t a >>= deserialize
where deserialize = parseMaybe parseJSON | 85 | false | true | 0 | 9 | 25 | 55 | 26 | 29 | null | null |
APVaisanen/asteroids | Asteroids.hs | mit | (.*) :: Float -> PointInSpace -> PointInSpace
s .* (u,v) = (s*u,s*v) | 68 | (.*) :: Float -> PointInSpace -> PointInSpace
s .* (u,v) = (s*u,s*v) | 68 | s .* (u,v) = (s*u,s*v) | 22 | false | true | 0 | 9 | 11 | 52 | 27 | 25 | null | null |
jamesdabbs/pi-base-2 | src/Models.hs | bsd-3-clause | true, false :: TValueId
true = toSqlKey 1 | 42 | true, false :: TValueId
true = toSqlKey 1 | 42 | true = toSqlKey 1 | 18 | false | true | 2 | 5 | 8 | 20 | 9 | 11 | null | null |
AaronFriel/eff-experiments | examples/regular.hs | bsd-3-clause | -- Regular style monads encode all of the behavior in their actions and
-- the definitions of the Monad bind operator (>>=), and other operators.
-- /- Type of the state (used with get/put)
-- | /- Return value of the computation
f :: State Int ()
f = do
x <- get
put (x * x)
return ()
-- Here's the trick: "State" is actually just a function, wrapped up in a data type. | 403 | f :: State Int ()
f = do
x <- get
put (x * x)
return ()
-- Here's the trick: "State" is actually just a function, wrapped up in a data type. | 153 | f = do
x <- get
put (x * x)
return ()
-- Here's the trick: "State" is actually just a function, wrapped up in a data type. | 135 | true | true | 1 | 10 | 107 | 55 | 26 | 29 | null | null |
bravit/Idris-dev | src/Idris/Core/Evaluate.hs | bsd-3-clause | convEq' ctxt hs x y = evalStateT (convEq ctxt hs x y) (0, []) | 61 | convEq' ctxt hs x y = evalStateT (convEq ctxt hs x y) (0, []) | 61 | convEq' ctxt hs x y = evalStateT (convEq ctxt hs x y) (0, []) | 61 | false | false | 0 | 7 | 13 | 40 | 20 | 20 | null | null |
chrisjpn/CPIB_ILMCompiler | src/VM/VirtualMachineIO.hs | bsd-3-clause | execInstr (Le Int64VmTy) (pc, fp, Int64VmVal y : Int64VmVal x : stack) =
return2 (pc + 1, fp, IntVmVal (boolToInt (x <= y)) : stack) | 134 | execInstr (Le Int64VmTy) (pc, fp, Int64VmVal y : Int64VmVal x : stack) =
return2 (pc + 1, fp, IntVmVal (boolToInt (x <= y)) : stack) | 134 | execInstr (Le Int64VmTy) (pc, fp, Int64VmVal y : Int64VmVal x : stack) =
return2 (pc + 1, fp, IntVmVal (boolToInt (x <= y)) : stack) | 134 | false | false | 0 | 12 | 26 | 76 | 39 | 37 | null | null |
da-x/fancydiff | src/Fancydiff/Lib.hs | bsd-3-clause | ------------------------------------------------------------------------------------
highlighterToString :: Highlighter -> Text
highlighterToString o = fromMaybe "generic" (Map.lookup o m)
where m = Map.fromList $ map (\(k, (d, _, _)) -> (d, k)) $ Map.toList syntaxMap | 273 | highlighterToString :: Highlighter -> Text
highlighterToString o = fromMaybe "generic" (Map.lookup o m)
where m = Map.fromList $ map (\(k, (d, _, _)) -> (d, k)) $ Map.toList syntaxMap | 187 | highlighterToString o = fromMaybe "generic" (Map.lookup o m)
where m = Map.fromList $ map (\(k, (d, _, _)) -> (d, k)) $ Map.toList syntaxMap | 144 | true | true | 3 | 10 | 34 | 98 | 49 | 49 | null | null |
ghc-android/ghc | testsuite/tests/ghci/should_run/ghcirun004.hs | bsd-3-clause | 2665 = 2664 | 11 | 2665 = 2664 | 11 | 2665 = 2664 | 11 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
roberth/uu-helium | test/benchmarks/Parser.hs | gpl-3.0 | paConstrs
= pgThen2
(\con texprs -> (con, texprs))
paCon
(pgZeroOrMore paAType) | 106 | paConstrs
= pgThen2
(\con texprs -> (con, texprs))
paCon
(pgZeroOrMore paAType) | 106 | paConstrs
= pgThen2
(\con texprs -> (con, texprs))
paCon
(pgZeroOrMore paAType) | 106 | false | false | 1 | 7 | 37 | 41 | 19 | 22 | null | null |
pepijnkokke/unlit | src/Unlit/String.hs | bsd-3-clause | x <+> y = x <> " " <> y | 25 | x <+> y = x <> " " <> y | 25 | x <+> y = x <> " " <> y | 25 | false | false | 0 | 6 | 11 | 20 | 9 | 11 | null | null |
brendanhay/gogol | gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs | mpl-2.0 | -- | The minute of the hour the feed file should be fetched (0-59).
-- Read-only.
dfsMinuteOfHour :: Lens' DatafeedFetchSchedule (Maybe Word32)
dfsMinuteOfHour
= lens _dfsMinuteOfHour
(\ s a -> s{_dfsMinuteOfHour = a})
. mapping _Coerce | 250 | dfsMinuteOfHour :: Lens' DatafeedFetchSchedule (Maybe Word32)
dfsMinuteOfHour
= lens _dfsMinuteOfHour
(\ s a -> s{_dfsMinuteOfHour = a})
. mapping _Coerce | 168 | dfsMinuteOfHour
= lens _dfsMinuteOfHour
(\ s a -> s{_dfsMinuteOfHour = a})
. mapping _Coerce | 106 | true | true | 0 | 10 | 49 | 56 | 29 | 27 | null | null |
rumblesan/haskell-experiments | src/Experiments/Concurrency/SimpleSTM.hs | bsd-3-clause | readHandler :: DataBus -> IO ()
readHandler databus = do
(value, queueLength) <-
atomically $ do
v <- readTBQueue $ queue databus
len <- readTMVar $ counter databus
let newLen = len - 1
_ <- swapTMVar (counter databus) (len - 1)
return (v, newLen)
let logMsg =
"Got a value: " <> show value <> "\nQueue length: " <> show queueLength
atomically $ writeTBQueue (logger databus) logMsg
threadDelay 5000 | 449 | readHandler :: DataBus -> IO ()
readHandler databus = do
(value, queueLength) <-
atomically $ do
v <- readTBQueue $ queue databus
len <- readTMVar $ counter databus
let newLen = len - 1
_ <- swapTMVar (counter databus) (len - 1)
return (v, newLen)
let logMsg =
"Got a value: " <> show value <> "\nQueue length: " <> show queueLength
atomically $ writeTBQueue (logger databus) logMsg
threadDelay 5000 | 449 | readHandler databus = do
(value, queueLength) <-
atomically $ do
v <- readTBQueue $ queue databus
len <- readTMVar $ counter databus
let newLen = len - 1
_ <- swapTMVar (counter databus) (len - 1)
return (v, newLen)
let logMsg =
"Got a value: " <> show value <> "\nQueue length: " <> show queueLength
atomically $ writeTBQueue (logger databus) logMsg
threadDelay 5000 | 417 | false | true | 0 | 15 | 119 | 174 | 79 | 95 | null | null |
haskellbr/missingh | missingh-all/examples/test2.hs | mit | realhandler h = do hLineInteract h h lineInteraction
hClose h | 80 | realhandler h = do hLineInteract h h lineInteraction
hClose h | 80 | realhandler h = do hLineInteract h h lineInteraction
hClose h | 80 | false | false | 0 | 7 | 28 | 25 | 10 | 15 | null | null |
fumieval/jugendstil | src/Jugendstil/Doc/Chart.hs | bsd-3-clause | rescale :: MinMax Float -> [V2 Float] -> [V2 Float]
rescale (MinMax y0 y1) = traverse . _y %~ \y -> (y1 - y) / (y1 - y0) | 120 | rescale :: MinMax Float -> [V2 Float] -> [V2 Float]
rescale (MinMax y0 y1) = traverse . _y %~ \y -> (y1 - y) / (y1 - y0) | 120 | rescale (MinMax y0 y1) = traverse . _y %~ \y -> (y1 - y) / (y1 - y0) | 68 | false | true | 0 | 10 | 27 | 82 | 40 | 42 | null | null |
HIPERFIT/futhark | src/Futhark/Util.hs | isc | -- | Return the list element at the given index, if the index is
-- valid, along with the elements before and after.
focusNth :: Integral int => int -> [a] -> Maybe ([a], a, [a])
focusNth i xs
| (bef, x : aft) <- genericSplitAt i xs = Just (bef, x, aft)
| otherwise = Nothing | 279 | focusNth :: Integral int => int -> [a] -> Maybe ([a], a, [a])
focusNth i xs
| (bef, x : aft) <- genericSplitAt i xs = Just (bef, x, aft)
| otherwise = Nothing | 162 | focusNth i xs
| (bef, x : aft) <- genericSplitAt i xs = Just (bef, x, aft)
| otherwise = Nothing | 100 | true | true | 1 | 10 | 60 | 99 | 53 | 46 | null | null |
tomphp/haskell-tictactoe | src/TicTacToe/Game.hs | mit | setCell :: (MonadError Error m, MonadState State m) => Coordinate -> m ()
setCell coordinate = do
p <- use State.player
b <- use State.board
case Board.setCell p coordinate b of
Right b' -> State.board .= b'
Left e -> throwError $ BoardError e | 260 | setCell :: (MonadError Error m, MonadState State m) => Coordinate -> m ()
setCell coordinate = do
p <- use State.player
b <- use State.board
case Board.setCell p coordinate b of
Right b' -> State.board .= b'
Left e -> throwError $ BoardError e | 260 | setCell coordinate = do
p <- use State.player
b <- use State.board
case Board.setCell p coordinate b of
Right b' -> State.board .= b'
Left e -> throwError $ BoardError e | 186 | false | true | 0 | 11 | 60 | 113 | 52 | 61 | null | null |
swift-nav/plover | src/Language/Plover/CodeGen.hs | mit | compileType' :: Type -> C.Type
compileType' (VecType _ _ ty) = compileVecType ty | 80 | compileType' :: Type -> C.Type
compileType' (VecType _ _ ty) = compileVecType ty | 80 | compileType' (VecType _ _ ty) = compileVecType ty | 49 | false | true | 0 | 9 | 12 | 38 | 17 | 21 | null | null |
fluffynukeit/bindings-cef3 | cefcapi/Main.hs | bsd-3-clause | rtNull1 :: String -> a -> IO (Ptr b)
rtNull1 s _ = printPID s >> return nullPtr | 79 | rtNull1 :: String -> a -> IO (Ptr b)
rtNull1 s _ = printPID s >> return nullPtr | 79 | rtNull1 s _ = printPID s >> return nullPtr | 42 | false | true | 0 | 9 | 17 | 43 | 20 | 23 | null | null |
tjakway/ghcjvm | compiler/types/Type.hs | bsd-3-clause | isForAllTy _ = False | 42 | isForAllTy _ = False | 42 | isForAllTy _ = False | 42 | false | false | 0 | 4 | 25 | 10 | 4 | 6 | null | null |
m3mitsuppe/haskell | exercises/datatype.hs | unlicense | isPalindrome :: (Eq a) => [a] -> Bool
isPalindrome x = x == reverse x | 69 | isPalindrome :: (Eq a) => [a] -> Bool
isPalindrome x = x == reverse x | 69 | isPalindrome x = x == reverse x | 31 | false | true | 0 | 7 | 14 | 37 | 19 | 18 | null | null |
kawu/nerf-proto | src/NLP/Nerf2/Tree.hs | bsd-2-clause | posify (Leaf x i) = LeafP x i | 29 | posify (Leaf x i) = LeafP x i | 29 | posify (Leaf x i) = LeafP x i | 29 | false | false | 0 | 6 | 7 | 23 | 10 | 13 | null | null |
simonjohnthompson/Interaction | InterBasics.hs | mit | shunt (a:x) m = shunt x (a:m) | 29 | shunt (a:x) m = shunt x (a:m) | 29 | shunt (a:x) m = shunt x (a:m) | 29 | false | false | 0 | 7 | 6 | 30 | 15 | 15 | null | null |
codemac/yi-editor | src/Yi/Mode/Interactive.hs | gpl-2.0 | getInputRegion :: BufferM Region
getInputRegion = do mo <- getMarkB (Just "StdOUT")
p <- pointAt botB
q <- getMarkPointB mo
return $ mkRegion p q | 205 | getInputRegion :: BufferM Region
getInputRegion = do mo <- getMarkB (Just "StdOUT")
p <- pointAt botB
q <- getMarkPointB mo
return $ mkRegion p q | 205 | getInputRegion = do mo <- getMarkB (Just "StdOUT")
p <- pointAt botB
q <- getMarkPointB mo
return $ mkRegion p q | 172 | false | true | 0 | 10 | 84 | 62 | 27 | 35 | null | null |
DrNico/rhodium | tools/rhc-strap/Rhodium/Judgement.hs | mit | entails ctx (JUpTerm (UpPi a b)) =
entails ctx { object = a:(object ctx) } (JUpTerm b) | 90 | entails ctx (JUpTerm (UpPi a b)) =
entails ctx { object = a:(object ctx) } (JUpTerm b) | 90 | entails ctx (JUpTerm (UpPi a b)) =
entails ctx { object = a:(object ctx) } (JUpTerm b) | 90 | false | false | 0 | 10 | 20 | 54 | 27 | 27 | null | null |
Zigazou/containers | Data/Sequence.hs | bsd-3-clause | addDigits2 m1 (Two a b) c d (One e) m2 =
appendTree2 m1 (node3 a b c) (node2 d e) m2 | 88 | addDigits2 m1 (Two a b) c d (One e) m2 =
appendTree2 m1 (node3 a b c) (node2 d e) m2 | 88 | addDigits2 m1 (Two a b) c d (One e) m2 =
appendTree2 m1 (node3 a b c) (node2 d e) m2 | 88 | false | false | 0 | 7 | 24 | 60 | 29 | 31 | null | null |
kcharter/brc-solver | tests/AssignmentTests.hs | bsd-2-clause | runAll :: (Bounded a, Enum a, Ord a, Show a) => Gen a -> IO ()
runAll g = mapM_ quickCheck [
forAll (assignment g) prop_findsUniqueSolutions,
forAll (satisfiable g) prop_findsAllSolutions
] | 195 | runAll :: (Bounded a, Enum a, Ord a, Show a) => Gen a -> IO ()
runAll g = mapM_ quickCheck [
forAll (assignment g) prop_findsUniqueSolutions,
forAll (satisfiable g) prop_findsAllSolutions
] | 195 | runAll g = mapM_ quickCheck [
forAll (assignment g) prop_findsUniqueSolutions,
forAll (satisfiable g) prop_findsAllSolutions
] | 132 | false | true | 0 | 9 | 36 | 86 | 42 | 44 | null | null |
a-ford/notghc | Llvm/CodeOutput.hs | bsd-3-clause | outputAsm :: LMString -> LMString -> LlvmType -> [LlvmVar] ->
Bool -> Bool -> IA.InlineAssembly
outputAsm asm constraints rty vars sideeffect alignstack =
IA.InlineAssembly {
IA.type' = llvmTypeToType rty,
IA.assembly = unpackFS asm,
IA.constraints = unpackFS constraints,
IA.hasSideEffects = sideeffect,
IA.alignStack= alignstack,
IA.dialect = IA.ATTDialect
} | 418 | outputAsm :: LMString -> LMString -> LlvmType -> [LlvmVar] ->
Bool -> Bool -> IA.InlineAssembly
outputAsm asm constraints rty vars sideeffect alignstack =
IA.InlineAssembly {
IA.type' = llvmTypeToType rty,
IA.assembly = unpackFS asm,
IA.constraints = unpackFS constraints,
IA.hasSideEffects = sideeffect,
IA.alignStack= alignstack,
IA.dialect = IA.ATTDialect
} | 418 | outputAsm asm constraints rty vars sideeffect alignstack =
IA.InlineAssembly {
IA.type' = llvmTypeToType rty,
IA.assembly = unpackFS asm,
IA.constraints = unpackFS constraints,
IA.hasSideEffects = sideeffect,
IA.alignStack= alignstack,
IA.dialect = IA.ATTDialect
} | 307 | false | true | 0 | 13 | 103 | 125 | 65 | 60 | null | null |
mbakke/ganeti | src/Ganeti/JQScheduler.hs | bsd-2-clause | -- | Logs errors of failed jobs and returns the set of job IDs.
logFailedJobs :: (MonadLog m)
=> [(JobWithStat, GanetiException)] -> m (S.Set JobId)
logFailedJobs [] = return S.empty | 196 | logFailedJobs :: (MonadLog m)
=> [(JobWithStat, GanetiException)] -> m (S.Set JobId)
logFailedJobs [] = return S.empty | 132 | logFailedJobs [] = return S.empty | 33 | true | true | 0 | 10 | 43 | 55 | 29 | 26 | null | null |
ardumont/haskell-platform | hptool/src/Utils.hs | bsd-3-clause | -- | Place one path "under" another. If the second path is absolute, then it
-- is placed as if it were rooted in the first. If the second path is relative
-- then this is the same as (</>)
(</+>) :: FilePath -> FilePath -> FilePath
base </+> rel | isAbsolute rel = base ++ rel
| otherwise = base </> rel | 323 | (</+>) :: FilePath -> FilePath -> FilePath
base </+> rel | isAbsolute rel = base ++ rel
| otherwise = base </> rel | 133 | base </+> rel | isAbsolute rel = base ++ rel
| otherwise = base </> rel | 90 | true | true | 0 | 9 | 81 | 63 | 30 | 33 | null | null |
shoehn/persistent-riak | Test/InterfaceTest.hs | gpl-3.0 | db_host :: [Char]
db_host = "127.0.0.1" | 39 | db_host :: [Char]
db_host = "127.0.0.1" | 39 | db_host = "127.0.0.1" | 21 | false | true | 0 | 7 | 5 | 21 | 9 | 12 | null | null |
HJvT/hdirect | src/Parser.hs | bsd-3-clause | action_564 (176#) = happyShift action_86 | 40 | action_564 (176#) = happyShift action_86 | 40 | action_564 (176#) = happyShift action_86 | 40 | false | false | 0 | 6 | 4 | 15 | 7 | 8 | null | null |
craffit/flexdb | src/DB/Flex/Query/Core.hs | bsd-3-clause | runSubQuery :: Query i l a -> Query i' l' (a, BaseQuery)
runSubQuery q =
do QState a bq <- ST.get
let (r, QState a' bq') = runQueryAlias a q
put (QState a' bq)
return (r, bq') | 192 | runSubQuery :: Query i l a -> Query i' l' (a, BaseQuery)
runSubQuery q =
do QState a bq <- ST.get
let (r, QState a' bq') = runQueryAlias a q
put (QState a' bq)
return (r, bq') | 192 | runSubQuery q =
do QState a bq <- ST.get
let (r, QState a' bq') = runQueryAlias a q
put (QState a' bq)
return (r, bq') | 135 | false | true | 0 | 11 | 53 | 104 | 49 | 55 | null | null |
grtlr/wyas | src/Wyas/Evaluator.hs | bsd-3-clause | unpackNum notNum = throwError $ TypeMismatch "number" notNum | 64 | unpackNum notNum = throwError $ TypeMismatch "number" notNum | 64 | unpackNum notNum = throwError $ TypeMismatch "number" notNum | 64 | false | false | 1 | 6 | 11 | 21 | 8 | 13 | null | null |
DanielSchuessler/logic-TPTP | testing/TestImportExportImportFile.hs | gpl-3.0 | parserInfo :: ParserInfo Options
parserInfo = info (helper <*> optionsParser) $ mconcat
[ fullDesc
] | 104 | parserInfo :: ParserInfo Options
parserInfo = info (helper <*> optionsParser) $ mconcat
[ fullDesc
] | 104 | parserInfo = info (helper <*> optionsParser) $ mconcat
[ fullDesc
] | 71 | false | true | 0 | 8 | 18 | 34 | 17 | 17 | null | null |
haskell-distributed/distributed-process-platform | src/Control/Distributed/Process/Platform/Internal/Queue/SeqQ.hs | bsd-3-clause | dequeue :: SeqQ a -> Maybe (a, SeqQ a)
dequeue s = maybe Nothing (\(s' :> a) -> Just (a, SeqQ s')) $ getR s | 107 | dequeue :: SeqQ a -> Maybe (a, SeqQ a)
dequeue s = maybe Nothing (\(s' :> a) -> Just (a, SeqQ s')) $ getR s | 107 | dequeue s = maybe Nothing (\(s' :> a) -> Just (a, SeqQ s')) $ getR s | 68 | false | true | 0 | 11 | 24 | 72 | 36 | 36 | null | null |
jwtouron/haskell-play | ProjectEuler/Problem3.hs | mit | primes' (x:xs) = x : primes' [x' | x' <- xs, x' `mod` x /= 0] | 61 | primes' (x:xs) = x : primes' [x' | x' <- xs, x' `mod` x /= 0] | 61 | primes' (x:xs) = x : primes' [x' | x' <- xs, x' `mod` x /= 0] | 61 | false | false | 0 | 10 | 15 | 49 | 25 | 24 | null | null |
droundy/franchise | Distribution/Franchise/ConfigureState.hs | bsd-3-clause | silently :: C a -> C a
silently (C j) =
C $ \ts ->
if verbosity ts == Debug
then j ts
else
do ch <- newChan
ch2 <- newChan
let silentthread = do readChan ch
writeChan ch2 ()
silentthread
forkIO silentthread
v <- j $ ts { outputChan = ch, syncChan = ch2 }
case v of
Right (a, ts') -> return $ Right (a, ts' { outputChan = outputChan ts,
syncChan = syncChan ts })
Left x -> return $ Left x | 562 | silently :: C a -> C a
silently (C j) =
C $ \ts ->
if verbosity ts == Debug
then j ts
else
do ch <- newChan
ch2 <- newChan
let silentthread = do readChan ch
writeChan ch2 ()
silentthread
forkIO silentthread
v <- j $ ts { outputChan = ch, syncChan = ch2 }
case v of
Right (a, ts') -> return $ Right (a, ts' { outputChan = outputChan ts,
syncChan = syncChan ts })
Left x -> return $ Left x | 562 | silently (C j) =
C $ \ts ->
if verbosity ts == Debug
then j ts
else
do ch <- newChan
ch2 <- newChan
let silentthread = do readChan ch
writeChan ch2 ()
silentthread
forkIO silentthread
v <- j $ ts { outputChan = ch, syncChan = ch2 }
case v of
Right (a, ts') -> return $ Right (a, ts' { outputChan = outputChan ts,
syncChan = syncChan ts })
Left x -> return $ Left x | 539 | false | true | 2 | 23 | 259 | 208 | 98 | 110 | null | null |
sdiehl/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | enumFrom_RDR, enumFromTo_RDR, enumFromThen_RDR, enumFromThenTo_RDR :: RdrName
enumFrom_RDR = nameRdrName enumFromName | 128 | enumFrom_RDR, enumFromTo_RDR, enumFromThen_RDR, enumFromThenTo_RDR :: RdrName
enumFrom_RDR = nameRdrName enumFromName | 128 | enumFrom_RDR = nameRdrName enumFromName | 50 | false | true | 0 | 5 | 20 | 20 | 13 | 7 | null | null |
louispan/glazier-react | src/Glazier/React/Main.hs | bsd-3-clause | execApp :: (
c ~ AppCmd "Simple"
, Cmd' [] c
, Cmd' IO c
, Cmd (LogLine JSString) c
, Cmd' Reactant c
, MonadUnliftIO m
, AskLogConfigRef m
, AskNextReactIdRef m
, AskDirtyPlans m
) => c -> m ()
execApp = fixVerifyExec (unAppCmd @"Simple") maybeExecApp
where
maybeExecApp executor =
maybeExec (traverse_ @[] executor) -- import Data.Foldable
`orExec` maybeExec ((>>= executor) . liftIO)
`orExec` maybeExec execLogLineJS
`orExec` maybeExec (execReactant executor)
-- | An example of starting an app using the glazier-react framework
-- A different @Obj o@ will be create everytime this function is used | 681 | execApp :: (
c ~ AppCmd "Simple"
, Cmd' [] c
, Cmd' IO c
, Cmd (LogLine JSString) c
, Cmd' Reactant c
, MonadUnliftIO m
, AskLogConfigRef m
, AskNextReactIdRef m
, AskDirtyPlans m
) => c -> m ()
execApp = fixVerifyExec (unAppCmd @"Simple") maybeExecApp
where
maybeExecApp executor =
maybeExec (traverse_ @[] executor) -- import Data.Foldable
`orExec` maybeExec ((>>= executor) . liftIO)
`orExec` maybeExec execLogLineJS
`orExec` maybeExec (execReactant executor)
-- | An example of starting an app using the glazier-react framework
-- A different @Obj o@ will be create everytime this function is used | 681 | execApp = fixVerifyExec (unAppCmd @"Simple") maybeExecApp
where
maybeExecApp executor =
maybeExec (traverse_ @[] executor) -- import Data.Foldable
`orExec` maybeExec ((>>= executor) . liftIO)
`orExec` maybeExec execLogLineJS
`orExec` maybeExec (execReactant executor)
-- | An example of starting an app using the glazier-react framework
-- A different @Obj o@ will be create everytime this function is used | 446 | false | true | 1 | 9 | 176 | 203 | 99 | 104 | null | null |
valderman/selda | selda/src/Database/Selda/SQL/Print.hs | mit | ppCol (InList x xs) = do
x' <- ppCol x
xs' <- mapM ppCol xs
pure $ mconcat [x', " IN (", Text.intercalate ", " xs', ")"] | 126 | ppCol (InList x xs) = do
x' <- ppCol x
xs' <- mapM ppCol xs
pure $ mconcat [x', " IN (", Text.intercalate ", " xs', ")"] | 126 | ppCol (InList x xs) = do
x' <- ppCol x
xs' <- mapM ppCol xs
pure $ mconcat [x', " IN (", Text.intercalate ", " xs', ")"] | 126 | false | false | 0 | 11 | 32 | 69 | 32 | 37 | null | null |
andorp/bead | src/Bead/Controller/Pages.hs | bsd-3-clause | isLogin _ = False | 17 | isLogin _ = False | 17 | isLogin _ = False | 17 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
haskell-opengl/OpenGLRaw | src/Graphics/GL/Functions/F07.hs | bsd-3-clause | -- glEGLImageTargetTexStorageEXT -----------------------------------------------
glEGLImageTargetTexStorageEXT
:: MonadIO m
=> GLenum -- ^ @target@.
-> GLeglImageOES -- ^ @image@.
-> Ptr GLint -- ^ @attrib_list@.
-> m ()
glEGLImageTargetTexStorageEXT v1 v2 v3 = liftIO $ dyn268 ptr_glEGLImageTargetTexStorageEXT v1 v2 v3 | 331 | glEGLImageTargetTexStorageEXT
:: MonadIO m
=> GLenum -- ^ @target@.
-> GLeglImageOES -- ^ @image@.
-> Ptr GLint -- ^ @attrib_list@.
-> m ()
glEGLImageTargetTexStorageEXT v1 v2 v3 = liftIO $ dyn268 ptr_glEGLImageTargetTexStorageEXT v1 v2 v3 | 249 | glEGLImageTargetTexStorageEXT v1 v2 v3 = liftIO $ dyn268 ptr_glEGLImageTargetTexStorageEXT v1 v2 v3 | 99 | true | true | 0 | 11 | 48 | 66 | 32 | 34 | null | null |
ben-schulz/Idris-dev | src/Idris/IdeMode.hs | bsd-3-clause | pSExp = do xs <- between (char '(') (char ')') (pSExp `sepBy` (char ' '))
return (SexpList xs)
<|> atom | 118 | pSExp = do xs <- between (char '(') (char ')') (pSExp `sepBy` (char ' '))
return (SexpList xs)
<|> atom | 118 | pSExp = do xs <- between (char '(') (char ')') (pSExp `sepBy` (char ' '))
return (SexpList xs)
<|> atom | 118 | false | false | 4 | 12 | 34 | 70 | 33 | 37 | null | null |
kadena-io/pact | src/Pact/Repl/Lib.hs | bsd-3-clause | expectThat i as = argsError' i as | 33 | expectThat i as = argsError' i as | 33 | expectThat i as = argsError' i as | 33 | false | false | 0 | 5 | 6 | 16 | 7 | 9 | null | null |
oldmanmike/sdl2 | src/SDL/Raw/Video.hs | bsd-3-clause | setWindowDisplayMode :: MonadIO m => Window -> Ptr DisplayMode -> m CInt
setWindowDisplayMode v1 v2 = liftIO $ setWindowDisplayModeFFI v1 v2 | 140 | setWindowDisplayMode :: MonadIO m => Window -> Ptr DisplayMode -> m CInt
setWindowDisplayMode v1 v2 = liftIO $ setWindowDisplayModeFFI v1 v2 | 140 | setWindowDisplayMode v1 v2 = liftIO $ setWindowDisplayModeFFI v1 v2 | 67 | false | true | 0 | 8 | 20 | 46 | 21 | 25 | null | null |
fmthoma/ghc | compiler/coreSyn/CoreUtils.hs | bsd-3-clause | isDivOp :: PrimOp -> Bool
-- This function probably belongs in PrimOp, or even in
-- an automagically generated file.. but it's such a
-- special case I thought I'd leave it here for now.
isDivOp IntQuotOp = True | 219 | isDivOp :: PrimOp -> Bool
isDivOp IntQuotOp = True | 57 | isDivOp IntQuotOp = True | 31 | true | true | 0 | 7 | 45 | 27 | 13 | 14 | null | null |
GaloisInc/saw-script | src/SAWScript/Prover/MRSolver/Monad.hs | bsd-3-clause | -- | Run an 'MRM' computation and return a result or an error
runMRM :: SharedContext -> Maybe Integer -> Int -> MREnv ->
MRM a -> IO (Either MRFailure a)
runMRM sc timeout debug env m =
do true_tm <- scBool sc True
let init_info = MRInfo { mriSC = sc, mriSMTTimeout = timeout,
mriDebugLevel = debug, mriEnv = env,
mriUVars = [], mriCoIndHyps = Map.empty,
mriAssumptions = true_tm,
mriDataTypeAssumps = HashMap.empty }
let init_st = MRState { mrsVars = Map.empty }
res <- runExceptT $ flip evalStateT init_st $
flip runReaderT init_info $ unMRM m
case res of
Right a -> return $ Right a
Left (MRExnFailure failure) -> return $ Left failure
Left exn -> fail ("runMRM: unexpected internal exception: " ++ show exn)
-- | Throw an 'MRFailure' | 919 | runMRM :: SharedContext -> Maybe Integer -> Int -> MREnv ->
MRM a -> IO (Either MRFailure a)
runMRM sc timeout debug env m =
do true_tm <- scBool sc True
let init_info = MRInfo { mriSC = sc, mriSMTTimeout = timeout,
mriDebugLevel = debug, mriEnv = env,
mriUVars = [], mriCoIndHyps = Map.empty,
mriAssumptions = true_tm,
mriDataTypeAssumps = HashMap.empty }
let init_st = MRState { mrsVars = Map.empty }
res <- runExceptT $ flip evalStateT init_st $
flip runReaderT init_info $ unMRM m
case res of
Right a -> return $ Right a
Left (MRExnFailure failure) -> return $ Left failure
Left exn -> fail ("runMRM: unexpected internal exception: " ++ show exn)
-- | Throw an 'MRFailure' | 857 | runMRM sc timeout debug env m =
do true_tm <- scBool sc True
let init_info = MRInfo { mriSC = sc, mriSMTTimeout = timeout,
mriDebugLevel = debug, mriEnv = env,
mriUVars = [], mriCoIndHyps = Map.empty,
mriAssumptions = true_tm,
mriDataTypeAssumps = HashMap.empty }
let init_st = MRState { mrsVars = Map.empty }
res <- runExceptT $ flip evalStateT init_st $
flip runReaderT init_info $ unMRM m
case res of
Right a -> return $ Right a
Left (MRExnFailure failure) -> return $ Left failure
Left exn -> fail ("runMRM: unexpected internal exception: " ++ show exn)
-- | Throw an 'MRFailure' | 754 | true | true | 0 | 13 | 312 | 256 | 129 | 127 | null | null |
DanielG/kvm-in-a-box | tests/test.hs | agpl-3.0 | withTdirs :: (FilePath -> FilePath -> IO a) -> IO a
withTdirs f = do
withSystemTempDirectory "kib-in" $ \i ->
withSystemTempDirectory "kib-ex" $ \e ->
f i e
where
withSystemTempDirectory = withT | 210 | withTdirs :: (FilePath -> FilePath -> IO a) -> IO a
withTdirs f = do
withSystemTempDirectory "kib-in" $ \i ->
withSystemTempDirectory "kib-ex" $ \e ->
f i e
where
withSystemTempDirectory = withT | 210 | withTdirs f = do
withSystemTempDirectory "kib-in" $ \i ->
withSystemTempDirectory "kib-ex" $ \e ->
f i e
where
withSystemTempDirectory = withT | 158 | false | true | 0 | 11 | 47 | 75 | 36 | 39 | null | null |
corajr/cataskell | src/Cataskell/GameData/Board.hs | bsd-3-clause | -- | A road can be built at the end of another road or a settlement, anywhere there isn't already one
validRoadsFor :: Color -> Board -> Set Construct
validRoadsFor color' board'
= let myPoints = roadsToPointsFor color' board'
enemyPoints' = enemyPoints color' board'
freeEdges' = freeEdges board'
pointsAdjacent e = filter (`Set.member` myPoints) [point1 e, point2 e]
notEnemy ps | length ps == 1 = head ps `Set.notMember` enemyPoints' -- if only one endpoint belongs to me, can't build
| length ps == 2 = True -- if both endpoints belong to me, I can build even though the enemy is there
| otherwise = False
validEdges = Set.filter (notEnemy . pointsAdjacent) freeEdges'
in Set.map (\e -> built (road $ Just (e, color'))) validEdges | 820 | validRoadsFor :: Color -> Board -> Set Construct
validRoadsFor color' board'
= let myPoints = roadsToPointsFor color' board'
enemyPoints' = enemyPoints color' board'
freeEdges' = freeEdges board'
pointsAdjacent e = filter (`Set.member` myPoints) [point1 e, point2 e]
notEnemy ps | length ps == 1 = head ps `Set.notMember` enemyPoints' -- if only one endpoint belongs to me, can't build
| length ps == 2 = True -- if both endpoints belong to me, I can build even though the enemy is there
| otherwise = False
validEdges = Set.filter (notEnemy . pointsAdjacent) freeEdges'
in Set.map (\e -> built (road $ Just (e, color'))) validEdges | 718 | validRoadsFor color' board'
= let myPoints = roadsToPointsFor color' board'
enemyPoints' = enemyPoints color' board'
freeEdges' = freeEdges board'
pointsAdjacent e = filter (`Set.member` myPoints) [point1 e, point2 e]
notEnemy ps | length ps == 1 = head ps `Set.notMember` enemyPoints' -- if only one endpoint belongs to me, can't build
| length ps == 2 = True -- if both endpoints belong to me, I can build even though the enemy is there
| otherwise = False
validEdges = Set.filter (notEnemy . pointsAdjacent) freeEdges'
in Set.map (\e -> built (road $ Just (e, color'))) validEdges | 669 | true | true | 0 | 14 | 210 | 207 | 104 | 103 | null | null |
fmapfmapfmap/amazonka | amazonka-codepipeline/gen/Network/AWS/CodePipeline/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'InputArtifact' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'iaName'
inputArtifact
:: Text -- ^ 'iaName'
-> InputArtifact
inputArtifact pName_ =
InputArtifact'
{ _iaName = pName_
} | 313 | inputArtifact
:: Text -- ^ 'iaName'
-> InputArtifact
inputArtifact pName_ =
InputArtifact'
{ _iaName = pName_
} | 131 | inputArtifact pName_ =
InputArtifact'
{ _iaName = pName_
} | 70 | true | true | 0 | 7 | 70 | 41 | 22 | 19 | null | null |
ssaavedra/liquidhaskell | tests/neg/StateConstraints00.hs | bsd-3-clause | foo :: a -> ST Bool a
foo x = return x | 38 | foo :: a -> ST Bool a
foo x = return x | 38 | foo x = return x | 16 | false | true | 0 | 6 | 11 | 29 | 13 | 16 | null | null |
johnjcamilleri/hpsg | Common.hs | mit | -- | Ordered combinations of sub lists
-- Should think of better name
-- Given [[a,b],[c],[d,e,f]] returns [[a,c,d],[a,c,e],[a,c,f],[b,c,d],[b,c,e],[b,c,f]]
combos :: [[a]] -> [[a]]
combos as =
case as of
[a] -> [ [x] | x <- a ] -- given [[a,b]] returns [[a],[b]]
(a:b:rest) -> foldl fo (go a b) rest
where
-- Given [a,b] [1,2] returns [[a,1],[a,2],[b,1],[b,2]]
go :: [a] -> [a] -> [[a]]
go xs ys = [[x,y] | x<-xs, y<-ys]
-- Given [[a,b],[c,d]] [1,2] returns [[a,b,1],[c,d,1],[a,b,2],[c,d,2]]
fo :: [[a]] -> [a] -> [[a]]
fo xss ys = [ xs++[y] | xs<-xss, y<-ys] | 601 | combos :: [[a]] -> [[a]]
combos as =
case as of
[a] -> [ [x] | x <- a ] -- given [[a,b]] returns [[a],[b]]
(a:b:rest) -> foldl fo (go a b) rest
where
-- Given [a,b] [1,2] returns [[a,1],[a,2],[b,1],[b,2]]
go :: [a] -> [a] -> [[a]]
go xs ys = [[x,y] | x<-xs, y<-ys]
-- Given [[a,b],[c,d]] [1,2] returns [[a,b,1],[c,d,1],[a,b,2],[c,d,2]]
fo :: [[a]] -> [a] -> [[a]]
fo xss ys = [ xs++[y] | xs<-xss, y<-ys] | 440 | combos as =
case as of
[a] -> [ [x] | x <- a ] -- given [[a,b]] returns [[a],[b]]
(a:b:rest) -> foldl fo (go a b) rest
where
-- Given [a,b] [1,2] returns [[a,1],[a,2],[b,1],[b,2]]
go :: [a] -> [a] -> [[a]]
go xs ys = [[x,y] | x<-xs, y<-ys]
-- Given [[a,b],[c,d]] [1,2] returns [[a,b,1],[c,d,1],[a,b,2],[c,d,2]]
fo :: [[a]] -> [a] -> [[a]]
fo xss ys = [ xs++[y] | xs<-xss, y<-ys] | 415 | true | true | 0 | 10 | 135 | 238 | 128 | 110 | null | null |
siegfried/HSMiner | src/Miner.hs | gpl-2.0 | responseResult :: String -> JSON.Result (JSON.JSObject JSON.JSValue)
responseResult body = do
mainObject <- JSON.decode body
JSON.valFromObj "result" mainObject | 168 | responseResult :: String -> JSON.Result (JSON.JSObject JSON.JSValue)
responseResult body = do
mainObject <- JSON.decode body
JSON.valFromObj "result" mainObject | 168 | responseResult body = do
mainObject <- JSON.decode body
JSON.valFromObj "result" mainObject | 99 | false | true | 0 | 9 | 25 | 55 | 25 | 30 | null | null |
Warbo/nix-eval | tests/Main.hs | gpl-3.0 | checkIO' :: Show a => (a -> Expr) -> a -> Maybe String -> Property
checkIO' pre i o = once $ monadicIO $ do
dbg (("expression", pre i),
("expected", o))
result <- run $ eval (pre i)
dbg ("result", result)
assert (result == o) | 242 | checkIO' :: Show a => (a -> Expr) -> a -> Maybe String -> Property
checkIO' pre i o = once $ monadicIO $ do
dbg (("expression", pre i),
("expected", o))
result <- run $ eval (pre i)
dbg ("result", result)
assert (result == o) | 242 | checkIO' pre i o = once $ monadicIO $ do
dbg (("expression", pre i),
("expected", o))
result <- run $ eval (pre i)
dbg ("result", result)
assert (result == o) | 175 | false | true | 2 | 13 | 61 | 134 | 64 | 70 | null | null |
xpika/mohws | src/Network/MoHWS/Part/Listing.hs | bsd-3-clause | htmlResponse :: (Stream.C body) =>
Config.T ext -> URI.URI -> Html.Html -> Response.T body
htmlResponse conf addr body =
Response.makeOk
conf
True
(Header.group [Header.makeContentType "text/html"])
(Response.bodyWithSizeFromString $
Stream.fromString (Config.chunkSize conf) $
Html.renderHtml $
htmlDoc ("Directory listing of " ++ show addr) body) | 399 | htmlResponse :: (Stream.C body) =>
Config.T ext -> URI.URI -> Html.Html -> Response.T body
htmlResponse conf addr body =
Response.makeOk
conf
True
(Header.group [Header.makeContentType "text/html"])
(Response.bodyWithSizeFromString $
Stream.fromString (Config.chunkSize conf) $
Html.renderHtml $
htmlDoc ("Directory listing of " ++ show addr) body) | 399 | htmlResponse conf addr body =
Response.makeOk
conf
True
(Header.group [Header.makeContentType "text/html"])
(Response.bodyWithSizeFromString $
Stream.fromString (Config.chunkSize conf) $
Html.renderHtml $
htmlDoc ("Directory listing of " ++ show addr) body) | 305 | false | true | 0 | 12 | 92 | 132 | 63 | 69 | null | null |
oldmanmike/ghc | compiler/nativeGen/X86/CodeGen.hs | bsd-3-clause | anyReg (Fixed rep reg fcode) = return (\dst -> fcode `snocOL` reg2reg rep reg dst) | 82 | anyReg (Fixed rep reg fcode) = return (\dst -> fcode `snocOL` reg2reg rep reg dst) | 82 | anyReg (Fixed rep reg fcode) = return (\dst -> fcode `snocOL` reg2reg rep reg dst) | 82 | false | false | 0 | 9 | 14 | 44 | 22 | 22 | null | null |
mcschroeder/smc | Main.hs | mit | ------------------------------------------------------------------------------
main :: IO ()
main = do
args <- getArgs
let file = args !! 0
sys = if length args > 1
then read (args !! 1)
else McMillan
printf "Interpolation system: %s\n" (show sys)
parseAiger file >>= \case
Left err -> print err
Right aag -> do
checkAiger aag sys >>= \case
Fixpoint -> putStrLn $ "OK"
Counterexample k -> putStrLn $ "FAIL @ k=" ++ (show k)
------------------------------------------------------------------------------ | 629 | main :: IO ()
main = do
args <- getArgs
let file = args !! 0
sys = if length args > 1
then read (args !! 1)
else McMillan
printf "Interpolation system: %s\n" (show sys)
parseAiger file >>= \case
Left err -> print err
Right aag -> do
checkAiger aag sys >>= \case
Fixpoint -> putStrLn $ "OK"
Counterexample k -> putStrLn $ "FAIL @ k=" ++ (show k)
------------------------------------------------------------------------------ | 549 | main = do
args <- getArgs
let file = args !! 0
sys = if length args > 1
then read (args !! 1)
else McMillan
printf "Interpolation system: %s\n" (show sys)
parseAiger file >>= \case
Left err -> print err
Right aag -> do
checkAiger aag sys >>= \case
Fixpoint -> putStrLn $ "OK"
Counterexample k -> putStrLn $ "FAIL @ k=" ++ (show k)
------------------------------------------------------------------------------ | 535 | true | true | 0 | 20 | 198 | 168 | 78 | 90 | null | null |
mchakravarty/hoas-conv | Convert.hs | bsd-3-clause | prjIdx ctxt n (PushLayout l _) = prjIdx ctxt (n - 1) l | 55 | prjIdx ctxt n (PushLayout l _) = prjIdx ctxt (n - 1) l | 55 | prjIdx ctxt n (PushLayout l _) = prjIdx ctxt (n - 1) l | 55 | false | false | 0 | 7 | 13 | 35 | 17 | 18 | null | null |
keera-studios/pang-a-lambda | src/Game/Levels.hs | gpl-3.0 | objBlocks 13 = [ staticBlock "block1" (100, 200) (100, 57)
, staticBlock "block2" (200, 200) (100, 57)
, staticBlock "block3" (300, 200) (100, 57)
, staticBlock "block4" (gameWidth - 100, 200) (100, 57)
, staticBlock "block5" (gameWidth - 200, 200) (100, 57)
, staticBlock "block6" (gameWidth - 300, 200) (100, 57)
] | 444 | objBlocks 13 = [ staticBlock "block1" (100, 200) (100, 57)
, staticBlock "block2" (200, 200) (100, 57)
, staticBlock "block3" (300, 200) (100, 57)
, staticBlock "block4" (gameWidth - 100, 200) (100, 57)
, staticBlock "block5" (gameWidth - 200, 200) (100, 57)
, staticBlock "block6" (gameWidth - 300, 200) (100, 57)
] | 444 | objBlocks 13 = [ staticBlock "block1" (100, 200) (100, 57)
, staticBlock "block2" (200, 200) (100, 57)
, staticBlock "block3" (300, 200) (100, 57)
, staticBlock "block4" (gameWidth - 100, 200) (100, 57)
, staticBlock "block5" (gameWidth - 200, 200) (100, 57)
, staticBlock "block6" (gameWidth - 300, 200) (100, 57)
] | 444 | false | false | 1 | 9 | 179 | 157 | 88 | 69 | null | null |
snoyberg/ghc | compiler/cmm/CmmUtils.hs | bsd-3-clause | primRepCmmType dflags WordRep = bWord dflags | 53 | primRepCmmType dflags WordRep = bWord dflags | 53 | primRepCmmType dflags WordRep = bWord dflags | 53 | false | false | 0 | 5 | 14 | 14 | 6 | 8 | null | null |
silky/DanceView | src/DiagramsStuff.hs | bsd-3-clause | frameInfo :: _
=> Options
-> Frame Person
-> V2 Double
-> QDiagram b V2 Double Any
frameInfo opts frame reasonableOrigin = mconcat [info, names]
where
peeps = getField @"people" frame
names = mconcat (map namedXy peeps)
-- If the keypoint we're going to draw the text at has no confidence,
-- then don't bother to draw a label at all.
nameKeyPoint p = neck (toSkeleton p)
namedXy p = if getField @"score" (nameKeyPoint p) == 0
then mempty
else namedXy' p
namedXy' p@Person {..} = (text (show name)
# fc black
# fontSizeL 60
)
# translate (r2 (xy opts (nameKeyPoint p)))
# translate reasonableOrigin
frameDeets = "#" ++ show (frameNumber frame) ++ ", " ++ show (length peeps) ++ " people."
info = baselineText frameDeets
# fc red
# fontSizeL 50
# translate reasonableOrigin | 1,183 | frameInfo :: _
=> Options
-> Frame Person
-> V2 Double
-> QDiagram b V2 Double Any
frameInfo opts frame reasonableOrigin = mconcat [info, names]
where
peeps = getField @"people" frame
names = mconcat (map namedXy peeps)
-- If the keypoint we're going to draw the text at has no confidence,
-- then don't bother to draw a label at all.
nameKeyPoint p = neck (toSkeleton p)
namedXy p = if getField @"score" (nameKeyPoint p) == 0
then mempty
else namedXy' p
namedXy' p@Person {..} = (text (show name)
# fc black
# fontSizeL 60
)
# translate (r2 (xy opts (nameKeyPoint p)))
# translate reasonableOrigin
frameDeets = "#" ++ show (frameNumber frame) ++ ", " ++ show (length peeps) ++ " people."
info = baselineText frameDeets
# fc red
# fontSizeL 50
# translate reasonableOrigin | 1,183 | frameInfo opts frame reasonableOrigin = mconcat [info, names]
where
peeps = getField @"people" frame
names = mconcat (map namedXy peeps)
-- If the keypoint we're going to draw the text at has no confidence,
-- then don't bother to draw a label at all.
nameKeyPoint p = neck (toSkeleton p)
namedXy p = if getField @"score" (nameKeyPoint p) == 0
then mempty
else namedXy' p
namedXy' p@Person {..} = (text (show name)
# fc black
# fontSizeL 60
)
# translate (r2 (xy opts (nameKeyPoint p)))
# translate reasonableOrigin
frameDeets = "#" ++ show (frameNumber frame) ++ ", " ++ show (length peeps) ++ " people."
info = baselineText frameDeets
# fc red
# fontSizeL 50
# translate reasonableOrigin | 1,060 | false | true | 0 | 13 | 546 | 290 | 140 | 150 | null | null |
ipuustin/propositional-planning | tests/Test-main.hs | bsd-3-clause | iscnf (Biconditional a b) = False | 33 | iscnf (Biconditional a b) = False | 33 | iscnf (Biconditional a b) = False | 33 | false | false | 0 | 7 | 5 | 17 | 8 | 9 | null | null |
mzero/plush | src/Plush/Run/BuiltIns/Text.hs | apache-2.0 | trExpand ('\\':'t':cs) = '\t' : trExpand cs | 43 | trExpand ('\\':'t':cs) = '\t' : trExpand cs | 43 | trExpand ('\\':'t':cs) = '\t' : trExpand cs | 43 | false | false | 0 | 7 | 6 | 23 | 11 | 12 | null | null |
kim/amazonka | amazonka-directconnect/gen/Network/AWS/DirectConnect/CreatePublicVirtualInterface.hs | mpl-2.0 | cpviConnectionId :: Lens' CreatePublicVirtualInterface Text
cpviConnectionId = lens _cpviConnectionId (\s a -> s { _cpviConnectionId = a }) | 139 | cpviConnectionId :: Lens' CreatePublicVirtualInterface Text
cpviConnectionId = lens _cpviConnectionId (\s a -> s { _cpviConnectionId = a }) | 139 | cpviConnectionId = lens _cpviConnectionId (\s a -> s { _cpviConnectionId = a }) | 79 | false | true | 0 | 9 | 17 | 39 | 21 | 18 | null | null |
etu-fkti5301-bgu/alt-exam_automated_theorem_proving | src/Expressions/Expressions.hs | bsd-3-clause | simplify' (Mul (Const 0) x) = Const 0 | 37 | simplify' (Mul (Const 0) x) = Const 0 | 37 | simplify' (Mul (Const 0) x) = Const 0 | 37 | false | false | 0 | 8 | 7 | 27 | 12 | 15 | null | null |
spechub/Hets | Syntax/ToXml.hs | gpl-2.0 | ghiding :: GlobalAnnos -> G_hiding -> Element
ghiding ga gm = case gm of
G_symb_list l -> unode "Hiding" $ gSymbItemList ga l
G_logic_projection lc -> add_attrs (logicCode lc)
$ unode "Logicprojection" () | 212 | ghiding :: GlobalAnnos -> G_hiding -> Element
ghiding ga gm = case gm of
G_symb_list l -> unode "Hiding" $ gSymbItemList ga l
G_logic_projection lc -> add_attrs (logicCode lc)
$ unode "Logicprojection" () | 212 | ghiding ga gm = case gm of
G_symb_list l -> unode "Hiding" $ gSymbItemList ga l
G_logic_projection lc -> add_attrs (logicCode lc)
$ unode "Logicprojection" () | 166 | false | true | 4 | 6 | 40 | 52 | 30 | 22 | null | null |
swamp-agr/carbuyer-advisor | fay/FFIExample.hs | mit | rmAttr :: Element -> Text -> Fay ()
rmAttr = ffi "%1.removeAttribute(%2)" | 73 | rmAttr :: Element -> Text -> Fay ()
rmAttr = ffi "%1.removeAttribute(%2)" | 73 | rmAttr = ffi "%1.removeAttribute(%2)" | 37 | false | true | 0 | 8 | 11 | 27 | 13 | 14 | null | null |
izgzhen/logix | Logix/Unwrap.hs | mit | makeInitial (s:ss) assump = if unStep s == assump then makeInitial2 assump ss
else insertStep s $ makeInitial ss assump | 123 | makeInitial (s:ss) assump = if unStep s == assump then makeInitial2 assump ss
else insertStep s $ makeInitial ss assump | 123 | makeInitial (s:ss) assump = if unStep s == assump then makeInitial2 assump ss
else insertStep s $ makeInitial ss assump | 123 | false | false | 0 | 7 | 23 | 50 | 24 | 26 | null | null |
glaebhoerl/type-eq | Type/Eq.hs | bsd-3-clause | (|>) = cast | 11 | (|>) = cast | 11 | (|>) = cast | 11 | false | false | 1 | 5 | 2 | 12 | 5 | 7 | null | null |
fibsifan/pandoc | src/Text/Pandoc/Readers/Docx/Parse.hs | gpl-2.0 | elemToRunStyle _ _ _ = defaultRunStyle | 38 | elemToRunStyle _ _ _ = defaultRunStyle | 38 | elemToRunStyle _ _ _ = defaultRunStyle | 38 | false | false | 0 | 5 | 5 | 13 | 6 | 7 | null | null |
IgorRodic/fp16-Pongout | src/Main.hs | mit | bricksBounce :: PongoutGame -> PongoutGame
bricksBounce game = game { ball1Vel = (vx1', vy1'),
ball2Vel = (vx2', vy2'),
bricksArray = bricksArray'',
player1Points = oldPlayer1Points + newPlayer1Ponts,
player2Points = oldPlayer2Points + newPlayer2Ponts }
where
(oldPlayer1Points, oldPlayer2Points) = ((player1Points game), (player2Points game))
collisions1 = map (\b -> getCollisionType (detectCollision (ball1 game) b)) (createBricksObjects (bricksArray game))
collisionsTypes1 = filter (\c -> c /= NoCollision ) collisions1
typeCollision1 = if (collisionsTypes1 /= []) then (head collisionsTypes1) else NoCollision
collisions2 = map (\b -> getCollisionType (detectCollision (ball2 game) b)) (createBricksObjects (bricksArray game))
collisionsTypes2 = filter (\c -> c /= NoCollision ) collisions2
typeCollision2 = if (collisionsTypes2 /= []) then (head collisionsTypes2) else NoCollision
vx1' = if typeCollision1 == LeftCollision ||
typeCollision1 == RightCollision
then -(fst $ ball1Vel game) else (fst $ ball1Vel game)
vy1' = if typeCollision1 == TopCollision ||
typeCollision1 == BottomCollision
then -(snd $ ball1Vel game) else (snd $ ball1Vel game)
vx2' = if typeCollision2 == LeftCollision ||
typeCollision2 == RightCollision
then -(fst $ ball2Vel game) else (fst $ ball2Vel game)
vy2' = if typeCollision2 == TopCollision ||
typeCollision2 == BottomCollision
then -(snd $ ball2Vel game) else (snd $ ball2Vel game)
-- Izracunavanje poena.
newPlayer1Ponts = if typeCollision1 /= NoCollision
then 40
else 0
newPlayer2Ponts = if typeCollision2 /= NoCollision
then 40
else 0
bricksArray' = changeBrickArray (bricksArray game) (ball1 game)
bricksArray'' = changeBrickArray bricksArray' (ball2 game) | 2,079 | bricksBounce :: PongoutGame -> PongoutGame
bricksBounce game = game { ball1Vel = (vx1', vy1'),
ball2Vel = (vx2', vy2'),
bricksArray = bricksArray'',
player1Points = oldPlayer1Points + newPlayer1Ponts,
player2Points = oldPlayer2Points + newPlayer2Ponts }
where
(oldPlayer1Points, oldPlayer2Points) = ((player1Points game), (player2Points game))
collisions1 = map (\b -> getCollisionType (detectCollision (ball1 game) b)) (createBricksObjects (bricksArray game))
collisionsTypes1 = filter (\c -> c /= NoCollision ) collisions1
typeCollision1 = if (collisionsTypes1 /= []) then (head collisionsTypes1) else NoCollision
collisions2 = map (\b -> getCollisionType (detectCollision (ball2 game) b)) (createBricksObjects (bricksArray game))
collisionsTypes2 = filter (\c -> c /= NoCollision ) collisions2
typeCollision2 = if (collisionsTypes2 /= []) then (head collisionsTypes2) else NoCollision
vx1' = if typeCollision1 == LeftCollision ||
typeCollision1 == RightCollision
then -(fst $ ball1Vel game) else (fst $ ball1Vel game)
vy1' = if typeCollision1 == TopCollision ||
typeCollision1 == BottomCollision
then -(snd $ ball1Vel game) else (snd $ ball1Vel game)
vx2' = if typeCollision2 == LeftCollision ||
typeCollision2 == RightCollision
then -(fst $ ball2Vel game) else (fst $ ball2Vel game)
vy2' = if typeCollision2 == TopCollision ||
typeCollision2 == BottomCollision
then -(snd $ ball2Vel game) else (snd $ ball2Vel game)
-- Izracunavanje poena.
newPlayer1Ponts = if typeCollision1 /= NoCollision
then 40
else 0
newPlayer2Ponts = if typeCollision2 /= NoCollision
then 40
else 0
bricksArray' = changeBrickArray (bricksArray game) (ball1 game)
bricksArray'' = changeBrickArray bricksArray' (ball2 game) | 2,079 | bricksBounce game = game { ball1Vel = (vx1', vy1'),
ball2Vel = (vx2', vy2'),
bricksArray = bricksArray'',
player1Points = oldPlayer1Points + newPlayer1Ponts,
player2Points = oldPlayer2Points + newPlayer2Ponts }
where
(oldPlayer1Points, oldPlayer2Points) = ((player1Points game), (player2Points game))
collisions1 = map (\b -> getCollisionType (detectCollision (ball1 game) b)) (createBricksObjects (bricksArray game))
collisionsTypes1 = filter (\c -> c /= NoCollision ) collisions1
typeCollision1 = if (collisionsTypes1 /= []) then (head collisionsTypes1) else NoCollision
collisions2 = map (\b -> getCollisionType (detectCollision (ball2 game) b)) (createBricksObjects (bricksArray game))
collisionsTypes2 = filter (\c -> c /= NoCollision ) collisions2
typeCollision2 = if (collisionsTypes2 /= []) then (head collisionsTypes2) else NoCollision
vx1' = if typeCollision1 == LeftCollision ||
typeCollision1 == RightCollision
then -(fst $ ball1Vel game) else (fst $ ball1Vel game)
vy1' = if typeCollision1 == TopCollision ||
typeCollision1 == BottomCollision
then -(snd $ ball1Vel game) else (snd $ ball1Vel game)
vx2' = if typeCollision2 == LeftCollision ||
typeCollision2 == RightCollision
then -(fst $ ball2Vel game) else (fst $ ball2Vel game)
vy2' = if typeCollision2 == TopCollision ||
typeCollision2 == BottomCollision
then -(snd $ ball2Vel game) else (snd $ ball2Vel game)
-- Izracunavanje poena.
newPlayer1Ponts = if typeCollision1 /= NoCollision
then 40
else 0
newPlayer2Ponts = if typeCollision2 /= NoCollision
then 40
else 0
bricksArray' = changeBrickArray (bricksArray game) (ball1 game)
bricksArray'' = changeBrickArray bricksArray' (ball2 game) | 2,036 | false | true | 4 | 12 | 604 | 573 | 305 | 268 | null | null |
neobrain/neobot | app/bot.hs | bsd-3-clause | handleIRCChannelMessage context (IRCMessage _ "!love") = sendMessage context "Haskell is love. Haskell is life." | 115 | handleIRCChannelMessage context (IRCMessage _ "!love") = sendMessage context "Haskell is love. Haskell is life." | 115 | handleIRCChannelMessage context (IRCMessage _ "!love") = sendMessage context "Haskell is love. Haskell is life." | 115 | false | false | 0 | 7 | 16 | 25 | 11 | 14 | null | null |
henrytill/hecate | src/Hecate/Parser.hs | apache-2.0 | addP :: Parser Command
addP = Add <$> descArgP
<*> optional idenOptP
<*> optional metaOptP | 112 | addP :: Parser Command
addP = Add <$> descArgP
<*> optional idenOptP
<*> optional metaOptP | 112 | addP = Add <$> descArgP
<*> optional idenOptP
<*> optional metaOptP | 89 | false | true | 0 | 7 | 36 | 32 | 15 | 17 | null | null |
ganeti-github-testing/ganeti-test-1 | src/Ganeti/Utils.hs | bsd-2-clause | exitWhen False _ = return () | 29 | exitWhen False _ = return () | 29 | exitWhen False _ = return () | 29 | false | false | 0 | 6 | 6 | 16 | 7 | 9 | null | null |
fmapfmapfmap/amazonka | amazonka-iam/gen/Network/AWS/IAM/ListRoles.hs | mpl-2.0 | -- | The response status code.
lrrsResponseStatus :: Lens' ListRolesResponse Int
lrrsResponseStatus = lens _lrrsResponseStatus (\ s a -> s{_lrrsResponseStatus = a}) | 164 | lrrsResponseStatus :: Lens' ListRolesResponse Int
lrrsResponseStatus = lens _lrrsResponseStatus (\ s a -> s{_lrrsResponseStatus = a}) | 133 | lrrsResponseStatus = lens _lrrsResponseStatus (\ s a -> s{_lrrsResponseStatus = a}) | 83 | true | true | 0 | 9 | 21 | 40 | 22 | 18 | null | null |
cloudhead/cryptocurrency | src/Crypto/Blockchain/Block.hs | bsd-3-clause | block :: [a] -> Either Error (Block a)
block xs = validate $
Block
BlockHeader
{ blockPreviousHash = zeroHash
, blockDifficulty = undefined
, blockTimestamp = undefined
, blockRootHash = undefined
, blockNonce = undefined
}
(Seq.fromList xs) | 349 | block :: [a] -> Either Error (Block a)
block xs = validate $
Block
BlockHeader
{ blockPreviousHash = zeroHash
, blockDifficulty = undefined
, blockTimestamp = undefined
, blockRootHash = undefined
, blockNonce = undefined
}
(Seq.fromList xs) | 349 | block xs = validate $
Block
BlockHeader
{ blockPreviousHash = zeroHash
, blockDifficulty = undefined
, blockTimestamp = undefined
, blockRootHash = undefined
, blockNonce = undefined
}
(Seq.fromList xs) | 310 | false | true | 0 | 8 | 145 | 86 | 46 | 40 | null | null |
siddhanathan/ghc | compiler/deSugar/Coverage.hs | bsd-3-clause | addTickHsExpr (HsMultiIf ty alts)
= do { let isOneOfMany = case alts of [_] -> False; _ -> True
; alts' <- mapM (liftL $ addTickGRHS isOneOfMany False) alts
; return $ HsMultiIf ty alts' } | 204 | addTickHsExpr (HsMultiIf ty alts)
= do { let isOneOfMany = case alts of [_] -> False; _ -> True
; alts' <- mapM (liftL $ addTickGRHS isOneOfMany False) alts
; return $ HsMultiIf ty alts' } | 204 | addTickHsExpr (HsMultiIf ty alts)
= do { let isOneOfMany = case alts of [_] -> False; _ -> True
; alts' <- mapM (liftL $ addTickGRHS isOneOfMany False) alts
; return $ HsMultiIf ty alts' } | 204 | false | false | 0 | 13 | 51 | 86 | 43 | 43 | null | null |
hanshoglund/reenact | src/Control/Reactive/Util.hs | bsd-3-clause | apIndexed :: (Int -> a -> b) -> [a] -> [b]
mapIndexed f as = map (uncurry f) (zip is as)
where
n = length as - 1
is = [0..n]
| 146 | mapIndexed :: (Int -> a -> b) -> [a] -> [b]
mapIndexed f as = map (uncurry f) (zip is as)
where
n = length as - 1
is = [0..n] | 146 | mapIndexed f as = map (uncurry f) (zip is as)
where
n = length as - 1
is = [0..n] | 102 | false | true | 0 | 8 | 52 | 88 | 45 | 43 | null | null |
frantisekfarka/ghc-dsi | compiler/main/GhcMake.hs | bsd-3-clause | preprocessFile :: HscEnv
-> FilePath
-> Maybe Phase -- ^ Starting phase
-> Maybe (StringBuffer,UTCTime)
-> IO (DynFlags, FilePath, StringBuffer)
preprocessFile hsc_env src_fn mb_phase Nothing
= do
(dflags', hspp_fn) <- preprocess hsc_env (src_fn, mb_phase)
buf <- hGetStringBuffer hspp_fn
return (dflags', hspp_fn, buf) | 405 | preprocessFile :: HscEnv
-> FilePath
-> Maybe Phase -- ^ Starting phase
-> Maybe (StringBuffer,UTCTime)
-> IO (DynFlags, FilePath, StringBuffer)
preprocessFile hsc_env src_fn mb_phase Nothing
= do
(dflags', hspp_fn) <- preprocess hsc_env (src_fn, mb_phase)
buf <- hGetStringBuffer hspp_fn
return (dflags', hspp_fn, buf) | 405 | preprocessFile hsc_env src_fn mb_phase Nothing
= do
(dflags', hspp_fn) <- preprocess hsc_env (src_fn, mb_phase)
buf <- hGetStringBuffer hspp_fn
return (dflags', hspp_fn, buf) | 200 | false | true | 0 | 10 | 127 | 110 | 57 | 53 | null | null |
eelcoh/cryptochallenge | src/Challenges/Set1.hs | bsd-3-clause | challenge5 :: [Char] -> [Char] -> [Char]
challenge5 stringToCipher key =
cycleKey (stringToByteString stringToCipher) (stringToByteString key)
|> byteStringToHexString | 171 | challenge5 :: [Char] -> [Char] -> [Char]
challenge5 stringToCipher key =
cycleKey (stringToByteString stringToCipher) (stringToByteString key)
|> byteStringToHexString | 171 | challenge5 stringToCipher key =
cycleKey (stringToByteString stringToCipher) (stringToByteString key)
|> byteStringToHexString | 130 | false | true | 1 | 7 | 21 | 58 | 29 | 29 | null | null |
termite2/tsl | Frontend/NS.hs | bsd-3-clause | objType (ObjProcess _ _) = error $ "requesting objType of ObjProcess" | 72 | objType (ObjProcess _ _) = error $ "requesting objType of ObjProcess" | 72 | objType (ObjProcess _ _) = error $ "requesting objType of ObjProcess" | 72 | false | false | 0 | 6 | 13 | 22 | 10 | 12 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.