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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tattsun/stock
|
src/Stock/Types/DateTime.hs
|
mit
|
getFirstDayOfMonth :: Int -> Int -> UnixTime
getFirstDayOfMonth year month = parseToTime (concat $ [show year, "-", show month, "-01 00:00:00"])
| 144 |
getFirstDayOfMonth :: Int -> Int -> UnixTime
getFirstDayOfMonth year month = parseToTime (concat $ [show year, "-", show month, "-01 00:00:00"])
| 144 |
getFirstDayOfMonth year month = parseToTime (concat $ [show year, "-", show month, "-01 00:00:00"])
| 99 | false | true | 0 | 9 | 20 | 52 | 27 | 25 | null | null |
ekmett/containers
|
Data/Set/Base.hs
|
bsd-3-clause
|
-- The balance function is equivalent to the following:
--
-- balance :: a -> Set a -> Set a -> Set a
-- balance x l r
-- | sizeL + sizeR <= 1 = Bin sizeX x l r
-- | sizeR > delta*sizeL = rotateL x l r
-- | sizeL > delta*sizeR = rotateR x l r
-- | otherwise = Bin sizeX x l r
-- where
-- sizeL = size l
-- sizeR = size r
-- sizeX = sizeL + sizeR + 1
--
-- rotateL :: a -> Set a -> Set a -> Set a
-- rotateL x l r@(Bin _ _ ly ry) | size ly < ratio*size ry = singleL x l r
-- | otherwise = doubleL x l r
-- rotateR :: a -> Set a -> Set a -> Set a
-- rotateR x l@(Bin _ _ ly ry) r | size ry < ratio*size ly = singleR x l r
-- | otherwise = doubleR x l r
--
-- singleL, singleR :: a -> Set a -> Set a -> Set a
-- singleL x1 t1 (Bin _ x2 t2 t3) = bin x2 (bin x1 t1 t2) t3
-- singleR x1 (Bin _ x2 t1 t2) t3 = bin x2 t1 (bin x1 t2 t3)
--
-- doubleL, doubleR :: a -> Set a -> Set a -> Set a
-- doubleL x1 t1 (Bin _ x2 (Bin _ x3 t2 t3) t4) = bin x3 (bin x1 t1 t2) (bin x2 t3 t4)
-- doubleR x1 (Bin _ x2 t1 (Bin _ x3 t2 t3)) t4 = bin x3 (bin x2 t1 t2) (bin x1 t3 t4)
--
-- It is only written in such a way that every node is pattern-matched only once.
--
-- Only balanceL and balanceR are needed at the moment, so balance is not here anymore.
-- In case it is needed, it can be found in Data.Map.
-- Functions balanceL and balanceR are specialised versions of balance.
-- balanceL only checks whether the left subtree is too big,
-- balanceR only checks whether the right subtree is too big.
-- balanceL is called when left subtree might have been inserted to or when
-- right subtree might have been deleted from.
balanceL :: a -> Set a -> Set a -> Set a
balanceL x l r = case r of
Tip -> case l of
Tip -> Bin 1 x Tip Tip
(Bin _ _ Tip Tip) -> Bin 2 x l Tip
(Bin _ lx Tip (Bin _ lrx _ _)) -> Bin 3 lrx (Bin 1 lx Tip Tip) (Bin 1 x Tip Tip)
(Bin _ lx ll@(Bin _ _ _ _) Tip) -> Bin 3 lx ll (Bin 1 x Tip Tip)
(Bin ls lx ll@(Bin lls _ _ _) lr@(Bin lrs lrx lrl lrr))
| lrs < ratio*lls -> Bin (1+ls) lx ll (Bin (1+lrs) x lr Tip)
| otherwise -> Bin (1+ls) lrx (Bin (1+lls+size lrl) lx ll lrl) (Bin (1+size lrr) x lrr Tip)
(Bin rs _ _ _) -> case l of
Tip -> Bin (1+rs) x Tip r
(Bin ls lx ll lr)
| ls > delta*rs -> case (ll, lr) of
(Bin lls _ _ _, Bin lrs lrx lrl lrr)
| lrs < ratio*lls -> Bin (1+ls+rs) lx ll (Bin (1+rs+lrs) x lr r)
| otherwise -> Bin (1+ls+rs) lrx (Bin (1+lls+size lrl) lx ll lrl) (Bin (1+rs+size lrr) x lrr r)
(_, _) -> error "Failure in Data.Map.balanceL"
| otherwise -> Bin (1+ls+rs) x l r
| 2,882 |
balanceL :: a -> Set a -> Set a -> Set a
balanceL x l r = case r of
Tip -> case l of
Tip -> Bin 1 x Tip Tip
(Bin _ _ Tip Tip) -> Bin 2 x l Tip
(Bin _ lx Tip (Bin _ lrx _ _)) -> Bin 3 lrx (Bin 1 lx Tip Tip) (Bin 1 x Tip Tip)
(Bin _ lx ll@(Bin _ _ _ _) Tip) -> Bin 3 lx ll (Bin 1 x Tip Tip)
(Bin ls lx ll@(Bin lls _ _ _) lr@(Bin lrs lrx lrl lrr))
| lrs < ratio*lls -> Bin (1+ls) lx ll (Bin (1+lrs) x lr Tip)
| otherwise -> Bin (1+ls) lrx (Bin (1+lls+size lrl) lx ll lrl) (Bin (1+size lrr) x lrr Tip)
(Bin rs _ _ _) -> case l of
Tip -> Bin (1+rs) x Tip r
(Bin ls lx ll lr)
| ls > delta*rs -> case (ll, lr) of
(Bin lls _ _ _, Bin lrs lrx lrl lrr)
| lrs < ratio*lls -> Bin (1+ls+rs) lx ll (Bin (1+rs+lrs) x lr r)
| otherwise -> Bin (1+ls+rs) lrx (Bin (1+lls+size lrl) lx ll lrl) (Bin (1+rs+size lrr) x lrr r)
(_, _) -> error "Failure in Data.Map.balanceL"
| otherwise -> Bin (1+ls+rs) x l r
| 1,104 |
balanceL x l r = case r of
Tip -> case l of
Tip -> Bin 1 x Tip Tip
(Bin _ _ Tip Tip) -> Bin 2 x l Tip
(Bin _ lx Tip (Bin _ lrx _ _)) -> Bin 3 lrx (Bin 1 lx Tip Tip) (Bin 1 x Tip Tip)
(Bin _ lx ll@(Bin _ _ _ _) Tip) -> Bin 3 lx ll (Bin 1 x Tip Tip)
(Bin ls lx ll@(Bin lls _ _ _) lr@(Bin lrs lrx lrl lrr))
| lrs < ratio*lls -> Bin (1+ls) lx ll (Bin (1+lrs) x lr Tip)
| otherwise -> Bin (1+ls) lrx (Bin (1+lls+size lrl) lx ll lrl) (Bin (1+size lrr) x lrr Tip)
(Bin rs _ _ _) -> case l of
Tip -> Bin (1+rs) x Tip r
(Bin ls lx ll lr)
| ls > delta*rs -> case (ll, lr) of
(Bin lls _ _ _, Bin lrs lrx lrl lrr)
| lrs < ratio*lls -> Bin (1+ls+rs) lx ll (Bin (1+rs+lrs) x lr r)
| otherwise -> Bin (1+ls+rs) lrx (Bin (1+lls+size lrl) lx ll lrl) (Bin (1+rs+size lrr) x lrr r)
(_, _) -> error "Failure in Data.Map.balanceL"
| otherwise -> Bin (1+ls+rs) x l r
| 1,063 | true | true | 0 | 21 | 993 | 721 | 374 | 347 | null | null |
bitemyapp/ganeti
|
src/Ganeti/OpParams.hs
|
bsd-2-clause
|
-- | Custom deserialiser for 'SetParamsMods'.
readSetParams :: (JSON a) => JSValue -> Text.JSON.Result (SetParamsMods a)
readSetParams (JSArray []) = return SetParamsEmpty
| 171 |
readSetParams :: (JSON a) => JSValue -> Text.JSON.Result (SetParamsMods a)
readSetParams (JSArray []) = return SetParamsEmpty
| 125 |
readSetParams (JSArray []) = return SetParamsEmpty
| 50 | true | true | 0 | 9 | 21 | 51 | 26 | 25 | null | null |
graninas/Andromeda
|
src/Andromeda/Types/Physics/Temperature.hs
|
bsd-3-clause
|
toPascal :: Float -> Measurement Pascal
toPascal = Measurement . floatValue
| 75 |
toPascal :: Float -> Measurement Pascal
toPascal = Measurement . floatValue
| 75 |
toPascal = Measurement . floatValue
| 35 | false | true | 0 | 7 | 10 | 28 | 12 | 16 | null | null |
haroldcarr/learn-haskell-coq-ml-etc
|
haskell/topic/monads/wiki-haskell-org_all-about-monads/src/Wiki_haskell_org_all_about_monads.hs
|
unlicense
|
ms3 = U.t "ms3" (lookupVar "var2" [[("var1","value1"),("var2","value2*")]
,[("var2","value2"),("var3","value3")]])
(Just "value2*")
| 183 |
ms3 = U.t "ms3" (lookupVar "var2" [[("var1","value1"),("var2","value2*")]
,[("var2","value2"),("var3","value3")]])
(Just "value2*")
| 183 |
ms3 = U.t "ms3" (lookupVar "var2" [[("var1","value1"),("var2","value2*")]
,[("var2","value2"),("var3","value3")]])
(Just "value2*")
| 183 | false | false | 1 | 9 | 61 | 76 | 42 | 34 | null | null |
fmapfmapfmap/amazonka
|
amazonka-route53/gen/Network/AWS/Route53/DisassociateVPCFromHostedZone.hs
|
mpl-2.0
|
-- | A complex type that contains the ID, the status, and the date and time
-- of your 'DisassociateVPCFromHostedZoneRequest'.
dvfhzrsChangeInfo :: Lens' DisassociateVPCFromHostedZoneResponse ChangeInfo
dvfhzrsChangeInfo = lens _dvfhzrsChangeInfo (\ s a -> s{_dvfhzrsChangeInfo = a})
| 283 |
dvfhzrsChangeInfo :: Lens' DisassociateVPCFromHostedZoneResponse ChangeInfo
dvfhzrsChangeInfo = lens _dvfhzrsChangeInfo (\ s a -> s{_dvfhzrsChangeInfo = a})
| 156 |
dvfhzrsChangeInfo = lens _dvfhzrsChangeInfo (\ s a -> s{_dvfhzrsChangeInfo = a})
| 80 | true | true | 1 | 9 | 35 | 44 | 23 | 21 | null | null |
zachsully/hakaru
|
haskell/Tests/Array.hs
|
bsd-3-clause
|
-- A plate full of diracs is a pure vector
testPlateDirac :: Assertion
testPlateDirac = testSS [plateDirac] plateDirac'
| 119 |
testPlateDirac :: Assertion
testPlateDirac = testSS [plateDirac] plateDirac'
| 76 |
testPlateDirac = testSS [plateDirac] plateDirac'
| 48 | true | true | 0 | 6 | 17 | 26 | 12 | 14 | null | null |
maarons/Cortex
|
Ariel/Proxy.hs
|
agpl-3.0
|
-----
reload :: [LBS.ByteString] -> GrandMonadStack ()
reload instances = do
{ iPrintLog "Instance change detected, reloading"
; let apps = makeApps instances Map.empty
; conf <- makeConf apps
; (_, path, _) <- get
; iWriteFile path conf
; pid <- (liftM $ LBS.takeWhile (/= '\n')) $ iReadFile (path ++ ".pid")
; iRawSystem "kill" ["-HUP", LBS.unpack pid]
}
| 389 |
reload :: [LBS.ByteString] -> GrandMonadStack ()
reload instances = do
{ iPrintLog "Instance change detected, reloading"
; let apps = makeApps instances Map.empty
; conf <- makeConf apps
; (_, path, _) <- get
; iWriteFile path conf
; pid <- (liftM $ LBS.takeWhile (/= '\n')) $ iReadFile (path ++ ".pid")
; iRawSystem "kill" ["-HUP", LBS.unpack pid]
}
| 382 |
reload instances = do
{ iPrintLog "Instance change detected, reloading"
; let apps = makeApps instances Map.empty
; conf <- makeConf apps
; (_, path, _) <- get
; iWriteFile path conf
; pid <- (liftM $ LBS.takeWhile (/= '\n')) $ iReadFile (path ++ ".pid")
; iRawSystem "kill" ["-HUP", LBS.unpack pid]
}
| 333 | true | true | 0 | 13 | 91 | 154 | 77 | 77 | null | null |
facebookincubator/duckling
|
Duckling/Time/Helpers.hs
|
bsd-3-clause
|
getIntValue _ = Nothing
| 23 |
getIntValue _ = Nothing
| 23 |
getIntValue _ = Nothing
| 23 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
ki11men0w/delphi-lint
|
src/ParsecSql.hs
|
bsd-3-clause
|
sqlBlockComment :: CharParser st String
sqlBlockComment = do
string start <?> "block comment start \"/*\""
s1 <- manyTill anyChar (try $ lookAhead $ string end)
string end <?> "block comment end \"*/\""
return $ start ++ dropEndLineSpaces s1 ++ end
where
start = "/*"
end = "*/"
| 298 |
sqlBlockComment :: CharParser st String
sqlBlockComment = do
string start <?> "block comment start \"/*\""
s1 <- manyTill anyChar (try $ lookAhead $ string end)
string end <?> "block comment end \"*/\""
return $ start ++ dropEndLineSpaces s1 ++ end
where
start = "/*"
end = "*/"
| 298 |
sqlBlockComment = do
string start <?> "block comment start \"/*\""
s1 <- manyTill anyChar (try $ lookAhead $ string end)
string end <?> "block comment end \"*/\""
return $ start ++ dropEndLineSpaces s1 ++ end
where
start = "/*"
end = "*/"
| 258 | false | true | 1 | 11 | 66 | 95 | 43 | 52 | null | null |
bgold-cosmos/Tidal
|
src/Sound/Tidal/Params.hs
|
gpl-3.0
|
lfoshapeTake :: String -> [Double] -> ControlPattern
lfoshapeTake name xs = pStateListF "lfoshape" name xs
| 106 |
lfoshapeTake :: String -> [Double] -> ControlPattern
lfoshapeTake name xs = pStateListF "lfoshape" name xs
| 106 |
lfoshapeTake name xs = pStateListF "lfoshape" name xs
| 53 | false | true | 0 | 8 | 14 | 42 | 18 | 24 | null | null |
rueshyna/gogol
|
gogol-play-moviespartner/gen/Network/Google/Resource/PlayMoviesPartner/Accounts/Avails/List.hs
|
mpl-2.0
|
-- | Pretty-print response.
aalPp :: Lens' AccountsAvailsList Bool
aalPp = lens _aalPp (\ s a -> s{_aalPp = a})
| 111 |
aalPp :: Lens' AccountsAvailsList Bool
aalPp = lens _aalPp (\ s a -> s{_aalPp = a})
| 83 |
aalPp = lens _aalPp (\ s a -> s{_aalPp = a})
| 44 | true | true | 0 | 9 | 19 | 40 | 22 | 18 | null | null |
probcomp/haxcat
|
Types.hs
|
apache-2.0
|
view_cluster_reinc :: RowID -> ClusterID -> View a -> View a
view_cluster_reinc r_id cluster_id v@View{view_partition = vp} =
v{view_partition = vp'} where
vp' = crp_seq_reinc r_id cluster_id vp
-- Treats extra columns in the Row correctly, namely by ignoring them.
-- TODO Tweak to ignore missing columns in the Row also (at fromJust)
-- TODO For possible uncollapsed columns, should probably accept a
-- candidate new cluster.
| 441 |
view_cluster_reinc :: RowID -> ClusterID -> View a -> View a
view_cluster_reinc r_id cluster_id v@View{view_partition = vp} =
v{view_partition = vp'} where
vp' = crp_seq_reinc r_id cluster_id vp
-- Treats extra columns in the Row correctly, namely by ignoring them.
-- TODO Tweak to ignore missing columns in the Row also (at fromJust)
-- TODO For possible uncollapsed columns, should probably accept a
-- candidate new cluster.
| 441 |
view_cluster_reinc r_id cluster_id v@View{view_partition = vp} =
v{view_partition = vp'} where
vp' = crp_seq_reinc r_id cluster_id vp
-- Treats extra columns in the Row correctly, namely by ignoring them.
-- TODO Tweak to ignore missing columns in the Row also (at fromJust)
-- TODO For possible uncollapsed columns, should probably accept a
-- candidate new cluster.
| 380 | false | true | 4 | 10 | 79 | 75 | 38 | 37 | null | null |
PiffNP/HaskellProject
|
src/WhileParser.hs
|
bsd-3-clause
|
expression :: Parser Expr
expression = constExpr
<|> liftM Var identifier
<|> try (parens makePairExpr)
<|> try (parens takeFstExpr)
<|> try (parens takeSndExpr)
<|> try (parens arrayEntryExpr)
<|> try (parens aExpr)
<|> try (parens bExpr)
<|> try (parens rExpr)
<|> try (parens letExpr)
<|> try (parens callExpr)
| 422 |
expression :: Parser Expr
expression = constExpr
<|> liftM Var identifier
<|> try (parens makePairExpr)
<|> try (parens takeFstExpr)
<|> try (parens takeSndExpr)
<|> try (parens arrayEntryExpr)
<|> try (parens aExpr)
<|> try (parens bExpr)
<|> try (parens rExpr)
<|> try (parens letExpr)
<|> try (parens callExpr)
| 422 |
expression = constExpr
<|> liftM Var identifier
<|> try (parens makePairExpr)
<|> try (parens takeFstExpr)
<|> try (parens takeSndExpr)
<|> try (parens arrayEntryExpr)
<|> try (parens aExpr)
<|> try (parens bExpr)
<|> try (parens rExpr)
<|> try (parens letExpr)
<|> try (parens callExpr)
| 396 | false | true | 0 | 16 | 155 | 140 | 65 | 75 | null | null |
danclien/validation-aeson-history
|
src/Data/Validation/Aeson.hs
|
mit
|
---- # Helpers
withObjectV :: Applicative f =>
(Object -> f (AesonV2 env err a))
-> Value
-> f (AesonV2 env err a)
withObjectV parse a =
case a of
(Object o) -> parse o
_ -> pure incorrectTypeError
--verror :: V.Vector (AesonVEnv env) -> err -> V.Vector (AesonVError env err)
--verror env err = V.singleton $ ValidationError env err
| 359 |
withObjectV :: Applicative f =>
(Object -> f (AesonV2 env err a))
-> Value
-> f (AesonV2 env err a)
withObjectV parse a =
case a of
(Object o) -> parse o
_ -> pure incorrectTypeError
--verror :: V.Vector (AesonVEnv env) -> err -> V.Vector (AesonVError env err)
--verror env err = V.singleton $ ValidationError env err
| 343 |
withObjectV parse a =
case a of
(Object o) -> parse o
_ -> pure incorrectTypeError
--verror :: V.Vector (AesonVEnv env) -> err -> V.Vector (AesonVError env err)
--verror env err = V.singleton $ ValidationError env err
| 237 | true | true | 2 | 12 | 86 | 97 | 47 | 50 | null | null |
shlevy/ghc
|
compiler/iface/ToIface.hs
|
bsd-3-clause
|
toIfUnfolding lb (DFunUnfolding { df_bndrs = bndrs, df_args = args })
= Just (HsUnfold lb (IfDFunUnfold (map toIfaceBndr bndrs) (map toIfaceExpr args)))
| 154 |
toIfUnfolding lb (DFunUnfolding { df_bndrs = bndrs, df_args = args })
= Just (HsUnfold lb (IfDFunUnfold (map toIfaceBndr bndrs) (map toIfaceExpr args)))
| 154 |
toIfUnfolding lb (DFunUnfolding { df_bndrs = bndrs, df_args = args })
= Just (HsUnfold lb (IfDFunUnfold (map toIfaceBndr bndrs) (map toIfaceExpr args)))
| 154 | false | false | 0 | 10 | 23 | 66 | 33 | 33 | null | null |
ComputationWithBoundedResources/ara-inference
|
doc/tpdb_trs/Haskell/basic_haskell/range_2.hs
|
mit
|
dsEm :: (b -> a) -> b -> a;
dsEm f x = seq x (f x)
| 56 |
dsEm :: (b -> a) -> b -> a
dsEm f x = seq x (f x)
| 55 |
dsEm f x = seq x (f x)
| 22 | false | true | 0 | 7 | 22 | 43 | 22 | 21 | null | null |
supermitch/learn-haskell
|
edx-fp101x/5_lab.hs
|
mit
|
isValid :: Integer -> Bool
isValid n = (sumDigits (doubleSecond (toDigitsRev n))) `mod` 10 == 0
| 95 |
isValid :: Integer -> Bool
isValid n = (sumDigits (doubleSecond (toDigitsRev n))) `mod` 10 == 0
| 95 |
isValid n = (sumDigits (doubleSecond (toDigitsRev n))) `mod` 10 == 0
| 68 | false | true | 0 | 12 | 15 | 46 | 24 | 22 | null | null |
nevrenato/HetsAlloy
|
Propositional/Sublogic.hs
|
gpl-2.0
|
prSymbolM :: PropSL -> Symbol.Symbol -> Maybe Symbol.Symbol
prSymbolM _ = Just
| 78 |
prSymbolM :: PropSL -> Symbol.Symbol -> Maybe Symbol.Symbol
prSymbolM _ = Just
| 78 |
prSymbolM _ = Just
| 18 | false | true | 0 | 9 | 11 | 34 | 15 | 19 | null | null |
balodja/sesyrel
|
src/Sesyrel/Expression/Base.hs
|
bsd-3-clause
|
singletonBundle :: (Ord a, Bundle b) => DiffSym a -> b a
singletonBundle d = insertDiff d emptyBundle
| 101 |
singletonBundle :: (Ord a, Bundle b) => DiffSym a -> b a
singletonBundle d = insertDiff d emptyBundle
| 101 |
singletonBundle d = insertDiff d emptyBundle
| 44 | false | true | 0 | 8 | 17 | 48 | 22 | 26 | null | null |
acowley/ghc
|
compiler/basicTypes/Literal.hs
|
bsd-3-clause
|
litValue (MachInt i) = i
| 27 |
litValue (MachInt i) = i
| 27 |
litValue (MachInt i) = i
| 27 | false | false | 0 | 6 | 7 | 16 | 7 | 9 | null | null |
Philonous/hexpat-internals
|
Text/XML/Expat/Internal/IO.hs
|
bsd-3-clause
|
nullCEndElementHandler :: CEndElementHandler
nullCEndElementHandler _ _ = return ()
| 83 |
nullCEndElementHandler :: CEndElementHandler
nullCEndElementHandler _ _ = return ()
| 83 |
nullCEndElementHandler _ _ = return ()
| 38 | false | true | 0 | 6 | 8 | 21 | 10 | 11 | null | null |
urbanslug/ghc
|
compiler/cmm/CmmSink.hs
|
bsd-3-clause
|
bothMems HeapMem HeapMem = HeapMem
| 37 |
bothMems HeapMem HeapMem = HeapMem
| 37 |
bothMems HeapMem HeapMem = HeapMem
| 37 | false | false | 1 | 5 | 7 | 16 | 5 | 11 | null | null |
spinda/liquidhaskell
|
tests/gsoc15/unknown/pos/RBTree-color.hs
|
bsd-3-clause
|
append piv l@(Node B _ _ _) (Node R rx rl rr)
= Node R rx (append piv l rl) rr
| 83 |
append piv l@(Node B _ _ _) (Node R rx rl rr)
= Node R rx (append piv l rl) rr
| 83 |
append piv l@(Node B _ _ _) (Node R rx rl rr)
= Node R rx (append piv l rl) rr
| 83 | false | false | 0 | 8 | 25 | 59 | 29 | 30 | null | null |
forsyde/forsyde-shallow
|
src/ForSyDe/Shallow/MoC/Synchronous/Stochastic.hs
|
bsd-3-clause
|
selScanlSY seed f0 f1 mem xs = selscan1 f0 f1 mem (sigmaUn seed (0,1)) xs
where
selscan1 :: (a -> b -> a) -> (a -> b -> a) -> a
-> Signal Int -> Signal b -> Signal a
selscan1 _ _ _ _ NullS = NullS
selscan1 f0 f1 mem (s:-_) (x:-NullS)
= select2 s f0 f1 mem x :- NullS
selscan1 f0 f1 mem (s:-NullS) (x:-_)
= select2 s f0 f1 mem x :- NullS
selscan1 f0 f1 mem (s:-ss) (x:-xs)
= select2 s f0 f1 mem x
:- (selscan1 f0 f1 (select2 s f0 f1 mem x) ss xs)
selscan1 _ _ _ NullS _
= error "selScanlSY: empty seed signal"
| 581 |
selScanlSY seed f0 f1 mem xs = selscan1 f0 f1 mem (sigmaUn seed (0,1)) xs
where
selscan1 :: (a -> b -> a) -> (a -> b -> a) -> a
-> Signal Int -> Signal b -> Signal a
selscan1 _ _ _ _ NullS = NullS
selscan1 f0 f1 mem (s:-_) (x:-NullS)
= select2 s f0 f1 mem x :- NullS
selscan1 f0 f1 mem (s:-NullS) (x:-_)
= select2 s f0 f1 mem x :- NullS
selscan1 f0 f1 mem (s:-ss) (x:-xs)
= select2 s f0 f1 mem x
:- (selscan1 f0 f1 (select2 s f0 f1 mem x) ss xs)
selscan1 _ _ _ NullS _
= error "selScanlSY: empty seed signal"
| 581 |
selScanlSY seed f0 f1 mem xs = selscan1 f0 f1 mem (sigmaUn seed (0,1)) xs
where
selscan1 :: (a -> b -> a) -> (a -> b -> a) -> a
-> Signal Int -> Signal b -> Signal a
selscan1 _ _ _ _ NullS = NullS
selscan1 f0 f1 mem (s:-_) (x:-NullS)
= select2 s f0 f1 mem x :- NullS
selscan1 f0 f1 mem (s:-NullS) (x:-_)
= select2 s f0 f1 mem x :- NullS
selscan1 f0 f1 mem (s:-ss) (x:-xs)
= select2 s f0 f1 mem x
:- (selscan1 f0 f1 (select2 s f0 f1 mem x) ss xs)
selscan1 _ _ _ NullS _
= error "selScanlSY: empty seed signal"
| 581 | false | false | 0 | 10 | 187 | 299 | 150 | 149 | null | null |
DanielWaterworth/Idris-dev
|
src/Idris/IdrisDoc.hs
|
bsd-3-clause
|
extractPTermNames (PTyped p1 p2) = concatMap extract [p1, p2]
| 65 |
extractPTermNames (PTyped p1 p2) = concatMap extract [p1, p2]
| 65 |
extractPTermNames (PTyped p1 p2) = concatMap extract [p1, p2]
| 65 | false | false | 0 | 7 | 12 | 28 | 14 | 14 | null | null |
databrary/databrary
|
src/Ops.hs
|
agpl-3.0
|
-- infixl 1 <?
-- infixr 1 ?!>
-- |@'($>)' . guard@
thenUse :: Alternative f => Bool -> a -> f a
False `thenUse` _ = empty
| 123 |
thenUse :: Alternative f => Bool -> a -> f a
False `thenUse` _ = empty
| 70 |
False `thenUse` _ = empty
| 25 | true | true | 0 | 8 | 28 | 47 | 23 | 24 | null | null |
janschulz/pandoc
|
src/Text/Pandoc/Writers/Man.hs
|
gpl-2.0
|
inlineToMan _ Space = return space
| 34 |
inlineToMan _ Space = return space
| 34 |
inlineToMan _ Space = return space
| 34 | false | false | 1 | 5 | 5 | 15 | 6 | 9 | null | null |
neongreen/megaparsec
|
Text/Megaparsec/Prim.hs
|
bsd-2-clause
|
pNotFollowedBy :: Stream s t => ParsecT s m a -> ParsecT s m ()
pNotFollowedBy p = ParsecT $ \s@(State input pos _) _ _ eok eerr ->
let l = maybe eoi (showToken . fst) (uncons input)
cok' _ _ _ = eerr $ unexpectedErr l pos
cerr' _ = eok () s mempty
eok' _ _ _ = eerr $ unexpectedErr l pos
eerr' _ = eok () s mempty
in unParser p s cok' cerr' eok' eerr'
| 386 |
pNotFollowedBy :: Stream s t => ParsecT s m a -> ParsecT s m ()
pNotFollowedBy p = ParsecT $ \s@(State input pos _) _ _ eok eerr ->
let l = maybe eoi (showToken . fst) (uncons input)
cok' _ _ _ = eerr $ unexpectedErr l pos
cerr' _ = eok () s mempty
eok' _ _ _ = eerr $ unexpectedErr l pos
eerr' _ = eok () s mempty
in unParser p s cok' cerr' eok' eerr'
| 386 |
pNotFollowedBy p = ParsecT $ \s@(State input pos _) _ _ eok eerr ->
let l = maybe eoi (showToken . fst) (uncons input)
cok' _ _ _ = eerr $ unexpectedErr l pos
cerr' _ = eok () s mempty
eok' _ _ _ = eerr $ unexpectedErr l pos
eerr' _ = eok () s mempty
in unParser p s cok' cerr' eok' eerr'
| 322 | false | true | 2 | 12 | 114 | 204 | 94 | 110 | null | null |
haroldcarr/learn-haskell-coq-ml-etc
|
haskell/course/2013-11-coursera-fp-odersky-but-in-haskell/FP02FunSetsWorksheet.hs
|
unlicense
|
(<:) :: Rational' -> Rational' -> Bool
(<:) = less
| 51 |
(<:) :: Rational' -> Rational' -> Bool
(<:) = less
| 51 |
(<:) = less
| 11 | false | true | 0 | 6 | 10 | 23 | 14 | 9 | null | null |
martin-kolinek/some-board-game
|
src/Player/Building/Style.hs
|
mit
|
hiddenPlaceholderTileCss :: Css
hiddenPlaceholderTileCss = display block
| 72 |
hiddenPlaceholderTileCss :: Css
hiddenPlaceholderTileCss = display block
| 72 |
hiddenPlaceholderTileCss = display block
| 40 | false | true | 0 | 5 | 6 | 14 | 7 | 7 | null | null |
vedgar/mlr
|
Haskell/2017K1rj/Z5rj.hs
|
unlicense
|
f --> g = Cond f g
| 18 |
f --> g = Cond f g
| 18 |
f --> g = Cond f g
| 18 | false | false | 1 | 5 | 6 | 19 | 8 | 11 | null | null |
Mic92/eidolon
|
Handler/Reactivate.hs
|
agpl-3.0
|
postReactivateR :: Handler Html
postReactivateR = do
((result, _), _) <- runFormPost reactivateForm
case result of
FormSuccess temp -> do
users <- runDB $ selectList [UserEmail ==. temp] []
case null users of
True -> do
userTokens <- foldM (\userTokens (Entity userId user) -> do
token <- liftIO $ generateString
_ <- runDB $ insert $ Token (encodeUtf8 token) "activate" (Just userId)
return $ (user, token) : userTokens
) [] users
_ <- foldM (\sent (user, token) ->
case sent of
False ->
return False
True -> do
activateLink <- ($ ActivateR token) <$> getUrlRender
sendMail (userEmail user) "Reset your password" $
[shamlet|
<h1>Welcome again to Eidolon #{userName user}
To reset your password visit the following link:
<a href="#{activateLink}">#{activateLink}
See you soon!
|]
return True
) True userTokens
setMessage "Your new password activation will arrive in your e-mail"
redirect $ HomeR
False -> do
setMessage "No user mith this Email"
redirect $ LoginR
_ -> do
setMessage "There is something wrong with your email"
redirect $ ReactivateR
| 1,440 |
postReactivateR :: Handler Html
postReactivateR = do
((result, _), _) <- runFormPost reactivateForm
case result of
FormSuccess temp -> do
users <- runDB $ selectList [UserEmail ==. temp] []
case null users of
True -> do
userTokens <- foldM (\userTokens (Entity userId user) -> do
token <- liftIO $ generateString
_ <- runDB $ insert $ Token (encodeUtf8 token) "activate" (Just userId)
return $ (user, token) : userTokens
) [] users
_ <- foldM (\sent (user, token) ->
case sent of
False ->
return False
True -> do
activateLink <- ($ ActivateR token) <$> getUrlRender
sendMail (userEmail user) "Reset your password" $
[shamlet|
<h1>Welcome again to Eidolon #{userName user}
To reset your password visit the following link:
<a href="#{activateLink}">#{activateLink}
See you soon!
|]
return True
) True userTokens
setMessage "Your new password activation will arrive in your e-mail"
redirect $ HomeR
False -> do
setMessage "No user mith this Email"
redirect $ LoginR
_ -> do
setMessage "There is something wrong with your email"
redirect $ ReactivateR
| 1,440 |
postReactivateR = do
((result, _), _) <- runFormPost reactivateForm
case result of
FormSuccess temp -> do
users <- runDB $ selectList [UserEmail ==. temp] []
case null users of
True -> do
userTokens <- foldM (\userTokens (Entity userId user) -> do
token <- liftIO $ generateString
_ <- runDB $ insert $ Token (encodeUtf8 token) "activate" (Just userId)
return $ (user, token) : userTokens
) [] users
_ <- foldM (\sent (user, token) ->
case sent of
False ->
return False
True -> do
activateLink <- ($ ActivateR token) <$> getUrlRender
sendMail (userEmail user) "Reset your password" $
[shamlet|
<h1>Welcome again to Eidolon #{userName user}
To reset your password visit the following link:
<a href="#{activateLink}">#{activateLink}
See you soon!
|]
return True
) True userTokens
setMessage "Your new password activation will arrive in your e-mail"
redirect $ HomeR
False -> do
setMessage "No user mith this Email"
redirect $ LoginR
_ -> do
setMessage "There is something wrong with your email"
redirect $ ReactivateR
| 1,408 | false | true | 0 | 30 | 559 | 336 | 161 | 175 | null | null |
AlexeyRaga/eta
|
compiler/ETA/Prelude/PrelNames.hs
|
bsd-3-clause
|
-- Functions for GHC extensions
groupWithName :: Name
groupWithName = varQual gHC_EXTS (fsLit "groupWith") groupWithIdKey
| 121 |
groupWithName :: Name
groupWithName = varQual gHC_EXTS (fsLit "groupWith") groupWithIdKey
| 89 |
groupWithName = varQual gHC_EXTS (fsLit "groupWith") groupWithIdKey
| 67 | true | true | 0 | 7 | 14 | 25 | 13 | 12 | null | null |
nevrenato/HetsAlloy
|
Maude/Maude2DG.hs
|
gpl-2.0
|
processModExp tim vm dg (InstantiationModExp modExp views) =
(tok'', tim'', final_morph, new_param_sorts, dg'') where
(tok, tim', morph, paramSorts, dg') = processModExp tim vm dg modExp
(_, _, _, ps, _) = fromJust $ Map.lookup tok tim'
param_names = map fstTpl ps
view_names = map HasName.getName views
(new_param_sorts, ps_morph) = instantiateSorts param_names view_names vm
morph paramSorts
(tok', morph1, ns, deps) = processViews views (mkSimpleId "") tim' vm ps
(ps_morph, [], [])
tok'' = mkSimpleId $ concat [show tok, "{", show tok', "}"]
sg2 = target morph1
final_morph = Maude.Morphism.inclusion sg2 sg2
(tim'', dg'') = if Map.member tok'' tim then (tim', dg') else
updateGraphViews tok tok'' sg2 morph1 ns tim' deps dg'
{- | generates a edge between the source and the target of a view, inserting
a new node if the view contained a term to term renaming, and thus updating
the map from module expression to its info and the development graph -}
| 1,015 |
processModExp tim vm dg (InstantiationModExp modExp views) =
(tok'', tim'', final_morph, new_param_sorts, dg'') where
(tok, tim', morph, paramSorts, dg') = processModExp tim vm dg modExp
(_, _, _, ps, _) = fromJust $ Map.lookup tok tim'
param_names = map fstTpl ps
view_names = map HasName.getName views
(new_param_sorts, ps_morph) = instantiateSorts param_names view_names vm
morph paramSorts
(tok', morph1, ns, deps) = processViews views (mkSimpleId "") tim' vm ps
(ps_morph, [], [])
tok'' = mkSimpleId $ concat [show tok, "{", show tok', "}"]
sg2 = target morph1
final_morph = Maude.Morphism.inclusion sg2 sg2
(tim'', dg'') = if Map.member tok'' tim then (tim', dg') else
updateGraphViews tok tok'' sg2 morph1 ns tim' deps dg'
{- | generates a edge between the source and the target of a view, inserting
a new node if the view contained a term to term renaming, and thus updating
the map from module expression to its info and the development graph -}
| 1,015 |
processModExp tim vm dg (InstantiationModExp modExp views) =
(tok'', tim'', final_morph, new_param_sorts, dg'') where
(tok, tim', morph, paramSorts, dg') = processModExp tim vm dg modExp
(_, _, _, ps, _) = fromJust $ Map.lookup tok tim'
param_names = map fstTpl ps
view_names = map HasName.getName views
(new_param_sorts, ps_morph) = instantiateSorts param_names view_names vm
morph paramSorts
(tok', morph1, ns, deps) = processViews views (mkSimpleId "") tim' vm ps
(ps_morph, [], [])
tok'' = mkSimpleId $ concat [show tok, "{", show tok', "}"]
sg2 = target morph1
final_morph = Maude.Morphism.inclusion sg2 sg2
(tim'', dg'') = if Map.member tok'' tim then (tim', dg') else
updateGraphViews tok tok'' sg2 morph1 ns tim' deps dg'
{- | generates a edge between the source and the target of a view, inserting
a new node if the view contained a term to term renaming, and thus updating
the map from module expression to its info and the development graph -}
| 1,015 | false | false | 0 | 10 | 213 | 302 | 163 | 139 | null | null |
genos/online_problems
|
advent_of_code_2016/day12/hask/src/Main.hs
|
mit
|
load :: Value -> Registers -> Int
load (Left v) _ = v
| 55 |
load :: Value -> Registers -> Int
load (Left v) _ = v
| 55 |
load (Left v) _ = v
| 21 | false | true | 0 | 7 | 14 | 30 | 15 | 15 | null | null |
ComputationWithBoundedResources/ara-inference
|
doc/tpdb_trs/Haskell/basic_haskell/SLASHEQ_1.hs
|
mit
|
not MyFalse = MyTrue
| 20 |
not MyFalse = MyTrue
| 20 |
not MyFalse = MyTrue
| 20 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
forked-upstream-packages-for-ghcjs/ghc
|
utils/hpc/HpcMarkup.hs
|
bsd-3-clause
|
openTick (TopLevelDecl True n0)
= "<span class=\"funcount\">-- entered " ++ showBigNum n0 ++ " times</span>" ++ openTopDecl
where showBigNum n | n <= 9999 = show n
| otherwise = case n `quotRem` 1000 of
(q, r) -> showBigNum' q ++ "," ++ showWith r
showBigNum' n | n <= 999 = show n
| otherwise = case n `quotRem` 1000 of
(q, r) -> showBigNum' q ++ "," ++ showWith r
showWith n = padLeft 3 '0' $ show n
| 546 |
openTick (TopLevelDecl True n0)
= "<span class=\"funcount\">-- entered " ++ showBigNum n0 ++ " times</span>" ++ openTopDecl
where showBigNum n | n <= 9999 = show n
| otherwise = case n `quotRem` 1000 of
(q, r) -> showBigNum' q ++ "," ++ showWith r
showBigNum' n | n <= 999 = show n
| otherwise = case n `quotRem` 1000 of
(q, r) -> showBigNum' q ++ "," ++ showWith r
showWith n = padLeft 3 '0' $ show n
| 546 |
openTick (TopLevelDecl True n0)
= "<span class=\"funcount\">-- entered " ++ showBigNum n0 ++ " times</span>" ++ openTopDecl
where showBigNum n | n <= 9999 = show n
| otherwise = case n `quotRem` 1000 of
(q, r) -> showBigNum' q ++ "," ++ showWith r
showBigNum' n | n <= 999 = show n
| otherwise = case n `quotRem` 1000 of
(q, r) -> showBigNum' q ++ "," ++ showWith r
showWith n = padLeft 3 '0' $ show n
| 546 | false | false | 0 | 11 | 225 | 187 | 89 | 98 | null | null |
jonascarpay/visor
|
src/Games/Melee/Graphic.hs
|
bsd-3-clause
|
gameGraph :: MeleeGame -> IO ()
gameGraph full'@(Win _ wq:game') =
do efont <- loadFontFile "data/fonts/Roboto-Regular.ttf"
let font = case efont of
Left err -> error err
Right font -> font
writePng "output.png" (img font)
where
game = reverse game'
full = reverse full'
pcts = map (\(Ingame (PlayerState _ p1) _ (PlayerState _ p2) _)
-> (fromIntegral p1, fromIntegral p2)
) game
(!p1Max, !p2Max) = let (p1s, p2s) = unzip pcts in (maximum p1s, maximum p2s)
(p1q, p2q) = let (Ingame _ q1 _ q2) = head game in (q1,q2)
imageWidth = 584
imageHeight = 480
frames = length game
graphWidth = 450
xOffset = (fromIntegral imageWidth - graphWidth) / 2
yOffset = 2
baseY = 340
barWidth = graphWidth / fromIntegral frames
barHeight = 60
p1Color = PixelRGBA8 100 30 20 255
p2Color = PixelRGBA8 20 30 100 255
bgColor = PixelRGBA8 10 10 10 255
markerColor = PixelRGBA8 255 250 230 255
bars = foldbars Nothing game
foldbars :: Maybe BarFold -> [Melee] -> [BarFold]
foldbars Nothing (_:t) =
b' : foldbars (Just b') t
where b' = BF 0 Nothing 4 0 0 Nothing 4 0 0
foldbars (Just (BF n _ s1 p1 _ _ s2 p2 _)) [] =
[if wq == p1q
then BF (n+1) Nothing s1 p1 0 (Just p2) s2 p2 0
else BF (n+1) (Just p1) s1 p1 0 Nothing s2 p2 0
]
foldbars
(Just (BF n _ s1 p1 _ _ s2 p2 _))
(Ingame (PlayerState s1' p1') _ (PlayerState s2' p2') _:t) =
b' : foldbars (Just b') t
where b' = BF (n+1) d1' s1' p1' dp1' d2' s2' p2' dp2'
d1' = if s1 == s1' then Nothing else Just p1
d2' = if s2 == s2' then Nothing else Just p2
dp1' = p1' - p1
dp2' = p2' - p2
drawBar font bf = do
-- p1
withTexture (uniformTexture p1Color) . fill$
rectangle (V2 x (baseY-yOffset))
w (negate h1)
-- p2
withTexture (uniformTexture p2Color) . fill$
rectangle (V2 x (baseY+yOffset))
w h2
withTexture (uniformTexture markerColor)$
do case p1death bf of
Nothing -> mempty
Just p -> do fill$ rectangle (V2 x (baseY-yOffset)) (w+1) (-10-barHeight)
printTextAt font (PointSize 12) (V2 (x+6) (baseY-yOffset-3-scalep1 p)) (show p)
case p2death bf of
Nothing -> mempty
Just p -> do fill$ rectangle (V2 x (baseY+yOffset)) (w+1) (10+barHeight)
printTextAt font (PointSize 12) (V2 (x+6) (baseY+yOffset+15+scalep2 p)) (show p)
where
scalep1 p = fromIntegral p * barHeight / p1Max
scalep2 p = fromIntegral p * barHeight / p2Max
h1 = scalep1$ p1p bf
h2 = scalep2$ p2p bf
x = floorF$ xOffset + n bf * barWidth
w = ceilF barWidth
img font =
renderDrawing imageWidth imageHeight bgColor$
do traverse_ (drawBar font) bars
withTexture (uniformTexture markerColor)$ do
printTextAt font (PointSize 10) (V2 390 (fromIntegral$ imageHeight - 20))
"github.com/jonascarpay/visor"
let size = 14
lx = 120
col1x = 350
col2x = 420
printText = printTextAt font (PointSize size)
printTextAt font (PointSize 20) (V2 lx 50) "MATCH REPORT"
printText (V2 col1x 95) ("P" ++ show p1q)
printText (V2 col2x 95) ("P" ++ show p2q)
printText (V2 lx 135) "Life expectancy"
printText (V2 col1x 135)$ show . averageInt $ killPctsP1 full
printText (V2 col2x 135)$ show . averageInt $ killPctsP2 full
printText (V2 lx 165) "Average punish"
printText (V2 col1x 165)$ take 4 . show . averageF $ punishP1 full
printText (V2 col2x 165)$ take 4 . show . averageF $ punishP2 full
printText (V2 lx 195) "Biggest punish"
printText (V2 col1x 195)$ show . maximum $ punishP1 full
printText (V2 col2x 195)$ show . maximum $ punishP2 full
printText (V2 lx 225) "Conversion rate"
printText (V2 col1x 225)$ take 4 . show . (*100) $ fromIntegral (length.killPctsP2$full) / fromIntegral (length.punishP1$full)
printText (V2 col2x 225)$ take 4 . show . (*100) $ fromIntegral (length.killPctsP1$full) / fromIntegral (length.punishP2$full)
| 4,618 |
gameGraph :: MeleeGame -> IO ()
gameGraph full'@(Win _ wq:game') =
do efont <- loadFontFile "data/fonts/Roboto-Regular.ttf"
let font = case efont of
Left err -> error err
Right font -> font
writePng "output.png" (img font)
where
game = reverse game'
full = reverse full'
pcts = map (\(Ingame (PlayerState _ p1) _ (PlayerState _ p2) _)
-> (fromIntegral p1, fromIntegral p2)
) game
(!p1Max, !p2Max) = let (p1s, p2s) = unzip pcts in (maximum p1s, maximum p2s)
(p1q, p2q) = let (Ingame _ q1 _ q2) = head game in (q1,q2)
imageWidth = 584
imageHeight = 480
frames = length game
graphWidth = 450
xOffset = (fromIntegral imageWidth - graphWidth) / 2
yOffset = 2
baseY = 340
barWidth = graphWidth / fromIntegral frames
barHeight = 60
p1Color = PixelRGBA8 100 30 20 255
p2Color = PixelRGBA8 20 30 100 255
bgColor = PixelRGBA8 10 10 10 255
markerColor = PixelRGBA8 255 250 230 255
bars = foldbars Nothing game
foldbars :: Maybe BarFold -> [Melee] -> [BarFold]
foldbars Nothing (_:t) =
b' : foldbars (Just b') t
where b' = BF 0 Nothing 4 0 0 Nothing 4 0 0
foldbars (Just (BF n _ s1 p1 _ _ s2 p2 _)) [] =
[if wq == p1q
then BF (n+1) Nothing s1 p1 0 (Just p2) s2 p2 0
else BF (n+1) (Just p1) s1 p1 0 Nothing s2 p2 0
]
foldbars
(Just (BF n _ s1 p1 _ _ s2 p2 _))
(Ingame (PlayerState s1' p1') _ (PlayerState s2' p2') _:t) =
b' : foldbars (Just b') t
where b' = BF (n+1) d1' s1' p1' dp1' d2' s2' p2' dp2'
d1' = if s1 == s1' then Nothing else Just p1
d2' = if s2 == s2' then Nothing else Just p2
dp1' = p1' - p1
dp2' = p2' - p2
drawBar font bf = do
-- p1
withTexture (uniformTexture p1Color) . fill$
rectangle (V2 x (baseY-yOffset))
w (negate h1)
-- p2
withTexture (uniformTexture p2Color) . fill$
rectangle (V2 x (baseY+yOffset))
w h2
withTexture (uniformTexture markerColor)$
do case p1death bf of
Nothing -> mempty
Just p -> do fill$ rectangle (V2 x (baseY-yOffset)) (w+1) (-10-barHeight)
printTextAt font (PointSize 12) (V2 (x+6) (baseY-yOffset-3-scalep1 p)) (show p)
case p2death bf of
Nothing -> mempty
Just p -> do fill$ rectangle (V2 x (baseY+yOffset)) (w+1) (10+barHeight)
printTextAt font (PointSize 12) (V2 (x+6) (baseY+yOffset+15+scalep2 p)) (show p)
where
scalep1 p = fromIntegral p * barHeight / p1Max
scalep2 p = fromIntegral p * barHeight / p2Max
h1 = scalep1$ p1p bf
h2 = scalep2$ p2p bf
x = floorF$ xOffset + n bf * barWidth
w = ceilF barWidth
img font =
renderDrawing imageWidth imageHeight bgColor$
do traverse_ (drawBar font) bars
withTexture (uniformTexture markerColor)$ do
printTextAt font (PointSize 10) (V2 390 (fromIntegral$ imageHeight - 20))
"github.com/jonascarpay/visor"
let size = 14
lx = 120
col1x = 350
col2x = 420
printText = printTextAt font (PointSize size)
printTextAt font (PointSize 20) (V2 lx 50) "MATCH REPORT"
printText (V2 col1x 95) ("P" ++ show p1q)
printText (V2 col2x 95) ("P" ++ show p2q)
printText (V2 lx 135) "Life expectancy"
printText (V2 col1x 135)$ show . averageInt $ killPctsP1 full
printText (V2 col2x 135)$ show . averageInt $ killPctsP2 full
printText (V2 lx 165) "Average punish"
printText (V2 col1x 165)$ take 4 . show . averageF $ punishP1 full
printText (V2 col2x 165)$ take 4 . show . averageF $ punishP2 full
printText (V2 lx 195) "Biggest punish"
printText (V2 col1x 195)$ show . maximum $ punishP1 full
printText (V2 col2x 195)$ show . maximum $ punishP2 full
printText (V2 lx 225) "Conversion rate"
printText (V2 col1x 225)$ take 4 . show . (*100) $ fromIntegral (length.killPctsP2$full) / fromIntegral (length.punishP1$full)
printText (V2 col2x 225)$ take 4 . show . (*100) $ fromIntegral (length.killPctsP1$full) / fromIntegral (length.punishP2$full)
| 4,618 |
gameGraph full'@(Win _ wq:game') =
do efont <- loadFontFile "data/fonts/Roboto-Regular.ttf"
let font = case efont of
Left err -> error err
Right font -> font
writePng "output.png" (img font)
where
game = reverse game'
full = reverse full'
pcts = map (\(Ingame (PlayerState _ p1) _ (PlayerState _ p2) _)
-> (fromIntegral p1, fromIntegral p2)
) game
(!p1Max, !p2Max) = let (p1s, p2s) = unzip pcts in (maximum p1s, maximum p2s)
(p1q, p2q) = let (Ingame _ q1 _ q2) = head game in (q1,q2)
imageWidth = 584
imageHeight = 480
frames = length game
graphWidth = 450
xOffset = (fromIntegral imageWidth - graphWidth) / 2
yOffset = 2
baseY = 340
barWidth = graphWidth / fromIntegral frames
barHeight = 60
p1Color = PixelRGBA8 100 30 20 255
p2Color = PixelRGBA8 20 30 100 255
bgColor = PixelRGBA8 10 10 10 255
markerColor = PixelRGBA8 255 250 230 255
bars = foldbars Nothing game
foldbars :: Maybe BarFold -> [Melee] -> [BarFold]
foldbars Nothing (_:t) =
b' : foldbars (Just b') t
where b' = BF 0 Nothing 4 0 0 Nothing 4 0 0
foldbars (Just (BF n _ s1 p1 _ _ s2 p2 _)) [] =
[if wq == p1q
then BF (n+1) Nothing s1 p1 0 (Just p2) s2 p2 0
else BF (n+1) (Just p1) s1 p1 0 Nothing s2 p2 0
]
foldbars
(Just (BF n _ s1 p1 _ _ s2 p2 _))
(Ingame (PlayerState s1' p1') _ (PlayerState s2' p2') _:t) =
b' : foldbars (Just b') t
where b' = BF (n+1) d1' s1' p1' dp1' d2' s2' p2' dp2'
d1' = if s1 == s1' then Nothing else Just p1
d2' = if s2 == s2' then Nothing else Just p2
dp1' = p1' - p1
dp2' = p2' - p2
drawBar font bf = do
-- p1
withTexture (uniformTexture p1Color) . fill$
rectangle (V2 x (baseY-yOffset))
w (negate h1)
-- p2
withTexture (uniformTexture p2Color) . fill$
rectangle (V2 x (baseY+yOffset))
w h2
withTexture (uniformTexture markerColor)$
do case p1death bf of
Nothing -> mempty
Just p -> do fill$ rectangle (V2 x (baseY-yOffset)) (w+1) (-10-barHeight)
printTextAt font (PointSize 12) (V2 (x+6) (baseY-yOffset-3-scalep1 p)) (show p)
case p2death bf of
Nothing -> mempty
Just p -> do fill$ rectangle (V2 x (baseY+yOffset)) (w+1) (10+barHeight)
printTextAt font (PointSize 12) (V2 (x+6) (baseY+yOffset+15+scalep2 p)) (show p)
where
scalep1 p = fromIntegral p * barHeight / p1Max
scalep2 p = fromIntegral p * barHeight / p2Max
h1 = scalep1$ p1p bf
h2 = scalep2$ p2p bf
x = floorF$ xOffset + n bf * barWidth
w = ceilF barWidth
img font =
renderDrawing imageWidth imageHeight bgColor$
do traverse_ (drawBar font) bars
withTexture (uniformTexture markerColor)$ do
printTextAt font (PointSize 10) (V2 390 (fromIntegral$ imageHeight - 20))
"github.com/jonascarpay/visor"
let size = 14
lx = 120
col1x = 350
col2x = 420
printText = printTextAt font (PointSize size)
printTextAt font (PointSize 20) (V2 lx 50) "MATCH REPORT"
printText (V2 col1x 95) ("P" ++ show p1q)
printText (V2 col2x 95) ("P" ++ show p2q)
printText (V2 lx 135) "Life expectancy"
printText (V2 col1x 135)$ show . averageInt $ killPctsP1 full
printText (V2 col2x 135)$ show . averageInt $ killPctsP2 full
printText (V2 lx 165) "Average punish"
printText (V2 col1x 165)$ take 4 . show . averageF $ punishP1 full
printText (V2 col2x 165)$ take 4 . show . averageF $ punishP2 full
printText (V2 lx 195) "Biggest punish"
printText (V2 col1x 195)$ show . maximum $ punishP1 full
printText (V2 col2x 195)$ show . maximum $ punishP2 full
printText (V2 lx 225) "Conversion rate"
printText (V2 col1x 225)$ take 4 . show . (*100) $ fromIntegral (length.killPctsP2$full) / fromIntegral (length.punishP1$full)
printText (V2 col2x 225)$ take 4 . show . (*100) $ fromIntegral (length.killPctsP1$full) / fromIntegral (length.punishP2$full)
| 4,586 | false | true | 25 | 22 | 1,649 | 1,842 | 888 | 954 | null | null |
dawedawe/kripkeweb
|
src/Conf.hs
|
bsd-3-clause
|
-- |Lookup item in tuple list and return it's value.
lookupConfItem :: String -> [(CF.OptionSpec, String)] -> String
lookupConfItem itemName items =
let value = lookup itemName items
in checkConfItem value itemName
| 224 |
lookupConfItem :: String -> [(CF.OptionSpec, String)] -> String
lookupConfItem itemName items =
let value = lookup itemName items
in checkConfItem value itemName
| 171 |
lookupConfItem itemName items =
let value = lookup itemName items
in checkConfItem value itemName
| 107 | true | true | 0 | 9 | 41 | 57 | 29 | 28 | null | null |
ghcjs/ghcjs
|
utils/pkg-cache/ghc/includes/dist-derivedconstants/header/GHCConstantsHaskellWrappers.hs
|
mit
|
sIZEOF_StgSMPThunkHeader :: DynFlags -> Int
sIZEOF_StgSMPThunkHeader dflags = pc_SIZEOF_StgSMPThunkHeader (platformConstants dflags)
| 132 |
sIZEOF_StgSMPThunkHeader :: DynFlags -> Int
sIZEOF_StgSMPThunkHeader dflags = pc_SIZEOF_StgSMPThunkHeader (platformConstants dflags)
| 132 |
sIZEOF_StgSMPThunkHeader dflags = pc_SIZEOF_StgSMPThunkHeader (platformConstants dflags)
| 88 | false | true | 0 | 7 | 10 | 30 | 14 | 16 | null | null |
svenssonjoel/ArrowObsidian
|
Obsidian/ArrowObsidian/CodeGen.hs
|
bsd-3-clause
|
blockOffs :: Int -> IndexE
blockOffs i = fromIntegral i * variable "blockIdx.x"
| 79 |
blockOffs :: Int -> IndexE
blockOffs i = fromIntegral i * variable "blockIdx.x"
| 79 |
blockOffs i = fromIntegral i * variable "blockIdx.x"
| 52 | false | true | 0 | 6 | 12 | 28 | 13 | 15 | null | null |
beni55/qoropa
|
src/Qoropa/Buffer/Search.hs
|
gpl-2.0
|
scrollDown' :: IORef Search -> Int -> Int -> IO ()
scrollDown' ref cols cnt = do
buf <- readIORef ref
case listScrollDown (bufferList buf) cols cnt of
Just ls -> writeIORef ref buf { bufferList = ls
, bufferStatusBar = (bufferStatusBar buf) { sBarCurrent = listSelected ls }
}
Nothing -> do
msg <- themeFormatHitTheBottom (bufferTheme buf)
writeIORef ref buf { bufferStatusMessage = (bufferStatusMessage buf) { sMessage = msg }
}
| 590 |
scrollDown' :: IORef Search -> Int -> Int -> IO ()
scrollDown' ref cols cnt = do
buf <- readIORef ref
case listScrollDown (bufferList buf) cols cnt of
Just ls -> writeIORef ref buf { bufferList = ls
, bufferStatusBar = (bufferStatusBar buf) { sBarCurrent = listSelected ls }
}
Nothing -> do
msg <- themeFormatHitTheBottom (bufferTheme buf)
writeIORef ref buf { bufferStatusMessage = (bufferStatusMessage buf) { sMessage = msg }
}
| 590 |
scrollDown' ref cols cnt = do
buf <- readIORef ref
case listScrollDown (bufferList buf) cols cnt of
Just ls -> writeIORef ref buf { bufferList = ls
, bufferStatusBar = (bufferStatusBar buf) { sBarCurrent = listSelected ls }
}
Nothing -> do
msg <- themeFormatHitTheBottom (bufferTheme buf)
writeIORef ref buf { bufferStatusMessage = (bufferStatusMessage buf) { sMessage = msg }
}
| 539 | false | true | 0 | 17 | 232 | 165 | 81 | 84 | null | null |
apisarek/malus
|
src/Preprocessing.hs
|
mit
|
allPaths :: IO [String]
allPaths = do
partFoldersNames <- listDirectory rootPath
let partFolderPaths = map (\folder -> rootPath ++ folder) partFoldersNames
innerFiles <- mapM listDirectory partFolderPaths
return $ concat $ zipWith filesWithPaths partFolderPaths innerFiles
| 280 |
allPaths :: IO [String]
allPaths = do
partFoldersNames <- listDirectory rootPath
let partFolderPaths = map (\folder -> rootPath ++ folder) partFoldersNames
innerFiles <- mapM listDirectory partFolderPaths
return $ concat $ zipWith filesWithPaths partFolderPaths innerFiles
| 280 |
allPaths = do
partFoldersNames <- listDirectory rootPath
let partFolderPaths = map (\folder -> rootPath ++ folder) partFoldersNames
innerFiles <- mapM listDirectory partFolderPaths
return $ concat $ zipWith filesWithPaths partFolderPaths innerFiles
| 256 | false | true | 0 | 13 | 41 | 83 | 39 | 44 | null | null |
urbanslug/ghc
|
compiler/codeGen/StgCmmPrim.hs
|
bsd-3-clause
|
vecElemInjectCast _ _ _ = Nothing
| 48 |
vecElemInjectCast _ _ _ = Nothing
| 48 |
vecElemInjectCast _ _ _ = Nothing
| 48 | false | false | 0 | 5 | 20 | 13 | 6 | 7 | null | null |
noughtmare/yi
|
yi-keymap-vim/src/Yi/Keymap/Vim/Digraph.hs
|
gpl-2.0
|
-- LATIN CAPITAL LETTER Z WITH STROKE
switch 'z' '/' = '\x01B6'
| 63 |
switch 'z' '/' = '\x01B6'
| 25 |
switch 'z' '/' = '\x01B6'
| 25 | true | false | 0 | 5 | 11 | 12 | 6 | 6 | null | null |
joeyinbox/space-invaders-haskell
|
src/Gui.hs
|
gpl-2.0
|
displayAttacker attackerTypeList appData (x:xs) = do
-- Display by type
if attackerTypeEq (fromList attackerTypeList ! (fst x)) Crab
then applySurface (fst (snd x)) (snd (snd x)) (getCrabImg appData) (getScreen appData)
else if attackerTypeEq (fromList attackerTypeList ! (fst x)) Octopus
then applySurface (fst (snd x)) (snd (snd x)) (getOctopusImg appData) (getScreen appData)
else if attackerTypeEq (fromList attackerTypeList ! (fst x)) Squid
then applySurface (fst (snd x)) (snd (snd x)) (getSquidImg appData) (getScreen appData)
else applySurface (fst (snd x)) (snd (snd x)) (getSpaceshipImg appData) (getScreen appData)
-- Loop through all remaining attackers to display
displayAttacker attackerTypeList appData xs
-- Display all bunkers
| 802 |
displayAttacker attackerTypeList appData (x:xs) = do
-- Display by type
if attackerTypeEq (fromList attackerTypeList ! (fst x)) Crab
then applySurface (fst (snd x)) (snd (snd x)) (getCrabImg appData) (getScreen appData)
else if attackerTypeEq (fromList attackerTypeList ! (fst x)) Octopus
then applySurface (fst (snd x)) (snd (snd x)) (getOctopusImg appData) (getScreen appData)
else if attackerTypeEq (fromList attackerTypeList ! (fst x)) Squid
then applySurface (fst (snd x)) (snd (snd x)) (getSquidImg appData) (getScreen appData)
else applySurface (fst (snd x)) (snd (snd x)) (getSpaceshipImg appData) (getScreen appData)
-- Loop through all remaining attackers to display
displayAttacker attackerTypeList appData xs
-- Display all bunkers
| 802 |
displayAttacker attackerTypeList appData (x:xs) = do
-- Display by type
if attackerTypeEq (fromList attackerTypeList ! (fst x)) Crab
then applySurface (fst (snd x)) (snd (snd x)) (getCrabImg appData) (getScreen appData)
else if attackerTypeEq (fromList attackerTypeList ! (fst x)) Octopus
then applySurface (fst (snd x)) (snd (snd x)) (getOctopusImg appData) (getScreen appData)
else if attackerTypeEq (fromList attackerTypeList ! (fst x)) Squid
then applySurface (fst (snd x)) (snd (snd x)) (getSquidImg appData) (getScreen appData)
else applySurface (fst (snd x)) (snd (snd x)) (getSpaceshipImg appData) (getScreen appData)
-- Loop through all remaining attackers to display
displayAttacker attackerTypeList appData xs
-- Display all bunkers
| 802 | false | false | 0 | 14 | 158 | 303 | 151 | 152 | null | null |
bos/text
|
tests/Tests/Properties/Basics.hs
|
bsd-2-clause
|
sf_last p = (last . L.filter p) `eqP` (S.last . S.filter p)
| 67 |
sf_last p = (last . L.filter p) `eqP` (S.last . S.filter p)
| 67 |
sf_last p = (last . L.filter p) `eqP` (S.last . S.filter p)
| 67 | false | false | 0 | 9 | 19 | 41 | 21 | 20 | null | null |
kirhgoff/haskell-sandbox
|
euler32/euler32.hs
|
mit
|
isValidFinal ns ms ps =
let
n = fromDigits ns
m = fromDigits ms
p = fromDigits ps
in
if n * m == p
then Just p
else Nothing
| 156 |
isValidFinal ns ms ps =
let
n = fromDigits ns
m = fromDigits ms
p = fromDigits ps
in
if n * m == p
then Just p
else Nothing
| 156 |
isValidFinal ns ms ps =
let
n = fromDigits ns
m = fromDigits ms
p = fromDigits ps
in
if n * m == p
then Just p
else Nothing
| 156 | false | false | 0 | 9 | 62 | 62 | 30 | 32 | null | null |
wiggly/workshop
|
app/Main.hs
|
bsd-3-clause
|
ackerman :: Int -> Int -> Int -> Int
ackerman m n 0 = m + n
| 59 |
ackerman :: Int -> Int -> Int -> Int
ackerman m n 0 = m + n
| 59 |
ackerman m n 0 = m + n
| 22 | false | true | 0 | 7 | 16 | 34 | 17 | 17 | null | null |
tel/haskell-maia
|
maia/src/Maia/Request.hs
|
mpl-2.0
|
lRequest' :: Lens' (Request t) (Rec Req (Fields t))
lRequest' inj (Request rc) = Request <$> inj rc
| 99 |
lRequest' :: Lens' (Request t) (Rec Req (Fields t))
lRequest' inj (Request rc) = Request <$> inj rc
| 99 |
lRequest' inj (Request rc) = Request <$> inj rc
| 47 | false | true | 0 | 9 | 17 | 54 | 26 | 28 | null | null |
kawamuray/ganeti
|
src/Ganeti/HTools/Loader.hs
|
gpl-2.0
|
-- * Functions
-- | Lookups a node into an assoc list.
lookupNode :: (Monad m) => NameAssoc -> String -> String -> m Ndx
lookupNode ktn inst node =
maybe (fail $ "Unknown node '" ++ node ++ "' for instance " ++ inst) return $
M.lookup node ktn
| 250 |
lookupNode :: (Monad m) => NameAssoc -> String -> String -> m Ndx
lookupNode ktn inst node =
maybe (fail $ "Unknown node '" ++ node ++ "' for instance " ++ inst) return $
M.lookup node ktn
| 194 |
lookupNode ktn inst node =
maybe (fail $ "Unknown node '" ++ node ++ "' for instance " ++ inst) return $
M.lookup node ktn
| 128 | true | true | 0 | 11 | 56 | 86 | 41 | 45 | null | null |
conal/hermit
|
src/HERMIT/PrettyPrinter/Glyphs.hs
|
bsd-2-clause
|
withNoStyle :: Maybe SyntaxForColor -> String -> IO ()
withNoStyle _ str = putStr str
| 85 |
withNoStyle :: Maybe SyntaxForColor -> String -> IO ()
withNoStyle _ str = putStr str
| 85 |
withNoStyle _ str = putStr str
| 30 | false | true | 0 | 8 | 14 | 35 | 16 | 19 | null | null |
peterbecich/haskell-programming-first-principles
|
src/Chapter17.hs
|
bsd-3-clause
|
append (Cons x xs) ys = Cons x $ xs `append` ys
| 47 |
append (Cons x xs) ys = Cons x $ xs `append` ys
| 47 |
append (Cons x xs) ys = Cons x $ xs `append` ys
| 47 | false | false | 3 | 6 | 11 | 40 | 17 | 23 | null | null |
mightymoose/liquidhaskell
|
src/Language/Haskell/Liquid/Simplify.hs
|
bsd-3-clause
|
-- OLD isBoundLike (RConc pred) = isBoundLikePred pred
-- OLD isBoundLike (RKvar _ _) = False
-- OLD moreThan 0 _ = True
-- OLD moreThan _ [] = False
-- OLD moreThan i (True : xs) = moreThan (i-1) xs
-- OLD moreThan i (False : xs) = moreThan i xs
simplifyLen :: Int
simplifyLen = 5
| 309 |
simplifyLen :: Int
simplifyLen = 5
| 34 |
simplifyLen = 5
| 15 | true | true | 0 | 6 | 85 | 24 | 13 | 11 | null | null |
TomMD/cryptol
|
sbv/Data/SBV/SMT/SMTLib2.hs
|
bsd-3-clause
|
negIf False a = a
| 17 |
negIf False a = a
| 17 |
negIf False a = a
| 17 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
fpco/cabal
|
cabal-install/Distribution/Client/InstallPlan.hs
|
bsd-3-clause
|
stateDependencyRelation (Configured _) (Configured _) = True
| 62 |
stateDependencyRelation (Configured _) (Configured _) = True
| 62 |
stateDependencyRelation (Configured _) (Configured _) = True
| 62 | false | false | 0 | 7 | 8 | 23 | 11 | 12 | null | null |
monsanto/hie
|
Hie/Language/Haskell/Exts/Build.hs
|
gpl-3.0
|
-- | A list expression.
listE :: [Exp] -> Exp
listE = List
| 58 |
listE :: [Exp] -> Exp
listE = List
| 34 |
listE = List
| 12 | true | true | 0 | 6 | 12 | 19 | 11 | 8 | null | null |
pellagic-puffbomb/simpleservantblog
|
src/Api/Post.hs
|
bsd-3-clause
|
getSeriesDetailH :: Int -> SimpleHandler BlogSeries
getSeriesDetailH seriesId = runHandlerDbHelper $ \db -> do
let q = "select * from series where id = ?"
res <- liftIO $ query db q (Only seriesId)
case res of
(x:_) -> return x
_ -> throwError $ appJson404 "Series not found"
| 293 |
getSeriesDetailH :: Int -> SimpleHandler BlogSeries
getSeriesDetailH seriesId = runHandlerDbHelper $ \db -> do
let q = "select * from series where id = ?"
res <- liftIO $ query db q (Only seriesId)
case res of
(x:_) -> return x
_ -> throwError $ appJson404 "Series not found"
| 293 |
getSeriesDetailH seriesId = runHandlerDbHelper $ \db -> do
let q = "select * from series where id = ?"
res <- liftIO $ query db q (Only seriesId)
case res of
(x:_) -> return x
_ -> throwError $ appJson404 "Series not found"
| 241 | false | true | 0 | 13 | 66 | 99 | 47 | 52 | null | null |
ygale/timezone-series
|
Data/Time/LocalTime/TimeZone/Series.hs
|
bsd-3-clause
|
compareLengths (_:_ ) _ = GT
| 33 |
compareLengths (_:_ ) _ = GT
| 33 |
compareLengths (_:_ ) _ = GT
| 33 | false | false | 0 | 7 | 10 | 18 | 9 | 9 | null | null |
AlexanderPankiv/ghc
|
compiler/coreSyn/CoreSeq.hs
|
bsd-3-clause
|
seqPairs :: [(CoreBndr, CoreExpr)] -> ()
seqPairs [] = ()
| 57 |
seqPairs :: [(CoreBndr, CoreExpr)] -> ()
seqPairs [] = ()
| 57 |
seqPairs [] = ()
| 16 | false | true | 0 | 7 | 9 | 33 | 18 | 15 | null | null |
batterseapower/context-semantics
|
Language/ContextSemantics/CallByNeedLambda.hs
|
bsd-3-clause
|
croissant :: String -> Port -> Port -> (Port, Port)
croissant s forced_out boxed_out = (forced_in, boxed_in)
where
forced_in tss = boxed_out (insert [Symbol s] tss)
boxed_in tss = case cursor tss of
[Symbol s'] | s == s' -> forced_out (delete tss)
_ -> Left $ "croissant: boxed port got malformed incoming context " ++ show tss
| 378 |
croissant :: String -> Port -> Port -> (Port, Port)
croissant s forced_out boxed_out = (forced_in, boxed_in)
where
forced_in tss = boxed_out (insert [Symbol s] tss)
boxed_in tss = case cursor tss of
[Symbol s'] | s == s' -> forced_out (delete tss)
_ -> Left $ "croissant: boxed port got malformed incoming context " ++ show tss
| 378 |
croissant s forced_out boxed_out = (forced_in, boxed_in)
where
forced_in tss = boxed_out (insert [Symbol s] tss)
boxed_in tss = case cursor tss of
[Symbol s'] | s == s' -> forced_out (delete tss)
_ -> Left $ "croissant: boxed port got malformed incoming context " ++ show tss
| 326 | false | true | 2 | 11 | 108 | 144 | 66 | 78 | null | null |
collective/ECSpooler
|
backends/haskell/haskell_libs/Graph.hs
|
gpl-2.0
|
{-- End of Adjacency matrix representation --}
depthFirstSearch start g = dfs [start] []
where
dfs [] vis = vis
dfs (c:cs) vis
| elem c vis = dfs cs vis
| otherwise = dfs ((adjacent g c)++cs) (vis++[c])
| 230 |
depthFirstSearch start g = dfs [start] []
where
dfs [] vis = vis
dfs (c:cs) vis
| elem c vis = dfs cs vis
| otherwise = dfs ((adjacent g c)++cs) (vis++[c])
| 182 |
depthFirstSearch start g = dfs [start] []
where
dfs [] vis = vis
dfs (c:cs) vis
| elem c vis = dfs cs vis
| otherwise = dfs ((adjacent g c)++cs) (vis++[c])
| 182 | true | false | 1 | 9 | 66 | 107 | 53 | 54 | null | null |
ctlab/gShell
|
src/Gshell/Names.hs
|
mit
|
unionfsLogFileName = "unionfs.log"
| 34 |
unionfsLogFileName = "unionfs.log"
| 34 |
unionfsLogFileName = "unionfs.log"
| 34 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
hvr/jhc
|
lib/haskell-extras/Data/IORef.hs
|
mit
|
readIORef :: IORef a -> IO a
readIORef (IORef r) = fromUIO $ \w -> readRef__ r w
| 80 |
readIORef :: IORef a -> IO a
readIORef (IORef r) = fromUIO $ \w -> readRef__ r w
| 80 |
readIORef (IORef r) = fromUIO $ \w -> readRef__ r w
| 51 | false | true | 0 | 9 | 17 | 48 | 22 | 26 | null | null |
silky/csound-expression
|
src/Csound/Air/Envelope.hs
|
bsd-3-clause
|
lindur :: [D] -> Sig
lindur = linseg . onIdur
| 45 |
lindur :: [D] -> Sig
lindur = linseg . onIdur
| 45 |
lindur = linseg . onIdur
| 24 | false | true | 0 | 6 | 9 | 22 | 12 | 10 | null | null |
Docteur-Lalla/HsSHAUN
|
src/Shaun/Syntax/Lexer.hs
|
bsd-3-clause
|
makeLexer :: String -> Lexer [Token]
makeLexer "" = Right ("", [])
| 68 |
makeLexer :: String -> Lexer [Token]
makeLexer "" = Right ("", [])
| 66 |
makeLexer "" = Right ("", [])
| 29 | false | true | 0 | 8 | 13 | 39 | 19 | 20 | null | null |
schernichkin/haskell-invertible-syntax-attoparsec
|
src/Text/Syntax/Parser/Attoparsec/Types.hs
|
bsd-3-clause
|
runIResult :: A.IResult tsc a -> S.IResult tsc a ([String], String)
runIResult r' = case r' of
A.Fail tks estack msg -> S.Fail tks (estack, msg)
A.Partial f -> S.Partial $ runIResult . f
A.Done tks r -> S.Done tks r
| 240 |
runIResult :: A.IResult tsc a -> S.IResult tsc a ([String], String)
runIResult r' = case r' of
A.Fail tks estack msg -> S.Fail tks (estack, msg)
A.Partial f -> S.Partial $ runIResult . f
A.Done tks r -> S.Done tks r
| 240 |
runIResult r' = case r' of
A.Fail tks estack msg -> S.Fail tks (estack, msg)
A.Partial f -> S.Partial $ runIResult . f
A.Done tks r -> S.Done tks r
| 172 | false | true | 0 | 10 | 65 | 120 | 58 | 62 | null | null |
alphaHeavy/hlint
|
data/Default.hs
|
gpl-2.0
|
error = mapM_ putChar ==> putStr
| 32 |
error = mapM_ putChar ==> putStr
| 32 |
error = mapM_ putChar ==> putStr
| 32 | false | false | 1 | 5 | 5 | 16 | 6 | 10 | null | null |
patperry/lapack
|
tests/Orthogonal.hs
|
bsd-3-clause
|
prop_perm_herm_apply (Nat n) =
forAll (testPerm n) $ \p ->
forAll (Test.vector n) $ \(x :: V) ->
p <*> herm p <*> x === x
| 140 |
prop_perm_herm_apply (Nat n) =
forAll (testPerm n) $ \p ->
forAll (Test.vector n) $ \(x :: V) ->
p <*> herm p <*> x === x
| 140 |
prop_perm_herm_apply (Nat n) =
forAll (testPerm n) $ \p ->
forAll (Test.vector n) $ \(x :: V) ->
p <*> herm p <*> x === x
| 140 | false | false | 0 | 12 | 44 | 75 | 37 | 38 | null | null |
danoctavian/shepherd
|
src/Network/BitTorrent/Shepherd.hs
|
gpl-2.0
|
logger = "shepherd"
| 19 |
logger = "shepherd"
| 19 |
logger = "shepherd"
| 19 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
gneuvill/haskell-exos
|
src/Week1/Exos.hs
|
bsd-3-clause
|
toDigits :: Integer -> [Integer]
toDigits = myReverse . toDigitsRev
| 67 |
toDigits :: Integer -> [Integer]
toDigits = myReverse . toDigitsRev
| 67 |
toDigits = myReverse . toDigitsRev
| 34 | false | true | 0 | 8 | 9 | 29 | 13 | 16 | null | null |
kowey/GenI
|
src/NLP/GenI.hs
|
gpl-2.0
|
throwOnParseError _ (Right p) = return p
| 41 |
throwOnParseError _ (Right p) = return p
| 41 |
throwOnParseError _ (Right p) = return p
| 41 | false | false | 1 | 6 | 7 | 22 | 9 | 13 | null | null |
barrucadu/irc-client
|
Network/IRC/Client/Internal.hs
|
mit
|
logConduit :: MonadIO m => (a -> IO ()) -> ConduitM a a m ()
logConduit logf = awaitForever $ \x -> do
-- Call the logging function
liftIO $ logf x
-- And pass the message on
yield x
-- | Print messages to stdout, with the current time.
| 246 |
logConduit :: MonadIO m => (a -> IO ()) -> ConduitM a a m ()
logConduit logf = awaitForever $ \x -> do
-- Call the logging function
liftIO $ logf x
-- And pass the message on
yield x
-- | Print messages to stdout, with the current time.
| 246 |
logConduit logf = awaitForever $ \x -> do
-- Call the logging function
liftIO $ logf x
-- And pass the message on
yield x
-- | Print messages to stdout, with the current time.
| 185 | false | true | 0 | 10 | 59 | 76 | 37 | 39 | null | null |
m-alvarez/arithmetic
|
Arithmetic/Tests/Int/Incorrect.hs
|
mit
|
addition_overflow :: Int -> Bool
addition_overflow i = i + 1 > i
| 64 |
addition_overflow :: Int -> Bool
addition_overflow i = i + 1 > i
| 64 |
addition_overflow i = i + 1 > i
| 31 | false | true | 0 | 6 | 12 | 26 | 13 | 13 | null | null |
haskellGardener/yusic
|
src/Yusic.hs
|
mit
|
fromKeyGuide KG_GMinor7 = G:As_Bb:D:F :[]
| 64 |
fromKeyGuide KG_GMinor7 = G:As_Bb:D:F :[]
| 64 |
fromKeyGuide KG_GMinor7 = G:As_Bb:D:F :[]
| 64 | false | false | 0 | 8 | 27 | 27 | 13 | 14 | null | null |
mdsteele/fallback
|
src/Fallback/Test/Couple.hs
|
gpl-3.0
|
-------------------------------------------------------------------------------
coupleTests :: Test
coupleTests = "couple" ~: TestList [
qcTest $ \a b -> makeCouple a b == (makeCouple b a :: CI),
qcTest $ \a b c d e f -> Set.fromList [a, b, c, d, e, f] ==
flattenCoupleSet (Set.fromList [makeCouple a b, makeCouple c d,
(makeCouple e f :: CI)]),
qcTest $ \a b -> fromCouple (makeCouple a b :: CI) == (min a b, max a b)]
| 486 |
coupleTests :: Test
coupleTests = "couple" ~: TestList [
qcTest $ \a b -> makeCouple a b == (makeCouple b a :: CI),
qcTest $ \a b c d e f -> Set.fromList [a, b, c, d, e, f] ==
flattenCoupleSet (Set.fromList [makeCouple a b, makeCouple c d,
(makeCouple e f :: CI)]),
qcTest $ \a b -> fromCouple (makeCouple a b :: CI) == (min a b, max a b)]
| 405 |
coupleTests = "couple" ~: TestList [
qcTest $ \a b -> makeCouple a b == (makeCouple b a :: CI),
qcTest $ \a b c d e f -> Set.fromList [a, b, c, d, e, f] ==
flattenCoupleSet (Set.fromList [makeCouple a b, makeCouple c d,
(makeCouple e f :: CI)]),
qcTest $ \a b -> fromCouple (makeCouple a b :: CI) == (min a b, max a b)]
| 385 | true | true | 0 | 16 | 138 | 197 | 103 | 94 | null | null |
lennart/tidal-midi
|
Sound/Tidal/Rytm.hs
|
gpl-3.0
|
delrev = makeF oscKeys "synth7"
| 37 |
delrev = makeF oscKeys "synth7"
| 37 |
delrev = makeF oscKeys "synth7"
| 37 | false | false | 1 | 5 | 10 | 14 | 5 | 9 | null | null |
fmthoma/ghc
|
compiler/coreSyn/PprCore.hs
|
bsd-3-clause
|
-- Lambda bound type variables are preceded by "@"
pprCoreBinder bind_site bndr
= getPprStyle $ \ sty ->
pprTypedLamBinder bind_site (debugStyle sty) bndr
| 160 |
pprCoreBinder bind_site bndr
= getPprStyle $ \ sty ->
pprTypedLamBinder bind_site (debugStyle sty) bndr
| 109 |
pprCoreBinder bind_site bndr
= getPprStyle $ \ sty ->
pprTypedLamBinder bind_site (debugStyle sty) bndr
| 109 | true | false | 0 | 9 | 28 | 34 | 17 | 17 | null | null |
conal/ghc-mod
|
Cabal.hs
|
bsd-3-clause
|
findTarget :: Parser (Maybe [String])
findTarget = Just <$> hs_source_dirs
<|> (anyChar >> findTarget)
<|> Nothing <$ endOfInput
| 146 |
findTarget :: Parser (Maybe [String])
findTarget = Just <$> hs_source_dirs
<|> (anyChar >> findTarget)
<|> Nothing <$ endOfInput
| 146 |
findTarget = Just <$> hs_source_dirs
<|> (anyChar >> findTarget)
<|> Nothing <$ endOfInput
| 108 | false | true | 0 | 9 | 35 | 46 | 24 | 22 | null | null |
arkon/courseography
|
hs/Svg/Parser.hs
|
gpl-3.0
|
parseTransform transform =
let parsedTransform = splitOn "," $ drop 10 transform
xPos = read $ parsedTransform !! 0
yPos = read $ init $ parsedTransform !! 1
in (xPos, yPos)
| 197 |
parseTransform transform =
let parsedTransform = splitOn "," $ drop 10 transform
xPos = read $ parsedTransform !! 0
yPos = read $ init $ parsedTransform !! 1
in (xPos, yPos)
| 197 |
parseTransform transform =
let parsedTransform = splitOn "," $ drop 10 transform
xPos = read $ parsedTransform !! 0
yPos = read $ init $ parsedTransform !! 1
in (xPos, yPos)
| 197 | false | false | 0 | 11 | 54 | 68 | 34 | 34 | null | null |
amplify-education/filestore
|
Data/FileStore/Mercurial.hs
|
bsd-3-clause
|
{- The following code goes not work because of a bug in mercurial. If the final line of a file
does not end with a newline and you search for a word in the final line, hg does not display
the line from the file correctly. In the results, the last character line is not printed.
mercurialSearch repo query = do
let patterns = map escapeRegexSpecialChars $ queryPatterns query
pattern = if queryWholeWords query
then "(\\b" ++ foldr1 (\a b -> a ++ "\\b|\\b" ++ b) patterns ++ "\\b)"
else "(" ++ foldr1 (\a b -> a ++ "|" ++ b) patterns ++ ")"
(status, errOutput, output) <- runMercurialCommand repo "grep" (["--ignore-case" | queryIgnoreCase query] ++ ["-n", "-0", pattern])
case status of
ExitSuccess -> do
putStrLn $ show output
case P.parse parseMercurialSearch "" (toString output) of
Left err' -> throwIO $ UnknownError $ "Error parsing mercurial search results.\n" ++ show err'
Right parsed -> return parsed
ExitFailure 1 -> return [] -- status of 1 means no matches
ExitFailure _ -> throwIO $ UnknownError $ "mercurial grep returned error status.\n" ++ errOutput
-}
mercurialLogFormat :: String
mercurialLogFormat = "{node}\\n{date|rfc822date}\\n{author|person}\\n{author|email}\\n{desc}\\x00{file_adds}\\x00{file_mods}\\x00{file_dels}\\x00"
| 1,411 |
mercurialLogFormat :: String
mercurialLogFormat = "{node}\\n{date|rfc822date}\\n{author|person}\\n{author|email}\\n{desc}\\x00{file_adds}\\x00{file_mods}\\x00{file_dels}\\x00"
| 175 |
mercurialLogFormat = "{node}\\n{date|rfc822date}\\n{author|person}\\n{author|email}\\n{desc}\\x00{file_adds}\\x00{file_mods}\\x00{file_dels}\\x00"
| 146 | true | true | 0 | 4 | 354 | 12 | 7 | 5 | null | null |
c0deaddict/project-euler
|
src/Part2/Problem45.hs
|
bsd-3-clause
|
isHexagonal :: Int -> Bool
isHexagonal x = x == hex n || x == hex (n + 1) where
hex n = n*(2*n - 1)
hx = x `div` 2
n = squareRoot hx
| 138 |
isHexagonal :: Int -> Bool
isHexagonal x = x == hex n || x == hex (n + 1) where
hex n = n*(2*n - 1)
hx = x `div` 2
n = squareRoot hx
| 138 |
isHexagonal x = x == hex n || x == hex (n + 1) where
hex n = n*(2*n - 1)
hx = x `div` 2
n = squareRoot hx
| 111 | false | true | 0 | 10 | 40 | 87 | 45 | 42 | null | null |
brendanhay/gogol
|
gogol-spanner/gen/Network/Google/Resource/Spanner/Projects/Instances/Databases/Get.hs
|
mpl-2.0
|
-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
pidgUploadType :: Lens' ProjectsInstancesDatabasesGet (Maybe Text)
pidgUploadType
= lens _pidgUploadType
(\ s a -> s{_pidgUploadType = a})
| 217 |
pidgUploadType :: Lens' ProjectsInstancesDatabasesGet (Maybe Text)
pidgUploadType
= lens _pidgUploadType
(\ s a -> s{_pidgUploadType = a})
| 146 |
pidgUploadType
= lens _pidgUploadType
(\ s a -> s{_pidgUploadType = a})
| 79 | true | true | 0 | 8 | 34 | 49 | 25 | 24 | null | null |
kosmoskatten/hats
|
src/Network/Nats/Message/Parser.hs
|
mit
|
parseTlsRequired :: Parser HandshakeMessageField
parseTlsRequired = pair "\"tls_required\"" boolean "tls_required" Bool
| 119 |
parseTlsRequired :: Parser HandshakeMessageField
parseTlsRequired = pair "\"tls_required\"" boolean "tls_required" Bool
| 119 |
parseTlsRequired = pair "\"tls_required\"" boolean "tls_required" Bool
| 70 | false | true | 0 | 6 | 10 | 29 | 12 | 17 | null | null |
fehu/hneuro
|
src/Test1.hs
|
mit
|
test = inputsLayer (undefined :: Nat' N2)
==> nextLayer ( NeuronInputs (\(HCons il _) -> vecElem1 il +: vecElem2 il +: VNil)
+: NeuronInputs (\(HCons il _) -> vecElem1 il +: vecElem2 il +: VNil)
+: VNil
)
==> nextLayer ( NeuronInputs (\(HCons l1 _) -> vecElem1 l1 +: vecElem2 l1 +: VNil)
+: NeuronInputs (\(HCons l1 (HCons il _)) -> vecElem1 il +: vecElem2 l1 +: VNil)
+: NeuronInputs (\(HCons l1 (HCons il _)) -> vecElem1 l1 +: vecElem2 il +: VNil)
+: VNil
)
==> lastLayer ( NeuronInputs (\(HCons l2 _) -> vecElem1 l2
+: vecElem2 l2
+: vecElem3 l2
+: VNil
) +: VNil
)
| 919 |
test = inputsLayer (undefined :: Nat' N2)
==> nextLayer ( NeuronInputs (\(HCons il _) -> vecElem1 il +: vecElem2 il +: VNil)
+: NeuronInputs (\(HCons il _) -> vecElem1 il +: vecElem2 il +: VNil)
+: VNil
)
==> nextLayer ( NeuronInputs (\(HCons l1 _) -> vecElem1 l1 +: vecElem2 l1 +: VNil)
+: NeuronInputs (\(HCons l1 (HCons il _)) -> vecElem1 il +: vecElem2 l1 +: VNil)
+: NeuronInputs (\(HCons l1 (HCons il _)) -> vecElem1 l1 +: vecElem2 il +: VNil)
+: VNil
)
==> lastLayer ( NeuronInputs (\(HCons l2 _) -> vecElem1 l2
+: vecElem2 l2
+: vecElem3 l2
+: VNil
) +: VNil
)
| 919 |
test = inputsLayer (undefined :: Nat' N2)
==> nextLayer ( NeuronInputs (\(HCons il _) -> vecElem1 il +: vecElem2 il +: VNil)
+: NeuronInputs (\(HCons il _) -> vecElem1 il +: vecElem2 il +: VNil)
+: VNil
)
==> nextLayer ( NeuronInputs (\(HCons l1 _) -> vecElem1 l1 +: vecElem2 l1 +: VNil)
+: NeuronInputs (\(HCons l1 (HCons il _)) -> vecElem1 il +: vecElem2 l1 +: VNil)
+: NeuronInputs (\(HCons l1 (HCons il _)) -> vecElem1 l1 +: vecElem2 il +: VNil)
+: VNil
)
==> lastLayer ( NeuronInputs (\(HCons l2 _) -> vecElem1 l2
+: vecElem2 l2
+: vecElem3 l2
+: VNil
) +: VNil
)
| 919 | false | false | 3 | 17 | 458 | 295 | 145 | 150 | null | null |
wizzup/advent_of_code
|
2016/3/part1.hs
|
mit
|
check _ = error "Invalid input"
| 37 |
check _ = error "Invalid input"
| 37 |
check _ = error "Invalid input"
| 37 | false | false | 0 | 4 | 11 | 13 | 5 | 8 | null | null |
prasmussen/glot-www
|
Handler/Compose.hs
|
mit
|
getComposeR :: Language.Id -> Handler Html
getComposeR langId = do
language <- Handler.getLanguage langId
now <- liftIO getCurrentTime
let snippet = defaultSnippet language now
let files = defaultSnippetFiles language
defaultLayout $ do
setTitle (composeTitle language)
setDescription (composeDescription language)
Handler.setCanonicalUrl (ComposeR langId)
$(widgetFile "compose")
| 432 |
getComposeR :: Language.Id -> Handler Html
getComposeR langId = do
language <- Handler.getLanguage langId
now <- liftIO getCurrentTime
let snippet = defaultSnippet language now
let files = defaultSnippetFiles language
defaultLayout $ do
setTitle (composeTitle language)
setDescription (composeDescription language)
Handler.setCanonicalUrl (ComposeR langId)
$(widgetFile "compose")
| 432 |
getComposeR langId = do
language <- Handler.getLanguage langId
now <- liftIO getCurrentTime
let snippet = defaultSnippet language now
let files = defaultSnippetFiles language
defaultLayout $ do
setTitle (composeTitle language)
setDescription (composeDescription language)
Handler.setCanonicalUrl (ComposeR langId)
$(widgetFile "compose")
| 389 | false | true | 0 | 12 | 94 | 126 | 54 | 72 | null | null |
beni55/texmath
|
src/Text/TeXMath/Readers/TeX.hs
|
gpl-2.0
|
tilde 'u' = "ũ"
| 15 |
tilde 'u' = "ũ"
| 15 |
tilde 'u' = "ũ"
| 15 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
input-output-hk/cardano-sl
|
generator/test/Test/Pos/Block/Logic/CreationSpec.hs
|
apache-2.0
|
spec :: Spec
spec = do
runWithMagic RequiresNoMagic
runWithMagic RequiresMagic
| 86 |
spec :: Spec
spec = do
runWithMagic RequiresNoMagic
runWithMagic RequiresMagic
| 86 |
spec = do
runWithMagic RequiresNoMagic
runWithMagic RequiresMagic
| 73 | false | true | 0 | 8 | 17 | 30 | 11 | 19 | null | null |
geocurnoff/nikki
|
src/Physics/Chipmunk/Types.hs
|
lgpl-3.0
|
translateVector :: Ptr QPainter -> Vector -> IO ()
translateVector ptr v = translate ptr $ vector2position v
| 108 |
translateVector :: Ptr QPainter -> Vector -> IO ()
translateVector ptr v = translate ptr $ vector2position v
| 108 |
translateVector ptr v = translate ptr $ vector2position v
| 57 | false | true | 0 | 9 | 17 | 46 | 20 | 26 | null | null |
jgoerzen/dtmconv
|
HaXml-1.12/src/Text/XML/HaXml/Combinators.hs
|
gpl-2.0
|
cat :: [a->[b]] -> (a->[b])
-- Specification: cat fs = \e-> concat [ f e | f <- fs ]
-- more efficient implementation below:
cat [] = const []
| 146 |
cat :: [a->[b]] -> (a->[b])
cat [] = const []
| 45 |
cat [] = const []
| 17 | true | true | 0 | 8 | 33 | 51 | 27 | 24 | null | null |
MateVM/harpy
|
Harpy/X86Assembler.hs
|
gpl-2.0
|
cvttps2dq :: XMMLoc xmm a => XMMReg -> xmm -> CodeGen e s ()
cvttps2dq (XMMReg dreg) reg =
x86_cvttps2dq dreg (xmmLocLowLevel reg)
| 133 |
cvttps2dq :: XMMLoc xmm a => XMMReg -> xmm -> CodeGen e s ()
cvttps2dq (XMMReg dreg) reg =
x86_cvttps2dq dreg (xmmLocLowLevel reg)
| 133 |
cvttps2dq (XMMReg dreg) reg =
x86_cvttps2dq dreg (xmmLocLowLevel reg)
| 72 | false | true | 0 | 9 | 25 | 59 | 28 | 31 | null | null |
opqdonut/riot
|
Riot/UI.hs
|
gpl-2.0
|
maybehead [] = Nothing
| 22 |
maybehead [] = Nothing
| 22 |
maybehead [] = Nothing
| 22 | false | false | 0 | 6 | 3 | 11 | 5 | 6 | null | null |
jstolarek/ghc
|
libraries/base/Data/Fixed.hs
|
bsd-3-clause
|
withDot :: String -> String
withDot "" = ""
| 43 |
withDot :: String -> String
withDot "" = ""
| 43 |
withDot "" = ""
| 15 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
markus-git/imperative-edsl-vhdl
|
src/Language/Embedded/VHDL/Monad/Expression.hs
|
bsd-3-clause
|
--------------------------------------------------------------------------------
-- ** Shift Expressions
sll, srl, sla, sra, rol, ror :: SimpleExpression -> SimpleExpression -> ShiftExpression
sll = shiftexp Sll
| 212 |
sll, srl, sla, sra, rol, ror :: SimpleExpression -> SimpleExpression -> ShiftExpression
sll = shiftexp Sll
| 106 |
sll = shiftexp Sll
| 18 | true | true | 3 | 6 | 21 | 41 | 23 | 18 | null | null |
locaweb/leela
|
src/warpdrive/src/Leela/Data/LQL/Read.hs
|
apache-2.0
|
parseStmtPath :: Parser LQL
parseStmtPath = "path " *> (PathStmt <$> parseQuery)
| 80 |
parseStmtPath :: Parser LQL
parseStmtPath = "path " *> (PathStmt <$> parseQuery)
| 80 |
parseStmtPath = "path " *> (PathStmt <$> parseQuery)
| 52 | false | true | 0 | 7 | 11 | 25 | 13 | 12 | null | null |
christiaanb/ghc
|
compiler/stranal/DmdAnal.hs
|
bsd-3-clause
|
setOneShotness Many bndr = bndr
| 31 |
setOneShotness Many bndr = bndr
| 31 |
setOneShotness Many bndr = bndr
| 31 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
ambiata/highlighting-kate
|
Text/Highlighting/Kate/Syntax/Isocpp.hs
|
gpl-2.0
|
regex_'2e'2a = compileRegex True ".*"
| 37 |
regex_'2e'2a = compileRegex True ".*"
| 37 |
regex_'2e'2a = compileRegex True ".*"
| 37 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
muspellsson/hiccup
|
TclChan.hs
|
lgpl-2.1
|
deleteChan c (CM m) = CM (Map.delete (chanName c) m)
| 52 |
deleteChan c (CM m) = CM (Map.delete (chanName c) m)
| 52 |
deleteChan c (CM m) = CM (Map.delete (chanName c) m)
| 52 | false | false | 0 | 9 | 9 | 36 | 17 | 19 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.