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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ppseafield/lametetris
|
LameTetris/Game.hs
|
bsd-3-clause
|
-- | Checks if two grids collide
collide :: Grid -> Grid -> Bool
collide g1 g2 = R.foldAllS (||) False $ R.zipWith (bothJust) g1 g2
| 131
|
collide :: Grid -> Grid -> Bool
collide g1 g2 = R.foldAllS (||) False $ R.zipWith (bothJust) g1 g2
| 98
|
collide g1 g2 = R.foldAllS (||) False $ R.zipWith (bothJust) g1 g2
| 66
| true
| true
| 0
| 8
| 25
| 55
| 27
| 28
| null | null |
rahulmutt/ghcvm
|
compiler/Eta/HsSyn/HsUtils.hs
|
bsd-3-clause
|
mkVarBind :: id -> LHsExpr id -> LHsBind id
mkVarBind var rhs = L (getLoc rhs) $
VarBind { var_id = var, var_rhs = rhs, var_inline = False }
| 160
|
mkVarBind :: id -> LHsExpr id -> LHsBind id
mkVarBind var rhs = L (getLoc rhs) $
VarBind { var_id = var, var_rhs = rhs, var_inline = False }
| 160
|
mkVarBind var rhs = L (getLoc rhs) $
VarBind { var_id = var, var_rhs = rhs, var_inline = False }
| 116
| false
| true
| 2
| 8
| 48
| 72
| 35
| 37
| null | null |
AlexanderPankiv/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
csel1CoercionTyConKey = mkPreludeTyConUnique 99
| 65
|
csel1CoercionTyConKey = mkPreludeTyConUnique 99
| 65
|
csel1CoercionTyConKey = mkPreludeTyConUnique 99
| 65
| false
| false
| 0
| 5
| 21
| 9
| 4
| 5
| null | null |
sdiehl/ghc
|
compiler/coreSyn/CoreUtils.hs
|
bsd-3-clause
|
coreAltType :: CoreAlt -> Type
-- ^ Returns the type of the alternatives right hand side
coreAltType alt@(_,bs,rhs)
= case occCheckExpand bs rhs_ty of
-- Note [Existential variables and silly type synonyms]
Just ty -> ty
Nothing -> pprPanic "coreAltType" (pprCoreAlt alt $$ ppr rhs_ty)
where
rhs_ty = exprType rhs
| 339
|
coreAltType :: CoreAlt -> Type
coreAltType alt@(_,bs,rhs)
= case occCheckExpand bs rhs_ty of
-- Note [Existential variables and silly type synonyms]
Just ty -> ty
Nothing -> pprPanic "coreAltType" (pprCoreAlt alt $$ ppr rhs_ty)
where
rhs_ty = exprType rhs
| 281
|
coreAltType alt@(_,bs,rhs)
= case occCheckExpand bs rhs_ty of
-- Note [Existential variables and silly type synonyms]
Just ty -> ty
Nothing -> pprPanic "coreAltType" (pprCoreAlt alt $$ ppr rhs_ty)
where
rhs_ty = exprType rhs
| 250
| true
| true
| 0
| 11
| 75
| 85
| 43
| 42
| null | null |
kmate/HaRe
|
old/testing/asPatterns/D4.hs
|
bsd-3-clause
|
newPat_1 = Empty
| 16
|
newPat_1 = Empty
| 16
|
newPat_1 = Empty
| 16
| false
| false
| 1
| 5
| 2
| 10
| 3
| 7
| null | null |
lisperatu/subgetter
|
Core.hs
|
gpl-3.0
|
-- nice printout
showLine :: Subtitle -> String
showLine sub = printf "%s %s at %s" name lang url where
name = movieName s
lang = subtitleLang s
url = subtitleUrl s
s = sub
-- convert from xml
| 217
|
showLine :: Subtitle -> String
showLine sub = printf "%s %s at %s" name lang url where
name = movieName s
lang = subtitleLang s
url = subtitleUrl s
s = sub
-- convert from xml
| 200
|
showLine sub = printf "%s %s at %s" name lang url where
name = movieName s
lang = subtitleLang s
url = subtitleUrl s
s = sub
-- convert from xml
| 169
| true
| true
| 4
| 7
| 63
| 79
| 32
| 47
| null | null |
daniel-ziegler/provability
|
src/Modal/Games.hs
|
bsd-3-clause
|
pdGameMap :: Map (U2 PD CorD CorD) (ModalFormula (U2 PD CorD CorD))
pdGameMap = gameMap2 prisonersDilemma udtA udtB where
udtA = udt' [DC, CC, DD, CD] [D, C] D
udtB = udt' [CD, CC, DD, DC] [D, C] D
| 201
|
pdGameMap :: Map (U2 PD CorD CorD) (ModalFormula (U2 PD CorD CorD))
pdGameMap = gameMap2 prisonersDilemma udtA udtB where
udtA = udt' [DC, CC, DD, CD] [D, C] D
udtB = udt' [CD, CC, DD, DC] [D, C] D
| 201
|
pdGameMap = gameMap2 prisonersDilemma udtA udtB where
udtA = udt' [DC, CC, DD, CD] [D, C] D
udtB = udt' [CD, CC, DD, DC] [D, C] D
| 133
| false
| true
| 0
| 9
| 42
| 110
| 61
| 49
| null | null |
felixsch/schnizle
|
Schnizle/Fields.hs
|
gpl-3.0
|
relatedLinksField :: Int -> String -> RelatedLinks -> Context Related -> Context a
relatedLinksField n name (RelatedLinks map' tags') ctx = listFieldWith name ctx $ \item -> do
needle <- getTags $ itemIdentifier item
ids <- return $ clean item $ findRelatedByTags tags' needle
related <- return $ fetchRelated map' $ clearIds $ sortByFrequency ids
return $ map relatedToItem related
where
clean item = filter (itemIdentifier item /=)
clearIds = take n . nub
relatedToItem related = Item (relatedId related) related
| 544
|
relatedLinksField :: Int -> String -> RelatedLinks -> Context Related -> Context a
relatedLinksField n name (RelatedLinks map' tags') ctx = listFieldWith name ctx $ \item -> do
needle <- getTags $ itemIdentifier item
ids <- return $ clean item $ findRelatedByTags tags' needle
related <- return $ fetchRelated map' $ clearIds $ sortByFrequency ids
return $ map relatedToItem related
where
clean item = filter (itemIdentifier item /=)
clearIds = take n . nub
relatedToItem related = Item (relatedId related) related
| 544
|
relatedLinksField n name (RelatedLinks map' tags') ctx = listFieldWith name ctx $ \item -> do
needle <- getTags $ itemIdentifier item
ids <- return $ clean item $ findRelatedByTags tags' needle
related <- return $ fetchRelated map' $ clearIds $ sortByFrequency ids
return $ map relatedToItem related
where
clean item = filter (itemIdentifier item /=)
clearIds = take n . nub
relatedToItem related = Item (relatedId related) related
| 461
| false
| true
| 2
| 13
| 110
| 189
| 88
| 101
| null | null |
d-rive/rivers
|
Data/Rivers/Streams.hs
|
bsd-3-clause
|
(a:as) <<| s = a <|| (as <<| s)
| 33
|
(a:as) <<| s = a <|| (as <<| s)
| 33
|
(a:as) <<| s = a <|| (as <<| s)
| 33
| false
| false
| 0
| 7
| 10
| 30
| 15
| 15
| null | null |
rebeccaskinner/ConfigFiles
|
personal/xmonad.hs
|
lgpl-3.0
|
configureKeyboardMouse =
spawn "xset m 5 1" >>
spawn "setxkbmap -option ctrl:nocaps"
| 88
|
configureKeyboardMouse =
spawn "xset m 5 1" >>
spawn "setxkbmap -option ctrl:nocaps"
| 88
|
configureKeyboardMouse =
spawn "xset m 5 1" >>
spawn "setxkbmap -option ctrl:nocaps"
| 88
| false
| false
| 3
| 5
| 15
| 21
| 7
| 14
| null | null |
adolfosilva/granada
|
tests/Granada/Tests/Parser.hs
|
gpl-3.0
|
unitTests = testGroup "Granada.Parser"
[ testCase "List comparison (different length)" $
[1, 2, 3] `compare` [1,2] @?= GT
-- the following test does not hold
, testCase "List comparison (same length)" $
[1, 2, 3] `compare` [1,2,2] @?= GT
]
| 260
|
unitTests = testGroup "Granada.Parser"
[ testCase "List comparison (different length)" $
[1, 2, 3] `compare` [1,2] @?= GT
-- the following test does not hold
, testCase "List comparison (same length)" $
[1, 2, 3] `compare` [1,2,2] @?= GT
]
| 260
|
unitTests = testGroup "Granada.Parser"
[ testCase "List comparison (different length)" $
[1, 2, 3] `compare` [1,2] @?= GT
-- the following test does not hold
, testCase "List comparison (same length)" $
[1, 2, 3] `compare` [1,2,2] @?= GT
]
| 260
| false
| false
| 1
| 10
| 60
| 90
| 50
| 40
| null | null |
philipcraig/hutton
|
src/Exercises/ChapterTen.hs
|
bsd-3-clause
|
adder' :: Int -> Int -> IO ()
adder' t r = do
x <- getLine
let total = t + read x :: Int
if r == 1
then putStrLn $ "The total is " ++ show total
else adder' total (r - 1)
| 184
|
adder' :: Int -> Int -> IO ()
adder' t r = do
x <- getLine
let total = t + read x :: Int
if r == 1
then putStrLn $ "The total is " ++ show total
else adder' total (r - 1)
| 184
|
adder' t r = do
x <- getLine
let total = t + read x :: Int
if r == 1
then putStrLn $ "The total is " ++ show total
else adder' total (r - 1)
| 154
| false
| true
| 0
| 11
| 58
| 93
| 45
| 48
| null | null |
spinda/liquidhaskell
|
tests/gsoc15/unknown/pos/RealProps.hs
|
bsd-3-clause
|
mulId :: Double -> Bool
mulId x = x == 1 * x
| 44
|
mulId :: Double -> Bool
mulId x = x == 1 * x
| 44
|
mulId x = x == 1 * x
| 20
| false
| true
| 1
| 7
| 12
| 32
| 14
| 18
| null | null |
leepike/copilot-sbv
|
src/Copilot/Compile/SBV/Witness.hs
|
bsd-3-clause
|
castErr :: a
castErr = C.badUsage $ "the SBV backend does not currently support casts to signed word types"
| 107
|
castErr :: a
castErr = C.badUsage $ "the SBV backend does not currently support casts to signed word types"
| 107
|
castErr = C.badUsage $ "the SBV backend does not currently support casts to signed word types"
| 94
| false
| true
| 0
| 6
| 18
| 17
| 9
| 8
| null | null |
alexander-at-github/eta
|
compiler/ETA/SimplCore/CallArity.hs
|
bsd-3-clause
|
resDel :: Var -> CallArityRes -> CallArityRes
resDel v (g, ae) = (g `delNode` v, ae `delVarEnv` v)
| 98
|
resDel :: Var -> CallArityRes -> CallArityRes
resDel v (g, ae) = (g `delNode` v, ae `delVarEnv` v)
| 98
|
resDel v (g, ae) = (g `delNode` v, ae `delVarEnv` v)
| 52
| false
| true
| 0
| 9
| 17
| 54
| 29
| 25
| null | null |
jhartikainen/hwo2014bot
|
Brain.hs
|
apache-2.0
|
isSwitch :: Piece -> Bool
isSwitch = switch
| 44
|
isSwitch :: Piece -> Bool
isSwitch = switch
| 43
|
isSwitch = switch
| 17
| false
| true
| 0
| 5
| 8
| 15
| 8
| 7
| null | null |
zaxtax/naive_bayes
|
NBHakaru.hs
|
bsd-3-clause
|
now :: IO Time
now = getCurrentTime
| 35
|
now :: IO Time
now = getCurrentTime
| 35
|
now = getCurrentTime
| 20
| false
| true
| 0
| 5
| 6
| 14
| 7
| 7
| null | null |
nushio3/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
dATA_ARRAY_PARALLEL_PRIM_NAME = mkModuleNameFS (fsLit "Data.Array.Parallel.Prim")
| 81
|
dATA_ARRAY_PARALLEL_PRIM_NAME = mkModuleNameFS (fsLit "Data.Array.Parallel.Prim")
| 81
|
dATA_ARRAY_PARALLEL_PRIM_NAME = mkModuleNameFS (fsLit "Data.Array.Parallel.Prim")
| 81
| false
| false
| 0
| 7
| 4
| 15
| 7
| 8
| null | null |
nikitadanilov/sequuntur
|
sequuntur.hs
|
mit
|
-- builds a new grammar to applying given function to the right-hand-sides of
-- the original grammar.
mapRhsG :: ([Symbol a] -> [Symbol a]) -> Grammar a -> Grammar a
mapRhsG f g = mapG (\(P lhs rhs) -> P lhs (f rhs)) g
| 219
|
mapRhsG :: ([Symbol a] -> [Symbol a]) -> Grammar a -> Grammar a
mapRhsG f g = mapG (\(P lhs rhs) -> P lhs (f rhs)) g
| 116
|
mapRhsG f g = mapG (\(P lhs rhs) -> P lhs (f rhs)) g
| 52
| true
| true
| 0
| 10
| 43
| 83
| 42
| 41
| null | null |
bitemyapp/persistent
|
persistent-sqlite/Database/Persist/Sqlite.hs
|
mit
|
showSqlType SqlDayTime = "TIMESTAMP"
| 36
|
showSqlType SqlDayTime = "TIMESTAMP"
| 36
|
showSqlType SqlDayTime = "TIMESTAMP"
| 36
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
scslab/hails
|
tests/DatabaseTests.hs
|
mit
|
typeCheckDocument_all_named_exist_fail2 :: Property
typeCheckDocument_all_named_exist_fail2 = monadicDC $ do
doc2 <- pick arbitrary
pre $ any isPolicyLabeled doc2
pl1 <- hasPolicy `liftM` pick arbitrary
pl2 <- needPolicy `liftM` pick arbitrary
let doc = [ "s1" -: (1 :: Int), "s3" -: (3 :: Int), "s2" -: (2 :: Int)
, "x1" -: (4 :: Int), "p1" -: pl1, "p2" -: pl2]
`merge` doc2
res <- run $ (typeCheckDocument typeCheckDoc_policies doc >> return False)
`catch` (constCatch $ return True)
Q.assert res
--
-- Test applyCollection policy
--
-- | Apply all-public policies
| 624
|
typeCheckDocument_all_named_exist_fail2 :: Property
typeCheckDocument_all_named_exist_fail2 = monadicDC $ do
doc2 <- pick arbitrary
pre $ any isPolicyLabeled doc2
pl1 <- hasPolicy `liftM` pick arbitrary
pl2 <- needPolicy `liftM` pick arbitrary
let doc = [ "s1" -: (1 :: Int), "s3" -: (3 :: Int), "s2" -: (2 :: Int)
, "x1" -: (4 :: Int), "p1" -: pl1, "p2" -: pl2]
`merge` doc2
res <- run $ (typeCheckDocument typeCheckDoc_policies doc >> return False)
`catch` (constCatch $ return True)
Q.assert res
--
-- Test applyCollection policy
--
-- | Apply all-public policies
| 624
|
typeCheckDocument_all_named_exist_fail2 = monadicDC $ do
doc2 <- pick arbitrary
pre $ any isPolicyLabeled doc2
pl1 <- hasPolicy `liftM` pick arbitrary
pl2 <- needPolicy `liftM` pick arbitrary
let doc = [ "s1" -: (1 :: Int), "s3" -: (3 :: Int), "s2" -: (2 :: Int)
, "x1" -: (4 :: Int), "p1" -: pl1, "p2" -: pl2]
`merge` doc2
res <- run $ (typeCheckDocument typeCheckDoc_policies doc >> return False)
`catch` (constCatch $ return True)
Q.assert res
--
-- Test applyCollection policy
--
-- | Apply all-public policies
| 572
| false
| true
| 0
| 14
| 147
| 204
| 109
| 95
| null | null |
SamirTalwar/advent-of-code
|
2021/AOC_15_1.hs
|
mit
|
cumulative :: Grid Int -> Map Point Int -> Grid Int
cumulative grid current
| null current = grid
| otherwise =
let updates = Map.fromListWith min $ map (\(point, restValue) -> (point, (grid ! point) + restValue)) $ Map.toList current
updatedGrid = grid // Map.toList updates
next = Map.fromListWith min $ concatMap (\point -> map (,updatedGrid ! point) $ filter (< point) $ toList $ Grid.neighboringPoints point grid) $ Map.keys updates
in cumulative updatedGrid next
| 497
|
cumulative :: Grid Int -> Map Point Int -> Grid Int
cumulative grid current
| null current = grid
| otherwise =
let updates = Map.fromListWith min $ map (\(point, restValue) -> (point, (grid ! point) + restValue)) $ Map.toList current
updatedGrid = grid // Map.toList updates
next = Map.fromListWith min $ concatMap (\point -> map (,updatedGrid ! point) $ filter (< point) $ toList $ Grid.neighboringPoints point grid) $ Map.keys updates
in cumulative updatedGrid next
| 497
|
cumulative grid current
| null current = grid
| otherwise =
let updates = Map.fromListWith min $ map (\(point, restValue) -> (point, (grid ! point) + restValue)) $ Map.toList current
updatedGrid = grid // Map.toList updates
next = Map.fromListWith min $ concatMap (\point -> map (,updatedGrid ! point) $ filter (< point) $ toList $ Grid.neighboringPoints point grid) $ Map.keys updates
in cumulative updatedGrid next
| 445
| false
| true
| 1
| 19
| 104
| 204
| 101
| 103
| null | null |
nesiax/melisa
|
src/Lib.hs
|
agpl-3.0
|
--t = Node 'a' [Node 'c' [Leaf 4,Node 'e' [Leaf 5, Node '6' []]] , Node 'e' []] :: Chart Int Char
--t= a0 :: Chart Account Char
--data ChartX a b = Leaf a | Node b [(Chart a b)] deriving Show
t0 = Node a0 [ Leaf a1 ] :: Chart Account Account
| 243
|
t0 = Node a0 [ Leaf a1 ] :: Chart Account Account
| 49
|
t0 = Node a0 [ Leaf a1 ] :: Chart Account Account
| 49
| true
| false
| 0
| 7
| 56
| 31
| 16
| 15
| null | null |
nwf/ansi-wl-pprint
|
Text/PrettyPrint/ANSI/Leijen.hs
|
bsd-2-clause
|
-- | Displays a document with no underlining
deunderline :: Doc -> Doc
deunderline = Annotate (AEUnderline NoUnderline)
| 119
|
deunderline :: Doc -> Doc
deunderline = Annotate (AEUnderline NoUnderline)
| 74
|
deunderline = Annotate (AEUnderline NoUnderline)
| 48
| true
| true
| 0
| 7
| 17
| 25
| 13
| 12
| null | null |
siddhanathan/yi
|
yi-language/src/Yi/Style.hs
|
gpl-2.0
|
purple = RGB 128 0 128
| 27
|
purple = RGB 128 0 128
| 27
|
purple = RGB 128 0 128
| 27
| false
| false
| 1
| 5
| 10
| 19
| 6
| 13
| null | null |
idf/commons-util-haskell
|
fundamentals/12_monads_more.hs
|
bsd-3-clause
|
{-
threeCoins is now a stateful computations and after taking an initial random generator, it passes
it to the first randomSt, which produces a number and a new generator, which gets passed to the next one and so on.
do notation: auto feed to the next line.
Need an initial feed
-}
threeCoins :: State StdGen (Bool,Bool,Bool)
threeCoins = do
a <- randomSt
b <- randomSt
c <- randomSt
return (a,b,c)
| 419
|
threeCoins :: State StdGen (Bool,Bool,Bool)
threeCoins = do
a <- randomSt
b <- randomSt
c <- randomSt
return (a,b,c)
| 132
|
threeCoins = do
a <- randomSt
b <- randomSt
c <- randomSt
return (a,b,c)
| 88
| true
| true
| 0
| 8
| 91
| 62
| 32
| 30
| null | null |
anchor/servant-purescript
|
test/Spec.hs
|
bsd-3-clause
|
main :: IO ()
main = hspec .
describe "generateJS" $ do
it "should generate valid purescript" $ do
let (postSimple :<|> getHasExtension ) = jquery (Proxy :: Proxy TestAPI)
shouldParse $ generatePSModule defaultSettings "Foo" [postSimple]
shouldParse $ generatePSModule defaultSettings "Foo" [getHasExtension]
it "should use non-empty function names" $ do
let (_ :<|> topLevel) = jquery (Proxy :: Proxy TopLevelRawAPI)
let m = generatePSModule defaultSettings "Foo" [topLevel "GET"]
shouldParse m
m `shouldContain` "get :: "
it "should generate valid header variables" $ do
let (gs :<|> _) = jquery headerHandlingProxy
let m = generatePSModule defaultSettings "Bar" [gs]
shouldParse m
m `shouldContain` " foo :: String"
m `shouldContain` "foo: headerFoo"
| 925
|
main :: IO ()
main = hspec .
describe "generateJS" $ do
it "should generate valid purescript" $ do
let (postSimple :<|> getHasExtension ) = jquery (Proxy :: Proxy TestAPI)
shouldParse $ generatePSModule defaultSettings "Foo" [postSimple]
shouldParse $ generatePSModule defaultSettings "Foo" [getHasExtension]
it "should use non-empty function names" $ do
let (_ :<|> topLevel) = jquery (Proxy :: Proxy TopLevelRawAPI)
let m = generatePSModule defaultSettings "Foo" [topLevel "GET"]
shouldParse m
m `shouldContain` "get :: "
it "should generate valid header variables" $ do
let (gs :<|> _) = jquery headerHandlingProxy
let m = generatePSModule defaultSettings "Bar" [gs]
shouldParse m
m `shouldContain` " foo :: String"
m `shouldContain` "foo: headerFoo"
| 925
|
main = hspec .
describe "generateJS" $ do
it "should generate valid purescript" $ do
let (postSimple :<|> getHasExtension ) = jquery (Proxy :: Proxy TestAPI)
shouldParse $ generatePSModule defaultSettings "Foo" [postSimple]
shouldParse $ generatePSModule defaultSettings "Foo" [getHasExtension]
it "should use non-empty function names" $ do
let (_ :<|> topLevel) = jquery (Proxy :: Proxy TopLevelRawAPI)
let m = generatePSModule defaultSettings "Foo" [topLevel "GET"]
shouldParse m
m `shouldContain` "get :: "
it "should generate valid header variables" $ do
let (gs :<|> _) = jquery headerHandlingProxy
let m = generatePSModule defaultSettings "Bar" [gs]
shouldParse m
m `shouldContain` " foo :: String"
m `shouldContain` "foo: headerFoo"
| 911
| false
| true
| 0
| 16
| 280
| 249
| 116
| 133
| null | null |
music-suite/music-score
|
src/Music/Time/Internal/Util.hs
|
bsd-3-clause
|
-- withNext = go
-- where
-- go [] = []
-- go [x] = [(x, Nothing)]
-- go (x:y:rs) = (x, Just y) : withNext (y : rs)
withPrevNext :: [a] -> [(Maybe a, a, Maybe a)]
withPrevNext xs = zip3 (pure Nothing ++ fmap Just xs) xs (fmap Just (tail xs) ++ repeat Nothing)
| 299
|
withPrevNext :: [a] -> [(Maybe a, a, Maybe a)]
withPrevNext xs = zip3 (pure Nothing ++ fmap Just xs) xs (fmap Just (tail xs) ++ repeat Nothing)
| 143
|
withPrevNext xs = zip3 (pure Nothing ++ fmap Just xs) xs (fmap Just (tail xs) ++ repeat Nothing)
| 96
| true
| true
| 0
| 10
| 95
| 87
| 46
| 41
| null | null |
sighingnow/Functional-99-Problems
|
Haskell/41.hs
|
mit
|
where m = floor . sqrt $ fromIntegral n
| 39
|
where m = floor . sqrt $ fromIntegral n
| 39
|
where m = floor . sqrt $ fromIntegral n
| 39
| false
| false
| 0
| 6
| 8
| 20
| 9
| 11
| null | null |
itsbruce/hackerrank
|
euler/2_sum_even_fibs.hs
|
unlicense
|
sumEvenFibs n = sum $ filter even $ takeWhile (<= n) fibs
| 57
|
sumEvenFibs n = sum $ filter even $ takeWhile (<= n) fibs
| 57
|
sumEvenFibs n = sum $ filter even $ takeWhile (<= n) fibs
| 57
| false
| false
| 0
| 7
| 11
| 29
| 14
| 15
| null | null |
hamishmack/haskell-gi
|
lib/Data/GI/CodeGen/Overrides.hs
|
lgpl-2.1
|
filterOneAPI _ (n, APIObject o, Just ignores) =
(n, APIObject o {objMethods = filterMethods (objMethods o) ignores,
objSignals = filter ((`S.notMember` ignores) . sigName)
(objSignals o)
})
| 268
|
filterOneAPI _ (n, APIObject o, Just ignores) =
(n, APIObject o {objMethods = filterMethods (objMethods o) ignores,
objSignals = filter ((`S.notMember` ignores) . sigName)
(objSignals o)
})
| 268
|
filterOneAPI _ (n, APIObject o, Just ignores) =
(n, APIObject o {objMethods = filterMethods (objMethods o) ignores,
objSignals = filter ((`S.notMember` ignores) . sigName)
(objSignals o)
})
| 268
| false
| false
| 1
| 13
| 105
| 89
| 47
| 42
| null | null |
ssaavedra/liquidhaskell
|
src/Language/Haskell/Liquid/Constraint/Env.hs
|
bsd-3-clause
|
fromListREnv :: [(F.Symbol, SpecType)] -> [(F.Symbol, SpecType)] -> REnv
fromListREnv gXts lXts = REnv
{ reGlobal = M.fromList gXts
, reLocal = M.fromList lXts
}
| 168
|
fromListREnv :: [(F.Symbol, SpecType)] -> [(F.Symbol, SpecType)] -> REnv
fromListREnv gXts lXts = REnv
{ reGlobal = M.fromList gXts
, reLocal = M.fromList lXts
}
| 168
|
fromListREnv gXts lXts = REnv
{ reGlobal = M.fromList gXts
, reLocal = M.fromList lXts
}
| 95
| false
| true
| 0
| 9
| 31
| 78
| 41
| 37
| null | null |
jonathanknowles/hs-type-level-prime-product
|
Data/TypeLevel/PrimeProduct/SparseTest.hs
|
bsd-3-clause
|
m5 = undefined :: Multiply (P2:^:N1:::E) (P2:^:P1:::E) E => x
| 73
|
m5 = undefined :: Multiply (P2:^:N1:::E) (P2:^:P1:::E) E => x
| 73
|
m5 = undefined :: Multiply (P2:^:N1:::E) (P2:^:P1:::E) E => x
| 73
| false
| false
| 0
| 9
| 21
| 42
| 22
| 20
| null | null |
forked-upstream-packages-for-ghcjs/ghc
|
compiler/codeGen/StgCmmPrim.hs
|
bsd-3-clause
|
-- ----------------------------------------------------------------------------
-- Misc utils
cmmIndexOffExpr :: DynFlags
-> ByteOff -- Initial offset in bytes
-> Width -- Width of element by which we are indexing
-> CmmExpr -- Base address
-> CmmExpr -- Index
-> CmmExpr
cmmIndexOffExpr dflags off width base idx
= cmmIndexExpr dflags width (cmmOffsetB dflags base off) idx
| 464
|
cmmIndexOffExpr :: DynFlags
-> ByteOff -- Initial offset in bytes
-> Width -- Width of element by which we are indexing
-> CmmExpr -- Base address
-> CmmExpr -- Index
-> CmmExpr
cmmIndexOffExpr dflags off width base idx
= cmmIndexExpr dflags width (cmmOffsetB dflags base off) idx
| 369
|
cmmIndexOffExpr dflags off width base idx
= cmmIndexExpr dflags width (cmmOffsetB dflags base off) idx
| 105
| true
| true
| 0
| 9
| 141
| 67
| 36
| 31
| null | null |
fmthoma/ghc
|
compiler/main/ErrUtils.hs
|
bsd-3-clause
|
showPass :: DynFlags -> String -> IO ()
showPass dflags what
= ifVerbose dflags 2 $
logInfo dflags defaultUserStyle (text "***" <+> text what <> colon)
| 157
|
showPass :: DynFlags -> String -> IO ()
showPass dflags what
= ifVerbose dflags 2 $
logInfo dflags defaultUserStyle (text "***" <+> text what <> colon)
| 157
|
showPass dflags what
= ifVerbose dflags 2 $
logInfo dflags defaultUserStyle (text "***" <+> text what <> colon)
| 117
| false
| true
| 0
| 10
| 31
| 62
| 29
| 33
| null | null |
gbwey/persistentold
|
persistent-mysql/Database/Persist/MySQL.hs
|
mit
|
-- Double
parseType "float" = return SqlReal
| 49
|
parseType "float" = return SqlReal
| 39
|
parseType "float" = return SqlReal
| 39
| true
| false
| 0
| 5
| 11
| 13
| 6
| 7
| null | null |
mikeizbicki/dominion
|
src/Dominion/Rules.hs
|
bsd-3-clause
|
cleanUpPhase :: MonadRandom m => PlayerState -> m PlayerState
cleanUpPhase ps = drawCards 5 $ PlayerState
{ deck = deck ps
, deckTop = deckTop ps
, hand = []
, played = []
, discard = hand ps ++ played ps ++ discard ps
, actions = 1
, buys = 1
, money = 0
, turnsCompleted = turnsCompleted ps + 1
}
| 338
|
cleanUpPhase :: MonadRandom m => PlayerState -> m PlayerState
cleanUpPhase ps = drawCards 5 $ PlayerState
{ deck = deck ps
, deckTop = deckTop ps
, hand = []
, played = []
, discard = hand ps ++ played ps ++ discard ps
, actions = 1
, buys = 1
, money = 0
, turnsCompleted = turnsCompleted ps + 1
}
| 338
|
cleanUpPhase ps = drawCards 5 $ PlayerState
{ deck = deck ps
, deckTop = deckTop ps
, hand = []
, played = []
, discard = hand ps ++ played ps ++ discard ps
, actions = 1
, buys = 1
, money = 0
, turnsCompleted = turnsCompleted ps + 1
}
| 276
| false
| true
| 0
| 10
| 104
| 129
| 68
| 61
| null | null |
green-haskell/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
-- |||
loopAIdKey = mkPreludeMiscIdUnique 185
| 51
|
loopAIdKey = mkPreludeMiscIdUnique 185
| 43
|
loopAIdKey = mkPreludeMiscIdUnique 185
| 43
| true
| false
| 0
| 5
| 11
| 10
| 5
| 5
| null | null |
siddhanathan/ghc
|
libraries/template-haskell/Language/Haskell/TH/PprLib.hs
|
bsd-3-clause
|
brackets = liftM HPJ.brackets
| 29
|
brackets = liftM HPJ.brackets
| 29
|
brackets = liftM HPJ.brackets
| 29
| false
| false
| 1
| 6
| 3
| 14
| 5
| 9
| null | null |
thalerjonathan/phd
|
coding/prototyping/haskell/PureAgentsSTM/src/SIRS/SIRSModel.hs
|
gpl-3.0
|
sirsMsgHandler :: SIRSMsgHandler
-- MESSAGE-CASE: Contact with Infected -> infect with given probability if agent is susceptibel
sirsMsgHandler a (Contact Infected) _ -- NOTE: ignore sender
| is a Susceptible = return (infectAgent a)
| otherwise = return a
| 278
|
sirsMsgHandler :: SIRSMsgHandler
sirsMsgHandler a (Contact Infected) _ -- NOTE: ignore sender
| is a Susceptible = return (infectAgent a)
| otherwise = return a
| 182
|
sirsMsgHandler a (Contact Infected) _ -- NOTE: ignore sender
| is a Susceptible = return (infectAgent a)
| otherwise = return a
| 149
| true
| true
| 1
| 8
| 60
| 56
| 27
| 29
| null | null |
sopvop/cabal
|
cabal-install/Distribution/Client/List.hs
|
bsd-3-clause
|
interestingVersions :: (Version -> Bool) -> [Version] -> [Version]
interestingVersions pref =
map ((\ns -> Version ns []) . fst) . filter snd
. concat . Tree.levels
. swizzleTree
. reorderTree (\(Node (v,_) _) -> pref (Version v []))
. reverseTree
. mkTree
. map versionBranch
where
swizzleTree = unfoldTree (spine [])
where
spine ts' (Node x []) = (x, ts')
spine ts' (Node x (t:ts)) = spine (Node x ts:ts') t
reorderTree _ (Node x []) = Node x []
reorderTree p (Node x ts) = Node x (ts' ++ ts'')
where
(ts',ts'') = partition p (map (reorderTree p) ts)
reverseTree (Node x cs) = Node x (reverse (map reverseTree cs))
mkTree xs = unfoldTree step (False, [], xs)
where
step (node,ns,vs) =
( (reverse ns, node)
, [ (any null vs', n:ns, filter (not . null) vs')
| (n, vs') <- groups vs ]
)
groups = map (\g -> (head (head g), map tail g))
. groupBy (equating head)
| 1,036
|
interestingVersions :: (Version -> Bool) -> [Version] -> [Version]
interestingVersions pref =
map ((\ns -> Version ns []) . fst) . filter snd
. concat . Tree.levels
. swizzleTree
. reorderTree (\(Node (v,_) _) -> pref (Version v []))
. reverseTree
. mkTree
. map versionBranch
where
swizzleTree = unfoldTree (spine [])
where
spine ts' (Node x []) = (x, ts')
spine ts' (Node x (t:ts)) = spine (Node x ts:ts') t
reorderTree _ (Node x []) = Node x []
reorderTree p (Node x ts) = Node x (ts' ++ ts'')
where
(ts',ts'') = partition p (map (reorderTree p) ts)
reverseTree (Node x cs) = Node x (reverse (map reverseTree cs))
mkTree xs = unfoldTree step (False, [], xs)
where
step (node,ns,vs) =
( (reverse ns, node)
, [ (any null vs', n:ns, filter (not . null) vs')
| (n, vs') <- groups vs ]
)
groups = map (\g -> (head (head g), map tail g))
. groupBy (equating head)
| 1,036
|
interestingVersions pref =
map ((\ns -> Version ns []) . fst) . filter snd
. concat . Tree.levels
. swizzleTree
. reorderTree (\(Node (v,_) _) -> pref (Version v []))
. reverseTree
. mkTree
. map versionBranch
where
swizzleTree = unfoldTree (spine [])
where
spine ts' (Node x []) = (x, ts')
spine ts' (Node x (t:ts)) = spine (Node x ts:ts') t
reorderTree _ (Node x []) = Node x []
reorderTree p (Node x ts) = Node x (ts' ++ ts'')
where
(ts',ts'') = partition p (map (reorderTree p) ts)
reverseTree (Node x cs) = Node x (reverse (map reverseTree cs))
mkTree xs = unfoldTree step (False, [], xs)
where
step (node,ns,vs) =
( (reverse ns, node)
, [ (any null vs', n:ns, filter (not . null) vs')
| (n, vs') <- groups vs ]
)
groups = map (\g -> (head (head g), map tail g))
. groupBy (equating head)
| 969
| false
| true
| 12
| 11
| 337
| 547
| 264
| 283
| null | null |
andorp/hs-bluesnap
|
src/Bluesnap/API/Response.hs
|
gpl-3.0
|
elementToXMLInitial_period :: Initial_period -> [Content ()]
elementToXMLInitial_period = schemaTypeToXML "initial-period"
| 122
|
elementToXMLInitial_period :: Initial_period -> [Content ()]
elementToXMLInitial_period = schemaTypeToXML "initial-period"
| 122
|
elementToXMLInitial_period = schemaTypeToXML "initial-period"
| 61
| false
| true
| 0
| 8
| 9
| 26
| 13
| 13
| null | null |
bocuma/users-service
|
src/Helpers/Config.hs
|
mit
|
getEnvOr :: String -> String -> IO Text
getEnvOr key defaultValue = do
value <- lookupEnv key
case value of
Just something -> return $ pack something
Nothing -> return $ pack defaultValue
| 201
|
getEnvOr :: String -> String -> IO Text
getEnvOr key defaultValue = do
value <- lookupEnv key
case value of
Just something -> return $ pack something
Nothing -> return $ pack defaultValue
| 201
|
getEnvOr key defaultValue = do
value <- lookupEnv key
case value of
Just something -> return $ pack something
Nothing -> return $ pack defaultValue
| 161
| false
| true
| 0
| 11
| 46
| 73
| 33
| 40
| null | null |
diku-dk/futhark
|
src/Futhark/Optimise/DoubleBuffer.hs
|
isc
|
optimiseMCOp :: OptimiseOp MCMem
optimiseMCOp (Inner (ParOp par_op op)) =
local inSegOp $
Inner
<$> (ParOp <$> traverse (mapSegOpM mapper) par_op <*> mapSegOpM mapper op)
where
mapper =
identitySegOpMapper
{ mapOnSegOpLambda = optimiseLambda,
mapOnSegOpBody = optimiseKernelBody
}
inSegOp env = env {envOptimiseLoop = optimiseLoop}
| 385
|
optimiseMCOp :: OptimiseOp MCMem
optimiseMCOp (Inner (ParOp par_op op)) =
local inSegOp $
Inner
<$> (ParOp <$> traverse (mapSegOpM mapper) par_op <*> mapSegOpM mapper op)
where
mapper =
identitySegOpMapper
{ mapOnSegOpLambda = optimiseLambda,
mapOnSegOpBody = optimiseKernelBody
}
inSegOp env = env {envOptimiseLoop = optimiseLoop}
| 385
|
optimiseMCOp (Inner (ParOp par_op op)) =
local inSegOp $
Inner
<$> (ParOp <$> traverse (mapSegOpM mapper) par_op <*> mapSegOpM mapper op)
where
mapper =
identitySegOpMapper
{ mapOnSegOpLambda = optimiseLambda,
mapOnSegOpBody = optimiseKernelBody
}
inSegOp env = env {envOptimiseLoop = optimiseLoop}
| 352
| false
| true
| 1
| 11
| 97
| 108
| 55
| 53
| null | null |
sthiele/hasple
|
Assignment.hs
|
gpl-3.0
|
unassign :: Assignment -> SVar -> Assignment
-- unassign a variable
unassign a l = a UVec.// [(l,0)]
| 101
|
unassign :: Assignment -> SVar -> Assignment
unassign a l = a UVec.// [(l,0)]
| 78
|
unassign a l = a UVec.// [(l,0)]
| 33
| true
| true
| 0
| 7
| 18
| 40
| 22
| 18
| null | null |
truls/almique
|
src/Almique/Binder.hs
|
gpl-3.0
|
checkStmt _ s = return (s, [])
| 30
|
checkStmt _ s = return (s, [])
| 30
|
checkStmt _ s = return (s, [])
| 30
| false
| false
| 1
| 7
| 6
| 22
| 11
| 11
| null | null |
Palmik/suspend
|
src/Control/Concurrent/Suspend.hs
|
bsd-3-clause
|
------------------------------------------------------------------------------
-- | Analogy of `Control.Concurrent.threadDelay` that allows for longer delays.
--
-- Suspends the current thread for the given delay (GHC only).
--
-- There is no guarantee that the thread will be rescheduled promptly when the
-- delay has expired, but the thread will never continue to run earlier than specified.
suspend :: Delay -> IO ()
suspend (Delay us) = when (us > 0) $ do
let wait = min us $ fromIntegral (maxBound :: Int)
threadDelay (fromIntegral wait)
suspend $! Delay (us - wait)
| 586
|
suspend :: Delay -> IO ()
suspend (Delay us) = when (us > 0) $ do
let wait = min us $ fromIntegral (maxBound :: Int)
threadDelay (fromIntegral wait)
suspend $! Delay (us - wait)
| 190
|
suspend (Delay us) = when (us > 0) $ do
let wait = min us $ fromIntegral (maxBound :: Int)
threadDelay (fromIntegral wait)
suspend $! Delay (us - wait)
| 164
| true
| true
| 0
| 13
| 101
| 104
| 53
| 51
| null | null |
mikolajsacha/HaskellPics
|
otsu.hs
|
gpl-3.0
|
threshold :: R.Array U sh Double -> Int -> IO Double
threshold arr buckets = do
hist <- histogram arr buckets
return $ histThreshold hist
| 143
|
threshold :: R.Array U sh Double -> Int -> IO Double
threshold arr buckets = do
hist <- histogram arr buckets
return $ histThreshold hist
| 143
|
threshold arr buckets = do
hist <- histogram arr buckets
return $ histThreshold hist
| 90
| false
| true
| 0
| 8
| 30
| 58
| 26
| 32
| null | null |
barrucadu/irc-client
|
Network/IRC/Client/Events.hs
|
mit
|
nickMangler :: EventHandler s
nickMangler = EventHandler (\ev -> matcher 432 fresh ev <|> matcher 433 mangle ev <|> matcher 436 mangle ev) $ \_ -> uncurry go
where
matcher num f ev = case _message ev of
Numeric n args | num == n -> Just (f, args)
_ -> Nothing
go f (_:srvNick:_) = do
theNick <- get nick <$> (snapshot instanceConfig =<< getIRCState)
-- If the length of our nick and the server's idea of our nick
-- differ, it was truncated - so calculate the allowable length.
let nicklen = if T.length srvNick /= T.length theNick
then Just $ T.length srvNick
else Nothing
setNick . trunc nicklen $ f srvNick
go _ _ = return ()
fresh n = if T.length n' == 0 then "f" else n'
where n' = T.filter isAlphaNum n
mangle n = (n <> "1") `fromMaybe` charsubst n
-- Truncate a nick, if there is a known length limit.
trunc len txt = maybe txt (`takeEnd` txt) len
-- List of substring substitutions. It's important that these
-- don't contain any loops!
charsubst = transform [ ("i", "1")
, ("I", "1")
, ("l", "1")
, ("L", "1")
, ("o", "0")
, ("O", "0")
, ("A", "4")
, ("0", "1")
, ("1", "2")
, ("2", "3")
, ("3", "4")
, ("4", "5")
, ("5", "6")
, ("6", "7")
, ("7", "8")
, ("8", "9")
, ("9", "-")
]
-- Attempt to transform some text by the substitutions.
transform ((from, to):trs) txt = case breakOn' from txt of
Just (before, after) -> Just $ before <> to <> after
_ -> transform trs txt
transform [] _ = Nothing
-- | Upon joining a channel (numeric reply 331 or 332), add it to the
-- list (if not already present).
| 2,114
|
nickMangler :: EventHandler s
nickMangler = EventHandler (\ev -> matcher 432 fresh ev <|> matcher 433 mangle ev <|> matcher 436 mangle ev) $ \_ -> uncurry go
where
matcher num f ev = case _message ev of
Numeric n args | num == n -> Just (f, args)
_ -> Nothing
go f (_:srvNick:_) = do
theNick <- get nick <$> (snapshot instanceConfig =<< getIRCState)
-- If the length of our nick and the server's idea of our nick
-- differ, it was truncated - so calculate the allowable length.
let nicklen = if T.length srvNick /= T.length theNick
then Just $ T.length srvNick
else Nothing
setNick . trunc nicklen $ f srvNick
go _ _ = return ()
fresh n = if T.length n' == 0 then "f" else n'
where n' = T.filter isAlphaNum n
mangle n = (n <> "1") `fromMaybe` charsubst n
-- Truncate a nick, if there is a known length limit.
trunc len txt = maybe txt (`takeEnd` txt) len
-- List of substring substitutions. It's important that these
-- don't contain any loops!
charsubst = transform [ ("i", "1")
, ("I", "1")
, ("l", "1")
, ("L", "1")
, ("o", "0")
, ("O", "0")
, ("A", "4")
, ("0", "1")
, ("1", "2")
, ("2", "3")
, ("3", "4")
, ("4", "5")
, ("5", "6")
, ("6", "7")
, ("7", "8")
, ("8", "9")
, ("9", "-")
]
-- Attempt to transform some text by the substitutions.
transform ((from, to):trs) txt = case breakOn' from txt of
Just (before, after) -> Just $ before <> to <> after
_ -> transform trs txt
transform [] _ = Nothing
-- | Upon joining a channel (numeric reply 331 or 332), add it to the
-- list (if not already present).
| 2,114
|
nickMangler = EventHandler (\ev -> matcher 432 fresh ev <|> matcher 433 mangle ev <|> matcher 436 mangle ev) $ \_ -> uncurry go
where
matcher num f ev = case _message ev of
Numeric n args | num == n -> Just (f, args)
_ -> Nothing
go f (_:srvNick:_) = do
theNick <- get nick <$> (snapshot instanceConfig =<< getIRCState)
-- If the length of our nick and the server's idea of our nick
-- differ, it was truncated - so calculate the allowable length.
let nicklen = if T.length srvNick /= T.length theNick
then Just $ T.length srvNick
else Nothing
setNick . trunc nicklen $ f srvNick
go _ _ = return ()
fresh n = if T.length n' == 0 then "f" else n'
where n' = T.filter isAlphaNum n
mangle n = (n <> "1") `fromMaybe` charsubst n
-- Truncate a nick, if there is a known length limit.
trunc len txt = maybe txt (`takeEnd` txt) len
-- List of substring substitutions. It's important that these
-- don't contain any loops!
charsubst = transform [ ("i", "1")
, ("I", "1")
, ("l", "1")
, ("L", "1")
, ("o", "0")
, ("O", "0")
, ("A", "4")
, ("0", "1")
, ("1", "2")
, ("2", "3")
, ("3", "4")
, ("4", "5")
, ("5", "6")
, ("6", "7")
, ("7", "8")
, ("8", "9")
, ("9", "-")
]
-- Attempt to transform some text by the substitutions.
transform ((from, to):trs) txt = case breakOn' from txt of
Just (before, after) -> Just $ before <> to <> after
_ -> transform trs txt
transform [] _ = Nothing
-- | Upon joining a channel (numeric reply 331 or 332), add it to the
-- list (if not already present).
| 2,084
| false
| true
| 8
| 16
| 901
| 554
| 310
| 244
| null | null |
hackern/ghc-7.8.3
|
libraries/containers/Data/IntSet/Base.hs
|
bsd-3-clause
|
withBar, withEmpty :: [String] -> [String]
withBar bars = "| ":bars
| 70
|
withBar, withEmpty :: [String] -> [String]
withBar bars = "| ":bars
| 70
|
withBar bars = "| ":bars
| 27
| false
| true
| 0
| 6
| 13
| 30
| 17
| 13
| null | null |
music-suite/music-dynamics
|
src/Music/Dynamics/Absolute.hs
|
bsd-3-clause
|
bel :: HasAmplitude a => a -> Bel
bel a = Bel $ logBase (10/1) (amplitude a) * 1
| 94
|
bel :: HasAmplitude a => a -> Bel
bel a = Bel $ logBase (10/1) (amplitude a) * 1
| 94
|
bel a = Bel $ logBase (10/1) (amplitude a) * 1
| 52
| false
| true
| 0
| 9
| 32
| 51
| 25
| 26
| null | null |
zhiyuanshi/fcore
|
examples/case_studies/HeapSort.hs
|
bsd-2-clause
|
prop_removeMax :: Heap -> Property
prop_removeMax h = hasLeftistProperty h ==>
-- forAll hasLeftistHeap $ \ h ->
collect (heapSize h) $
hasLeftistProperty (removeMax h) &&
-- (h == Leaf || heapContents h ==
-- (Set.union (heapContents (removeMax h)) (Set.singleton (findMax h)))) &&
((removeMax h) == Leaf || ((findMax (removeMax h)) < (findMax h)))
| 384
|
prop_removeMax :: Heap -> Property
prop_removeMax h = hasLeftistProperty h ==>
-- forAll hasLeftistHeap $ \ h ->
collect (heapSize h) $
hasLeftistProperty (removeMax h) &&
-- (h == Leaf || heapContents h ==
-- (Set.union (heapContents (removeMax h)) (Set.singleton (findMax h)))) &&
((removeMax h) == Leaf || ((findMax (removeMax h)) < (findMax h)))
| 384
|
prop_removeMax h = hasLeftistProperty h ==>
-- forAll hasLeftistHeap $ \ h ->
collect (heapSize h) $
hasLeftistProperty (removeMax h) &&
-- (h == Leaf || heapContents h ==
-- (Set.union (heapContents (removeMax h)) (Set.singleton (findMax h)))) &&
((removeMax h) == Leaf || ((findMax (removeMax h)) < (findMax h)))
| 349
| false
| true
| 0
| 14
| 88
| 102
| 50
| 52
| null | null |
brendanhay/gogol
|
gogol-books/gen/Network/Google/Books/Types/Product.hs
|
mpl-2.0
|
-- | URL to download pdf. (In LITE projection.)
vaipDownloadLink :: Lens' VolumeAccessInfoPdf (Maybe Text)
vaipDownloadLink
= lens _vaipDownloadLink
(\ s a -> s{_vaipDownloadLink = a})
| 192
|
vaipDownloadLink :: Lens' VolumeAccessInfoPdf (Maybe Text)
vaipDownloadLink
= lens _vaipDownloadLink
(\ s a -> s{_vaipDownloadLink = a})
| 144
|
vaipDownloadLink
= lens _vaipDownloadLink
(\ s a -> s{_vaipDownloadLink = a})
| 85
| true
| true
| 0
| 8
| 33
| 49
| 25
| 24
| null | null |
verement/etamoo
|
src/MOO/Database/LambdaMOO.hs
|
bsd-3-clause
|
saveLMDatabase :: VSpace -> FilePath -> (Database, Connected) -> IO ()
saveLMDatabase vspace dbFile (database, connected) = do
putStrLn $ "EXPORTING: " ++ dbFile
withDBFile dbFile WriteMode $ \handle -> do
let writer = evalStateT (writeDatabase database connected) initState
vtx = execWriterT writer
TL.hPutStr handle . toLazyText =<< runVTx vspace vtx
| 375
|
saveLMDatabase :: VSpace -> FilePath -> (Database, Connected) -> IO ()
saveLMDatabase vspace dbFile (database, connected) = do
putStrLn $ "EXPORTING: " ++ dbFile
withDBFile dbFile WriteMode $ \handle -> do
let writer = evalStateT (writeDatabase database connected) initState
vtx = execWriterT writer
TL.hPutStr handle . toLazyText =<< runVTx vspace vtx
| 375
|
saveLMDatabase vspace dbFile (database, connected) = do
putStrLn $ "EXPORTING: " ++ dbFile
withDBFile dbFile WriteMode $ \handle -> do
let writer = evalStateT (writeDatabase database connected) initState
vtx = execWriterT writer
TL.hPutStr handle . toLazyText =<< runVTx vspace vtx
| 304
| false
| true
| 0
| 16
| 73
| 126
| 61
| 65
| null | null |
chadbrewbaker/shellcheck
|
ShellCheck/Parser.hs
|
gpl-3.0
|
ifParse p t f =
(lookAhead (try p) >> t) <|> f
| 50
|
ifParse p t f =
(lookAhead (try p) >> t) <|> f
| 50
|
ifParse p t f =
(lookAhead (try p) >> t) <|> f
| 50
| false
| false
| 1
| 10
| 15
| 39
| 16
| 23
| null | null |
ezyang/ghc
|
testsuite/tests/gadt/while.hs
|
bsd-3-clause
|
checkT B = TJ BoolR
| 19
|
checkT B = TJ BoolR
| 19
|
checkT B = TJ BoolR
| 19
| false
| false
| 1
| 5
| 4
| 16
| 5
| 11
| null | null |
iu-parfunc/criterion
|
Criterion/Report.hs
|
bsd-2-clause
|
getTemplateDir :: IO FilePath
getTemplateDir = getDataFileName "templates"
| 74
|
getTemplateDir :: IO FilePath
getTemplateDir = getDataFileName "templates"
| 74
|
getTemplateDir = getDataFileName "templates"
| 44
| false
| true
| 0
| 6
| 7
| 22
| 9
| 13
| null | null |
brendanhay/gogol
|
gogol-docs/gen/Network/Google/Docs/Types/Product.hs
|
mpl-2.0
|
-- | The top padding of the cell.
tcsPaddingTop :: Lens' TableCellStyle (Maybe Dimension)
tcsPaddingTop
= lens _tcsPaddingTop
(\ s a -> s{_tcsPaddingTop = a})
| 166
|
tcsPaddingTop :: Lens' TableCellStyle (Maybe Dimension)
tcsPaddingTop
= lens _tcsPaddingTop
(\ s a -> s{_tcsPaddingTop = a})
| 132
|
tcsPaddingTop
= lens _tcsPaddingTop
(\ s a -> s{_tcsPaddingTop = a})
| 76
| true
| true
| 0
| 9
| 32
| 48
| 25
| 23
| null | null |
ndmitchell/nsis
|
src/Development/NSIS/Plugins/WinMessages.hs
|
bsd-3-clause
|
stm_ONLY_THIS_INTERFACE = 0x00000001
| 40
|
stm_ONLY_THIS_INTERFACE = 0x00000001
| 40
|
stm_ONLY_THIS_INTERFACE = 0x00000001
| 40
| false
| false
| 0
| 4
| 6
| 6
| 3
| 3
| null | null |
helium/postgresql-transactional
|
src/Database/PostgreSQL/Transaction.hs
|
bsd-3-clause
|
-- | Runs a transaction in the base monad @m@ with a provided 'IsolationLevel'.
-- Catching exceptions through 'MonadBaseControl' is not transaction safe.
runPGTransactionT' :: MonadBaseControl IO m
=> PT.IsolationLevel
-> PGTransactionT m a
-> Postgres.Connection
-> m a
runPGTransactionT' isolation (PGTransactionT pgTrans) conn =
let runTransaction run =
PT.withTransactionLevel isolation conn (run pgTrans)
in control runTransaction `runReaderT` conn
| 550
|
runPGTransactionT' :: MonadBaseControl IO m
=> PT.IsolationLevel
-> PGTransactionT m a
-> Postgres.Connection
-> m a
runPGTransactionT' isolation (PGTransactionT pgTrans) conn =
let runTransaction run =
PT.withTransactionLevel isolation conn (run pgTrans)
in control runTransaction `runReaderT` conn
| 393
|
runPGTransactionT' isolation (PGTransactionT pgTrans) conn =
let runTransaction run =
PT.withTransactionLevel isolation conn (run pgTrans)
in control runTransaction `runReaderT` conn
| 200
| true
| true
| 0
| 12
| 154
| 101
| 48
| 53
| null | null |
bergmark/hlint
|
src/Test/Standard.hs
|
bsd-3-clause
|
testHintFile :: FilePath -> FilePath -> IO ()
testHintFile dataDir file = do
hints <- readSettings2 dataDir [file] []
sequence_ $ nameCheckHints hints : checkAnnotations hints file :
[typeCheckHints hints | takeFileName file /= "Test.hs"]
progress
| 275
|
testHintFile :: FilePath -> FilePath -> IO ()
testHintFile dataDir file = do
hints <- readSettings2 dataDir [file] []
sequence_ $ nameCheckHints hints : checkAnnotations hints file :
[typeCheckHints hints | takeFileName file /= "Test.hs"]
progress
| 275
|
testHintFile dataDir file = do
hints <- readSettings2 dataDir [file] []
sequence_ $ nameCheckHints hints : checkAnnotations hints file :
[typeCheckHints hints | takeFileName file /= "Test.hs"]
progress
| 229
| false
| true
| 0
| 11
| 63
| 91
| 42
| 49
| null | null |
karamellpelle/grid
|
designer/source/Game/LevelPuzzleMode/Helpers.hs
|
gpl-3.0
|
levelpuzzleCamera :: LevelPuzzleWorld -> Camera
levelpuzzleCamera =
gridCamera . levelpuzzleGrid
| 100
|
levelpuzzleCamera :: LevelPuzzleWorld -> Camera
levelpuzzleCamera =
gridCamera . levelpuzzleGrid
| 100
|
levelpuzzleCamera =
gridCamera . levelpuzzleGrid
| 52
| false
| true
| 0
| 5
| 13
| 19
| 10
| 9
| null | null |
romanb/aws
|
Aws/Core.hs
|
bsd-3-clause
|
fromAbsoluteTimeInfo (AbsoluteExpires time) = time
| 50
|
fromAbsoluteTimeInfo (AbsoluteExpires time) = time
| 50
|
fromAbsoluteTimeInfo (AbsoluteExpires time) = time
| 50
| false
| false
| 0
| 7
| 4
| 15
| 7
| 8
| null | null |
brendanhay/gogol
|
gogol-bigquery/gen/Network/Google/BigQuery/Types/Product.hs
|
mpl-2.0
|
-- | R^2 score. This corresponds to r2_score in ML.EVALUATE.
rmRSquared :: Lens' RegressionMetrics (Maybe Double)
rmRSquared
= lens _rmRSquared (\ s a -> s{_rmRSquared = a}) .
mapping _Coerce
| 199
|
rmRSquared :: Lens' RegressionMetrics (Maybe Double)
rmRSquared
= lens _rmRSquared (\ s a -> s{_rmRSquared = a}) .
mapping _Coerce
| 138
|
rmRSquared
= lens _rmRSquared (\ s a -> s{_rmRSquared = a}) .
mapping _Coerce
| 85
| true
| true
| 0
| 10
| 37
| 55
| 28
| 27
| null | null |
spinda/liquidhaskell-std
|
src/LiquidHaskell/Qualifiers.hs
|
bsd-3-clause
|
lq_qualif_gt v x = v > x
| 26
|
lq_qualif_gt v x = v > x
| 26
|
lq_qualif_gt v x = v > x
| 26
| false
| false
| 0
| 5
| 8
| 15
| 7
| 8
| null | null |
bjornbm/astro
|
src/Astro/Place/ReferenceEllipsoid.hs
|
bsd-3-clause
|
-- [wp].
bessel1841 = referenceEllipsoid' (6377397.155*~meter) (299.1528153513233*~one)
| 94
|
bessel1841 = referenceEllipsoid' (6377397.155*~meter) (299.1528153513233*~one)
| 85
|
bessel1841 = referenceEllipsoid' (6377397.155*~meter) (299.1528153513233*~one)
| 85
| true
| false
| 1
| 7
| 13
| 29
| 14
| 15
| null | null |
plow-technologies/ghcjs-dom
|
src/GHCJS/DOM/EventM.hs
|
mit
|
mouseMovementXY :: IsMouseEvent e => EventM t e (Int, Int)
mouseMovementXY = do
e <- event
x <- MouseEvent.getMovementX e
y <- MouseEvent.getMovementY e
return (x, y)
| 182
|
mouseMovementXY :: IsMouseEvent e => EventM t e (Int, Int)
mouseMovementXY = do
e <- event
x <- MouseEvent.getMovementX e
y <- MouseEvent.getMovementY e
return (x, y)
| 182
|
mouseMovementXY = do
e <- event
x <- MouseEvent.getMovementX e
y <- MouseEvent.getMovementY e
return (x, y)
| 123
| false
| true
| 0
| 9
| 42
| 74
| 35
| 39
| null | null |
markhibberd/pin
|
src/Network/Api/Pin/Data.hs
|
bsd-3-clause
|
fromText :: Text -> B.ByteString
fromText = encodeUtf8
| 54
|
fromText :: Text -> B.ByteString
fromText = encodeUtf8
| 54
|
fromText = encodeUtf8
| 21
| false
| true
| 0
| 6
| 7
| 17
| 9
| 8
| null | null |
jwiegley/ghc-release
|
libraries/bytestring/Data/ByteString/Internal.hs
|
gpl-3.0
|
append :: ByteString -> ByteString -> ByteString
append (PS _ _ 0) b = b
| 97
|
append :: ByteString -> ByteString -> ByteString
append (PS _ _ 0) b = b
| 97
|
append (PS _ _ 0) b = b
| 48
| false
| true
| 0
| 7
| 39
| 34
| 17
| 17
| null | null |
text-utf8/text
|
Data/Text/Internal/Fusion/Size.hs
|
bsd-2-clause
|
-- | Compute the maximum size from a size hint, if possible.
lowerBound :: Int -> Size -> Int
lowerBound _ (Between n _) = n
| 124
|
lowerBound :: Int -> Size -> Int
lowerBound _ (Between n _) = n
| 63
|
lowerBound _ (Between n _) = n
| 30
| true
| true
| 0
| 7
| 25
| 33
| 17
| 16
| null | null |
zepto-lang/zepto
|
src/Zepto/Types/Export.hs
|
gpl-2.0
|
anyBVec = B.any
| 15
|
anyBVec = B.any
| 15
|
anyBVec = B.any
| 15
| false
| false
| 0
| 5
| 2
| 8
| 4
| 4
| null | null |
bitemyapp/blpapi-hs
|
src/Finance/Blpapi/Impl/CorrelationIdImpl.hs
|
mit
|
getCidTypeFromClass :: Int32 -> Int32
getCidTypeFromClass c = (c `shiftR` 8) .&. 0xf
| 84
|
getCidTypeFromClass :: Int32 -> Int32
getCidTypeFromClass c = (c `shiftR` 8) .&. 0xf
| 84
|
getCidTypeFromClass c = (c `shiftR` 8) .&. 0xf
| 46
| false
| true
| 0
| 7
| 12
| 35
| 18
| 17
| null | null |
schernichkin/snakes
|
bench/Main.hs
|
bsd-3-clause
|
-- Our benchmark harness.
main :: IO ()
main = defaultMain
[ diffLikeBench
, vectorBench
]
| 96
|
main :: IO ()
main = defaultMain
[ diffLikeBench
, vectorBench
]
| 70
|
main = defaultMain
[ diffLikeBench
, vectorBench
]
| 56
| true
| true
| 0
| 6
| 21
| 26
| 14
| 12
| null | null |
ddssff/lens
|
src/Control/Lens/Tuple.hs
|
bsd-3-clause
|
-- | Strict version of '_4'
_4' :: Field4 s t a b => Lens s t a b
_4' = \f !x -> _4 f x
| 87
|
_4' :: Field4 s t a b => Lens s t a b
_4' = \f !x -> _4 f x
| 59
|
_4' = \f !x -> _4 f x
| 21
| true
| true
| 0
| 7
| 26
| 54
| 24
| 30
| null | null |
GaloisInc/halvm-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
| 8
| 16
| 42
| 22
| 20
| null | null |
vTurbine/ghc
|
compiler/simplCore/SetLevels.hs
|
bsd-3-clause
|
countFreeIds :: DVarSet -> Int
countFreeIds = nonDetFoldUDFM add 0
-- It's OK to use nonDetFoldUDFM here because we're just counting things.
where
add :: Var -> Int -> Int
add v n | isId v = n+1
| otherwise = n
{-
************************************************************************
* *
\subsection{Free-To-Level Monad}
* *
************************************************************************
-}
| 569
|
countFreeIds :: DVarSet -> Int
countFreeIds = nonDetFoldUDFM add 0
-- It's OK to use nonDetFoldUDFM here because we're just counting things.
where
add :: Var -> Int -> Int
add v n | isId v = n+1
| otherwise = n
{-
************************************************************************
* *
\subsection{Free-To-Level Monad}
* *
************************************************************************
-}
| 569
|
countFreeIds = nonDetFoldUDFM add 0
-- It's OK to use nonDetFoldUDFM here because we're just counting things.
where
add :: Var -> Int -> Int
add v n | isId v = n+1
| otherwise = n
{-
************************************************************************
* *
\subsection{Free-To-Level Monad}
* *
************************************************************************
-}
| 538
| false
| true
| 3
| 8
| 217
| 70
| 34
| 36
| null | null |
elieux/ghc
|
compiler/types/Type.hs
|
bsd-3-clause
|
isTyVarTy :: Type -> Bool
isTyVarTy ty = isJust (getTyVar_maybe ty)
| 67
|
isTyVarTy :: Type -> Bool
isTyVarTy ty = isJust (getTyVar_maybe ty)
| 67
|
isTyVarTy ty = isJust (getTyVar_maybe ty)
| 41
| false
| true
| 0
| 7
| 10
| 30
| 14
| 16
| null | null |
ancientlanguage/haskell-analysis
|
prepare/src/Prepare/Decompose.hs
|
mit
|
decomposeChar '\x0228' = "\x0045\x0327"
| 39
|
decomposeChar '\x0228' = "\x0045\x0327"
| 39
|
decomposeChar '\x0228' = "\x0045\x0327"
| 39
| false
| false
| 1
| 5
| 3
| 13
| 4
| 9
| null | null |
a143753/AOJ
|
0631.hs
|
apache-2.0
|
scan _ [] = []
| 14
|
scan _ [] = []
| 14
|
scan _ [] = []
| 14
| false
| false
| 0
| 6
| 4
| 15
| 7
| 8
| null | null |
xpika/interpreter-haskell
|
Plugins/Html.hs
|
gpl-3.0
|
rHtml x = mySpecialStringGetter $ map (chr . fromIntegral) (unpack (renderHtml x))
| 82
|
rHtml x = mySpecialStringGetter $ map (chr . fromIntegral) (unpack (renderHtml x))
| 82
|
rHtml x = mySpecialStringGetter $ map (chr . fromIntegral) (unpack (renderHtml x))
| 82
| false
| false
| 0
| 10
| 11
| 37
| 18
| 19
| null | null |
mgbarotto/Chip8
|
EmuProcessor.hs
|
gpl-3.0
|
toBitsArray :: Word8 -> [Bool]
toBitsArray x = map (testBit x) [7,6..0]
| 71
|
toBitsArray :: Word8 -> [Bool]
toBitsArray x = map (testBit x) [7,6..0]
| 71
|
toBitsArray x = map (testBit x) [7,6..0]
| 40
| false
| true
| 0
| 7
| 11
| 40
| 21
| 19
| null | null |
cchalmers/lens
|
src/Control/Lens/Internal/Fold.hs
|
bsd-3-clause
|
getRightmost :: Rightmost a -> Maybe a
getRightmost RPure = Nothing
| 67
|
getRightmost :: Rightmost a -> Maybe a
getRightmost RPure = Nothing
| 67
|
getRightmost RPure = Nothing
| 28
| false
| true
| 0
| 6
| 10
| 24
| 11
| 13
| null | null |
tcsavage/lazy-compiler
|
src/STG/AST.hs
|
mit
|
stgmain1 :: Binding
stgmain1 = Binding "main" (Lambda [] N [] (Let [Binding "x" (Lambda [] N [] (Ap "double" [AtomLit 2])), Binding "y" (Lambda ["x"] N [] (Ap "double" [AtomVar "x"]))] (Ap "dumpInt" [AtomVar "y"])))
| 215
|
stgmain1 :: Binding
stgmain1 = Binding "main" (Lambda [] N [] (Let [Binding "x" (Lambda [] N [] (Ap "double" [AtomLit 2])), Binding "y" (Lambda ["x"] N [] (Ap "double" [AtomVar "x"]))] (Ap "dumpInt" [AtomVar "y"])))
| 215
|
stgmain1 = Binding "main" (Lambda [] N [] (Let [Binding "x" (Lambda [] N [] (Ap "double" [AtomLit 2])), Binding "y" (Lambda ["x"] N [] (Ap "double" [AtomVar "x"]))] (Ap "dumpInt" [AtomVar "y"])))
| 195
| false
| true
| 0
| 17
| 35
| 131
| 66
| 65
| null | null |
geophf/1HaskellADay
|
exercises/HAD/Y2018/M05/D31/Exercise.hs
|
mit
|
-- prints the GRANDE and VENTI elements JSON enhanced with entity_count
{-- BONUS -----------------------------------------------------------------
Boss man wants to see the original articles to see if there's some connection
between article content and length and the time it takes to extract the
entities.
Go to the Pilot database, extract the full text of the articles for GRANDE
and VENTI, insert those articles into the JSON. Then declare Miller Time (tm)
--}
fullTextStmt :: Query
fullTextStmt = [sql|SELECT id,full_text FROM article WHERE id in ?|]
| 559
|
fullTextStmt :: Query
fullTextStmt = [sql|SELECT id,full_text FROM article WHERE id in ?|]
| 90
|
fullTextStmt = [sql|SELECT id,full_text FROM article WHERE id in ?|]
| 68
| true
| true
| 0
| 6
| 86
| 24
| 13
| 11
| null | null |
mydaum/cabal
|
cabal-install/Distribution/Client/Sandbox/Index.hs
|
bsd-3-clause
|
-- | Read build tree references from an index cache
readBuildTreeRefsFromCache :: Verbosity -> FilePath -> IO [BuildTreeRef]
readBuildTreeRefsFromCache verbosity indexPath = do
(mRefs, _prefs) <- readCacheStrict verbosity (SandboxIndex indexPath) buildTreeRef
return (catMaybes mRefs)
where
buildTreeRef pkgEntry =
case pkgEntry of
IndexUtils.NormalPackage _ _ _ _ -> Nothing
IndexUtils.BuildTreeRef typ _ _ path _ -> Just $ BuildTreeRef typ path
-- | Given a local build tree ref, serialise it to a tar archive entry.
| 557
|
readBuildTreeRefsFromCache :: Verbosity -> FilePath -> IO [BuildTreeRef]
readBuildTreeRefsFromCache verbosity indexPath = do
(mRefs, _prefs) <- readCacheStrict verbosity (SandboxIndex indexPath) buildTreeRef
return (catMaybes mRefs)
where
buildTreeRef pkgEntry =
case pkgEntry of
IndexUtils.NormalPackage _ _ _ _ -> Nothing
IndexUtils.BuildTreeRef typ _ _ path _ -> Just $ BuildTreeRef typ path
-- | Given a local build tree ref, serialise it to a tar archive entry.
| 505
|
readBuildTreeRefsFromCache verbosity indexPath = do
(mRefs, _prefs) <- readCacheStrict verbosity (SandboxIndex indexPath) buildTreeRef
return (catMaybes mRefs)
where
buildTreeRef pkgEntry =
case pkgEntry of
IndexUtils.NormalPackage _ _ _ _ -> Nothing
IndexUtils.BuildTreeRef typ _ _ path _ -> Just $ BuildTreeRef typ path
-- | Given a local build tree ref, serialise it to a tar archive entry.
| 432
| true
| true
| 0
| 10
| 113
| 129
| 63
| 66
| null | null |
phillipm/mlish-to-llvm
|
src/ClosureConversion.hs
|
bsd-3-clause
|
exprClosureConv (MInt n) = return $ CInt n
| 42
|
exprClosureConv (MInt n) = return $ CInt n
| 42
|
exprClosureConv (MInt n) = return $ CInt n
| 42
| false
| false
| 0
| 7
| 7
| 22
| 10
| 12
| null | null |
ghcjs/ghcjs
|
src/Gen2/Prim.hs
|
mit
|
genPrim _ _ ReadOffAddrOp_Int16 [c] [a,o,i] = PrimInline $ c |= dv_i16 a (o+(i.<<.1))
| 86
|
genPrim _ _ ReadOffAddrOp_Int16 [c] [a,o,i] = PrimInline $ c |= dv_i16 a (o+(i.<<.1))
| 86
|
genPrim _ _ ReadOffAddrOp_Int16 [c] [a,o,i] = PrimInline $ c |= dv_i16 a (o+(i.<<.1))
| 86
| false
| false
| 0
| 10
| 14
| 56
| 30
| 26
| null | null |
SergeyKrivohatskiy/fp_haskell
|
class/class3.hs
|
mit
|
findDigitAndIndexOrLen :: String -> Either (Int, Int) Int
findDigitAndIndexOrLen = findRec 0
where findRec n [] = Right n
findRec n (x:xs) | isDigit x = Left (digitToInt x, n)
| otherwise = findRec (n + 1) xs
| 250
|
findDigitAndIndexOrLen :: String -> Either (Int, Int) Int
findDigitAndIndexOrLen = findRec 0
where findRec n [] = Right n
findRec n (x:xs) | isDigit x = Left (digitToInt x, n)
| otherwise = findRec (n + 1) xs
| 250
|
findDigitAndIndexOrLen = findRec 0
where findRec n [] = Right n
findRec n (x:xs) | isDigit x = Left (digitToInt x, n)
| otherwise = findRec (n + 1) xs
| 192
| false
| true
| 1
| 8
| 79
| 105
| 51
| 54
| null | null |
castaway/pandoc
|
src/Text/Pandoc/Readers/Markdown.hs
|
gpl-2.0
|
htmlBlock :: GenParser Char ParserState Block
htmlBlock = try $ do
failUnlessBeginningOfLine
first <- htmlElement
finalSpace <- many spaceChar
finalNewlines <- many newline
return $ RawBlock "html" $ first ++ finalSpace ++ finalNewlines
| 256
|
htmlBlock :: GenParser Char ParserState Block
htmlBlock = try $ do
failUnlessBeginningOfLine
first <- htmlElement
finalSpace <- many spaceChar
finalNewlines <- many newline
return $ RawBlock "html" $ first ++ finalSpace ++ finalNewlines
| 256
|
htmlBlock = try $ do
failUnlessBeginningOfLine
first <- htmlElement
finalSpace <- many spaceChar
finalNewlines <- many newline
return $ RawBlock "html" $ first ++ finalSpace ++ finalNewlines
| 210
| false
| true
| 0
| 12
| 52
| 74
| 33
| 41
| null | null |
nomeata/ghc
|
compiler/nativeGen/X86/Instr.hs
|
bsd-3-clause
|
--------------------------------------------------------------------------------
-- | See if this instruction is telling us the current C stack delta
x86_takeDeltaInstr
:: Instr
-> Maybe Int
x86_takeDeltaInstr instr
= case instr of
DELTA i -> Just i
_ -> Nothing
| 319
|
x86_takeDeltaInstr
:: Instr
-> Maybe Int
x86_takeDeltaInstr instr
= case instr of
DELTA i -> Just i
_ -> Nothing
| 167
|
x86_takeDeltaInstr instr
= case instr of
DELTA i -> Just i
_ -> Nothing
| 110
| true
| true
| 3
| 7
| 91
| 46
| 23
| 23
| null | null |
edsko/cabal
|
cabal-install/tests/UnitTests/Distribution/Client/Dependency/Modular/Solver.hs
|
bsd-3-clause
|
db1 :: ExampleDb
db1 =
let a = exInst "A" 1 "A-1" []
in [ Left a
, Right $ exAv "B" 1 [ExAny "A"]
, Right $ exAv "B" 2 [ExAny "A"]
, Right $ exAv "C" 1 [ExFix "B" 1]
, Right $ exAv "D" 1 [ExFix "B" 2]
, Right $ exAv "E" 1 [ExAny "B"]
, Right $ exAv "F" 1 [ExFix "B" 1, ExAny "E"]
, Right $ exAv "G" 1 [ExFix "B" 2, ExAny "E"]
, Right $ exAv "Z" 1 []
]
| 422
|
db1 :: ExampleDb
db1 =
let a = exInst "A" 1 "A-1" []
in [ Left a
, Right $ exAv "B" 1 [ExAny "A"]
, Right $ exAv "B" 2 [ExAny "A"]
, Right $ exAv "C" 1 [ExFix "B" 1]
, Right $ exAv "D" 1 [ExFix "B" 2]
, Right $ exAv "E" 1 [ExAny "B"]
, Right $ exAv "F" 1 [ExFix "B" 1, ExAny "E"]
, Right $ exAv "G" 1 [ExFix "B" 2, ExAny "E"]
, Right $ exAv "Z" 1 []
]
| 422
|
db1 =
let a = exInst "A" 1 "A-1" []
in [ Left a
, Right $ exAv "B" 1 [ExAny "A"]
, Right $ exAv "B" 2 [ExAny "A"]
, Right $ exAv "C" 1 [ExFix "B" 1]
, Right $ exAv "D" 1 [ExFix "B" 2]
, Right $ exAv "E" 1 [ExAny "B"]
, Right $ exAv "F" 1 [ExFix "B" 1, ExAny "E"]
, Right $ exAv "G" 1 [ExFix "B" 2, ExAny "E"]
, Right $ exAv "Z" 1 []
]
| 405
| false
| true
| 0
| 12
| 159
| 222
| 108
| 114
| null | null |
romanb/amazonka
|
amazonka-opsworks/gen/Network/AWS/OpsWorks/DetachElasticLoadBalancer.hs
|
mpl-2.0
|
-- | The Elastic Load Balancing instance's name.
delbElasticLoadBalancerName :: Lens' DetachElasticLoadBalancer Text
delbElasticLoadBalancerName =
lens _delbElasticLoadBalancerName
(\s a -> s { _delbElasticLoadBalancerName = a })
| 241
|
delbElasticLoadBalancerName :: Lens' DetachElasticLoadBalancer Text
delbElasticLoadBalancerName =
lens _delbElasticLoadBalancerName
(\s a -> s { _delbElasticLoadBalancerName = a })
| 192
|
delbElasticLoadBalancerName =
lens _delbElasticLoadBalancerName
(\s a -> s { _delbElasticLoadBalancerName = a })
| 124
| true
| true
| 0
| 9
| 37
| 40
| 22
| 18
| null | null |
karamellpelle/grid
|
designer/source/Game/Grid/Output/Fancy/DrawPath.hs
|
gpl-3.0
|
drawSegmentAlpha (Segment (Node nx ny nz) turn) alpha = do
let x = fromIntegral nx
y = fromIntegral ny
z = fromIntegral nz
Dir dx dy dz = direction turn
x' = x + realToFrac alpha * fromIntegral dx
z' = z + realToFrac alpha * fromIntegral dz
y' = y + realToFrac alpha * fromIntegral dy
io $ do
glBegin gl_LINES
glVertex3f x y z
glVertex3f x' y' z'
glEnd
| 435
|
drawSegmentAlpha (Segment (Node nx ny nz) turn) alpha = do
let x = fromIntegral nx
y = fromIntegral ny
z = fromIntegral nz
Dir dx dy dz = direction turn
x' = x + realToFrac alpha * fromIntegral dx
z' = z + realToFrac alpha * fromIntegral dz
y' = y + realToFrac alpha * fromIntegral dy
io $ do
glBegin gl_LINES
glVertex3f x y z
glVertex3f x' y' z'
glEnd
| 435
|
drawSegmentAlpha (Segment (Node nx ny nz) turn) alpha = do
let x = fromIntegral nx
y = fromIntegral ny
z = fromIntegral nz
Dir dx dy dz = direction turn
x' = x + realToFrac alpha * fromIntegral dx
z' = z + realToFrac alpha * fromIntegral dz
y' = y + realToFrac alpha * fromIntegral dy
io $ do
glBegin gl_LINES
glVertex3f x y z
glVertex3f x' y' z'
glEnd
| 435
| false
| false
| 0
| 12
| 153
| 166
| 75
| 91
| null | null |
vikraman/ghc
|
compiler/prelude/THNames.hs
|
bsd-3-clause
|
moduleAnnotationIdKey = mkPreludeMiscIdUnique 492
| 49
|
moduleAnnotationIdKey = mkPreludeMiscIdUnique 492
| 49
|
moduleAnnotationIdKey = mkPreludeMiscIdUnique 492
| 49
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
yliu120/K3
|
src/Language/K3/Core/Type.hs
|
apache-2.0
|
-- | Extract named annotations
namedTAnnotations :: [Annotation Type] -> [Identifier]
namedTAnnotations anns = map extractId $ filter isTAnnotation anns
where extractId (TAnnotation n) = n
extractId _ = error "Invalid named annotation"
{- Type instances -}
| 268
|
namedTAnnotations :: [Annotation Type] -> [Identifier]
namedTAnnotations anns = map extractId $ filter isTAnnotation anns
where extractId (TAnnotation n) = n
extractId _ = error "Invalid named annotation"
{- Type instances -}
| 237
|
namedTAnnotations anns = map extractId $ filter isTAnnotation anns
where extractId (TAnnotation n) = n
extractId _ = error "Invalid named annotation"
{- Type instances -}
| 182
| true
| true
| 1
| 7
| 48
| 68
| 34
| 34
| null | null |
shinjiro-itagaki/shinjirecs
|
shinjirecs-api/src/DB/Persist.hs
|
gpl-3.0
|
checkUnique :: (PersistRecordBackend record SqlBackend) => Connection__ -> record -> IO (Maybe (Unique record))
checkUnique connpool record = runSqlPool (checkUniqueQuery record) connpool
| 187
|
checkUnique :: (PersistRecordBackend record SqlBackend) => Connection__ -> record -> IO (Maybe (Unique record))
checkUnique connpool record = runSqlPool (checkUniqueQuery record) connpool
| 187
|
checkUnique connpool record = runSqlPool (checkUniqueQuery record) connpool
| 75
| false
| true
| 0
| 12
| 21
| 61
| 30
| 31
| null | null |
fredmorcos/attic
|
snippets/haskell/Parser.hs
|
isc
|
pSatMany :: Eq a => (p -> a -> p) -> Predicate a -> Parser a p [a]
pSatMany f pd@(p, _) =
isEnd >>= \e -> if e then return [] else
peek >>= \c -> if not $ p c then return [] else
item f >>= \i -> pSatMany f pd >>= \r -> return $ i:r
| 244
|
pSatMany :: Eq a => (p -> a -> p) -> Predicate a -> Parser a p [a]
pSatMany f pd@(p, _) =
isEnd >>= \e -> if e then return [] else
peek >>= \c -> if not $ p c then return [] else
item f >>= \i -> pSatMany f pd >>= \r -> return $ i:r
| 244
|
pSatMany f pd@(p, _) =
isEnd >>= \e -> if e then return [] else
peek >>= \c -> if not $ p c then return [] else
item f >>= \i -> pSatMany f pd >>= \r -> return $ i:r
| 177
| false
| true
| 21
| 7
| 71
| 152
| 82
| 70
| null | null |
graninas/The-Amoeba-World
|
src/Main.hs
|
gpl-3.0
|
main :: IO ()
main = do
cfg <- P.getDataFileName optionsPath >>= Cfg.loadConfiguration
logFilePath <- Cfg.extract cfg logFileLoader >>= P.getDataFileName
worldPath <- Cfg.extract cfg worldFileLoader >>= P.getDataFileName
Log.setupLogger logFilePath
Log.info $ "Logger started: " ++ logFilePath
game <- loadGame worldPath
Log.info $ "Game loaded from: " ++ worldPath
boot cfg game
Log.info "Game unloaded."
Log.finish
| 486
|
main :: IO ()
main = do
cfg <- P.getDataFileName optionsPath >>= Cfg.loadConfiguration
logFilePath <- Cfg.extract cfg logFileLoader >>= P.getDataFileName
worldPath <- Cfg.extract cfg worldFileLoader >>= P.getDataFileName
Log.setupLogger logFilePath
Log.info $ "Logger started: " ++ logFilePath
game <- loadGame worldPath
Log.info $ "Game loaded from: " ++ worldPath
boot cfg game
Log.info "Game unloaded."
Log.finish
| 486
|
main = do
cfg <- P.getDataFileName optionsPath >>= Cfg.loadConfiguration
logFilePath <- Cfg.extract cfg logFileLoader >>= P.getDataFileName
worldPath <- Cfg.extract cfg worldFileLoader >>= P.getDataFileName
Log.setupLogger logFilePath
Log.info $ "Logger started: " ++ logFilePath
game <- loadGame worldPath
Log.info $ "Game loaded from: " ++ worldPath
boot cfg game
Log.info "Game unloaded."
Log.finish
| 472
| false
| true
| 0
| 10
| 124
| 139
| 61
| 78
| null | null |
mcmaniac/ghc
|
compiler/nativeGen/RegAlloc/Linear/Main.hs
|
bsd-3-clause
|
regAlloc _ (CmmProc (LiveInfo info _ _ _) lbl [])
= return ( CmmProc info lbl (ListGraph [])
, Nothing )
| 129
|
regAlloc _ (CmmProc (LiveInfo info _ _ _) lbl [])
= return ( CmmProc info lbl (ListGraph [])
, Nothing )
| 129
|
regAlloc _ (CmmProc (LiveInfo info _ _ _) lbl [])
= return ( CmmProc info lbl (ListGraph [])
, Nothing )
| 129
| false
| false
| 1
| 9
| 45
| 61
| 29
| 32
| null | null |
ghorn/dynobud
|
dynobud/src/Dyno/MultipleShooting.hs
|
lgpl-3.0
|
makeMsNlp ::
forall x u p n
. (KnownNat n, Vectorize x, Vectorize u, Vectorize p, Additive x)
=> MsOcp x u p -> IO (Nlp (MsDvs x u p n) (JV None) (MsConstraints x n) MX)
makeMsNlp msOcp = do
let n = fromIntegral (natVal (Proxy :: Proxy n))
integrate (IntegratorIn x0 u p) = IntegratorOut (vcat (simulate nsteps ode x0' u' p' 0 dt))
where
endTime = msEndTime msOcp
dt = (realToFrac endTime) / fromIntegral n
ode = msOde msOcp
nsteps = fromMaybe 1 (msNumRk4Steps msOcp)
x0' = vsplit x0
u' = vsplit u
p' = vsplit p
integrator <- toFun "my_integrator" integrate mempty :: IO (Fun (IntegratorIn x u p) (IntegratorOut x))
let nlp =
Nlp
{ nlpFG = fg
, nlpIn =
NlpIn
{ nlpBX = bx
, nlpBG = bg
, nlpX0 = x0
, nlpP = catJV None
, nlpLamX0 = Nothing
, nlpLamG0 = Nothing
}
, nlpScaleF = Nothing
, nlpScaleX = Nothing
, nlpScaleG = Nothing
}
x0 :: J (MsDvs x u p n) (V.Vector Double)
x0 = jfill 0
boundsX0 = catJV (fmap (\x -> (x,x)) (msX0 msOcp)) :: J (JV x) (Vector Bounds)
boundsX = catJV (msXBnds msOcp) :: J (JV x) (Vector Bounds)
boundsU = catJV (msUBnds msOcp) :: J (JV u) (Vector Bounds)
boundsX0u = JTuple boundsX0 boundsU :: JTuple (JV x) (JV u) (Vector Bounds)
boundsXu = JTuple boundsX boundsU :: JTuple (JV x) (JV u) (Vector Bounds)
boundsXF = catJV (fmap (\x -> (x,x)) (msXF msOcp)) :: J (JV x) (Vector Bounds)
boundsXus :: (J (JVec n (JTuple (JV x) (JV u))) (Vector Bounds))
boundsXus = cat $ JVec $ mkVec' ( cat boundsX0u : replicate (n-1) (cat boundsXu))
bx :: J (MsDvs x u p n) (Vector Bounds)
bx = cat MsDvs
{ dvXus = boundsXus
, dvXf = boundsXF
, dvP = catJV (msPBnds msOcp)
}
bg :: J (MsConstraints x n) (Vector Bounds)
bg = cat MsConstraints { gContinuity = jfill (Just 0, Just 0) }
fg :: J (MsDvs x u p n) MX -> J (JV None) MX -> (S MX, J (MsConstraints x n) MX)
fg dvs _ = (f, cat g)
where
MsDvs xus xf p = split dvs
x1s :: Vec n (J (JV x) MX)
x1s = fmap (callIntegrate . split) $ unJVec $ split xus
callIntegrate (JTuple x0' u) = x1
where
IntegratorOut x1 = callSym integrator (IntegratorIn x0' u p)
lagrangeSum = F.sum $ fmap callLagrangeSum (unJVec (split xus))
where
callLagrangeSum xu = msLagrangeSum msOcp (vsplit x) (vsplit u)
where
JTuple x u = split xu
mayer = msMayer msOcp (vsplit xf)
f :: S MX
f = mayer + lagrangeSum
x0s' = fmap (extractx . split) $ unJVec $ split xus :: Vec n (J (JV x) MX)
extractx (JTuple x0'' _) = x0''
x0s = tvtail (x0s' |> xf) :: Vec n (J (JV x) MX)
gaps:: Vec n (J (JV x) MX)
gaps = tvzipWith (-) x1s x0s
g :: MsConstraints x n MX
g = MsConstraints { gContinuity = cat $ JVec gaps }
return nlp
| 3,202
|
makeMsNlp ::
forall x u p n
. (KnownNat n, Vectorize x, Vectorize u, Vectorize p, Additive x)
=> MsOcp x u p -> IO (Nlp (MsDvs x u p n) (JV None) (MsConstraints x n) MX)
makeMsNlp msOcp = do
let n = fromIntegral (natVal (Proxy :: Proxy n))
integrate (IntegratorIn x0 u p) = IntegratorOut (vcat (simulate nsteps ode x0' u' p' 0 dt))
where
endTime = msEndTime msOcp
dt = (realToFrac endTime) / fromIntegral n
ode = msOde msOcp
nsteps = fromMaybe 1 (msNumRk4Steps msOcp)
x0' = vsplit x0
u' = vsplit u
p' = vsplit p
integrator <- toFun "my_integrator" integrate mempty :: IO (Fun (IntegratorIn x u p) (IntegratorOut x))
let nlp =
Nlp
{ nlpFG = fg
, nlpIn =
NlpIn
{ nlpBX = bx
, nlpBG = bg
, nlpX0 = x0
, nlpP = catJV None
, nlpLamX0 = Nothing
, nlpLamG0 = Nothing
}
, nlpScaleF = Nothing
, nlpScaleX = Nothing
, nlpScaleG = Nothing
}
x0 :: J (MsDvs x u p n) (V.Vector Double)
x0 = jfill 0
boundsX0 = catJV (fmap (\x -> (x,x)) (msX0 msOcp)) :: J (JV x) (Vector Bounds)
boundsX = catJV (msXBnds msOcp) :: J (JV x) (Vector Bounds)
boundsU = catJV (msUBnds msOcp) :: J (JV u) (Vector Bounds)
boundsX0u = JTuple boundsX0 boundsU :: JTuple (JV x) (JV u) (Vector Bounds)
boundsXu = JTuple boundsX boundsU :: JTuple (JV x) (JV u) (Vector Bounds)
boundsXF = catJV (fmap (\x -> (x,x)) (msXF msOcp)) :: J (JV x) (Vector Bounds)
boundsXus :: (J (JVec n (JTuple (JV x) (JV u))) (Vector Bounds))
boundsXus = cat $ JVec $ mkVec' ( cat boundsX0u : replicate (n-1) (cat boundsXu))
bx :: J (MsDvs x u p n) (Vector Bounds)
bx = cat MsDvs
{ dvXus = boundsXus
, dvXf = boundsXF
, dvP = catJV (msPBnds msOcp)
}
bg :: J (MsConstraints x n) (Vector Bounds)
bg = cat MsConstraints { gContinuity = jfill (Just 0, Just 0) }
fg :: J (MsDvs x u p n) MX -> J (JV None) MX -> (S MX, J (MsConstraints x n) MX)
fg dvs _ = (f, cat g)
where
MsDvs xus xf p = split dvs
x1s :: Vec n (J (JV x) MX)
x1s = fmap (callIntegrate . split) $ unJVec $ split xus
callIntegrate (JTuple x0' u) = x1
where
IntegratorOut x1 = callSym integrator (IntegratorIn x0' u p)
lagrangeSum = F.sum $ fmap callLagrangeSum (unJVec (split xus))
where
callLagrangeSum xu = msLagrangeSum msOcp (vsplit x) (vsplit u)
where
JTuple x u = split xu
mayer = msMayer msOcp (vsplit xf)
f :: S MX
f = mayer + lagrangeSum
x0s' = fmap (extractx . split) $ unJVec $ split xus :: Vec n (J (JV x) MX)
extractx (JTuple x0'' _) = x0''
x0s = tvtail (x0s' |> xf) :: Vec n (J (JV x) MX)
gaps:: Vec n (J (JV x) MX)
gaps = tvzipWith (-) x1s x0s
g :: MsConstraints x n MX
g = MsConstraints { gContinuity = cat $ JVec gaps }
return nlp
| 3,202
|
makeMsNlp msOcp = do
let n = fromIntegral (natVal (Proxy :: Proxy n))
integrate (IntegratorIn x0 u p) = IntegratorOut (vcat (simulate nsteps ode x0' u' p' 0 dt))
where
endTime = msEndTime msOcp
dt = (realToFrac endTime) / fromIntegral n
ode = msOde msOcp
nsteps = fromMaybe 1 (msNumRk4Steps msOcp)
x0' = vsplit x0
u' = vsplit u
p' = vsplit p
integrator <- toFun "my_integrator" integrate mempty :: IO (Fun (IntegratorIn x u p) (IntegratorOut x))
let nlp =
Nlp
{ nlpFG = fg
, nlpIn =
NlpIn
{ nlpBX = bx
, nlpBG = bg
, nlpX0 = x0
, nlpP = catJV None
, nlpLamX0 = Nothing
, nlpLamG0 = Nothing
}
, nlpScaleF = Nothing
, nlpScaleX = Nothing
, nlpScaleG = Nothing
}
x0 :: J (MsDvs x u p n) (V.Vector Double)
x0 = jfill 0
boundsX0 = catJV (fmap (\x -> (x,x)) (msX0 msOcp)) :: J (JV x) (Vector Bounds)
boundsX = catJV (msXBnds msOcp) :: J (JV x) (Vector Bounds)
boundsU = catJV (msUBnds msOcp) :: J (JV u) (Vector Bounds)
boundsX0u = JTuple boundsX0 boundsU :: JTuple (JV x) (JV u) (Vector Bounds)
boundsXu = JTuple boundsX boundsU :: JTuple (JV x) (JV u) (Vector Bounds)
boundsXF = catJV (fmap (\x -> (x,x)) (msXF msOcp)) :: J (JV x) (Vector Bounds)
boundsXus :: (J (JVec n (JTuple (JV x) (JV u))) (Vector Bounds))
boundsXus = cat $ JVec $ mkVec' ( cat boundsX0u : replicate (n-1) (cat boundsXu))
bx :: J (MsDvs x u p n) (Vector Bounds)
bx = cat MsDvs
{ dvXus = boundsXus
, dvXf = boundsXF
, dvP = catJV (msPBnds msOcp)
}
bg :: J (MsConstraints x n) (Vector Bounds)
bg = cat MsConstraints { gContinuity = jfill (Just 0, Just 0) }
fg :: J (MsDvs x u p n) MX -> J (JV None) MX -> (S MX, J (MsConstraints x n) MX)
fg dvs _ = (f, cat g)
where
MsDvs xus xf p = split dvs
x1s :: Vec n (J (JV x) MX)
x1s = fmap (callIntegrate . split) $ unJVec $ split xus
callIntegrate (JTuple x0' u) = x1
where
IntegratorOut x1 = callSym integrator (IntegratorIn x0' u p)
lagrangeSum = F.sum $ fmap callLagrangeSum (unJVec (split xus))
where
callLagrangeSum xu = msLagrangeSum msOcp (vsplit x) (vsplit u)
where
JTuple x u = split xu
mayer = msMayer msOcp (vsplit xf)
f :: S MX
f = mayer + lagrangeSum
x0s' = fmap (extractx . split) $ unJVec $ split xus :: Vec n (J (JV x) MX)
extractx (JTuple x0'' _) = x0''
x0s = tvtail (x0s' |> xf) :: Vec n (J (JV x) MX)
gaps:: Vec n (J (JV x) MX)
gaps = tvzipWith (-) x1s x0s
g :: MsConstraints x n MX
g = MsConstraints { gContinuity = cat $ JVec gaps }
return nlp
| 3,026
| false
| true
| 0
| 18
| 1,176
| 1,366
| 697
| 669
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.