Search is not available for this dataset
repo_name
string | path
string | license
string | full_code
string | full_size
int64 | uncommented_code
string | uncommented_size
int64 | function_only_code
string | function_only_size
int64 | is_commented
bool | is_signatured
bool | n_ast_errors
int64 | ast_max_depth
int64 | n_whitespaces
int64 | n_ast_nodes
int64 | n_ast_terminals
int64 | n_ast_nonterminals
int64 | loc
int64 | cycloplexity
int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
acowley/ghc
|
compiler/basicTypes/Unique.hs
|
bsd-3-clause
|
mkRegPairUnique = mkUnique 'P'
| 32
|
mkRegPairUnique = mkUnique 'P'
| 32
|
mkRegPairUnique = mkUnique 'P'
| 32
| false
| false
| 0
| 5
| 5
| 9
| 4
| 5
| null | null |
cmahon/opengl-examples
|
library/Util.hs
|
bsd-3-clause
|
isPress :: GLFW.KeyState -> Bool
isPress GLFW.KeyState'Pressed = True
| 71
|
isPress :: GLFW.KeyState -> Bool
isPress GLFW.KeyState'Pressed = True
| 71
|
isPress GLFW.KeyState'Pressed = True
| 38
| false
| true
| 0
| 6
| 10
| 22
| 11
| 11
| null | null |
zerobuzz/webtest
|
src/Test/WebApp/HTTP/Util.hs
|
agpl-3.0
|
-- | Process response, force response code 2xx and drop result entirely.
assertResponse :: Bool -> Response LBS -> ()
assertResponse verbose_ response =
maybe (error "giving up") (const ()) $
(processResponse verbose_ response :: Maybe JS.Value)
| 255
|
assertResponse :: Bool -> Response LBS -> ()
assertResponse verbose_ response =
maybe (error "giving up") (const ()) $
(processResponse verbose_ response :: Maybe JS.Value)
| 182
|
assertResponse verbose_ response =
maybe (error "giving up") (const ()) $
(processResponse verbose_ response :: Maybe JS.Value)
| 137
| true
| true
| 0
| 9
| 46
| 69
| 34
| 35
| null | null |
wyager/GeoLabel
|
src/GeoLabel/Test.hs
|
bsd-3-clause
|
locTest = forAll (choose (0,19)) $ \face ->
forAll (vectorOf 25 (elements [A,B,C,D])) $ \subfaces ->
let loc = Location face subfaces in
loc == (fromJust . parse . format $ loc)
| 201
|
locTest = forAll (choose (0,19)) $ \face ->
forAll (vectorOf 25 (elements [A,B,C,D])) $ \subfaces ->
let loc = Location face subfaces in
loc == (fromJust . parse . format $ loc)
| 201
|
locTest = forAll (choose (0,19)) $ \face ->
forAll (vectorOf 25 (elements [A,B,C,D])) $ \subfaces ->
let loc = Location face subfaces in
loc == (fromJust . parse . format $ loc)
| 201
| false
| false
| 2
| 11
| 55
| 108
| 55
| 53
| null | null |
xuwei-k/kan-extensions
|
src/Control/Comonad/Density.hs
|
bsd-3-clause
|
densityToLan :: Density f a -> Lan f f a
densityToLan (Density f v) = Lan f v
| 77
|
densityToLan :: Density f a -> Lan f f a
densityToLan (Density f v) = Lan f v
| 77
|
densityToLan (Density f v) = Lan f v
| 36
| false
| true
| 0
| 6
| 17
| 47
| 21
| 26
| null | null |
pairyo/elm-compiler
|
src/Parse/Helpers.hs
|
bsd-3-clause
|
commaSep1 :: IParser a -> IParser [a]
commaSep1 =
spaceySepBy1 comma
| 70
|
commaSep1 :: IParser a -> IParser [a]
commaSep1 =
spaceySepBy1 comma
| 70
|
commaSep1 =
spaceySepBy1 comma
| 32
| false
| true
| 0
| 8
| 12
| 33
| 14
| 19
| null | null |
chrisbanks/cpiwb
|
profileMC3.hs
|
gpl-3.0
|
f10 = Pos (0,infty) f6
| 22
|
f10 = Pos (0,infty) f6
| 22
|
f10 = Pos (0,infty) f6
| 22
| false
| false
| 0
| 6
| 4
| 17
| 9
| 8
| null | null |
gcampax/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
runMainKey = mkPreludeMiscIdUnique 102
| 57
|
runMainKey = mkPreludeMiscIdUnique 102
| 57
|
runMainKey = mkPreludeMiscIdUnique 102
| 57
| false
| false
| 0
| 5
| 22
| 9
| 4
| 5
| null | null |
ml9951/ghc
|
utils/deriveConstants/DeriveConstants.hs
|
bsd-3-clause
|
structFieldH :: Where -> String -> String -> Wanteds
structFieldH w = structFieldHelper w w
| 91
|
structFieldH :: Where -> String -> String -> Wanteds
structFieldH w = structFieldHelper w w
| 91
|
structFieldH w = structFieldHelper w w
| 38
| false
| true
| 0
| 9
| 14
| 36
| 16
| 20
| null | null |
sdiehl/ghc
|
compiler/typecheck/TcOrigin.hs
|
bsd-3-clause
|
pprUserTypeCtxt GenSigCtxt = text "a type expected by the context"
| 73
|
pprUserTypeCtxt GenSigCtxt = text "a type expected by the context"
| 73
|
pprUserTypeCtxt GenSigCtxt = text "a type expected by the context"
| 73
| false
| false
| 0
| 5
| 16
| 12
| 5
| 7
| null | null |
forked-upstream-packages-for-ghcjs/ghcjs
|
ghcjs/src/Gen2/Optimizer.hs
|
mit
|
isConst (ValE (StrV _)) = True
| 30
|
isConst (ValE (StrV _)) = True
| 30
|
isConst (ValE (StrV _)) = True
| 30
| false
| false
| 0
| 9
| 5
| 21
| 10
| 11
| null | null |
DaMSL/K3
|
src/Language/K3/Parser.hs
|
apache-2.0
|
optWithProperties :: (Eq (Annotation a))
=> String -> Bool -> K3Parser [Annotation a] -> K3Parser (Maybe (K3 a)) -> K3Parser (Maybe (K3 a))
optWithProperties sfx asPrefix prop tree = withPropertiesF sfx asPrefix prop tree attachOpt
where attachOpt treeOpt anns = maybe Nothing (\t -> Just $ foldl (@+) t anns) treeOpt
| 337
|
optWithProperties :: (Eq (Annotation a))
=> String -> Bool -> K3Parser [Annotation a] -> K3Parser (Maybe (K3 a)) -> K3Parser (Maybe (K3 a))
optWithProperties sfx asPrefix prop tree = withPropertiesF sfx asPrefix prop tree attachOpt
where attachOpt treeOpt anns = maybe Nothing (\t -> Just $ foldl (@+) t anns) treeOpt
| 337
|
optWithProperties sfx asPrefix prop tree = withPropertiesF sfx asPrefix prop tree attachOpt
where attachOpt treeOpt anns = maybe Nothing (\t -> Just $ foldl (@+) t anns) treeOpt
| 179
| false
| true
| 1
| 15
| 70
| 150
| 71
| 79
| null | null |
wiggly/functional-pokering
|
src/Cards.hs
|
mit
|
suits :: [Suit]
suits = [Spades .. Clubs]
| 41
|
suits :: [Suit]
suits = [Spades .. Clubs]
| 41
|
suits = [Spades .. Clubs]
| 25
| false
| true
| 0
| 5
| 7
| 20
| 12
| 8
| null | null |
justinethier/husk-scheme
|
hs-src/Language/Scheme/Core.hs
|
mit
|
evalAndPrint :: Env -> String -> IO ()
evalAndPrint env expr = evalString env expr >>= putStrLn
| 95
|
evalAndPrint :: Env -> String -> IO ()
evalAndPrint env expr = evalString env expr >>= putStrLn
| 95
|
evalAndPrint env expr = evalString env expr >>= putStrLn
| 56
| false
| true
| 0
| 8
| 16
| 38
| 18
| 20
| null | null |
jpvillaisaza/slack-web
|
src/Web/Slack/Classy.hs
|
mit
|
apiTest
:: (MonadReader env m, HasManager env, MonadIO m)
=> Api.TestReq
-> m (Response Api.TestRsp)
apiTest = liftToReader . flip (NonClassy.apiTest . getManager)
| 169
|
apiTest
:: (MonadReader env m, HasManager env, MonadIO m)
=> Api.TestReq
-> m (Response Api.TestRsp)
apiTest = liftToReader . flip (NonClassy.apiTest . getManager)
| 169
|
apiTest = liftToReader . flip (NonClassy.apiTest . getManager)
| 62
| false
| true
| 1
| 11
| 28
| 74
| 35
| 39
| null | null |
rvion/lamdu
|
Lamdu/Eval/ToExpr.hs
|
gpl-3.0
|
fromThunkId :: Monad m => ThunkId -> EvalT pl m (Val ())
fromThunkId t = whnfThunk t >>= fromValHead
| 100
|
fromThunkId :: Monad m => ThunkId -> EvalT pl m (Val ())
fromThunkId t = whnfThunk t >>= fromValHead
| 100
|
fromThunkId t = whnfThunk t >>= fromValHead
| 43
| false
| true
| 0
| 11
| 18
| 51
| 23
| 28
| null | null |
wavewave/HROOT
|
HROOT-generate/lib/HROOT/Data/Hist/Class.hs
|
gpl-3.0
|
{-
tFormula :: Class
tFormula = histclass "TFormula" [tNamed] mempty
[ Constructor [cstring "name", cstring "formula"] Nothing
, NonVirtual void_ "Optimize" [] Nothing
-- Analyze
-- AnalyzeFunction
-- , Virtual int_ "Compile" [cstring "expression"] Nothing
, Virtual void_ "Clear" [cstring "option"] Nothing
-- DefinedString
, Virtual double_ "DefinedValue" [int "code"] Nothing
-- DefinedVariable
, Virtual double_ "Eval" [double "x", double "y", double "z", double "t"] Nothing
-- , Virtual double_ "EvalParOld" [doublep "x", doublep "params"] Nothing
, Virtual double_ "EvalPar" [doublep "x", doublep "params"] Nothing
-- GetLinearPart
, Virtual int_ "GetNdim" [] Nothing
, Virtual int_ "GetNpar" [] Nothing
, Virtual int_ "GetNumber" [] Nothing
-- GetExpFormula
, NonVirtual double_ "GetParameter" [cstring "name" ] Nothing
-- GetParameters
-- GetParName
, Virtual int_ "GetParNumber" [cstring "name"] Nothing
, Virtual bool_ "IsLinear" [] Nothing
-- , Virtual bool_ "IsNormalized" [] Nothing
-- ProcessLinear
-- , Virtual void_ "SetNumber" [int "number"] Nothing
, Virtual void_ "SetParameter" [cstring "name", double "parvalue"] Nothing
, Virtual void_ "SetParameters" [doublep "params"] Nothing
, Virtual void_ "SetParName" [int "ipar", cstring "name"] Nothing
, Virtual void_ "SetParNames" [cstring "name0", cstring "name1", cstring "name2"
,cstring "name3", cstring "name4", cstring "name5"
,cstring "name6", cstring "name7", cstring "name8"
,cstring "name9", cstring "name10" ] Nothing
, Virtual void_ "Update" [] Nothing
-- SetMaxima
]
-}
----------------
-- starting G --
----------------
tGraph :: Class
tGraph =
histclass "TGraph" [tNamed, tAttLine, tAttFill, tAttMarker] (Protected [])
[ Constructor [int "n", doublep "x", doublep "y"] Nothing
, Virtual void_ "Apply" [cppclass tF1 "f"] Nothing
, Virtual double_ "Chisquare" [cppclass tF1 "f1"] Nothing
-- CompareArg
-- CompareX
-- CompareY
-- CompareRadius
-- ComputeRange
, Virtual void_ "DrawGraph" [int "n", doublep "x", doublep "y", cstring "option"] Nothing
, Virtual void_ "DrawPanel" [] (Just "drawPanelTGraph")
-- Eval
, Virtual void_ "Expand" [int "newsize", int "step"] Nothing
-- Fit
, Virtual void_ "FitPanel" [] (Just "FitPanelTGraph")
, NonVirtual bool_ "GetEditable" [] Nothing
, NonVirtual (cppclass_ tF1) "GetFunction" [cstring "name"] Nothing
, NonVirtual (cppclass_ tH1F) "GetHistogram" [] Nothing
-- , NonVirtual (cppclass_ "TList") "GetListOfFunctions" []
, Virtual double_ "GetCorrelationFactor" [] (Just "getCorrelationFactorTGraph")
, Virtual double_ "GetCovariance" [] (Just "getCovarianceTGraph")
, Virtual double_ "GetMean" [int "axis"] (Just "getMeanTGraph")
, Virtual double_ "GetRMS" [int "axis"] (Just "getRMSTGraph")
, NonVirtual int_ "GetMaxSize" [] Nothing
, NonVirtual int_ "GetN" [] Nothing
, Virtual double_ "GetErrorX" [int "bin"] Nothing
, Virtual double_ "GetErrorY" [int "bin"] Nothing
, Virtual double_ "GetErrorXhigh" [int "bin"] Nothing
, Virtual double_ "GetErrorXlow" [int "bin"] Nothing
, Virtual double_ "GetErrorYhigh" [int "bin"] Nothing
, Virtual double_ "GetErrorYlow" [int "bin"] Nothing
-- GetX
-- GetY
-- GetEX
-- GetEY
-- omit..
, NonVirtual double_ "GetMaximum" [] Nothing
, NonVirtual double_ "GetMinimum" [] Nothing
, NonVirtual (cppclass_ tAxis) "GetXaxis" [] Nothing
, NonVirtual (cppclass_ tAxis) "GetYaxis" [] Nothing
-- GetPoint
, Virtual void_ "InitExpo" [double "xmin", double "xmax"] Nothing
, Virtual void_ "InitGaus" [double "xmin", double "xmax"] Nothing
, Virtual void_ "InitPolynom" [double "xmin", double "xmax"] Nothing
, Virtual int_ "InsertPoint" [] Nothing
, Virtual double_ "Integral" [int "first", int "last"] (Just "integralTGraph")
, Virtual bool_ "IsEditable" [] Nothing
, Virtual int_ "IsInside" [double "x", double "y"] (Just "isInsideTGraph")
, Virtual void_ "LeastSquareFit" [int "m", doublep "a", double "xmin", double "xmax"] Nothing
-- LeastSquareLinearFit
, NonVirtual void_ "PaintGraph" [int "npoints", doublep "x", doublep "y", cstring "chopt"] Nothing
, NonVirtual void_ "PaintGrapHist" [int "npoints", doublep "x", doublep "y", cstring "chopt"] Nothing
, Virtual void_ "PaintStats" [cppclass tF1 "fit"] Nothing
, Virtual int_ "RemovePoint" [int "ipoint"] Nothing
, Virtual void_ "SetEditable" [bool "editable"] Nothing
, Virtual void_ "SetHistogram" [cppclass tH1F "h"] Nothing
, Virtual void_ "SetMaximum" [double "maximum"] (Just "setMaximumTGraph")
, Virtual void_ "SetMinimum" [double "minimum"] (Just "setMinimumTGraph")
, Virtual void_ "Set" [int "n"] Nothing
, Virtual void_ "SetPoint" [int "i", double "x", double "y"] Nothing
-- Zero
]
| 5,223
|
tGraph :: Class
tGraph =
histclass "TGraph" [tNamed, tAttLine, tAttFill, tAttMarker] (Protected [])
[ Constructor [int "n", doublep "x", doublep "y"] Nothing
, Virtual void_ "Apply" [cppclass tF1 "f"] Nothing
, Virtual double_ "Chisquare" [cppclass tF1 "f1"] Nothing
-- CompareArg
-- CompareX
-- CompareY
-- CompareRadius
-- ComputeRange
, Virtual void_ "DrawGraph" [int "n", doublep "x", doublep "y", cstring "option"] Nothing
, Virtual void_ "DrawPanel" [] (Just "drawPanelTGraph")
-- Eval
, Virtual void_ "Expand" [int "newsize", int "step"] Nothing
-- Fit
, Virtual void_ "FitPanel" [] (Just "FitPanelTGraph")
, NonVirtual bool_ "GetEditable" [] Nothing
, NonVirtual (cppclass_ tF1) "GetFunction" [cstring "name"] Nothing
, NonVirtual (cppclass_ tH1F) "GetHistogram" [] Nothing
-- , NonVirtual (cppclass_ "TList") "GetListOfFunctions" []
, Virtual double_ "GetCorrelationFactor" [] (Just "getCorrelationFactorTGraph")
, Virtual double_ "GetCovariance" [] (Just "getCovarianceTGraph")
, Virtual double_ "GetMean" [int "axis"] (Just "getMeanTGraph")
, Virtual double_ "GetRMS" [int "axis"] (Just "getRMSTGraph")
, NonVirtual int_ "GetMaxSize" [] Nothing
, NonVirtual int_ "GetN" [] Nothing
, Virtual double_ "GetErrorX" [int "bin"] Nothing
, Virtual double_ "GetErrorY" [int "bin"] Nothing
, Virtual double_ "GetErrorXhigh" [int "bin"] Nothing
, Virtual double_ "GetErrorXlow" [int "bin"] Nothing
, Virtual double_ "GetErrorYhigh" [int "bin"] Nothing
, Virtual double_ "GetErrorYlow" [int "bin"] Nothing
-- GetX
-- GetY
-- GetEX
-- GetEY
-- omit..
, NonVirtual double_ "GetMaximum" [] Nothing
, NonVirtual double_ "GetMinimum" [] Nothing
, NonVirtual (cppclass_ tAxis) "GetXaxis" [] Nothing
, NonVirtual (cppclass_ tAxis) "GetYaxis" [] Nothing
-- GetPoint
, Virtual void_ "InitExpo" [double "xmin", double "xmax"] Nothing
, Virtual void_ "InitGaus" [double "xmin", double "xmax"] Nothing
, Virtual void_ "InitPolynom" [double "xmin", double "xmax"] Nothing
, Virtual int_ "InsertPoint" [] Nothing
, Virtual double_ "Integral" [int "first", int "last"] (Just "integralTGraph")
, Virtual bool_ "IsEditable" [] Nothing
, Virtual int_ "IsInside" [double "x", double "y"] (Just "isInsideTGraph")
, Virtual void_ "LeastSquareFit" [int "m", doublep "a", double "xmin", double "xmax"] Nothing
-- LeastSquareLinearFit
, NonVirtual void_ "PaintGraph" [int "npoints", doublep "x", doublep "y", cstring "chopt"] Nothing
, NonVirtual void_ "PaintGrapHist" [int "npoints", doublep "x", doublep "y", cstring "chopt"] Nothing
, Virtual void_ "PaintStats" [cppclass tF1 "fit"] Nothing
, Virtual int_ "RemovePoint" [int "ipoint"] Nothing
, Virtual void_ "SetEditable" [bool "editable"] Nothing
, Virtual void_ "SetHistogram" [cppclass tH1F "h"] Nothing
, Virtual void_ "SetMaximum" [double "maximum"] (Just "setMaximumTGraph")
, Virtual void_ "SetMinimum" [double "minimum"] (Just "setMinimumTGraph")
, Virtual void_ "Set" [int "n"] Nothing
, Virtual void_ "SetPoint" [int "i", double "x", double "y"] Nothing
-- Zero
]
| 3,127
|
tGraph =
histclass "TGraph" [tNamed, tAttLine, tAttFill, tAttMarker] (Protected [])
[ Constructor [int "n", doublep "x", doublep "y"] Nothing
, Virtual void_ "Apply" [cppclass tF1 "f"] Nothing
, Virtual double_ "Chisquare" [cppclass tF1 "f1"] Nothing
-- CompareArg
-- CompareX
-- CompareY
-- CompareRadius
-- ComputeRange
, Virtual void_ "DrawGraph" [int "n", doublep "x", doublep "y", cstring "option"] Nothing
, Virtual void_ "DrawPanel" [] (Just "drawPanelTGraph")
-- Eval
, Virtual void_ "Expand" [int "newsize", int "step"] Nothing
-- Fit
, Virtual void_ "FitPanel" [] (Just "FitPanelTGraph")
, NonVirtual bool_ "GetEditable" [] Nothing
, NonVirtual (cppclass_ tF1) "GetFunction" [cstring "name"] Nothing
, NonVirtual (cppclass_ tH1F) "GetHistogram" [] Nothing
-- , NonVirtual (cppclass_ "TList") "GetListOfFunctions" []
, Virtual double_ "GetCorrelationFactor" [] (Just "getCorrelationFactorTGraph")
, Virtual double_ "GetCovariance" [] (Just "getCovarianceTGraph")
, Virtual double_ "GetMean" [int "axis"] (Just "getMeanTGraph")
, Virtual double_ "GetRMS" [int "axis"] (Just "getRMSTGraph")
, NonVirtual int_ "GetMaxSize" [] Nothing
, NonVirtual int_ "GetN" [] Nothing
, Virtual double_ "GetErrorX" [int "bin"] Nothing
, Virtual double_ "GetErrorY" [int "bin"] Nothing
, Virtual double_ "GetErrorXhigh" [int "bin"] Nothing
, Virtual double_ "GetErrorXlow" [int "bin"] Nothing
, Virtual double_ "GetErrorYhigh" [int "bin"] Nothing
, Virtual double_ "GetErrorYlow" [int "bin"] Nothing
-- GetX
-- GetY
-- GetEX
-- GetEY
-- omit..
, NonVirtual double_ "GetMaximum" [] Nothing
, NonVirtual double_ "GetMinimum" [] Nothing
, NonVirtual (cppclass_ tAxis) "GetXaxis" [] Nothing
, NonVirtual (cppclass_ tAxis) "GetYaxis" [] Nothing
-- GetPoint
, Virtual void_ "InitExpo" [double "xmin", double "xmax"] Nothing
, Virtual void_ "InitGaus" [double "xmin", double "xmax"] Nothing
, Virtual void_ "InitPolynom" [double "xmin", double "xmax"] Nothing
, Virtual int_ "InsertPoint" [] Nothing
, Virtual double_ "Integral" [int "first", int "last"] (Just "integralTGraph")
, Virtual bool_ "IsEditable" [] Nothing
, Virtual int_ "IsInside" [double "x", double "y"] (Just "isInsideTGraph")
, Virtual void_ "LeastSquareFit" [int "m", doublep "a", double "xmin", double "xmax"] Nothing
-- LeastSquareLinearFit
, NonVirtual void_ "PaintGraph" [int "npoints", doublep "x", doublep "y", cstring "chopt"] Nothing
, NonVirtual void_ "PaintGrapHist" [int "npoints", doublep "x", doublep "y", cstring "chopt"] Nothing
, Virtual void_ "PaintStats" [cppclass tF1 "fit"] Nothing
, Virtual int_ "RemovePoint" [int "ipoint"] Nothing
, Virtual void_ "SetEditable" [bool "editable"] Nothing
, Virtual void_ "SetHistogram" [cppclass tH1F "h"] Nothing
, Virtual void_ "SetMaximum" [double "maximum"] (Just "setMaximumTGraph")
, Virtual void_ "SetMinimum" [double "minimum"] (Just "setMinimumTGraph")
, Virtual void_ "Set" [int "n"] Nothing
, Virtual void_ "SetPoint" [int "i", double "x", double "y"] Nothing
-- Zero
]
| 3,111
| true
| true
| 0
| 8
| 1,241
| 1,017
| 520
| 497
| null | null |
HaskellForCats/HaskellForCats
|
ladiesWhoCodeHaskell/ladiesWhoCodeHaskell002.hs
|
mit
|
someFun002 a b = a + b
| 22
|
someFun002 a b = a + b
| 22
|
someFun002 a b = a + b
| 22
| false
| false
| 0
| 5
| 6
| 15
| 7
| 8
| null | null |
ghc-android/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
cTyConKey = mkPreludeTyConUnique 147
| 36
|
cTyConKey = mkPreludeTyConUnique 147
| 36
|
cTyConKey = mkPreludeTyConUnique 147
| 36
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
JLiangWaterloo/sat
|
Haskell/Sat.hs
|
mit
|
makeCmty :: Int -> Int -> Int -> Double -> IO Sat
makeCmty vars clauses cmtys q =
evalRandIO $ replicateM clauses make3Clause
where
make3Clause = do
cmty <- getRandomR (1, cmtys)
a <- makeCmtyLit cmty
r1 <- getRandomR (0, 1)
b <- if r1 < q then makeCmtyLit cmty else makeLit
r2 <- getRandomR (0, 1)
c <- if r2 < q then makeCmtyLit cmty else makeLit
return [a, b, c]
makeLit = getRandomR (1, vars) >>= makeSign
makeCmtyLit cmty = do
val <- getRandomR (0, cmtySize)
makeSign $ val * cmtys + cmty
makeSign v = do
s <- getRandom
if s then return v else return (-v)
cmtySize = vars `div` cmtys
| 768
|
makeCmty :: Int -> Int -> Int -> Double -> IO Sat
makeCmty vars clauses cmtys q =
evalRandIO $ replicateM clauses make3Clause
where
make3Clause = do
cmty <- getRandomR (1, cmtys)
a <- makeCmtyLit cmty
r1 <- getRandomR (0, 1)
b <- if r1 < q then makeCmtyLit cmty else makeLit
r2 <- getRandomR (0, 1)
c <- if r2 < q then makeCmtyLit cmty else makeLit
return [a, b, c]
makeLit = getRandomR (1, vars) >>= makeSign
makeCmtyLit cmty = do
val <- getRandomR (0, cmtySize)
makeSign $ val * cmtys + cmty
makeSign v = do
s <- getRandom
if s then return v else return (-v)
cmtySize = vars `div` cmtys
| 768
|
makeCmty vars clauses cmtys q =
evalRandIO $ replicateM clauses make3Clause
where
make3Clause = do
cmty <- getRandomR (1, cmtys)
a <- makeCmtyLit cmty
r1 <- getRandomR (0, 1)
b <- if r1 < q then makeCmtyLit cmty else makeLit
r2 <- getRandomR (0, 1)
c <- if r2 < q then makeCmtyLit cmty else makeLit
return [a, b, c]
makeLit = getRandomR (1, vars) >>= makeSign
makeCmtyLit cmty = do
val <- getRandomR (0, cmtySize)
makeSign $ val * cmtys + cmty
makeSign v = do
s <- getRandom
if s then return v else return (-v)
cmtySize = vars `div` cmtys
| 718
| false
| true
| 0
| 12
| 294
| 277
| 139
| 138
| null | null |
urbanslug/ghc
|
compiler/basicTypes/Literal.hs
|
bsd-3-clause
|
-- | Creates a 'Literal' of type @Word#@
mkMachWord :: DynFlags -> Integer -> Literal
mkMachWord dflags x = ASSERT2( inWordRange dflags x, integer x )
MachWord x
| 187
|
mkMachWord :: DynFlags -> Integer -> Literal
mkMachWord dflags x = ASSERT2( inWordRange dflags x, integer x )
MachWord x
| 146
|
mkMachWord dflags x = ASSERT2( inWordRange dflags x, integer x )
MachWord x
| 101
| true
| true
| 0
| 7
| 53
| 50
| 24
| 26
| null | null |
kim/amazonka
|
amazonka-cloudformation/gen/Network/AWS/CloudFormation/Types.hs
|
mpl-2.0
|
-- | Success/failure message associated with the resource.
srsResourceStatusReason :: Lens' StackResourceSummary (Maybe Text)
srsResourceStatusReason =
lens _srsResourceStatusReason (\s a -> s { _srsResourceStatusReason = a })
| 230
|
srsResourceStatusReason :: Lens' StackResourceSummary (Maybe Text)
srsResourceStatusReason =
lens _srsResourceStatusReason (\s a -> s { _srsResourceStatusReason = a })
| 171
|
srsResourceStatusReason =
lens _srsResourceStatusReason (\s a -> s { _srsResourceStatusReason = a })
| 104
| true
| true
| 0
| 9
| 30
| 46
| 25
| 21
| null | null |
haskell-distributed/distributed-process-tests
|
src/Control/Distributed/Process/Tests/Internal/Utils.hs
|
bsd-3-clause
|
runTestProcess :: Process () -> Process ()
runTestProcess proc = do
ctl <- expect
case ctl of
Stop -> return ()
Go -> proc >> runTestProcess proc
Report p -> receiveWait [matchAny (\m -> forward m p)] >> runTestProcess proc
-- | Tell a /test process/ to continue executing
| 299
|
runTestProcess :: Process () -> Process ()
runTestProcess proc = do
ctl <- expect
case ctl of
Stop -> return ()
Go -> proc >> runTestProcess proc
Report p -> receiveWait [matchAny (\m -> forward m p)] >> runTestProcess proc
-- | Tell a /test process/ to continue executing
| 299
|
runTestProcess proc = do
ctl <- expect
case ctl of
Stop -> return ()
Go -> proc >> runTestProcess proc
Report p -> receiveWait [matchAny (\m -> forward m p)] >> runTestProcess proc
-- | Tell a /test process/ to continue executing
| 256
| false
| true
| 0
| 17
| 75
| 110
| 50
| 60
| null | null |
ghcjs/ghcjs
|
utils/pkg-cache/ghc/includes/dist-derivedconstants/header/GHCConstantsHaskellWrappers.hs
|
mit
|
oFFSET_StgRegTable_rD6 :: DynFlags -> Int
oFFSET_StgRegTable_rD6 dflags = pc_OFFSET_StgRegTable_rD6 (platformConstants dflags)
| 126
|
oFFSET_StgRegTable_rD6 :: DynFlags -> Int
oFFSET_StgRegTable_rD6 dflags = pc_OFFSET_StgRegTable_rD6 (platformConstants dflags)
| 126
|
oFFSET_StgRegTable_rD6 dflags = pc_OFFSET_StgRegTable_rD6 (platformConstants dflags)
| 84
| false
| true
| 0
| 7
| 10
| 30
| 14
| 16
| null | null |
leksah/yi
|
src/library/Yi/Buffer/Misc.hs
|
gpl-2.0
|
replaceCharWithBelowB :: BufferM ()
replaceCharWithBelowB = replaceCharWithVerticalOffset 1
| 91
|
replaceCharWithBelowB :: BufferM ()
replaceCharWithBelowB = replaceCharWithVerticalOffset 1
| 91
|
replaceCharWithBelowB = replaceCharWithVerticalOffset 1
| 55
| false
| true
| 0
| 6
| 7
| 19
| 9
| 10
| null | null |
pepeiborra/muterm-framework-charts
|
MuTerm/Framework/GraphViz.hs
|
bsd-3-clause
|
dropNotes = foldFree Pure (Impure . dropNote)
| 45
|
dropNotes = foldFree Pure (Impure . dropNote)
| 45
|
dropNotes = foldFree Pure (Impure . dropNote)
| 45
| false
| false
| 0
| 7
| 6
| 18
| 9
| 9
| null | null |
andreyk0/www-request-router
|
src/CliArgs.hs
|
bsd-3-clause
|
parseHttpsCommand :: Parser CliCommand
parseHttpsCommand = CliHttpsCommand
<$> option auto
( long "port"
<> short 'p'
<> value 443
<> help "TLS port." )
<*> strOption
( long "cert-file"
<> short 'c'
<> metavar "cert.pem"
<> help "TLS cert file" )
<*> strOption
( long "key-file"
<> short 'k'
<> metavar "cert.key"
<> help "TLS key file" )
<*> option auto
( long "session-length"
<> short 'S'
<> value 120
<> showDefault
<> help "App session length, minutes." )
<*> strOption
( long "session-key"
<> short 's'
<> value "session-key.aes"
<> showDefault
<> help "App session key file." )
| 709
|
parseHttpsCommand :: Parser CliCommand
parseHttpsCommand = CliHttpsCommand
<$> option auto
( long "port"
<> short 'p'
<> value 443
<> help "TLS port." )
<*> strOption
( long "cert-file"
<> short 'c'
<> metavar "cert.pem"
<> help "TLS cert file" )
<*> strOption
( long "key-file"
<> short 'k'
<> metavar "cert.key"
<> help "TLS key file" )
<*> option auto
( long "session-length"
<> short 'S'
<> value 120
<> showDefault
<> help "App session length, minutes." )
<*> strOption
( long "session-key"
<> short 's'
<> value "session-key.aes"
<> showDefault
<> help "App session key file." )
| 709
|
parseHttpsCommand = CliHttpsCommand
<$> option auto
( long "port"
<> short 'p'
<> value 443
<> help "TLS port." )
<*> strOption
( long "cert-file"
<> short 'c'
<> metavar "cert.pem"
<> help "TLS cert file" )
<*> strOption
( long "key-file"
<> short 'k'
<> metavar "cert.key"
<> help "TLS key file" )
<*> option auto
( long "session-length"
<> short 'S'
<> value 120
<> showDefault
<> help "App session length, minutes." )
<*> strOption
( long "session-key"
<> short 's'
<> value "session-key.aes"
<> showDefault
<> help "App session key file." )
| 670
| false
| true
| 14
| 11
| 223
| 212
| 96
| 116
| null | null |
brendanhay/gogol
|
gogol-vault/gen/Network/Google/Vault/Types/Product.hs
|
mpl-2.0
|
-- | The account and its role to add.
amprMatterPermission :: Lens' AddMatterPermissionsRequest (Maybe MatterPermission)
amprMatterPermission
= lens _amprMatterPermission
(\ s a -> s{_amprMatterPermission = a})
| 218
|
amprMatterPermission :: Lens' AddMatterPermissionsRequest (Maybe MatterPermission)
amprMatterPermission
= lens _amprMatterPermission
(\ s a -> s{_amprMatterPermission = a})
| 180
|
amprMatterPermission
= lens _amprMatterPermission
(\ s a -> s{_amprMatterPermission = a})
| 97
| true
| true
| 0
| 9
| 33
| 48
| 25
| 23
| null | null |
ducis/haAni
|
hs/common/Graphics/UI/GLUT/State.hs
|
gpl-2.0
|
supportedNumAuxBuffers :: GettableStateVar [Int]
supportedNumAuxBuffers = getModeValues glut_AUX
| 96
|
supportedNumAuxBuffers :: GettableStateVar [Int]
supportedNumAuxBuffers = getModeValues glut_AUX
| 96
|
supportedNumAuxBuffers = getModeValues glut_AUX
| 47
| false
| true
| 0
| 6
| 7
| 20
| 10
| 10
| null | null |
beni55/fay
|
examples/oscillator.hs
|
bsd-3-clause
|
lineTo :: Context -> Point -> Fay ()
lineTo c (x,y) = lineTo' c x y
| 67
|
lineTo :: Context -> Point -> Fay ()
lineTo c (x,y) = lineTo' c x y
| 67
|
lineTo c (x,y) = lineTo' c x y
| 30
| false
| true
| 0
| 8
| 15
| 42
| 21
| 21
| null | null |
siddhanathan/ghc
|
compiler/typecheck/TcType.hs
|
bsd-3-clause
|
isOverloadedTy (FunTy a _) = isPredTy a
| 43
|
isOverloadedTy (FunTy a _) = isPredTy a
| 43
|
isOverloadedTy (FunTy a _) = isPredTy a
| 43
| false
| false
| 0
| 6
| 10
| 21
| 9
| 12
| null | null |
d-day/relation
|
include/pointfree-style/pointfree-1.0.4.3/Plugin/Pl/Rules.hs
|
bsd-3-clause
|
zipE = Quote $ Var Pref "zip"
| 35
|
zipE = Quote $ Var Pref "zip"
| 35
|
zipE = Quote $ Var Pref "zip"
| 35
| false
| false
| 0
| 6
| 12
| 15
| 7
| 8
| null | null |
ntc2/cryptol
|
src/Cryptol/Parser/NoPat.hs
|
bsd-3-clause
|
annotDs [] = return []
| 22
|
annotDs [] = return []
| 22
|
annotDs [] = return []
| 22
| false
| false
| 0
| 6
| 4
| 16
| 7
| 9
| null | null |
forked-upstream-packages-for-ghcjs/ghc
|
compiler/prelude/TysWiredIn.hs
|
bsd-3-clause
|
-- Build one specially
tupleCon BoxedTuple i = snd (boxedTupleArr ! i)
| 74
|
tupleCon BoxedTuple i = snd (boxedTupleArr ! i)
| 51
|
tupleCon BoxedTuple i = snd (boxedTupleArr ! i)
| 51
| true
| false
| 1
| 7
| 15
| 26
| 11
| 15
| null | null |
mtlstats/mtlstats
|
test/ActionsSpec.hs
|
gpl-3.0
|
resetStandingsSpec :: Spec
resetStandingsSpec = describe "resetStandings" $ do
let
home = GameStats
{ _gmsWins = 1
, _gmsLosses = 2
, _gmsOvertime = 3
, _gmsGoalsFor = 4
, _gmsGoalsAgainst = 5
}
away = GameStats
{ _gmsWins = 6
, _gmsLosses = 7
, _gmsOvertime = 8
, _gmsGoalsFor = 9
, _gmsGoalsAgainst = 10
}
db = newDatabase
& dbHomeGameStats .~ home
& dbAwayGameStats .~ away
ps = newProgState
& database .~ db
& resetStandings
context "home standings" $
it "should be reset" $
ps^.database.dbHomeGameStats `shouldBe` newGameStats
context "away standings" $
it "should be reset" $
ps^.database.dbAwayGameStats `shouldBe` newGameStats
| 821
|
resetStandingsSpec :: Spec
resetStandingsSpec = describe "resetStandings" $ do
let
home = GameStats
{ _gmsWins = 1
, _gmsLosses = 2
, _gmsOvertime = 3
, _gmsGoalsFor = 4
, _gmsGoalsAgainst = 5
}
away = GameStats
{ _gmsWins = 6
, _gmsLosses = 7
, _gmsOvertime = 8
, _gmsGoalsFor = 9
, _gmsGoalsAgainst = 10
}
db = newDatabase
& dbHomeGameStats .~ home
& dbAwayGameStats .~ away
ps = newProgState
& database .~ db
& resetStandings
context "home standings" $
it "should be reset" $
ps^.database.dbHomeGameStats `shouldBe` newGameStats
context "away standings" $
it "should be reset" $
ps^.database.dbAwayGameStats `shouldBe` newGameStats
| 821
|
resetStandingsSpec = describe "resetStandings" $ do
let
home = GameStats
{ _gmsWins = 1
, _gmsLosses = 2
, _gmsOvertime = 3
, _gmsGoalsFor = 4
, _gmsGoalsAgainst = 5
}
away = GameStats
{ _gmsWins = 6
, _gmsLosses = 7
, _gmsOvertime = 8
, _gmsGoalsFor = 9
, _gmsGoalsAgainst = 10
}
db = newDatabase
& dbHomeGameStats .~ home
& dbAwayGameStats .~ away
ps = newProgState
& database .~ db
& resetStandings
context "home standings" $
it "should be reset" $
ps^.database.dbHomeGameStats `shouldBe` newGameStats
context "away standings" $
it "should be reset" $
ps^.database.dbAwayGameStats `shouldBe` newGameStats
| 794
| false
| true
| 0
| 14
| 288
| 192
| 106
| 86
| null | null |
diku-dk/futhark
|
src/Futhark/Optimise/Fusion/LoopKernel.hs
|
isc
|
removeUnusedParamsFromKer :: FusedKer -> FusedKer
removeUnusedParamsFromKer ker =
case soac of
SOAC.Screma {} -> ker {fsoac = soac'}
_ -> ker
where
soac = fsoac ker
l = SOAC.lambda soac
inps = SOAC.inputs soac
(l', inps') = removeUnusedParams l inps
soac' =
l'
`SOAC.setLambda` (inps' `SOAC.setInputs` soac)
| 353
|
removeUnusedParamsFromKer :: FusedKer -> FusedKer
removeUnusedParamsFromKer ker =
case soac of
SOAC.Screma {} -> ker {fsoac = soac'}
_ -> ker
where
soac = fsoac ker
l = SOAC.lambda soac
inps = SOAC.inputs soac
(l', inps') = removeUnusedParams l inps
soac' =
l'
`SOAC.setLambda` (inps' `SOAC.setInputs` soac)
| 353
|
removeUnusedParamsFromKer ker =
case soac of
SOAC.Screma {} -> ker {fsoac = soac'}
_ -> ker
where
soac = fsoac ker
l = SOAC.lambda soac
inps = SOAC.inputs soac
(l', inps') = removeUnusedParams l inps
soac' =
l'
`SOAC.setLambda` (inps' `SOAC.setInputs` soac)
| 303
| false
| true
| 4
| 9
| 92
| 120
| 64
| 56
| null | null |
siddhanathan/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
noArityDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "NoArity")
| 67
|
noArityDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "NoArity")
| 67
|
noArityDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "NoArity")
| 67
| false
| false
| 0
| 7
| 8
| 17
| 8
| 9
| null | null |
mhuesch/scheme_compiler
|
src/L3ToL2/Compile.hs
|
bsd-3-clause
|
compileD target isTail (L3.Aref v1 v2) = do
tmp1 <- newVar
tmp2 <- newVar
notBadLabel <- newLab
badLabel <- newLab
goodLabel <- newLab
let v1X = compileVX v1
tmp1W = variableToW tmp1
tmp2W = variableToW tmp2
return . addReturn isTail $
[L2.IAssign tmp1W (encodeS v2)
,L2.IShiftN tmp1W L2.ShiftRight (intToN2 1)
,L2.IReadMem tmp2W v1X (intToN2 0)
,L2.ICjump (L2.Tx $ L2.Xw tmp1W) L2.LessThan (L2.Tx $ L2.Xw tmp2W) notBadLabel badLabel
,L2.ILabel notBadLabel
,L2.ICjump (L2.Tx $ L2.Xw tmp1W) L2.LessThan (L2.Tnum $ intToN2 0) badLabel goodLabel
,L2.ILabel badLabel]
++
(setVars [v1,v2])
++
[L2.ICallRuntime L2.ArrayError (intToPNI2 2)
,L2.ILabel goodLabel
,L2.IArith tmp1W L2.Mult (L2.Tnum $ intToN2 8)
,L2.IArith tmp1W L2.Add (L2.Tx v1X)
,L2.IReadMem target (L2.Xw tmp1W) (intToN2 8)]
| 948
|
compileD target isTail (L3.Aref v1 v2) = do
tmp1 <- newVar
tmp2 <- newVar
notBadLabel <- newLab
badLabel <- newLab
goodLabel <- newLab
let v1X = compileVX v1
tmp1W = variableToW tmp1
tmp2W = variableToW tmp2
return . addReturn isTail $
[L2.IAssign tmp1W (encodeS v2)
,L2.IShiftN tmp1W L2.ShiftRight (intToN2 1)
,L2.IReadMem tmp2W v1X (intToN2 0)
,L2.ICjump (L2.Tx $ L2.Xw tmp1W) L2.LessThan (L2.Tx $ L2.Xw tmp2W) notBadLabel badLabel
,L2.ILabel notBadLabel
,L2.ICjump (L2.Tx $ L2.Xw tmp1W) L2.LessThan (L2.Tnum $ intToN2 0) badLabel goodLabel
,L2.ILabel badLabel]
++
(setVars [v1,v2])
++
[L2.ICallRuntime L2.ArrayError (intToPNI2 2)
,L2.ILabel goodLabel
,L2.IArith tmp1W L2.Mult (L2.Tnum $ intToN2 8)
,L2.IArith tmp1W L2.Add (L2.Tx v1X)
,L2.IReadMem target (L2.Xw tmp1W) (intToN2 8)]
| 948
|
compileD target isTail (L3.Aref v1 v2) = do
tmp1 <- newVar
tmp2 <- newVar
notBadLabel <- newLab
badLabel <- newLab
goodLabel <- newLab
let v1X = compileVX v1
tmp1W = variableToW tmp1
tmp2W = variableToW tmp2
return . addReturn isTail $
[L2.IAssign tmp1W (encodeS v2)
,L2.IShiftN tmp1W L2.ShiftRight (intToN2 1)
,L2.IReadMem tmp2W v1X (intToN2 0)
,L2.ICjump (L2.Tx $ L2.Xw tmp1W) L2.LessThan (L2.Tx $ L2.Xw tmp2W) notBadLabel badLabel
,L2.ILabel notBadLabel
,L2.ICjump (L2.Tx $ L2.Xw tmp1W) L2.LessThan (L2.Tnum $ intToN2 0) badLabel goodLabel
,L2.ILabel badLabel]
++
(setVars [v1,v2])
++
[L2.ICallRuntime L2.ArrayError (intToPNI2 2)
,L2.ILabel goodLabel
,L2.IArith tmp1W L2.Mult (L2.Tnum $ intToN2 8)
,L2.IArith tmp1W L2.Add (L2.Tx v1X)
,L2.IReadMem target (L2.Xw tmp1W) (intToN2 8)]
| 948
| false
| false
| 0
| 15
| 275
| 380
| 186
| 194
| null | null |
Teaspot-Studio/Urho3D-Haskell
|
src/Graphics/Urho3D/Input/InputConstants.hs
|
mit
|
keyKPHexadecimal :: Int
keyKPHexadecimal = fromIntegral $ [C.pure| int {KEY_KP_HEXADECIMAL} |]
| 94
|
keyKPHexadecimal :: Int
keyKPHexadecimal = fromIntegral $ [C.pure| int {KEY_KP_HEXADECIMAL} |]
| 94
|
keyKPHexadecimal = fromIntegral $ [C.pure| int {KEY_KP_HEXADECIMAL} |]
| 70
| false
| true
| 0
| 6
| 10
| 21
| 13
| 8
| null | null |
wiggly/functional-pokering
|
src/Wiggly.hs
|
mit
|
nckValuesBelow :: Int -> Int -> Int -> Int -> (Int, Int)
nckValuesBelow limit k i v = let nv = comboCount (i+1) k
in if nv > limit
then (i,v)
else nckValuesBelow limit k (i+1) nv
| 271
|
nckValuesBelow :: Int -> Int -> Int -> Int -> (Int, Int)
nckValuesBelow limit k i v = let nv = comboCount (i+1) k
in if nv > limit
then (i,v)
else nckValuesBelow limit k (i+1) nv
| 271
|
nckValuesBelow limit k i v = let nv = comboCount (i+1) k
in if nv > limit
then (i,v)
else nckValuesBelow limit k (i+1) nv
| 214
| false
| true
| 0
| 11
| 129
| 99
| 52
| 47
| null | null |
robdockins/edison
|
edison-core/src/Data/Edison/Seq/BinaryRandList.hs
|
mit
|
ltail (Even ps) = case lview ps of
Just ((_,y), ps') -> Odd y ps'
Nothing -> error "BinaryRandList.ltail: bug!"
| 151
|
ltail (Even ps) = case lview ps of
Just ((_,y), ps') -> Odd y ps'
Nothing -> error "BinaryRandList.ltail: bug!"
| 151
|
ltail (Even ps) = case lview ps of
Just ((_,y), ps') -> Odd y ps'
Nothing -> error "BinaryRandList.ltail: bug!"
| 151
| false
| false
| 0
| 10
| 59
| 58
| 28
| 30
| null | null |
vincenthz/cryptonite
|
Crypto/Math/Polynomial.hs
|
bsd-3-clause
|
mergePoly :: (Integer -> Integer -> Integer) -> Polynomial -> Polynomial -> Polynomial
mergePoly f (Polynomial p1) (Polynomial p2) = fromList $ loop 0 0
where
l1 = V.length p1
l2 = V.length p2
loop !i1 !i2
| i1 == l1 && i2 == l2 = []
| i1 == l1 = (p2 ! i2) : loop i1 (i2+1)
| i2 == l2 = (p1 ! i1) : loop (i1+1) i2
| otherwise =
let (coef, i1inc, i2inc) = addCoef (p1 ! i1) (p2 ! i2) in
coef : loop (i1+i1inc) (i2+i2inc)
addCoef m1@(Monomial w1 v1) (Monomial w2 v2) =
case compare w1 w2 of
LT -> (Monomial w2 (f 0 v2), 0, 1)
EQ -> (Monomial w1 (f v1 v2), 1, 1)
GT -> (m1, 1, 0)
| 787
|
mergePoly :: (Integer -> Integer -> Integer) -> Polynomial -> Polynomial -> Polynomial
mergePoly f (Polynomial p1) (Polynomial p2) = fromList $ loop 0 0
where
l1 = V.length p1
l2 = V.length p2
loop !i1 !i2
| i1 == l1 && i2 == l2 = []
| i1 == l1 = (p2 ! i2) : loop i1 (i2+1)
| i2 == l2 = (p1 ! i1) : loop (i1+1) i2
| otherwise =
let (coef, i1inc, i2inc) = addCoef (p1 ! i1) (p2 ! i2) in
coef : loop (i1+i1inc) (i2+i2inc)
addCoef m1@(Monomial w1 v1) (Monomial w2 v2) =
case compare w1 w2 of
LT -> (Monomial w2 (f 0 v2), 0, 1)
EQ -> (Monomial w1 (f v1 v2), 1, 1)
GT -> (m1, 1, 0)
| 787
|
mergePoly f (Polynomial p1) (Polynomial p2) = fromList $ loop 0 0
where
l1 = V.length p1
l2 = V.length p2
loop !i1 !i2
| i1 == l1 && i2 == l2 = []
| i1 == l1 = (p2 ! i2) : loop i1 (i2+1)
| i2 == l2 = (p1 ! i1) : loop (i1+1) i2
| otherwise =
let (coef, i1inc, i2inc) = addCoef (p1 ! i1) (p2 ! i2) in
coef : loop (i1+i1inc) (i2+i2inc)
addCoef m1@(Monomial w1 v1) (Monomial w2 v2) =
case compare w1 w2 of
LT -> (Monomial w2 (f 0 v2), 0, 1)
EQ -> (Monomial w1 (f v1 v2), 1, 1)
GT -> (m1, 1, 0)
| 700
| false
| true
| 0
| 14
| 338
| 369
| 187
| 182
| null | null |
yuvallanger/threepenny-gui
|
src/Reactive/Threepenny/PulseLatch.hs
|
bsd-3-clause
|
test_recursion1 :: IO (IO ())
test_recursion1 = mdo
(p1, fire) <- newPulse
p2 <- applyP l2 p1
p3 <- mapP (const (+1)) p2
~(l1,_) <- accumL (0::Int) p3
let l2 = mapL const l1
addHandler p2 print
return $ fire ()
| 250
|
test_recursion1 :: IO (IO ())
test_recursion1 = mdo
(p1, fire) <- newPulse
p2 <- applyP l2 p1
p3 <- mapP (const (+1)) p2
~(l1,_) <- accumL (0::Int) p3
let l2 = mapL const l1
addHandler p2 print
return $ fire ()
| 250
|
test_recursion1 = mdo
(p1, fire) <- newPulse
p2 <- applyP l2 p1
p3 <- mapP (const (+1)) p2
~(l1,_) <- accumL (0::Int) p3
let l2 = mapL const l1
addHandler p2 print
return $ fire ()
| 220
| false
| true
| 0
| 11
| 80
| 128
| 61
| 67
| null | null |
chpatrick/hmidi
|
System/MIDI.hs
|
bsd-3-clause
|
etModel = S.getModel
| 21
|
getModel = S.getModel
| 21
|
getModel = S.getModel
| 21
| false
| false
| 0
| 5
| 3
| 8
| 4
| 4
| null | null |
ancientlanguage/haskell-analysis
|
prepare/src/Prepare/Decompose.hs
|
mit
|
decomposeChar '\x1FA3' = "\x03C9\x0314\x0300\x0345"
| 51
|
decomposeChar '\x1FA3' = "\x03C9\x0314\x0300\x0345"
| 51
|
decomposeChar '\x1FA3' = "\x03C9\x0314\x0300\x0345"
| 51
| false
| false
| 1
| 5
| 3
| 13
| 4
| 9
| null | null |
coghex/abridgefaraway
|
src/GLUtil/Font.hs
|
bsd-3-clause
|
findLetter BPFONT '5' = (71, 16)
| 33
|
findLetter BPFONT '5' = (71, 16)
| 33
|
findLetter BPFONT '5' = (71, 16)
| 33
| false
| false
| 0
| 5
| 6
| 19
| 9
| 10
| null | null |
commercialhaskell/intero
|
src/test/Main.hs
|
bsd-3-clause
|
withIntero
:: MonadIO m
=> [String] -> (FilePath -> (String -> IO String) -> IO a) -> m a
withIntero arguments cont =
liftIO
(withSystemTempDirectory
"withIntero"
(\dir -> do
(inp,out,err,pid) <-
catch
(runInteractiveProcess
"intero"
("-ignore-dot-ghci" : arguments)
(Just dir)
Nothing)
(\(_ :: IOException) -> error "Couldn't launch intero process.")
hSetBuffering inp NoBuffering
hSetBuffering out NoBuffering
hSetBuffering err NoBuffering
let repl instr = do
catch
(do hPutStrLn inp instr
let getReply = do
mc <-
catch
(fmap Just (hGetChar out))
(\(_ :: IOException) -> return Nothing)
case mc of
Nothing -> hGetAvailable err
Just '\4' -> hGetAvailable err
Just c -> do
cs <- getReply
return (c : cs)
getReply)
(\(_ :: IOException) -> return "")
_ <- repl ":set prompt \"\\4\""
finally
(cont dir repl)
(do ignored (hClose inp)
ignored (hClose out)
ignored (hClose err)
ignored (terminateProcess pid))))
where
ignored m = catch m (\(_ :: IOException) -> return ())
hGetAvailable h = do
available <- catch (hReady h) (\(_ :: IOException) -> return False)
if available
then catch
(do c <- hGetChar h
cs <- hGetAvailable h
return (c : cs))
(\(_ :: IOException) -> return [])
else return []
--------------------------------------------------------------------------------
-- Spec combinators
-- | Specify an issue that needs to be regression tested.
| 2,129
|
withIntero
:: MonadIO m
=> [String] -> (FilePath -> (String -> IO String) -> IO a) -> m a
withIntero arguments cont =
liftIO
(withSystemTempDirectory
"withIntero"
(\dir -> do
(inp,out,err,pid) <-
catch
(runInteractiveProcess
"intero"
("-ignore-dot-ghci" : arguments)
(Just dir)
Nothing)
(\(_ :: IOException) -> error "Couldn't launch intero process.")
hSetBuffering inp NoBuffering
hSetBuffering out NoBuffering
hSetBuffering err NoBuffering
let repl instr = do
catch
(do hPutStrLn inp instr
let getReply = do
mc <-
catch
(fmap Just (hGetChar out))
(\(_ :: IOException) -> return Nothing)
case mc of
Nothing -> hGetAvailable err
Just '\4' -> hGetAvailable err
Just c -> do
cs <- getReply
return (c : cs)
getReply)
(\(_ :: IOException) -> return "")
_ <- repl ":set prompt \"\\4\""
finally
(cont dir repl)
(do ignored (hClose inp)
ignored (hClose out)
ignored (hClose err)
ignored (terminateProcess pid))))
where
ignored m = catch m (\(_ :: IOException) -> return ())
hGetAvailable h = do
available <- catch (hReady h) (\(_ :: IOException) -> return False)
if available
then catch
(do c <- hGetChar h
cs <- hGetAvailable h
return (c : cs))
(\(_ :: IOException) -> return [])
else return []
--------------------------------------------------------------------------------
-- Spec combinators
-- | Specify an issue that needs to be regression tested.
| 2,129
|
withIntero arguments cont =
liftIO
(withSystemTempDirectory
"withIntero"
(\dir -> do
(inp,out,err,pid) <-
catch
(runInteractiveProcess
"intero"
("-ignore-dot-ghci" : arguments)
(Just dir)
Nothing)
(\(_ :: IOException) -> error "Couldn't launch intero process.")
hSetBuffering inp NoBuffering
hSetBuffering out NoBuffering
hSetBuffering err NoBuffering
let repl instr = do
catch
(do hPutStrLn inp instr
let getReply = do
mc <-
catch
(fmap Just (hGetChar out))
(\(_ :: IOException) -> return Nothing)
case mc of
Nothing -> hGetAvailable err
Just '\4' -> hGetAvailable err
Just c -> do
cs <- getReply
return (c : cs)
getReply)
(\(_ :: IOException) -> return "")
_ <- repl ":set prompt \"\\4\""
finally
(cont dir repl)
(do ignored (hClose inp)
ignored (hClose out)
ignored (hClose err)
ignored (terminateProcess pid))))
where
ignored m = catch m (\(_ :: IOException) -> return ())
hGetAvailable h = do
available <- catch (hReady h) (\(_ :: IOException) -> return False)
if available
then catch
(do c <- hGetChar h
cs <- hGetAvailable h
return (c : cs))
(\(_ :: IOException) -> return [])
else return []
--------------------------------------------------------------------------------
-- Spec combinators
-- | Specify an issue that needs to be regression tested.
| 2,035
| false
| true
| 5
| 29
| 987
| 571
| 274
| 297
| null | null |
lambdageek/insomnia
|
src/FOmega/Parse.hs
|
bsd-3-clause
|
litTerm :: Parser Term
litTerm = L <$> literal
where
literal = toLiteral <$> naturalOrFloat
toLiteral (Right d) = RealL d
toLiteral (Left i) = IntL i
-- λ (x1:t1) [a1:k1] ... (xN:tN) . e
| 201
|
litTerm :: Parser Term
litTerm = L <$> literal
where
literal = toLiteral <$> naturalOrFloat
toLiteral (Right d) = RealL d
toLiteral (Left i) = IntL i
-- λ (x1:t1) [a1:k1] ... (xN:tN) . e
| 201
|
litTerm = L <$> literal
where
literal = toLiteral <$> naturalOrFloat
toLiteral (Right d) = RealL d
toLiteral (Left i) = IntL i
-- λ (x1:t1) [a1:k1] ... (xN:tN) . e
| 178
| false
| true
| 5
| 6
| 49
| 77
| 33
| 44
| null | null |
jailson-dias/Arca
|
src/GameOver.hs
|
bsd-3-clause
|
linha :: Vertice -> Vertice -> Vertice -> Vertice -> [Cor] -> IO ()
linha v1 v2 v3 v4 [cor] = desenhaQuadrado cor v1 v2 v3 v4
| 129
|
linha :: Vertice -> Vertice -> Vertice -> Vertice -> [Cor] -> IO ()
linha v1 v2 v3 v4 [cor] = desenhaQuadrado cor v1 v2 v3 v4
| 125
|
linha v1 v2 v3 v4 [cor] = desenhaQuadrado cor v1 v2 v3 v4
| 57
| false
| true
| 0
| 11
| 30
| 70
| 33
| 37
| null | null |
ekr/tamarin-prover
|
src/Web/Hamlet.hs
|
gpl-3.0
|
headerDiffTpl :: DiffTheoryInfo -> Widget
headerDiffTpl info = [whamlet|
$newline never
<div class="layout-pane-north">
<div #header-info>
Running
\ <a href=@{RootR}><span class="tamarin">Tamarin</span></a>
\ #{showVersion version}
<div #header-links>
<a class=plain-link href=@{RootR}>Index</a>
<a class=plain-link href=@{DownloadTheoryDiffR idx filename}>Download</a>
<ul #navigation>
<li><a href="#">Actions</a>
<ul>
<li><a target=_blank href=@{TheorySourceDiffR idx}>Show source</a>
<li><a href="#">Options</a>
<ul>
<li><a id=graph-toggle href="#">Compact graphs</a>
<li><a id=seqnt-toggle href="#">Compress sequents</a>
|]
where
-- <li><a id=debug-toggle href="#">Debug pane</a>
-- <li><a href=@{TheoryVariantsR idx}>Show variants</a>
-- <li><a class=edit-link href=@{EditTheoryR idx}>Edit theory</a>
-- <li><a class=edit-link href=@{EditPathR idx (TheoryLemma "")}>Add lemma</a>
--
idx = dtiIndex info
filename = get diffThyName (dtiTheory info) ++ ".spthy"
{- use this snipped to reactivate saving local theories
localTheory (Local _) = True
localTheory _ = False
$if localTheory (tiOrigin info)
<a class=save-link href=@{SaveTheoryR idx}>Save</a>
-}
-- | Template for proof state (tree) frame.
| 1,447
|
headerDiffTpl :: DiffTheoryInfo -> Widget
headerDiffTpl info = [whamlet|
$newline never
<div class="layout-pane-north">
<div #header-info>
Running
\ <a href=@{RootR}><span class="tamarin">Tamarin</span></a>
\ #{showVersion version}
<div #header-links>
<a class=plain-link href=@{RootR}>Index</a>
<a class=plain-link href=@{DownloadTheoryDiffR idx filename}>Download</a>
<ul #navigation>
<li><a href="#">Actions</a>
<ul>
<li><a target=_blank href=@{TheorySourceDiffR idx}>Show source</a>
<li><a href="#">Options</a>
<ul>
<li><a id=graph-toggle href="#">Compact graphs</a>
<li><a id=seqnt-toggle href="#">Compress sequents</a>
|]
where
-- <li><a id=debug-toggle href="#">Debug pane</a>
-- <li><a href=@{TheoryVariantsR idx}>Show variants</a>
-- <li><a class=edit-link href=@{EditTheoryR idx}>Edit theory</a>
-- <li><a class=edit-link href=@{EditPathR idx (TheoryLemma "")}>Add lemma</a>
--
idx = dtiIndex info
filename = get diffThyName (dtiTheory info) ++ ".spthy"
{- use this snipped to reactivate saving local theories
localTheory (Local _) = True
localTheory _ = False
$if localTheory (tiOrigin info)
<a class=save-link href=@{SaveTheoryR idx}>Save</a>
-}
-- | Template for proof state (tree) frame.
| 1,447
|
headerDiffTpl info = [whamlet|
$newline never
<div class="layout-pane-north">
<div #header-info>
Running
\ <a href=@{RootR}><span class="tamarin">Tamarin</span></a>
\ #{showVersion version}
<div #header-links>
<a class=plain-link href=@{RootR}>Index</a>
<a class=plain-link href=@{DownloadTheoryDiffR idx filename}>Download</a>
<ul #navigation>
<li><a href="#">Actions</a>
<ul>
<li><a target=_blank href=@{TheorySourceDiffR idx}>Show source</a>
<li><a href="#">Options</a>
<ul>
<li><a id=graph-toggle href="#">Compact graphs</a>
<li><a id=seqnt-toggle href="#">Compress sequents</a>
|]
where
-- <li><a id=debug-toggle href="#">Debug pane</a>
-- <li><a href=@{TheoryVariantsR idx}>Show variants</a>
-- <li><a class=edit-link href=@{EditTheoryR idx}>Edit theory</a>
-- <li><a class=edit-link href=@{EditPathR idx (TheoryLemma "")}>Add lemma</a>
--
idx = dtiIndex info
filename = get diffThyName (dtiTheory info) ++ ".spthy"
{- use this snipped to reactivate saving local theories
localTheory (Local _) = True
localTheory _ = False
$if localTheory (tiOrigin info)
<a class=save-link href=@{SaveTheoryR idx}>Save</a>
-}
-- | Template for proof state (tree) frame.
| 1,405
| false
| true
| 0
| 8
| 373
| 60
| 35
| 25
| null | null |
x-y-z/cabal
|
Cabal/Distribution/Simple/Program/GHC.hs
|
bsd-3-clause
|
verbosityOpts :: Verbosity -> [String]
verbosityOpts verbosity
| verbosity >= deafening = ["-v"]
| verbosity >= normal = []
| otherwise = ["-w", "-v0"]
| 173
|
verbosityOpts :: Verbosity -> [String]
verbosityOpts verbosity
| verbosity >= deafening = ["-v"]
| verbosity >= normal = []
| otherwise = ["-w", "-v0"]
| 173
|
verbosityOpts verbosity
| verbosity >= deafening = ["-v"]
| verbosity >= normal = []
| otherwise = ["-w", "-v0"]
| 134
| false
| true
| 1
| 8
| 45
| 70
| 34
| 36
| null | null |
verement/etamoo
|
src/MOO/Builtins/Tasks.hs
|
bsd-3-clause
|
bf_caller_perms = Builtin "caller_perms" 0 (Just 0) [] TObj $ \[] ->
Obj . objectForMaybe <$> caller permissions
| 114
|
bf_caller_perms = Builtin "caller_perms" 0 (Just 0) [] TObj $ \[] ->
Obj . objectForMaybe <$> caller permissions
| 114
|
bf_caller_perms = Builtin "caller_perms" 0 (Just 0) [] TObj $ \[] ->
Obj . objectForMaybe <$> caller permissions
| 114
| false
| false
| 0
| 8
| 19
| 47
| 23
| 24
| null | null |
sharynneazhar/lotus_sudoku
|
lotus.hs
|
mit
|
doSolve 48 _ _ = []
| 19
|
doSolve 48 _ _ = []
| 19
|
doSolve 48 _ _ = []
| 19
| false
| false
| 0
| 5
| 5
| 15
| 7
| 8
| null | null |
gokhankici/symmetry
|
checker/tests/todo/SrcReslock.hs
|
mit
|
unlock_msg :: ReslockSem repr => repr (Pid RSing -> Msg)
unlock_msg = lam $ \pid -> inr $ inr $ inr pid
| 104
|
unlock_msg :: ReslockSem repr => repr (Pid RSing -> Msg)
unlock_msg = lam $ \pid -> inr $ inr $ inr pid
| 104
|
unlock_msg = lam $ \pid -> inr $ inr $ inr pid
| 47
| false
| true
| 2
| 10
| 22
| 57
| 26
| 31
| null | null |
mbelicki/valdemar
|
src/TypeChecker.hs
|
gpl-3.0
|
pushScope :: TypeChecker ()
pushScope = do
locals <- getLocals
let newLocals = emptyScope { scopeParent = Just locals }
modify $ \s -> s { checkerLocalScope = newLocals }
| 182
|
pushScope :: TypeChecker ()
pushScope = do
locals <- getLocals
let newLocals = emptyScope { scopeParent = Just locals }
modify $ \s -> s { checkerLocalScope = newLocals }
| 182
|
pushScope = do
locals <- getLocals
let newLocals = emptyScope { scopeParent = Just locals }
modify $ \s -> s { checkerLocalScope = newLocals }
| 154
| false
| true
| 0
| 12
| 41
| 63
| 32
| 31
| null | null |
alessandroleite/hephaestus-pl
|
src/funsat-0.6.2/src/Funsat/Utils.hs
|
lgpl-3.0
|
outputConflict :: FilePath -> String -> a -> a
outputConflict fn g x = unsafePerformIO $ do writeFile fn g
return x
-- | /O(1)/ Whether a list contains a single element.
| 216
|
outputConflict :: FilePath -> String -> a -> a
outputConflict fn g x = unsafePerformIO $ do writeFile fn g
return x
-- | /O(1)/ Whether a list contains a single element.
| 216
|
outputConflict fn g x = unsafePerformIO $ do writeFile fn g
return x
-- | /O(1)/ Whether a list contains a single element.
| 169
| false
| true
| 0
| 8
| 78
| 49
| 23
| 26
| null | null |
daleooo/barrelfish
|
hake/RuleDefs.hs
|
mit
|
kernelCFlags "armv7-m" = ARMv7_M.kernelCFlags
| 45
|
kernelCFlags "armv7-m" = ARMv7_M.kernelCFlags
| 45
|
kernelCFlags "armv7-m" = ARMv7_M.kernelCFlags
| 45
| false
| false
| 0
| 5
| 3
| 11
| 5
| 6
| null | null |
acowley/ghc
|
compiler/simplCore/SimplUtils.hs
|
bsd-3-clause
|
-- Stop at a cast
argInfoAppArgs (ValArg e : as) = e : argInfoAppArgs as
| 94
|
argInfoAppArgs (ValArg e : as) = e : argInfoAppArgs as
| 76
|
argInfoAppArgs (ValArg e : as) = e : argInfoAppArgs as
| 76
| true
| false
| 0
| 7
| 36
| 28
| 13
| 15
| null | null |
Lythimus/lptv
|
sites/all/modules/jgm-pandoc-8be6cc2/src/Text/Pandoc/Writers/HTML.hs
|
gpl-2.0
|
-- | Obfuscate a "mailto:" link.
obfuscateLink :: WriterOptions -> String -> String -> Html
obfuscateLink opts txt s | writerEmailObfuscation opts == NoObfuscation =
anchor ! [href s] << txt
| 192
|
obfuscateLink :: WriterOptions -> String -> String -> Html
obfuscateLink opts txt s | writerEmailObfuscation opts == NoObfuscation =
anchor ! [href s] << txt
| 159
|
obfuscateLink opts txt s | writerEmailObfuscation opts == NoObfuscation =
anchor ! [href s] << txt
| 100
| true
| true
| 0
| 9
| 32
| 58
| 28
| 30
| null | null |
yu-i9/HaSS
|
src/Parser.hs
|
mit
|
colon :: Parser String
colon = P.colon lexer
| 44
|
colon :: Parser String
colon = P.colon lexer
| 44
|
colon = P.colon lexer
| 21
| false
| true
| 0
| 6
| 7
| 19
| 9
| 10
| null | null |
timjb/diagrams-rubiks-cube
|
src/Diagrams/RubiksCube/Model.hs
|
mit
|
-- | Rotate the whole Rubik's Cube such that the top side becomes the new
-- left side and the front and back sides stay fixed.
rotateCCW :: Aut (RubiksCube a)
rotateCCW = from rotateCW
| 185
|
rotateCCW :: Aut (RubiksCube a)
rotateCCW = from rotateCW
| 57
|
rotateCCW = from rotateCW
| 25
| true
| true
| 0
| 7
| 34
| 25
| 13
| 12
| null | null |
thomie/cabal
|
cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL.hs
|
bsd-3-clause
|
-- | Constructs an example installed package given:
--
-- 1. The name of the package 'ExamplePkgName', i.e., 'String'
-- 2. The version of the package 'ExamplePkgVersion', i.e., 'Int'
-- 3. The IPID for the package 'ExamplePkgHash', i.e., 'String'
-- (just some unique identifier for the package.)
-- 4. The 'ExampleInstalled' packages which this package was
-- compiled against.)
--
exInst :: ExamplePkgName -> ExamplePkgVersion -> ExamplePkgHash
-> [ExampleInstalled] -> ExampleInstalled
exInst pn v hash deps = ExInst pn v hash (map exInstHash deps)
| 595
|
exInst :: ExamplePkgName -> ExamplePkgVersion -> ExamplePkgHash
-> [ExampleInstalled] -> ExampleInstalled
exInst pn v hash deps = ExInst pn v hash (map exInstHash deps)
| 175
|
exInst pn v hash deps = ExInst pn v hash (map exInstHash deps)
| 62
| true
| true
| 0
| 9
| 126
| 65
| 37
| 28
| null | null |
smaccm/capDL-tool
|
CapDL/PrintIsabelle.hs
|
bsd-2-clause
|
printEmptyIrqObjMapping :: ObjMap Word -> IRQMap -> Doc
printEmptyIrqObjMapping ms irqNode =
parens (lambda <> text ("obj_id. if " ++ start ++ " \\<le> obj_id \\<and> obj_id \\<le> " ++ end) <+>
text "then (Some empty_irq_node)" <+> text "else None")
where ms' = Map.filterWithKey (\id _ -> not (mapElem id irqNode)) ms
start = show $ Map.size ms'
end = show $ Map.size ms' + 255 - 1
| 419
|
printEmptyIrqObjMapping :: ObjMap Word -> IRQMap -> Doc
printEmptyIrqObjMapping ms irqNode =
parens (lambda <> text ("obj_id. if " ++ start ++ " \\<le> obj_id \\<and> obj_id \\<le> " ++ end) <+>
text "then (Some empty_irq_node)" <+> text "else None")
where ms' = Map.filterWithKey (\id _ -> not (mapElem id irqNode)) ms
start = show $ Map.size ms'
end = show $ Map.size ms' + 255 - 1
| 419
|
printEmptyIrqObjMapping ms irqNode =
parens (lambda <> text ("obj_id. if " ++ start ++ " \\<le> obj_id \\<and> obj_id \\<le> " ++ end) <+>
text "then (Some empty_irq_node)" <+> text "else None")
where ms' = Map.filterWithKey (\id _ -> not (mapElem id irqNode)) ms
start = show $ Map.size ms'
end = show $ Map.size ms' + 255 - 1
| 363
| false
| true
| 2
| 14
| 103
| 143
| 69
| 74
| null | null |
melrief/PhDPresentation
|
src/Commands.hs
|
mit
|
mode :: LaTeXC l => l -> l
mode = liftL $ \x -> TeXComm "mode" [SymArg x]
| 73
|
mode :: LaTeXC l => l -> l
mode = liftL $ \x -> TeXComm "mode" [SymArg x]
| 73
|
mode = liftL $ \x -> TeXComm "mode" [SymArg x]
| 46
| false
| true
| 2
| 8
| 17
| 49
| 22
| 27
| null | null |
andyarvanitis/Idris-dev
|
src/Idris/Core/TT.hs
|
bsd-3-clause
|
intTyName (ITVec ity count) = "B" ++ show (nativeTyWidth ity) ++ "x" ++ show count
| 82
|
intTyName (ITVec ity count) = "B" ++ show (nativeTyWidth ity) ++ "x" ++ show count
| 82
|
intTyName (ITVec ity count) = "B" ++ show (nativeTyWidth ity) ++ "x" ++ show count
| 82
| false
| false
| 2
| 9
| 14
| 43
| 19
| 24
| null | null |
zeekay/lambdabot
|
lambdabot-utils/Lambdabot/Util.hs
|
mit
|
levenshtein :: String -> String -> Int
levenshtein [] [] = 0
| 60
|
levenshtein :: String -> String -> Int
levenshtein [] [] = 0
| 60
|
levenshtein [] [] = 0
| 21
| false
| true
| 0
| 9
| 11
| 34
| 15
| 19
| null | null |
ezyang/ghc
|
testsuite/tests/codeGen/should_run/T10245.hs
|
bsd-3-clause
|
f :: Int -> String
f n = case n of
#if WORD_SIZE_IN_BITS == 64
0x8000000000000000 -> "yes"
#else
0x80000000 -> "yes"
#endif
_ -> "no"
| 140
|
f :: Int -> String
f n = case n of
#if WORD_SIZE_IN_BITS == 64
0x8000000000000000 -> "yes"
#else
0x80000000 -> "yes"
#endif
_ -> "no"
| 140
|
f n = case n of
#if WORD_SIZE_IN_BITS == 64
0x8000000000000000 -> "yes"
#else
0x80000000 -> "yes"
#endif
_ -> "no"
| 121
| false
| true
| 0
| 7
| 32
| 42
| 21
| 21
| null | null |
vTurbine/ghc
|
compiler/basicTypes/OccName.hs
|
bsd-3-clause
|
-- The in-scope OccNames
-- See Note [TidyOccEnv]
emptyTidyOccEnv :: TidyOccEnv
emptyTidyOccEnv = emptyUFM
| 109
|
emptyTidyOccEnv :: TidyOccEnv
emptyTidyOccEnv = emptyUFM
| 56
|
emptyTidyOccEnv = emptyUFM
| 26
| true
| true
| 0
| 4
| 16
| 13
| 8
| 5
| null | null |
reactormonk/hoauth2
|
example/Facebook/test.hs
|
bsd-3-clause
|
-- | Fetch user id and email.
userinfo :: Manager -> AccessToken -> IO (OAuth2Result BL.ByteString)
userinfo mgr token = authGetBS mgr token [uri|https://graph.facebook.com/me?fields=id,name,email|]
| 198
|
userinfo :: Manager -> AccessToken -> IO (OAuth2Result BL.ByteString)
userinfo mgr token = authGetBS mgr token [uri|https://graph.facebook.com/me?fields=id,name,email|]
| 168
|
userinfo mgr token = authGetBS mgr token [uri|https://graph.facebook.com/me?fields=id,name,email|]
| 98
| true
| true
| 0
| 10
| 23
| 47
| 25
| 22
| null | null |
ml9951/ghc
|
compiler/cmm/CmmUtils.hs
|
bsd-3-clause
|
-- | like 'toBlockList', but the entry block always comes first
toBlockListEntryFirst :: CmmGraph -> [CmmBlock]
toBlockListEntryFirst g
| mapNull m = []
| otherwise = entry_block : others
where
m = toBlockMap g
entry_id = g_entry g
Just entry_block = mapLookup entry_id m
others = filter ((/= entry_id) . entryLabel) (mapElems m)
-- | Like 'toBlockListEntryFirst', but we strive to ensure that we order blocks
-- so that the false case of a conditional jumps to the next block in the output
-- list of blocks. This matches the way OldCmm blocks were output since in
-- OldCmm the false case was a fallthrough, whereas in Cmm conditional branches
-- have both true and false successors. Block ordering can make a big difference
-- in performance in the LLVM backend. Note that we rely crucially on the order
-- of successors returned for CmmCondBranch by the NonLocal instance for CmmNode
-- defind in cmm/CmmNode.hs. -GBM
| 946
|
toBlockListEntryFirst :: CmmGraph -> [CmmBlock]
toBlockListEntryFirst g
| mapNull m = []
| otherwise = entry_block : others
where
m = toBlockMap g
entry_id = g_entry g
Just entry_block = mapLookup entry_id m
others = filter ((/= entry_id) . entryLabel) (mapElems m)
-- | Like 'toBlockListEntryFirst', but we strive to ensure that we order blocks
-- so that the false case of a conditional jumps to the next block in the output
-- list of blocks. This matches the way OldCmm blocks were output since in
-- OldCmm the false case was a fallthrough, whereas in Cmm conditional branches
-- have both true and false successors. Block ordering can make a big difference
-- in performance in the LLVM backend. Note that we rely crucially on the order
-- of successors returned for CmmCondBranch by the NonLocal instance for CmmNode
-- defind in cmm/CmmNode.hs. -GBM
| 882
|
toBlockListEntryFirst g
| mapNull m = []
| otherwise = entry_block : others
where
m = toBlockMap g
entry_id = g_entry g
Just entry_block = mapLookup entry_id m
others = filter ((/= entry_id) . entryLabel) (mapElems m)
-- | Like 'toBlockListEntryFirst', but we strive to ensure that we order blocks
-- so that the false case of a conditional jumps to the next block in the output
-- list of blocks. This matches the way OldCmm blocks were output since in
-- OldCmm the false case was a fallthrough, whereas in Cmm conditional branches
-- have both true and false successors. Block ordering can make a big difference
-- in performance in the LLVM backend. Note that we rely crucially on the order
-- of successors returned for CmmCondBranch by the NonLocal instance for CmmNode
-- defind in cmm/CmmNode.hs. -GBM
| 834
| true
| true
| 1
| 8
| 180
| 112
| 60
| 52
| null | null |
mgmeier/mysql-simple
|
Database/MySQL/Simple/Result.hs
|
bsd-3-clause
|
okWord = ok32
| 13
|
okWord = ok32
| 13
|
okWord = ok32
| 13
| false
| false
| 1
| 5
| 2
| 10
| 3
| 7
| null | null |
LouisJenkinsCS/Minimal-JVM
|
MateVMRuntime/Types.hs
|
bsd-3-clause
|
getMethodMap :: IO MethodMap
getMethodMap = ctxMethodMap <$> readIORef mateCtx
| 78
|
getMethodMap :: IO MethodMap
getMethodMap = ctxMethodMap <$> readIORef mateCtx
| 78
|
getMethodMap = ctxMethodMap <$> readIORef mateCtx
| 49
| false
| true
| 0
| 6
| 9
| 26
| 11
| 15
| null | null |
ony/Yampa-core
|
tests/AFRPTestsWFG.hs
|
bsd-3-clause
|
wfg_t2 :: [Double]
wfg_t2 = take 25 $ embed (trackAndHold 99.99) wfg_inp3
| 73
|
wfg_t2 :: [Double]
wfg_t2 = take 25 $ embed (trackAndHold 99.99) wfg_inp3
| 73
|
wfg_t2 = take 25 $ embed (trackAndHold 99.99) wfg_inp3
| 54
| false
| true
| 0
| 8
| 11
| 32
| 16
| 16
| null | null |
nfjinjing/mps
|
src/MPS/Math/AdditiveNumberTheory.hs
|
bsd-3-clause
|
oddElts (x0:x1:xs) = x1 : oddElts xs
| 36
|
oddElts (x0:x1:xs) = x1 : oddElts xs
| 36
|
oddElts (x0:x1:xs) = x1 : oddElts xs
| 36
| false
| false
| 0
| 8
| 6
| 27
| 13
| 14
| null | null |
leshchevds/ganeti
|
src/Ganeti/Types.hs
|
bsd-2-clause
|
diskTemplateToStorageType DTDrbd8 = StorageLvmVg
| 48
|
diskTemplateToStorageType DTDrbd8 = StorageLvmVg
| 48
|
diskTemplateToStorageType DTDrbd8 = StorageLvmVg
| 48
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
roberth/uu-helium
|
test/simple/benchmarks/Main.hs
|
gpl-3.0
|
eTakeLitChars d l n ('\\':'t':cs)
= case leTakeLitChars d l (n+2) cs of
(rest, col, left) -> ('\t':rest, col, left)
| 125
|
leTakeLitChars d l n ('\\':'t':cs)
= case leTakeLitChars d l (n+2) cs of
(rest, col, left) -> ('\t':rest, col, left)
| 125
|
leTakeLitChars d l n ('\\':'t':cs)
= case leTakeLitChars d l (n+2) cs of
(rest, col, left) -> ('\t':rest, col, left)
| 125
| false
| false
| 0
| 9
| 29
| 70
| 38
| 32
| null | null |
spechub/Hets
|
Comorphisms/CASL2PCFOL.hs
|
gpl-2.0
|
-- | apply (a partial) projection function
projectTo :: TermExtension f => SORT -> TERM f -> TERM f
projectTo s q = projectUnique Partial nullRange q s
| 151
|
projectTo :: TermExtension f => SORT -> TERM f -> TERM f
projectTo s q = projectUnique Partial nullRange q s
| 108
|
projectTo s q = projectUnique Partial nullRange q s
| 51
| true
| true
| 0
| 8
| 27
| 47
| 22
| 25
| null | null |
tolysz/hiccup
|
TclParse.hs
|
lgpl-2.1
|
parseToken :: Parser TclWord
parseToken = do
-- eatSpaces
h <- lookAhead anyChar <?> "token"
case h of
-- ' ' -> eatSpaces >> parseToken
'{' -> try parseExpand <|> parseNoSub
'"' -> parseRichStr `wrapWith` Word
'\\' -> handleEsc
-- ' ' -> return []
_ -> wordToken `wrapWith` Word
where parseNoSub = NoSub <$> parseBlock
parseExpand = parseLit "{*}" >> Expand <$> parseToken
| 427
|
parseToken :: Parser TclWord
parseToken = do
-- eatSpaces
h <- lookAhead anyChar <?> "token"
case h of
-- ' ' -> eatSpaces >> parseToken
'{' -> try parseExpand <|> parseNoSub
'"' -> parseRichStr `wrapWith` Word
'\\' -> handleEsc
-- ' ' -> return []
_ -> wordToken `wrapWith` Word
where parseNoSub = NoSub <$> parseBlock
parseExpand = parseLit "{*}" >> Expand <$> parseToken
| 427
|
parseToken = do
-- eatSpaces
h <- lookAhead anyChar <?> "token"
case h of
-- ' ' -> eatSpaces >> parseToken
'{' -> try parseExpand <|> parseNoSub
'"' -> parseRichStr `wrapWith` Word
'\\' -> handleEsc
-- ' ' -> return []
_ -> wordToken `wrapWith` Word
where parseNoSub = NoSub <$> parseBlock
parseExpand = parseLit "{*}" >> Expand <$> parseToken
| 398
| false
| true
| 1
| 11
| 117
| 110
| 56
| 54
| null | null |
zhangyz/llvm-slicing
|
src/LLVM/Slicing/Util/ValueTest.hs
|
apache-2.0
|
isConstantValue :: Value -> Bool
isConstantValue v = case valueContent' v of
ConstantC ConstantPointerNull {} -> True
ConstantC ConstantValue {} -> True
_ -> False
| 176
|
isConstantValue :: Value -> Bool
isConstantValue v = case valueContent' v of
ConstantC ConstantPointerNull {} -> True
ConstantC ConstantValue {} -> True
_ -> False
| 176
|
isConstantValue v = case valueContent' v of
ConstantC ConstantPointerNull {} -> True
ConstantC ConstantValue {} -> True
_ -> False
| 143
| false
| true
| 0
| 9
| 37
| 61
| 28
| 33
| null | null |
nevrenato/HyLoRes_Source
|
src/HyLoRes/Formula/Internal.hs
|
gpl-2.0
|
replaceNom i i' f@Diam{} = onSubf (replaceNom i i') f
| 55
|
replaceNom i i' f@Diam{} = onSubf (replaceNom i i') f
| 55
|
replaceNom i i' f@Diam{} = onSubf (replaceNom i i') f
| 55
| false
| false
| 0
| 7
| 11
| 33
| 16
| 17
| null | null |
alasconnect/auth0
|
src/Auth0/Management/UsersByEmail.hs
|
apache-2.0
|
usersByEmailApi :: Proxy (UsersByEmailApi appMd userMd)
usersByEmailApi = Proxy
| 79
|
usersByEmailApi :: Proxy (UsersByEmailApi appMd userMd)
usersByEmailApi = Proxy
| 79
|
usersByEmailApi = Proxy
| 23
| false
| true
| 0
| 7
| 8
| 22
| 11
| 11
| null | null |
jeannekamikaze/Spear
|
Spear/Window.hs
|
mit
|
setup :: Dimensions -> [DisplayBits] -> WindowMode -> Context -> Maybe WindowTitle
-> Game s Window
setup (w, h) displayBits windowMode (major, minor) wndTitle = do
closeRequest <- liftIO newEmptyMVar
inputEvents <- liftIO newEmptyMVar
let onResize' = onResize inputEvents
let dimensions = GL.Size (fromIntegral w) (fromIntegral h)
result <- liftIO $ do
GLFW.openWindowHint GLFW.OpenGLVersionMajor major
GLFW.openWindowHint GLFW.OpenGLVersionMinor minor
compat (major, minor)
GLFW.disableSpecial GLFW.AutoPollEvent
GLFW.openWindow dimensions (defaultBits displayBits) windowMode
when (not result) $ gameError "GLFW.openWindow failed"
liftIO $ do
GLFW.windowTitle GL.$= case wndTitle of
Nothing -> "Spear Game Framework"
Just title -> title
GLFW.windowCloseCallback GL.$= (onWindowClose closeRequest)
GLFW.windowSizeCallback GL.$= onResize'
GLFW.keyCallback GL.$= onKey inputEvents
GLFW.charCallback GL.$= onChar inputEvents
GLFW.mouseButtonCallback GL.$= onMouseButton inputEvents
onMouseMove inputEvents >>= (GLFW.mousePosCallback GL.$=)
onResize' (GL.Size (fromIntegral w) (fromIntegral h))
return $ Spear.Window.Window closeRequest inputEvents
| 1,491
|
setup :: Dimensions -> [DisplayBits] -> WindowMode -> Context -> Maybe WindowTitle
-> Game s Window
setup (w, h) displayBits windowMode (major, minor) wndTitle = do
closeRequest <- liftIO newEmptyMVar
inputEvents <- liftIO newEmptyMVar
let onResize' = onResize inputEvents
let dimensions = GL.Size (fromIntegral w) (fromIntegral h)
result <- liftIO $ do
GLFW.openWindowHint GLFW.OpenGLVersionMajor major
GLFW.openWindowHint GLFW.OpenGLVersionMinor minor
compat (major, minor)
GLFW.disableSpecial GLFW.AutoPollEvent
GLFW.openWindow dimensions (defaultBits displayBits) windowMode
when (not result) $ gameError "GLFW.openWindow failed"
liftIO $ do
GLFW.windowTitle GL.$= case wndTitle of
Nothing -> "Spear Game Framework"
Just title -> title
GLFW.windowCloseCallback GL.$= (onWindowClose closeRequest)
GLFW.windowSizeCallback GL.$= onResize'
GLFW.keyCallback GL.$= onKey inputEvents
GLFW.charCallback GL.$= onChar inputEvents
GLFW.mouseButtonCallback GL.$= onMouseButton inputEvents
onMouseMove inputEvents >>= (GLFW.mousePosCallback GL.$=)
onResize' (GL.Size (fromIntegral w) (fromIntegral h))
return $ Spear.Window.Window closeRequest inputEvents
| 1,491
|
setup (w, h) displayBits windowMode (major, minor) wndTitle = do
closeRequest <- liftIO newEmptyMVar
inputEvents <- liftIO newEmptyMVar
let onResize' = onResize inputEvents
let dimensions = GL.Size (fromIntegral w) (fromIntegral h)
result <- liftIO $ do
GLFW.openWindowHint GLFW.OpenGLVersionMajor major
GLFW.openWindowHint GLFW.OpenGLVersionMinor minor
compat (major, minor)
GLFW.disableSpecial GLFW.AutoPollEvent
GLFW.openWindow dimensions (defaultBits displayBits) windowMode
when (not result) $ gameError "GLFW.openWindow failed"
liftIO $ do
GLFW.windowTitle GL.$= case wndTitle of
Nothing -> "Spear Game Framework"
Just title -> title
GLFW.windowCloseCallback GL.$= (onWindowClose closeRequest)
GLFW.windowSizeCallback GL.$= onResize'
GLFW.keyCallback GL.$= onKey inputEvents
GLFW.charCallback GL.$= onChar inputEvents
GLFW.mouseButtonCallback GL.$= onMouseButton inputEvents
onMouseMove inputEvents >>= (GLFW.mousePosCallback GL.$=)
onResize' (GL.Size (fromIntegral w) (fromIntegral h))
return $ Spear.Window.Window closeRequest inputEvents
| 1,385
| false
| true
| 0
| 15
| 471
| 392
| 179
| 213
| null | null |
kosmoskatten/nats-client
|
src/Network/Nats/Subscriber.hs
|
mit
|
-- | Add a new Subscriber to the HashMap.
addSubscriber :: SubscriptionId -> Subscriber -> Subscribers -> Subscribers
addSubscriber = HM.insert
| 143
|
addSubscriber :: SubscriptionId -> Subscriber -> Subscribers -> Subscribers
addSubscriber = HM.insert
| 101
|
addSubscriber = HM.insert
| 25
| true
| true
| 0
| 9
| 20
| 33
| 15
| 18
| null | null |
barrucadu/nagi
|
lib/Imageboard/Web/Mod.hs
|
mit
|
-- | Edit, delete, purge, add note (process).
doEditPost :: ModPage m n xs => Text -> BoardAction (HVect xs) ()
doEditPost _post = error "unimplemented: doEditPost"
| 164
|
doEditPost :: ModPage m n xs => Text -> BoardAction (HVect xs) ()
doEditPost _post = error "unimplemented: doEditPost"
| 118
|
doEditPost _post = error "unimplemented: doEditPost"
| 52
| true
| true
| 0
| 9
| 26
| 46
| 22
| 24
| null | null |
nushio3/ghc
|
compiler/basicTypes/OccName.hs
|
bsd-3-clause
|
mkTcOcc :: String -> OccName
mkTcOcc = mkOccName tcName
| 55
|
mkTcOcc :: String -> OccName
mkTcOcc = mkOccName tcName
| 55
|
mkTcOcc = mkOccName tcName
| 26
| false
| true
| 0
| 5
| 8
| 18
| 9
| 9
| null | null |
tau-tao/DistField-2D
|
src/TestDistanceTransform.hs
|
bsd-3-clause
|
-- | Return distance field Y8 image from width, height, Y8 pixels
mkDistFieldImage :: Int -> Int -> V.Vector Word8 -> DynamicImage
mkDistFieldImage w h pixels = scaleImg w h df
where
df = edtPar [w, h] $ thresholdGrey (w + h) (convert pixels)
-- | Convert greyscale png image to greyscale png df image
| 308
|
mkDistFieldImage :: Int -> Int -> V.Vector Word8 -> DynamicImage
mkDistFieldImage w h pixels = scaleImg w h df
where
df = edtPar [w, h] $ thresholdGrey (w + h) (convert pixels)
-- | Convert greyscale png image to greyscale png df image
| 242
|
mkDistFieldImage w h pixels = scaleImg w h df
where
df = edtPar [w, h] $ thresholdGrey (w + h) (convert pixels)
-- | Convert greyscale png image to greyscale png df image
| 177
| true
| true
| 1
| 9
| 61
| 90
| 43
| 47
| null | null |
m-alvarez/jhc
|
src/FrontEnd/Lex/Layout.hs
|
mit
|
pragma "LINE" ((L bsl LPragmaStart "#LINE"):ls) = d [] ls where
d cs (r@(L sl _ _):rs) | srcLocLine sl /= srcLocLine bsl = (Just $ reverse cs,r:rs)
d cs (r:rs) = d (r:cs) rs
d cs [] = (Just (reverse cs),[])
| 219
|
pragma "LINE" ((L bsl LPragmaStart "#LINE"):ls) = d [] ls where
d cs (r@(L sl _ _):rs) | srcLocLine sl /= srcLocLine bsl = (Just $ reverse cs,r:rs)
d cs (r:rs) = d (r:cs) rs
d cs [] = (Just (reverse cs),[])
| 219
|
pragma "LINE" ((L bsl LPragmaStart "#LINE"):ls) = d [] ls where
d cs (r@(L sl _ _):rs) | srcLocLine sl /= srcLocLine bsl = (Just $ reverse cs,r:rs)
d cs (r:rs) = d (r:cs) rs
d cs [] = (Just (reverse cs),[])
| 219
| false
| false
| 0
| 12
| 54
| 158
| 79
| 79
| null | null |
michalkonecny/aern2
|
aern2-erc/src/ERC/Integer.hs
|
bsd-3-clause
|
neqINTEGER a b = checkK $ boolToKleenean <$> ((/=) <$> a <*> b)
| 63
|
neqINTEGER a b = checkK $ boolToKleenean <$> ((/=) <$> a <*> b)
| 63
|
neqINTEGER a b = checkK $ boolToKleenean <$> ((/=) <$> a <*> b)
| 63
| false
| false
| 0
| 8
| 12
| 32
| 17
| 15
| null | null |
ml9951/ghc
|
compiler/main/DynFlags.hs
|
bsd-3-clause
|
addLdInputs :: Option -> DynFlags -> DynFlags
addLdInputs p dflags = dflags{ldInputs = ldInputs dflags ++ [p]}
| 110
|
addLdInputs :: Option -> DynFlags -> DynFlags
addLdInputs p dflags = dflags{ldInputs = ldInputs dflags ++ [p]}
| 110
|
addLdInputs p dflags = dflags{ldInputs = ldInputs dflags ++ [p]}
| 64
| false
| true
| 0
| 9
| 16
| 48
| 23
| 25
| null | null |
ryansb/elm-dev-containers
|
BuildFromSource.hs
|
mit
|
(=:) = (,)
| 10
|
(=:) = (,)
| 10
|
(=:) = (,)
| 10
| false
| false
| 1
| 6
| 2
| 15
| 7
| 8
| null | null |
dreixel/instant-generics
|
examples/Test.hs
|
bsd-3-clause
|
exp1 = Plus (Const 1) (Const 2)
| 31
|
exp1 = Plus (Const 1) (Const 2)
| 31
|
exp1 = Plus (Const 1) (Const 2)
| 31
| false
| false
| 0
| 7
| 6
| 23
| 11
| 12
| null | null |
lpenz/realworldhaskell-exercises
|
ch12/barcode.hs
|
mit
|
addFirstDigit :: ParityMap -> DigitMap
addFirstDigit = M.foldWithKey updateFirst M.empty
| 88
|
addFirstDigit :: ParityMap -> DigitMap
addFirstDigit = M.foldWithKey updateFirst M.empty
| 88
|
addFirstDigit = M.foldWithKey updateFirst M.empty
| 49
| false
| true
| 0
| 6
| 9
| 24
| 12
| 12
| null | null |
mzero/plush
|
src/Plush/DocTest.hs
|
apache-2.0
|
extractTests :: String -> [Test]
extractTests input = skipping $ zip [1..] $ lines input
where
skipping [] = []
skipping ((i,s):ls) =
case findInitialPrompt s of
Nothing -> skipping ls
Just (leadin, c0) -> command (inputLine c0 $ newTest i) leadin ls
command test leadin lls@((_,s):ls) =
case findContinuePrompt leadin s of
Nothing -> expect test leadin lls
Just c -> command (inputLine c test) leadin ls
command test leadin lls = expect test leadin lls
expect test leadin lls@((_,s):ls) =
case findExpectLine leadin s of
Nothing -> test : skipping lls
Just f -> expect (f test) leadin ls
expect test _ lls = test : skipping lls
findInitialPrompt = go ""
where
go leadin ('#':' ':s) = Just (leadin, s)
go leadin (' ':s) = go (' ':leadin) s
go _ _ = Nothing
findContinuePrompt leadin s = removeLeadin leadin s >>= go
where
go ('+':' ':t) = Just t
go _ = Nothing
findExpectLine leadin s = removeLeadin leadin s >>= go
where
go "" = Nothing
go ('.':t) = Just $ expectLine t
go ('!':' ':t) = Just $ expectError t
go (c:' ':_) | c == '#' = Nothing
go t = Just $ expectLine t
removeLeadin [] s = Just s
removeLeadin (l:ls) (c:cs) | l == c = removeLeadin ls cs
removeLeadin _ _ = Nothing
| 1,430
|
extractTests :: String -> [Test]
extractTests input = skipping $ zip [1..] $ lines input
where
skipping [] = []
skipping ((i,s):ls) =
case findInitialPrompt s of
Nothing -> skipping ls
Just (leadin, c0) -> command (inputLine c0 $ newTest i) leadin ls
command test leadin lls@((_,s):ls) =
case findContinuePrompt leadin s of
Nothing -> expect test leadin lls
Just c -> command (inputLine c test) leadin ls
command test leadin lls = expect test leadin lls
expect test leadin lls@((_,s):ls) =
case findExpectLine leadin s of
Nothing -> test : skipping lls
Just f -> expect (f test) leadin ls
expect test _ lls = test : skipping lls
findInitialPrompt = go ""
where
go leadin ('#':' ':s) = Just (leadin, s)
go leadin (' ':s) = go (' ':leadin) s
go _ _ = Nothing
findContinuePrompt leadin s = removeLeadin leadin s >>= go
where
go ('+':' ':t) = Just t
go _ = Nothing
findExpectLine leadin s = removeLeadin leadin s >>= go
where
go "" = Nothing
go ('.':t) = Just $ expectLine t
go ('!':' ':t) = Just $ expectError t
go (c:' ':_) | c == '#' = Nothing
go t = Just $ expectLine t
removeLeadin [] s = Just s
removeLeadin (l:ls) (c:cs) | l == c = removeLeadin ls cs
removeLeadin _ _ = Nothing
| 1,430
|
extractTests input = skipping $ zip [1..] $ lines input
where
skipping [] = []
skipping ((i,s):ls) =
case findInitialPrompt s of
Nothing -> skipping ls
Just (leadin, c0) -> command (inputLine c0 $ newTest i) leadin ls
command test leadin lls@((_,s):ls) =
case findContinuePrompt leadin s of
Nothing -> expect test leadin lls
Just c -> command (inputLine c test) leadin ls
command test leadin lls = expect test leadin lls
expect test leadin lls@((_,s):ls) =
case findExpectLine leadin s of
Nothing -> test : skipping lls
Just f -> expect (f test) leadin ls
expect test _ lls = test : skipping lls
findInitialPrompt = go ""
where
go leadin ('#':' ':s) = Just (leadin, s)
go leadin (' ':s) = go (' ':leadin) s
go _ _ = Nothing
findContinuePrompt leadin s = removeLeadin leadin s >>= go
where
go ('+':' ':t) = Just t
go _ = Nothing
findExpectLine leadin s = removeLeadin leadin s >>= go
where
go "" = Nothing
go ('.':t) = Just $ expectLine t
go ('!':' ':t) = Just $ expectError t
go (c:' ':_) | c == '#' = Nothing
go t = Just $ expectLine t
removeLeadin [] s = Just s
removeLeadin (l:ls) (c:cs) | l == c = removeLeadin ls cs
removeLeadin _ _ = Nothing
| 1,397
| false
| true
| 10
| 11
| 473
| 663
| 310
| 353
| null | null |
conal/hermit
|
src/HERMIT/Core.hs
|
bsd-2-clause
|
-- | GHC's 'exprType' function throws an error if applied to a 'Type'.
-- This function catches that case as failure in an arbitrary monad.
exprTypeM :: Monad m => CoreExpr -> m Type
exprTypeM (Type _) = fail "exprTypeM failed: expression is a type, so does not have a type."
| 277
|
exprTypeM :: Monad m => CoreExpr -> m Type
exprTypeM (Type _) = fail "exprTypeM failed: expression is a type, so does not have a type."
| 135
|
exprTypeM (Type _) = fail "exprTypeM failed: expression is a type, so does not have a type."
| 92
| true
| true
| 0
| 10
| 52
| 43
| 20
| 23
| null | null |
nevrenato/Hets_Fork
|
THF/PrintTHF.hs
|
gpl-2.0
|
prettyLowerWord :: UpperWord -> Doc
prettyLowerWord uw = text (toLower (head uw) : tail uw)
| 91
|
prettyLowerWord :: UpperWord -> Doc
prettyLowerWord uw = text (toLower (head uw) : tail uw)
| 91
|
prettyLowerWord uw = text (toLower (head uw) : tail uw)
| 55
| false
| true
| 0
| 10
| 14
| 46
| 20
| 26
| null | null |
ghc-android/ghc
|
testsuite/tests/ghci/should_run/ghcirun004.hs
|
bsd-3-clause
|
4862 = 4861
| 11
|
4862 = 4861
| 11
|
4862 = 4861
| 11
| false
| false
| 1
| 5
| 2
| 10
| 3
| 7
| null | null |
olsner/ghc
|
compiler/specialise/Rules.hs
|
bsd-3-clause
|
match :: RuleMatchEnv
-> RuleSubst
-> CoreExpr -- Template
-> CoreExpr -- Target
-> Maybe RuleSubst
-- We look through certain ticks. See note [Tick annotations in RULE matching]
match renv subst e1 (Tick t e2)
| tickishFloatable t
= match renv subst' e1 e2
where subst' = subst { rs_binds = rs_binds subst . mkTick t }
| 378
|
match :: RuleMatchEnv
-> RuleSubst
-> CoreExpr -- Template
-> CoreExpr -- Target
-> Maybe RuleSubst
match renv subst e1 (Tick t e2)
| tickishFloatable t
= match renv subst' e1 e2
where subst' = subst { rs_binds = rs_binds subst . mkTick t }
| 298
|
match renv subst e1 (Tick t e2)
| tickishFloatable t
= match renv subst' e1 e2
where subst' = subst { rs_binds = rs_binds subst . mkTick t }
| 146
| true
| true
| 1
| 12
| 116
| 108
| 48
| 60
| null | null |
jstolarek/dep-typed-wbl-heaps-hs
|
src/TwoPassMerge/CombinedProofs.hs
|
bsd-3-clause
|
rank (Node _ _ _ l r) = SSucc (rank l %:+ rank r)
| 49
|
rank (Node _ _ _ l r) = SSucc (rank l %:+ rank r)
| 49
|
rank (Node _ _ _ l r) = SSucc (rank l %:+ rank r)
| 49
| false
| false
| 0
| 8
| 13
| 39
| 18
| 21
| null | null |
Helium4Haskell/helium
|
src/Helium/Parser/ParseLibrary.hs
|
gpl-3.0
|
getLastPosition :: HParser SourcePos
getLastPosition = getState
| 63
|
getLastPosition :: HParser SourcePos
getLastPosition = getState
| 63
|
getLastPosition = getState
| 26
| false
| true
| 0
| 5
| 6
| 14
| 7
| 7
| null | null |
olorin/amazonka
|
amazonka-ec2/gen/Network/AWS/EC2/Types/Product.hs
|
mpl-2.0
|
-- | The ID of the VPC.
vclVPCId :: Lens' VPCClassicLink (Maybe Text)
vclVPCId = lens _vclVPCId (\ s a -> s{_vclVPCId = a})
| 123
|
vclVPCId :: Lens' VPCClassicLink (Maybe Text)
vclVPCId = lens _vclVPCId (\ s a -> s{_vclVPCId = a})
| 99
|
vclVPCId = lens _vclVPCId (\ s a -> s{_vclVPCId = a})
| 53
| true
| true
| 0
| 9
| 23
| 46
| 25
| 21
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.