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
cblp/crdt
crdt-test/test/Cv/TwoPSet.hs
bsd-3-clause
test_Cv = cvrdtLaws @(TwoPSet Char)
35
test_Cv = cvrdtLaws @(TwoPSet Char)
35
test_Cv = cvrdtLaws @(TwoPSet Char)
35
false
false
0
8
4
17
8
9
null
null
infotroph/pandoc
src/Text/Pandoc/Readers/LaTeX.hs
gpl-2.0
hacek 'H' = "Ȟ"
15
hacek 'H' = "Ȟ"
15
hacek 'H' = "Ȟ"
15
false
false
1
5
3
13
4
9
null
null
cdepillabout/haskell-github-updater
Main.hs
gpl-3.0
repoRemoteBranch _ = Nothing
28
repoRemoteBranch _ = Nothing
28
repoRemoteBranch _ = Nothing
28
false
false
0
5
3
9
4
5
null
null
SergeyKrivohatskiy/fp_haskell
hw08/Main.hs
mit
-- (0.5 балла) listP :: Parser Char a -> Parser Char [a] listP parserA = brackets (sepBy parserA (symbol ','))
110
listP :: Parser Char a -> Parser Char [a] listP parserA = brackets (sepBy parserA (symbol ','))
95
listP parserA = brackets (sepBy parserA (symbol ','))
53
true
true
0
9
19
49
24
25
null
null
MichielDerhaeg/stack
src/Stack/Build/ConstructPlan.hs
bsd-3-clause
checkDirtiness :: PackageSource -> Installed -> Package -> Map PackageIdentifier GhcPkgId -> Set PackageName -> M Bool checkDirtiness ps installed package present wanted = do ctx <- ask moldOpts <- runRIO ctx $ tryGetFlagCache installed let configOpts = configureOpts (view envConfigL ctx) (baseConfigOpts ctx) present (psLocal ps) (piiLocation ps) -- should be Local always package buildOpts = bcoBuildOpts (baseConfigOpts ctx) wantConfigCache = ConfigCache { configCacheOpts = configOpts , configCacheDeps = Set.fromList $ Map.elems present , configCacheComponents = case ps of PSFiles lp _ -> Set.map renderComponent $ lpComponents lp PSIndex{} -> Set.empty , configCacheHaddock = shouldHaddockPackage buildOpts wanted (packageName package) || -- Disabling haddocks when old config had haddocks doesn't make dirty. maybe False configCacheHaddock moldOpts , configCachePkgSrc = toCachePkgSrc ps } let mreason = case moldOpts of Nothing -> Just "old configure information not found" Just oldOpts | Just reason <- describeConfigDiff config oldOpts wantConfigCache -> Just reason | True <- psForceDirty ps -> Just "--force-dirty specified" | Just files <- psDirty ps -> Just $ "local file changes: " <> addEllipsis (T.pack $ unwords $ Set.toList files) | otherwise -> Nothing config = view configL ctx case mreason of Nothing -> return False Just reason -> do tell mempty { wDirty = Map.singleton (packageName package) reason } return True
2,026
checkDirtiness :: PackageSource -> Installed -> Package -> Map PackageIdentifier GhcPkgId -> Set PackageName -> M Bool checkDirtiness ps installed package present wanted = do ctx <- ask moldOpts <- runRIO ctx $ tryGetFlagCache installed let configOpts = configureOpts (view envConfigL ctx) (baseConfigOpts ctx) present (psLocal ps) (piiLocation ps) -- should be Local always package buildOpts = bcoBuildOpts (baseConfigOpts ctx) wantConfigCache = ConfigCache { configCacheOpts = configOpts , configCacheDeps = Set.fromList $ Map.elems present , configCacheComponents = case ps of PSFiles lp _ -> Set.map renderComponent $ lpComponents lp PSIndex{} -> Set.empty , configCacheHaddock = shouldHaddockPackage buildOpts wanted (packageName package) || -- Disabling haddocks when old config had haddocks doesn't make dirty. maybe False configCacheHaddock moldOpts , configCachePkgSrc = toCachePkgSrc ps } let mreason = case moldOpts of Nothing -> Just "old configure information not found" Just oldOpts | Just reason <- describeConfigDiff config oldOpts wantConfigCache -> Just reason | True <- psForceDirty ps -> Just "--force-dirty specified" | Just files <- psDirty ps -> Just $ "local file changes: " <> addEllipsis (T.pack $ unwords $ Set.toList files) | otherwise -> Nothing config = view configL ctx case mreason of Nothing -> return False Just reason -> do tell mempty { wDirty = Map.singleton (packageName package) reason } return True
2,026
checkDirtiness ps installed package present wanted = do ctx <- ask moldOpts <- runRIO ctx $ tryGetFlagCache installed let configOpts = configureOpts (view envConfigL ctx) (baseConfigOpts ctx) present (psLocal ps) (piiLocation ps) -- should be Local always package buildOpts = bcoBuildOpts (baseConfigOpts ctx) wantConfigCache = ConfigCache { configCacheOpts = configOpts , configCacheDeps = Set.fromList $ Map.elems present , configCacheComponents = case ps of PSFiles lp _ -> Set.map renderComponent $ lpComponents lp PSIndex{} -> Set.empty , configCacheHaddock = shouldHaddockPackage buildOpts wanted (packageName package) || -- Disabling haddocks when old config had haddocks doesn't make dirty. maybe False configCacheHaddock moldOpts , configCachePkgSrc = toCachePkgSrc ps } let mreason = case moldOpts of Nothing -> Just "old configure information not found" Just oldOpts | Just reason <- describeConfigDiff config oldOpts wantConfigCache -> Just reason | True <- psForceDirty ps -> Just "--force-dirty specified" | Just files <- psDirty ps -> Just $ "local file changes: " <> addEllipsis (T.pack $ unwords $ Set.toList files) | otherwise -> Nothing config = view configL ctx case mreason of Nothing -> return False Just reason -> do tell mempty { wDirty = Map.singleton (packageName package) reason } return True
1,832
false
true
0
19
798
453
214
239
null
null
olsner/ghc
compiler/main/HscTypes.hs
bsd-3-clause
-- | Get the PrintUnqualified function based on the flags and this InteractiveContext icPrintUnqual :: DynFlags -> InteractiveContext -> PrintUnqualified icPrintUnqual dflags InteractiveContext{ ic_rn_gbl_env = grenv } = mkPrintUnqualified dflags grenv
256
icPrintUnqual :: DynFlags -> InteractiveContext -> PrintUnqualified icPrintUnqual dflags InteractiveContext{ ic_rn_gbl_env = grenv } = mkPrintUnqualified dflags grenv
170
icPrintUnqual dflags InteractiveContext{ ic_rn_gbl_env = grenv } = mkPrintUnqualified dflags grenv
102
true
true
0
8
34
43
21
22
null
null
ezyang/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
stablePtrTyConKey = mkPreludeTyConUnique 36
65
stablePtrTyConKey = mkPreludeTyConUnique 36
65
stablePtrTyConKey = mkPreludeTyConUnique 36
65
false
false
0
5
25
9
4
5
null
null
nbloomf/hakyll-shortcode
src/Hakyll/Shortcode/Render.hs
gpl-3.0
-- | Helper function for rendering @Maybe@ 'Valid' parameters as path components. pathValid :: (Show t) => Maybe t -> String pathValid Nothing = ""
148
pathValid :: (Show t) => Maybe t -> String pathValid Nothing = ""
66
pathValid Nothing = ""
23
true
true
0
8
25
37
17
20
null
null
Mikolaj/miniutter
NLP/Miniutter/English.hs
bsd-3-clause
makeParts :: Irregular -> [Part] -> [Text] makeParts irr = filter (not . T.null) . map (makePart irr)
101
makeParts :: Irregular -> [Part] -> [Text] makeParts irr = filter (not . T.null) . map (makePart irr)
101
makeParts irr = filter (not . T.null) . map (makePart irr)
58
false
true
0
9
17
58
28
30
null
null
colin-adams/dragonfly-website
Dragonfly/ImageGallery/Exif.hs
gpl-3.0
-- | Interpretation of 'focalLength' focalLengthI :: String focalLengthI = "Focal length:"
91
focalLengthI :: String focalLengthI = "Focal length:"
54
focalLengthI = "Focal length:"
30
true
true
0
6
12
19
8
11
null
null
thielema/gitit
Network/Gitit/Export.hs
gpl-2.0
exportFormats :: Config -> [(String, String -> Pandoc -> Handler)] exportFormats cfg = if pdfExport cfg then ("PDF", respondPDF) : rest else rest where rest = [ ("LaTeX", respondLaTeX) -- (description, writer) , ("ConTeXt", respondConTeXt) , ("Texinfo", respondTexinfo) , ("reST", respondRST) , ("Markdown", respondMarkdown) , ("Plain text",respondPlain) , ("MediaWiki", respondMediaWiki) , ("Org-mode", respondOrg) , ("Textile", respondTextile) , ("AsciiDoc", respondAsciiDoc) , ("Man page", respondMan) , ("DocBook", respondDocbook) , ("DZSlides", respondSlides "dzslides" DZSlides) , ("Slidy", respondSlides "slidy" SlidySlides) , ("S5", respondSlides "s5" S5Slides) , ("EPUB", respondEPUB) , ("ODT", respondODT) , ("Docx", respondDocx) , ("RTF", respondRTF) ]
1,159
exportFormats :: Config -> [(String, String -> Pandoc -> Handler)] exportFormats cfg = if pdfExport cfg then ("PDF", respondPDF) : rest else rest where rest = [ ("LaTeX", respondLaTeX) -- (description, writer) , ("ConTeXt", respondConTeXt) , ("Texinfo", respondTexinfo) , ("reST", respondRST) , ("Markdown", respondMarkdown) , ("Plain text",respondPlain) , ("MediaWiki", respondMediaWiki) , ("Org-mode", respondOrg) , ("Textile", respondTextile) , ("AsciiDoc", respondAsciiDoc) , ("Man page", respondMan) , ("DocBook", respondDocbook) , ("DZSlides", respondSlides "dzslides" DZSlides) , ("Slidy", respondSlides "slidy" SlidySlides) , ("S5", respondSlides "s5" S5Slides) , ("EPUB", respondEPUB) , ("ODT", respondODT) , ("Docx", respondDocx) , ("RTF", respondRTF) ]
1,159
exportFormats cfg = if pdfExport cfg then ("PDF", respondPDF) : rest else rest where rest = [ ("LaTeX", respondLaTeX) -- (description, writer) , ("ConTeXt", respondConTeXt) , ("Texinfo", respondTexinfo) , ("reST", respondRST) , ("Markdown", respondMarkdown) , ("Plain text",respondPlain) , ("MediaWiki", respondMediaWiki) , ("Org-mode", respondOrg) , ("Textile", respondTextile) , ("AsciiDoc", respondAsciiDoc) , ("Man page", respondMan) , ("DocBook", respondDocbook) , ("DZSlides", respondSlides "dzslides" DZSlides) , ("Slidy", respondSlides "slidy" SlidySlides) , ("S5", respondSlides "s5" S5Slides) , ("EPUB", respondEPUB) , ("ODT", respondODT) , ("Docx", respondDocx) , ("RTF", respondRTF) ]
1,092
false
true
1
9
489
258
157
101
null
null
acamino/cis-194-2013
src/CIS194/Week02/LogAnalysis.hs
mit
parseNonErrorMessage :: MessageType -> [String] -> LogMessage parseNonErrorMessage messageType (ts:msg) = LogMessage messageType timestamp message where timestamp = read ts message = unwords msg
214
parseNonErrorMessage :: MessageType -> [String] -> LogMessage parseNonErrorMessage messageType (ts:msg) = LogMessage messageType timestamp message where timestamp = read ts message = unwords msg
214
parseNonErrorMessage messageType (ts:msg) = LogMessage messageType timestamp message where timestamp = read ts message = unwords msg
146
false
true
0
10
43
65
31
34
null
null
alexander-at-github/eta
compiler/ETA/Main/HscTypes.hs
bsd-3-clause
throwOneError :: MonadIO m => ErrMsg -> m ab throwOneError err = liftIO $ throwIO $ mkSrcErr $ unitBag err
106
throwOneError :: MonadIO m => ErrMsg -> m ab throwOneError err = liftIO $ throwIO $ mkSrcErr $ unitBag err
106
throwOneError err = liftIO $ throwIO $ mkSrcErr $ unitBag err
61
false
true
0
7
19
46
21
25
null
null
svanderbleek/elm-bot
src/Main.hs
bsd-3-clause
main :: IO () main = do args <- Sys.getArgs let port = read . head $ args Warp.run port (Slash.app handler)
122
main :: IO () main = do args <- Sys.getArgs let port = read . head $ args Warp.run port (Slash.app handler)
122
main = do args <- Sys.getArgs let port = read . head $ args Warp.run port (Slash.app handler)
108
false
true
0
11
36
60
28
32
null
null
johanneshilden/trombone
Trombone/Dispatch.hs
bsd-3-clause
strictRequestBody_ :: Request -> IO BS.ByteString strictRequestBody_ req = loop id where loop front = do bs <- requestBody req if BS.null bs then return $ L8.toStrict $ front LI.Empty else loop (front . LI.Chunk bs)
254
strictRequestBody_ :: Request -> IO BS.ByteString strictRequestBody_ req = loop id where loop front = do bs <- requestBody req if BS.null bs then return $ L8.toStrict $ front LI.Empty else loop (front . LI.Chunk bs)
254
strictRequestBody_ req = loop id where loop front = do bs <- requestBody req if BS.null bs then return $ L8.toStrict $ front LI.Empty else loop (front . LI.Chunk bs)
204
false
true
1
13
74
101
44
57
null
null
spechub/Hets
Comorphisms/Hs2HOLCFaux.hs
gpl-2.0
constFilter :: Term -> [Term] constFilter t = case t of IsaSign.Const _ _ -> [t] IsaSign.Abs _ x _ -> constFilter x IsaSign.App x y _ -> concatMap constFilter [x, y] IsaSign.If x y z _ -> concatMap constFilter [x, y, z] IsaSign.Case x ys -> concatMap constFilter $ x : map snd ys IsaSign.Let xs y -> concatMap constFilter $ y : map snd xs IsaSign.IsaEq x y -> concatMap constFilter [x, y] IsaSign.Tuplex xs _ -> concatMap constFilter xs _ -> [t]
454
constFilter :: Term -> [Term] constFilter t = case t of IsaSign.Const _ _ -> [t] IsaSign.Abs _ x _ -> constFilter x IsaSign.App x y _ -> concatMap constFilter [x, y] IsaSign.If x y z _ -> concatMap constFilter [x, y, z] IsaSign.Case x ys -> concatMap constFilter $ x : map snd ys IsaSign.Let xs y -> concatMap constFilter $ y : map snd xs IsaSign.IsaEq x y -> concatMap constFilter [x, y] IsaSign.Tuplex xs _ -> concatMap constFilter xs _ -> [t]
454
constFilter t = case t of IsaSign.Const _ _ -> [t] IsaSign.Abs _ x _ -> constFilter x IsaSign.App x y _ -> concatMap constFilter [x, y] IsaSign.If x y z _ -> concatMap constFilter [x, y, z] IsaSign.Case x ys -> concatMap constFilter $ x : map snd ys IsaSign.Let xs y -> concatMap constFilter $ y : map snd xs IsaSign.IsaEq x y -> concatMap constFilter [x, y] IsaSign.Tuplex xs _ -> concatMap constFilter xs _ -> [t]
424
false
true
0
10
93
231
110
121
null
null
lnunno/blaze-bootstrap3
Bootstrap3/CDN.hs
mit
ratchetJS = script noHtml ! src ratchetJSLink
45
ratchetJS = script noHtml ! src ratchetJSLink
45
ratchetJS = script noHtml ! src ratchetJSLink
45
false
false
1
6
6
19
7
12
null
null
emaphis/Haskell-Practice
testing-project/test/FindIdentifier_Test.hs
bsd-3-clause
borderCases = TestLabel "Border test cases" (TestList [ testEmpty, testNegCursor, testComment ])
97
borderCases = TestLabel "Border test cases" (TestList [ testEmpty, testNegCursor, testComment ])
97
borderCases = TestLabel "Border test cases" (TestList [ testEmpty, testNegCursor, testComment ])
97
false
false
0
8
12
26
14
12
null
null
brendanhay/gogol
gogol-people/gen/Network/Google/Resource/People/OtherContacts/Search.hs
mpl-2.0
-- | V1 error format. ocsXgafv :: Lens' OtherContactsSearch (Maybe Xgafv) ocsXgafv = lens _ocsXgafv (\ s a -> s{_ocsXgafv = a})
127
ocsXgafv :: Lens' OtherContactsSearch (Maybe Xgafv) ocsXgafv = lens _ocsXgafv (\ s a -> s{_ocsXgafv = a})
105
ocsXgafv = lens _ocsXgafv (\ s a -> s{_ocsXgafv = a})
53
true
true
1
9
21
50
25
25
null
null
naushadh/persistent
persistent/Database/Persist/Types/Base.hs
mit
fromPersistValueText PersistNull = Left "Unexpected null"
57
fromPersistValueText PersistNull = Left "Unexpected null"
57
fromPersistValueText PersistNull = Left "Unexpected null"
57
false
false
0
5
5
12
5
7
null
null
akru/haste-compiler
src/Data/JSTarget/Print.hs
bsd-3-clause
opParens Sub (Lit (LNum 0)) b = case b of BinOp _ _ _ -> " -(" .+. pp b .+. ")" _ -> " -" .+. pp b
118
opParens Sub (Lit (LNum 0)) b = case b of BinOp _ _ _ -> " -(" .+. pp b .+. ")" _ -> " -" .+. pp b
118
opParens Sub (Lit (LNum 0)) b = case b of BinOp _ _ _ -> " -(" .+. pp b .+. ")" _ -> " -" .+. pp b
118
false
false
5
9
48
58
30
28
null
null
fmapfmapfmap/amazonka
amazonka-storagegateway/gen/Network/AWS/StorageGateway/Types/Product.hs
mpl-2.0
-- | Undocumented member. vrpiVolumeARN :: Lens' VolumeRecoveryPointInfo (Maybe Text) vrpiVolumeARN = lens _vrpiVolumeARN (\ s a -> s{_vrpiVolumeARN = a})
154
vrpiVolumeARN :: Lens' VolumeRecoveryPointInfo (Maybe Text) vrpiVolumeARN = lens _vrpiVolumeARN (\ s a -> s{_vrpiVolumeARN = a})
128
vrpiVolumeARN = lens _vrpiVolumeARN (\ s a -> s{_vrpiVolumeARN = a})
68
true
true
0
9
20
46
25
21
null
null
dblia/elastic-rolling-restart
src/Elastic/RollingRestart/Utils/Curl.hs
mit
-- | Performs a PUT request, and returns the response code and body. curlPutString :: URLString -> [String] -> Maybe String -> IO (CurlCode, String) curlPutString = createRequest "PUT"
184
curlPutString :: URLString -> [String] -> Maybe String -> IO (CurlCode, String) curlPutString = createRequest "PUT"
115
curlPutString = createRequest "PUT"
35
true
true
0
10
28
47
23
24
null
null
Andrey-Sisoyev/PCLT-DB
Data/MyHelpers_.hs
lgpl-2.1
takeFromMap :: Ord k => k -> Map k a -> (Maybe a, Map k a) takeFromMap k m = let mb_a = M.lookup k m in ( mb_a , case isJust mb_a of True -> M.delete k m False -> m )
244
takeFromMap :: Ord k => k -> Map k a -> (Maybe a, Map k a) takeFromMap k m = let mb_a = M.lookup k m in ( mb_a , case isJust mb_a of True -> M.delete k m False -> m )
244
takeFromMap k m = let mb_a = M.lookup k m in ( mb_a , case isJust mb_a of True -> M.delete k m False -> m )
185
false
true
0
13
120
106
49
57
null
null
rueshyna/gogol
gogol-gmail/gen/Network/Google/Gmail/Types.hs
mpl-2.0
-- | View your emails messages and settings gmailReadOnlyScope :: Proxy '["https://www.googleapis.com/auth/gmail.readonly"] gmailReadOnlyScope = Proxy
150
gmailReadOnlyScope :: Proxy '["https://www.googleapis.com/auth/gmail.readonly"] gmailReadOnlyScope = Proxy
106
gmailReadOnlyScope = Proxy
26
true
true
0
7
14
20
11
9
null
null
oakfang/DemiLang
src/Demi/VM.hs
mit
enrichState state (p:ps) (v:vs) = enrichState (Map.insert p v state) ps vs
74
enrichState state (p:ps) (v:vs) = enrichState (Map.insert p v state) ps vs
74
enrichState state (p:ps) (v:vs) = enrichState (Map.insert p v state) ps vs
74
false
false
0
8
11
46
23
23
null
null
GaloisInc/halvm-ghc
compiler/hsSyn/HsDecls.hs
bsd-3-clause
isTypeFamilyDecl _ = False
26
isTypeFamilyDecl _ = False
26
isTypeFamilyDecl _ = False
26
false
false
0
5
3
9
4
5
null
null
spechub/Hets
OWL2/ProvePellet.hs
gpl-2.0
pelletEnv :: String pelletEnv = "PELLET_PATH"
45
pelletEnv :: String pelletEnv = "PELLET_PATH"
45
pelletEnv = "PELLET_PATH"
25
false
true
0
4
5
11
6
5
null
null
brendanhay/gogol
gogol-gmail/gen/Network/Google/Resource/Gmail/Users/Settings/SendAs/Get.hs
mpl-2.0
-- | JSONP ussagCallback :: Lens' UsersSettingsSendAsGet (Maybe Text) ussagCallback = lens _ussagCallback (\ s a -> s{_ussagCallback = a})
146
ussagCallback :: Lens' UsersSettingsSendAsGet (Maybe Text) ussagCallback = lens _ussagCallback (\ s a -> s{_ussagCallback = a})
135
ussagCallback = lens _ussagCallback (\ s a -> s{_ussagCallback = a})
76
true
true
0
9
27
48
25
23
null
null
zepto-lang/zepto-js
src/Zepto/Types.hs
gpl-2.0
typeString (Cont _) = "continuation"
36
typeString (Cont _) = "continuation"
36
typeString (Cont _) = "continuation"
36
false
false
0
6
4
16
7
9
null
null
crockeo/netwire-vinyl
src/Input.hs
mit
isMouseButtonDown :: Monoid e => MouseButton -> Wire s e IO a Bool isMouseButtonDown b = pure True . mouseButtonDown b <|> pure False
156
isMouseButtonDown :: Monoid e => MouseButton -> Wire s e IO a Bool isMouseButtonDown b = pure True . mouseButtonDown b <|> pure False
156
isMouseButtonDown b = pure True . mouseButtonDown b <|> pure False
89
false
true
0
7
46
53
24
29
null
null
qwertzdarth/lsys
src/Main.hs
bsd-3-clause
main :: IO () main = putStrLn "hello world"
43
main :: IO () main = putStrLn "hello world"
43
main = putStrLn "hello world"
29
false
true
0
6
8
19
9
10
null
null
uduki/hsQt
Qtc/Core/QDate.hs
bsd-2-clause
day :: QDate a -> (()) -> IO (Int) day x0 () = withIntResult $ withObjectPtr x0 $ \cobj_x0 -> qtc_QDate_day cobj_x0
125
day :: QDate a -> (()) -> IO (Int) day x0 () = withIntResult $ withObjectPtr x0 $ \cobj_x0 -> qtc_QDate_day cobj_x0
125
day x0 () = withIntResult $ withObjectPtr x0 $ \cobj_x0 -> qtc_QDate_day cobj_x0
90
false
true
0
8
31
63
30
33
null
null
kojiromike/Idris-dev
src/Idris/Core/CaseTree.hs
bsd-3-clause
order :: Phase -> [(Name, Bool)] -> [Clause] -> [Bool] -> ([Name], [Clause]) -- do nothing at compile time: FIXME (EB): Put this in after checking -- implications for Franck's reflection work... see issue 3233 -- order CompileTime ns cs _ = (map fst ns, cs) order _ [] cs cans = ([], cs)
288
order :: Phase -> [(Name, Bool)] -> [Clause] -> [Bool] -> ([Name], [Clause]) order _ [] cs cans = ([], cs)
107
order _ [] cs cans = ([], cs)
30
true
true
0
12
54
82
46
36
null
null
olsner/ghc
compiler/nativeGen/X86/CodeGen.hs
bsd-3-clause
is32BitLit :: Bool -> CmmLit -> Bool is32BitLit is32Bit (CmmInt i W64) | not is32Bit = -- assume that labels are in the range 0-2^31-1: this assumes the -- small memory model (see gcc docs, -mcmodel=small). is32BitInteger i
240
is32BitLit :: Bool -> CmmLit -> Bool is32BitLit is32Bit (CmmInt i W64) | not is32Bit = -- assume that labels are in the range 0-2^31-1: this assumes the -- small memory model (see gcc docs, -mcmodel=small). is32BitInteger i
240
is32BitLit is32Bit (CmmInt i W64) | not is32Bit = -- assume that labels are in the range 0-2^31-1: this assumes the -- small memory model (see gcc docs, -mcmodel=small). is32BitInteger i
203
false
true
0
10
54
52
23
29
null
null
naushadh/persistent
persistent-postgresql/test/main.hs
mit
setup :: MonadIO m => Migration -> ReaderT SqlBackend m () setup migration = do printMigration migration runMigrationUnsafe migration
137
setup :: MonadIO m => Migration -> ReaderT SqlBackend m () setup migration = do printMigration migration runMigrationUnsafe migration
137
setup migration = do printMigration migration runMigrationUnsafe migration
78
false
true
0
9
22
51
21
30
null
null
graninas/Andromeda
src/Andromeda/Types/Hardware/Device.hs
bsd-3-clause
getDeviceId :: Device -> DeviceId getDeviceId (DeviceImpl dId _) = dId
70
getDeviceId :: Device -> DeviceId getDeviceId (DeviceImpl dId _) = dId
70
getDeviceId (DeviceImpl dId _) = dId
36
false
true
0
6
10
30
14
16
null
null
akru/nlp-opus
src/bin/MultiUNExtract.hs
mit
extract :: FilePath -> [(Lang, FilePath)] -> IO () extract fileName input = do files <- map (sort . dotsFilter) <$> mapM getDirectoryContents dirs c <- extract' Set.empty files save (fileName ++ ".gz") c where dirs = map snd input extract' acc ([] : _) = return acc extract' acc ((x : xs) : ys) | x =~ filePattern && all (elem x) ys = do putStr $ "Loading " ++ x ++ "..." c <- try $ parseRaw $ map (fmap (\d -> d </> x)) input case c of Right corpus -> do putStrLn $ show $ Set.size corpus extract' (acc `Set.union` corpus) (xs : ys) Left e -> do putStrLn $ show (e :: ErrorCall) extract' acc (xs : ys) | otherwise = do putStrLn $ "No parallel for " ++ x extract' acc (xs : ys)
912
extract :: FilePath -> [(Lang, FilePath)] -> IO () extract fileName input = do files <- map (sort . dotsFilter) <$> mapM getDirectoryContents dirs c <- extract' Set.empty files save (fileName ++ ".gz") c where dirs = map snd input extract' acc ([] : _) = return acc extract' acc ((x : xs) : ys) | x =~ filePattern && all (elem x) ys = do putStr $ "Loading " ++ x ++ "..." c <- try $ parseRaw $ map (fmap (\d -> d </> x)) input case c of Right corpus -> do putStrLn $ show $ Set.size corpus extract' (acc `Set.union` corpus) (xs : ys) Left e -> do putStrLn $ show (e :: ErrorCall) extract' acc (xs : ys) | otherwise = do putStrLn $ "No parallel for " ++ x extract' acc (xs : ys)
912
extract fileName input = do files <- map (sort . dotsFilter) <$> mapM getDirectoryContents dirs c <- extract' Set.empty files save (fileName ++ ".gz") c where dirs = map snd input extract' acc ([] : _) = return acc extract' acc ((x : xs) : ys) | x =~ filePattern && all (elem x) ys = do putStr $ "Loading " ++ x ++ "..." c <- try $ parseRaw $ map (fmap (\d -> d </> x)) input case c of Right corpus -> do putStrLn $ show $ Set.size corpus extract' (acc `Set.union` corpus) (xs : ys) Left e -> do putStrLn $ show (e :: ErrorCall) extract' acc (xs : ys) | otherwise = do putStrLn $ "No parallel for " ++ x extract' acc (xs : ys)
861
false
true
2
17
374
371
176
195
null
null
lukexi/bindings-Oculus
test/case2/Main.hs
apache-2.0
genColorFrameBuffer tex width height = do traceIO $ "tex size = " ++ (show (width,height)) !fbo <- genObjectName :: IO FramebufferObject bindFramebuffer Framebuffer $= fbo !rbo <- genObjectName :: IO RenderbufferObject bindRenderbuffer Renderbuffer $= rbo renderbufferStorage Renderbuffer DepthComponent' (RenderbufferSize width height) framebufferRenderbuffer Framebuffer DepthAttachment Renderbuffer rbo framebufferTexture2D Framebuffer (ColorAttachment 0) Texture2D tex 0 drawBuffers $= [FBOColorAttachment 0] -- unbind bindRenderbuffer Renderbuffer $= noRenderbufferObject bindFramebuffer Framebuffer $= defaultFramebufferObject return fbo
699
genColorFrameBuffer tex width height = do traceIO $ "tex size = " ++ (show (width,height)) !fbo <- genObjectName :: IO FramebufferObject bindFramebuffer Framebuffer $= fbo !rbo <- genObjectName :: IO RenderbufferObject bindRenderbuffer Renderbuffer $= rbo renderbufferStorage Renderbuffer DepthComponent' (RenderbufferSize width height) framebufferRenderbuffer Framebuffer DepthAttachment Renderbuffer rbo framebufferTexture2D Framebuffer (ColorAttachment 0) Texture2D tex 0 drawBuffers $= [FBOColorAttachment 0] -- unbind bindRenderbuffer Renderbuffer $= noRenderbufferObject bindFramebuffer Framebuffer $= defaultFramebufferObject return fbo
699
genColorFrameBuffer tex width height = do traceIO $ "tex size = " ++ (show (width,height)) !fbo <- genObjectName :: IO FramebufferObject bindFramebuffer Framebuffer $= fbo !rbo <- genObjectName :: IO RenderbufferObject bindRenderbuffer Renderbuffer $= rbo renderbufferStorage Renderbuffer DepthComponent' (RenderbufferSize width height) framebufferRenderbuffer Framebuffer DepthAttachment Renderbuffer rbo framebufferTexture2D Framebuffer (ColorAttachment 0) Texture2D tex 0 drawBuffers $= [FBOColorAttachment 0] -- unbind bindRenderbuffer Renderbuffer $= noRenderbufferObject bindFramebuffer Framebuffer $= defaultFramebufferObject return fbo
699
false
false
0
10
124
174
77
97
null
null
dfordivam/lava
Lava/Property.hs
bsd-3-clause
zipWith7' f xs ys zs vs [] ps qs = zipWith7' f xs ys zs vs ["?"] ps qs
98
zipWith7' f xs ys zs vs [] ps qs = zipWith7' f xs ys zs vs ["?"] ps qs
98
zipWith7' f xs ys zs vs [] ps qs = zipWith7' f xs ys zs vs ["?"] ps qs
98
false
false
0
6
46
50
22
28
null
null
dysinger/amazonka
amazonka-codedeploy/gen/Network/AWS/CodeDeploy/Types.hs
mpl-2.0
-- | The minimum healthy instances type: -- -- HOST_COUNT: The minimum number of healthy instances, as an absolute value. FLEET_PERCENT: The minimum number of healthy instances, as a percentage of the total number of instances in the deployment. -- For example, for 9 Amazon EC2 instances, if a HOST_COUNT of 6 is specified, -- deploy to up to 3 instances at a time. The deployment succeeds if 6 or more -- instances are successfully deployed to; otherwise, the deployment fails. If a -- FLEET_PERCENT of 40 is specified, deploy to up to 5 instances at a time. The -- deployment succeeds if 4 or more instances are successfully deployed to; -- otherwise, the deployment fails. -- -- In a call to the get deployment configuration operation, -- CodeDeployDefault.OneAtATime will return a minimum healthy instances type of -- MOST_CONCURRENCY and a value of 1. This means a deployment to only one Amazon -- EC2 instance at a time. (You cannot set the type to MOST_CONCURRENCY, only to -- HOST_COUNT or FLEET_PERCENT.) mhhType :: Lens' MinimumHealthyHosts (Maybe MinimumHealthyHostsType) mhhType = lens _mhhType (\s a -> s { _mhhType = a })
1,136
mhhType :: Lens' MinimumHealthyHosts (Maybe MinimumHealthyHostsType) mhhType = lens _mhhType (\s a -> s { _mhhType = a })
121
mhhType = lens _mhhType (\s a -> s { _mhhType = a })
52
true
true
1
9
189
66
39
27
null
null
bamboo/idris-cil
src/IRTS/CodegenCil.hs
bsd-3-clause
emit (SCon _ 1 n [v]) | n == maybeJust = load v
50
emit (SCon _ 1 n [v]) | n == maybeJust = load v
50
emit (SCon _ 1 n [v]) | n == maybeJust = load v
50
false
false
0
8
15
37
17
20
null
null
ghcjs/jsaddle-dom
src/JSDOM/Generated/SVGStyleElement.hs
mit
-- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGStyleElement.title Mozilla SVGStyleElement.title documentation> getTitle :: (MonadDOM m, FromJSString result) => SVGStyleElement -> m result getTitle self = liftDOM ((self ^. js "title") >>= fromJSValUnchecked)
280
getTitle :: (MonadDOM m, FromJSString result) => SVGStyleElement -> m result getTitle self = liftDOM ((self ^. js "title") >>= fromJSValUnchecked)
157
getTitle self = liftDOM ((self ^. js "title") >>= fromJSValUnchecked)
71
true
true
0
10
38
62
30
32
null
null
zenhack/haskell-capnp
lib/Data/Mutable.hs
mit
create :: Thaw a => (forall s. ST s (Mutable s a)) -> a create st = runST (st >>= unsafeFreeze)
95
create :: Thaw a => (forall s. ST s (Mutable s a)) -> a create st = runST (st >>= unsafeFreeze)
95
create st = runST (st >>= unsafeFreeze)
39
false
true
0
12
20
61
29
32
null
null
kyren/hsgb
lib/Gameboy/Assembler.hs
unlicense
cpl :: Parsec String st Instruction cpl = string "CPL" >> return CPL
68
cpl :: Parsec String st Instruction cpl = string "CPL" >> return CPL
68
cpl = string "CPL" >> return CPL
32
false
true
0
6
12
28
13
15
null
null
ibraimgm/learn-haskell
src/StackTransformer.hs
bsd-3-clause
peek :: StatefulStack Int peek = do (x:xs) <- get liftIO . putStrLn $ ">> Peeking the value " ++ (show x) return x -- manipulate the stack
145
peek :: StatefulStack Int peek = do (x:xs) <- get liftIO . putStrLn $ ">> Peeking the value " ++ (show x) return x -- manipulate the stack
145
peek = do (x:xs) <- get liftIO . putStrLn $ ">> Peeking the value " ++ (show x) return x -- manipulate the stack
119
false
true
0
9
34
56
27
29
null
null
nikai3d/ce-challenges
moderate/pass_triangle.hs
bsd-3-clause
passtriangle xss = passtriangle (passdown xs (head xs + head ys : tail ys) : zss) where xs = head xss ys = head (tail xss) zss = tail (tail xss)
213
passtriangle xss = passtriangle (passdown xs (head xs + head ys : tail ys) : zss) where xs = head xss ys = head (tail xss) zss = tail (tail xss)
213
passtriangle xss = passtriangle (passdown xs (head xs + head ys : tail ys) : zss) where xs = head xss ys = head (tail xss) zss = tail (tail xss)
213
false
false
0
12
99
82
39
43
null
null
rabipelais/cloudpoint
src/Features.hs
mit
convexFeature :: Vector Point -> Feature convexFeature ps = CH a v where a = _area ch v = _volume ch ch = convexHull ps -- | Compare two histograms, only if they have the same number of bins -- using the mean square error
236
convexFeature :: Vector Point -> Feature convexFeature ps = CH a v where a = _area ch v = _volume ch ch = convexHull ps -- | Compare two histograms, only if they have the same number of bins -- using the mean square error
236
convexFeature ps = CH a v where a = _area ch v = _volume ch ch = convexHull ps -- | Compare two histograms, only if they have the same number of bins -- using the mean square error
195
false
true
3
7
59
70
28
42
null
null
sdiehl/ghc
compiler/GHC/CmmToC.hs
bsd-3-clause
te_Stmt :: CmmNode e x -> TE () te_Stmt (CmmAssign r e) = te_Reg r >> te_Expr e
87
te_Stmt :: CmmNode e x -> TE () te_Stmt (CmmAssign r e) = te_Reg r >> te_Expr e
87
te_Stmt (CmmAssign r e) = te_Reg r >> te_Expr e
55
false
true
0
7
25
46
21
25
null
null
geraldus/yesod
yesod-core/src/Yesod/Core/Handler.hs
mit
-- | Bypass remaining handler code and output the given content with the given -- status code. sendResponseStatus :: (MonadHandler m, ToTypedContent c) => H.Status -> c -> m a sendResponseStatus s = handlerError . HCContent s . toTypedContent
242
sendResponseStatus :: (MonadHandler m, ToTypedContent c) => H.Status -> c -> m a sendResponseStatus s = handlerError . HCContent s . toTypedContent
147
sendResponseStatus s = handlerError . HCContent s . toTypedContent
66
true
true
0
8
38
55
28
27
null
null
jprider63/yesod
yesod-core/Yesod/Core/Handler.hs
mit
-- | Get a unique identifier. newIdent :: MonadHandler m => m Text newIdent = do x <- get let i' = ghsIdent x + 1 put x { ghsIdent = i' } return $ T.pack $ "hident" ++ show i' -- | Redirect to a POST resource. -- -- This is not technically a redirect; instead, it returns an HTML page with a -- POST form, and some Javascript to automatically submit the form. This can be -- useful when you need to post a plain link somewhere that needs to cause -- changes on the server.
489
newIdent :: MonadHandler m => m Text newIdent = do x <- get let i' = ghsIdent x + 1 put x { ghsIdent = i' } return $ T.pack $ "hident" ++ show i' -- | Redirect to a POST resource. -- -- This is not technically a redirect; instead, it returns an HTML page with a -- POST form, and some Javascript to automatically submit the form. This can be -- useful when you need to post a plain link somewhere that needs to cause -- changes on the server.
459
newIdent = do x <- get let i' = ghsIdent x + 1 put x { ghsIdent = i' } return $ T.pack $ "hident" ++ show i' -- | Redirect to a POST resource. -- -- This is not technically a redirect; instead, it returns an HTML page with a -- POST form, and some Javascript to automatically submit the form. This can be -- useful when you need to post a plain link somewhere that needs to cause -- changes on the server.
422
true
true
0
11
114
85
43
42
null
null
Jubobs/CommonMark-WIP
src/CommonMark/Util/Char.hs
bsd-3-clause
-- | Selects alphabetic ASCII characters. isAsciiLetter :: Char -> Bool isAsciiLetter c = isAscii c && isLetter c
113
isAsciiLetter :: Char -> Bool isAsciiLetter c = isAscii c && isLetter c
71
isAsciiLetter c = isAscii c && isLetter c
41
true
true
0
6
18
29
14
15
null
null
c0deaddict/project-euler
src/Part1/Problem17.hs
bsd-3-clause
numberLetters 90 = "ninety"
27
numberLetters 90 = "ninety"
27
numberLetters 90 = "ninety"
27
false
false
0
5
3
9
4
5
null
null
bitemyapp/Haskmon
src/Haskmon/Client.hs
mit
-- | Get an ability by ID getAbilityById :: ID -> IO Ability getAbilityById = getResourceById "ability" . show
110
getAbilityById :: ID -> IO Ability getAbilityById = getResourceById "ability" . show
84
getAbilityById = getResourceById "ability" . show
49
true
true
0
6
18
26
13
13
null
null
tedkornish/stack
src/Stack/Build/ConstructPlan.hs
bsd-3-clause
stripLocals :: Plan -> Plan stripLocals plan = plan { planTasks = Map.filter checkTask $ planTasks plan , planFinals = Map.empty , planUnregisterLocal = Map.empty , planInstallExes = Map.filter (/= Local) $ planInstallExes plan } where checkTask task = case taskType task of TTLocal _ -> False TTUpstream _ Local -> False TTUpstream _ Snap -> True
417
stripLocals :: Plan -> Plan stripLocals plan = plan { planTasks = Map.filter checkTask $ planTasks plan , planFinals = Map.empty , planUnregisterLocal = Map.empty , planInstallExes = Map.filter (/= Local) $ planInstallExes plan } where checkTask task = case taskType task of TTLocal _ -> False TTUpstream _ Local -> False TTUpstream _ Snap -> True
417
stripLocals plan = plan { planTasks = Map.filter checkTask $ planTasks plan , planFinals = Map.empty , planUnregisterLocal = Map.empty , planInstallExes = Map.filter (/= Local) $ planInstallExes plan } where checkTask task = case taskType task of TTLocal _ -> False TTUpstream _ Local -> False TTUpstream _ Snap -> True
389
false
true
1
9
126
137
65
72
null
null
jonpetterbergman/wai-snap
src/Snap/Internal/Parsing.hs
bsd-3-clause
------------------------------------------------------------------------------ generateFS :: (Word8 -> Bool) -> FastSet generateFS f = FS.fromList $ filter f [0..255]
166
generateFS :: (Word8 -> Bool) -> FastSet generateFS f = FS.fromList $ filter f [0..255]
87
generateFS f = FS.fromList $ filter f [0..255]
46
true
true
0
7
15
42
22
20
null
null
ghcjs/jsaddle-dom
src/JSDOM/Generated/SVGNumberList.hs
mit
-- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGNumberList.removeItem Mozilla SVGNumberList.removeItem documentation> removeItem_ :: (MonadDOM m) => SVGNumberList -> Word -> m () removeItem_ self index = liftDOM (void (self ^. jsf "removeItem" [toJSVal index]))
274
removeItem_ :: (MonadDOM m) => SVGNumberList -> Word -> m () removeItem_ self index = liftDOM (void (self ^. jsf "removeItem" [toJSVal index]))
145
removeItem_ self index = liftDOM (void (self ^. jsf "removeItem" [toJSVal index]))
84
true
true
0
12
31
66
33
33
null
null
glguy/advent2015
Day19.hs
isc
generate :: Ix i => (i,i) -> (i -> e) -> Array i e generate bnd f = array bnd [ (i, f i) | i <- range bnd ]
107
generate :: Ix i => (i,i) -> (i -> e) -> Array i e generate bnd f = array bnd [ (i, f i) | i <- range bnd ]
107
generate bnd f = array bnd [ (i, f i) | i <- range bnd ]
56
false
true
0
10
29
82
40
42
null
null
a143753/AOJ
1006.hs
apache-2.0
merge (a:b:s) = merge ((mg a b):s)
34
merge (a:b:s) = merge ((mg a b):s)
34
merge (a:b:s) = merge ((mg a b):s)
34
false
false
0
9
6
39
19
20
null
null
rjw57/cloudsync
cs/Main/Command/AddObject.hs
mit
-- |Default option values defaultOptions :: IO Options defaultOptions = do cwd <- getCurrentDirectory return Options { optHelp = False , optCabinetDir = cwd } -- |Available command line options
232
defaultOptions :: IO Options defaultOptions = do cwd <- getCurrentDirectory return Options { optHelp = False , optCabinetDir = cwd } -- |Available command line options
206
defaultOptions = do cwd <- getCurrentDirectory return Options { optHelp = False , optCabinetDir = cwd } -- |Available command line options
177
true
true
0
10
68
49
24
25
null
null
brendanhay/gogol
gogol-monitoring/gen/Network/Google/Monitoring/Types/Product.hs
mpl-2.0
-- | A distribution value. tvDistributionValue :: Lens' TypedValue (Maybe Distribution) tvDistributionValue = lens _tvDistributionValue (\ s a -> s{_tvDistributionValue = a})
182
tvDistributionValue :: Lens' TypedValue (Maybe Distribution) tvDistributionValue = lens _tvDistributionValue (\ s a -> s{_tvDistributionValue = a})
155
tvDistributionValue = lens _tvDistributionValue (\ s a -> s{_tvDistributionValue = a})
94
true
true
0
8
29
49
25
24
null
null
svalaskevicius/hob
src/lib/Hob/Command/FindText.hs
gpl-3.0
searchNextCommandHandler :: CommandHandler searchNextCommandHandler = CommandHandler Nothing searchNext
103
searchNextCommandHandler :: CommandHandler searchNextCommandHandler = CommandHandler Nothing searchNext
103
searchNextCommandHandler = CommandHandler Nothing searchNext
60
false
true
0
5
7
16
8
8
null
null
jmgimeno/haskell-playground
src/Zippers/comonadic-life-in-a-torus.hs
unlicense
neighbours :: [Z a -> Z a] neighbours = horiz ++ vert ++ liftM2 (.) horiz vert where horiz = [left, right] vert = [up, down]
148
neighbours :: [Z a -> Z a] neighbours = horiz ++ vert ++ liftM2 (.) horiz vert where horiz = [left, right] vert = [up, down]
147
neighbours = horiz ++ vert ++ liftM2 (.) horiz vert where horiz = [left, right] vert = [up, down]
120
false
true
0
7
49
65
36
29
null
null
jmacmahon/syllabify
Linguisticks/Parser.hs
agpl-3.0
-- Convenience functions for the parser and representations parseSyllables :: String -> Either ParseError Syllables parseSyllables s = runParser (maybeP syllables) zeroState "" s
178
parseSyllables :: String -> Either ParseError Syllables parseSyllables s = runParser (maybeP syllables) zeroState "" s
118
parseSyllables s = runParser (maybeP syllables) zeroState "" s
62
true
true
0
7
23
44
20
24
null
null
rahulmutt/codec-jvm
src/Codec/JVM/ASM/Code.hs
apache-2.0
new ft@(ArrayType ftInner) = mkCode cs $ fold [ IT.op OP.anewarray , IT.ix c , modifyStack $ CF.push ft . CF.pop jint ] where c = fromJust $ getObjConst ftInner cs = CP.unpack c
193
new ft@(ArrayType ftInner) = mkCode cs $ fold [ IT.op OP.anewarray , IT.ix c , modifyStack $ CF.push ft . CF.pop jint ] where c = fromJust $ getObjConst ftInner cs = CP.unpack c
193
new ft@(ArrayType ftInner) = mkCode cs $ fold [ IT.op OP.anewarray , IT.ix c , modifyStack $ CF.push ft . CF.pop jint ] where c = fromJust $ getObjConst ftInner cs = CP.unpack c
193
false
false
4
9
49
99
44
55
null
null
alexander-at-github/eta
compiler/ETA/TypeCheck/TcGenDeriv.hs
bsd-3-clause
gen_Read_binds :: (Name -> Fixity) -> SrcSpan -> TyCon -> (LHsBinds RdrName, BagDerivStuff) gen_Read_binds get_fixity loc tycon = (listToBag [read_prec, default_readlist, default_readlistprec], emptyBag) where ----------------------------------------------------------------------- default_readlist = mkHsVarBind loc readList_RDR (nlHsVar readListDefault_RDR) default_readlistprec = mkHsVarBind loc readListPrec_RDR (nlHsVar readListPrecDefault_RDR) ----------------------------------------------------------------------- data_cons = tyConDataCons tycon (nullary_cons, non_nullary_cons) = partition isNullarySrcDataCon data_cons read_prec = mkHsVarBind loc readPrec_RDR (nlHsApp (nlHsVar parens_RDR) read_cons) read_cons | null data_cons = nlHsVar pfail_RDR -- See Note [Read for empty data types] | otherwise = foldr1 mk_alt (read_nullary_cons ++ read_non_nullary_cons) read_non_nullary_cons = map read_non_nullary_con non_nullary_cons read_nullary_cons = case nullary_cons of [] -> [] [con] -> [nlHsDo DoExpr (match_con con ++ [noLoc $ mkLastStmt (result_expr con [])])] _ -> [nlHsApp (nlHsVar choose_RDR) (nlList (map mk_pair nullary_cons))] -- NB For operators the parens around (:=:) are matched by the -- enclosing "parens" call, so here we must match the naked -- data_con_str con match_con con | isSym con_str = [symbol_pat con_str] | otherwise = ident_h_pat con_str where con_str = data_con_str con -- For nullary constructors we must match Ident s for normal constrs -- and Symbol s for operators mk_pair con = mkLHsTupleExpr [nlHsLit (mkHsString (data_con_str con)), result_expr con []] read_non_nullary_con data_con | is_infix = mk_parser infix_prec infix_stmts body | is_record = mk_parser record_prec record_stmts body -- Using these two lines instead allows the derived -- read for infix and record bindings to read the prefix form -- | is_infix = mk_alt prefix_parser (mk_parser infix_prec infix_stmts body) -- | is_record = mk_alt prefix_parser (mk_parser record_prec record_stmts body) | otherwise = prefix_parser where body = result_expr data_con as_needed con_str = data_con_str data_con prefix_parser = mk_parser prefix_prec prefix_stmts body read_prefix_con | isSym con_str = [read_punc "(", symbol_pat con_str, read_punc ")"] | otherwise = ident_h_pat con_str read_infix_con | isSym con_str = [symbol_pat con_str] | otherwise = [read_punc "`"] ++ ident_h_pat con_str ++ [read_punc "`"] prefix_stmts -- T a b c = read_prefix_con ++ read_args infix_stmts -- a %% b, or a `T` b = [read_a1] ++ read_infix_con ++ [read_a2] record_stmts -- T { f1 = a, f2 = b } = read_prefix_con ++ [read_punc "{"] ++ concat (intersperse [read_punc ","] field_stmts) ++ [read_punc "}"] field_stmts = zipWithEqual "lbl_stmts" read_field labels as_needed con_arity = dataConSourceArity data_con labels = dataConFieldLabels data_con dc_nm = getName data_con is_infix = dataConIsInfix data_con is_record = length labels > 0 as_needed = take con_arity as_RDRs read_args = zipWithEqual "gen_Read_binds" read_arg as_needed (dataConOrigArgTys data_con) (read_a1:read_a2:_) = read_args prefix_prec = appPrecedence infix_prec = getPrecedence get_fixity dc_nm record_prec = appPrecedence + 1 -- Record construction binds even more tightly -- than application; e.g. T2 T1 {x=2} means T2 (T1 {x=2}) ------------------------------------------------------------------------ -- Helpers ------------------------------------------------------------------------ mk_alt e1 e2 = genOpApp e1 alt_RDR e2 -- e1 +++ e2 mk_parser p ss b = nlHsApps prec_RDR [nlHsIntLit p -- prec p (do { ss ; b }) , nlHsDo DoExpr (ss ++ [noLoc $ mkLastStmt b])] con_app con as = nlHsVarApps (getRdrName con) as -- con as result_expr con as = nlHsApp (nlHsVar returnM_RDR) (con_app con as) -- return (con as) -- For constructors and field labels ending in '#', we hackily -- let the lexer generate two tokens, and look for both in sequence -- Thus [Ident "I"; Symbol "#"]. See Trac #5041 ident_h_pat s | Just (ss, '#') <- snocView s = [ ident_pat ss, symbol_pat "#" ] | otherwise = [ ident_pat s ] bindLex pat = noLoc (mkBodyStmt (nlHsApp (nlHsVar expectP_RDR) pat)) -- expectP p -- See Note [Use expectP] ident_pat s = bindLex $ nlHsApps ident_RDR [nlHsLit (mkHsString s)] -- expectP (Ident "foo") symbol_pat s = bindLex $ nlHsApps symbol_RDR [nlHsLit (mkHsString s)] -- expectP (Symbol ">>") read_punc c = bindLex $ nlHsApps punc_RDR [nlHsLit (mkHsString c)] -- expectP (Punc "<") data_con_str con = occNameString (getOccName con) read_arg a ty = --ASSERT( not (isUnLiftedType ty) ) noLoc (mkBindStmt (nlVarPat a) (nlHsVarApps step_RDR [readPrec_RDR])) read_field lbl a = read_lbl lbl ++ [read_punc "=", noLoc (mkBindStmt (nlVarPat a) (nlHsVarApps reset_RDR [readPrec_RDR]))] -- When reading field labels we might encounter -- a = 3 -- _a = 3 -- or (#) = 4 -- Note the parens! read_lbl lbl | isSym lbl_str = [read_punc "(", symbol_pat lbl_str, read_punc ")"] | otherwise = ident_h_pat lbl_str where lbl_str = occNameString (getOccName lbl) {- ************************************************************************ * * Show instances * * ************************************************************************ Example infixr 5 :^: data Tree a = Leaf a | Tree a :^: Tree a instance (Show a) => Show (Tree a) where showsPrec d (Leaf m) = showParen (d > app_prec) showStr where showStr = showString "Leaf " . showsPrec (app_prec+1) m showsPrec d (u :^: v) = showParen (d > up_prec) showStr where showStr = showsPrec (up_prec+1) u . showString " :^: " . showsPrec (up_prec+1) v -- Note: right-associativity of :^: ignored up_prec = 5 -- Precedence of :^: app_prec = 10 -- Application has precedence one more than -- the most tightly-binding operator -}
7,355
gen_Read_binds :: (Name -> Fixity) -> SrcSpan -> TyCon -> (LHsBinds RdrName, BagDerivStuff) gen_Read_binds get_fixity loc tycon = (listToBag [read_prec, default_readlist, default_readlistprec], emptyBag) where ----------------------------------------------------------------------- default_readlist = mkHsVarBind loc readList_RDR (nlHsVar readListDefault_RDR) default_readlistprec = mkHsVarBind loc readListPrec_RDR (nlHsVar readListPrecDefault_RDR) ----------------------------------------------------------------------- data_cons = tyConDataCons tycon (nullary_cons, non_nullary_cons) = partition isNullarySrcDataCon data_cons read_prec = mkHsVarBind loc readPrec_RDR (nlHsApp (nlHsVar parens_RDR) read_cons) read_cons | null data_cons = nlHsVar pfail_RDR -- See Note [Read for empty data types] | otherwise = foldr1 mk_alt (read_nullary_cons ++ read_non_nullary_cons) read_non_nullary_cons = map read_non_nullary_con non_nullary_cons read_nullary_cons = case nullary_cons of [] -> [] [con] -> [nlHsDo DoExpr (match_con con ++ [noLoc $ mkLastStmt (result_expr con [])])] _ -> [nlHsApp (nlHsVar choose_RDR) (nlList (map mk_pair nullary_cons))] -- NB For operators the parens around (:=:) are matched by the -- enclosing "parens" call, so here we must match the naked -- data_con_str con match_con con | isSym con_str = [symbol_pat con_str] | otherwise = ident_h_pat con_str where con_str = data_con_str con -- For nullary constructors we must match Ident s for normal constrs -- and Symbol s for operators mk_pair con = mkLHsTupleExpr [nlHsLit (mkHsString (data_con_str con)), result_expr con []] read_non_nullary_con data_con | is_infix = mk_parser infix_prec infix_stmts body | is_record = mk_parser record_prec record_stmts body -- Using these two lines instead allows the derived -- read for infix and record bindings to read the prefix form -- | is_infix = mk_alt prefix_parser (mk_parser infix_prec infix_stmts body) -- | is_record = mk_alt prefix_parser (mk_parser record_prec record_stmts body) | otherwise = prefix_parser where body = result_expr data_con as_needed con_str = data_con_str data_con prefix_parser = mk_parser prefix_prec prefix_stmts body read_prefix_con | isSym con_str = [read_punc "(", symbol_pat con_str, read_punc ")"] | otherwise = ident_h_pat con_str read_infix_con | isSym con_str = [symbol_pat con_str] | otherwise = [read_punc "`"] ++ ident_h_pat con_str ++ [read_punc "`"] prefix_stmts -- T a b c = read_prefix_con ++ read_args infix_stmts -- a %% b, or a `T` b = [read_a1] ++ read_infix_con ++ [read_a2] record_stmts -- T { f1 = a, f2 = b } = read_prefix_con ++ [read_punc "{"] ++ concat (intersperse [read_punc ","] field_stmts) ++ [read_punc "}"] field_stmts = zipWithEqual "lbl_stmts" read_field labels as_needed con_arity = dataConSourceArity data_con labels = dataConFieldLabels data_con dc_nm = getName data_con is_infix = dataConIsInfix data_con is_record = length labels > 0 as_needed = take con_arity as_RDRs read_args = zipWithEqual "gen_Read_binds" read_arg as_needed (dataConOrigArgTys data_con) (read_a1:read_a2:_) = read_args prefix_prec = appPrecedence infix_prec = getPrecedence get_fixity dc_nm record_prec = appPrecedence + 1 -- Record construction binds even more tightly -- than application; e.g. T2 T1 {x=2} means T2 (T1 {x=2}) ------------------------------------------------------------------------ -- Helpers ------------------------------------------------------------------------ mk_alt e1 e2 = genOpApp e1 alt_RDR e2 -- e1 +++ e2 mk_parser p ss b = nlHsApps prec_RDR [nlHsIntLit p -- prec p (do { ss ; b }) , nlHsDo DoExpr (ss ++ [noLoc $ mkLastStmt b])] con_app con as = nlHsVarApps (getRdrName con) as -- con as result_expr con as = nlHsApp (nlHsVar returnM_RDR) (con_app con as) -- return (con as) -- For constructors and field labels ending in '#', we hackily -- let the lexer generate two tokens, and look for both in sequence -- Thus [Ident "I"; Symbol "#"]. See Trac #5041 ident_h_pat s | Just (ss, '#') <- snocView s = [ ident_pat ss, symbol_pat "#" ] | otherwise = [ ident_pat s ] bindLex pat = noLoc (mkBodyStmt (nlHsApp (nlHsVar expectP_RDR) pat)) -- expectP p -- See Note [Use expectP] ident_pat s = bindLex $ nlHsApps ident_RDR [nlHsLit (mkHsString s)] -- expectP (Ident "foo") symbol_pat s = bindLex $ nlHsApps symbol_RDR [nlHsLit (mkHsString s)] -- expectP (Symbol ">>") read_punc c = bindLex $ nlHsApps punc_RDR [nlHsLit (mkHsString c)] -- expectP (Punc "<") data_con_str con = occNameString (getOccName con) read_arg a ty = --ASSERT( not (isUnLiftedType ty) ) noLoc (mkBindStmt (nlVarPat a) (nlHsVarApps step_RDR [readPrec_RDR])) read_field lbl a = read_lbl lbl ++ [read_punc "=", noLoc (mkBindStmt (nlVarPat a) (nlHsVarApps reset_RDR [readPrec_RDR]))] -- When reading field labels we might encounter -- a = 3 -- _a = 3 -- or (#) = 4 -- Note the parens! read_lbl lbl | isSym lbl_str = [read_punc "(", symbol_pat lbl_str, read_punc ")"] | otherwise = ident_h_pat lbl_str where lbl_str = occNameString (getOccName lbl) {- ************************************************************************ * * Show instances * * ************************************************************************ Example infixr 5 :^: data Tree a = Leaf a | Tree a :^: Tree a instance (Show a) => Show (Tree a) where showsPrec d (Leaf m) = showParen (d > app_prec) showStr where showStr = showString "Leaf " . showsPrec (app_prec+1) m showsPrec d (u :^: v) = showParen (d > up_prec) showStr where showStr = showsPrec (up_prec+1) u . showString " :^: " . showsPrec (up_prec+1) v -- Note: right-associativity of :^: ignored up_prec = 5 -- Precedence of :^: app_prec = 10 -- Application has precedence one more than -- the most tightly-binding operator -}
7,354
gen_Read_binds get_fixity loc tycon = (listToBag [read_prec, default_readlist, default_readlistprec], emptyBag) where ----------------------------------------------------------------------- default_readlist = mkHsVarBind loc readList_RDR (nlHsVar readListDefault_RDR) default_readlistprec = mkHsVarBind loc readListPrec_RDR (nlHsVar readListPrecDefault_RDR) ----------------------------------------------------------------------- data_cons = tyConDataCons tycon (nullary_cons, non_nullary_cons) = partition isNullarySrcDataCon data_cons read_prec = mkHsVarBind loc readPrec_RDR (nlHsApp (nlHsVar parens_RDR) read_cons) read_cons | null data_cons = nlHsVar pfail_RDR -- See Note [Read for empty data types] | otherwise = foldr1 mk_alt (read_nullary_cons ++ read_non_nullary_cons) read_non_nullary_cons = map read_non_nullary_con non_nullary_cons read_nullary_cons = case nullary_cons of [] -> [] [con] -> [nlHsDo DoExpr (match_con con ++ [noLoc $ mkLastStmt (result_expr con [])])] _ -> [nlHsApp (nlHsVar choose_RDR) (nlList (map mk_pair nullary_cons))] -- NB For operators the parens around (:=:) are matched by the -- enclosing "parens" call, so here we must match the naked -- data_con_str con match_con con | isSym con_str = [symbol_pat con_str] | otherwise = ident_h_pat con_str where con_str = data_con_str con -- For nullary constructors we must match Ident s for normal constrs -- and Symbol s for operators mk_pair con = mkLHsTupleExpr [nlHsLit (mkHsString (data_con_str con)), result_expr con []] read_non_nullary_con data_con | is_infix = mk_parser infix_prec infix_stmts body | is_record = mk_parser record_prec record_stmts body -- Using these two lines instead allows the derived -- read for infix and record bindings to read the prefix form -- | is_infix = mk_alt prefix_parser (mk_parser infix_prec infix_stmts body) -- | is_record = mk_alt prefix_parser (mk_parser record_prec record_stmts body) | otherwise = prefix_parser where body = result_expr data_con as_needed con_str = data_con_str data_con prefix_parser = mk_parser prefix_prec prefix_stmts body read_prefix_con | isSym con_str = [read_punc "(", symbol_pat con_str, read_punc ")"] | otherwise = ident_h_pat con_str read_infix_con | isSym con_str = [symbol_pat con_str] | otherwise = [read_punc "`"] ++ ident_h_pat con_str ++ [read_punc "`"] prefix_stmts -- T a b c = read_prefix_con ++ read_args infix_stmts -- a %% b, or a `T` b = [read_a1] ++ read_infix_con ++ [read_a2] record_stmts -- T { f1 = a, f2 = b } = read_prefix_con ++ [read_punc "{"] ++ concat (intersperse [read_punc ","] field_stmts) ++ [read_punc "}"] field_stmts = zipWithEqual "lbl_stmts" read_field labels as_needed con_arity = dataConSourceArity data_con labels = dataConFieldLabels data_con dc_nm = getName data_con is_infix = dataConIsInfix data_con is_record = length labels > 0 as_needed = take con_arity as_RDRs read_args = zipWithEqual "gen_Read_binds" read_arg as_needed (dataConOrigArgTys data_con) (read_a1:read_a2:_) = read_args prefix_prec = appPrecedence infix_prec = getPrecedence get_fixity dc_nm record_prec = appPrecedence + 1 -- Record construction binds even more tightly -- than application; e.g. T2 T1 {x=2} means T2 (T1 {x=2}) ------------------------------------------------------------------------ -- Helpers ------------------------------------------------------------------------ mk_alt e1 e2 = genOpApp e1 alt_RDR e2 -- e1 +++ e2 mk_parser p ss b = nlHsApps prec_RDR [nlHsIntLit p -- prec p (do { ss ; b }) , nlHsDo DoExpr (ss ++ [noLoc $ mkLastStmt b])] con_app con as = nlHsVarApps (getRdrName con) as -- con as result_expr con as = nlHsApp (nlHsVar returnM_RDR) (con_app con as) -- return (con as) -- For constructors and field labels ending in '#', we hackily -- let the lexer generate two tokens, and look for both in sequence -- Thus [Ident "I"; Symbol "#"]. See Trac #5041 ident_h_pat s | Just (ss, '#') <- snocView s = [ ident_pat ss, symbol_pat "#" ] | otherwise = [ ident_pat s ] bindLex pat = noLoc (mkBodyStmt (nlHsApp (nlHsVar expectP_RDR) pat)) -- expectP p -- See Note [Use expectP] ident_pat s = bindLex $ nlHsApps ident_RDR [nlHsLit (mkHsString s)] -- expectP (Ident "foo") symbol_pat s = bindLex $ nlHsApps symbol_RDR [nlHsLit (mkHsString s)] -- expectP (Symbol ">>") read_punc c = bindLex $ nlHsApps punc_RDR [nlHsLit (mkHsString c)] -- expectP (Punc "<") data_con_str con = occNameString (getOccName con) read_arg a ty = --ASSERT( not (isUnLiftedType ty) ) noLoc (mkBindStmt (nlVarPat a) (nlHsVarApps step_RDR [readPrec_RDR])) read_field lbl a = read_lbl lbl ++ [read_punc "=", noLoc (mkBindStmt (nlVarPat a) (nlHsVarApps reset_RDR [readPrec_RDR]))] -- When reading field labels we might encounter -- a = 3 -- _a = 3 -- or (#) = 4 -- Note the parens! read_lbl lbl | isSym lbl_str = [read_punc "(", symbol_pat lbl_str, read_punc ")"] | otherwise = ident_h_pat lbl_str where lbl_str = occNameString (getOccName lbl) {- ************************************************************************ * * Show instances * * ************************************************************************ Example infixr 5 :^: data Tree a = Leaf a | Tree a :^: Tree a instance (Show a) => Show (Tree a) where showsPrec d (Leaf m) = showParen (d > app_prec) showStr where showStr = showString "Leaf " . showsPrec (app_prec+1) m showsPrec d (u :^: v) = showParen (d > up_prec) showStr where showStr = showsPrec (up_prec+1) u . showString " :^: " . showsPrec (up_prec+1) v -- Note: right-associativity of :^: ignored up_prec = 5 -- Precedence of :^: app_prec = 10 -- Application has precedence one more than -- the most tightly-binding operator -}
7,262
false
true
28
17
2,450
1,267
639
628
null
null
avieth/frappe
Control/Monad/Embedding.hs
bsd-3-clause
embedIdentity :: Applicative g => Embedding Identity g embedIdentity = Embedding $ \(Identity t) -> pure (t, embedIdentity)
123
embedIdentity :: Applicative g => Embedding Identity g embedIdentity = Embedding $ \(Identity t) -> pure (t, embedIdentity)
123
embedIdentity = Embedding $ \(Identity t) -> pure (t, embedIdentity)
68
false
true
2
7
17
53
25
28
null
null
hpacheco/jasminv
src/Language/Jasmin/TypeChecker/TyInfo.hs
gpl-3.0
stotyInfoLoc' (Just sto) t l = TyInfo (Just sto) (Just t) Nothing l
67
stotyInfoLoc' (Just sto) t l = TyInfo (Just sto) (Just t) Nothing l
67
stotyInfoLoc' (Just sto) t l = TyInfo (Just sto) (Just t) Nothing l
67
false
false
0
7
12
40
19
21
null
null
binesiyu/ifl
examples/ch28/GameInventory.hs
mit
shoppingList :: [(Item, Gold)] -> Player -> Player -> STM (Maybe (Item, Gold)) shoppingList list buyer seller = maybeSTM . msum $ map sellOne list where sellOne this@(item,price) = do sellItem item price buyer seller return this {-- /snippet shoppingList --} {-- snippet maybeSTM --}
325
shoppingList :: [(Item, Gold)] -> Player -> Player -> STM (Maybe (Item, Gold)) shoppingList list buyer seller = maybeSTM . msum $ map sellOne list where sellOne this@(item,price) = do sellItem item price buyer seller return this {-- /snippet shoppingList --} {-- snippet maybeSTM --}
325
shoppingList list buyer seller = maybeSTM . msum $ map sellOne list where sellOne this@(item,price) = do sellItem item price buyer seller return this {-- /snippet shoppingList --} {-- snippet maybeSTM --}
233
false
true
0
11
86
106
55
51
null
null
ony/hledger
hledger/Hledger/Cli/Commands/Add.hs
gpl-3.0
-- maybeShowHelp :: Wizard Haskeline String -> Wizard Haskeline String -- maybeShowHelp wizard = maybe (liftIO showHelp >> wizard) return $ -- parser (\s -> if s=="?" then Nothing else Just s) wizard -- Completion helpers dateCompleter :: String -> CompletionFunc IO dateCompleter = completer ["today","tomorrow","yesterday"]
350
dateCompleter :: String -> CompletionFunc IO dateCompleter = completer ["today","tomorrow","yesterday"]
103
dateCompleter = completer ["today","tomorrow","yesterday"]
58
true
true
0
6
70
34
20
14
null
null
alphaHeavy/hlint
src/HSE/Util.hs
gpl-2.0
fromGuardedAlts :: GuardedAlts s -> Rhs s fromGuardedAlts (UnGuardedAlt s x) = UnGuardedRhs s x
95
fromGuardedAlts :: GuardedAlts s -> Rhs s fromGuardedAlts (UnGuardedAlt s x) = UnGuardedRhs s x
95
fromGuardedAlts (UnGuardedAlt s x) = UnGuardedRhs s x
53
false
true
0
9
14
41
18
23
null
null
brendanhay/gogol
gogol-bigtableadmin/gen/Network/Google/Resource/BigtableAdmin/Projects/Instances/AppProFiles/List.hs
mpl-2.0
-- | Required. The unique name of the instance for which a list of app -- profiles is requested. Values are of the form -- \`projects\/{project}\/instances\/{instance}\`. Use \`{instance} = -- \'-\'\` to list AppProfiles for all Instances in a project, e.g., -- \`projects\/myproject\/instances\/-\`. piapflParent :: Lens' ProjectsInstancesAppProFilesList Text piapflParent = lens _piapflParent (\ s a -> s{_piapflParent = a})
428
piapflParent :: Lens' ProjectsInstancesAppProFilesList Text piapflParent = lens _piapflParent (\ s a -> s{_piapflParent = a})
127
piapflParent = lens _piapflParent (\ s a -> s{_piapflParent = a})
67
true
true
0
9
60
46
26
20
null
null
dservgun/erp
src/common/Company.hs
gpl-3.0
createCompany :: Party -> Cu.Currency -> S.Set Cu.Currency -> S.Set Pr.Product -> ErpM Company createCompany aParty aCurrency alternateCurrencies products = pure $ createCompanyNM aParty aCurrency alternateCurrencies products
237
createCompany :: Party -> Cu.Currency -> S.Set Cu.Currency -> S.Set Pr.Product -> ErpM Company createCompany aParty aCurrency alternateCurrencies products = pure $ createCompanyNM aParty aCurrency alternateCurrencies products
237
createCompany aParty aCurrency alternateCurrencies products = pure $ createCompanyNM aParty aCurrency alternateCurrencies products
134
false
true
2
11
38
75
33
42
null
null
brendanhay/gogol
gogol-dataflow/gen/Network/Google/Dataflow/Types/Product.hs
mpl-2.0
-- | The health of a worker. wmWorkerHealthReport :: Lens' WorkerMessage (Maybe WorkerHealthReport) wmWorkerHealthReport = lens _wmWorkerHealthReport (\ s a -> s{_wmWorkerHealthReport = a})
197
wmWorkerHealthReport :: Lens' WorkerMessage (Maybe WorkerHealthReport) wmWorkerHealthReport = lens _wmWorkerHealthReport (\ s a -> s{_wmWorkerHealthReport = a})
168
wmWorkerHealthReport = lens _wmWorkerHealthReport (\ s a -> s{_wmWorkerHealthReport = a})
97
true
true
0
9
31
48
25
23
null
null
snoyberg/hebrew-time
src/Data/Time/Calendar/Hebrew/Internal.hs
mit
shaotFromDays :: Days -> Shaot shaotFromDays (Days d) = Shaot (d * 24)
70
shaotFromDays :: Days -> Shaot shaotFromDays (Days d) = Shaot (d * 24)
70
shaotFromDays (Days d) = Shaot (d * 24)
39
false
true
0
9
12
39
18
21
null
null
haskell-opengl/OpenGLRaw
src/Graphics/GL/ExtensionPredicates.hs
bsd-3-clause
-- | Is the <https://www.opengl.org/registry/specs/ARB/half_float_vertex.txt ARB_half_float_vertex> extension supported? -- Note that in the presence of multiple contexts with different capabilities, -- this might be wrong. Use 'glGetARBHalfFloatVertex' in those cases instead. gl_ARB_half_float_vertex :: Bool gl_ARB_half_float_vertex = member "GL_ARB_half_float_vertex" extensions
382
gl_ARB_half_float_vertex :: Bool gl_ARB_half_float_vertex = member "GL_ARB_half_float_vertex" extensions
104
gl_ARB_half_float_vertex = member "GL_ARB_half_float_vertex" extensions
71
true
true
0
5
38
19
11
8
null
null
xnning/fcore
lib/Src.hs
bsd-2-clause
-- Relations between types -- | Subtyping (<:) is defined only between types of kind *. subtype :: TypeContext -> Type -> Type -> Bool subtype d t1 t2 = subtypeS (expandType d t1) (expandType d t2)
198
subtype :: TypeContext -> Type -> Type -> Bool subtype d t1 t2 = subtypeS (expandType d t1) (expandType d t2)
109
subtype d t1 t2 = subtypeS (expandType d t1) (expandType d t2)
62
true
true
0
7
37
53
27
26
null
null
gergoerdi/metafun
src/Language/Kiff/Parser.hs
gpl-3.0
conname = do name@(n:_) <- identifier if isUpper n then return name else fail []
93
conname = do name@(n:_) <- identifier if isUpper n then return name else fail []
93
conname = do name@(n:_) <- identifier if isUpper n then return name else fail []
93
false
false
1
11
27
49
22
27
null
null
alexander-at-github/eta
compiler/ETA/DeSugar/Check.hs
bsd-3-clause
isConPatOut _ = False
60
isConPatOut _ = False
60
isConPatOut _ = False
60
false
false
0
5
42
9
4
5
null
null
michaelt/series
Series/List/Prelude.hs
bsd-3-clause
-- replicateM :: Monad m => Int -> m a -> [a] -- replicateM n a = buildList (F.replicateM n a) -- {-# INLINE replicateM #-} -- --------------- -- iterate -- --------------- iterate :: (a -> a) -> a -> [a] iterate f = buildList . F.iterate f
243
iterate :: (a -> a) -> a -> [a] iterate f = buildList . F.iterate f
68
iterate f = buildList . F.iterate f
36
true
true
0
7
50
47
27
20
null
null
vaibhav276/scheme-compiler
src/Parser.hs
mit
isBound :: Env -> String -> IO Bool isBound envRef var = readIORef envRef >>= return . maybe False (const True) . lookup var
124
isBound :: Env -> String -> IO Bool isBound envRef var = readIORef envRef >>= return . maybe False (const True) . lookup var
124
isBound envRef var = readIORef envRef >>= return . maybe False (const True) . lookup var
88
false
true
0
9
23
56
26
30
null
null
bamboo/idris-cil
src/IRTS/Cil/MaxStack.hs
bsd-3-clause
netStackChange _ Ldc_i4_2 = 1
35
netStackChange _ Ldc_i4_2 = 1
35
netStackChange _ Ldc_i4_2 = 1
35
false
false
0
5
10
11
5
6
null
null
snoyberg/todolist
Handler/Todo.hs
bsd-2-clause
deleteTodoR :: TodoId -> Handler () deleteTodoR tid = do runDB $ delete tid sendResponseStatus status204 ()
115
deleteTodoR :: TodoId -> Handler () deleteTodoR tid = do runDB $ delete tid sendResponseStatus status204 ()
115
deleteTodoR tid = do runDB $ delete tid sendResponseStatus status204 ()
79
false
true
0
8
24
43
19
24
null
null
tjakway/ghcjvm
compiler/prelude/PrelNames.hs
bsd-3-clause
notAssocDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "NotAssociative")
74
notAssocDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "NotAssociative")
74
notAssocDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "NotAssociative")
74
false
false
0
7
7
17
8
9
null
null
brianshourd/adventOfCode2015
src/Day2.hs
mit
parseAndApply :: (Box -> Int) -> String -> Int parseAndApply f input = case parseOnly parseBoxes (pack input) of (Right boxes) -> sum . map f $ boxes _ -> -1
165
parseAndApply :: (Box -> Int) -> String -> Int parseAndApply f input = case parseOnly parseBoxes (pack input) of (Right boxes) -> sum . map f $ boxes _ -> -1
165
parseAndApply f input = case parseOnly parseBoxes (pack input) of (Right boxes) -> sum . map f $ boxes _ -> -1
118
false
true
3
8
38
79
38
41
null
null
chip2n/tin172-project
related-stuff/AStarExamples.hs
gpl-3.0
(!!=) :: [a] -> (Int,a) -> [a] (!!=) xs (p,x) = take p xs ++ [x] ++ drop (p+1) xs
81
(!!=) :: [a] -> (Int,a) -> [a] (!!=) xs (p,x) = take p xs ++ [x] ++ drop (p+1) xs
81
(!!=) xs (p,x) = take p xs ++ [x] ++ drop (p+1) xs
50
false
true
0
8
19
74
42
32
null
null
rdnetto/persistent
persistent-sqlite/Database/Sqlite.hs
mit
finalize :: Statement -> IO () finalize statement = do error <- finalizeError statement case error of ErrorOK -> return () _ -> return () -- sqlError Nothing "finalize" error -- Taken from: https://github.com/IreneKnapp/direct-sqlite/blob/master/Database/SQLite3/Direct.hs -- | Like 'unsafeUseAsCStringLen', but if the string is empty, -- never pass the callback a null pointer.
391
finalize :: Statement -> IO () finalize statement = do error <- finalizeError statement case error of ErrorOK -> return () _ -> return () -- sqlError Nothing "finalize" error -- Taken from: https://github.com/IreneKnapp/direct-sqlite/blob/master/Database/SQLite3/Direct.hs -- | Like 'unsafeUseAsCStringLen', but if the string is empty, -- never pass the callback a null pointer.
391
finalize statement = do error <- finalizeError statement case error of ErrorOK -> return () _ -> return () -- sqlError Nothing "finalize" error -- Taken from: https://github.com/IreneKnapp/direct-sqlite/blob/master/Database/SQLite3/Direct.hs -- | Like 'unsafeUseAsCStringLen', but if the string is empty, -- never pass the callback a null pointer.
360
false
true
0
12
64
71
33
38
null
null
izgzhen/hadrian
src/Utilities.hs
mit
runBuilder :: Builder -> [String] -> Action () runBuilder = runBuilderWith []
77
runBuilder :: Builder -> [String] -> Action () runBuilder = runBuilderWith []
77
runBuilder = runBuilderWith []
30
false
true
0
8
11
32
16
16
null
null
projectorhq/haskell-liquid
src/Text/Liquid/Renderer.hs
bsd-3-clause
-- | Evaluate predicate result and render evalLogic :: Value -- ^ JSON Context -> Rendering Bool -- ^ Predicate / logical expression result -> [Expr] -- ^ Expressions to evaluate if true -> Rendering Text evalLogic j (AccSuccess True) ts = foldl (<>) T.empty <$> tevals where tevals = sequenceA $ (renderTemplate j <$> ts)
353
evalLogic :: Value -- ^ JSON Context -> Rendering Bool -- ^ Predicate / logical expression result -> [Expr] -- ^ Expressions to evaluate if true -> Rendering Text evalLogic j (AccSuccess True) ts = foldl (<>) T.empty <$> tevals where tevals = sequenceA $ (renderTemplate j <$> ts)
311
evalLogic j (AccSuccess True) ts = foldl (<>) T.empty <$> tevals where tevals = sequenceA $ (renderTemplate j <$> ts)
123
true
true
5
11
86
95
45
50
null
null
coolhacks/scripts-hacks
examples/shellcheck-master/ShellCheck/Parser.hs
mit
g_Lparen = tryToken "(" T_Lparen
32
g_Lparen = tryToken "(" T_Lparen
32
g_Lparen = tryToken "(" T_Lparen
32
false
false
0
5
4
11
5
6
null
null
Catchouli/robo
src/USB.hs
bsd-3-clause
-- Get device info deviceInfo :: Device -> [String] deviceInfo dev = [ printf "deviceSpeed: %s" (maybe "-" show $ deviceSpeed dev) , printf "busNumber: %s" (show $ busNumber dev) , printf "portNumber: %s" (show $ portNumber dev) , printf "portNumbers: %s" (maybe "-" (show . V.toList) $ portNumbers dev 7) , printf "deviceAddress: %s" (show $ deviceAddress dev) ]
420
deviceInfo :: Device -> [String] deviceInfo dev = [ printf "deviceSpeed: %s" (maybe "-" show $ deviceSpeed dev) , printf "busNumber: %s" (show $ busNumber dev) , printf "portNumber: %s" (show $ portNumber dev) , printf "portNumbers: %s" (maybe "-" (show . V.toList) $ portNumbers dev 7) , printf "deviceAddress: %s" (show $ deviceAddress dev) ]
401
deviceInfo dev = [ printf "deviceSpeed: %s" (maybe "-" show $ deviceSpeed dev) , printf "busNumber: %s" (show $ busNumber dev) , printf "portNumber: %s" (show $ portNumber dev) , printf "portNumbers: %s" (maybe "-" (show . V.toList) $ portNumbers dev 7) , printf "deviceAddress: %s" (show $ deviceAddress dev) ]
368
true
true
0
12
116
133
67
66
null
null
grandpascorpion/canon
Math/NumberTheory/Internals.hs
gpl-3.0
crModI _ (-1) = 0
24
crModI _ (-1) = 0
24
crModI _ (-1) = 0
24
false
false
1
6
11
19
8
11
null
null
jystic/cthulhu
src/Pretty.hs
bsd-3-clause
escape '\n' = text "\\n"
33
escape '\n' = text "\\n"
33
escape '\n' = text "\\n"
33
false
false
0
5
13
12
5
7
null
null
hamishmack/haskell-gi
lib/Data/GI/GIR/Parser.hs
lgpl-2.1
queryAttr :: XML.Name -> Parser (Maybe Text) queryAttr attr = do ctx <- ask return $ lookupAttr attr (currentElement ctx) -- | Like `queryAttr`, but allow for specifying the namespace.
189
queryAttr :: XML.Name -> Parser (Maybe Text) queryAttr attr = do ctx <- ask return $ lookupAttr attr (currentElement ctx) -- | Like `queryAttr`, but allow for specifying the namespace.
189
queryAttr attr = do ctx <- ask return $ lookupAttr attr (currentElement ctx) -- | Like `queryAttr`, but allow for specifying the namespace.
144
false
true
0
10
34
55
26
29
null
null
anchor/ceilometer-common
lib/Ceilometer/Tags.hs
bsd-3-clause
valVolumeFast = pack "f7797fba-2ce2-4d19-a607-29f4bc2acb3f"
62
valVolumeFast = pack "f7797fba-2ce2-4d19-a607-29f4bc2acb3f"
62
valVolumeFast = pack "f7797fba-2ce2-4d19-a607-29f4bc2acb3f"
62
false
false
0
5
6
9
4
5
null
null
cbrghostrider/Hacking
codeJam/2014/magicTrick/magicTrick.hs
mit
processInput :: String -> String processInput = unlines . writeOutput . map solveProblem . readInput . tail . lines
116
processInput :: String -> String processInput = unlines . writeOutput . map solveProblem . readInput . tail . lines
115
processInput = unlines . writeOutput . map solveProblem . readInput . tail . lines
82
false
true
0
9
19
38
19
19
null
null
Nathan-Fenner/New-Nickel
ParseAST.hs
mit
parseModuleLet :: Parse (Maybe (ModuleDeclaration Parsed)) parseModuleLet = fmap (fmap ModuleLet) parseLetDeclaration
117
parseModuleLet :: Parse (Maybe (ModuleDeclaration Parsed)) parseModuleLet = fmap (fmap ModuleLet) parseLetDeclaration
117
parseModuleLet = fmap (fmap ModuleLet) parseLetDeclaration
58
false
true
0
9
11
37
18
19
null
null
mightymoose/liquidhaskell
benchmarks/llrbtree-0.1.1/Data/Heap/Skew.hs
bsd-3-clause
null (Node _ _ _) = False
25
null (Node _ _ _) = False
25
null (Node _ _ _) = False
25
false
false
0
7
6
19
9
10
null
null
sdiehl/ghc
compiler/coreSyn/CoreUtils.hs
bsd-3-clause
-- Should not happen altsAreExhaustive ((con1,_,_) : alts) = case con1 of DEFAULT -> True LitAlt {} -> False DataAlt c -> alts `lengthIs` (tyConFamilySize (dataConTyCon c) - 1) -- It is possible to have an exhaustive case that does not -- enumerate all constructors, notably in a GADT match, but -- we behave conservatively here -- I don't think it's important -- enough to deserve special treatment -- | True of dyadic operators that can fail only if the second arg is zero!
522
altsAreExhaustive ((con1,_,_) : alts) = case con1 of DEFAULT -> True LitAlt {} -> False DataAlt c -> alts `lengthIs` (tyConFamilySize (dataConTyCon c) - 1) -- It is possible to have an exhaustive case that does not -- enumerate all constructors, notably in a GADT match, but -- we behave conservatively here -- I don't think it's important -- enough to deserve special treatment -- | True of dyadic operators that can fail only if the second arg is zero!
501
altsAreExhaustive ((con1,_,_) : alts) = case con1 of DEFAULT -> True LitAlt {} -> False DataAlt c -> alts `lengthIs` (tyConFamilySize (dataConTyCon c) - 1) -- It is possible to have an exhaustive case that does not -- enumerate all constructors, notably in a GADT match, but -- we behave conservatively here -- I don't think it's important -- enough to deserve special treatment -- | True of dyadic operators that can fail only if the second arg is zero!
501
true
false
4
12
130
78
43
35
null
null
yyotti/euler_haskell
test/P019Spec.hs
mit
main :: IO () main = hspec spec
31
main :: IO () main = hspec spec
31
main = hspec spec
17
false
true
0
7
7
25
10
15
null
null