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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
psibi/cabal2nix
|
src/Distribution/Nixpkgs/Haskell/FromCabal/PostProcess.hs
|
bsd-3-clause
|
postProcess :: Derivation -> Derivation
postProcess deriv = foldr ($) (fixGtkBuilds deriv) [ f | (Dependency n vr, f) <- hooks, packageName deriv == n, packageVersion deriv `withinRange` vr ]
| 191
|
postProcess :: Derivation -> Derivation
postProcess deriv = foldr ($) (fixGtkBuilds deriv) [ f | (Dependency n vr, f) <- hooks, packageName deriv == n, packageVersion deriv `withinRange` vr ]
| 191
|
postProcess deriv = foldr ($) (fixGtkBuilds deriv) [ f | (Dependency n vr, f) <- hooks, packageName deriv == n, packageVersion deriv `withinRange` vr ]
| 151
| false
| true
| 0
| 10
| 29
| 79
| 41
| 38
| null | null |
ndmitchell/shake
|
src/Test/Match.hs
|
bsd-3-clause
|
ain = testBuild test $ do
let output x file = writeFile' file x
["or*","*or"] |%> output ""
alternatives $ do
"alternative.t*" %> output "alternative.t*"
"alternative.*" %> output "alternative.*"
priority 100 $ priority 0 $ "priority.txt" %> output "100"
priority 50 $ "priority.txt" %> output "50"
alternatives $ do
priority 20 $ "altpri.txt" %> output "20"
priority 40 $ "altpri.txt" %> output "40"
priority 30 $ "altpri.txt" %> output "30"
alternatives $ do
priority 21 $ "altpri2.txt" %> output "21"
priority 22 $ "altpri2.txt" %> output "22"
priority 23 $ "altpri2.txt" %> output "23"
priority 55 $ alternatives $ "x" %> output "55"
priority 51 $ "x" %> output "51"
priority 42 $ alternatives $ "xx" %> output "42"
priority 43 $ "xx" %> output "43"
priority 10 $ do
priority 6 $ "change" %> output "6"
priority 7 $ "change" %> output "7"
priority 8 $ "change" %> output "8"
priority 9 $ "change" %> output "9"
| 1,055
|
main = testBuild test $ do
let output x file = writeFile' file x
["or*","*or"] |%> output ""
alternatives $ do
"alternative.t*" %> output "alternative.t*"
"alternative.*" %> output "alternative.*"
priority 100 $ priority 0 $ "priority.txt" %> output "100"
priority 50 $ "priority.txt" %> output "50"
alternatives $ do
priority 20 $ "altpri.txt" %> output "20"
priority 40 $ "altpri.txt" %> output "40"
priority 30 $ "altpri.txt" %> output "30"
alternatives $ do
priority 21 $ "altpri2.txt" %> output "21"
priority 22 $ "altpri2.txt" %> output "22"
priority 23 $ "altpri2.txt" %> output "23"
priority 55 $ alternatives $ "x" %> output "55"
priority 51 $ "x" %> output "51"
priority 42 $ alternatives $ "xx" %> output "42"
priority 43 $ "xx" %> output "43"
priority 10 $ do
priority 6 $ "change" %> output "6"
priority 7 $ "change" %> output "7"
priority 8 $ "change" %> output "8"
priority 9 $ "change" %> output "9"
| 1,055
|
main = testBuild test $ do
let output x file = writeFile' file x
["or*","*or"] |%> output ""
alternatives $ do
"alternative.t*" %> output "alternative.t*"
"alternative.*" %> output "alternative.*"
priority 100 $ priority 0 $ "priority.txt" %> output "100"
priority 50 $ "priority.txt" %> output "50"
alternatives $ do
priority 20 $ "altpri.txt" %> output "20"
priority 40 $ "altpri.txt" %> output "40"
priority 30 $ "altpri.txt" %> output "30"
alternatives $ do
priority 21 $ "altpri2.txt" %> output "21"
priority 22 $ "altpri2.txt" %> output "22"
priority 23 $ "altpri2.txt" %> output "23"
priority 55 $ alternatives $ "x" %> output "55"
priority 51 $ "x" %> output "51"
priority 42 $ alternatives $ "xx" %> output "42"
priority 43 $ "xx" %> output "43"
priority 10 $ do
priority 6 $ "change" %> output "6"
priority 7 $ "change" %> output "7"
priority 8 $ "change" %> output "8"
priority 9 $ "change" %> output "9"
| 1,055
| false
| false
| 1
| 13
| 298
| 389
| 162
| 227
| null | null |
DbIHbKA/vbpca
|
src/PCA/QModels.hs
|
bsd-3-clause
|
calcSigmaX
:: Int
-> Distr Double Double
-> Distr (Matrix Double) (Matrix Double)
-> Matrix Double
calcSigmaX d tau w = H.inv (ident d + mean tau `H.scale` wSquareMean)
where
mW = mean w
wSquareMean = variance w + (H.tr mW H.<> mW)
| 257
|
calcSigmaX
:: Int
-> Distr Double Double
-> Distr (Matrix Double) (Matrix Double)
-> Matrix Double
calcSigmaX d tau w = H.inv (ident d + mean tau `H.scale` wSquareMean)
where
mW = mean w
wSquareMean = variance w + (H.tr mW H.<> mW)
| 257
|
calcSigmaX d tau w = H.inv (ident d + mean tau `H.scale` wSquareMean)
where
mW = mean w
wSquareMean = variance w + (H.tr mW H.<> mW)
| 142
| false
| true
| 2
| 11
| 68
| 129
| 58
| 71
| null | null |
trobertson/merch
|
src/Merchandise/Types/Script.hs
|
bsd-3-clause
|
retrieveVal :: CS.CoreState
-> Pl.Player
-> Lens' CS.CoreState (M.Map T.Text a)
-> (a -> Var)
-> T.Text
-> Var
retrieveVal cs pl l f i =
case pl ^. Pl.modCS . l . at i of
Just x -> f x
Nothing -> case cs ^. l . at i of
Just y -> f y
Nothing -> VarError $ "Identifier Not Found: " `ta` i
-- transforms a Var into Text
| 433
|
retrieveVal :: CS.CoreState
-> Pl.Player
-> Lens' CS.CoreState (M.Map T.Text a)
-> (a -> Var)
-> T.Text
-> Var
retrieveVal cs pl l f i =
case pl ^. Pl.modCS . l . at i of
Just x -> f x
Nothing -> case cs ^. l . at i of
Just y -> f y
Nothing -> VarError $ "Identifier Not Found: " `ta` i
-- transforms a Var into Text
| 433
|
retrieveVal cs pl l f i =
case pl ^. Pl.modCS . l . at i of
Just x -> f x
Nothing -> case cs ^. l . at i of
Just y -> f y
Nothing -> VarError $ "Identifier Not Found: " `ta` i
-- transforms a Var into Text
| 262
| false
| true
| 0
| 12
| 188
| 157
| 77
| 80
| null | null |
allanderek/ipclib
|
Ipc/Ipc.hs
|
gpl-2.0
|
isShowLogOption :: CliOpt a -> Bool
isShowLogOption (CliShowLog) = True
| 71
|
isShowLogOption :: CliOpt a -> Bool
isShowLogOption (CliShowLog) = True
| 71
|
isShowLogOption (CliShowLog) = True
| 35
| false
| true
| 0
| 6
| 9
| 24
| 12
| 12
| null | null |
zhangyz/llvm-slicing
|
src/LLVM/Slicing/Static/Weiser/WeiserADT.hs
|
apache-2.0
|
runAnalysis :: RWS r b s a -> r -> s -> a
runAnalysis a r s = fst $ RW.evalRWS a r s
| 85
|
runAnalysis :: RWS r b s a -> r -> s -> a
runAnalysis a r s = fst $ RW.evalRWS a r s
| 84
|
runAnalysis a r s = fst $ RW.evalRWS a r s
| 42
| false
| true
| 0
| 9
| 24
| 57
| 26
| 31
| null | null |
LeviSchuck/RedReader
|
Red/Parse/RFL.hs
|
mit
|
parseRFLNavPoint :: RFContext -> AP.Parser RFLNavPoint
parseRFLNavPoint c = do
i <- AB.anyWord32le
-- traceM ("ID: " ++ show i)
fs <- parseVector 6 parseFloat
b1 <- AP.anyWord8
b2 <- AP.anyWord8
b3 <- AP.anyWord8
b4 <- AP.anyWord8
b5 <- AP.anyWord8
let flagsV = V.fromList [b1,b2,b3,b4,b5]
ua1 <- if b2 > 0
then do
bs <- AP.take 36
return $ Just bs
else return Nothing
ua2 <- AP.take 4
-- traceM ("Bytes: " ++ hexPrint ua1)
linksCount <- AB.anyWord32le
-- traceM ("Links: " ++ niceHex32 linksCount)
ls <- parseVector (fromIntegral linksCount) AB.anyWord32le
return $ RFLNavPoint i fs flagsV ua1 ua2 linksCount ls
| 716
|
parseRFLNavPoint :: RFContext -> AP.Parser RFLNavPoint
parseRFLNavPoint c = do
i <- AB.anyWord32le
-- traceM ("ID: " ++ show i)
fs <- parseVector 6 parseFloat
b1 <- AP.anyWord8
b2 <- AP.anyWord8
b3 <- AP.anyWord8
b4 <- AP.anyWord8
b5 <- AP.anyWord8
let flagsV = V.fromList [b1,b2,b3,b4,b5]
ua1 <- if b2 > 0
then do
bs <- AP.take 36
return $ Just bs
else return Nothing
ua2 <- AP.take 4
-- traceM ("Bytes: " ++ hexPrint ua1)
linksCount <- AB.anyWord32le
-- traceM ("Links: " ++ niceHex32 linksCount)
ls <- parseVector (fromIntegral linksCount) AB.anyWord32le
return $ RFLNavPoint i fs flagsV ua1 ua2 linksCount ls
| 716
|
parseRFLNavPoint c = do
i <- AB.anyWord32le
-- traceM ("ID: " ++ show i)
fs <- parseVector 6 parseFloat
b1 <- AP.anyWord8
b2 <- AP.anyWord8
b3 <- AP.anyWord8
b4 <- AP.anyWord8
b5 <- AP.anyWord8
let flagsV = V.fromList [b1,b2,b3,b4,b5]
ua1 <- if b2 > 0
then do
bs <- AP.take 36
return $ Just bs
else return Nothing
ua2 <- AP.take 4
-- traceM ("Bytes: " ++ hexPrint ua1)
linksCount <- AB.anyWord32le
-- traceM ("Links: " ++ niceHex32 linksCount)
ls <- parseVector (fromIntegral linksCount) AB.anyWord32le
return $ RFLNavPoint i fs flagsV ua1 ua2 linksCount ls
| 661
| false
| true
| 0
| 13
| 204
| 228
| 107
| 121
| null | null |
nickbart1980/pandoc
|
src/Text/Pandoc/Writers/Docbook.hs
|
gpl-2.0
|
inlineToDocbook _ (Code _ str) =
inTagsSimple "literal" $ text (escapeStringForXML str)
| 89
|
inlineToDocbook _ (Code _ str) =
inTagsSimple "literal" $ text (escapeStringForXML str)
| 89
|
inlineToDocbook _ (Code _ str) =
inTagsSimple "literal" $ text (escapeStringForXML str)
| 89
| false
| false
| 1
| 8
| 13
| 37
| 16
| 21
| null | null |
termite2/tsl
|
Frontend/RelationOps.hs
|
bsd-3-clause
|
rargType :: (?spec::Spec, ?scope::Scope) => RArg -> Type
rargType = Type ?scope . tspec
| 87
|
rargType :: (?spec::Spec, ?scope::Scope) => RArg -> Type
rargType = Type ?scope . tspec
| 87
|
rargType = Type ?scope . tspec
| 30
| false
| true
| 0
| 6
| 13
| 37
| 21
| 16
| null | null |
marklar/elm-fun
|
HR/widthBst.hs
|
mit
|
iameter (Node _ l r) =
maximum [ 1 + depth l + depth r
, diameter l
, diameter r
]
| 123
|
diameter (Node _ l r) =
maximum [ 1 + depth l + depth r
, diameter l
, diameter r
]
| 123
|
diameter (Node _ l r) =
maximum [ 1 + depth l + depth r
, diameter l
, diameter r
]
| 123
| false
| false
| 0
| 9
| 62
| 51
| 24
| 27
| null | null |
ekmett/ghclive
|
src-main/SeqMap.hs
|
bsd-3-clause
|
first _ = Nothing
| 31
|
first _ = Nothing
| 31
|
first _ = Nothing
| 31
| false
| false
| 0
| 4
| 17
| 10
| 4
| 6
| null | null |
iand675/Zoom
|
Zoom/Template/TH.hs
|
bsd-3-clause
|
render x = x undefined
| 22
|
render x = x undefined
| 22
|
render x = x undefined
| 22
| false
| false
| 0
| 5
| 4
| 12
| 5
| 7
| null | null |
orome/crypto-enigma
|
cli/enigma.hs
|
bsd-3-clause
|
omitArgFoot cmd = unlines [
"Note that providing no value, a value of '', or just spaces or invalid",
"characters for " ++ omittedArg ++ " is the same as omitting it."]
where omittedArg | cmd == "show" = "LETTER"
| otherwise = "MESSAGE"
| 301
|
omitArgFoot cmd = unlines [
"Note that providing no value, a value of '', or just spaces or invalid",
"characters for " ++ omittedArg ++ " is the same as omitting it."]
where omittedArg | cmd == "show" = "LETTER"
| otherwise = "MESSAGE"
| 301
|
omitArgFoot cmd = unlines [
"Note that providing no value, a value of '', or just spaces or invalid",
"characters for " ++ omittedArg ++ " is the same as omitting it."]
where omittedArg | cmd == "show" = "LETTER"
| otherwise = "MESSAGE"
| 301
| false
| false
| 0
| 10
| 108
| 52
| 25
| 27
| null | null |
8l/barrelfish
|
hake/ArchDefaults.hs
|
mit
|
cDefines options = [ Str ("-D"++s) | s <- [ "BARRELFISH",
"BF_BINARY_PREFIX=\\\"\\\"",
"_WANT_IO_C99_FORMATS" -- newlib C99 printf format specifiers
]
]
++ Config.defines
++ Config.arch_defines options
| 388
|
cDefines options = [ Str ("-D"++s) | s <- [ "BARRELFISH",
"BF_BINARY_PREFIX=\\\"\\\"",
"_WANT_IO_C99_FORMATS" -- newlib C99 printf format specifiers
]
]
++ Config.defines
++ Config.arch_defines options
| 388
|
cDefines options = [ Str ("-D"++s) | s <- [ "BARRELFISH",
"BF_BINARY_PREFIX=\\\"\\\"",
"_WANT_IO_C99_FORMATS" -- newlib C99 printf format specifiers
]
]
++ Config.defines
++ Config.arch_defines options
| 388
| false
| false
| 5
| 8
| 212
| 60
| 29
| 31
| null | null |
termite2/tsl
|
Abstract/BFormula.hs
|
bsd-3-clause
|
fRelIntEq1 :: (?spec::Spec) => (Expr, Expr) -> Formula
fRelIntEq1 (e1,e2) | exprWidth e1 <= maxAVarIntWidth && isConstExpr e2 = FEqConst (AVarInt $ scalarExprToTerm e1) i where i = fromInteger $ ivalVal $ evalConstExpr e2
| 227
|
fRelIntEq1 :: (?spec::Spec) => (Expr, Expr) -> Formula
fRelIntEq1 (e1,e2) | exprWidth e1 <= maxAVarIntWidth && isConstExpr e2 = FEqConst (AVarInt $ scalarExprToTerm e1) i where i = fromInteger $ ivalVal $ evalConstExpr e2
| 227
|
fRelIntEq1 (e1,e2) | exprWidth e1 <= maxAVarIntWidth && isConstExpr e2 = FEqConst (AVarInt $ scalarExprToTerm e1) i where i = fromInteger $ ivalVal $ evalConstExpr e2
| 172
| false
| true
| 0
| 10
| 39
| 96
| 48
| 48
| null | null |
rodrigogribeiro/mptc
|
src/Language/Haskell/Exts/Pretty.hs
|
bsd-3-clause
|
maybePP :: (a -> Doc) -> Maybe a -> Doc
maybePP pp Nothing = empty
| 66
|
maybePP :: (a -> Doc) -> Maybe a -> Doc
maybePP pp Nothing = empty
| 66
|
maybePP pp Nothing = empty
| 26
| false
| true
| 0
| 8
| 14
| 40
| 18
| 22
| null | null |
phischu/fragnix
|
benchmarks/containers/Data.Sequence.hs
|
bsd-3-clause
|
splitTree i (Deep _ pr m sf)
| i < spr = case splitDigit i pr of
Split l x r -> Split (maybe Empty digitToTree l) x (deepL r m sf)
| i < spm = case splitTree im m of
Split ml xs mr -> case splitNode (im - size ml) xs of
Split l x r -> Split (deepR pr ml l) x (deepL r mr sf)
| otherwise = case splitDigit (i - spm) sf of
Split l x r -> Split (deepR pr m l) x (maybe Empty digitToTree r)
where
spr = size pr
spm = spr + size m
im = i - spr
| 535
|
splitTree i (Deep _ pr m sf)
| i < spr = case splitDigit i pr of
Split l x r -> Split (maybe Empty digitToTree l) x (deepL r m sf)
| i < spm = case splitTree im m of
Split ml xs mr -> case splitNode (im - size ml) xs of
Split l x r -> Split (deepR pr ml l) x (deepL r mr sf)
| otherwise = case splitDigit (i - spm) sf of
Split l x r -> Split (deepR pr m l) x (maybe Empty digitToTree r)
where
spr = size pr
spm = spr + size m
im = i - spr
| 535
|
splitTree i (Deep _ pr m sf)
| i < spr = case splitDigit i pr of
Split l x r -> Split (maybe Empty digitToTree l) x (deepL r m sf)
| i < spm = case splitTree im m of
Split ml xs mr -> case splitNode (im - size ml) xs of
Split l x r -> Split (deepR pr ml l) x (deepL r mr sf)
| otherwise = case splitDigit (i - spm) sf of
Split l x r -> Split (deepR pr m l) x (maybe Empty digitToTree r)
where
spr = size pr
spm = spr + size m
im = i - spr
| 535
| false
| false
| 5
| 14
| 207
| 291
| 131
| 160
| null | null |
ghc-android/ghc
|
compiler/hsSyn/HsTypes.hs
|
bsd-3-clause
|
---------------------
mkAnonWildCardTy :: HsType RdrName
mkAnonWildCardTy = HsWildCardTy (AnonWildCard PlaceHolder)
| 115
|
mkAnonWildCardTy :: HsType RdrName
mkAnonWildCardTy = HsWildCardTy (AnonWildCard PlaceHolder)
| 93
|
mkAnonWildCardTy = HsWildCardTy (AnonWildCard PlaceHolder)
| 58
| true
| true
| 0
| 7
| 9
| 24
| 12
| 12
| null | null |
mightybyte/reflex-dom-stubs
|
src/GHCJS/DOM/HTMLInputElement.hs
|
bsd-3-clause
|
htmlInputElementSetSrc = undefined
| 34
|
htmlInputElementSetSrc = undefined
| 34
|
htmlInputElementSetSrc = undefined
| 34
| false
| false
| 1
| 5
| 2
| 10
| 3
| 7
| null | null |
Heather/Idris-dev
|
src/Idris/AbsSyntaxTree.hs
|
bsd-3-clause
|
inferDecl = PDatadecl inferTy primfc
(PType bi)
[(emptyDocstring, [], inferCon, primfc, PPi impl (sMN 0 "iType") primfc (PType bi) (
PPi expl (sMN 0 "ival") primfc (PRef bi [] (sMN 0 "iType"))
(PRef bi [] inferTy)), bi, [])]
| 370
|
inferDecl = PDatadecl inferTy primfc
(PType bi)
[(emptyDocstring, [], inferCon, primfc, PPi impl (sMN 0 "iType") primfc (PType bi) (
PPi expl (sMN 0 "ival") primfc (PRef bi [] (sMN 0 "iType"))
(PRef bi [] inferTy)), bi, [])]
| 370
|
inferDecl = PDatadecl inferTy primfc
(PType bi)
[(emptyDocstring, [], inferCon, primfc, PPi impl (sMN 0 "iType") primfc (PType bi) (
PPi expl (sMN 0 "ival") primfc (PRef bi [] (sMN 0 "iType"))
(PRef bi [] inferTy)), bi, [])]
| 370
| false
| false
| 0
| 14
| 183
| 128
| 67
| 61
| null | null |
TomMD/ghc
|
compiler/basicTypes/MkId.hs
|
bsd-3-clause
|
nullAddrName = mkWiredInIdName gHC_PRIM (fsLit "nullAddr#") nullAddrIdKey nullAddrId
| 100
|
nullAddrName = mkWiredInIdName gHC_PRIM (fsLit "nullAddr#") nullAddrIdKey nullAddrId
| 100
|
nullAddrName = mkWiredInIdName gHC_PRIM (fsLit "nullAddr#") nullAddrIdKey nullAddrId
| 100
| false
| false
| 0
| 7
| 23
| 21
| 10
| 11
| null | null |
HairyDude/heal
|
Handler/Call.hs
|
bsd-2-clause
|
populateCallDB :: Handler ()
populateCallDB = do
-- Clear the DB first
runDB $ deleteWhere ([] :: [Filter CallSpec])
runDB $ deleteWhere ([] :: [Filter ArgSpec])
runDB $ deleteWhere ([] :: [Filter CallArg])
forM_ (M.elems apiCalls) $
\(CallParams scope call key arglist) -> do
-- Insert the call
callID <- runDB $ insert $ CallSpec scope call key
-- Insert the ArgSpecs (getting IDs of any that are already in)
let argSpecs = map ArgSpec arglist
argSpecIDs <- mapM (liftM (either entityKey id) . runDB . insertBy)
argSpecs
-- Insert the relation between the two
mapM (\argID -> runDB $ insertBy (CallArg callID argID)) argSpecIDs
-- Render the page.
-- Form widgets are built separately to let get/post handle them differently.
| 871
|
populateCallDB :: Handler ()
populateCallDB = do
-- Clear the DB first
runDB $ deleteWhere ([] :: [Filter CallSpec])
runDB $ deleteWhere ([] :: [Filter ArgSpec])
runDB $ deleteWhere ([] :: [Filter CallArg])
forM_ (M.elems apiCalls) $
\(CallParams scope call key arglist) -> do
-- Insert the call
callID <- runDB $ insert $ CallSpec scope call key
-- Insert the ArgSpecs (getting IDs of any that are already in)
let argSpecs = map ArgSpec arglist
argSpecIDs <- mapM (liftM (either entityKey id) . runDB . insertBy)
argSpecs
-- Insert the relation between the two
mapM (\argID -> runDB $ insertBy (CallArg callID argID)) argSpecIDs
-- Render the page.
-- Form widgets are built separately to let get/post handle them differently.
| 871
|
populateCallDB = do
-- Clear the DB first
runDB $ deleteWhere ([] :: [Filter CallSpec])
runDB $ deleteWhere ([] :: [Filter ArgSpec])
runDB $ deleteWhere ([] :: [Filter CallArg])
forM_ (M.elems apiCalls) $
\(CallParams scope call key arglist) -> do
-- Insert the call
callID <- runDB $ insert $ CallSpec scope call key
-- Insert the ArgSpecs (getting IDs of any that are already in)
let argSpecs = map ArgSpec arglist
argSpecIDs <- mapM (liftM (either entityKey id) . runDB . insertBy)
argSpecs
-- Insert the relation between the two
mapM (\argID -> runDB $ insertBy (CallArg callID argID)) argSpecIDs
-- Render the page.
-- Form widgets are built separately to let get/post handle them differently.
| 842
| false
| true
| 0
| 18
| 264
| 230
| 114
| 116
| null | null |
michalt/cvector
|
Data/CVector.hs
|
bsd-3-clause
|
foldl1 :: (a -> a -> a) -> CVector a -> a
foldl1 = G.foldl1
| 59
|
foldl1 :: (a -> a -> a) -> CVector a -> a
foldl1 = G.foldl1
| 59
|
foldl1 = G.foldl1
| 17
| false
| true
| 0
| 8
| 14
| 35
| 18
| 17
| null | null |
lordi/flowskell
|
src/Flowskell/InputActions.hs
|
gpl-2.0
|
keyboardAct (Char '\DEL') = actionModifyInputLine IL.del
| 56
|
keyboardAct (Char '\DEL') = actionModifyInputLine IL.del
| 56
|
keyboardAct (Char '\DEL') = actionModifyInputLine IL.del
| 56
| false
| false
| 0
| 6
| 5
| 21
| 9
| 12
| null | null |
wenkokke/sf
|
hs/UpdateContributors.hs
|
mit
|
-- |Get commit history for a repository.
getCommits :: GH.Auth -> GH.Name GH.Owner -> GH.Name GH.Repo -> IO [GH.Commit]
getCommits auth owner repo =
V.toList <$> (fromRight =<< GH.github auth GH.commitsForR owner repo GH.FetchAll)
| 232
|
getCommits :: GH.Auth -> GH.Name GH.Owner -> GH.Name GH.Repo -> IO [GH.Commit]
getCommits auth owner repo =
V.toList <$> (fromRight =<< GH.github auth GH.commitsForR owner repo GH.FetchAll)
| 191
|
getCommits auth owner repo =
V.toList <$> (fromRight =<< GH.github auth GH.commitsForR owner repo GH.FetchAll)
| 112
| true
| true
| 0
| 10
| 35
| 85
| 42
| 43
| null | null |
siphayne/CS381
|
scratch/InfList.hs
|
mit
|
-- | An infinite list of ones.
-- >>> take 5 ones
-- [1,1,1,1,1]
ones :: [Int]
ones = 1 : ones
| 98
|
ones :: [Int]
ones = 1 : ones
| 29
|
ones = 1 : ones
| 15
| true
| true
| 0
| 5
| 25
| 21
| 13
| 8
| null | null |
haskell-opengl/OpenGLRaw
|
src/Graphics/GL/Functions/F11.hs
|
bsd-3-clause
|
-- glGetNamedProgramStringEXT --------------------------------------------------
glGetNamedProgramStringEXT
:: MonadIO m
=> GLuint -- ^ @program@.
-> GLenum -- ^ @target@ of type [ProgramTarget](Graphics-GL-Groups.html#ProgramTarget).
-> GLenum -- ^ @pname@ of type [ProgramStringProperty](Graphics-GL-Groups.html#ProgramStringProperty).
-> Ptr a -- ^ @string@ pointing to @COMPSIZE(program,pname)@ elements of type @a@.
-> m ()
glGetNamedProgramStringEXT v1 v2 v3 v4 = liftIO $ dyn385 ptr_glGetNamedProgramStringEXT v1 v2 v3 v4
| 541
|
glGetNamedProgramStringEXT
:: MonadIO m
=> GLuint -- ^ @program@.
-> GLenum -- ^ @target@ of type [ProgramTarget](Graphics-GL-Groups.html#ProgramTarget).
-> GLenum -- ^ @pname@ of type [ProgramStringProperty](Graphics-GL-Groups.html#ProgramStringProperty).
-> Ptr a -- ^ @string@ pointing to @COMPSIZE(program,pname)@ elements of type @a@.
-> m ()
glGetNamedProgramStringEXT v1 v2 v3 v4 = liftIO $ dyn385 ptr_glGetNamedProgramStringEXT v1 v2 v3 v4
| 459
|
glGetNamedProgramStringEXT v1 v2 v3 v4 = liftIO $ dyn385 ptr_glGetNamedProgramStringEXT v1 v2 v3 v4
| 99
| true
| true
| 0
| 12
| 70
| 75
| 37
| 38
| null | null |
allanderek/ipclib
|
Language/Hydra/Syntax.hs
|
gpl-2.0
|
amesOfCexp (Cifte e1 e2 e3) = union (namesOfCexp e1) $
union (namesOfCexp e2) (namesOfCexp e3)
| 126
|
namesOfCexp (Cifte e1 e2 e3) = union (namesOfCexp e1) $
union (namesOfCexp e2) (namesOfCexp e3)
| 126
|
namesOfCexp (Cifte e1 e2 e3) = union (namesOfCexp e1) $
union (namesOfCexp e2) (namesOfCexp e3)
| 126
| false
| false
| 0
| 8
| 46
| 49
| 23
| 26
| null | null |
iduhetonas/haskell-projects
|
Haskell99Problems/Arithmetic.hs
|
mit
|
--------------------------------------------------------------------------------
-- Problem #34!
totient :: Int -> Int
totient num =
let totFunc = coprime num
in length . filter (/=False) $ map totFunc [1..(num-1)]
| 220
|
totient :: Int -> Int
totient num =
let totFunc = coprime num
in length . filter (/=False) $ map totFunc [1..(num-1)]
| 122
|
totient num =
let totFunc = coprime num
in length . filter (/=False) $ map totFunc [1..(num-1)]
| 100
| true
| true
| 0
| 11
| 31
| 66
| 34
| 32
| null | null |
djeik/goto
|
libgoto/Language/GoLite/Weeder/Stmt.hs
|
mit
|
-- Assignment: weed the expressions on each side. Blank identifiers are allowed
-- as operands on the left in the case of a normal assignment.
weedStmt (Fix (Ann _ (Assignment lhs op rhs))) = do
case bare op of
Assign -> void $ mapM weedExprAllowingBlanks lhs
_ -> void $ mapM weedExpr lhs
void $ mapM weedExpr rhs
where
weedExprAllowingBlanks :: SrcAnnExpr -> Weeder ()
weedExprAllowingBlanks e = when (not ("_" `isIdAsOperand` e)) (weedExpr e)
-- Print statement: weed the inner expressions
| 538
|
weedStmt (Fix (Ann _ (Assignment lhs op rhs))) = do
case bare op of
Assign -> void $ mapM weedExprAllowingBlanks lhs
_ -> void $ mapM weedExpr lhs
void $ mapM weedExpr rhs
where
weedExprAllowingBlanks :: SrcAnnExpr -> Weeder ()
weedExprAllowingBlanks e = when (not ("_" `isIdAsOperand` e)) (weedExpr e)
-- Print statement: weed the inner expressions
| 395
|
weedStmt (Fix (Ann _ (Assignment lhs op rhs))) = do
case bare op of
Assign -> void $ mapM weedExprAllowingBlanks lhs
_ -> void $ mapM weedExpr lhs
void $ mapM weedExpr rhs
where
weedExprAllowingBlanks :: SrcAnnExpr -> Weeder ()
weedExprAllowingBlanks e = when (not ("_" `isIdAsOperand` e)) (weedExpr e)
-- Print statement: weed the inner expressions
| 395
| true
| false
| 2
| 11
| 127
| 138
| 68
| 70
| null | null |
gibiansky/nvim-hs
|
library/Neovim/RPC/EventHandler.hs
|
apache-2.0
|
runEventHandlerContext
:: Internal.Config RPCConfig Int64 -> EventHandler a -> IO a
runEventHandlerContext env (EventHandler a) =
evalStateT (runReaderT (runResourceT a) env) 1
| 184
|
runEventHandlerContext
:: Internal.Config RPCConfig Int64 -> EventHandler a -> IO a
runEventHandlerContext env (EventHandler a) =
evalStateT (runReaderT (runResourceT a) env) 1
| 184
|
runEventHandlerContext env (EventHandler a) =
evalStateT (runReaderT (runResourceT a) env) 1
| 96
| false
| true
| 0
| 9
| 29
| 65
| 30
| 35
| null | null |
jacekszymanski/wxHaskell
|
wxcore/src/haskell/Graphics/UI/WXCore/WxcTypes.hs
|
lgpl-2.1
|
withBoolResult :: IO CBool -> IO Bool
withBoolResult io
= do x <- io
return (fromCBool x)
| 98
|
withBoolResult :: IO CBool -> IO Bool
withBoolResult io
= do x <- io
return (fromCBool x)
| 98
|
withBoolResult io
= do x <- io
return (fromCBool x)
| 60
| false
| true
| 0
| 9
| 25
| 43
| 19
| 24
| null | null |
wavewave/hxournal
|
lib/Application/HXournal/ModelAction/Window.hs
|
bsd-2-clause
|
newCanvasId :: CanvasInfoMap -> CanvasId
newCanvasId cmap =
let cids = M.keys cmap
in (maximum cids) + 1
| 112
|
newCanvasId :: CanvasInfoMap -> CanvasId
newCanvasId cmap =
let cids = M.keys cmap
in (maximum cids) + 1
| 111
|
newCanvasId cmap =
let cids = M.keys cmap
in (maximum cids) + 1
| 70
| false
| true
| 0
| 10
| 25
| 44
| 21
| 23
| null | null |
bloody76/Hodor
|
src/Language/Brainfuck/Internals/Interpreter.hs
|
gpl-3.0
|
right (Memory l v (r:rs)) = Memory (v:l) r rs
| 45
|
right (Memory l v (r:rs)) = Memory (v:l) r rs
| 45
|
right (Memory l v (r:rs)) = Memory (v:l) r rs
| 45
| false
| false
| 0
| 8
| 9
| 41
| 20
| 21
| null | null |
fmthoma/ghc
|
compiler/hsSyn/HsExpr.hs
|
bsd-3-clause
|
tupArgPresent :: LHsTupArg id -> Bool
tupArgPresent (L _ (Present {})) = True
| 77
|
tupArgPresent :: LHsTupArg id -> Bool
tupArgPresent (L _ (Present {})) = True
| 77
|
tupArgPresent (L _ (Present {})) = True
| 39
| false
| true
| 0
| 9
| 12
| 36
| 18
| 18
| null | null |
mhwombat/creatur-wains-iomha
|
src/ALife/Creatur/Wain/Iomha/Experiment.hs
|
bsd-3-clause
|
-- TODO: Is there a more lens-y way to do this? Maybe can combine a
-- prism and a lens.
directObjectWain :: Lens' Experiment ImageWain
directObjectWain = lens getWain setWain
where
getWain :: Experiment -> ImageWain
getWain = O.objectToWain . _directObject
setWain :: Experiment -> ImageWain -> Experiment
setWain e w = e { _directObject = O.AObject w }
| 373
|
directObjectWain :: Lens' Experiment ImageWain
directObjectWain = lens getWain setWain
where
getWain :: Experiment -> ImageWain
getWain = O.objectToWain . _directObject
setWain :: Experiment -> ImageWain -> Experiment
setWain e w = e { _directObject = O.AObject w }
| 284
|
directObjectWain = lens getWain setWain
where
getWain :: Experiment -> ImageWain
getWain = O.objectToWain . _directObject
setWain :: Experiment -> ImageWain -> Experiment
setWain e w = e { _directObject = O.AObject w }
| 237
| true
| true
| 6
| 6
| 77
| 85
| 43
| 42
| null | null |
JacquesCarette/literate-scientific-software
|
code/drasil-data/Data/Drasil/Software/Products.hs
|
bsd-2-clause
|
videoGame, openSource, compPro :: NamedChunk
videoGame = compoundNC video game
| 80
|
videoGame, openSource, compPro :: NamedChunk
videoGame = compoundNC video game
| 80
|
videoGame = compoundNC video game
| 35
| false
| true
| 0
| 5
| 11
| 20
| 12
| 8
| null | null |
sampou-org/pfad
|
Code/Code29.hs
|
bsd-3-clause
|
addpair :: (Int,Int) -> [(Int,Int)] -> [(Int,Int)]
addpair (_,1) ps = ps
| 86
|
addpair :: (Int,Int) -> [(Int,Int)] -> [(Int,Int)]
addpair (_,1) ps = ps
| 86
|
addpair (_,1) ps = ps
| 24
| false
| true
| 0
| 8
| 25
| 54
| 32
| 22
| null | null |
tphyahoo/haskoin
|
haskoin-wallet/Network/Haskoin/Wallet/Server/Handler.hs
|
unlicense
|
getKeyRingR :: (MonadLogger m, MonadBaseControl IO m, MonadIO m)
=> KeyRingName -> Handler m (Maybe Value)
getKeyRingR name = do
$(logInfo) $ format $ unwords [ "GetKeyRingR", unpack name ]
Entity _ keyRing <- runDB $ getKeyRing name
return $ Just $ toJSON $ toJsonKeyRing keyRing Nothing Nothing
| 320
|
getKeyRingR :: (MonadLogger m, MonadBaseControl IO m, MonadIO m)
=> KeyRingName -> Handler m (Maybe Value)
getKeyRingR name = do
$(logInfo) $ format $ unwords [ "GetKeyRingR", unpack name ]
Entity _ keyRing <- runDB $ getKeyRing name
return $ Just $ toJSON $ toJsonKeyRing keyRing Nothing Nothing
| 320
|
getKeyRingR name = do
$(logInfo) $ format $ unwords [ "GetKeyRingR", unpack name ]
Entity _ keyRing <- runDB $ getKeyRing name
return $ Just $ toJSON $ toJsonKeyRing keyRing Nothing Nothing
| 201
| false
| true
| 0
| 11
| 71
| 125
| 58
| 67
| null | null |
fredmorcos/attic
|
projects/simpleparse/Parser.hs
|
isc
|
satMany1 :: Eq a => Parser a p b -> Parser a p [b]
satMany1 p = do c <- sat1 p
r <- satMany p
return $ c:r
-- Predicate satisfaction functions
| 175
|
satMany1 :: Eq a => Parser a p b -> Parser a p [b]
satMany1 p = do c <- sat1 p
r <- satMany p
return $ c:r
-- Predicate satisfaction functions
| 175
|
satMany1 p = do c <- sat1 p
r <- satMany p
return $ c:r
-- Predicate satisfaction functions
| 124
| false
| true
| 0
| 8
| 65
| 78
| 35
| 43
| null | null |
ComputationWithBoundedResources/ara-inference
|
doc/tpdb_trs/Haskell/basic_haskell/compare_5.hs
|
mit
|
primCmpNat (Succ x) (Succ y) = primCmpNat x y
| 45
|
primCmpNat (Succ x) (Succ y) = primCmpNat x y
| 45
|
primCmpNat (Succ x) (Succ y) = primCmpNat x y
| 45
| false
| false
| 0
| 7
| 8
| 28
| 13
| 15
| null | null |
randen/cabal
|
cabal-install/Distribution/Client/Dependency/Modular/Explore.hs
|
bsd-3-clause
|
combine var ((k, ( d, v)) : xs) c = (\ ~(e, ys) -> (e, (k, v) : ys)) $
case d of
Just e | not (simplifyVar var `S.member` e) -> (Just e, [])
| otherwise -> combine var xs (e `S.union` c)
Nothing -> (Nothing, snd $ combine var xs S.empty)
-- | Naive backtracking exploration of the search tree. This will yield correct
-- assignments only once the tree itself is validated.
| 611
|
combine var ((k, ( d, v)) : xs) c = (\ ~(e, ys) -> (e, (k, v) : ys)) $
case d of
Just e | not (simplifyVar var `S.member` e) -> (Just e, [])
| otherwise -> combine var xs (e `S.union` c)
Nothing -> (Nothing, snd $ combine var xs S.empty)
-- | Naive backtracking exploration of the search tree. This will yield correct
-- assignments only once the tree itself is validated.
| 611
|
combine var ((k, ( d, v)) : xs) c = (\ ~(e, ys) -> (e, (k, v) : ys)) $
case d of
Just e | not (simplifyVar var `S.member` e) -> (Just e, [])
| otherwise -> combine var xs (e `S.union` c)
Nothing -> (Nothing, snd $ combine var xs S.empty)
-- | Naive backtracking exploration of the search tree. This will yield correct
-- assignments only once the tree itself is validated.
| 611
| false
| false
| 0
| 15
| 313
| 168
| 91
| 77
| null | null |
toppoint/haskell-alpm
|
tests/Tests.hs
|
gpl-2.0
|
test_optionLockFileNothig :: Assertion
test_optionLockFileNothig = stringIsJustTest optionGetLockFile lockFilePath
| 114
|
test_optionLockFileNothig :: Assertion
test_optionLockFileNothig = stringIsJustTest optionGetLockFile lockFilePath
| 114
|
test_optionLockFileNothig = stringIsJustTest optionGetLockFile lockFilePath
| 75
| false
| true
| 0
| 5
| 7
| 16
| 8
| 8
| null | null |
sinelaw/lamdu
|
Lamdu/GUI/ExpressionEdit/DefinitionContentEdit.hs
|
gpl-3.0
|
jumpToRHS ::
(MonadA m, MonadA f) =>
[E.ModKey] -> (String, ExprGuiM.SugarExpr m) ->
ExprGuiM f (Widget.EventHandlers (T f))
jumpToRHS keys (rhsDoc, rhs) = do
savePos <- ExprGuiM.mkPrejumpPosSaver
return $
Widget.keysEventMapMovesCursor keys (E.Doc ["Navigation", "Jump to " ++ rhsDoc]) $
rhsId <$ savePos
where
rhsId = WidgetIds.fromGuid $ rhs ^. Sugar.rPayload . Sugar.plGuid
| 403
|
jumpToRHS ::
(MonadA m, MonadA f) =>
[E.ModKey] -> (String, ExprGuiM.SugarExpr m) ->
ExprGuiM f (Widget.EventHandlers (T f))
jumpToRHS keys (rhsDoc, rhs) = do
savePos <- ExprGuiM.mkPrejumpPosSaver
return $
Widget.keysEventMapMovesCursor keys (E.Doc ["Navigation", "Jump to " ++ rhsDoc]) $
rhsId <$ savePos
where
rhsId = WidgetIds.fromGuid $ rhs ^. Sugar.rPayload . Sugar.plGuid
| 403
|
jumpToRHS keys (rhsDoc, rhs) = do
savePos <- ExprGuiM.mkPrejumpPosSaver
return $
Widget.keysEventMapMovesCursor keys (E.Doc ["Navigation", "Jump to " ++ rhsDoc]) $
rhsId <$ savePos
where
rhsId = WidgetIds.fromGuid $ rhs ^. Sugar.rPayload . Sugar.plGuid
| 272
| false
| true
| 1
| 14
| 77
| 163
| 80
| 83
| null | null |
CBMM/petersonfaces
|
petersonfaces-frontend/src/Canvas2D.hs
|
bsd-3-clause
|
canvas :: forall t m.MonadWidget t m => CanvasConfig t -> m (Canvas t m)
canvas (CanvasConfig attrs localCtx ctx0 touchCtx) = do
(canvasEl, children) <- elDynAttr' "canvas" attrs (return ())
let canv = castToHTMLCanvasElement $ _element_raw canvasEl
rec ctx <- holdDyn ctx0 touchedCtx
touchedCtx <- performEvent $ ffor (attach (current ctx) touchCtx) $ \(c,mkCtx) -> liftIO $ do
cOld <- getContext canv ("2d" :: String)
mkCtx =<< fromJSValUnchecked cOld :: IO ()
fromJSValUnchecked =<< getContext canv ("2d" :: String)
performEvent $ ffor (attach (current ctx) localCtx) $ \(c,act) -> liftIO $ do
save c
getContext canv ("2d" :: String) >>= \jv -> fromJSValUnchecked jv >>= act
restore c
let getCtx triggers = performEvent $ ffor (attach (current ctx) triggers) $ \(c, (x,y,w,h)) -> liftIO $ do
getImageData c x y w h
-- return $ nullableToMaybe i
return $ Canvas canvasEl ctx getCtx
#ifndef ghcjs_HOST_OS
| 983
|
canvas :: forall t m.MonadWidget t m => CanvasConfig t -> m (Canvas t m)
canvas (CanvasConfig attrs localCtx ctx0 touchCtx) = do
(canvasEl, children) <- elDynAttr' "canvas" attrs (return ())
let canv = castToHTMLCanvasElement $ _element_raw canvasEl
rec ctx <- holdDyn ctx0 touchedCtx
touchedCtx <- performEvent $ ffor (attach (current ctx) touchCtx) $ \(c,mkCtx) -> liftIO $ do
cOld <- getContext canv ("2d" :: String)
mkCtx =<< fromJSValUnchecked cOld :: IO ()
fromJSValUnchecked =<< getContext canv ("2d" :: String)
performEvent $ ffor (attach (current ctx) localCtx) $ \(c,act) -> liftIO $ do
save c
getContext canv ("2d" :: String) >>= \jv -> fromJSValUnchecked jv >>= act
restore c
let getCtx triggers = performEvent $ ffor (attach (current ctx) triggers) $ \(c, (x,y,w,h)) -> liftIO $ do
getImageData c x y w h
-- return $ nullableToMaybe i
return $ Canvas canvasEl ctx getCtx
#ifndef ghcjs_HOST_OS
| 983
|
canvas (CanvasConfig attrs localCtx ctx0 touchCtx) = do
(canvasEl, children) <- elDynAttr' "canvas" attrs (return ())
let canv = castToHTMLCanvasElement $ _element_raw canvasEl
rec ctx <- holdDyn ctx0 touchedCtx
touchedCtx <- performEvent $ ffor (attach (current ctx) touchCtx) $ \(c,mkCtx) -> liftIO $ do
cOld <- getContext canv ("2d" :: String)
mkCtx =<< fromJSValUnchecked cOld :: IO ()
fromJSValUnchecked =<< getContext canv ("2d" :: String)
performEvent $ ffor (attach (current ctx) localCtx) $ \(c,act) -> liftIO $ do
save c
getContext canv ("2d" :: String) >>= \jv -> fromJSValUnchecked jv >>= act
restore c
let getCtx triggers = performEvent $ ffor (attach (current ctx) triggers) $ \(c, (x,y,w,h)) -> liftIO $ do
getImageData c x y w h
-- return $ nullableToMaybe i
return $ Canvas canvasEl ctx getCtx
#ifndef ghcjs_HOST_OS
| 910
| false
| true
| 0
| 17
| 223
| 402
| 196
| 206
| null | null |
NicolasDP/keeper
|
Keeper/CheckAuthorizedKeys.hs
|
bsd-3-clause
|
------------------------------------------------------------------------------
main = defaultMain getFlatDB
| 108
|
main = defaultMain getFlatDB
| 28
|
main = defaultMain getFlatDB
| 28
| true
| false
| 1
| 5
| 5
| 14
| 5
| 9
| null | null |
purebred-mua/purebred
|
test/TestUserAcceptance.hs
|
agpl-3.0
|
selectedListItem :: B.ByteString
selectedListItem = buildAnsiRegex [] ["37"] ["43"]
| 83
|
selectedListItem :: B.ByteString
selectedListItem = buildAnsiRegex [] ["37"] ["43"]
| 83
|
selectedListItem = buildAnsiRegex [] ["37"] ["43"]
| 50
| false
| true
| 0
| 6
| 8
| 28
| 15
| 13
| null | null |
nevrenato/Hets_Fork
|
Comorphisms/SuleCFOL2SoftFOL.hs
|
gpl-2.0
|
isSingleSorted :: CSign.Sign f e -> Bool
isSingleSorted sign =
Set.size (CSign.sortSet sign) == 1
&& Set.null (emptySortSet sign)
| 133
|
isSingleSorted :: CSign.Sign f e -> Bool
isSingleSorted sign =
Set.size (CSign.sortSet sign) == 1
&& Set.null (emptySortSet sign)
| 133
|
isSingleSorted sign =
Set.size (CSign.sortSet sign) == 1
&& Set.null (emptySortSet sign)
| 92
| false
| true
| 2
| 9
| 22
| 58
| 27
| 31
| null | null |
jamwt/altis
|
src/Database/Altis/ServerProtocol.hs
|
bsd-3-clause
|
readIntLine :: Atto.Parser Int
readIntLine = do
i <- AttoC.decimal
_ <- Atto.string "\r\n"
return i
| 111
|
readIntLine :: Atto.Parser Int
readIntLine = do
i <- AttoC.decimal
_ <- Atto.string "\r\n"
return i
| 111
|
readIntLine = do
i <- AttoC.decimal
_ <- Atto.string "\r\n"
return i
| 80
| false
| true
| 0
| 9
| 27
| 43
| 19
| 24
| null | null |
sopvop/snap-core
|
test/Snap/Util/FileUploads/Tests.hs
|
bsd-3-clause
|
formContents1 :: ByteString
formContents1 = "form contents 1"
| 61
|
formContents1 :: ByteString
formContents1 = "form contents 1"
| 61
|
formContents1 = "form contents 1"
| 33
| false
| true
| 0
| 6
| 7
| 18
| 7
| 11
| null | null |
sopvop/cabal
|
Cabal/Distribution/Simple/Build/Macros.hs
|
bsd-3-clause
|
define :: String -> Maybe [String] -> String -> HeaderLines
define macro params val =
line ("#define " ++ macro ++ f params ++ " " ++ val)
where
f Nothing = ""
f (Just xs) = "(" ++ intercalate "," xs ++ ")"
| 220
|
define :: String -> Maybe [String] -> String -> HeaderLines
define macro params val =
line ("#define " ++ macro ++ f params ++ " " ++ val)
where
f Nothing = ""
f (Just xs) = "(" ++ intercalate "," xs ++ ")"
| 220
|
define macro params val =
line ("#define " ++ macro ++ f params ++ " " ++ val)
where
f Nothing = ""
f (Just xs) = "(" ++ intercalate "," xs ++ ")"
| 160
| false
| true
| 1
| 9
| 57
| 109
| 49
| 60
| null | null |
MichaelBaker/opengl-haskell
|
src/Uniform.hs
|
mit
|
uid (Uniform3Floats _ uid _ _ _) = uid
| 38
|
uid (Uniform3Floats _ uid _ _ _) = uid
| 38
|
uid (Uniform3Floats _ uid _ _ _) = uid
| 38
| false
| false
| 0
| 6
| 8
| 24
| 11
| 13
| null | null |
vituscze/norri
|
src/Compiler/Parser.hs
|
bsd-3-clause
|
-- | Parse an 'Expr' without any operator at the outermost level.
manyFactors :: Parser Expr
manyFactors = foldl1 App <$> many1 factor
| 134
|
manyFactors :: Parser Expr
manyFactors = foldl1 App <$> many1 factor
| 68
|
manyFactors = foldl1 App <$> many1 factor
| 41
| true
| true
| 0
| 6
| 22
| 25
| 12
| 13
| null | null |
brendanhay/gogol
|
gogol-youtube/gen/Network/Google/Resource/YouTube/Comments/Insert.hs
|
mpl-2.0
|
-- | OAuth access token.
comAccessToken :: Lens' CommentsInsert (Maybe Text)
comAccessToken
= lens _comAccessToken
(\ s a -> s{_comAccessToken = a})
| 156
|
comAccessToken :: Lens' CommentsInsert (Maybe Text)
comAccessToken
= lens _comAccessToken
(\ s a -> s{_comAccessToken = a})
| 131
|
comAccessToken
= lens _comAccessToken
(\ s a -> s{_comAccessToken = a})
| 79
| true
| true
| 0
| 9
| 29
| 46
| 25
| 21
| null | null |
mrkkrp/alga
|
src/Alga/Interaction/Commands.hs
|
gpl-3.0
|
cmdLoad' :: (HasEnv m, MonadIO m, MonadState AlgaSt m, MonadThrow m)
=> String -> m ()
cmdLoad' = cmdLoad . words
| 115
|
cmdLoad' :: (HasEnv m, MonadIO m, MonadState AlgaSt m, MonadThrow m)
=> String -> m ()
cmdLoad' = cmdLoad . words
| 115
|
cmdLoad' = cmdLoad . words
| 26
| false
| true
| 0
| 8
| 22
| 53
| 27
| 26
| null | null |
shicks/shsh
|
System/Console/ShSh/Command.hs
|
bsd-3-clause
|
pipeline _ (BangPipeline [s]) = sec $ notProcess `fmap` runStatement IgnoreE s
| 78
|
pipeline _ (BangPipeline [s]) = sec $ notProcess `fmap` runStatement IgnoreE s
| 78
|
pipeline _ (BangPipeline [s]) = sec $ notProcess `fmap` runStatement IgnoreE s
| 78
| false
| false
| 0
| 8
| 11
| 35
| 18
| 17
| null | null |
stackbuilders/inflections-hs
|
Text/Inflections/Transliterate.hs
|
mit
|
-- | Returns a 'Text' after default approximations for changing Unicode
-- characters to a valid ASCII range are applied. If you want to supplement
-- the default approximations with your own, you should use the
-- 'transliterateCustom' function instead of 'transliterate'.
transliterate :: Text -> Text
transliterate = transliterateCustom "?" defaultTransliterations
| 367
|
transliterate :: Text -> Text
transliterate = transliterateCustom "?" defaultTransliterations
| 93
|
transliterate = transliterateCustom "?" defaultTransliterations
| 63
| true
| true
| 0
| 5
| 51
| 24
| 14
| 10
| null | null |
PKAuth/pkcloud-accounts
|
src/Application.hs
|
apache-2.0
|
makeApplication :: App -> IO Application
makeApplication foundation = do
logWare <- makeLogWare foundation
-- Create the WAI application and apply middlewares
appPlain <- toWaiAppPlain foundation
return $ logWare $ defaultMiddlewaresNoLogging appPlain
| 267
|
makeApplication :: App -> IO Application
makeApplication foundation = do
logWare <- makeLogWare foundation
-- Create the WAI application and apply middlewares
appPlain <- toWaiAppPlain foundation
return $ logWare $ defaultMiddlewaresNoLogging appPlain
| 267
|
makeApplication foundation = do
logWare <- makeLogWare foundation
-- Create the WAI application and apply middlewares
appPlain <- toWaiAppPlain foundation
return $ logWare $ defaultMiddlewaresNoLogging appPlain
| 226
| false
| true
| 0
| 8
| 47
| 56
| 25
| 31
| null | null |
BlairArchibald/bones
|
apps/maxclique/src/Solvers/BonesSolver.hs
|
bsd-3-clause
|
toClosureMCNodeBS_abs :: MCNodeBS -> Thunk MCNodeBS
toClosureMCNodeBS_abs x = Thunk x
| 85
|
toClosureMCNodeBS_abs :: MCNodeBS -> Thunk MCNodeBS
toClosureMCNodeBS_abs x = Thunk x
| 85
|
toClosureMCNodeBS_abs x = Thunk x
| 33
| false
| true
| 0
| 6
| 10
| 24
| 11
| 13
| null | null |
tomahawkins/dove
|
Language/Dove/Optimize.hs
|
bsd-3-clause
|
optimize :: Expr -> Expr
optimize = optRemoveNullEffect . optConstantProp . optInline . optRemoveNullEffect . optConstantProp
| 125
|
optimize :: Expr -> Expr
optimize = optRemoveNullEffect . optConstantProp . optInline . optRemoveNullEffect . optConstantProp
| 125
|
optimize = optRemoveNullEffect . optConstantProp . optInline . optRemoveNullEffect . optConstantProp
| 100
| false
| true
| 0
| 8
| 15
| 31
| 16
| 15
| null | null |
rueshyna/gogol
|
gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs
|
mpl-2.0
|
-- | Creates a value of 'AccountIdentifier' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'aiMerchantId'
--
-- * 'aiAggregatorId'
accountIdentifier
:: AccountIdentifier
accountIdentifier =
AccountIdentifier'
{ _aiMerchantId = Nothing
, _aiAggregatorId = Nothing
}
| 370
|
accountIdentifier
:: AccountIdentifier
accountIdentifier =
AccountIdentifier'
{ _aiMerchantId = Nothing
, _aiAggregatorId = Nothing
}
| 153
|
accountIdentifier =
AccountIdentifier'
{ _aiMerchantId = Nothing
, _aiAggregatorId = Nothing
}
| 110
| true
| true
| 1
| 7
| 72
| 39
| 23
| 16
| null | null |
soumith/fbthrift
|
thrift/lib/hs/Thrift/Protocol/JSON.hs
|
apache-2.0
|
buildJSONValue (TString s) = "\"" <> escape s <> "\""
| 53
|
buildJSONValue (TString s) = "\"" <> escape s <> "\""
| 53
|
buildJSONValue (TString s) = "\"" <> escape s <> "\""
| 53
| false
| false
| 0
| 7
| 9
| 26
| 12
| 14
| null | null |
filopodia/open
|
echarts-hs/src/Graphics/Echarts.hs
|
mit
|
thickRadius = ["20%","70%"]
| 27
|
thickRadius = ["20%","70%"]
| 27
|
thickRadius = ["20%","70%"]
| 27
| false
| false
| 1
| 5
| 2
| 15
| 7
| 8
| null | null |
tamarin-prover/tamarin-prover
|
lib/theory/src/Theory/Constraint/Solver/Goals.hs
|
gpl-3.0
|
-- Instances
------------
-- | The list of goals that must be solved before a solution can be extracted.
-- Each goal is annotated with its age and an indicator for its usefulness.
openGoals :: System -> [AnnotatedGoal]
openGoals sys = do
(goal, status) <- M.toList $ get sGoals sys
let solved = get gsSolved status
-- check whether the goal is still open
guard $ case goal of
ActionG i (kFactView -> Just (UpK, m)) ->
if get sDiffSystem sys
-- In a diff proof, all action goals need to be solved.
then not (solved)
else
not $ solved
-- message variables are not solved, except if the node already exists in the system -> facilitates finding contradictions
|| (isMsgVar m && Nothing == M.lookup i (get sNodes sys)) || sortOfLNTerm m == LSortPub
-- handled by 'insertAction'
|| isPair m || isInverse m || isProduct m --- || isXor m
|| isUnion m || isNullaryPublicFunction m
ActionG _ _ -> not solved
PremiseG _ _ -> not solved
-- Technically the 'False' disj would be a solvable goal. However, we
-- have a separate proof method for this, i.e., contradictions.
DisjG (Disj []) -> False
DisjG _ -> not solved
ChainG c p ->
case kFactView (nodeConcFact c sys) of
Just (DnK, viewTerm2 -> FUnion args) ->
-- do not solve Union conclusions if they contain only known msg vars
not solved && not (allMsgVarsKnownEarlier c args)
-- open chains for msg vars are only solved if N5'' is applicable
Just (DnK, m) | isMsgVar m -> (not solved) &&
(chainToEquality m c p)
| otherwise -> not solved
fa -> error $ "openChainGoals: impossible fact: " ++ show fa
-- FIXME: Split goals may be duplicated, we always have to check
-- explicitly if they still exist.
SplitG idx -> splitExists (get sEqStore sys) idx
let
useful = case goal of
_ | get gsLoopBreaker status -> LoopBreaker
ActionG i (kFactView -> Just (UpK, m))
-- if there are KU-guards then all knowledge goals are useful
| hasKUGuards -> Useful
| currentlyDeducible i m -> CurrentlyDeducible
| probablyConstructible m -> ProbablyConstructible
_ -> Useful
return (goal, (get gsNr status, useful))
where
existingDeps = rawLessRel sys
hasKUGuards =
any ((KUFact `elem`) . guardFactTags) $ S.toList $ get sFormulas sys
checkTermLits :: (LSort -> Bool) -> LNTerm -> Bool
checkTermLits p =
Mono.getAll . foldMap (Mono.All . p . sortOfLit)
-- KU goals of messages that are likely to be constructible by the
-- adversary. These are terms that do not contain a fresh name or a fresh
-- name variable. For protocols without loops they are very likely to be
-- constructible. For protocols with loops, such terms have to be given
-- similar priority as loop-breakers.
probablyConstructible m = checkTermLits (LSortFresh /=) m
&& not (containsPrivate m)
-- KU goals of messages that are currently deducible. Either because they
-- are composed of public names only and do not contain private function
-- symbols or because they can be extracted from a sent message using
-- unpairing or inversion only.
currentlyDeducible i m = (checkTermLits (LSortPub ==) m
&& not (containsPrivate m))
|| extractible i m
extractible i m = or $ do
(j, ru) <- M.toList $ get sNodes sys
-- We cannot deduce a message from a last node.
guard (not $ isLast sys j)
let derivedMsgs = concatMap toplevelTerms $
[ t | Fact OutFact _ [t] <- get rConcs ru] <|>
[ t | Just (DnK, t) <- kFactView <$> get rConcs ru]
-- m is deducible from j without an immediate contradiction
-- if it is a derived message of 'ru' and the dependency does
-- not make the graph cyclic.
return $ m `elem` derivedMsgs &&
not (j `S.member` D.reachableSet [i] existingDeps)
toplevelTerms t@(viewTerm2 -> FPair t1 t2) =
t : toplevelTerms t1 ++ toplevelTerms t2
toplevelTerms t@(viewTerm2 -> FInv t1) = t : toplevelTerms t1
toplevelTerms t = [t]
allMsgVarsKnownEarlier (i,_) args = (all isMsgVar args) &&
(all (`elem` earlierMsgVars) args)
where earlierMsgVars = do (j, _, t) <- allKUActions sys
guard $ isMsgVar t && alwaysBefore sys j i
return t
-- check whether we have a chain that fits N5'' (an open chain between an
-- equality rule and a simple msg var conclusion that exists as a K up
-- previously) which needs to be resolved even if it is an open chain
chainToEquality :: LNTerm -> NodeConc -> NodePrem -> Bool
chainToEquality t_start conc p = is_msg_var && is_equality && ku_before
where
-- check whether it is a msg var
is_msg_var = isMsgVar t_start
-- and whether we do have an equality rule instance at the end
is_equality = isIEqualityRule $ nodeRule (fst p) sys
-- get all KU-facts with the same msg var
ku_start = filter (\x -> (fst x) == t_start) $
map (\(i, _, m) -> (m, i)) $ allKUActions sys
-- and check whether any of them happens before the KD-conclusion
ku_before = any (\(_, x) -> alwaysBefore sys x (fst conc)) ku_start
-- | The list of all open goals left together with their status.
| 6,094
|
openGoals :: System -> [AnnotatedGoal]
openGoals sys = do
(goal, status) <- M.toList $ get sGoals sys
let solved = get gsSolved status
-- check whether the goal is still open
guard $ case goal of
ActionG i (kFactView -> Just (UpK, m)) ->
if get sDiffSystem sys
-- In a diff proof, all action goals need to be solved.
then not (solved)
else
not $ solved
-- message variables are not solved, except if the node already exists in the system -> facilitates finding contradictions
|| (isMsgVar m && Nothing == M.lookup i (get sNodes sys)) || sortOfLNTerm m == LSortPub
-- handled by 'insertAction'
|| isPair m || isInverse m || isProduct m --- || isXor m
|| isUnion m || isNullaryPublicFunction m
ActionG _ _ -> not solved
PremiseG _ _ -> not solved
-- Technically the 'False' disj would be a solvable goal. However, we
-- have a separate proof method for this, i.e., contradictions.
DisjG (Disj []) -> False
DisjG _ -> not solved
ChainG c p ->
case kFactView (nodeConcFact c sys) of
Just (DnK, viewTerm2 -> FUnion args) ->
-- do not solve Union conclusions if they contain only known msg vars
not solved && not (allMsgVarsKnownEarlier c args)
-- open chains for msg vars are only solved if N5'' is applicable
Just (DnK, m) | isMsgVar m -> (not solved) &&
(chainToEquality m c p)
| otherwise -> not solved
fa -> error $ "openChainGoals: impossible fact: " ++ show fa
-- FIXME: Split goals may be duplicated, we always have to check
-- explicitly if they still exist.
SplitG idx -> splitExists (get sEqStore sys) idx
let
useful = case goal of
_ | get gsLoopBreaker status -> LoopBreaker
ActionG i (kFactView -> Just (UpK, m))
-- if there are KU-guards then all knowledge goals are useful
| hasKUGuards -> Useful
| currentlyDeducible i m -> CurrentlyDeducible
| probablyConstructible m -> ProbablyConstructible
_ -> Useful
return (goal, (get gsNr status, useful))
where
existingDeps = rawLessRel sys
hasKUGuards =
any ((KUFact `elem`) . guardFactTags) $ S.toList $ get sFormulas sys
checkTermLits :: (LSort -> Bool) -> LNTerm -> Bool
checkTermLits p =
Mono.getAll . foldMap (Mono.All . p . sortOfLit)
-- KU goals of messages that are likely to be constructible by the
-- adversary. These are terms that do not contain a fresh name or a fresh
-- name variable. For protocols without loops they are very likely to be
-- constructible. For protocols with loops, such terms have to be given
-- similar priority as loop-breakers.
probablyConstructible m = checkTermLits (LSortFresh /=) m
&& not (containsPrivate m)
-- KU goals of messages that are currently deducible. Either because they
-- are composed of public names only and do not contain private function
-- symbols or because they can be extracted from a sent message using
-- unpairing or inversion only.
currentlyDeducible i m = (checkTermLits (LSortPub ==) m
&& not (containsPrivate m))
|| extractible i m
extractible i m = or $ do
(j, ru) <- M.toList $ get sNodes sys
-- We cannot deduce a message from a last node.
guard (not $ isLast sys j)
let derivedMsgs = concatMap toplevelTerms $
[ t | Fact OutFact _ [t] <- get rConcs ru] <|>
[ t | Just (DnK, t) <- kFactView <$> get rConcs ru]
-- m is deducible from j without an immediate contradiction
-- if it is a derived message of 'ru' and the dependency does
-- not make the graph cyclic.
return $ m `elem` derivedMsgs &&
not (j `S.member` D.reachableSet [i] existingDeps)
toplevelTerms t@(viewTerm2 -> FPair t1 t2) =
t : toplevelTerms t1 ++ toplevelTerms t2
toplevelTerms t@(viewTerm2 -> FInv t1) = t : toplevelTerms t1
toplevelTerms t = [t]
allMsgVarsKnownEarlier (i,_) args = (all isMsgVar args) &&
(all (`elem` earlierMsgVars) args)
where earlierMsgVars = do (j, _, t) <- allKUActions sys
guard $ isMsgVar t && alwaysBefore sys j i
return t
-- check whether we have a chain that fits N5'' (an open chain between an
-- equality rule and a simple msg var conclusion that exists as a K up
-- previously) which needs to be resolved even if it is an open chain
chainToEquality :: LNTerm -> NodeConc -> NodePrem -> Bool
chainToEquality t_start conc p = is_msg_var && is_equality && ku_before
where
-- check whether it is a msg var
is_msg_var = isMsgVar t_start
-- and whether we do have an equality rule instance at the end
is_equality = isIEqualityRule $ nodeRule (fst p) sys
-- get all KU-facts with the same msg var
ku_start = filter (\x -> (fst x) == t_start) $
map (\(i, _, m) -> (m, i)) $ allKUActions sys
-- and check whether any of them happens before the KD-conclusion
ku_before = any (\(_, x) -> alwaysBefore sys x (fst conc)) ku_start
-- | The list of all open goals left together with their status.
| 5,912
|
openGoals sys = do
(goal, status) <- M.toList $ get sGoals sys
let solved = get gsSolved status
-- check whether the goal is still open
guard $ case goal of
ActionG i (kFactView -> Just (UpK, m)) ->
if get sDiffSystem sys
-- In a diff proof, all action goals need to be solved.
then not (solved)
else
not $ solved
-- message variables are not solved, except if the node already exists in the system -> facilitates finding contradictions
|| (isMsgVar m && Nothing == M.lookup i (get sNodes sys)) || sortOfLNTerm m == LSortPub
-- handled by 'insertAction'
|| isPair m || isInverse m || isProduct m --- || isXor m
|| isUnion m || isNullaryPublicFunction m
ActionG _ _ -> not solved
PremiseG _ _ -> not solved
-- Technically the 'False' disj would be a solvable goal. However, we
-- have a separate proof method for this, i.e., contradictions.
DisjG (Disj []) -> False
DisjG _ -> not solved
ChainG c p ->
case kFactView (nodeConcFact c sys) of
Just (DnK, viewTerm2 -> FUnion args) ->
-- do not solve Union conclusions if they contain only known msg vars
not solved && not (allMsgVarsKnownEarlier c args)
-- open chains for msg vars are only solved if N5'' is applicable
Just (DnK, m) | isMsgVar m -> (not solved) &&
(chainToEquality m c p)
| otherwise -> not solved
fa -> error $ "openChainGoals: impossible fact: " ++ show fa
-- FIXME: Split goals may be duplicated, we always have to check
-- explicitly if they still exist.
SplitG idx -> splitExists (get sEqStore sys) idx
let
useful = case goal of
_ | get gsLoopBreaker status -> LoopBreaker
ActionG i (kFactView -> Just (UpK, m))
-- if there are KU-guards then all knowledge goals are useful
| hasKUGuards -> Useful
| currentlyDeducible i m -> CurrentlyDeducible
| probablyConstructible m -> ProbablyConstructible
_ -> Useful
return (goal, (get gsNr status, useful))
where
existingDeps = rawLessRel sys
hasKUGuards =
any ((KUFact `elem`) . guardFactTags) $ S.toList $ get sFormulas sys
checkTermLits :: (LSort -> Bool) -> LNTerm -> Bool
checkTermLits p =
Mono.getAll . foldMap (Mono.All . p . sortOfLit)
-- KU goals of messages that are likely to be constructible by the
-- adversary. These are terms that do not contain a fresh name or a fresh
-- name variable. For protocols without loops they are very likely to be
-- constructible. For protocols with loops, such terms have to be given
-- similar priority as loop-breakers.
probablyConstructible m = checkTermLits (LSortFresh /=) m
&& not (containsPrivate m)
-- KU goals of messages that are currently deducible. Either because they
-- are composed of public names only and do not contain private function
-- symbols or because they can be extracted from a sent message using
-- unpairing or inversion only.
currentlyDeducible i m = (checkTermLits (LSortPub ==) m
&& not (containsPrivate m))
|| extractible i m
extractible i m = or $ do
(j, ru) <- M.toList $ get sNodes sys
-- We cannot deduce a message from a last node.
guard (not $ isLast sys j)
let derivedMsgs = concatMap toplevelTerms $
[ t | Fact OutFact _ [t] <- get rConcs ru] <|>
[ t | Just (DnK, t) <- kFactView <$> get rConcs ru]
-- m is deducible from j without an immediate contradiction
-- if it is a derived message of 'ru' and the dependency does
-- not make the graph cyclic.
return $ m `elem` derivedMsgs &&
not (j `S.member` D.reachableSet [i] existingDeps)
toplevelTerms t@(viewTerm2 -> FPair t1 t2) =
t : toplevelTerms t1 ++ toplevelTerms t2
toplevelTerms t@(viewTerm2 -> FInv t1) = t : toplevelTerms t1
toplevelTerms t = [t]
allMsgVarsKnownEarlier (i,_) args = (all isMsgVar args) &&
(all (`elem` earlierMsgVars) args)
where earlierMsgVars = do (j, _, t) <- allKUActions sys
guard $ isMsgVar t && alwaysBefore sys j i
return t
-- check whether we have a chain that fits N5'' (an open chain between an
-- equality rule and a simple msg var conclusion that exists as a K up
-- previously) which needs to be resolved even if it is an open chain
chainToEquality :: LNTerm -> NodeConc -> NodePrem -> Bool
chainToEquality t_start conc p = is_msg_var && is_equality && ku_before
where
-- check whether it is a msg var
is_msg_var = isMsgVar t_start
-- and whether we do have an equality rule instance at the end
is_equality = isIEqualityRule $ nodeRule (fst p) sys
-- get all KU-facts with the same msg var
ku_start = filter (\x -> (fst x) == t_start) $
map (\(i, _, m) -> (m, i)) $ allKUActions sys
-- and check whether any of them happens before the KD-conclusion
ku_before = any (\(_, x) -> alwaysBefore sys x (fst conc)) ku_start
-- | The list of all open goals left together with their status.
| 5,873
| true
| true
| 55
| 24
| 2,159
| 1,163
| 613
| 550
| null | null |
VictorDenisov/ldap-client
|
src/Ldap/Client/Modify.hs
|
bsd-2-clause
|
-- | Perform the Modify DN operation synchronously. Returns @Left e@ where
-- @e@ is a 'ResponseError' on failures.
modifyDnEither :: Ldap -> Dn -> RelativeDn -> Bool -> Maybe Dn -> IO (Either ResponseError ())
modifyDnEither l dn rdn del new =
wait =<< modifyDnAsync l dn rdn del new
| 286
|
modifyDnEither :: Ldap -> Dn -> RelativeDn -> Bool -> Maybe Dn -> IO (Either ResponseError ())
modifyDnEither l dn rdn del new =
wait =<< modifyDnAsync l dn rdn del new
| 170
|
modifyDnEither l dn rdn del new =
wait =<< modifyDnAsync l dn rdn del new
| 75
| true
| true
| 1
| 14
| 52
| 72
| 34
| 38
| null | null |
eryx67/haskell-libtorrent
|
src/Network/Libtorrent/TorrentInfo.hs
|
bsd-3-clause
|
torrentInfoTrackers :: MonadIO m => TorrentInfo -> m (StdVector AnnounceEntry)
torrentInfoTrackers ho =
liftIO . withPtr ho $ \hoPtr ->
fromPtr [CU.exp| VectorAnnounceEntry * { new VectorAnnounceEntry($(torrent_info * hoPtr)->trackers()) } |]
| 247
|
torrentInfoTrackers :: MonadIO m => TorrentInfo -> m (StdVector AnnounceEntry)
torrentInfoTrackers ho =
liftIO . withPtr ho $ \hoPtr ->
fromPtr [CU.exp| VectorAnnounceEntry * { new VectorAnnounceEntry($(torrent_info * hoPtr)->trackers()) } |]
| 247
|
torrentInfoTrackers ho =
liftIO . withPtr ho $ \hoPtr ->
fromPtr [CU.exp| VectorAnnounceEntry * { new VectorAnnounceEntry($(torrent_info * hoPtr)->trackers()) } |]
| 167
| false
| true
| 0
| 9
| 35
| 59
| 30
| 29
| null | null |
geophf/1HaskellADay
|
exercises/HAD/Y2020/M08/D24/Exercise.hs
|
mit
|
{--
I've been thinking about cosine similarities...
https://en.wikipedia.org/wiki/Cosine_similarity
... but before we get our cosine similarity-game on, let's limber up a bit.
Let's play, a little, with cosines today.
Today's Haskell problem: multiple two numbers using the cosine-method and
compare those results with, you know, the actual multiplication of those
numbers.
The cosine-method:
https://en.wikipedia.org/wiki/Prosthaphaeresis
Or, to steal the text, blatantly, because: who follows the links?
For example, say we want to multiply 105 and 720. Following the steps:
1. Scale down: Shift the decimal point three places to the left in each. We get
cos a = 0.105 and cos b = 0.720
2. Inverse cosine: cos 84 degrees is about 0.105 and cos 44 degrees is
about 0.720
3. Sum and difference: 84+44=128 and 84-44=40
4. Average the cosines: (cos 128 degrees + cos 40 degrees) / 2 is about
(-0.616+0.766) / 2, or 0.075.
5. Scale up: For each of 105 and 720, we shifted the decimal point three places
to the left, so in the answer we shift six places to the right. The result
is 75,000. This is very close to the actual product, 75,600 (a percent error
of ≈0.8%).
ta-dah!
Write this algorithm. Compare the results of it to the actual products.
--}
cosineMultiply :: Int -> Int -> Int
cosineMultiply a b = undefined
| 1,350
|
cosineMultiply :: Int -> Int -> Int
cosineMultiply a b = undefined
| 66
|
cosineMultiply a b = undefined
| 30
| true
| true
| 0
| 6
| 256
| 25
| 13
| 12
| null | null |
themoritz/cabal
|
cabal-testsuite/PackageTests/Ambiguity/reexport-test/Main.hs
|
bsd-3-clause
|
main = putStrLn (PDupe.pkg ++ " " ++ QDupe.pkg)
| 47
|
main = putStrLn (PDupe.pkg ++ " " ++ QDupe.pkg)
| 47
|
main = putStrLn (PDupe.pkg ++ " " ++ QDupe.pkg)
| 47
| false
| false
| 0
| 9
| 8
| 24
| 12
| 12
| null | null |
gafiatulin/codewars
|
src/3 kyu/UnlimitedGameOfLife.hs
|
mit
|
life world 0 = world
| 20
|
life world 0 = world
| 20
|
life world 0 = world
| 20
| false
| false
| 1
| 5
| 4
| 16
| 5
| 11
| null | null |
ppenzin/neko-lib-hs
|
src/test/Instructions.hs
|
bsd-2-clause
|
binaryCheckInstructions = testGroup "produce/consume instruction"
[ checkInstruction H.empty $ AccNull
, checkInstruction H.empty $ AccTrue
, checkInstruction H.empty $ AccFalse
, checkInstruction H.empty $ AccThis
, checkInstruction H.empty $ AccInt 7
, checkInstruction H.empty $ AccInt 1000
, checkInstruction H.empty $ AccStack 3
, checkInstruction H.empty $ AccGlobal 1
, checkInstruction H.empty $ AccEnv 4
, checkInstruction (H.fromStringList ["someField"]) $ AccField "someField"
, checkInstruction H.empty $ AccArray
, checkInstruction H.empty $ AccIndex 5
, checkInstruction (H.fromStringList ["someBuiltin"]) $ AccBuiltin "someBuiltin"
, checkInstruction H.empty $ SetStack 3
, checkInstruction H.empty $ SetGlobal 1
, checkInstruction H.empty $ SetEnv 4
, checkInstruction (H.fromStringList ["foobar"]) $ SetField "foobar"
, checkInstruction H.empty $ SetArray
, checkInstruction H.empty $ SetIndex 7
, checkInstruction H.empty $ SetThis
, checkInstruction H.empty $ Push
, checkInstruction H.empty $ Pop 10
, checkInstruction H.empty $ Call 0
, checkInstruction H.empty $ ObjCall 5
, checkInstruction H.empty $ Jump (-3)
, checkInstruction H.empty $ JumpIf 15
, checkInstruction H.empty $ JumpIfNot (-6)
, checkInstruction H.empty $ Trap 30
, checkInstruction H.empty $ EndTrap
, checkInstruction H.empty $ (Ret 10)
, checkInstruction H.empty $ (MakeEnv 1)
, checkInstruction H.empty $ (MakeArray 1)
, checkInstruction H.empty $ Bool
, checkInstruction H.empty $ IsNull
, checkInstruction H.empty $ IsNotNull
, checkInstruction H.empty $ Add
, checkInstruction H.empty $ Sub
, checkInstruction H.empty $ Mult
, checkInstruction H.empty $ Div
, checkInstruction H.empty $ Mod
, checkInstruction H.empty $ Shl
, checkInstruction H.empty $ Shr
, checkInstruction H.empty $ UShr
, checkInstruction H.empty $ Or
, checkInstruction H.empty $ And
, checkInstruction H.empty $ Xor
, checkInstruction H.empty $ Eq
, checkInstruction H.empty $ Neq
, checkInstruction H.empty $ Gt
, checkInstruction H.empty $ Gte
, checkInstruction H.empty $ Lt
, checkInstruction H.empty $ Lte
, checkInstruction H.empty $ Not
, checkInstruction H.empty $ TypeOf
, checkInstruction H.empty $ Compare
, checkInstruction H.empty $ Hash
, checkInstruction H.empty $ New
, checkInstruction H.empty $ JumpTable 0
, checkInstruction H.empty $ Apply 6
, checkInstruction H.empty $ AccStack0
, checkInstruction H.empty $ AccStack1
, checkInstruction H.empty $ AccIndex0
, checkInstruction H.empty $ AccIndex1
, checkInstruction H.empty $ PhysCompare
, checkInstruction H.empty $ TailCall (4,20)
, checkInstruction H.empty $ Loop
]
| 2,743
|
binaryCheckInstructions = testGroup "produce/consume instruction"
[ checkInstruction H.empty $ AccNull
, checkInstruction H.empty $ AccTrue
, checkInstruction H.empty $ AccFalse
, checkInstruction H.empty $ AccThis
, checkInstruction H.empty $ AccInt 7
, checkInstruction H.empty $ AccInt 1000
, checkInstruction H.empty $ AccStack 3
, checkInstruction H.empty $ AccGlobal 1
, checkInstruction H.empty $ AccEnv 4
, checkInstruction (H.fromStringList ["someField"]) $ AccField "someField"
, checkInstruction H.empty $ AccArray
, checkInstruction H.empty $ AccIndex 5
, checkInstruction (H.fromStringList ["someBuiltin"]) $ AccBuiltin "someBuiltin"
, checkInstruction H.empty $ SetStack 3
, checkInstruction H.empty $ SetGlobal 1
, checkInstruction H.empty $ SetEnv 4
, checkInstruction (H.fromStringList ["foobar"]) $ SetField "foobar"
, checkInstruction H.empty $ SetArray
, checkInstruction H.empty $ SetIndex 7
, checkInstruction H.empty $ SetThis
, checkInstruction H.empty $ Push
, checkInstruction H.empty $ Pop 10
, checkInstruction H.empty $ Call 0
, checkInstruction H.empty $ ObjCall 5
, checkInstruction H.empty $ Jump (-3)
, checkInstruction H.empty $ JumpIf 15
, checkInstruction H.empty $ JumpIfNot (-6)
, checkInstruction H.empty $ Trap 30
, checkInstruction H.empty $ EndTrap
, checkInstruction H.empty $ (Ret 10)
, checkInstruction H.empty $ (MakeEnv 1)
, checkInstruction H.empty $ (MakeArray 1)
, checkInstruction H.empty $ Bool
, checkInstruction H.empty $ IsNull
, checkInstruction H.empty $ IsNotNull
, checkInstruction H.empty $ Add
, checkInstruction H.empty $ Sub
, checkInstruction H.empty $ Mult
, checkInstruction H.empty $ Div
, checkInstruction H.empty $ Mod
, checkInstruction H.empty $ Shl
, checkInstruction H.empty $ Shr
, checkInstruction H.empty $ UShr
, checkInstruction H.empty $ Or
, checkInstruction H.empty $ And
, checkInstruction H.empty $ Xor
, checkInstruction H.empty $ Eq
, checkInstruction H.empty $ Neq
, checkInstruction H.empty $ Gt
, checkInstruction H.empty $ Gte
, checkInstruction H.empty $ Lt
, checkInstruction H.empty $ Lte
, checkInstruction H.empty $ Not
, checkInstruction H.empty $ TypeOf
, checkInstruction H.empty $ Compare
, checkInstruction H.empty $ Hash
, checkInstruction H.empty $ New
, checkInstruction H.empty $ JumpTable 0
, checkInstruction H.empty $ Apply 6
, checkInstruction H.empty $ AccStack0
, checkInstruction H.empty $ AccStack1
, checkInstruction H.empty $ AccIndex0
, checkInstruction H.empty $ AccIndex1
, checkInstruction H.empty $ PhysCompare
, checkInstruction H.empty $ TailCall (4,20)
, checkInstruction H.empty $ Loop
]
| 2,743
|
binaryCheckInstructions = testGroup "produce/consume instruction"
[ checkInstruction H.empty $ AccNull
, checkInstruction H.empty $ AccTrue
, checkInstruction H.empty $ AccFalse
, checkInstruction H.empty $ AccThis
, checkInstruction H.empty $ AccInt 7
, checkInstruction H.empty $ AccInt 1000
, checkInstruction H.empty $ AccStack 3
, checkInstruction H.empty $ AccGlobal 1
, checkInstruction H.empty $ AccEnv 4
, checkInstruction (H.fromStringList ["someField"]) $ AccField "someField"
, checkInstruction H.empty $ AccArray
, checkInstruction H.empty $ AccIndex 5
, checkInstruction (H.fromStringList ["someBuiltin"]) $ AccBuiltin "someBuiltin"
, checkInstruction H.empty $ SetStack 3
, checkInstruction H.empty $ SetGlobal 1
, checkInstruction H.empty $ SetEnv 4
, checkInstruction (H.fromStringList ["foobar"]) $ SetField "foobar"
, checkInstruction H.empty $ SetArray
, checkInstruction H.empty $ SetIndex 7
, checkInstruction H.empty $ SetThis
, checkInstruction H.empty $ Push
, checkInstruction H.empty $ Pop 10
, checkInstruction H.empty $ Call 0
, checkInstruction H.empty $ ObjCall 5
, checkInstruction H.empty $ Jump (-3)
, checkInstruction H.empty $ JumpIf 15
, checkInstruction H.empty $ JumpIfNot (-6)
, checkInstruction H.empty $ Trap 30
, checkInstruction H.empty $ EndTrap
, checkInstruction H.empty $ (Ret 10)
, checkInstruction H.empty $ (MakeEnv 1)
, checkInstruction H.empty $ (MakeArray 1)
, checkInstruction H.empty $ Bool
, checkInstruction H.empty $ IsNull
, checkInstruction H.empty $ IsNotNull
, checkInstruction H.empty $ Add
, checkInstruction H.empty $ Sub
, checkInstruction H.empty $ Mult
, checkInstruction H.empty $ Div
, checkInstruction H.empty $ Mod
, checkInstruction H.empty $ Shl
, checkInstruction H.empty $ Shr
, checkInstruction H.empty $ UShr
, checkInstruction H.empty $ Or
, checkInstruction H.empty $ And
, checkInstruction H.empty $ Xor
, checkInstruction H.empty $ Eq
, checkInstruction H.empty $ Neq
, checkInstruction H.empty $ Gt
, checkInstruction H.empty $ Gte
, checkInstruction H.empty $ Lt
, checkInstruction H.empty $ Lte
, checkInstruction H.empty $ Not
, checkInstruction H.empty $ TypeOf
, checkInstruction H.empty $ Compare
, checkInstruction H.empty $ Hash
, checkInstruction H.empty $ New
, checkInstruction H.empty $ JumpTable 0
, checkInstruction H.empty $ Apply 6
, checkInstruction H.empty $ AccStack0
, checkInstruction H.empty $ AccStack1
, checkInstruction H.empty $ AccIndex0
, checkInstruction H.empty $ AccIndex1
, checkInstruction H.empty $ PhysCompare
, checkInstruction H.empty $ TailCall (4,20)
, checkInstruction H.empty $ Loop
]
| 2,743
| false
| false
| 0
| 10
| 498
| 934
| 458
| 476
| null | null |
rrnewton/accelerate
|
Data/Array/Accelerate/Smart.hs
|
bsd-3-clause
|
showPreAccOp Reshape{} = "Reshape"
| 43
|
showPreAccOp Reshape{} = "Reshape"
| 43
|
showPreAccOp Reshape{} = "Reshape"
| 43
| false
| false
| 0
| 6
| 12
| 13
| 6
| 7
| null | null |
tanakh/tanakh.jp
|
site.hs
|
bsd-3-clause
|
--------------------------------------------------------------------------------
postList :: Tags -> Pattern -> ([Item String] -> Compiler [Item String]) -> Compiler String
postList tags pattern sortFilter = do
posts <- sortFilter =<< loadAll pattern
itemTpl <- loadBody "templates/post-item.html"
applyTemplateList itemTpl (postCtx tags) posts
--------------------------------------------------------------------------------
| 441
|
postList :: Tags -> Pattern -> ([Item String] -> Compiler [Item String]) -> Compiler String
postList tags pattern sortFilter = do
posts <- sortFilter =<< loadAll pattern
itemTpl <- loadBody "templates/post-item.html"
applyTemplateList itemTpl (postCtx tags) posts
--------------------------------------------------------------------------------
| 360
|
postList tags pattern sortFilter = do
posts <- sortFilter =<< loadAll pattern
itemTpl <- loadBody "templates/post-item.html"
applyTemplateList itemTpl (postCtx tags) posts
--------------------------------------------------------------------------------
| 268
| true
| true
| 0
| 13
| 53
| 102
| 47
| 55
| null | null |
AlexeyRaga/eta
|
libraries/base/GHC/IO/Handle/Internals.hs
|
bsd-3-clause
|
do_operation :: String -> Handle -> (Handle__ -> IO a) -> MVar Handle__ -> IO a
do_operation fun h act m = do
h_ <- takeMVar m
checkHandleInvariants h_
act h_ `catchException` handler h_
where
handler h_ e = do
putMVar m h_
case () of
_ | Just ioe <- fromException e ->
ioError (augmentIOError ioe fun h)
_ | Just async_ex <- fromException e -> do -- see Note [async]
let _ = async_ex :: SomeAsyncException
t <- myThreadId
throwTo t e
do_operation fun h act m
_otherwise ->
throwIO e
-- Note [async]
--
-- If an asynchronous exception is raised during an I/O operation,
-- normally it is fine to just re-throw the exception synchronously.
-- However, if we are inside an unsafePerformIO or an
-- unsafeInterleaveIO, this would replace the enclosing thunk with the
-- exception raised, which is wrong (#3997). We have to release the
-- lock on the Handle, but what do we replace the thunk with? What
-- should happen when the thunk is subsequently demanded again?
--
-- The only sensible choice we have is to re-do the IO operation on
-- resumption, but then we have to be careful in the IO library that
-- this is always safe to do. In particular we should
--
-- never perform any side-effects before an interruptible operation
--
-- because the interruptible operation may raise an asynchronous
-- exception, which may cause the operation and its side effects to be
-- subsequently performed again.
--
-- Re-doing the IO operation is achieved by:
-- - using throwTo to re-throw the asynchronous exception asynchronously
-- in the current thread
-- - on resumption, it will be as if throwTo returns. In that case, we
-- recursively invoke the original operation (see do_operation above).
--
-- Interruptible operations in the I/O library are:
-- - threadWaitRead/threadWaitWrite
-- - fillReadBuffer/flushWriteBuffer
-- - readTextDevice/writeTextDevice
| 2,000
|
do_operation :: String -> Handle -> (Handle__ -> IO a) -> MVar Handle__ -> IO a
do_operation fun h act m = do
h_ <- takeMVar m
checkHandleInvariants h_
act h_ `catchException` handler h_
where
handler h_ e = do
putMVar m h_
case () of
_ | Just ioe <- fromException e ->
ioError (augmentIOError ioe fun h)
_ | Just async_ex <- fromException e -> do -- see Note [async]
let _ = async_ex :: SomeAsyncException
t <- myThreadId
throwTo t e
do_operation fun h act m
_otherwise ->
throwIO e
-- Note [async]
--
-- If an asynchronous exception is raised during an I/O operation,
-- normally it is fine to just re-throw the exception synchronously.
-- However, if we are inside an unsafePerformIO or an
-- unsafeInterleaveIO, this would replace the enclosing thunk with the
-- exception raised, which is wrong (#3997). We have to release the
-- lock on the Handle, but what do we replace the thunk with? What
-- should happen when the thunk is subsequently demanded again?
--
-- The only sensible choice we have is to re-do the IO operation on
-- resumption, but then we have to be careful in the IO library that
-- this is always safe to do. In particular we should
--
-- never perform any side-effects before an interruptible operation
--
-- because the interruptible operation may raise an asynchronous
-- exception, which may cause the operation and its side effects to be
-- subsequently performed again.
--
-- Re-doing the IO operation is achieved by:
-- - using throwTo to re-throw the asynchronous exception asynchronously
-- in the current thread
-- - on resumption, it will be as if throwTo returns. In that case, we
-- recursively invoke the original operation (see do_operation above).
--
-- Interruptible operations in the I/O library are:
-- - threadWaitRead/threadWaitWrite
-- - fillReadBuffer/flushWriteBuffer
-- - readTextDevice/writeTextDevice
| 2,000
|
do_operation fun h act m = do
h_ <- takeMVar m
checkHandleInvariants h_
act h_ `catchException` handler h_
where
handler h_ e = do
putMVar m h_
case () of
_ | Just ioe <- fromException e ->
ioError (augmentIOError ioe fun h)
_ | Just async_ex <- fromException e -> do -- see Note [async]
let _ = async_ex :: SomeAsyncException
t <- myThreadId
throwTo t e
do_operation fun h act m
_otherwise ->
throwIO e
-- Note [async]
--
-- If an asynchronous exception is raised during an I/O operation,
-- normally it is fine to just re-throw the exception synchronously.
-- However, if we are inside an unsafePerformIO or an
-- unsafeInterleaveIO, this would replace the enclosing thunk with the
-- exception raised, which is wrong (#3997). We have to release the
-- lock on the Handle, but what do we replace the thunk with? What
-- should happen when the thunk is subsequently demanded again?
--
-- The only sensible choice we have is to re-do the IO operation on
-- resumption, but then we have to be careful in the IO library that
-- this is always safe to do. In particular we should
--
-- never perform any side-effects before an interruptible operation
--
-- because the interruptible operation may raise an asynchronous
-- exception, which may cause the operation and its side effects to be
-- subsequently performed again.
--
-- Re-doing the IO operation is achieved by:
-- - using throwTo to re-throw the asynchronous exception asynchronously
-- in the current thread
-- - on resumption, it will be as if throwTo returns. In that case, we
-- recursively invoke the original operation (see do_operation above).
--
-- Interruptible operations in the I/O library are:
-- - threadWaitRead/threadWaitWrite
-- - fillReadBuffer/flushWriteBuffer
-- - readTextDevice/writeTextDevice
| 1,920
| false
| true
| 0
| 15
| 466
| 250
| 127
| 123
| null | null |
beni55/ghcjs
|
src/Compiler/JMacro/QQ.hs
|
mit
|
folBy :: JMParser a -> Char -> JMParser a
folBy a b = a <* (lookAhead (char b) >>= const (return ()))
| 101
|
folBy :: JMParser a -> Char -> JMParser a
folBy a b = a <* (lookAhead (char b) >>= const (return ()))
| 101
|
folBy a b = a <* (lookAhead (char b) >>= const (return ()))
| 59
| false
| true
| 2
| 11
| 21
| 68
| 31
| 37
| null | null |
cutsea110/Kestrel
|
Handler/Admin.hs
|
bsd-3-clause
|
postUserR :: UserId -> Handler ()
postUserR uid = do
_ <- requireAuth
new <- runInputPost $ User
<$> ireq textField "ident"
<*> iopt passwordField "password"
<*> iopt textField "nickname"
<*> ireq boolField "active"
runDB $ replace uid new
redirect $ UserR uid
| 304
|
postUserR :: UserId -> Handler ()
postUserR uid = do
_ <- requireAuth
new <- runInputPost $ User
<$> ireq textField "ident"
<*> iopt passwordField "password"
<*> iopt textField "nickname"
<*> ireq boolField "active"
runDB $ replace uid new
redirect $ UserR uid
| 304
|
postUserR uid = do
_ <- requireAuth
new <- runInputPost $ User
<$> ireq textField "ident"
<*> iopt passwordField "password"
<*> iopt textField "nickname"
<*> ireq boolField "active"
runDB $ replace uid new
redirect $ UserR uid
| 270
| false
| true
| 0
| 13
| 86
| 104
| 45
| 59
| null | null |
maximilianhuber/maximilian-huber.de
|
src/Pages.hs
|
bsd-3-clause
|
webdesign :: SiteCfg -> Page
webdesign sc = (defaultP sc) { pPath = ["webdesign.html"]
, pTitle = Just "Webdesign"
, pCtn = ctn }
where ctn :: Html
ctn = do
h1 "Webdesign"
_ <- "Diese Seite ist in purem "
a ! A.href "http://www.haskell.org/haskellwiki/Haskell"
! A.target "_blank" $
"Haskell"
_ <- " geschrieben. Um diese statische HTML Seite zu erzeugen habe ich die folgenden Tools genutzt"
ul $ do
li $ do
a ! A.href "http://jaspervdj.be/blaze/"! A.target "_blank" $
"blazeHtml"
" zum erzeugen des HTML codes und "
li $ do
a ! A.href "http://fvisser.nl/clay/"! A.target "_blank" $
"clay"
" um die CSS-Dateien zu erzeugen."
_ <- "Der komplette Code ist auf "
a ! A.href "https://github.com/maxhbr/maximilian-huber.de" $
"GitHub"
_ <- " zu finden."
a ! A.href "https://github.com/maxhbr/maximilian-huber.de"
! A.target "_blank" $
img ! A.style "position: absolute; top: 0; right: 0; border: 0;"
! A.src "https://camo.githubusercontent.com/a6677b08c955af8400f44c6298f40e7d19cc5b2d/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677261795f3664366436642e706e67"
! A.alt "Fork me on GitHub"
-------------------------------------------------------------------------------
| 1,592
|
webdesign :: SiteCfg -> Page
webdesign sc = (defaultP sc) { pPath = ["webdesign.html"]
, pTitle = Just "Webdesign"
, pCtn = ctn }
where ctn :: Html
ctn = do
h1 "Webdesign"
_ <- "Diese Seite ist in purem "
a ! A.href "http://www.haskell.org/haskellwiki/Haskell"
! A.target "_blank" $
"Haskell"
_ <- " geschrieben. Um diese statische HTML Seite zu erzeugen habe ich die folgenden Tools genutzt"
ul $ do
li $ do
a ! A.href "http://jaspervdj.be/blaze/"! A.target "_blank" $
"blazeHtml"
" zum erzeugen des HTML codes und "
li $ do
a ! A.href "http://fvisser.nl/clay/"! A.target "_blank" $
"clay"
" um die CSS-Dateien zu erzeugen."
_ <- "Der komplette Code ist auf "
a ! A.href "https://github.com/maxhbr/maximilian-huber.de" $
"GitHub"
_ <- " zu finden."
a ! A.href "https://github.com/maxhbr/maximilian-huber.de"
! A.target "_blank" $
img ! A.style "position: absolute; top: 0; right: 0; border: 0;"
! A.src "https://camo.githubusercontent.com/a6677b08c955af8400f44c6298f40e7d19cc5b2d/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677261795f3664366436642e706e67"
! A.alt "Fork me on GitHub"
-------------------------------------------------------------------------------
| 1,592
|
webdesign sc = (defaultP sc) { pPath = ["webdesign.html"]
, pTitle = Just "Webdesign"
, pCtn = ctn }
where ctn :: Html
ctn = do
h1 "Webdesign"
_ <- "Diese Seite ist in purem "
a ! A.href "http://www.haskell.org/haskellwiki/Haskell"
! A.target "_blank" $
"Haskell"
_ <- " geschrieben. Um diese statische HTML Seite zu erzeugen habe ich die folgenden Tools genutzt"
ul $ do
li $ do
a ! A.href "http://jaspervdj.be/blaze/"! A.target "_blank" $
"blazeHtml"
" zum erzeugen des HTML codes und "
li $ do
a ! A.href "http://fvisser.nl/clay/"! A.target "_blank" $
"clay"
" um die CSS-Dateien zu erzeugen."
_ <- "Der komplette Code ist auf "
a ! A.href "https://github.com/maxhbr/maximilian-huber.de" $
"GitHub"
_ <- " zu finden."
a ! A.href "https://github.com/maxhbr/maximilian-huber.de"
! A.target "_blank" $
img ! A.style "position: absolute; top: 0; right: 0; border: 0;"
! A.src "https://camo.githubusercontent.com/a6677b08c955af8400f44c6298f40e7d19cc5b2d/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677261795f3664366436642e706e67"
! A.alt "Fork me on GitHub"
-------------------------------------------------------------------------------
| 1,563
| false
| true
| 0
| 18
| 519
| 280
| 126
| 154
| null | null |
brendanhay/gogol
|
gogol-dfareporting/gen/Network/Google/DFAReporting/Types/Product.hs
|
mpl-2.0
|
-- | Creates a value of 'FloodlightActivity' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'faCountingMethod'
--
-- * 'faAttributionEnabled'
--
-- * 'faStatus'
--
-- * 'faTagString'
--
-- * 'faSecure'
--
-- * 'faExpectedURL'
--
-- * 'faFloodlightActivityGroupTagString'
--
-- * 'faFloodlightConfigurationId'
--
-- * 'faKind'
--
-- * 'faAdvertiserId'
--
-- * 'faAdvertiserIdDimensionValue'
--
-- * 'faSSLCompliant'
--
-- * 'faIdDimensionValue'
--
-- * 'faTagFormat'
--
-- * 'faCacheBustingType'
--
-- * 'faAccountId'
--
-- * 'faName'
--
-- * 'faPublisherTags'
--
-- * 'faFloodlightActivityGroupId'
--
-- * 'faFloodlightActivityGroupType'
--
-- * 'faDefaultTags'
--
-- * 'faFloodlightTagType'
--
-- * 'faFloodlightActivityGroupName'
--
-- * 'faId'
--
-- * 'faSSLRequired'
--
-- * 'faUserDefinedVariableTypes'
--
-- * 'faSubAccountId'
--
-- * 'faNotes'
--
-- * 'faFloodlightConfigurationIdDimensionValue'
floodlightActivity
:: FloodlightActivity
floodlightActivity =
FloodlightActivity'
{ _faCountingMethod = Nothing
, _faAttributionEnabled = Nothing
, _faStatus = Nothing
, _faTagString = Nothing
, _faSecure = Nothing
, _faExpectedURL = Nothing
, _faFloodlightActivityGroupTagString = Nothing
, _faFloodlightConfigurationId = Nothing
, _faKind = Nothing
, _faAdvertiserId = Nothing
, _faAdvertiserIdDimensionValue = Nothing
, _faSSLCompliant = Nothing
, _faIdDimensionValue = Nothing
, _faTagFormat = Nothing
, _faCacheBustingType = Nothing
, _faAccountId = Nothing
, _faName = Nothing
, _faPublisherTags = Nothing
, _faFloodlightActivityGroupId = Nothing
, _faFloodlightActivityGroupType = Nothing
, _faDefaultTags = Nothing
, _faFloodlightTagType = Nothing
, _faFloodlightActivityGroupName = Nothing
, _faId = Nothing
, _faSSLRequired = Nothing
, _faUserDefinedVariableTypes = Nothing
, _faSubAccountId = Nothing
, _faNotes = Nothing
, _faFloodlightConfigurationIdDimensionValue = Nothing
}
| 2,104
|
floodlightActivity
:: FloodlightActivity
floodlightActivity =
FloodlightActivity'
{ _faCountingMethod = Nothing
, _faAttributionEnabled = Nothing
, _faStatus = Nothing
, _faTagString = Nothing
, _faSecure = Nothing
, _faExpectedURL = Nothing
, _faFloodlightActivityGroupTagString = Nothing
, _faFloodlightConfigurationId = Nothing
, _faKind = Nothing
, _faAdvertiserId = Nothing
, _faAdvertiserIdDimensionValue = Nothing
, _faSSLCompliant = Nothing
, _faIdDimensionValue = Nothing
, _faTagFormat = Nothing
, _faCacheBustingType = Nothing
, _faAccountId = Nothing
, _faName = Nothing
, _faPublisherTags = Nothing
, _faFloodlightActivityGroupId = Nothing
, _faFloodlightActivityGroupType = Nothing
, _faDefaultTags = Nothing
, _faFloodlightTagType = Nothing
, _faFloodlightActivityGroupName = Nothing
, _faId = Nothing
, _faSSLRequired = Nothing
, _faUserDefinedVariableTypes = Nothing
, _faSubAccountId = Nothing
, _faNotes = Nothing
, _faFloodlightConfigurationIdDimensionValue = Nothing
}
| 1,115
|
floodlightActivity =
FloodlightActivity'
{ _faCountingMethod = Nothing
, _faAttributionEnabled = Nothing
, _faStatus = Nothing
, _faTagString = Nothing
, _faSecure = Nothing
, _faExpectedURL = Nothing
, _faFloodlightActivityGroupTagString = Nothing
, _faFloodlightConfigurationId = Nothing
, _faKind = Nothing
, _faAdvertiserId = Nothing
, _faAdvertiserIdDimensionValue = Nothing
, _faSSLCompliant = Nothing
, _faIdDimensionValue = Nothing
, _faTagFormat = Nothing
, _faCacheBustingType = Nothing
, _faAccountId = Nothing
, _faName = Nothing
, _faPublisherTags = Nothing
, _faFloodlightActivityGroupId = Nothing
, _faFloodlightActivityGroupType = Nothing
, _faDefaultTags = Nothing
, _faFloodlightTagType = Nothing
, _faFloodlightActivityGroupName = Nothing
, _faId = Nothing
, _faSSLRequired = Nothing
, _faUserDefinedVariableTypes = Nothing
, _faSubAccountId = Nothing
, _faNotes = Nothing
, _faFloodlightConfigurationIdDimensionValue = Nothing
}
| 1,070
| true
| true
| 0
| 7
| 394
| 258
| 186
| 72
| null | null |
nushio3/ghc
|
compiler/typecheck/TcTypeable.hs
|
bsd-3-clause
|
mkModIdRHS :: Module -> LHsExpr Id
mkModIdRHS mod
= nlHsApps (dataConWrapId trModuleDataCon)
[ trNameLit (unitIdFS (moduleUnitId mod))
, trNameLit (moduleNameFS (moduleName mod)) ]
| 208
|
mkModIdRHS :: Module -> LHsExpr Id
mkModIdRHS mod
= nlHsApps (dataConWrapId trModuleDataCon)
[ trNameLit (unitIdFS (moduleUnitId mod))
, trNameLit (moduleNameFS (moduleName mod)) ]
| 208
|
mkModIdRHS mod
= nlHsApps (dataConWrapId trModuleDataCon)
[ trNameLit (unitIdFS (moduleUnitId mod))
, trNameLit (moduleNameFS (moduleName mod)) ]
| 173
| false
| true
| 0
| 11
| 50
| 74
| 34
| 40
| null | null |
shlomobauer/BuildIT
|
src/Treepr.hs
|
apache-2.0
|
ptreeb (NBlock1 a b c d) = let z = "node " ++ a in
do
putStrLn ""
putStrLn z
ptreel 1 b
ptreenbl 1 c
ptreein 1 d
-- NBlock2 String CnstrList INicList IPlatform
| 171
|
ptreeb (NBlock1 a b c d) = let z = "node " ++ a in
do
putStrLn ""
putStrLn z
ptreel 1 b
ptreenbl 1 c
ptreein 1 d
-- NBlock2 String CnstrList INicList IPlatform
| 171
|
ptreeb (NBlock1 a b c d) = let z = "node " ++ a in
do
putStrLn ""
putStrLn z
ptreel 1 b
ptreenbl 1 c
ptreein 1 d
-- NBlock2 String CnstrList INicList IPlatform
| 171
| false
| false
| 0
| 9
| 46
| 74
| 31
| 43
| null | null |
nickspinale/euler
|
incomplete/044.hs
|
mit
|
root :: Integer -> Maybe Integer
root n = search 1 n
| 52
|
root :: Integer -> Maybe Integer
root n = search 1 n
| 52
|
root n = search 1 n
| 19
| false
| true
| 0
| 7
| 11
| 32
| 13
| 19
| null | null |
gridaphobe/ghc
|
compiler/main/HscTypes.hs
|
bsd-3-clause
|
-- | extendInteractiveContext is called with new TyThings recently defined to update the
-- InteractiveContext to include them. Ids are easily removed when shadowed,
-- but Classes and TyCons are not. Some work could be done to determine
-- whether they are entirely shadowed, but as you could still have references
-- to them (e.g. instances for classes or values of the type for TyCons), it's
-- not clear whether removing them is even the appropriate behavior.
extendInteractiveContext :: InteractiveContext
-> [TyThing]
-> [ClsInst] -> [FamInst]
-> Maybe [Type]
-> FixityEnv
-> InteractiveContext
extendInteractiveContext ictxt new_tythings new_cls_insts new_fam_insts defaults fix_env
= ictxt { ic_mod_index = ic_mod_index ictxt + 1
-- Always bump this; even instances should create
-- a new mod_index (Trac #9426)
, ic_tythings = new_tythings ++ old_tythings
, ic_rn_gbl_env = ic_rn_gbl_env ictxt `icExtendGblRdrEnv` new_tythings
, ic_instances = ( new_cls_insts ++ old_cls_insts
, new_fam_insts ++ old_fam_insts )
, ic_default = defaults
, ic_fix_env = fix_env -- See Note [Fixity declarations in GHCi]
}
where
new_ids = [id | AnId id <- new_tythings]
old_tythings = filterOut (shadowed_by new_ids) (ic_tythings ictxt)
-- Discard old instances that have been fully overrridden
-- See Note [Override identical instances in GHCi]
(cls_insts, fam_insts) = ic_instances ictxt
old_cls_insts = filterOut (\i -> any (identicalClsInstHead i) new_cls_insts) cls_insts
old_fam_insts = filterOut (\i -> any (identicalFamInstHead i) new_fam_insts) fam_insts
| 1,867
|
extendInteractiveContext :: InteractiveContext
-> [TyThing]
-> [ClsInst] -> [FamInst]
-> Maybe [Type]
-> FixityEnv
-> InteractiveContext
extendInteractiveContext ictxt new_tythings new_cls_insts new_fam_insts defaults fix_env
= ictxt { ic_mod_index = ic_mod_index ictxt + 1
-- Always bump this; even instances should create
-- a new mod_index (Trac #9426)
, ic_tythings = new_tythings ++ old_tythings
, ic_rn_gbl_env = ic_rn_gbl_env ictxt `icExtendGblRdrEnv` new_tythings
, ic_instances = ( new_cls_insts ++ old_cls_insts
, new_fam_insts ++ old_fam_insts )
, ic_default = defaults
, ic_fix_env = fix_env -- See Note [Fixity declarations in GHCi]
}
where
new_ids = [id | AnId id <- new_tythings]
old_tythings = filterOut (shadowed_by new_ids) (ic_tythings ictxt)
-- Discard old instances that have been fully overrridden
-- See Note [Override identical instances in GHCi]
(cls_insts, fam_insts) = ic_instances ictxt
old_cls_insts = filterOut (\i -> any (identicalClsInstHead i) new_cls_insts) cls_insts
old_fam_insts = filterOut (\i -> any (identicalFamInstHead i) new_fam_insts) fam_insts
| 1,401
|
extendInteractiveContext ictxt new_tythings new_cls_insts new_fam_insts defaults fix_env
= ictxt { ic_mod_index = ic_mod_index ictxt + 1
-- Always bump this; even instances should create
-- a new mod_index (Trac #9426)
, ic_tythings = new_tythings ++ old_tythings
, ic_rn_gbl_env = ic_rn_gbl_env ictxt `icExtendGblRdrEnv` new_tythings
, ic_instances = ( new_cls_insts ++ old_cls_insts
, new_fam_insts ++ old_fam_insts )
, ic_default = defaults
, ic_fix_env = fix_env -- See Note [Fixity declarations in GHCi]
}
where
new_ids = [id | AnId id <- new_tythings]
old_tythings = filterOut (shadowed_by new_ids) (ic_tythings ictxt)
-- Discard old instances that have been fully overrridden
-- See Note [Override identical instances in GHCi]
(cls_insts, fam_insts) = ic_instances ictxt
old_cls_insts = filterOut (\i -> any (identicalClsInstHead i) new_cls_insts) cls_insts
old_fam_insts = filterOut (\i -> any (identicalFamInstHead i) new_fam_insts) fam_insts
| 1,139
| true
| true
| 4
| 11
| 536
| 278
| 148
| 130
| null | null |
ian-mi/hTorrent
|
Torrent/State/Requests.hs
|
gpl-3.0
|
toInterval (IntervalCO a b) = Interval a (b - 1)
| 48
|
toInterval (IntervalCO a b) = Interval a (b - 1)
| 48
|
toInterval (IntervalCO a b) = Interval a (b - 1)
| 48
| false
| false
| 0
| 7
| 9
| 30
| 14
| 16
| null | null |
magicant/flesh
|
src/Flesh/Language/Parser/Error/Print.hs
|
gpl-2.0
|
describe (MissingFiForIf p) =
("a \"fi\" is required to close the if command", [b])
where b = note p "the if command was introduced here"
| 143
|
describe (MissingFiForIf p) =
("a \"fi\" is required to close the if command", [b])
where b = note p "the if command was introduced here"
| 143
|
describe (MissingFiForIf p) =
("a \"fi\" is required to close the if command", [b])
where b = note p "the if command was introduced here"
| 143
| false
| false
| 0
| 7
| 30
| 36
| 19
| 17
| null | null |
timbod7/terraform-hs
|
scripts/generate.hs
|
bsd-3-clause
|
main :: IO ()
main = generate "src/Language/Terraform"
| 54
|
main :: IO ()
main = generate "src/Language/Terraform"
| 54
|
main = generate "src/Language/Terraform"
| 40
| false
| true
| 0
| 6
| 7
| 19
| 9
| 10
| null | null |
ChrisSwires/One
|
Handler/Home.hs
|
bsd-2-clause
|
getDbtestR :: Handler RepHtml
getDbtestR = do
(formWidget, formEnctype) <- generateFormPost sampleForm
let submission = Nothing :: Maybe (FileInfo, Text)
handlerName = "getDbtestR" :: Text
defaultLayout $ do
aDomId <- lift newIdent
setTitle "Database Test"
$(widgetFile "dbtest")
| 323
|
getDbtestR :: Handler RepHtml
getDbtestR = do
(formWidget, formEnctype) <- generateFormPost sampleForm
let submission = Nothing :: Maybe (FileInfo, Text)
handlerName = "getDbtestR" :: Text
defaultLayout $ do
aDomId <- lift newIdent
setTitle "Database Test"
$(widgetFile "dbtest")
| 323
|
getDbtestR = do
(formWidget, formEnctype) <- generateFormPost sampleForm
let submission = Nothing :: Maybe (FileInfo, Text)
handlerName = "getDbtestR" :: Text
defaultLayout $ do
aDomId <- lift newIdent
setTitle "Database Test"
$(widgetFile "dbtest")
| 293
| false
| true
| 0
| 13
| 80
| 98
| 45
| 53
| null | null |
individkid/sidegeo
|
src/AffTopo/Naive.hs
|
gpl-3.0
|
subSpaceF :: ([Region] -> [Region] -> [Region]) -> Boundary -> Place -> Place
subSpaceF f b s = let
(bounds,space) = unzipPlace s
regions = regionsOfSpace space
index = elemIndex' b bounds
bound = Boundary index
section = filter (subSpaceG bound space) regions
result = map2 (f section) (unplace index space)
in zipPlace (unplace index bounds) result
| 357
|
subSpaceF :: ([Region] -> [Region] -> [Region]) -> Boundary -> Place -> Place
subSpaceF f b s = let
(bounds,space) = unzipPlace s
regions = regionsOfSpace space
index = elemIndex' b bounds
bound = Boundary index
section = filter (subSpaceG bound space) regions
result = map2 (f section) (unplace index space)
in zipPlace (unplace index bounds) result
| 357
|
subSpaceF f b s = let
(bounds,space) = unzipPlace s
regions = regionsOfSpace space
index = elemIndex' b bounds
bound = Boundary index
section = filter (subSpaceG bound space) regions
result = map2 (f section) (unplace index space)
in zipPlace (unplace index bounds) result
| 279
| false
| true
| 0
| 11
| 63
| 152
| 77
| 75
| null | null |
hakoja/SHA3
|
Data/Digest/JH256.hs
|
bsd-3-clause
|
jh256_h0 :: Block1024
jh256_h0 = B1024 (B512 0xeb98a3412c20d3eb92cdbe7b9cb245c1 0x1c93519160d4c7fa260082d67e508a03
0xa4239e267726b945e0fb1a48d41a9477 0xcdb5ab26026b177a56f024420fff2fa8)
(B512 0x71a396897f2e4d751d144908f77de262 0x277695f776248f9487d5b6574780296c
0x5c5e272dac8e0d6c518450c657057a0f 0x7be4d367702412ea89e3ab13d31cd769)
| 396
|
jh256_h0 :: Block1024
jh256_h0 = B1024 (B512 0xeb98a3412c20d3eb92cdbe7b9cb245c1 0x1c93519160d4c7fa260082d67e508a03
0xa4239e267726b945e0fb1a48d41a9477 0xcdb5ab26026b177a56f024420fff2fa8)
(B512 0x71a396897f2e4d751d144908f77de262 0x277695f776248f9487d5b6574780296c
0x5c5e272dac8e0d6c518450c657057a0f 0x7be4d367702412ea89e3ab13d31cd769)
| 396
|
jh256_h0 = B1024 (B512 0xeb98a3412c20d3eb92cdbe7b9cb245c1 0x1c93519160d4c7fa260082d67e508a03
0xa4239e267726b945e0fb1a48d41a9477 0xcdb5ab26026b177a56f024420fff2fa8)
(B512 0x71a396897f2e4d751d144908f77de262 0x277695f776248f9487d5b6574780296c
0x5c5e272dac8e0d6c518450c657057a0f 0x7be4d367702412ea89e3ab13d31cd769)
| 374
| false
| true
| 0
| 7
| 79
| 40
| 20
| 20
| null | null |
comonoidial/ALFIN
|
Backend/ReduceArity.hs
|
mit
|
-- Gives the amount of arguments in the main node of an x-arity node
argsMainNode :: Int -> Int
argsMainNode x
| x <= maxArity = x
| (x-maxArity) `mod` (maxArity - 1) == 0 = maxArity - 1
| otherwise = (x-maxArity) `mod` (maxArity - 1)
| 300
|
argsMainNode :: Int -> Int
argsMainNode x
| x <= maxArity = x
| (x-maxArity) `mod` (maxArity - 1) == 0 = maxArity - 1
| otherwise = (x-maxArity) `mod` (maxArity - 1)
| 231
|
argsMainNode x
| x <= maxArity = x
| (x-maxArity) `mod` (maxArity - 1) == 0 = maxArity - 1
| otherwise = (x-maxArity) `mod` (maxArity - 1)
| 204
| true
| true
| 0
| 11
| 112
| 95
| 50
| 45
| null | null |
prasmussen/glot-www
|
Widget/Editor.hs
|
mit
|
addExt :: Language.Language -> Text -> Text
addExt Language.Language{..} filename =
concat [ filename, "." , fileExtension ]
| 128
|
addExt :: Language.Language -> Text -> Text
addExt Language.Language{..} filename =
concat [ filename, "." , fileExtension ]
| 128
|
addExt Language.Language{..} filename =
concat [ filename, "." , fileExtension ]
| 84
| false
| true
| 1
| 7
| 21
| 52
| 25
| 27
| null | null |
Bodigrim/arithmoi
|
test-suite/Math/NumberTheory/Primes/CountingTests.hs
|
mit
|
-- | Check that values of 'primeCount' are non-negative.
primeCountProperty1 :: Integer -> Bool
primeCountProperty1 n = n > primeCountMaxArg
|| n > 0 && primeCount n >= 0
|| n <= 0 && primeCount n == 0
| 206
|
primeCountProperty1 :: Integer -> Bool
primeCountProperty1 n = n > primeCountMaxArg
|| n > 0 && primeCount n >= 0
|| n <= 0 && primeCount n == 0
| 149
|
primeCountProperty1 n = n > primeCountMaxArg
|| n > 0 && primeCount n >= 0
|| n <= 0 && primeCount n == 0
| 110
| true
| true
| 11
| 7
| 42
| 73
| 33
| 40
| null | null |
kelnage/tamarin-prover
|
lib/term/src/Term/Builtin/Convenience.hs
|
gpl-3.0
|
sdec (a,b) = fAppNoEq sdecSym [a,b]
| 41
|
sdec (a,b) = fAppNoEq sdecSym [a,b]
| 41
|
sdec (a,b) = fAppNoEq sdecSym [a,b]
| 41
| false
| false
| 0
| 6
| 11
| 27
| 14
| 13
| null | null |
acarno/slicer
|
valgrind/auxprogs/DotToScc.hs
|
gpl-2.0
|
- ==========================================================--
--
unMkSet :: (Ord a) => Set a -> [a]
unMkSet (MkSet s) = s
| 124
|
unMkSet :: (Ord a) => Set a -> [a]
unMkSet (MkSet s) = s
| 56
|
unMkSet (MkSet s) = s
| 21
| true
| true
| 1
| 7
| 18
| 105
| 82
| 23
| null | null |
LightAndLight/hindley-milner
|
src/Phil/Sugar.hs
|
bsd-3-clause
|
asClassInstanceP :: Type -> InstanceHead
asClassInstanceP ty
= case asClassInstance ty :: Either SyntaxError InstanceHead of
Right res -> res
Left _ -> error $ "asClassInstanceP: invalid argument: " ++ show ty
| 224
|
asClassInstanceP :: Type -> InstanceHead
asClassInstanceP ty
= case asClassInstance ty :: Either SyntaxError InstanceHead of
Right res -> res
Left _ -> error $ "asClassInstanceP: invalid argument: " ++ show ty
| 224
|
asClassInstanceP ty
= case asClassInstance ty :: Either SyntaxError InstanceHead of
Right res -> res
Left _ -> error $ "asClassInstanceP: invalid argument: " ++ show ty
| 183
| false
| true
| 0
| 9
| 46
| 67
| 30
| 37
| null | null |
abhean/phffp-examples
|
src/MaybeSmallLib.hs
|
bsd-3-clause
|
isNothing _ = False
| 19
|
isNothing _ = False
| 19
|
isNothing _ = False
| 19
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
mrakgr/futhark
|
src/Futhark/Representation/AST/Attributes/Types.hs
|
bsd-3-clause
|
-- | Rearrange the dimensions of the type. If the length of the
-- permutation does not match the rank of the type, the permutation
-- will be extended with identity.
rearrangeType :: [Int] -> Type -> Type
rearrangeType perm t =
t `setArrayShape` Shape (rearrangeShape perm' $ arrayDims t)
where perm' = perm ++ [length perm .. arrayRank t - 1]
-- | @diet t@ returns a description of how a function parameter of
-- type @t@ might consume its argument.
| 457
|
rearrangeType :: [Int] -> Type -> Type
rearrangeType perm t =
t `setArrayShape` Shape (rearrangeShape perm' $ arrayDims t)
where perm' = perm ++ [length perm .. arrayRank t - 1]
-- | @diet t@ returns a description of how a function parameter of
-- type @t@ might consume its argument.
| 289
|
rearrangeType perm t =
t `setArrayShape` Shape (rearrangeShape perm' $ arrayDims t)
where perm' = perm ++ [length perm .. arrayRank t - 1]
-- | @diet t@ returns a description of how a function parameter of
-- type @t@ might consume its argument.
| 250
| true
| true
| 0
| 9
| 87
| 86
| 45
| 41
| null | null |
brendanhay/gogol
|
gogol-bigquery/gen/Network/Google/BigQuery/Types/Product.hs
|
mpl-2.0
|
-- | A list of category resource names. For example,
-- \"projects\/1\/location\/eu\/taxonomies\/2\/policyTags\/3\". At most 1
-- policy tag is allowed.
tfsptNames :: Lens' TableFieldSchemaPolicyTags [Text]
tfsptNames
= lens _tfsptNames (\ s a -> s{_tfsptNames = a}) .
_Default
. _Coerce
| 301
|
tfsptNames :: Lens' TableFieldSchemaPolicyTags [Text]
tfsptNames
= lens _tfsptNames (\ s a -> s{_tfsptNames = a}) .
_Default
. _Coerce
| 148
|
tfsptNames
= lens _tfsptNames (\ s a -> s{_tfsptNames = a}) .
_Default
. _Coerce
| 94
| true
| true
| 0
| 11
| 53
| 55
| 30
| 25
| null | null |
TGOlson/gpio
|
lib/System/GPIO.hs
|
bsd-3-clause
|
readFirstLine :: MonadIO m => FilePath -> m String
readFirstLine = fmap (fromMaybe mempty . headMay . lines) . readFileM
| 120
|
readFirstLine :: MonadIO m => FilePath -> m String
readFirstLine = fmap (fromMaybe mempty . headMay . lines) . readFileM
| 120
|
readFirstLine = fmap (fromMaybe mempty . headMay . lines) . readFileM
| 69
| false
| true
| 0
| 10
| 19
| 46
| 22
| 24
| null | null |
forked-upstream-packages-for-ghcjs/ghc
|
compiler/utils/Outputable.hs
|
bsd-3-clause
|
mkCodeStyle :: CodeStyle -> PprStyle
mkCodeStyle = PprCode
| 58
|
mkCodeStyle :: CodeStyle -> PprStyle
mkCodeStyle = PprCode
| 58
|
mkCodeStyle = PprCode
| 21
| false
| true
| 0
| 5
| 7
| 15
| 8
| 7
| null | null |
Unoriginal-War/unoriginal-war
|
src/Main.hs
|
mit
|
main :: IO ()
main = do
initializeAll
window <- createWindow "My SDL Application" defaultWindow
renderer <- createRenderer window (-1) defaultRenderer
-- TODO proper loading
let unitDesc = _unitDescription $ Vector.head units'
let buildingDesc = _buildingDescription $ Vector.head buildings'
unitTex <- loadUnitTexture renderer unitDesc
buildingTex <- loadBuildingTexture renderer buildingDesc
state <- newMVar State
{ _units = units'
, _buildings = buildings'
, _grid = Grid
{ _verticalExtent = 10
, _horizontalExtent = 10
, _tiles = Array.array (0, 0) []
}
, _store = Store
{ _units = HashMap.insert unitDesc unitTex HashMap.empty
, _buildings = HashMap.insert buildingDesc buildingTex HashMap.empty
, _tiles = HashMap.empty
}
, _mapSize = V2 1200 1200
, _viewPort = VP.ViewPort
{ VP._size = V2 800 600
, VP._position = V2 0 0
}
}
input <- newIORef emptyInput
run renderDelta $ render renderer state
run gameDelta $ game input state
void . loop inputDelta $ pollInput input
where
run delta = void . forkIO . loop delta
renderDelta = 0.01 -- 100 FPS
gameDelta = 0.001 -- 1000 FPS
inputDelta = 0.001 -- 1000 FPS
makeTexture :: Renderer -> Size -> FilePath -> IO Texture
makeTexture renderer size' name = do
texture <- createCairoTexture renderer (V2 iSize iSize)
withCanvas texture $ do
buildingImage <- loadImagePNG name
image' buildingImage (D 0 0 dSize dSize)
pure texture
where
iSize = CInt $ fromIntegral size'
dSize = fromIntegral size'
loadUnitTexture :: Renderer -> UnitDescription -> IO Texture
loadUnitTexture renderer UnitDescription{..} =
makeTexture renderer _unitSize _unitTexture
loadBuildingTexture :: Renderer -> BuildingDescription -> IO Texture
loadBuildingTexture renderer BuildingDescription{..} =
makeTexture renderer _buildingSize _buildingTexture
buildings' = Vector.fromList
[ Building
{ _buildingDescription = BuildingDescription
{ _buildingSize = 200
, _buildingTexture = "image/building.png"
}
, _buildingPosition = V2 200 200
}
, Building
{ _buildingDescription = BuildingDescription
{ _buildingSize = 200
, _buildingTexture = "image/building.png"
}
, _buildingPosition = V2 900 900
}
]
units' = Vector.fromList
[ Unit
{ _unitDescription = UnitDescription
{ _unitSpeed = 0.2
, _unitSize = 50
, _unitTexture = "image/unit.png"
}
, _unitPosition = V2 500 200
, _unitPlan = cycle
[ MoveTo $ V2 200 400
, MoveTo $ V2 500 200
, MoveTo $ V2 500 500
]
}
]
| 3,170
|
main :: IO ()
main = do
initializeAll
window <- createWindow "My SDL Application" defaultWindow
renderer <- createRenderer window (-1) defaultRenderer
-- TODO proper loading
let unitDesc = _unitDescription $ Vector.head units'
let buildingDesc = _buildingDescription $ Vector.head buildings'
unitTex <- loadUnitTexture renderer unitDesc
buildingTex <- loadBuildingTexture renderer buildingDesc
state <- newMVar State
{ _units = units'
, _buildings = buildings'
, _grid = Grid
{ _verticalExtent = 10
, _horizontalExtent = 10
, _tiles = Array.array (0, 0) []
}
, _store = Store
{ _units = HashMap.insert unitDesc unitTex HashMap.empty
, _buildings = HashMap.insert buildingDesc buildingTex HashMap.empty
, _tiles = HashMap.empty
}
, _mapSize = V2 1200 1200
, _viewPort = VP.ViewPort
{ VP._size = V2 800 600
, VP._position = V2 0 0
}
}
input <- newIORef emptyInput
run renderDelta $ render renderer state
run gameDelta $ game input state
void . loop inputDelta $ pollInput input
where
run delta = void . forkIO . loop delta
renderDelta = 0.01 -- 100 FPS
gameDelta = 0.001 -- 1000 FPS
inputDelta = 0.001 -- 1000 FPS
makeTexture :: Renderer -> Size -> FilePath -> IO Texture
makeTexture renderer size' name = do
texture <- createCairoTexture renderer (V2 iSize iSize)
withCanvas texture $ do
buildingImage <- loadImagePNG name
image' buildingImage (D 0 0 dSize dSize)
pure texture
where
iSize = CInt $ fromIntegral size'
dSize = fromIntegral size'
loadUnitTexture :: Renderer -> UnitDescription -> IO Texture
loadUnitTexture renderer UnitDescription{..} =
makeTexture renderer _unitSize _unitTexture
loadBuildingTexture :: Renderer -> BuildingDescription -> IO Texture
loadBuildingTexture renderer BuildingDescription{..} =
makeTexture renderer _buildingSize _buildingTexture
buildings' = Vector.fromList
[ Building
{ _buildingDescription = BuildingDescription
{ _buildingSize = 200
, _buildingTexture = "image/building.png"
}
, _buildingPosition = V2 200 200
}
, Building
{ _buildingDescription = BuildingDescription
{ _buildingSize = 200
, _buildingTexture = "image/building.png"
}
, _buildingPosition = V2 900 900
}
]
units' = Vector.fromList
[ Unit
{ _unitDescription = UnitDescription
{ _unitSpeed = 0.2
, _unitSize = 50
, _unitTexture = "image/unit.png"
}
, _unitPosition = V2 500 200
, _unitPlan = cycle
[ MoveTo $ V2 200 400
, MoveTo $ V2 500 200
, MoveTo $ V2 500 500
]
}
]
| 3,170
|
main = do
initializeAll
window <- createWindow "My SDL Application" defaultWindow
renderer <- createRenderer window (-1) defaultRenderer
-- TODO proper loading
let unitDesc = _unitDescription $ Vector.head units'
let buildingDesc = _buildingDescription $ Vector.head buildings'
unitTex <- loadUnitTexture renderer unitDesc
buildingTex <- loadBuildingTexture renderer buildingDesc
state <- newMVar State
{ _units = units'
, _buildings = buildings'
, _grid = Grid
{ _verticalExtent = 10
, _horizontalExtent = 10
, _tiles = Array.array (0, 0) []
}
, _store = Store
{ _units = HashMap.insert unitDesc unitTex HashMap.empty
, _buildings = HashMap.insert buildingDesc buildingTex HashMap.empty
, _tiles = HashMap.empty
}
, _mapSize = V2 1200 1200
, _viewPort = VP.ViewPort
{ VP._size = V2 800 600
, VP._position = V2 0 0
}
}
input <- newIORef emptyInput
run renderDelta $ render renderer state
run gameDelta $ game input state
void . loop inputDelta $ pollInput input
where
run delta = void . forkIO . loop delta
renderDelta = 0.01 -- 100 FPS
gameDelta = 0.001 -- 1000 FPS
inputDelta = 0.001 -- 1000 FPS
makeTexture :: Renderer -> Size -> FilePath -> IO Texture
makeTexture renderer size' name = do
texture <- createCairoTexture renderer (V2 iSize iSize)
withCanvas texture $ do
buildingImage <- loadImagePNG name
image' buildingImage (D 0 0 dSize dSize)
pure texture
where
iSize = CInt $ fromIntegral size'
dSize = fromIntegral size'
loadUnitTexture :: Renderer -> UnitDescription -> IO Texture
loadUnitTexture renderer UnitDescription{..} =
makeTexture renderer _unitSize _unitTexture
loadBuildingTexture :: Renderer -> BuildingDescription -> IO Texture
loadBuildingTexture renderer BuildingDescription{..} =
makeTexture renderer _buildingSize _buildingTexture
buildings' = Vector.fromList
[ Building
{ _buildingDescription = BuildingDescription
{ _buildingSize = 200
, _buildingTexture = "image/building.png"
}
, _buildingPosition = V2 200 200
}
, Building
{ _buildingDescription = BuildingDescription
{ _buildingSize = 200
, _buildingTexture = "image/building.png"
}
, _buildingPosition = V2 900 900
}
]
units' = Vector.fromList
[ Unit
{ _unitDescription = UnitDescription
{ _unitSpeed = 0.2
, _unitSize = 50
, _unitTexture = "image/unit.png"
}
, _unitPosition = V2 500 200
, _unitPlan = cycle
[ MoveTo $ V2 200 400
, MoveTo $ V2 500 200
, MoveTo $ V2 500 500
]
}
]
| 3,156
| false
| true
| 41
| 15
| 1,155
| 565
| 320
| 245
| null | null |
MarcusVoelker/LParse
|
src/Text/LParse/Metaparser.hs
|
mit
|
isRuleName _ = False
| 20
|
isRuleName _ = False
| 20
|
isRuleName _ = False
| 20
| false
| false
| 0
| 4
| 3
| 10
| 4
| 6
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.