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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
acowley/ghc | compiler/iface/IfaceType.hs | bsd-3-clause | eqIfaceTvBndrs _ _ _ = Nothing | 30 | eqIfaceTvBndrs _ _ _ = Nothing | 30 | eqIfaceTvBndrs _ _ _ = Nothing | 30 | false | false | 0 | 5 | 5 | 13 | 6 | 7 | null | null |
AlephAlpha/Samau | OldSamau/Eval.hs | gpl-2.0 | smInit s = s | 30 | smInit s = s | 30 | smInit s = s | 30 | false | false | 0 | 5 | 21 | 9 | 4 | 5 | null | null |
ayberkt/TAPL | src/FullSimple/Semantics.hs | bsd-3-clause | typeOf ∷ Context → Term → Either String Ty
typeOf ctx (TmVar i) = getTypeFromContext ctx i | 90 | typeOf ∷ Context → Term → Either String Ty
typeOf ctx (TmVar i) = getTypeFromContext ctx i | 90 | typeOf ctx (TmVar i) = getTypeFromContext ctx i | 47 | false | true | 0 | 7 | 16 | 40 | 19 | 21 | null | null |
stschiff/rarecoal | src/RarecoalLib/ModelTemplate.hs | gpl-3.0 | eventP :: Parser MTEvent
eventP = P.try popSizeChangeCmdP <|>
P.try joinCmdP <|>
P.try joinPopSizeCmdP <|>
P.try splitCmdP <|>
freezeCmdP | 173 | eventP :: Parser MTEvent
eventP = P.try popSizeChangeCmdP <|>
P.try joinCmdP <|>
P.try joinPopSizeCmdP <|>
P.try splitCmdP <|>
freezeCmdP | 173 | eventP = P.try popSizeChangeCmdP <|>
P.try joinCmdP <|>
P.try joinPopSizeCmdP <|>
P.try splitCmdP <|>
freezeCmdP | 148 | false | true | 0 | 10 | 54 | 50 | 23 | 27 | null | null |
tomahawkins/improve | attic/Examples.hs | bsd-3-clause | gcdMain :: Stmt ()
gcdMain = do
let a = input int ["a"] -- Input variable 'a'.
b = input int ["b"] -- Input variable 'b'.
done <- bool "done" False -- Variable signalling completion.
result <- int "result" 0 -- Result of GCD.
-- Call gcd' in its own scope. (Scopes prevent variable name collisions.)
(done', result') <- "gcd" -| gcd' a b
-- Bind the results to the output variables.
done <== done'
result <== result'
-- | Build the gcdMain code (i.e. gcd.c, gcd.h). | 506 | gcdMain :: Stmt ()
gcdMain = do
let a = input int ["a"] -- Input variable 'a'.
b = input int ["b"] -- Input variable 'b'.
done <- bool "done" False -- Variable signalling completion.
result <- int "result" 0 -- Result of GCD.
-- Call gcd' in its own scope. (Scopes prevent variable name collisions.)
(done', result') <- "gcd" -| gcd' a b
-- Bind the results to the output variables.
done <== done'
result <== result'
-- | Build the gcdMain code (i.e. gcd.c, gcd.h). | 506 | gcdMain = do
let a = input int ["a"] -- Input variable 'a'.
b = input int ["b"] -- Input variable 'b'.
done <- bool "done" False -- Variable signalling completion.
result <- int "result" 0 -- Result of GCD.
-- Call gcd' in its own scope. (Scopes prevent variable name collisions.)
(done', result') <- "gcd" -| gcd' a b
-- Bind the results to the output variables.
done <== done'
result <== result'
-- | Build the gcdMain code (i.e. gcd.c, gcd.h). | 487 | false | true | 0 | 11 | 127 | 113 | 57 | 56 | null | null |
8c6794b6/ixfts | ixfts.hs | bsd-3-clause | mkHtmlDocument :: FilePath -> IO (IxSet Document)
mkHtmlDocument = mkDocument (extension ==? ".html") htmlBody | 110 | mkHtmlDocument :: FilePath -> IO (IxSet Document)
mkHtmlDocument = mkDocument (extension ==? ".html") htmlBody | 110 | mkHtmlDocument = mkDocument (extension ==? ".html") htmlBody | 60 | false | true | 0 | 9 | 13 | 41 | 19 | 22 | null | null |
MarceColl/blog.marcecoll.com | site.hs | mit | postCtx :: Context String
postCtx =
dateField "date" "%B %e, %Y" `mappend`
defaultContext | 97 | postCtx :: Context String
postCtx =
dateField "date" "%B %e, %Y" `mappend`
defaultContext | 97 | postCtx =
dateField "date" "%B %e, %Y" `mappend`
defaultContext | 71 | false | true | 1 | 6 | 20 | 29 | 13 | 16 | null | null |
ekalosak/haskell-practice | 10.hs | lgpl-3.0 | lenStr :: [Char] -> (Char, Int)
lenStr str = (head str, length str) | 67 | lenStr :: [Char] -> (Char, Int)
lenStr str = (head str, length str) | 67 | lenStr str = (head str, length str) | 35 | false | true | 0 | 6 | 12 | 39 | 21 | 18 | null | null |
roelvandijk/hs-src-db | src/Main.hs | bsd-3-clause | executableModules ∷ FilePath → CBL.Executable → IO [Module]
executableModules pkgDir exe =
(:) <$> makeMainModule pkgDir srcDirs [Executable] (CBL.modulePath exe)
<*> makeModules pkgDir srcDirs [Executable] (CBL.otherModules bi)
where
bi = CBL.buildInfo exe
srcDirs = CBL.hsSourceDirs bi | 312 | executableModules ∷ FilePath → CBL.Executable → IO [Module]
executableModules pkgDir exe =
(:) <$> makeMainModule pkgDir srcDirs [Executable] (CBL.modulePath exe)
<*> makeModules pkgDir srcDirs [Executable] (CBL.otherModules bi)
where
bi = CBL.buildInfo exe
srcDirs = CBL.hsSourceDirs bi | 312 | executableModules pkgDir exe =
(:) <$> makeMainModule pkgDir srcDirs [Executable] (CBL.modulePath exe)
<*> makeModules pkgDir srcDirs [Executable] (CBL.otherModules bi)
where
bi = CBL.buildInfo exe
srcDirs = CBL.hsSourceDirs bi | 252 | false | true | 7 | 9 | 60 | 124 | 56 | 68 | null | null |
m4rw3r/warframe-dmg-hs | src/armor.hs | mit | modifierForDamageOnArmor Damage.Radiation Robotic = 0.25 | 65 | modifierForDamageOnArmor Damage.Radiation Robotic = 0.25 | 65 | modifierForDamageOnArmor Damage.Radiation Robotic = 0.25 | 65 | false | false | 0 | 6 | 13 | 15 | 6 | 9 | null | null |
sjakobi/stack | src/Stack/Types/Config.hs | bsd-3-clause | explicitSetupDeps :: (MonadReader env m, HasConfig env) => PackageName -> m Bool
explicitSetupDeps name = do
m <- asks $ configExplicitSetupDeps . getConfig
return $
-- Yes there are far cleverer ways to write this. I honestly consider
-- the explicit pattern matching much easier to parse at a glance.
case Map.lookup (Just name) m of
Just b -> b
Nothing ->
case Map.lookup Nothing m of
Just b -> b
Nothing -> False -- default value
-- | Data passed into Docker container for the Docker entrypoint's use | 617 | explicitSetupDeps :: (MonadReader env m, HasConfig env) => PackageName -> m Bool
explicitSetupDeps name = do
m <- asks $ configExplicitSetupDeps . getConfig
return $
-- Yes there are far cleverer ways to write this. I honestly consider
-- the explicit pattern matching much easier to parse at a glance.
case Map.lookup (Just name) m of
Just b -> b
Nothing ->
case Map.lookup Nothing m of
Just b -> b
Nothing -> False -- default value
-- | Data passed into Docker container for the Docker entrypoint's use | 617 | explicitSetupDeps name = do
m <- asks $ configExplicitSetupDeps . getConfig
return $
-- Yes there are far cleverer ways to write this. I honestly consider
-- the explicit pattern matching much easier to parse at a glance.
case Map.lookup (Just name) m of
Just b -> b
Nothing ->
case Map.lookup Nothing m of
Just b -> b
Nothing -> False -- default value
-- | Data passed into Docker container for the Docker entrypoint's use | 536 | false | true | 0 | 14 | 201 | 122 | 60 | 62 | null | null |
crockeo/whatisthisgame | src/WhatIsThisGame/Controllers/EnemySpawner.hs | mit | maybeAppendEnemy True pos size l =
(Just $ newEnemy pos size) : l | 68 | maybeAppendEnemy True pos size l =
(Just $ newEnemy pos size) : l | 68 | maybeAppendEnemy True pos size l =
(Just $ newEnemy pos size) : l | 68 | false | false | 0 | 8 | 15 | 31 | 15 | 16 | null | null |
bgold-cosmos/Tidal | src/Sound/Tidal/Params.hs | gpl-3.0 | lhitomCount :: String -> ControlPattern
lhitomCount name = pStateF "lhitom" name (maybe 0 (+1)) | 95 | lhitomCount :: String -> ControlPattern
lhitomCount name = pStateF "lhitom" name (maybe 0 (+1)) | 95 | lhitomCount name = pStateF "lhitom" name (maybe 0 (+1)) | 55 | false | true | 0 | 8 | 13 | 45 | 20 | 25 | null | null |
fffej/HS-Poker | LookupPatternMatch.hs | bsd-3-clause | getValueFromProduct 555611 = 5443 | 33 | getValueFromProduct 555611 = 5443 | 33 | getValueFromProduct 555611 = 5443 | 33 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
termite2/tsl | Frontend/StatementOps.hs | bsd-3-clause | statCallees s (SAssign _ _ l r) = exprCallees s l ++ exprCallees s r | 78 | statCallees s (SAssign _ _ l r) = exprCallees s l ++ exprCallees s r | 78 | statCallees s (SAssign _ _ l r) = exprCallees s l ++ exprCallees s r | 78 | false | false | 0 | 7 | 24 | 37 | 17 | 20 | null | null |
tdammers/templar | src/Web/Sprinkles/PandocGVal.hs | bsd-3-clause | modifyUrls :: (Text -> Text) -> Pandoc -> Pandoc
modifyUrls f = walk goInline
where
goInline :: Inline -> Inline
goInline (Image attrs inlines (url, title)) =
Image attrs (map goInline inlines) (f url, title)
goInline (Link attrs inlines (url, title)) =
Link attrs (map goInline inlines) (f url, title)
goInline x = x | 377 | modifyUrls :: (Text -> Text) -> Pandoc -> Pandoc
modifyUrls f = walk goInline
where
goInline :: Inline -> Inline
goInline (Image attrs inlines (url, title)) =
Image attrs (map goInline inlines) (f url, title)
goInline (Link attrs inlines (url, title)) =
Link attrs (map goInline inlines) (f url, title)
goInline x = x | 377 | modifyUrls f = walk goInline
where
goInline :: Inline -> Inline
goInline (Image attrs inlines (url, title)) =
Image attrs (map goInline inlines) (f url, title)
goInline (Link attrs inlines (url, title)) =
Link attrs (map goInline inlines) (f url, title)
goInline x = x | 328 | false | true | 1 | 10 | 113 | 167 | 78 | 89 | null | null |
nyson/haste-compiler | libraries/ghc-7.8/base/Control/Monad.hs | bsd-3-clause | -- | Promote a function to a monad, scanning the monadic arguments from
-- left to right (cf. 'liftM2').
liftM4 :: (Monad m) => (a1 -> a2 -> a3 -> a4 -> r) -> m a1 -> m a2 -> m a3 -> m a4 -> m r
liftM4 f m1 m2 m3 m4 = do { x1 <- m1; x2 <- m2; x3 <- m3; x4 <- m4; return (f x1 x2 x3 x4) } | 291 | liftM4 :: (Monad m) => (a1 -> a2 -> a3 -> a4 -> r) -> m a1 -> m a2 -> m a3 -> m a4 -> m r
liftM4 f m1 m2 m3 m4 = do { x1 <- m1; x2 <- m2; x3 <- m3; x4 <- m4; return (f x1 x2 x3 x4) } | 186 | liftM4 f m1 m2 m3 m4 = do { x1 <- m1; x2 <- m2; x3 <- m3; x4 <- m4; return (f x1 x2 x3 x4) } | 95 | true | true | 0 | 11 | 79 | 147 | 70 | 77 | null | null |
ekr/tamarin-prover | lib/theory/src/Theory/Text/Parser/Token.hs | gpl-3.0 | -- Use Parsec's support for defining token parsers.
spthy :: T.TokenParser MaudeSig
spthy =
T.makeTokenParser spthyStyle
where
spthyStyle = T.LanguageDef
{ T.commentStart = "/*"
, T.commentEnd = "*/"
, T.commentLine = "//"
, T.nestedComments = True
, T.identStart = alphaNum
, T.identLetter = alphaNum <|> oneOf "_"
, T.reservedNames = ["in","let","rule","diff"]
, T.opStart = oneOf ":!$%&*+./<=>?@\\^|-"
, T.opLetter = oneOf ":!$%&*+./<=>?@\\^|-"
, T.reservedOpNames= []
, T.caseSensitive = True
}
-- | Run a parser on the contents of a file. | 657 | spthy :: T.TokenParser MaudeSig
spthy =
T.makeTokenParser spthyStyle
where
spthyStyle = T.LanguageDef
{ T.commentStart = "/*"
, T.commentEnd = "*/"
, T.commentLine = "//"
, T.nestedComments = True
, T.identStart = alphaNum
, T.identLetter = alphaNum <|> oneOf "_"
, T.reservedNames = ["in","let","rule","diff"]
, T.opStart = oneOf ":!$%&*+./<=>?@\\^|-"
, T.opLetter = oneOf ":!$%&*+./<=>?@\\^|-"
, T.reservedOpNames= []
, T.caseSensitive = True
}
-- | Run a parser on the contents of a file. | 605 | spthy =
T.makeTokenParser spthyStyle
where
spthyStyle = T.LanguageDef
{ T.commentStart = "/*"
, T.commentEnd = "*/"
, T.commentLine = "//"
, T.nestedComments = True
, T.identStart = alphaNum
, T.identLetter = alphaNum <|> oneOf "_"
, T.reservedNames = ["in","let","rule","diff"]
, T.opStart = oneOf ":!$%&*+./<=>?@\\^|-"
, T.opLetter = oneOf ":!$%&*+./<=>?@\\^|-"
, T.reservedOpNames= []
, T.caseSensitive = True
}
-- | Run a parser on the contents of a file. | 573 | true | true | 0 | 8 | 193 | 150 | 87 | 63 | null | null |
ribag/ganeti-experiments | src/Ganeti/Locking/Waiting.hs | gpl-2.0 | -- | Intersect locks to a given set.
intersectLocks :: (Lock a, Ord b, Ord c)
=> [a]
-> b
-> LockWaiting a b c -> (LockWaiting a b c, S.Set b)
intersectLocks locks = freeLocksPredicate (not . flip elem locks) | 253 | intersectLocks :: (Lock a, Ord b, Ord c)
=> [a]
-> b
-> LockWaiting a b c -> (LockWaiting a b c, S.Set b)
intersectLocks locks = freeLocksPredicate (not . flip elem locks) | 216 | intersectLocks locks = freeLocksPredicate (not . flip elem locks) | 65 | true | true | 0 | 13 | 85 | 96 | 47 | 49 | null | null |
jwiegley/hnix | src/Nix/Expr/Shorthands.hs | bsd-3-clause | -- | Make a path expression which pulls from the NIX_PATH env variable.
mkEnvPath :: FilePath -> NExpr
mkEnvPath = Fix . mkEnvPathF | 131 | mkEnvPath :: FilePath -> NExpr
mkEnvPath = Fix . mkEnvPathF | 59 | mkEnvPath = Fix . mkEnvPathF | 28 | true | true | 0 | 5 | 22 | 20 | 11 | 9 | null | null |
capitanbatata/functional-systems-in-haskell | fsh-exercises/src/Rock2.hs | mit | outcome Scissors Paper = Win | 34 | outcome Scissors Paper = Win | 34 | outcome Scissors Paper = Win | 34 | false | false | 0 | 5 | 10 | 11 | 5 | 6 | null | null |
bhamrick/HSS | HSS/Color.hs | mit | gold = RGB 0xFF 0xD7 0x00 | 44 | gold = RGB 0xFF 0xD7 0x00 | 44 | gold = RGB 0xFF 0xD7 0x00 | 44 | false | false | 0 | 5 | 24 | 13 | 6 | 7 | null | null |
Cahu/krpc-hs | src/KRPCHS/SpaceCenter.hs | gpl-3.0 | getEngineThrottleLockedStream :: KRPCHS.SpaceCenter.Engine -> RPCContext (KRPCStream (Bool))
getEngineThrottleLockedStream thisArg = requestStream $ getEngineThrottleLockedStreamReq thisArg | 189 | getEngineThrottleLockedStream :: KRPCHS.SpaceCenter.Engine -> RPCContext (KRPCStream (Bool))
getEngineThrottleLockedStream thisArg = requestStream $ getEngineThrottleLockedStreamReq thisArg | 189 | getEngineThrottleLockedStream thisArg = requestStream $ getEngineThrottleLockedStreamReq thisArg | 96 | false | true | 0 | 9 | 13 | 43 | 21 | 22 | null | null |
mb21/qua-kit | apps/hs/qua-server/src/Handler/Mooc/Comment.hs | mit | writeCommentFormW :: ScenarioId -> [Entity Criterion] -> Widget
writeCommentFormW scId criteria = do
toWidgetHead [cassius|
div.card-comment.card-action
padding: 4px
margin: 0
min-height: 28px
span.card-comment.card-criterion
height: 24px
width: 24px
margin: 0px 4px 0px 4px
padding: 0px
float: left
opacity: 0.3
span.card-comment.card-criterion:hover
opacity: 1.0
cursor: pointer
span.card-comment.icon
height: 24px
width: 24px
font-size: 16px
padding: 4px
margin: 0px 2px 0px 2px
float: left
opacity: 0.3
span.card-comment
height: 24px
width: 24px
font-size: 16px
padding: 4px
margin: 0px 2px 0px 2px
float: left
span.card-comment:hover
opacity: 1.0
span.card-comment.icon:hover
opacity: 1.0
cursor: pointer
a.card-comment.btn
height: 24px
padding: 4px
font-size: 16px
float: right
display: none
div.card-comment.form-group
margin: 16px 4px 4px 4px
#voteinfo
margin: 2px
padding: 2px
|]
toWidgetHead [julius|
function submitComment(){
$.post(
{ url: '@{WriteReviewR scId}'
, data: $('#commentForm').serialize()
, success: function(result){
resetAllComment();
$("body").snackbar({
content: (result.error ? result.error : "Review sent. Refresh the page to see it.")
});
}
});
}
var voteSet = false, critSet = false;
function resetAllComment() {
voteSet = false;
critSet = false;
$('#criterionIdI').val(undefined);
$('#criterionValI').val(undefined);
$('#commentI').val('');
$('#voteCName').text('');
$('#voteIndication').text('');
$('span.card-comment.card-criterion').css('opacity','0.3');
$('#downvoteSpan').css('opacity','0.3');
$('#upvoteSpan').css('opacity','0.3');
checkVote();
}
function voteCriterion(criterionId, criterionName) {
$('#criterionIdI').val(criterionId);
$('#voteCName').text(criterionName);
$('span.card-comment.card-criterion').css('opacity','0.3');
$('#cspan' + criterionId).css('opacity','1.0');
critSet = true;
checkVote();
}
function setUpvote() {
$('#criterionValI').val(1);
$('#voteIndication').text('Upvote ');
$('#downvoteSpan').css('opacity','0.3');
$('#upvoteSpan').css('opacity','1.0');
voteSet = true;
checkVote();
}
function setDownvote() {
$('#criterionValI').val(0);
$('#voteIndication').text('Downvote ');
$('#downvoteSpan').css('opacity','1.0');
$('#upvoteSpan').css('opacity','0.3');
voteSet = true;
checkVote();
}
function checkVote() {
if(voteSet && critSet) {
$('#voteSubmit').show();
} else {
$('#voteSubmit').hide();
}
}
|]
toWidgetBody [hamlet|
<div.card-comment.card>
<div.card-comment.card-main>
<div.card-comment.card-inner>
<form #commentForm method="post">
<input type="hidden" #criterionIdI name="criterion">
<input type="hidden" #criterionValI name="val">
<div.card-comment.form-group.form-group-label>
<label.floating-label for="commentI">Write a review
<textarea.form-control.textarea-autosize form="commentForm" id="commentI" rows="1" name="comment">
<p.card-comment #voteinfo>
<span #voteIndication>
<span #voteCName>
<div.card-comment.card-action>
$forall (Entity cId criterion) <- criteria
<span.card-comment.card-criterion onclick="voteCriterion(#{fromSqlKey cId},'#{criterionName criterion}')" id="cspan#{fromSqlKey cId}">
#{preEscapedToMarkup $ criterionIcon criterion}
<span.card-comment>
<span.card-comment.icon #upvoteSpan onclick="setUpvote()">thumb_up
<span.card-comment.icon #downvoteSpan onclick="setDownvote()">thumb_down
<a.card-comment.btn.btn-flat.btn-brand-accent.waves-attach.waves-effect #voteSubmit onclick="submitComment()">
<span.icon>check
Send
|] | 4,322 | writeCommentFormW :: ScenarioId -> [Entity Criterion] -> Widget
writeCommentFormW scId criteria = do
toWidgetHead [cassius|
div.card-comment.card-action
padding: 4px
margin: 0
min-height: 28px
span.card-comment.card-criterion
height: 24px
width: 24px
margin: 0px 4px 0px 4px
padding: 0px
float: left
opacity: 0.3
span.card-comment.card-criterion:hover
opacity: 1.0
cursor: pointer
span.card-comment.icon
height: 24px
width: 24px
font-size: 16px
padding: 4px
margin: 0px 2px 0px 2px
float: left
opacity: 0.3
span.card-comment
height: 24px
width: 24px
font-size: 16px
padding: 4px
margin: 0px 2px 0px 2px
float: left
span.card-comment:hover
opacity: 1.0
span.card-comment.icon:hover
opacity: 1.0
cursor: pointer
a.card-comment.btn
height: 24px
padding: 4px
font-size: 16px
float: right
display: none
div.card-comment.form-group
margin: 16px 4px 4px 4px
#voteinfo
margin: 2px
padding: 2px
|]
toWidgetHead [julius|
function submitComment(){
$.post(
{ url: '@{WriteReviewR scId}'
, data: $('#commentForm').serialize()
, success: function(result){
resetAllComment();
$("body").snackbar({
content: (result.error ? result.error : "Review sent. Refresh the page to see it.")
});
}
});
}
var voteSet = false, critSet = false;
function resetAllComment() {
voteSet = false;
critSet = false;
$('#criterionIdI').val(undefined);
$('#criterionValI').val(undefined);
$('#commentI').val('');
$('#voteCName').text('');
$('#voteIndication').text('');
$('span.card-comment.card-criterion').css('opacity','0.3');
$('#downvoteSpan').css('opacity','0.3');
$('#upvoteSpan').css('opacity','0.3');
checkVote();
}
function voteCriterion(criterionId, criterionName) {
$('#criterionIdI').val(criterionId);
$('#voteCName').text(criterionName);
$('span.card-comment.card-criterion').css('opacity','0.3');
$('#cspan' + criterionId).css('opacity','1.0');
critSet = true;
checkVote();
}
function setUpvote() {
$('#criterionValI').val(1);
$('#voteIndication').text('Upvote ');
$('#downvoteSpan').css('opacity','0.3');
$('#upvoteSpan').css('opacity','1.0');
voteSet = true;
checkVote();
}
function setDownvote() {
$('#criterionValI').val(0);
$('#voteIndication').text('Downvote ');
$('#downvoteSpan').css('opacity','1.0');
$('#upvoteSpan').css('opacity','0.3');
voteSet = true;
checkVote();
}
function checkVote() {
if(voteSet && critSet) {
$('#voteSubmit').show();
} else {
$('#voteSubmit').hide();
}
}
|]
toWidgetBody [hamlet|
<div.card-comment.card>
<div.card-comment.card-main>
<div.card-comment.card-inner>
<form #commentForm method="post">
<input type="hidden" #criterionIdI name="criterion">
<input type="hidden" #criterionValI name="val">
<div.card-comment.form-group.form-group-label>
<label.floating-label for="commentI">Write a review
<textarea.form-control.textarea-autosize form="commentForm" id="commentI" rows="1" name="comment">
<p.card-comment #voteinfo>
<span #voteIndication>
<span #voteCName>
<div.card-comment.card-action>
$forall (Entity cId criterion) <- criteria
<span.card-comment.card-criterion onclick="voteCriterion(#{fromSqlKey cId},'#{criterionName criterion}')" id="cspan#{fromSqlKey cId}">
#{preEscapedToMarkup $ criterionIcon criterion}
<span.card-comment>
<span.card-comment.icon #upvoteSpan onclick="setUpvote()">thumb_up
<span.card-comment.icon #downvoteSpan onclick="setDownvote()">thumb_down
<a.card-comment.btn.btn-flat.btn-brand-accent.waves-attach.waves-effect #voteSubmit onclick="submitComment()">
<span.icon>check
Send
|] | 4,322 | writeCommentFormW scId criteria = do
toWidgetHead [cassius|
div.card-comment.card-action
padding: 4px
margin: 0
min-height: 28px
span.card-comment.card-criterion
height: 24px
width: 24px
margin: 0px 4px 0px 4px
padding: 0px
float: left
opacity: 0.3
span.card-comment.card-criterion:hover
opacity: 1.0
cursor: pointer
span.card-comment.icon
height: 24px
width: 24px
font-size: 16px
padding: 4px
margin: 0px 2px 0px 2px
float: left
opacity: 0.3
span.card-comment
height: 24px
width: 24px
font-size: 16px
padding: 4px
margin: 0px 2px 0px 2px
float: left
span.card-comment:hover
opacity: 1.0
span.card-comment.icon:hover
opacity: 1.0
cursor: pointer
a.card-comment.btn
height: 24px
padding: 4px
font-size: 16px
float: right
display: none
div.card-comment.form-group
margin: 16px 4px 4px 4px
#voteinfo
margin: 2px
padding: 2px
|]
toWidgetHead [julius|
function submitComment(){
$.post(
{ url: '@{WriteReviewR scId}'
, data: $('#commentForm').serialize()
, success: function(result){
resetAllComment();
$("body").snackbar({
content: (result.error ? result.error : "Review sent. Refresh the page to see it.")
});
}
});
}
var voteSet = false, critSet = false;
function resetAllComment() {
voteSet = false;
critSet = false;
$('#criterionIdI').val(undefined);
$('#criterionValI').val(undefined);
$('#commentI').val('');
$('#voteCName').text('');
$('#voteIndication').text('');
$('span.card-comment.card-criterion').css('opacity','0.3');
$('#downvoteSpan').css('opacity','0.3');
$('#upvoteSpan').css('opacity','0.3');
checkVote();
}
function voteCriterion(criterionId, criterionName) {
$('#criterionIdI').val(criterionId);
$('#voteCName').text(criterionName);
$('span.card-comment.card-criterion').css('opacity','0.3');
$('#cspan' + criterionId).css('opacity','1.0');
critSet = true;
checkVote();
}
function setUpvote() {
$('#criterionValI').val(1);
$('#voteIndication').text('Upvote ');
$('#downvoteSpan').css('opacity','0.3');
$('#upvoteSpan').css('opacity','1.0');
voteSet = true;
checkVote();
}
function setDownvote() {
$('#criterionValI').val(0);
$('#voteIndication').text('Downvote ');
$('#downvoteSpan').css('opacity','1.0');
$('#upvoteSpan').css('opacity','0.3');
voteSet = true;
checkVote();
}
function checkVote() {
if(voteSet && critSet) {
$('#voteSubmit').show();
} else {
$('#voteSubmit').hide();
}
}
|]
toWidgetBody [hamlet|
<div.card-comment.card>
<div.card-comment.card-main>
<div.card-comment.card-inner>
<form #commentForm method="post">
<input type="hidden" #criterionIdI name="criterion">
<input type="hidden" #criterionValI name="val">
<div.card-comment.form-group.form-group-label>
<label.floating-label for="commentI">Write a review
<textarea.form-control.textarea-autosize form="commentForm" id="commentI" rows="1" name="comment">
<p.card-comment #voteinfo>
<span #voteIndication>
<span #voteCName>
<div.card-comment.card-action>
$forall (Entity cId criterion) <- criteria
<span.card-comment.card-criterion onclick="voteCriterion(#{fromSqlKey cId},'#{criterionName criterion}')" id="cspan#{fromSqlKey cId}">
#{preEscapedToMarkup $ criterionIcon criterion}
<span.card-comment>
<span.card-comment.icon #upvoteSpan onclick="setUpvote()">thumb_up
<span.card-comment.icon #downvoteSpan onclick="setDownvote()">thumb_down
<a.card-comment.btn.btn-flat.btn-brand-accent.waves-attach.waves-effect #voteSubmit onclick="submitComment()">
<span.icon>check
Send
|] | 4,258 | false | true | 0 | 8 | 1,173 | 60 | 33 | 27 | null | null |
ku-fpg/remote-monad-examples | classic-examples/Deep/DeepProcedure.hs | bsd-3-clause | readProcedureReply :: Procedure a -> String -> a
readProcedureReply (Reply {}) i = read i | 89 | readProcedureReply :: Procedure a -> String -> a
readProcedureReply (Reply {}) i = read i | 89 | readProcedureReply (Reply {}) i = read i | 40 | false | true | 0 | 7 | 14 | 37 | 18 | 19 | null | null |
erantapaa/happstack-server | src/Happstack/Server/SURI/ParseURI.hs | bsd-3-clause | pquery :: ByteString -> (String -> String -> t) -> t
pquery fs cont =
case breakChar '#' fs of
(a,b) -> cont ('?':unpack a) (unpack b) | 140 | pquery :: ByteString -> (String -> String -> t) -> t
pquery fs cont =
case breakChar '#' fs of
(a,b) -> cont ('?':unpack a) (unpack b) | 140 | pquery fs cont =
case breakChar '#' fs of
(a,b) -> cont ('?':unpack a) (unpack b) | 87 | false | true | 1 | 9 | 32 | 77 | 39 | 38 | null | null |
balopat/quantum-computing | src/Matrix.hs | bsd-3-clause | isHermitian (Matrix mx n m) = n == m && all (\(i,j) -> mx !! i !! j == (Complex.conj ( mx !! j !! i))) [ (i,j) | i <- [0..n-1], j <- [0..i]] | 141 | isHermitian (Matrix mx n m) = n == m && all (\(i,j) -> mx !! i !! j == (Complex.conj ( mx !! j !! i))) [ (i,j) | i <- [0..n-1], j <- [0..i]] | 141 | isHermitian (Matrix mx n m) = n == m && all (\(i,j) -> mx !! i !! j == (Complex.conj ( mx !! j !! i))) [ (i,j) | i <- [0..n-1], j <- [0..i]] | 141 | false | false | 0 | 14 | 35 | 116 | 62 | 54 | null | null |
amcphail/hmatrix-gsl-stats | lib/Numeric/GSL/Statistics.hs | bsd-3-clause | -- | the absolute deviation from the precomputed mean
absdev_m :: Double -> Vector Double -> Double
absdev_m m = getD1 (statistics_absdev_m m) "absdev_m" | 153 | absdev_m :: Double -> Vector Double -> Double
absdev_m m = getD1 (statistics_absdev_m m) "absdev_m" | 99 | absdev_m m = getD1 (statistics_absdev_m m) "absdev_m" | 53 | true | true | 0 | 8 | 23 | 43 | 19 | 24 | null | null |
jeffchao/hedgewars-accessible | gameServer/RoomsAndClients.hs | gpl-2.0 | clientRoomM :: MRoomsAndClients r c -> ClientIndex -> IO RoomIndex
clientRoomM (MRoomsAndClients (_, clients)) (ClientIndex ci) = liftM clientRoom' (clients `readElem` ci) | 171 | clientRoomM :: MRoomsAndClients r c -> ClientIndex -> IO RoomIndex
clientRoomM (MRoomsAndClients (_, clients)) (ClientIndex ci) = liftM clientRoom' (clients `readElem` ci) | 171 | clientRoomM (MRoomsAndClients (_, clients)) (ClientIndex ci) = liftM clientRoom' (clients `readElem` ci) | 104 | false | true | 0 | 11 | 21 | 68 | 34 | 34 | null | null |
haskell-opengl/OpenGLRaw | src/Graphics/GL/ExtensionPredicates.hs | bsd-3-clause | -- | Is the <https://www.opengl.org/registry/specs/SGIX/polynomial_ffd.txt SGIX_polynomial_ffd> extension supported?
glGetSGIXPolynomialFFD :: MonadIO m => m Bool
glGetSGIXPolynomialFFD = getExtensions >>= (return . member "GL_SGIX_polynomial_ffd") | 248 | glGetSGIXPolynomialFFD :: MonadIO m => m Bool
glGetSGIXPolynomialFFD = getExtensions >>= (return . member "GL_SGIX_polynomial_ffd") | 131 | glGetSGIXPolynomialFFD = getExtensions >>= (return . member "GL_SGIX_polynomial_ffd") | 85 | true | true | 0 | 8 | 22 | 36 | 18 | 18 | null | null |
Tener/personal-library-yesod | Handler/File.hs | bsd-2-clause | uploadDirectory :: FilePath -- FIXME: make this configurable
uploadDirectory = "/var/tmp/personallibrary/incoming" | 114 | uploadDirectory :: FilePath
uploadDirectory = "/var/tmp/personallibrary/incoming" | 81 | uploadDirectory = "/var/tmp/personallibrary/incoming" | 53 | true | true | 0 | 4 | 10 | 12 | 7 | 5 | null | null |
AlexeyRaga/eta | compiler/ETA/Main/SysTools.hs | bsd-3-clause | runPp :: DynFlags -> [Option] -> IO ()
runPp dflags args = do
let prog = pgm_F dflags
opts = map Option (getOpts dflags opt_F)
runSomething dflags "Haskell pre-processor" prog (args ++ opts) | 202 | runPp :: DynFlags -> [Option] -> IO ()
runPp dflags args = do
let prog = pgm_F dflags
opts = map Option (getOpts dflags opt_F)
runSomething dflags "Haskell pre-processor" prog (args ++ opts) | 202 | runPp dflags args = do
let prog = pgm_F dflags
opts = map Option (getOpts dflags opt_F)
runSomething dflags "Haskell pre-processor" prog (args ++ opts) | 163 | false | true | 0 | 13 | 44 | 86 | 40 | 46 | null | null |
oldmanmike/haskellSDL2Examples | src/lesson10.hs | gpl-2.0 | main :: IO ()
main = inWindow $ \window -> Image.withImgInit [Image.InitPNG] $ do
_ <- setHint "SDL_RENDER_SCALE_QUALITY" "1" >>= logWarning
renderer <- createRenderer window (-1) [SDL.SDL_RENDERER_ACCELERATED] >>= either throwSDLError return
fooTexture <- loadTexture renderer "./assets/foo.png"
(fw, fh) <- getTextureSize fooTexture
let foo = (fooTexture, fw, fh)
backgroundTexture <- loadTexture renderer "./assets/background.png"
(bw, bh) <- getTextureSize backgroundTexture
let background = (backgroundTexture, bw, bh)
let instructions = createRenderInstructions background foo
repeatUntilTrue $ draw renderer instructions >> handleNoInput pollEvent
destroyTextures [fooTexture, backgroundTexture]
SDL.destroyRenderer renderer | 779 | main :: IO ()
main = inWindow $ \window -> Image.withImgInit [Image.InitPNG] $ do
_ <- setHint "SDL_RENDER_SCALE_QUALITY" "1" >>= logWarning
renderer <- createRenderer window (-1) [SDL.SDL_RENDERER_ACCELERATED] >>= either throwSDLError return
fooTexture <- loadTexture renderer "./assets/foo.png"
(fw, fh) <- getTextureSize fooTexture
let foo = (fooTexture, fw, fh)
backgroundTexture <- loadTexture renderer "./assets/background.png"
(bw, bh) <- getTextureSize backgroundTexture
let background = (backgroundTexture, bw, bh)
let instructions = createRenderInstructions background foo
repeatUntilTrue $ draw renderer instructions >> handleNoInput pollEvent
destroyTextures [fooTexture, backgroundTexture]
SDL.destroyRenderer renderer | 779 | main = inWindow $ \window -> Image.withImgInit [Image.InitPNG] $ do
_ <- setHint "SDL_RENDER_SCALE_QUALITY" "1" >>= logWarning
renderer <- createRenderer window (-1) [SDL.SDL_RENDERER_ACCELERATED] >>= either throwSDLError return
fooTexture <- loadTexture renderer "./assets/foo.png"
(fw, fh) <- getTextureSize fooTexture
let foo = (fooTexture, fw, fh)
backgroundTexture <- loadTexture renderer "./assets/background.png"
(bw, bh) <- getTextureSize backgroundTexture
let background = (backgroundTexture, bw, bh)
let instructions = createRenderInstructions background foo
repeatUntilTrue $ draw renderer instructions >> handleNoInput pollEvent
destroyTextures [fooTexture, backgroundTexture]
SDL.destroyRenderer renderer | 765 | false | true | 0 | 14 | 129 | 233 | 112 | 121 | null | null |
hanshoglund/comb | src/Sound/Comb/Prim/Ref.hs | bsd-3-clause | run :: Signal -> [Double]
run a = let s = defState
in if not (a `verify` s) then error "Could not verify" else
unfoldr (runBase a) s | 145 | run :: Signal -> [Double]
run a = let s = defState
in if not (a `verify` s) then error "Could not verify" else
unfoldr (runBase a) s | 145 | run a = let s = defState
in if not (a `verify` s) then error "Could not verify" else
unfoldr (runBase a) s | 119 | false | true | 0 | 10 | 40 | 73 | 35 | 38 | null | null |
brendanhay/gogol | gogol-script/gen/Network/Google/Script/Types/Product.hs | mpl-2.0 | -- | The result of the execution.
esrResult :: Lens' ExecuteStreamResponse (Maybe ScriptExecutionResult)
esrResult
= lens _esrResult (\ s a -> s{_esrResult = a}) | 163 | esrResult :: Lens' ExecuteStreamResponse (Maybe ScriptExecutionResult)
esrResult
= lens _esrResult (\ s a -> s{_esrResult = a}) | 129 | esrResult
= lens _esrResult (\ s a -> s{_esrResult = a}) | 58 | true | true | 1 | 9 | 25 | 52 | 25 | 27 | null | null |
beni55/ghcjs | src-bin/Haddock.hs | mit | getGhcjsDirs :: [Flag] -> IO (String, String)
getGhcjsDirs flags =
case [ dir | Flag_GhcLibDir dir <- flags ] of
[] -> error "haddock-ghcjs: missing -B option, cannot find library dir"
xs -> return ("not available", last xs) | 234 | getGhcjsDirs :: [Flag] -> IO (String, String)
getGhcjsDirs flags =
case [ dir | Flag_GhcLibDir dir <- flags ] of
[] -> error "haddock-ghcjs: missing -B option, cannot find library dir"
xs -> return ("not available", last xs) | 234 | getGhcjsDirs flags =
case [ dir | Flag_GhcLibDir dir <- flags ] of
[] -> error "haddock-ghcjs: missing -B option, cannot find library dir"
xs -> return ("not available", last xs) | 188 | false | true | 0 | 10 | 47 | 77 | 39 | 38 | null | null |
davideGiovannini/scheme-repl | src/Evaluation.hs | bsd-3-clause | eval _ val@(Number _) = return val | 34 | eval _ val@(Number _) = return val | 34 | eval _ val@(Number _) = return val | 34 | false | false | 0 | 8 | 6 | 27 | 12 | 15 | null | null |
sgillespie/ghc | compiler/utils/Outputable.hs | bsd-3-clause | ifPprDebug :: SDoc -> SDoc -- Empty for non-debug style
ifPprDebug d = SDoc $ \ctx ->
case ctx of
SDC{sdocStyle=PprDebug} -> runSDoc d ctx
_ -> Pretty.empty | 205 | ifPprDebug :: SDoc -> SDoc
ifPprDebug d = SDoc $ \ctx ->
case ctx of
SDC{sdocStyle=PprDebug} -> runSDoc d ctx
_ -> Pretty.empty | 169 | ifPprDebug d = SDoc $ \ctx ->
case ctx of
SDC{sdocStyle=PprDebug} -> runSDoc d ctx
_ -> Pretty.empty | 142 | true | true | 0 | 12 | 76 | 60 | 31 | 29 | null | null |
annenkov/contracts | Coq/Extraction/contracts-haskell/src/Contracts/HOAS.hs | mit | true :: BExp
true = opE (BLit True) [] | 38 | true :: BExp
true = opE (BLit True) [] | 38 | true = opE (BLit True) [] | 25 | false | true | 0 | 7 | 8 | 24 | 12 | 12 | null | null |
siddhanathan/ghc | compiler/basicTypes/PatSyn.hs | bsd-3-clause | patSynArgs :: PatSyn -> [Type]
patSynArgs = psArgs | 50 | patSynArgs :: PatSyn -> [Type]
patSynArgs = psArgs | 50 | patSynArgs = psArgs | 19 | false | true | 0 | 8 | 7 | 25 | 11 | 14 | null | null |
hvr/lens | src/Control/Lens/Cons.hs | bsd-3-clause | -- | A 'Traversal' reading and writing to the last element of a /non-empty/ container.
--
-- >>> [a,b,c]^?!_last
-- c
--
-- >>> []^?_last
-- Nothing
--
-- >>> [a,b,c] & _last %~ f
-- [a,b,f c]
--
-- >>> [1,2]^?_last
-- Just 2
--
-- >>> [] & _last .~ 1
-- []
--
-- >>> [0] & _last .~ 2
-- [2]
--
-- >>> [0,1] & _last .~ 2
-- [0,2]
--
-- This 'Traversal' is not limited to lists, however. We can also work with other containers, such as a 'Vector'.
--
-- >>> Vector.fromList "abcde" ^? _last
-- Just 'e'
--
-- >>> Vector.empty ^? _last
-- Nothing
--
-- >>> Vector.fromList "abcde" & _last .~ 'Q'
-- fromList "abcdQ"
--
-- @
-- '_last' :: 'Traversal'' [a] a
-- '_last' :: 'Traversal'' ('Seq' a) a
-- '_last' :: 'Traversal'' ('Vector' a) a
-- @
_last :: Snoc s s a a => Traversal' s a
_last = _Snoc._2 | 797 | _last :: Snoc s s a a => Traversal' s a
_last = _Snoc._2 | 56 | _last = _Snoc._2 | 16 | true | true | 0 | 6 | 164 | 70 | 54 | 16 | null | null |
sdiehl/ghc | compiler/typecheck/TcGenFunctor.hs | bsd-3-clause | foldDataConArgs :: FFoldType a -> DataCon -> [a]
-- Fold over the arguments of the datacon
foldDataConArgs ft con
= map foldArg (dataConOrigArgTys con)
where
foldArg
= case getTyVar_maybe (last (tyConAppArgs (dataConOrigResTy con))) of
Just tv -> functorLikeTraverse tv ft
Nothing -> const (ft_triv ft)
-- If we are deriving Foldable for a GADT, there is a chance that the last
-- type variable in the data type isn't actually a type variable at all.
-- (for example, this can happen if the last type variable is refined to
-- be a concrete type such as Int). If the last type variable is refined
-- to be a specific type, then getTyVar_maybe will return Nothing.
-- See Note [DeriveFoldable with ExistentialQuantification]
--
-- The kind checks have ensured the last type parameter is of kind *.
-- Make a HsLam using a fresh variable from a State monad | 927 | foldDataConArgs :: FFoldType a -> DataCon -> [a]
foldDataConArgs ft con
= map foldArg (dataConOrigArgTys con)
where
foldArg
= case getTyVar_maybe (last (tyConAppArgs (dataConOrigResTy con))) of
Just tv -> functorLikeTraverse tv ft
Nothing -> const (ft_triv ft)
-- If we are deriving Foldable for a GADT, there is a chance that the last
-- type variable in the data type isn't actually a type variable at all.
-- (for example, this can happen if the last type variable is refined to
-- be a concrete type such as Int). If the last type variable is refined
-- to be a specific type, then getTyVar_maybe will return Nothing.
-- See Note [DeriveFoldable with ExistentialQuantification]
--
-- The kind checks have ensured the last type parameter is of kind *.
-- Make a HsLam using a fresh variable from a State monad | 885 | foldDataConArgs ft con
= map foldArg (dataConOrigArgTys con)
where
foldArg
= case getTyVar_maybe (last (tyConAppArgs (dataConOrigResTy con))) of
Just tv -> functorLikeTraverse tv ft
Nothing -> const (ft_triv ft)
-- If we are deriving Foldable for a GADT, there is a chance that the last
-- type variable in the data type isn't actually a type variable at all.
-- (for example, this can happen if the last type variable is refined to
-- be a concrete type such as Int). If the last type variable is refined
-- to be a specific type, then getTyVar_maybe will return Nothing.
-- See Note [DeriveFoldable with ExistentialQuantification]
--
-- The kind checks have ensured the last type parameter is of kind *.
-- Make a HsLam using a fresh variable from a State monad | 836 | true | true | 0 | 12 | 220 | 113 | 59 | 54 | null | null |
OS2World/DEV-UTIL-HUGS | oldlib/SizedSeq.hs | bsd-3-clause | lookupM (N n xs) = S.lookupM xs | 31 | lookupM (N n xs) = S.lookupM xs | 31 | lookupM (N n xs) = S.lookupM xs | 31 | false | false | 0 | 6 | 6 | 23 | 10 | 13 | null | null |
frontrowed/wai | wai-extra/test/WaiExtraSpec.hs | mit | moApp :: Application
moApp = methodOverride $ \req f -> f $ responseLBS status200
[("Method", requestMethod req)] "" | 120 | moApp :: Application
moApp = methodOverride $ \req f -> f $ responseLBS status200
[("Method", requestMethod req)] "" | 120 | moApp = methodOverride $ \req f -> f $ responseLBS status200
[("Method", requestMethod req)] "" | 99 | false | true | 0 | 8 | 21 | 47 | 24 | 23 | null | null |
amccausl/Swish | Swish/HaskellRDF/SwishTest.hs | lgpl-2.1 | test10 = swishTestCase "-i=Data/Simple3.n3 -o=Data/Simple3.tmp" | 63 | test10 = swishTestCase "-i=Data/Simple3.n3 -o=Data/Simple3.tmp" | 63 | test10 = swishTestCase "-i=Data/Simple3.n3 -o=Data/Simple3.tmp" | 63 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
ctford/Idris-Elba-dev | src/Idris/Core/TT.hs | bsd-3-clause | vToP :: TT n -> TT n
vToP = vToP' [] where
vToP' env (V i) = let (n, b) = (env !! i) in
P Bound n (binderTy b)
vToP' env (Bind n b sc) = let b' = fmap (vToP' env) b in
Bind n b' (vToP' ((n, b'):env) sc)
vToP' env (App f a) = App (vToP' env f) (vToP' env a)
vToP' env t = t
-- | Replace every non-free reference to the name of a binding in
-- the given term with a de Bruijn index. | 457 | vToP :: TT n -> TT n
vToP = vToP' [] where
vToP' env (V i) = let (n, b) = (env !! i) in
P Bound n (binderTy b)
vToP' env (Bind n b sc) = let b' = fmap (vToP' env) b in
Bind n b' (vToP' ((n, b'):env) sc)
vToP' env (App f a) = App (vToP' env f) (vToP' env a)
vToP' env t = t
-- | Replace every non-free reference to the name of a binding in
-- the given term with a de Bruijn index. | 457 | vToP = vToP' [] where
vToP' env (V i) = let (n, b) = (env !! i) in
P Bound n (binderTy b)
vToP' env (Bind n b sc) = let b' = fmap (vToP' env) b in
Bind n b' (vToP' ((n, b'):env) sc)
vToP' env (App f a) = App (vToP' env f) (vToP' env a)
vToP' env t = t
-- | Replace every non-free reference to the name of a binding in
-- the given term with a de Bruijn index. | 436 | false | true | 1 | 12 | 168 | 223 | 102 | 121 | null | null |
Ian-Stewart-Binks/courseography | dependencies/HaXml-1.25.3/src/Text/XML/HaXml/DtdToHaskell/TypeDef.hs | gpl-3.0 | notPrelude "Char" = "AChar" | 30 | notPrelude "Char" = "AChar" | 30 | notPrelude "Char" = "AChar" | 30 | false | false | 0 | 5 | 6 | 9 | 4 | 5 | null | null |
denibertovic/haskell | kubernetes/lib/Kubernetes/OpenAPI/ModelLens.hs | bsd-3-clause | -- | 'v1ObjectMetaDeletionGracePeriodSeconds' Lens
v1ObjectMetaDeletionGracePeriodSecondsL :: Lens_' V1ObjectMeta (Maybe Integer)
v1ObjectMetaDeletionGracePeriodSecondsL f V1ObjectMeta{..} = (\v1ObjectMetaDeletionGracePeriodSeconds -> V1ObjectMeta { v1ObjectMetaDeletionGracePeriodSeconds, ..} ) <$> f v1ObjectMetaDeletionGracePeriodSeconds | 340 | v1ObjectMetaDeletionGracePeriodSecondsL :: Lens_' V1ObjectMeta (Maybe Integer)
v1ObjectMetaDeletionGracePeriodSecondsL f V1ObjectMeta{..} = (\v1ObjectMetaDeletionGracePeriodSeconds -> V1ObjectMeta { v1ObjectMetaDeletionGracePeriodSeconds, ..} ) <$> f v1ObjectMetaDeletionGracePeriodSeconds | 289 | v1ObjectMetaDeletionGracePeriodSecondsL f V1ObjectMeta{..} = (\v1ObjectMetaDeletionGracePeriodSeconds -> V1ObjectMeta { v1ObjectMetaDeletionGracePeriodSeconds, ..} ) <$> f v1ObjectMetaDeletionGracePeriodSeconds | 210 | true | true | 0 | 8 | 23 | 57 | 30 | 27 | null | null |
ekr/tamarin-prover | lib/theory/src/Theory/Constraint/System/Guarded.hs | gpl-3.0 | ginduct :: Ord c => LGuarded c -> Either String (LGuarded c, LGuarded c)
ginduct gf = do
unless (null $ frees gf) (throwError "formula not closed")
unless (containsAction gf) (throwError "formula contains no action atom")
baseCase <- satisfiedByEmptyTrace gf
gfIH <- toInductionHypothesis gf
return (gtf baseCase, gconj [gf, gfIH])
where
containsAction = foldGuarded (const True) (or . getDisj) (or . getConj)
(\_ _ as body -> not (null as) || body)
------------------------------------------------------------------------------
-- Formula Simplification
------------------------------------------------------------------------------
-- | Simplify a 'Guarded' formula by replacing atoms with their truth value,
-- if it can be determined. | 805 | ginduct :: Ord c => LGuarded c -> Either String (LGuarded c, LGuarded c)
ginduct gf = do
unless (null $ frees gf) (throwError "formula not closed")
unless (containsAction gf) (throwError "formula contains no action atom")
baseCase <- satisfiedByEmptyTrace gf
gfIH <- toInductionHypothesis gf
return (gtf baseCase, gconj [gf, gfIH])
where
containsAction = foldGuarded (const True) (or . getDisj) (or . getConj)
(\_ _ as body -> not (null as) || body)
------------------------------------------------------------------------------
-- Formula Simplification
------------------------------------------------------------------------------
-- | Simplify a 'Guarded' formula by replacing atoms with their truth value,
-- if it can be determined. | 805 | ginduct gf = do
unless (null $ frees gf) (throwError "formula not closed")
unless (containsAction gf) (throwError "formula contains no action atom")
baseCase <- satisfiedByEmptyTrace gf
gfIH <- toInductionHypothesis gf
return (gtf baseCase, gconj [gf, gfIH])
where
containsAction = foldGuarded (const True) (or . getDisj) (or . getConj)
(\_ _ as body -> not (null as) || body)
------------------------------------------------------------------------------
-- Formula Simplification
------------------------------------------------------------------------------
-- | Simplify a 'Guarded' formula by replacing atoms with their truth value,
-- if it can be determined. | 732 | false | true | 1 | 11 | 162 | 209 | 100 | 109 | null | null |
nikita-volkov/postgresql-binary | library/PostgreSQL/Binary/Time.hs | mit | microsToUTC :: Int64 -> UTCTime
microsToUTC =
evalState $ do
d <- state $ flip divMod $ 10^6 * 60 * 60 * 24
u <- get
return $
UTCTime (postgresJulianToDay d) (microsToDiffTime u)
| 200 | microsToUTC :: Int64 -> UTCTime
microsToUTC =
evalState $ do
d <- state $ flip divMod $ 10^6 * 60 * 60 * 24
u <- get
return $
UTCTime (postgresJulianToDay d) (microsToDiffTime u)
| 200 | microsToUTC =
evalState $ do
d <- state $ flip divMod $ 10^6 * 60 * 60 * 24
u <- get
return $
UTCTime (postgresJulianToDay d) (microsToDiffTime u)
| 168 | false | true | 0 | 15 | 55 | 84 | 40 | 44 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/utils/FastString.hs | bsd-3-clause | tailFS :: FastString -> FastString
tailFS (FastString _ 0 _ _) = panic "tailFS: Empty FastString" | 97 | tailFS :: FastString -> FastString
tailFS (FastString _ 0 _ _) = panic "tailFS: Empty FastString" | 97 | tailFS (FastString _ 0 _ _) = panic "tailFS: Empty FastString" | 62 | false | true | 0 | 7 | 15 | 33 | 16 | 17 | null | null |
dimara/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | cpuavgloadBufferSize :: Int
cpuavgloadBufferSize = 150 | 54 | cpuavgloadBufferSize :: Int
cpuavgloadBufferSize = 150 | 54 | cpuavgloadBufferSize = 150 | 26 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
sashabu/libcspm | src/CSPM/Syntax/Types.hs | bsd-3-clause | isPolymorphic TBool = False | 27 | isPolymorphic TBool = False | 27 | isPolymorphic TBool = False | 27 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
clample/lamdabtc | backend/src/Protocol/Server.hs | bsd-3-clause | isNewSync' :: Connection' Bool
isNewSync' = (== []) <$> getAllAddresses' | 72 | isNewSync' :: Connection' Bool
isNewSync' = (== []) <$> getAllAddresses' | 72 | isNewSync' = (== []) <$> getAllAddresses' | 41 | false | true | 0 | 7 | 9 | 24 | 13 | 11 | null | null |
TueHaulund/ROOPLC | src/Parser.hs | mit | languageDef :: Token.LanguageDef st
languageDef =
emptyDef {
Token.commentLine = "//",
Token.nestedComments = False,
Token.identStart = letter,
Token.identLetter = alphaNum <|> oneOf "_'",
Token.reservedOpNames = concatMap (map fst) operatorTable,
Token.reservedNames = keywords,
Token.caseSensitive = True } | 386 | languageDef :: Token.LanguageDef st
languageDef =
emptyDef {
Token.commentLine = "//",
Token.nestedComments = False,
Token.identStart = letter,
Token.identLetter = alphaNum <|> oneOf "_'",
Token.reservedOpNames = concatMap (map fst) operatorTable,
Token.reservedNames = keywords,
Token.caseSensitive = True } | 386 | languageDef =
emptyDef {
Token.commentLine = "//",
Token.nestedComments = False,
Token.identStart = letter,
Token.identLetter = alphaNum <|> oneOf "_'",
Token.reservedOpNames = concatMap (map fst) operatorTable,
Token.reservedNames = keywords,
Token.caseSensitive = True } | 350 | false | true | 1 | 10 | 113 | 99 | 53 | 46 | null | null |
mbelicki/valdemar | src/Compiler.hs | gpl-3.0 | getFormat :: OutputType -> E.OutModuleFormat
getFormat outType
= failOnNothing msg $ Map.lookup outType outFileFormats
where msg = "Fatal could not find output fromat for: " ++ show outType | 201 | getFormat :: OutputType -> E.OutModuleFormat
getFormat outType
= failOnNothing msg $ Map.lookup outType outFileFormats
where msg = "Fatal could not find output fromat for: " ++ show outType | 201 | getFormat outType
= failOnNothing msg $ Map.lookup outType outFileFormats
where msg = "Fatal could not find output fromat for: " ++ show outType | 156 | false | true | 0 | 8 | 39 | 48 | 23 | 25 | null | null |
ndmitchell/firstify | Example.hs | bsd-3-clause | neq2 x y = not (x == y) | 23 | neq2 x y = not (x == y) | 23 | neq2 x y = not (x == y) | 23 | false | false | 1 | 7 | 7 | 26 | 10 | 16 | null | null |
FranklinChen/monadiccp | Control/CP/FD/Decompose.hs | bsd-3-clause | constIntTransInv :: EGParTerm -> ModelIntTerm ModelFunctions
constIntTransInv (EGPTParam x) = ModelIntPar x | 107 | constIntTransInv :: EGParTerm -> ModelIntTerm ModelFunctions
constIntTransInv (EGPTParam x) = ModelIntPar x | 107 | constIntTransInv (EGPTParam x) = ModelIntPar x | 46 | false | true | 0 | 7 | 11 | 30 | 14 | 16 | null | null |
hguenther/gtl | lib/Language/GTL/Target/PromelaKCG.hs | bsd-3-clause | nondetAssignRange :: String -> Integer -> Integer -> Pr.Step
nondetAssignRange var from to
= Pr.StepStmt
(Pr.prSequence [Pr.StmtCCode (var++"="++show from++";")
,Pr.prDo [[Pr.StmtCExpr Nothing (var++"<"++show to)
,Pr.StmtCCode (var++"++;")
]
,[Pr.StmtBreak]
]
])
Nothing | 433 | nondetAssignRange :: String -> Integer -> Integer -> Pr.Step
nondetAssignRange var from to
= Pr.StepStmt
(Pr.prSequence [Pr.StmtCCode (var++"="++show from++";")
,Pr.prDo [[Pr.StmtCExpr Nothing (var++"<"++show to)
,Pr.StmtCCode (var++"++;")
]
,[Pr.StmtBreak]
]
])
Nothing | 433 | nondetAssignRange var from to
= Pr.StepStmt
(Pr.prSequence [Pr.StmtCCode (var++"="++show from++";")
,Pr.prDo [[Pr.StmtCExpr Nothing (var++"<"++show to)
,Pr.StmtCCode (var++"++;")
]
,[Pr.StmtBreak]
]
])
Nothing | 372 | false | true | 0 | 14 | 193 | 132 | 67 | 65 | null | null |
GaloisInc/halvm-ghc | compiler/coreSyn/CoreUnfold.hs | bsd-3-clause | mkCompulsoryUnfolding :: CoreExpr -> Unfolding
mkCompulsoryUnfolding expr -- Used for things that absolutely must be unfolded
= mkCoreUnfolding InlineCompulsory True
(simpleOptExpr expr)
(UnfWhen { ug_arity = 0 -- Arity of unfolding doesn't matter
, ug_unsat_ok = unSaturatedOk, ug_boring_ok = boringCxtOk }) | 390 | mkCompulsoryUnfolding :: CoreExpr -> Unfolding
mkCompulsoryUnfolding expr -- Used for things that absolutely must be unfolded
= mkCoreUnfolding InlineCompulsory True
(simpleOptExpr expr)
(UnfWhen { ug_arity = 0 -- Arity of unfolding doesn't matter
, ug_unsat_ok = unSaturatedOk, ug_boring_ok = boringCxtOk }) | 390 | mkCompulsoryUnfolding expr -- Used for things that absolutely must be unfolded
= mkCoreUnfolding InlineCompulsory True
(simpleOptExpr expr)
(UnfWhen { ug_arity = 0 -- Arity of unfolding doesn't matter
, ug_unsat_ok = unSaturatedOk, ug_boring_ok = boringCxtOk }) | 343 | false | true | 0 | 8 | 122 | 58 | 33 | 25 | null | null |
hugonasciutti/Exercises | Haskell/Exercises/pratica7.hs | mit | maiusculas l = mapear (toUpper) l | 33 | maiusculas l = mapear (toUpper) l | 33 | maiusculas l = mapear (toUpper) l | 33 | false | false | 0 | 6 | 5 | 17 | 8 | 9 | null | null |
alephcloud/hs-configuration-tools | test/TestExample.hs | mit | testsInvalidUrl ∷ Int → [IO Bool]
testsInvalidUrl httpPort =
[ runTest pkgInfo mainInfo "invalidUrl-0" False [x0, d1]
, runTest pkgInfo mainInfo "invalidUrl-1" False [x1, d1]
]
where
x0 = trueAssertion ["--config-file=http://invalid"]
x1 = trueAssertion ["--config-file=" ⊕ T.unpack (serverUrl httpPort) ⊕ "/invalid"] | 339 | testsInvalidUrl ∷ Int → [IO Bool]
testsInvalidUrl httpPort =
[ runTest pkgInfo mainInfo "invalidUrl-0" False [x0, d1]
, runTest pkgInfo mainInfo "invalidUrl-1" False [x1, d1]
]
where
x0 = trueAssertion ["--config-file=http://invalid"]
x1 = trueAssertion ["--config-file=" ⊕ T.unpack (serverUrl httpPort) ⊕ "/invalid"] | 339 | testsInvalidUrl httpPort =
[ runTest pkgInfo mainInfo "invalidUrl-0" False [x0, d1]
, runTest pkgInfo mainInfo "invalidUrl-1" False [x1, d1]
]
where
x0 = trueAssertion ["--config-file=http://invalid"]
x1 = trueAssertion ["--config-file=" ⊕ T.unpack (serverUrl httpPort) ⊕ "/invalid"] | 305 | false | true | 0 | 13 | 62 | 107 | 56 | 51 | null | null |
Concelo/concelo | src/Database/Concelo/Protocol.hs | bsd-3-clause | done = prefix "d" | 17 | done = prefix "d" | 17 | done = prefix "d" | 17 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
aelve/json-x | tests/Encoders.hs | bsd-3-clause | thNullaryToEncodingString :: Nullary -> Encoding
thNullaryToEncodingString = $(mkToEncoding defaultOptions ''Nullary) | 117 | thNullaryToEncodingString :: Nullary -> Encoding
thNullaryToEncodingString = $(mkToEncoding defaultOptions ''Nullary) | 117 | thNullaryToEncodingString = $(mkToEncoding defaultOptions ''Nullary) | 68 | false | true | 0 | 8 | 9 | 26 | 13 | 13 | null | null |
juodaspaulius/clafer-old-customBNFC | src/Language/Clafer/Comments.hs | mit | getGraph' :: [String] -> Int -> [Int]
getGraph' [] _ = [] | 57 | getGraph' :: [String] -> Int -> [Int]
getGraph' [] _ = [] | 57 | getGraph' [] _ = [] | 19 | false | true | 0 | 7 | 11 | 34 | 18 | 16 | null | null |
mihaimaruseac/blog-demos | pokemon/pokemon.hs | mit | -- -----------------------
test_3_amazes_nogrt = f 3 37 45 0 7 | 64 | test_3_amazes_nogrt = f 3 37 45 0 7 | 37 | test_3_amazes_nogrt = f 3 37 45 0 7 | 37 | true | false | 0 | 5 | 11 | 18 | 9 | 9 | null | null |
curiousily/haskell-99problems | 47.hs | mit | xor' :: Bool -> Bool -> Bool
xor' True _ = True | 47 | xor' :: Bool -> Bool -> Bool
xor' True _ = True | 47 | xor' True _ = True | 18 | false | true | 0 | 8 | 11 | 30 | 13 | 17 | null | null |
Numberartificial/workflow | haskell-first-principles/haskell-programming-from-first-principles-master/src/Addition.hs | mit | propAdditionGreater :: Int -> Bool
propAdditionGreater x = x + 1 > x | 68 | propAdditionGreater :: Int -> Bool
propAdditionGreater x = x + 1 > x | 68 | propAdditionGreater x = x + 1 > x | 33 | false | true | 4 | 7 | 12 | 34 | 14 | 20 | null | null |
GaloisInc/halvm-ghc | compiler/codeGen/StgCmmUtils.hs | bsd-3-clause | addToMemE :: CmmType -- rep of the counter
-> CmmExpr -- Address
-> CmmExpr -- What to add (a word-typed expression)
-> CmmAGraph
addToMemE rep ptr n
= mkStore ptr (CmmMachOp (MO_Add (typeWidth rep)) [CmmLoad ptr rep, n]) | 262 | addToMemE :: CmmType -- rep of the counter
-> CmmExpr -- Address
-> CmmExpr -- What to add (a word-typed expression)
-> CmmAGraph
addToMemE rep ptr n
= mkStore ptr (CmmMachOp (MO_Add (typeWidth rep)) [CmmLoad ptr rep, n]) | 262 | addToMemE rep ptr n
= mkStore ptr (CmmMachOp (MO_Add (typeWidth rep)) [CmmLoad ptr rep, n]) | 93 | false | true | 0 | 11 | 78 | 69 | 36 | 33 | null | null |
thoughtpolice/hs-leveldb | examples/ffi_test.hs | bsd-3-clause | sfree :: Ptr CString -> IO ()
sfree p = do
x <- peek p
when (x /= nullPtr) $ do
free x | 94 | sfree :: Ptr CString -> IO ()
sfree p = do
x <- peek p
when (x /= nullPtr) $ do
free x | 94 | sfree p = do
x <- peek p
when (x /= nullPtr) $ do
free x | 64 | false | true | 0 | 10 | 30 | 59 | 26 | 33 | null | null |
ocramz/sparse-linear-algebra | accelerate/src/Numeric/LinearAlgebra/Sparse/Accelerate.hs | gpl-3.0 | sortWith :: (Ord b, PrimMonad m) => (a -> b) -> V.Vector a -> m (V.Vector a)
sortWith by v = do
vm <- V.thaw v
sortBy (comparing by) vm
V.freeze vm
-- Sparse-matrix vector multiplication
-- -----------------------------------
-- type SparseVector e = Vector (A.Int32, e)
-- type SparseMatrix e = (Segments A.Int32, SparseVector e)
-- smvm :: A.Num a => Acc (SparseMatrix a) -> Acc (Vector a) -> Acc (Vector a)
-- smvm smat vec
-- = let (segd, svec) = A.unlift smat
-- (inds, vals) = A.unzip svec
-- -- vecVals = A.gather (A.map A.fromIntegral inds) vec
-- vecVals = A.backpermute
-- (A.shape inds)
-- (\i -> A.index1 $ A.fromIntegral $ inds A.! i)
-- vec
-- products = A.zipWith (*) vecVals vals
-- in
-- A.foldSeg (+) 0 products segd
-- sv0 :: A.Array DIM1 (Int, Int)
-- sv0 = A.fromList (Z :. 5) $ zip [0,1,3,4,6] [4 ..] | 999 | sortWith :: (Ord b, PrimMonad m) => (a -> b) -> V.Vector a -> m (V.Vector a)
sortWith by v = do
vm <- V.thaw v
sortBy (comparing by) vm
V.freeze vm
-- Sparse-matrix vector multiplication
-- -----------------------------------
-- type SparseVector e = Vector (A.Int32, e)
-- type SparseMatrix e = (Segments A.Int32, SparseVector e)
-- smvm :: A.Num a => Acc (SparseMatrix a) -> Acc (Vector a) -> Acc (Vector a)
-- smvm smat vec
-- = let (segd, svec) = A.unlift smat
-- (inds, vals) = A.unzip svec
-- -- vecVals = A.gather (A.map A.fromIntegral inds) vec
-- vecVals = A.backpermute
-- (A.shape inds)
-- (\i -> A.index1 $ A.fromIntegral $ inds A.! i)
-- vec
-- products = A.zipWith (*) vecVals vals
-- in
-- A.foldSeg (+) 0 products segd
-- sv0 :: A.Array DIM1 (Int, Int)
-- sv0 = A.fromList (Z :. 5) $ zip [0,1,3,4,6] [4 ..] | 999 | sortWith by v = do
vm <- V.thaw v
sortBy (comparing by) vm
V.freeze vm
-- Sparse-matrix vector multiplication
-- -----------------------------------
-- type SparseVector e = Vector (A.Int32, e)
-- type SparseMatrix e = (Segments A.Int32, SparseVector e)
-- smvm :: A.Num a => Acc (SparseMatrix a) -> Acc (Vector a) -> Acc (Vector a)
-- smvm smat vec
-- = let (segd, svec) = A.unlift smat
-- (inds, vals) = A.unzip svec
-- -- vecVals = A.gather (A.map A.fromIntegral inds) vec
-- vecVals = A.backpermute
-- (A.shape inds)
-- (\i -> A.index1 $ A.fromIntegral $ inds A.! i)
-- vec
-- products = A.zipWith (*) vecVals vals
-- in
-- A.foldSeg (+) 0 products segd
-- sv0 :: A.Array DIM1 (Int, Int)
-- sv0 = A.fromList (Z :. 5) $ zip [0,1,3,4,6] [4 ..] | 922 | false | true | 0 | 11 | 328 | 114 | 63 | 51 | null | null |
rueshyna/gogol | gogol-analytics/gen/Network/Google/Analytics/Types/Product.hs | mpl-2.0 | -- | Account ID.
cddAccountId :: Lens' CustomDimension (Maybe Text)
cddAccountId
= lens _cddAccountId (\ s a -> s{_cddAccountId = a}) | 135 | cddAccountId :: Lens' CustomDimension (Maybe Text)
cddAccountId
= lens _cddAccountId (\ s a -> s{_cddAccountId = a}) | 118 | cddAccountId
= lens _cddAccountId (\ s a -> s{_cddAccountId = a}) | 67 | true | true | 0 | 9 | 22 | 48 | 25 | 23 | null | null |
hpdeifel/dbus-browser | src/Unparse.hs | bsd-3-clause | -- | Add subexpression to the right
(+>) :: String -> (Side -> String) -> String
(+>) s f = s ++ f RightSide | 108 | (+>) :: String -> (Side -> String) -> String
(+>) s f = s ++ f RightSide | 72 | (+>) s f = s ++ f RightSide | 27 | true | true | 2 | 9 | 23 | 50 | 25 | 25 | null | null |
jcpetruzza/haskell-ast | src/Language/Haskell/AST/HSE.hs | bsd-3-clause | fromHseImportSpecList :: Parsed_ E.ImportSpecList -> Parsed Core.ImportSpecList
fromHseImportSpecList (E.ImportSpecList l b iss) = Core.ImportSpecList l b (map fromHseImportSpec iss) | 182 | fromHseImportSpecList :: Parsed_ E.ImportSpecList -> Parsed Core.ImportSpecList
fromHseImportSpecList (E.ImportSpecList l b iss) = Core.ImportSpecList l b (map fromHseImportSpec iss) | 182 | fromHseImportSpecList (E.ImportSpecList l b iss) = Core.ImportSpecList l b (map fromHseImportSpec iss) | 102 | false | true | 0 | 10 | 18 | 61 | 28 | 33 | null | null |
basvandijk/string-combinators | Data/String/Combinators.hs | bsd-3-clause | -- | A '{' character.
lbrace :: IsString s => s
lbrace = char '{' | 65 | lbrace :: IsString s => s
lbrace = char '{' | 43 | lbrace = char '{' | 17 | true | true | 0 | 6 | 14 | 22 | 11 | 11 | null | null |
jfischoff/Sharpen | src/Numeric/MaxEnt/Deconvolution/Convolution2D.hs | bsd-3-clause | toConvolve2DZeroBoundary :: r -> Matrix r -> Matrix r
toConvolve2DZeroBoundary zero mat = result where
result = fromBlocks' . toConvolveZeroBoundary
(zeroMatrix zero (dimensions innerMat)) $ innerMat
innerMat = map (toConvolveZeroBoundary zero) $ columns
columns = transpose mat
-- convert the input matrix input a column vector | 366 | toConvolve2DZeroBoundary :: r -> Matrix r -> Matrix r
toConvolve2DZeroBoundary zero mat = result where
result = fromBlocks' . toConvolveZeroBoundary
(zeroMatrix zero (dimensions innerMat)) $ innerMat
innerMat = map (toConvolveZeroBoundary zero) $ columns
columns = transpose mat
-- convert the input matrix input a column vector | 366 | toConvolve2DZeroBoundary zero mat = result where
result = fromBlocks' . toConvolveZeroBoundary
(zeroMatrix zero (dimensions innerMat)) $ innerMat
innerMat = map (toConvolveZeroBoundary zero) $ columns
columns = transpose mat
-- convert the input matrix input a column vector | 312 | false | true | 0 | 13 | 83 | 89 | 44 | 45 | null | null |
ardumont/write-yourself-a-scheme-lab | Scheme/Type.hs | gpl-2.0 | showVal :: LispVal -> String
showVal (String s) = "\"" ++ s ++ "\"" | 87 | showVal :: LispVal -> String
showVal (String s) = "\"" ++ s ++ "\"" | 87 | showVal (String s) = "\"" ++ s ++ "\"" | 58 | false | true | 0 | 6 | 33 | 36 | 17 | 19 | null | null |
Philonous/hs-otr | source/Otr.hs | mit | bob3 :: OtrSignatureMessage -> Otr g ()
bob3 (SM xaEncrypted xaSha256Mac) = do
aState <- OtrT $ gets authState
case aState of
AuthStateAwaitingSig -> return ()
_ -> throwError $ WrongState
checkAndSaveAuthMessage KeysSM (SM xaEncrypted xaSha256Mac)
putAuthState AuthStateNone
putMsgState MsgStateEncrypted
return () | 355 | bob3 :: OtrSignatureMessage -> Otr g ()
bob3 (SM xaEncrypted xaSha256Mac) = do
aState <- OtrT $ gets authState
case aState of
AuthStateAwaitingSig -> return ()
_ -> throwError $ WrongState
checkAndSaveAuthMessage KeysSM (SM xaEncrypted xaSha256Mac)
putAuthState AuthStateNone
putMsgState MsgStateEncrypted
return () | 355 | bob3 (SM xaEncrypted xaSha256Mac) = do
aState <- OtrT $ gets authState
case aState of
AuthStateAwaitingSig -> return ()
_ -> throwError $ WrongState
checkAndSaveAuthMessage KeysSM (SM xaEncrypted xaSha256Mac)
putAuthState AuthStateNone
putMsgState MsgStateEncrypted
return () | 315 | false | true | 0 | 11 | 81 | 111 | 49 | 62 | null | null |
Teaspot-Studio/Urho3D-Haskell | src/Graphics/Urho3D/Graphics/Camera.hs | mit | cameraGetLodDistance :: (Parent Camera a, Pointer p a, MonadIO m) => p -- ^ Camera pointer or child
-> Float -- ^ distance
-> Float -- ^ scale
-> Float -- ^ bias
-> m Float
cameraGetLodDistance p distance scale bias = liftIO $ do
let ptr = parentPointer p
distance' = realToFrac distance
scale' = realToFrac scale
bias' = realToFrac bias
realToFrac <$> [C.exp| float {$(Camera* ptr)->GetLodDistance($(float distance'), $(float scale'), $(float bias'))} |]
-- | Return a world rotation for facing a camera on certain axes based on the existing world rotation.
-- Quaternion GetFaceCameraRotation(const Vector3& position, const Quaternion& rotation, FaceCameraMode mode, float minAngle = 0.0f); | 723 | cameraGetLodDistance :: (Parent Camera a, Pointer p a, MonadIO m) => p -- ^ Camera pointer or child
-> Float -- ^ distance
-> Float -- ^ scale
-> Float -- ^ bias
-> m Float
cameraGetLodDistance p distance scale bias = liftIO $ do
let ptr = parentPointer p
distance' = realToFrac distance
scale' = realToFrac scale
bias' = realToFrac bias
realToFrac <$> [C.exp| float {$(Camera* ptr)->GetLodDistance($(float distance'), $(float scale'), $(float bias'))} |]
-- | Return a world rotation for facing a camera on certain axes based on the existing world rotation.
-- Quaternion GetFaceCameraRotation(const Vector3& position, const Quaternion& rotation, FaceCameraMode mode, float minAngle = 0.0f); | 723 | cameraGetLodDistance p distance scale bias = liftIO $ do
let ptr = parentPointer p
distance' = realToFrac distance
scale' = realToFrac scale
bias' = realToFrac bias
realToFrac <$> [C.exp| float {$(Camera* ptr)->GetLodDistance($(float distance'), $(float scale'), $(float bias'))} |]
-- | Return a world rotation for facing a camera on certain axes based on the existing world rotation.
-- Quaternion GetFaceCameraRotation(const Vector3& position, const Quaternion& rotation, FaceCameraMode mode, float minAngle = 0.0f); | 542 | false | true | 0 | 11 | 137 | 128 | 66 | 62 | null | null |
Mathnerd314/lamdu | src/Lamdu/CodeEdit/ExpressionEdit/BuiltinEdit.hs | gpl-3.0 | make
:: MonadA m
=> Sugar.DefinitionBuiltin m (ExprGuiM.SugarExpr m)
-> Widget.Id
-> ExprGuiM m (WidgetT m)
make (Sugar.DefinitionBuiltin (Definition.FFIName modulePath name) setFFIName _) myId =
ExprGuiM.assignCursor myId (WidgetIds.builtinFFIName myId) $ do
config <- ExprGuiM.widgetEnv WE.readConfig
moduleName <-
makeNamePartEditor (Config.foreignModuleColor config)
modulePathStr modulePathSetter WidgetIds.builtinFFIPath
varName <-
makeNamePartEditor (Config.foreignVarColor config) name nameSetter
WidgetIds.builtinFFIName
dot <- ExprGuiM.widgetEnv . BWidgets.makeLabel "." $ Widget.toAnimId myId
return $ Box.hboxCentered [moduleName, dot, varName]
where
makeNamePartEditor color namePartStr mSetter makeWidgetId =
ExprGuiM.withFgColor color .
ExprGuiM.wrapDelegated builtinFDConfig FocusDelegator.NotDelegating id
(ExprGuiM.widgetEnv . maybe
(BWidgets.makeTextViewWidget namePartStr . Widget.toAnimId)
(BWidgets.makeWordEdit . Property namePartStr) mSetter) $
makeWidgetId myId
maybeSetter = (`fmap` setFFIName)
modulePathStr = List.intercalate "." modulePath
modulePathSetter = maybeSetter $ \ffiNameSetter ->
ffiNameSetter . (`Definition.FFIName` name) . splitOn "."
nameSetter = maybeSetter $ \ffiNameSetter -> ffiNameSetter . Definition.FFIName modulePath | 1,388 | make
:: MonadA m
=> Sugar.DefinitionBuiltin m (ExprGuiM.SugarExpr m)
-> Widget.Id
-> ExprGuiM m (WidgetT m)
make (Sugar.DefinitionBuiltin (Definition.FFIName modulePath name) setFFIName _) myId =
ExprGuiM.assignCursor myId (WidgetIds.builtinFFIName myId) $ do
config <- ExprGuiM.widgetEnv WE.readConfig
moduleName <-
makeNamePartEditor (Config.foreignModuleColor config)
modulePathStr modulePathSetter WidgetIds.builtinFFIPath
varName <-
makeNamePartEditor (Config.foreignVarColor config) name nameSetter
WidgetIds.builtinFFIName
dot <- ExprGuiM.widgetEnv . BWidgets.makeLabel "." $ Widget.toAnimId myId
return $ Box.hboxCentered [moduleName, dot, varName]
where
makeNamePartEditor color namePartStr mSetter makeWidgetId =
ExprGuiM.withFgColor color .
ExprGuiM.wrapDelegated builtinFDConfig FocusDelegator.NotDelegating id
(ExprGuiM.widgetEnv . maybe
(BWidgets.makeTextViewWidget namePartStr . Widget.toAnimId)
(BWidgets.makeWordEdit . Property namePartStr) mSetter) $
makeWidgetId myId
maybeSetter = (`fmap` setFFIName)
modulePathStr = List.intercalate "." modulePath
modulePathSetter = maybeSetter $ \ffiNameSetter ->
ffiNameSetter . (`Definition.FFIName` name) . splitOn "."
nameSetter = maybeSetter $ \ffiNameSetter -> ffiNameSetter . Definition.FFIName modulePath | 1,388 | make (Sugar.DefinitionBuiltin (Definition.FFIName modulePath name) setFFIName _) myId =
ExprGuiM.assignCursor myId (WidgetIds.builtinFFIName myId) $ do
config <- ExprGuiM.widgetEnv WE.readConfig
moduleName <-
makeNamePartEditor (Config.foreignModuleColor config)
modulePathStr modulePathSetter WidgetIds.builtinFFIPath
varName <-
makeNamePartEditor (Config.foreignVarColor config) name nameSetter
WidgetIds.builtinFFIName
dot <- ExprGuiM.widgetEnv . BWidgets.makeLabel "." $ Widget.toAnimId myId
return $ Box.hboxCentered [moduleName, dot, varName]
where
makeNamePartEditor color namePartStr mSetter makeWidgetId =
ExprGuiM.withFgColor color .
ExprGuiM.wrapDelegated builtinFDConfig FocusDelegator.NotDelegating id
(ExprGuiM.widgetEnv . maybe
(BWidgets.makeTextViewWidget namePartStr . Widget.toAnimId)
(BWidgets.makeWordEdit . Property namePartStr) mSetter) $
makeWidgetId myId
maybeSetter = (`fmap` setFFIName)
modulePathStr = List.intercalate "." modulePath
modulePathSetter = maybeSetter $ \ffiNameSetter ->
ffiNameSetter . (`Definition.FFIName` name) . splitOn "."
nameSetter = maybeSetter $ \ffiNameSetter -> ffiNameSetter . Definition.FFIName modulePath | 1,272 | false | true | 4 | 15 | 246 | 387 | 189 | 198 | null | null |
mudphone/HaskellBook | hangman/src/Main.hs | mit | minWordLength :: Int
minWordLength = 5 | 38 | minWordLength :: Int
minWordLength = 5 | 38 | minWordLength = 5 | 17 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
rueshyna/gogol | gogol-prediction/gen/Network/Google/Prediction/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'InsertTrainingInstancesItem' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'itiiCSVInstance'
--
-- * 'itiiOutput'
insertTrainingInstancesItem
:: InsertTrainingInstancesItem
insertTrainingInstancesItem =
InsertTrainingInstancesItem'
{ _itiiCSVInstance = Nothing
, _itiiOutput = Nothing
} | 418 | insertTrainingInstancesItem
:: InsertTrainingInstancesItem
insertTrainingInstancesItem =
InsertTrainingInstancesItem'
{ _itiiCSVInstance = Nothing
, _itiiOutput = Nothing
} | 192 | insertTrainingInstancesItem =
InsertTrainingInstancesItem'
{ _itiiCSVInstance = Nothing
, _itiiOutput = Nothing
} | 129 | true | true | 0 | 6 | 72 | 32 | 22 | 10 | null | null |
DavidAlphaFox/ghc | libraries/containers/Data/Set/Base.hs | bsd-3-clause | findMin Tip = error "Set.findMin: empty set has no minimal element" | 79 | findMin Tip = error "Set.findMin: empty set has no minimal element" | 79 | findMin Tip = error "Set.findMin: empty set has no minimal element" | 79 | false | false | 0 | 5 | 22 | 12 | 5 | 7 | null | null |
brendanhay/gogol | gogol-accesscontextmanager/gen/Network/Google/Resource/AccessContextManager/AccessPolicies/ServicePerimeters/Create.hs | mpl-2.0 | -- | Required. Resource name for the access policy which owns this Service
-- Perimeter. Format: \`accessPolicies\/{policy_id}\`
apspcParent :: Lens' AccessPoliciesServicePerimetersCreate Text
apspcParent
= lens _apspcParent (\ s a -> s{_apspcParent = a}) | 257 | apspcParent :: Lens' AccessPoliciesServicePerimetersCreate Text
apspcParent
= lens _apspcParent (\ s a -> s{_apspcParent = a}) | 128 | apspcParent
= lens _apspcParent (\ s a -> s{_apspcParent = a}) | 64 | true | true | 0 | 9 | 34 | 43 | 23 | 20 | null | null |
bacchanalia/KitchenSink | KitchenSink/Qualified.hs | gpl-3.0 | -- |'MapS.updateMinWithKey'
ms_updateMinWithKey = MapS.updateMinWithKey | 71 | ms_updateMinWithKey = MapS.updateMinWithKey | 43 | ms_updateMinWithKey = MapS.updateMinWithKey | 43 | true | false | 0 | 5 | 4 | 9 | 5 | 4 | null | null |
uuhan/Idris-dev | src/Idris/Primitives.hs | bsd-3-clause | bsBin _ _ = Nothing | 19 | bsBin _ _ = Nothing | 19 | bsBin _ _ = Nothing | 19 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
jtojnar/haste-compiler | libraries/ghc-7.10/ghc-prim/GHC/PrimopWrappers.hs | bsd-3-clause | writeWord64Array# :: MutableByteArray# s -> Int# -> Word64# -> State# s -> State# s
writeWord64Array# a1 a2 a3 a4 = (GHC.Prim.writeWord64Array#) a1 a2 a3 a4 | 156 | writeWord64Array# :: MutableByteArray# s -> Int# -> Word64# -> State# s -> State# s
writeWord64Array# a1 a2 a3 a4 = (GHC.Prim.writeWord64Array#) a1 a2 a3 a4 | 156 | writeWord64Array# a1 a2 a3 a4 = (GHC.Prim.writeWord64Array#) a1 a2 a3 a4 | 72 | false | true | 0 | 9 | 24 | 60 | 29 | 31 | null | null |
letsbreelhere/egg | src/Data/Expr.hs | bsd-3-clause | freeVariables :: String -> ExprTrans (Set String)
freeVariables bound (_ :< expr) = case expr of
Var e | e /= bound -> Set.singleton e
e1 :@: e2 -> foldMap (freeVariables bound) [e1,e2]
BinOp _ e1 e2 -> foldMap (freeVariables bound) [e1,e2]
If e1 e2 e3 -> foldMap (freeVariables bound) [e1,e2,e3]
Lam bound' e -> Set.delete bound $ freeVariables bound' e
_ -> Set.empty | 425 | freeVariables :: String -> ExprTrans (Set String)
freeVariables bound (_ :< expr) = case expr of
Var e | e /= bound -> Set.singleton e
e1 :@: e2 -> foldMap (freeVariables bound) [e1,e2]
BinOp _ e1 e2 -> foldMap (freeVariables bound) [e1,e2]
If e1 e2 e3 -> foldMap (freeVariables bound) [e1,e2,e3]
Lam bound' e -> Set.delete bound $ freeVariables bound' e
_ -> Set.empty | 425 | freeVariables bound (_ :< expr) = case expr of
Var e | e /= bound -> Set.singleton e
e1 :@: e2 -> foldMap (freeVariables bound) [e1,e2]
BinOp _ e1 e2 -> foldMap (freeVariables bound) [e1,e2]
If e1 e2 e3 -> foldMap (freeVariables bound) [e1,e2,e3]
Lam bound' e -> Set.delete bound $ freeVariables bound' e
_ -> Set.empty | 375 | false | true | 0 | 11 | 119 | 192 | 92 | 100 | null | null |
cartazio/omega | mosaic/finally-predicative.hs | bsd-3-clause | pl2a = pla $ \x -> pla $ \y -> cnst 45 | 38 | pl2a = pla $ \x -> pla $ \y -> cnst 45 | 38 | pl2a = pla $ \x -> pla $ \y -> cnst 45 | 38 | false | false | 5 | 5 | 11 | 33 | 14 | 19 | null | null |
brendanhay/gogol | gogol-apps-reseller/gen/Network/Google/AppsReseller/Types/Product.hs | mpl-2.0 | -- | Renewal settings for the annual commitment plan. For more detailed
-- information, see renewal options in the administrator help center.
subRenewalSettings :: Lens' Subscription (Maybe RenewalSettings)
subRenewalSettings
= lens _subRenewalSettings
(\ s a -> s{_subRenewalSettings = a}) | 298 | subRenewalSettings :: Lens' Subscription (Maybe RenewalSettings)
subRenewalSettings
= lens _subRenewalSettings
(\ s a -> s{_subRenewalSettings = a}) | 156 | subRenewalSettings
= lens _subRenewalSettings
(\ s a -> s{_subRenewalSettings = a}) | 91 | true | true | 0 | 9 | 46 | 49 | 26 | 23 | null | null |
haskell-distributed/distributed-process-client-server | src/Control/Distributed/Process/ManagedProcess/Server.hs | bsd-3-clause | -- | Version of 'handleControlChan' that ignores the server state.
--
handleControlChan_ :: forall s a. (Serializable a)
=> ControlChannel a
-> StatelessHandler s a
-> ExternDispatcher s
handleControlChan_ chan h
= DispatchCC { channel = snd $ unControl chan
, dispatchChan = \s ((CastMessage p) :: Message a ()) -> h p s
} | 393 | handleControlChan_ :: forall s a. (Serializable a)
=> ControlChannel a
-> StatelessHandler s a
-> ExternDispatcher s
handleControlChan_ chan h
= DispatchCC { channel = snd $ unControl chan
, dispatchChan = \s ((CastMessage p) :: Message a ()) -> h p s
} | 323 | handleControlChan_ chan h
= DispatchCC { channel = snd $ unControl chan
, dispatchChan = \s ((CastMessage p) :: Message a ()) -> h p s
} | 173 | true | true | 0 | 12 | 124 | 113 | 57 | 56 | null | null |
Concomitant/LambdaHack | Game/LambdaHack/Common/ActorState.hs | bsd-3-clause | actorAssocs :: (FactionId -> Bool) -> LevelId -> State
-> [(ActorId, Actor)]
actorAssocs p lid s =
actorAssocsLvl p (sdungeon s EM.! lid) (sactorD s) | 163 | actorAssocs :: (FactionId -> Bool) -> LevelId -> State
-> [(ActorId, Actor)]
actorAssocs p lid s =
actorAssocsLvl p (sdungeon s EM.! lid) (sactorD s) | 163 | actorAssocs p lid s =
actorAssocsLvl p (sdungeon s EM.! lid) (sactorD s) | 74 | false | true | 0 | 9 | 38 | 71 | 37 | 34 | null | null |
paulp/unison | parser-typechecker/src/Unison/ABT.hs | mit | fresh :: Var v => Term f v a -> v -> v
fresh t = fresh' (freeVars t) | 68 | fresh :: Var v => Term f v a -> v -> v
fresh t = fresh' (freeVars t) | 68 | fresh t = fresh' (freeVars t) | 29 | false | true | 0 | 7 | 18 | 45 | 21 | 24 | null | null |
brendanhay/gogol | gogol-datastore/gen/Network/Google/Datastore/Types/Product.hs | mpl-2.0 | -- | Required. The indexed property\'s direction. Must not be
-- DIRECTION_UNSPECIFIED.
gdavipDirection :: Lens' GoogleDatastoreAdminV1IndexedProperty (Maybe GoogleDatastoreAdminV1IndexedPropertyDirection)
gdavipDirection
= lens _gdavipDirection
(\ s a -> s{_gdavipDirection = a}) | 288 | gdavipDirection :: Lens' GoogleDatastoreAdminV1IndexedProperty (Maybe GoogleDatastoreAdminV1IndexedPropertyDirection)
gdavipDirection
= lens _gdavipDirection
(\ s a -> s{_gdavipDirection = a}) | 200 | gdavipDirection
= lens _gdavipDirection
(\ s a -> s{_gdavipDirection = a}) | 82 | true | true | 0 | 9 | 36 | 49 | 26 | 23 | null | null |
ezyang/ghc | testsuite/tests/gadt/T9380.hs | bsd-3-clause | test2 :: IO ()
test2 =
let s = cast A (SomeS (S 4))
in case viewV1 s of
V1A{} -> putStrLn "test2 - A"
V1B{} -> putStrLn "test2 - B"
V1a{} -> putStrLn "test2 - O_o" | 185 | test2 :: IO ()
test2 =
let s = cast A (SomeS (S 4))
in case viewV1 s of
V1A{} -> putStrLn "test2 - A"
V1B{} -> putStrLn "test2 - B"
V1a{} -> putStrLn "test2 - O_o" | 185 | test2 =
let s = cast A (SomeS (S 4))
in case viewV1 s of
V1A{} -> putStrLn "test2 - A"
V1B{} -> putStrLn "test2 - B"
V1a{} -> putStrLn "test2 - O_o" | 170 | false | true | 0 | 13 | 58 | 95 | 43 | 52 | null | null |
penteract/HigherOrderHornRefinement | HOCHC/FormulaChecks.hs | bsd-3-clause | isRelational (Arrow Int rho) = isRelational rho | 47 | isRelational (Arrow Int rho) = isRelational rho | 47 | isRelational (Arrow Int rho) = isRelational rho | 47 | false | false | 0 | 7 | 6 | 20 | 9 | 11 | null | null |
nbloomf/carl | test/Tests/Lib/Data/ZZModulo.hs | gpl-3.0 | arbModulus :: Gen Int
arbModulus = choose (2, gMAX_MODULUS) | 59 | arbModulus :: Gen Int
arbModulus = choose (2, gMAX_MODULUS) | 59 | arbModulus = choose (2, gMAX_MODULUS) | 37 | false | true | 0 | 6 | 8 | 28 | 13 | 15 | null | null |
rahulmutt/ghcvm | libraries/eta-meta/Language/Eta/Meta/Syntax.hs | bsd-3-clause | mk_unboxed_tup_name :: Int -> NameSpace -> Name
mk_unboxed_tup_name n_commas space
= Name occ (NameG space (mkPkgName "ghc-prim") tup_mod)
where
occ = mkOccName ("(#" ++ replicate n_commas ',' ++ "#)")
tup_mod = mkModName "GHC.Tuple"
-----------------------------------------------------
--
-- The Info returned by reification
--
-----------------------------------------------------
-- | Obtained from 'reify' in the 'Q' Monad. | 447 | mk_unboxed_tup_name :: Int -> NameSpace -> Name
mk_unboxed_tup_name n_commas space
= Name occ (NameG space (mkPkgName "ghc-prim") tup_mod)
where
occ = mkOccName ("(#" ++ replicate n_commas ',' ++ "#)")
tup_mod = mkModName "GHC.Tuple"
-----------------------------------------------------
--
-- The Info returned by reification
--
-----------------------------------------------------
-- | Obtained from 'reify' in the 'Q' Monad. | 447 | mk_unboxed_tup_name n_commas space
= Name occ (NameG space (mkPkgName "ghc-prim") tup_mod)
where
occ = mkOccName ("(#" ++ replicate n_commas ',' ++ "#)")
tup_mod = mkModName "GHC.Tuple"
-----------------------------------------------------
--
-- The Info returned by reification
--
-----------------------------------------------------
-- | Obtained from 'reify' in the 'Q' Monad. | 399 | false | true | 1 | 9 | 70 | 86 | 45 | 41 | null | null |
rvion/ride | jetpack/src/System/IO/AsEnv.hs | bsd-3-clause | -- env_hReady :: Handle -> IO Bool
env_hReady = I.hReady | 56 | env_hReady = I.hReady | 21 | env_hReady = I.hReady | 21 | true | false | 0 | 5 | 9 | 9 | 5 | 4 | null | null |
kmels/hledger | hledger-lib/Hledger/Data/Journal.hs | gpl-3.0 | checkBalanceAssertionsForAccount :: [Posting] -> Either String ()
checkBalanceAssertionsForAccount ps
| null errs = Right ()
| otherwise = Left $ head errs
where
errs = fst $
foldl' checkBalanceAssertion ([],nullmixedamt) $
splitAssertions $
sortBy (comparing postingDate) ps
-- Given a starting balance, accumulated errors, and a non-null sequence of
-- postings to a single account with a balance assertion in the last:
-- check that the final balance matches the balance assertion.
-- If it does, return the new balance, otherwise add an error to the
-- error list. Intended to be called from a fold. | 647 | checkBalanceAssertionsForAccount :: [Posting] -> Either String ()
checkBalanceAssertionsForAccount ps
| null errs = Right ()
| otherwise = Left $ head errs
where
errs = fst $
foldl' checkBalanceAssertion ([],nullmixedamt) $
splitAssertions $
sortBy (comparing postingDate) ps
-- Given a starting balance, accumulated errors, and a non-null sequence of
-- postings to a single account with a balance assertion in the last:
-- check that the final balance matches the balance assertion.
-- If it does, return the new balance, otherwise add an error to the
-- error list. Intended to be called from a fold. | 647 | checkBalanceAssertionsForAccount ps
| null errs = Right ()
| otherwise = Left $ head errs
where
errs = fst $
foldl' checkBalanceAssertion ([],nullmixedamt) $
splitAssertions $
sortBy (comparing postingDate) ps
-- Given a starting balance, accumulated errors, and a non-null sequence of
-- postings to a single account with a balance assertion in the last:
-- check that the final balance matches the balance assertion.
-- If it does, return the new balance, otherwise add an error to the
-- error list. Intended to be called from a fold. | 581 | false | true | 1 | 10 | 139 | 105 | 53 | 52 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.