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
plumlife/cabal
Cabal/Distribution/Simple/LocalBuildInfo.hs
bsd-3-clause
foldComponent _ f _ _ (CExe exe) = f exe
42
foldComponent _ f _ _ (CExe exe) = f exe
42
foldComponent _ f _ _ (CExe exe) = f exe
42
false
false
2
6
11
29
11
18
null
null
eigengo/hwsexp
core/main/Custom/Codegen.hs
apache-2.0
emptyCodegen :: CodegenState emptyCodegen = CodegenState (Name entryBlockName) Map.empty [] 1 0 Map.empty
105
emptyCodegen :: CodegenState emptyCodegen = CodegenState (Name entryBlockName) Map.empty [] 1 0 Map.empty
105
emptyCodegen = CodegenState (Name entryBlockName) Map.empty [] 1 0 Map.empty
76
false
true
0
7
12
42
19
23
null
null
nickbart1980/pandoc
src/Text/Pandoc/Writers/AsciiDoc.hs
gpl-2.0
blockToAsciiDoc opts (Div _ bs) = blockListToAsciiDoc opts bs
61
blockToAsciiDoc opts (Div _ bs) = blockListToAsciiDoc opts bs
61
blockToAsciiDoc opts (Div _ bs) = blockListToAsciiDoc opts bs
61
false
false
0
7
8
24
11
13
null
null
rohitjha/MPL
src/Set.hs
bsd-2-clause
{-| The 'difference' function performs the set difference operation on the two sets passed as arguments. For example: >>> difference (Set [1,2,3]) (Set [2..5]) {1} >>> difference (Set "irjfg") (Set "kdsvbuf") {'g','i','j','r'} >>> difference (Set [1..10]) (Set [0,(-1)..(-10)]) {1,2,3,4,5,6,7,8,9,10} >>> difference (Set ["s","d","l","i","r","e","v"]) (Set ["a","e", "i", "o", "u"]) {"d","l","r","s","v"} -} difference :: Ord a => Set a -> Set a -> Set a difference (Set set1) (Set set2) = Set ((L.sort . L.nub) [e | e <- set1, e `notElem` set2])
595
difference :: Ord a => Set a -> Set a -> Set a difference (Set set1) (Set set2) = Set ((L.sort . L.nub) [e | e <- set1, e `notElem` set2])
142
difference (Set set1) (Set set2) = Set ((L.sort . L.nub) [e | e <- set1, e `notElem` set2])
95
true
true
0
10
129
94
47
47
null
null
vladimir-ipatov/ganeti
src/Ganeti/HTools/Instance.hs
gpl-2.0
setBoth :: Instance -- ^ the original instance -> T.Ndx -- ^ new primary node index -> T.Ndx -- ^ new secondary node index -> Instance -- ^ the modified instance setBoth t p s = t { pNode = p, sNode = s }
238
setBoth :: Instance -- ^ the original instance -> T.Ndx -- ^ new primary node index -> T.Ndx -- ^ new secondary node index -> Instance setBoth t p s = t { pNode = p, sNode = s }
211
setBoth t p s = t { pNode = p, sNode = s }
42
true
true
0
9
78
61
32
29
null
null
jlamothe/ru-deposit
ru-deposit.hs
gpl-3.0
restart :: State -> IO () restart state = do again <- yesNo "Process another transaction?" if again then processTxn state else finalize state
154
restart :: State -> IO () restart state = do again <- yesNo "Process another transaction?" if again then processTxn state else finalize state
154
restart state = do again <- yesNo "Process another transaction?" if again then processTxn state else finalize state
128
false
true
0
8
36
50
23
27
null
null
urbanslug/ghc
libraries/base/GHC/Natural.hs
bsd-3-clause
-- | Convert 'Int' to 'Natural'. -- Throws 'Underflow' when passed a negative 'Int'. intToNatural :: Int -> Natural intToNatural i | i<0 = throw Underflow
154
intToNatural :: Int -> Natural intToNatural i | i<0 = throw Underflow
69
intToNatural i | i<0 = throw Underflow
38
true
true
0
8
25
33
16
17
null
null
tibbe/ghc
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
emitPrimOp dflags res (VecReadScalarByteArrayOp vcat n w) args = do checkVecCompatibility dflags vcat n w doIndexByteArrayOpAs Nothing vecty ty res args where vecty :: CmmType vecty = vecVmmType vcat n w ty :: CmmType ty = vecCmmCat vcat w
266
emitPrimOp dflags res (VecReadScalarByteArrayOp vcat n w) args = do checkVecCompatibility dflags vcat n w doIndexByteArrayOpAs Nothing vecty ty res args where vecty :: CmmType vecty = vecVmmType vcat n w ty :: CmmType ty = vecCmmCat vcat w
266
emitPrimOp dflags res (VecReadScalarByteArrayOp vcat n w) args = do checkVecCompatibility dflags vcat n w doIndexByteArrayOpAs Nothing vecty ty res args where vecty :: CmmType vecty = vecVmmType vcat n w ty :: CmmType ty = vecCmmCat vcat w
266
false
false
0
7
65
86
41
45
null
null
jacekszymanski/wxHaskell
wx/src/Graphics/UI/WX/Controls.hs
lgpl-2.1
singleListBoxViewGetSelection :: ListBoxView (CSingleListBox ()) a -> IO (Maybe a) singleListBoxViewGetSelection view = do sel <- get (listBoxViewCtrl view) selection its <- get (listBoxViewItems view) value return $ if sel == -1 then Nothing else Just (its !! sel)
272
singleListBoxViewGetSelection :: ListBoxView (CSingleListBox ()) a -> IO (Maybe a) singleListBoxViewGetSelection view = do sel <- get (listBoxViewCtrl view) selection its <- get (listBoxViewItems view) value return $ if sel == -1 then Nothing else Just (its !! sel)
272
singleListBoxViewGetSelection view = do sel <- get (listBoxViewCtrl view) selection its <- get (listBoxViewItems view) value return $ if sel == -1 then Nothing else Just (its !! sel)
189
false
true
0
11
45
107
51
56
null
null
distillation/language-core
Language/Core/Parser.hs
gpl-3.0
parseLit (LHE.String s) = Con "StringTransformer" [parseLitString s]
68
parseLit (LHE.String s) = Con "StringTransformer" [parseLitString s]
68
parseLit (LHE.String s) = Con "StringTransformer" [parseLitString s]
68
false
false
0
7
7
29
13
16
null
null
kaoskorobase/mescaline
lib/mescaline-patterns/src/Mescaline/Pattern/AST/Library.hs
gpl-3.0
-- | Multiply a field value by a scalar. multiply :: Field -> Pattern Scalar -> Pattern Event -> Pattern Event multiply = fzip F_multiply
137
multiply :: Field -> Pattern Scalar -> Pattern Event -> Pattern Event multiply = fzip F_multiply
96
multiply = fzip F_multiply
26
true
true
0
9
24
42
18
24
null
null
shlevy/ghc
compiler/prelude/THNames.hs
bsd-3-clause
fromToEName = libFun (fsLit "fromToE") fromToEIdKey
59
fromToEName = libFun (fsLit "fromToE") fromToEIdKey
59
fromToEName = libFun (fsLit "fromToE") fromToEIdKey
59
false
false
0
7
13
17
8
9
null
null
sgillespie/ghc
compiler/utils/Outputable.hs
bsd-3-clause
rparen = docToSDoc $ Pretty.rparen
38
rparen = docToSDoc $ Pretty.rparen
38
rparen = docToSDoc $ Pretty.rparen
38
false
false
0
6
8
12
6
6
null
null
bmabsout/neural-swarm
src/SizedV.hs
bsd-3-clause
fromSized :: S n a -> V.Vector a fromSized (Sized v) = v
56
fromSized :: S n a -> V.Vector a fromSized (Sized v) = v
56
fromSized (Sized v) = v
23
false
true
0
7
12
34
16
18
null
null
gchrupala/morfette
src/GramLab/Morfette/Utils.hs
bsd-2-clause
getDict :: [Flag] -> Maybe (Set.Set String) -> IO Lexicon getDict flags tokSet = do case [f | DictFile f <- flags ] of [f] -> fmap (parseLexicon tokSet) $ readFile f [] -> return emptyLexicon
202
getDict :: [Flag] -> Maybe (Set.Set String) -> IO Lexicon getDict flags tokSet = do case [f | DictFile f <- flags ] of [f] -> fmap (parseLexicon tokSet) $ readFile f [] -> return emptyLexicon
202
getDict flags tokSet = do case [f | DictFile f <- flags ] of [f] -> fmap (parseLexicon tokSet) $ readFile f [] -> return emptyLexicon
144
false
true
0
13
46
98
47
51
null
null
Tosainu/blog
src/Compiler.hs
mit
renderFontAwesome :: FontAwesomeIcons -> Item String -> Compiler (Item String) renderFontAwesome icons = return . fmap (TST.renderTreeOptions tagSoupOption . TST.transformTree renderFontAwesome' . TST.parseTree) where renderFontAwesome' tag@(TST.TagBranch "i" as []) = case toFontAwesome $ classes as of Just tree -> [tree] Nothing -> [tag] renderFontAwesome' tag = [tag] toFontAwesome (prefix:('f':'a':'-':name):cs) = fmap (`appendClasses` cs) (fontawesome icons prefix name) toFontAwesome _ = Nothing appendClasses t [] = t appendClasses (TST.TagBranch x y z) cs = let as1 = HM.fromList y as2 = HM.singleton "class" $ unwords cs y' = HM.toList $ HM.unionWith (\v1 v2 -> v1 ++ " " ++ v2) as1 as2 in TST.TagBranch x y' z appendClasses t _ = t classes = words . fromMaybe "" . lookup "class"
901
renderFontAwesome :: FontAwesomeIcons -> Item String -> Compiler (Item String) renderFontAwesome icons = return . fmap (TST.renderTreeOptions tagSoupOption . TST.transformTree renderFontAwesome' . TST.parseTree) where renderFontAwesome' tag@(TST.TagBranch "i" as []) = case toFontAwesome $ classes as of Just tree -> [tree] Nothing -> [tag] renderFontAwesome' tag = [tag] toFontAwesome (prefix:('f':'a':'-':name):cs) = fmap (`appendClasses` cs) (fontawesome icons prefix name) toFontAwesome _ = Nothing appendClasses t [] = t appendClasses (TST.TagBranch x y z) cs = let as1 = HM.fromList y as2 = HM.singleton "class" $ unwords cs y' = HM.toList $ HM.unionWith (\v1 v2 -> v1 ++ " " ++ v2) as1 as2 in TST.TagBranch x y' z appendClasses t _ = t classes = words . fromMaybe "" . lookup "class"
901
renderFontAwesome icons = return . fmap (TST.renderTreeOptions tagSoupOption . TST.transformTree renderFontAwesome' . TST.parseTree) where renderFontAwesome' tag@(TST.TagBranch "i" as []) = case toFontAwesome $ classes as of Just tree -> [tree] Nothing -> [tag] renderFontAwesome' tag = [tag] toFontAwesome (prefix:('f':'a':'-':name):cs) = fmap (`appendClasses` cs) (fontawesome icons prefix name) toFontAwesome _ = Nothing appendClasses t [] = t appendClasses (TST.TagBranch x y z) cs = let as1 = HM.fromList y as2 = HM.singleton "class" $ unwords cs y' = HM.toList $ HM.unionWith (\v1 v2 -> v1 ++ " " ++ v2) as1 as2 in TST.TagBranch x y' z appendClasses t _ = t classes = words . fromMaybe "" . lookup "class"
822
false
true
7
15
230
337
168
169
null
null
diagrams/diagrams-test
misc/Text.hs
bsd-3-clause
attributes :: Diagram B attributes = center $ text' 10 "Hello" # italic === text' 5 "there" # bold # font "freeserif" === text' 3 "world" # fc green where text' s t = text t # fontSizeL s <> strutY (s * 1.3)
237
attributes :: Diagram B attributes = center $ text' 10 "Hello" # italic === text' 5 "there" # bold # font "freeserif" === text' 3 "world" # fc green where text' s t = text t # fontSizeL s <> strutY (s * 1.3)
237
attributes = center $ text' 10 "Hello" # italic === text' 5 "there" # bold # font "freeserif" === text' 3 "world" # fc green where text' s t = text t # fontSizeL s <> strutY (s * 1.3)
213
false
true
0
12
73
99
46
53
null
null
elliottt/llvm-threading
Test.hs
bsd-3-clause
-- -------------------------------------------------------------------------- -- -- Test builder for simple "gold" tests; tests where the output is fixed -- and well-known. -- -- -------------------------------------------------------------------------- buildGoldTest :: String -> IO Test buildGoldTest base = do goodOutput <- readFile inputFile return $ testProgramOutput base executable [] (checkEq goodOutput) Nothing where executable = "tests/" ++ base ++ ".elf" inputFile = "tests/" ++ base ++ ".gold" checkEq x = Just (\ y -> x == y)
556
buildGoldTest :: String -> IO Test buildGoldTest base = do goodOutput <- readFile inputFile return $ testProgramOutput base executable [] (checkEq goodOutput) Nothing where executable = "tests/" ++ base ++ ".elf" inputFile = "tests/" ++ base ++ ".gold" checkEq x = Just (\ y -> x == y)
301
buildGoldTest base = do goodOutput <- readFile inputFile return $ testProgramOutput base executable [] (checkEq goodOutput) Nothing where executable = "tests/" ++ base ++ ".elf" inputFile = "tests/" ++ base ++ ".gold" checkEq x = Just (\ y -> x == y)
266
true
true
3
10
86
129
60
69
null
null
SAdams601/HaRe
old/testing/refacFunDef/Test15_AstOut.hs
bsd-3-clause
g = 13 * (f (13 - 1))
21
g = 13 * (f (13 - 1))
21
g = 13 * (f (13 - 1))
21
false
false
2
9
7
28
12
16
null
null
ctlab/gShell
src/Main.hs
mit
parseEnter :: Parser Command parseEnter = Enter <$> argument str (metavar "PROJECT-FOLDER")
91
parseEnter :: Parser Command parseEnter = Enter <$> argument str (metavar "PROJECT-FOLDER")
91
parseEnter = Enter <$> argument str (metavar "PROJECT-FOLDER")
62
false
true
0
8
11
29
14
15
null
null
zepto-lang/zepto
src/Zepto/Types/Export.hs
gpl-2.0
mapMaybeWithKeyMap = M.mapMaybeWithKey
38
mapMaybeWithKeyMap = M.mapMaybeWithKey
38
mapMaybeWithKeyMap = M.mapMaybeWithKey
38
false
false
0
5
2
8
4
4
null
null
sethfowler/pygmalion
src/Pygmalion/RPC/Server.hs
bsd-3-clause
route (RPCGetSimilarCommandInfo sf) = doGetSimilarCommandInfo sf
73
route (RPCGetSimilarCommandInfo sf) = doGetSimilarCommandInfo sf
73
route (RPCGetSimilarCommandInfo sf) = doGetSimilarCommandInfo sf
73
false
false
0
7
14
18
8
10
null
null
graydon/metrics
src/Data/Metrics/Reservoir/Uniform.hs
mit
-- | Using this variant requires that you ensure that there is no sharing of the reservoir itself. -- -- In other words, there must only be a single point of access (an IORef, etc. that accepts some sort of modification function). -- -- In return, updating the reservoir becomes an O(1) operation and clearing the reservoir avoids extra allocations. unsafeReservoir :: Seed -> Int -> R.Reservoir unsafeReservoir g r = R.Reservoir { R._reservoirClear = unsafeClear , R._reservoirSize = size , R._reservoirSnapshot = snapshot , R._reservoirUpdate = unsafeUpdate , R._reservoirState = UniformReservoir 0 (I.replicate r 0) g }
634
unsafeReservoir :: Seed -> Int -> R.Reservoir unsafeReservoir g r = R.Reservoir { R._reservoirClear = unsafeClear , R._reservoirSize = size , R._reservoirSnapshot = snapshot , R._reservoirUpdate = unsafeUpdate , R._reservoirState = UniformReservoir 0 (I.replicate r 0) g }
284
unsafeReservoir g r = R.Reservoir { R._reservoirClear = unsafeClear , R._reservoirSize = size , R._reservoirSnapshot = snapshot , R._reservoirUpdate = unsafeUpdate , R._reservoirState = UniformReservoir 0 (I.replicate r 0) g }
238
true
true
0
11
109
96
54
42
null
null
brendanhay/gogol
gogol-ml/gen/Network/Google/MachineLearning/Types/Product.hs
mpl-2.0
-- | Creates a value of 'GoogleCloudMlV1__OperationMetadataLabels' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'gcmvomlAddtional' googleCloudMlV1__OperationMetadataLabels :: HashMap Text Text -- ^ 'gcmvomlAddtional' -> GoogleCloudMlV1__OperationMetadataLabels googleCloudMlV1__OperationMetadataLabels pGcmvomlAddtional_ = GoogleCloudMlV1__OperationMetadataLabels' {_gcmvomlAddtional = _Coerce # pGcmvomlAddtional_}
517
googleCloudMlV1__OperationMetadataLabels :: HashMap Text Text -- ^ 'gcmvomlAddtional' -> GoogleCloudMlV1__OperationMetadataLabels googleCloudMlV1__OperationMetadataLabels pGcmvomlAddtional_ = GoogleCloudMlV1__OperationMetadataLabels' {_gcmvomlAddtional = _Coerce # pGcmvomlAddtional_}
298
googleCloudMlV1__OperationMetadataLabels pGcmvomlAddtional_ = GoogleCloudMlV1__OperationMetadataLabels' {_gcmvomlAddtional = _Coerce # pGcmvomlAddtional_}
160
true
true
0
7
66
41
24
17
null
null
galexy/galexy.github.io
app/Main.hs
bsd-3-clause
-------------------------------------------------------------------------------- main :: IO () main = hakyll $ do match "images/**" $ do route idRoute compile copyFileCompiler match "css/*" $ do route idRoute compile $ compressCssCompiler match "404.html" $ do route idRoute compile $ pandocCompiler >>= loadAndApplyTemplate "templates/default.html" siteCtx >>= relativizeUrls -------------------------------------------------------------------------- -- Build tags from posts (and used by posts) -- tags <- buildTags "posts/*/index.*" (fromCapture "tags/*.html") categories <- buildMetaCategories "posts/*/index.*" (fromCapture "categories/*.html") let postCtxWithTags = tagsField "tags" tags <> metaCategoriesField "categories" categories <> postCtx match "posts/*/index.*" $ do route $ setExtension "html" compile $ pandocCompiler >>= saveSnapshot "content" >>= loadAndApplyTemplate "templates/post.html" postCtxWithTags >>= loadAndApplyTemplate "templates/default.html" postCtxWithTags >>= relativizeUrls match "pages/*/index.*" $ do route $ setExtension "html" compile $ pandocCompiler >>= loadAndApplyTemplate "templates/page.html" siteCtx >>= loadAndApplyTemplate "templates/default.html" siteCtx -------------------------------------------------------------------------- -- generate home page with most recent 10 posts -- create ["index.html"] $ do route idRoute compile $ do let postTeaserCtx = teaserCtx postCtxWithTags let homeCtx = listField "posts" postTeaserCtx (recentPosts 10) <> siteCtx makeItem "" >>= loadAndApplyTemplate "templates/home.html" homeCtx >>= loadAndApplyTemplate "templates/default.html" homeCtx >>= relativizeUrls -------------------------------------------------------------------------- -- generate archive list of posts -- create ["posts/index.html"] $ do route idRoute compile $ do let listCtx = listField "items" postCtxWithTags orderedPosts <> siteCtx makeItem "" >>= loadAndApplyTemplate "templates/list.html" listCtx >>= loadAndApplyTemplate "templates/default.html" listCtx >>= relativizeUrls -------------------------------------------------------------------------- -- generate tag lists -- tagsRules tags $ \tag pattern -> do let title = "Posts tagged \"" ++ tag ++ "\"" route idRoute compile $ do posts <- recentFirst =<< loadAll pattern let ctx = constField "title" title <> listField "items" postCtxWithTags (return posts) <> siteCtx makeItem "" >>= loadAndApplyTemplate "templates/tag.html" ctx >>= loadAndApplyTemplate "templates/default.html" ctx >>= relativizeUrls -------------------------------------------------------------------------- -- generate category lists -- tagsRules categories $ \category pattern -> do let title = "Posts in \"" ++ category ++ "\"" route idRoute compile $ do posts <- recentFirst =<< loadAll pattern let ctx = constField "title" title <> listField "items" postCtxWithTags (return posts) <> siteCtx makeItem "" >>= loadAndApplyTemplate "templates/tag.html" ctx >>= loadAndApplyTemplate "templates/default.html" ctx >>= relativizeUrls -------------------------------------------------------------------------- -- compile all the templates for use in other rules -- match "templates/*" $ compile templateCompiler --------------------------------------------------------------------------
4,226
main :: IO () main = hakyll $ do match "images/**" $ do route idRoute compile copyFileCompiler match "css/*" $ do route idRoute compile $ compressCssCompiler match "404.html" $ do route idRoute compile $ pandocCompiler >>= loadAndApplyTemplate "templates/default.html" siteCtx >>= relativizeUrls -------------------------------------------------------------------------- -- Build tags from posts (and used by posts) -- tags <- buildTags "posts/*/index.*" (fromCapture "tags/*.html") categories <- buildMetaCategories "posts/*/index.*" (fromCapture "categories/*.html") let postCtxWithTags = tagsField "tags" tags <> metaCategoriesField "categories" categories <> postCtx match "posts/*/index.*" $ do route $ setExtension "html" compile $ pandocCompiler >>= saveSnapshot "content" >>= loadAndApplyTemplate "templates/post.html" postCtxWithTags >>= loadAndApplyTemplate "templates/default.html" postCtxWithTags >>= relativizeUrls match "pages/*/index.*" $ do route $ setExtension "html" compile $ pandocCompiler >>= loadAndApplyTemplate "templates/page.html" siteCtx >>= loadAndApplyTemplate "templates/default.html" siteCtx -------------------------------------------------------------------------- -- generate home page with most recent 10 posts -- create ["index.html"] $ do route idRoute compile $ do let postTeaserCtx = teaserCtx postCtxWithTags let homeCtx = listField "posts" postTeaserCtx (recentPosts 10) <> siteCtx makeItem "" >>= loadAndApplyTemplate "templates/home.html" homeCtx >>= loadAndApplyTemplate "templates/default.html" homeCtx >>= relativizeUrls -------------------------------------------------------------------------- -- generate archive list of posts -- create ["posts/index.html"] $ do route idRoute compile $ do let listCtx = listField "items" postCtxWithTags orderedPosts <> siteCtx makeItem "" >>= loadAndApplyTemplate "templates/list.html" listCtx >>= loadAndApplyTemplate "templates/default.html" listCtx >>= relativizeUrls -------------------------------------------------------------------------- -- generate tag lists -- tagsRules tags $ \tag pattern -> do let title = "Posts tagged \"" ++ tag ++ "\"" route idRoute compile $ do posts <- recentFirst =<< loadAll pattern let ctx = constField "title" title <> listField "items" postCtxWithTags (return posts) <> siteCtx makeItem "" >>= loadAndApplyTemplate "templates/tag.html" ctx >>= loadAndApplyTemplate "templates/default.html" ctx >>= relativizeUrls -------------------------------------------------------------------------- -- generate category lists -- tagsRules categories $ \category pattern -> do let title = "Posts in \"" ++ category ++ "\"" route idRoute compile $ do posts <- recentFirst =<< loadAll pattern let ctx = constField "title" title <> listField "items" postCtxWithTags (return posts) <> siteCtx makeItem "" >>= loadAndApplyTemplate "templates/tag.html" ctx >>= loadAndApplyTemplate "templates/default.html" ctx >>= relativizeUrls -------------------------------------------------------------------------- -- compile all the templates for use in other rules -- match "templates/*" $ compile templateCompiler --------------------------------------------------------------------------
4,145
main = hakyll $ do match "images/**" $ do route idRoute compile copyFileCompiler match "css/*" $ do route idRoute compile $ compressCssCompiler match "404.html" $ do route idRoute compile $ pandocCompiler >>= loadAndApplyTemplate "templates/default.html" siteCtx >>= relativizeUrls -------------------------------------------------------------------------- -- Build tags from posts (and used by posts) -- tags <- buildTags "posts/*/index.*" (fromCapture "tags/*.html") categories <- buildMetaCategories "posts/*/index.*" (fromCapture "categories/*.html") let postCtxWithTags = tagsField "tags" tags <> metaCategoriesField "categories" categories <> postCtx match "posts/*/index.*" $ do route $ setExtension "html" compile $ pandocCompiler >>= saveSnapshot "content" >>= loadAndApplyTemplate "templates/post.html" postCtxWithTags >>= loadAndApplyTemplate "templates/default.html" postCtxWithTags >>= relativizeUrls match "pages/*/index.*" $ do route $ setExtension "html" compile $ pandocCompiler >>= loadAndApplyTemplate "templates/page.html" siteCtx >>= loadAndApplyTemplate "templates/default.html" siteCtx -------------------------------------------------------------------------- -- generate home page with most recent 10 posts -- create ["index.html"] $ do route idRoute compile $ do let postTeaserCtx = teaserCtx postCtxWithTags let homeCtx = listField "posts" postTeaserCtx (recentPosts 10) <> siteCtx makeItem "" >>= loadAndApplyTemplate "templates/home.html" homeCtx >>= loadAndApplyTemplate "templates/default.html" homeCtx >>= relativizeUrls -------------------------------------------------------------------------- -- generate archive list of posts -- create ["posts/index.html"] $ do route idRoute compile $ do let listCtx = listField "items" postCtxWithTags orderedPosts <> siteCtx makeItem "" >>= loadAndApplyTemplate "templates/list.html" listCtx >>= loadAndApplyTemplate "templates/default.html" listCtx >>= relativizeUrls -------------------------------------------------------------------------- -- generate tag lists -- tagsRules tags $ \tag pattern -> do let title = "Posts tagged \"" ++ tag ++ "\"" route idRoute compile $ do posts <- recentFirst =<< loadAll pattern let ctx = constField "title" title <> listField "items" postCtxWithTags (return posts) <> siteCtx makeItem "" >>= loadAndApplyTemplate "templates/tag.html" ctx >>= loadAndApplyTemplate "templates/default.html" ctx >>= relativizeUrls -------------------------------------------------------------------------- -- generate category lists -- tagsRules categories $ \category pattern -> do let title = "Posts in \"" ++ category ++ "\"" route idRoute compile $ do posts <- recentFirst =<< loadAll pattern let ctx = constField "title" title <> listField "items" postCtxWithTags (return posts) <> siteCtx makeItem "" >>= loadAndApplyTemplate "templates/tag.html" ctx >>= loadAndApplyTemplate "templates/default.html" ctx >>= relativizeUrls -------------------------------------------------------------------------- -- compile all the templates for use in other rules -- match "templates/*" $ compile templateCompiler --------------------------------------------------------------------------
4,131
true
true
2
26
1,300
713
321
392
null
null
JoshuaGross/haskell-learning-log
Code/Haskellbook/Phone.hs
mit
reverseTaps :: PhoneStructure -> Char -> [(Digit, Presses)] reverseTaps = undefined
83
reverseTaps :: PhoneStructure -> Char -> [(Digit, Presses)] reverseTaps = undefined
83
reverseTaps = undefined
23
false
true
0
8
10
28
16
12
null
null
gbataille/pandoc
src/Text/Pandoc/Writers/Texinfo.hs
gpl-2.0
pandocToTexinfo :: WriterOptions -> Pandoc -> State WriterState String pandocToTexinfo options (Pandoc meta blocks) = do let titlePage = not $ all null $ docTitle meta : docDate meta : docAuthors meta let colwidth = if writerWrapText options then Just $ writerColumns options else Nothing metadata <- metaToJSON options (fmap (render colwidth) . blockListToTexinfo) (fmap (render colwidth) . inlineListToTexinfo) meta main <- blockListToTexinfo blocks st <- get let body = render colwidth main let context = defField "body" body $ defField "toc" (writerTableOfContents options) $ defField "titlepage" titlePage $ defField "subscript" (stSubscript st) $ defField "superscript" (stSuperscript st) $ defField "strikeout" (stStrikeout st) $ metadata if writerStandalone options then return $ renderTemplate' (writerTemplate options) context else return body -- | Escape things as needed for Texinfo.
1,110
pandocToTexinfo :: WriterOptions -> Pandoc -> State WriterState String pandocToTexinfo options (Pandoc meta blocks) = do let titlePage = not $ all null $ docTitle meta : docDate meta : docAuthors meta let colwidth = if writerWrapText options then Just $ writerColumns options else Nothing metadata <- metaToJSON options (fmap (render colwidth) . blockListToTexinfo) (fmap (render colwidth) . inlineListToTexinfo) meta main <- blockListToTexinfo blocks st <- get let body = render colwidth main let context = defField "body" body $ defField "toc" (writerTableOfContents options) $ defField "titlepage" titlePage $ defField "subscript" (stSubscript st) $ defField "superscript" (stSuperscript st) $ defField "strikeout" (stStrikeout st) $ metadata if writerStandalone options then return $ renderTemplate' (writerTemplate options) context else return body -- | Escape things as needed for Texinfo.
1,110
pandocToTexinfo options (Pandoc meta blocks) = do let titlePage = not $ all null $ docTitle meta : docDate meta : docAuthors meta let colwidth = if writerWrapText options then Just $ writerColumns options else Nothing metadata <- metaToJSON options (fmap (render colwidth) . blockListToTexinfo) (fmap (render colwidth) . inlineListToTexinfo) meta main <- blockListToTexinfo blocks st <- get let body = render colwidth main let context = defField "body" body $ defField "toc" (writerTableOfContents options) $ defField "titlepage" titlePage $ defField "subscript" (stSubscript st) $ defField "superscript" (stSuperscript st) $ defField "strikeout" (stStrikeout st) $ metadata if writerStandalone options then return $ renderTemplate' (writerTemplate options) context else return body -- | Escape things as needed for Texinfo.
1,039
false
true
9
14
340
295
139
156
null
null
WraithM/peertrader-backend
src/PeerTrader/StrategyManagement.hs
bsd-3-clause
anActiveStrategy :: (PersistField a, PersistBackend m) => UserLogin -> m (Maybe (Strategy a)) anActiveStrategy n = do activeStrat <- liftM listToMaybe $ select $ ActiveOwnerField ==. n let afKey = activeStrategy <$> activeStrat getMaybeKey afKey where getMaybeKey (Just k) = get k getMaybeKey Nothing = return Nothing
354
anActiveStrategy :: (PersistField a, PersistBackend m) => UserLogin -> m (Maybe (Strategy a)) anActiveStrategy n = do activeStrat <- liftM listToMaybe $ select $ ActiveOwnerField ==. n let afKey = activeStrategy <$> activeStrat getMaybeKey afKey where getMaybeKey (Just k) = get k getMaybeKey Nothing = return Nothing
354
anActiveStrategy n = do activeStrat <- liftM listToMaybe $ select $ ActiveOwnerField ==. n let afKey = activeStrategy <$> activeStrat getMaybeKey afKey where getMaybeKey (Just k) = get k getMaybeKey Nothing = return Nothing
245
false
true
0
12
83
118
56
62
null
null
urbanslug/ghc
compiler/types/TyCon.hs
bsd-3-clause
isNewTyCon _ = False
54
isNewTyCon _ = False
54
isNewTyCon _ = False
54
false
false
0
5
37
9
4
5
null
null
Airtnp/Freshman_Simple_Haskell_Lib
Intro/hello-world.hs
mit
nextChar_less :: Char -> Char nextChar_less = toEnum . (+1) . fromEnum
70
nextChar_less :: Char -> Char nextChar_less = toEnum . (+1) . fromEnum
70
nextChar_less = toEnum . (+1) . fromEnum
40
false
true
0
7
11
34
16
18
null
null
mathhun/stack
src/Stack/Types/StackT.hs
bsd-3-clause
runStackTGlobal :: (MonadIO m,MonadBaseControl IO m) => Manager -> config -> GlobalOpts -> StackT config m a -> m a runStackTGlobal manager config GlobalOpts{..} m = runStackT manager globalLogLevel config globalTerminal (isJust globalReExecVersion) m
271
runStackTGlobal :: (MonadIO m,MonadBaseControl IO m) => Manager -> config -> GlobalOpts -> StackT config m a -> m a runStackTGlobal manager config GlobalOpts{..} m = runStackT manager globalLogLevel config globalTerminal (isJust globalReExecVersion) m
271
runStackTGlobal manager config GlobalOpts{..} m = runStackT manager globalLogLevel config globalTerminal (isJust globalReExecVersion) m
139
false
true
0
10
53
88
43
45
null
null
martine/gat
Shared.hs
gpl-2.0
firstTrue :: Monad m => [m (Maybe a)] -> m (Maybe a) firstTrue [] = return Nothing
86
firstTrue :: Monad m => [m (Maybe a)] -> m (Maybe a) firstTrue [] = return Nothing
86
firstTrue [] = return Nothing
33
false
true
0
11
20
56
25
31
null
null
ezyang/ghc
compiler/hsSyn/HsPat.hs
bsd-3-clause
pprPat (ConPatIn con details) = pprUserCon (unLoc con) details
62
pprPat (ConPatIn con details) = pprUserCon (unLoc con) details
62
pprPat (ConPatIn con details) = pprUserCon (unLoc con) details
62
false
false
0
7
8
28
13
15
null
null
DavidAlphaFox/ghc
libraries/Cabal/Cabal/tests/PackageTests/TemplateHaskell/Check.hs
bsd-3-clause
vanilla :: FilePath -> Test vanilla ghcPath = TestCase $ do let spec = PackageSpec { directory = "PackageTests" </> "TemplateHaskell" </> "vanilla" , configOpts = [] , distPref = Nothing } result <- cabal_build spec ghcPath assertBuildSucceeded result
297
vanilla :: FilePath -> Test vanilla ghcPath = TestCase $ do let spec = PackageSpec { directory = "PackageTests" </> "TemplateHaskell" </> "vanilla" , configOpts = [] , distPref = Nothing } result <- cabal_build spec ghcPath assertBuildSucceeded result
297
vanilla ghcPath = TestCase $ do let spec = PackageSpec { directory = "PackageTests" </> "TemplateHaskell" </> "vanilla" , configOpts = [] , distPref = Nothing } result <- cabal_build spec ghcPath assertBuildSucceeded result
269
false
true
0
14
84
79
40
39
null
null
kyagrd/hs-nipkow-lics93
src/Unif.hs
bsd-2-clause
lamMany = foldr ((.) . lam) id
30
lamMany = foldr ((.) . lam) id
30
lamMany = foldr ((.) . lam) id
30
false
false
0
7
6
20
11
9
null
null
truls/language-vhdl-quote
src/Language/VHDL/Pretty.hs
mpl-2.0
postponed :: Pretty a => Maybe Label -> Bool -> a -> Doc postponed l b a = label l <+> when b (text "postponed") <+> ppr a
126
postponed :: Pretty a => Maybe Label -> Bool -> a -> Doc postponed l b a = label l <+> when b (text "postponed") <+> ppr a
126
postponed l b a = label l <+> when b (text "postponed") <+> ppr a
65
false
true
0
9
31
68
31
37
null
null
christiaanb/ghc
compiler/deSugar/DsBinds.hs
bsd-3-clause
dsEvTerm (EvDelayedError ty msg) = return $ Var errorId `mkTyApps` [ty] `mkApps` [litMsg] where errorId = rUNTIME_ERROR_ID litMsg = Lit (MachStr (fastStringToByteString msg))
185
dsEvTerm (EvDelayedError ty msg) = return $ Var errorId `mkTyApps` [ty] `mkApps` [litMsg] where errorId = rUNTIME_ERROR_ID litMsg = Lit (MachStr (fastStringToByteString msg))
185
dsEvTerm (EvDelayedError ty msg) = return $ Var errorId `mkTyApps` [ty] `mkApps` [litMsg] where errorId = rUNTIME_ERROR_ID litMsg = Lit (MachStr (fastStringToByteString msg))
185
false
false
2
9
33
78
37
41
null
null
grasswire/scrapey
src/Web/Scrapey/App/Main.hs
bsd-3-clause
getCanonicalUrl :: URI -> Maybe String getCanonicalUrl url = uriRegName <$> uriAuthority url
92
getCanonicalUrl :: URI -> Maybe String getCanonicalUrl url = uriRegName <$> uriAuthority url
92
getCanonicalUrl url = uriRegName <$> uriAuthority url
53
false
true
0
6
12
28
13
15
null
null
urbanslug/ghc
includes/CodeGen.Platform.hs
bsd-3-clause
globalRegMaybe (YmmReg 2) = Just (RealRegSingle REG_YMM2)
71
globalRegMaybe (YmmReg 2) = Just (RealRegSingle REG_YMM2)
71
globalRegMaybe (YmmReg 2) = Just (RealRegSingle REG_YMM2)
71
false
false
0
7
20
24
11
13
null
null
nomicflux/threals
src/Threal/Impartial.hs
gpl-2.0
nextTurnInTree :: ThrealTree -> ThrealTree nextTurnInTree TThunk = TThunk
73
nextTurnInTree :: ThrealTree -> ThrealTree nextTurnInTree TThunk = TThunk
73
nextTurnInTree TThunk = TThunk
30
false
true
0
5
8
18
9
9
null
null
CindyLinz/CodeSnippet
haskell/VarArg.hs
mit
prt (Printing a remain) = putStr (show a ++ " ") >> prt remain
62
prt (Printing a remain) = putStr (show a ++ " ") >> prt remain
62
prt (Printing a remain) = putStr (show a ++ " ") >> prt remain
62
false
false
0
9
13
37
17
20
null
null
Peaker/keyvaluehash
src/test.hs
bsd-3-clause
ignoreExceptions :: IO () -> IO () ignoreExceptions = (`E.catch` \(E.SomeException _) -> return ())
99
ignoreExceptions :: IO () -> IO () ignoreExceptions = (`E.catch` \(E.SomeException _) -> return ())
99
ignoreExceptions = (`E.catch` \(E.SomeException _) -> return ())
64
false
true
0
9
14
51
27
24
null
null
narurien/ganeti-ceph
src/Ganeti/OpParams.hs
gpl-2.0
tagTypeOf (TagGroup {}) = TagTypeGroup
41
tagTypeOf (TagGroup {}) = TagTypeGroup
41
tagTypeOf (TagGroup {}) = TagTypeGroup
41
false
false
0
6
7
17
8
9
null
null
dzeban/haskell-exercises
hw2/LogAnalysis.hs
mit
severity _ = -1
15
severity _ = -1
15
severity _ = -1
15
false
false
0
5
3
11
5
6
null
null
DavidAlphaFox/darcs
harness/Darcs/Test/Patch/Examples/Set2Unwitnessed.hs
gpl-2.0
mergeExamples :: [Sealed2 (RealPatch Prim :\/: RealPatch Prim)] mergeExamples = map (mapSeal2 fromW) w_mergeExamples
116
mergeExamples :: [Sealed2 (RealPatch Prim :\/: RealPatch Prim)] mergeExamples = map (mapSeal2 fromW) w_mergeExamples
116
mergeExamples = map (mapSeal2 fromW) w_mergeExamples
52
false
true
0
9
13
41
20
21
null
null
input-output-hk/pos-haskell-prototype
lib/src/Pos/Network/Block/Logic.hs
mit
handleBlocks :: forall ctx m . ( BlockWorkMode ctx m , HasMisbehaviorMetrics ctx ) => Genesis.Config -> TxpConfiguration -> OldestFirst NE Block -> Diffusion m -> m () handleBlocks genesisConfig txpConfig blocks diffusion = do logDebug "handleBlocks: processing" inAssertMode $ logInfo $ sformat ("Processing sequence of blocks: " % buildListBounds % "...") $ getOldestFirst $ map headerHash blocks maybe onNoLca handleBlocksWithLca =<< lcaWithMainChain (map (view blockHeader) blocks) inAssertMode $ logDebug $ "Finished processing sequence of blocks" where onNoLca = logWarning $ "Sequence of blocks can't be processed, because there is no LCA. " <> "Probably rollback happened in parallel" handleBlocksWithLca :: HeaderHash -> m () handleBlocksWithLca lcaHash = do logDebug $ sformat ("Handling block w/ LCA, which is "%shortHashF) lcaHash -- Head blund in result is the youngest one. toRollback <- DB.loadBlundsFromTipWhile (configGenesisHash genesisConfig) $ \blk -> headerHash blk /= lcaHash maybe (applyWithoutRollback genesisConfig txpConfig diffusion blocks) (applyWithRollback genesisConfig txpConfig diffusion blocks lcaHash) (_NewestFirst nonEmpty toRollback)
1,363
handleBlocks :: forall ctx m . ( BlockWorkMode ctx m , HasMisbehaviorMetrics ctx ) => Genesis.Config -> TxpConfiguration -> OldestFirst NE Block -> Diffusion m -> m () handleBlocks genesisConfig txpConfig blocks diffusion = do logDebug "handleBlocks: processing" inAssertMode $ logInfo $ sformat ("Processing sequence of blocks: " % buildListBounds % "...") $ getOldestFirst $ map headerHash blocks maybe onNoLca handleBlocksWithLca =<< lcaWithMainChain (map (view blockHeader) blocks) inAssertMode $ logDebug $ "Finished processing sequence of blocks" where onNoLca = logWarning $ "Sequence of blocks can't be processed, because there is no LCA. " <> "Probably rollback happened in parallel" handleBlocksWithLca :: HeaderHash -> m () handleBlocksWithLca lcaHash = do logDebug $ sformat ("Handling block w/ LCA, which is "%shortHashF) lcaHash -- Head blund in result is the youngest one. toRollback <- DB.loadBlundsFromTipWhile (configGenesisHash genesisConfig) $ \blk -> headerHash blk /= lcaHash maybe (applyWithoutRollback genesisConfig txpConfig diffusion blocks) (applyWithRollback genesisConfig txpConfig diffusion blocks lcaHash) (_NewestFirst nonEmpty toRollback)
1,363
handleBlocks genesisConfig txpConfig blocks diffusion = do logDebug "handleBlocks: processing" inAssertMode $ logInfo $ sformat ("Processing sequence of blocks: " % buildListBounds % "...") $ getOldestFirst $ map headerHash blocks maybe onNoLca handleBlocksWithLca =<< lcaWithMainChain (map (view blockHeader) blocks) inAssertMode $ logDebug $ "Finished processing sequence of blocks" where onNoLca = logWarning $ "Sequence of blocks can't be processed, because there is no LCA. " <> "Probably rollback happened in parallel" handleBlocksWithLca :: HeaderHash -> m () handleBlocksWithLca lcaHash = do logDebug $ sformat ("Handling block w/ LCA, which is "%shortHashF) lcaHash -- Head blund in result is the youngest one. toRollback <- DB.loadBlundsFromTipWhile (configGenesisHash genesisConfig) $ \blk -> headerHash blk /= lcaHash maybe (applyWithoutRollback genesisConfig txpConfig diffusion blocks) (applyWithRollback genesisConfig txpConfig diffusion blocks lcaHash) (_NewestFirst nonEmpty toRollback)
1,150
false
true
0
13
347
299
142
157
null
null
bitemyapp/github
samples/Repos/Webhooks/DeleteWebhook.hs
bsd-3-clause
main :: IO () main = do let auth = Auth.GithubOAuth "oauthtoken" resp <- deleteRepoWebhook' auth "repoOwner" "repoName" 123 case resp of (Left err) -> putStrLn $ "Error: " ++ (show err) (Right stat) -> putStrLn $ "Resp: " ++ (show stat)
250
main :: IO () main = do let auth = Auth.GithubOAuth "oauthtoken" resp <- deleteRepoWebhook' auth "repoOwner" "repoName" 123 case resp of (Left err) -> putStrLn $ "Error: " ++ (show err) (Right stat) -> putStrLn $ "Resp: " ++ (show stat)
250
main = do let auth = Auth.GithubOAuth "oauthtoken" resp <- deleteRepoWebhook' auth "repoOwner" "repoName" 123 case resp of (Left err) -> putStrLn $ "Error: " ++ (show err) (Right stat) -> putStrLn $ "Resp: " ++ (show stat)
236
false
true
0
12
55
105
50
55
null
null
cryptica/slapnet
src/Solver/Formula.hs
gpl-3.0
opToFunction Lt = (.<)
22
opToFunction Lt = (.<)
22
opToFunction Lt = (.<)
22
false
false
0
5
3
11
6
5
null
null
pparkkin/eta
compiler/ETA/BasicTypes/OccName.hs
bsd-3-clause
-- | Test if the 'OccName' is a data constructor that starts with -- a symbol (e.g. @:@, or @[]@) isDataSymOcc :: OccName -> Bool isDataSymOcc (OccName DataName s) = isLexConSym s
179
isDataSymOcc :: OccName -> Bool isDataSymOcc (OccName DataName s) = isLexConSym s
81
isDataSymOcc (OccName DataName s) = isLexConSym s
49
true
true
0
7
31
31
16
15
null
null
mydaum/cabal
Cabal/Distribution/Parsec/Parser.hs
bsd-3-clause
-- An element (field or section) that is valid in a layout context. -- In a layout context we can have fields and sections that themselves -- either use layout style or that use braces style. -- -- elementInLayoutContext ::= ':' fieldLayoutOrBraces -- | arg* sectionLayoutOrBraces elementInLayoutContext :: IndentLevel -> Name Position -> Parser (Field Position) elementInLayoutContext ilevel name = (do colon; fieldLayoutOrBraces ilevel name) <|> (do args <- many sectionArg elems <- sectionLayoutOrBraces ilevel return (Section name args elems))
602
elementInLayoutContext :: IndentLevel -> Name Position -> Parser (Field Position) elementInLayoutContext ilevel name = (do colon; fieldLayoutOrBraces ilevel name) <|> (do args <- many sectionArg elems <- sectionLayoutOrBraces ilevel return (Section name args elems))
295
elementInLayoutContext ilevel name = (do colon; fieldLayoutOrBraces ilevel name) <|> (do args <- many sectionArg elems <- sectionLayoutOrBraces ilevel return (Section name args elems))
213
true
true
3
11
134
108
52
56
null
null
wehu/hw
src/Type.hs
apache-2.0
prType (TCon a []) = PP.parens $ prType a
41
prType (TCon a []) = PP.parens $ prType a
41
prType (TCon a []) = PP.parens $ prType a
41
false
false
0
7
8
29
13
16
null
null
coolhacks/scripts-hacks
examples/shellcheck-master/ShellCheck/Analytics.hs
mit
prop_checkSpuriousExec5 = verifyNot checkSpuriousExec "exec > file; cmd"
72
prop_checkSpuriousExec5 = verifyNot checkSpuriousExec "exec > file; cmd"
72
prop_checkSpuriousExec5 = verifyNot checkSpuriousExec "exec > file; cmd"
72
false
false
0
5
7
11
5
6
null
null
andrew-quinn/sufftree
sufftree.hs
gpl-2.0
suffixes xs = xs : suffixes (tail xs)
37
suffixes xs = xs : suffixes (tail xs)
37
suffixes xs = xs : suffixes (tail xs)
37
false
false
0
8
7
22
10
12
null
null
thlorenz/Pricetory
src/Contract/Protocol.hs
bsd-3-clause
encodeRequestAck :: RequestAck -> L.ByteString encodeRequestAck (RequestAck ackOK ackMsgCode) = L.concat . map encode $ [ackOK, ackMsgCode]
144
encodeRequestAck :: RequestAck -> L.ByteString encodeRequestAck (RequestAck ackOK ackMsgCode) = L.concat . map encode $ [ackOK, ackMsgCode]
144
encodeRequestAck (RequestAck ackOK ackMsgCode) = L.concat . map encode $ [ackOK, ackMsgCode]
97
false
true
0
7
21
47
24
23
null
null
JoshuaGross/haskell-learning-log
Code/Haskellbook/Reader/src/Char.hs
mit
-- functions are functors! fmapped :: [Char] -> [Char] fmapped = fmap cap rev
77
fmapped :: [Char] -> [Char] fmapped = fmap cap rev
50
fmapped = fmap cap rev
22
true
true
0
8
13
35
16
19
null
null
chrisdone/hulk
fastirc-0.2.0/Network/FastIRC/Session.hs
bsd-3-clause
-- | Send bot command to a bot. sendBotCmd :: BotSession -> BotCommand -> IO () sendBotCmd bs cmd = writeChan (botCmdChan bs) cmd
130
sendBotCmd :: BotSession -> BotCommand -> IO () sendBotCmd bs cmd = writeChan (botCmdChan bs) cmd
97
sendBotCmd bs cmd = writeChan (botCmdChan bs) cmd
49
true
true
0
9
24
46
21
25
null
null
kim/amazonka
amazonka-cloudwatch/gen/Network/AWS/CloudWatch/Types.hs
mpl-2.0
-- | An explanation for the alarm's state in machine-readable JSON format maStateReasonData :: Lens' MetricAlarm (Maybe Text) maStateReasonData = lens _maStateReasonData (\s a -> s { _maStateReasonData = a })
212
maStateReasonData :: Lens' MetricAlarm (Maybe Text) maStateReasonData = lens _maStateReasonData (\s a -> s { _maStateReasonData = a })
138
maStateReasonData = lens _maStateReasonData (\s a -> s { _maStateReasonData = a })
86
true
true
1
9
34
52
25
27
null
null
SimplyNaOH/voronoi
app/Main.hs
gpl-3.0
renderedges :: [Edge'] -> [Diagram B] renderedges edges = concatMap (\(Edge' _ _ l r) -> if l /= (0,0) && r/=(0,0) then [line [l, r]] else []) edges
167
renderedges :: [Edge'] -> [Diagram B] renderedges edges = concatMap (\(Edge' _ _ l r) -> if l /= (0,0) && r/=(0,0) then [line [l, r]] else []) edges
167
renderedges edges = concatMap (\(Edge' _ _ l r) -> if l /= (0,0) && r/=(0,0) then [line [l, r]] else []) edges
129
false
true
0
11
47
105
55
50
null
null
geraldus/lambdacms
lambdacms-core/LambdaCms/Core/Message.hs
mit
dutchMessage WelcomeInfo = "Voor meer informatie over LambdaCms kan je terecht op <a href='http://www.lambdacms.org'>www.lambdacms.org</a>."
160
dutchMessage WelcomeInfo = "Voor meer informatie over LambdaCms kan je terecht op <a href='http://www.lambdacms.org'>www.lambdacms.org</a>."
160
dutchMessage WelcomeInfo = "Voor meer informatie over LambdaCms kan je terecht op <a href='http://www.lambdacms.org'>www.lambdacms.org</a>."
160
false
false
0
5
33
9
4
5
null
null
OS2World/DEV-UTIL-HUGS
oldlib/BinaryRandList.hs
bsd-3-clause
foldr f e (Odd x ps) = f x (foldr (\(x,y) e -> f x (f y e)) e ps)
65
foldr f e (Odd x ps) = f x (foldr (\(x,y) e -> f x (f y e)) e ps)
65
foldr f e (Odd x ps) = f x (foldr (\(x,y) e -> f x (f y e)) e ps)
65
false
false
0
12
19
69
33
36
null
null
rimmington/unix
tests/T3816.hs
bsd-3-clause
main = do getAllGroupEntries >>= print . (>0) . length getAllGroupEntries >>= print . (>0) . length
103
main = do getAllGroupEntries >>= print . (>0) . length getAllGroupEntries >>= print . (>0) . length
103
main = do getAllGroupEntries >>= print . (>0) . length getAllGroupEntries >>= print . (>0) . length
103
false
false
0
9
20
44
23
21
null
null
sajith/betty-web
Settings.hs
agpl-3.0
-- | @config/settings.yml@, parsed to a @Value@. configSettingsYmlValue :: Value configSettingsYmlValue = either Exception.throw id $ decodeEither' configSettingsYmlBS
167
configSettingsYmlValue :: Value configSettingsYmlValue = either Exception.throw id $ decodeEither' configSettingsYmlBS
118
configSettingsYmlValue = either Exception.throw id $ decodeEither' configSettingsYmlBS
86
true
true
0
7
17
26
13
13
null
null
nicklawls/eightpuzzle
src/Main.hs
bsd-3-clause
-- this magical incantation inserts the list of (score, node) pairs into the queue uniformCost :: Problem state => (state -> Cost) -> QueueingFunction state uniformCost = astar (const 0)
188
uniformCost :: Problem state => (state -> Cost) -> QueueingFunction state uniformCost = astar (const 0)
103
uniformCost = astar (const 0)
29
true
true
0
8
31
42
21
21
null
null
Lignum/Tetoris
src/Board.hs
mit
boardRowEmpty :: Board -> Int -> Bool boardRowEmpty b y = flip all [0..(w - 1)] $ \x -> not $ boardHasCell b x y where (w, _) = boardSize b
141
boardRowEmpty :: Board -> Int -> Bool boardRowEmpty b y = flip all [0..(w - 1)] $ \x -> not $ boardHasCell b x y where (w, _) = boardSize b
141
boardRowEmpty b y = flip all [0..(w - 1)] $ \x -> not $ boardHasCell b x y where (w, _) = boardSize b
103
false
true
0
9
32
83
41
42
null
null
apyrgio/ganeti
test/hs/Test/Ganeti/Utils.hs
bsd-2-clause
prop_select :: Int -- ^ Default result -> [Int] -- ^ List of False values -> [Int] -- ^ List of True values -> Property -- ^ Test result prop_select def lst1 lst2 = select def (flist ++ tlist) ==? expectedresult where expectedresult = defaultHead def lst2 flist = zip (repeat False) lst1 tlist = zip (repeat True) lst2
394
prop_select :: Int -- ^ Default result -> [Int] -- ^ List of False values -> [Int] -- ^ List of True values -> Property prop_select def lst1 lst2 = select def (flist ++ tlist) ==? expectedresult where expectedresult = defaultHead def lst2 flist = zip (repeat False) lst1 tlist = zip (repeat True) lst2
377
prop_select def lst1 lst2 = select def (flist ++ tlist) ==? expectedresult where expectedresult = defaultHead def lst2 flist = zip (repeat False) lst1 tlist = zip (repeat True) lst2
210
true
true
2
8
134
101
53
48
null
null
rueshyna/gogol
gogol-bigquery/gen/Network/Google/BigQuery/Types/Product.hs
mpl-2.0
-- | [Optional] Human-oriented description of the field. qptstiDescription :: Lens' QueryParameterTypeStructTypesItem (Maybe Text) qptstiDescription = lens _qptstiDescription (\ s a -> s{_qptstiDescription = a})
219
qptstiDescription :: Lens' QueryParameterTypeStructTypesItem (Maybe Text) qptstiDescription = lens _qptstiDescription (\ s a -> s{_qptstiDescription = a})
162
qptstiDescription = lens _qptstiDescription (\ s a -> s{_qptstiDescription = a})
88
true
true
0
9
32
48
25
23
null
null
webcrank/webcrank.hs
src/Webcrank/Internal/ResourceData.hs
bsd-3-clause
getRequestMethod :: (MonadTrans t, Monad m, MonadReader r (t m), HasResourceData r m) => t m Method getRequestMethod = callAPI srvGetRequestMethod
150
getRequestMethod :: (MonadTrans t, Monad m, MonadReader r (t m), HasResourceData r m) => t m Method getRequestMethod = callAPI srvGetRequestMethod
150
getRequestMethod = callAPI srvGetRequestMethod
46
false
true
0
8
24
59
29
30
null
null
bsl/GLFW-b
Graphics/UI/GLFW.hs
bsd-2-clause
windowHint (WindowHint'GreenBits x) = c'glfwWindowHint c'GLFW_GREEN_BITS (toC x)
109
windowHint (WindowHint'GreenBits x) = c'glfwWindowHint c'GLFW_GREEN_BITS (toC x)
109
windowHint (WindowHint'GreenBits x) = c'glfwWindowHint c'GLFW_GREEN_BITS (toC x)
109
false
false
0
7
36
26
12
14
null
null
thomasjm/ot.hs
src/Control/OperationalTransformation/JSON.hs
mit
-- Operations where the left affects the right -- since `x` is unaffected by `y`, `x'` is just `x` transform' x y | x `affects` y = ((j x, ) . j) <$> (transformRight x y)
170
transform' x y | x `affects` y = ((j x, ) . j) <$> (transformRight x y)
71
transform' x y | x `affects` y = ((j x, ) . j) <$> (transformRight x y)
71
true
false
0
10
35
51
27
24
null
null
apyrgio/snf-ganeti
src/Ganeti/HTools/Node.hs
bsd-2-clause
availDisk :: Node -> Int availDisk t = let _f = fDsk t _l = loDsk t in if _f < _l then 0 else _f - _l
125
availDisk :: Node -> Int availDisk t = let _f = fDsk t _l = loDsk t in if _f < _l then 0 else _f - _l
125
availDisk t = let _f = fDsk t _l = loDsk t in if _f < _l then 0 else _f - _l
100
false
true
0
9
51
62
29
33
null
null
dysinger/amazonka
amazonka-swf/gen/Network/AWS/SWF/RespondActivityTaskFailed.hs
mpl-2.0
-- | Description of the error that may assist in diagnostics. ratfReason :: Lens' RespondActivityTaskFailed (Maybe Text) ratfReason = lens _ratfReason (\s a -> s { _ratfReason = a })
182
ratfReason :: Lens' RespondActivityTaskFailed (Maybe Text) ratfReason = lens _ratfReason (\s a -> s { _ratfReason = a })
120
ratfReason = lens _ratfReason (\s a -> s { _ratfReason = a })
61
true
true
0
9
29
46
25
21
null
null
adept/hledger
hledger-lib/Hledger/Utils/String.hs
gpl-3.0
-- | Strip ANSI escape sequences from a string. -- -- >>> stripAnsi "\ESC[31m-1\ESC[m" -- "-1" stripAnsi :: String -> String stripAnsi s = either err id $ regexReplace ansire "" s where err = error "stripAnsi: invalid replacement pattern" -- PARTIAL, shouldn't happen ansire = toRegex' $ T.pack "\ESC\\[([0-9]+;)*([0-9]+)?[ABCDHJKfmsu]" -- PARTIAL, should succeed
379
stripAnsi :: String -> String stripAnsi s = either err id $ regexReplace ansire "" s where err = error "stripAnsi: invalid replacement pattern" -- PARTIAL, shouldn't happen ansire = toRegex' $ T.pack "\ESC\\[([0-9]+;)*([0-9]+)?[ABCDHJKfmsu]" -- PARTIAL, should succeed
284
stripAnsi s = either err id $ regexReplace ansire "" s where err = error "stripAnsi: invalid replacement pattern" -- PARTIAL, shouldn't happen ansire = toRegex' $ T.pack "\ESC\\[([0-9]+;)*([0-9]+)?[ABCDHJKfmsu]" -- PARTIAL, should succeed
254
true
true
2
7
69
76
35
41
null
null
romanb/amazonka
amazonka-cognito-sync/gen/Network/AWS/CognitoSync/SetIdentityPoolConfiguration.hs
mpl-2.0
-- | Options to apply to this identity pool for push synchronization. sipcrPushSync :: Lens' SetIdentityPoolConfigurationResponse (Maybe PushSync) sipcrPushSync = lens _sipcrPushSync (\s a -> s { _sipcrPushSync = a })
217
sipcrPushSync :: Lens' SetIdentityPoolConfigurationResponse (Maybe PushSync) sipcrPushSync = lens _sipcrPushSync (\s a -> s { _sipcrPushSync = a })
147
sipcrPushSync = lens _sipcrPushSync (\s a -> s { _sipcrPushSync = a })
70
true
true
0
9
30
46
25
21
null
null
GaloisInc/pads-haskell
Examples/Binary.hs
bsd-3-clause
call_expect = ([Call {onpa = 221, obase = 2360199, dpna = 936, dbase = 3615299, con = 96977709, dur = 71},Call {onpa = 221, obase = 2360399, dpna = 855, dbase = 5445599, con = 96978527, dur = 126},Call {onpa = 221, obase = 2390199, dpna = 974, dbase = 4298199, con = 96980122, dur = 990},Call {onpa = 221, obase = 2390399, dpna = 855, dbase = 5404599, con = 96976885, dur = 35},Call {onpa = 222, obase = 2332099, dpna = 426, dbase = 6814599, con = 96977173, dur = 4850},Call {onpa = 222, obase = 2332099, dpna = -15, dbase = 9999999, con = 96978457, dur = 533},Call {onpa = 222, obase = 2340599, dpna = 855, dbase = 8442799, con = 96980047, dur = 8},Call {onpa = 222, obase = 2341299, dpna = 855, dbase = 7081599, con = 96979104, dur = 11},Call {onpa = 223, obase = 2340099, dpna = 855, dbase = 2484499, con = 96977739, dur = 564},Call {onpa = 223, obase = 2340199, dpna = -15, dbase = 9999999, con = 96979345, dur = 143}],0)
925
call_expect = ([Call {onpa = 221, obase = 2360199, dpna = 936, dbase = 3615299, con = 96977709, dur = 71},Call {onpa = 221, obase = 2360399, dpna = 855, dbase = 5445599, con = 96978527, dur = 126},Call {onpa = 221, obase = 2390199, dpna = 974, dbase = 4298199, con = 96980122, dur = 990},Call {onpa = 221, obase = 2390399, dpna = 855, dbase = 5404599, con = 96976885, dur = 35},Call {onpa = 222, obase = 2332099, dpna = 426, dbase = 6814599, con = 96977173, dur = 4850},Call {onpa = 222, obase = 2332099, dpna = -15, dbase = 9999999, con = 96978457, dur = 533},Call {onpa = 222, obase = 2340599, dpna = 855, dbase = 8442799, con = 96980047, dur = 8},Call {onpa = 222, obase = 2341299, dpna = 855, dbase = 7081599, con = 96979104, dur = 11},Call {onpa = 223, obase = 2340099, dpna = 855, dbase = 2484499, con = 96977739, dur = 564},Call {onpa = 223, obase = 2340199, dpna = -15, dbase = 9999999, con = 96979345, dur = 143}],0)
925
call_expect = ([Call {onpa = 221, obase = 2360199, dpna = 936, dbase = 3615299, con = 96977709, dur = 71},Call {onpa = 221, obase = 2360399, dpna = 855, dbase = 5445599, con = 96978527, dur = 126},Call {onpa = 221, obase = 2390199, dpna = 974, dbase = 4298199, con = 96980122, dur = 990},Call {onpa = 221, obase = 2390399, dpna = 855, dbase = 5404599, con = 96976885, dur = 35},Call {onpa = 222, obase = 2332099, dpna = 426, dbase = 6814599, con = 96977173, dur = 4850},Call {onpa = 222, obase = 2332099, dpna = -15, dbase = 9999999, con = 96978457, dur = 533},Call {onpa = 222, obase = 2340599, dpna = 855, dbase = 8442799, con = 96980047, dur = 8},Call {onpa = 222, obase = 2341299, dpna = 855, dbase = 7081599, con = 96979104, dur = 11},Call {onpa = 223, obase = 2340099, dpna = 855, dbase = 2484499, con = 96977739, dur = 564},Call {onpa = 223, obase = 2340199, dpna = -15, dbase = 9999999, con = 96979345, dur = 143}],0)
925
false
false
1
9
182
429
279
150
null
null
spinda/liquidhaskell
tests/gsoc15/unknown/pos/test00b.hs
bsd-3-clause
prop_abs = if x > 0 then baz (foo x) else False
47
prop_abs = if x > 0 then baz (foo x) else False
47
prop_abs = if x > 0 then baz (foo x) else False
47
false
false
0
8
11
27
14
13
null
null
haskellGardener/yusic
src/Yusic.hs
mit
--end Fs_Gb toKeyGuide (G:B:D :[]) = Just KG_GMajor
128
toKeyGuide (G:B:D :[]) = Just KG_GMajor
59
toKeyGuide (G:B:D :[]) = Just KG_GMajor
59
true
false
0
10
84
30
15
15
null
null
phunehehe/deepseq-bounded
src/Control/DeepSeq/Bounded/NFDataN.hs
bsd-3-clause
- As per DeepSeq: -- | the deep analogue of '$!'. In the expression @f $!! x@, @x@ is -- fully evaluated before the function @f@ is applied to it. ($!!) :: NFData a => (a -> b) -> a -> b f $!! x = x `deepseq` f x
222
($!!) :: NFData a => (a -> b) -> a -> b f $!! x = x `deepseq` f x
65
f $!! x = x `deepseq` f x
25
true
true
2
10
59
73
35
38
null
null
gnn/Hets
Common/IRI.hs
gpl-2.0
isAlphaNumChar :: Char -> Bool isAlphaNumChar c = isAlphaNum c && isAscii c
75
isAlphaNumChar :: Char -> Bool isAlphaNumChar c = isAlphaNum c && isAscii c
75
isAlphaNumChar c = isAlphaNum c && isAscii c
44
false
true
0
6
12
28
13
15
null
null
mariefarrell/Hets
Driver/Options.hs
gpl-2.0
-- | the suffix of env files prfSuffix :: String prfSuffix = '.' : prfS
71
prfSuffix :: String prfSuffix = '.' : prfS
42
prfSuffix = '.' : prfS
22
true
true
2
6
14
24
10
14
null
null
rleshchinskiy/vector
Data/Vector/Fusion/Bundle/Monadic.hs
bsd-3-clause
zipWith5M f sa sb sc sd se = zipWithM (\(a,b,c) (d,e) -> f a b c d e) (zip3 sa sb sc) (zip sd se)
99
zipWith5M f sa sb sc sd se = zipWithM (\(a,b,c) (d,e) -> f a b c d e) (zip3 sa sb sc) (zip sd se)
99
zipWith5M f sa sb sc sd se = zipWithM (\(a,b,c) (d,e) -> f a b c d e) (zip3 sa sb sc) (zip sd se)
99
false
false
0
8
26
80
42
38
null
null
rueshyna/gogol
gogol-youtube-analytics/gen/Network/Google/YouTubeAnalytics/Types.hs
mpl-2.0
-- | View monetary and non-monetary YouTube Analytics reports for your -- YouTube content youTubeAnalyticsMonetaryReadOnlyScope :: Proxy '["https://www.googleapis.com/auth/yt-analytics-monetary.readonly"] youTubeAnalyticsMonetaryReadOnlyScope = Proxy
250
youTubeAnalyticsMonetaryReadOnlyScope :: Proxy '["https://www.googleapis.com/auth/yt-analytics-monetary.readonly"] youTubeAnalyticsMonetaryReadOnlyScope = Proxy
160
youTubeAnalyticsMonetaryReadOnlyScope = Proxy
45
true
true
0
7
20
21
12
9
null
null
tphyahoo/happs-tutorial
src/Misc.hs
bsd-3-clause
timeSince x = do currTime <- getClockTime return . diffClockTimes currTime $ x -- splitList 3 [1..11] -- [([(1,1),(2,2),(3,3)],(1,3)),([(4,4),(5,5),(6,6)],(4,6)),([(7,7),(8,8),(9,9)],(7,9)),([(10,10),(11,11)],(10,11))] -- the result is a list of (indexed sublist,(fist index, last index))
293
timeSince x = do currTime <- getClockTime return . diffClockTimes currTime $ x -- splitList 3 [1..11] -- [([(1,1),(2,2),(3,3)],(1,3)),([(4,4),(5,5),(6,6)],(4,6)),([(7,7),(8,8),(9,9)],(7,9)),([(10,10),(11,11)],(10,11))] -- the result is a list of (indexed sublist,(fist index, last index))
293
timeSince x = do currTime <- getClockTime return . diffClockTimes currTime $ x -- splitList 3 [1..11] -- [([(1,1),(2,2),(3,3)],(1,3)),([(4,4),(5,5),(6,6)],(4,6)),([(7,7),(8,8),(9,9)],(7,9)),([(10,10),(11,11)],(10,11))] -- the result is a list of (indexed sublist,(fist index, last index))
293
false
false
1
9
35
37
16
21
null
null
iemxblog/sivi-haskell
src/Sivi/GCode/Base.hs
gpl-2.0
-- | Smart constructor for 'G00' g00 :: GCodeInstruction g00 = G00 Nothing Nothing Nothing
90
g00 :: GCodeInstruction g00 = G00 Nothing Nothing Nothing
57
g00 = G00 Nothing Nothing Nothing
33
true
true
0
6
14
25
11
14
null
null
katydid/haslapse
src/Data/Katydid/Relapse/Exprs/Compare.hs
bsd-3-clause
-- | -- neExpr creates a ne (not equal) expression that returns true if the two evaluated input expressions are not equal -- and both don't evaluate to an error. neExpr :: (Eq a) => Expr a -> Expr a -> Expr Bool neExpr a b = trimBool Expr { desc = mkDesc "ne" [desc a, desc b] , eval = \v -> ne (eval a v) (eval b v) }
324
neExpr :: (Eq a) => Expr a -> Expr a -> Expr Bool neExpr a b = trimBool Expr { desc = mkDesc "ne" [desc a, desc b] , eval = \v -> ne (eval a v) (eval b v) }
162
neExpr a b = trimBool Expr { desc = mkDesc "ne" [desc a, desc b] , eval = \v -> ne (eval a v) (eval b v) }
112
true
true
0
11
76
113
56
57
null
null
7lb/tsp-haskell
tsp.hs
mit
randomTour n = do rc <- randomCity rt <- randomTour (n - 1) return (rc : rt)
88
randomTour n = do rc <- randomCity rt <- randomTour (n - 1) return (rc : rt)
88
randomTour n = do rc <- randomCity rt <- randomTour (n - 1) return (rc : rt)
88
false
false
0
10
28
46
21
25
null
null
apyrgio/ganeti
src/Ganeti/HTools/Instance.hs
bsd-2-clause
-- | Check if instance is offline. isOffline :: Instance -> Bool isOffline (Instance {runSt = T.StatusOffline}) = True
118
isOffline :: Instance -> Bool isOffline (Instance {runSt = T.StatusOffline}) = True
83
isOffline (Instance {runSt = T.StatusOffline}) = True
53
true
true
0
10
18
33
18
15
null
null
wavewave/lhc-analysis-collection
heavyhiggs/MCRun_ttbarqcd.hs
gpl-3.0
-- | rsetup :: {- Double -> Int -> -} RunSetup rsetup {- sqrts n -} = RS { numevent = 10000 , machine = LHC14 ATLAS -- Parton (0.5*sqrts) ATLAS -- LHC14 ATLAS , rgrun = Auto , rgscale = 200.0 , match = MLM -- NoMatch , cut = DefCut -- NoCut -- DefCut , pythia = RunPYTHIA -- NoPYTHIA -- RunPYTHIA , lhesanitizer = [] , pgs = NoPGS -- RunPGS (Cone 0.4, WithTau) -- NoPGS , uploadhep = NoUploadHEP , setnum = 1 -- n }
518
rsetup :: {- Double -> Int -> -} RunSetup rsetup {- sqrts n -} = RS { numevent = 10000 , machine = LHC14 ATLAS -- Parton (0.5*sqrts) ATLAS -- LHC14 ATLAS , rgrun = Auto , rgscale = 200.0 , match = MLM -- NoMatch , cut = DefCut -- NoCut -- DefCut , pythia = RunPYTHIA -- NoPYTHIA -- RunPYTHIA , lhesanitizer = [] , pgs = NoPGS -- RunPGS (Cone 0.4, WithTau) -- NoPGS , uploadhep = NoUploadHEP , setnum = 1 -- n }
512
rsetup {- sqrts n -} = RS { numevent = 10000 , machine = LHC14 ATLAS -- Parton (0.5*sqrts) ATLAS -- LHC14 ATLAS , rgrun = Auto , rgscale = 200.0 , match = MLM -- NoMatch , cut = DefCut -- NoCut -- DefCut , pythia = RunPYTHIA -- NoPYTHIA -- RunPYTHIA , lhesanitizer = [] , pgs = NoPGS -- RunPGS (Cone 0.4, WithTau) -- NoPGS , uploadhep = NoUploadHEP , setnum = 1 -- n }
470
true
true
0
7
192
93
62
31
null
null
yjwen/hada
test/Num.hs
lgpl-3.0
le8 :: Int8 -> Int8 -> Bool le8 = (<=)
38
le8 :: Int8 -> Int8 -> Bool le8 = (<=)
38
le8 = (<=)
10
false
true
0
6
9
21
12
9
null
null
DavidAlphaFox/ghc
libraries/containers/Data/IntSet/Base.hs
bsd-3-clause
toList :: IntSet -> [Key] toList = toAscList
46
toList :: IntSet -> [Key] toList = toAscList
46
toList = toAscList
20
false
true
0
8
9
25
11
14
null
null
YLiLarry/parser241
src/Parser/ProductRule/Internal/Manager.hs
bsd-3-clause
addMakers :: [Maker a] -> Manager a -> Manager a addMakers ls m = m >> tell ls
78
addMakers :: [Maker a] -> Manager a -> Manager a addMakers ls m = m >> tell ls
78
addMakers ls m = m >> tell ls
29
false
true
0
7
17
43
20
23
null
null
thomie/cabal
cabal-install/Distribution/Client/Config.hs
bsd-3-clause
-- | Get the differences (as a pseudo code diff) between the user's -- '~/.cabal/config' and the one that cabal would generate if it didn't exist. userConfigDiff :: GlobalFlags -> IO [String] userConfigDiff globalFlags = do userConfig <- loadConfig normal (globalConfigFile globalFlags) testConfig <- liftM2 mappend baseSavedConfig initialSavedConfig return $ reverse . foldl' createDiff [] . M.toList $ M.unionWith combine (M.fromList . map justFst $ filterShow testConfig) (M.fromList . map justSnd $ filterShow userConfig) where justFst (a, b) = (a, (Just b, Nothing)) justSnd (a, b) = (a, (Nothing, Just b)) combine (Nothing, Just b) (Just a, Nothing) = (Just a, Just b) combine (Just a, Nothing) (Nothing, Just b) = (Just a, Just b) combine x y = error $ "Can't happen : userConfigDiff " ++ show x ++ " " ++ show y createDiff :: [String] -> (String, (Maybe String, Maybe String)) -> [String] createDiff acc (key, (Just a, Just b)) | a == b = acc | otherwise = ("+ " ++ key ++ ": " ++ b) : ("- " ++ key ++ ": " ++ a) : acc createDiff acc (key, (Nothing, Just b)) = ("+ " ++ key ++ ": " ++ b) : acc createDiff acc (key, (Just a, Nothing)) = ("- " ++ key ++ ": " ++ a) : acc createDiff acc (_, (Nothing, Nothing)) = acc filterShow :: SavedConfig -> [(String, String)] filterShow cfg = map keyValueSplit . filter (\s -> not (null s) && any (== ':') s) . map nonComment . lines $ showConfig cfg nonComment [] = [] nonComment ('-':'-':_) = [] nonComment (x:xs) = x : nonComment xs topAndTail = reverse . dropWhile isSpace . reverse . dropWhile isSpace keyValueSplit s = let (left, right) = break (== ':') s in (topAndTail left, topAndTail (drop 1 right)) -- | Update the user's ~/.cabal/config' keeping the user's customizations.
1,972
userConfigDiff :: GlobalFlags -> IO [String] userConfigDiff globalFlags = do userConfig <- loadConfig normal (globalConfigFile globalFlags) testConfig <- liftM2 mappend baseSavedConfig initialSavedConfig return $ reverse . foldl' createDiff [] . M.toList $ M.unionWith combine (M.fromList . map justFst $ filterShow testConfig) (M.fromList . map justSnd $ filterShow userConfig) where justFst (a, b) = (a, (Just b, Nothing)) justSnd (a, b) = (a, (Nothing, Just b)) combine (Nothing, Just b) (Just a, Nothing) = (Just a, Just b) combine (Just a, Nothing) (Nothing, Just b) = (Just a, Just b) combine x y = error $ "Can't happen : userConfigDiff " ++ show x ++ " " ++ show y createDiff :: [String] -> (String, (Maybe String, Maybe String)) -> [String] createDiff acc (key, (Just a, Just b)) | a == b = acc | otherwise = ("+ " ++ key ++ ": " ++ b) : ("- " ++ key ++ ": " ++ a) : acc createDiff acc (key, (Nothing, Just b)) = ("+ " ++ key ++ ": " ++ b) : acc createDiff acc (key, (Just a, Nothing)) = ("- " ++ key ++ ": " ++ a) : acc createDiff acc (_, (Nothing, Nothing)) = acc filterShow :: SavedConfig -> [(String, String)] filterShow cfg = map keyValueSplit . filter (\s -> not (null s) && any (== ':') s) . map nonComment . lines $ showConfig cfg nonComment [] = [] nonComment ('-':'-':_) = [] nonComment (x:xs) = x : nonComment xs topAndTail = reverse . dropWhile isSpace . reverse . dropWhile isSpace keyValueSplit s = let (left, right) = break (== ':') s in (topAndTail left, topAndTail (drop 1 right)) -- | Update the user's ~/.cabal/config' keeping the user's customizations.
1,825
userConfigDiff globalFlags = do userConfig <- loadConfig normal (globalConfigFile globalFlags) testConfig <- liftM2 mappend baseSavedConfig initialSavedConfig return $ reverse . foldl' createDiff [] . M.toList $ M.unionWith combine (M.fromList . map justFst $ filterShow testConfig) (M.fromList . map justSnd $ filterShow userConfig) where justFst (a, b) = (a, (Just b, Nothing)) justSnd (a, b) = (a, (Nothing, Just b)) combine (Nothing, Just b) (Just a, Nothing) = (Just a, Just b) combine (Just a, Nothing) (Nothing, Just b) = (Just a, Just b) combine x y = error $ "Can't happen : userConfigDiff " ++ show x ++ " " ++ show y createDiff :: [String] -> (String, (Maybe String, Maybe String)) -> [String] createDiff acc (key, (Just a, Just b)) | a == b = acc | otherwise = ("+ " ++ key ++ ": " ++ b) : ("- " ++ key ++ ": " ++ a) : acc createDiff acc (key, (Nothing, Just b)) = ("+ " ++ key ++ ": " ++ b) : acc createDiff acc (key, (Just a, Nothing)) = ("- " ++ key ++ ": " ++ a) : acc createDiff acc (_, (Nothing, Nothing)) = acc filterShow :: SavedConfig -> [(String, String)] filterShow cfg = map keyValueSplit . filter (\s -> not (null s) && any (== ':') s) . map nonComment . lines $ showConfig cfg nonComment [] = [] nonComment ('-':'-':_) = [] nonComment (x:xs) = x : nonComment xs topAndTail = reverse . dropWhile isSpace . reverse . dropWhile isSpace keyValueSplit s = let (left, right) = break (== ':') s in (topAndTail left, topAndTail (drop 1 right)) -- | Update the user's ~/.cabal/config' keeping the user's customizations.
1,780
true
true
19
12
554
806
395
411
null
null
plow-technologies/ircbrowse
src/Ircbrowse/Types/Import.hs
bsd-3-clause
-- | Pretty print a channel in a human-representation. prettyChan :: Channel -> String prettyChan Plowtech = "#plowtech"
120
prettyChan :: Channel -> String prettyChan Plowtech = "#plowtech"
65
prettyChan Plowtech = "#plowtech"
33
true
true
0
7
17
25
11
14
null
null
lhoghu/yahoo-portfolio-manager
src/Data/YahooPortfolioManager/DbAdapter.hs
mit
withConnection :: (Connection -> IO a) -> IO a withConnection f = do db <- dbFile conn <- connect db result <- f conn disconnect conn return result -------------------------------------------------------------------------------- {- Ensure the db exists with a minimal schema Also perform any checks on db integrity here -}
346
withConnection :: (Connection -> IO a) -> IO a withConnection f = do db <- dbFile conn <- connect db result <- f conn disconnect conn return result -------------------------------------------------------------------------------- {- Ensure the db exists with a minimal schema Also perform any checks on db integrity here -}
346
withConnection f = do db <- dbFile conn <- connect db result <- f conn disconnect conn return result -------------------------------------------------------------------------------- {- Ensure the db exists with a minimal schema Also perform any checks on db integrity here -}
299
false
true
0
8
70
72
32
40
null
null
meteficha/yesod
yesod-bin/main.hs
mit
defaultRescan :: Int defaultRescan = 10
39
defaultRescan :: Int defaultRescan = 10
39
defaultRescan = 10
18
false
true
0
4
5
11
6
5
null
null
Cahu/krpc-hs
src/KRPCHS/SpaceCenter.hs
gpl-3.0
getVesselMassStream :: KRPCHS.SpaceCenter.Vessel -> RPCContext (KRPCStream (Float)) getVesselMassStream thisArg = requestStream $ getVesselMassStreamReq thisArg
160
getVesselMassStream :: KRPCHS.SpaceCenter.Vessel -> RPCContext (KRPCStream (Float)) getVesselMassStream thisArg = requestStream $ getVesselMassStreamReq thisArg
160
getVesselMassStream thisArg = requestStream $ getVesselMassStreamReq thisArg
76
false
true
0
10
13
44
21
23
null
null
ghcjs/jsaddle-dom
src/JSDOM/Generated/HTMLTableElement.hs
mit
-- | <https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement.createTBody Mozilla HTMLTableElement.createTBody documentation> createTBody_ :: (MonadDOM m) => HTMLTableElement -> m () createTBody_ self = liftDOM (void (self ^. jsf "createTBody" ()))
259
createTBody_ :: (MonadDOM m) => HTMLTableElement -> m () createTBody_ self = liftDOM (void (self ^. jsf "createTBody" ()))
122
createTBody_ self = liftDOM (void (self ^. jsf "createTBody" ()))
65
true
true
0
11
25
56
28
28
null
null
MasseR/xmonadcontrib
XMonad/Prompt.hs
bsd-3-clause
mkComplFunFromList' l s = return $ filter (\x -> take (length s) x == s) l
76
mkComplFunFromList' l s = return $ filter (\x -> take (length s) x == s) l
76
mkComplFunFromList' l s = return $ filter (\x -> take (length s) x == s) l
76
false
false
0
12
17
43
21
22
null
null
Mahdi89/eTeak
src/ParseTree.hs
bsd-3-clause
exprPos (ExtendExpr pos _ _ _ _) = pos
38
exprPos (ExtendExpr pos _ _ _ _) = pos
38
exprPos (ExtendExpr pos _ _ _ _) = pos
38
false
false
0
7
8
23
11
12
null
null
AndrewRademacher/wai
warp/Network/Wai/Handler/Warp/MultiMap.hs
mit
insert' :: Ord k => k -> v -> MMap k v -> MMap k v insert' xk xv Leaf = Node R Leaf xk (One xv) Leaf
100
insert' :: Ord k => k -> v -> MMap k v -> MMap k v insert' xk xv Leaf = Node R Leaf xk (One xv) Leaf
100
insert' xk xv Leaf = Node R Leaf xk (One xv) Leaf
49
false
true
0
9
27
64
30
34
null
null
sfultong/stand-in-language
src/SIL/Parser.hs
apache-2.0
convertPT (TCompleteLam x) = completeLam (convertPT x)
54
convertPT (TCompleteLam x) = completeLam (convertPT x)
54
convertPT (TCompleteLam x) = completeLam (convertPT x)
54
false
false
0
7
6
24
11
13
null
null