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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
JPMoresmau/leksah-server | src/IDE/Core/CTypes.hs | gpl-2.0 | -- Starts with non-alpha
isOperator _ = False | 54 | isOperator _ = False | 29 | isOperator _ = False | 29 | true | false | 0 | 5 | 16 | 10 | 5 | 5 | null | null |
warreee/Algorithm-Implementations | FizzBuzz/Haskell/FizzBuzzTest.hs | mit | main = do
putStrLn "Test for FizzBuzz: "
let result = fizzbuzzTest
putStrLn $ "Test: " ++ (succesornot result)
where succesornot = (\x -> if x then "Succeeded!" else "Failed") | 192 | main = do
putStrLn "Test for FizzBuzz: "
let result = fizzbuzzTest
putStrLn $ "Test: " ++ (succesornot result)
where succesornot = (\x -> if x then "Succeeded!" else "Failed") | 192 | main = do
putStrLn "Test for FizzBuzz: "
let result = fizzbuzzTest
putStrLn $ "Test: " ++ (succesornot result)
where succesornot = (\x -> if x then "Succeeded!" else "Failed") | 192 | false | false | 2 | 9 | 46 | 68 | 31 | 37 | null | null |
danstiner/clod | src/Command/Dupes/Add.hs | mit | storeFree :: ProcessT StoreOp (MergedOperation (PathKey, BucketKey)) ()
storeFree = repeatedly $ do
v <- await
lift $ case v of
LeftOnly (p, b) -> putOp p b
RightOnly (p, _) -> rmOp p
Both _ -> return () | 220 | storeFree :: ProcessT StoreOp (MergedOperation (PathKey, BucketKey)) ()
storeFree = repeatedly $ do
v <- await
lift $ case v of
LeftOnly (p, b) -> putOp p b
RightOnly (p, _) -> rmOp p
Both _ -> return () | 220 | storeFree = repeatedly $ do
v <- await
lift $ case v of
LeftOnly (p, b) -> putOp p b
RightOnly (p, _) -> rmOp p
Both _ -> return () | 148 | false | true | 0 | 13 | 55 | 106 | 52 | 54 | null | null |
JoeyEremondi/elm-type-effect | src/Type/Effect/Env.hs | bsd-3-clause | occurringVars :: PatAnn -> [AnnVar PatInfo]
occurringVars (VarAnnot v) = [v] | 76 | occurringVars :: PatAnn -> [AnnVar PatInfo]
occurringVars (VarAnnot v) = [v] | 76 | occurringVars (VarAnnot v) = [v] | 32 | false | true | 0 | 9 | 10 | 39 | 18 | 21 | null | null |
iblumenfeld/saw-core | src/Verifier/SAW/Typechecker/Simplification.hs | bsd-3-clause | reduce :: TermContext s -> TCTerm -> TC s TCTerm
reduce tc t =
case tcAsApp t of
(TCF (RecordSelector r f), a) -> do
r' <- reduce tc r
case r' of
TCF (RecordValue m) ->
case Map.lookup f m of
Just v -> reduce tc (tcMkApp v a)
Nothing -> fail "Missing record field in reduce"
_ -> return t
(TCLambda pat _ rhs, a0:al) -> do
r <- tryMatchPat tc pat a0
case r of
Nothing -> return t
Just (sub,_) -> reduce tc (tcMkApp t' al)
where tc' = extendPatContext tc pat
t' = tcApply tc (tc',rhs) (tc,sub)
(TCF (GlobalDef g), al) -> do
-- Get global equations.
m <- tryEval (globalDefEqns g tc)
case m of
Nothing -> return t
Just eqs -> procEqs eqs
where procEqs [] = return t
procEqs (DefEqnGen pats rhs:eql) = do
m <- tryMatchPatList tc pats al
case m of
Nothing -> procEqs eql
Just (tc', sub, rest) -> reduce tc (tcMkApp g' rest)
where g' = tcApply tc (tc',rhs) (tc,V.reverse sub)
_ -> return t
-- | Attempt to reduce a term to a pi expression, returning the pattern, type
-- of the pattern and the right-hand side.
-- Reports error if htis fails. | 1,313 | reduce :: TermContext s -> TCTerm -> TC s TCTerm
reduce tc t =
case tcAsApp t of
(TCF (RecordSelector r f), a) -> do
r' <- reduce tc r
case r' of
TCF (RecordValue m) ->
case Map.lookup f m of
Just v -> reduce tc (tcMkApp v a)
Nothing -> fail "Missing record field in reduce"
_ -> return t
(TCLambda pat _ rhs, a0:al) -> do
r <- tryMatchPat tc pat a0
case r of
Nothing -> return t
Just (sub,_) -> reduce tc (tcMkApp t' al)
where tc' = extendPatContext tc pat
t' = tcApply tc (tc',rhs) (tc,sub)
(TCF (GlobalDef g), al) -> do
-- Get global equations.
m <- tryEval (globalDefEqns g tc)
case m of
Nothing -> return t
Just eqs -> procEqs eqs
where procEqs [] = return t
procEqs (DefEqnGen pats rhs:eql) = do
m <- tryMatchPatList tc pats al
case m of
Nothing -> procEqs eql
Just (tc', sub, rest) -> reduce tc (tcMkApp g' rest)
where g' = tcApply tc (tc',rhs) (tc,V.reverse sub)
_ -> return t
-- | Attempt to reduce a term to a pi expression, returning the pattern, type
-- of the pattern and the right-hand side.
-- Reports error if htis fails. | 1,313 | reduce tc t =
case tcAsApp t of
(TCF (RecordSelector r f), a) -> do
r' <- reduce tc r
case r' of
TCF (RecordValue m) ->
case Map.lookup f m of
Just v -> reduce tc (tcMkApp v a)
Nothing -> fail "Missing record field in reduce"
_ -> return t
(TCLambda pat _ rhs, a0:al) -> do
r <- tryMatchPat tc pat a0
case r of
Nothing -> return t
Just (sub,_) -> reduce tc (tcMkApp t' al)
where tc' = extendPatContext tc pat
t' = tcApply tc (tc',rhs) (tc,sub)
(TCF (GlobalDef g), al) -> do
-- Get global equations.
m <- tryEval (globalDefEqns g tc)
case m of
Nothing -> return t
Just eqs -> procEqs eqs
where procEqs [] = return t
procEqs (DefEqnGen pats rhs:eql) = do
m <- tryMatchPatList tc pats al
case m of
Nothing -> procEqs eql
Just (tc', sub, rest) -> reduce tc (tcMkApp g' rest)
where g' = tcApply tc (tc',rhs) (tc,V.reverse sub)
_ -> return t
-- | Attempt to reduce a term to a pi expression, returning the pattern, type
-- of the pattern and the right-hand side.
-- Reports error if htis fails. | 1,264 | false | true | 0 | 20 | 481 | 475 | 230 | 245 | null | null |
apanagio/easykenak | slicer2/src/Utils.hs | gpl-3.0 | -- >>>>>>>>>>>>>> END Balconies <<<<<<<<<<<<<<<<<<<
-- >>>>>>>>>>>>>> Obstacles <<<<<<<<<<<<<<<<<<<<<<<
-- project line l1 to line l2
-- only if l2 is "in front" of l1
-- return part of l1 that gets the projection and
-- distance of the points
projectLine :: Line -> Line -> Maybe (Interval, (Double, Double))
projectLine (p1, v1) (p2, v2)
| (p1, v1) == (p2, v2) = Nothing
| not (snd startProj ~< 0) && not (snd endProj ~< 0) = Nothing
| fst startProj ~= fst endProj = Nothing
| otherwise = dd <$> i
where
startProj = project p2 (p1, v1)
endProj = project (p2 &+ v2) (p1, v1)
i = intervalIntersection (0.0, 1.0) (fst startProj, fst endProj)
getD s = norm v1 * fst (uintersect (p1 &+ (s &* v1), cw v1) (p2, v2))
dd i = (i, (getD *** getD) i)
-- subtracts all following intervals from the current one
-- eg [a, b, c, d] -> [[a - b - c - d], [b - c - d], [c - d], [d]] | 899 | projectLine :: Line -> Line -> Maybe (Interval, (Double, Double))
projectLine (p1, v1) (p2, v2)
| (p1, v1) == (p2, v2) = Nothing
| not (snd startProj ~< 0) && not (snd endProj ~< 0) = Nothing
| fst startProj ~= fst endProj = Nothing
| otherwise = dd <$> i
where
startProj = project p2 (p1, v1)
endProj = project (p2 &+ v2) (p1, v1)
i = intervalIntersection (0.0, 1.0) (fst startProj, fst endProj)
getD s = norm v1 * fst (uintersect (p1 &+ (s &* v1), cw v1) (p2, v2))
dd i = (i, (getD *** getD) i)
-- subtracts all following intervals from the current one
-- eg [a, b, c, d] -> [[a - b - c - d], [b - c - d], [c - d], [d]] | 653 | projectLine (p1, v1) (p2, v2)
| (p1, v1) == (p2, v2) = Nothing
| not (snd startProj ~< 0) && not (snd endProj ~< 0) = Nothing
| fst startProj ~= fst endProj = Nothing
| otherwise = dd <$> i
where
startProj = project p2 (p1, v1)
endProj = project (p2 &+ v2) (p1, v1)
i = intervalIntersection (0.0, 1.0) (fst startProj, fst endProj)
getD s = norm v1 * fst (uintersect (p1 &+ (s &* v1), cw v1) (p2, v2))
dd i = (i, (getD *** getD) i)
-- subtracts all following intervals from the current one
-- eg [a, b, c, d] -> [[a - b - c - d], [b - c - d], [c - d], [d]] | 587 | true | true | 2 | 12 | 205 | 304 | 161 | 143 | null | null |
input-output-hk/pos-haskell-prototype | wallet/src/Cardano/Wallet/API/V1/Handlers/Accounts.hs | mit | newAccount :: PassiveWalletLayer IO
-> WalletId
-> NewAccount
-> Handler (APIResponse Account)
newAccount layer wId newAccountRequest = do
res <- liftIO $ WalletLayer.createAccount layer wId newAccountRequest
case res of
Left e -> throwM e
Right account -> return $ single account | 346 | newAccount :: PassiveWalletLayer IO
-> WalletId
-> NewAccount
-> Handler (APIResponse Account)
newAccount layer wId newAccountRequest = do
res <- liftIO $ WalletLayer.createAccount layer wId newAccountRequest
case res of
Left e -> throwM e
Right account -> return $ single account | 346 | newAccount layer wId newAccountRequest = do
res <- liftIO $ WalletLayer.createAccount layer wId newAccountRequest
case res of
Left e -> throwM e
Right account -> return $ single account | 218 | false | true | 0 | 11 | 106 | 97 | 44 | 53 | null | null |
Saulzar/Ants | Ant/Renderer.hs | bsd-3-clause | regionColourSet :: V.Vector (Colour Float)
regionColourSet = V.fromList [lightsalmon, lightseagreen, cornflowerblue, brown, pink, cadetblue, olive, brown, moccasin, darkkhaki, cornsilk, lightsteelblue, darkgoldenrod, azure] | 223 | regionColourSet :: V.Vector (Colour Float)
regionColourSet = V.fromList [lightsalmon, lightseagreen, cornflowerblue, brown, pink, cadetblue, olive, brown, moccasin, darkkhaki, cornsilk, lightsteelblue, darkgoldenrod, azure] | 223 | regionColourSet = V.fromList [lightsalmon, lightseagreen, cornflowerblue, brown, pink, cadetblue, olive, brown, moccasin, darkkhaki, cornsilk, lightsteelblue, darkgoldenrod, azure] | 180 | false | true | 0 | 7 | 21 | 69 | 41 | 28 | null | null |
alexbiehl/hoop | hadoop-protos/src/Hadoop/Protos/YarnServerResourceManagerRecoveryProtos/RMAppAttemptStateProto.hs | mit | toMaybe'Enum 4 = Prelude'.Just RMATTEMPT_ALLOCATED | 50 | toMaybe'Enum 4 = Prelude'.Just RMATTEMPT_ALLOCATED | 50 | toMaybe'Enum 4 = Prelude'.Just RMATTEMPT_ALLOCATED | 50 | false | false | 1 | 6 | 4 | 17 | 6 | 11 | null | null |
tjakway/ghcjvm | compiler/codeGen/StgCmmMonad.hs | bsd-3-clause | emitProcWithStackFrame _ _ _ _ _ _ _ = panic "emitProcWithStackFrame" | 69 | emitProcWithStackFrame _ _ _ _ _ _ _ = panic "emitProcWithStackFrame" | 69 | emitProcWithStackFrame _ _ _ _ _ _ _ = panic "emitProcWithStackFrame" | 69 | false | false | 1 | 5 | 10 | 20 | 10 | 10 | null | null |
a143753/AOJ | 0266.hs | apache-2.0 | ans (x:xs) =
let d = foldl f 'A' x
a = if d == 'B' then "Yes" else "No"
in
a:ans(xs) | 98 | ans (x:xs) =
let d = foldl f 'A' x
a = if d == 'B' then "Yes" else "No"
in
a:ans(xs) | 98 | ans (x:xs) =
let d = foldl f 'A' x
a = if d == 'B' then "Yes" else "No"
in
a:ans(xs) | 98 | false | false | 0 | 10 | 35 | 61 | 31 | 30 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/course/2014-06-upenn/cis194/src/HW04_HC.hs | unlicense | ------------------------------------------------------------------------------
-- Exercise 4
cartProd :: [a] -> [b] -> [(a, b)]
cartProd xs ys = [(x,y) | x <- xs, y <- ys] | 172 | cartProd :: [a] -> [b] -> [(a, b)]
cartProd xs ys = [(x,y) | x <- xs, y <- ys] | 78 | cartProd xs ys = [(x,y) | x <- xs, y <- ys] | 43 | true | true | 0 | 8 | 24 | 66 | 38 | 28 | null | null |
ekmett/kevin | Kevin/Types.hs | gpl-3.0 | io :: MonadIO m => IO a -> m a
io = liftIO | 42 | io :: MonadIO m => IO a -> m a
io = liftIO | 42 | io = liftIO | 11 | false | true | 0 | 8 | 12 | 34 | 14 | 20 | null | null |
ghcjs/ghcjs | src-bin/Boot.hs | mit | cp_r :: FilePath -> FilePath -> B ()
cp_r src tgt = do
liftIO (createDirectoryIfMissing True tgt)
mapM_ f =<< liftIO (listDirectory src)
where
f entry = do
let se = src </> entry
te = tgt </> entry
isDir <- liftIO (doesDirectoryExist se)
if isDir then cp_r se te else liftIO (copyFile se te) | 329 | cp_r :: FilePath -> FilePath -> B ()
cp_r src tgt = do
liftIO (createDirectoryIfMissing True tgt)
mapM_ f =<< liftIO (listDirectory src)
where
f entry = do
let se = src </> entry
te = tgt </> entry
isDir <- liftIO (doesDirectoryExist se)
if isDir then cp_r se te else liftIO (copyFile se te) | 329 | cp_r src tgt = do
liftIO (createDirectoryIfMissing True tgt)
mapM_ f =<< liftIO (listDirectory src)
where
f entry = do
let se = src </> entry
te = tgt </> entry
isDir <- liftIO (doesDirectoryExist se)
if isDir then cp_r se te else liftIO (copyFile se te) | 292 | false | true | 0 | 10 | 92 | 137 | 64 | 73 | null | null |
nikita-volkov/postgresql-binary | tasty/Main/Gens.hs | mit | postgresInt :: (Bounded a, Ord a, Integral a, Arbitrary a) => Gen a
postgresInt =
arbitrary >>= \x -> if x > halfMaxBound then postgresInt else pure x
where
halfMaxBound =
div maxBound 2 | 200 | postgresInt :: (Bounded a, Ord a, Integral a, Arbitrary a) => Gen a
postgresInt =
arbitrary >>= \x -> if x > halfMaxBound then postgresInt else pure x
where
halfMaxBound =
div maxBound 2 | 200 | postgresInt =
arbitrary >>= \x -> if x > halfMaxBound then postgresInt else pure x
where
halfMaxBound =
div maxBound 2 | 132 | false | true | 0 | 8 | 47 | 78 | 40 | 38 | null | null |
iblumenfeld/cryptol | src/Cryptol/TypeCheck/Monad.hs | bsd-3-clause | kLookupTSyn :: QName -> KindM (Maybe TySyn)
kLookupTSyn x = kInInferM $ lookupTSyn x | 84 | kLookupTSyn :: QName -> KindM (Maybe TySyn)
kLookupTSyn x = kInInferM $ lookupTSyn x | 84 | kLookupTSyn x = kInInferM $ lookupTSyn x | 40 | false | true | 0 | 8 | 13 | 34 | 16 | 18 | null | null |
frantisekfarka/ghc-dsi | compiler/nativeGen/X86/Ppr.hs | bsd-3-clause | pprInstr (DIV sz op) = pprSizeOp (sLit "div") sz op | 55 | pprInstr (DIV sz op) = pprSizeOp (sLit "div") sz op | 55 | pprInstr (DIV sz op) = pprSizeOp (sLit "div") sz op | 55 | false | false | 0 | 7 | 13 | 31 | 14 | 17 | null | null |
randen/cabal | cabal-install/Distribution/Client/Dependency/Modular/Log.hs | bsd-3-clause | -- | Turns a log into a list of messages paired with a final result. A final result
-- of 'Nothing' indicates failure. A final result of 'Just' indicates success.
-- Keep in mind that forcing the second component of the returned pair will force the
-- entire log.
runLog :: Log m a -> ([m], Maybe a)
runLog (Done x) = ([], Just x) | 336 | runLog :: Log m a -> ([m], Maybe a)
runLog (Done x) = ([], Just x) | 72 | runLog (Done x) = ([], Just x) | 36 | true | true | 0 | 7 | 70 | 56 | 31 | 25 | null | null |
alexander-at-github/eta | compiler/ETA/BasicTypes/Var.hs | bsd-3-clause | isLocalId _ = False | 46 | isLocalId _ = False | 46 | isLocalId _ = False | 46 | false | false | 0 | 5 | 30 | 9 | 4 | 5 | null | null |
begriffs/hasql-postgres | library/Hasql/Postgres/ErrorCode.hs | mit | -- * Class 03 — SQL Statement Not Yet Complete
-------------------------
sql_statement_not_yet_complete :: ErrorCode = "03000" | 149 | sql_statement_not_yet_complete :: ErrorCode = "03000" | 75 | sql_statement_not_yet_complete :: ErrorCode = "03000" | 75 | true | false | 0 | 5 | 38 | 13 | 7 | 6 | null | null |
pjones/xmonad-test | vendor/xmonad-contrib/XMonad/Layout/LayoutBuilder.hs | bsd-2-clause | layoutN :: (Read a, Eq a, LayoutClass l1 a, LayoutClass l2 a, LayoutClass l3 a) =>
Int -- ^ The number of windows to handle
-> SubBox -- ^ The box to place the windows in
-> Maybe SubBox -- ^ Possibly an alternative box that is used when this layout handles all windows that are left
-> l1 a -- ^ The layout to use in the specified area
-> LayoutN l2 l3 a -- ^ Where to send the remaining windows
-> LayoutN l1 (LayoutN l2 l3) a -- ^ The resulting layout
layoutN num box mbox sub next = LayoutN Nothing Nothing (Left num) box mbox sub (Just next) | 673 | layoutN :: (Read a, Eq a, LayoutClass l1 a, LayoutClass l2 a, LayoutClass l3 a) =>
Int -- ^ The number of windows to handle
-> SubBox -- ^ The box to place the windows in
-> Maybe SubBox -- ^ Possibly an alternative box that is used when this layout handles all windows that are left
-> l1 a -- ^ The layout to use in the specified area
-> LayoutN l2 l3 a -- ^ Where to send the remaining windows
-> LayoutN l1 (LayoutN l2 l3) a
layoutN num box mbox sub next = LayoutN Nothing Nothing (Left num) box mbox sub (Just next) | 647 | layoutN num box mbox sub next = LayoutN Nothing Nothing (Left num) box mbox sub (Just next) | 91 | true | true | 0 | 14 | 238 | 143 | 72 | 71 | null | null |
mfpi/hnars | src/FingerTree.hs | mit | nodes [a, b, c] = [node3 a b c] | 31 | nodes [a, b, c] = [node3 a b c] | 31 | nodes [a, b, c] = [node3 a b c] | 31 | false | false | 0 | 6 | 8 | 28 | 15 | 13 | null | null |
input-output-hk/pos-haskell-prototype | wallet/src/Cardano/Wallet/Kernel/Submission.hs | mit | -- | This value is the default resubmission limit. It is referred to in the
-- @RelatingWalletSpecToCardano.md@ document in section 10.4. If this value is
-- altered, then that document should be updated.
defaultResubmissionLimit :: Int
defaultResubmissionLimit = 23 | 266 | defaultResubmissionLimit :: Int
defaultResubmissionLimit = 23 | 61 | defaultResubmissionLimit = 23 | 29 | true | true | 0 | 4 | 38 | 14 | 9 | 5 | null | null |
CarstenKoenig/Countdown | src/lib/Countdown/Lists.hs | mit | pick :: [a] -> [ (a,[a]) ]
pick [] = [] | 39 | pick :: [a] -> [ (a,[a]) ]
pick [] = [] | 39 | pick [] = [] | 12 | false | true | 0 | 10 | 10 | 43 | 22 | 21 | null | null |
tdfirth/lambda | src/Lambda/ReadExpression.hs | mit | eval env (List [Atom "load", String filename]) =
load filename >>= liftM last . mapM (eval env) | 97 | eval env (List [Atom "load", String filename]) =
load filename >>= liftM last . mapM (eval env) | 97 | eval env (List [Atom "load", String filename]) =
load filename >>= liftM last . mapM (eval env) | 97 | false | false | 2 | 8 | 18 | 56 | 25 | 31 | null | null |
zhensydow/ljcsandbox | lang/haskell/spoj/solved/ONP.hs | gpl-3.0 | operand :: Parser Expr
operand = do{ o <- letter
; return $ Operand o
}
<?> "operand" | 117 | operand :: Parser Expr
operand = do{ o <- letter
; return $ Operand o
}
<?> "operand" | 117 | operand = do{ o <- letter
; return $ Operand o
}
<?> "operand" | 94 | false | true | 2 | 8 | 49 | 45 | 20 | 25 | null | null |
siddhanathan/ghc | compiler/cmm/CmmNode.hs | bsd-3-clause | foldExp f (CmmCondBranch e _ _ _) z = f e z | 57 | foldExp f (CmmCondBranch e _ _ _) z = f e z | 57 | foldExp f (CmmCondBranch e _ _ _) z = f e z | 57 | false | false | 1 | 6 | 25 | 37 | 14 | 23 | null | null |
koengit/cyphy | src/CyphyUtils.hs | mit | refStream :: (Ord time, Num time, ?h :: time)
=> [(time, value)]
-> S value
refStream [(_, r)] = repeat r | 125 | refStream :: (Ord time, Num time, ?h :: time)
=> [(time, value)]
-> S value
refStream [(_, r)] = repeat r | 125 | refStream [(_, r)] = repeat r | 29 | false | true | 0 | 8 | 40 | 63 | 35 | 28 | null | null |
NickAger/LearningHaskell | ParallelConcurrent/diningPhilosophers/app/Main.hs | mit | -- Philosophers
runPhilosopher :: String -> (Fork, Fork) -> IO ()
runPhilosopher name (left, right) = forever $ do
putStrLn (name ++ " is hungry.")
(leftNum, rightNum) <- atomically $ do
leftNum <- trace (name ++ " trying to grab left fork") takeFork left
rightNum <- trace (name ++ " trying to grab right fork") takeFork right
return (leftNum, rightNum)
putStrLn $ printf "%s got forks %d and %d and is now eating" name leftNum rightNum
delay <- randomRIO (1, 3)
threadDelay (delay * 1000000)
putStrLn (name ++ " is done eating. Going back to thinking.")
atomically $ do
releaseFork leftNum left
releaseFork rightNum right
delay <- randomRIO (1, 3)
threadDelay (delay * 1000000) | 761 | runPhilosopher :: String -> (Fork, Fork) -> IO ()
runPhilosopher name (left, right) = forever $ do
putStrLn (name ++ " is hungry.")
(leftNum, rightNum) <- atomically $ do
leftNum <- trace (name ++ " trying to grab left fork") takeFork left
rightNum <- trace (name ++ " trying to grab right fork") takeFork right
return (leftNum, rightNum)
putStrLn $ printf "%s got forks %d and %d and is now eating" name leftNum rightNum
delay <- randomRIO (1, 3)
threadDelay (delay * 1000000)
putStrLn (name ++ " is done eating. Going back to thinking.")
atomically $ do
releaseFork leftNum left
releaseFork rightNum right
delay <- randomRIO (1, 3)
threadDelay (delay * 1000000) | 745 | runPhilosopher name (left, right) = forever $ do
putStrLn (name ++ " is hungry.")
(leftNum, rightNum) <- atomically $ do
leftNum <- trace (name ++ " trying to grab left fork") takeFork left
rightNum <- trace (name ++ " trying to grab right fork") takeFork right
return (leftNum, rightNum)
putStrLn $ printf "%s got forks %d and %d and is now eating" name leftNum rightNum
delay <- randomRIO (1, 3)
threadDelay (delay * 1000000)
putStrLn (name ++ " is done eating. Going back to thinking.")
atomically $ do
releaseFork leftNum left
releaseFork rightNum right
delay <- randomRIO (1, 3)
threadDelay (delay * 1000000) | 695 | true | true | 0 | 16 | 195 | 245 | 117 | 128 | null | null |
forste/haReFork | tools/hs2alfa/tests/Test1.hs | bsd-3-clause | intersperse :: a -> [a] -> [a]
intersperse sep [] = [] | 72 | intersperse :: a -> [a] -> [a]
intersperse sep [] = [] | 72 | intersperse sep [] = [] | 29 | false | true | 0 | 7 | 29 | 34 | 18 | 16 | null | null |
siddhanathan/ghc | compiler/prelude/THNames.hs | bsd-3-clause | starKName = libFun (fsLit "starK") starKIdKey | 58 | starKName = libFun (fsLit "starK") starKIdKey | 58 | starKName = libFun (fsLit "starK") starKIdKey | 58 | false | false | 1 | 7 | 18 | 20 | 8 | 12 | null | null |
abakst/liquidhaskell | benchmarks/vector-0.10.0.1/Data/Vector/Generic.hs | bsd-3-clause | enumFromThenTo x y z = unstream (Stream.enumFromThenTo x y z) | 61 | enumFromThenTo x y z = unstream (Stream.enumFromThenTo x y z) | 61 | enumFromThenTo x y z = unstream (Stream.enumFromThenTo x y z) | 61 | false | false | 1 | 8 | 9 | 33 | 13 | 20 | null | null |
tingtun/jmacro | Language/Javascript/JMacro/QQ.hs | bsd-3-clause | -- import Debug.Trace
{--------------------------------------------------------------------
QuasiQuotation
--------------------------------------------------------------------}
-- | QuasiQuoter for a block of JMacro statements.
jmacro :: QuasiQuoter
jmacro = QuasiQuoter {quoteExp = quoteJMExp, quotePat = quoteJMPat} | 321 | jmacro :: QuasiQuoter
jmacro = QuasiQuoter {quoteExp = quoteJMExp, quotePat = quoteJMPat} | 89 | jmacro = QuasiQuoter {quoteExp = quoteJMExp, quotePat = quoteJMPat} | 67 | true | true | 0 | 7 | 30 | 38 | 20 | 18 | null | null |
crogers1/manager | xenmgr/XenMgr/Config.hs | gpl-2.0 | appGetV4VFirewall :: Rpc Bool
appGetV4VFirewall = dbReadWithDefault True "/xenmgr/v4v-firewall" | 95 | appGetV4VFirewall :: Rpc Bool
appGetV4VFirewall = dbReadWithDefault True "/xenmgr/v4v-firewall" | 95 | appGetV4VFirewall = dbReadWithDefault True "/xenmgr/v4v-firewall" | 65 | false | true | 0 | 5 | 8 | 19 | 9 | 10 | null | null |
bennofs/ghc-server | src/Main.hs | bsd-3-clause | commandConfigM :: String -> Parser ConfigO -> InfoMod ConfigO -> Mod CommandFields ConfigO
commandConfigM c conf = command c . info conf | 136 | commandConfigM :: String -> Parser ConfigO -> InfoMod ConfigO -> Mod CommandFields ConfigO
commandConfigM c conf = command c . info conf | 136 | commandConfigM c conf = command c . info conf | 45 | false | true | 0 | 9 | 21 | 53 | 23 | 30 | null | null |
seL4/capDL-tool | CapDL/PrintXml.hs | bsd-2-clause | showObjectAttrs (IOPorts sz) = [("size", show sz)] | 50 | showObjectAttrs (IOPorts sz) = [("size", show sz)] | 50 | showObjectAttrs (IOPorts sz) = [("size", show sz)] | 50 | false | false | 0 | 7 | 6 | 27 | 14 | 13 | null | null |
bkoropoff/Idris-dev | src/Idris/Core/TT.hs | bsd-3-clause | showEnvDbg env t = showEnv' env t True | 38 | showEnvDbg env t = showEnv' env t True | 38 | showEnvDbg env t = showEnv' env t True | 38 | false | false | 1 | 5 | 7 | 22 | 8 | 14 | null | null |
jshholland/savannah-wit | src/Board.hs | bsd-3-clause | charToPiece _ = Nothing | 25 | charToPiece _ = Nothing | 25 | charToPiece _ = Nothing | 25 | false | false | 0 | 4 | 5 | 10 | 4 | 6 | null | null |
ComputationWithBoundedResources/tct-core | src/Tct/Core/Data/Declaration.hs | bsd-3-clause | setArgMeta k (SomeArg a) = SomeArg (setArgMeta k a) | 58 | setArgMeta k (SomeArg a) = SomeArg (setArgMeta k a) | 58 | setArgMeta k (SomeArg a) = SomeArg (setArgMeta k a) | 58 | false | false | 0 | 7 | 15 | 28 | 13 | 15 | null | null |
andorp/grin | grin/src/Test/Util.hs | bsd-3-clause | cCons :: Tag
cCons = Tag C "Cons" | 33 | cCons :: Tag
cCons = Tag C "Cons" | 33 | cCons = Tag C "Cons" | 20 | false | true | 0 | 6 | 7 | 24 | 9 | 15 | null | null |
energyflowanalysis/efa-2.1 | src/EFA/Signal/Plot.hs | bsd-3-clause | paletteGray ::
(Graph.C graph) => Opts.T graph -> Opts.T graph
paletteGray =
Opts.add (Opt.custom "palette" "") ["defined ( 0 0 0 0, 1 1 1 1 )"] | 148 | paletteGray ::
(Graph.C graph) => Opts.T graph -> Opts.T graph
paletteGray =
Opts.add (Opt.custom "palette" "") ["defined ( 0 0 0 0, 1 1 1 1 )"] | 148 | paletteGray =
Opts.add (Opt.custom "palette" "") ["defined ( 0 0 0 0, 1 1 1 1 )"] | 83 | false | true | 0 | 9 | 30 | 62 | 29 | 33 | null | null |
bens/battleship | src/Battleship.hs | bsd-3-clause | updateAbove :: Ship -> Position -> Int -> Board Cell -> Cell
updateAbove ship (Position (newx, newy)) n board =
case extract board of
Ship ship' -> Ship ship'
Empty dist@(Distance (dx, dy)) ->
if x < newx || x >= newx + n || newy < y then Empty dist
else if newy == y then Ship ship
else Empty (Distance (dx, min (newy - y) dy))
where
Position (x,y) = boardPosition board
-- | Update the distance to the new ship for all cells to the left of it. | 491 | updateAbove :: Ship -> Position -> Int -> Board Cell -> Cell
updateAbove ship (Position (newx, newy)) n board =
case extract board of
Ship ship' -> Ship ship'
Empty dist@(Distance (dx, dy)) ->
if x < newx || x >= newx + n || newy < y then Empty dist
else if newy == y then Ship ship
else Empty (Distance (dx, min (newy - y) dy))
where
Position (x,y) = boardPosition board
-- | Update the distance to the new ship for all cells to the left of it. | 491 | updateAbove ship (Position (newx, newy)) n board =
case extract board of
Ship ship' -> Ship ship'
Empty dist@(Distance (dx, dy)) ->
if x < newx || x >= newx + n || newy < y then Empty dist
else if newy == y then Ship ship
else Empty (Distance (dx, min (newy - y) dy))
where
Position (x,y) = boardPosition board
-- | Update the distance to the new ship for all cells to the left of it. | 430 | false | true | 0 | 16 | 136 | 191 | 98 | 93 | null | null |
23Skidoo/ghc-parmake | src/GHC/ParMake/BuildPlan.hs | bsd-3-clause | markReadyAsBuilding :: BuildPlan -> BuildPlan
markReadyAsBuilding plan = plan {
planReady = IntSet.empty,
planBuilding = planBuilding plan `IntSet.union` planReady plan
} | 176 | markReadyAsBuilding :: BuildPlan -> BuildPlan
markReadyAsBuilding plan = plan {
planReady = IntSet.empty,
planBuilding = planBuilding plan `IntSet.union` planReady plan
} | 176 | markReadyAsBuilding plan = plan {
planReady = IntSet.empty,
planBuilding = planBuilding plan `IntSet.union` planReady plan
} | 130 | false | true | 0 | 9 | 26 | 54 | 27 | 27 | null | null |
Garciat/pixelated-hs | src/Main.hs | mit | head' :: [a] -> Maybe a
head' [] = Nothing | 45 | head' :: [a] -> Maybe a
head' [] = Nothing | 45 | head' [] = Nothing | 21 | false | true | 0 | 6 | 12 | 26 | 13 | 13 | null | null |
markusle/husky | test/CalculatorTest.hs | gpl-3.0 | simpleTest6 :: GoodTestCase
simpleTest6 = ("(3.0+3.0)*(9.0+8.0)", DblResult 102.0) | 82 | simpleTest6 :: GoodTestCase
simpleTest6 = ("(3.0+3.0)*(9.0+8.0)", DblResult 102.0) | 82 | simpleTest6 = ("(3.0+3.0)*(9.0+8.0)", DblResult 102.0) | 54 | false | true | 0 | 6 | 7 | 20 | 11 | 9 | null | null |
DougBurke/swish | src/Swish/RDF/ProofContext.hs | lgpl-2.1 | {- -- Test data
qnamint = ScopedName namespaceXSD "integer"
xsdint = Res qnamint
lab010 = Lit "010" (Just qnamint)
can010 = getCanonical lab010 xsdint xsdint
nsex = Namespace "ex" "http://example.org/"
resexp = Res (ScopedName nsex "p")
resexs = Res (ScopedName nsex "s")
vara = Var "a"
varb = Var "b"
varc = Var "c"
vard = Var "d"
varp = Var "p"
vars = Var "s"
vart = Var "t"
vb1 = makeVarBinding [(vara,lab010),(varb,xsdint),(vard,xsdint)]
vb2 = sameDatatypedValueApply vara varb varc vard vb1
vb3 = vbmApply (sameDatatypedValue vara varb varc vard) [vb1]
vb3t = vb3 == vb2
vb4 = vbmApply (valueSame "a" "b" "c" "d") [vb1]
vb4t = vb4 == vb2
vb5 = vbmApply (valueSame "a" "b" "c" "b") [vb1]
vb5t = vb5 == vb2
vb6 = makeVarBinding [(vars,lab010),(varp,resexp),(vara,resexs),(vard,xsdint)]
vb7 = vbmApply (valueSame "s" "d" "t" "d") [vb6]
vb8 = makeVarBinding [(vars,lab010),(varp,resexp),(vara,resexs),(vard,xsdint)
,(vart,fromJust can010)]
vb8t = vb7 == [vb8]
-- -}
------------------------------------------------------------
-- Common definitions
------------------------------------------------------------
------------------------------------------------------------
-- Define RDF axioms
------------------------------------------------------------
-- scopeRDF = Namespace "rs-rdf" "http://id.ninebynine.org/2003/Ruleset/rdf#"
-- RDF axioms (from RDF semantics document, section 3.1)
--
-- (See also, container property rules below)
--
rdfa1 :: RDFFormula
rdfa1 = makeFormula scopeRDF "a1" "rdf:type rdf:type rdf:Property ." | 1,585 | rdfa1 :: RDFFormula
rdfa1 = makeFormula scopeRDF "a1" "rdf:type rdf:type rdf:Property ." | 93 | rdfa1 = makeFormula scopeRDF "a1" "rdf:type rdf:type rdf:Property ." | 73 | true | true | 0 | 5 | 252 | 30 | 21 | 9 | null | null |
ankhers/haskell-ide-engine | src/Haskell/Ide/Engine/BasePlugin.hs | bsd-3-clause | -- ---------------------------------------------------------------------
versionCmd :: CommandFunc T.Text
versionCmd = CmdSync $ \_ _ -> return $ IdeResponseOk (T.pack version) | 177 | versionCmd :: CommandFunc T.Text
versionCmd = CmdSync $ \_ _ -> return $ IdeResponseOk (T.pack version) | 103 | versionCmd = CmdSync $ \_ _ -> return $ IdeResponseOk (T.pack version) | 70 | true | true | 1 | 11 | 18 | 46 | 22 | 24 | null | null |
DaMSL/K3 | src/Language/K3/Parser/SQL.hs | apache-2.0 | scalarexprType sidOpt (CaseSimple _ expr whens elseexpr) = maybe (caselistType sidOpt whens) (scalarexprType sidOpt) elseexpr | 125 | scalarexprType sidOpt (CaseSimple _ expr whens elseexpr) = maybe (caselistType sidOpt whens) (scalarexprType sidOpt) elseexpr | 125 | scalarexprType sidOpt (CaseSimple _ expr whens elseexpr) = maybe (caselistType sidOpt whens) (scalarexprType sidOpt) elseexpr | 125 | false | false | 0 | 7 | 14 | 44 | 21 | 23 | null | null |
ivanmoore/seedy | lib/RobUnit.hs | gpl-3.0 | ioResult :: IO String -> IO ()
ioResult test = do
result <- test
putStr result | 82 | ioResult :: IO String -> IO ()
ioResult test = do
result <- test
putStr result | 82 | ioResult test = do
result <- test
putStr result | 51 | false | true | 0 | 7 | 19 | 39 | 17 | 22 | null | null |
tismith/tlisp | src/Primitives.hs | mit | anyNumBinDiv (Number a) (Complex b) = return $ Complex ((fromIntegral a :+ 0) / b) | 82 | anyNumBinDiv (Number a) (Complex b) = return $ Complex ((fromIntegral a :+ 0) / b) | 82 | anyNumBinDiv (Number a) (Complex b) = return $ Complex ((fromIntegral a :+ 0) / b) | 82 | false | false | 0 | 11 | 14 | 47 | 23 | 24 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/typecheck/TcEvidence.hs | bsd-3-clause | mkTcLRCo :: LeftOrRight -> TcCoercion -> TcCoercion
mkTcLRCo lr (TcRefl r ty) = TcRefl r (pickLR lr (tcSplitAppTy ty)) | 118 | mkTcLRCo :: LeftOrRight -> TcCoercion -> TcCoercion
mkTcLRCo lr (TcRefl r ty) = TcRefl r (pickLR lr (tcSplitAppTy ty)) | 118 | mkTcLRCo lr (TcRefl r ty) = TcRefl r (pickLR lr (tcSplitAppTy ty)) | 66 | false | true | 0 | 9 | 18 | 51 | 25 | 26 | null | null |
da-x/ghc | libraries/base/Data/List/NonEmpty.hs | bsd-3-clause | unfold :: (a -> (b, Maybe a)) -> a -> NonEmpty b
unfold f a = case f a of
(b, Nothing) -> b :| []
(b, Just c) -> b <| unfold f c
-- | 'nonEmpty' efficiently turns a normal list into a 'NonEmpty' stream,
-- producing 'Nothing' if the input is empty. | 254 | unfold :: (a -> (b, Maybe a)) -> a -> NonEmpty b
unfold f a = case f a of
(b, Nothing) -> b :| []
(b, Just c) -> b <| unfold f c
-- | 'nonEmpty' efficiently turns a normal list into a 'NonEmpty' stream,
-- producing 'Nothing' if the input is empty. | 254 | unfold f a = case f a of
(b, Nothing) -> b :| []
(b, Just c) -> b <| unfold f c
-- | 'nonEmpty' efficiently turns a normal list into a 'NonEmpty' stream,
-- producing 'Nothing' if the input is empty. | 205 | false | true | 2 | 9 | 60 | 97 | 49 | 48 | null | null |
alpicola/mel | src/Frontend/Monomorphise.hs | mit | monoExpr (AFun b e) =
AFun <$> bimapM return replaceType b <*> monoExpr e | 75 | monoExpr (AFun b e) =
AFun <$> bimapM return replaceType b <*> monoExpr e | 75 | monoExpr (AFun b e) =
AFun <$> bimapM return replaceType b <*> monoExpr e | 75 | false | false | 2 | 6 | 15 | 37 | 16 | 21 | null | null |
edofic/koofr-api-hs | src/Koofr/Client.hs | mit | mountInfo :: (MonadIO m, MonadReader Client m) => MountId -> m Mount
mountInfo mountId = do
resp <- clientRequest methodGet ("/api/v2/mounts/" ++ mountId) noJSON
consumeJSON resp | 184 | mountInfo :: (MonadIO m, MonadReader Client m) => MountId -> m Mount
mountInfo mountId = do
resp <- clientRequest methodGet ("/api/v2/mounts/" ++ mountId) noJSON
consumeJSON resp | 184 | mountInfo mountId = do
resp <- clientRequest methodGet ("/api/v2/mounts/" ++ mountId) noJSON
consumeJSON resp | 114 | false | true | 0 | 10 | 31 | 65 | 31 | 34 | null | null |
vTurbine/ghc | compiler/utils/UniqFM.hs | bsd-3-clause | -- It's OK to use nonDetEltsUFM here because the type guarantees that
-- the only interesting thing this function can do is to force the
-- elements.
-- See Note [Deterministic UniqFM] to learn about nondeterminism.
-- If you use this please provide a justification why it doesn't introduce
-- nondeterminism.
nonDetEltsUFM :: UniqFM elt -> [elt]
nonDetEltsUFM (UFM m) = M.elems m | 385 | nonDetEltsUFM :: UniqFM elt -> [elt]
nonDetEltsUFM (UFM m) = M.elems m | 70 | nonDetEltsUFM (UFM m) = M.elems m | 33 | true | true | 0 | 7 | 67 | 41 | 23 | 18 | null | null |
lfritz/python-type-inference | python-type-inference/src/Language/Python/TypeInference/CFG/ToFragment.hs | bsd-3-clause | toBinaryOperator (AST.FloorDivide _) = return DivDiv | 58 | toBinaryOperator (AST.FloorDivide _) = return DivDiv | 58 | toBinaryOperator (AST.FloorDivide _) = return DivDiv | 58 | false | false | 0 | 8 | 11 | 20 | 9 | 11 | null | null |
changlinli/tictactoe-haskell | Negamax.hs | gpl-3.0 | findBestMove :: forall move state.
state ->
(move -> state -> state) ->
(state -> Bool) ->
(state -> [move]) ->
(state -> ExtendedNum Integer) ->
Int ->
move
findBestMove state moveFunc checkGameOverFunc generatePossibleMovesFunc evalFunc depth = fst $ foldl biggerOne initialMoveGuess moveList where
biggerOne :: (move, ExtendedNum Integer) -> move -> (move, ExtendedNum Integer)
-- Note that we choose the least favorable state because all the
-- states are calculated from the perspective of the opposing
-- player
biggerOne (acc, accScore) newMove = if newMoveScore < accScore
then (newMove, newMoveScore)
else (acc, accScore)
where newMoveScore = evaluateAB (generateNegamaxTree (moveFunc newMove state) moveFunc checkGameOverFunc generatePossibleMovesFunc) evalFunc depth
moveList :: [move]
moveList = generatePossibleMovesFunc state
initialMoveGuess :: (move, ExtendedNum Integer)
initialMoveGuess = (moveList !! 0, PosInf) | 1,144 | findBestMove :: forall move state.
state ->
(move -> state -> state) ->
(state -> Bool) ->
(state -> [move]) ->
(state -> ExtendedNum Integer) ->
Int ->
move
findBestMove state moveFunc checkGameOverFunc generatePossibleMovesFunc evalFunc depth = fst $ foldl biggerOne initialMoveGuess moveList where
biggerOne :: (move, ExtendedNum Integer) -> move -> (move, ExtendedNum Integer)
-- Note that we choose the least favorable state because all the
-- states are calculated from the perspective of the opposing
-- player
biggerOne (acc, accScore) newMove = if newMoveScore < accScore
then (newMove, newMoveScore)
else (acc, accScore)
where newMoveScore = evaluateAB (generateNegamaxTree (moveFunc newMove state) moveFunc checkGameOverFunc generatePossibleMovesFunc) evalFunc depth
moveList :: [move]
moveList = generatePossibleMovesFunc state
initialMoveGuess :: (move, ExtendedNum Integer)
initialMoveGuess = (moveList !! 0, PosInf) | 1,144 | findBestMove state moveFunc checkGameOverFunc generatePossibleMovesFunc evalFunc depth = fst $ foldl biggerOne initialMoveGuess moveList where
biggerOne :: (move, ExtendedNum Integer) -> move -> (move, ExtendedNum Integer)
-- Note that we choose the least favorable state because all the
-- states are calculated from the perspective of the opposing
-- player
biggerOne (acc, accScore) newMove = if newMoveScore < accScore
then (newMove, newMoveScore)
else (acc, accScore)
where newMoveScore = evaluateAB (generateNegamaxTree (moveFunc newMove state) moveFunc checkGameOverFunc generatePossibleMovesFunc) evalFunc depth
moveList :: [move]
moveList = generatePossibleMovesFunc state
initialMoveGuess :: (move, ExtendedNum Integer)
initialMoveGuess = (moveList !! 0, PosInf) | 930 | false | true | 0 | 13 | 338 | 258 | 142 | 116 | null | null |
bobbyrauchenberg/haskellCourse | src/Ex9.hs | bsd-3-clause | select :: (Show a, Ord a) => Int -> Vector a -> Rnd (Maybe a)
select i v = let len = vLen v
in case i > len of
True -> return Nothing
False ->
do
rnd <- getRandomR (0, len) :: (Rnd Int)
(l, m, r) <- return $ partitionAt v rnd
let
llen = length l
res = if i == llen
then return (v !? rnd)
else if i < llen
then select i l
else select (i - llen - 1) r
in res | 659 | select :: (Show a, Ord a) => Int -> Vector a -> Rnd (Maybe a)
select i v = let len = vLen v
in case i > len of
True -> return Nothing
False ->
do
rnd <- getRandomR (0, len) :: (Rnd Int)
(l, m, r) <- return $ partitionAt v rnd
let
llen = length l
res = if i == llen
then return (v !? rnd)
else if i < llen
then select i l
else select (i - llen - 1) r
in res | 659 | select i v = let len = vLen v
in case i > len of
True -> return Nothing
False ->
do
rnd <- getRandomR (0, len) :: (Rnd Int)
(l, m, r) <- return $ partitionAt v rnd
let
llen = length l
res = if i == llen
then return (v !? rnd)
else if i < llen
then select i l
else select (i - llen - 1) r
in res | 597 | false | true | 0 | 21 | 391 | 215 | 107 | 108 | null | null |
kelnage/tamarin-prover | lib/term/src/Term/Maude/Parser.hs | gpl-3.0 | parseLSortSym :: ByteString -> Maybe LSort
parseLSortSym s = case s of
"f" -> Just LSortFresh
"p" -> Just LSortPub
"c" -> Just LSortMsg
"n" -> Just LSortNode
_ -> Nothing
-- | Used to prevent clashes with predefined Maude function symbols
-- like @true@ | 283 | parseLSortSym :: ByteString -> Maybe LSort
parseLSortSym s = case s of
"f" -> Just LSortFresh
"p" -> Just LSortPub
"c" -> Just LSortMsg
"n" -> Just LSortNode
_ -> Nothing
-- | Used to prevent clashes with predefined Maude function symbols
-- like @true@ | 283 | parseLSortSym s = case s of
"f" -> Just LSortFresh
"p" -> Just LSortPub
"c" -> Just LSortMsg
"n" -> Just LSortNode
_ -> Nothing
-- | Used to prevent clashes with predefined Maude function symbols
-- like @true@ | 240 | false | true | 2 | 6 | 74 | 48 | 33 | 15 | null | null |
nvasilakis/pandoc | src/Text/Pandoc/Readers/LaTeX.hs | gpl-2.0 | acute 'i' = "í" | 15 | acute 'i' = "í" | 15 | acute 'i' = "í" | 15 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
siddhanathan/ghc | compiler/nativeGen/X86/CodeGen.hs | bsd-3-clause | -- getOperand: the operand is not required to remain valid across the
-- computation of an arbitrary expression.
getOperand :: CmmExpr -> NatM (Operand, InstrBlock)
getOperand (CmmLit lit) = do
use_sse2 <- sse2Enabled
if (use_sse2 && isSuitableFloatingPointLit lit)
then do
let CmmFloat _ w = lit
Amode addr code <- memConstant (widthInBytes w) lit
return (OpAddr addr, code)
else do
is32Bit <- is32BitPlatform
dflags <- getDynFlags
if is32BitLit is32Bit lit && not (isFloatType (cmmLitType dflags lit))
then return (OpImm (litToImm lit), nilOL)
else getOperand_generic (CmmLit lit) | 628 | getOperand :: CmmExpr -> NatM (Operand, InstrBlock)
getOperand (CmmLit lit) = do
use_sse2 <- sse2Enabled
if (use_sse2 && isSuitableFloatingPointLit lit)
then do
let CmmFloat _ w = lit
Amode addr code <- memConstant (widthInBytes w) lit
return (OpAddr addr, code)
else do
is32Bit <- is32BitPlatform
dflags <- getDynFlags
if is32BitLit is32Bit lit && not (isFloatType (cmmLitType dflags lit))
then return (OpImm (litToImm lit), nilOL)
else getOperand_generic (CmmLit lit) | 514 | getOperand (CmmLit lit) = do
use_sse2 <- sse2Enabled
if (use_sse2 && isSuitableFloatingPointLit lit)
then do
let CmmFloat _ w = lit
Amode addr code <- memConstant (widthInBytes w) lit
return (OpAddr addr, code)
else do
is32Bit <- is32BitPlatform
dflags <- getDynFlags
if is32BitLit is32Bit lit && not (isFloatType (cmmLitType dflags lit))
then return (OpImm (litToImm lit), nilOL)
else getOperand_generic (CmmLit lit) | 462 | true | true | 0 | 17 | 131 | 199 | 94 | 105 | null | null |
christiaanb/ghc | compiler/hsSyn/HsBinds.hs | bsd-3-clause | ppr_monobind :: (OutputableBndr idL, OutputableBndr idR) => HsBindLR idL idR -> SDoc
ppr_monobind (PatBind { pat_lhs = pat, pat_rhs = grhss })
= pprPatBind pat grhss | 168 | ppr_monobind :: (OutputableBndr idL, OutputableBndr idR) => HsBindLR idL idR -> SDoc
ppr_monobind (PatBind { pat_lhs = pat, pat_rhs = grhss })
= pprPatBind pat grhss | 167 | ppr_monobind (PatBind { pat_lhs = pat, pat_rhs = grhss })
= pprPatBind pat grhss | 82 | false | true | 0 | 8 | 28 | 67 | 33 | 34 | null | null |
bjpop/blip | blipcompiler/src/Blip/Compiler/Compile.hs | bsd-3-clause | compileExpr expr@(AST.Imaginary {}) =
compileConstantEmit $ constantToPyObject expr | 86 | compileExpr expr@(AST.Imaginary {}) =
compileConstantEmit $ constantToPyObject expr | 86 | compileExpr expr@(AST.Imaginary {}) =
compileConstantEmit $ constantToPyObject expr | 86 | false | false | 0 | 9 | 10 | 28 | 14 | 14 | null | null |
Kheldar/hw-koans | test/Check/Reader.hs | bsd-3-clause | prop_asks :: Property
prop_asks = property $ do
env <- forAll $ Gen.int (Range.linear 0 100)
K.runReader (K.asks (+1)) env === env + 1
K.runReader (K.asks (+1)) env === R.runReader (R.asks (+1)) env | 204 | prop_asks :: Property
prop_asks = property $ do
env <- forAll $ Gen.int (Range.linear 0 100)
K.runReader (K.asks (+1)) env === env + 1
K.runReader (K.asks (+1)) env === R.runReader (R.asks (+1)) env | 204 | prop_asks = property $ do
env <- forAll $ Gen.int (Range.linear 0 100)
K.runReader (K.asks (+1)) env === env + 1
K.runReader (K.asks (+1)) env === R.runReader (R.asks (+1)) env | 182 | false | true | 2 | 13 | 38 | 124 | 59 | 65 | null | null |
rueshyna/gogol | gogol-compute/gen/Network/Google/Resource/Compute/InstanceGroups/Insert.hs | mpl-2.0 | -- | The name of the zone where you want to create the instance group.
igiZone :: Lens' InstanceGroupsInsert Text
igiZone = lens _igiZone (\ s a -> s{_igiZone = a}) | 164 | igiZone :: Lens' InstanceGroupsInsert Text
igiZone = lens _igiZone (\ s a -> s{_igiZone = a}) | 93 | igiZone = lens _igiZone (\ s a -> s{_igiZone = a}) | 50 | true | true | 0 | 9 | 30 | 47 | 23 | 24 | null | null |
brendanhay/gogol | gogol-redis/gen/Network/Google/Redis/Types/Product.hs | mpl-2.0 | -- | Serial number, as extracted from the certificate.
tcSerialNumber :: Lens' TLSCertificate (Maybe Text)
tcSerialNumber
= lens _tcSerialNumber
(\ s a -> s{_tcSerialNumber = a}) | 186 | tcSerialNumber :: Lens' TLSCertificate (Maybe Text)
tcSerialNumber
= lens _tcSerialNumber
(\ s a -> s{_tcSerialNumber = a}) | 131 | tcSerialNumber
= lens _tcSerialNumber
(\ s a -> s{_tcSerialNumber = a}) | 79 | true | true | 1 | 9 | 33 | 51 | 25 | 26 | null | null |
phaazon/OpenGLRawgen | src/Code/ModuleCode.hs | bsd-3-clause | toDecls _ = pure [] | 47 | toDecls _ = pure [] | 47 | toDecls _ = pure [] | 47 | false | false | 0 | 6 | 32 | 14 | 6 | 8 | null | null |
Zankoku-Okuno/murex | Murex/Parser.hs | gpl-3.0 | token :: Token -> Parser ()
token t = void $ satisfy (== t) | 59 | token :: Token -> Parser ()
token t = void $ satisfy (== t) | 59 | token t = void $ satisfy (== t) | 31 | false | true | 2 | 8 | 13 | 39 | 18 | 21 | null | null |
ben-schulz/Idris-dev | src/Idris/Core/Elaborate.hs | bsd-3-clause | unifyProblems :: Elab' aux ()
unifyProblems = processTactic' UnifyProblems | 74 | unifyProblems :: Elab' aux ()
unifyProblems = processTactic' UnifyProblems | 74 | unifyProblems = processTactic' UnifyProblems | 44 | false | true | 0 | 7 | 8 | 27 | 11 | 16 | null | null |
eckyputrady/haskell-scotty-realworld-example-app | src/Feature/Article/PG.hs | mit | allTags :: PG r m => m (Set Tag)
allTags = do
results <- withConn $ \conn -> query_ conn qry
return $ setFromList $ (\(Only tag) -> tag) <$> results
where
qry = "select cast(tag as text) from (select distinct unnest(tags) as tag from articles) tags" | 259 | allTags :: PG r m => m (Set Tag)
allTags = do
results <- withConn $ \conn -> query_ conn qry
return $ setFromList $ (\(Only tag) -> tag) <$> results
where
qry = "select cast(tag as text) from (select distinct unnest(tags) as tag from articles) tags" | 259 | allTags = do
results <- withConn $ \conn -> query_ conn qry
return $ setFromList $ (\(Only tag) -> tag) <$> results
where
qry = "select cast(tag as text) from (select distinct unnest(tags) as tag from articles) tags" | 226 | false | true | 1 | 12 | 56 | 96 | 44 | 52 | null | null |
vrom911/Compiler | app/Main.hs | mit | test :: [Statement] -> IO ()
test p = do
print p
rumInterpreter p
TIO.putStrLn $ progToStr 0 p | 106 | test :: [Statement] -> IO ()
test p = do
print p
rumInterpreter p
TIO.putStrLn $ progToStr 0 p | 106 | test p = do
print p
rumInterpreter p
TIO.putStrLn $ progToStr 0 p | 77 | false | true | 0 | 8 | 30 | 52 | 23 | 29 | null | null |
andreagenso/java2scala | test/Main.hs | apache-2.0 | test "tspPC" = tspPC | 20 | test "tspPC" = tspPC | 20 | test "tspPC" = tspPC | 20 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
polarina/sdl2 | Graphics/UI/SDL/Video.hs | bsd-3-clause | setClipRect :: MonadIO m => Ptr Surface -> Ptr Rect -> m Bool
setClipRect v1 v2 = liftIO $ setClipRect' v1 v2 | 109 | setClipRect :: MonadIO m => Ptr Surface -> Ptr Rect -> m Bool
setClipRect v1 v2 = liftIO $ setClipRect' v1 v2 | 109 | setClipRect v1 v2 = liftIO $ setClipRect' v1 v2 | 47 | false | true | 0 | 8 | 21 | 49 | 22 | 27 | null | null |
mdsteele/fallback | src/Fallback/State/Tags.hs | gpl-3.0 | abilityClassAndNumber :: AbilityTag -> (CharacterClass, AbilityNumber)
abilityClassAndNumber tag = Bij.getA abilityBijection tag | 128 | abilityClassAndNumber :: AbilityTag -> (CharacterClass, AbilityNumber)
abilityClassAndNumber tag = Bij.getA abilityBijection tag | 128 | abilityClassAndNumber tag = Bij.getA abilityBijection tag | 57 | false | true | 0 | 6 | 11 | 34 | 17 | 17 | null | null |
pmiddend/jumpie | lib/Jumpie/Game.hs | gpl-3.0 | processPlatforms :: (Monad m,MonadIO m,Applicative m,MonadGame m,MonadState GameState m,MonadWriter [OutgoingAction] m) => ObjectProcessor m Platforms
processPlatforms actions section = do
platformsWithObjects <- traverse (processPlatform actions) section
let
platforms = catMaybes (fst <$> platformsWithObjects)
objects = concatMap snd platformsWithObjects
return (if null platforms then Nothing else Just platforms,objects) | 439 | processPlatforms :: (Monad m,MonadIO m,Applicative m,MonadGame m,MonadState GameState m,MonadWriter [OutgoingAction] m) => ObjectProcessor m Platforms
processPlatforms actions section = do
platformsWithObjects <- traverse (processPlatform actions) section
let
platforms = catMaybes (fst <$> platformsWithObjects)
objects = concatMap snd platformsWithObjects
return (if null platforms then Nothing else Just platforms,objects) | 439 | processPlatforms actions section = do
platformsWithObjects <- traverse (processPlatform actions) section
let
platforms = catMaybes (fst <$> platformsWithObjects)
objects = concatMap snd platformsWithObjects
return (if null platforms then Nothing else Just platforms,objects) | 288 | false | true | 0 | 13 | 60 | 145 | 70 | 75 | null | null |
grandpascorpion/canon | Math/NumberTheory/Canon.hs | gpl-3.0 | -- Convert Canon To Double.
cToD :: Canon -> Double
cToD (Bare i _) = fromIntegral i | 84 | cToD :: Canon -> Double
cToD (Bare i _) = fromIntegral i | 56 | cToD (Bare i _) = fromIntegral i | 32 | true | true | 0 | 7 | 16 | 30 | 15 | 15 | null | null |
siddhanathan/ghc | testsuite/tests/rename/should_compile/timing001.hs | bsd-3-clause | a349 = a350 | 11 | a349 = a350 | 11 | a349 = a350 | 11 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
flowbox-public/imagemagick | Graphics/ImageMagick/MagickWand/PixelWand.hs | apache-2.0 | getHSL :: (MonadResource m) => PPixelWand -> m (Double, Double, Double)
getHSL w = liftIO $ fmap (map3 realToFrac) (with3 (F.pixelGetHSL w)) | 140 | getHSL :: (MonadResource m) => PPixelWand -> m (Double, Double, Double)
getHSL w = liftIO $ fmap (map3 realToFrac) (with3 (F.pixelGetHSL w)) | 140 | getHSL w = liftIO $ fmap (map3 realToFrac) (with3 (F.pixelGetHSL w)) | 68 | false | true | 2 | 10 | 21 | 73 | 36 | 37 | null | null |
McCraeAndrew/cpi-ide | CPi/Signals.hs | gpl-3.0 | -- until
test15 = decomposeSig tSigP == [tSigP1,tSigP2] | 55 | test15 = decomposeSig tSigP == [tSigP1,tSigP2] | 46 | test15 = decomposeSig tSigP == [tSigP1,tSigP2] | 46 | true | false | 0 | 6 | 7 | 20 | 11 | 9 | null | null |
mhwombat/backprop-example | MatrixPlus.hs | bsd-3-clause | magnitude :: (Field a, Floating a)
=> Matrix a
-> a
magnitude x =
if cols x == 1
then sqrt (sum xsxs)
else error "not a column vector"
where xs = toList (flatten x)
xsxs = zipWith (*) xs xs | 214 | magnitude :: (Field a, Floating a)
=> Matrix a
-> a
magnitude x =
if cols x == 1
then sqrt (sum xsxs)
else error "not a column vector"
where xs = toList (flatten x)
xsxs = zipWith (*) xs xs | 214 | magnitude x =
if cols x == 1
then sqrt (sum xsxs)
else error "not a column vector"
where xs = toList (flatten x)
xsxs = zipWith (*) xs xs | 158 | false | true | 0 | 9 | 65 | 95 | 47 | 48 | null | null |
jml/graphql-api | src/GraphQL/Internal/Syntax/Parser.hs | bsd-3-clause | objectTypeDefinition :: Parser AST.ObjectTypeDefinition
objectTypeDefinition = AST.ObjectTypeDefinition
<$ tok "type"
<*> nameParser
<*> optempty interfaces
<*> fieldDefinitions | 186 | objectTypeDefinition :: Parser AST.ObjectTypeDefinition
objectTypeDefinition = AST.ObjectTypeDefinition
<$ tok "type"
<*> nameParser
<*> optempty interfaces
<*> fieldDefinitions | 186 | objectTypeDefinition = AST.ObjectTypeDefinition
<$ tok "type"
<*> nameParser
<*> optempty interfaces
<*> fieldDefinitions | 130 | false | true | 12 | 6 | 25 | 54 | 25 | 29 | null | null |
s9gf4ult/hdbi | Database/HDBI/SqlValue.hs | bsd-3-clause | wrongSqlList :: [SqlValue] -- ^ given list of SqlValues
-> Int -- ^ expected length of list
-> Either ConvertError a
wrongSqlList x c = Left $ ConvertError
$ "Wrong count of SqlValues: " ++ (show $ length x)
++ " but expected: " ++ (show c) | 310 | wrongSqlList :: [SqlValue] -- ^ given list of SqlValues
-> Int -- ^ expected length of list
-> Either ConvertError a
wrongSqlList x c = Left $ ConvertError
$ "Wrong count of SqlValues: " ++ (show $ length x)
++ " but expected: " ++ (show c) | 310 | wrongSqlList x c = Left $ ConvertError
$ "Wrong count of SqlValues: " ++ (show $ length x)
++ " but expected: " ++ (show c) | 161 | false | true | 0 | 10 | 116 | 70 | 36 | 34 | null | null |
adamse/hindent | src/HIndent/Pretty.hs | bsd-3-clause | decl (SpliceDecl _ e) = pretty e | 32 | decl (SpliceDecl _ e) = pretty e | 32 | decl (SpliceDecl _ e) = pretty e | 32 | false | false | 0 | 6 | 6 | 21 | 9 | 12 | null | null |
siddhanathan/yi | yi-core/src/Yi/Completion.hs | gpl-2.0 | -- | Complete a string given a user input string, a matching function
-- and a list of possibilites. Matching function should return the
-- part of the string that matches the user string.
completeInList :: T.Text -- ^ Input to match on
-> (T.Text -> Maybe T.Text) -- ^ matcher function
-> [T.Text] -- ^ items to match against
-> EditorM T.Text
completeInList = completeInListCustomShow id | 434 | completeInList :: T.Text -- ^ Input to match on
-> (T.Text -> Maybe T.Text) -- ^ matcher function
-> [T.Text] -- ^ items to match against
-> EditorM T.Text
completeInList = completeInListCustomShow id | 245 | completeInList = completeInListCustomShow id | 44 | true | true | 0 | 10 | 111 | 58 | 32 | 26 | null | null |
tolysz/hs-tls | core/Benchmarks/Benchmarks.hs | bsd-3-clause | recvDataNonNull ctx = recvData ctx >>= \l -> if B.null l then recvDataNonNull ctx else return l | 95 | recvDataNonNull ctx = recvData ctx >>= \l -> if B.null l then recvDataNonNull ctx else return l | 95 | recvDataNonNull ctx = recvData ctx >>= \l -> if B.null l then recvDataNonNull ctx else return l | 95 | false | false | 0 | 9 | 16 | 40 | 19 | 21 | null | null |
owainlewis/daenerys | app/Main.hs | mit | runProgram :: String -> IO ()
runProgram f = do
request <- readRequest f
case request of
Just r -> print . rCode =<< runRequest r
Nothing -> pure () | 161 | runProgram :: String -> IO ()
runProgram f = do
request <- readRequest f
case request of
Just r -> print . rCode =<< runRequest r
Nothing -> pure () | 161 | runProgram f = do
request <- readRequest f
case request of
Just r -> print . rCode =<< runRequest r
Nothing -> pure () | 131 | false | true | 0 | 11 | 42 | 71 | 32 | 39 | null | null |
fpco/serial-bench | binary-0.4.3.1/tests/NewBinary.hs | bsd-3-clause | getByteNoBits :: BinHandle -> IO Word8
getByteNoBits h@(BinMem ix_r sz_r arr_r _ _) = do
ix <- readFastMutInt ix_r
sz <- readFastMutInt sz_r
when (ix >= sz) $
throw (IOException $ mkIOError eofErrorType "Data.Binary.getWord8" Nothing Nothing)
arr <- readIORef arr_r
w <- unsafeRead arr ix
writeFastMutInt ix_r (ix+1)
return w | 362 | getByteNoBits :: BinHandle -> IO Word8
getByteNoBits h@(BinMem ix_r sz_r arr_r _ _) = do
ix <- readFastMutInt ix_r
sz <- readFastMutInt sz_r
when (ix >= sz) $
throw (IOException $ mkIOError eofErrorType "Data.Binary.getWord8" Nothing Nothing)
arr <- readIORef arr_r
w <- unsafeRead arr ix
writeFastMutInt ix_r (ix+1)
return w | 362 | getByteNoBits h@(BinMem ix_r sz_r arr_r _ _) = do
ix <- readFastMutInt ix_r
sz <- readFastMutInt sz_r
when (ix >= sz) $
throw (IOException $ mkIOError eofErrorType "Data.Binary.getWord8" Nothing Nothing)
arr <- readIORef arr_r
w <- unsafeRead arr ix
writeFastMutInt ix_r (ix+1)
return w | 323 | false | true | 1 | 12 | 86 | 145 | 63 | 82 | null | null |
ddssff/lens | src/Control/Lens/Fold.hs | bsd-3-clause | -- | The 'lookupOf' function takes a 'Fold' (or 'Getter', 'Traversal',
-- 'Lens', 'Iso', etc.), a key, and a structure containing key/value pairs.
-- It returns the first value corresponding to the given key. This function
-- generalizes 'lookup' to work on an arbitrary 'Fold' instead of lists.
--
-- >>> lookupOf folded 4 [(2, 'a'), (4, 'b'), (4, 'c')]
-- Just 'b'
--
-- >>> lookupOf each 2 [(2, 'a'), (4, 'b'), (4, 'c')]
-- Just 'a'
--
-- @
-- 'lookupOf' :: 'Eq' k => 'Fold' s (k,v) -> k -> s -> 'Maybe' v
-- @
lookupOf :: Eq k => Getting (Endo (Maybe v)) s (k,v) -> k -> s -> Maybe v
lookupOf l k = foldrOf l (\(k',v) next -> if k == k' then Just v else next) Nothing | 671 | lookupOf :: Eq k => Getting (Endo (Maybe v)) s (k,v) -> k -> s -> Maybe v
lookupOf l k = foldrOf l (\(k',v) next -> if k == k' then Just v else next) Nothing | 157 | lookupOf l k = foldrOf l (\(k',v) next -> if k == k' then Just v else next) Nothing | 83 | true | true | 0 | 11 | 135 | 115 | 66 | 49 | null | null |
grantslatton/JustParse | src/Data/JustParse/Combinator.hs | unlicense | -- | Synonym of 'count'.
exactly :: Stream s t => Int -> Parser s a -> Parser s [a]
exactly n = mN n n | 102 | exactly :: Stream s t => Int -> Parser s a -> Parser s [a]
exactly n = mN n n | 77 | exactly n = mN n n | 18 | true | true | 0 | 10 | 25 | 56 | 25 | 31 | null | null |
mniip/h6502 | src/H6502/Util.hs | mit | addrZeroPageY :: Monad m => H6502T m Word16
addrZeroPageY = do
imm <- peekPC
y <- getY
return (onZeroPage $ imm + y)
-- | Absolute addressing mode: read a word from the instruction, and use it as an address | 219 | addrZeroPageY :: Monad m => H6502T m Word16
addrZeroPageY = do
imm <- peekPC
y <- getY
return (onZeroPage $ imm + y)
-- | Absolute addressing mode: read a word from the instruction, and use it as an address | 219 | addrZeroPageY = do
imm <- peekPC
y <- getY
return (onZeroPage $ imm + y)
-- | Absolute addressing mode: read a word from the instruction, and use it as an address | 175 | false | true | 0 | 10 | 52 | 55 | 26 | 29 | null | null |
blancas/trex | src/Util.hs | mit | alphaRegex = getRegex "[a-zA-Z]+" | 33 | alphaRegex = getRegex "[a-zA-Z]+" | 33 | alphaRegex = getRegex "[a-zA-Z]+" | 33 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
rueshyna/gogol | gogol-doubleclick-search/gen/Network/Google/DoubleClickSearch/Types/Product.hs | mpl-2.0 | -- | Custom dimensions for the conversion, which can be used to filter data
-- in a report.
cCustomDimension :: Lens' Conversion [CustomDimension]
cCustomDimension
= lens _cCustomDimension
(\ s a -> s{_cCustomDimension = a})
. _Default
. _Coerce | 265 | cCustomDimension :: Lens' Conversion [CustomDimension]
cCustomDimension
= lens _cCustomDimension
(\ s a -> s{_cCustomDimension = a})
. _Default
. _Coerce | 173 | cCustomDimension
= lens _cCustomDimension
(\ s a -> s{_cCustomDimension = a})
. _Default
. _Coerce | 118 | true | true | 3 | 8 | 57 | 59 | 29 | 30 | null | null |
apyrgio/snf-ganeti | test/hs/Test/Ganeti/Hypervisor/Xen/XmParser.hs | bsd-2-clause | serializeConf (LCDouble d) = show d | 35 | serializeConf (LCDouble d) = show d | 35 | serializeConf (LCDouble d) = show d | 35 | false | false | 0 | 6 | 5 | 19 | 8 | 11 | null | null |
duplode/stack | src/Stack/Build/ConstructPlan.hs | bsd-3-clause | stripLocals :: Plan -> Plan
stripLocals plan = plan
{ planTasks = Map.filter checkTask $ planTasks plan
, planFinals = Map.empty
, planUnregisterLocal = Map.empty
, planInstallExes = Map.filter (/= Local) $ planInstallExes plan
}
where
checkTask task =
case taskType task of
TTLocal _ -> False
TTUpstream _ Local -> False
TTUpstream _ Snap -> True | 417 | stripLocals :: Plan -> Plan
stripLocals plan = plan
{ planTasks = Map.filter checkTask $ planTasks plan
, planFinals = Map.empty
, planUnregisterLocal = Map.empty
, planInstallExes = Map.filter (/= Local) $ planInstallExes plan
}
where
checkTask task =
case taskType task of
TTLocal _ -> False
TTUpstream _ Local -> False
TTUpstream _ Snap -> True | 417 | stripLocals plan = plan
{ planTasks = Map.filter checkTask $ planTasks plan
, planFinals = Map.empty
, planUnregisterLocal = Map.empty
, planInstallExes = Map.filter (/= Local) $ planInstallExes plan
}
where
checkTask task =
case taskType task of
TTLocal _ -> False
TTUpstream _ Local -> False
TTUpstream _ Snap -> True | 389 | false | true | 0 | 9 | 126 | 129 | 64 | 65 | null | null |
mishun/tangles | src/Math/Topology/KnotTh/Tangle.hs | lgpl-3.0 | conwayRamification :: (MirrorAction a) => Tangle4 a -> Tangle4 a -> Tangle4 a
conwayRamification a = conwaySum (conwayRecip a) . conwayRecip | 140 | conwayRamification :: (MirrorAction a) => Tangle4 a -> Tangle4 a -> Tangle4 a
conwayRamification a = conwaySum (conwayRecip a) . conwayRecip | 140 | conwayRamification a = conwaySum (conwayRecip a) . conwayRecip | 62 | false | true | 0 | 9 | 20 | 58 | 26 | 32 | null | null |
mvdan/hint | src/Hint/Base.hs | bsd-3-clause | debug :: MonadInterpreter m => String -> m ()
debug = liftIO . putStrLn . ("!! " ++) | 84 | debug :: MonadInterpreter m => String -> m ()
debug = liftIO . putStrLn . ("!! " ++) | 84 | debug = liftIO . putStrLn . ("!! " ++) | 38 | false | true | 2 | 9 | 17 | 47 | 21 | 26 | null | null |
ScrambledEggsOnToast/Kachushi | Kachushi/OFCP.hs | mit | iisToLs :: Int -> (Int, Int, Int) -> [Int]
iisToLs n (a,b,s) = map (\n -> if n == a then s
else if n == b then (-s)
else 0) [0 .. n-1] | 189 | iisToLs :: Int -> (Int, Int, Int) -> [Int]
iisToLs n (a,b,s) = map (\n -> if n == a then s
else if n == b then (-s)
else 0) [0 .. n-1] | 189 | iisToLs n (a,b,s) = map (\n -> if n == a then s
else if n == b then (-s)
else 0) [0 .. n-1] | 146 | false | true | 0 | 11 | 88 | 97 | 56 | 41 | null | null |
Gwin73/Schemini | src/one-file-version/Schemini.hs | mit | printLine badArgs = throwError $ NumArgs 1 badArgs | 50 | printLine badArgs = throwError $ NumArgs 1 badArgs | 50 | printLine badArgs = throwError $ NumArgs 1 badArgs | 50 | false | false | 0 | 6 | 7 | 18 | 8 | 10 | null | null |
csrhodes/pandoc | src/Text/Pandoc/Readers/LaTeX.hs | gpl-2.0 | addPrefix _ _ = [] | 18 | addPrefix _ _ = [] | 18 | addPrefix _ _ = [] | 18 | false | false | 1 | 6 | 4 | 14 | 6 | 8 | null | null |
beni55/hermit | src/HERMIT/Dictionary/WorkerWrapper/FixResult.hs | bsd-2-clause | -- | @abs (rep (f h x))@ \<==\> @f h x@
wwResultAssB :: Maybe (RewriteH CoreExpr) -- ^ WW Assumption B
-> CoreExpr -- ^ abs
-> CoreExpr -- ^ rep
-> CoreExpr -- ^ f
-> BiRewriteH CoreExpr
wwResultAssB mr abs rep f = beforeBiR (whenJust (verifyAssB abs rep f) mr)
(\ () -> bidirectional wwBL wwBR)
where
assA :: BiRewriteH CoreExpr
assA = wwResultAssA Nothing abs rep
wwBL :: RewriteH CoreExpr
wwBL = withPatFailMsg (wrongExprForm "abs (rep (f h x))") $
do App _ (App _ (App (App f' _) _)) <- idR
guardMsg (exprAlphaEq f f') "given body function does not match expression."
forwardT assA
wwBR :: RewriteH CoreExpr
wwBR = withPatFailMsg (wrongExprForm "f h x") $
do App (App f' _) _ <- idR
guardMsg (exprAlphaEq f f') "given body function does not match expression."
backwardT assA
-- | @abs (rep (f h x))@ \<==\> @f h x@ | 1,040 | wwResultAssB :: Maybe (RewriteH CoreExpr) -- ^ WW Assumption B
-> CoreExpr -- ^ abs
-> CoreExpr -- ^ rep
-> CoreExpr -- ^ f
-> BiRewriteH CoreExpr
wwResultAssB mr abs rep f = beforeBiR (whenJust (verifyAssB abs rep f) mr)
(\ () -> bidirectional wwBL wwBR)
where
assA :: BiRewriteH CoreExpr
assA = wwResultAssA Nothing abs rep
wwBL :: RewriteH CoreExpr
wwBL = withPatFailMsg (wrongExprForm "abs (rep (f h x))") $
do App _ (App _ (App (App f' _) _)) <- idR
guardMsg (exprAlphaEq f f') "given body function does not match expression."
forwardT assA
wwBR :: RewriteH CoreExpr
wwBR = withPatFailMsg (wrongExprForm "f h x") $
do App (App f' _) _ <- idR
guardMsg (exprAlphaEq f f') "given body function does not match expression."
backwardT assA
-- | @abs (rep (f h x))@ \<==\> @f h x@ | 998 | wwResultAssB mr abs rep f = beforeBiR (whenJust (verifyAssB abs rep f) mr)
(\ () -> bidirectional wwBL wwBR)
where
assA :: BiRewriteH CoreExpr
assA = wwResultAssA Nothing abs rep
wwBL :: RewriteH CoreExpr
wwBL = withPatFailMsg (wrongExprForm "abs (rep (f h x))") $
do App _ (App _ (App (App f' _) _)) <- idR
guardMsg (exprAlphaEq f f') "given body function does not match expression."
forwardT assA
wwBR :: RewriteH CoreExpr
wwBR = withPatFailMsg (wrongExprForm "f h x") $
do App (App f' _) _ <- idR
guardMsg (exprAlphaEq f f') "given body function does not match expression."
backwardT assA
-- | @abs (rep (f h x))@ \<==\> @f h x@ | 772 | true | true | 1 | 15 | 373 | 285 | 132 | 153 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.