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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
shlevy/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | gt_RDR = varQual_RDR gHC_CLASSES (fsLit ">") | 62 | gt_RDR = varQual_RDR gHC_CLASSES (fsLit ">") | 62 | gt_RDR = varQual_RDR gHC_CLASSES (fsLit ">") | 62 | false | false | 0 | 7 | 23 | 17 | 8 | 9 | null | null |
rgaiacs/pandoc | src/Text/Pandoc/Writers/RST.hs | gpl-2.0 | blockToRST (OrderedList (start, style', delim) items) = do
let markers = if start == 1 && style' == DefaultStyle && delim == DefaultDelim
then take (length items) $ repeat "#."
else take (length items) $ orderedListMarkers
(start, style', delim)
let maxMarkerLength = maximum $ map length markers
let markers' = map (\m -> let s = maxMarkerLength - length m
in m ++ replicate s ' ') markers
contents <- mapM (\(item, num) -> orderedListItemToRST item num) $
zip markers' items
-- ensure that sublists have preceding blank line
return $ blankline $$ chomp (vcat contents) $$ blankline | 722 | blockToRST (OrderedList (start, style', delim) items) = do
let markers = if start == 1 && style' == DefaultStyle && delim == DefaultDelim
then take (length items) $ repeat "#."
else take (length items) $ orderedListMarkers
(start, style', delim)
let maxMarkerLength = maximum $ map length markers
let markers' = map (\m -> let s = maxMarkerLength - length m
in m ++ replicate s ' ') markers
contents <- mapM (\(item, num) -> orderedListItemToRST item num) $
zip markers' items
-- ensure that sublists have preceding blank line
return $ blankline $$ chomp (vcat contents) $$ blankline | 722 | blockToRST (OrderedList (start, style', delim) items) = do
let markers = if start == 1 && style' == DefaultStyle && delim == DefaultDelim
then take (length items) $ repeat "#."
else take (length items) $ orderedListMarkers
(start, style', delim)
let maxMarkerLength = maximum $ map length markers
let markers' = map (\m -> let s = maxMarkerLength - length m
in m ++ replicate s ' ') markers
contents <- mapM (\(item, num) -> orderedListItemToRST item num) $
zip markers' items
-- ensure that sublists have preceding blank line
return $ blankline $$ chomp (vcat contents) $$ blankline | 722 | false | false | 4 | 13 | 236 | 223 | 115 | 108 | null | null |
charleso/haskell-in-haste | src/Chat/Bot/Vote.hs | bsd-3-clause | {-
LEVEL: Medium
USAGE: /poll question answer answer answer
USAGE: /poll
USAGE: /vote answer
Create a poll for people to vote on.
EXAMPLE:
> /poll Tabs or Spaces? Tabs Spaces
Poll created
> /vote Tabs
> /vote Spaces
> /vote Tabs
> /poll
Tabs or Spaces? Tabs: 2 Spaces: 1
-}
-- See Misc/Vote.hs
{-
data Vote = Vote String Int
data Poll = Poll String [Vote]
-}
-- |
--
-- >>> createPoll "Tabs" ["Yes","No"]
-- Poll "Tabs" [Vote "Yes" 0,Vote "No" 0]
--
-- HINTS:
--
-- map :: (String -> Vote) -> [String] -> [Vote]
--
createPoll :: String -> [String] -> Poll
createPoll question options =
notImplemented "Vote.createPoll" (createPollAnswer question options) | 707 | createPoll :: String -> [String] -> Poll
createPoll question options =
notImplemented "Vote.createPoll" (createPollAnswer question options) | 141 | createPoll question options =
notImplemented "Vote.createPoll" (createPollAnswer question options) | 100 | true | true | 0 | 7 | 167 | 52 | 32 | 20 | null | null |
alanz/hroq | src/Data/Concurrent/Queue/Roq/Mnesia.hs | bsd-3-clause | handleDirtyReadQ :: State -> DirtyReadQ -> Process (ProcessReply (Maybe QEntry) State)
handleDirtyReadQ s (DirtyReadQ tableName key) = do
logt $ "handleDirtyReadQ starting"
res <- do_dirty_read_q tableName key
logt $ "handleDirtyReadQ done"
reply res s
{-
handleDirtyReadLS :: State -> DirtyReadLS -> Process (ProcessReply (Maybe ConsumerMessage) State)
handleDirtyReadLS s (DirtyReadLS consumerName key) = do
logt $ "handleDirtyReadLS starting"
res <- do_dirty_read_ls consumerName key
logt $ "handleDirtyReadLS done"
reply res s
-} | 566 | handleDirtyReadQ :: State -> DirtyReadQ -> Process (ProcessReply (Maybe QEntry) State)
handleDirtyReadQ s (DirtyReadQ tableName key) = do
logt $ "handleDirtyReadQ starting"
res <- do_dirty_read_q tableName key
logt $ "handleDirtyReadQ done"
reply res s
{-
handleDirtyReadLS :: State -> DirtyReadLS -> Process (ProcessReply (Maybe ConsumerMessage) State)
handleDirtyReadLS s (DirtyReadLS consumerName key) = do
logt $ "handleDirtyReadLS starting"
res <- do_dirty_read_ls consumerName key
logt $ "handleDirtyReadLS done"
reply res s
-} | 566 | handleDirtyReadQ s (DirtyReadQ tableName key) = do
logt $ "handleDirtyReadQ starting"
res <- do_dirty_read_q tableName key
logt $ "handleDirtyReadQ done"
reply res s
{-
handleDirtyReadLS :: State -> DirtyReadLS -> Process (ProcessReply (Maybe ConsumerMessage) State)
handleDirtyReadLS s (DirtyReadLS consumerName key) = do
logt $ "handleDirtyReadLS starting"
res <- do_dirty_read_ls consumerName key
logt $ "handleDirtyReadLS done"
reply res s
-} | 479 | false | true | 0 | 11 | 102 | 84 | 39 | 45 | null | null |
oldmanmike/ghc | compiler/utils/Digraph.hs | bsd-3-clause | noOutEdges :: IntGraph -> [Vertex]
noOutEdges g = [ v | v <- vertices g, null (g!v)] | 84 | noOutEdges :: IntGraph -> [Vertex]
noOutEdges g = [ v | v <- vertices g, null (g!v)] | 84 | noOutEdges g = [ v | v <- vertices g, null (g!v)] | 49 | false | true | 0 | 9 | 16 | 49 | 25 | 24 | null | null |
tamarin-prover/tamarin-prover | lib/theory/src/Theory.hs | gpl-3.0 | prettyProcessDef :: HighlightDocument d => ProcessDef -> d
prettyProcessDef pDef = text ("let " ++ (L.get pName pDef) ++ " = " ++ (prettySapic (L.get pBody pDef))) | 163 | prettyProcessDef :: HighlightDocument d => ProcessDef -> d
prettyProcessDef pDef = text ("let " ++ (L.get pName pDef) ++ " = " ++ (prettySapic (L.get pBody pDef))) | 163 | prettyProcessDef pDef = text ("let " ++ (L.get pName pDef) ++ " = " ++ (prettySapic (L.get pBody pDef))) | 104 | false | true | 0 | 12 | 26 | 69 | 34 | 35 | null | null |
ecaustin/haskhol-math | src/HaskHOL/Lib/Grobner.hs | bsd-2-clause | convNUM_SIMPLIFY :: WFCtxt thry => Conversion cls thry
convNUM_SIMPLIFY =
convNUM_REDUCE `_THEN` convCONDS_CELIM `_THEN` convNNF `_THEN`
convNUM_MULTIPLY True `_THEN` convNUM_REDUCE `_THEN`
convGEN_REWRITE convONCE_DEPTH [pth]
where convNUM_MULTIPLY :: WFCtxt thry => Bool -> Conversion cls thry
convNUM_MULTIPLY pos = Conv $ \ tm ->
if isForall tm || isExists tm || isUExists tm
then runConv (convBINDER (convNUM_MULTIPLY pos)) tm
else if isImp tm && containsQuantifier tm
then runConv (convCOMB2 (convRAND (convNUM_MULTIPLY (not pos)))
(convNUM_MULTIPLY pos)) tm
else if (isConj tm || isDisj tm || isIff tm) &&
containsQuantifier tm
then runConv (convBINOP (convNUM_MULTIPLY pos)) tm
else if (isNeg tm && not pos && containsQuantifier tm)
then runConv (convRAND (convNUM_MULTIPLY (not pos))) tm
else do tmA <- toHTm [wf| a:num |]
tmB <- toHTm [wf| b:num |]
tmM <- toHTm [wf| m:num |]
tmN <- toHTm [wf| n:num |]
tmP <- toHTm [wf| P:num->bool |]
tmQ <- toHTm [wf| P:num->num->bool |]
tmDiv <- toHTm [wf| (DIV):num->num->num |]
tmMod <- toHTm [wf| (MOD):num->num->num |]
((do t <- findTerm (\ t -> isPre t && freeIn t tm) tm
ty <- typeOf t
v <- genVar ty
p <- mkAbs v $ subst [(t, v)] tm
th0 <- if pos then thmPRE_ELIM'' else thmPRE_ELIM'
t' <- rand t
th1 <- primINST [(tmP, p), (tmN, t')] th0
th2 <- ruleCONV (convCOMB2 (convRAND convBETA)
(convBINDER (convRAND convBETA))) th1
ruleCONV (convRAND (convNUM_MULTIPLY pos)) th2) <|>
(do t <- findTerm (\ t -> isSub t && freeIn t tm) tm
ty <- typeOf t
v <- genVar ty
p <- mkAbs v $ subst [(t, v)] tm
th0 <- if pos then thmSUB_ELIM'' else thmSUB_ELIM'
t' <- lHand t
t'' <- rand t
th1 <- primINST [(tmP, p), (tmA, t'), (tmB, t'')] th0
th2 <- ruleCONV (convCOMB2 (convRAND convBETA)
(convBINDER (convRAND convBETA))) th1
ruleCONV (convRAND (convNUM_MULTIPLY pos)) th2) <|>
(do t <- findTerm (\ t -> isDivmod t && freeIn t tm) tm
x <- lHand t
y <- rand t
dtm <- mkComb (mkComb tmDiv x) y
mtm <- mkComb (mkComb tmMod x) y
vd <- genVar $ typeOf dtm
vm <- genVar $ typeOf mtm
p <- listMkAbs [vd, vm] $ subst [(dtm, vd), (mtm, vm)] tm
th0 <- if pos then thmDIVMOD_ELIM'' else thmDIVMOD_ELIM'
th1 <- primINST [(tmQ, p), (tmM, x), (tmN, y)] th0
th2 <- ruleCONV (convCOMB2 (convRAND convBETA2)
(funpow 2 convBINDER (convRAND convBETA2))) th1
ruleCONV (convRAND (convNUM_MULTIPLY pos)) th2) <|>
(primREFL tm))
isPre :: HOLTerm -> Bool
isPre (Comb (Const "PRE" _) _) = True
isPre _ = False
isSub :: HOLTerm -> Bool
isSub = isBinary "-"
isDivmod :: HOLTerm -> Bool
isDivmod tm =
isBinary "DIV" tm || isBinary "MOD" tm
containsQuantifier :: HOLTerm -> Bool
containsQuantifier =
test' . (findTerm (\ t -> isForall t || isExists t || isUExists t))
convBETA2 :: Conversion cls thry
convBETA2 = convRATOR convBETA `_THEN` convBETA
thmPRE_ELIM'' :: WFCtxt thry => HOL cls thry HOLThm
thmPRE_ELIM'' = cacheProof "thmPRE_ELIM''" ctxtWF $
ruleCONV (convRAND convNNF) thmPRE_ELIM
thmSUB_ELIM'' :: WFCtxt thry => HOL cls thry HOLThm
thmSUB_ELIM'' = cacheProof "thmSUB_ELIM''" ctxtWF $
ruleCONV (convRAND convNNF) thmSUB_ELIM
thmDIVMOD_ELIM'' :: WFCtxt thry => HOL cls thry HOLThm
thmDIVMOD_ELIM'' = cacheProof "thmDIVMOD_ELIM''" ctxtWF $
ruleCONV (convRAND convNNF) thmDIVMOD_ELIM
pth :: WFCtxt thry => HOL cls thry HOLThm
pth = cacheProof "convNUM_SIMPLIFY_pth" ctxtWF .
prove [txt| (EVEN(x) <=> (!y. ~(x = SUC(2 * y)))) /\
(ODD(x) <=> (!y. ~(x = 2 * y))) /\
(~EVEN(x) <=> (!y. ~(x = 2 * y))) /\
(~ODD(x) <=> (!y. ~(x = SUC(2 * y)))) |] $
tacREWRITE [ ruleGSYM thmNOT_EXISTS, ruleGSYM thmEVEN_EXISTS
, ruleGSYM thmODD_EXISTS] `_THEN`
tacREWRITE [thmNOT_EVEN, thmNOT_ODD] | 5,078 | convNUM_SIMPLIFY :: WFCtxt thry => Conversion cls thry
convNUM_SIMPLIFY =
convNUM_REDUCE `_THEN` convCONDS_CELIM `_THEN` convNNF `_THEN`
convNUM_MULTIPLY True `_THEN` convNUM_REDUCE `_THEN`
convGEN_REWRITE convONCE_DEPTH [pth]
where convNUM_MULTIPLY :: WFCtxt thry => Bool -> Conversion cls thry
convNUM_MULTIPLY pos = Conv $ \ tm ->
if isForall tm || isExists tm || isUExists tm
then runConv (convBINDER (convNUM_MULTIPLY pos)) tm
else if isImp tm && containsQuantifier tm
then runConv (convCOMB2 (convRAND (convNUM_MULTIPLY (not pos)))
(convNUM_MULTIPLY pos)) tm
else if (isConj tm || isDisj tm || isIff tm) &&
containsQuantifier tm
then runConv (convBINOP (convNUM_MULTIPLY pos)) tm
else if (isNeg tm && not pos && containsQuantifier tm)
then runConv (convRAND (convNUM_MULTIPLY (not pos))) tm
else do tmA <- toHTm [wf| a:num |]
tmB <- toHTm [wf| b:num |]
tmM <- toHTm [wf| m:num |]
tmN <- toHTm [wf| n:num |]
tmP <- toHTm [wf| P:num->bool |]
tmQ <- toHTm [wf| P:num->num->bool |]
tmDiv <- toHTm [wf| (DIV):num->num->num |]
tmMod <- toHTm [wf| (MOD):num->num->num |]
((do t <- findTerm (\ t -> isPre t && freeIn t tm) tm
ty <- typeOf t
v <- genVar ty
p <- mkAbs v $ subst [(t, v)] tm
th0 <- if pos then thmPRE_ELIM'' else thmPRE_ELIM'
t' <- rand t
th1 <- primINST [(tmP, p), (tmN, t')] th0
th2 <- ruleCONV (convCOMB2 (convRAND convBETA)
(convBINDER (convRAND convBETA))) th1
ruleCONV (convRAND (convNUM_MULTIPLY pos)) th2) <|>
(do t <- findTerm (\ t -> isSub t && freeIn t tm) tm
ty <- typeOf t
v <- genVar ty
p <- mkAbs v $ subst [(t, v)] tm
th0 <- if pos then thmSUB_ELIM'' else thmSUB_ELIM'
t' <- lHand t
t'' <- rand t
th1 <- primINST [(tmP, p), (tmA, t'), (tmB, t'')] th0
th2 <- ruleCONV (convCOMB2 (convRAND convBETA)
(convBINDER (convRAND convBETA))) th1
ruleCONV (convRAND (convNUM_MULTIPLY pos)) th2) <|>
(do t <- findTerm (\ t -> isDivmod t && freeIn t tm) tm
x <- lHand t
y <- rand t
dtm <- mkComb (mkComb tmDiv x) y
mtm <- mkComb (mkComb tmMod x) y
vd <- genVar $ typeOf dtm
vm <- genVar $ typeOf mtm
p <- listMkAbs [vd, vm] $ subst [(dtm, vd), (mtm, vm)] tm
th0 <- if pos then thmDIVMOD_ELIM'' else thmDIVMOD_ELIM'
th1 <- primINST [(tmQ, p), (tmM, x), (tmN, y)] th0
th2 <- ruleCONV (convCOMB2 (convRAND convBETA2)
(funpow 2 convBINDER (convRAND convBETA2))) th1
ruleCONV (convRAND (convNUM_MULTIPLY pos)) th2) <|>
(primREFL tm))
isPre :: HOLTerm -> Bool
isPre (Comb (Const "PRE" _) _) = True
isPre _ = False
isSub :: HOLTerm -> Bool
isSub = isBinary "-"
isDivmod :: HOLTerm -> Bool
isDivmod tm =
isBinary "DIV" tm || isBinary "MOD" tm
containsQuantifier :: HOLTerm -> Bool
containsQuantifier =
test' . (findTerm (\ t -> isForall t || isExists t || isUExists t))
convBETA2 :: Conversion cls thry
convBETA2 = convRATOR convBETA `_THEN` convBETA
thmPRE_ELIM'' :: WFCtxt thry => HOL cls thry HOLThm
thmPRE_ELIM'' = cacheProof "thmPRE_ELIM''" ctxtWF $
ruleCONV (convRAND convNNF) thmPRE_ELIM
thmSUB_ELIM'' :: WFCtxt thry => HOL cls thry HOLThm
thmSUB_ELIM'' = cacheProof "thmSUB_ELIM''" ctxtWF $
ruleCONV (convRAND convNNF) thmSUB_ELIM
thmDIVMOD_ELIM'' :: WFCtxt thry => HOL cls thry HOLThm
thmDIVMOD_ELIM'' = cacheProof "thmDIVMOD_ELIM''" ctxtWF $
ruleCONV (convRAND convNNF) thmDIVMOD_ELIM
pth :: WFCtxt thry => HOL cls thry HOLThm
pth = cacheProof "convNUM_SIMPLIFY_pth" ctxtWF .
prove [txt| (EVEN(x) <=> (!y. ~(x = SUC(2 * y)))) /\
(ODD(x) <=> (!y. ~(x = 2 * y))) /\
(~EVEN(x) <=> (!y. ~(x = 2 * y))) /\
(~ODD(x) <=> (!y. ~(x = SUC(2 * y)))) |] $
tacREWRITE [ ruleGSYM thmNOT_EXISTS, ruleGSYM thmEVEN_EXISTS
, ruleGSYM thmODD_EXISTS] `_THEN`
tacREWRITE [thmNOT_EVEN, thmNOT_ODD] | 5,078 | convNUM_SIMPLIFY =
convNUM_REDUCE `_THEN` convCONDS_CELIM `_THEN` convNNF `_THEN`
convNUM_MULTIPLY True `_THEN` convNUM_REDUCE `_THEN`
convGEN_REWRITE convONCE_DEPTH [pth]
where convNUM_MULTIPLY :: WFCtxt thry => Bool -> Conversion cls thry
convNUM_MULTIPLY pos = Conv $ \ tm ->
if isForall tm || isExists tm || isUExists tm
then runConv (convBINDER (convNUM_MULTIPLY pos)) tm
else if isImp tm && containsQuantifier tm
then runConv (convCOMB2 (convRAND (convNUM_MULTIPLY (not pos)))
(convNUM_MULTIPLY pos)) tm
else if (isConj tm || isDisj tm || isIff tm) &&
containsQuantifier tm
then runConv (convBINOP (convNUM_MULTIPLY pos)) tm
else if (isNeg tm && not pos && containsQuantifier tm)
then runConv (convRAND (convNUM_MULTIPLY (not pos))) tm
else do tmA <- toHTm [wf| a:num |]
tmB <- toHTm [wf| b:num |]
tmM <- toHTm [wf| m:num |]
tmN <- toHTm [wf| n:num |]
tmP <- toHTm [wf| P:num->bool |]
tmQ <- toHTm [wf| P:num->num->bool |]
tmDiv <- toHTm [wf| (DIV):num->num->num |]
tmMod <- toHTm [wf| (MOD):num->num->num |]
((do t <- findTerm (\ t -> isPre t && freeIn t tm) tm
ty <- typeOf t
v <- genVar ty
p <- mkAbs v $ subst [(t, v)] tm
th0 <- if pos then thmPRE_ELIM'' else thmPRE_ELIM'
t' <- rand t
th1 <- primINST [(tmP, p), (tmN, t')] th0
th2 <- ruleCONV (convCOMB2 (convRAND convBETA)
(convBINDER (convRAND convBETA))) th1
ruleCONV (convRAND (convNUM_MULTIPLY pos)) th2) <|>
(do t <- findTerm (\ t -> isSub t && freeIn t tm) tm
ty <- typeOf t
v <- genVar ty
p <- mkAbs v $ subst [(t, v)] tm
th0 <- if pos then thmSUB_ELIM'' else thmSUB_ELIM'
t' <- lHand t
t'' <- rand t
th1 <- primINST [(tmP, p), (tmA, t'), (tmB, t'')] th0
th2 <- ruleCONV (convCOMB2 (convRAND convBETA)
(convBINDER (convRAND convBETA))) th1
ruleCONV (convRAND (convNUM_MULTIPLY pos)) th2) <|>
(do t <- findTerm (\ t -> isDivmod t && freeIn t tm) tm
x <- lHand t
y <- rand t
dtm <- mkComb (mkComb tmDiv x) y
mtm <- mkComb (mkComb tmMod x) y
vd <- genVar $ typeOf dtm
vm <- genVar $ typeOf mtm
p <- listMkAbs [vd, vm] $ subst [(dtm, vd), (mtm, vm)] tm
th0 <- if pos then thmDIVMOD_ELIM'' else thmDIVMOD_ELIM'
th1 <- primINST [(tmQ, p), (tmM, x), (tmN, y)] th0
th2 <- ruleCONV (convCOMB2 (convRAND convBETA2)
(funpow 2 convBINDER (convRAND convBETA2))) th1
ruleCONV (convRAND (convNUM_MULTIPLY pos)) th2) <|>
(primREFL tm))
isPre :: HOLTerm -> Bool
isPre (Comb (Const "PRE" _) _) = True
isPre _ = False
isSub :: HOLTerm -> Bool
isSub = isBinary "-"
isDivmod :: HOLTerm -> Bool
isDivmod tm =
isBinary "DIV" tm || isBinary "MOD" tm
containsQuantifier :: HOLTerm -> Bool
containsQuantifier =
test' . (findTerm (\ t -> isForall t || isExists t || isUExists t))
convBETA2 :: Conversion cls thry
convBETA2 = convRATOR convBETA `_THEN` convBETA
thmPRE_ELIM'' :: WFCtxt thry => HOL cls thry HOLThm
thmPRE_ELIM'' = cacheProof "thmPRE_ELIM''" ctxtWF $
ruleCONV (convRAND convNNF) thmPRE_ELIM
thmSUB_ELIM'' :: WFCtxt thry => HOL cls thry HOLThm
thmSUB_ELIM'' = cacheProof "thmSUB_ELIM''" ctxtWF $
ruleCONV (convRAND convNNF) thmSUB_ELIM
thmDIVMOD_ELIM'' :: WFCtxt thry => HOL cls thry HOLThm
thmDIVMOD_ELIM'' = cacheProof "thmDIVMOD_ELIM''" ctxtWF $
ruleCONV (convRAND convNNF) thmDIVMOD_ELIM
pth :: WFCtxt thry => HOL cls thry HOLThm
pth = cacheProof "convNUM_SIMPLIFY_pth" ctxtWF .
prove [txt| (EVEN(x) <=> (!y. ~(x = SUC(2 * y)))) /\
(ODD(x) <=> (!y. ~(x = 2 * y))) /\
(~EVEN(x) <=> (!y. ~(x = 2 * y))) /\
(~ODD(x) <=> (!y. ~(x = SUC(2 * y)))) |] $
tacREWRITE [ ruleGSYM thmNOT_EXISTS, ruleGSYM thmEVEN_EXISTS
, ruleGSYM thmODD_EXISTS] `_THEN`
tacREWRITE [thmNOT_EVEN, thmNOT_ODD] | 5,023 | false | true | 0 | 27 | 2,081 | 1,508 | 756 | 752 | null | null |
tdietert/nanocoin | src/Nanocoin/Block.hs | apache-2.0 | -------------------------------------------------------------------------------
-- Consensus
-------------------------------------------------------------------------------
-- | Generates (mines) a new block using the `proofOfWork` function
mineBlock
:: MonadIO m
=> Block -- ^ Previous Block in chain
-> Key.KeyPair -- ^ Miner's ECDSA key pair
-> [Transaction] -- ^ List of transactions
-> m Block
mineBlock prevBlock keys@(pubKey,privKey) txs' = do
-- Generate reward transaction
rewardTx <- liftIO $
T.rewardTransaction keys (calcReward index')
-- Create the block header
let blockTxs = txs' ++ [rewardTx]
let blockHeader = mkBlockHeader blockTxs
-- Get time of block creation
ts <- liftIO Time.now
-- Sign the serialized block header
signature' <- liftIO $
Key.sign privKey (S.encode blockHeader)
return Block
{ index = index'
, header = blockHeader
, transactions = blockTxs
, signature = S.encode signature'
, timestamp = ts
}
where
index' = index prevBlock + 1
prevHash = hashBlock prevBlock
origin' = Key.toPublic privKey
mkBlockHeader txs = proofOfWork index' $
let txHashes = map T.hashTransaction txs
in BlockHeader { origin = origin'
, previousHash = prevHash
, merkleRoot = mtHash (mkMerkleTree txHashes)
, nonce = 0
} | 1,507 | mineBlock
:: MonadIO m
=> Block -- ^ Previous Block in chain
-> Key.KeyPair -- ^ Miner's ECDSA key pair
-> [Transaction] -- ^ List of transactions
-> m Block
mineBlock prevBlock keys@(pubKey,privKey) txs' = do
-- Generate reward transaction
rewardTx <- liftIO $
T.rewardTransaction keys (calcReward index')
-- Create the block header
let blockTxs = txs' ++ [rewardTx]
let blockHeader = mkBlockHeader blockTxs
-- Get time of block creation
ts <- liftIO Time.now
-- Sign the serialized block header
signature' <- liftIO $
Key.sign privKey (S.encode blockHeader)
return Block
{ index = index'
, header = blockHeader
, transactions = blockTxs
, signature = S.encode signature'
, timestamp = ts
}
where
index' = index prevBlock + 1
prevHash = hashBlock prevBlock
origin' = Key.toPublic privKey
mkBlockHeader txs = proofOfWork index' $
let txHashes = map T.hashTransaction txs
in BlockHeader { origin = origin'
, previousHash = prevHash
, merkleRoot = mtHash (mkMerkleTree txHashes)
, nonce = 0
} | 1,265 | mineBlock prevBlock keys@(pubKey,privKey) txs' = do
-- Generate reward transaction
rewardTx <- liftIO $
T.rewardTransaction keys (calcReward index')
-- Create the block header
let blockTxs = txs' ++ [rewardTx]
let blockHeader = mkBlockHeader blockTxs
-- Get time of block creation
ts <- liftIO Time.now
-- Sign the serialized block header
signature' <- liftIO $
Key.sign privKey (S.encode blockHeader)
return Block
{ index = index'
, header = blockHeader
, transactions = blockTxs
, signature = S.encode signature'
, timestamp = ts
}
where
index' = index prevBlock + 1
prevHash = hashBlock prevBlock
origin' = Key.toPublic privKey
mkBlockHeader txs = proofOfWork index' $
let txHashes = map T.hashTransaction txs
in BlockHeader { origin = origin'
, previousHash = prevHash
, merkleRoot = mtHash (mkMerkleTree txHashes)
, nonce = 0
} | 1,084 | true | true | 36 | 13 | 450 | 232 | 132 | 100 | null | null |
ben-schulz/Idris-dev | src/Idris/Core/Elaborate.hs | bsd-3-clause | arg :: Name -> Maybe ImplicitInfo -> Name -> Elab' aux ()
arg n i tyhole = do ty <- unique_hole tyhole
claim ty RType
movelast ty
forall n i (Var ty)
-- try a tactic, if it adds any unification problem, return an error | 279 | arg :: Name -> Maybe ImplicitInfo -> Name -> Elab' aux ()
arg n i tyhole = do ty <- unique_hole tyhole
claim ty RType
movelast ty
forall n i (Var ty)
-- try a tactic, if it adds any unification problem, return an error | 279 | arg n i tyhole = do ty <- unique_hole tyhole
claim ty RType
movelast ty
forall n i (Var ty)
-- try a tactic, if it adds any unification problem, return an error | 221 | false | true | 0 | 10 | 105 | 86 | 37 | 49 | null | null |
geophf/1HaskellADay | exercises/HAD/Y2017/M04/D18/Solution.hs | mit | stateCapitalSPARQL :: SPARQL
stateCapitalSPARQL =
let st = Nod "state" True
cp = Nod "capital" True in
Query True (map Nd [st, cp])
[RDF (Trip (Rel st (Name "wdt" "P31") (Name "wd" "Q35657"))),
RDF (Trip (Rel st (Name "wdt" "P36") (Node cp)))]
(Just (Sort ORDER [st])) Nothing | 315 | stateCapitalSPARQL :: SPARQL
stateCapitalSPARQL =
let st = Nod "state" True
cp = Nod "capital" True in
Query True (map Nd [st, cp])
[RDF (Trip (Rel st (Name "wdt" "P31") (Name "wd" "Q35657"))),
RDF (Trip (Rel st (Name "wdt" "P36") (Node cp)))]
(Just (Sort ORDER [st])) Nothing | 315 | stateCapitalSPARQL =
let st = Nod "state" True
cp = Nod "capital" True in
Query True (map Nd [st, cp])
[RDF (Trip (Rel st (Name "wdt" "P31") (Name "wd" "Q35657"))),
RDF (Trip (Rel st (Name "wdt" "P36") (Node cp)))]
(Just (Sort ORDER [st])) Nothing | 286 | false | true | 0 | 15 | 85 | 153 | 77 | 76 | null | null |
srijs/haskell-generalized-functors | src/Data/Functors/Types.hs | mit | invariantId :: Morphism Invariant a a
invariantId = (id, id) | 60 | invariantId :: Morphism Invariant a a
invariantId = (id, id) | 60 | invariantId = (id, id) | 22 | false | true | 1 | 6 | 9 | 29 | 13 | 16 | null | null |
uuhan/Idris-dev | src/Idris/Options.hs | bsd-3-clause | loggingCatsStr :: String
loggingCatsStr = unlines
[ (strLogCat IParse)
, (strLogCat IElab)
, (strLogCat ICodeGen)
, (strLogCat IErasure)
, (strLogCat ICoverage)
, (strLogCat IIBC)
] | 209 | loggingCatsStr :: String
loggingCatsStr = unlines
[ (strLogCat IParse)
, (strLogCat IElab)
, (strLogCat ICodeGen)
, (strLogCat IErasure)
, (strLogCat ICoverage)
, (strLogCat IIBC)
] | 209 | loggingCatsStr = unlines
[ (strLogCat IParse)
, (strLogCat IElab)
, (strLogCat ICodeGen)
, (strLogCat IErasure)
, (strLogCat ICoverage)
, (strLogCat IIBC)
] | 184 | false | true | 0 | 8 | 52 | 75 | 38 | 37 | null | null |
luzhuomi/cpp-obs | Language/C/Obfuscate/SSA.hs | apache-2.0 | domBy :: SDom ->
Ident -> -- ^ dominator
Ident -> -- ^ dominatee
Bool
domBy sdom dtor dtee = (dtor == dtee) || (sdomBy sdom dtor dtee) | 161 | domBy :: SDom ->
Ident -> -- ^ dominator
Ident -> -- ^ dominatee
Bool
domBy sdom dtor dtee = (dtor == dtee) || (sdomBy sdom dtor dtee) | 161 | domBy sdom dtor dtee = (dtor == dtee) || (sdomBy sdom dtor dtee) | 64 | false | true | 0 | 7 | 54 | 53 | 28 | 25 | null | null |
frantisekfarka/ghc-dsi | compiler/nativeGen/PPC/Ppr.hs | bsd-3-clause | pprBinaryF :: LitString -> Size -> Reg -> Reg -> Reg -> SDoc
pprBinaryF op sz reg1 reg2 reg3 = hcat [
char '\t',
ptext op,
pprFSize sz,
char '\t',
pprReg reg1,
ptext (sLit ", "),
pprReg reg2,
ptext (sLit ", "),
pprReg reg3
] | 300 | pprBinaryF :: LitString -> Size -> Reg -> Reg -> Reg -> SDoc
pprBinaryF op sz reg1 reg2 reg3 = hcat [
char '\t',
ptext op,
pprFSize sz,
char '\t',
pprReg reg1,
ptext (sLit ", "),
pprReg reg2,
ptext (sLit ", "),
pprReg reg3
] | 300 | pprBinaryF op sz reg1 reg2 reg3 = hcat [
char '\t',
ptext op,
pprFSize sz,
char '\t',
pprReg reg1,
ptext (sLit ", "),
pprReg reg2,
ptext (sLit ", "),
pprReg reg3
] | 239 | false | true | 0 | 9 | 120 | 116 | 56 | 60 | null | null |
muhbaasu/hash-id | src/Data/HashId/Internal.hs | mit | encodeStep1 :: Char
-> Alphabet
-> Salt
-> Separators
-> [Natural]
-> (Alphabet, ReturnVal)
encodeStep1 char alpha salt' seps nums =
foldl' foldStep (alpha, [char]) ns
where ns = zip [0..] nums
foldStep ((Alphabet alpha'), retVal) (i, n) =
let buffer = char : unSalt salt' ++ alpha'
alphabet'' = consistentShuffle alpha' $ Salt
$ take (length alpha') buffer
lastC = hash (Alphabet alphabet'') n
retVal' = retVal ++ lastC
lennums = fromIntegral $ length nums
retVal'' = if i + 1 < lennums
then
let n' = n `mod` (fromIntegral $ ord (head lastC) + i)
lenseps = fromIntegral $ length seps
sepsIndex = n' `mod` lenseps
in retVal' ++ [seps !!! sepsIndex]
else retVal'
in ((Alphabet alphabet''), retVal'') | 1,091 | encodeStep1 :: Char
-> Alphabet
-> Salt
-> Separators
-> [Natural]
-> (Alphabet, ReturnVal)
encodeStep1 char alpha salt' seps nums =
foldl' foldStep (alpha, [char]) ns
where ns = zip [0..] nums
foldStep ((Alphabet alpha'), retVal) (i, n) =
let buffer = char : unSalt salt' ++ alpha'
alphabet'' = consistentShuffle alpha' $ Salt
$ take (length alpha') buffer
lastC = hash (Alphabet alphabet'') n
retVal' = retVal ++ lastC
lennums = fromIntegral $ length nums
retVal'' = if i + 1 < lennums
then
let n' = n `mod` (fromIntegral $ ord (head lastC) + i)
lenseps = fromIntegral $ length seps
sepsIndex = n' `mod` lenseps
in retVal' ++ [seps !!! sepsIndex]
else retVal'
in ((Alphabet alphabet''), retVal'') | 1,091 | encodeStep1 char alpha salt' seps nums =
foldl' foldStep (alpha, [char]) ns
where ns = zip [0..] nums
foldStep ((Alphabet alpha'), retVal) (i, n) =
let buffer = char : unSalt salt' ++ alpha'
alphabet'' = consistentShuffle alpha' $ Salt
$ take (length alpha') buffer
lastC = hash (Alphabet alphabet'') n
retVal' = retVal ++ lastC
lennums = fromIntegral $ length nums
retVal'' = if i + 1 < lennums
then
let n' = n `mod` (fromIntegral $ ord (head lastC) + i)
lenseps = fromIntegral $ length seps
sepsIndex = n' `mod` lenseps
in retVal' ++ [seps !!! sepsIndex]
else retVal'
in ((Alphabet alphabet''), retVal'') | 919 | false | true | 2 | 20 | 512 | 317 | 160 | 157 | null | null |
Peaker/git-pushq | Git/CLI.hs | gpl-2.0 | ignoreError :: IO () -> IO ()
ignoreError = (`onFail` return ()) | 64 | ignoreError :: IO () -> IO ()
ignoreError = (`onFail` return ()) | 64 | ignoreError = (`onFail` return ()) | 34 | false | true | 0 | 8 | 11 | 42 | 20 | 22 | null | null |
kmate/HaRe | old/refactorer/RefacUnfoldAsPatterns.hs | bsd-3-clause | rewritePats _ _ (pat1@(Pat (HsPLit x y)))
= (Exp (HsLit x y), pat1) | 69 | rewritePats _ _ (pat1@(Pat (HsPLit x y)))
= (Exp (HsLit x y), pat1) | 69 | rewritePats _ _ (pat1@(Pat (HsPLit x y)))
= (Exp (HsLit x y), pat1) | 69 | false | false | 0 | 11 | 14 | 50 | 26 | 24 | null | null |
anttisalonen/freekick2 | src/Match/State/MatchBase.hs | gpl-3.0 | ownGoalAbs :: MatchState -> Player -> FRange
ownGoalAbs m pl =
oppositeGoalAbs' (pitchsize m) (not $ playerHome pl == homeattacksup m) | 136 | ownGoalAbs :: MatchState -> Player -> FRange
ownGoalAbs m pl =
oppositeGoalAbs' (pitchsize m) (not $ playerHome pl == homeattacksup m) | 136 | ownGoalAbs m pl =
oppositeGoalAbs' (pitchsize m) (not $ playerHome pl == homeattacksup m) | 91 | false | true | 0 | 9 | 22 | 52 | 25 | 27 | null | null |
abakst/liquidhaskell | tests/crash/Assume.hs | bsd-3-clause | {-@ assume incr :: Int -> {v : Int | v == x} @-}
incr :: Int -> Int
incr x = x + 1 | 82 | incr :: Int -> Int
incr x = x + 1 | 33 | incr x = x + 1 | 14 | true | true | 0 | 5 | 24 | 23 | 12 | 11 | null | null |
spire/spire | src/Spire/CLI.hs | bsd-3-clause | -- Version of 'run' that does not use cmdargs.
--
-- The cmdargs package seems to mess up the ghci debugger; 'runDebug'
-- can be used instead of 'run' when debugging. E.g.
--
-- ghci -fbreak-on-error -isrc src/Spire/CLI.hs
-- :trace runDebug (emptyConf { file = "examples/MetaVars.spire" , metavars = True })
runDebug :: Conf -> IO ()
runDebug conf = do
setDebugging . Spire.Options.debug $ conf
-- http://www.haskell.org/ghc/docs/latest/html/users_guide/other-type-extensions.html#implicit-parameters
let ?conf = conf
prelude <- readPrelude
checkFromFile prelude (file conf)
---------------------------------------------------------------------- | 662 | runDebug :: Conf -> IO ()
runDebug conf = do
setDebugging . Spire.Options.debug $ conf
-- http://www.haskell.org/ghc/docs/latest/html/users_guide/other-type-extensions.html#implicit-parameters
let ?conf = conf
prelude <- readPrelude
checkFromFile prelude (file conf)
---------------------------------------------------------------------- | 348 | runDebug conf = do
setDebugging . Spire.Options.debug $ conf
-- http://www.haskell.org/ghc/docs/latest/html/users_guide/other-type-extensions.html#implicit-parameters
let ?conf = conf
prelude <- readPrelude
checkFromFile prelude (file conf)
---------------------------------------------------------------------- | 322 | true | true | 0 | 9 | 94 | 76 | 40 | 36 | null | null |
nazrhom/vcs-clojure | src/Util/PPPatch.hs | bsd-3-clause | showAtmuPosE :: (IsRecEl u, IsRecEl v) => Usingl u -> AtmuPos u v -> String
showAtmuPosE u (FixPos almu) = showPatchEffect almu u | 129 | showAtmuPosE :: (IsRecEl u, IsRecEl v) => Usingl u -> AtmuPos u v -> String
showAtmuPosE u (FixPos almu) = showPatchEffect almu u | 129 | showAtmuPosE u (FixPos almu) = showPatchEffect almu u | 53 | false | true | 0 | 8 | 22 | 63 | 29 | 34 | null | null |
CarstenKoenig/AdventOfCode2016 | Day17/Main.hs | mit | main :: IO ()
main = do
putStrLn $ "Part 1: " ++ show (path part1)
putStrLn $ "Part 2: " ++ show part2
putStrLn "all done" | 128 | main :: IO ()
main = do
putStrLn $ "Part 1: " ++ show (path part1)
putStrLn $ "Part 2: " ++ show part2
putStrLn "all done" | 128 | main = do
putStrLn $ "Part 1: " ++ show (path part1)
putStrLn $ "Part 2: " ++ show part2
putStrLn "all done" | 114 | false | true | 0 | 10 | 32 | 56 | 25 | 31 | null | null |
hvr/tar | Codec/Archive/Tar/Index.hs | bsd-3-clause | hReadEntry :: Handle -> TarEntryOffset -> IO Entry
hReadEntry hnd off = do
entry <- hReadEntryHeader hnd off
case entryContent entry of
NormalFile _ size -> do body <- LBS.hGet hnd (fromIntegral size)
return entry {
entryContent = NormalFile body size
}
OtherEntryType c _ size -> do body <- LBS.hGet hnd (fromIntegral size)
return entry {
entryContent = OtherEntryType c body size
}
_ -> return entry
-- | Read the header for a 'Entry' at the given 'TarEntryOffset' in the tar
-- file. The 'entryContent' will contain the correct metadata but an empty file
-- content. The 'Handle' must be open for reading and be seekable.
--
-- The 'Handle' position is advanced to the beginning of the entry content (if
-- any). You must check the 'entryContent' to see if the entry is of type
-- 'NormalFile'. If it is, the 'NormalFile' gives the content length and you
-- are free to read this much data from the 'Handle'.
--
-- > entry <- Tar.hReadEntryHeader hnd
-- > case Tar.entryContent entry of
-- > Tar.NormalFile _ size -> do content <- BS.hGet hnd size
-- > ...
--
-- Of course you don't have to read it all in one go (as 'hReadEntry' does),
-- you can use any appropriate method to read it incrementally.
--
-- In addition to I\/O errors, this can throw a 'FormatError' if the offset is
-- wrong, or if the file is not valid tar format.
--
-- There is also the lower level operation 'hSeekEntryOffset'.
-- | 1,711 | hReadEntry :: Handle -> TarEntryOffset -> IO Entry
hReadEntry hnd off = do
entry <- hReadEntryHeader hnd off
case entryContent entry of
NormalFile _ size -> do body <- LBS.hGet hnd (fromIntegral size)
return entry {
entryContent = NormalFile body size
}
OtherEntryType c _ size -> do body <- LBS.hGet hnd (fromIntegral size)
return entry {
entryContent = OtherEntryType c body size
}
_ -> return entry
-- | Read the header for a 'Entry' at the given 'TarEntryOffset' in the tar
-- file. The 'entryContent' will contain the correct metadata but an empty file
-- content. The 'Handle' must be open for reading and be seekable.
--
-- The 'Handle' position is advanced to the beginning of the entry content (if
-- any). You must check the 'entryContent' to see if the entry is of type
-- 'NormalFile'. If it is, the 'NormalFile' gives the content length and you
-- are free to read this much data from the 'Handle'.
--
-- > entry <- Tar.hReadEntryHeader hnd
-- > case Tar.entryContent entry of
-- > Tar.NormalFile _ size -> do content <- BS.hGet hnd size
-- > ...
--
-- Of course you don't have to read it all in one go (as 'hReadEntry' does),
-- you can use any appropriate method to read it incrementally.
--
-- In addition to I\/O errors, this can throw a 'FormatError' if the offset is
-- wrong, or if the file is not valid tar format.
--
-- There is also the lower level operation 'hSeekEntryOffset'.
-- | 1,711 | hReadEntry hnd off = do
entry <- hReadEntryHeader hnd off
case entryContent entry of
NormalFile _ size -> do body <- LBS.hGet hnd (fromIntegral size)
return entry {
entryContent = NormalFile body size
}
OtherEntryType c _ size -> do body <- LBS.hGet hnd (fromIntegral size)
return entry {
entryContent = OtherEntryType c body size
}
_ -> return entry
-- | Read the header for a 'Entry' at the given 'TarEntryOffset' in the tar
-- file. The 'entryContent' will contain the correct metadata but an empty file
-- content. The 'Handle' must be open for reading and be seekable.
--
-- The 'Handle' position is advanced to the beginning of the entry content (if
-- any). You must check the 'entryContent' to see if the entry is of type
-- 'NormalFile'. If it is, the 'NormalFile' gives the content length and you
-- are free to read this much data from the 'Handle'.
--
-- > entry <- Tar.hReadEntryHeader hnd
-- > case Tar.entryContent entry of
-- > Tar.NormalFile _ size -> do content <- BS.hGet hnd size
-- > ...
--
-- Of course you don't have to read it all in one go (as 'hReadEntry' does),
-- you can use any appropriate method to read it incrementally.
--
-- In addition to I\/O errors, this can throw a 'FormatError' if the offset is
-- wrong, or if the file is not valid tar format.
--
-- There is also the lower level operation 'hSeekEntryOffset'.
-- | 1,660 | false | true | 0 | 15 | 562 | 184 | 96 | 88 | null | null |
grammarware/slps | topics/fl/haskell/Scanner.hs | bsd-3-clause | -- Special characters
special s = spaces >> string s | 53 | special s = spaces >> string s | 30 | special s = spaces >> string s | 30 | true | false | 3 | 5 | 10 | 21 | 8 | 13 | null | null |
tjakway/ghcjvm | compiler/coreSyn/PprCore.hs | bsd-3-clause | ppr_expr add_par (Tick tickish expr)
= sdocWithDynFlags $ \dflags ->
if gopt Opt_PprShowTicks dflags
then add_par (sep [ppr tickish, pprCoreExpr expr])
else ppr_expr add_par expr | 186 | ppr_expr add_par (Tick tickish expr)
= sdocWithDynFlags $ \dflags ->
if gopt Opt_PprShowTicks dflags
then add_par (sep [ppr tickish, pprCoreExpr expr])
else ppr_expr add_par expr | 186 | ppr_expr add_par (Tick tickish expr)
= sdocWithDynFlags $ \dflags ->
if gopt Opt_PprShowTicks dflags
then add_par (sep [ppr tickish, pprCoreExpr expr])
else ppr_expr add_par expr | 186 | false | false | 0 | 12 | 32 | 67 | 33 | 34 | null | null |
travitch/iiglue | tools/IIGen.hs | bsd-3-clause | isFinalized :: (Parameter, Ident ()) -> Bool
isFinalized = any (==PAFinalize) . parameterAnnotations . fst | 106 | isFinalized :: (Parameter, Ident ()) -> Bool
isFinalized = any (==PAFinalize) . parameterAnnotations . fst | 106 | isFinalized = any (==PAFinalize) . parameterAnnotations . fst | 61 | false | true | 2 | 8 | 14 | 42 | 21 | 21 | null | null |
minib00m/jpp | src/Evaluator.hs | mit | evalRelBinOp Less = (<) | 23 | evalRelBinOp Less = (<) | 23 | evalRelBinOp Less = (<) | 23 | false | false | 1 | 5 | 3 | 15 | 6 | 9 | null | null |
AlexeyRaga/eta | compiler/ETA/Prelude/PrelNames.hs | bsd-3-clause | dATA_ARRAY_PARALLEL_NAME, dATA_ARRAY_PARALLEL_PRIM_NAME :: ModuleName
dATA_ARRAY_PARALLEL_NAME = mkModuleNameFS (fsLit "Data.Array.Parallel") | 146 | dATA_ARRAY_PARALLEL_NAME, dATA_ARRAY_PARALLEL_PRIM_NAME :: ModuleName
dATA_ARRAY_PARALLEL_NAME = mkModuleNameFS (fsLit "Data.Array.Parallel") | 146 | dATA_ARRAY_PARALLEL_NAME = mkModuleNameFS (fsLit "Data.Array.Parallel") | 76 | false | true | 0 | 7 | 13 | 22 | 12 | 10 | null | null |
jparyani/capnproto-boostpython | compiler/src/Util.hs | bsd-2-clause | splitOn delimiter (c:rest) = let (first:more) = splitOn delimiter rest in (c:first):more | 88 | splitOn delimiter (c:rest) = let (first:more) = splitOn delimiter rest in (c:first):more | 88 | splitOn delimiter (c:rest) = let (first:more) = splitOn delimiter rest in (c:first):more | 88 | false | false | 0 | 10 | 11 | 54 | 26 | 28 | null | null |
ikirill/ComputationalMathematics | Cube/Cube.hs | gpl-3.0 | dirConvert CCwise = P.inv | 25 | dirConvert CCwise = P.inv | 25 | dirConvert CCwise = P.inv | 25 | false | false | 0 | 5 | 3 | 11 | 5 | 6 | null | null |
momomimachli/Hedsql | src/Database/Hedsql/Common/Constructor.hs | gpl-3.0 | ---------------------------------------
-- Utils
---------------------------------------
{-|
Create a function which will return the primary key value of the last inserted
row.
This function differs from one database vendor from another.
Note that with PostgreSQL you may prefer to use the RETURNING clause instead.
-}
lastInsertId :: Expression colType dbVendor
lastInsertId = LastInsertId | 392 | lastInsertId :: Expression colType dbVendor
lastInsertId = LastInsertId | 71 | lastInsertId = LastInsertId | 27 | true | true | 0 | 5 | 52 | 20 | 12 | 8 | null | null |
EduPH/Problemas | Cube_Root/Cube_root.hs | gpl-3.0 | escribeSalida (x:xs) = (show (mejorAproxRaiz (intervalos (0,x) x) x)) ++
"\n" ++ escribeSalida xs | 120 | escribeSalida (x:xs) = (show (mejorAproxRaiz (intervalos (0,x) x) x)) ++
"\n" ++ escribeSalida xs | 120 | escribeSalida (x:xs) = (show (mejorAproxRaiz (intervalos (0,x) x) x)) ++
"\n" ++ escribeSalida xs | 120 | false | false | 0 | 13 | 36 | 56 | 28 | 28 | null | null |
na4zagin3/uhim-dict | src/Language/UHIM/Japanese/Verb.hs | gpl-3.0 | jaVerbClasses :: Map String JaVerbConjugation
jaVerbClasses = M.fromList $ do
(x, s, c) <- ls
[ (x, JaVerbConjugation ModernStandardJapanese s c)
, ("文" `mappend` x, JaVerbConjugation MiddleJapanese s c)
]
where
ls = [ ("ア四", StemZero, Quadrigrade)
, ("ア五", StemZero, Quinquegrade)
, ("ア上二", StemZero, SuperBigrade)
, ("ア上一", StemZero, SuperMonograde)
, ("ア下二", StemZero, SubBigrade)
, ("ア下一", StemZero, SubMonograde)
, ("カ四", StemK, Quadrigrade)
, ("カ五", StemK, Quinquegrade)
, ("カ上二", StemK, SuperBigrade)
, ("カ上一", StemK, SuperMonograde)
, ("カ下二", StemK, SubBigrade)
, ("カ下一", StemK, SubMonograde)
, ("カ變", StemK, Irregular)
, ("カ変", StemK, Irregular)
, ("ガ四", StemG, Quadrigrade)
, ("ガ五", StemG, Quinquegrade)
, ("ガ上二", StemG, SuperBigrade)
, ("ガ上一", StemG, SuperMonograde)
, ("ガ下二", StemG, SubBigrade)
, ("ガ下一", StemG, SubMonograde)
, ("サ四", StemS, Quadrigrade)
, ("サ五", StemS, Quinquegrade)
, ("サ上二", StemS, SuperBigrade)
, ("サ上一", StemS, SuperMonograde)
, ("サ下二", StemS, SubBigrade)
, ("サ下一", StemS, SubMonograde)
, ("サ變", StemS, Irregular)
, ("サ変", StemS, Irregular)
, ("ザ四", StemZ, Quadrigrade)
, ("ザ五", StemZ, Quinquegrade)
, ("ザ上二", StemZ, SuperBigrade)
, ("ザ上一", StemZ, SuperMonograde)
, ("ザ下二", StemZ, SubBigrade)
, ("ザ下一", StemZ, SubMonograde)
, ("ザ變", StemZ, Irregular)
, ("ザ変", StemZ, Irregular)
, ("タ四", StemT, Quadrigrade)
, ("タ五", StemT, Quinquegrade)
, ("タ上二", StemT, SuperBigrade)
, ("タ上一", StemT, SuperMonograde)
, ("タ下二", StemT, SubBigrade)
, ("タ下一", StemT, SubMonograde)
, ("ダ四", StemD, Quadrigrade)
, ("ダ五", StemD, Quinquegrade)
, ("ダ上二", StemD, SuperBigrade)
, ("ダ上一", StemD, SuperMonograde)
, ("ダ下二", StemD, SubBigrade)
, ("ダ下一", StemD, SubMonograde)
, ("ナ四", StemN, Quadrigrade)
, ("ナ五", StemN, Quinquegrade)
, ("ナ上二", StemN, SuperBigrade)
, ("ナ上一", StemN, SuperMonograde)
, ("ナ下二", StemN, SubBigrade)
, ("ナ下一", StemN, SubMonograde)
, ("ナ變", StemN, Irregular)
, ("ナ変", StemN, Irregular)
, ("ハ四", StemF, Quadrigrade)
, ("ハ五", StemF, Quinquegrade)
, ("ハ上二", StemF, SuperBigrade)
, ("ハ上一", StemF, SuperMonograde)
, ("ハ下二", StemF, SubBigrade)
, ("ハ下一", StemF, SubMonograde)
, ("バ四", StemB, Quadrigrade)
, ("バ五", StemB, Quinquegrade)
, ("バ上二", StemB, SuperBigrade)
, ("バ上一", StemB, SuperMonograde)
, ("バ下二", StemB, SubBigrade)
, ("バ下一", StemB, SubMonograde)
, ("パ四", StemP, Quadrigrade)
, ("パ五", StemP, Quinquegrade)
, ("パ上二", StemP, SuperBigrade)
, ("パ上一", StemP, SuperMonograde)
, ("パ下二", StemP, SubBigrade)
, ("パ下一", StemP, SubMonograde)
, ("マ四", StemM, Quadrigrade)
, ("マ五", StemM, Quinquegrade)
, ("マ上二", StemM, SuperBigrade)
, ("マ上一", StemM, SuperMonograde)
, ("マ下二", StemM, SubBigrade)
, ("マ下一", StemM, SubMonograde)
, ("ヤ四", StemY, Quadrigrade)
, ("ヤ五", StemY, Quinquegrade)
, ("ヤ上二", StemY, SuperBigrade)
, ("ヤ上一", StemY, SuperMonograde)
, ("ヤ下二", StemY, SubBigrade)
, ("ヤ下一", StemY, SubMonograde)
, ("ラ四", StemR, Quadrigrade)
, ("ラ五", StemR, Quinquegrade)
, ("ラ上二", StemR, SuperBigrade)
, ("ラ上一", StemR, SuperMonograde)
, ("ラ下二", StemR, SubBigrade)
, ("ラ下一", StemR, SubMonograde)
, ("ラ變", StemR, Irregular)
, ("ラ変", StemR, Irregular)
, ("ワ四", StemW, Quadrigrade)
, ("ワ五", StemW, Quinquegrade)
, ("ワ上二", StemW, SuperBigrade)
, ("ワ上一", StemW, SuperMonograde)
, ("ワ下二", StemW, SubBigrade)
, ("ワ下一", StemW, SubMonograde)
] | 4,271 | jaVerbClasses :: Map String JaVerbConjugation
jaVerbClasses = M.fromList $ do
(x, s, c) <- ls
[ (x, JaVerbConjugation ModernStandardJapanese s c)
, ("文" `mappend` x, JaVerbConjugation MiddleJapanese s c)
]
where
ls = [ ("ア四", StemZero, Quadrigrade)
, ("ア五", StemZero, Quinquegrade)
, ("ア上二", StemZero, SuperBigrade)
, ("ア上一", StemZero, SuperMonograde)
, ("ア下二", StemZero, SubBigrade)
, ("ア下一", StemZero, SubMonograde)
, ("カ四", StemK, Quadrigrade)
, ("カ五", StemK, Quinquegrade)
, ("カ上二", StemK, SuperBigrade)
, ("カ上一", StemK, SuperMonograde)
, ("カ下二", StemK, SubBigrade)
, ("カ下一", StemK, SubMonograde)
, ("カ變", StemK, Irregular)
, ("カ変", StemK, Irregular)
, ("ガ四", StemG, Quadrigrade)
, ("ガ五", StemG, Quinquegrade)
, ("ガ上二", StemG, SuperBigrade)
, ("ガ上一", StemG, SuperMonograde)
, ("ガ下二", StemG, SubBigrade)
, ("ガ下一", StemG, SubMonograde)
, ("サ四", StemS, Quadrigrade)
, ("サ五", StemS, Quinquegrade)
, ("サ上二", StemS, SuperBigrade)
, ("サ上一", StemS, SuperMonograde)
, ("サ下二", StemS, SubBigrade)
, ("サ下一", StemS, SubMonograde)
, ("サ變", StemS, Irregular)
, ("サ変", StemS, Irregular)
, ("ザ四", StemZ, Quadrigrade)
, ("ザ五", StemZ, Quinquegrade)
, ("ザ上二", StemZ, SuperBigrade)
, ("ザ上一", StemZ, SuperMonograde)
, ("ザ下二", StemZ, SubBigrade)
, ("ザ下一", StemZ, SubMonograde)
, ("ザ變", StemZ, Irregular)
, ("ザ変", StemZ, Irregular)
, ("タ四", StemT, Quadrigrade)
, ("タ五", StemT, Quinquegrade)
, ("タ上二", StemT, SuperBigrade)
, ("タ上一", StemT, SuperMonograde)
, ("タ下二", StemT, SubBigrade)
, ("タ下一", StemT, SubMonograde)
, ("ダ四", StemD, Quadrigrade)
, ("ダ五", StemD, Quinquegrade)
, ("ダ上二", StemD, SuperBigrade)
, ("ダ上一", StemD, SuperMonograde)
, ("ダ下二", StemD, SubBigrade)
, ("ダ下一", StemD, SubMonograde)
, ("ナ四", StemN, Quadrigrade)
, ("ナ五", StemN, Quinquegrade)
, ("ナ上二", StemN, SuperBigrade)
, ("ナ上一", StemN, SuperMonograde)
, ("ナ下二", StemN, SubBigrade)
, ("ナ下一", StemN, SubMonograde)
, ("ナ變", StemN, Irregular)
, ("ナ変", StemN, Irregular)
, ("ハ四", StemF, Quadrigrade)
, ("ハ五", StemF, Quinquegrade)
, ("ハ上二", StemF, SuperBigrade)
, ("ハ上一", StemF, SuperMonograde)
, ("ハ下二", StemF, SubBigrade)
, ("ハ下一", StemF, SubMonograde)
, ("バ四", StemB, Quadrigrade)
, ("バ五", StemB, Quinquegrade)
, ("バ上二", StemB, SuperBigrade)
, ("バ上一", StemB, SuperMonograde)
, ("バ下二", StemB, SubBigrade)
, ("バ下一", StemB, SubMonograde)
, ("パ四", StemP, Quadrigrade)
, ("パ五", StemP, Quinquegrade)
, ("パ上二", StemP, SuperBigrade)
, ("パ上一", StemP, SuperMonograde)
, ("パ下二", StemP, SubBigrade)
, ("パ下一", StemP, SubMonograde)
, ("マ四", StemM, Quadrigrade)
, ("マ五", StemM, Quinquegrade)
, ("マ上二", StemM, SuperBigrade)
, ("マ上一", StemM, SuperMonograde)
, ("マ下二", StemM, SubBigrade)
, ("マ下一", StemM, SubMonograde)
, ("ヤ四", StemY, Quadrigrade)
, ("ヤ五", StemY, Quinquegrade)
, ("ヤ上二", StemY, SuperBigrade)
, ("ヤ上一", StemY, SuperMonograde)
, ("ヤ下二", StemY, SubBigrade)
, ("ヤ下一", StemY, SubMonograde)
, ("ラ四", StemR, Quadrigrade)
, ("ラ五", StemR, Quinquegrade)
, ("ラ上二", StemR, SuperBigrade)
, ("ラ上一", StemR, SuperMonograde)
, ("ラ下二", StemR, SubBigrade)
, ("ラ下一", StemR, SubMonograde)
, ("ラ變", StemR, Irregular)
, ("ラ変", StemR, Irregular)
, ("ワ四", StemW, Quadrigrade)
, ("ワ五", StemW, Quinquegrade)
, ("ワ上二", StemW, SuperBigrade)
, ("ワ上一", StemW, SuperMonograde)
, ("ワ下二", StemW, SubBigrade)
, ("ワ下一", StemW, SubMonograde)
] | 4,271 | jaVerbClasses = M.fromList $ do
(x, s, c) <- ls
[ (x, JaVerbConjugation ModernStandardJapanese s c)
, ("文" `mappend` x, JaVerbConjugation MiddleJapanese s c)
]
where
ls = [ ("ア四", StemZero, Quadrigrade)
, ("ア五", StemZero, Quinquegrade)
, ("ア上二", StemZero, SuperBigrade)
, ("ア上一", StemZero, SuperMonograde)
, ("ア下二", StemZero, SubBigrade)
, ("ア下一", StemZero, SubMonograde)
, ("カ四", StemK, Quadrigrade)
, ("カ五", StemK, Quinquegrade)
, ("カ上二", StemK, SuperBigrade)
, ("カ上一", StemK, SuperMonograde)
, ("カ下二", StemK, SubBigrade)
, ("カ下一", StemK, SubMonograde)
, ("カ變", StemK, Irregular)
, ("カ変", StemK, Irregular)
, ("ガ四", StemG, Quadrigrade)
, ("ガ五", StemG, Quinquegrade)
, ("ガ上二", StemG, SuperBigrade)
, ("ガ上一", StemG, SuperMonograde)
, ("ガ下二", StemG, SubBigrade)
, ("ガ下一", StemG, SubMonograde)
, ("サ四", StemS, Quadrigrade)
, ("サ五", StemS, Quinquegrade)
, ("サ上二", StemS, SuperBigrade)
, ("サ上一", StemS, SuperMonograde)
, ("サ下二", StemS, SubBigrade)
, ("サ下一", StemS, SubMonograde)
, ("サ變", StemS, Irregular)
, ("サ変", StemS, Irregular)
, ("ザ四", StemZ, Quadrigrade)
, ("ザ五", StemZ, Quinquegrade)
, ("ザ上二", StemZ, SuperBigrade)
, ("ザ上一", StemZ, SuperMonograde)
, ("ザ下二", StemZ, SubBigrade)
, ("ザ下一", StemZ, SubMonograde)
, ("ザ變", StemZ, Irregular)
, ("ザ変", StemZ, Irregular)
, ("タ四", StemT, Quadrigrade)
, ("タ五", StemT, Quinquegrade)
, ("タ上二", StemT, SuperBigrade)
, ("タ上一", StemT, SuperMonograde)
, ("タ下二", StemT, SubBigrade)
, ("タ下一", StemT, SubMonograde)
, ("ダ四", StemD, Quadrigrade)
, ("ダ五", StemD, Quinquegrade)
, ("ダ上二", StemD, SuperBigrade)
, ("ダ上一", StemD, SuperMonograde)
, ("ダ下二", StemD, SubBigrade)
, ("ダ下一", StemD, SubMonograde)
, ("ナ四", StemN, Quadrigrade)
, ("ナ五", StemN, Quinquegrade)
, ("ナ上二", StemN, SuperBigrade)
, ("ナ上一", StemN, SuperMonograde)
, ("ナ下二", StemN, SubBigrade)
, ("ナ下一", StemN, SubMonograde)
, ("ナ變", StemN, Irregular)
, ("ナ変", StemN, Irregular)
, ("ハ四", StemF, Quadrigrade)
, ("ハ五", StemF, Quinquegrade)
, ("ハ上二", StemF, SuperBigrade)
, ("ハ上一", StemF, SuperMonograde)
, ("ハ下二", StemF, SubBigrade)
, ("ハ下一", StemF, SubMonograde)
, ("バ四", StemB, Quadrigrade)
, ("バ五", StemB, Quinquegrade)
, ("バ上二", StemB, SuperBigrade)
, ("バ上一", StemB, SuperMonograde)
, ("バ下二", StemB, SubBigrade)
, ("バ下一", StemB, SubMonograde)
, ("パ四", StemP, Quadrigrade)
, ("パ五", StemP, Quinquegrade)
, ("パ上二", StemP, SuperBigrade)
, ("パ上一", StemP, SuperMonograde)
, ("パ下二", StemP, SubBigrade)
, ("パ下一", StemP, SubMonograde)
, ("マ四", StemM, Quadrigrade)
, ("マ五", StemM, Quinquegrade)
, ("マ上二", StemM, SuperBigrade)
, ("マ上一", StemM, SuperMonograde)
, ("マ下二", StemM, SubBigrade)
, ("マ下一", StemM, SubMonograde)
, ("ヤ四", StemY, Quadrigrade)
, ("ヤ五", StemY, Quinquegrade)
, ("ヤ上二", StemY, SuperBigrade)
, ("ヤ上一", StemY, SuperMonograde)
, ("ヤ下二", StemY, SubBigrade)
, ("ヤ下一", StemY, SubMonograde)
, ("ラ四", StemR, Quadrigrade)
, ("ラ五", StemR, Quinquegrade)
, ("ラ上二", StemR, SuperBigrade)
, ("ラ上一", StemR, SuperMonograde)
, ("ラ下二", StemR, SubBigrade)
, ("ラ下一", StemR, SubMonograde)
, ("ラ變", StemR, Irregular)
, ("ラ変", StemR, Irregular)
, ("ワ四", StemW, Quadrigrade)
, ("ワ五", StemW, Quinquegrade)
, ("ワ上二", StemW, SuperBigrade)
, ("ワ上一", StemW, SuperMonograde)
, ("ワ下二", StemW, SubBigrade)
, ("ワ下一", StemW, SubMonograde)
] | 4,225 | false | true | 0 | 10 | 1,453 | 1,287 | 847 | 440 | null | null |
dillonhuff/Folly | src/Folly/Formula.hs | bsd-3-clause | skolemize :: Formula -> Formula
skolemize f = (transformFormula removeExistential) $ replaceVarsWithSkolemFuncs f | 113 | skolemize :: Formula -> Formula
skolemize f = (transformFormula removeExistential) $ replaceVarsWithSkolemFuncs f | 113 | skolemize f = (transformFormula removeExistential) $ replaceVarsWithSkolemFuncs f | 81 | false | true | 0 | 7 | 12 | 31 | 15 | 16 | null | null |
spatial-reasoning/zeno | src/compareGivenNetworks.hs | bsd-2-clause | dpCheckConsistency :: [Network [String] (Set.Set Dipole72)]
-> [[Maybe Bool]]
dpCheckConsistency nets = answers
where
-- answers = [sparqAnswers, gqrAnswers, triangleAnswers, chirotopeAnswers] `using` parList rdeepseq
-- answers = [sparqAnswers, gqrAnswers, triangleAnswers, chirotopeAnswers] `using` parList rseq
-- answers = [sparqAnswers, gqrAnswers, triangleAnswers, chirotopeAnswers]
-- answers = [sparqAnswersPar, gqrAnswers, triangleAnswers, chirotopeAnswers]
answers = [ aClosureAnswers
, aReasoningAnswers
, triangleAnswers
, chirotopeAnswers
, biquadraticPolynomialAnswers
]
aClosureAnswers = map ((\(x,_,_) -> x) . S.algebraicClosure "dra-72") nets
aReasoningAnswers = map (S.algebraicReasoning "dra-72") nets
triangleAnswers = map (T.checkConsistencyDipole72 . makeAtomic) nets
chirotopeAnswers = map (isAcyclicChirotopeDipole72 . makeAtomic) nets
biquadraticPolynomialAnswers = map (isAcyclicChirotopeWithoutBPDipole72 . makeAtomic) nets
-- chirotopeAndBiquadraticPolynomialAnswers = map (isAcyclicChirotopePlainAndWithoutBPDipole72 . makeAtomic) nets
-- [chirotopeAnswers, biquadraticPolynomialAnswers] = transpose chirotopeAndBiquadraticPolynomialAnswers
-- aClosureAnswers = parMap rseq ((\(x,_,_) -> x) . S.algebraicClosure "dra-72") nets
-- aReasoningAnswers = parMap rseq (S.algebraicReasoning "dra-72") nets
-- triangleAnswers = parMap rseq (T.checkConsistencyDipole72 . makeAtomic) nets
-- chirotopeAnswers = parMap rseq (isAcyclicChirotopeDipole72 . makeAtomic) nets
-- biquadraticPolynomialAnswers = parMap rseq (isAcyclicChirotopeWithoutBPDipole72 . makeAtomic) nets | 1,740 | dpCheckConsistency :: [Network [String] (Set.Set Dipole72)]
-> [[Maybe Bool]]
dpCheckConsistency nets = answers
where
-- answers = [sparqAnswers, gqrAnswers, triangleAnswers, chirotopeAnswers] `using` parList rdeepseq
-- answers = [sparqAnswers, gqrAnswers, triangleAnswers, chirotopeAnswers] `using` parList rseq
-- answers = [sparqAnswers, gqrAnswers, triangleAnswers, chirotopeAnswers]
-- answers = [sparqAnswersPar, gqrAnswers, triangleAnswers, chirotopeAnswers]
answers = [ aClosureAnswers
, aReasoningAnswers
, triangleAnswers
, chirotopeAnswers
, biquadraticPolynomialAnswers
]
aClosureAnswers = map ((\(x,_,_) -> x) . S.algebraicClosure "dra-72") nets
aReasoningAnswers = map (S.algebraicReasoning "dra-72") nets
triangleAnswers = map (T.checkConsistencyDipole72 . makeAtomic) nets
chirotopeAnswers = map (isAcyclicChirotopeDipole72 . makeAtomic) nets
biquadraticPolynomialAnswers = map (isAcyclicChirotopeWithoutBPDipole72 . makeAtomic) nets
-- chirotopeAndBiquadraticPolynomialAnswers = map (isAcyclicChirotopePlainAndWithoutBPDipole72 . makeAtomic) nets
-- [chirotopeAnswers, biquadraticPolynomialAnswers] = transpose chirotopeAndBiquadraticPolynomialAnswers
-- aClosureAnswers = parMap rseq ((\(x,_,_) -> x) . S.algebraicClosure "dra-72") nets
-- aReasoningAnswers = parMap rseq (S.algebraicReasoning "dra-72") nets
-- triangleAnswers = parMap rseq (T.checkConsistencyDipole72 . makeAtomic) nets
-- chirotopeAnswers = parMap rseq (isAcyclicChirotopeDipole72 . makeAtomic) nets
-- biquadraticPolynomialAnswers = parMap rseq (isAcyclicChirotopeWithoutBPDipole72 . makeAtomic) nets | 1,740 | dpCheckConsistency nets = answers
where
-- answers = [sparqAnswers, gqrAnswers, triangleAnswers, chirotopeAnswers] `using` parList rdeepseq
-- answers = [sparqAnswers, gqrAnswers, triangleAnswers, chirotopeAnswers] `using` parList rseq
-- answers = [sparqAnswers, gqrAnswers, triangleAnswers, chirotopeAnswers]
-- answers = [sparqAnswersPar, gqrAnswers, triangleAnswers, chirotopeAnswers]
answers = [ aClosureAnswers
, aReasoningAnswers
, triangleAnswers
, chirotopeAnswers
, biquadraticPolynomialAnswers
]
aClosureAnswers = map ((\(x,_,_) -> x) . S.algebraicClosure "dra-72") nets
aReasoningAnswers = map (S.algebraicReasoning "dra-72") nets
triangleAnswers = map (T.checkConsistencyDipole72 . makeAtomic) nets
chirotopeAnswers = map (isAcyclicChirotopeDipole72 . makeAtomic) nets
biquadraticPolynomialAnswers = map (isAcyclicChirotopeWithoutBPDipole72 . makeAtomic) nets
-- chirotopeAndBiquadraticPolynomialAnswers = map (isAcyclicChirotopePlainAndWithoutBPDipole72 . makeAtomic) nets
-- [chirotopeAnswers, biquadraticPolynomialAnswers] = transpose chirotopeAndBiquadraticPolynomialAnswers
-- aClosureAnswers = parMap rseq ((\(x,_,_) -> x) . S.algebraicClosure "dra-72") nets
-- aReasoningAnswers = parMap rseq (S.algebraicReasoning "dra-72") nets
-- triangleAnswers = parMap rseq (T.checkConsistencyDipole72 . makeAtomic) nets
-- chirotopeAnswers = parMap rseq (isAcyclicChirotopeDipole72 . makeAtomic) nets
-- biquadraticPolynomialAnswers = parMap rseq (isAcyclicChirotopeWithoutBPDipole72 . makeAtomic) nets | 1,643 | false | true | 5 | 11 | 308 | 214 | 109 | 105 | null | null |
reiddraper/cauterize | src/Cauterize/Dynamic/Meta/Unpack.hs | bsd-3-clause | dynamicMetaUnpackHeader :: Spec.Spec -> B.ByteString -> Either String (MetaHeader, B.ByteString)
dynamicMetaUnpackHeader spec b = runGetState p b 0
where
p = do
let tagLen = fromIntegral . Spec.unTypeTagWidth . Spec.specTypeTagWidth $ spec
let dataLen = fromIntegral . Spec.unLengthTagWidth . Spec.specLengthTagWidth $ spec
len <- liftM fromIntegral (unpackLengthWithWidth dataLen)
tag <- liftM B.unpack $ getByteString tagLen
return $ MetaHeader len tag | 492 | dynamicMetaUnpackHeader :: Spec.Spec -> B.ByteString -> Either String (MetaHeader, B.ByteString)
dynamicMetaUnpackHeader spec b = runGetState p b 0
where
p = do
let tagLen = fromIntegral . Spec.unTypeTagWidth . Spec.specTypeTagWidth $ spec
let dataLen = fromIntegral . Spec.unLengthTagWidth . Spec.specLengthTagWidth $ spec
len <- liftM fromIntegral (unpackLengthWithWidth dataLen)
tag <- liftM B.unpack $ getByteString tagLen
return $ MetaHeader len tag | 492 | dynamicMetaUnpackHeader spec b = runGetState p b 0
where
p = do
let tagLen = fromIntegral . Spec.unTypeTagWidth . Spec.specTypeTagWidth $ spec
let dataLen = fromIntegral . Spec.unLengthTagWidth . Spec.specLengthTagWidth $ spec
len <- liftM fromIntegral (unpackLengthWithWidth dataLen)
tag <- liftM B.unpack $ getByteString tagLen
return $ MetaHeader len tag | 395 | false | true | 7 | 9 | 97 | 139 | 69 | 70 | null | null |
yigitozkavci/glow | src/Codegen.hs | mit | fcmp :: FP.FloatingPointPredicate -> Operand -> Operand -> Codegen Operand
fcmp cond a b = instr double $ FCmp cond a b [] | 122 | fcmp :: FP.FloatingPointPredicate -> Operand -> Operand -> Codegen Operand
fcmp cond a b = instr double $ FCmp cond a b [] | 122 | fcmp cond a b = instr double $ FCmp cond a b [] | 47 | false | true | 0 | 8 | 22 | 53 | 25 | 28 | null | null |
arekfu/project_euler | p0054/p0054.hs | mit | allSameSuit :: [Card] -> Bool
allSameSuit [c] = True | 52 | allSameSuit :: [Card] -> Bool
allSameSuit [c] = True | 52 | allSameSuit [c] = True | 22 | false | true | 0 | 8 | 8 | 30 | 14 | 16 | null | null |
peterokagey/haskellOEIS | test/KthDifferences/A327743Spec.hs | apache-2.0 | main :: IO ()
main = hspec spec | 31 | main :: IO ()
main = hspec spec | 31 | main = hspec spec | 17 | false | true | 1 | 6 | 7 | 22 | 9 | 13 | null | null |
ganeti-github-testing/ganeti-test-1 | src/Ganeti/HTools/Node.hs | bsd-2-clause | -- | Set the migration tags a node is able to receive
setRecvMigrationTags :: Node -> Set.Set String -> Node
setRecvMigrationTags t val = t { rmigTags = val } | 158 | setRecvMigrationTags :: Node -> Set.Set String -> Node
setRecvMigrationTags t val = t { rmigTags = val } | 104 | setRecvMigrationTags t val = t { rmigTags = val } | 49 | true | true | 0 | 8 | 29 | 38 | 20 | 18 | null | null |
gwright83/Wheeler | src/Math/Symbolic/Wheeler/MetricTensor.hs | bsd-3-clause | contractedPair :: [ VarIndex ] -> Bool
contractedPair (x : y : []) = x == (-y) | 78 | contractedPair :: [ VarIndex ] -> Bool
contractedPair (x : y : []) = x == (-y) | 78 | contractedPair (x : y : []) = x == (-y) | 39 | false | true | 0 | 9 | 16 | 43 | 23 | 20 | null | null |
markhibberd/pin | src/Network/Api/Pin/Defaults.hs | bsd-3-clause | pinTestConfig :: Text -> PinConfig
pinTestConfig key =
PinConfig "https://test-api.pin.net.au/1/charges" key (def { managerCheckCerts = checkDomainOnly }) | 156 | pinTestConfig :: Text -> PinConfig
pinTestConfig key =
PinConfig "https://test-api.pin.net.au/1/charges" key (def { managerCheckCerts = checkDomainOnly }) | 156 | pinTestConfig key =
PinConfig "https://test-api.pin.net.au/1/charges" key (def { managerCheckCerts = checkDomainOnly }) | 121 | false | true | 0 | 8 | 18 | 36 | 19 | 17 | null | null |
Mr-Click/PFQ | user/Haskell/Network/PFq/Experimental.hs | gpl-2.0 | -- | Evaluate to /True/ if the SkBuff is a GTP Control-Plane packet.
is_gtp_cp = Predicate "is_gtp_cp" () () () () () () () () :: NetPredicate | 142 | is_gtp_cp = Predicate "is_gtp_cp" () () () () () () () () :: NetPredicate | 73 | is_gtp_cp = Predicate "is_gtp_cp" () () () () () () () () :: NetPredicate | 73 | true | false | 0 | 6 | 26 | 45 | 23 | 22 | null | null |
WSCU/JSEuterpea | Euterpea Examples/Rhythm.hs | gpl-3.0 | --added
sectionB = tempo q 180 (sB + sBm) | 42 | sectionB = tempo q 180 (sB + sBm) | 33 | sectionB = tempo q 180 (sB + sBm) | 33 | true | false | 1 | 7 | 9 | 27 | 11 | 16 | null | null |
ian-ross/cabal | cabal-install/Distribution/Client/Setup.hs | bsd-3-clause | defaultConfigExFlags :: ConfigExFlags
defaultConfigExFlags = mempty { configSolver = Flag defaultSolver
, configAllowNewer = Flag AllowNewerNone } | 180 | defaultConfigExFlags :: ConfigExFlags
defaultConfigExFlags = mempty { configSolver = Flag defaultSolver
, configAllowNewer = Flag AllowNewerNone } | 180 | defaultConfigExFlags = mempty { configSolver = Flag defaultSolver
, configAllowNewer = Flag AllowNewerNone } | 142 | false | true | 0 | 7 | 50 | 31 | 17 | 14 | null | null |
sdiehl/ghc | compiler/coreSyn/CoreSyn.hs | bsd-3-clause | rhssOfBind (Rec pairs) = [rhs | (_,rhs) <- pairs] | 52 | rhssOfBind (Rec pairs) = [rhs | (_,rhs) <- pairs] | 52 | rhssOfBind (Rec pairs) = [rhs | (_,rhs) <- pairs] | 52 | false | false | 0 | 8 | 11 | 33 | 17 | 16 | null | null |
google-code/bkil-open | volatile/edu/ep_2_1.hs | gpl-2.0 | ep_2_1 :: Ord k => KV11 k v -> KV11 k v -> KV21 k v -> OKVL k v -> OKVL k v -> OKVL k v
ep_2_1 f1 f2 f12 xs ys = catMaybes $ f [] xs ys where
f zs (x:xs) (y:ys) =
case compare x y of
LT -> f (f1 x:zs) xs (y:ys)
GT -> f (f2 y:zs) (x:xs) ys
EQ -> f (f12 x y:zs) xs ys
f zs xr yr = reverse zs ++ map f1 xr ++ map f2 yr | 342 | ep_2_1 :: Ord k => KV11 k v -> KV11 k v -> KV21 k v -> OKVL k v -> OKVL k v -> OKVL k v
ep_2_1 f1 f2 f12 xs ys = catMaybes $ f [] xs ys where
f zs (x:xs) (y:ys) =
case compare x y of
LT -> f (f1 x:zs) xs (y:ys)
GT -> f (f2 y:zs) (x:xs) ys
EQ -> f (f12 x y:zs) xs ys
f zs xr yr = reverse zs ++ map f1 xr ++ map f2 yr | 342 | ep_2_1 f1 f2 f12 xs ys = catMaybes $ f [] xs ys where
f zs (x:xs) (y:ys) =
case compare x y of
LT -> f (f1 x:zs) xs (y:ys)
GT -> f (f2 y:zs) (x:xs) ys
EQ -> f (f12 x y:zs) xs ys
f zs xr yr = reverse zs ++ map f1 xr ++ map f2 yr | 254 | false | true | 0 | 13 | 115 | 251 | 119 | 132 | null | null |
spechub/Hets | LF/Sign.hs | gpl-2.0 | -- tests for inclusion of signatures
isSubsig :: Sign -> Sign -> Bool
isSubsig (Sign _ _ ds1) (Sign _ _ ds2) =
Set.isSubsetOf (Set.fromList ds1) (Set.fromList ds2) | 165 | isSubsig :: Sign -> Sign -> Bool
isSubsig (Sign _ _ ds1) (Sign _ _ ds2) =
Set.isSubsetOf (Set.fromList ds1) (Set.fromList ds2) | 128 | isSubsig (Sign _ _ ds1) (Sign _ _ ds2) =
Set.isSubsetOf (Set.fromList ds1) (Set.fromList ds2) | 95 | true | true | 0 | 8 | 29 | 68 | 34 | 34 | null | null |
thsutton/type-assignment | lib/Terms.hs | bsd-3-clause | -- | Rename variables in a lambda-term such that none are both bound and free.
unclash :: (Variable v, Ord v) => Term v -> Term v
unclash term =
let _all_vars = S.union (free term) (bound term)
clash = clashing term
sub = M.fromList [ (v,v) | v <- S.toList clash]
in if S.null clash
then term
else worker sub term
where
worker s (Var v) = Var . fromMaybe v $ M.lookup v s
worker _ (App f a) = App f a
worker _ (Abs v b) = Abs v b
-- | Check whether a lambda-term is open (i.e. has free variables). | 554 | unclash :: (Variable v, Ord v) => Term v -> Term v
unclash term =
let _all_vars = S.union (free term) (bound term)
clash = clashing term
sub = M.fromList [ (v,v) | v <- S.toList clash]
in if S.null clash
then term
else worker sub term
where
worker s (Var v) = Var . fromMaybe v $ M.lookup v s
worker _ (App f a) = App f a
worker _ (Abs v b) = Abs v b
-- | Check whether a lambda-term is open (i.e. has free variables). | 475 | unclash term =
let _all_vars = S.union (free term) (bound term)
clash = clashing term
sub = M.fromList [ (v,v) | v <- S.toList clash]
in if S.null clash
then term
else worker sub term
where
worker s (Var v) = Var . fromMaybe v $ M.lookup v s
worker _ (App f a) = App f a
worker _ (Abs v b) = Abs v b
-- | Check whether a lambda-term is open (i.e. has free variables). | 424 | true | true | 0 | 14 | 162 | 212 | 104 | 108 | null | null |
markus1189/lambda-feed | src/LambdaFeed/Widgets.hs | gpl-3.0 | newArticleWidget :: Show b => IO (Widget (List a b))
newArticleWidget = do
lst <- newList 1
setSelectedFocusedAttr lst (Just defAttr)
setSelectedUnfocusedAttr lst (Just defAttr)
lst `onKeyPressed` \this k _ -> case k of
(KChar ' ') -> pageDown this >> return True
KBS -> pageUp this >> return True
_ -> return False
return lst | 348 | newArticleWidget :: Show b => IO (Widget (List a b))
newArticleWidget = do
lst <- newList 1
setSelectedFocusedAttr lst (Just defAttr)
setSelectedUnfocusedAttr lst (Just defAttr)
lst `onKeyPressed` \this k _ -> case k of
(KChar ' ') -> pageDown this >> return True
KBS -> pageUp this >> return True
_ -> return False
return lst | 348 | newArticleWidget = do
lst <- newList 1
setSelectedFocusedAttr lst (Just defAttr)
setSelectedUnfocusedAttr lst (Just defAttr)
lst `onKeyPressed` \this k _ -> case k of
(KChar ' ') -> pageDown this >> return True
KBS -> pageUp this >> return True
_ -> return False
return lst | 295 | false | true | 0 | 14 | 77 | 154 | 69 | 85 | null | null |
drhodes/jade2hdl | src/Jade/Part.hs | bsd-3-clause | isTerm (TermC _) = True | 23 | isTerm (TermC _) = True | 23 | isTerm (TermC _) = True | 23 | false | false | 0 | 7 | 4 | 15 | 7 | 8 | null | null |
drcabana/euler-fp | source/hs/P03.hs | epl-1.0 | main = do print solution | 24 | main = do print solution | 24 | main = do print solution | 24 | false | false | 0 | 7 | 4 | 12 | 5 | 7 | null | null |
mdsteele/fallback | src/Fallback/State/Area.hs | gpl-3.0 | arsExploredMap :: (AreaState a) => a -> ExploredMap
arsExploredMap ars = partyExploredMap (arsTerrain ars) (arsParty ars) | 121 | arsExploredMap :: (AreaState a) => a -> ExploredMap
arsExploredMap ars = partyExploredMap (arsTerrain ars) (arsParty ars) | 121 | arsExploredMap ars = partyExploredMap (arsTerrain ars) (arsParty ars) | 69 | false | true | 0 | 7 | 15 | 44 | 22 | 22 | null | null |
phaazon/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/Tokens.hs | bsd-3-clause | gl_PROGRAM_PIPELINE :: GLenum
gl_PROGRAM_PIPELINE = 0x82E4 | 58 | gl_PROGRAM_PIPELINE :: GLenum
gl_PROGRAM_PIPELINE = 0x82E4 | 58 | gl_PROGRAM_PIPELINE = 0x82E4 | 28 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
trbauer/hrun | HRun.hs | mit | main :: IO ()
main = do
SE.getArgs >>= runWithArgs >>= SE.exitWith
-- Tests | 82 | main :: IO ()
main = do
SE.getArgs >>= runWithArgs >>= SE.exitWith
-- Tests | 81 | main = do
SE.getArgs >>= runWithArgs >>= SE.exitWith
-- Tests | 67 | false | true | 0 | 9 | 20 | 38 | 17 | 21 | null | null |
music-suite/music-pitch | src/Music/Pitch/Equal.hs | bsd-3-clause | getSize :: IsNat a => Equal a -> Nat a
getSize _ = nat | 54 | getSize :: IsNat a => Equal a -> Nat a
getSize _ = nat | 54 | getSize _ = nat | 15 | false | true | 0 | 8 | 13 | 36 | 15 | 21 | null | null |
miguelpagano/equ | Equ/Parser/Expr.hs | gpl-3.0 | -- | Parseo de la lista escrita con syntax sugar.
sugarList :: PExprStateClass s => ParserE s PreExpr -> PExprStateClass s => ParserE s PreExpr
sugarList p = foldr (BinOp listApp) (Con listEmpty) <$> commaSep lexer p | 216 | sugarList :: PExprStateClass s => ParserE s PreExpr -> PExprStateClass s => ParserE s PreExpr
sugarList p = foldr (BinOp listApp) (Con listEmpty) <$> commaSep lexer p | 166 | sugarList p = foldr (BinOp listApp) (Con listEmpty) <$> commaSep lexer p | 72 | true | true | 0 | 9 | 36 | 74 | 33 | 41 | null | null |
dylanmann/CurriersOfCatan | src/Board.hs | gpl-3.0 | makeTileLocation x 2 | x < 12 = Just $ TileLocation (x, 2) | 66 | makeTileLocation x 2 | x < 12 = Just $ TileLocation (x, 2) | 66 | makeTileLocation x 2 | x < 12 = Just $ TileLocation (x, 2) | 66 | false | false | 0 | 8 | 20 | 34 | 16 | 18 | null | null |
traeger/fol-solver | Folsolver/TPTP.hs | gpl-3.0 | transformOnInput :: (Formula -> Formula) -> TPTP_Input -> TPTP_Input
transformOnInput fun (AFormula name role form anno) = AFormula name role (fun form) anno | 157 | transformOnInput :: (Formula -> Formula) -> TPTP_Input -> TPTP_Input
transformOnInput fun (AFormula name role form anno) = AFormula name role (fun form) anno | 157 | transformOnInput fun (AFormula name role form anno) = AFormula name role (fun form) anno | 88 | false | true | 0 | 7 | 22 | 58 | 29 | 29 | null | null |
achirkin/ghcjs-webgl | src/JavaScript/WebGL/Const.hs | mit | gl_RENDERBUFFER_STENCIL_SIZE :: GLenum
gl_RENDERBUFFER_STENCIL_SIZE = 0x8D55 | 76 | gl_RENDERBUFFER_STENCIL_SIZE :: GLenum
gl_RENDERBUFFER_STENCIL_SIZE = 0x8D55 | 76 | gl_RENDERBUFFER_STENCIL_SIZE = 0x8D55 | 37 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
snoyberg/nonterminating-pipes | src/Generator.hs | mit | fuse :: Monad m
=> ConduitM a b m ()
-> ConduitM b c m r
-> ConduitM a c m r
fuse (ConduitM up) (ConduitM down) = ConduitM $ liftM (first drain) . down . up | 171 | fuse :: Monad m
=> ConduitM a b m ()
-> ConduitM b c m r
-> ConduitM a c m r
fuse (ConduitM up) (ConduitM down) = ConduitM $ liftM (first drain) . down . up | 171 | fuse (ConduitM up) (ConduitM down) = ConduitM $ liftM (first drain) . down . up | 79 | false | true | 0 | 10 | 51 | 93 | 44 | 49 | null | null |
gcampax/ghc | compiler/types/TyCon.hs | bsd-3-clause | isDataProductTyCon_maybe (TupleTyCon { dataCon = con })
= Just con | 68 | isDataProductTyCon_maybe (TupleTyCon { dataCon = con })
= Just con | 68 | isDataProductTyCon_maybe (TupleTyCon { dataCon = con })
= Just con | 68 | false | false | 0 | 9 | 11 | 24 | 12 | 12 | null | null |
leshchevds/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | autoRepairSuccess :: String
autoRepairSuccess = Types.autoRepairResultToRaw ArSuccess | 85 | autoRepairSuccess :: String
autoRepairSuccess = Types.autoRepairResultToRaw ArSuccess | 85 | autoRepairSuccess = Types.autoRepairResultToRaw ArSuccess | 57 | false | true | 0 | 6 | 6 | 16 | 8 | 8 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Generated/HTMLMarqueeElement.hs | mit | -- | <https://developer.mozilla.org/en-US/docs/Web/API/HTMLMarqueeElement.scrollAmount Mozilla HTMLMarqueeElement.scrollAmount documentation>
getScrollAmount :: (MonadDOM m) => HTMLMarqueeElement -> m Word
getScrollAmount self
= liftDOM (round <$> ((self ^. js "scrollAmount") >>= valToNumber)) | 297 | getScrollAmount :: (MonadDOM m) => HTMLMarqueeElement -> m Word
getScrollAmount self
= liftDOM (round <$> ((self ^. js "scrollAmount") >>= valToNumber)) | 154 | getScrollAmount self
= liftDOM (round <$> ((self ^. js "scrollAmount") >>= valToNumber)) | 90 | true | true | 0 | 12 | 29 | 58 | 30 | 28 | null | null |
ltcmelo/psychec | formalism/muC.hs | bsd-3-clause | -- | Return whether the type is a ground type.
isGround :: Type -> Bool
isGround t =
if ftv t == []
then True
else False | 126 | isGround :: Type -> Bool
isGround t =
if ftv t == []
then True
else False | 79 | isGround t =
if ftv t == []
then True
else False | 54 | true | true | 0 | 7 | 32 | 36 | 19 | 17 | null | null |
m-alvarez/jhc | src/FrontEnd/Tc/Type.hs | mit | extractTyVar :: Monad m => Type -> m Tyvar
extractTyVar (TVar tv) = return tv | 78 | extractTyVar :: Monad m => Type -> m Tyvar
extractTyVar (TVar tv) = return tv | 78 | extractTyVar (TVar tv) = return tv | 34 | false | true | 0 | 7 | 15 | 37 | 17 | 20 | null | null |
threetreeslight/learning-haskell | practice/old/20151206.hs | mit | mapL :: (a -> b) -> List a -> List b
mapL f (x :~ xs) = f x :~ mapL f xs | 72 | mapL :: (a -> b) -> List a -> List b
mapL f (x :~ xs) = f x :~ mapL f xs | 72 | mapL f (x :~ xs) = f x :~ mapL f xs | 35 | false | true | 2 | 10 | 22 | 61 | 28 | 33 | null | null |
massysett/penny | penny/lib/Penny/Copper/Optics/Manual.hs | bsd-3-clause | sepPostingList'Opt :: Lens.Traversal' (PostingList'Opt t a) (White'Star t a)
sepPostingList'Opt = Lens._Wrapped' . Lens._Just . sepPostingList | 142 | sepPostingList'Opt :: Lens.Traversal' (PostingList'Opt t a) (White'Star t a)
sepPostingList'Opt = Lens._Wrapped' . Lens._Just . sepPostingList | 142 | sepPostingList'Opt = Lens._Wrapped' . Lens._Just . sepPostingList | 65 | false | true | 0 | 7 | 15 | 46 | 23 | 23 | null | null |
meiersi/blaze-binary | src/Codec/MsgPack/Encoder.hs | bsd-3-clause | nil :: OutStream
nil = OutStream ONil | 37 | nil :: OutStream
nil = OutStream ONil | 37 | nil = OutStream ONil | 20 | false | true | 0 | 6 | 6 | 21 | 8 | 13 | null | null |
NorfairKing/haphviz | src/Text/Dot/Render.hs | mit | -- | Render a given graph and print it to std out
renderToStdOut :: DotGraph -> IO ()
renderToStdOut = T.putStrLn . renderGraph | 127 | renderToStdOut :: DotGraph -> IO ()
renderToStdOut = T.putStrLn . renderGraph | 77 | renderToStdOut = T.putStrLn . renderGraph | 41 | true | true | 0 | 8 | 22 | 33 | 15 | 18 | null | null |
AndreasPK/stack | src/Path/Extra.hs | bsd-3-clause | pathToText :: Path b t -> T.Text
pathToText = T.pack . toFilePath | 65 | pathToText :: Path b t -> T.Text
pathToText = T.pack . toFilePath | 65 | pathToText = T.pack . toFilePath | 32 | false | true | 0 | 6 | 11 | 28 | 14 | 14 | null | null |
carliros/dbjava | src/Jvm/PrettyClass.hs | bsd-3-clause | pAttr name pvalue = text name >#< text "=" >#< pvalue | 53 | pAttr name pvalue = text name >#< text "=" >#< pvalue | 53 | pAttr name pvalue = text name >#< text "=" >#< pvalue | 53 | false | false | 0 | 7 | 10 | 25 | 11 | 14 | null | null |
alexander-matsievsky/HackerRank | All_Domains/Functional_Programming/Recursion/src/StringCompression.hs | mit | run :: String -> String
run input = output where
output = concatMap print' $ group input
print' group' = case group' of
[] -> ""
[_] -> group'
letter:_ -> letter : show (length group') | 216 | run :: String -> String
run input = output where
output = concatMap print' $ group input
print' group' = case group' of
[] -> ""
[_] -> group'
letter:_ -> letter : show (length group') | 216 | run input = output where
output = concatMap print' $ group input
print' group' = case group' of
[] -> ""
[_] -> group'
letter:_ -> letter : show (length group') | 192 | false | true | 2 | 11 | 67 | 99 | 44 | 55 | null | null |
ambiata/mafia | src/Mafia/Twine/Snooze.hs | bsd-3-clause | toMilliseconds :: Duration -> Int
toMilliseconds =
flip div 1000 . toMicroseconds | 83 | toMilliseconds :: Duration -> Int
toMilliseconds =
flip div 1000 . toMicroseconds | 83 | toMilliseconds =
flip div 1000 . toMicroseconds | 49 | false | true | 0 | 6 | 13 | 24 | 12 | 12 | null | null |
emonkak/skype4hs | src/Network/Skype/API/Carbon.hs | mit | connect :: (Error e, MonadIO m, MonadError e m)
=> ApplicationName
-> m Connection
connect appName = do
connection <- liftIO $ newConnection appName
clientID <- liftIO $ atomically $ readTMVar $ skypeClientID connection
when (clientID <= 0) $ throwError $ strMsg "Couldn't connect to Skype client."
liftIO $ addForeignPtrFinalizer
(getNotificationCenter $ skypeNotificationCenter connection)
(disconnectFrom (skypeNotificationCenter connection) clientID)
return connection | 509 | connect :: (Error e, MonadIO m, MonadError e m)
=> ApplicationName
-> m Connection
connect appName = do
connection <- liftIO $ newConnection appName
clientID <- liftIO $ atomically $ readTMVar $ skypeClientID connection
when (clientID <= 0) $ throwError $ strMsg "Couldn't connect to Skype client."
liftIO $ addForeignPtrFinalizer
(getNotificationCenter $ skypeNotificationCenter connection)
(disconnectFrom (skypeNotificationCenter connection) clientID)
return connection | 509 | connect appName = do
connection <- liftIO $ newConnection appName
clientID <- liftIO $ atomically $ readTMVar $ skypeClientID connection
when (clientID <= 0) $ throwError $ strMsg "Couldn't connect to Skype client."
liftIO $ addForeignPtrFinalizer
(getNotificationCenter $ skypeNotificationCenter connection)
(disconnectFrom (skypeNotificationCenter connection) clientID)
return connection | 410 | false | true | 0 | 12 | 96 | 146 | 68 | 78 | null | null |
mariefarrell/Hets | CspCASLProver/Utils.hs | gpl-2.0 | {- | Return the injection name of the injection from one sort to another
This function is not implemented in a satisfactory way -}
getDefinedOp :: [SORT] -> SORT -> Term -> Term
getDefinedOp sorts s =
termAppl (con $ VName (getDefinedName sorts s) Nothing) | 260 | getDefinedOp :: [SORT] -> SORT -> Term -> Term
getDefinedOp sorts s =
termAppl (con $ VName (getDefinedName sorts s) Nothing) | 129 | getDefinedOp sorts s =
termAppl (con $ VName (getDefinedName sorts s) Nothing) | 82 | true | true | 0 | 10 | 48 | 61 | 29 | 32 | null | null |
dmp1ce/DMSS | src-lib/DMSS/Config.hs | unlicense | -- | Creates the data directory if it doesn't exist already
createLocalDirectory :: IO ()
createLocalDirectory = localDirectory >>= createDirectoryIfMissing True | 161 | createLocalDirectory :: IO ()
createLocalDirectory = localDirectory >>= createDirectoryIfMissing True | 101 | createLocalDirectory = localDirectory >>= createDirectoryIfMissing True | 71 | true | true | 0 | 6 | 20 | 24 | 12 | 12 | null | null |
mbakke/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | hvstMemoryTotal :: String
hvstMemoryTotal = "mem_total" | 55 | hvstMemoryTotal :: String
hvstMemoryTotal = "mem_total" | 55 | hvstMemoryTotal = "mem_total" | 29 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
mhwombat/creatur-realtra.OLD | src/ALife/Realtra/Image.hs | bsd-3-clause | getPixels (Left s) (Right _) = return $ Left s | 46 | getPixels (Left s) (Right _) = return $ Left s | 46 | getPixels (Left s) (Right _) = return $ Left s | 46 | false | false | 0 | 7 | 9 | 30 | 14 | 16 | null | null |
antonlogvinenko/javelin | src/Javelin/Lib/ByteCode/Attribute.hs | mit | lineNumberTableAttr len = do
attrs <- several lineNumberAttr
return $ LineNumberTable attrs | 95 | lineNumberTableAttr len = do
attrs <- several lineNumberAttr
return $ LineNumberTable attrs | 95 | lineNumberTableAttr len = do
attrs <- several lineNumberAttr
return $ LineNumberTable attrs | 95 | false | false | 0 | 8 | 15 | 29 | 12 | 17 | null | null |
josefs/sbv | Data/SBV/SMT/SMT.hs | bsd-3-clause | -- | Extract value of a variable from an all-sat call. Similar to `getModelValue`.
getModelValues :: SymWord b => String -> AllSatResult -> [Maybe b]
getModelValues s (AllSatResult (_, _, xs)) = map (s `getModelValue`) xs | 222 | getModelValues :: SymWord b => String -> AllSatResult -> [Maybe b]
getModelValues s (AllSatResult (_, _, xs)) = map (s `getModelValue`) xs | 139 | getModelValues s (AllSatResult (_, _, xs)) = map (s `getModelValue`) xs | 72 | true | true | 0 | 9 | 36 | 64 | 35 | 29 | null | null |
li-zhirui/EoplLangs | src/MutablePairs/Data.hs | bsd-3-clause | extendRecMany :: [(String, [String], Expression)] -> Environment
-> StatedTry Environment
extendRecMany lst env = do
refs <- allocMany (length lst)
let denoVals = fmap DenoRef refs
let names = fmap (\(n, _, _) -> n) lst
let newEnv = extendMany (zip names denoVals) env
extendRecMany' lst refs newEnv
where
extendRecMany' [] [] env = return env
extendRecMany' ((name, params, body):triples) (ref:refs) env = do
setRef ref (ExprProc $ Procedure params body env)
extendRecMany' triples refs env
allocMany 0 = return []
allocMany x = do
ref <- newRef (ExprBool False) -- dummy value false for allocating space
(ref:) <$> allocMany (x - 1) | 700 | extendRecMany :: [(String, [String], Expression)] -> Environment
-> StatedTry Environment
extendRecMany lst env = do
refs <- allocMany (length lst)
let denoVals = fmap DenoRef refs
let names = fmap (\(n, _, _) -> n) lst
let newEnv = extendMany (zip names denoVals) env
extendRecMany' lst refs newEnv
where
extendRecMany' [] [] env = return env
extendRecMany' ((name, params, body):triples) (ref:refs) env = do
setRef ref (ExprProc $ Procedure params body env)
extendRecMany' triples refs env
allocMany 0 = return []
allocMany x = do
ref <- newRef (ExprBool False) -- dummy value false for allocating space
(ref:) <$> allocMany (x - 1) | 700 | extendRecMany lst env = do
refs <- allocMany (length lst)
let denoVals = fmap DenoRef refs
let names = fmap (\(n, _, _) -> n) lst
let newEnv = extendMany (zip names denoVals) env
extendRecMany' lst refs newEnv
where
extendRecMany' [] [] env = return env
extendRecMany' ((name, params, body):triples) (ref:refs) env = do
setRef ref (ExprProc $ Procedure params body env)
extendRecMany' triples refs env
allocMany 0 = return []
allocMany x = do
ref <- newRef (ExprBool False) -- dummy value false for allocating space
(ref:) <$> allocMany (x - 1) | 596 | false | true | 4 | 13 | 168 | 302 | 141 | 161 | null | null |
fmapfmapfmap/amazonka | amazonka-glacier/gen/Network/AWS/Glacier/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'UploadListElement' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'uleMultipartUploadId'
--
-- * 'ulePartSizeInBytes'
--
-- * 'uleArchiveDescription'
--
-- * 'uleVaultARN'
--
-- * 'uleCreationDate'
uploadListElement
:: UploadListElement
uploadListElement =
UploadListElement'
{ _uleMultipartUploadId = Nothing
, _ulePartSizeInBytes = Nothing
, _uleArchiveDescription = Nothing
, _uleVaultARN = Nothing
, _uleCreationDate = Nothing
} | 575 | uploadListElement
:: UploadListElement
uploadListElement =
UploadListElement'
{ _uleMultipartUploadId = Nothing
, _ulePartSizeInBytes = Nothing
, _uleArchiveDescription = Nothing
, _uleVaultARN = Nothing
, _uleCreationDate = Nothing
} | 266 | uploadListElement =
UploadListElement'
{ _uleMultipartUploadId = Nothing
, _ulePartSizeInBytes = Nothing
, _uleArchiveDescription = Nothing
, _uleVaultARN = Nothing
, _uleCreationDate = Nothing
} | 223 | true | true | 1 | 7 | 108 | 63 | 41 | 22 | null | null |
dbp/hs-stripe | src/Web/Stripe/Customer.hs | bsd-3-clause | delCustomer :: MonadIO m => Customer -> StripeT m Bool
delCustomer = delCustomerById . custId | 94 | delCustomer :: MonadIO m => Customer -> StripeT m Bool
delCustomer = delCustomerById . custId | 94 | delCustomer = delCustomerById . custId | 39 | false | true | 0 | 8 | 15 | 37 | 16 | 21 | null | null |
corajr/scalar-convert | src/Text/Scalar/RDF.hs | bsd-3-clause | version :: Node
version = UNode "scalar:version" | 48 | version :: Node
version = UNode "scalar:version" | 48 | version = UNode "scalar:version" | 32 | false | true | 0 | 5 | 6 | 14 | 7 | 7 | null | null |
BitFunctor/bitfunctor-theory | src/Network/BitFunctor/Theory/Coq/Extraction/Constants.hs | mit | globFileSuffix = ".glob" | 24 | globFileSuffix = ".glob" | 24 | globFileSuffix = ".glob" | 24 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
conal/ghc-mod | Types.hs | bsd-3-clause | withGHC :: (MonadPlus m) => Ghc (m a) -> IO (m a)
withGHC body = ghandle ignore $ runGhc (Just libdir) body
where
ignore :: (MonadPlus m) => SomeException -> IO (m a)
ignore _ = return mzero
---------------------------------------------------------------- | 266 | withGHC :: (MonadPlus m) => Ghc (m a) -> IO (m a)
withGHC body = ghandle ignore $ runGhc (Just libdir) body
where
ignore :: (MonadPlus m) => SomeException -> IO (m a)
ignore _ = return mzero
---------------------------------------------------------------- | 266 | withGHC body = ghandle ignore $ runGhc (Just libdir) body
where
ignore :: (MonadPlus m) => SomeException -> IO (m a)
ignore _ = return mzero
---------------------------------------------------------------- | 216 | false | true | 4 | 9 | 49 | 107 | 51 | 56 | null | null |
AndrewRademacher/stack | src/test/Stack/GhciSpec.hs | bsd-3-clause | relFileT = pathToText relFile | 29 | relFileT = pathToText relFile | 29 | relFileT = pathToText relFile | 29 | false | false | 1 | 5 | 3 | 12 | 4 | 8 | null | null |
keera-studios/hsQt | Qtc/Enums/Core/QDir.hs | bsd-2-clause | fWritable :: Filters
fWritable
= ifFilters $ 32 | 49 | fWritable :: Filters
fWritable
= ifFilters $ 32 | 49 | fWritable
= ifFilters $ 32 | 28 | false | true | 0 | 6 | 9 | 18 | 8 | 10 | null | null |
trskop/hs-not-found | not-found/test/TestCase/Data/Functor/FlipT.hs | bsd-3-clause | test_mapFlipT :: [Test]
test_mapFlipT = [] | 42 | test_mapFlipT :: [Test]
test_mapFlipT = [] | 42 | test_mapFlipT = [] | 18 | false | true | 0 | 5 | 5 | 16 | 9 | 7 | null | null |
Fuuzetsu/haddock | haddock-library/test/Documentation/Haddock/ParserSpec.hs | bsd-2-clause | main :: IO ()
main = hspec spec | 31 | main :: IO ()
main = hspec spec | 31 | main = hspec spec | 17 | false | true | 0 | 6 | 7 | 19 | 9 | 10 | null | null |
romanb/amazonka | core/src/Network/AWS/Data/Internal/Header.hs | mpl-2.0 | hAMZExpires :: HeaderName
hAMZExpires = "X-Amz-Expires" | 55 | hAMZExpires :: HeaderName
hAMZExpires = "X-Amz-Expires" | 55 | hAMZExpires = "X-Amz-Expires" | 29 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
sukwon0709/z3-haskell | src/Z3/Monad.hs | bsd-3-clause | -- | Create a numeral of sort /Bit-vector/ from an 'Integer'.
mkBitvector :: MonadZ3 z3 => Int -- ^ bit-width
-> Integer -- ^ integer value
-> z3 AST
mkBitvector = liftFun2 Base.mkBitvector | 247 | mkBitvector :: MonadZ3 z3 => Int -- ^ bit-width
-> Integer -- ^ integer value
-> z3 AST
mkBitvector = liftFun2 Base.mkBitvector | 185 | mkBitvector = liftFun2 Base.mkBitvector | 39 | true | true | 0 | 8 | 90 | 37 | 19 | 18 | null | null |
cornell-pl/HsAdapton | weak-hashtables/benchmark/src/Criterion/Collection/Chart.hs | bsd-3-clause | errBarChart :: Bool
-> Double
-> String
-> [(AlphaColour Double, String, [SampleData])]
-> Renderable ()
errBarChart logPlot lineWidth plotTitle plotData = toRenderable layout
where
mkPlot (colour, plotName, samples) = joinPlot eb pts
where
lStyle = line_width ^= lineWidth
$ line_color ^= colour
$ defaultPlotErrBars ^. plot_errbars_line_style
pStyle = filledCircles (1.5 * lineWidth) colour
eb = plotErrBars plotName lStyle samples
pts = plotPoints plotName pStyle samples
remapLabels = axis_labels ^: f
where
f labels = map (map g) labels
g (x,_) = (x, secs x)
axisfn = if logPlot
then autoScaledLogAxis defaultLogAxis
else autoScaledAxis defaultLinearAxis
layout = layout1_title ^= plotTitle
$ layout1_background ^= solidFillStyle (opaque white)
$ layout1_left_axis ^: laxis_generate ^= axisfn
$ layout1_left_axis ^: laxis_override ^= remapLabels
$ layout1_left_axis ^: laxis_title ^= "Time (seconds)"
$ layout1_bottom_axis ^: laxis_generate ^= axisfn
$ layout1_bottom_axis ^: laxis_title ^= "# of items in collection"
$ layout1_plots ^= (map (Left . mkPlot) plotData)
$ defaultLayout1 | 1,369 | errBarChart :: Bool
-> Double
-> String
-> [(AlphaColour Double, String, [SampleData])]
-> Renderable ()
errBarChart logPlot lineWidth plotTitle plotData = toRenderable layout
where
mkPlot (colour, plotName, samples) = joinPlot eb pts
where
lStyle = line_width ^= lineWidth
$ line_color ^= colour
$ defaultPlotErrBars ^. plot_errbars_line_style
pStyle = filledCircles (1.5 * lineWidth) colour
eb = plotErrBars plotName lStyle samples
pts = plotPoints plotName pStyle samples
remapLabels = axis_labels ^: f
where
f labels = map (map g) labels
g (x,_) = (x, secs x)
axisfn = if logPlot
then autoScaledLogAxis defaultLogAxis
else autoScaledAxis defaultLinearAxis
layout = layout1_title ^= plotTitle
$ layout1_background ^= solidFillStyle (opaque white)
$ layout1_left_axis ^: laxis_generate ^= axisfn
$ layout1_left_axis ^: laxis_override ^= remapLabels
$ layout1_left_axis ^: laxis_title ^= "Time (seconds)"
$ layout1_bottom_axis ^: laxis_generate ^= axisfn
$ layout1_bottom_axis ^: laxis_title ^= "# of items in collection"
$ layout1_plots ^= (map (Left . mkPlot) plotData)
$ defaultLayout1 | 1,369 | errBarChart logPlot lineWidth plotTitle plotData = toRenderable layout
where
mkPlot (colour, plotName, samples) = joinPlot eb pts
where
lStyle = line_width ^= lineWidth
$ line_color ^= colour
$ defaultPlotErrBars ^. plot_errbars_line_style
pStyle = filledCircles (1.5 * lineWidth) colour
eb = plotErrBars plotName lStyle samples
pts = plotPoints plotName pStyle samples
remapLabels = axis_labels ^: f
where
f labels = map (map g) labels
g (x,_) = (x, secs x)
axisfn = if logPlot
then autoScaledLogAxis defaultLogAxis
else autoScaledAxis defaultLinearAxis
layout = layout1_title ^= plotTitle
$ layout1_background ^= solidFillStyle (opaque white)
$ layout1_left_axis ^: laxis_generate ^= axisfn
$ layout1_left_axis ^: laxis_override ^= remapLabels
$ layout1_left_axis ^: laxis_title ^= "Time (seconds)"
$ layout1_bottom_axis ^: laxis_generate ^= axisfn
$ layout1_bottom_axis ^: laxis_title ^= "# of items in collection"
$ layout1_plots ^= (map (Left . mkPlot) plotData)
$ defaultLayout1 | 1,216 | false | true | 27 | 12 | 429 | 380 | 176 | 204 | null | null |
bitemyapp/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | -- | Instance Parameters Profile
ppDefault :: String
ppDefault = "default" | 74 | ppDefault :: String
ppDefault = "default" | 41 | ppDefault = "default" | 21 | true | true | 0 | 6 | 10 | 19 | 8 | 11 | null | null |
paldepind/t-diagram | src/Main.hs | mit | iX86inARM = iDiagram "x86" "ARM" | 32 | iX86inARM = iDiagram "x86" "ARM" | 32 | iX86inARM = iDiagram "x86" "ARM" | 32 | false | false | 1 | 5 | 4 | 16 | 5 | 11 | null | null |
rueshyna/gogol | gogol-replicapool/gen/Network/Google/ReplicaPool/Types/Product.hs | mpl-2.0 | -- | [Output Only] The time that this operation was completed, in RFC3339
-- text format.
oEndTime :: Lens' Operation (Maybe Text)
oEndTime = lens _oEndTime (\ s a -> s{_oEndTime = a}) | 184 | oEndTime :: Lens' Operation (Maybe Text)
oEndTime = lens _oEndTime (\ s a -> s{_oEndTime = a}) | 94 | oEndTime = lens _oEndTime (\ s a -> s{_oEndTime = a}) | 53 | true | true | 2 | 9 | 32 | 56 | 26 | 30 | null | null |
randen/haddock | haddock-api/src/Haddock/Backends/Xhtml/Utils.hs | bsd-2-clause | pabrackets h = toHtml "[:" +++ h +++ toHtml ":]" | 51 | pabrackets h = toHtml "[:" +++ h +++ toHtml ":]" | 51 | pabrackets h = toHtml "[:" +++ h +++ toHtml ":]" | 51 | false | false | 5 | 5 | 12 | 28 | 10 | 18 | null | null |
farnoy/torrent | src/Network/BitTorrent/RPCServer.hs | bsd-3-clause | extractTorrentInfo :: TorrentState -> IO TorrentInfo
extractTorrentInfo state = do
(bf, status, peerCount, dlSpeed) <- atomically $ do
bf <- readTVar $ torrentStateBitField state
status <- readTVar $ torrentStateStatus state
peerCount <- fromIntegral . Seq.length <$> (readTVar $ torrentStatePeerThreads state)
dlSpeed <- readTVar (torrentStateDownloadSpeed state)
return (bf, status, peerCount, dlSpeed)
let meta = torrentStateMetaInfo state
Just infoHash = fromByteString $ B16.encode $ Meta.infoHash meta
Just fileName = fromByteString $ Meta.name $ head $ Meta.files $ Meta.info $ torrentStateMetaInfo state
dlSpeedHistory = LS.recent 60 dlSpeed |> toList
return $ TorrentInfo infoHash fileName (BF.completed bf) status peerCount (B.unpack $ BF.raw bf) dlSpeedHistory | 817 | extractTorrentInfo :: TorrentState -> IO TorrentInfo
extractTorrentInfo state = do
(bf, status, peerCount, dlSpeed) <- atomically $ do
bf <- readTVar $ torrentStateBitField state
status <- readTVar $ torrentStateStatus state
peerCount <- fromIntegral . Seq.length <$> (readTVar $ torrentStatePeerThreads state)
dlSpeed <- readTVar (torrentStateDownloadSpeed state)
return (bf, status, peerCount, dlSpeed)
let meta = torrentStateMetaInfo state
Just infoHash = fromByteString $ B16.encode $ Meta.infoHash meta
Just fileName = fromByteString $ Meta.name $ head $ Meta.files $ Meta.info $ torrentStateMetaInfo state
dlSpeedHistory = LS.recent 60 dlSpeed |> toList
return $ TorrentInfo infoHash fileName (BF.completed bf) status peerCount (B.unpack $ BF.raw bf) dlSpeedHistory | 817 | extractTorrentInfo state = do
(bf, status, peerCount, dlSpeed) <- atomically $ do
bf <- readTVar $ torrentStateBitField state
status <- readTVar $ torrentStateStatus state
peerCount <- fromIntegral . Seq.length <$> (readTVar $ torrentStatePeerThreads state)
dlSpeed <- readTVar (torrentStateDownloadSpeed state)
return (bf, status, peerCount, dlSpeed)
let meta = torrentStateMetaInfo state
Just infoHash = fromByteString $ B16.encode $ Meta.infoHash meta
Just fileName = fromByteString $ Meta.name $ head $ Meta.files $ Meta.info $ torrentStateMetaInfo state
dlSpeedHistory = LS.recent 60 dlSpeed |> toList
return $ TorrentInfo infoHash fileName (BF.completed bf) status peerCount (B.unpack $ BF.raw bf) dlSpeedHistory | 764 | false | true | 0 | 16 | 145 | 272 | 129 | 143 | null | null |
tcoenraad/functioneel-programmeren | practica/serie2/11.quick-sort.hs | mit | qsort (x:xs) = qsort(filter (<x) (x:xs)) ++ filter (==x) (x:xs) ++ qsort(filter (>x) (x:xs)) | 92 | qsort (x:xs) = qsort(filter (<x) (x:xs)) ++ filter (==x) (x:xs) ++ qsort(filter (>x) (x:xs)) | 92 | qsort (x:xs) = qsort(filter (<x) (x:xs)) ++ filter (==x) (x:xs) ++ qsort(filter (>x) (x:xs)) | 92 | false | false | 0 | 11 | 13 | 84 | 45 | 39 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.