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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
brendanhay/gogol
|
gogol-logging/gen/Network/Google/Resource/Logging/Locations/Operations/Cancel.hs
|
mpl-2.0
|
-- | JSONP
locCallback :: Lens' LocationsOperationsCancel (Maybe Text)
locCallback
= lens _locCallback (\ s a -> s{_locCallback = a})
| 135
|
locCallback :: Lens' LocationsOperationsCancel (Maybe Text)
locCallback
= lens _locCallback (\ s a -> s{_locCallback = a})
| 124
|
locCallback
= lens _locCallback (\ s a -> s{_locCallback = a})
| 64
| true
| true
| 0
| 9
| 21
| 48
| 25
| 23
| null | null |
dterei/memcache-hs
|
Database/Memcache/Socket.hs
|
bsd-3-clause
|
chkLength expected l msg = when (l /= expected) $
return $ throw $ ProtocolError BadLength { protocolError =
msg ++ " length expected " ++ show expected ++ " got " ++ show l
}
| 185
|
chkLength expected l msg = when (l /= expected) $
return $ throw $ ProtocolError BadLength { protocolError =
msg ++ " length expected " ++ show expected ++ " got " ++ show l
}
| 185
|
chkLength expected l msg = when (l /= expected) $
return $ throw $ ProtocolError BadLength { protocolError =
msg ++ " length expected " ++ show expected ++ " got " ++ show l
}
| 185
| false
| false
| 0
| 12
| 45
| 68
| 33
| 35
| null | null |
badp/ganeti
|
src/Ganeti/OpParams.hs
|
gpl-2.0
|
pIgnoreRemoveFailures :: Field
pIgnoreRemoveFailures =
withDoc "Whether to ignore failures while removing instances" $
defaultFalse "ignore_remove_failures"
| 160
|
pIgnoreRemoveFailures :: Field
pIgnoreRemoveFailures =
withDoc "Whether to ignore failures while removing instances" $
defaultFalse "ignore_remove_failures"
| 160
|
pIgnoreRemoveFailures =
withDoc "Whether to ignore failures while removing instances" $
defaultFalse "ignore_remove_failures"
| 129
| false
| true
| 0
| 6
| 19
| 21
| 10
| 11
| null | null |
noughtmare/yi
|
yi-keymap-vim/src/Yi/Keymap/Vim/Digraph.hs
|
gpl-2.0
|
-- KATAKANA LETTER HU
switch 'B' 'u' = '\x30D6'
| 47
|
switch 'B' 'u' = '\x30D6'
| 25
|
switch 'B' 'u' = '\x30D6'
| 25
| true
| false
| 0
| 5
| 8
| 12
| 6
| 6
| null | null |
bitemyapp/ghc
|
compiler/hsSyn/HsExpr.hs
|
bsd-3-clause
|
isListCompExpr _ = False
| 40
|
isListCompExpr _ = False
| 40
|
isListCompExpr _ = False
| 40
| false
| false
| 0
| 5
| 19
| 9
| 4
| 5
| null | null |
mariefarrell/Hets
|
utils/DrIFT-src/ParseLib2.hs
|
gpl-2.0
|
parse :: Parser a -> Parser a
parse = (junk >>)
| 47
|
parse :: Parser a -> Parser a
parse = (junk >>)
| 47
|
parse = (junk >>)
| 17
| false
| true
| 0
| 7
| 10
| 31
| 14
| 17
| null | null |
JeanJoskin/ObjectiveJLib
|
src/Language/ObjectiveJLib/Parser/Parser.hs
|
bsd-3-clause
|
-- Objective-J: IVar declaration
pJIVar :: JsParser JIVar
pJIVar = JIVar <$> pJTy <*> pIdent <*> pMaybe pJAccessors <* pSemi
| 124
|
pJIVar :: JsParser JIVar
pJIVar = JIVar <$> pJTy <*> pIdent <*> pMaybe pJAccessors <* pSemi
| 91
|
pJIVar = JIVar <$> pJTy <*> pIdent <*> pMaybe pJAccessors <* pSemi
| 66
| true
| true
| 3
| 7
| 19
| 39
| 17
| 22
| null | null |
rahulmutt/ghcvm
|
compiler/Eta/BasicTypes/OccName.hs
|
bsd-3-clause
|
nameSpacesRelated :: NameSpace -> NameSpace -> Bool
nameSpacesRelated ns1 ns2 = ns1 == ns2 || otherNameSpace ns1 == ns2
| 119
|
nameSpacesRelated :: NameSpace -> NameSpace -> Bool
nameSpacesRelated ns1 ns2 = ns1 == ns2 || otherNameSpace ns1 == ns2
| 119
|
nameSpacesRelated ns1 ns2 = ns1 == ns2 || otherNameSpace ns1 == ns2
| 67
| false
| true
| 0
| 7
| 18
| 39
| 19
| 20
| null | null |
liff/adventofcode-2016
|
app/Day4.hs
|
bsd-3-clause
|
part1 :: [Room] -> Int
part1 = sum . map sector . filter isReal
| 63
|
part1 :: [Room] -> Int
part1 = sum . map sector . filter isReal
| 63
|
part1 = sum . map sector . filter isReal
| 40
| false
| true
| 2
| 7
| 13
| 40
| 17
| 23
| null | null |
shlevy/ghc
|
compiler/typecheck/TcRnTypes.hs
|
bsd-3-clause
|
tyCoFVsOfCt (CDictCan { cc_tyargs = tys }) = tyCoFVsOfTypes tys
| 63
|
tyCoFVsOfCt (CDictCan { cc_tyargs = tys }) = tyCoFVsOfTypes tys
| 63
|
tyCoFVsOfCt (CDictCan { cc_tyargs = tys }) = tyCoFVsOfTypes tys
| 63
| false
| false
| 0
| 8
| 9
| 25
| 12
| 13
| null | null |
NorfairKing/the-notes
|
src/Macro/Sets/Macro.hs
|
gpl-2.0
|
--[ set union comprehension
setuncmprsign :: Note
setuncmprsign = commS "bigcup"
| 80
|
setuncmprsign :: Note
setuncmprsign = commS "bigcup"
| 52
|
setuncmprsign = commS "bigcup"
| 30
| true
| true
| 0
| 6
| 10
| 21
| 9
| 12
| null | null |
technogeeky/d-A
|
include/containers-0.5.0.0/Data/Map/Strict.hs
|
gpl-3.0
|
mapEitherWithKey f (Bin _ kx x l r) = case f kx x of
Left y -> y `seq` (join kx y l1 r1 `strictPair` merge l2 r2)
Right z -> z `seq` (merge l1 r1 `strictPair` join kx z l2 r2)
where
(l1,l2) = mapEitherWithKey f l
(r1,r2) = mapEitherWithKey f r
{--------------------------------------------------------------------
Mapping
--------------------------------------------------------------------}
-- | /O(n)/. Map a function over all values in the map.
--
-- > map (++ "x") (fromList [(5,"a"), (3,"b")]) == fromList [(3, "bx"), (5, "ax")]
| 550
|
mapEitherWithKey f (Bin _ kx x l r) = case f kx x of
Left y -> y `seq` (join kx y l1 r1 `strictPair` merge l2 r2)
Right z -> z `seq` (merge l1 r1 `strictPair` join kx z l2 r2)
where
(l1,l2) = mapEitherWithKey f l
(r1,r2) = mapEitherWithKey f r
{--------------------------------------------------------------------
Mapping
--------------------------------------------------------------------}
-- | /O(n)/. Map a function over all values in the map.
--
-- > map (++ "x") (fromList [(5,"a"), (3,"b")]) == fromList [(3, "bx"), (5, "ax")]
| 550
|
mapEitherWithKey f (Bin _ kx x l r) = case f kx x of
Left y -> y `seq` (join kx y l1 r1 `strictPair` merge l2 r2)
Right z -> z `seq` (merge l1 r1 `strictPair` join kx z l2 r2)
where
(l1,l2) = mapEitherWithKey f l
(r1,r2) = mapEitherWithKey f r
{--------------------------------------------------------------------
Mapping
--------------------------------------------------------------------}
-- | /O(n)/. Map a function over all values in the map.
--
-- > map (++ "x") (fromList [(5,"a"), (3,"b")]) == fromList [(3, "bx"), (5, "ax")]
| 550
| false
| false
| 0
| 11
| 99
| 155
| 79
| 76
| null | null |
qrilka/xlsx
|
src/Codec/Xlsx/Types/ConditionalFormatting.hs
|
mit
|
readOpExpression :: Text -> [Formula] -> [OperatorExpression]
readOpExpression "beginsWith" [f] = [OpBeginsWith f ]
| 123
|
readOpExpression :: Text -> [Formula] -> [OperatorExpression]
readOpExpression "beginsWith" [f] = [OpBeginsWith f ]
| 123
|
readOpExpression "beginsWith" [f] = [OpBeginsWith f ]
| 61
| false
| true
| 0
| 9
| 21
| 45
| 22
| 23
| null | null |
msiegenthaler/haskell-xbee
|
System/Hardware/XBee/Command.hs
|
bsd-3-clause
|
-- | Initial FrameId.
frameId = FrameId 1
| 41
|
frameId = FrameId 1
| 19
|
frameId = FrameId 1
| 19
| true
| false
| 0
| 5
| 7
| 10
| 5
| 5
| null | null |
ejlilley/AbstractMusic
|
LilyParse.hs
|
gpl-3.0
|
relativeSim base (LilySimultaneous (e:es)) = let (b, e') = relativeExpr base e
(b', (LilySimultaneous es')) = relativeSim b (LilySimultaneous es)
in (b', LilySimultaneous (e':es'))
| 274
|
relativeSim base (LilySimultaneous (e:es)) = let (b, e') = relativeExpr base e
(b', (LilySimultaneous es')) = relativeSim b (LilySimultaneous es)
in (b', LilySimultaneous (e':es'))
| 274
|
relativeSim base (LilySimultaneous (e:es)) = let (b, e') = relativeExpr base e
(b', (LilySimultaneous es')) = relativeSim b (LilySimultaneous es)
in (b', LilySimultaneous (e':es'))
| 274
| false
| false
| 0
| 11
| 117
| 92
| 47
| 45
| null | null |
githubkleon/ConvenientHDL
|
src/VerilogHandle.hs
|
bsd-3-clause
|
genPortDecl x pt (CS.Ident ident) ll ww = PortDecl (PortDir x) (maybe Nothing (Just . parseFromPortType) pt) (maybeGetRange ll ww) (Ident ident) (CommentItem "")
where
maybeGetRange l w = case or [(isJust l),(isJust w)] of
False -> Nothing
True -> maybeGetRange1 l w
maybeGetRange1 l w = case and $ map equalTo1 [l,w] of
True -> Nothing
False -> Just $ Range (parseExpr $ showMult l w) $ intExpr 0
equalTo1 (Just exp) = (showExpr exp) == "1"
equalto1 Nothing = True
showExpr l = render (CP.ppExpr l)
showMult (Just l) Nothing = (showExpr l) ++ "-1"
showMult Nothing (Just w) = (showExpr w) ++ "-1"
showMult (Just l) (Just w) = "(" ++ (showExpr l) ++ ")*(" ++ (showExpr w) ++ ")-1"
| 798
|
genPortDecl x pt (CS.Ident ident) ll ww = PortDecl (PortDir x) (maybe Nothing (Just . parseFromPortType) pt) (maybeGetRange ll ww) (Ident ident) (CommentItem "")
where
maybeGetRange l w = case or [(isJust l),(isJust w)] of
False -> Nothing
True -> maybeGetRange1 l w
maybeGetRange1 l w = case and $ map equalTo1 [l,w] of
True -> Nothing
False -> Just $ Range (parseExpr $ showMult l w) $ intExpr 0
equalTo1 (Just exp) = (showExpr exp) == "1"
equalto1 Nothing = True
showExpr l = render (CP.ppExpr l)
showMult (Just l) Nothing = (showExpr l) ++ "-1"
showMult Nothing (Just w) = (showExpr w) ++ "-1"
showMult (Just l) (Just w) = "(" ++ (showExpr l) ++ ")*(" ++ (showExpr w) ++ ")-1"
| 798
|
genPortDecl x pt (CS.Ident ident) ll ww = PortDecl (PortDir x) (maybe Nothing (Just . parseFromPortType) pt) (maybeGetRange ll ww) (Ident ident) (CommentItem "")
where
maybeGetRange l w = case or [(isJust l),(isJust w)] of
False -> Nothing
True -> maybeGetRange1 l w
maybeGetRange1 l w = case and $ map equalTo1 [l,w] of
True -> Nothing
False -> Just $ Range (parseExpr $ showMult l w) $ intExpr 0
equalTo1 (Just exp) = (showExpr exp) == "1"
equalto1 Nothing = True
showExpr l = render (CP.ppExpr l)
showMult (Just l) Nothing = (showExpr l) ++ "-1"
showMult Nothing (Just w) = (showExpr w) ++ "-1"
showMult (Just l) (Just w) = "(" ++ (showExpr l) ++ ")*(" ++ (showExpr w) ++ ")-1"
| 798
| false
| false
| 4
| 13
| 240
| 372
| 175
| 197
| null | null |
keithodulaigh/Hets
|
Taxonomy/MMiSSOntology.hs
|
gpl-2.0
|
gselType :: (OntoObjectType -> Bool) -> ClassGraph
-> [Context (String, String, OntoObjectType) String]
gselType f = gselLab ( \ (_, _, t) -> f t)
| 155
|
gselType :: (OntoObjectType -> Bool) -> ClassGraph
-> [Context (String, String, OntoObjectType) String]
gselType f = gselLab ( \ (_, _, t) -> f t)
| 155
|
gselType f = gselLab ( \ (_, _, t) -> f t)
| 42
| false
| true
| 0
| 9
| 33
| 69
| 38
| 31
| null | null |
wavewave/madgraph-auto-dataset
|
src/HEP/Automation/MadGraph/Dataset/Set20110428set3.hs
|
gpl-3.0
|
-- [101]
zptasklist :: ScriptSetup -> ClusterSetup ZpHFull -> [WorkSetup ZpHFull]
zptasklist ssetup csetup =
[ WS ssetup (psetup_zphfull_TZpLep)
(RS { param = p
, numevent = 10000
, machine = TeVatron
, rgrun = Fixed
, rgscale = 200.0
, match = NoMatch
, cut = DefCut
, pythia = RunPYTHIA
, usercut = NoUserCutDef
, pgs = RunPGS
, setnum = num
})
csetup
(WebDAVRemoteDir "mc/TeVatronFor3/ZpHFull0428Big")
| p <- zpHFullParamSet , num <- sets ]
| 617
|
zptasklist :: ScriptSetup -> ClusterSetup ZpHFull -> [WorkSetup ZpHFull]
zptasklist ssetup csetup =
[ WS ssetup (psetup_zphfull_TZpLep)
(RS { param = p
, numevent = 10000
, machine = TeVatron
, rgrun = Fixed
, rgscale = 200.0
, match = NoMatch
, cut = DefCut
, pythia = RunPYTHIA
, usercut = NoUserCutDef
, pgs = RunPGS
, setnum = num
})
csetup
(WebDAVRemoteDir "mc/TeVatronFor3/ZpHFull0428Big")
| p <- zpHFullParamSet , num <- sets ]
| 607
|
zptasklist ssetup csetup =
[ WS ssetup (psetup_zphfull_TZpLep)
(RS { param = p
, numevent = 10000
, machine = TeVatron
, rgrun = Fixed
, rgscale = 200.0
, match = NoMatch
, cut = DefCut
, pythia = RunPYTHIA
, usercut = NoUserCutDef
, pgs = RunPGS
, setnum = num
})
csetup
(WebDAVRemoteDir "mc/TeVatronFor3/ZpHFull0428Big")
| p <- zpHFullParamSet , num <- sets ]
| 534
| true
| true
| 0
| 9
| 250
| 144
| 84
| 60
| null | null |
PavelClaudiuStefan/FMI
|
An_3_Semestru_1/ProgramareDeclarativa/Laboratoare/Laborator2/lab2chess.hs
|
cc0-1.0
|
fenCharToPicture 'k' = king
| 27
|
fenCharToPicture 'k' = king
| 27
|
fenCharToPicture 'k' = king
| 27
| false
| false
| 0
| 4
| 3
| 10
| 4
| 6
| null | null |
sherwoodwang/wxHaskell
|
wxcore/src/haskell/Graphics/UI/WXCore/WxcTypes.hs
|
lgpl-2.1
|
withCSizeDouble :: Size2D Double -> (CDouble -> CDouble -> IO a) -> IO a
withCSizeDouble (Size w h) f
= f (toCDouble w) (toCDouble h)
| 135
|
withCSizeDouble :: Size2D Double -> (CDouble -> CDouble -> IO a) -> IO a
withCSizeDouble (Size w h) f
= f (toCDouble w) (toCDouble h)
| 135
|
withCSizeDouble (Size w h) f
= f (toCDouble w) (toCDouble h)
| 62
| false
| true
| 0
| 10
| 26
| 70
| 33
| 37
| null | null |
allanderek/ipclib
|
Smc/SmcGraph.hs
|
gpl-2.0
|
makeLatexDocument :: CliOptions
-- | String representation of the original srmc model
-> String
-> [ SensitivityGroup SensitivityPdfs ]
-> [ CandleGraph ]
-> [ TimeGraphGroup ]
-> String
makeLatexDocument options stringModel sgroups candles timeGroups =
unlines [ "\\documentclass[10pt,a4paper]{article}"
, "\\usepackage{amssymb,amsbsy,verbatim,fancybox}"
, "\\usepackage{graphicx}"
, "\\usepackage[pdftex]{hyperref}"
, "%"
, ""
, "% For displaying a single graph in a figure."
, "\\newcommand{\\graphicfigure}[3]{"
, "\\begin{figure}[ht]"
, "\\includegraphics[scale=0.8]{#1}"
, "\\caption{"
, " \\label{#2}"
, " #3"
, " }"
, "\\end{figure}"
, "}"
, ""
, "\\title{Results Graphs}"
, "\\author{smc}"
, ""
, ""
, "\\begin{document}"
, "\\maketitle"
, ""
, "\\tableofcontents"
, "\\section{The srmc model}"
, "\\begin{verbatim}"
, stringModel
, "\\end{verbatim}"
, "\\section{Sensitivity Graphs}"
, sensitivityGraphsTexIntroduction
, sgroupSubSections
, "\\section{Candle Stick Graphs}"
, candleStickGraphsTexIntroduction
, candleFigures
, "\\section{Time-at Graphs}"
, timeAtGraphsTexIntroduction
, timeAtFigures
, "\\listoffigures"
, "\\end{document}"
]
where
candleFigures = unlines $ map makeCandleFigure candles
timeAtFigures = unlines $ map makeTimeAtFigure timeGroups
sgroupSubSections = unlines $ map makeSgroupSection sgroups
makeCandleFigure :: CandleStickGraph -> String
makeCandleFigure candle =
makeGraphFigure file label caption
where
file = candleName candle
label = "figure:graph:" ++ (Utils.dropGivenExt "pdf" file)
caption = unlines [ "The candle stick graph where the boxes represent"
, "a high of " ++ (show $ candleHigh candle)
, "and a low of " ++ (show $ candleLow candle)
]
makeTimeAtFigure :: TimeGraphGroup -> String
makeTimeAtFigure tgroup =
makeGraphFigure file label caption
where
file = timeGroupName tgroup
label = "figure:graph:timeAt:" ++ (Utils.dropGivenExt "pdf" file)
caption = unlines [ "A time-at graph showing probability"
, "vs instance of model number at "
++ captionEnd
]
-- The caption is different for groups of length one, in these groups
-- we do not want to have a key and the caption should specify the time.
-- Where there are more than one time graphs we need a key anyway so we
-- needn't cutter up the caption with all the times.
captionEnd = case timeGroupGraphs tgroup of
[ one ] -> "time: " ++ (show $ timegraphTime one)
_ -> "the times shown"
makeSgroupSection :: SensitivityGroup SensitivityPdfs -> String
makeSgroupSection sgroup =
unlines (header ++ sgraphFigures)
where
header = [ "\\subsection{Sensitivity Graph Group}"
, "All the sensitivity graphs in this sub-section"
, "Relate to the following choices of process"
, "instantiations:"
, "\\begin{verbatim}"
, unlines $ map latexProcessDef (sgroupProcesses sgroup)
, "\\end{verbatim}"
, "\\newpage"
]
sgraphFigures
| any isIntersperseOptions options = map makeSGraphFigure sgraphs
| otherwise = sgraphSubsections
sgraphSubsections = concat [ [ "\\subsubsection{The cdf graphs}" ]
, sgraphcdfs
, [ "\\subsubsection{The pdf graphs}" ]
, sgraphpdfs
]
sgraphcdfs = map makeSGraphCDFFigure sgraphs
sgraphpdfs = map makeSGraphPDFFigure sgraphs
sgraphs = sgroupGraphs sgroup
makeSGraphFigure :: SensitivityPdfs -> String
makeSGraphFigure sgPdf =
unlines [ makeSGraphCDFFigure sgPdf
, makeSGraphPDFFigure sgPdf
]
makeSGraphCDFFigure :: SensitivityPdfs -> String
makeSGraphCDFFigure sgPdf =
unlines [ "The graphs in figure \\ref{" ++ cdfLabel ++ "}"
, "show the effect of the rate " ++ variedRate ++ "."
, otherRates
, "\\begin{figure}[ht]"
, "\\includegraphics[scale=0.8]{" ++ cdfFile ++ "}"
, "\\includegraphics[scale=0.8]{" ++ cdfMultiFile ++ "}"
, "\\caption{"
, cdfCaption
, "\\label{" ++ cdfLabel ++ "}"
, "} % closes caption"
, "\\end{figure}"
, showFileNames cdfFile cdfMultiFile
, "\\clearpage"
]
where
sgGraph = senPdfGraph sgPdf
rateValues = sgRateValues sgGraph
variedRate = escapeToLatex $ sgVariedRate sgGraph
otherRates
| null rateValues = ""
| otherwise =
unlines [ "The other rates which are used in this model"
, "(and are defined by a rate array in the main srmc model)"
, "are as follows:"
, "\\begin{verbatim}"
, unlines $ map latexRateValue rateValues
, "\\end{verbatim}"
]
showFileNames :: FilePath -> FilePath -> String
showFileNames f1 f2 =
unwords [ "The file names are:"
, escapeToLatex f1
, "and"
, escapeToLatex f2
]
cdfFile = senPdf3dCdfDotPdf sgPdf
cdfMultiFile = senPdfMultiCdfDotPdf sgPdf
cdfLabel = "figure:graph:" ++ (Utils.dropGivenExt "pdf" cdfFile)
cdfCaption = concat [ "Sensitivity graphs of cdfs for the rate: "
, variedRate
]
makeSGraphPDFFigure :: SensitivityPdfs -> String
makeSGraphPDFFigure sgPdf =
unlines ["The graphs in figure \\ref{" ++ pdfLabel ++ "}"
, "show the effect of the rate " ++ variedRate ++ "."
, otherRates
, "\\begin{figure}[ht]"
, "\\includegraphics[scale=0.8]{" ++ pdfFile ++ "}"
, "\\includegraphics[scale=0.8]{" ++ pdfMultiFile ++ "}"
, "\\caption{"
, pdfCaption
, "\\label{" ++ pdfLabel ++ "}"
, "} % closes caption"
, "\\end{figure}"
, showFileNames pdfFile pdfMultiFile
, "\\clearpage"
]
where
sgGraph = senPdfGraph sgPdf
rateValues = sgRateValues sgGraph
variedRate = escapeToLatex $ sgVariedRate sgGraph
otherRates
| null rateValues = ""
| otherwise =
unlines [ "The other rates which are used in this model"
, "(and are defined by a rate array in the main srmc model)"
, "are as follows:"
, "\\begin{verbatim}"
, unlines $ map latexRateValue rateValues
, "\\end{verbatim}"
]
showFileNames :: FilePath -> FilePath -> String
showFileNames f1 f2 =
unwords [ "The file names are:"
, escapeToLatex f1
, "and"
, escapeToLatex f2
]
pdfFile = senPdf3dPdfDotPdf sgPdf
pdfMultiFile = senPdfMultiPdfDotPdf sgPdf
pdfLabel = "figure:graph:" ++ (Utils.dropGivenExt "pdf" pdfFile)
pdfCaption = concat [ "Sensitivity graphs of pdfs for the rate: "
, variedRate
]
makeGraphFigure :: String -> String -> String -> String
makeGraphFigure file label caption =
unlines [ "\\graphicfigure{" ++ file ++ "}"
, " {" ++ label ++ "}"
, " {" ++ caption ++ "}"
, "\\clearpage"
]
latexProcessDef :: ProcessDef -> String
latexProcessDef (name, comp) =
unwords [ hprintComponentName name, "=", hprintComponent comp ]
latexRateValue :: RateValue -> String
latexRateValue (name, value) =
unwords [ name
, "="
, show value
]
| 8,593
|
makeLatexDocument :: CliOptions
-- | String representation of the original srmc model
-> String
-> [ SensitivityGroup SensitivityPdfs ]
-> [ CandleGraph ]
-> [ TimeGraphGroup ]
-> String
makeLatexDocument options stringModel sgroups candles timeGroups =
unlines [ "\\documentclass[10pt,a4paper]{article}"
, "\\usepackage{amssymb,amsbsy,verbatim,fancybox}"
, "\\usepackage{graphicx}"
, "\\usepackage[pdftex]{hyperref}"
, "%"
, ""
, "% For displaying a single graph in a figure."
, "\\newcommand{\\graphicfigure}[3]{"
, "\\begin{figure}[ht]"
, "\\includegraphics[scale=0.8]{#1}"
, "\\caption{"
, " \\label{#2}"
, " #3"
, " }"
, "\\end{figure}"
, "}"
, ""
, "\\title{Results Graphs}"
, "\\author{smc}"
, ""
, ""
, "\\begin{document}"
, "\\maketitle"
, ""
, "\\tableofcontents"
, "\\section{The srmc model}"
, "\\begin{verbatim}"
, stringModel
, "\\end{verbatim}"
, "\\section{Sensitivity Graphs}"
, sensitivityGraphsTexIntroduction
, sgroupSubSections
, "\\section{Candle Stick Graphs}"
, candleStickGraphsTexIntroduction
, candleFigures
, "\\section{Time-at Graphs}"
, timeAtGraphsTexIntroduction
, timeAtFigures
, "\\listoffigures"
, "\\end{document}"
]
where
candleFigures = unlines $ map makeCandleFigure candles
timeAtFigures = unlines $ map makeTimeAtFigure timeGroups
sgroupSubSections = unlines $ map makeSgroupSection sgroups
makeCandleFigure :: CandleStickGraph -> String
makeCandleFigure candle =
makeGraphFigure file label caption
where
file = candleName candle
label = "figure:graph:" ++ (Utils.dropGivenExt "pdf" file)
caption = unlines [ "The candle stick graph where the boxes represent"
, "a high of " ++ (show $ candleHigh candle)
, "and a low of " ++ (show $ candleLow candle)
]
makeTimeAtFigure :: TimeGraphGroup -> String
makeTimeAtFigure tgroup =
makeGraphFigure file label caption
where
file = timeGroupName tgroup
label = "figure:graph:timeAt:" ++ (Utils.dropGivenExt "pdf" file)
caption = unlines [ "A time-at graph showing probability"
, "vs instance of model number at "
++ captionEnd
]
-- The caption is different for groups of length one, in these groups
-- we do not want to have a key and the caption should specify the time.
-- Where there are more than one time graphs we need a key anyway so we
-- needn't cutter up the caption with all the times.
captionEnd = case timeGroupGraphs tgroup of
[ one ] -> "time: " ++ (show $ timegraphTime one)
_ -> "the times shown"
makeSgroupSection :: SensitivityGroup SensitivityPdfs -> String
makeSgroupSection sgroup =
unlines (header ++ sgraphFigures)
where
header = [ "\\subsection{Sensitivity Graph Group}"
, "All the sensitivity graphs in this sub-section"
, "Relate to the following choices of process"
, "instantiations:"
, "\\begin{verbatim}"
, unlines $ map latexProcessDef (sgroupProcesses sgroup)
, "\\end{verbatim}"
, "\\newpage"
]
sgraphFigures
| any isIntersperseOptions options = map makeSGraphFigure sgraphs
| otherwise = sgraphSubsections
sgraphSubsections = concat [ [ "\\subsubsection{The cdf graphs}" ]
, sgraphcdfs
, [ "\\subsubsection{The pdf graphs}" ]
, sgraphpdfs
]
sgraphcdfs = map makeSGraphCDFFigure sgraphs
sgraphpdfs = map makeSGraphPDFFigure sgraphs
sgraphs = sgroupGraphs sgroup
makeSGraphFigure :: SensitivityPdfs -> String
makeSGraphFigure sgPdf =
unlines [ makeSGraphCDFFigure sgPdf
, makeSGraphPDFFigure sgPdf
]
makeSGraphCDFFigure :: SensitivityPdfs -> String
makeSGraphCDFFigure sgPdf =
unlines [ "The graphs in figure \\ref{" ++ cdfLabel ++ "}"
, "show the effect of the rate " ++ variedRate ++ "."
, otherRates
, "\\begin{figure}[ht]"
, "\\includegraphics[scale=0.8]{" ++ cdfFile ++ "}"
, "\\includegraphics[scale=0.8]{" ++ cdfMultiFile ++ "}"
, "\\caption{"
, cdfCaption
, "\\label{" ++ cdfLabel ++ "}"
, "} % closes caption"
, "\\end{figure}"
, showFileNames cdfFile cdfMultiFile
, "\\clearpage"
]
where
sgGraph = senPdfGraph sgPdf
rateValues = sgRateValues sgGraph
variedRate = escapeToLatex $ sgVariedRate sgGraph
otherRates
| null rateValues = ""
| otherwise =
unlines [ "The other rates which are used in this model"
, "(and are defined by a rate array in the main srmc model)"
, "are as follows:"
, "\\begin{verbatim}"
, unlines $ map latexRateValue rateValues
, "\\end{verbatim}"
]
showFileNames :: FilePath -> FilePath -> String
showFileNames f1 f2 =
unwords [ "The file names are:"
, escapeToLatex f1
, "and"
, escapeToLatex f2
]
cdfFile = senPdf3dCdfDotPdf sgPdf
cdfMultiFile = senPdfMultiCdfDotPdf sgPdf
cdfLabel = "figure:graph:" ++ (Utils.dropGivenExt "pdf" cdfFile)
cdfCaption = concat [ "Sensitivity graphs of cdfs for the rate: "
, variedRate
]
makeSGraphPDFFigure :: SensitivityPdfs -> String
makeSGraphPDFFigure sgPdf =
unlines ["The graphs in figure \\ref{" ++ pdfLabel ++ "}"
, "show the effect of the rate " ++ variedRate ++ "."
, otherRates
, "\\begin{figure}[ht]"
, "\\includegraphics[scale=0.8]{" ++ pdfFile ++ "}"
, "\\includegraphics[scale=0.8]{" ++ pdfMultiFile ++ "}"
, "\\caption{"
, pdfCaption
, "\\label{" ++ pdfLabel ++ "}"
, "} % closes caption"
, "\\end{figure}"
, showFileNames pdfFile pdfMultiFile
, "\\clearpage"
]
where
sgGraph = senPdfGraph sgPdf
rateValues = sgRateValues sgGraph
variedRate = escapeToLatex $ sgVariedRate sgGraph
otherRates
| null rateValues = ""
| otherwise =
unlines [ "The other rates which are used in this model"
, "(and are defined by a rate array in the main srmc model)"
, "are as follows:"
, "\\begin{verbatim}"
, unlines $ map latexRateValue rateValues
, "\\end{verbatim}"
]
showFileNames :: FilePath -> FilePath -> String
showFileNames f1 f2 =
unwords [ "The file names are:"
, escapeToLatex f1
, "and"
, escapeToLatex f2
]
pdfFile = senPdf3dPdfDotPdf sgPdf
pdfMultiFile = senPdfMultiPdfDotPdf sgPdf
pdfLabel = "figure:graph:" ++ (Utils.dropGivenExt "pdf" pdfFile)
pdfCaption = concat [ "Sensitivity graphs of pdfs for the rate: "
, variedRate
]
makeGraphFigure :: String -> String -> String -> String
makeGraphFigure file label caption =
unlines [ "\\graphicfigure{" ++ file ++ "}"
, " {" ++ label ++ "}"
, " {" ++ caption ++ "}"
, "\\clearpage"
]
latexProcessDef :: ProcessDef -> String
latexProcessDef (name, comp) =
unwords [ hprintComponentName name, "=", hprintComponent comp ]
latexRateValue :: RateValue -> String
latexRateValue (name, value) =
unwords [ name
, "="
, show value
]
| 8,593
|
makeLatexDocument options stringModel sgroups candles timeGroups =
unlines [ "\\documentclass[10pt,a4paper]{article}"
, "\\usepackage{amssymb,amsbsy,verbatim,fancybox}"
, "\\usepackage{graphicx}"
, "\\usepackage[pdftex]{hyperref}"
, "%"
, ""
, "% For displaying a single graph in a figure."
, "\\newcommand{\\graphicfigure}[3]{"
, "\\begin{figure}[ht]"
, "\\includegraphics[scale=0.8]{#1}"
, "\\caption{"
, " \\label{#2}"
, " #3"
, " }"
, "\\end{figure}"
, "}"
, ""
, "\\title{Results Graphs}"
, "\\author{smc}"
, ""
, ""
, "\\begin{document}"
, "\\maketitle"
, ""
, "\\tableofcontents"
, "\\section{The srmc model}"
, "\\begin{verbatim}"
, stringModel
, "\\end{verbatim}"
, "\\section{Sensitivity Graphs}"
, sensitivityGraphsTexIntroduction
, sgroupSubSections
, "\\section{Candle Stick Graphs}"
, candleStickGraphsTexIntroduction
, candleFigures
, "\\section{Time-at Graphs}"
, timeAtGraphsTexIntroduction
, timeAtFigures
, "\\listoffigures"
, "\\end{document}"
]
where
candleFigures = unlines $ map makeCandleFigure candles
timeAtFigures = unlines $ map makeTimeAtFigure timeGroups
sgroupSubSections = unlines $ map makeSgroupSection sgroups
makeCandleFigure :: CandleStickGraph -> String
makeCandleFigure candle =
makeGraphFigure file label caption
where
file = candleName candle
label = "figure:graph:" ++ (Utils.dropGivenExt "pdf" file)
caption = unlines [ "The candle stick graph where the boxes represent"
, "a high of " ++ (show $ candleHigh candle)
, "and a low of " ++ (show $ candleLow candle)
]
makeTimeAtFigure :: TimeGraphGroup -> String
makeTimeAtFigure tgroup =
makeGraphFigure file label caption
where
file = timeGroupName tgroup
label = "figure:graph:timeAt:" ++ (Utils.dropGivenExt "pdf" file)
caption = unlines [ "A time-at graph showing probability"
, "vs instance of model number at "
++ captionEnd
]
-- The caption is different for groups of length one, in these groups
-- we do not want to have a key and the caption should specify the time.
-- Where there are more than one time graphs we need a key anyway so we
-- needn't cutter up the caption with all the times.
captionEnd = case timeGroupGraphs tgroup of
[ one ] -> "time: " ++ (show $ timegraphTime one)
_ -> "the times shown"
makeSgroupSection :: SensitivityGroup SensitivityPdfs -> String
makeSgroupSection sgroup =
unlines (header ++ sgraphFigures)
where
header = [ "\\subsection{Sensitivity Graph Group}"
, "All the sensitivity graphs in this sub-section"
, "Relate to the following choices of process"
, "instantiations:"
, "\\begin{verbatim}"
, unlines $ map latexProcessDef (sgroupProcesses sgroup)
, "\\end{verbatim}"
, "\\newpage"
]
sgraphFigures
| any isIntersperseOptions options = map makeSGraphFigure sgraphs
| otherwise = sgraphSubsections
sgraphSubsections = concat [ [ "\\subsubsection{The cdf graphs}" ]
, sgraphcdfs
, [ "\\subsubsection{The pdf graphs}" ]
, sgraphpdfs
]
sgraphcdfs = map makeSGraphCDFFigure sgraphs
sgraphpdfs = map makeSGraphPDFFigure sgraphs
sgraphs = sgroupGraphs sgroup
makeSGraphFigure :: SensitivityPdfs -> String
makeSGraphFigure sgPdf =
unlines [ makeSGraphCDFFigure sgPdf
, makeSGraphPDFFigure sgPdf
]
makeSGraphCDFFigure :: SensitivityPdfs -> String
makeSGraphCDFFigure sgPdf =
unlines [ "The graphs in figure \\ref{" ++ cdfLabel ++ "}"
, "show the effect of the rate " ++ variedRate ++ "."
, otherRates
, "\\begin{figure}[ht]"
, "\\includegraphics[scale=0.8]{" ++ cdfFile ++ "}"
, "\\includegraphics[scale=0.8]{" ++ cdfMultiFile ++ "}"
, "\\caption{"
, cdfCaption
, "\\label{" ++ cdfLabel ++ "}"
, "} % closes caption"
, "\\end{figure}"
, showFileNames cdfFile cdfMultiFile
, "\\clearpage"
]
where
sgGraph = senPdfGraph sgPdf
rateValues = sgRateValues sgGraph
variedRate = escapeToLatex $ sgVariedRate sgGraph
otherRates
| null rateValues = ""
| otherwise =
unlines [ "The other rates which are used in this model"
, "(and are defined by a rate array in the main srmc model)"
, "are as follows:"
, "\\begin{verbatim}"
, unlines $ map latexRateValue rateValues
, "\\end{verbatim}"
]
showFileNames :: FilePath -> FilePath -> String
showFileNames f1 f2 =
unwords [ "The file names are:"
, escapeToLatex f1
, "and"
, escapeToLatex f2
]
cdfFile = senPdf3dCdfDotPdf sgPdf
cdfMultiFile = senPdfMultiCdfDotPdf sgPdf
cdfLabel = "figure:graph:" ++ (Utils.dropGivenExt "pdf" cdfFile)
cdfCaption = concat [ "Sensitivity graphs of cdfs for the rate: "
, variedRate
]
makeSGraphPDFFigure :: SensitivityPdfs -> String
makeSGraphPDFFigure sgPdf =
unlines ["The graphs in figure \\ref{" ++ pdfLabel ++ "}"
, "show the effect of the rate " ++ variedRate ++ "."
, otherRates
, "\\begin{figure}[ht]"
, "\\includegraphics[scale=0.8]{" ++ pdfFile ++ "}"
, "\\includegraphics[scale=0.8]{" ++ pdfMultiFile ++ "}"
, "\\caption{"
, pdfCaption
, "\\label{" ++ pdfLabel ++ "}"
, "} % closes caption"
, "\\end{figure}"
, showFileNames pdfFile pdfMultiFile
, "\\clearpage"
]
where
sgGraph = senPdfGraph sgPdf
rateValues = sgRateValues sgGraph
variedRate = escapeToLatex $ sgVariedRate sgGraph
otherRates
| null rateValues = ""
| otherwise =
unlines [ "The other rates which are used in this model"
, "(and are defined by a rate array in the main srmc model)"
, "are as follows:"
, "\\begin{verbatim}"
, unlines $ map latexRateValue rateValues
, "\\end{verbatim}"
]
showFileNames :: FilePath -> FilePath -> String
showFileNames f1 f2 =
unwords [ "The file names are:"
, escapeToLatex f1
, "and"
, escapeToLatex f2
]
pdfFile = senPdf3dPdfDotPdf sgPdf
pdfMultiFile = senPdfMultiPdfDotPdf sgPdf
pdfLabel = "figure:graph:" ++ (Utils.dropGivenExt "pdf" pdfFile)
pdfCaption = concat [ "Sensitivity graphs of pdfs for the rate: "
, variedRate
]
makeGraphFigure :: String -> String -> String -> String
makeGraphFigure file label caption =
unlines [ "\\graphicfigure{" ++ file ++ "}"
, " {" ++ label ++ "}"
, " {" ++ caption ++ "}"
, "\\clearpage"
]
latexProcessDef :: ProcessDef -> String
latexProcessDef (name, comp) =
unwords [ hprintComponentName name, "=", hprintComponent comp ]
latexRateValue :: RateValue -> String
latexRateValue (name, value) =
unwords [ name
, "="
, show value
]
| 8,290
| false
| true
| 0
| 13
| 3,232
| 1,336
| 723
| 613
| null | null |
shlevy/ghc
|
compiler/simplCore/CSE.hs
|
bsd-3-clause
|
cseOneExpr :: InExpr -> OutExpr
cseOneExpr e = cseExpr env e
where env = emptyCSEnv {cs_subst = mkEmptySubst (mkInScopeSet (exprFreeVars e)) }
| 144
|
cseOneExpr :: InExpr -> OutExpr
cseOneExpr e = cseExpr env e
where env = emptyCSEnv {cs_subst = mkEmptySubst (mkInScopeSet (exprFreeVars e)) }
| 144
|
cseOneExpr e = cseExpr env e
where env = emptyCSEnv {cs_subst = mkEmptySubst (mkInScopeSet (exprFreeVars e)) }
| 112
| false
| true
| 0
| 12
| 23
| 59
| 28
| 31
| null | null |
Megaleo/Minehack
|
src/Tile/TileType.hs
|
bsd-3-clause
|
name (TEntity (E.EPlayer EP.Human)) = "Human"
| 49
|
name (TEntity (E.EPlayer EP.Human)) = "Human"
| 49
|
name (TEntity (E.EPlayer EP.Human)) = "Human"
| 49
| false
| false
| 0
| 10
| 9
| 25
| 12
| 13
| null | null |
Blaisorblade/pts
|
src-lib/PTS/Dynamics/Evaluation.hs
|
bsd-3-clause
|
close :: Name -> Value Eval -> Maybe C -> Value Eval -> Eval (Function Eval)
close name typ sort value = do
term <- reify value
abstract (\arg -> do
withEnvironment [] $ do
bind name (Binding False arg typ sort) $ do
eval term)
| 249
|
close :: Name -> Value Eval -> Maybe C -> Value Eval -> Eval (Function Eval)
close name typ sort value = do
term <- reify value
abstract (\arg -> do
withEnvironment [] $ do
bind name (Binding False arg typ sort) $ do
eval term)
| 249
|
close name typ sort value = do
term <- reify value
abstract (\arg -> do
withEnvironment [] $ do
bind name (Binding False arg typ sort) $ do
eval term)
| 172
| false
| true
| 0
| 18
| 67
| 120
| 54
| 66
| null | null |
shayan-najd/Haskell-Desugar-Generic
|
Examples/XMonad/SS_noListComp.hs
|
bsd-3-clause
|
tagMember :: (Eq i) => i -> StackSet i l a s sd -> Bool
tagMember t = elem t . map tag . workspaces
| 99
|
tagMember :: (Eq i) => i -> StackSet i l a s sd -> Bool
tagMember t = elem t . map tag . workspaces
| 99
|
tagMember t = elem t . map tag . workspaces
| 43
| false
| true
| 0
| 8
| 24
| 56
| 27
| 29
| null | null |
nevrenato/HetsAlloy
|
QBF/Symbol.hs
|
gpl-2.0
|
printSymbol :: Symbol -> Doc
printSymbol = pretty . symName
| 59
|
printSymbol :: Symbol -> Doc
printSymbol = pretty . symName
| 59
|
printSymbol = pretty . symName
| 30
| false
| true
| 0
| 5
| 9
| 19
| 10
| 9
| null | null |
zrho/pylon
|
src/Language/Pylon/Util.hs
|
bsd-3-clause
|
safeIndex (x:_) 0 = Just x
| 27
|
safeIndex (x:_) 0 = Just x
| 27
|
safeIndex (x:_) 0 = Just x
| 27
| false
| false
| 1
| 6
| 6
| 26
| 10
| 16
| null | null |
urbanslug/ghc
|
compiler/simplCore/SimplEnv.hs
|
bsd-3-clause
|
refineFromInScope :: InScopeSet -> Var -> Var
refineFromInScope in_scope v
| isLocalId v = case lookupInScope in_scope v of
Just v' -> v'
Nothing -> WARN( True, ppr v ) v -- This is an error!
| otherwise = v
| 248
|
refineFromInScope :: InScopeSet -> Var -> Var
refineFromInScope in_scope v
| isLocalId v = case lookupInScope in_scope v of
Just v' -> v'
Nothing -> WARN( True, ppr v ) v -- This is an error!
| otherwise = v
| 248
|
refineFromInScope in_scope v
| isLocalId v = case lookupInScope in_scope v of
Just v' -> v'
Nothing -> WARN( True, ppr v ) v -- This is an error!
| otherwise = v
| 202
| false
| true
| 1
| 11
| 80
| 82
| 38
| 44
| null | null |
vikraman/ghc
|
libraries/template-haskell/Language/Haskell/TH/Lib.hs
|
bsd-3-clause
|
arrowT :: TypeQ
arrowT = return ArrowT
| 38
|
arrowT :: TypeQ
arrowT = return ArrowT
| 38
|
arrowT = return ArrowT
| 22
| false
| true
| 0
| 6
| 6
| 20
| 8
| 12
| null | null |
toppoint/haskell-alpm
|
tests/Tests.hs
|
gpl-2.0
|
test_optionLocalDatabase :: Assertion
test_optionLocalDatabase = withLocalDatabase $ \db -> do
name <- databaseGetName db
return $ name == "local"
-- Tests: Database -----------------------------------------------------------
| 235
|
test_optionLocalDatabase :: Assertion
test_optionLocalDatabase = withLocalDatabase $ \db -> do
name <- databaseGetName db
return $ name == "local"
-- Tests: Database -----------------------------------------------------------
| 235
|
test_optionLocalDatabase = withLocalDatabase $ \db -> do
name <- databaseGetName db
return $ name == "local"
-- Tests: Database -----------------------------------------------------------
| 197
| false
| true
| 0
| 10
| 32
| 42
| 21
| 21
| null | null |
danr/hipspec
|
testsuite/prod/Properties.hs
|
gpl-3.0
|
prop_T22 :: [a] -> [a] -> Prop Bool
prop_T22 x y = even (length (x ++ y)) =:= even (length (y ++ x))
| 100
|
prop_T22 :: [a] -> [a] -> Prop Bool
prop_T22 x y = even (length (x ++ y)) =:= even (length (y ++ x))
| 100
|
prop_T22 x y = even (length (x ++ y)) =:= even (length (y ++ x))
| 64
| false
| true
| 0
| 10
| 22
| 73
| 36
| 37
| null | null |
vTurbine/ghc
|
compiler/hsSyn/HsExpr.hs
|
bsd-3-clause
|
ppr_cmd (HsCmdArrApp arrow arg _ HsFirstOrderApp True)
= hsep [ppr_lexpr arrow, larrowt, ppr_lexpr arg]
| 105
|
ppr_cmd (HsCmdArrApp arrow arg _ HsFirstOrderApp True)
= hsep [ppr_lexpr arrow, larrowt, ppr_lexpr arg]
| 105
|
ppr_cmd (HsCmdArrApp arrow arg _ HsFirstOrderApp True)
= hsep [ppr_lexpr arrow, larrowt, ppr_lexpr arg]
| 105
| false
| false
| 0
| 6
| 15
| 42
| 20
| 22
| null | null |
bgold-cosmos/Tidal
|
src/Sound/Tidal/UI.hs
|
gpl-3.0
|
_euclid' :: Int -> Int -> Pattern a -> Pattern a
_euclid' n k p = fastcat $ map (\x -> if x then p else silence) (bjorklund (n,k))
| 130
|
_euclid' :: Int -> Int -> Pattern a -> Pattern a
_euclid' n k p = fastcat $ map (\x -> if x then p else silence) (bjorklund (n,k))
| 130
|
_euclid' n k p = fastcat $ map (\x -> if x then p else silence) (bjorklund (n,k))
| 81
| false
| true
| 0
| 9
| 28
| 78
| 39
| 39
| null | null |
LeventErkok/linearEqSolver
|
Math/LinearEquationSolver.hs
|
bsd-3-clause
|
solveIntegerLinearEqsAll :: Solver -- ^ SMT Solver to use
-> Int -- ^ Maximum number of solutions to return, in case infinite
-> [[Integer]] -- ^ Coefficient matrix (A)
-> [Integer] -- ^ Result vector (b)
-> IO [[Integer]] -- ^ All solutions to @Ax = b@
solveIntegerLinearEqsAll s maxNo coeffs res = extractModels `fmap` allSatWith cfg cs
where cs = buildConstraints "solveIntegerLinearEqsAll" coeffs res
cfg = (defaultSolverConfig s) {allSatMaxModelCount = Just maxNo}
-- | Solve a system of linear equations over rationals. Same as the integer
-- version `solveIntegerLinearEqs`, except it takes rational coefficients
-- and returns rational results.
--
-- Here's an example call, to solve the following system of equations:
--
-- @
-- 2.4x + 3.6y = 12
-- 7.2x - 5y = -8.5
-- @
--
-- >>> solveRationalLinearEqs Z3 [[2.4, 3.6],[7.2, -5]] [12, -8.5]
-- Just [245 % 316,445 % 158]
| 1,036
|
solveIntegerLinearEqsAll :: Solver -- ^ SMT Solver to use
-> Int -- ^ Maximum number of solutions to return, in case infinite
-> [[Integer]] -- ^ Coefficient matrix (A)
-> [Integer] -- ^ Result vector (b)
-> IO [[Integer]]
solveIntegerLinearEqsAll s maxNo coeffs res = extractModels `fmap` allSatWith cfg cs
where cs = buildConstraints "solveIntegerLinearEqsAll" coeffs res
cfg = (defaultSolverConfig s) {allSatMaxModelCount = Just maxNo}
-- | Solve a system of linear equations over rationals. Same as the integer
-- version `solveIntegerLinearEqs`, except it takes rational coefficients
-- and returns rational results.
--
-- Here's an example call, to solve the following system of equations:
--
-- @
-- 2.4x + 3.6y = 12
-- 7.2x - 5y = -8.5
-- @
--
-- >>> solveRationalLinearEqs Z3 [[2.4, 3.6],[7.2, -5]] [12, -8.5]
-- Just [245 % 316,445 % 158]
| 1,004
|
solveIntegerLinearEqsAll s maxNo coeffs res = extractModels `fmap` allSatWith cfg cs
where cs = buildConstraints "solveIntegerLinearEqsAll" coeffs res
cfg = (defaultSolverConfig s) {allSatMaxModelCount = Just maxNo}
-- | Solve a system of linear equations over rationals. Same as the integer
-- version `solveIntegerLinearEqs`, except it takes rational coefficients
-- and returns rational results.
--
-- Here's an example call, to solve the following system of equations:
--
-- @
-- 2.4x + 3.6y = 12
-- 7.2x - 5y = -8.5
-- @
--
-- >>> solveRationalLinearEqs Z3 [[2.4, 3.6],[7.2, -5]] [12, -8.5]
-- Just [245 % 316,445 % 158]
| 646
| true
| true
| 1
| 11
| 303
| 123
| 72
| 51
| null | null |
tejon/diagrams-contrib
|
src/Diagrams/TwoD/Tilings.hs
|
bsd-3-clause
|
polySin Square = 1
| 21
|
polySin Square = 1
| 21
|
polySin Square = 1
| 21
| false
| false
| 0
| 4
| 6
| 10
| 4
| 6
| null | null |
mightymoose/liquidhaskell
|
benchmarks/base-4.5.1.0/System/Posix/Internals.hs
|
bsd-3-clause
|
peekFilePath :: CWString -> IO FilePath
peekFilePath = peekCWString
| 67
|
peekFilePath :: CWString -> IO FilePath
peekFilePath = peekCWString
| 67
|
peekFilePath = peekCWString
| 27
| false
| true
| 0
| 7
| 8
| 24
| 10
| 14
| null | null |
jaspervdj/lorem-markdownum
|
lib/LoremMarkdownum/Gen/Markdown.hs
|
bsd-3-clause
|
--------------------------------------------------------------------------------
genLink :: MonadGen m => MarkdownGen m Text
genLink = do
noExternalLinks <- asks mcNoExternalLinks
if noExternalLinks then genInternalLink else genExternalLink
where
genInternalLink :: MonadGen m => MarkdownGen m Text
genInternalLink = do
n <- randomInt (1, 3)
linkParts <- replicateM n genLinkPart
return $ "#" <> T.intercalate "-" linkParts
genExternalLink :: MonadGen m => MarkdownGen m Text
genExternalLink = do
n0 <- randomInt (1, 2)
domainParts <- replicateM n0 genLinkPart
n1 <- randomInt (0, 2)
pathParts <- replicateM n1 genLinkPart
domainPart <- sampleFromList
[T.concat domainParts, T.intercalate "-" domainParts]
pathPart <- sampleFromList
[T.concat pathParts, T.intercalate "-" pathParts]
www <- sampleFromFrequencies [("", 3), ("www.", 1)]
tld <- sampleFromList [".org", ".net", ".com", ".io"]
ext <- if T.null pathPart
then return ""
else sampleFromFrequencies
[("", 5), (".php", 1), (".html", 2), (".aspx", 1)]
return $ T.concat ["http://", www, domainPart, tld, "/", pathPart, ext]
genLinkPart :: MonadGen m => MarkdownGen m Text
genLinkPart = do
token <- genToken
case token of
Element x -> return (T.toLower x)
_ -> genLinkPart
--------------------------------------------------------------------------------
| 1,623
|
genLink :: MonadGen m => MarkdownGen m Text
genLink = do
noExternalLinks <- asks mcNoExternalLinks
if noExternalLinks then genInternalLink else genExternalLink
where
genInternalLink :: MonadGen m => MarkdownGen m Text
genInternalLink = do
n <- randomInt (1, 3)
linkParts <- replicateM n genLinkPart
return $ "#" <> T.intercalate "-" linkParts
genExternalLink :: MonadGen m => MarkdownGen m Text
genExternalLink = do
n0 <- randomInt (1, 2)
domainParts <- replicateM n0 genLinkPart
n1 <- randomInt (0, 2)
pathParts <- replicateM n1 genLinkPart
domainPart <- sampleFromList
[T.concat domainParts, T.intercalate "-" domainParts]
pathPart <- sampleFromList
[T.concat pathParts, T.intercalate "-" pathParts]
www <- sampleFromFrequencies [("", 3), ("www.", 1)]
tld <- sampleFromList [".org", ".net", ".com", ".io"]
ext <- if T.null pathPart
then return ""
else sampleFromFrequencies
[("", 5), (".php", 1), (".html", 2), (".aspx", 1)]
return $ T.concat ["http://", www, domainPart, tld, "/", pathPart, ext]
genLinkPart :: MonadGen m => MarkdownGen m Text
genLinkPart = do
token <- genToken
case token of
Element x -> return (T.toLower x)
_ -> genLinkPart
--------------------------------------------------------------------------------
| 1,542
|
genLink = do
noExternalLinks <- asks mcNoExternalLinks
if noExternalLinks then genInternalLink else genExternalLink
where
genInternalLink :: MonadGen m => MarkdownGen m Text
genInternalLink = do
n <- randomInt (1, 3)
linkParts <- replicateM n genLinkPart
return $ "#" <> T.intercalate "-" linkParts
genExternalLink :: MonadGen m => MarkdownGen m Text
genExternalLink = do
n0 <- randomInt (1, 2)
domainParts <- replicateM n0 genLinkPart
n1 <- randomInt (0, 2)
pathParts <- replicateM n1 genLinkPart
domainPart <- sampleFromList
[T.concat domainParts, T.intercalate "-" domainParts]
pathPart <- sampleFromList
[T.concat pathParts, T.intercalate "-" pathParts]
www <- sampleFromFrequencies [("", 3), ("www.", 1)]
tld <- sampleFromList [".org", ".net", ".com", ".io"]
ext <- if T.null pathPart
then return ""
else sampleFromFrequencies
[("", 5), (".php", 1), (".html", 2), (".aspx", 1)]
return $ T.concat ["http://", www, domainPart, tld, "/", pathPart, ext]
genLinkPart :: MonadGen m => MarkdownGen m Text
genLinkPart = do
token <- genToken
case token of
Element x -> return (T.toLower x)
_ -> genLinkPart
--------------------------------------------------------------------------------
| 1,498
| true
| true
| 0
| 13
| 481
| 458
| 231
| 227
| null | null |
SwiftsNamesake/Southpaw
|
lib/Southpaw/Picasso/Palette.hs
|
mit
|
olivedrab = (0.41960800, 0.55686300, 0.13725500, 1.0)
| 64
|
olivedrab = (0.41960800, 0.55686300, 0.13725500, 1.0)
| 64
|
olivedrab = (0.41960800, 0.55686300, 0.13725500, 1.0)
| 64
| false
| false
| 0
| 5
| 16
| 18
| 11
| 7
| null | null |
vladimir-ipatov/ganeti
|
src/Ganeti/Constants.hs
|
gpl-2.0
|
nvDrbdlist :: String
nvDrbdlist = "drbd-list"
| 45
|
nvDrbdlist :: String
nvDrbdlist = "drbd-list"
| 45
|
nvDrbdlist = "drbd-list"
| 24
| false
| true
| 0
| 6
| 5
| 18
| 7
| 11
| null | null |
TomMD/irc-core
|
driver/Main.hs
|
bsd-3-clause
|
-- exit silently
socketLoop :: TChan (UTCTime, MsgFromServer) -> Connection -> Maybe Handle -> IO ()
socketLoop chan h hErr =
forever (atomically . writeTChan chan =<< getOne h hErr)
`catches`
[ Handler $ \ioe ->
do let msg = if isEOFError ioe
then "Connection terminated"
else Text.encodeUtf8 (Text.pack (show ioe))
now <- getCurrentTime
atomically (writeTChan chan (now, Error msg))
, Handler $ \(SomeException e) ->
do now <- getCurrentTime
atomically (writeTChan chan (now, Error (Text.encodeUtf8 (Text.pack (show e)))))
]
| 623
|
socketLoop :: TChan (UTCTime, MsgFromServer) -> Connection -> Maybe Handle -> IO ()
socketLoop chan h hErr =
forever (atomically . writeTChan chan =<< getOne h hErr)
`catches`
[ Handler $ \ioe ->
do let msg = if isEOFError ioe
then "Connection terminated"
else Text.encodeUtf8 (Text.pack (show ioe))
now <- getCurrentTime
atomically (writeTChan chan (now, Error msg))
, Handler $ \(SomeException e) ->
do now <- getCurrentTime
atomically (writeTChan chan (now, Error (Text.encodeUtf8 (Text.pack (show e)))))
]
| 605
|
socketLoop chan h hErr =
forever (atomically . writeTChan chan =<< getOne h hErr)
`catches`
[ Handler $ \ioe ->
do let msg = if isEOFError ioe
then "Connection terminated"
else Text.encodeUtf8 (Text.pack (show ioe))
now <- getCurrentTime
atomically (writeTChan chan (now, Error msg))
, Handler $ \(SomeException e) ->
do now <- getCurrentTime
atomically (writeTChan chan (now, Error (Text.encodeUtf8 (Text.pack (show e)))))
]
| 521
| true
| true
| 0
| 22
| 176
| 231
| 114
| 117
| null | null |
nhibberd/toaster
|
src/Toaster/main.hs
|
mit
|
main :: IO ()
main = do
pool <- mkpool
runmigrate pool
scotty 3030 $ do
middleware logStdoutDev
middleware $ staticPolicy (addBase "web")
Http.toastermain pool
| 175
|
main :: IO ()
main = do
pool <- mkpool
runmigrate pool
scotty 3030 $ do
middleware logStdoutDev
middleware $ staticPolicy (addBase "web")
Http.toastermain pool
| 175
|
main = do
pool <- mkpool
runmigrate pool
scotty 3030 $ do
middleware logStdoutDev
middleware $ staticPolicy (addBase "web")
Http.toastermain pool
| 161
| false
| true
| 0
| 13
| 40
| 69
| 29
| 40
| null | null |
andygill/er-systemf
|
Language/SystemF/Eval.hs
|
bsd-3-clause
|
evalCase env _ _ _ = error "attempting to case a lambda expression"
| 67
|
evalCase env _ _ _ = error "attempting to case a lambda expression"
| 67
|
evalCase env _ _ _ = error "attempting to case a lambda expression"
| 67
| false
| false
| 1
| 5
| 12
| 19
| 7
| 12
| null | null |
brendanhay/gogol
|
gogol-blogger/gen/Network/Google/Resource/Blogger/Blogs/Get.hs
|
mpl-2.0
|
-- | Creates a value of 'BlogsGet' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bgXgafv'
--
-- * 'bgUploadProtocol'
--
-- * 'bgAccessToken'
--
-- * 'bgUploadType'
--
-- * 'bgBlogId'
--
-- * 'bgMaxPosts'
--
-- * 'bgView'
--
-- * 'bgCallback'
blogsGet
:: Text -- ^ 'bgBlogId'
-> BlogsGet
blogsGet pBgBlogId_ =
BlogsGet'
{ _bgXgafv = Nothing
, _bgUploadProtocol = Nothing
, _bgAccessToken = Nothing
, _bgUploadType = Nothing
, _bgBlogId = pBgBlogId_
, _bgMaxPosts = Nothing
, _bgView = Nothing
, _bgCallback = Nothing
}
| 651
|
blogsGet
:: Text -- ^ 'bgBlogId'
-> BlogsGet
blogsGet pBgBlogId_ =
BlogsGet'
{ _bgXgafv = Nothing
, _bgUploadProtocol = Nothing
, _bgAccessToken = Nothing
, _bgUploadType = Nothing
, _bgBlogId = pBgBlogId_
, _bgMaxPosts = Nothing
, _bgView = Nothing
, _bgCallback = Nothing
}
| 321
|
blogsGet pBgBlogId_ =
BlogsGet'
{ _bgXgafv = Nothing
, _bgUploadProtocol = Nothing
, _bgAccessToken = Nothing
, _bgUploadType = Nothing
, _bgBlogId = pBgBlogId_
, _bgMaxPosts = Nothing
, _bgView = Nothing
, _bgCallback = Nothing
}
| 268
| true
| true
| 0
| 6
| 152
| 88
| 62
| 26
| null | null |
markus1189/xmonad-contrib-710
|
XMonad/Hooks/DebugEvents.hs
|
bsd-3-clause
|
dumpProp _ "_NET_DESKTOP_GEOMETRY" = dumpArray dump32
| 73
|
dumpProp _ "_NET_DESKTOP_GEOMETRY" = dumpArray dump32
| 73
|
dumpProp _ "_NET_DESKTOP_GEOMETRY" = dumpArray dump32
| 73
| false
| false
| 0
| 5
| 25
| 14
| 6
| 8
| null | null |
agomezl/fluffy-chainsaw
|
test/Main.hs
|
mit
|
prop5 ∷ Property
prop5 = forAll (listOf $ choose (0,1)) rawProp
where rawProp x = m5Check x == accepts m5 x
| 111
|
prop5 ∷ Property
prop5 = forAll (listOf $ choose (0,1)) rawProp
where rawProp x = m5Check x == accepts m5 x
| 111
|
prop5 = forAll (listOf $ choose (0,1)) rawProp
where rawProp x = m5Check x == accepts m5 x
| 94
| false
| true
| 2
| 9
| 24
| 64
| 27
| 37
| null | null |
gbaz/haskell-platform
|
hptool/src/OS/Internal.hs
|
bsd-3-clause
|
genericOS :: BuildConfig -> OS
genericOS BuildConfig{..} = OS{..}
where
HpVersion{..} = bcHpVersion
GhcVersion{..} = bcGhcVersion
osHpPrefix = "/usr/local/haskell-platform" </> showVersion hpVersion
osGhcPrefix = "/usr/local/ghc" </> showVersion ghcVersion
osGhcLocalInstall = GhcInstallConfigure
osGhcTargetInstall = GhcInstallConfigure
osPackageTargetDir p = osHpPrefix </> "lib" </> packagePattern p
osDoShared = True
osPackagePostRegister _ = return ()
osPackageInstallAction p = do
let confFile = packageTargetConf p
let regDir = targetDir </+> osHpPrefix </> "etc" </> "registrations"
let regFile = regDir </> show p
makeDirectory regDir
hasReg <- doesFileExist confFile
if hasReg
then command_ [] "cp" [confFile, regFile]
else command_ [] "rm" ["-f", regFile]
osTargetAction = return ()
osGhcDbDir = "lib" </> show bcGhcVersion </> "package.conf.d"
osGhcPkgHtmlFieldExtras = []
osPlatformPkgPathMunge = flip const
osGhcPkgPathMunge = flip const
osPkgHtmlDir pkg = osPackageTargetDir pkg </> "doc" </> "html"
osDocAction = return ()
osProduct = productDir </> "generic.tar.gz"
osRules _hpRelease _bc =
osProduct %> \out -> do
need [targetDir, vdir ghcVirtualTarget]
command_ [Cwd buildRoot]
"tar" ["czf", out `relativeToDir` buildRoot, targetDir `relativeToDir` buildRoot]
osPackageConfigureExtraArgs _pkg = []
| 1,519
|
genericOS :: BuildConfig -> OS
genericOS BuildConfig{..} = OS{..}
where
HpVersion{..} = bcHpVersion
GhcVersion{..} = bcGhcVersion
osHpPrefix = "/usr/local/haskell-platform" </> showVersion hpVersion
osGhcPrefix = "/usr/local/ghc" </> showVersion ghcVersion
osGhcLocalInstall = GhcInstallConfigure
osGhcTargetInstall = GhcInstallConfigure
osPackageTargetDir p = osHpPrefix </> "lib" </> packagePattern p
osDoShared = True
osPackagePostRegister _ = return ()
osPackageInstallAction p = do
let confFile = packageTargetConf p
let regDir = targetDir </+> osHpPrefix </> "etc" </> "registrations"
let regFile = regDir </> show p
makeDirectory regDir
hasReg <- doesFileExist confFile
if hasReg
then command_ [] "cp" [confFile, regFile]
else command_ [] "rm" ["-f", regFile]
osTargetAction = return ()
osGhcDbDir = "lib" </> show bcGhcVersion </> "package.conf.d"
osGhcPkgHtmlFieldExtras = []
osPlatformPkgPathMunge = flip const
osGhcPkgPathMunge = flip const
osPkgHtmlDir pkg = osPackageTargetDir pkg </> "doc" </> "html"
osDocAction = return ()
osProduct = productDir </> "generic.tar.gz"
osRules _hpRelease _bc =
osProduct %> \out -> do
need [targetDir, vdir ghcVirtualTarget]
command_ [Cwd buildRoot]
"tar" ["czf", out `relativeToDir` buildRoot, targetDir `relativeToDir` buildRoot]
osPackageConfigureExtraArgs _pkg = []
| 1,519
|
genericOS BuildConfig{..} = OS{..}
where
HpVersion{..} = bcHpVersion
GhcVersion{..} = bcGhcVersion
osHpPrefix = "/usr/local/haskell-platform" </> showVersion hpVersion
osGhcPrefix = "/usr/local/ghc" </> showVersion ghcVersion
osGhcLocalInstall = GhcInstallConfigure
osGhcTargetInstall = GhcInstallConfigure
osPackageTargetDir p = osHpPrefix </> "lib" </> packagePattern p
osDoShared = True
osPackagePostRegister _ = return ()
osPackageInstallAction p = do
let confFile = packageTargetConf p
let regDir = targetDir </+> osHpPrefix </> "etc" </> "registrations"
let regFile = regDir </> show p
makeDirectory regDir
hasReg <- doesFileExist confFile
if hasReg
then command_ [] "cp" [confFile, regFile]
else command_ [] "rm" ["-f", regFile]
osTargetAction = return ()
osGhcDbDir = "lib" </> show bcGhcVersion </> "package.conf.d"
osGhcPkgHtmlFieldExtras = []
osPlatformPkgPathMunge = flip const
osGhcPkgPathMunge = flip const
osPkgHtmlDir pkg = osPackageTargetDir pkg </> "doc" </> "html"
osDocAction = return ()
osProduct = productDir </> "generic.tar.gz"
osRules _hpRelease _bc =
osProduct %> \out -> do
need [targetDir, vdir ghcVirtualTarget]
command_ [Cwd buildRoot]
"tar" ["czf", out `relativeToDir` buildRoot, targetDir `relativeToDir` buildRoot]
osPackageConfigureExtraArgs _pkg = []
| 1,488
| false
| true
| 19
| 20
| 368
| 418
| 205
| 213
| null | null |
minoki/LambdaQuest
|
src/LambdaQuest/SystemFsub/Coercion.hs
|
bsd-3-clause
|
joinType ctx (TyArr s0 s1) (TyArr t0 t1)
= case meetType ctx s0 t0 of
Just u -> TyArr u $ joinType (AnonymousBind : ctx) s1 t1
Nothing -> TyTop
| 157
|
joinType ctx (TyArr s0 s1) (TyArr t0 t1)
= case meetType ctx s0 t0 of
Just u -> TyArr u $ joinType (AnonymousBind : ctx) s1 t1
Nothing -> TyTop
| 157
|
joinType ctx (TyArr s0 s1) (TyArr t0 t1)
= case meetType ctx s0 t0 of
Just u -> TyArr u $ joinType (AnonymousBind : ctx) s1 t1
Nothing -> TyTop
| 157
| false
| false
| 0
| 11
| 43
| 76
| 36
| 40
| null | null |
jthornber/language-c-ejt
|
src/Language/C/Analysis/ConstEval.hs
|
bsd-3-clause
|
intOp CXorOp i1 i2 = i1 `xor` i2
| 32
|
intOp CXorOp i1 i2 = i1 `xor` i2
| 32
|
intOp CXorOp i1 i2 = i1 `xor` i2
| 32
| false
| false
| 0
| 5
| 7
| 19
| 10
| 9
| null | null |
ambiata/highlighting-kate
|
Text/Highlighting/Kate/Syntax/Fortran.hs
|
gpl-2.0
|
list_transform'5ffn = Set.fromList $ words $ "repeat trim selected_int_kind selected_real_kind transfer dot_product matmul all any count maxval minval product sum pack unpack reshape spread cshift eoshift transpose maxloc minloc"
| 229
|
list_transform'5ffn = Set.fromList $ words $ "repeat trim selected_int_kind selected_real_kind transfer dot_product matmul all any count maxval minval product sum pack unpack reshape spread cshift eoshift transpose maxloc minloc"
| 229
|
list_transform'5ffn = Set.fromList $ words $ "repeat trim selected_int_kind selected_real_kind transfer dot_product matmul all any count maxval minval product sum pack unpack reshape spread cshift eoshift transpose maxloc minloc"
| 229
| false
| false
| 0
| 7
| 28
| 16
| 8
| 8
| null | null |
konn/hint-forked
|
src/Hint/Context.hs
|
bsd-3-clause
|
setImports :: MonadInterpreter m => [ModuleName] -> m ()
setImports ms = setImportsQ $ zip ms (repeat Nothing)
| 110
|
setImports :: MonadInterpreter m => [ModuleName] -> m ()
setImports ms = setImportsQ $ zip ms (repeat Nothing)
| 110
|
setImports ms = setImportsQ $ zip ms (repeat Nothing)
| 53
| false
| true
| 2
| 9
| 17
| 55
| 24
| 31
| null | null |
ekmett/ghclive
|
prototypes/sharededitor/WsTest.hs
|
bsd-3-clause
|
sockets :: Editor -> WS.Request -> WS.WebSockets WS.Hybi10 ()
sockets y req
| WS.requestPath req == "/edit" = accept editSocket
| otherwise = WS.rejectRequest req "Not found"
where
accept a = WS.acceptRequest req >> a y
| 251
|
sockets :: Editor -> WS.Request -> WS.WebSockets WS.Hybi10 ()
sockets y req
| WS.requestPath req == "/edit" = accept editSocket
| otherwise = WS.rejectRequest req "Not found"
where
accept a = WS.acceptRequest req >> a y
| 251
|
sockets y req
| WS.requestPath req == "/edit" = accept editSocket
| otherwise = WS.rejectRequest req "Not found"
where
accept a = WS.acceptRequest req >> a y
| 189
| false
| true
| 1
| 10
| 67
| 92
| 42
| 50
| null | null |
olsner/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
floatFromIntegerIdKey = mkPreludeMiscIdUnique 85
| 56
|
floatFromIntegerIdKey = mkPreludeMiscIdUnique 85
| 56
|
floatFromIntegerIdKey = mkPreludeMiscIdUnique 85
| 56
| false
| false
| 0
| 5
| 11
| 9
| 4
| 5
| null | null |
synsem/texhs
|
src/Text/TeX/Context/Walk.hs
|
gpl-3.0
|
-- | @list bullet p@ parses zero or more occurrences of @p@, each prefixed by @bullet@.
-- Returns a list of values returned by @p@.
--
-- Note: @p@ must not overlap with @bullet@.
list :: Parser a -> Parser b -> Parser [b]
list bullet p = many (bullet *> p)
| 258
|
list :: Parser a -> Parser b -> Parser [b]
list bullet p = many (bullet *> p)
| 77
|
list bullet p = many (bullet *> p)
| 34
| true
| true
| 0
| 8
| 51
| 54
| 27
| 27
| null | null |
brendanhay/semver
|
src/Data/SemVer.hs
|
mpl-2.0
|
-- | A default 'Version' which can be used to signify initial development.
--
-- Note: Equivalent to @0.0.0@
initial :: Version
initial = version 0 0 0 [] []
| 157
|
initial :: Version
initial = version 0 0 0 [] []
| 48
|
initial = version 0 0 0 [] []
| 29
| true
| true
| 0
| 6
| 29
| 29
| 16
| 13
| null | null |
cartazio/HaNS
|
examples/echo-server/Main.hs
|
bsd-3-clause
|
showExceptions :: String -> IO a -> IO a
showExceptions l m = m `catch` \ e ->
do print (l, e :: SomeException)
throwIO e
| 128
|
showExceptions :: String -> IO a -> IO a
showExceptions l m = m `catch` \ e ->
do print (l, e :: SomeException)
throwIO e
| 128
|
showExceptions l m = m `catch` \ e ->
do print (l, e :: SomeException)
throwIO e
| 87
| false
| true
| 0
| 11
| 32
| 70
| 33
| 37
| null | null |
laugh-at-me/recurrence
|
src/Math.hs
|
gpl-3.0
|
commutativity SZ (SS n) = unsafeCoerce Refl
| 43
|
commutativity SZ (SS n) = unsafeCoerce Refl
| 43
|
commutativity SZ (SS n) = unsafeCoerce Refl
| 43
| false
| false
| 0
| 6
| 6
| 22
| 9
| 13
| null | null |
aelve/hslibs
|
src/Guide/State.hs
|
bsd-3-clause
|
-- | Converts 'GlobalState' to 'PublicDB' type stripping private data.
toPublicDB :: GlobalState -> PublicDB
toPublicDB GlobalState{..} =
PublicDB {
publicCategories = _categories,
publicCategoriesDeleted = _categoriesDeleted,
publicActions = _actions,
publicPendingEdits = _pendingEdits,
publicEditIdCounter = _editIdCounter,
publicUsers = fmap userToPublic _users
}
| 433
|
toPublicDB :: GlobalState -> PublicDB
toPublicDB GlobalState{..} =
PublicDB {
publicCategories = _categories,
publicCategoriesDeleted = _categoriesDeleted,
publicActions = _actions,
publicPendingEdits = _pendingEdits,
publicEditIdCounter = _editIdCounter,
publicUsers = fmap userToPublic _users
}
| 362
|
toPublicDB GlobalState{..} =
PublicDB {
publicCategories = _categories,
publicCategoriesDeleted = _categoriesDeleted,
publicActions = _actions,
publicPendingEdits = _pendingEdits,
publicEditIdCounter = _editIdCounter,
publicUsers = fmap userToPublic _users
}
| 324
| true
| true
| 0
| 7
| 106
| 68
| 40
| 28
| null | null |
wincent/docvim
|
lib/Text/Docvim/Printer/Vim.hs
|
mit
|
slurp :: String -> Env
slurp str = do
context <- get
put (Context (lineBreak context) (partial context))
return [Slurp str]
where
-- eg. (partialLine context) | str | result
-- ----------------------|------------|-------
-- "" | "\n" | ""
-- "foo" | "\n" | "foo"
-- "foo" | "bar" | "foo"
-- "abc" | "bc" | "a"
-- "abc" | "foo\nabc" | ""
--
-- Note: That last one is unsafe, because we can't guarantee that "foo" is
-- there. Caveat emptor!
partial context = if str `isSuffixOf` partialLine context
then take (length (partialLine context) - length str) (partialLine context)
else partialLine context
| 831
|
slurp :: String -> Env
slurp str = do
context <- get
put (Context (lineBreak context) (partial context))
return [Slurp str]
where
-- eg. (partialLine context) | str | result
-- ----------------------|------------|-------
-- "" | "\n" | ""
-- "foo" | "\n" | "foo"
-- "foo" | "bar" | "foo"
-- "abc" | "bc" | "a"
-- "abc" | "foo\nabc" | ""
--
-- Note: That last one is unsafe, because we can't guarantee that "foo" is
-- there. Caveat emptor!
partial context = if str `isSuffixOf` partialLine context
then take (length (partialLine context) - length str) (partialLine context)
else partialLine context
| 831
|
slurp str = do
context <- get
put (Context (lineBreak context) (partial context))
return [Slurp str]
where
-- eg. (partialLine context) | str | result
-- ----------------------|------------|-------
-- "" | "\n" | ""
-- "foo" | "\n" | "foo"
-- "foo" | "bar" | "foo"
-- "abc" | "bc" | "a"
-- "abc" | "foo\nabc" | ""
--
-- Note: That last one is unsafe, because we can't guarantee that "foo" is
-- there. Caveat emptor!
partial context = if str `isSuffixOf` partialLine context
then take (length (partialLine context) - length str) (partialLine context)
else partialLine context
| 808
| false
| true
| 1
| 11
| 334
| 142
| 70
| 72
| null | null |
vTurbine/ghc
|
compiler/typecheck/TcRnTypes.hs
|
bsd-3-clause
|
pprCtO StandAloneDerivOrigin = text "a 'deriving' declaration"
| 62
|
pprCtO StandAloneDerivOrigin = text "a 'deriving' declaration"
| 62
|
pprCtO StandAloneDerivOrigin = text "a 'deriving' declaration"
| 62
| false
| false
| 0
| 5
| 6
| 13
| 5
| 8
| null | null |
mumuki/mulang
|
src/Data/Count.hs
|
gpl-3.0
|
encodeMaybe n | n >= 1 = Just $ MoreThanOne (fromIntegral n)
| 60
|
encodeMaybe n | n >= 1 = Just $ MoreThanOne (fromIntegral n)
| 60
|
encodeMaybe n | n >= 1 = Just $ MoreThanOne (fromIntegral n)
| 60
| false
| false
| 0
| 9
| 11
| 35
| 15
| 20
| null | null |
copumpkin/charm
|
src/Architecture/ARM/Pretty.hs
|
bsd-3-clause
|
showInstruction (SXTB rd d) = printf "SXTB%%s %s, %s" (showRegister rd) (showDataOp d)
| 103
|
showInstruction (SXTB rd d) = printf "SXTB%%s %s, %s" (showRegister rd) (showDataOp d)
| 103
|
showInstruction (SXTB rd d) = printf "SXTB%%s %s, %s" (showRegister rd) (showDataOp d)
| 103
| false
| false
| 0
| 7
| 29
| 36
| 17
| 19
| null | null |
plaprade/haskoin
|
haskoin-core/src/Network/Haskoin/Block/Headers.hs
|
unlicense
|
connectBlock :: BlockHeaders m
=> Timestamp -- ^ current time
-> BlockHeader
-> m (Either String BlockNode)
connectBlock t bh = runExceptT $ do
par <- ExceptT $ parentBlock bh
pars <- lift $ getParents 10 par
skM <- lift $ getAncestor (skipHeight (nodeHeight par + 1)) par
sk <- case skM of
Just sk -> return sk
Nothing -> throwError $ "BUG: Could not get skip for block "
++ show (headerHash $ nodeHeader par)
bb <- lift getBestBlockHeader
bn <- ExceptT . return $ validBlock t bb par pars bh sk
let bb' = chooseBest bb bn
lift $ addBlockHeader bn
when (bb /= bb') . lift $ setBestBlockHeader bb'
return bn
| 728
|
connectBlock :: BlockHeaders m
=> Timestamp -- ^ current time
-> BlockHeader
-> m (Either String BlockNode)
connectBlock t bh = runExceptT $ do
par <- ExceptT $ parentBlock bh
pars <- lift $ getParents 10 par
skM <- lift $ getAncestor (skipHeight (nodeHeight par + 1)) par
sk <- case skM of
Just sk -> return sk
Nothing -> throwError $ "BUG: Could not get skip for block "
++ show (headerHash $ nodeHeader par)
bb <- lift getBestBlockHeader
bn <- ExceptT . return $ validBlock t bb par pars bh sk
let bb' = chooseBest bb bn
lift $ addBlockHeader bn
when (bb /= bb') . lift $ setBestBlockHeader bb'
return bn
| 728
|
connectBlock t bh = runExceptT $ do
par <- ExceptT $ parentBlock bh
pars <- lift $ getParents 10 par
skM <- lift $ getAncestor (skipHeight (nodeHeight par + 1)) par
sk <- case skM of
Just sk -> return sk
Nothing -> throwError $ "BUG: Could not get skip for block "
++ show (headerHash $ nodeHeader par)
bb <- lift getBestBlockHeader
bn <- ExceptT . return $ validBlock t bb par pars bh sk
let bb' = chooseBest bb bn
lift $ addBlockHeader bn
when (bb /= bb') . lift $ setBestBlockHeader bb'
return bn
| 574
| false
| true
| 0
| 16
| 234
| 251
| 114
| 137
| null | null |
timsears/species
|
Math/Combinatorics/Species/Class.hs
|
bsd-3-clause
|
elements :: Species s => s
elements = element
| 45
|
elements :: Species s => s
elements = element
| 45
|
elements = element
| 18
| false
| true
| 0
| 6
| 8
| 18
| 9
| 9
| null | null |
christiaanb/ghc
|
compiler/types/InstEnv.hs
|
bsd-3-clause
|
-- | Checks for an exact match of ClsInst in the instance environment.
-- We use this when we do signature checking in TcRnDriver
memberInstEnv :: InstEnv -> ClsInst -> Bool
memberInstEnv inst_env ins_item@(ClsInst { is_cls_nm = cls_nm } ) =
maybe False (\(ClsIE items) -> any (identicalClsInstHead ins_item) items)
(lookupUFM inst_env cls_nm)
| 357
|
memberInstEnv :: InstEnv -> ClsInst -> Bool
memberInstEnv inst_env ins_item@(ClsInst { is_cls_nm = cls_nm } ) =
maybe False (\(ClsIE items) -> any (identicalClsInstHead ins_item) items)
(lookupUFM inst_env cls_nm)
| 227
|
memberInstEnv inst_env ins_item@(ClsInst { is_cls_nm = cls_nm } ) =
maybe False (\(ClsIE items) -> any (identicalClsInstHead ins_item) items)
(lookupUFM inst_env cls_nm)
| 183
| true
| true
| 0
| 10
| 66
| 83
| 43
| 40
| null | null |
narurien/ganeti-ceph
|
src/Ganeti/Confd/Server.hs
|
gpl-2.0
|
gntErrorToResult (Ok x) = Ok x
| 30
|
gntErrorToResult (Ok x) = Ok x
| 30
|
gntErrorToResult (Ok x) = Ok x
| 30
| false
| false
| 0
| 7
| 5
| 18
| 8
| 10
| null | null |
mortberg/cubicaltt
|
CTT.hs
|
mit
|
showDecls :: Decls -> Doc
showDecls (MutualDecls _ defs) =
hsep $ punctuate comma
[ text x <+> equals <+> showTer d | (x,(_,d)) <- defs ]
| 141
|
showDecls :: Decls -> Doc
showDecls (MutualDecls _ defs) =
hsep $ punctuate comma
[ text x <+> equals <+> showTer d | (x,(_,d)) <- defs ]
| 141
|
showDecls (MutualDecls _ defs) =
hsep $ punctuate comma
[ text x <+> equals <+> showTer d | (x,(_,d)) <- defs ]
| 115
| false
| true
| 0
| 9
| 30
| 73
| 37
| 36
| null | null |
coolhacks/scripts-hacks
|
examples/shellcheck-master/ShellCheck/Analytics.hs
|
mit
|
prop_getBracedReference9 = getBracedReference "foo:-bar" == "foo"
| 65
|
prop_getBracedReference9 = getBracedReference "foo:-bar" == "foo"
| 65
|
prop_getBracedReference9 = getBracedReference "foo:-bar" == "foo"
| 65
| false
| false
| 0
| 6
| 5
| 13
| 6
| 7
| null | null |
apyrgio/snf-ganeti
|
src/Ganeti/OpParams.hs
|
bsd-2-clause
|
pRequiredNodes :: Field
pRequiredNodes =
withDoc "Required list of node names" .
renameField "ReqNodes " $ simpleField "nodes" [t| [NonEmptyString] |]
| 154
|
pRequiredNodes :: Field
pRequiredNodes =
withDoc "Required list of node names" .
renameField "ReqNodes " $ simpleField "nodes" [t| [NonEmptyString] |]
| 154
|
pRequiredNodes =
withDoc "Required list of node names" .
renameField "ReqNodes " $ simpleField "nodes" [t| [NonEmptyString] |]
| 130
| false
| true
| 0
| 7
| 24
| 34
| 18
| 16
| null | null |
ttsiodras/Score4
|
Haskell/score4.hs
|
gpl-2.0
|
(width,height) = (7,6)
| 22
|
(width,height) = (7,6)
| 22
|
(width,height) = (7,6)
| 22
| false
| false
| 0
| 5
| 2
| 19
| 11
| 8
| null | null |
DanielWaterworth/Idris-dev
|
src/IRTS/CodegenLLVM.hs
|
bsd-3-clause
|
cgOp (LSHL ITBig) [x,y] = mpzBit "mul_2exp" x y
| 49
|
cgOp (LSHL ITBig) [x,y] = mpzBit "mul_2exp" x y
| 49
|
cgOp (LSHL ITBig) [x,y] = mpzBit "mul_2exp" x y
| 49
| false
| false
| 0
| 7
| 10
| 30
| 15
| 15
| null | null |
gnn/Hets
|
Driver/Options.hs
|
gpl-2.0
|
-- | 'parseTransOpt' parses a 'Trans' Flag from user input
parseTransOpt :: String -> Flag
parseTransOpt = Trans . map mkSimpleId . splitPaths
| 142
|
parseTransOpt :: String -> Flag
parseTransOpt = Trans . map mkSimpleId . splitPaths
| 83
|
parseTransOpt = Trans . map mkSimpleId . splitPaths
| 51
| true
| true
| 0
| 7
| 22
| 34
| 15
| 19
| null | null |
apyrgio/ganeti
|
src/Ganeti/Utils.hs
|
bsd-2-clause
|
-- | Ensure a value is quoted if needed.
ensureQuoted :: String -> String
ensureQuoted v = if not (all (\c -> isAlphaNum c || c == '.') v)
then '\'':v ++ "'"
else v
| 198
|
ensureQuoted :: String -> String
ensureQuoted v = if not (all (\c -> isAlphaNum c || c == '.') v)
then '\'':v ++ "'"
else v
| 157
|
ensureQuoted v = if not (all (\c -> isAlphaNum c || c == '.') v)
then '\'':v ++ "'"
else v
| 124
| true
| true
| 0
| 13
| 68
| 65
| 34
| 31
| null | null |
ssaavedra/liquidhaskell
|
benchmarks/vector-0.10.0.1/Data/Vector.hs
|
bsd-3-clause
|
prescanr' = G.prescanr'
| 23
|
prescanr' = G.prescanr'
| 23
|
prescanr' = G.prescanr'
| 23
| false
| false
| 0
| 5
| 2
| 8
| 4
| 4
| null | null |
quephird/todo.hs
|
src/Models/Task.hs
|
mit
|
toKey :: ToBackendKey SqlBackend a => Integer -> Key a
toKey i = toSqlKey $ fromIntegral (i :: Integer)
| 103
|
toKey :: ToBackendKey SqlBackend a => Integer -> Key a
toKey i = toSqlKey $ fromIntegral (i :: Integer)
| 103
|
toKey i = toSqlKey $ fromIntegral (i :: Integer)
| 48
| false
| true
| 2
| 8
| 18
| 48
| 22
| 26
| null | null |
E2LP/e2asm
|
src/E2ASM/Assembler/Lexer.hs
|
gpl-3.0
|
tokenizeSpacesLeft :: PT.Parser a -> PT.Parser a
tokenizeSpacesLeft p = (P.spaces >> P.optional tokenizeComment >> P.spaces) *> p
| 129
|
tokenizeSpacesLeft :: PT.Parser a -> PT.Parser a
tokenizeSpacesLeft p = (P.spaces >> P.optional tokenizeComment >> P.spaces) *> p
| 129
|
tokenizeSpacesLeft p = (P.spaces >> P.optional tokenizeComment >> P.spaces) *> p
| 80
| false
| true
| 0
| 10
| 17
| 52
| 25
| 27
| null | null |
sdiehl/ghc
|
compiler/typecheck/FamInst.hs
|
bsd-3-clause
|
newFamInst :: FamFlavor -> CoAxiom Unbranched -> TcM FamInst
-- Freshen the type variables of the FamInst branches
newFamInst flavor axiom@(CoAxiom { co_ax_tc = fam_tc })
= ASSERT2( tyCoVarsOfTypes lhs `subVarSet` tcv_set, text "lhs" <+> pp_ax )
ASSERT2( lhs_kind `eqType` rhs_kind, text "kind" <+> pp_ax $$ ppr lhs_kind $$ ppr rhs_kind )
-- We used to have an assertion that the tyvars of the RHS were bound
-- by tcv_set, but in error situations like F Int = a that isn't
-- true; a later check in checkValidFamInst rejects it
do { (subst, tvs') <- freshenTyVarBndrs tvs
; (subst, cvs') <- freshenCoVarBndrsX subst cvs
; dflags <- getDynFlags
; let lhs' = substTys subst lhs
rhs' = substTy subst rhs
tcvs' = tvs' ++ cvs'
; ifErrsM (return ()) $ -- Don't lint when there are errors, because
-- errors might mean TcTyCons.
-- See Note [Recover from validity error] in TcTyClsDecls
when (gopt Opt_DoCoreLinting dflags) $
-- Check that the types involved in this instance are well formed.
-- Do /not/ expand type synonyms, for the reasons discussed in
-- Note [Linting type synonym applications].
case lintTypes dflags tcvs' (rhs':lhs') of
Nothing -> pure ()
Just fail_msg -> pprPanic "Core Lint error" (vcat [ fail_msg
, ppr fam_tc
, ppr subst
, ppr tvs'
, ppr cvs'
, ppr lhs'
, ppr rhs' ])
; return (FamInst { fi_fam = tyConName fam_tc
, fi_flavor = flavor
, fi_tcs = roughMatchTcs lhs
, fi_tvs = tvs'
, fi_cvs = cvs'
, fi_tys = lhs'
, fi_rhs = rhs'
, fi_axiom = axiom }) }
where
lhs_kind = tcTypeKind (mkTyConApp fam_tc lhs)
rhs_kind = tcTypeKind rhs
tcv_set = mkVarSet (tvs ++ cvs)
pp_ax = pprCoAxiom axiom
CoAxBranch { cab_tvs = tvs
, cab_cvs = cvs
, cab_lhs = lhs
, cab_rhs = rhs } = coAxiomSingleBranch axiom
{-
************************************************************************
* *
Optimised overlap checking for family instances
* *
************************************************************************
Note [Checking family instance consistency]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For any two family instance modules that we import directly or indirectly, we
check whether the instances in the two modules are consistent, *unless* we can
be certain that the instances of the two modules have already been checked for
consistency during the compilation of modules that we import.
Why do we need to check? Consider
module X1 where module X2 where
data T1 data T2
type instance F T1 b = Int type instance F a T2 = Char
f1 :: F T1 a -> Int f2 :: Char -> F a T2
f1 x = x f2 x = x
Now if we import both X1 and X2 we could make (f2 . f1) :: Int -> Char.
Notice that neither instance is an orphan.
How do we know which pairs of modules have already been checked? For each
module M we directly import, we look up the family instance modules that M
imports (directly or indirectly), say F1, ..., FN. For any two modules
among M, F1, ..., FN, we know that the family instances defined in those
two modules are consistent--because we checked that when we compiled M.
For every other pair of family instance modules we import (directly or
indirectly), we check that they are consistent now. (So that we can be
certain that the modules in our `HscTypes.dep_finsts' are consistent.)
There is some fancy footwork regarding hs-boot module loops, see
Note [Don't check hs-boot type family instances too early]
Note [Checking family instance optimization]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
As explained in Note [Checking family instance consistency]
we need to ensure that every pair of transitive imports that define type family
instances is consistent.
Let's define df(A) = transitive imports of A that define type family instances
+ A, if A defines type family instances
Then for every direct import A, df(A) is already consistent.
Let's name the current module M.
We want to make sure that df(M) is consistent.
df(M) = df(D_1) U df(D_2) U ... U df(D_i) where D_1 .. D_i are direct imports.
We perform the check iteratively, maintaining a set of consistent modules 'C'
and trying to add df(D_i) to it.
The key part is how to ensure that the union C U df(D_i) is consistent.
Let's consider two modules: A and B from C U df(D_i).
There are nine possible ways to choose A and B from C U df(D_i):
| A in C only | A in C and B in df(D_i) | A in df(D_i) only
--------------------------------------------------------------------------------
B in C only | Already checked | Already checked | Needs to be checked
| when checking C | when checking C |
--------------------------------------------------------------------------------
B in C and | Already checked | Already checked | Already checked when
B in df(D_i) | when checking C | when checking C | checking df(D_i)
--------------------------------------------------------------------------------
B in df(D_i) | Needs to be | Already checked | Already checked when
only | checked | when checking df(D_i) | checking df(D_i)
That means to ensure that C U df(D_i) is consistent we need to check every
module from C - df(D_i) against every module from df(D_i) - C and
every module from df(D_i) - C against every module from C - df(D_i).
But since the checks are symmetric it suffices to pick A from C - df(D_i)
and B from df(D_i) - C.
In other words these are the modules we need to check:
[ (m1, m2) | m1 <- C, m1 not in df(D_i)
, m2 <- df(D_i), m2 not in C ]
One final thing to note here is that if there's lot of overlap between
subsequent df(D_i)'s then we expect those set differences to be small.
That situation should be pretty common in practice, there's usually
a set of utility modules that every module imports directly or indirectly.
This is basically the idea from #13092, comment:14.
-}
-- This function doesn't check ALL instances for consistency,
-- only ones that aren't involved in recursive knot-tying
-- loops; see Note [Don't check hs-boot type family instances too early].
-- We don't need to check the current module, this is done in
-- tcExtendLocalFamInstEnv.
-- See Note [The type family instance consistency story].
| 7,290
|
newFamInst :: FamFlavor -> CoAxiom Unbranched -> TcM FamInst
newFamInst flavor axiom@(CoAxiom { co_ax_tc = fam_tc })
= ASSERT2( tyCoVarsOfTypes lhs `subVarSet` tcv_set, text "lhs" <+> pp_ax )
ASSERT2( lhs_kind `eqType` rhs_kind, text "kind" <+> pp_ax $$ ppr lhs_kind $$ ppr rhs_kind )
-- We used to have an assertion that the tyvars of the RHS were bound
-- by tcv_set, but in error situations like F Int = a that isn't
-- true; a later check in checkValidFamInst rejects it
do { (subst, tvs') <- freshenTyVarBndrs tvs
; (subst, cvs') <- freshenCoVarBndrsX subst cvs
; dflags <- getDynFlags
; let lhs' = substTys subst lhs
rhs' = substTy subst rhs
tcvs' = tvs' ++ cvs'
; ifErrsM (return ()) $ -- Don't lint when there are errors, because
-- errors might mean TcTyCons.
-- See Note [Recover from validity error] in TcTyClsDecls
when (gopt Opt_DoCoreLinting dflags) $
-- Check that the types involved in this instance are well formed.
-- Do /not/ expand type synonyms, for the reasons discussed in
-- Note [Linting type synonym applications].
case lintTypes dflags tcvs' (rhs':lhs') of
Nothing -> pure ()
Just fail_msg -> pprPanic "Core Lint error" (vcat [ fail_msg
, ppr fam_tc
, ppr subst
, ppr tvs'
, ppr cvs'
, ppr lhs'
, ppr rhs' ])
; return (FamInst { fi_fam = tyConName fam_tc
, fi_flavor = flavor
, fi_tcs = roughMatchTcs lhs
, fi_tvs = tvs'
, fi_cvs = cvs'
, fi_tys = lhs'
, fi_rhs = rhs'
, fi_axiom = axiom }) }
where
lhs_kind = tcTypeKind (mkTyConApp fam_tc lhs)
rhs_kind = tcTypeKind rhs
tcv_set = mkVarSet (tvs ++ cvs)
pp_ax = pprCoAxiom axiom
CoAxBranch { cab_tvs = tvs
, cab_cvs = cvs
, cab_lhs = lhs
, cab_rhs = rhs } = coAxiomSingleBranch axiom
{-
************************************************************************
* *
Optimised overlap checking for family instances
* *
************************************************************************
Note [Checking family instance consistency]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For any two family instance modules that we import directly or indirectly, we
check whether the instances in the two modules are consistent, *unless* we can
be certain that the instances of the two modules have already been checked for
consistency during the compilation of modules that we import.
Why do we need to check? Consider
module X1 where module X2 where
data T1 data T2
type instance F T1 b = Int type instance F a T2 = Char
f1 :: F T1 a -> Int f2 :: Char -> F a T2
f1 x = x f2 x = x
Now if we import both X1 and X2 we could make (f2 . f1) :: Int -> Char.
Notice that neither instance is an orphan.
How do we know which pairs of modules have already been checked? For each
module M we directly import, we look up the family instance modules that M
imports (directly or indirectly), say F1, ..., FN. For any two modules
among M, F1, ..., FN, we know that the family instances defined in those
two modules are consistent--because we checked that when we compiled M.
For every other pair of family instance modules we import (directly or
indirectly), we check that they are consistent now. (So that we can be
certain that the modules in our `HscTypes.dep_finsts' are consistent.)
There is some fancy footwork regarding hs-boot module loops, see
Note [Don't check hs-boot type family instances too early]
Note [Checking family instance optimization]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
As explained in Note [Checking family instance consistency]
we need to ensure that every pair of transitive imports that define type family
instances is consistent.
Let's define df(A) = transitive imports of A that define type family instances
+ A, if A defines type family instances
Then for every direct import A, df(A) is already consistent.
Let's name the current module M.
We want to make sure that df(M) is consistent.
df(M) = df(D_1) U df(D_2) U ... U df(D_i) where D_1 .. D_i are direct imports.
We perform the check iteratively, maintaining a set of consistent modules 'C'
and trying to add df(D_i) to it.
The key part is how to ensure that the union C U df(D_i) is consistent.
Let's consider two modules: A and B from C U df(D_i).
There are nine possible ways to choose A and B from C U df(D_i):
| A in C only | A in C and B in df(D_i) | A in df(D_i) only
--------------------------------------------------------------------------------
B in C only | Already checked | Already checked | Needs to be checked
| when checking C | when checking C |
--------------------------------------------------------------------------------
B in C and | Already checked | Already checked | Already checked when
B in df(D_i) | when checking C | when checking C | checking df(D_i)
--------------------------------------------------------------------------------
B in df(D_i) | Needs to be | Already checked | Already checked when
only | checked | when checking df(D_i) | checking df(D_i)
That means to ensure that C U df(D_i) is consistent we need to check every
module from C - df(D_i) against every module from df(D_i) - C and
every module from df(D_i) - C against every module from C - df(D_i).
But since the checks are symmetric it suffices to pick A from C - df(D_i)
and B from df(D_i) - C.
In other words these are the modules we need to check:
[ (m1, m2) | m1 <- C, m1 not in df(D_i)
, m2 <- df(D_i), m2 not in C ]
One final thing to note here is that if there's lot of overlap between
subsequent df(D_i)'s then we expect those set differences to be small.
That situation should be pretty common in practice, there's usually
a set of utility modules that every module imports directly or indirectly.
This is basically the idea from #13092, comment:14.
-}
-- This function doesn't check ALL instances for consistency,
-- only ones that aren't involved in recursive knot-tying
-- loops; see Note [Don't check hs-boot type family instances too early].
-- We don't need to check the current module, this is done in
-- tcExtendLocalFamInstEnv.
-- See Note [The type family instance consistency story].
| 7,236
|
newFamInst flavor axiom@(CoAxiom { co_ax_tc = fam_tc })
= ASSERT2( tyCoVarsOfTypes lhs `subVarSet` tcv_set, text "lhs" <+> pp_ax )
ASSERT2( lhs_kind `eqType` rhs_kind, text "kind" <+> pp_ax $$ ppr lhs_kind $$ ppr rhs_kind )
-- We used to have an assertion that the tyvars of the RHS were bound
-- by tcv_set, but in error situations like F Int = a that isn't
-- true; a later check in checkValidFamInst rejects it
do { (subst, tvs') <- freshenTyVarBndrs tvs
; (subst, cvs') <- freshenCoVarBndrsX subst cvs
; dflags <- getDynFlags
; let lhs' = substTys subst lhs
rhs' = substTy subst rhs
tcvs' = tvs' ++ cvs'
; ifErrsM (return ()) $ -- Don't lint when there are errors, because
-- errors might mean TcTyCons.
-- See Note [Recover from validity error] in TcTyClsDecls
when (gopt Opt_DoCoreLinting dflags) $
-- Check that the types involved in this instance are well formed.
-- Do /not/ expand type synonyms, for the reasons discussed in
-- Note [Linting type synonym applications].
case lintTypes dflags tcvs' (rhs':lhs') of
Nothing -> pure ()
Just fail_msg -> pprPanic "Core Lint error" (vcat [ fail_msg
, ppr fam_tc
, ppr subst
, ppr tvs'
, ppr cvs'
, ppr lhs'
, ppr rhs' ])
; return (FamInst { fi_fam = tyConName fam_tc
, fi_flavor = flavor
, fi_tcs = roughMatchTcs lhs
, fi_tvs = tvs'
, fi_cvs = cvs'
, fi_tys = lhs'
, fi_rhs = rhs'
, fi_axiom = axiom }) }
where
lhs_kind = tcTypeKind (mkTyConApp fam_tc lhs)
rhs_kind = tcTypeKind rhs
tcv_set = mkVarSet (tvs ++ cvs)
pp_ax = pprCoAxiom axiom
CoAxBranch { cab_tvs = tvs
, cab_cvs = cvs
, cab_lhs = lhs
, cab_rhs = rhs } = coAxiomSingleBranch axiom
{-
************************************************************************
* *
Optimised overlap checking for family instances
* *
************************************************************************
Note [Checking family instance consistency]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For any two family instance modules that we import directly or indirectly, we
check whether the instances in the two modules are consistent, *unless* we can
be certain that the instances of the two modules have already been checked for
consistency during the compilation of modules that we import.
Why do we need to check? Consider
module X1 where module X2 where
data T1 data T2
type instance F T1 b = Int type instance F a T2 = Char
f1 :: F T1 a -> Int f2 :: Char -> F a T2
f1 x = x f2 x = x
Now if we import both X1 and X2 we could make (f2 . f1) :: Int -> Char.
Notice that neither instance is an orphan.
How do we know which pairs of modules have already been checked? For each
module M we directly import, we look up the family instance modules that M
imports (directly or indirectly), say F1, ..., FN. For any two modules
among M, F1, ..., FN, we know that the family instances defined in those
two modules are consistent--because we checked that when we compiled M.
For every other pair of family instance modules we import (directly or
indirectly), we check that they are consistent now. (So that we can be
certain that the modules in our `HscTypes.dep_finsts' are consistent.)
There is some fancy footwork regarding hs-boot module loops, see
Note [Don't check hs-boot type family instances too early]
Note [Checking family instance optimization]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
As explained in Note [Checking family instance consistency]
we need to ensure that every pair of transitive imports that define type family
instances is consistent.
Let's define df(A) = transitive imports of A that define type family instances
+ A, if A defines type family instances
Then for every direct import A, df(A) is already consistent.
Let's name the current module M.
We want to make sure that df(M) is consistent.
df(M) = df(D_1) U df(D_2) U ... U df(D_i) where D_1 .. D_i are direct imports.
We perform the check iteratively, maintaining a set of consistent modules 'C'
and trying to add df(D_i) to it.
The key part is how to ensure that the union C U df(D_i) is consistent.
Let's consider two modules: A and B from C U df(D_i).
There are nine possible ways to choose A and B from C U df(D_i):
| A in C only | A in C and B in df(D_i) | A in df(D_i) only
--------------------------------------------------------------------------------
B in C only | Already checked | Already checked | Needs to be checked
| when checking C | when checking C |
--------------------------------------------------------------------------------
B in C and | Already checked | Already checked | Already checked when
B in df(D_i) | when checking C | when checking C | checking df(D_i)
--------------------------------------------------------------------------------
B in df(D_i) | Needs to be | Already checked | Already checked when
only | checked | when checking df(D_i) | checking df(D_i)
That means to ensure that C U df(D_i) is consistent we need to check every
module from C - df(D_i) against every module from df(D_i) - C and
every module from df(D_i) - C against every module from C - df(D_i).
But since the checks are symmetric it suffices to pick A from C - df(D_i)
and B from df(D_i) - C.
In other words these are the modules we need to check:
[ (m1, m2) | m1 <- C, m1 not in df(D_i)
, m2 <- df(D_i), m2 not in C ]
One final thing to note here is that if there's lot of overlap between
subsequent df(D_i)'s then we expect those set differences to be small.
That situation should be pretty common in practice, there's usually
a set of utility modules that every module imports directly or indirectly.
This is basically the idea from #13092, comment:14.
-}
-- This function doesn't check ALL instances for consistency,
-- only ones that aren't involved in recursive knot-tying
-- loops; see Note [Don't check hs-boot type family instances too early].
-- We don't need to check the current module, this is done in
-- tcExtendLocalFamInstEnv.
-- See Note [The type family instance consistency story].
| 7,175
| true
| true
| 3
| 15
| 2,307
| 493
| 260
| 233
| null | null |
f1u77y/xmonad-contrib
|
XMonad/Config/Droundy.hs
|
bsd-3-clause
|
dropFromHead h s | take (length h) s == h = Just $ drop (length h) s
| otherwise = Nothing
| 107
|
dropFromHead h s | take (length h) s == h = Just $ drop (length h) s
| otherwise = Nothing
| 107
|
dropFromHead h s | take (length h) s == h = Just $ drop (length h) s
| otherwise = Nothing
| 107
| false
| false
| 0
| 11
| 37
| 63
| 27
| 36
| null | null |
diminishedprime/.org
|
programmey_stuff/write_yourself_a_scheme/ch_08/wyas/app/Parser.hs
|
mit
|
parseExpr :: Parser LispVal
parseExpr = parseAtom
<|> parseString
<|> try parseRatio
<|> try parseFloat
<|> try parseComplex
<|> try parseNumber
<|> try parseBool
<|> try parseCharacter
<|> parseQuasiQuoted
<|> parseUnQuote
<|> parseQuoted
<|> char '(' *> (try parseList <|> parseDottedList) <* char ')'
| 402
|
parseExpr :: Parser LispVal
parseExpr = parseAtom
<|> parseString
<|> try parseRatio
<|> try parseFloat
<|> try parseComplex
<|> try parseNumber
<|> try parseBool
<|> try parseCharacter
<|> parseQuasiQuoted
<|> parseUnQuote
<|> parseQuoted
<|> char '(' *> (try parseList <|> parseDottedList) <* char ')'
| 402
|
parseExpr = parseAtom
<|> parseString
<|> try parseRatio
<|> try parseFloat
<|> try parseComplex
<|> try parseNumber
<|> try parseBool
<|> try parseCharacter
<|> parseQuasiQuoted
<|> parseUnQuote
<|> parseQuoted
<|> char '(' *> (try parseList <|> parseDottedList) <* char ')'
| 374
| false
| true
| 35
| 8
| 142
| 140
| 70
| 70
| null | null |
sinelaw/cv-combinators
|
src/Test.hs
|
gpl-2.0
|
edges :: ImageProcessor
edges = canny 30 190 3
| 46
|
edges :: ImageProcessor
edges = canny 30 190 3
| 46
|
edges = canny 30 190 3
| 22
| false
| true
| 0
| 5
| 8
| 18
| 9
| 9
| null | null |
kmels/dart-haskell
|
examples/interpreter/Lists.hs
|
bsd-3-clause
|
mytake n (x:xs) = x : mytake (n-1) xs
| 47
|
mytake n (x:xs) = x : mytake (n-1) xs
| 47
|
mytake n (x:xs) = x : mytake (n-1) xs
| 47
| false
| false
| 2
| 7
| 18
| 37
| 17
| 20
| null | null |
bordaigorl/jamesbound
|
src/Language/PiCalc/Analysis/Hierarchical.hs
|
gpl-2.0
|
reach :: Ord n => AdjMap n -> (n, Set n) -> Either (Set n) (AdjMap n)
reach graph (n, adj)
| n ∊ new = Left $ Set.filter connected new
| otherwise = Right $ Map.mapWithKey insNew graph'
where
new = adj ∪ Set.unions [ adjacent x graph | x <- Set.elems adj ]
graph' = Map.insertWith (∪) n new graph
insNew x rs
| n ∊ rs = Set.union rs new
| otherwise = rs
connected x = adjacent x graph `intersects` new
| 448
|
reach :: Ord n => AdjMap n -> (n, Set n) -> Either (Set n) (AdjMap n)
reach graph (n, adj)
| n ∊ new = Left $ Set.filter connected new
| otherwise = Right $ Map.mapWithKey insNew graph'
where
new = adj ∪ Set.unions [ adjacent x graph | x <- Set.elems adj ]
graph' = Map.insertWith (∪) n new graph
insNew x rs
| n ∊ rs = Set.union rs new
| otherwise = rs
connected x = adjacent x graph `intersects` new
| 448
|
reach graph (n, adj)
| n ∊ new = Left $ Set.filter connected new
| otherwise = Right $ Map.mapWithKey insNew graph'
where
new = adj ∪ Set.unions [ adjacent x graph | x <- Set.elems adj ]
graph' = Map.insertWith (∪) n new graph
insNew x rs
| n ∊ rs = Set.union rs new
| otherwise = rs
connected x = adjacent x graph `intersects` new
| 378
| false
| true
| 5
| 11
| 131
| 241
| 109
| 132
| null | null |
futtetennista/IntroductionToFunctionalProgramming
|
itfp/src/Chapter3.hs
|
mit
|
rev2 xs =
xs
| 14
|
rev2 xs =
xs
| 14
|
rev2 xs =
xs
| 14
| false
| false
| 1
| 5
| 5
| 13
| 4
| 9
| null | null |
tjakway/ghcjvm
|
compiler/nativeGen/Dwarf/Constants.hs
|
bsd-3-clause
|
dW_CFA_same_value = 0x08
| 32
|
dW_CFA_same_value = 0x08
| 32
|
dW_CFA_same_value = 0x08
| 32
| false
| false
| 0
| 4
| 10
| 6
| 3
| 3
| null | null |
unisonweb/platform
|
parser-typechecker/src/Unison/Codebase/FileCodebase/Common.hs
|
mit
|
touchIdFile :: MonadIO m => Reference.Id -> FilePath -> m ()
touchIdFile id fp =
touchFile (fp </> encodeFileName (componentIdToString id))
| 141
|
touchIdFile :: MonadIO m => Reference.Id -> FilePath -> m ()
touchIdFile id fp =
touchFile (fp </> encodeFileName (componentIdToString id))
| 141
|
touchIdFile id fp =
touchFile (fp </> encodeFileName (componentIdToString id))
| 80
| false
| true
| 0
| 10
| 22
| 57
| 27
| 30
| null | null |
nightscape/platform
|
shared/src/Unison/ABT.hs
|
mit
|
freshNamed' :: Var v => Set v -> Text -> v
freshNamed' used n = fresh' used (v' n)
| 82
|
freshNamed' :: Var v => Set v -> Text -> v
freshNamed' used n = fresh' used (v' n)
| 82
|
freshNamed' used n = fresh' used (v' n)
| 39
| false
| true
| 0
| 7
| 18
| 45
| 21
| 24
| null | null |
bitemyapp/machines
|
src/Data/Machine/Process.hs
|
bsd-3-clause
|
-- | Feed a 'Process' some input.
supply :: forall f m a b . (Foldable f, Monad m) => f a -> ProcessT m a b -> ProcessT m a b
supply xs = foldr go id xs
where
go :: a ->
(ProcessT m a b -> ProcessT m a b) ->
ProcessT m a b ->
ProcessT m a b
go x r m = MachineT $ do
v <- runMachineT m
case v of
Stop -> return Stop
Await f Refl _ -> runMachineT $ r (f x)
Yield o k -> return $ Yield o (go x r k)
-- |
-- Convert a machine into a process, with a little bit of help.
--
-- @
-- 'process' 'Data.Machine.Tee.L' :: 'Data.Machine.Process.Process' a c -> 'Data.Machine.Tee.Tee' a b c
-- 'process' 'Data.Machine.Tee.R' :: 'Data.Machine.Process.Process' b c -> 'Data.Machine.Tee.Tee' a b c
-- 'process' 'id' :: 'Data.Machine.Process.Process' a b -> 'Data.Machine.Process.Process' a b
-- @
| 883
|
supply :: forall f m a b . (Foldable f, Monad m) => f a -> ProcessT m a b -> ProcessT m a b
supply xs = foldr go id xs
where
go :: a ->
(ProcessT m a b -> ProcessT m a b) ->
ProcessT m a b ->
ProcessT m a b
go x r m = MachineT $ do
v <- runMachineT m
case v of
Stop -> return Stop
Await f Refl _ -> runMachineT $ r (f x)
Yield o k -> return $ Yield o (go x r k)
-- |
-- Convert a machine into a process, with a little bit of help.
--
-- @
-- 'process' 'Data.Machine.Tee.L' :: 'Data.Machine.Process.Process' a c -> 'Data.Machine.Tee.Tee' a b c
-- 'process' 'Data.Machine.Tee.R' :: 'Data.Machine.Process.Process' b c -> 'Data.Machine.Tee.Tee' a b c
-- 'process' 'id' :: 'Data.Machine.Process.Process' a b -> 'Data.Machine.Process.Process' a b
-- @
| 849
|
supply xs = foldr go id xs
where
go :: a ->
(ProcessT m a b -> ProcessT m a b) ->
ProcessT m a b ->
ProcessT m a b
go x r m = MachineT $ do
v <- runMachineT m
case v of
Stop -> return Stop
Await f Refl _ -> runMachineT $ r (f x)
Yield o k -> return $ Yield o (go x r k)
-- |
-- Convert a machine into a process, with a little bit of help.
--
-- @
-- 'process' 'Data.Machine.Tee.L' :: 'Data.Machine.Process.Process' a c -> 'Data.Machine.Tee.Tee' a b c
-- 'process' 'Data.Machine.Tee.R' :: 'Data.Machine.Process.Process' b c -> 'Data.Machine.Tee.Tee' a b c
-- 'process' 'id' :: 'Data.Machine.Process.Process' a b -> 'Data.Machine.Process.Process' a b
-- @
| 757
| true
| true
| 2
| 14
| 262
| 243
| 117
| 126
| null | null |
sdiehl/ghc
|
compiler/coreSyn/PprCore.hs
|
bsd-3-clause
|
pprUntypedBinder :: Var -> SDoc
pprUntypedBinder binder
| isTyVar binder = text "@" <> ppr binder -- NB: don't print kind
| otherwise = pprIdBndr binder
| 164
|
pprUntypedBinder :: Var -> SDoc
pprUntypedBinder binder
| isTyVar binder = text "@" <> ppr binder -- NB: don't print kind
| otherwise = pprIdBndr binder
| 164
|
pprUntypedBinder binder
| isTyVar binder = text "@" <> ppr binder -- NB: don't print kind
| otherwise = pprIdBndr binder
| 132
| false
| true
| 1
| 8
| 37
| 48
| 22
| 26
| null | null |
olsner/ghc
|
testsuite/tests/programs/galois_raytrace/Interval.hs
|
bsd-3-clause
|
cmpI :: Intersection a -> Intersection a -> Ordering
cmpI (i, _, _) (j, _, _)
| i `near` j = EQ
| i < j = LT
| otherwise = GT
| 137
|
cmpI :: Intersection a -> Intersection a -> Ordering
cmpI (i, _, _) (j, _, _)
| i `near` j = EQ
| i < j = LT
| otherwise = GT
| 137
|
cmpI (i, _, _) (j, _, _)
| i `near` j = EQ
| i < j = LT
| otherwise = GT
| 84
| false
| true
| 2
| 8
| 43
| 81
| 42
| 39
| null | null |
ice1000/OI-codes
|
codewars/301-400/esolang-interpreters-number-3-custom-paintf-star-star-k-interpreter-giveup.hs
|
agpl-3.0
|
interpreter code x y = undefined
where initialize x y = take y $ repeat $ const 0 <$> [1..x]
--
| 97
|
interpreter code x y = undefined
where initialize x y = take y $ repeat $ const 0 <$> [1..x]
--
| 97
|
interpreter code x y = undefined
where initialize x y = take y $ repeat $ const 0 <$> [1..x]
--
| 97
| false
| false
| 0
| 8
| 22
| 49
| 24
| 25
| null | null |
ecaustin/haskhol-core
|
src/HaskHOL/Core/State.hs
|
bsd-2-clause
|
mkBinary :: (HOLTermRep tm1 cls thry, HOLTermRep tm2 cls thry)
=> Text -> tm1 -> tm2 -> HOL cls thry HOLTerm
mkBinary op = let ?constsFun = constants in overload2 (O.mkBinary op)
| 187
|
mkBinary :: (HOLTermRep tm1 cls thry, HOLTermRep tm2 cls thry)
=> Text -> tm1 -> tm2 -> HOL cls thry HOLTerm
mkBinary op = let ?constsFun = constants in overload2 (O.mkBinary op)
| 187
|
mkBinary op = let ?constsFun = constants in overload2 (O.mkBinary op)
| 69
| false
| true
| 0
| 10
| 40
| 82
| 39
| 43
| null | null |
codygman/Frames
|
demo/TimeZones/src/TimeIn.hs
|
bsd-3-clause
|
-- | Try to parse a 'LocalTime' value using common formats.
parseLocalTime :: MonadPlus m => T.Text -> m LocalTime
parseLocalTime t = msum (map (($ T.unpack t) . mkParser) formats)
where formats = ["%F %T", "%F"]
mkParser = parseTimeM True defaultTimeLocale
-- | @zonedTime "America/Chicago"@ will create a 'Parseable' instance
-- for the type @TimeIn "America/Chicago"@. You can then use this type
-- when loading data.
| 431
|
parseLocalTime :: MonadPlus m => T.Text -> m LocalTime
parseLocalTime t = msum (map (($ T.unpack t) . mkParser) formats)
where formats = ["%F %T", "%F"]
mkParser = parseTimeM True defaultTimeLocale
-- | @zonedTime "America/Chicago"@ will create a 'Parseable' instance
-- for the type @TimeIn "America/Chicago"@. You can then use this type
-- when loading data.
| 371
|
parseLocalTime t = msum (map (($ T.unpack t) . mkParser) formats)
where formats = ["%F %T", "%F"]
mkParser = parseTimeM True defaultTimeLocale
-- | @zonedTime "America/Chicago"@ will create a 'Parseable' instance
-- for the type @TimeIn "America/Chicago"@. You can then use this type
-- when loading data.
| 316
| true
| true
| 1
| 12
| 77
| 86
| 45
| 41
| null | null |
janschulz/pandoc
|
src/Text/Pandoc/Readers/Markdown.hs
|
gpl-2.0
|
trimInlinesF :: F Inlines -> F Inlines
trimInlinesF = liftM trimInlines
| 71
|
trimInlinesF :: F Inlines -> F Inlines
trimInlinesF = liftM trimInlines
| 71
|
trimInlinesF = liftM trimInlines
| 32
| false
| true
| 0
| 6
| 10
| 24
| 11
| 13
| null | null |
Happstack/happstack-server
|
src/Happstack/Server/RqData.hs
|
bsd-3-clause
|
apEither :: (Monoid e) => Either e (a -> b) -> Either e a -> Either e b
apEither (Left errs1) (Left errs2) = Left (errs1 `mappend` errs2)
| 137
|
apEither :: (Monoid e) => Either e (a -> b) -> Either e a -> Either e b
apEither (Left errs1) (Left errs2) = Left (errs1 `mappend` errs2)
| 137
|
apEither (Left errs1) (Left errs2) = Left (errs1 `mappend` errs2)
| 65
| false
| true
| 0
| 9
| 27
| 79
| 40
| 39
| null | null |
jeremyong/Yaiba
|
Yaiba/Monomial.hs
|
bsd-3-clause
|
gcdMon Constant _ = Constant
| 35
|
gcdMon Constant _ = Constant
| 35
|
gcdMon Constant _ = Constant
| 35
| false
| false
| 0
| 5
| 11
| 11
| 5
| 6
| null | null |
5outh/textlunky
|
src/Types/Entity.hs
|
mit
|
canPickUp (Item' _) = True
| 32
|
canPickUp (Item' _) = True
| 32
|
canPickUp (Item' _) = True
| 32
| false
| false
| 0
| 6
| 10
| 16
| 7
| 9
| null | null |
JamieBeverley/InnerEar
|
src/InnerEar/Types/Data.hs
|
gpl-3.0
|
toDatum :: (JSON c, JSON q, JSON a, JSON e, JSON s) => ExerciseDatum -> Result (Datum c q a e s)
toDatum ExerciseStarted = return Started
| 137
|
toDatum :: (JSON c, JSON q, JSON a, JSON e, JSON s) => ExerciseDatum -> Result (Datum c q a e s)
toDatum ExerciseStarted = return Started
| 137
|
toDatum ExerciseStarted = return Started
| 40
| false
| true
| 0
| 9
| 26
| 71
| 35
| 36
| null | null |
technogeeky/d-A
|
include/containers-0.5.0.0/Data/Map/Base.hs
|
gpl-3.0
|
maxViewWithKey x = Just (deleteFindMax x)
| 43
|
maxViewWithKey x = Just (deleteFindMax x)
| 43
|
maxViewWithKey x = Just (deleteFindMax x)
| 43
| false
| false
| 1
| 7
| 7
| 22
| 8
| 14
| null | null |
UCSD-PL/RefScript
|
src/Language/Rsc/SSA/SSA.hs
|
bsd-3-clause
|
ssaStmt g (WhileStmt l cnd body) = do
(gc, sc, cnd') <- ssaExpr g cnd
-- Do not allow updates in the conditional
unless (null sc) (ssaError $ errorUpdateInExpr (srcPos l) cnd)
(gNopt, body') <- ssaStmt gc body
case gNopt of
Just gN -> do
let (_, δ, ν) = envProgress (mSSA g) (mSSA gN)
let gN' = removeSsaVars ν gN
mapM_ (addAnn l . PhiLoop) (envValues δ)
return (Just gN', WhileStmt l cnd' body')
Nothing ->
return (Just gc, WhileStmt l cnd' body')
| 538
|
ssaStmt g (WhileStmt l cnd body) = do
(gc, sc, cnd') <- ssaExpr g cnd
-- Do not allow updates in the conditional
unless (null sc) (ssaError $ errorUpdateInExpr (srcPos l) cnd)
(gNopt, body') <- ssaStmt gc body
case gNopt of
Just gN -> do
let (_, δ, ν) = envProgress (mSSA g) (mSSA gN)
let gN' = removeSsaVars ν gN
mapM_ (addAnn l . PhiLoop) (envValues δ)
return (Just gN', WhileStmt l cnd' body')
Nothing ->
return (Just gc, WhileStmt l cnd' body')
| 538
|
ssaStmt g (WhileStmt l cnd body) = do
(gc, sc, cnd') <- ssaExpr g cnd
-- Do not allow updates in the conditional
unless (null sc) (ssaError $ errorUpdateInExpr (srcPos l) cnd)
(gNopt, body') <- ssaStmt gc body
case gNopt of
Just gN -> do
let (_, δ, ν) = envProgress (mSSA g) (mSSA gN)
let gN' = removeSsaVars ν gN
mapM_ (addAnn l . PhiLoop) (envValues δ)
return (Just gN', WhileStmt l cnd' body')
Nothing ->
return (Just gc, WhileStmt l cnd' body')
| 538
| false
| false
| 0
| 17
| 173
| 230
| 110
| 120
| null | null |
shockkolate/containers
|
Data/IntMap/Base.hs
|
bsd-3-clause
|
updateMaxWithKey :: (Key -> a -> Maybe a) -> IntMap a -> IntMap a
updateMaxWithKey f t =
case t of Bin p m l r | m < 0 -> bin p m (go f l) r
_ -> go f t
where
go f' (Bin p m l r) = bin p m l (go f' r)
go f' (Tip k y) = case f' k y of
Just y' -> Tip k y'
Nothing -> Nil
go _ Nil = error "updateMaxWithKey Nil"
-- | /O(min(n,W))/. Retrieves the maximal (key,value) pair of the map, and
-- the map stripped of that element, or 'Nothing' if passed an empty map.
--
-- > maxViewWithKey (fromList [(5,"a"), (3,"b")]) == Just ((5,"a"), singleton 3 "b")
-- > maxViewWithKey empty == Nothing
| 659
|
updateMaxWithKey :: (Key -> a -> Maybe a) -> IntMap a -> IntMap a
updateMaxWithKey f t =
case t of Bin p m l r | m < 0 -> bin p m (go f l) r
_ -> go f t
where
go f' (Bin p m l r) = bin p m l (go f' r)
go f' (Tip k y) = case f' k y of
Just y' -> Tip k y'
Nothing -> Nil
go _ Nil = error "updateMaxWithKey Nil"
-- | /O(min(n,W))/. Retrieves the maximal (key,value) pair of the map, and
-- the map stripped of that element, or 'Nothing' if passed an empty map.
--
-- > maxViewWithKey (fromList [(5,"a"), (3,"b")]) == Just ((5,"a"), singleton 3 "b")
-- > maxViewWithKey empty == Nothing
| 659
|
updateMaxWithKey f t =
case t of Bin p m l r | m < 0 -> bin p m (go f l) r
_ -> go f t
where
go f' (Bin p m l r) = bin p m l (go f' r)
go f' (Tip k y) = case f' k y of
Just y' -> Tip k y'
Nothing -> Nil
go _ Nil = error "updateMaxWithKey Nil"
-- | /O(min(n,W))/. Retrieves the maximal (key,value) pair of the map, and
-- the map stripped of that element, or 'Nothing' if passed an empty map.
--
-- > maxViewWithKey (fromList [(5,"a"), (3,"b")]) == Just ((5,"a"), singleton 3 "b")
-- > maxViewWithKey empty == Nothing
| 593
| false
| true
| 1
| 11
| 207
| 219
| 101
| 118
| null | null |
mrmonday/Idris-dev
|
src/IRTS/JavaScript/AST.hs
|
bsd-3-clause
|
compileJS' indent (JSNum num)
| JSInt i <- num = T.pack (show i)
| JSFloat f <- num = T.pack (show f)
| JSInteger JSBigZero <- num = T.pack "i$ZERO"
| JSInteger JSBigOne <- num = T.pack "i$ONE"
| JSInteger (JSBigInt i) <- num = T.pack (show i)
| JSInteger (JSBigIntExpr e) <- num =
"i$bigInt(" `T.append` compileJS' indent e `T.append` ")"
| 412
|
compileJS' indent (JSNum num)
| JSInt i <- num = T.pack (show i)
| JSFloat f <- num = T.pack (show f)
| JSInteger JSBigZero <- num = T.pack "i$ZERO"
| JSInteger JSBigOne <- num = T.pack "i$ONE"
| JSInteger (JSBigInt i) <- num = T.pack (show i)
| JSInteger (JSBigIntExpr e) <- num =
"i$bigInt(" `T.append` compileJS' indent e `T.append` ")"
| 412
|
compileJS' indent (JSNum num)
| JSInt i <- num = T.pack (show i)
| JSFloat f <- num = T.pack (show f)
| JSInteger JSBigZero <- num = T.pack "i$ZERO"
| JSInteger JSBigOne <- num = T.pack "i$ONE"
| JSInteger (JSBigInt i) <- num = T.pack (show i)
| JSInteger (JSBigIntExpr e) <- num =
"i$bigInt(" `T.append` compileJS' indent e `T.append` ")"
| 412
| false
| false
| 0
| 11
| 134
| 197
| 90
| 107
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.