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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
charlescharles/mixcoin-hs | src/Mixcoin/Common/Crypto.hs | mit | decode64 :: ASN1Object a => BS.ByteString -> Either String a
decode64 bs = do
dec <- B64.decode bs
asn <- case decodeASN1' DER dec of
Left _ -> Left "couldn't decode ASN1 stream"
Right r -> Right r
(ret, remaining) <- fromASN1 asn
if null remaining
then Right ret
else Left "invalid ASN1 stream" | 321 | decode64 :: ASN1Object a => BS.ByteString -> Either String a
decode64 bs = do
dec <- B64.decode bs
asn <- case decodeASN1' DER dec of
Left _ -> Left "couldn't decode ASN1 stream"
Right r -> Right r
(ret, remaining) <- fromASN1 asn
if null remaining
then Right ret
else Left "invalid ASN1 stream" | 321 | decode64 bs = do
dec <- B64.decode bs
asn <- case decodeASN1' DER dec of
Left _ -> Left "couldn't decode ASN1 stream"
Right r -> Right r
(ret, remaining) <- fromASN1 asn
if null remaining
then Right ret
else Left "invalid ASN1 stream" | 260 | false | true | 0 | 12 | 79 | 124 | 55 | 69 | null | null |
apyrgio/snf-ganeti | test/hs/Test/Ganeti/TestCommon.hs | bsd-2-clause | -- | Generates a valid, arbitrary tag name with respect to the given
-- 'TagKind' for Luxi.
genLuxiTagName :: TagKind -> Gen String
genLuxiTagName TagKindCluster = return "" | 173 | genLuxiTagName :: TagKind -> Gen String
genLuxiTagName TagKindCluster = return "" | 81 | genLuxiTagName TagKindCluster = return "" | 41 | true | true | 0 | 6 | 27 | 30 | 14 | 16 | null | null |
olsner/sedition | IR.hs | mit | tCmd (AST.PrintLineNumber fd) = emit (PrintLineNumber fd) | 57 | tCmd (AST.PrintLineNumber fd) = emit (PrintLineNumber fd) | 57 | tCmd (AST.PrintLineNumber fd) = emit (PrintLineNumber fd) | 57 | false | false | 0 | 7 | 6 | 27 | 12 | 15 | null | null |
noughtmare/yi | yi-keymap-vim/src/Yi/Keymap/Vim/Motion.hs | gpl-2.0 | matchGotoMarkMove (m:c:[]) = WholeMatch $ Move style True action
where style = if m == '`' then Inclusive else LineWise
action _mcount = do
mmark <- mayGetMarkB [c]
case mmark of
Nothing -> fail $ "Mark " <> show c <> " not set"
Just mark -> moveTo =<< use (markPointA mark) | 352 | matchGotoMarkMove (m:c:[]) = WholeMatch $ Move style True action
where style = if m == '`' then Inclusive else LineWise
action _mcount = do
mmark <- mayGetMarkB [c]
case mmark of
Nothing -> fail $ "Mark " <> show c <> " not set"
Just mark -> moveTo =<< use (markPointA mark) | 352 | matchGotoMarkMove (m:c:[]) = WholeMatch $ Move style True action
where style = if m == '`' then Inclusive else LineWise
action _mcount = do
mmark <- mayGetMarkB [c]
case mmark of
Nothing -> fail $ "Mark " <> show c <> " not set"
Just mark -> moveTo =<< use (markPointA mark) | 352 | false | false | 3 | 14 | 129 | 129 | 60 | 69 | null | null |
expipiplus1/minizinc | src/Language/MiniZinc/Print.hs | mit | varDeclDoc (VarDecl type' name (Just e)) = typeDoc type' <> ":" <+>
text name <+>
"=" <+> exprDoc e <> ";" | 192 | varDeclDoc (VarDecl type' name (Just e)) = typeDoc type' <> ":" <+>
text name <+>
"=" <+> exprDoc e <> ";" | 192 | varDeclDoc (VarDecl type' name (Just e)) = typeDoc type' <> ":" <+>
text name <+>
"=" <+> exprDoc e <> ";" | 192 | false | false | 0 | 10 | 106 | 55 | 25 | 30 | null | null |
maggy96/haskell | smaller snippets/addargs.hs | mit | main = do
input <- getArgs
print . sum $ makeargsalist input | 60 | main = do
input <- getArgs
print . sum $ makeargsalist input | 60 | main = do
input <- getArgs
print . sum $ makeargsalist input | 60 | false | false | 0 | 8 | 11 | 27 | 12 | 15 | null | null |
tranma/shitty-refinement | example/Wow.hs | bsd-3-clause | listInsert = List.insert | 24 | listInsert = List.insert | 24 | listInsert = List.insert | 24 | false | false | 0 | 5 | 2 | 8 | 4 | 4 | null | null |
pparkkin/eta | compiler/ETA/CodeGen/Prim.hs | bsd-3-clause | shouldInlinePrimOp' _ NewMutVarOp args = Right $ return
[
new stgMutVarType
<> dup stgMutVarType
<> fold args
<> invokespecial (mkMethodRef stgMutVar "<init>" [closureType] void)
] | 191 | shouldInlinePrimOp' _ NewMutVarOp args = Right $ return
[
new stgMutVarType
<> dup stgMutVarType
<> fold args
<> invokespecial (mkMethodRef stgMutVar "<init>" [closureType] void)
] | 191 | shouldInlinePrimOp' _ NewMutVarOp args = Right $ return
[
new stgMutVarType
<> dup stgMutVarType
<> fold args
<> invokespecial (mkMethodRef stgMutVar "<init>" [closureType] void)
] | 191 | false | false | 0 | 10 | 35 | 62 | 29 | 33 | null | null |
soupi/pureli | src/Language/Pureli/Lexer.hs | bsd-3-clause | ommaSep :: Parser a -> Parser [a]
commaSep = Tok.commaSep lexer
| 64 | commaSep :: Parser a -> Parser [a]
commaSep = Tok.commaSep lexer | 64 | commaSep = Tok.commaSep lexer | 29 | false | true | 0 | 7 | 11 | 29 | 14 | 15 | null | null |
prowdsponsor/country-codes | src/Data/CountryCodes/ISO31661.hs | bsd-3-clause | fromMName "Bhutan" = Just BT | 28 | fromMName "Bhutan" = Just BT | 28 | fromMName "Bhutan" = Just BT | 28 | false | false | 0 | 5 | 4 | 12 | 5 | 7 | null | null |
wavewave/madgraph-auto-dataset | src/HEP/Automation/MadGraph/Dataset/Set20110630set1.hs | gpl-3.0 | eventsets :: [EventSet]
eventsets =
[ EventSet (psetup_zph_TTBar0or1J)
(RS { param = p
, numevent = 100000
, machine = LHC7
, rgrun = Fixed
, rgscale = 200.0
, match = MLM
, cut = DefCut
, pythia = RunPYTHIA
, usercut = UserCutDef ucut
, pgs = RunPGS
, jetalgo = KTJet 0.5
, uploadhep = NoUploadHEP
, setnum = num
})
| p <- zphParamSet , num <- sets ] | 629 | eventsets :: [EventSet]
eventsets =
[ EventSet (psetup_zph_TTBar0or1J)
(RS { param = p
, numevent = 100000
, machine = LHC7
, rgrun = Fixed
, rgscale = 200.0
, match = MLM
, cut = DefCut
, pythia = RunPYTHIA
, usercut = UserCutDef ucut
, pgs = RunPGS
, jetalgo = KTJet 0.5
, uploadhep = NoUploadHEP
, setnum = num
})
| p <- zphParamSet , num <- sets ] | 629 | eventsets =
[ EventSet (psetup_zph_TTBar0or1J)
(RS { param = p
, numevent = 100000
, machine = LHC7
, rgrun = Fixed
, rgscale = 200.0
, match = MLM
, cut = DefCut
, pythia = RunPYTHIA
, usercut = UserCutDef ucut
, pgs = RunPGS
, jetalgo = KTJet 0.5
, uploadhep = NoUploadHEP
, setnum = num
})
| p <- zphParamSet , num <- sets ] | 605 | false | true | 0 | 10 | 350 | 130 | 79 | 51 | null | null |
Palmik/data-store | benchmarks/src/DSPInsert2.hs | bsd-3-clause | main :: IO ()
main = do
return $! rnf ke5000
--return $! rnf $! go5000'
return $! rnf $! go5000'' | 104 | main :: IO ()
main = do
return $! rnf ke5000
--return $! rnf $! go5000'
return $! rnf $! go5000'' | 104 | main = do
return $! rnf ke5000
--return $! rnf $! go5000'
return $! rnf $! go5000'' | 90 | false | true | 0 | 8 | 27 | 38 | 18 | 20 | null | null |
acharal/hopes | src/prover/ComputedAnswer.hs | gpl-2.0 | mkvar e = BasicSet [] [] [e] | 28 | mkvar e = BasicSet [] [] [e] | 28 | mkvar e = BasicSet [] [] [e] | 28 | false | false | 0 | 6 | 6 | 23 | 11 | 12 | null | null |
frosch03/frogblog | Blog/Auxiliary.hs | bsd-3-clause | linkify (par, val, htmltext) = toHtml $ hotlink (blogPath ++ ('/': par) ++ ('/' : val)) htmltext | 96 | linkify (par, val, htmltext) = toHtml $ hotlink (blogPath ++ ('/': par) ++ ('/' : val)) htmltext | 96 | linkify (par, val, htmltext) = toHtml $ hotlink (blogPath ++ ('/': par) ++ ('/' : val)) htmltext | 96 | false | false | 0 | 11 | 16 | 52 | 28 | 24 | null | null |
coreyoconnor/corebot-bliki | src/Yesod/CoreBot/Bliki/Resources/Blog.hs | bsd-3-clause | -- XXX: needs json representation
getBlogIndexR :: Yesod master => GHandler ( Blog_ master ) master RepHtml
getBlogIndexR = do
blog@(Blog src_data) <- getYesodSub
db <- liftIO $ readIORef $ db_ref src_data
let updates = take 50 $ update_log db
update_summaries = build_summaries updates
build_summaries [] = []
build_summaries ( Tweet _ txt : us )
= [whamlet|
$newline always
<p .tweet> #{txt}
|] : build_summaries us
build_summaries ( BlogAdded _ txt : us )
= [whamlet|
$newline always
<p .blog_summary> #{take 200 txt}
|] : build_summaries us
build_summaries ( EntryAdded _ node_path : us ) =
let node_R = data_routes (config src_data) $ EntryLatestR []
in [whamlet|
$newline always
<p .node_update>
Added
<a href=@{node_R}/#{node_path}>#{node_path}
|] : build_summaries us
build_summaries ( EntryChanged _ node_path : us ) =
let node_R = data_routes (config src_data) $ EntryLatestR []
in [whamlet|
$newline always
<p .node_update>
Changed
<a href=@{node_R}/#{node_path}>#{node_path}
|] : build_summaries us
build_summaries ( Wibble _ : us )
= build_summaries us
defaultLayout $ do
[whamlet|
$newline always
<div .update_log>
<ol .summary_listing>
$forall summary <- update_summaries
<li> ^{summary}
|] | 1,663 | getBlogIndexR :: Yesod master => GHandler ( Blog_ master ) master RepHtml
getBlogIndexR = do
blog@(Blog src_data) <- getYesodSub
db <- liftIO $ readIORef $ db_ref src_data
let updates = take 50 $ update_log db
update_summaries = build_summaries updates
build_summaries [] = []
build_summaries ( Tweet _ txt : us )
= [whamlet|
$newline always
<p .tweet> #{txt}
|] : build_summaries us
build_summaries ( BlogAdded _ txt : us )
= [whamlet|
$newline always
<p .blog_summary> #{take 200 txt}
|] : build_summaries us
build_summaries ( EntryAdded _ node_path : us ) =
let node_R = data_routes (config src_data) $ EntryLatestR []
in [whamlet|
$newline always
<p .node_update>
Added
<a href=@{node_R}/#{node_path}>#{node_path}
|] : build_summaries us
build_summaries ( EntryChanged _ node_path : us ) =
let node_R = data_routes (config src_data) $ EntryLatestR []
in [whamlet|
$newline always
<p .node_update>
Changed
<a href=@{node_R}/#{node_path}>#{node_path}
|] : build_summaries us
build_summaries ( Wibble _ : us )
= build_summaries us
defaultLayout $ do
[whamlet|
$newline always
<div .update_log>
<ol .summary_listing>
$forall summary <- update_summaries
<li> ^{summary}
|] | 1,629 | getBlogIndexR = do
blog@(Blog src_data) <- getYesodSub
db <- liftIO $ readIORef $ db_ref src_data
let updates = take 50 $ update_log db
update_summaries = build_summaries updates
build_summaries [] = []
build_summaries ( Tweet _ txt : us )
= [whamlet|
$newline always
<p .tweet> #{txt}
|] : build_summaries us
build_summaries ( BlogAdded _ txt : us )
= [whamlet|
$newline always
<p .blog_summary> #{take 200 txt}
|] : build_summaries us
build_summaries ( EntryAdded _ node_path : us ) =
let node_R = data_routes (config src_data) $ EntryLatestR []
in [whamlet|
$newline always
<p .node_update>
Added
<a href=@{node_R}/#{node_path}>#{node_path}
|] : build_summaries us
build_summaries ( EntryChanged _ node_path : us ) =
let node_R = data_routes (config src_data) $ EntryLatestR []
in [whamlet|
$newline always
<p .node_update>
Changed
<a href=@{node_R}/#{node_path}>#{node_path}
|] : build_summaries us
build_summaries ( Wibble _ : us )
= build_summaries us
defaultLayout $ do
[whamlet|
$newline always
<div .update_log>
<ol .summary_listing>
$forall summary <- update_summaries
<li> ^{summary}
|] | 1,555 | true | true | 0 | 17 | 634 | 328 | 163 | 165 | null | null |
innovimax/bond | compiler/Bond/Template/TypeMapping.hs | mit | cppTypeCustomAlloc _lloc (BT_Nullable element) = "bond::nullable<" <>> elementTypeName element <<> ">" | 102 | cppTypeCustomAlloc _lloc (BT_Nullable element) = "bond::nullable<" <>> elementTypeName element <<> ">" | 102 | cppTypeCustomAlloc _lloc (BT_Nullable element) = "bond::nullable<" <>> elementTypeName element <<> ">" | 102 | false | false | 0 | 7 | 10 | 28 | 13 | 15 | null | null |
jeffwheeler/pointedlist | Data/List/PointedList/Circular.hs | bsd-3-clause | deleteRight (PointedList ls _ (r:rs)) = Just $ PointedList ls r rs | 66 | deleteRight (PointedList ls _ (r:rs)) = Just $ PointedList ls r rs | 66 | deleteRight (PointedList ls _ (r:rs)) = Just $ PointedList ls r rs | 66 | false | false | 0 | 9 | 11 | 37 | 18 | 19 | null | null |
prashant007/AMPL | myAMPL/src/test_del/InterpretAMPL.hs | mit | compile_process sym stack trans ((AC_RECORDf recs):rest)
= (AMC_REC (destructor_headtype recs)):(compile_process sym stack trans rest)
where destructor_headtype [] = error "Record expression: expected some entries!"
destructor_headtype recs@(((head,struct),_,_):_) = sorter 1 (destructor_headtype' head recs)
where num_of = length(look_up_syms_structs sym (head,struct))
sorter n [] | (num_of+1)==n = []
| otherwise = error ("Destructor "++(show n)++" missing!")
sorter n vs@((n',x):rest)| n==n' = x:(sorter (n+1) rest)
| otherwise = v:(sorter (n+1) rest')
where (v,rest') = pull_up n vs
pull_up n ((n',x):rest) | n==n' = (x,rest)
| otherwise = case (pull_up n rest) of
(x',rest') -> (x',(n',x):rest')
pull_up n [] = error ("Destructor "++(show n)++" missing in record expression!")
destructor_headtype' _ [] = []
destructor_headtype' head (((head',struct),vars,cs):rest)
| head==head' && (length vars)==arity
= (des_num,(compile_process sym (vars++stack) trans cs)):(destructor_headtype' head rest)
| otherwise = error "Record expression: not well-formed!"
where
(des_num,arity) = case look_up_syms sym (head,struct) of
SYM_DESTR des_num arity -> (des_num,arity)
_ -> error "Record expression: destructor not found!" | 1,826 | compile_process sym stack trans ((AC_RECORDf recs):rest)
= (AMC_REC (destructor_headtype recs)):(compile_process sym stack trans rest)
where destructor_headtype [] = error "Record expression: expected some entries!"
destructor_headtype recs@(((head,struct),_,_):_) = sorter 1 (destructor_headtype' head recs)
where num_of = length(look_up_syms_structs sym (head,struct))
sorter n [] | (num_of+1)==n = []
| otherwise = error ("Destructor "++(show n)++" missing!")
sorter n vs@((n',x):rest)| n==n' = x:(sorter (n+1) rest)
| otherwise = v:(sorter (n+1) rest')
where (v,rest') = pull_up n vs
pull_up n ((n',x):rest) | n==n' = (x,rest)
| otherwise = case (pull_up n rest) of
(x',rest') -> (x',(n',x):rest')
pull_up n [] = error ("Destructor "++(show n)++" missing in record expression!")
destructor_headtype' _ [] = []
destructor_headtype' head (((head',struct),vars,cs):rest)
| head==head' && (length vars)==arity
= (des_num,(compile_process sym (vars++stack) trans cs)):(destructor_headtype' head rest)
| otherwise = error "Record expression: not well-formed!"
where
(des_num,arity) = case look_up_syms sym (head,struct) of
SYM_DESTR des_num arity -> (des_num,arity)
_ -> error "Record expression: destructor not found!" | 1,826 | compile_process sym stack trans ((AC_RECORDf recs):rest)
= (AMC_REC (destructor_headtype recs)):(compile_process sym stack trans rest)
where destructor_headtype [] = error "Record expression: expected some entries!"
destructor_headtype recs@(((head,struct),_,_):_) = sorter 1 (destructor_headtype' head recs)
where num_of = length(look_up_syms_structs sym (head,struct))
sorter n [] | (num_of+1)==n = []
| otherwise = error ("Destructor "++(show n)++" missing!")
sorter n vs@((n',x):rest)| n==n' = x:(sorter (n+1) rest)
| otherwise = v:(sorter (n+1) rest')
where (v,rest') = pull_up n vs
pull_up n ((n',x):rest) | n==n' = (x,rest)
| otherwise = case (pull_up n rest) of
(x',rest') -> (x',(n',x):rest')
pull_up n [] = error ("Destructor "++(show n)++" missing in record expression!")
destructor_headtype' _ [] = []
destructor_headtype' head (((head',struct),vars,cs):rest)
| head==head' && (length vars)==arity
= (des_num,(compile_process sym (vars++stack) trans cs)):(destructor_headtype' head rest)
| otherwise = error "Record expression: not well-formed!"
where
(des_num,arity) = case look_up_syms sym (head,struct) of
SYM_DESTR des_num arity -> (des_num,arity)
_ -> error "Record expression: destructor not found!" | 1,826 | false | false | 10 | 16 | 761 | 524 | 290 | 234 | null | null |
brendanhay/gogol | gogol-compute/gen/Network/Google/Resource/Compute/RegionCommitments/AggregatedList.hs | mpl-2.0 | -- | Opt-in for partial success behavior which provides partial results in
-- case of failure. The default value is false.
rcalReturnPartialSuccess :: Lens' RegionCommitmentsAggregatedList (Maybe Bool)
rcalReturnPartialSuccess
= lens _rcalReturnPartialSuccess
(\ s a -> s{_rcalReturnPartialSuccess = a}) | 311 | rcalReturnPartialSuccess :: Lens' RegionCommitmentsAggregatedList (Maybe Bool)
rcalReturnPartialSuccess
= lens _rcalReturnPartialSuccess
(\ s a -> s{_rcalReturnPartialSuccess = a}) | 188 | rcalReturnPartialSuccess
= lens _rcalReturnPartialSuccess
(\ s a -> s{_rcalReturnPartialSuccess = a}) | 109 | true | true | 0 | 9 | 45 | 49 | 26 | 23 | null | null |
paparazzi/libsbp | haskell/test/Test.hs | lgpl-3.0 | main :: IO ()
main = defaultMain tests | 38 | main :: IO ()
main = defaultMain tests | 38 | main = defaultMain tests | 24 | false | true | 0 | 7 | 7 | 25 | 10 | 15 | null | null |
sboosali/commands-frontend-DragonNaturallySpeaking | sources/Commands/Frontends/Dragon13/Lens.hs | bsd-3-clause | dnsNonExports :: Lens' (DNSGrammar i t n) [DNSProduction i t n]
dnsNonExports = dnsProductions . nonemptyTail | 109 | dnsNonExports :: Lens' (DNSGrammar i t n) [DNSProduction i t n]
dnsNonExports = dnsProductions . nonemptyTail | 109 | dnsNonExports = dnsProductions . nonemptyTail | 45 | false | true | 1 | 8 | 15 | 47 | 21 | 26 | null | null |
quivade/screwdriver | src/Language/FIRRTL/Recursion.hs | gpl-3.0 | ymapM :: (Traversable f, Monad m)
=> (Fix f -> m (Fix f)) -> Fix f -> m (Fix f)
ymapM f = liftM Fix . mapM f . unfix | 122 | ymapM :: (Traversable f, Monad m)
=> (Fix f -> m (Fix f)) -> Fix f -> m (Fix f)
ymapM f = liftM Fix . mapM f . unfix | 122 | ymapM f = liftM Fix . mapM f . unfix | 36 | false | true | 0 | 11 | 35 | 82 | 39 | 43 | null | null |
typedvar/hLand | hcore/NParser.hs | mit | pBracExpr = pThen3 mkBrack (pLit "(") pExpr (pLit ")")
where
mkBrack open expr close = expr | 115 | pBracExpr = pThen3 mkBrack (pLit "(") pExpr (pLit ")")
where
mkBrack open expr close = expr | 115 | pBracExpr = pThen3 mkBrack (pLit "(") pExpr (pLit ")")
where
mkBrack open expr close = expr | 115 | false | false | 0 | 7 | 39 | 41 | 20 | 21 | null | null |
sdiehl/ghc | libraries/base/GHC/Event/Manager.hs | bsd-3-clause | closeFd_ :: EventManager
-> IntTable [FdData]
-> Fd
-> IO (IO ())
closeFd_ mgr tbl fd = do
prev <- IT.delete (fromIntegral fd) tbl
case prev of
Nothing -> return (return ())
Just fds -> do
let oldEls = eventsOf fds
when (oldEls /= mempty) $ do
_ <- I.modifyFd (emBackend mgr) fd (I.elEvent oldEls) mempty
wakeManager mgr
return $
forM_ fds $ \(FdData reg el cb) ->
cb reg (I.elEvent el `mappend` evtClose)
------------------------------------------------------------------------
-- Utilities
-- | Call the callbacks corresponding to the given file descriptor. | 662 | closeFd_ :: EventManager
-> IntTable [FdData]
-> Fd
-> IO (IO ())
closeFd_ mgr tbl fd = do
prev <- IT.delete (fromIntegral fd) tbl
case prev of
Nothing -> return (return ())
Just fds -> do
let oldEls = eventsOf fds
when (oldEls /= mempty) $ do
_ <- I.modifyFd (emBackend mgr) fd (I.elEvent oldEls) mempty
wakeManager mgr
return $
forM_ fds $ \(FdData reg el cb) ->
cb reg (I.elEvent el `mappend` evtClose)
------------------------------------------------------------------------
-- Utilities
-- | Call the callbacks corresponding to the given file descriptor. | 662 | closeFd_ mgr tbl fd = do
prev <- IT.delete (fromIntegral fd) tbl
case prev of
Nothing -> return (return ())
Just fds -> do
let oldEls = eventsOf fds
when (oldEls /= mempty) $ do
_ <- I.modifyFd (emBackend mgr) fd (I.elEvent oldEls) mempty
wakeManager mgr
return $
forM_ fds $ \(FdData reg el cb) ->
cb reg (I.elEvent el `mappend` evtClose)
------------------------------------------------------------------------
-- Utilities
-- | Call the callbacks corresponding to the given file descriptor. | 560 | false | true | 3 | 12 | 190 | 204 | 104 | 100 | null | null |
mgold/Elm | src/Elm/Compiler/Module.hs | bsd-3-clause | hyphenate :: ModuleName.Raw -> String
hyphenate names =
List.intercalate "-" names | 84 | hyphenate :: ModuleName.Raw -> String
hyphenate names =
List.intercalate "-" names | 84 | hyphenate names =
List.intercalate "-" names | 46 | false | true | 0 | 6 | 12 | 27 | 13 | 14 | null | null |
jrahm/DuckTest | src/DuckTest/Internal/State/Instance.hs | bsd-2-clause | handleAssign :: InternalState a -> String -> Expr a -> a -> DuckTest a (InternalState a)
{-| Handle an assignment. a = <expr>. This will extend the state
- to include the variable a with the type inferred from expr. If
- the type happens to be inferred to be a void type, then a warning
- is emitted warning of the void type usage. -}
handleAssign state vname ex pos = do
inferredType <- runDeferred state =<< inferTypeForExpression state ex
Debug %%! duckf vname " = " (prettyText ex) " :: " inferredType
when (isVoid2 inferredType) $
warn pos $ duckf "Void type not ignored as it ought to be!"
return $ addVariableType vname inferredType state | 674 | handleAssign :: InternalState a -> String -> Expr a -> a -> DuckTest a (InternalState a)
handleAssign state vname ex pos = do
inferredType <- runDeferred state =<< inferTypeForExpression state ex
Debug %%! duckf vname " = " (prettyText ex) " :: " inferredType
when (isVoid2 inferredType) $
warn pos $ duckf "Void type not ignored as it ought to be!"
return $ addVariableType vname inferredType state | 425 | handleAssign state vname ex pos = do
inferredType <- runDeferred state =<< inferTypeForExpression state ex
Debug %%! duckf vname " = " (prettyText ex) " :: " inferredType
when (isVoid2 inferredType) $
warn pos $ duckf "Void type not ignored as it ought to be!"
return $ addVariableType vname inferredType state | 336 | true | true | 0 | 11 | 145 | 137 | 62 | 75 | null | null |
vdweegen/UvA-Software_Testing | Lab4/Willem/Exercises.hs | gpl-3.0 | -- =============================================================================
-- Exercise 4 :: Time spent +-
-- =============================================================================
exercise4 = do
print()
-- =============================================================================
-- Exercise 5 :: Time spent +-
-- ============================================================================= | 411 | exercise4 = do
print()
-- =============================================================================
-- Exercise 5 :: Time spent +-
-- ============================================================================= | 218 | exercise4 = do
print()
-- =============================================================================
-- Exercise 5 :: Time spent +-
-- ============================================================================= | 218 | true | false | 0 | 8 | 28 | 20 | 12 | 8 | null | null |
gilith/hol | src/HOL/Term.hs | mit | destEq :: Term -> Maybe (Term,Term)
destEq tm = do
(el,r) <- destApp tm
(e,l) <- destApp el
if isEqConst e then Just (l,r) else Nothing | 147 | destEq :: Term -> Maybe (Term,Term)
destEq tm = do
(el,r) <- destApp tm
(e,l) <- destApp el
if isEqConst e then Just (l,r) else Nothing | 147 | destEq tm = do
(el,r) <- destApp tm
(e,l) <- destApp el
if isEqConst e then Just (l,r) else Nothing | 111 | false | true | 0 | 9 | 37 | 82 | 42 | 40 | null | null |
mzini/TcT | source/Tct/Encoding/AbstractInterpretation.hs | gpl-3.0 | relativeStricterTrsConstraints :: (Algebra a c, AbstrOrd c b) => [R.Rule] -> a -> Trs.Trs -> b
relativeStricterTrsConstraints [] a trs = relativeStrictTrsConstraints a trs | 177 | relativeStricterTrsConstraints :: (Algebra a c, AbstrOrd c b) => [R.Rule] -> a -> Trs.Trs -> b
relativeStricterTrsConstraints [] a trs = relativeStrictTrsConstraints a trs | 177 | relativeStricterTrsConstraints [] a trs = relativeStrictTrsConstraints a trs | 82 | false | true | 0 | 9 | 29 | 63 | 32 | 31 | null | null |
beni55/LambdaHack | Game/LambdaHack/Client/AI/Strategy.hs | bsd-3-clause | -- TODO: express with traverse?
mapStrategyM :: Monad m => (a -> m (Maybe b)) -> Strategy a -> m (Strategy b)
mapStrategyM f s = do
let mapFreq freq = do
let g (k, a) = do
mb <- f a
return $! (k,) <$> mb
lbm <- mapM g $ runFrequency freq
return $! toFreq "mapStrategyM" $ catMaybes lbm
ls = runStrategy s
lt <- mapM mapFreq ls
return $! normalizeStrategy $ Strategy lt | 432 | mapStrategyM :: Monad m => (a -> m (Maybe b)) -> Strategy a -> m (Strategy b)
mapStrategyM f s = do
let mapFreq freq = do
let g (k, a) = do
mb <- f a
return $! (k,) <$> mb
lbm <- mapM g $ runFrequency freq
return $! toFreq "mapStrategyM" $ catMaybes lbm
ls = runStrategy s
lt <- mapM mapFreq ls
return $! normalizeStrategy $ Strategy lt | 400 | mapStrategyM f s = do
let mapFreq freq = do
let g (k, a) = do
mb <- f a
return $! (k,) <$> mb
lbm <- mapM g $ runFrequency freq
return $! toFreq "mapStrategyM" $ catMaybes lbm
ls = runStrategy s
lt <- mapM mapFreq ls
return $! normalizeStrategy $ Strategy lt | 322 | true | true | 0 | 19 | 139 | 184 | 84 | 100 | null | null |
tkonolige/ilp | src/Pretty.hs | bsd-3-clause | prettyBody :: Body -> Doc
prettyBody (And a b) = prettyBody a <+> color 4 (char ',') <+> prettyBody b | 101 | prettyBody :: Body -> Doc
prettyBody (And a b) = prettyBody a <+> color 4 (char ',') <+> prettyBody b | 101 | prettyBody (And a b) = prettyBody a <+> color 4 (char ',') <+> prettyBody b | 75 | false | true | 0 | 9 | 19 | 51 | 24 | 27 | null | null |
mpickering/hackage-server | BuildClient.hs | bsd-3-clause | initialise :: BuildOpts -> URI -> [URI] -> IO ()
initialise opts uri auxUris
= do putStrLn "Enter hackage username"
username <- getLine
putStrLn "Enter hackage password"
password <- getLine
let config = BuildConfig {
bc_srcURI = uri,
bc_auxURIs = auxUris,
bc_username = username,
bc_password = password
}
createDirectoryIfMissing False $ bo_stateDir opts
createDirectoryIfMissing False $ resultsDirectory opts
writeConfig opts config
writeCabalConfig opts config | 659 | initialise :: BuildOpts -> URI -> [URI] -> IO ()
initialise opts uri auxUris
= do putStrLn "Enter hackage username"
username <- getLine
putStrLn "Enter hackage password"
password <- getLine
let config = BuildConfig {
bc_srcURI = uri,
bc_auxURIs = auxUris,
bc_username = username,
bc_password = password
}
createDirectoryIfMissing False $ bo_stateDir opts
createDirectoryIfMissing False $ resultsDirectory opts
writeConfig opts config
writeCabalConfig opts config | 659 | initialise opts uri auxUris
= do putStrLn "Enter hackage username"
username <- getLine
putStrLn "Enter hackage password"
password <- getLine
let config = BuildConfig {
bc_srcURI = uri,
bc_auxURIs = auxUris,
bc_username = username,
bc_password = password
}
createDirectoryIfMissing False $ bo_stateDir opts
createDirectoryIfMissing False $ resultsDirectory opts
writeConfig opts config
writeCabalConfig opts config | 610 | false | true | 0 | 11 | 260 | 141 | 66 | 75 | null | null |
biegunka/biegunka-svn | src/Control/Biegunka/Source/Svn/Internal.hs | bsd-2-clause | -- | Run @svn checkout@.
svnCheckout :: MonadIO m => Config Url a -> FilePath -> ExceptT Err m Out
svnCheckout Config { configUrl, configIgnoreExternals, configRevision } fp =
runSvn (["checkout", configUrl, "--revision", configRevision, fp] ++ ["--ignore-externals" | configIgnoreExternals]) Nothing | 302 | svnCheckout :: MonadIO m => Config Url a -> FilePath -> ExceptT Err m Out
svnCheckout Config { configUrl, configIgnoreExternals, configRevision } fp =
runSvn (["checkout", configUrl, "--revision", configRevision, fp] ++ ["--ignore-externals" | configIgnoreExternals]) Nothing | 277 | svnCheckout Config { configUrl, configIgnoreExternals, configRevision } fp =
runSvn (["checkout", configUrl, "--revision", configRevision, fp] ++ ["--ignore-externals" | configIgnoreExternals]) Nothing | 203 | true | true | 0 | 9 | 41 | 90 | 48 | 42 | null | null |
brendanhay/gogol | gogol-dataflow/gen/Network/Google/Dataflow/Types/Product.hs | mpl-2.0 | -- | The ID of the worker running this pipeline.
wsWorkerId :: Lens' WorkerSettings (Maybe Text)
wsWorkerId
= lens _wsWorkerId (\ s a -> s{_wsWorkerId = a}) | 158 | wsWorkerId :: Lens' WorkerSettings (Maybe Text)
wsWorkerId
= lens _wsWorkerId (\ s a -> s{_wsWorkerId = a}) | 109 | wsWorkerId
= lens _wsWorkerId (\ s a -> s{_wsWorkerId = a}) | 61 | true | true | 0 | 9 | 28 | 48 | 25 | 23 | null | null |
shayan-najd/Haskell-Desugar-Generic | Examples/XMonad/SS.hs | bsd-3-clause | member :: (Eq a) => a -> StackSet i l a s sd -> Bool
member a s = isJust (findTag a s) | 86 | member :: (Eq a) => a -> StackSet i l a s sd -> Bool
member a s = isJust (findTag a s) | 86 | member a s = isJust (findTag a s) | 33 | false | true | 0 | 8 | 22 | 55 | 27 | 28 | null | null |
AndreasPK/stack | src/Text/PrettyPrint/Leijen/Extended.hs | bsd-3-clause | getSGRTag (SetColor Background _ _) = TagColorBackground | 60 | getSGRTag (SetColor Background _ _) = TagColorBackground | 60 | getSGRTag (SetColor Background _ _) = TagColorBackground | 60 | false | false | 0 | 7 | 10 | 19 | 9 | 10 | null | null |
supermario/stack | src/Stack/Docker.hs | bsd-3-clause | -- | Run a command in a new Docker container, then exit the process.
runContainerAndExit :: M env m
=> (EnvOverride -> Inspect -> m (FilePath,[String],[(String,String)],[Mount]))
-> Maybe (Path Abs Dir)
-> m ()
-> m ()
-> m ()
runContainerAndExit getCmdArgs
mprojectRoot
before
after =
do config <- asks getConfig
let docker = configDocker config
envOverride <- getEnvOverride (configPlatform config)
checkDockerVersion envOverride
(dockerHost,dockerCertPath,bamboo,jenkins) <-
liftIO ((,,,) <$> lookupEnv "DOCKER_HOST"
<*> lookupEnv "DOCKER_CERT_PATH"
<*> lookupEnv "bamboo_buildKey"
<*> lookupEnv "JENKINS_HOME")
let isRemoteDocker = maybe False (isPrefixOf "tcp://") dockerHost
userEnvVars <-
if fromMaybe (not isRemoteDocker) (dockerSetUser docker)
then do
uidOut <- readProcessStdout Nothing envOverride "id" ["-u"]
gidOut <- readProcessStdout Nothing envOverride "id" ["-g"]
return
[ "-e","WORK_UID=" ++ dropWhileEnd isSpace (decodeUtf8 uidOut)
, "-e","WORK_GID=" ++ dropWhileEnd isSpace (decodeUtf8 gidOut) ]
else return []
isStdoutTerminal <- asks getTerminal
(isStdinTerminal,isStderrTerminal) <-
liftIO ((,) <$> hIsTerminalDevice stdin
<*> hIsTerminalDevice stderr)
pwd <- getWorkingDir
when (isRemoteDocker &&
maybe False (isInfixOf "boot2docker") dockerCertPath)
($logWarn "Warning: Using boot2docker is NOT supported, and not likely to perform well.")
let image = dockerImage docker
maybeImageInfo <- inspect envOverride image
imageInfo <- case maybeImageInfo of
Just ii -> return ii
Nothing
| dockerAutoPull docker ->
do pullImage envOverride docker image
mii2 <- inspect envOverride image
case mii2 of
Just ii2 -> return ii2
Nothing -> throwM (InspectFailedException image)
| otherwise -> throwM (NotPulledException image)
(cmnd,args,envVars,extraMount) <- getCmdArgs envOverride imageInfo
let imageEnvVars = map (break (== '=')) (icEnv (iiConfig imageInfo))
sandboxID = fromMaybe "default" (lookupImageEnv sandboxIDEnvVar imageEnvVars)
sandboxIDDir <- parseRelDir (sandboxID ++ "/")
let stackRoot = configStackRoot config
sandboxDir = projectDockerSandboxDir projectRoot
sandboxSandboxDir = sandboxDir </> $(mkRelDir "_sandbox/") </> sandboxIDDir
sandboxHomeDir = sandboxDir </> homeDirName
sandboxRepoDir = sandboxDir </> sandboxIDDir
sandboxSubdirs = map (\d -> sandboxRepoDir </> d)
sandboxedHomeSubdirectories
isTerm = not (dockerDetach docker) &&
isStdinTerminal &&
isStdoutTerminal &&
isStderrTerminal
keepStdinOpen = not (dockerDetach docker) &&
-- Workaround for https://github.com/docker/docker/issues/12319
(isTerm || (isNothing bamboo && isNothing jenkins))
liftIO
(do updateDockerImageLastUsed config
(iiId imageInfo)
(toFilePath projectRoot)
mapM_ createTree
(concat [[sandboxHomeDir, sandboxSandboxDir, stackRoot] ++
sandboxSubdirs]))
containerID <- (trim . decodeUtf8) <$> readDockerProcess
envOverride
(concat
[["create"
,"--net=host"
,"-e",inContainerEnvVar ++ "=1"
,"-e",stackRootEnvVar ++ "=" ++ toFilePathNoTrailingSep stackRoot
,"-e","WORK_WD=" ++ toFilePathNoTrailingSep pwd
,"-e","WORK_HOME=" ++ toFilePathNoTrailingSep sandboxRepoDir
,"-e","WORK_ROOT=" ++ toFilePathNoTrailingSep projectRoot
,"-v",toFilePathNoTrailingSep stackRoot ++ ":" ++ toFilePathNoTrailingSep stackRoot
,"-v",toFilePathNoTrailingSep projectRoot ++ ":" ++ toFilePathNoTrailingSep projectRoot
,"-v",toFilePathNoTrailingSep sandboxSandboxDir ++ ":" ++ toFilePathNoTrailingSep sandboxDir
,"-v",toFilePathNoTrailingSep sandboxHomeDir ++ ":" ++ toFilePathNoTrailingSep sandboxRepoDir
,"-v",toFilePathNoTrailingSep stackRoot ++ ":" ++
toFilePathNoTrailingSep (sandboxRepoDir </> $(mkRelDir ("." ++ stackProgName ++ "/")))]
,userEnvVars
,concatMap (\(k,v) -> ["-e", k ++ "=" ++ v]) envVars
,concatMap sandboxSubdirArg sandboxSubdirs
,concatMap mountArg (extraMount ++ dockerMount docker)
,concatMap (\nv -> ["-e", nv]) (dockerEnv docker)
,case dockerContainerName docker of
Just name -> ["--name=" ++ name]
Nothing -> []
,["-t" | isTerm]
,["-i" | keepStdinOpen]
,dockerRunArgs docker
,[image]
,[cmnd]
,args])
before
#ifndef WINDOWS
runInBase <- liftBaseWith $ \run -> return (void . run)
oldHandlers <- forM (concat [[(sigINT,sigTERM) | not keepStdinOpen]
,[(sigTERM,sigTERM)]]) $ \(sigIn,sigOut) -> do
let sigHandler = runInBase (readProcessNull Nothing envOverride "docker"
["kill","--signal=" ++ show sigOut,containerID])
oldHandler <- liftIO $ installHandler sigIn (Catch sigHandler) Nothing
return (sigIn, oldHandler)
#endif
e <- try (callProcess'
(if keepStdinOpen then id else (\cp -> cp { delegate_ctlc = False }))
Nothing
envOverride
"docker"
(concat [["start"]
,["-a" | not (dockerDetach docker)]
,["-i" | keepStdinOpen]
,[containerID]]))
#ifndef WINDOWS
forM_ oldHandlers $ \(sig,oldHandler) ->
liftIO $ installHandler sig oldHandler Nothing
#endif
unless (dockerPersist docker || dockerDetach docker)
(readProcessNull Nothing envOverride "docker" ["rm","-f",containerID])
case e of
Left (ProcessExitedUnsuccessfully _ ec) -> liftIO (exitWith ec)
Right () -> do after
liftIO exitSuccess
where
lookupImageEnv name vars =
case lookup name vars of
Just ('=':val) -> Just val
_ -> Nothing
mountArg (Mount host container) = ["-v",host ++ ":" ++ container]
sandboxSubdirArg subdir = ["-v",toFilePathNoTrailingSep subdir++ ":" ++ toFilePathNoTrailingSep subdir]
projectRoot = fromMaybeProjectRoot mprojectRoot
-- | Clean-up old docker images and containers. | 6,986 | runContainerAndExit :: M env m
=> (EnvOverride -> Inspect -> m (FilePath,[String],[(String,String)],[Mount]))
-> Maybe (Path Abs Dir)
-> m ()
-> m ()
-> m ()
runContainerAndExit getCmdArgs
mprojectRoot
before
after =
do config <- asks getConfig
let docker = configDocker config
envOverride <- getEnvOverride (configPlatform config)
checkDockerVersion envOverride
(dockerHost,dockerCertPath,bamboo,jenkins) <-
liftIO ((,,,) <$> lookupEnv "DOCKER_HOST"
<*> lookupEnv "DOCKER_CERT_PATH"
<*> lookupEnv "bamboo_buildKey"
<*> lookupEnv "JENKINS_HOME")
let isRemoteDocker = maybe False (isPrefixOf "tcp://") dockerHost
userEnvVars <-
if fromMaybe (not isRemoteDocker) (dockerSetUser docker)
then do
uidOut <- readProcessStdout Nothing envOverride "id" ["-u"]
gidOut <- readProcessStdout Nothing envOverride "id" ["-g"]
return
[ "-e","WORK_UID=" ++ dropWhileEnd isSpace (decodeUtf8 uidOut)
, "-e","WORK_GID=" ++ dropWhileEnd isSpace (decodeUtf8 gidOut) ]
else return []
isStdoutTerminal <- asks getTerminal
(isStdinTerminal,isStderrTerminal) <-
liftIO ((,) <$> hIsTerminalDevice stdin
<*> hIsTerminalDevice stderr)
pwd <- getWorkingDir
when (isRemoteDocker &&
maybe False (isInfixOf "boot2docker") dockerCertPath)
($logWarn "Warning: Using boot2docker is NOT supported, and not likely to perform well.")
let image = dockerImage docker
maybeImageInfo <- inspect envOverride image
imageInfo <- case maybeImageInfo of
Just ii -> return ii
Nothing
| dockerAutoPull docker ->
do pullImage envOverride docker image
mii2 <- inspect envOverride image
case mii2 of
Just ii2 -> return ii2
Nothing -> throwM (InspectFailedException image)
| otherwise -> throwM (NotPulledException image)
(cmnd,args,envVars,extraMount) <- getCmdArgs envOverride imageInfo
let imageEnvVars = map (break (== '=')) (icEnv (iiConfig imageInfo))
sandboxID = fromMaybe "default" (lookupImageEnv sandboxIDEnvVar imageEnvVars)
sandboxIDDir <- parseRelDir (sandboxID ++ "/")
let stackRoot = configStackRoot config
sandboxDir = projectDockerSandboxDir projectRoot
sandboxSandboxDir = sandboxDir </> $(mkRelDir "_sandbox/") </> sandboxIDDir
sandboxHomeDir = sandboxDir </> homeDirName
sandboxRepoDir = sandboxDir </> sandboxIDDir
sandboxSubdirs = map (\d -> sandboxRepoDir </> d)
sandboxedHomeSubdirectories
isTerm = not (dockerDetach docker) &&
isStdinTerminal &&
isStdoutTerminal &&
isStderrTerminal
keepStdinOpen = not (dockerDetach docker) &&
-- Workaround for https://github.com/docker/docker/issues/12319
(isTerm || (isNothing bamboo && isNothing jenkins))
liftIO
(do updateDockerImageLastUsed config
(iiId imageInfo)
(toFilePath projectRoot)
mapM_ createTree
(concat [[sandboxHomeDir, sandboxSandboxDir, stackRoot] ++
sandboxSubdirs]))
containerID <- (trim . decodeUtf8) <$> readDockerProcess
envOverride
(concat
[["create"
,"--net=host"
,"-e",inContainerEnvVar ++ "=1"
,"-e",stackRootEnvVar ++ "=" ++ toFilePathNoTrailingSep stackRoot
,"-e","WORK_WD=" ++ toFilePathNoTrailingSep pwd
,"-e","WORK_HOME=" ++ toFilePathNoTrailingSep sandboxRepoDir
,"-e","WORK_ROOT=" ++ toFilePathNoTrailingSep projectRoot
,"-v",toFilePathNoTrailingSep stackRoot ++ ":" ++ toFilePathNoTrailingSep stackRoot
,"-v",toFilePathNoTrailingSep projectRoot ++ ":" ++ toFilePathNoTrailingSep projectRoot
,"-v",toFilePathNoTrailingSep sandboxSandboxDir ++ ":" ++ toFilePathNoTrailingSep sandboxDir
,"-v",toFilePathNoTrailingSep sandboxHomeDir ++ ":" ++ toFilePathNoTrailingSep sandboxRepoDir
,"-v",toFilePathNoTrailingSep stackRoot ++ ":" ++
toFilePathNoTrailingSep (sandboxRepoDir </> $(mkRelDir ("." ++ stackProgName ++ "/")))]
,userEnvVars
,concatMap (\(k,v) -> ["-e", k ++ "=" ++ v]) envVars
,concatMap sandboxSubdirArg sandboxSubdirs
,concatMap mountArg (extraMount ++ dockerMount docker)
,concatMap (\nv -> ["-e", nv]) (dockerEnv docker)
,case dockerContainerName docker of
Just name -> ["--name=" ++ name]
Nothing -> []
,["-t" | isTerm]
,["-i" | keepStdinOpen]
,dockerRunArgs docker
,[image]
,[cmnd]
,args])
before
#ifndef WINDOWS
runInBase <- liftBaseWith $ \run -> return (void . run)
oldHandlers <- forM (concat [[(sigINT,sigTERM) | not keepStdinOpen]
,[(sigTERM,sigTERM)]]) $ \(sigIn,sigOut) -> do
let sigHandler = runInBase (readProcessNull Nothing envOverride "docker"
["kill","--signal=" ++ show sigOut,containerID])
oldHandler <- liftIO $ installHandler sigIn (Catch sigHandler) Nothing
return (sigIn, oldHandler)
#endif
e <- try (callProcess'
(if keepStdinOpen then id else (\cp -> cp { delegate_ctlc = False }))
Nothing
envOverride
"docker"
(concat [["start"]
,["-a" | not (dockerDetach docker)]
,["-i" | keepStdinOpen]
,[containerID]]))
#ifndef WINDOWS
forM_ oldHandlers $ \(sig,oldHandler) ->
liftIO $ installHandler sig oldHandler Nothing
#endif
unless (dockerPersist docker || dockerDetach docker)
(readProcessNull Nothing envOverride "docker" ["rm","-f",containerID])
case e of
Left (ProcessExitedUnsuccessfully _ ec) -> liftIO (exitWith ec)
Right () -> do after
liftIO exitSuccess
where
lookupImageEnv name vars =
case lookup name vars of
Just ('=':val) -> Just val
_ -> Nothing
mountArg (Mount host container) = ["-v",host ++ ":" ++ container]
sandboxSubdirArg subdir = ["-v",toFilePathNoTrailingSep subdir++ ":" ++ toFilePathNoTrailingSep subdir]
projectRoot = fromMaybeProjectRoot mprojectRoot
-- | Clean-up old docker images and containers. | 6,917 | runContainerAndExit getCmdArgs
mprojectRoot
before
after =
do config <- asks getConfig
let docker = configDocker config
envOverride <- getEnvOverride (configPlatform config)
checkDockerVersion envOverride
(dockerHost,dockerCertPath,bamboo,jenkins) <-
liftIO ((,,,) <$> lookupEnv "DOCKER_HOST"
<*> lookupEnv "DOCKER_CERT_PATH"
<*> lookupEnv "bamboo_buildKey"
<*> lookupEnv "JENKINS_HOME")
let isRemoteDocker = maybe False (isPrefixOf "tcp://") dockerHost
userEnvVars <-
if fromMaybe (not isRemoteDocker) (dockerSetUser docker)
then do
uidOut <- readProcessStdout Nothing envOverride "id" ["-u"]
gidOut <- readProcessStdout Nothing envOverride "id" ["-g"]
return
[ "-e","WORK_UID=" ++ dropWhileEnd isSpace (decodeUtf8 uidOut)
, "-e","WORK_GID=" ++ dropWhileEnd isSpace (decodeUtf8 gidOut) ]
else return []
isStdoutTerminal <- asks getTerminal
(isStdinTerminal,isStderrTerminal) <-
liftIO ((,) <$> hIsTerminalDevice stdin
<*> hIsTerminalDevice stderr)
pwd <- getWorkingDir
when (isRemoteDocker &&
maybe False (isInfixOf "boot2docker") dockerCertPath)
($logWarn "Warning: Using boot2docker is NOT supported, and not likely to perform well.")
let image = dockerImage docker
maybeImageInfo <- inspect envOverride image
imageInfo <- case maybeImageInfo of
Just ii -> return ii
Nothing
| dockerAutoPull docker ->
do pullImage envOverride docker image
mii2 <- inspect envOverride image
case mii2 of
Just ii2 -> return ii2
Nothing -> throwM (InspectFailedException image)
| otherwise -> throwM (NotPulledException image)
(cmnd,args,envVars,extraMount) <- getCmdArgs envOverride imageInfo
let imageEnvVars = map (break (== '=')) (icEnv (iiConfig imageInfo))
sandboxID = fromMaybe "default" (lookupImageEnv sandboxIDEnvVar imageEnvVars)
sandboxIDDir <- parseRelDir (sandboxID ++ "/")
let stackRoot = configStackRoot config
sandboxDir = projectDockerSandboxDir projectRoot
sandboxSandboxDir = sandboxDir </> $(mkRelDir "_sandbox/") </> sandboxIDDir
sandboxHomeDir = sandboxDir </> homeDirName
sandboxRepoDir = sandboxDir </> sandboxIDDir
sandboxSubdirs = map (\d -> sandboxRepoDir </> d)
sandboxedHomeSubdirectories
isTerm = not (dockerDetach docker) &&
isStdinTerminal &&
isStdoutTerminal &&
isStderrTerminal
keepStdinOpen = not (dockerDetach docker) &&
-- Workaround for https://github.com/docker/docker/issues/12319
(isTerm || (isNothing bamboo && isNothing jenkins))
liftIO
(do updateDockerImageLastUsed config
(iiId imageInfo)
(toFilePath projectRoot)
mapM_ createTree
(concat [[sandboxHomeDir, sandboxSandboxDir, stackRoot] ++
sandboxSubdirs]))
containerID <- (trim . decodeUtf8) <$> readDockerProcess
envOverride
(concat
[["create"
,"--net=host"
,"-e",inContainerEnvVar ++ "=1"
,"-e",stackRootEnvVar ++ "=" ++ toFilePathNoTrailingSep stackRoot
,"-e","WORK_WD=" ++ toFilePathNoTrailingSep pwd
,"-e","WORK_HOME=" ++ toFilePathNoTrailingSep sandboxRepoDir
,"-e","WORK_ROOT=" ++ toFilePathNoTrailingSep projectRoot
,"-v",toFilePathNoTrailingSep stackRoot ++ ":" ++ toFilePathNoTrailingSep stackRoot
,"-v",toFilePathNoTrailingSep projectRoot ++ ":" ++ toFilePathNoTrailingSep projectRoot
,"-v",toFilePathNoTrailingSep sandboxSandboxDir ++ ":" ++ toFilePathNoTrailingSep sandboxDir
,"-v",toFilePathNoTrailingSep sandboxHomeDir ++ ":" ++ toFilePathNoTrailingSep sandboxRepoDir
,"-v",toFilePathNoTrailingSep stackRoot ++ ":" ++
toFilePathNoTrailingSep (sandboxRepoDir </> $(mkRelDir ("." ++ stackProgName ++ "/")))]
,userEnvVars
,concatMap (\(k,v) -> ["-e", k ++ "=" ++ v]) envVars
,concatMap sandboxSubdirArg sandboxSubdirs
,concatMap mountArg (extraMount ++ dockerMount docker)
,concatMap (\nv -> ["-e", nv]) (dockerEnv docker)
,case dockerContainerName docker of
Just name -> ["--name=" ++ name]
Nothing -> []
,["-t" | isTerm]
,["-i" | keepStdinOpen]
,dockerRunArgs docker
,[image]
,[cmnd]
,args])
before
#ifndef WINDOWS
runInBase <- liftBaseWith $ \run -> return (void . run)
oldHandlers <- forM (concat [[(sigINT,sigTERM) | not keepStdinOpen]
,[(sigTERM,sigTERM)]]) $ \(sigIn,sigOut) -> do
let sigHandler = runInBase (readProcessNull Nothing envOverride "docker"
["kill","--signal=" ++ show sigOut,containerID])
oldHandler <- liftIO $ installHandler sigIn (Catch sigHandler) Nothing
return (sigIn, oldHandler)
#endif
e <- try (callProcess'
(if keepStdinOpen then id else (\cp -> cp { delegate_ctlc = False }))
Nothing
envOverride
"docker"
(concat [["start"]
,["-a" | not (dockerDetach docker)]
,["-i" | keepStdinOpen]
,[containerID]]))
#ifndef WINDOWS
forM_ oldHandlers $ \(sig,oldHandler) ->
liftIO $ installHandler sig oldHandler Nothing
#endif
unless (dockerPersist docker || dockerDetach docker)
(readProcessNull Nothing envOverride "docker" ["rm","-f",containerID])
case e of
Left (ProcessExitedUnsuccessfully _ ec) -> liftIO (exitWith ec)
Right () -> do after
liftIO exitSuccess
where
lookupImageEnv name vars =
case lookup name vars of
Just ('=':val) -> Just val
_ -> Nothing
mountArg (Mount host container) = ["-v",host ++ ":" ++ container]
sandboxSubdirArg subdir = ["-v",toFilePathNoTrailingSep subdir++ ":" ++ toFilePathNoTrailingSep subdir]
projectRoot = fromMaybeProjectRoot mprojectRoot
-- | Clean-up old docker images and containers. | 6,659 | true | true | 0 | 23 | 2,248 | 1,792 | 903 | 889 | null | null |
markwatkinson/luminous | tests/regression/haskell/Parser.hs | lgpl-2.1 | squares = P.squares lexer | 37 | squares = P.squares lexer | 37 | squares = P.squares lexer | 37 | false | false | 0 | 6 | 15 | 11 | 5 | 6 | null | null |
nickbart1980/pandoc | src/Text/Pandoc/Parsing.hs | gpl-2.0 | -- | Parses material enclosed between start and end parsers.
enclosed :: Parser [Char] st t -- ^ start parser
-> Parser [Char] st end -- ^ end parser
-> Parser [Char] st a -- ^ content parser (to be used repeatedly)
-> Parser [Char] st [a]
enclosed start end parser = try $
start >> notFollowedBy space >> many1Till parser end | 361 | enclosed :: Parser [Char] st t -- ^ start parser
-> Parser [Char] st end -- ^ end parser
-> Parser [Char] st a -- ^ content parser (to be used repeatedly)
-> Parser [Char] st [a]
enclosed start end parser = try $
start >> notFollowedBy space >> many1Till parser end | 300 | enclosed start end parser = try $
start >> notFollowedBy space >> many1Till parser end | 88 | true | true | 2 | 10 | 96 | 102 | 51 | 51 | null | null |
mpwillson/mal | haskell/step8_macros.hs | mpl-2.0 | apply_ast ast@(MalList (MalSymbol "if" : args) _) env = do
case args of
(a1 : a2 : a3 : []) -> do
cond <- eval a1 env
if cond == MalFalse || cond == Nil
then eval a3 env
else eval a2 env
(a1 : a2 : []) -> do
cond <- eval a1 env
if cond == MalFalse || cond == Nil
then return Nil
else eval a2 env
_ -> throwStr "invalid if" | 465 | apply_ast ast@(MalList (MalSymbol "if" : args) _) env = do
case args of
(a1 : a2 : a3 : []) -> do
cond <- eval a1 env
if cond == MalFalse || cond == Nil
then eval a3 env
else eval a2 env
(a1 : a2 : []) -> do
cond <- eval a1 env
if cond == MalFalse || cond == Nil
then return Nil
else eval a2 env
_ -> throwStr "invalid if" | 465 | apply_ast ast@(MalList (MalSymbol "if" : args) _) env = do
case args of
(a1 : a2 : a3 : []) -> do
cond <- eval a1 env
if cond == MalFalse || cond == Nil
then eval a3 env
else eval a2 env
(a1 : a2 : []) -> do
cond <- eval a1 env
if cond == MalFalse || cond == Nil
then return Nil
else eval a2 env
_ -> throwStr "invalid if" | 465 | false | false | 0 | 15 | 217 | 178 | 86 | 92 | null | null |
rueshyna/gogol | gogol-compute/gen/Network/Google/Compute/Types/Product.hs | mpl-2.0 | -- | [Output Only] Name of the resource.
dtName :: Lens' DiskType (Maybe Text)
dtName = lens _dtName (\ s a -> s{_dtName = a}) | 126 | dtName :: Lens' DiskType (Maybe Text)
dtName = lens _dtName (\ s a -> s{_dtName = a}) | 85 | dtName = lens _dtName (\ s a -> s{_dtName = a}) | 47 | true | true | 2 | 9 | 24 | 55 | 25 | 30 | null | null |
fugyk/cabal | cabal-install/Distribution/Client/Targets.hs | bsd-3-clause | readPToMaybe :: Parse.ReadP a a -> String -> Maybe a
readPToMaybe p str = listToMaybe [ r | (r,s) <- Parse.readP_to_S p str
, all isSpace s ] | 178 | readPToMaybe :: Parse.ReadP a a -> String -> Maybe a
readPToMaybe p str = listToMaybe [ r | (r,s) <- Parse.readP_to_S p str
, all isSpace s ] | 178 | readPToMaybe p str = listToMaybe [ r | (r,s) <- Parse.readP_to_S p str
, all isSpace s ] | 125 | false | true | 0 | 10 | 64 | 70 | 34 | 36 | null | null |
fmapfmapfmap/amazonka | amazonka-rds/gen/Network/AWS/RDS/ListTagsForResource.hs | mpl-2.0 | -- | Creates a value of 'ListTagsForResource' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ltfrFilters'
--
-- * 'ltfrResourceName'
listTagsForResource
:: Text -- ^ 'ltfrResourceName'
-> ListTagsForResource
listTagsForResource pResourceName_ =
ListTagsForResource'
{ _ltfrFilters = Nothing
, _ltfrResourceName = pResourceName_
} | 440 | listTagsForResource
:: Text -- ^ 'ltfrResourceName'
-> ListTagsForResource
listTagsForResource pResourceName_ =
ListTagsForResource'
{ _ltfrFilters = Nothing
, _ltfrResourceName = pResourceName_
} | 220 | listTagsForResource pResourceName_ =
ListTagsForResource'
{ _ltfrFilters = Nothing
, _ltfrResourceName = pResourceName_
} | 137 | true | true | 0 | 6 | 82 | 40 | 26 | 14 | null | null |
martindavid/code-sandbox | comp90048/assignments/project1/Combination.hs | mit | combinations' a b = [ x ++ y | x <- a, y <- b] | 46 | combinations' a b = [ x ++ y | x <- a, y <- b] | 46 | combinations' a b = [ x ++ y | x <- a, y <- b] | 46 | false | false | 1 | 8 | 14 | 39 | 17 | 22 | null | null |
mcschroeder/ghc | compiler/prelude/THNames.hs | bsd-3-clause | -- data Inline = ...
noInlineDataConName, inlineDataConName, inlinableDataConName :: Name
noInlineDataConName = thCon (fsLit "NoInline") noInlineDataConKey | 157 | noInlineDataConName, inlineDataConName, inlinableDataConName :: Name
noInlineDataConName = thCon (fsLit "NoInline") noInlineDataConKey | 136 | noInlineDataConName = thCon (fsLit "NoInline") noInlineDataConKey | 67 | true | true | 0 | 7 | 17 | 27 | 16 | 11 | null | null |
geophf/1HaskellADay | exercises/HAD/Y2017/M01/D26/Exercise.hs | mit | -- wordCounts counts the words of a (Haskell) source file returning a
-- word -> occurences map.
-- hint: Data.Bag counts occurences of elements in a collection
-- Point wordCounts at this file. What are the top 5 words in this file?
{-- BONUS -----------------------------------------------------------------
Now, one file doesn't give a good cross section of frequently used words
in the Haskell corpus, so, find a Haskell Corpus, such as the sources of
the GHC libraries, or the 1HaskellADay problem sets and libraries, or your
own sets of Haskell files.
Run wordCounts over those filesets. What are the top 5 words of the combined
files?
--}
wordsCounts :: [FilePath] -> IO (Map String Int)
wordsCounts files = undefined | 730 | wordsCounts :: [FilePath] -> IO (Map String Int)
wordsCounts files = undefined | 78 | wordsCounts files = undefined | 29 | true | true | 0 | 8 | 122 | 41 | 22 | 19 | null | null |
zcesur/h99 | src/Problems46thru50.hs | gpl-3.0 | table :: (Bool -> Bool -> Bool) -> IO ()
table f = putStrLn $ tablePure f | 73 | table :: (Bool -> Bool -> Bool) -> IO ()
table f = putStrLn $ tablePure f | 73 | table f = putStrLn $ tablePure f | 32 | false | true | 0 | 8 | 16 | 41 | 20 | 21 | null | null |
genos/online_problems | advent_of_code_2018/day03/src/Main.hs | mit | claim :: Parser Claim
claim = do
_id <- char '#' >> decimal
_rect <- space >> char '@' >> space >> rect
pure C { _id, _rect } | 133 | claim :: Parser Claim
claim = do
_id <- char '#' >> decimal
_rect <- space >> char '@' >> space >> rect
pure C { _id, _rect } | 133 | claim = do
_id <- char '#' >> decimal
_rect <- space >> char '@' >> space >> rect
pure C { _id, _rect } | 111 | false | true | 0 | 11 | 36 | 64 | 30 | 34 | null | null |
Yuras/mongodb | Database/MongoDB/Transport/Tls.hs | apache-2.0 | tlsConnection :: TLS.Context -> IO Transport
tlsConnection ctx = do
restRef <- newIORef mempty
return Transport
{ T.read = \count -> let
readSome = do
rest <- readIORef restRef
writeIORef restRef mempty
if ByteString.null rest
then TLS.recvData ctx
else return rest
unread = \rest ->
modifyIORef restRef (rest <>)
go acc n = do
-- read until get enough bytes
chunk <- readSome
when (ByteString.null chunk) $
ioError eof
let len = ByteString.length chunk
if len >= n
then do
let (res, rest) = ByteString.splitAt n chunk
unless (ByteString.null rest) $
unread rest
return (acc <> Lazy.ByteString.fromStrict res)
else go (acc <> Lazy.ByteString.fromStrict chunk) (n - len)
eof = mkIOError eofErrorType "Database.MongoDB.Transport"
Nothing Nothing
in Lazy.ByteString.toStrict <$> go mempty count
, T.write = TLS.sendData ctx . Lazy.ByteString.fromStrict
, T.flush = TLS.contextFlush ctx
, T.close = TLS.contextClose ctx
} | 1,248 | tlsConnection :: TLS.Context -> IO Transport
tlsConnection ctx = do
restRef <- newIORef mempty
return Transport
{ T.read = \count -> let
readSome = do
rest <- readIORef restRef
writeIORef restRef mempty
if ByteString.null rest
then TLS.recvData ctx
else return rest
unread = \rest ->
modifyIORef restRef (rest <>)
go acc n = do
-- read until get enough bytes
chunk <- readSome
when (ByteString.null chunk) $
ioError eof
let len = ByteString.length chunk
if len >= n
then do
let (res, rest) = ByteString.splitAt n chunk
unless (ByteString.null rest) $
unread rest
return (acc <> Lazy.ByteString.fromStrict res)
else go (acc <> Lazy.ByteString.fromStrict chunk) (n - len)
eof = mkIOError eofErrorType "Database.MongoDB.Transport"
Nothing Nothing
in Lazy.ByteString.toStrict <$> go mempty count
, T.write = TLS.sendData ctx . Lazy.ByteString.fromStrict
, T.flush = TLS.contextFlush ctx
, T.close = TLS.contextClose ctx
} | 1,248 | tlsConnection ctx = do
restRef <- newIORef mempty
return Transport
{ T.read = \count -> let
readSome = do
rest <- readIORef restRef
writeIORef restRef mempty
if ByteString.null rest
then TLS.recvData ctx
else return rest
unread = \rest ->
modifyIORef restRef (rest <>)
go acc n = do
-- read until get enough bytes
chunk <- readSome
when (ByteString.null chunk) $
ioError eof
let len = ByteString.length chunk
if len >= n
then do
let (res, rest) = ByteString.splitAt n chunk
unless (ByteString.null rest) $
unread rest
return (acc <> Lazy.ByteString.fromStrict res)
else go (acc <> Lazy.ByteString.fromStrict chunk) (n - len)
eof = mkIOError eofErrorType "Database.MongoDB.Transport"
Nothing Nothing
in Lazy.ByteString.toStrict <$> go mempty count
, T.write = TLS.sendData ctx . Lazy.ByteString.fromStrict
, T.flush = TLS.contextFlush ctx
, T.close = TLS.contextClose ctx
} | 1,203 | false | true | 0 | 24 | 468 | 354 | 172 | 182 | null | null |
Helkafen/haddock | haddock-library/src/Documentation/Haddock/Parser.hs | bsd-2-clause | examples :: Parser (DocH mod a)
examples = DocExamples <$> (many (skipHorizontalSpace *> "\n") *> go)
where
go :: Parser [Example]
go = do
prefix <- decodeUtf8 <$> takeHorizontalSpace <* ">>>"
expr <- takeLine
(rs, es) <- resultAndMoreExamples
return (makeExample prefix expr rs : es)
where
resultAndMoreExamples :: Parser ([String], [Example])
resultAndMoreExamples = moreExamples <|> result <|> pure ([], [])
where
moreExamples :: Parser ([String], [Example])
moreExamples = (,) [] <$> go
result :: Parser ([String], [Example])
result = first . (:) <$> nonEmptyLine <*> resultAndMoreExamples
makeExample :: String -> String -> [String] -> Example
makeExample prefix expression res =
Example (strip expression) result
where
result = map (substituteBlankLine . tryStripPrefix) res
tryStripPrefix xs = fromMaybe xs (stripPrefix prefix xs)
substituteBlankLine "<BLANKLINE>" = ""
substituteBlankLine xs = xs | 1,074 | examples :: Parser (DocH mod a)
examples = DocExamples <$> (many (skipHorizontalSpace *> "\n") *> go)
where
go :: Parser [Example]
go = do
prefix <- decodeUtf8 <$> takeHorizontalSpace <* ">>>"
expr <- takeLine
(rs, es) <- resultAndMoreExamples
return (makeExample prefix expr rs : es)
where
resultAndMoreExamples :: Parser ([String], [Example])
resultAndMoreExamples = moreExamples <|> result <|> pure ([], [])
where
moreExamples :: Parser ([String], [Example])
moreExamples = (,) [] <$> go
result :: Parser ([String], [Example])
result = first . (:) <$> nonEmptyLine <*> resultAndMoreExamples
makeExample :: String -> String -> [String] -> Example
makeExample prefix expression res =
Example (strip expression) result
where
result = map (substituteBlankLine . tryStripPrefix) res
tryStripPrefix xs = fromMaybe xs (stripPrefix prefix xs)
substituteBlankLine "<BLANKLINE>" = ""
substituteBlankLine xs = xs | 1,074 | examples = DocExamples <$> (many (skipHorizontalSpace *> "\n") *> go)
where
go :: Parser [Example]
go = do
prefix <- decodeUtf8 <$> takeHorizontalSpace <* ">>>"
expr <- takeLine
(rs, es) <- resultAndMoreExamples
return (makeExample prefix expr rs : es)
where
resultAndMoreExamples :: Parser ([String], [Example])
resultAndMoreExamples = moreExamples <|> result <|> pure ([], [])
where
moreExamples :: Parser ([String], [Example])
moreExamples = (,) [] <$> go
result :: Parser ([String], [Example])
result = first . (:) <$> nonEmptyLine <*> resultAndMoreExamples
makeExample :: String -> String -> [String] -> Example
makeExample prefix expression res =
Example (strip expression) result
where
result = map (substituteBlankLine . tryStripPrefix) res
tryStripPrefix xs = fromMaybe xs (stripPrefix prefix xs)
substituteBlankLine "<BLANKLINE>" = ""
substituteBlankLine xs = xs | 1,042 | false | true | 2 | 12 | 297 | 348 | 180 | 168 | null | null |
spechub/Hets | Temporal/Ctl.hs | gpl-2.0 | sat m (Atom a) = Set.filter (Set.member a . labels m) (states m) | 64 | sat m (Atom a) = Set.filter (Set.member a . labels m) (states m) | 64 | sat m (Atom a) = Set.filter (Set.member a . labels m) (states m) | 64 | false | false | 0 | 9 | 12 | 45 | 21 | 24 | null | null |
roldugin/LiveFusion | Data/LiveFusion/Loop/Block.hs | bsd-3-clause | pprBlock :: Block -> String
pprBlock (Block stmts mbfinal)
= unlines $ map pprStmt (stmts ++ fin)
where fin = maybe [] return mbfinal -- returns either singleton or empty list | 179 | pprBlock :: Block -> String
pprBlock (Block stmts mbfinal)
= unlines $ map pprStmt (stmts ++ fin)
where fin = maybe [] return mbfinal -- returns either singleton or empty list | 179 | pprBlock (Block stmts mbfinal)
= unlines $ map pprStmt (stmts ++ fin)
where fin = maybe [] return mbfinal -- returns either singleton or empty list | 151 | false | true | 0 | 8 | 34 | 60 | 30 | 30 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/enumFromThenTo_2.hs | mit | flip :: (c -> b -> a) -> b -> c -> a;
flip f x y = f y x | 66 | flip :: (c -> b -> a) -> b -> c -> a
flip f x y = f y x | 65 | flip f x y = f y x | 18 | false | true | 0 | 8 | 30 | 47 | 24 | 23 | null | null |
CBMM/CBaaS | cbaas-lib/src/Model.hs | bsd-3-clause | readModelImage :: ReadS ModelImage
readModelImage s = case imageFromBytes (BS.pack $ Prelude.dropWhile (== ' ') s) of
Right m -> [(m,"")]
Left e -> error e | 159 | readModelImage :: ReadS ModelImage
readModelImage s = case imageFromBytes (BS.pack $ Prelude.dropWhile (== ' ') s) of
Right m -> [(m,"")]
Left e -> error e | 159 | readModelImage s = case imageFromBytes (BS.pack $ Prelude.dropWhile (== ' ') s) of
Right m -> [(m,"")]
Left e -> error e | 124 | false | true | 0 | 10 | 29 | 78 | 38 | 40 | null | null |
comonoidial/ALFIN | Alfin/CoreLowering.hs | mit | lowerSubLamExp :: [(String,ShapeType)] -> [(Name,SCType)] -> SCExp -> SCType -> NameGen ([FunDef], ([TopExp -> TopExp], SimpleExp))
lowerSubLamExp tfs as e t = do
let fs = filter (flip notElem $ map fst as) (freeVars e)
let fds = map (\fv -> (fv, maybe (error ("lookup " ++ fv ++ show tfs)) id $ lookup fv tfs)) fs
let vs = map (\(a,x) -> (a, lowerType x)) as
e' <- lowerTopExp (vs ++ tfs) e
lf <- newName "lam"
return (fst e', ([LetExp ("",lf) (fds ++ vs) (lowerType t) (snd e')], FunVal ("",lf) $ map VarExp fs)) | 526 | lowerSubLamExp :: [(String,ShapeType)] -> [(Name,SCType)] -> SCExp -> SCType -> NameGen ([FunDef], ([TopExp -> TopExp], SimpleExp))
lowerSubLamExp tfs as e t = do
let fs = filter (flip notElem $ map fst as) (freeVars e)
let fds = map (\fv -> (fv, maybe (error ("lookup " ++ fv ++ show tfs)) id $ lookup fv tfs)) fs
let vs = map (\(a,x) -> (a, lowerType x)) as
e' <- lowerTopExp (vs ++ tfs) e
lf <- newName "lam"
return (fst e', ([LetExp ("",lf) (fds ++ vs) (lowerType t) (snd e')], FunVal ("",lf) $ map VarExp fs)) | 526 | lowerSubLamExp tfs as e t = do
let fs = filter (flip notElem $ map fst as) (freeVars e)
let fds = map (\fv -> (fv, maybe (error ("lookup " ++ fv ++ show tfs)) id $ lookup fv tfs)) fs
let vs = map (\(a,x) -> (a, lowerType x)) as
e' <- lowerTopExp (vs ++ tfs) e
lf <- newName "lam"
return (fst e', ([LetExp ("",lf) (fds ++ vs) (lowerType t) (snd e')], FunVal ("",lf) $ map VarExp fs)) | 394 | false | true | 0 | 20 | 107 | 318 | 165 | 153 | null | null |
fffej/HS-Poker | LookupPatternMatch.hs | bsd-3-clause | getValueFromProduct 4133261 = 3910 | 34 | getValueFromProduct 4133261 = 3910 | 34 | getValueFromProduct 4133261 = 3910 | 34 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
Peaker/FreeTypeGL | src/Graphics/FreetypeGL/TextureFont.hs | bsd-3-clause | descender :: TextureFont -> IO Float
descender (TextureFont ptr) = realToFrac <$> peek (TF.p'texture_font_t'descender ptr) | 122 | descender :: TextureFont -> IO Float
descender (TextureFont ptr) = realToFrac <$> peek (TF.p'texture_font_t'descender ptr) | 122 | descender (TextureFont ptr) = realToFrac <$> peek (TF.p'texture_font_t'descender ptr) | 85 | false | true | 0 | 9 | 14 | 46 | 21 | 25 | null | null |
gaetjen/FunFreakyPatMan | src/HasseTree.hs | mit | toString' ((HasseLeafNode itm n):htT) prefix = prefix ++ itm ++ " " ++ (show n) ++ "\n"++ (toString' htT prefix) | 112 | toString' ((HasseLeafNode itm n):htT) prefix = prefix ++ itm ++ " " ++ (show n) ++ "\n"++ (toString' htT prefix) | 112 | toString' ((HasseLeafNode itm n):htT) prefix = prefix ++ itm ++ " " ++ (show n) ++ "\n"++ (toString' htT prefix) | 112 | false | false | 0 | 9 | 19 | 60 | 30 | 30 | null | null |
kmels/hledger | hledger-lib/Hledger/Read/CsvReader.hs | gpl-3.0 | setCsvFieldIndexesFromList :: [CsvFieldName] -> CsvRules -> CsvRules
setCsvFieldIndexesFromList fs r = r{rcsvfieldindexes=zip fs [1..]} | 135 | setCsvFieldIndexesFromList :: [CsvFieldName] -> CsvRules -> CsvRules
setCsvFieldIndexesFromList fs r = r{rcsvfieldindexes=zip fs [1..]} | 135 | setCsvFieldIndexesFromList fs r = r{rcsvfieldindexes=zip fs [1..]} | 66 | false | true | 0 | 8 | 13 | 43 | 23 | 20 | null | null |
rueshyna/gogol | gogol-servicemanagement/gen/Network/Google/Resource/ServiceManagement/Services/Configs/Create.hs | mpl-2.0 | -- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
sccUploadType :: Lens' ServicesConfigsCreate (Maybe Text)
sccUploadType
= lens _sccUploadType
(\ s a -> s{_sccUploadType = a}) | 205 | sccUploadType :: Lens' ServicesConfigsCreate (Maybe Text)
sccUploadType
= lens _sccUploadType
(\ s a -> s{_sccUploadType = a}) | 134 | sccUploadType
= lens _sccUploadType
(\ s a -> s{_sccUploadType = a}) | 76 | true | true | 1 | 9 | 34 | 51 | 25 | 26 | null | null |
brendanhay/gogol | gogol-youtube/gen/Network/Google/YouTube/Types/Product.hs | mpl-2.0 | -- | General pagination information.
clrPageInfo :: Lens' ChannelListResponse (Maybe PageInfo)
clrPageInfo
= lens _clrPageInfo (\ s a -> s{_clrPageInfo = a}) | 159 | clrPageInfo :: Lens' ChannelListResponse (Maybe PageInfo)
clrPageInfo
= lens _clrPageInfo (\ s a -> s{_clrPageInfo = a}) | 122 | clrPageInfo
= lens _clrPageInfo (\ s a -> s{_clrPageInfo = a}) | 64 | true | true | 0 | 9 | 23 | 48 | 25 | 23 | null | null |
mhlakhani/hlisp | src/Lexer.hs | mit | reserved = Tok.reserved lexer | 36 | reserved = Tok.reserved lexer | 36 | reserved = Tok.reserved lexer | 36 | false | false | 0 | 6 | 10 | 11 | 5 | 6 | null | null |
mainland/nikola | src/Data/Vector/CUDA/Storable.hs | bsd-3-clause | -- NOTE: eta-expanded due to http://hackage.haskell.org/trac/ghc/ticket/4120
create p = G.create p | 98 | create p = G.create p | 21 | create p = G.create p | 21 | true | false | 0 | 6 | 10 | 15 | 7 | 8 | null | null |
nikolaspapirniywork/99_problems | haskell/src/P2.hs | apache-2.0 | myButLast'' :: [a] -> a
myButLast'' [] = error "No elements" | 60 | myButLast'' :: [a] -> a
myButLast'' [] = error "No elements" | 60 | myButLast'' [] = error "No elements" | 36 | false | true | 0 | 6 | 10 | 26 | 13 | 13 | null | null |
scott-fleischman/greek-grammar | haskell/greek-grammar/src/Data/Unicode/DecomposeChar.hs | mit | decomposeChar '\x2F8A7' = "\x614C" | 34 | decomposeChar '\x2F8A7' = "\x614C" | 34 | decomposeChar '\x2F8A7' = "\x614C" | 34 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
brendanhay/gogol | gogol-compute/gen/Network/Google/Resource/Compute/RegionBackendServices/Delete.hs | mpl-2.0 | -- | Project ID for this request.
rbsdProject :: Lens' RegionBackendServicesDelete Text
rbsdProject
= lens _rbsdProject (\ s a -> s{_rbsdProject = a}) | 152 | rbsdProject :: Lens' RegionBackendServicesDelete Text
rbsdProject
= lens _rbsdProject (\ s a -> s{_rbsdProject = a}) | 118 | rbsdProject
= lens _rbsdProject (\ s a -> s{_rbsdProject = a}) | 64 | true | true | 0 | 9 | 24 | 42 | 22 | 20 | null | null |
AlexanderPankiv/ghc | compiler/llvmGen/Llvm/Types.hs | bsd-3-clause | i16 = LMInt 16 | 17 | i16 = LMInt 16 | 17 | i16 = LMInt 16 | 17 | false | false | 1 | 5 | 6 | 12 | 4 | 8 | null | null |
l0b0/Project-Euler | 2 - Sum of even Fibonacci numbers up to N.hs | gpl-3.0 | sumEvenFibonaccisUntil :: (Integral integral) => integral -> integral
sumEvenFibonaccisUntil number = sum (evenFibonaccisUntil number) | 134 | sumEvenFibonaccisUntil :: (Integral integral) => integral -> integral
sumEvenFibonaccisUntil number = sum (evenFibonaccisUntil number) | 134 | sumEvenFibonaccisUntil number = sum (evenFibonaccisUntil number) | 64 | false | true | 0 | 7 | 13 | 36 | 18 | 18 | null | null |
plumlife/cabal | Cabal/Distribution/Simple/PackageIndex.hs | bsd-3-clause | reverseTopologicalOrder :: PackageInstalled a => PackageIndex a -> [a]
reverseTopologicalOrder index = map toPkgId
. Graph.topSort
. Graph.transposeG
$ graph
where (graph, toPkgId, _) = dependencyGraph index
-- | Builds a graph of the package dependencies.
--
-- Dependencies on other packages that are not in the index are discarded.
-- You can check if there are any such dependencies with 'brokenPackages'.
-- | 505 | reverseTopologicalOrder :: PackageInstalled a => PackageIndex a -> [a]
reverseTopologicalOrder index = map toPkgId
. Graph.topSort
. Graph.transposeG
$ graph
where (graph, toPkgId, _) = dependencyGraph index
-- | Builds a graph of the package dependencies.
--
-- Dependencies on other packages that are not in the index are discarded.
-- You can check if there are any such dependencies with 'brokenPackages'.
-- | 505 | reverseTopologicalOrder index = map toPkgId
. Graph.topSort
. Graph.transposeG
$ graph
where (graph, toPkgId, _) = dependencyGraph index
-- | Builds a graph of the package dependencies.
--
-- Dependencies on other packages that are not in the index are discarded.
-- You can check if there are any such dependencies with 'brokenPackages'.
-- | 434 | false | true | 0 | 8 | 155 | 75 | 40 | 35 | null | null |
cocreature/rss2diaspora-hs | Bot.hs | mit | replaceFeedItem' :: Item -> ReaderT ConfigFile IO (Maybe T.Text)
replaceFeedItem' item =
replaceFeedItem item <$>
asks absPath <*>
asks tags | 146 | replaceFeedItem' :: Item -> ReaderT ConfigFile IO (Maybe T.Text)
replaceFeedItem' item =
replaceFeedItem item <$>
asks absPath <*>
asks tags | 146 | replaceFeedItem' item =
replaceFeedItem item <$>
asks absPath <*>
asks tags | 81 | false | true | 0 | 9 | 25 | 50 | 23 | 27 | null | null |
alexander-at-github/eta | compiler/ETA/DeSugar/DsArrows.hs | bsd-3-clause | mkFailExpr :: HsMatchContext Id -> Type -> DsM CoreExpr
mkFailExpr ctxt ty
= mkErrorAppDs pAT_ERROR_ID ty (matchContextErrString ctxt) | 136 | mkFailExpr :: HsMatchContext Id -> Type -> DsM CoreExpr
mkFailExpr ctxt ty
= mkErrorAppDs pAT_ERROR_ID ty (matchContextErrString ctxt) | 136 | mkFailExpr ctxt ty
= mkErrorAppDs pAT_ERROR_ID ty (matchContextErrString ctxt) | 80 | false | true | 0 | 8 | 19 | 48 | 21 | 27 | null | null |
geophf/1HaskellADay | exercises/HAD/Y2017/M09/D04/Solution.hs | mit | wordFreq url dir files@(_:_) = wf url dir files emptyBag | 56 | wordFreq url dir files@(_:_) = wf url dir files emptyBag | 56 | wordFreq url dir files@(_:_) = wf url dir files emptyBag | 56 | false | false | 0 | 8 | 9 | 34 | 16 | 18 | null | null |
grwlf/vsim | src/VSim.hs | gpl-3.0 | gen_pat_list es = HS.PList es | 29 | gen_pat_list es = HS.PList es | 29 | gen_pat_list es = HS.PList es | 29 | false | false | 0 | 6 | 4 | 14 | 6 | 8 | null | null |
cosmo0920/hs-mongo | Database/MongoDB/App/Mongo/Internal.hs | mit | -- READ
allUser :: Action IO [Document]
allUser = rest =<< find (select [] collectionName) {sort = ["name.email1.mail1" =: 1]} | 126 | allUser :: Action IO [Document]
allUser = rest =<< find (select [] collectionName) {sort = ["name.email1.mail1" =: 1]} | 118 | allUser = rest =<< find (select [] collectionName) {sort = ["name.email1.mail1" =: 1]} | 86 | true | true | 0 | 10 | 19 | 52 | 28 | 24 | null | null |
Denommus/stack | src/Stack/Build/ConstructPlan.hs | bsd-3-clause | tellExecutables name (PSUpstream version loc flags) = do
tellExecutablesUpstream name version loc flags | 107 | tellExecutables name (PSUpstream version loc flags) = do
tellExecutablesUpstream name version loc flags | 107 | tellExecutables name (PSUpstream version loc flags) = do
tellExecutablesUpstream name version loc flags | 107 | false | false | 0 | 7 | 16 | 35 | 15 | 20 | null | null |
bos/inttable | IntTable.hs | bsd-3-clause | updateWith :: (a -> Maybe a) -> Int -> IntTable a -> IO (Maybe a)
updateWith f k (IntTable ref) = do
it@IT{..} <- readIORef ref
let idx = indexOf k it
go changed bkt@Bucket{..}
| bucketKey == k =
let fbv = f bucketValue
!nb = case fbv of
Just val -> bkt { bucketValue = val }
Nothing -> bucketNext
in (fbv, Just bucketValue, nb)
| otherwise = case go changed bucketNext of
(fbv, ov, nb) -> (fbv, ov, bkt { bucketNext = nb })
go _ e = (Nothing, Nothing, e)
(fbv, oldVal, newBucket) <- go False `liftM` Arr.read tabArr idx
when (isJust oldVal) $ do
Arr.write tabArr idx newBucket
unless (isJust fbv) $
withForeignPtr tabSize $ \ptr -> do
size <- peek ptr
poke ptr (size - 1)
return oldVal | 867 | updateWith :: (a -> Maybe a) -> Int -> IntTable a -> IO (Maybe a)
updateWith f k (IntTable ref) = do
it@IT{..} <- readIORef ref
let idx = indexOf k it
go changed bkt@Bucket{..}
| bucketKey == k =
let fbv = f bucketValue
!nb = case fbv of
Just val -> bkt { bucketValue = val }
Nothing -> bucketNext
in (fbv, Just bucketValue, nb)
| otherwise = case go changed bucketNext of
(fbv, ov, nb) -> (fbv, ov, bkt { bucketNext = nb })
go _ e = (Nothing, Nothing, e)
(fbv, oldVal, newBucket) <- go False `liftM` Arr.read tabArr idx
when (isJust oldVal) $ do
Arr.write tabArr idx newBucket
unless (isJust fbv) $
withForeignPtr tabSize $ \ptr -> do
size <- peek ptr
poke ptr (size - 1)
return oldVal | 867 | updateWith f k (IntTable ref) = do
it@IT{..} <- readIORef ref
let idx = indexOf k it
go changed bkt@Bucket{..}
| bucketKey == k =
let fbv = f bucketValue
!nb = case fbv of
Just val -> bkt { bucketValue = val }
Nothing -> bucketNext
in (fbv, Just bucketValue, nb)
| otherwise = case go changed bucketNext of
(fbv, ov, nb) -> (fbv, ov, bkt { bucketNext = nb })
go _ e = (Nothing, Nothing, e)
(fbv, oldVal, newBucket) <- go False `liftM` Arr.read tabArr idx
when (isJust oldVal) $ do
Arr.write tabArr idx newBucket
unless (isJust fbv) $
withForeignPtr tabSize $ \ptr -> do
size <- peek ptr
poke ptr (size - 1)
return oldVal | 801 | false | true | 0 | 19 | 314 | 368 | 181 | 187 | null | null |
chrisdone/path | src/Path/Include.hs | bsd-3-clause | parent (Path fp) =
Path
$ normalizeDir
$ FilePath.takeDirectory
$ FilePath.dropTrailingPathSeparator fp | 119 | parent (Path fp) =
Path
$ normalizeDir
$ FilePath.takeDirectory
$ FilePath.dropTrailingPathSeparator fp | 119 | parent (Path fp) =
Path
$ normalizeDir
$ FilePath.takeDirectory
$ FilePath.dropTrailingPathSeparator fp | 119 | false | false | 6 | 7 | 27 | 37 | 16 | 21 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/readDec_1.hs | mit | primMulInt (Neg x) (Neg y) = Pos (primMulNat x y) | 49 | primMulInt (Neg x) (Neg y) = Pos (primMulNat x y) | 49 | primMulInt (Neg x) (Neg y) = Pos (primMulNat x y) | 49 | false | false | 0 | 7 | 9 | 34 | 16 | 18 | null | null |
csrhodes/pandoc | src/Text/Pandoc/Writers/Docx.hs | gpl-2.0 | blockToOpenXML opts (BlockQuote blocks) = do
p <- withParaPropM (pStyleM "Block Text") $ blocksToOpenXML opts blocks
setFirstPara
return p | 144 | blockToOpenXML opts (BlockQuote blocks) = do
p <- withParaPropM (pStyleM "Block Text") $ blocksToOpenXML opts blocks
setFirstPara
return p | 144 | blockToOpenXML opts (BlockQuote blocks) = do
p <- withParaPropM (pStyleM "Block Text") $ blocksToOpenXML opts blocks
setFirstPara
return p | 144 | false | false | 0 | 11 | 24 | 51 | 22 | 29 | null | null |
ddssff/pandoc | src/Text/Pandoc/Writers/ICML.hs | gpl-2.0 | tableName = "TablePar" | 30 | tableName = "TablePar" | 30 | tableName = "TablePar" | 30 | false | false | 0 | 4 | 10 | 6 | 3 | 3 | null | null |
GRACeFUL-project/GRACe | examples/QuickCheckTesting.hs | bsd-3-clause | myProp :: [Int] -> Property
myProp xs = forAll arbitrary $ \a ->
forAll arbitrary $ \(Positive b) ->
-- collect b $
countSummits xs == countSummits (map (\x -> a + b*x) xs) | 209 | myProp :: [Int] -> Property
myProp xs = forAll arbitrary $ \a ->
forAll arbitrary $ \(Positive b) ->
-- collect b $
countSummits xs == countSummits (map (\x -> a + b*x) xs) | 209 | myProp xs = forAll arbitrary $ \a ->
forAll arbitrary $ \(Positive b) ->
-- collect b $
countSummits xs == countSummits (map (\x -> a + b*x) xs) | 181 | false | true | 0 | 16 | 70 | 86 | 44 | 42 | null | null |
phaazon/linear | src/Linear/Plucker.hs | bsd-3-clause | plucker :: Num a => V4 a -> V4 a -> Plucker a
plucker (V4 a b c d)
(V4 e f g h) =
Plucker (a*f-b*e)
(a*g-c*e)
(b*g-c*f)
(a*h-d*e)
(b*h-d*f)
(c*h-d*g) | 209 | plucker :: Num a => V4 a -> V4 a -> Plucker a
plucker (V4 a b c d)
(V4 e f g h) =
Plucker (a*f-b*e)
(a*g-c*e)
(b*g-c*f)
(a*h-d*e)
(b*h-d*f)
(c*h-d*g) | 209 | plucker (V4 a b c d)
(V4 e f g h) =
Plucker (a*f-b*e)
(a*g-c*e)
(b*g-c*f)
(a*h-d*e)
(b*h-d*f)
(c*h-d*g) | 163 | false | true | 0 | 11 | 91 | 177 | 85 | 92 | null | null |
bixuanzju/FunImpl | src/Expr.hs | gpl-3.0 | desugar (Rec (RB n params field) e) =
let selNames = map fst . selector $ field
taus = map snd . selector $ field
ru = foldl App (Var n) (map (Var . fst) params)
selTypes = map (\t -> foldr (\(u, k) tau -> Pi u k tau) (Pi "" ru t) params) taus
xs = genVarsAndTypes 'x' taus
selExprs = zip selNames
(zip selTypes
(map
(\i ->
genLambdas params
(Lam "L" ru
(Case (Var "L")
[ Alt (PConstr (Constructor (recordName field) []) xs)
(Var (map fst xs !! i))
])))
[0 :: Int .. length taus - 1]))
lastExpr = Data (DB n params [Constructor (recordName field) (selector field)])
(desugar (foldr (\(name, (kt, ke)) body -> Let name kt ke body) e selExprs))
in lastExpr | 1,007 | desugar (Rec (RB n params field) e) =
let selNames = map fst . selector $ field
taus = map snd . selector $ field
ru = foldl App (Var n) (map (Var . fst) params)
selTypes = map (\t -> foldr (\(u, k) tau -> Pi u k tau) (Pi "" ru t) params) taus
xs = genVarsAndTypes 'x' taus
selExprs = zip selNames
(zip selTypes
(map
(\i ->
genLambdas params
(Lam "L" ru
(Case (Var "L")
[ Alt (PConstr (Constructor (recordName field) []) xs)
(Var (map fst xs !! i))
])))
[0 :: Int .. length taus - 1]))
lastExpr = Data (DB n params [Constructor (recordName field) (selector field)])
(desugar (foldr (\(name, (kt, ke)) body -> Let name kt ke body) e selExprs))
in lastExpr | 1,007 | desugar (Rec (RB n params field) e) =
let selNames = map fst . selector $ field
taus = map snd . selector $ field
ru = foldl App (Var n) (map (Var . fst) params)
selTypes = map (\t -> foldr (\(u, k) tau -> Pi u k tau) (Pi "" ru t) params) taus
xs = genVarsAndTypes 'x' taus
selExprs = zip selNames
(zip selTypes
(map
(\i ->
genLambdas params
(Lam "L" ru
(Case (Var "L")
[ Alt (PConstr (Constructor (recordName field) []) xs)
(Var (map fst xs !! i))
])))
[0 :: Int .. length taus - 1]))
lastExpr = Data (DB n params [Constructor (recordName field) (selector field)])
(desugar (foldr (\(name, (kt, ke)) body -> Let name kt ke body) e selExprs))
in lastExpr | 1,007 | false | false | 0 | 28 | 480 | 382 | 196 | 186 | null | null |
isaiah/cis194 | src/Ch04.hs | mit | fun1 :: [Integer] -> Integer
fun1 [] = 1 | 40 | fun1 :: [Integer] -> Integer
fun1 [] = 1 | 40 | fun1 [] = 1 | 11 | false | true | 0 | 6 | 8 | 23 | 12 | 11 | null | null |
bsl/GLFW-b | Graphics/UI/GLFW.hs | bsd-2-clause | windowHint (WindowHint'Maximized x) =
c'glfwWindowHint c'GLFW_MAXIMIZED (toC x) | 109 | windowHint (WindowHint'Maximized x) =
c'glfwWindowHint c'GLFW_MAXIMIZED (toC x) | 109 | windowHint (WindowHint'Maximized x) =
c'glfwWindowHint c'GLFW_MAXIMIZED (toC x) | 109 | false | false | 0 | 7 | 37 | 26 | 12 | 14 | null | null |
brendanhay/gogol | gogol-healthcare/gen/Network/Google/Resource/Healthcare/Projects/Locations/DataSets/ConsentStores/UserDataMAppings/Delete.hs | mpl-2.0 | -- | Upload protocol for media (e.g. \"raw\", \"multipart\").
pldscsudmadUploadProtocol :: Lens' ProjectsLocationsDataSetsConsentStoresUserDataMAppingsDelete (Maybe Text)
pldscsudmadUploadProtocol
= lens _pldscsudmadUploadProtocol
(\ s a -> s{_pldscsudmadUploadProtocol = a}) | 283 | pldscsudmadUploadProtocol :: Lens' ProjectsLocationsDataSetsConsentStoresUserDataMAppingsDelete (Maybe Text)
pldscsudmadUploadProtocol
= lens _pldscsudmadUploadProtocol
(\ s a -> s{_pldscsudmadUploadProtocol = a}) | 221 | pldscsudmadUploadProtocol
= lens _pldscsudmadUploadProtocol
(\ s a -> s{_pldscsudmadUploadProtocol = a}) | 112 | true | true | 0 | 8 | 33 | 49 | 25 | 24 | null | null |
NCrashed/PowerCom | src/powercom/Application/Layer.hs | gpl-3.0 | userDisconnectHandler :: GuiApi -> (ProcessId, String, String) -> Process Bool
userDisconnectHandler api (_, _, name) = do
liftIO $ removeUser api name
return True
-- | Initializes application layer. | 214 | userDisconnectHandler :: GuiApi -> (ProcessId, String, String) -> Process Bool
userDisconnectHandler api (_, _, name) = do
liftIO $ removeUser api name
return True
-- | Initializes application layer. | 214 | userDisconnectHandler api (_, _, name) = do
liftIO $ removeUser api name
return True
-- | Initializes application layer. | 135 | false | true | 0 | 8 | 43 | 64 | 33 | 31 | null | null |
keithshep/txt-sushi | Database/TxtSushi/SQLExpression.hs | bsd-3-clause | expressionToString (StringConstantExpression _ strRep) = strRep | 63 | expressionToString (StringConstantExpression _ strRep) = strRep | 63 | expressionToString (StringConstantExpression _ strRep) = strRep | 63 | false | false | 0 | 6 | 5 | 18 | 8 | 10 | null | null |
mariefarrell/Hets | ATC/ATCTest2.hs | gpl-2.0 | checkDDataMap :: String -> FilePath -> IO ()
checkDDataMap upperstr fp = do
int_list <- generateRandomLists upperstr
let int_map = Map.fromList int_list
str <- readFile fp
let read_map = fromShATerm (readATerm str)
putStrLn ("BigMap of Int -> Int is " ++
(if read_map == int_map
then "consistent."
else "inconsistent!!")) | 497 | checkDDataMap :: String -> FilePath -> IO ()
checkDDataMap upperstr fp = do
int_list <- generateRandomLists upperstr
let int_map = Map.fromList int_list
str <- readFile fp
let read_map = fromShATerm (readATerm str)
putStrLn ("BigMap of Int -> Int is " ++
(if read_map == int_map
then "consistent."
else "inconsistent!!")) | 497 | checkDDataMap upperstr fp = do
int_list <- generateRandomLists upperstr
let int_map = Map.fromList int_list
str <- readFile fp
let read_map = fromShATerm (readATerm str)
putStrLn ("BigMap of Int -> Int is " ++
(if read_map == int_map
then "consistent."
else "inconsistent!!")) | 452 | false | true | 0 | 13 | 224 | 114 | 52 | 62 | null | null |
Zoetermeer/latro | src/Latro/Typecheck.hs | mit | lookupPatIn :: TEnv -> UniqId -> Checked Ty
lookupPatIn table id =
hoistEither $ maybeToEither (ErrUnboundUniqIdentifier id) $ Map.lookup id table | 148 | lookupPatIn :: TEnv -> UniqId -> Checked Ty
lookupPatIn table id =
hoistEither $ maybeToEither (ErrUnboundUniqIdentifier id) $ Map.lookup id table | 148 | lookupPatIn table id =
hoistEither $ maybeToEither (ErrUnboundUniqIdentifier id) $ Map.lookup id table | 104 | false | true | 2 | 8 | 22 | 56 | 25 | 31 | null | null |
urbanslug/ghc | testsuite/tests/codeGen/should_run/CmmSwitchTestGen.hs | bsd-3-clause | output :: Integer -> Integer
output n = n`div`2 + 42 | 52 | output :: Integer -> Integer
output n = n`div`2 + 42 | 52 | output n = n`div`2 + 42 | 23 | false | true | 0 | 6 | 10 | 28 | 15 | 13 | null | null |
luisnavarrodelangel/InnerEar | src/InnerEar/Exercises/MultipleChoice.hs | gpl-3.0 | answerSelected :: (Eq a,Ord a,Ord c) => a -> MultipleChoiceState a c -> MultipleChoiceState a c
answerSelected _ s | mode s == ListenMode = s | 141 | answerSelected :: (Eq a,Ord a,Ord c) => a -> MultipleChoiceState a c -> MultipleChoiceState a c
answerSelected _ s | mode s == ListenMode = s | 141 | answerSelected _ s | mode s == ListenMode = s | 45 | false | true | 0 | 9 | 25 | 68 | 32 | 36 | null | null |
vikraman/ghc | compiler/coreSyn/CoreUtils.hs | bsd-3-clause | exprIsTrivial (Coercion _) = True | 37 | exprIsTrivial (Coercion _) = True | 37 | exprIsTrivial (Coercion _) = True | 37 | false | false | 0 | 7 | 8 | 15 | 7 | 8 | null | null |
brendanhay/gogol | gogol-apps-calendar/gen/Network/Google/AppsCalendar/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'ConferenceSolution' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'csIconURI'
--
-- * 'csKey'
--
-- * 'csName'
conferenceSolution
:: ConferenceSolution
conferenceSolution =
ConferenceSolution'
{_csIconURI = Nothing, _csKey = Nothing, _csName = Nothing} | 374 | conferenceSolution
:: ConferenceSolution
conferenceSolution =
ConferenceSolution'
{_csIconURI = Nothing, _csKey = Nothing, _csName = Nothing} | 151 | conferenceSolution =
ConferenceSolution'
{_csIconURI = Nothing, _csKey = Nothing, _csName = Nothing} | 106 | true | true | 1 | 7 | 66 | 47 | 29 | 18 | null | null |
gleachkr/Carnap | Carnap/src/Carnap/Languages/PureFirstOrder/Logic/Gamut.hs | gpl-3.0 | parseGamutNDCore rtc = do r <- choice (map (try . string) [ "IA", "I∀", "EA", "E∀", "IE", "I∃", "EE", "E∃", "I=", "E=" ])
case r of
r | r `elem` [ "IA", "I∀" ] -> return [InA]
| r `elem` [ "EA", "E∀" ] -> return [ElimA]
| r `elem` [ "IE", "I∃" ] -> return [InE]
| r `elem` [ "EE", "E∃" ] -> return [ElimE]
| r `elem` [ "I=" ] -> return [InEq]
| r `elem` [ "E=" ] -> return [ElimEq1, ElimEq2] | 607 | parseGamutNDCore rtc = do r <- choice (map (try . string) [ "IA", "I∀", "EA", "E∀", "IE", "I∃", "EE", "E∃", "I=", "E=" ])
case r of
r | r `elem` [ "IA", "I∀" ] -> return [InA]
| r `elem` [ "EA", "E∀" ] -> return [ElimA]
| r `elem` [ "IE", "I∃" ] -> return [InE]
| r `elem` [ "EE", "E∃" ] -> return [ElimE]
| r `elem` [ "I=" ] -> return [InEq]
| r `elem` [ "E=" ] -> return [ElimEq1, ElimEq2] | 607 | parseGamutNDCore rtc = do r <- choice (map (try . string) [ "IA", "I∀", "EA", "E∀", "IE", "I∃", "EE", "E∃", "I=", "E=" ])
case r of
r | r `elem` [ "IA", "I∀" ] -> return [InA]
| r `elem` [ "EA", "E∀" ] -> return [ElimA]
| r `elem` [ "IE", "I∃" ] -> return [InE]
| r `elem` [ "EE", "E∃" ] -> return [ElimE]
| r `elem` [ "I=" ] -> return [InEq]
| r `elem` [ "E=" ] -> return [ElimEq1, ElimEq2] | 607 | false | false | 0 | 14 | 301 | 233 | 128 | 105 | null | null |
vdweegen/UvA-Software_Testing | Lab1/Final/Exercises.hs | gpl-3.0 | -- Euler 49
euler49 :: String
euler49 = result $ last $ filter isPermutation [(a , b, c) | a <- primes1000, let b = a + 3330, let c = b + 3330, b `elem` primes1000, c `elem` primes1000] | 185 | euler49 :: String
euler49 = result $ last $ filter isPermutation [(a , b, c) | a <- primes1000, let b = a + 3330, let c = b + 3330, b `elem` primes1000, c `elem` primes1000] | 173 | euler49 = result $ last $ filter isPermutation [(a , b, c) | a <- primes1000, let b = a + 3330, let c = b + 3330, b `elem` primes1000, c `elem` primes1000] | 155 | true | true | 0 | 12 | 39 | 93 | 51 | 42 | null | null |
rahulmutt/ghcvm | compiler/Eta/Prelude/PrelNames.hs | bsd-3-clause | noArityDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "NoArity") | 67 | noArityDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "NoArity") | 67 | noArityDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "NoArity") | 67 | false | false | 0 | 7 | 8 | 17 | 8 | 9 | null | null |
FranklinChen/Idris-dev | src/Idris/DSL.hs | bsd-3-clause | expandSugar dsl (PIdiom fc e) = expandSugar dsl $ unIdiom (dsl_apply dsl) (dsl_pure dsl) fc e | 93 | expandSugar dsl (PIdiom fc e) = expandSugar dsl $ unIdiom (dsl_apply dsl) (dsl_pure dsl) fc e | 93 | expandSugar dsl (PIdiom fc e) = expandSugar dsl $ unIdiom (dsl_apply dsl) (dsl_pure dsl) fc e | 93 | false | false | 0 | 8 | 15 | 49 | 22 | 27 | null | null |
ezyang/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | cgOpApp (StgPrimCallOp primcall) args _res_ty
= do { cmm_args <- getNonVoidArgAmodes args
; let fun = CmmLit (CmmLabel (mkPrimCallLabel primcall))
; emitCall (NativeNodeCall, NativeReturn) fun cmm_args } | 222 | cgOpApp (StgPrimCallOp primcall) args _res_ty
= do { cmm_args <- getNonVoidArgAmodes args
; let fun = CmmLit (CmmLabel (mkPrimCallLabel primcall))
; emitCall (NativeNodeCall, NativeReturn) fun cmm_args } | 222 | cgOpApp (StgPrimCallOp primcall) args _res_ty
= do { cmm_args <- getNonVoidArgAmodes args
; let fun = CmmLit (CmmLabel (mkPrimCallLabel primcall))
; emitCall (NativeNodeCall, NativeReturn) fun cmm_args } | 222 | false | false | 1 | 15 | 45 | 78 | 36 | 42 | null | null |
mrkkrp/stack | src/Text/PrettyPrint/Leijen/Extended.hs | bsd-3-clause | getSGRTag SetSwapForegroundBackground{} = TagSwapForegroundBackground | 69 | getSGRTag SetSwapForegroundBackground{} = TagSwapForegroundBackground | 69 | getSGRTag SetSwapForegroundBackground{} = TagSwapForegroundBackground | 69 | false | false | 0 | 5 | 3 | 14 | 6 | 8 | null | null |