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
larioj/nemo
test/NemoGraphSpec.hs
mit
nemoGraphB = NemoGraph (graph depGraphA) Map.empty (Map.fromList [("c", Just "c-clone")])
93
nemoGraphB = NemoGraph (graph depGraphA) Map.empty (Map.fromList [("c", Just "c-clone")])
93
nemoGraphB = NemoGraph (graph depGraphA) Map.empty (Map.fromList [("c", Just "c-clone")])
93
false
false
1
10
13
45
21
24
null
null
deech/LibClang
src/Clang/Index.hs
bsd-3-clause
-- | Creates an index. withNew :: ClangBase m => Bool -- ^ Whether to exclude declarations coming from pre-compiled headers. -> Bool -- ^ Whether to automatically display diagnostic messages. -> (forall s. FFI.Index s -> ClangT s m a) -- ^ The function which will use the index. -> m a withNew i1 i2 f = runClangT (FFI.createIndex i1 i2 >>= f)
378
withNew :: ClangBase m => Bool -- ^ Whether to exclude declarations coming from pre-compiled headers. -> Bool -- ^ Whether to automatically display diagnostic messages. -> (forall s. FFI.Index s -> ClangT s m a) -- ^ The function which will use the index. -> m a withNew i1 i2 f = runClangT (FFI.createIndex i1 i2 >>= f)
355
withNew i1 i2 f = runClangT (FFI.createIndex i1 i2 >>= f)
57
true
true
0
13
98
85
43
42
null
null
konn/lxc-dummy
src/System/LXC/Internal/AttachOptions.hs
bsd-3-clause
-- | Run a shell command in the container. attachRunShell :: AttachExecFn attachRunShell = AttachExecFn p'lxc_attach_run_shell
126
attachRunShell :: AttachExecFn attachRunShell = AttachExecFn p'lxc_attach_run_shell
83
attachRunShell = AttachExecFn p'lxc_attach_run_shell
52
true
true
0
5
15
15
8
7
null
null
flashcurd/HaskellVirtualMachine
src/Main.hs
lgpl-3.0
push a xs = a : xs
18
push a xs = a : xs
18
push a xs = a : xs
18
false
false
0
5
6
16
7
9
null
null
Happy0/haskellscrabble
src/Wordify/Rules/Square.hs
gpl-3.0
isOccupied :: Square -> Bool isOccupied = isJust . squareIfOccupied
69
isOccupied :: Square -> Bool isOccupied = isJust . squareIfOccupied
67
isOccupied = isJust . squareIfOccupied
38
false
true
1
7
11
27
11
16
null
null
sitewisely/zellige
src/Data/Geometry/Clip/Internal/LineQuickClip.hs
apache-2.0
clipLinesQc :: TypesGeography.BoundingBox -> Geospatial.GeoMultiLine -> Geospatial.GeoFeature Aeson.Value -> Sequence.Seq (Geospatial.GeoFeature Aeson.Value) -> Sequence.Seq (Geospatial.GeoFeature Aeson.Value) clipLinesQc bb lines (Geospatial.GeoFeature bbox _ props fId) acc = case clipLinesQcMap bb lines of Just res -> (Sequence.<|) (Geospatial.GeoFeature bbox (Geospatial.MultiLine res) props fId) acc Nothing -> acc
431
clipLinesQc :: TypesGeography.BoundingBox -> Geospatial.GeoMultiLine -> Geospatial.GeoFeature Aeson.Value -> Sequence.Seq (Geospatial.GeoFeature Aeson.Value) -> Sequence.Seq (Geospatial.GeoFeature Aeson.Value) clipLinesQc bb lines (Geospatial.GeoFeature bbox _ props fId) acc = case clipLinesQcMap bb lines of Just res -> (Sequence.<|) (Geospatial.GeoFeature bbox (Geospatial.MultiLine res) props fId) acc Nothing -> acc
431
clipLinesQc bb lines (Geospatial.GeoFeature bbox _ props fId) acc = case clipLinesQcMap bb lines of Just res -> (Sequence.<|) (Geospatial.GeoFeature bbox (Geospatial.MultiLine res) props fId) acc Nothing -> acc
221
false
true
0
13
55
151
72
79
null
null
mcschroeder/ghc
libraries/template-haskell/Language/Haskell/TH/Lib.hs
bsd-3-clause
varT :: Name -> TypeQ varT = return . VarT
42
varT :: Name -> TypeQ varT = return . VarT
42
varT = return . VarT
20
false
true
0
5
9
19
10
9
null
null
examachine/bitdrill
src/haskell/Graph.hs
agpl-3.0
edgeIn g (x,y) = elem y (adjacent g x)
39
edgeIn g (x,y) = elem y (adjacent g x)
39
edgeIn g (x,y) = elem y (adjacent g x)
39
false
false
0
7
9
30
15
15
null
null
ilikebits/matasano
src/Matasano.hs
isc
s1q5 = args2 repeatingXorEncrypt
32
s1q5 = args2 repeatingXorEncrypt
32
s1q5 = args2 repeatingXorEncrypt
32
false
false
1
5
3
13
4
9
null
null
black-puppydog/dotfiles_crvs
xmonad.symlink/xmonad.darrhya.hs
mit
-- Color of current workspace in xmobar. xmobarCurrentWorkspaceColor = "#EE9A00"
80
xmobarCurrentWorkspaceColor = "#EE9A00"
39
xmobarCurrentWorkspaceColor = "#EE9A00"
39
true
false
0
4
9
7
4
3
null
null
antalsz/hs-to-coq
examples/base-src/gen-files/GHC/Stack/CCS.hs
mit
-- | Format a 'CostCentreStack' as a list of lines. ccsToStrings :: Ptr CostCentreStack -> IO [String] ccsToStrings ccs0 = go ccs0 [] where go ccs acc | ccs == nullPtr = return acc | otherwise = do cc <- ccsCC ccs lbl <- GHC.peekCString utf8 =<< ccLabel cc mdl <- GHC.peekCString utf8 =<< ccModule cc loc <- GHC.peekCString utf8 =<< ccSrcSpan cc parent <- ccsParent ccs if (mdl == "MAIN" && lbl == "MAIN") then return acc else go parent ((mdl ++ '.':lbl ++ ' ':'(':loc ++ ")") : acc) -- | Get the stack trace attached to an object. -- -- @since 4.5.0.0
640
ccsToStrings :: Ptr CostCentreStack -> IO [String] ccsToStrings ccs0 = go ccs0 [] where go ccs acc | ccs == nullPtr = return acc | otherwise = do cc <- ccsCC ccs lbl <- GHC.peekCString utf8 =<< ccLabel cc mdl <- GHC.peekCString utf8 =<< ccModule cc loc <- GHC.peekCString utf8 =<< ccSrcSpan cc parent <- ccsParent ccs if (mdl == "MAIN" && lbl == "MAIN") then return acc else go parent ((mdl ++ '.':lbl ++ ' ':'(':loc ++ ")") : acc) -- | Get the stack trace attached to an object. -- -- @since 4.5.0.0
588
ccsToStrings ccs0 = go ccs0 [] where go ccs acc | ccs == nullPtr = return acc | otherwise = do cc <- ccsCC ccs lbl <- GHC.peekCString utf8 =<< ccLabel cc mdl <- GHC.peekCString utf8 =<< ccModule cc loc <- GHC.peekCString utf8 =<< ccSrcSpan cc parent <- ccsParent ccs if (mdl == "MAIN" && lbl == "MAIN") then return acc else go parent ((mdl ++ '.':lbl ++ ' ':'(':loc ++ ")") : acc) -- | Get the stack trace attached to an object. -- -- @since 4.5.0.0
537
true
true
0
18
192
217
102
115
null
null
unknownloner/calccomp
Asm/InstrBytes.hs
mit
instrBytes OUT (AddrIndir port:Reg8 A:_) = w8l [0xD3, port]
59
instrBytes OUT (AddrIndir port:Reg8 A:_) = w8l [0xD3, port]
59
instrBytes OUT (AddrIndir port:Reg8 A:_) = w8l [0xD3, port]
59
false
false
0
9
8
37
18
19
null
null
dsalisbury/xmobar
src/Plugins/Monitors/MultiCpu.hs
bsd-3-clause
groupData :: [String] -> [[String]] groupData = transpose . tail . splitEvery vNum
82
groupData :: [String] -> [[String]] groupData = transpose . tail . splitEvery vNum
82
groupData = transpose . tail . splitEvery vNum
46
false
true
0
7
12
35
19
16
null
null
sdiehl/ghc
compiler/basicTypes/BasicTypes.hs
bsd-3-clause
pprOneShotInfo OneShotLam = text "OneShot"
45
pprOneShotInfo OneShotLam = text "OneShot"
45
pprOneShotInfo OneShotLam = text "OneShot"
45
false
false
0
5
7
12
5
7
null
null
anttisalonen/cgen
src/HeaderData.hs
bsd-3-clause
getObjName (VarDecl p _) = varname p
44
getObjName (VarDecl p _) = varname p
44
getObjName (VarDecl p _) = varname p
44
false
false
0
7
14
20
9
11
null
null
facebookincubator/duckling
Duckling/Ranking/Classifiers.hs
bsd-3-clause
classifiers (Locale NB _) = NB_XXClassifiers.classifiers
56
classifiers (Locale NB _) = NB_XXClassifiers.classifiers
56
classifiers (Locale NB _) = NB_XXClassifiers.classifiers
56
false
false
0
7
5
19
9
10
null
null
ezyang/ghc
compiler/cmm/CmmLint.hs
bsd-3-clause
checkCond dflags (CmmLit (CmmInt x t)) | x == 0 || x == 1, t == wordWidth dflags = return ()
92
checkCond dflags (CmmLit (CmmInt x t)) | x == 0 || x == 1, t == wordWidth dflags = return ()
92
checkCond dflags (CmmLit (CmmInt x t)) | x == 0 || x == 1, t == wordWidth dflags = return ()
92
false
false
0
10
20
59
27
32
null
null
Lythimus/lptv
sites/all/modules/jgm-pandoc-8be6cc2/src/Text/Pandoc/Writers/Textile.hs
gpl-2.0
inlineToTextile _ (LineBreak) = return "\n"
43
inlineToTextile _ (LineBreak) = return "\n"
43
inlineToTextile _ (LineBreak) = return "\n"
43
false
false
1
5
5
19
8
11
null
null
harrisi/on-being-better
list-expansion/Haskell/course/src/Course/Parser.hs
cc0-1.0
-- | Return a parser that produces one or more space characters -- (consuming until the first non-space) but fails if -- -- * The input is empty. -- -- * The first produced character is not a space. -- -- /Tip:/ Use the @list1@ and @space@ functions. spaces1 :: Parser Chars spaces1 = error "todo: Course.Parser#spaces1"
328
spaces1 :: Parser Chars spaces1 = error "todo: Course.Parser#spaces1"
73
spaces1 = error "todo: Course.Parser#spaces1"
47
true
true
0
5
64
25
16
9
null
null
iamkingmaker/HLearn
src/HLearn/History.hs
bsd-3-clause
fx1grows :: ( Has_fx1 opt v , Ord (Scalar v) ) => StopCondition_ (opt v) fx1grows opt0 opt1 = {-# SCC fx1grows #-} return $ fx1 opt0 < fx1 opt1
143
fx1grows :: ( Has_fx1 opt v , Ord (Scalar v) ) => StopCondition_ (opt v) fx1grows opt0 opt1 = {-# SCC fx1grows #-} return $ fx1 opt0 < fx1 opt1
143
fx1grows opt0 opt1 = {-# SCC fx1grows #-} return $ fx1 opt0 < fx1 opt1
70
false
true
0
9
29
67
32
35
null
null
nfjinjing/moesocks
src/Network/MoeSocks/Bootstrap.hs
apache-2.0
loadConfig :: O.Options -> ExceptT String IO C.Config loadConfig someOptions = do let _maybeFilePath = someOptions ^. O.configFile _v <- case _maybeFilePath of Nothing -> pure - Just - Object mempty Just _filePath -> fmap (preview _JSON) - io - TIO.readFile - _filePath ^. _Text let fixConfig:: Text -> Text fixConfig x = let _remoteHost = "remoteHost" _remotePort = "remotePort" _localHost = "localHost" fixes = Map.fromList [ ("server" , _remoteHost ) , ("remote" , _remoteHost ) , ("remoteAddress", _remoteHost ) , ("server_port" , _remotePort ) , ("local" , _localHost ) , ("localAddress" , _localHost ) , ("local_address", _localHost ) ] in fixes ^? ix x & fromMaybe x toParsableConfig :: Value -> Value toParsableConfig = asList - each . _1 %~ ( T.cons '_' . toHaskellNamingConvention . fixConfig ) filterEssentialConfig :: Value -> Value filterEssentialConfig = over _Object - \_obj -> foldl (flip H.delete) _obj - [ "_password" ] insertConfig :: Value -> Value -> Value insertConfig (Object _from) = over _Object (_from `H.union`) insertConfig _ = const Null insertParams :: [(Text, Value)] -> Value -> Value insertParams _from = over _Object (H.fromList _from `H.union`) fallbackConfig :: Value -> Value -> Value fallbackConfig = flip insertConfig optionalConfig = filterEssentialConfig - toJSON defaultConfig _maybeConfig = -- trace' "JSON: " _v >>= decode . encode . fallbackConfig optionalConfig . insertParams (someOptions ^. O.params) . toParsableConfig case _maybeConfig of Nothing -> do let _r = execWriter - do tell "\n" case _maybeFilePath of Just _filePath -> do tell "Failed to parse configuration file: " tell _filePath tell "\n" tell "Example: \n" tell - showConfig defaultConfig <> "\n" Nothing -> do tell "The password argument '-k' is required.\n" tell "Alternatively, use '-c' to provide a " tell "configuration file.\n" tell "\n" tell "Use '-h' to show help text" tell "\n" throwError - _r ^. _Text Just _config -> do let configStr = showConfig _config ^. _Text :: String io - debug_ - "Using config: " <> configStr pure - _config
3,357
loadConfig :: O.Options -> ExceptT String IO C.Config loadConfig someOptions = do let _maybeFilePath = someOptions ^. O.configFile _v <- case _maybeFilePath of Nothing -> pure - Just - Object mempty Just _filePath -> fmap (preview _JSON) - io - TIO.readFile - _filePath ^. _Text let fixConfig:: Text -> Text fixConfig x = let _remoteHost = "remoteHost" _remotePort = "remotePort" _localHost = "localHost" fixes = Map.fromList [ ("server" , _remoteHost ) , ("remote" , _remoteHost ) , ("remoteAddress", _remoteHost ) , ("server_port" , _remotePort ) , ("local" , _localHost ) , ("localAddress" , _localHost ) , ("local_address", _localHost ) ] in fixes ^? ix x & fromMaybe x toParsableConfig :: Value -> Value toParsableConfig = asList - each . _1 %~ ( T.cons '_' . toHaskellNamingConvention . fixConfig ) filterEssentialConfig :: Value -> Value filterEssentialConfig = over _Object - \_obj -> foldl (flip H.delete) _obj - [ "_password" ] insertConfig :: Value -> Value -> Value insertConfig (Object _from) = over _Object (_from `H.union`) insertConfig _ = const Null insertParams :: [(Text, Value)] -> Value -> Value insertParams _from = over _Object (H.fromList _from `H.union`) fallbackConfig :: Value -> Value -> Value fallbackConfig = flip insertConfig optionalConfig = filterEssentialConfig - toJSON defaultConfig _maybeConfig = -- trace' "JSON: " _v >>= decode . encode . fallbackConfig optionalConfig . insertParams (someOptions ^. O.params) . toParsableConfig case _maybeConfig of Nothing -> do let _r = execWriter - do tell "\n" case _maybeFilePath of Just _filePath -> do tell "Failed to parse configuration file: " tell _filePath tell "\n" tell "Example: \n" tell - showConfig defaultConfig <> "\n" Nothing -> do tell "The password argument '-k' is required.\n" tell "Alternatively, use '-c' to provide a " tell "configuration file.\n" tell "\n" tell "Use '-h' to show help text" tell "\n" throwError - _r ^. _Text Just _config -> do let configStr = showConfig _config ^. _Text :: String io - debug_ - "Using config: " <> configStr pure - _config
3,357
loadConfig someOptions = do let _maybeFilePath = someOptions ^. O.configFile _v <- case _maybeFilePath of Nothing -> pure - Just - Object mempty Just _filePath -> fmap (preview _JSON) - io - TIO.readFile - _filePath ^. _Text let fixConfig:: Text -> Text fixConfig x = let _remoteHost = "remoteHost" _remotePort = "remotePort" _localHost = "localHost" fixes = Map.fromList [ ("server" , _remoteHost ) , ("remote" , _remoteHost ) , ("remoteAddress", _remoteHost ) , ("server_port" , _remotePort ) , ("local" , _localHost ) , ("localAddress" , _localHost ) , ("local_address", _localHost ) ] in fixes ^? ix x & fromMaybe x toParsableConfig :: Value -> Value toParsableConfig = asList - each . _1 %~ ( T.cons '_' . toHaskellNamingConvention . fixConfig ) filterEssentialConfig :: Value -> Value filterEssentialConfig = over _Object - \_obj -> foldl (flip H.delete) _obj - [ "_password" ] insertConfig :: Value -> Value -> Value insertConfig (Object _from) = over _Object (_from `H.union`) insertConfig _ = const Null insertParams :: [(Text, Value)] -> Value -> Value insertParams _from = over _Object (H.fromList _from `H.union`) fallbackConfig :: Value -> Value -> Value fallbackConfig = flip insertConfig optionalConfig = filterEssentialConfig - toJSON defaultConfig _maybeConfig = -- trace' "JSON: " _v >>= decode . encode . fallbackConfig optionalConfig . insertParams (someOptions ^. O.params) . toParsableConfig case _maybeConfig of Nothing -> do let _r = execWriter - do tell "\n" case _maybeFilePath of Just _filePath -> do tell "Failed to parse configuration file: " tell _filePath tell "\n" tell "Example: \n" tell - showConfig defaultConfig <> "\n" Nothing -> do tell "The password argument '-k' is required.\n" tell "Alternatively, use '-c' to provide a " tell "configuration file.\n" tell "\n" tell "Use '-h' to show help text" tell "\n" throwError - _r ^. _Text Just _config -> do let configStr = showConfig _config ^. _Text :: String io - debug_ - "Using config: " <> configStr pure - _config
3,303
false
true
0
25
1,625
687
341
346
null
null
konn/graph-utils
Data/Graph/PageRank.hs
bsd-3-clause
-- |'pageRanks' calculate the PageRank for each node in the Graph 'gr' pageRanks :: (Graph gr) => gr a b -> Double -> Double -> RankDic pageRanks gr epsilon error = fst $ execRWS steps Env{node=nds, from=froms, outdegrees=outdegs} initRanks where nds = nodes gr count :: (Num a) => a count = fromIntegral $ noNodes gr froms = fromList $ zip nds $ map (pre gr) nds outdegs = fromList $ zip nds $ map (outdeg gr) nds initRanks = fromList $ zip nds $ replicate count (1/count) steps = do old <- get new <- calcPageRank epsilon let cond = foldWithKey (\k a b -> b && ((findWithDefault (1/0) k new)-a < error)) True old if cond then return new else steps
761
pageRanks :: (Graph gr) => gr a b -> Double -> Double -> RankDic pageRanks gr epsilon error = fst $ execRWS steps Env{node=nds, from=froms, outdegrees=outdegs} initRanks where nds = nodes gr count :: (Num a) => a count = fromIntegral $ noNodes gr froms = fromList $ zip nds $ map (pre gr) nds outdegs = fromList $ zip nds $ map (outdeg gr) nds initRanks = fromList $ zip nds $ replicate count (1/count) steps = do old <- get new <- calcPageRank epsilon let cond = foldWithKey (\k a b -> b && ((findWithDefault (1/0) k new)-a < error)) True old if cond then return new else steps
690
pageRanks gr epsilon error = fst $ execRWS steps Env{node=nds, from=froms, outdegrees=outdegs} initRanks where nds = nodes gr count :: (Num a) => a count = fromIntegral $ noNodes gr froms = fromList $ zip nds $ map (pre gr) nds outdegs = fromList $ zip nds $ map (outdeg gr) nds initRanks = fromList $ zip nds $ replicate count (1/count) steps = do old <- get new <- calcPageRank epsilon let cond = foldWithKey (\k a b -> b && ((findWithDefault (1/0) k new)-a < error)) True old if cond then return new else steps
625
true
true
5
20
234
318
150
168
null
null
nh2/shake
Development/Shake/Derived.hs
bsd-3-clause
-- | Read a file, after calling 'need'. readFile' :: FilePath -> Action String readFile' x = need [x] >> liftIO (readFile x)
124
readFile' :: FilePath -> Action String readFile' x = need [x] >> liftIO (readFile x)
84
readFile' x = need [x] >> liftIO (readFile x)
45
true
true
0
8
22
41
20
21
null
null
qpliu/esolang
shiftprime/hs/Parse.hs
gpl-3.0
compileExprs arity (Def1Mul _ leftExprs rightExprs:exprs) = case (compileExprs arity leftExprs,compileExprs arity rightExprs) of ((leftExpr,[]),(rightExpr,[])) -> (ExprMul leftExpr rightExpr,exprs) ((_,expr:_),_) -> (ExprCompileError (def1ExprLocation expr,"Unexpected expression"),exprs) (_,(_,expr:_)) -> (ExprCompileError (def1ExprLocation expr,"Unexpected expression"),exprs)
401
compileExprs arity (Def1Mul _ leftExprs rightExprs:exprs) = case (compileExprs arity leftExprs,compileExprs arity rightExprs) of ((leftExpr,[]),(rightExpr,[])) -> (ExprMul leftExpr rightExpr,exprs) ((_,expr:_),_) -> (ExprCompileError (def1ExprLocation expr,"Unexpected expression"),exprs) (_,(_,expr:_)) -> (ExprCompileError (def1ExprLocation expr,"Unexpected expression"),exprs)
401
compileExprs arity (Def1Mul _ leftExprs rightExprs:exprs) = case (compileExprs arity leftExprs,compileExprs arity rightExprs) of ((leftExpr,[]),(rightExpr,[])) -> (ExprMul leftExpr rightExpr,exprs) ((_,expr:_),_) -> (ExprCompileError (def1ExprLocation expr,"Unexpected expression"),exprs) (_,(_,expr:_)) -> (ExprCompileError (def1ExprLocation expr,"Unexpected expression"),exprs)
401
false
false
0
11
52
164
91
73
null
null
andorp/hs-bluesnap
src/Bluesnap/API/Response.hs
gpl-3.0
elementDownload_links :: XMLParser Download_links elementDownload_links = parseSchemaType "download-links"
106
elementDownload_links :: XMLParser Download_links elementDownload_links = parseSchemaType "download-links"
106
elementDownload_links = parseSchemaType "download-links"
56
false
true
0
5
7
17
8
9
null
null
ruud-v-a/hakyll
src/Hakyll/Web/Html.hs
bsd-3-clause
isUrlAttribute :: String -> Bool isUrlAttribute = (`elem` ["src", "href", "data"])
82
isUrlAttribute :: String -> Bool isUrlAttribute = (`elem` ["src", "href", "data"])
82
isUrlAttribute = (`elem` ["src", "href", "data"])
49
false
true
0
6
10
30
19
11
null
null
balachia/CriticMarkup.hs
CriticMarkup.hs
mit
cmParse :: Parsec String () String cmParse = matchTag (Tag "" EOF Keep)
71
cmParse :: Parsec String () String cmParse = matchTag (Tag "" EOF Keep)
71
cmParse = matchTag (Tag "" EOF Keep)
36
false
true
1
6
12
37
16
21
null
null
armoredsoftware/protocol
demos/PaulPractice/bookExactly3.hs
bsd-3-clause
eval (Succ TRUE) = NUM_EXPECTED_ERROR
37
eval (Succ TRUE) = NUM_EXPECTED_ERROR
37
eval (Succ TRUE) = NUM_EXPECTED_ERROR
37
false
false
0
7
4
15
7
8
null
null
hvr/vector
Data/Vector/Primitive.hs
bsd-3-clause
minIndex = G.minIndex
21
minIndex = G.minIndex
21
minIndex = G.minIndex
21
false
false
0
5
2
8
4
4
null
null
ctford/Idris-Elba-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
{-! deriving instance Binary PTerm deriving instance NFData PTerm !-} mapPT :: (PTerm -> PTerm) -> PTerm -> PTerm mapPT f t = f (mpt t) where mpt (PLam n t s) = PLam n (mapPT f t) (mapPT f s) mpt (PPi p n t s) = PPi p n (mapPT f t) (mapPT f s) mpt (PLet n ty v s) = PLet n (mapPT f ty) (mapPT f v) (mapPT f s) mpt (PRewrite fc t s g) = PRewrite fc (mapPT f t) (mapPT f s) (fmap (mapPT f) g) mpt (PApp fc t as) = PApp fc (mapPT f t) (map (fmap (mapPT f)) as) mpt (PAppBind fc t as) = PAppBind fc (mapPT f t) (map (fmap (mapPT f)) as) mpt (PCase fc c os) = PCase fc (mapPT f c) (map (pmap (mapPT f)) os) mpt (PEq fc l r) = PEq fc (mapPT f l) (mapPT f r) mpt (PTyped l r) = PTyped (mapPT f l) (mapPT f r) mpt (PPair fc l r) = PPair fc (mapPT f l) (mapPT f r) mpt (PDPair fc l t r) = PDPair fc (mapPT f l) (mapPT f t) (mapPT f r) mpt (PAlternative a as) = PAlternative a (map (mapPT f) as) mpt (PHidden t) = PHidden (mapPT f t) mpt (PDoBlock ds) = PDoBlock (map (fmap (mapPT f)) ds) mpt (PProof ts) = PProof (map (fmap (mapPT f)) ts) mpt (PTactics ts) = PTactics (map (fmap (mapPT f)) ts) mpt (PUnifyLog tm) = PUnifyLog (mapPT f tm) mpt (PDisamb ns tm) = PDisamb ns (mapPT f tm) mpt (PNoImplicits tm) = PNoImplicits (mapPT f tm) mpt (PGoal fc r n sc) = PGoal fc (mapPT f r) n (mapPT f sc) mpt x = x
1,370
mapPT :: (PTerm -> PTerm) -> PTerm -> PTerm mapPT f t = f (mpt t) where mpt (PLam n t s) = PLam n (mapPT f t) (mapPT f s) mpt (PPi p n t s) = PPi p n (mapPT f t) (mapPT f s) mpt (PLet n ty v s) = PLet n (mapPT f ty) (mapPT f v) (mapPT f s) mpt (PRewrite fc t s g) = PRewrite fc (mapPT f t) (mapPT f s) (fmap (mapPT f) g) mpt (PApp fc t as) = PApp fc (mapPT f t) (map (fmap (mapPT f)) as) mpt (PAppBind fc t as) = PAppBind fc (mapPT f t) (map (fmap (mapPT f)) as) mpt (PCase fc c os) = PCase fc (mapPT f c) (map (pmap (mapPT f)) os) mpt (PEq fc l r) = PEq fc (mapPT f l) (mapPT f r) mpt (PTyped l r) = PTyped (mapPT f l) (mapPT f r) mpt (PPair fc l r) = PPair fc (mapPT f l) (mapPT f r) mpt (PDPair fc l t r) = PDPair fc (mapPT f l) (mapPT f t) (mapPT f r) mpt (PAlternative a as) = PAlternative a (map (mapPT f) as) mpt (PHidden t) = PHidden (mapPT f t) mpt (PDoBlock ds) = PDoBlock (map (fmap (mapPT f)) ds) mpt (PProof ts) = PProof (map (fmap (mapPT f)) ts) mpt (PTactics ts) = PTactics (map (fmap (mapPT f)) ts) mpt (PUnifyLog tm) = PUnifyLog (mapPT f tm) mpt (PDisamb ns tm) = PDisamb ns (mapPT f tm) mpt (PNoImplicits tm) = PNoImplicits (mapPT f tm) mpt (PGoal fc r n sc) = PGoal fc (mapPT f r) n (mapPT f sc) mpt x = x
1,299
mapPT f t = f (mpt t) where mpt (PLam n t s) = PLam n (mapPT f t) (mapPT f s) mpt (PPi p n t s) = PPi p n (mapPT f t) (mapPT f s) mpt (PLet n ty v s) = PLet n (mapPT f ty) (mapPT f v) (mapPT f s) mpt (PRewrite fc t s g) = PRewrite fc (mapPT f t) (mapPT f s) (fmap (mapPT f) g) mpt (PApp fc t as) = PApp fc (mapPT f t) (map (fmap (mapPT f)) as) mpt (PAppBind fc t as) = PAppBind fc (mapPT f t) (map (fmap (mapPT f)) as) mpt (PCase fc c os) = PCase fc (mapPT f c) (map (pmap (mapPT f)) os) mpt (PEq fc l r) = PEq fc (mapPT f l) (mapPT f r) mpt (PTyped l r) = PTyped (mapPT f l) (mapPT f r) mpt (PPair fc l r) = PPair fc (mapPT f l) (mapPT f r) mpt (PDPair fc l t r) = PDPair fc (mapPT f l) (mapPT f t) (mapPT f r) mpt (PAlternative a as) = PAlternative a (map (mapPT f) as) mpt (PHidden t) = PHidden (mapPT f t) mpt (PDoBlock ds) = PDoBlock (map (fmap (mapPT f)) ds) mpt (PProof ts) = PProof (map (fmap (mapPT f)) ts) mpt (PTactics ts) = PTactics (map (fmap (mapPT f)) ts) mpt (PUnifyLog tm) = PUnifyLog (mapPT f tm) mpt (PDisamb ns tm) = PDisamb ns (mapPT f tm) mpt (PNoImplicits tm) = PNoImplicits (mapPT f tm) mpt (PGoal fc r n sc) = PGoal fc (mapPT f r) n (mapPT f sc) mpt x = x
1,255
true
true
0
11
370
874
428
446
null
null
j-rock/lambduh
src/Language/Parse.hs
mit
ws :: Parser () ws = skipWhile $ liftA2 (||) isHorizontalSpace isEndOfLine
74
ws :: Parser () ws = skipWhile $ liftA2 (||) isHorizontalSpace isEndOfLine
74
ws = skipWhile $ liftA2 (||) isHorizontalSpace isEndOfLine
58
false
true
2
7
11
35
16
19
null
null
mumuki/mulang
src/Language/Mulang/Parsers/JavaScript.hs
gpl-3.0
muFor inits conds progs body = (ForLoop (muJSExpressionFromList inits) (muJSExpressionFromList conds) (muJSExpressionFromList progs) (muJSStatement body))
290
muFor inits conds progs body = (ForLoop (muJSExpressionFromList inits) (muJSExpressionFromList conds) (muJSExpressionFromList progs) (muJSStatement body))
290
muFor inits conds progs body = (ForLoop (muJSExpressionFromList inits) (muJSExpressionFromList conds) (muJSExpressionFromList progs) (muJSStatement body))
290
false
false
0
8
150
51
25
26
null
null
magthe/cblrepo
src/Versions.hs
apache-2.0
printAllVersions :: (String, Maybe [(Version, Int)]) -> IO () printAllVersions (p, Nothing) = putStrLn $ p ++ ": No such package"
129
printAllVersions :: (String, Maybe [(Version, Int)]) -> IO () printAllVersions (p, Nothing) = putStrLn $ p ++ ": No such package"
129
printAllVersions (p, Nothing) = putStrLn $ p ++ ": No such package"
67
false
true
0
9
20
55
30
25
null
null
pminten/xhaskell
meetup/example.hs
mit
toWeekday :: Weekday -> Day -> Day toWeekday w d = fromIntegral offset `addDays` d where offset | wnum >= wd = wnum - wd | otherwise = 7 + wnum - wd wnum = weekdayNum w (_, _, wd) = toWeekDate d
228
toWeekday :: Weekday -> Day -> Day toWeekday w d = fromIntegral offset `addDays` d where offset | wnum >= wd = wnum - wd | otherwise = 7 + wnum - wd wnum = weekdayNum w (_, _, wd) = toWeekDate d
228
toWeekday w d = fromIntegral offset `addDays` d where offset | wnum >= wd = wnum - wd | otherwise = 7 + wnum - wd wnum = weekdayNum w (_, _, wd) = toWeekDate d
193
false
true
2
8
76
98
49
49
null
null
david-caro/shellcheck
ShellCheck/Analytics.hs
gpl-3.0
prop_checkBashisms28= verify checkBashisms "exec {n}>&2"
56
prop_checkBashisms28= verify checkBashisms "exec {n}>&2"
56
prop_checkBashisms28= verify checkBashisms "exec {n}>&2"
56
false
false
0
5
4
11
5
6
null
null
Mahdi89/eTeak
src/Plot.hs
bsd-3-clause
compUsePortNames (TeakComp { nwTeakType = TeakI {} }) _ = False
63
compUsePortNames (TeakComp { nwTeakType = TeakI {} }) _ = False
63
compUsePortNames (TeakComp { nwTeakType = TeakI {} }) _ = False
63
false
false
0
10
10
27
14
13
null
null
lukexi/reshader
test/TestReshader.hs
bsd-2-clause
resY = 1080
11
resY = 1080
11
resY = 1080
11
false
false
0
4
2
6
3
3
null
null
aaronc/Idris-dev
src/IRTS/CodegenC.hs
bsd-3-clause
doOp v (LZExt (ITFixed from) ITNative) [x] = v ++ "MKINT((i_int)" ++ creg x ++ "->info.bits" ++ show (nativeTyWidth from) ++ ")"
132
doOp v (LZExt (ITFixed from) ITNative) [x] = v ++ "MKINT((i_int)" ++ creg x ++ "->info.bits" ++ show (nativeTyWidth from) ++ ")"
132
doOp v (LZExt (ITFixed from) ITNative) [x] = v ++ "MKINT((i_int)" ++ creg x ++ "->info.bits" ++ show (nativeTyWidth from) ++ ")"
132
false
false
3
9
25
69
30
39
null
null
phischu/fragnix
tests/packages/scotty/Data.Vector.Fusion.Bundle.hs
bsd-3-clause
concatMap = M.concatMap
23
concatMap = M.concatMap
23
concatMap = M.concatMap
23
false
false
1
6
2
12
4
8
null
null
elieux/ghc
compiler/typecheck/TcPatSyn.hs
bsd-3-clause
tcCheckPatSynPat :: LPat Name -> TcM () tcCheckPatSynPat = go where go :: LPat Name -> TcM () go = addLocM go1 go1 :: Pat Name -> TcM () go1 (ConPatIn _ info) = mapM_ go (hsConPatArgs info) go1 VarPat{} = return () go1 WildPat{} = return () go1 p@(AsPat _ _) = asPatInPatSynErr p go1 (LazyPat pat) = go pat go1 (ParPat pat) = go pat go1 (BangPat pat) = go pat go1 (PArrPat pats _) = mapM_ go pats go1 (ListPat pats _ _) = mapM_ go pats go1 (TuplePat pats _ _) = mapM_ go pats go1 LitPat{} = return () go1 NPat{} = return () go1 (SigPatIn pat _) = go pat go1 (ViewPat _ pat _) = go pat go1 p@SplicePat{} = thInPatSynErr p go1 p@NPlusKPat{} = nPlusKPatInPatSynErr p go1 ConPatOut{} = panic "ConPatOut in output of renamer" go1 SigPatOut{} = panic "SigPatOut in output of renamer" go1 CoPat{} = panic "CoPat in output of renamer"
1,076
tcCheckPatSynPat :: LPat Name -> TcM () tcCheckPatSynPat = go where go :: LPat Name -> TcM () go = addLocM go1 go1 :: Pat Name -> TcM () go1 (ConPatIn _ info) = mapM_ go (hsConPatArgs info) go1 VarPat{} = return () go1 WildPat{} = return () go1 p@(AsPat _ _) = asPatInPatSynErr p go1 (LazyPat pat) = go pat go1 (ParPat pat) = go pat go1 (BangPat pat) = go pat go1 (PArrPat pats _) = mapM_ go pats go1 (ListPat pats _ _) = mapM_ go pats go1 (TuplePat pats _ _) = mapM_ go pats go1 LitPat{} = return () go1 NPat{} = return () go1 (SigPatIn pat _) = go pat go1 (ViewPat _ pat _) = go pat go1 p@SplicePat{} = thInPatSynErr p go1 p@NPlusKPat{} = nPlusKPatInPatSynErr p go1 ConPatOut{} = panic "ConPatOut in output of renamer" go1 SigPatOut{} = panic "SigPatOut in output of renamer" go1 CoPat{} = panic "CoPat in output of renamer"
1,076
tcCheckPatSynPat = go where go :: LPat Name -> TcM () go = addLocM go1 go1 :: Pat Name -> TcM () go1 (ConPatIn _ info) = mapM_ go (hsConPatArgs info) go1 VarPat{} = return () go1 WildPat{} = return () go1 p@(AsPat _ _) = asPatInPatSynErr p go1 (LazyPat pat) = go pat go1 (ParPat pat) = go pat go1 (BangPat pat) = go pat go1 (PArrPat pats _) = mapM_ go pats go1 (ListPat pats _ _) = mapM_ go pats go1 (TuplePat pats _ _) = mapM_ go pats go1 LitPat{} = return () go1 NPat{} = return () go1 (SigPatIn pat _) = go pat go1 (ViewPat _ pat _) = go pat go1 p@SplicePat{} = thInPatSynErr p go1 p@NPlusKPat{} = nPlusKPatInPatSynErr p go1 ConPatOut{} = panic "ConPatOut in output of renamer" go1 SigPatOut{} = panic "SigPatOut in output of renamer" go1 CoPat{} = panic "CoPat in output of renamer"
1,036
false
true
25
8
410
389
202
187
null
null
lostbean/radio-fm69
src/Radio/RFM69/Registers.hs
bsd-3-clause
fStep :: Double fStep = fXoSc / 524288
38
fStep :: Double fStep = fXoSc / 524288
38
fStep = fXoSc / 524288
22
false
true
2
6
7
23
9
14
null
null
Philonous/xml-picklers
src/Data/XML/Pickle/Basic.hs
bsd-3-clause
-- | Override the last backtrace level in the error report. (<?>) :: (Text, Text) -> PU t a -> PU t a (<?>) tr = mapError (swapStack tr) where swapStack ns (TraceStep _s e) = TraceStep ns e swapStack _ns e = error $ "Can't replace non-trace step: " ++ show e
268
(<?>) :: (Text, Text) -> PU t a -> PU t a (<?>) tr = mapError (swapStack tr) where swapStack ns (TraceStep _s e) = TraceStep ns e swapStack _ns e = error $ "Can't replace non-trace step: " ++ show e
208
(<?>) tr = mapError (swapStack tr) where swapStack ns (TraceStep _s e) = TraceStep ns e swapStack _ns e = error $ "Can't replace non-trace step: " ++ show e
166
true
true
0
7
62
99
50
49
null
null
nominolo/haddock2
src/Haddock/Interface/Rename.hs
bsd-2-clause
renameDoc :: Doc Name -> RnM (Doc DocName) renameDoc d = case d of DocEmpty -> return DocEmpty DocAppend a b -> do a' <- renameDoc a b' <- renameDoc b return (DocAppend a' b') DocString str -> return (DocString str) DocParagraph doc -> do doc' <- renameDoc doc return (DocParagraph doc') DocIdentifier ids -> do lkp <- getLookupRn case [ n | (True, n) <- map lkp ids ] of ids'@(_:_) -> return (DocIdentifier ids') [] -> return (DocIdentifier (map Undocumented ids)) DocModule str -> return (DocModule str) DocEmphasis doc -> do doc' <- renameDoc doc return (DocEmphasis doc') DocMonospaced doc -> do doc' <- renameDoc doc return (DocMonospaced doc') DocUnorderedList docs -> do docs' <- mapM renameDoc docs return (DocUnorderedList docs') DocOrderedList docs -> do docs' <- mapM renameDoc docs return (DocOrderedList docs') DocDefList docs -> do docs' <- mapM (\(a,b) -> do a' <- renameDoc a b' <- renameDoc b return (a',b')) docs return (DocDefList docs') DocCodeBlock doc -> do doc' <- renameDoc doc return (DocCodeBlock doc') DocURL str -> return (DocURL str) DocPic str -> return (DocPic str) DocAName str -> return (DocAName str) DocExamples e -> return (DocExamples e)
1,312
renameDoc :: Doc Name -> RnM (Doc DocName) renameDoc d = case d of DocEmpty -> return DocEmpty DocAppend a b -> do a' <- renameDoc a b' <- renameDoc b return (DocAppend a' b') DocString str -> return (DocString str) DocParagraph doc -> do doc' <- renameDoc doc return (DocParagraph doc') DocIdentifier ids -> do lkp <- getLookupRn case [ n | (True, n) <- map lkp ids ] of ids'@(_:_) -> return (DocIdentifier ids') [] -> return (DocIdentifier (map Undocumented ids)) DocModule str -> return (DocModule str) DocEmphasis doc -> do doc' <- renameDoc doc return (DocEmphasis doc') DocMonospaced doc -> do doc' <- renameDoc doc return (DocMonospaced doc') DocUnorderedList docs -> do docs' <- mapM renameDoc docs return (DocUnorderedList docs') DocOrderedList docs -> do docs' <- mapM renameDoc docs return (DocOrderedList docs') DocDefList docs -> do docs' <- mapM (\(a,b) -> do a' <- renameDoc a b' <- renameDoc b return (a',b')) docs return (DocDefList docs') DocCodeBlock doc -> do doc' <- renameDoc doc return (DocCodeBlock doc') DocURL str -> return (DocURL str) DocPic str -> return (DocPic str) DocAName str -> return (DocAName str) DocExamples e -> return (DocExamples e)
1,312
renameDoc d = case d of DocEmpty -> return DocEmpty DocAppend a b -> do a' <- renameDoc a b' <- renameDoc b return (DocAppend a' b') DocString str -> return (DocString str) DocParagraph doc -> do doc' <- renameDoc doc return (DocParagraph doc') DocIdentifier ids -> do lkp <- getLookupRn case [ n | (True, n) <- map lkp ids ] of ids'@(_:_) -> return (DocIdentifier ids') [] -> return (DocIdentifier (map Undocumented ids)) DocModule str -> return (DocModule str) DocEmphasis doc -> do doc' <- renameDoc doc return (DocEmphasis doc') DocMonospaced doc -> do doc' <- renameDoc doc return (DocMonospaced doc') DocUnorderedList docs -> do docs' <- mapM renameDoc docs return (DocUnorderedList docs') DocOrderedList docs -> do docs' <- mapM renameDoc docs return (DocOrderedList docs') DocDefList docs -> do docs' <- mapM (\(a,b) -> do a' <- renameDoc a b' <- renameDoc b return (a',b')) docs return (DocDefList docs') DocCodeBlock doc -> do doc' <- renameDoc doc return (DocCodeBlock doc') DocURL str -> return (DocURL str) DocPic str -> return (DocPic str) DocAName str -> return (DocAName str) DocExamples e -> return (DocExamples e)
1,269
false
true
17
14
331
559
251
308
null
null
brendanhay/gogol
gogol-ml/gen/Network/Google/Resource/Ml/Projects/Models/Versions/Patch.hs
mpl-2.0
-- | Required. The name of the model. pmvpName :: Lens' ProjectsModelsVersionsPatch Text pmvpName = lens _pmvpName (\ s a -> s{_pmvpName = a})
142
pmvpName :: Lens' ProjectsModelsVersionsPatch Text pmvpName = lens _pmvpName (\ s a -> s{_pmvpName = a})
104
pmvpName = lens _pmvpName (\ s a -> s{_pmvpName = a})
53
true
true
1
9
23
43
22
21
null
null
d0kt0r0/Tidal
src/Sound/Tidal/Params.hs
gpl-3.0
from :: Pattern Double -> ControlPattern from = pF "from"
57
from :: Pattern Double -> ControlPattern from = pF "from"
57
from = pF "from"
16
false
true
0
6
9
21
10
11
null
null
rgrinberg/wai
warp/test/ExceptionSpec.hs
mit
withTestServer :: (Int -> IO a) -> IO a withTestServer inner = bracket (N.bindRandomPortTCP "127.0.0.1") (sClose . snd) $ \(prt, lsocket) -> do withAsync (runSettingsSocket defaultSettings lsocket testApp) $ \_ -> inner prt
255
withTestServer :: (Int -> IO a) -> IO a withTestServer inner = bracket (N.bindRandomPortTCP "127.0.0.1") (sClose . snd) $ \(prt, lsocket) -> do withAsync (runSettingsSocket defaultSettings lsocket testApp) $ \_ -> inner prt
255
withTestServer inner = bracket (N.bindRandomPortTCP "127.0.0.1") (sClose . snd) $ \(prt, lsocket) -> do withAsync (runSettingsSocket defaultSettings lsocket testApp) $ \_ -> inner prt
215
false
true
2
12
64
101
48
53
null
null
haroldcarr/learn-haskell-coq-ml-etc
haskell/topic/monads/2017-04-sandy-mcquire-freer-monads-in-action-eff/src/VEff.hs
unlicense
d :: Int -> Int -> ((Maybe (Int,Int,Int), String), Int) d initialBalance w = run . flip runState initialBalance . runWriter $ withdraw w
136
d :: Int -> Int -> ((Maybe (Int,Int,Int), String), Int) d initialBalance w = run . flip runState initialBalance . runWriter $ withdraw w
136
d initialBalance w = run . flip runState initialBalance . runWriter $ withdraw w
80
false
true
0
10
23
72
37
35
null
null
sdiehl/ghc
compiler/GHC/StgToCmm/Heap.hs
bsd-3-clause
altHeapCheck :: [LocalReg] -> FCode a -> FCode a altHeapCheck regs code = altOrNoEscapeHeapCheck False regs code
112
altHeapCheck :: [LocalReg] -> FCode a -> FCode a altHeapCheck regs code = altOrNoEscapeHeapCheck False regs code
112
altHeapCheck regs code = altOrNoEscapeHeapCheck False regs code
63
false
true
0
8
16
44
20
24
null
null
RossMeikleham/GPC
src/GPC/Interpreter.hs
bsd-2-clause
genBinExpr :: BinOps -> Expr -> Expr -> GenState SymbolTree genBinExpr bOp lExpr rExpr = do curThread <- getThread let method = case bOp of Add -> "+" Sub -> "-" Mul -> "*" Div -> "/" And -> "&&" Or -> "||" Mod -> "%" Less -> "<" LessEq -> "<=" Greater -> ">" GreaterEq -> ">=" Equals -> "==" NEquals -> "!=" ShiftL -> "<<" ShiftR -> ">>" BAnd -> "&" BXor -> "^" BOr -> "|" let binSymbol = Symbol $ GOpSymbol $ MkOpSymbol False ("", curThread) [method] lExpr' <- genExpr lExpr rExpr' <- genExpr rExpr return $ SymbolList False [binSymbol, lExpr', rExpr']
812
genBinExpr :: BinOps -> Expr -> Expr -> GenState SymbolTree genBinExpr bOp lExpr rExpr = do curThread <- getThread let method = case bOp of Add -> "+" Sub -> "-" Mul -> "*" Div -> "/" And -> "&&" Or -> "||" Mod -> "%" Less -> "<" LessEq -> "<=" Greater -> ">" GreaterEq -> ">=" Equals -> "==" NEquals -> "!=" ShiftL -> "<<" ShiftR -> ">>" BAnd -> "&" BXor -> "^" BOr -> "|" let binSymbol = Symbol $ GOpSymbol $ MkOpSymbol False ("", curThread) [method] lExpr' <- genExpr lExpr rExpr' <- genExpr rExpr return $ SymbolList False [binSymbol, lExpr', rExpr']
812
genBinExpr bOp lExpr rExpr = do curThread <- getThread let method = case bOp of Add -> "+" Sub -> "-" Mul -> "*" Div -> "/" And -> "&&" Or -> "||" Mod -> "%" Less -> "<" LessEq -> "<=" Greater -> ">" GreaterEq -> ">=" Equals -> "==" NEquals -> "!=" ShiftL -> "<<" ShiftR -> ">>" BAnd -> "&" BXor -> "^" BOr -> "|" let binSymbol = Symbol $ GOpSymbol $ MkOpSymbol False ("", curThread) [method] lExpr' <- genExpr lExpr rExpr' <- genExpr rExpr return $ SymbolList False [binSymbol, lExpr', rExpr']
752
false
true
0
12
363
235
115
120
null
null
rueshyna/gogol
gogol-youtube/gen/Network/Google/YouTube/Types/Product.hs
mpl-2.0
-- | The configurations issues on this stream lshsConfigurationIssues :: Lens' LiveStreamHealthStatus [LiveStreamConfigurationIssue] lshsConfigurationIssues = lens _lshsConfigurationIssues (\ s a -> s{_lshsConfigurationIssues = a}) . _Default . _Coerce
272
lshsConfigurationIssues :: Lens' LiveStreamHealthStatus [LiveStreamConfigurationIssue] lshsConfigurationIssues = lens _lshsConfigurationIssues (\ s a -> s{_lshsConfigurationIssues = a}) . _Default . _Coerce
226
lshsConfigurationIssues = lens _lshsConfigurationIssues (\ s a -> s{_lshsConfigurationIssues = a}) . _Default . _Coerce
139
true
true
0
11
47
53
28
25
null
null
elieux/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
datatypeClassKey = mkPreludeClassUnique 39
45
datatypeClassKey = mkPreludeClassUnique 39
45
datatypeClassKey = mkPreludeClassUnique 39
45
false
false
0
5
6
9
4
5
null
null
FranklinChen/hugs98-plus-Sep2006
packages/HaXml/src/Text/XML/HaXml/Html/Pretty.hs
bsd-3-clause
defaultdecl (DefaultTo a f) = maybe (const (text "#FIXED")) f <+> attvalue a
79
defaultdecl (DefaultTo a f) = maybe (const (text "#FIXED")) f <+> attvalue a
79
defaultdecl (DefaultTo a f) = maybe (const (text "#FIXED")) f <+> attvalue a
79
false
false
0
10
15
41
19
22
null
null
gcampax/ghc
compiler/hsSyn/HsTypes.hs
bsd-3-clause
-- Even if tvs is empty, we still make a HsForAll! -- In the Implicit case, this signals the place to do implicit quantification -- In the Explicit case, it prevents implicit quantification -- (see the sigtype production in Parser.y) -- so that (forall. ty) isn't implicitly quantified plus :: HsExplicitFlag -> HsExplicitFlag -> HsExplicitFlag Qualified `plus` Qualified = Qualified
426
plus :: HsExplicitFlag -> HsExplicitFlag -> HsExplicitFlag Qualified `plus` Qualified = Qualified
97
Qualified `plus` Qualified = Qualified
38
true
true
0
6
102
39
21
18
null
null
zcwj/emacs
lisps/mew/bin/hs/Index.hs
gpl-3.0
getModTime :: FilePath -> IO Integer getModTime file = utctimeToInteger <$> getModificationTime file
100
getModTime :: FilePath -> IO Integer getModTime file = utctimeToInteger <$> getModificationTime file
100
getModTime file = utctimeToInteger <$> getModificationTime file
63
false
true
0
6
12
28
13
15
null
null
mapinguari/SC_HS_Proxy
src/Proxy/Query/Unit.hs
mit
canMove ProtossObserver = True
30
canMove ProtossObserver = True
30
canMove ProtossObserver = True
30
false
false
0
5
3
9
4
5
null
null
rumblesan/proviz
src/Language/Interpreter.hs
bsd-3-clause
interpretApplication :: Variable -> [ApplicationArg] -> Maybe Lambda -> InterpreterProcess Value interpretApplication name args mbLmb = do v <- interpretVariable name argValues <- foldM handleArg [] args case v of (BuiltInFunctionRef name) -> newScope $ do (BuiltInFunction action) <- getBuiltIn name action argValues (LambdaRef lmb) -> interpretFunctionCall lmb argValues mbLmb ot -> throwError $ show name ++ " cannot be applied as it is of type " ++ getValueType ot
539
interpretApplication :: Variable -> [ApplicationArg] -> Maybe Lambda -> InterpreterProcess Value interpretApplication name args mbLmb = do v <- interpretVariable name argValues <- foldM handleArg [] args case v of (BuiltInFunctionRef name) -> newScope $ do (BuiltInFunction action) <- getBuiltIn name action argValues (LambdaRef lmb) -> interpretFunctionCall lmb argValues mbLmb ot -> throwError $ show name ++ " cannot be applied as it is of type " ++ getValueType ot
539
interpretApplication name args mbLmb = do v <- interpretVariable name argValues <- foldM handleArg [] args case v of (BuiltInFunctionRef name) -> newScope $ do (BuiltInFunction action) <- getBuiltIn name action argValues (LambdaRef lmb) -> interpretFunctionCall lmb argValues mbLmb ot -> throwError $ show name ++ " cannot be applied as it is of type " ++ getValueType ot
440
false
true
0
16
140
157
71
86
null
null
nomeata/codeworld
codeworld-base/src/Internal/Picture.hs
apache-2.0
-- | A picture scaled by these factors. scaled :: (Picture, Number, Number) -> Picture scaled (p, x, y) = CWPic (CW.scaled (toDouble x) (toDouble y) (toCWPic p))
161
scaled :: (Picture, Number, Number) -> Picture scaled (p, x, y) = CWPic (CW.scaled (toDouble x) (toDouble y) (toCWPic p))
121
scaled (p, x, y) = CWPic (CW.scaled (toDouble x) (toDouble y) (toCWPic p))
74
true
true
0
9
27
75
39
36
null
null
jaalonso/I1M-Cod-Temas
src/Tema_30.hs
gpl-2.0
matrizLongitudSCM2 :: Eq a => [a] -> [a] -> Array (Int,Int) Int matrizLongitudSCM2 xs ys = q where n = length xs m = length ys v = listArray (1,n) xs w = listArray (1,m) ys q = array ((0,0),(n,m)) [((i,j), f i j) | i <- [0..n], j <- [0..m]] where f 0 _ = 0 f _ 0 = 0 f i j | v ! i == w ! j = 1 + q ! (i-1,j-1) | otherwise = max (q ! (i-1,j)) (q ! (i,j-1)) -- Comparación de eficiencia -- ========================= -- La comparación es -- λ> longitudSCM1 (take 18 (cycle [1,3])) (take 18 (cycle [2,3])) -- 9 -- (21.59 secs, 8,868,816,536 bytes) -- λ> longitudSCM2 (take 18 (cycle [1,3])) (take 18 (cycle [2,3])) -- 9 -- (0.01 secs, 0 bytes) -- --------------------------------------------------------------------- -- § Subsecuencia común máxima (SCM) -- -- --------------------------------------------------------------------- -- Definir la función -- scm :: Eq a => [a] -> [a] -> [a] -- tal que (scm xs ys) es una de las subsecuencias comunes de longitud -- máxima de xs e ys. Por ejemplo, -- scm "amapola" "matamoscas" == "amoa" -- scm "atamos" "matamoscas" == "atamos" -- scm "aaa" "bbbb" == "" -- Definición por recursión -- ========================
1,306
matrizLongitudSCM2 :: Eq a => [a] -> [a] -> Array (Int,Int) Int matrizLongitudSCM2 xs ys = q where n = length xs m = length ys v = listArray (1,n) xs w = listArray (1,m) ys q = array ((0,0),(n,m)) [((i,j), f i j) | i <- [0..n], j <- [0..m]] where f 0 _ = 0 f _ 0 = 0 f i j | v ! i == w ! j = 1 + q ! (i-1,j-1) | otherwise = max (q ! (i-1,j)) (q ! (i,j-1)) -- Comparación de eficiencia -- ========================= -- La comparación es -- λ> longitudSCM1 (take 18 (cycle [1,3])) (take 18 (cycle [2,3])) -- 9 -- (21.59 secs, 8,868,816,536 bytes) -- λ> longitudSCM2 (take 18 (cycle [1,3])) (take 18 (cycle [2,3])) -- 9 -- (0.01 secs, 0 bytes) -- --------------------------------------------------------------------- -- § Subsecuencia común máxima (SCM) -- -- --------------------------------------------------------------------- -- Definir la función -- scm :: Eq a => [a] -> [a] -> [a] -- tal que (scm xs ys) es una de las subsecuencias comunes de longitud -- máxima de xs e ys. Por ejemplo, -- scm "amapola" "matamoscas" == "amoa" -- scm "atamos" "matamoscas" == "atamos" -- scm "aaa" "bbbb" == "" -- Definición por recursión -- ========================
1,306
matrizLongitudSCM2 xs ys = q where n = length xs m = length ys v = listArray (1,n) xs w = listArray (1,m) ys q = array ((0,0),(n,m)) [((i,j), f i j) | i <- [0..n], j <- [0..m]] where f 0 _ = 0 f _ 0 = 0 f i j | v ! i == w ! j = 1 + q ! (i-1,j-1) | otherwise = max (q ! (i-1,j)) (q ! (i,j-1)) -- Comparación de eficiencia -- ========================= -- La comparación es -- λ> longitudSCM1 (take 18 (cycle [1,3])) (take 18 (cycle [2,3])) -- 9 -- (21.59 secs, 8,868,816,536 bytes) -- λ> longitudSCM2 (take 18 (cycle [1,3])) (take 18 (cycle [2,3])) -- 9 -- (0.01 secs, 0 bytes) -- --------------------------------------------------------------------- -- § Subsecuencia común máxima (SCM) -- -- --------------------------------------------------------------------- -- Definir la función -- scm :: Eq a => [a] -> [a] -> [a] -- tal que (scm xs ys) es una de las subsecuencias comunes de longitud -- máxima de xs e ys. Por ejemplo, -- scm "amapola" "matamoscas" == "amoa" -- scm "atamos" "matamoscas" == "atamos" -- scm "aaa" "bbbb" == "" -- Definición por recursión -- ========================
1,242
false
true
0
12
360
314
178
136
null
null
fredokun/piexplorer
src/Main.hs
gpl-3.0
helpCommand Quit = ":quit (:q)\n\ \ Tired of pisym?"
61
helpCommand Quit = ":quit (:q)\n\ \ Tired of pisym?"
61
helpCommand Quit = ":quit (:q)\n\ \ Tired of pisym?"
61
false
false
0
5
17
9
4
5
null
null
drhodes/jade2hdl
test/TestIcon.hs
bsd-3-clause
testBoundingBox modname (BB x1 y1 x2 y2) = do testIcon "testBoundingBox" "/user/" modname $ \icon -> do nb $ show icon bb@(BB left top right bottom) <- Icon.boundingBox icon nb $ show bb let f x y s = when (x /= y) $ do nb s expected y x bail f top y1 "top" f left x1 "left" f bottom y2 "bottom" f right x2 "left"
427
testBoundingBox modname (BB x1 y1 x2 y2) = do testIcon "testBoundingBox" "/user/" modname $ \icon -> do nb $ show icon bb@(BB left top right bottom) <- Icon.boundingBox icon nb $ show bb let f x y s = when (x /= y) $ do nb s expected y x bail f top y1 "top" f left x1 "left" f bottom y2 "bottom" f right x2 "left"
427
testBoundingBox modname (BB x1 y1 x2 y2) = do testIcon "testBoundingBox" "/user/" modname $ \icon -> do nb $ show icon bb@(BB left top right bottom) <- Icon.boundingBox icon nb $ show bb let f x y s = when (x /= y) $ do nb s expected y x bail f top y1 "top" f left x1 "left" f bottom y2 "bottom" f right x2 "left"
427
false
false
0
17
180
176
77
99
null
null
arianvp/binary-serialise-cbor
tests/Tests/Negative.hs
bsd-3-clause
didFail (Right _) = False
25
didFail (Right _) = False
25
didFail (Right _) = False
25
false
false
0
6
4
16
7
9
null
null
shlevy/ghc
compiler/deSugar/DsUtils.hs
bsd-3-clause
addBang :: LPat id -- ^ Original pattern -> LPat id -- ^ Banged pattern addBang = go where go lp@(L l p) = case p of ParPat p -> L l (ParPat (go p)) LazyPat lp' -> L l (BangPat lp') BangPat _ -> lp _ -> L l (BangPat lp)
298
addBang :: LPat id -- ^ Original pattern -> LPat id addBang = go where go lp@(L l p) = case p of ParPat p -> L l (ParPat (go p)) LazyPat lp' -> L l (BangPat lp') BangPat _ -> lp _ -> L l (BangPat lp)
278
addBang = go where go lp@(L l p) = case p of ParPat p -> L l (ParPat (go p)) LazyPat lp' -> L l (BangPat lp') BangPat _ -> lp _ -> L l (BangPat lp)
218
true
true
0
12
130
122
58
64
null
null
mcmaniac/ghc
compiler/main/CmdLineParser.hs
bsd-3-clause
-------------------------------------------------------- -- Utils -------------------------------------------------------- errorsToGhcException :: [Located String] -> GhcException errorsToGhcException errs = let errors = vcat [ ppr l <> text ": " <> text e | L l e <- errs ] in UsageError (renderWithStyle errors cmdlineParserStyle)
341
errorsToGhcException :: [Located String] -> GhcException errorsToGhcException errs = let errors = vcat [ ppr l <> text ": " <> text e | L l e <- errs ] in UsageError (renderWithStyle errors cmdlineParserStyle)
217
errorsToGhcException errs = let errors = vcat [ ppr l <> text ": " <> text e | L l e <- errs ] in UsageError (renderWithStyle errors cmdlineParserStyle)
160
true
true
0
13
47
91
42
49
null
null
harry830622/cis194-solutions
07-folds-monoids/JoinList.hs
mit
-- Exercise 1 (+++) :: Monoid m => JoinList m a -> JoinList m a -> JoinList m a (+++) x y = Append (tag x <> tag y) x y
119
(+++) :: Monoid m => JoinList m a -> JoinList m a -> JoinList m a (+++) x y = Append (tag x <> tag y) x y
105
(+++) x y = Append (tag x <> tag y) x y
39
true
true
0
8
30
71
35
36
null
null
xmonad/xmonad-contrib
XMonad/Util/Stack.hs
bsd-3-clause
-- | Monadic version of 'mapZ' mapZM :: Monad m => (Bool -> a -> m b) -> Zipper a -> m (Zipper b) mapZM f as = fromTags <$> (mapM (mapEM f) . toTags) as
152
mapZM :: Monad m => (Bool -> a -> m b) -> Zipper a -> m (Zipper b) mapZM f as = fromTags <$> (mapM (mapEM f) . toTags) as
121
mapZM f as = fromTags <$> (mapM (mapEM f) . toTags) as
54
true
true
0
11
35
85
40
45
null
null
christiaanb/ghc
compiler/basicTypes/OccName.hs
bsd-3-clause
-- In RULES involving Coercible mkNewTyCoOcc = mk_simple_deriv tcName "NTCo:"
86
mkNewTyCoOcc = mk_simple_deriv tcName "NTCo:"
54
mkNewTyCoOcc = mk_simple_deriv tcName "NTCo:"
54
true
false
0
5
18
12
6
6
null
null
hguenther/smtlib2
extras/composite/Language/SMTLib2/Composite/Domains.hs
gpl-3.0
absBounds :: (Num a,Ord a) => Bounds a -> Bounds a absBounds = fmap abs' where abs' (l,u) | l >= 0 = (l,u) | u >= 0 = (0,u) | otherwise = (abs u,abs l)
181
absBounds :: (Num a,Ord a) => Bounds a -> Bounds a absBounds = fmap abs' where abs' (l,u) | l >= 0 = (l,u) | u >= 0 = (0,u) | otherwise = (abs u,abs l)
181
absBounds = fmap abs' where abs' (l,u) | l >= 0 = (l,u) | u >= 0 = (0,u) | otherwise = (abs u,abs l)
130
false
true
0
8
65
123
59
64
null
null
jkramer/database-abstract
Database/Abstract.hs
gpl-3.0
quoteSQL style (Table name) = quoteName style name
50
quoteSQL style (Table name) = quoteName style name
50
quoteSQL style (Table name) = quoteName style name
50
false
false
0
7
7
22
10
12
null
null
antalsz/hs-to-coq
examples/ghc/gen-files/Lexer.hs
mit
unboxedTuplesEnabled :: ExtsBitmap -> Bool unboxedTuplesEnabled = xtest UnboxedTuplesBit
88
unboxedTuplesEnabled :: ExtsBitmap -> Bool unboxedTuplesEnabled = xtest UnboxedTuplesBit
88
unboxedTuplesEnabled = xtest UnboxedTuplesBit
45
false
true
0
5
8
18
9
9
null
null
rueshyna/gogol
gogol-genomics/gen/Network/Google/Resource/Genomics/DataSets/Create.hs
mpl-2.0
-- | Creates a value of 'DataSetsCreate' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'dscXgafv' -- -- * 'dscUploadProtocol' -- -- * 'dscPp' -- -- * 'dscAccessToken' -- -- * 'dscUploadType' -- -- * 'dscPayload' -- -- * 'dscBearerToken' -- -- * 'dscCallback' dataSetsCreate :: DataSet -- ^ 'dscPayload' -> DataSetsCreate dataSetsCreate pDscPayload_ = DataSetsCreate' { _dscXgafv = Nothing , _dscUploadProtocol = Nothing , _dscPp = True , _dscAccessToken = Nothing , _dscUploadType = Nothing , _dscPayload = pDscPayload_ , _dscBearerToken = Nothing , _dscCallback = Nothing }
709
dataSetsCreate :: DataSet -- ^ 'dscPayload' -> DataSetsCreate dataSetsCreate pDscPayload_ = DataSetsCreate' { _dscXgafv = Nothing , _dscUploadProtocol = Nothing , _dscPp = True , _dscAccessToken = Nothing , _dscUploadType = Nothing , _dscPayload = pDscPayload_ , _dscBearerToken = Nothing , _dscCallback = Nothing }
363
dataSetsCreate pDscPayload_ = DataSetsCreate' { _dscXgafv = Nothing , _dscUploadProtocol = Nothing , _dscPp = True , _dscAccessToken = Nothing , _dscUploadType = Nothing , _dscPayload = pDscPayload_ , _dscBearerToken = Nothing , _dscCallback = Nothing }
293
true
true
0
6
154
88
62
26
null
null
guillaume-nargeot/project-euler-haskell
src/ProjectEuler/Problem002.hs
bsd-3-clause
solution002 :: Integer solution002 = genericSolution 4e6
56
solution002 :: Integer solution002 = genericSolution 4e6
56
solution002 = genericSolution 4e6
33
false
true
0
5
6
14
7
7
null
null
edwardwas/turnBasedGame
src/Control.hs
mit
makeNewCity :: MCoord -> City -> World -> World makeNewCity coord c w | isNothing (preview (tiles . at coord . traverse . city . traverse) w) = set (tiles . at coord . traverse . city . traverse) c w | otherwise = w
231
makeNewCity :: MCoord -> City -> World -> World makeNewCity coord c w | isNothing (preview (tiles . at coord . traverse . city . traverse) w) = set (tiles . at coord . traverse . city . traverse) c w | otherwise = w
231
makeNewCity coord c w | isNothing (preview (tiles . at coord . traverse . city . traverse) w) = set (tiles . at coord . traverse . city . traverse) c w | otherwise = w
183
false
true
1
16
60
106
51
55
null
null
YLiLarry/db-model
src/DB/Model/Internal/New.hs
mit
inTable :: Table -> (String, Relation A.Value) -> Bool inTable t (f, (IsCol t1 _)) = t == t1
92
inTable :: Table -> (String, Relation A.Value) -> Bool inTable t (f, (IsCol t1 _)) = t == t1
92
inTable t (f, (IsCol t1 _)) = t == t1
37
false
true
0
9
18
53
28
25
null
null
ygale/yesod
yesod-auth/Yesod/Auth.hs
mit
authLayoutJson :: (YesodAuth site, ToJSON j) => WidgetT site IO () -- ^ HTML -> HandlerT site IO j -- ^ JSON -> HandlerT site IO TypedContent authLayoutJson w json = selectRep $ do provideRep $ authLayout w provideRep $ fmap toJSON json -- | Clears current user credentials for the session. -- -- Since 1.1.7
373
authLayoutJson :: (YesodAuth site, ToJSON j) => WidgetT site IO () -- ^ HTML -> HandlerT site IO j -- ^ JSON -> HandlerT site IO TypedContent authLayoutJson w json = selectRep $ do provideRep $ authLayout w provideRep $ fmap toJSON json -- | Clears current user credentials for the session. -- -- Since 1.1.7
373
authLayoutJson w json = selectRep $ do provideRep $ authLayout w provideRep $ fmap toJSON json -- | Clears current user credentials for the session. -- -- Since 1.1.7
175
false
true
0
9
120
93
46
47
null
null
bartavelle/manglingrules
Mangling.hs
gpl-3.0
showCC (CharacterClass MatchDigit x) = mu 'd' x
54
showCC (CharacterClass MatchDigit x) = mu 'd' x
54
showCC (CharacterClass MatchDigit x) = mu 'd' x
54
false
false
0
6
14
23
10
13
null
null
opentower/carnap
Carnap/src/Carnap/Calculi/NaturalDeduction/Syntax.hs
gpl-3.0
discharged (DependentAssertLine _ _ _ (Just d) _ _) = d
55
discharged (DependentAssertLine _ _ _ (Just d) _ _) = d
55
discharged (DependentAssertLine _ _ _ (Just d) _ _) = d
55
false
false
0
8
10
32
15
17
null
null
tim6her/halculator
Main.hs
mit
pars (x:stack) "acos" = Just $ acos x : stack
45
pars (x:stack) "acos" = Just $ acos x : stack
45
pars (x:stack) "acos" = Just $ acos x : stack
45
false
false
1
7
9
34
14
20
null
null
codemac/yi-editor
src/Yi/Buffer/Undo.hs
gpl-2.0
-- | Add a saved file point so that we can tell that the buffer has not -- been modified since the previous saved file point. -- Notice that we must be sure to remove the previous saved file points -- since they are now worthless. setSavedFilePointU :: URList -> URList setSavedFilePointU (URList undos redos) = URList (SavedFilePoint : cleanUndos) cleanRedos where cleanUndos = filter isNotSavedFilePoint undos cleanRedos = filter isNotSavedFilePoint redos isNotSavedFilePoint :: Change -> Bool isNotSavedFilePoint SavedFilePoint = False isNotSavedFilePoint _ = True -- | This undoes one interaction step.
634
setSavedFilePointU :: URList -> URList setSavedFilePointU (URList undos redos) = URList (SavedFilePoint : cleanUndos) cleanRedos where cleanUndos = filter isNotSavedFilePoint undos cleanRedos = filter isNotSavedFilePoint redos isNotSavedFilePoint :: Change -> Bool isNotSavedFilePoint SavedFilePoint = False isNotSavedFilePoint _ = True -- | This undoes one interaction step.
403
setSavedFilePointU (URList undos redos) = URList (SavedFilePoint : cleanUndos) cleanRedos where cleanUndos = filter isNotSavedFilePoint undos cleanRedos = filter isNotSavedFilePoint redos isNotSavedFilePoint :: Change -> Bool isNotSavedFilePoint SavedFilePoint = False isNotSavedFilePoint _ = True -- | This undoes one interaction step.
364
true
true
0
7
119
91
48
43
null
null
RobertFischer/real-world-haskell
ch03/Ex.hs
unlicense
intersperse _ [only_list:[]] = only_list:[]
43
intersperse _ [only_list:[]] = only_list:[]
43
intersperse _ [only_list:[]] = only_list:[]
43
false
false
0
8
4
26
13
13
null
null
anton-dessiatov/stack
src/Stack/PackageLocation.hs
bsd-3-clause
resolveMultiPackageLocation y (PLArchive (Archive url subdirs msha)) = do dir <- resolveSinglePackageLocation y (PLArchive (Archive url "." msha)) let subdirs' = case subdirs of DefaultSubdirs -> ["."] ExplicitSubdirs subs -> subs forM subdirs' $ \subdir -> do dir' <- resolveDir dir subdir return (dir', PLArchive (Archive url subdir msha))
383
resolveMultiPackageLocation y (PLArchive (Archive url subdirs msha)) = do dir <- resolveSinglePackageLocation y (PLArchive (Archive url "." msha)) let subdirs' = case subdirs of DefaultSubdirs -> ["."] ExplicitSubdirs subs -> subs forM subdirs' $ \subdir -> do dir' <- resolveDir dir subdir return (dir', PLArchive (Archive url subdir msha))
383
resolveMultiPackageLocation y (PLArchive (Archive url subdirs msha)) = do dir <- resolveSinglePackageLocation y (PLArchive (Archive url "." msha)) let subdirs' = case subdirs of DefaultSubdirs -> ["."] ExplicitSubdirs subs -> subs forM subdirs' $ \subdir -> do dir' <- resolveDir dir subdir return (dir', PLArchive (Archive url subdir msha))
383
false
false
0
15
90
138
65
73
null
null
athanclark/sets
src/Data/Set/Ordered/Unique/With.hs
mit
maxView :: SetWith k a -> Maybe (a, SetWith k a) maxView (SetWith (f,xs)) = (\(l,a) -> (l, SetWith (f,a))) <$> Map.maxView xs
125
maxView :: SetWith k a -> Maybe (a, SetWith k a) maxView (SetWith (f,xs)) = (\(l,a) -> (l, SetWith (f,a))) <$> Map.maxView xs
125
maxView (SetWith (f,xs)) = (\(l,a) -> (l, SetWith (f,a))) <$> Map.maxView xs
76
false
true
0
10
22
91
48
43
null
null
TorosFanny/kaleidoscope
src/chapter5/Emit.hs
mit
cgen (S.For ivar start cond step body) = do forloop <- addBlock "for.loop" forexit <- addBlock "for.exit" -- %entry ------------------ i <- alloca double istart <- cgen start -- Generate loop variable initial value stepval <- cgen step -- Generate loop variable step store i istart -- Store the loop variable initial value assign ivar i -- Assign loop variable to the variable name br forloop -- Branch to the loop body block -- for.loop ------------------ setBlock forloop cgen body -- Generate the loop body ival <- load i -- Load the current loop iteration inext <- fadd ival stepval -- Increment loop variable store i inext cond <- cgen cond -- Generate the loop condition test <- fcmp FP.ONE false cond -- Test if the loop condition is True ( 1.0 ) cbr test forloop forexit -- Generate the loop condition -- for.exit ------------------ setBlock forexit return zero ------------------------------------------------------------------------------- -- Compilation -------------------------------------------------------------------------------
1,231
cgen (S.For ivar start cond step body) = do forloop <- addBlock "for.loop" forexit <- addBlock "for.exit" -- %entry ------------------ i <- alloca double istart <- cgen start -- Generate loop variable initial value stepval <- cgen step -- Generate loop variable step store i istart -- Store the loop variable initial value assign ivar i -- Assign loop variable to the variable name br forloop -- Branch to the loop body block -- for.loop ------------------ setBlock forloop cgen body -- Generate the loop body ival <- load i -- Load the current loop iteration inext <- fadd ival stepval -- Increment loop variable store i inext cond <- cgen cond -- Generate the loop condition test <- fcmp FP.ONE false cond -- Test if the loop condition is True ( 1.0 ) cbr test forloop forexit -- Generate the loop condition -- for.exit ------------------ setBlock forexit return zero ------------------------------------------------------------------------------- -- Compilation -------------------------------------------------------------------------------
1,231
cgen (S.For ivar start cond step body) = do forloop <- addBlock "for.loop" forexit <- addBlock "for.exit" -- %entry ------------------ i <- alloca double istart <- cgen start -- Generate loop variable initial value stepval <- cgen step -- Generate loop variable step store i istart -- Store the loop variable initial value assign ivar i -- Assign loop variable to the variable name br forloop -- Branch to the loop body block -- for.loop ------------------ setBlock forloop cgen body -- Generate the loop body ival <- load i -- Load the current loop iteration inext <- fadd ival stepval -- Increment loop variable store i inext cond <- cgen cond -- Generate the loop condition test <- fcmp FP.ONE false cond -- Test if the loop condition is True ( 1.0 ) cbr test forloop forexit -- Generate the loop condition -- for.exit ------------------ setBlock forexit return zero ------------------------------------------------------------------------------- -- Compilation -------------------------------------------------------------------------------
1,231
false
false
0
9
339
207
95
112
null
null
GaloisInc/pads-haskell
Language/Pads/BaseTypes.hs
bsd-3-clause
int2HexStr :: Int -> (Int, Base_md) -> (StringFW, Base_md) int2HexStr size (x,md) | length result == size && wasPos = (result, md) | not wasPos = (Prelude.take size result, mkErrBasePD (TransformToSrcFail "StrHex" (show x) (" (Expected positive number)")) Nothing) | otherwise = (Prelude.take size result, mkErrBasePD (TransformToSrcFail "StrHex" (show x) (" (too big to fit in "++ (show size) ++" characters)")) Nothing) where cvt rest a = if rest < 16 then {- reverse $ -} (C.intToDigit rest) : a else cvt (rest `div` 16) (C.intToDigit (rest `mod` 16) : a) (wasPos,x') = if x < 0 then (False, -x) else (True, x) temp = cvt x' [] padding = size - (length temp) stutter c n = if n <= 0 then [] else c : (stutter c (n-1)) result = (stutter '0' padding) ++ temp
849
int2HexStr :: Int -> (Int, Base_md) -> (StringFW, Base_md) int2HexStr size (x,md) | length result == size && wasPos = (result, md) | not wasPos = (Prelude.take size result, mkErrBasePD (TransformToSrcFail "StrHex" (show x) (" (Expected positive number)")) Nothing) | otherwise = (Prelude.take size result, mkErrBasePD (TransformToSrcFail "StrHex" (show x) (" (too big to fit in "++ (show size) ++" characters)")) Nothing) where cvt rest a = if rest < 16 then {- reverse $ -} (C.intToDigit rest) : a else cvt (rest `div` 16) (C.intToDigit (rest `mod` 16) : a) (wasPos,x') = if x < 0 then (False, -x) else (True, x) temp = cvt x' [] padding = size - (length temp) stutter c n = if n <= 0 then [] else c : (stutter c (n-1)) result = (stutter '0' padding) ++ temp
849
int2HexStr size (x,md) | length result == size && wasPos = (result, md) | not wasPos = (Prelude.take size result, mkErrBasePD (TransformToSrcFail "StrHex" (show x) (" (Expected positive number)")) Nothing) | otherwise = (Prelude.take size result, mkErrBasePD (TransformToSrcFail "StrHex" (show x) (" (too big to fit in "++ (show size) ++" characters)")) Nothing) where cvt rest a = if rest < 16 then {- reverse $ -} (C.intToDigit rest) : a else cvt (rest `div` 16) (C.intToDigit (rest `mod` 16) : a) (wasPos,x') = if x < 0 then (False, -x) else (True, x) temp = cvt x' [] padding = size - (length temp) stutter c n = if n <= 0 then [] else c : (stutter c (n-1)) result = (stutter '0' padding) ++ temp
790
false
true
7
17
226
372
198
174
null
null
FranklinChen/hugs98-plus-Sep2006
packages/base/Data/IntMap.hs
bsd-3-clause
-- ++ show (p,m) showWide wide bars | wide = showString (concat (reverse bars)) . showString "|\n" | otherwise = id
127
showWide wide bars | wide = showString (concat (reverse bars)) . showString "|\n" | otherwise = id
109
showWide wide bars | wide = showString (concat (reverse bars)) . showString "|\n" | otherwise = id
109
true
false
1
11
32
48
22
26
null
null
fhaust/aer-utils
test/LearnGaborTests.hs
mit
matEq' ε a b = zipWithM_ (assertApproxEqual "" ε) (toList a) (toList b)
71
matEq' ε a b = zipWithM_ (assertApproxEqual "" ε) (toList a) (toList b)
71
matEq' ε a b = zipWithM_ (assertApproxEqual "" ε) (toList a) (toList b)
71
false
false
0
7
12
40
19
21
null
null
silkapp/xmlhtml
src/Text/XmlHtml/XML/Render.hs
bsd-3-clause
firstNode e (Element t a c) = node e (Element t a c)
52
firstNode e (Element t a c) = node e (Element t a c)
52
firstNode e (Element t a c) = node e (Element t a c)
52
false
false
0
7
12
38
17
21
null
null
kojiromike/Idris-dev
src/Idris/Elab/Quasiquote.hs
bsd-3-clause
extractUnquotes n (PDisamb ns tm) = do (tm', ex) <- extractUnquotes n tm return (PDisamb ns tm', ex)
109
extractUnquotes n (PDisamb ns tm) = do (tm', ex) <- extractUnquotes n tm return (PDisamb ns tm', ex)
109
extractUnquotes n (PDisamb ns tm) = do (tm', ex) <- extractUnquotes n tm return (PDisamb ns tm', ex)
109
false
false
0
9
26
54
26
28
null
null
lymar/hastache
Text/Hastache.hs
bsd-3-clause
hastacheStr :: (MonadIO m) => MuConfig m -- ^ Configuration -> Text -- ^ Template -> MuContext m -- ^ Context -> m TL.Text hastacheStr conf str context = hastacheStrBuilder conf str context >>= return . TLB.toLazyText
265
hastacheStr :: (MonadIO m) => MuConfig m -- ^ Configuration -> Text -- ^ Template -> MuContext m -- ^ Context -> m TL.Text hastacheStr conf str context = hastacheStrBuilder conf str context >>= return . TLB.toLazyText
265
hastacheStr conf str context = hastacheStrBuilder conf str context >>= return . TLB.toLazyText
99
false
true
0
11
84
71
35
36
null
null
flofehrenbacher/music-project
EasyNotes/Songs/HaenschenKlein.hs
gpl-3.0
-- | Single part of /Haenschen Klein/'s melody h1,h2,h3,h4,h5 :: Music Pitch h1 = a 4 en :+: fs 4 en :+: fs 4 qn :+: g 4 en :+: e 4 en :+: e 4 qn
145
h1,h2,h3,h4,h5 :: Music Pitch h1 = a 4 en :+: fs 4 en :+: fs 4 qn :+: g 4 en :+: e 4 en :+: e 4 qn
98
h1 = a 4 en :+: fs 4 en :+: fs 4 qn :+: g 4 en :+: e 4 en :+: e 4 qn
68
true
true
5
10
36
84
38
46
null
null
sopvop/cabal
Cabal/Distribution/Types/BuildInfo.hs
bsd-3-clause
emptyBuildInfo :: BuildInfo emptyBuildInfo = mempty
51
emptyBuildInfo :: BuildInfo emptyBuildInfo = mempty
51
emptyBuildInfo = mempty
23
false
true
0
6
5
18
7
11
null
null
phunehehe/deepseq-bounded
tests/Util.hs
bsd-3-clause
poor' :: Show a => String -> a -> a spoor' string expr = unsafePerformIO $ do trayceIO $ string ++ show expr return expr {
135
spoor' :: Show a => String -> a -> a spoor' string expr = unsafePerformIO $ do trayceIO $ string ++ show expr return expr
133
spoor' string expr = unsafePerformIO $ do trayceIO $ string ++ show expr return expr
96
false
true
1
10
38
62
27
35
null
null
tanakh/serialize-bench
bench.hs
bsd-3-clause
decodeBlazeStrict :: S.ByteString -> MapType decodeBlazeStrict bs = ret where
77
decodeBlazeStrict :: S.ByteString -> MapType decodeBlazeStrict bs = ret where
77
decodeBlazeStrict bs = ret where
32
false
true
0
7
9
29
12
17
null
null
vincenthz/hs-simple-readline
System/Console/SimpleReadline/Zipper.hs
bsd-3-clause
zipDelNext :: Int -> Zipper a -> Zipper a zipDelNext nb z@(Zipper plen p nlen n) | nb >= nlen = zipDelToEnd z | otherwise = Zipper plen p (nlen - nb) (drop nb n)
170
zipDelNext :: Int -> Zipper a -> Zipper a zipDelNext nb z@(Zipper plen p nlen n) | nb >= nlen = zipDelToEnd z | otherwise = Zipper plen p (nlen - nb) (drop nb n)
170
zipDelNext nb z@(Zipper plen p nlen n) | nb >= nlen = zipDelToEnd z | otherwise = Zipper plen p (nlen - nb) (drop nb n)
128
false
true
1
8
43
89
43
46
null
null
adamschoenemann/asa-analysis
test/Anal/LivenessSpec.hs
bsd-3-clause
testDeadCodeTrans (n, prog) = it ("works for " ++ n) $ do pprintAnalysis livenessAnal prog True `shouldBe` True -- let eliminated = deadCodeTrans prog -- let eliminated' = cfgToProgram . deadCodeElim . progToCfg $ prog -- putStrLn $ "----------------- " ++ n ++ " ----------------" -- putStrLn "--- before ---" -- putPrettyLn prog -- putStrLn "\n--- after ---" -- putPrettyLn eliminated -- eliminated `shouldBe` eliminated'
465
testDeadCodeTrans (n, prog) = it ("works for " ++ n) $ do pprintAnalysis livenessAnal prog True `shouldBe` True -- let eliminated = deadCodeTrans prog -- let eliminated' = cfgToProgram . deadCodeElim . progToCfg $ prog -- putStrLn $ "----------------- " ++ n ++ " ----------------" -- putStrLn "--- before ---" -- putPrettyLn prog -- putStrLn "\n--- after ---" -- putPrettyLn eliminated -- eliminated `shouldBe` eliminated'
465
testDeadCodeTrans (n, prog) = it ("works for " ++ n) $ do pprintAnalysis livenessAnal prog True `shouldBe` True -- let eliminated = deadCodeTrans prog -- let eliminated' = cfgToProgram . deadCodeElim . progToCfg $ prog -- putStrLn $ "----------------- " ++ n ++ " ----------------" -- putStrLn "--- before ---" -- putPrettyLn prog -- putStrLn "\n--- after ---" -- putPrettyLn eliminated -- eliminated `shouldBe` eliminated'
465
false
false
0
8
106
54
31
23
null
null
rahulmutt/ghcvm
compiler/Eta/CodeGen/Expr.hs
bsd-3-clause
cgIdApp :: Id -> [StgArg] -> CodeGen () cgIdApp funId [] | isVoidTy (idType funId) = emitReturn []
98
cgIdApp :: Id -> [StgArg] -> CodeGen () cgIdApp funId [] | isVoidTy (idType funId) = emitReturn []
98
cgIdApp funId [] | isVoidTy (idType funId) = emitReturn []
58
false
true
0
10
17
54
25
29
null
null
nomeata/ghc
compiler/cmm/CmmSink.hs
bsd-3-clause
-- -- discard dead assignments. This doesn't do as good a job as -- removeDeadAsssignments, because it would need multiple passes -- to get all the dead code, but it catches the common case of -- superfluous reloads from the stack that the stack allocator -- leaves behind. -- -- Also we catch "r = r" here. You might think it would fall -- out of inlining, but the inliner will see that r is live -- after the instruction and choose not to inline r in the rhs. -- shouldDiscard :: CmmNode e x -> RegSet -> Bool shouldDiscard node live = case node of CmmAssign r (CmmReg r') | r == r' -> True CmmAssign (CmmLocal r) _ -> not (r `Set.member` live) _otherwise -> False
692
shouldDiscard :: CmmNode e x -> RegSet -> Bool shouldDiscard node live = case node of CmmAssign r (CmmReg r') | r == r' -> True CmmAssign (CmmLocal r) _ -> not (r `Set.member` live) _otherwise -> False
225
shouldDiscard node live = case node of CmmAssign r (CmmReg r') | r == r' -> True CmmAssign (CmmLocal r) _ -> not (r `Set.member` live) _otherwise -> False
178
true
true
0
11
153
114
59
55
null
null
zhangjiji/real-world-haskell
ch17/Regex-hsc-const.hs
mit
dollar_endonly :: PCREOption dollar_endonly = PCREOption #const PCRE_DOLLAR_ENDONLY
83
dollar_endonly :: PCREOption dollar_endonly = PCREOption #const PCRE_DOLLAR_ENDONLY
83
dollar_endonly = PCREOption #const PCRE_DOLLAR_ENDONLY
54
false
true
0
5
7
16
8
8
null
null
danr/hipspec
testsuite/prod/zeno_version/PropT48.hs
gpl-3.0
qrev :: [a] -> [a] -> [a] qrev [] acc = acc
47
qrev :: [a] -> [a] -> [a] qrev [] acc = acc
47
qrev [] acc = acc
21
false
true
0
9
15
41
20
21
null
null
ndreynolds/hsURL
commandline/Main.hs
mit
header = "Usage: hsurl [OPTIONS...] <url>"
42
header = "Usage: hsurl [OPTIONS...] <url>"
42
header = "Usage: hsurl [OPTIONS...] <url>"
42
false
false
1
5
5
10
3
7
null
null
bitemyapp/ghc
compiler/basicTypes/OccName.hs
bsd-3-clause
isDataConNameSpace _ = False
35
isDataConNameSpace _ = False
35
isDataConNameSpace _ = False
35
false
false
0
5
10
9
4
5
null
null