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
phischu/fragnix
tests/packages/scotty/Control.Monad.Trans.Resource.hs
bsd-3-clause
-- | Perform some allocation, and automatically register a cleanup action. -- -- This is almost identical to calling the allocation and then -- @register@ing the release action, but this properly handles masking of -- asynchronous exceptions. -- -- Since 0.3.0 allocate :: MonadResource m => IO a -- ^ allocate -> (a -> IO ()) -- ^ free resource -> m (ReleaseKey, a) allocate a = liftResourceT . allocateRIO a
436
allocate :: MonadResource m => IO a -- ^ allocate -> (a -> IO ()) -- ^ free resource -> m (ReleaseKey, a) allocate a = liftResourceT . allocateRIO a
175
allocate a = liftResourceT . allocateRIO a
42
true
true
0
11
97
69
38
31
null
null
markus1189/wumpus-cave
Wumpus.hs
bsd-3-clause
pickup _ = message "Nothing to pickup here."
44
pickup _ = message "Nothing to pickup here."
44
pickup _ = message "Nothing to pickup here."
44
false
false
0
5
7
12
5
7
null
null
rdnetto/persistent
persistent-mongoDB/Database/Persist/MongoDB.hs
mit
-- | Same as '&->.', but Works against a Maybe type (?&->.) :: forall record typ nest. PersistEntity nest => EntityField record (Maybe nest) -> EntityField nest typ -> NestedField record typ (?&->.) = LastNestFldNullable
220
(?&->.) :: forall record typ nest. PersistEntity nest => EntityField record (Maybe nest) -> EntityField nest typ -> NestedField record typ (?&->.) = LastNestFldNullable
168
(?&->.) = LastNestFldNullable
29
true
true
0
10
34
59
32
27
null
null
brendanhay/gogol
gogol-iam/gen/Network/Google/Resource/IAM/Projects/ServiceAccounts/Keys/Delete.hs
mpl-2.0
-- | Creates a value of 'ProjectsServiceAccountsKeysDelete' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'psakdXgafv' -- -- * 'psakdUploadProtocol' -- -- * 'psakdAccessToken' -- -- * 'psakdUploadType' -- -- * 'psakdName' -- -- * 'psakdCallback' projectsServiceAccountsKeysDelete :: Text -- ^ 'psakdName' -> ProjectsServiceAccountsKeysDelete projectsServiceAccountsKeysDelete pPsakdName_ = ProjectsServiceAccountsKeysDelete' { _psakdXgafv = Nothing , _psakdUploadProtocol = Nothing , _psakdAccessToken = Nothing , _psakdUploadType = Nothing , _psakdName = pPsakdName_ , _psakdCallback = Nothing }
721
projectsServiceAccountsKeysDelete :: Text -- ^ 'psakdName' -> ProjectsServiceAccountsKeysDelete projectsServiceAccountsKeysDelete pPsakdName_ = ProjectsServiceAccountsKeysDelete' { _psakdXgafv = Nothing , _psakdUploadProtocol = Nothing , _psakdAccessToken = Nothing , _psakdUploadType = Nothing , _psakdName = pPsakdName_ , _psakdCallback = Nothing }
388
projectsServiceAccountsKeysDelete pPsakdName_ = ProjectsServiceAccountsKeysDelete' { _psakdXgafv = Nothing , _psakdUploadProtocol = Nothing , _psakdAccessToken = Nothing , _psakdUploadType = Nothing , _psakdName = pPsakdName_ , _psakdCallback = Nothing }
284
true
true
0
6
128
72
50
22
null
null
statusfailed/aeson-traversal
src/Data/Aeson/Traversal/Primitive.hs
mit
-- | Try to convert a Value to a Primitive toPrim :: Value -> Either Value Primitive toPrim (String s) = Right $ StringP s
122
toPrim :: Value -> Either Value Primitive toPrim (String s) = Right $ StringP s
79
toPrim (String s) = Right $ StringP s
37
true
true
2
9
24
42
19
23
null
null
chjp2046/fbthrift
thrift/lib/hs/Thrift/Protocol/PrettyJSON.hs
apache-2.0
indented :: Int -> Builder indented i = mconcat $ "\n" : replicate i " "
72
indented :: Int -> Builder indented i = mconcat $ "\n" : replicate i " "
72
indented i = mconcat $ "\n" : replicate i " "
45
false
true
0
6
15
34
16
18
null
null
ant1441/stack
src/Stack/PackageDump.hs
bsd-3-clause
conduitDumpPackage :: MonadThrow m => Conduit ByteString m (DumpPackage () ()) conduitDumpPackage = (=$= CL.catMaybes) $ eachSection $ do pairs <- eachPair (\k -> (k, ) <$> CL.consume) =$= CL.consume let m = Map.fromList pairs let parseS k = case Map.lookup k m of Just [v] -> return v _ -> throwM $ MissingSingleField k m -- Can't fail: if not found, same as an empty list. See: -- https://github.com/fpco/stack/issues/182 parseM k = case Map.lookup k m of Just vs -> vs Nothing -> [] parseDepend :: MonadThrow m => ByteString -> m (Maybe GhcPkgId) parseDepend "builtin_rts" = return Nothing parseDepend bs = liftM Just $ parseGhcPkgId bs' where (bs', _builtinRts) = case stripSuffixBS " builtin_rts" bs of Nothing -> case stripPrefixBS "builtin_rts " bs of Nothing -> (bs, False) Just x -> (x, True) Just x -> (x, True) case Map.lookup "id" m of Just ["builtin_rts"] -> return Nothing _ -> do name <- parseS "name" >>= parsePackageName version <- parseS "version" >>= parseVersion ghcPkgId <- parseS "id" >>= parseGhcPkgId when (PackageIdentifier name version /= ghcPkgIdPackageIdentifier ghcPkgId) $ throwM $ MismatchedId name version ghcPkgId -- if a package has no modules, these won't exist let libDirKey = "library-dirs" libDirs = parseM libDirKey libraries = parseM "hs-libraries" exposedModules = parseM "exposed-modules" haddockInterfaces = parseM "haddock-interfaces" depends <- mapM parseDepend $ parseM "depends" libDirPaths <- case mapM (P.parseOnly (argsParser NoEscaping) . T.decodeUtf8) libDirs of Left{} -> throwM (Couldn'tParseField libDirKey libDirs) Right dirs -> return (concat dirs) return $ Just DumpPackage { dpGhcPkgId = ghcPkgId , dpLibDirs = libDirPaths , dpLibraries = S8.words $ S8.unwords libraries , dpHasExposedModules = not (null libraries || null exposedModules) , dpDepends = catMaybes (depends :: [Maybe GhcPkgId]) , dpHaddockInterfaces = S8.words $ S8.unwords haddockInterfaces , dpProfiling = () , dpHaddock = () }
2,702
conduitDumpPackage :: MonadThrow m => Conduit ByteString m (DumpPackage () ()) conduitDumpPackage = (=$= CL.catMaybes) $ eachSection $ do pairs <- eachPair (\k -> (k, ) <$> CL.consume) =$= CL.consume let m = Map.fromList pairs let parseS k = case Map.lookup k m of Just [v] -> return v _ -> throwM $ MissingSingleField k m -- Can't fail: if not found, same as an empty list. See: -- https://github.com/fpco/stack/issues/182 parseM k = case Map.lookup k m of Just vs -> vs Nothing -> [] parseDepend :: MonadThrow m => ByteString -> m (Maybe GhcPkgId) parseDepend "builtin_rts" = return Nothing parseDepend bs = liftM Just $ parseGhcPkgId bs' where (bs', _builtinRts) = case stripSuffixBS " builtin_rts" bs of Nothing -> case stripPrefixBS "builtin_rts " bs of Nothing -> (bs, False) Just x -> (x, True) Just x -> (x, True) case Map.lookup "id" m of Just ["builtin_rts"] -> return Nothing _ -> do name <- parseS "name" >>= parsePackageName version <- parseS "version" >>= parseVersion ghcPkgId <- parseS "id" >>= parseGhcPkgId when (PackageIdentifier name version /= ghcPkgIdPackageIdentifier ghcPkgId) $ throwM $ MismatchedId name version ghcPkgId -- if a package has no modules, these won't exist let libDirKey = "library-dirs" libDirs = parseM libDirKey libraries = parseM "hs-libraries" exposedModules = parseM "exposed-modules" haddockInterfaces = parseM "haddock-interfaces" depends <- mapM parseDepend $ parseM "depends" libDirPaths <- case mapM (P.parseOnly (argsParser NoEscaping) . T.decodeUtf8) libDirs of Left{} -> throwM (Couldn'tParseField libDirKey libDirs) Right dirs -> return (concat dirs) return $ Just DumpPackage { dpGhcPkgId = ghcPkgId , dpLibDirs = libDirPaths , dpLibraries = S8.words $ S8.unwords libraries , dpHasExposedModules = not (null libraries || null exposedModules) , dpDepends = catMaybes (depends :: [Maybe GhcPkgId]) , dpHaddockInterfaces = S8.words $ S8.unwords haddockInterfaces , dpProfiling = () , dpHaddock = () }
2,702
conduitDumpPackage = (=$= CL.catMaybes) $ eachSection $ do pairs <- eachPair (\k -> (k, ) <$> CL.consume) =$= CL.consume let m = Map.fromList pairs let parseS k = case Map.lookup k m of Just [v] -> return v _ -> throwM $ MissingSingleField k m -- Can't fail: if not found, same as an empty list. See: -- https://github.com/fpco/stack/issues/182 parseM k = case Map.lookup k m of Just vs -> vs Nothing -> [] parseDepend :: MonadThrow m => ByteString -> m (Maybe GhcPkgId) parseDepend "builtin_rts" = return Nothing parseDepend bs = liftM Just $ parseGhcPkgId bs' where (bs', _builtinRts) = case stripSuffixBS " builtin_rts" bs of Nothing -> case stripPrefixBS "builtin_rts " bs of Nothing -> (bs, False) Just x -> (x, True) Just x -> (x, True) case Map.lookup "id" m of Just ["builtin_rts"] -> return Nothing _ -> do name <- parseS "name" >>= parsePackageName version <- parseS "version" >>= parseVersion ghcPkgId <- parseS "id" >>= parseGhcPkgId when (PackageIdentifier name version /= ghcPkgIdPackageIdentifier ghcPkgId) $ throwM $ MismatchedId name version ghcPkgId -- if a package has no modules, these won't exist let libDirKey = "library-dirs" libDirs = parseM libDirKey libraries = parseM "hs-libraries" exposedModules = parseM "exposed-modules" haddockInterfaces = parseM "haddock-interfaces" depends <- mapM parseDepend $ parseM "depends" libDirPaths <- case mapM (P.parseOnly (argsParser NoEscaping) . T.decodeUtf8) libDirs of Left{} -> throwM (Couldn'tParseField libDirKey libDirs) Right dirs -> return (concat dirs) return $ Just DumpPackage { dpGhcPkgId = ghcPkgId , dpLibDirs = libDirPaths , dpLibraries = S8.words $ S8.unwords libraries , dpHasExposedModules = not (null libraries || null exposedModules) , dpDepends = catMaybes (depends :: [Maybe GhcPkgId]) , dpHaddockInterfaces = S8.words $ S8.unwords haddockInterfaces , dpProfiling = () , dpHaddock = () }
2,604
false
true
0
20
1,045
688
337
351
null
null
chrisdone/pgsql-simple
Database/PostgreSQL/Simple/Result.hs
bsd-3-clause
ok16 = mkCompats [Short]
24
ok16 = mkCompats [Short]
24
ok16 = mkCompats [Short]
24
false
false
0
6
3
12
6
6
null
null
Bodigrim/arithmoi
test-suite/Math/NumberTheory/Primes/CountingTests.hs
mit
-- | Check that 'primeCount' is monotonically increasing function. primeCountProperty2 :: Positive Integer -> Positive Integer -> Bool primeCountProperty2 (Positive n1) (Positive n2) = n1 > primeCountMaxArg || n2 > primeCountMaxArg || n1 <= n2 && p1 <= p2 || n1 > n2 && p1 >= p2 where p1 = primeCount n1 p2 = primeCount n2 -- | Check that 'primeCount' is strictly increasing iff an argument is prime.
421
primeCountProperty2 :: Positive Integer -> Positive Integer -> Bool primeCountProperty2 (Positive n1) (Positive n2) = n1 > primeCountMaxArg || n2 > primeCountMaxArg || n1 <= n2 && p1 <= p2 || n1 > n2 && p1 >= p2 where p1 = primeCount n1 p2 = primeCount n2 -- | Check that 'primeCount' is strictly increasing iff an argument is prime.
354
primeCountProperty2 (Positive n1) (Positive n2) = n1 > primeCountMaxArg || n2 > primeCountMaxArg || n1 <= n2 && p1 <= p2 || n1 > n2 && p1 >= p2 where p1 = primeCount n1 p2 = primeCount n2 -- | Check that 'primeCount' is strictly increasing iff an argument is prime.
286
true
true
6
14
89
123
55
68
null
null
ben-schulz/Idris-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
mapPDeclFC f g (POpenInterfaces fc ifs decls) = POpenInterfaces (f fc) ifs (map (mapPDeclFC f g) decls)
107
mapPDeclFC f g (POpenInterfaces fc ifs decls) = POpenInterfaces (f fc) ifs (map (mapPDeclFC f g) decls)
107
mapPDeclFC f g (POpenInterfaces fc ifs decls) = POpenInterfaces (f fc) ifs (map (mapPDeclFC f g) decls)
107
false
false
0
9
20
56
25
31
null
null
hverr/lxdfile
app/Main.hs
gpl-3.0
parseInitScriptContext :: InitScriptArg -> IO (Either InitScriptError InitScriptContext) parseInitScriptContext (InitScriptArg fp ctx) = do v <- InitScript.parseFile fp return $ InitScriptContext <$> v <*> pure ctx
222
parseInitScriptContext :: InitScriptArg -> IO (Either InitScriptError InitScriptContext) parseInitScriptContext (InitScriptArg fp ctx) = do v <- InitScript.parseFile fp return $ InitScriptContext <$> v <*> pure ctx
222
parseInitScriptContext (InitScriptArg fp ctx) = do v <- InitScript.parseFile fp return $ InitScriptContext <$> v <*> pure ctx
133
false
true
0
9
33
71
32
39
null
null
parapluu/encore
src/opt/Optimizer/Optimizer.hs
bsd-3-clause
dropBorrowBlocks = extend dropBorrowBlock where dropBorrowBlock e@Borrow{emeta, target, name, body} = Let{emeta ,mutability = Val ,decls = [([VarNoType name], target)] ,body} dropBorrowBlock e = e
253
dropBorrowBlocks = extend dropBorrowBlock where dropBorrowBlock e@Borrow{emeta, target, name, body} = Let{emeta ,mutability = Val ,decls = [([VarNoType name], target)] ,body} dropBorrowBlock e = e
253
dropBorrowBlocks = extend dropBorrowBlock where dropBorrowBlock e@Borrow{emeta, target, name, body} = Let{emeta ,mutability = Val ,decls = [([VarNoType name], target)] ,body} dropBorrowBlock e = e
253
false
false
0
12
81
80
46
34
null
null
spinda/liquidhaskell
src/Language/Haskell/Liquid/Desugar710/Check.hs
bsd-3-clause
get_lit :: Pat id -> Maybe HsLit -- Get a representative HsLit to stand for the OverLit -- It doesn't matter which one, because they will only be compared -- with other HsLits gotten in the same way get_lit (LitPat lit) = Just lit
267
get_lit :: Pat id -> Maybe HsLit get_lit (LitPat lit) = Just lit
101
get_lit (LitPat lit) = Just lit
68
true
true
0
7
80
36
18
18
null
null
alphaHeavy/cabal
Cabal/Distribution/PackageDescription/Configuration.hs
bsd-3-clause
flattenPackageDescription :: GenericPackageDescription -> PackageDescription flattenPackageDescription (GenericPackageDescription pkg _ mlib0 exes0 tests0 bms0) = pkg { library = mlib , executables = reverse exes , testSuites = reverse tests , benchmarks = reverse bms , buildDepends = ldeps ++ reverse edeps ++ reverse tdeps ++ reverse bdeps } where (mlib, ldeps) = case mlib0 of Just lib -> let (l,ds) = ignoreConditions lib in (Just (libFillInDefaults l), ds) Nothing -> (Nothing, []) (exes, edeps) = foldr flattenExe ([],[]) exes0 (tests, tdeps) = foldr flattenTst ([],[]) tests0 (bms, bdeps) = foldr flattenBm ([],[]) bms0 flattenExe (n, t) (es, ds) = let (e, ds') = ignoreConditions t in ( (exeFillInDefaults $ e { exeName = n }) : es, ds' ++ ds ) flattenTst (n, t) (es, ds) = let (e, ds') = ignoreConditions t in ( (testFillInDefaults $ e { testName = n }) : es, ds' ++ ds ) flattenBm (n, t) (es, ds) = let (e, ds') = ignoreConditions t in ( (benchFillInDefaults $ e { benchmarkName = n }) : es, ds' ++ ds ) -- This is in fact rather a hack. The original version just overrode the -- default values, however, when adding conditions we had to switch to a -- modifier-based approach. There, nothing is ever overwritten, but only -- joined together. -- -- This is the cleanest way i could think of, that doesn't require -- changing all field parsing functions to return modifiers instead.
1,553
flattenPackageDescription :: GenericPackageDescription -> PackageDescription flattenPackageDescription (GenericPackageDescription pkg _ mlib0 exes0 tests0 bms0) = pkg { library = mlib , executables = reverse exes , testSuites = reverse tests , benchmarks = reverse bms , buildDepends = ldeps ++ reverse edeps ++ reverse tdeps ++ reverse bdeps } where (mlib, ldeps) = case mlib0 of Just lib -> let (l,ds) = ignoreConditions lib in (Just (libFillInDefaults l), ds) Nothing -> (Nothing, []) (exes, edeps) = foldr flattenExe ([],[]) exes0 (tests, tdeps) = foldr flattenTst ([],[]) tests0 (bms, bdeps) = foldr flattenBm ([],[]) bms0 flattenExe (n, t) (es, ds) = let (e, ds') = ignoreConditions t in ( (exeFillInDefaults $ e { exeName = n }) : es, ds' ++ ds ) flattenTst (n, t) (es, ds) = let (e, ds') = ignoreConditions t in ( (testFillInDefaults $ e { testName = n }) : es, ds' ++ ds ) flattenBm (n, t) (es, ds) = let (e, ds') = ignoreConditions t in ( (benchFillInDefaults $ e { benchmarkName = n }) : es, ds' ++ ds ) -- This is in fact rather a hack. The original version just overrode the -- default values, however, when adding conditions we had to switch to a -- modifier-based approach. There, nothing is ever overwritten, but only -- joined together. -- -- This is the cleanest way i could think of, that doesn't require -- changing all field parsing functions to return modifiers instead.
1,553
flattenPackageDescription (GenericPackageDescription pkg _ mlib0 exes0 tests0 bms0) = pkg { library = mlib , executables = reverse exes , testSuites = reverse tests , benchmarks = reverse bms , buildDepends = ldeps ++ reverse edeps ++ reverse tdeps ++ reverse bdeps } where (mlib, ldeps) = case mlib0 of Just lib -> let (l,ds) = ignoreConditions lib in (Just (libFillInDefaults l), ds) Nothing -> (Nothing, []) (exes, edeps) = foldr flattenExe ([],[]) exes0 (tests, tdeps) = foldr flattenTst ([],[]) tests0 (bms, bdeps) = foldr flattenBm ([],[]) bms0 flattenExe (n, t) (es, ds) = let (e, ds') = ignoreConditions t in ( (exeFillInDefaults $ e { exeName = n }) : es, ds' ++ ds ) flattenTst (n, t) (es, ds) = let (e, ds') = ignoreConditions t in ( (testFillInDefaults $ e { testName = n }) : es, ds' ++ ds ) flattenBm (n, t) (es, ds) = let (e, ds') = ignoreConditions t in ( (benchFillInDefaults $ e { benchmarkName = n }) : es, ds' ++ ds ) -- This is in fact rather a hack. The original version just overrode the -- default values, however, when adding conditions we had to switch to a -- modifier-based approach. There, nothing is ever overwritten, but only -- joined together. -- -- This is the cleanest way i could think of, that doesn't require -- changing all field parsing functions to return modifiers instead.
1,476
false
true
0
13
401
503
267
236
null
null
JPMoresmau/haddock
haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
bsd-2-clause
-- Drop top-level for-all type variables in user style -- since they are implicit in Haskell ppForAllCon :: HsExplicitFlag -> LHsTyVarBndrs DocName -> Located (HsContext DocName) -> Unicode -> Qualification -> Html ppForAllCon expl tvs cxt unicode qual = forall_part <+> ppLContext cxt unicode qual where forall_part = ppLTyVarBndrs expl tvs unicode qual
372
ppForAllCon :: HsExplicitFlag -> LHsTyVarBndrs DocName -> Located (HsContext DocName) -> Unicode -> Qualification -> Html ppForAllCon expl tvs cxt unicode qual = forall_part <+> ppLContext cxt unicode qual where forall_part = ppLTyVarBndrs expl tvs unicode qual
278
ppForAllCon expl tvs cxt unicode qual = forall_part <+> ppLContext cxt unicode qual where forall_part = ppLTyVarBndrs expl tvs unicode qual
147
true
true
0
10
70
84
41
43
null
null
thomie/vector
Data/Vector/Unboxed/Mutable.hs
bsd-3-clause
drop = G.drop
13
drop = G.drop
13
drop = G.drop
13
false
false
1
6
2
12
4
8
null
null
acamino/state-codes
src/Data/StateCodes/ISO31662US.hs
mit
toText ND = "ND"
16
toText ND = "ND"
16
toText ND = "ND"
16
false
false
0
5
3
9
4
5
null
null
poiuj/pfcc
src/Codegen.hs
bsd-3-clause
codegenMethod :: Syntax.Name -> Feature -> LLVM () codegenMethod currClassName (Method name formals return body) = defun currClassName name formals return body
159
codegenMethod :: Syntax.Name -> Feature -> LLVM () codegenMethod currClassName (Method name formals return body) = defun currClassName name formals return body
159
codegenMethod currClassName (Method name formals return body) = defun currClassName name formals return body
108
false
true
0
8
21
58
27
31
null
null
zaxtax/hsbib
Console.hs
gpl-2.0
commands :: [CommandDescr] commands = [("help", " -- show help", complete_cmds) ,("open", " -- open document", complete_none) ,("dump", " -- dump entries to a file",complete_file) ,("load", " -- load bibtex file",complete_file) ,("find", " -- find documents",complete_none) ,("quit", " -- quit", complete_none)]
379
commands :: [CommandDescr] commands = [("help", " -- show help", complete_cmds) ,("open", " -- open document", complete_none) ,("dump", " -- dump entries to a file",complete_file) ,("load", " -- load bibtex file",complete_file) ,("find", " -- find documents",complete_none) ,("quit", " -- quit", complete_none)]
379
commands = [("help", " -- show help", complete_cmds) ,("open", " -- open document", complete_none) ,("dump", " -- dump entries to a file",complete_file) ,("load", " -- load bibtex file",complete_file) ,("find", " -- find documents",complete_none) ,("quit", " -- quit", complete_none)]
352
false
true
0
6
108
86
56
30
null
null
sahnib/haskell-make
src/Make/DependencyBuilder.hs
mit
ruleForTarget :: Target -> [Rule] -> Maybe Rule ruleForTarget t [] = Nothing
76
ruleForTarget :: Target -> [Rule] -> Maybe Rule ruleForTarget t [] = Nothing
76
ruleForTarget t [] = Nothing
28
false
true
0
7
12
32
16
16
null
null
DaMSL/K3
src/Language/K3/Analysis/Provenance/Constructors.hs
apache-2.0
pderivedTI :: Int -> [TrIndex] -> [K3 Provenance] -> (TrIndex, K3 Provenance) pderivedTI sz tich ch = mkNode $! simplifyChildrenTI (== PDerived) tich ch where mkNode (_,[]) = (tileaf $! zerobv sz, ptemp) mkNode (tichl, chl) = (orti tichl, Node (PDerived :@: []) chl)
276
pderivedTI :: Int -> [TrIndex] -> [K3 Provenance] -> (TrIndex, K3 Provenance) pderivedTI sz tich ch = mkNode $! simplifyChildrenTI (== PDerived) tich ch where mkNode (_,[]) = (tileaf $! zerobv sz, ptemp) mkNode (tichl, chl) = (orti tichl, Node (PDerived :@: []) chl)
276
pderivedTI sz tich ch = mkNode $! simplifyChildrenTI (== PDerived) tich ch where mkNode (_,[]) = (tileaf $! zerobv sz, ptemp) mkNode (tichl, chl) = (orti tichl, Node (PDerived :@: []) chl)
198
false
true
1
10
53
132
70
62
null
null
JamieBeverley/InnerEar
src/InnerEar/Exercises/SpectralShape.hs
gpl-3.0
getShape Linear = fmap (ampdb . (\x -> 1/x)) [1,2 .. 200]
57
getShape Linear = fmap (ampdb . (\x -> 1/x)) [1,2 .. 200]
57
getShape Linear = fmap (ampdb . (\x -> 1/x)) [1,2 .. 200]
57
false
false
0
10
11
42
23
19
null
null
rgaiacs/pandoc
src/Text/Pandoc/Writers/RST.hs
gpl-2.0
registerImage :: [Inline] -> Target -> Maybe String -> State WriterState Doc registerImage alt (src,tit) mbtarget = do pics <- get >>= return . stImages txt <- case lookup alt pics of Just (s,t,mbt) | (s,t,mbt) == (src,tit,mbtarget) -> return alt _ -> do let alt' = if null alt || alt == [Str ""] then [Str $ "image" ++ show (length pics)] else alt modify $ \st -> st { stImages = (alt', (src,tit, mbtarget)):stImages st } return alt' inlineListToRST txt
627
registerImage :: [Inline] -> Target -> Maybe String -> State WriterState Doc registerImage alt (src,tit) mbtarget = do pics <- get >>= return . stImages txt <- case lookup alt pics of Just (s,t,mbt) | (s,t,mbt) == (src,tit,mbtarget) -> return alt _ -> do let alt' = if null alt || alt == [Str ""] then [Str $ "image" ++ show (length pics)] else alt modify $ \st -> st { stImages = (alt', (src,tit, mbtarget)):stImages st } return alt' inlineListToRST txt
627
registerImage alt (src,tit) mbtarget = do pics <- get >>= return . stImages txt <- case lookup alt pics of Just (s,t,mbt) | (s,t,mbt) == (src,tit,mbtarget) -> return alt _ -> do let alt' = if null alt || alt == [Str ""] then [Str $ "image" ++ show (length pics)] else alt modify $ \st -> st { stImages = (alt', (src,tit, mbtarget)):stImages st } return alt' inlineListToRST txt
550
false
true
0
21
254
241
123
118
null
null
mkawalec/twitterbot
src/Main.hs
gpl-3.0
getConfigMap :: T.Text -> IO Config getConfigMap config = return $ Map.fromList pairs where stringify = T.unpack . T.strip pair = \[x, y] -> (stringify x, stringify y) processLine = pair . (T.split (=='=')) correctLines = filter (T.any (=='=')) (T.lines config) pairs = map processLine correctLines
342
getConfigMap :: T.Text -> IO Config getConfigMap config = return $ Map.fromList pairs where stringify = T.unpack . T.strip pair = \[x, y] -> (stringify x, stringify y) processLine = pair . (T.split (=='=')) correctLines = filter (T.any (=='=')) (T.lines config) pairs = map processLine correctLines
342
getConfigMap config = return $ Map.fromList pairs where stringify = T.unpack . T.strip pair = \[x, y] -> (stringify x, stringify y) processLine = pair . (T.split (=='=')) correctLines = filter (T.any (=='=')) (T.lines config) pairs = map processLine correctLines
306
false
true
4
12
89
142
72
70
null
null
aaronc/Idris-dev
src/Idris/Core/TT.hs
bsd-3-clause
getRetTy (Bind n (PVTy _) sc) = getRetTy sc
43
getRetTy (Bind n (PVTy _) sc) = getRetTy sc
43
getRetTy (Bind n (PVTy _) sc) = getRetTy sc
43
false
false
0
8
8
29
13
16
null
null
jfranklin9000/urbit
pkg/hs/urbit-king/lib/Urbit/King/App.hs
mit
runAppLogFile :: RIO App a -> IO a runAppLogFile inner = withLogFileHandle $ \h -> do logOptions <- logOptionsHandle h True <&> setLogUseTime True <&> setLogUseLoc False stderrLogOptions <- logOptionsHandle stderr True <&> setLogUseTime False <&> setLogUseLoc False withLogFunc stderrLogOptions $ \stderrLogFunc -> withLogFunc logOptions $ \logFunc -> runRIO (App logFunc stderrLogFunc) inner
473
runAppLogFile :: RIO App a -> IO a runAppLogFile inner = withLogFileHandle $ \h -> do logOptions <- logOptionsHandle h True <&> setLogUseTime True <&> setLogUseLoc False stderrLogOptions <- logOptionsHandle stderr True <&> setLogUseTime False <&> setLogUseLoc False withLogFunc stderrLogOptions $ \stderrLogFunc -> withLogFunc logOptions $ \logFunc -> runRIO (App logFunc stderrLogFunc) inner
473
runAppLogFile inner = withLogFileHandle $ \h -> do logOptions <- logOptionsHandle h True <&> setLogUseTime True <&> setLogUseLoc False stderrLogOptions <- logOptionsHandle stderr True <&> setLogUseTime False <&> setLogUseLoc False withLogFunc stderrLogOptions $ \stderrLogFunc -> withLogFunc logOptions $ \logFunc -> runRIO (App logFunc stderrLogFunc) inner
438
false
true
0
16
133
131
59
72
null
null
kairuku/stack
src/Stack/Types/Config.hs
bsd-3-clause
configShakeFilesDir :: (MonadReader env m, HasBuildConfig env) => m (Path Abs Dir) configShakeFilesDir = liftM (</> $(mkRelDir "shake")) configProjectWorkDir
157
configShakeFilesDir :: (MonadReader env m, HasBuildConfig env) => m (Path Abs Dir) configShakeFilesDir = liftM (</> $(mkRelDir "shake")) configProjectWorkDir
157
configShakeFilesDir = liftM (</> $(mkRelDir "shake")) configProjectWorkDir
74
false
true
0
9
18
60
29
31
null
null
xicesky/sky-haskell-playground
src/Sky/Compositional/Demo2Parametric.hs
bsd-3-clause
evalAlg5 :: Exp5 IntFn IntFn -> IntFn evalAlg5 (Error5) = error "Encountered error"
85
evalAlg5 :: Exp5 IntFn IntFn -> IntFn evalAlg5 (Error5) = error "Encountered error"
85
evalAlg5 (Error5) = error "Encountered error"
47
false
true
0
6
14
29
14
15
null
null
fmapfmapfmap/amazonka
amazonka-elasticache/gen/Network/AWS/ElastiCache/Types/Product.hs
mpl-2.0
-- | Creates a value of 'ParameterNameValue' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'pnvParameterValue' -- -- * 'pnvParameterName' parameterNameValue :: ParameterNameValue parameterNameValue = ParameterNameValue' { _pnvParameterValue = Nothing , _pnvParameterName = Nothing }
389
parameterNameValue :: ParameterNameValue parameterNameValue = ParameterNameValue' { _pnvParameterValue = Nothing , _pnvParameterName = Nothing }
164
parameterNameValue = ParameterNameValue' { _pnvParameterValue = Nothing , _pnvParameterName = Nothing }
119
true
true
0
6
72
32
22
10
null
null
sopvop/cabal
Cabal/tests/PackageTests/PackageTester.hs
bsd-3-clause
record :: Result -> TestM () record res = do log_dir <- topDir (suite, _) <- ask liftIO $ createDirectoryIfMissing True log_dir liftIO $ C.appendFile (log_dir </> "test.log") (C.pack $ "+ " ++ resultCommand res ++ "\n" ++ resultOutput res ++ "\n\n") let test_sh = log_dir </> "test.sh" b <- liftIO $ doesFileExist test_sh when (not b) . liftIO $ do -- This is hella racey but this is not that security important C.appendFile test_sh (C.pack $ "#/bin/sh\nset -ev\n" ++ "cd "++ show (absoluteCWD suite) ++"\n") perms <- getPermissions test_sh setPermissions test_sh (setOwnerExecutable True perms) liftIO $ C.appendFile test_sh (C.pack (case resultDirectory res of Nothing -> resultCommand res Just d -> "(cd " ++ show d ++ " && " ++ resultCommand res ++ ")\n")) ------------------------------------------------------------------------ -- * Test helpers
1,078
record :: Result -> TestM () record res = do log_dir <- topDir (suite, _) <- ask liftIO $ createDirectoryIfMissing True log_dir liftIO $ C.appendFile (log_dir </> "test.log") (C.pack $ "+ " ++ resultCommand res ++ "\n" ++ resultOutput res ++ "\n\n") let test_sh = log_dir </> "test.sh" b <- liftIO $ doesFileExist test_sh when (not b) . liftIO $ do -- This is hella racey but this is not that security important C.appendFile test_sh (C.pack $ "#/bin/sh\nset -ev\n" ++ "cd "++ show (absoluteCWD suite) ++"\n") perms <- getPermissions test_sh setPermissions test_sh (setOwnerExecutable True perms) liftIO $ C.appendFile test_sh (C.pack (case resultDirectory res of Nothing -> resultCommand res Just d -> "(cd " ++ show d ++ " && " ++ resultCommand res ++ ")\n")) ------------------------------------------------------------------------ -- * Test helpers
1,078
record res = do log_dir <- topDir (suite, _) <- ask liftIO $ createDirectoryIfMissing True log_dir liftIO $ C.appendFile (log_dir </> "test.log") (C.pack $ "+ " ++ resultCommand res ++ "\n" ++ resultOutput res ++ "\n\n") let test_sh = log_dir </> "test.sh" b <- liftIO $ doesFileExist test_sh when (not b) . liftIO $ do -- This is hella racey but this is not that security important C.appendFile test_sh (C.pack $ "#/bin/sh\nset -ev\n" ++ "cd "++ show (absoluteCWD suite) ++"\n") perms <- getPermissions test_sh setPermissions test_sh (setOwnerExecutable True perms) liftIO $ C.appendFile test_sh (C.pack (case resultDirectory res of Nothing -> resultCommand res Just d -> "(cd " ++ show d ++ " && " ++ resultCommand res ++ ")\n")) ------------------------------------------------------------------------ -- * Test helpers
1,049
false
true
0
19
356
295
138
157
null
null
geophf/1HaskellADay
exercises/HAD/Y2020/M07/D23/Exercise.hs
mit
-- so, some image processors only work with TIFFs. Convert the above image -- (the JPEG file) and save it as a TIFF. convertToTiff :: FilePath -> FilePath -> IO () convertToTiff jpgFileIn tiffFileOut = undefined
212
convertToTiff :: FilePath -> FilePath -> IO () convertToTiff jpgFileIn tiffFileOut = undefined
94
convertToTiff jpgFileIn tiffFileOut = undefined
47
true
true
0
8
36
31
16
15
null
null
aartifact/aartifact-verifier
src/ContextRelations.hs
mit
convArgs ixs n js nes ((App e1 e2):es) = case convArgs ixs (n-1) [] [] [e1,e2] of Just (n',as',nes') -> convArgs ixs n' (n:js) (((SLC Eql Apply,n:as'):nes') ++ nes) es Nothing -> Nothing
196
convArgs ixs n js nes ((App e1 e2):es) = case convArgs ixs (n-1) [] [] [e1,e2] of Just (n',as',nes') -> convArgs ixs n' (n:js) (((SLC Eql Apply,n:as'):nes') ++ nes) es Nothing -> Nothing
196
convArgs ixs n js nes ((App e1 e2):es) = case convArgs ixs (n-1) [] [] [e1,e2] of Just (n',as',nes') -> convArgs ixs n' (n:js) (((SLC Eql Apply,n:as'):nes') ++ nes) es Nothing -> Nothing
196
false
false
0
14
42
135
71
64
null
null
JohnLato/jaek
src/Jaek/UI/Views.hs
lgpl-3.0
addWaveNode :: TreeZip -> ViewMap -> ViewMap addWaveNode tz mp = M.insert (liftT nodePath cur) (WaveView 0 srcdur) mp where cur = hole tz srcdur = foldl' max 0 . map getDur $ getExprs cur
195
addWaveNode :: TreeZip -> ViewMap -> ViewMap addWaveNode tz mp = M.insert (liftT nodePath cur) (WaveView 0 srcdur) mp where cur = hole tz srcdur = foldl' max 0 . map getDur $ getExprs cur
195
addWaveNode tz mp = M.insert (liftT nodePath cur) (WaveView 0 srcdur) mp where cur = hole tz srcdur = foldl' max 0 . map getDur $ getExprs cur
150
false
true
1
7
42
90
41
49
null
null
allanderek/ipclib
examples/PepaTimed.hs
gpl-2.0
processArgs files = mapM_ (convertFile False) files
73
processArgs files = mapM_ (convertFile False) files
73
processArgs files = mapM_ (convertFile False) files
73
false
false
0
7
28
20
9
11
null
null
aelve/shortcut-links
src/ShortcutLinks/All.hs
bsd-3-clause
telegram :: Shortcut telegram _ q | T.null q = pure url | Just ('@', username) <- T.uncons q = pure $ formatSlash url username | otherwise = pure $ formatSlash url q where url :: Text url = "https://t.me" {- | <https://twitter.com Twitter> (shortcut: “t” or “twitter”) Link by username: @ \[Edward Kmett\](\@t:kmett) <https://twitter.com/kmett> @ It's alright if the username already starts with a “\@”: @ \[\@kmett\](\@t) <https://twitter.com/kmett> @ There are different links for hashtags: @ \[#haskell\](\@t) <https://twitter.com/hashtag/haskell> @ -}
595
telegram :: Shortcut telegram _ q | T.null q = pure url | Just ('@', username) <- T.uncons q = pure $ formatSlash url username | otherwise = pure $ formatSlash url q where url :: Text url = "https://t.me" {- | <https://twitter.com Twitter> (shortcut: “t” or “twitter”) Link by username: @ \[Edward Kmett\](\@t:kmett) <https://twitter.com/kmett> @ It's alright if the username already starts with a “\@”: @ \[\@kmett\](\@t) <https://twitter.com/kmett> @ There are different links for hashtags: @ \[#haskell\](\@t) <https://twitter.com/hashtag/haskell> @ -}
595
telegram _ q | T.null q = pure url | Just ('@', username) <- T.uncons q = pure $ formatSlash url username | otherwise = pure $ formatSlash url q where url :: Text url = "https://t.me" {- | <https://twitter.com Twitter> (shortcut: “t” or “twitter”) Link by username: @ \[Edward Kmett\](\@t:kmett) <https://twitter.com/kmett> @ It's alright if the username already starts with a “\@”: @ \[\@kmett\](\@t) <https://twitter.com/kmett> @ There are different links for hashtags: @ \[#haskell\](\@t) <https://twitter.com/hashtag/haskell> @ -}
574
false
true
0
10
120
114
50
64
null
null
jameshsmith/HRL
Server/Core/DijkstraMap.hs
mit
mkDijkstraMap' :: [(Row, Col)] -> Word -> UArray (Row, Col) Bool -> STUArray s (Row, Col) Word -> ST s () mkDijkstraMap' [] _ _ _ = return ()
141
mkDijkstraMap' :: [(Row, Col)] -> Word -> UArray (Row, Col) Bool -> STUArray s (Row, Col) Word -> ST s () mkDijkstraMap' [] _ _ _ = return ()
141
mkDijkstraMap' [] _ _ _ = return ()
35
false
true
0
10
28
83
43
40
null
null
wowofbob/gol
src/Game.hs
bsd-3-clause
-- ^^^^^^^^^^^^^^^^ -- Returns coordinates of alive cells on grid. aliveCells :: Grid -> [(Int, Int)] aliveCells (Grid state _ _) = G.aliveCoords state
154
aliveCells :: Grid -> [(Int, Int)] aliveCells (Grid state _ _) = G.aliveCoords state
84
aliveCells (Grid state _ _) = G.aliveCoords state
49
true
true
0
7
26
44
24
20
null
null
beni55/ghcjs
test/ghc/integer/integerConstantFolding.hs
mit
leIntegerG :: Bool leIntegerG = (100026 :: Integer) <= 100025
61
leIntegerG :: Bool leIntegerG = (100026 :: Integer) <= 100025
61
leIntegerG = (100026 :: Integer) <= 100025
42
false
true
0
6
9
21
12
9
null
null
nfjinjing/haskore-guide
src/bach_prelude.hs
bsd-3-clause
repeat_last_3 xs = xs ++ ( P.reverse $ P.take 3 $ P.reverse xs )
64
repeat_last_3 xs = xs ++ ( P.reverse $ P.take 3 $ P.reverse xs )
64
repeat_last_3 xs = xs ++ ( P.reverse $ P.take 3 $ P.reverse xs )
64
false
false
0
10
13
36
17
19
null
null
Marcus-Rosti/numerical-methods
src/ch_09/Ch_09.hs
gpl-2.0
boundedMin :: (Double -> Double) -- ^ function -> Double -- ^ leftmost point -> Double -- ^ rightmost point -> Double -- ^ error bound -> Double -- ^ result within bound boundedMin func a b err | abs (x3 - x0) <= err = (x0 + x3) / 2 | func x1 > func x2 = boundedMin func x1 x3 err | otherwise = boundedMin func x0 x2 err where phi = (sqrt 5 - 1) / 2 x0 = a x1 = a + (b-a) * (1-phi) x2 = a + (b-a) * phi x3 = b
453
boundedMin :: (Double -> Double) -- ^ function -> Double -- ^ leftmost point -> Double -- ^ rightmost point -> Double -- ^ error bound -> Double boundedMin func a b err | abs (x3 - x0) <= err = (x0 + x3) / 2 | func x1 > func x2 = boundedMin func x1 x3 err | otherwise = boundedMin func x0 x2 err where phi = (sqrt 5 - 1) / 2 x0 = a x1 = a + (b-a) * (1-phi) x2 = a + (b-a) * phi x3 = b
428
boundedMin func a b err | abs (x3 - x0) <= err = (x0 + x3) / 2 | func x1 > func x2 = boundedMin func x1 x3 err | otherwise = boundedMin func x0 x2 err where phi = (sqrt 5 - 1) / 2 x0 = a x1 = a + (b-a) * (1-phi) x2 = a + (b-a) * phi x3 = b
279
true
true
5
12
143
213
106
107
null
null
jthornber/language-c-ejt
src/Language/C/Analysis/NameSpaceMap.hs
bsd-3-clause
-- | create a name space nameSpaceMap :: (Ord k) => NameSpaceMap k v nameSpaceMap = NsMap Map.empty []
103
nameSpaceMap :: (Ord k) => NameSpaceMap k v nameSpaceMap = NsMap Map.empty []
78
nameSpaceMap = NsMap Map.empty []
34
true
true
0
6
19
35
18
17
null
null
d3sformal/bacon-core
src/Domain/Trans/FunctionAwareDomain.hs
mit
-- Means of extracting results runFunctionAwareDomainT :: MonadDomain d => System -> FunctionAwareDomainT d a -> d a runFunctionAwareDomainT sys ma = runLocationAwareDomainT sys (error "undefined function") $ runReaderT (unpack ma) (FunctionAwareState sys)
325
runFunctionAwareDomainT :: MonadDomain d => System -> FunctionAwareDomainT d a -> d a runFunctionAwareDomainT sys ma = runLocationAwareDomainT sys (error "undefined function") $ runReaderT (unpack ma) (FunctionAwareState sys)
294
runFunctionAwareDomainT sys ma = runLocationAwareDomainT sys (error "undefined function") $ runReaderT (unpack ma) (FunctionAwareState sys)
139
true
true
0
9
101
76
35
41
null
null
rueshyna/gogol
gogol-adexchange-buyer/gen/Network/Google/AdExchangeBuyer/Types/Product.hs
mpl-2.0
-- | The pair of (seller.account_id, profile_id) uniquely identifies a -- publisher profile for a given publisher. ppfapProFileId :: Lens' PublisherProFileAPIProto (Maybe Int32) ppfapProFileId = lens _ppfapProFileId (\ s a -> s{_ppfapProFileId = a}) . mapping _Coerce
281
ppfapProFileId :: Lens' PublisherProFileAPIProto (Maybe Int32) ppfapProFileId = lens _ppfapProFileId (\ s a -> s{_ppfapProFileId = a}) . mapping _Coerce
166
ppfapProFileId = lens _ppfapProFileId (\ s a -> s{_ppfapProFileId = a}) . mapping _Coerce
103
true
true
2
8
50
60
29
31
null
null
haskell-infra/cloudflare
src/CloudFlare.hs
bsd-3-clause
setCacheLevel :: Account -> Zone -> CacheLevel -> IO (Either Text ()) setCacheLevel a z lvl = postCf k a "cache_lvl" [ "z" := z, "v" := lvlStr lvl ] where k _ = return () lvlStr :: CacheLevel -> T.Text lvlStr Basic = "basic" lvlStr Aggressive = "agg" -- | Get the IDs for a particular Domain.
316
setCacheLevel :: Account -> Zone -> CacheLevel -> IO (Either Text ()) setCacheLevel a z lvl = postCf k a "cache_lvl" [ "z" := z, "v" := lvlStr lvl ] where k _ = return () lvlStr :: CacheLevel -> T.Text lvlStr Basic = "basic" lvlStr Aggressive = "agg" -- | Get the IDs for a particular Domain.
316
setCacheLevel a z lvl = postCf k a "cache_lvl" [ "z" := z, "v" := lvlStr lvl ] where k _ = return () lvlStr :: CacheLevel -> T.Text lvlStr Basic = "basic" lvlStr Aggressive = "agg" -- | Get the IDs for a particular Domain.
246
false
true
0
11
81
125
58
67
null
null
Soostone/snaplet-persistent
example/Site.hs
bsd-3-clause
addHandler :: Handler App App () addHandler = do mname <- getParam "uname" let name = maybe "guest" T.decodeUtf8 mname u <- with auth $ createUser name "" liftIO $ print u ------------------------------------------------------------------------------ -- | The application initializer.
301
addHandler :: Handler App App () addHandler = do mname <- getParam "uname" let name = maybe "guest" T.decodeUtf8 mname u <- with auth $ createUser name "" liftIO $ print u ------------------------------------------------------------------------------ -- | The application initializer.
301
addHandler = do mname <- getParam "uname" let name = maybe "guest" T.decodeUtf8 mname u <- with auth $ createUser name "" liftIO $ print u ------------------------------------------------------------------------------ -- | The application initializer.
268
false
true
1
12
54
84
36
48
null
null
rjwright/js-typeomatic
TypeRules.hs
apache-2.0
- They type of a return statement is they same as the type of the expression it returns. astChildRules (LabReturn ex, n, sourceFragment) dIDs = [Rule (Meta n) (childWSToMeta ex) (Just sourceFragment)] ++ (exprChildRules ex dIDs)
237
astChildRules (LabReturn ex, n, sourceFragment) dIDs = [Rule (Meta n) (childWSToMeta ex) (Just sourceFragment)] ++ (exprChildRules ex dIDs)
147
astChildRules (LabReturn ex, n, sourceFragment) dIDs = [Rule (Meta n) (childWSToMeta ex) (Just sourceFragment)] ++ (exprChildRules ex dIDs)
147
true
false
8
8
44
68
38
30
null
null
sdiehl/ghc
libraries/base/codepages/MakeTable.hs
bsd-3-clause
repDualByte :: Enum c => c -> String repDualByte c | n >= 2^(16::Int) = errorWithoutStackTrace "value is too high!" -- NOTE : this assumes little-endian architecture. But we're only using this on Windows, -- so it's probably OK. | otherwise = showHex' (n `mod` 256) ++ showHex' (n `div` 256) where n = fromEnum c
335
repDualByte :: Enum c => c -> String repDualByte c | n >= 2^(16::Int) = errorWithoutStackTrace "value is too high!" -- NOTE : this assumes little-endian architecture. But we're only using this on Windows, -- so it's probably OK. | otherwise = showHex' (n `mod` 256) ++ showHex' (n `div` 256) where n = fromEnum c
335
repDualByte c | n >= 2^(16::Int) = errorWithoutStackTrace "value is too high!" -- NOTE : this assumes little-endian architecture. But we're only using this on Windows, -- so it's probably OK. | otherwise = showHex' (n `mod` 256) ++ showHex' (n `div` 256) where n = fromEnum c
298
false
true
1
9
78
109
52
57
null
null
llelf/float-binstring
Data/Float/BinString.hs
bsd-3-clause
parser = do r <- try parserPeculiar <|> parserNormal endOfInput return r
96
parser = do r <- try parserPeculiar <|> parserNormal endOfInput return r
96
parser = do r <- try parserPeculiar <|> parserNormal endOfInput return r
96
false
false
0
9
35
29
12
17
null
null
rosenbergdm/language-r
src/Language/R/sketches/InFin.hs
bsd-3-clause
evalI (Fix f) = evalI (f (Fix f))
33
evalI (Fix f) = evalI (f (Fix f))
33
evalI (Fix f) = evalI (f (Fix f))
33
false
false
0
9
7
31
14
17
null
null
nbloomf/st-haskell
src/STH/Copy/Main.hs
gpl-3.0
main :: IO () main = do args <- getArgs mode <- case args of ["--char"] -> return Chars otherwise -> return Lines case mode of Chars -> charFilter id Lines -> lineFilter id exitSuccess
212
main :: IO () main = do args <- getArgs mode <- case args of ["--char"] -> return Chars otherwise -> return Lines case mode of Chars -> charFilter id Lines -> lineFilter id exitSuccess
212
main = do args <- getArgs mode <- case args of ["--char"] -> return Chars otherwise -> return Lines case mode of Chars -> charFilter id Lines -> lineFilter id exitSuccess
198
false
true
0
11
62
83
38
45
null
null
flipstone/orville
orville-postgresql/src/Database/Orville/PostgreSQL/Internal/QueryKey.hs
mit
compareSqlValue _ (SqlByteString _) = GT
40
compareSqlValue _ (SqlByteString _) = GT
40
compareSqlValue _ (SqlByteString _) = GT
40
false
false
0
7
5
17
8
9
null
null
iemxblog/sivi-haskell
src/Sivi/Operation/Pocket.hs
gpl-2.0
rectangularSpiral :: Num a => a -- ^ sx : Spacing betwenn each turn for the x axis -> a -- ^ sy : Spacing between each turn for the y axis -> [(a, a)] -- ^ Resulting rectangular spiral rectangularSpiral = rectangularSpiralR (0, 0) 1
382
rectangularSpiral :: Num a => a -- ^ sx : Spacing betwenn each turn for the x axis -> a -- ^ sy : Spacing between each turn for the y axis -> [(a, a)] rectangularSpiral = rectangularSpiralR (0, 0) 1
328
rectangularSpiral = rectangularSpiralR (0, 0) 1
47
true
true
0
9
195
49
28
21
null
null
jvranish/TheExperiment
test/ETests/Parser/Type.hs
bsd-3-clause
testParseType :: IO Specs testParseType = hspec aTypeSpecs
58
testParseType :: IO Specs testParseType = hspec aTypeSpecs
58
testParseType = hspec aTypeSpecs
32
false
true
0
5
7
17
8
9
null
null
OS2World/DEV-UTIL-HUGS
demos/Expr.hs
bsd-3-clause
many :: Parser a -> Parser [a] many p = q where q = p &&& q >>> (\(x,xs) -> x:xs) ||| result []
166
many :: Parser a -> Parser [a] many p = q where q = p &&& q >>> (\(x,xs) -> x:xs) ||| result []
166
many p = q where q = p &&& q >>> (\(x,xs) -> x:xs) ||| result []
127
false
true
0
11
94
69
36
33
null
null
unisonweb/platform
parser-typechecker/src/Unison/Util/Pretty.hs
mit
spacedMap :: (Foldable f, IsString s) => (a -> Pretty s) -> f a -> Pretty s spacedMap f as = spaced . fmap f $ toList as
120
spacedMap :: (Foldable f, IsString s) => (a -> Pretty s) -> f a -> Pretty s spacedMap f as = spaced . fmap f $ toList as
120
spacedMap f as = spaced . fmap f $ toList as
44
false
true
0
9
27
69
33
36
null
null
Garciat/SocketsToy
src/Main.hs
mit
headers :: Parser [HttpHeader] headers = many genericHeader
59
headers :: Parser [HttpHeader] headers = many genericHeader
59
headers = many genericHeader
28
false
true
0
7
7
26
11
15
null
null
snoyberg/ghc
compiler/hsSyn/HsPat.hs
bsd-3-clause
pprConArgs :: (OutputableBndrId id) => HsConPatDetails id -> SDoc pprConArgs (PrefixCon pats) = sep (map pprParendLPat pats)
124
pprConArgs :: (OutputableBndrId id) => HsConPatDetails id -> SDoc pprConArgs (PrefixCon pats) = sep (map pprParendLPat pats)
124
pprConArgs (PrefixCon pats) = sep (map pprParendLPat pats)
58
false
true
0
7
16
51
24
27
null
null
jamshidh/ethereum-vm
src/Blockchain/VM/PrecompiledContracts.hs
bsd-3-clause
callPrecompiledContract 3 inputData = do useGas $ gRIPEMD160BASE + gRIPEMD160WORD*(ceiling $ fromIntegral (B.length inputData)/(32::Double)) return $ ripemd inputData
174
callPrecompiledContract 3 inputData = do useGas $ gRIPEMD160BASE + gRIPEMD160WORD*(ceiling $ fromIntegral (B.length inputData)/(32::Double)) return $ ripemd inputData
174
callPrecompiledContract 3 inputData = do useGas $ gRIPEMD160BASE + gRIPEMD160WORD*(ceiling $ fromIntegral (B.length inputData)/(32::Double)) return $ ripemd inputData
174
false
false
0
14
25
64
31
33
null
null
smobs/Ratscrew
tests/Ratscrew/Game/Internal/Snapping/Tests.hs
mit
singleSnap :: ([Card], [Card]) -> Rank -> (Suit, Suit) -> [Card] singleSnap (d1, d2) r (s1, s2) = d1 ++ [Card r s1, Card r s2] ++ d2
133
singleSnap :: ([Card], [Card]) -> Rank -> (Suit, Suit) -> [Card] singleSnap (d1, d2) r (s1, s2) = d1 ++ [Card r s1, Card r s2] ++ d2
133
singleSnap (d1, d2) r (s1, s2) = d1 ++ [Card r s1, Card r s2] ++ d2
68
false
true
0
8
28
87
49
38
null
null
snapframework/snap-core
test/Snap/Util/FileUploads/Tests.hs
bsd-3-clause
testNoFileNameTooBig :: Test testNoFileNameTooBig = testCase "fileUploads/noFileNameTooBig" $ assertThrows (harness tmpdir hndl noFileNameTestBody) h where h !(e :: FileUploadException) = do let r = fileUploadExceptionReason e assertBool "correct exception" (T.isInfixOf "File" r && T.isInfixOf "exceeded maximum allowable size" r) tmpdir = "tempdir_noname_toobig" hndl = handleFileUploads tmpdir defaultUploadPolicy (const $ allowWithMaximumSize 1) hndl' hndl' pinfo !e = do let (Left !x) = e coverShowInstance x assertEqual "filename" Nothing $ partFileName pinfo assertEqual "disposition" DispositionFile $ partDisposition pinfo throwIO x ------------------------------------------------------------------------------
919
testNoFileNameTooBig :: Test testNoFileNameTooBig = testCase "fileUploads/noFileNameTooBig" $ assertThrows (harness tmpdir hndl noFileNameTestBody) h where h !(e :: FileUploadException) = do let r = fileUploadExceptionReason e assertBool "correct exception" (T.isInfixOf "File" r && T.isInfixOf "exceeded maximum allowable size" r) tmpdir = "tempdir_noname_toobig" hndl = handleFileUploads tmpdir defaultUploadPolicy (const $ allowWithMaximumSize 1) hndl' hndl' pinfo !e = do let (Left !x) = e coverShowInstance x assertEqual "filename" Nothing $ partFileName pinfo assertEqual "disposition" DispositionFile $ partDisposition pinfo throwIO x ------------------------------------------------------------------------------
919
testNoFileNameTooBig = testCase "fileUploads/noFileNameTooBig" $ assertThrows (harness tmpdir hndl noFileNameTestBody) h where h !(e :: FileUploadException) = do let r = fileUploadExceptionReason e assertBool "correct exception" (T.isInfixOf "File" r && T.isInfixOf "exceeded maximum allowable size" r) tmpdir = "tempdir_noname_toobig" hndl = handleFileUploads tmpdir defaultUploadPolicy (const $ allowWithMaximumSize 1) hndl' hndl' pinfo !e = do let (Left !x) = e coverShowInstance x assertEqual "filename" Nothing $ partFileName pinfo assertEqual "disposition" DispositionFile $ partDisposition pinfo throwIO x ------------------------------------------------------------------------------
890
false
true
3
14
277
196
88
108
null
null
gencer/bond
compiler/src/Language/Bond/Codegen/Util.hs
mit
commaLine :: Int64 -> Text commaLine n = [lt|, #{indent n}|]
60
commaLine :: Int64 -> Text commaLine n = [lt|, #{indent n}|]
60
commaLine n = [lt|, #{indent n}|]
33
false
true
0
5
10
22
13
9
null
null
damianfral/clay
src/Clay/Geometry.hs
bsd-3-clause
paddingLeft = key "padding-left"
34
paddingLeft = key "padding-left"
34
paddingLeft = key "padding-left"
34
false
false
0
5
5
9
4
5
null
null
aaronc/Idris-dev
src/IRTS/Compiler.hs
bsd-3-clause
irTerm :: Vars -> [Name] -> Term -> Idris LExp irTerm vs env tm@(App _ f a) = do ist <- getIState case unApply tm of (P _ (UN m) _, args) | m == txt "mkForeignPrim" -> doForeign vs env (reverse (drop 4 args)) -- drop implicits (P _ (UN u) _, [_, arg]) | u == txt "unsafePerformPrimIO" -> irTerm vs env arg -- TMP HACK - until we get inlining. (P _ (UN r) _, [_, _, _, _, _, arg]) | r == txt "replace" -> irTerm vs env arg -- Laziness, the old way (P _ (UN l) _, [_, arg]) | l == txt "lazy" -> error "lazy has crept in somehow" (P _ (UN l) _, [_, arg]) | l == txt "force" -> LForce <$> irTerm vs env arg -- Laziness, the new way (P _ (UN l) _, [_, _, arg]) | l == txt "Delay" -> LLazyExp <$> irTerm vs env arg (P _ (UN l) _, [_, _, arg]) | l == txt "Force" -> LForce <$> irTerm vs env arg (P _ (UN a) _, [_, _, _, arg]) | a == txt "assert_smaller" -> irTerm vs env arg (P _ (UN a) _, [_, arg]) | a == txt "assert_total" -> irTerm vs env arg (P _ (UN p) _, [_, arg]) | p == txt "par" -> do arg' <- irTerm vs env arg return $ LOp LPar [LLazyExp arg'] (P _ (UN pf) _, [arg]) | pf == txt "prim_fork" -> do arg' <- irTerm vs env arg return $ LOp LFork [LLazyExp arg'] (P _ (UN m) _, [_,size,t]) | m == txt "malloc" -> irTerm vs env t (P _ (UN tm) _, [_,t]) | tm == txt "trace_malloc" -> irTerm vs env t -- TODO -- This case is here until we get more general inlining. It's just -- a really common case, and the laziness hurts... (P _ (NS (UN be) [b,p]) _, [_,x,(App _ (App _ (App _ (P _ (UN d) _) _) _) t), (App _ (App _ (App _ (P _ (UN d') _) _) _) e)]) | be == txt "ifThenElse" , d == txt "Delay" , d' == txt "Delay" , b == txt "Bool" , p == txt "Prelude" -> do x' <- irTerm vs env x t' <- irTerm vs env t e' <- irTerm vs env e return (LCase Shared x' [LConCase 0 (sNS (sUN "False") ["Bool","Prelude"]) [] e' ,LConCase 1 (sNS (sUN "True" ) ["Bool","Prelude"]) [] t' ]) -- data constructor (P (DCon t arity _) n _, args) -> do detag <- fgetState (opt_detaggable . ist_optimisation n) used <- map fst <$> fgetState (cg_usedpos . ist_callgraph n) let isNewtype = length used == 1 && detag let argsPruned = [a | (i,a) <- zip [0..] args, i `elem` used] -- The following code removes fields from data constructors -- and performs the newtype optimisation. -- -- The general rule here is: -- Everything we get as input is not touched by erasure, -- so it conforms to the official arities and types -- and we can reason about it like it's plain TT. -- -- It's only the data that leaves this point that's erased -- and possibly no longer typed as the original TT version. -- -- Especially, underapplied constructors must yield functions -- even if all the remaining arguments are erased -- (the resulting function *will* be applied, to NULLs). -- -- This will probably need rethinking when we get erasure from functions. -- "padLams" will wrap our term in LLam-bdas and give us -- the "list of future unerased args" coming from these lambdas. -- -- We can do whatever we like with the list of unerased args, -- hence it takes a lambda: \unerased_argname_list -> resulting_LExp. let padLams = padLambdas used (length args) arity case compare (length args) arity of -- overapplied GT -> ifail ("overapplied data constructor: " ++ show tm) -- exactly saturated EQ | isNewtype -> irTerm vs env (head argsPruned) | otherwise -- not newtype, plain data ctor -> buildApp (LV $ Glob n) argsPruned -- not saturated, underapplied LT | isNewtype -- newtype , length argsPruned == 1 -- and we already have the value -> padLams . (\tm [] -> tm) -- the [] asserts there are no unerased args <$> irTerm vs env (head argsPruned) | isNewtype -- newtype but the value is not among args yet -> return . padLams $ \[vn] -> LApp False (LV $ Glob n) [LV $ Glob vn] -- not a newtype, just apply to a constructor | otherwise -> padLams . applyToNames <$> buildApp (LV $ Glob n) argsPruned -- type constructor (P (TCon t a) n _, args) -> return LNothing -- an external name applied to arguments (P _ n _, args) | S.member (n, length args) (idris_externs ist) -> do LOp (LExternal n) <$> mapM (irTerm vs env) args -- a name applied to arguments (P _ n _, args) -> do case lookup n (idris_scprims ist) of -- if it's a primitive that is already saturated, -- compile to the corresponding op here already to save work Just (arity, op) | length args == arity -> LOp op <$> mapM (irTerm vs env) args -- otherwise, just apply the name _ -> applyName n ist args -- turn de bruijn vars into regular named references and try again (V i, args) -> irTerm vs env $ mkApp (P Bound (env !! i) Erased) args (f, args) -> LApp False <$> irTerm vs env f <*> mapM (irTerm vs env) args where buildApp :: LExp -> [Term] -> Idris LExp buildApp e [] = return e buildApp e xs = LApp False e <$> mapM (irTerm vs env) xs applyToNames :: LExp -> [Name] -> LExp applyToNames tm [] = tm applyToNames tm ns = LApp False tm $ map (LV . Glob) ns padLambdas :: [Int] -> Int -> Int -> ([Name] -> LExp) -> LExp padLambdas used startIdx endSIdx mkTerm = LLam allNames $ mkTerm nonerasedNames where allNames = [sMN i "sat" | i <- [startIdx .. endSIdx-1]] nonerasedNames = [sMN i "sat" | i <- [startIdx .. endSIdx-1], i `elem` used] applyName :: Name -> IState -> [Term] -> Idris LExp applyName n ist args = LApp False (LV $ Glob n) <$> mapM (irTerm vs env . erase) (zip [0..] args) where erase (i, x) | i >= arity || i `elem` used = x | otherwise = Erased arity = case fst4 <$> lookupCtxtExact n (definitions . tt_ctxt $ ist) of Just (CaseOp ci ty tys def tot cdefs) -> length tys Just (TyDecl (DCon tag ar _) _) -> ar Just (TyDecl Ref ty) -> length $ getArgTys ty Just (Operator ty ar op) -> ar Just def -> error $ "unknown arity: " ++ show (n, def) Nothing -> 0 -- no definition, probably local name => can't erase anything -- name for purposes of usage info lookup uName | Just n' <- viMethod =<< M.lookup n vs = n' | otherwise = n used = maybe [] (map fst . usedpos) $ lookupCtxtExact uName (idris_callgraph ist) fst4 (x,_,_,_) = x
7,492
irTerm :: Vars -> [Name] -> Term -> Idris LExp irTerm vs env tm@(App _ f a) = do ist <- getIState case unApply tm of (P _ (UN m) _, args) | m == txt "mkForeignPrim" -> doForeign vs env (reverse (drop 4 args)) -- drop implicits (P _ (UN u) _, [_, arg]) | u == txt "unsafePerformPrimIO" -> irTerm vs env arg -- TMP HACK - until we get inlining. (P _ (UN r) _, [_, _, _, _, _, arg]) | r == txt "replace" -> irTerm vs env arg -- Laziness, the old way (P _ (UN l) _, [_, arg]) | l == txt "lazy" -> error "lazy has crept in somehow" (P _ (UN l) _, [_, arg]) | l == txt "force" -> LForce <$> irTerm vs env arg -- Laziness, the new way (P _ (UN l) _, [_, _, arg]) | l == txt "Delay" -> LLazyExp <$> irTerm vs env arg (P _ (UN l) _, [_, _, arg]) | l == txt "Force" -> LForce <$> irTerm vs env arg (P _ (UN a) _, [_, _, _, arg]) | a == txt "assert_smaller" -> irTerm vs env arg (P _ (UN a) _, [_, arg]) | a == txt "assert_total" -> irTerm vs env arg (P _ (UN p) _, [_, arg]) | p == txt "par" -> do arg' <- irTerm vs env arg return $ LOp LPar [LLazyExp arg'] (P _ (UN pf) _, [arg]) | pf == txt "prim_fork" -> do arg' <- irTerm vs env arg return $ LOp LFork [LLazyExp arg'] (P _ (UN m) _, [_,size,t]) | m == txt "malloc" -> irTerm vs env t (P _ (UN tm) _, [_,t]) | tm == txt "trace_malloc" -> irTerm vs env t -- TODO -- This case is here until we get more general inlining. It's just -- a really common case, and the laziness hurts... (P _ (NS (UN be) [b,p]) _, [_,x,(App _ (App _ (App _ (P _ (UN d) _) _) _) t), (App _ (App _ (App _ (P _ (UN d') _) _) _) e)]) | be == txt "ifThenElse" , d == txt "Delay" , d' == txt "Delay" , b == txt "Bool" , p == txt "Prelude" -> do x' <- irTerm vs env x t' <- irTerm vs env t e' <- irTerm vs env e return (LCase Shared x' [LConCase 0 (sNS (sUN "False") ["Bool","Prelude"]) [] e' ,LConCase 1 (sNS (sUN "True" ) ["Bool","Prelude"]) [] t' ]) -- data constructor (P (DCon t arity _) n _, args) -> do detag <- fgetState (opt_detaggable . ist_optimisation n) used <- map fst <$> fgetState (cg_usedpos . ist_callgraph n) let isNewtype = length used == 1 && detag let argsPruned = [a | (i,a) <- zip [0..] args, i `elem` used] -- The following code removes fields from data constructors -- and performs the newtype optimisation. -- -- The general rule here is: -- Everything we get as input is not touched by erasure, -- so it conforms to the official arities and types -- and we can reason about it like it's plain TT. -- -- It's only the data that leaves this point that's erased -- and possibly no longer typed as the original TT version. -- -- Especially, underapplied constructors must yield functions -- even if all the remaining arguments are erased -- (the resulting function *will* be applied, to NULLs). -- -- This will probably need rethinking when we get erasure from functions. -- "padLams" will wrap our term in LLam-bdas and give us -- the "list of future unerased args" coming from these lambdas. -- -- We can do whatever we like with the list of unerased args, -- hence it takes a lambda: \unerased_argname_list -> resulting_LExp. let padLams = padLambdas used (length args) arity case compare (length args) arity of -- overapplied GT -> ifail ("overapplied data constructor: " ++ show tm) -- exactly saturated EQ | isNewtype -> irTerm vs env (head argsPruned) | otherwise -- not newtype, plain data ctor -> buildApp (LV $ Glob n) argsPruned -- not saturated, underapplied LT | isNewtype -- newtype , length argsPruned == 1 -- and we already have the value -> padLams . (\tm [] -> tm) -- the [] asserts there are no unerased args <$> irTerm vs env (head argsPruned) | isNewtype -- newtype but the value is not among args yet -> return . padLams $ \[vn] -> LApp False (LV $ Glob n) [LV $ Glob vn] -- not a newtype, just apply to a constructor | otherwise -> padLams . applyToNames <$> buildApp (LV $ Glob n) argsPruned -- type constructor (P (TCon t a) n _, args) -> return LNothing -- an external name applied to arguments (P _ n _, args) | S.member (n, length args) (idris_externs ist) -> do LOp (LExternal n) <$> mapM (irTerm vs env) args -- a name applied to arguments (P _ n _, args) -> do case lookup n (idris_scprims ist) of -- if it's a primitive that is already saturated, -- compile to the corresponding op here already to save work Just (arity, op) | length args == arity -> LOp op <$> mapM (irTerm vs env) args -- otherwise, just apply the name _ -> applyName n ist args -- turn de bruijn vars into regular named references and try again (V i, args) -> irTerm vs env $ mkApp (P Bound (env !! i) Erased) args (f, args) -> LApp False <$> irTerm vs env f <*> mapM (irTerm vs env) args where buildApp :: LExp -> [Term] -> Idris LExp buildApp e [] = return e buildApp e xs = LApp False e <$> mapM (irTerm vs env) xs applyToNames :: LExp -> [Name] -> LExp applyToNames tm [] = tm applyToNames tm ns = LApp False tm $ map (LV . Glob) ns padLambdas :: [Int] -> Int -> Int -> ([Name] -> LExp) -> LExp padLambdas used startIdx endSIdx mkTerm = LLam allNames $ mkTerm nonerasedNames where allNames = [sMN i "sat" | i <- [startIdx .. endSIdx-1]] nonerasedNames = [sMN i "sat" | i <- [startIdx .. endSIdx-1], i `elem` used] applyName :: Name -> IState -> [Term] -> Idris LExp applyName n ist args = LApp False (LV $ Glob n) <$> mapM (irTerm vs env . erase) (zip [0..] args) where erase (i, x) | i >= arity || i `elem` used = x | otherwise = Erased arity = case fst4 <$> lookupCtxtExact n (definitions . tt_ctxt $ ist) of Just (CaseOp ci ty tys def tot cdefs) -> length tys Just (TyDecl (DCon tag ar _) _) -> ar Just (TyDecl Ref ty) -> length $ getArgTys ty Just (Operator ty ar op) -> ar Just def -> error $ "unknown arity: " ++ show (n, def) Nothing -> 0 -- no definition, probably local name => can't erase anything -- name for purposes of usage info lookup uName | Just n' <- viMethod =<< M.lookup n vs = n' | otherwise = n used = maybe [] (map fst . usedpos) $ lookupCtxtExact uName (idris_callgraph ist) fst4 (x,_,_,_) = x
7,492
irTerm vs env tm@(App _ f a) = do ist <- getIState case unApply tm of (P _ (UN m) _, args) | m == txt "mkForeignPrim" -> doForeign vs env (reverse (drop 4 args)) -- drop implicits (P _ (UN u) _, [_, arg]) | u == txt "unsafePerformPrimIO" -> irTerm vs env arg -- TMP HACK - until we get inlining. (P _ (UN r) _, [_, _, _, _, _, arg]) | r == txt "replace" -> irTerm vs env arg -- Laziness, the old way (P _ (UN l) _, [_, arg]) | l == txt "lazy" -> error "lazy has crept in somehow" (P _ (UN l) _, [_, arg]) | l == txt "force" -> LForce <$> irTerm vs env arg -- Laziness, the new way (P _ (UN l) _, [_, _, arg]) | l == txt "Delay" -> LLazyExp <$> irTerm vs env arg (P _ (UN l) _, [_, _, arg]) | l == txt "Force" -> LForce <$> irTerm vs env arg (P _ (UN a) _, [_, _, _, arg]) | a == txt "assert_smaller" -> irTerm vs env arg (P _ (UN a) _, [_, arg]) | a == txt "assert_total" -> irTerm vs env arg (P _ (UN p) _, [_, arg]) | p == txt "par" -> do arg' <- irTerm vs env arg return $ LOp LPar [LLazyExp arg'] (P _ (UN pf) _, [arg]) | pf == txt "prim_fork" -> do arg' <- irTerm vs env arg return $ LOp LFork [LLazyExp arg'] (P _ (UN m) _, [_,size,t]) | m == txt "malloc" -> irTerm vs env t (P _ (UN tm) _, [_,t]) | tm == txt "trace_malloc" -> irTerm vs env t -- TODO -- This case is here until we get more general inlining. It's just -- a really common case, and the laziness hurts... (P _ (NS (UN be) [b,p]) _, [_,x,(App _ (App _ (App _ (P _ (UN d) _) _) _) t), (App _ (App _ (App _ (P _ (UN d') _) _) _) e)]) | be == txt "ifThenElse" , d == txt "Delay" , d' == txt "Delay" , b == txt "Bool" , p == txt "Prelude" -> do x' <- irTerm vs env x t' <- irTerm vs env t e' <- irTerm vs env e return (LCase Shared x' [LConCase 0 (sNS (sUN "False") ["Bool","Prelude"]) [] e' ,LConCase 1 (sNS (sUN "True" ) ["Bool","Prelude"]) [] t' ]) -- data constructor (P (DCon t arity _) n _, args) -> do detag <- fgetState (opt_detaggable . ist_optimisation n) used <- map fst <$> fgetState (cg_usedpos . ist_callgraph n) let isNewtype = length used == 1 && detag let argsPruned = [a | (i,a) <- zip [0..] args, i `elem` used] -- The following code removes fields from data constructors -- and performs the newtype optimisation. -- -- The general rule here is: -- Everything we get as input is not touched by erasure, -- so it conforms to the official arities and types -- and we can reason about it like it's plain TT. -- -- It's only the data that leaves this point that's erased -- and possibly no longer typed as the original TT version. -- -- Especially, underapplied constructors must yield functions -- even if all the remaining arguments are erased -- (the resulting function *will* be applied, to NULLs). -- -- This will probably need rethinking when we get erasure from functions. -- "padLams" will wrap our term in LLam-bdas and give us -- the "list of future unerased args" coming from these lambdas. -- -- We can do whatever we like with the list of unerased args, -- hence it takes a lambda: \unerased_argname_list -> resulting_LExp. let padLams = padLambdas used (length args) arity case compare (length args) arity of -- overapplied GT -> ifail ("overapplied data constructor: " ++ show tm) -- exactly saturated EQ | isNewtype -> irTerm vs env (head argsPruned) | otherwise -- not newtype, plain data ctor -> buildApp (LV $ Glob n) argsPruned -- not saturated, underapplied LT | isNewtype -- newtype , length argsPruned == 1 -- and we already have the value -> padLams . (\tm [] -> tm) -- the [] asserts there are no unerased args <$> irTerm vs env (head argsPruned) | isNewtype -- newtype but the value is not among args yet -> return . padLams $ \[vn] -> LApp False (LV $ Glob n) [LV $ Glob vn] -- not a newtype, just apply to a constructor | otherwise -> padLams . applyToNames <$> buildApp (LV $ Glob n) argsPruned -- type constructor (P (TCon t a) n _, args) -> return LNothing -- an external name applied to arguments (P _ n _, args) | S.member (n, length args) (idris_externs ist) -> do LOp (LExternal n) <$> mapM (irTerm vs env) args -- a name applied to arguments (P _ n _, args) -> do case lookup n (idris_scprims ist) of -- if it's a primitive that is already saturated, -- compile to the corresponding op here already to save work Just (arity, op) | length args == arity -> LOp op <$> mapM (irTerm vs env) args -- otherwise, just apply the name _ -> applyName n ist args -- turn de bruijn vars into regular named references and try again (V i, args) -> irTerm vs env $ mkApp (P Bound (env !! i) Erased) args (f, args) -> LApp False <$> irTerm vs env f <*> mapM (irTerm vs env) args where buildApp :: LExp -> [Term] -> Idris LExp buildApp e [] = return e buildApp e xs = LApp False e <$> mapM (irTerm vs env) xs applyToNames :: LExp -> [Name] -> LExp applyToNames tm [] = tm applyToNames tm ns = LApp False tm $ map (LV . Glob) ns padLambdas :: [Int] -> Int -> Int -> ([Name] -> LExp) -> LExp padLambdas used startIdx endSIdx mkTerm = LLam allNames $ mkTerm nonerasedNames where allNames = [sMN i "sat" | i <- [startIdx .. endSIdx-1]] nonerasedNames = [sMN i "sat" | i <- [startIdx .. endSIdx-1], i `elem` used] applyName :: Name -> IState -> [Term] -> Idris LExp applyName n ist args = LApp False (LV $ Glob n) <$> mapM (irTerm vs env . erase) (zip [0..] args) where erase (i, x) | i >= arity || i `elem` used = x | otherwise = Erased arity = case fst4 <$> lookupCtxtExact n (definitions . tt_ctxt $ ist) of Just (CaseOp ci ty tys def tot cdefs) -> length tys Just (TyDecl (DCon tag ar _) _) -> ar Just (TyDecl Ref ty) -> length $ getArgTys ty Just (Operator ty ar op) -> ar Just def -> error $ "unknown arity: " ++ show (n, def) Nothing -> 0 -- no definition, probably local name => can't erase anything -- name for purposes of usage info lookup uName | Just n' <- viMethod =<< M.lookup n vs = n' | otherwise = n used = maybe [] (map fst . usedpos) $ lookupCtxtExact uName (idris_callgraph ist) fst4 (x,_,_,_) = x
7,445
false
true
218
15
2,741
2,413
1,295
1,118
null
null
flowbox-public/fgl
Data/Graph/Inductive/Internal/FiniteMap.hs
bsd-3-clause
minFM (Node _ l _ _) = minFM l
34
minFM (Node _ l _ _) = minFM l
34
minFM (Node _ l _ _) = minFM l
34
false
false
0
7
12
24
11
13
null
null
rueshyna/gogol
gogol-dataflow/gen/Network/Google/Dataflow/Types/Product.hs
mpl-2.0
-- | The state family values. ctStateFamilies :: Lens' ComputationTopology [StateFamilyConfig] ctStateFamilies = lens _ctStateFamilies (\ s a -> s{_ctStateFamilies = a}) . _Default . _Coerce
210
ctStateFamilies :: Lens' ComputationTopology [StateFamilyConfig] ctStateFamilies = lens _ctStateFamilies (\ s a -> s{_ctStateFamilies = a}) . _Default . _Coerce
180
ctStateFamilies = lens _ctStateFamilies (\ s a -> s{_ctStateFamilies = a}) . _Default . _Coerce
115
true
true
3
8
45
59
28
31
null
null
arekfu/irt
src/G4Release.hs
bsd-3-clause
specificGranDeps _ = defaultGranDeps
36
specificGranDeps _ = defaultGranDeps
36
specificGranDeps _ = defaultGranDeps
36
false
false
0
5
3
9
4
5
null
null
spechub/Hets
SoftFOL/Sign.hs
gpl-2.0
mkConj :: SPTerm -> SPTerm -> SPTerm mkConj t1 t2 = compTerm SPAnd [t1, t2]
75
mkConj :: SPTerm -> SPTerm -> SPTerm mkConj t1 t2 = compTerm SPAnd [t1, t2]
75
mkConj t1 t2 = compTerm SPAnd [t1, t2]
38
false
true
0
6
14
39
19
20
null
null
ku-fpg/kansas-amber
System/Hardware/Haskino/Protocol.hs
bsd-3-clause
packageExpr (SetBI16 e1 e2) = packageTwoSubExpr (exprCmdVal EXPR_INT16 EXPR_SETB) e1 e2
87
packageExpr (SetBI16 e1 e2) = packageTwoSubExpr (exprCmdVal EXPR_INT16 EXPR_SETB) e1 e2
87
packageExpr (SetBI16 e1 e2) = packageTwoSubExpr (exprCmdVal EXPR_INT16 EXPR_SETB) e1 e2
87
false
false
0
7
10
32
15
17
null
null
mrakgr/futhark
src/Language/Futhark/TypeChecker.hs
bsd-3-clause
checkLambda (CurryFun fname curryargexps _ pos) args = do (curryargexps', curryargs) <- unzip <$> mapM checkArg curryargexps bnd <- asks (funFromScope fname) case bnd of Nothing -> bad $ UnknownFunctionError fname pos Just (longname, rt, paramtypes) -> do let rettype' = fromStruct $ removeShapeAnnotations rt paramtypes' = map (fromStruct . removeShapeAnnotations) paramtypes case () of _ | [(Tuple ets, _, _)] <- args, validApply paramtypes ets -> do -- Same shimming as in the case for anonymous functions. let mkparam i t = newIdent ("param_" ++ show i) t pos params <- zipWithM mkparam [(0::Int)..] paramtypes' paramname <- newIDFromString "x" let paramtype = Tuple paramtypes paramtype' = contractTypeBase paramtype tupparam = Param paramname (TypeDecl paramtype' NoInfo) pos tuplet = LetPat (TuplePattern (map (Id . untype) params) pos) (Var $ Ident paramname NoInfo pos) body pos tupfun = AnonymFun [tupparam] tuplet (TypeDecl (contractTypeBase rt) NoInfo) pos body = Apply fname [(Var $ untype param, diet paramt) | (param, paramt) <- zip params paramtypes'] NoInfo pos void $ checkLambda tupfun args return $ CurryFun longname curryargexps' (Info rettype') pos | otherwise -> do case find (unique . snd) $ zip curryargexps paramtypes of Just (e, _) -> bad $ CurriedConsumption fname $ srclocOf e _ -> return () let mkparam i t = newParam ("param_" ++ show i) t pos asIdent p = Ident (paramName p) NoInfo $ srclocOf p params <- zipWithM mkparam [(0::Int)..] $ drop (length curryargs) paramtypes' let fun = AnonymFun params body (TypeDecl (contractTypeBase rt) NoInfo) pos body = Apply fname (zip (curryargexps++map (Var . asIdent) params) $ map diet paramtypes) NoInfo pos void $ checkLambda fun args return $ CurryFun longname curryargexps' (Info rettype') pos where untype ident = ident { identType = NoInfo }
2,471
checkLambda (CurryFun fname curryargexps _ pos) args = do (curryargexps', curryargs) <- unzip <$> mapM checkArg curryargexps bnd <- asks (funFromScope fname) case bnd of Nothing -> bad $ UnknownFunctionError fname pos Just (longname, rt, paramtypes) -> do let rettype' = fromStruct $ removeShapeAnnotations rt paramtypes' = map (fromStruct . removeShapeAnnotations) paramtypes case () of _ | [(Tuple ets, _, _)] <- args, validApply paramtypes ets -> do -- Same shimming as in the case for anonymous functions. let mkparam i t = newIdent ("param_" ++ show i) t pos params <- zipWithM mkparam [(0::Int)..] paramtypes' paramname <- newIDFromString "x" let paramtype = Tuple paramtypes paramtype' = contractTypeBase paramtype tupparam = Param paramname (TypeDecl paramtype' NoInfo) pos tuplet = LetPat (TuplePattern (map (Id . untype) params) pos) (Var $ Ident paramname NoInfo pos) body pos tupfun = AnonymFun [tupparam] tuplet (TypeDecl (contractTypeBase rt) NoInfo) pos body = Apply fname [(Var $ untype param, diet paramt) | (param, paramt) <- zip params paramtypes'] NoInfo pos void $ checkLambda tupfun args return $ CurryFun longname curryargexps' (Info rettype') pos | otherwise -> do case find (unique . snd) $ zip curryargexps paramtypes of Just (e, _) -> bad $ CurriedConsumption fname $ srclocOf e _ -> return () let mkparam i t = newParam ("param_" ++ show i) t pos asIdent p = Ident (paramName p) NoInfo $ srclocOf p params <- zipWithM mkparam [(0::Int)..] $ drop (length curryargs) paramtypes' let fun = AnonymFun params body (TypeDecl (contractTypeBase rt) NoInfo) pos body = Apply fname (zip (curryargexps++map (Var . asIdent) params) $ map diet paramtypes) NoInfo pos void $ checkLambda fun args return $ CurryFun longname curryargexps' (Info rettype') pos where untype ident = ident { identType = NoInfo }
2,471
checkLambda (CurryFun fname curryargexps _ pos) args = do (curryargexps', curryargs) <- unzip <$> mapM checkArg curryargexps bnd <- asks (funFromScope fname) case bnd of Nothing -> bad $ UnknownFunctionError fname pos Just (longname, rt, paramtypes) -> do let rettype' = fromStruct $ removeShapeAnnotations rt paramtypes' = map (fromStruct . removeShapeAnnotations) paramtypes case () of _ | [(Tuple ets, _, _)] <- args, validApply paramtypes ets -> do -- Same shimming as in the case for anonymous functions. let mkparam i t = newIdent ("param_" ++ show i) t pos params <- zipWithM mkparam [(0::Int)..] paramtypes' paramname <- newIDFromString "x" let paramtype = Tuple paramtypes paramtype' = contractTypeBase paramtype tupparam = Param paramname (TypeDecl paramtype' NoInfo) pos tuplet = LetPat (TuplePattern (map (Id . untype) params) pos) (Var $ Ident paramname NoInfo pos) body pos tupfun = AnonymFun [tupparam] tuplet (TypeDecl (contractTypeBase rt) NoInfo) pos body = Apply fname [(Var $ untype param, diet paramt) | (param, paramt) <- zip params paramtypes'] NoInfo pos void $ checkLambda tupfun args return $ CurryFun longname curryargexps' (Info rettype') pos | otherwise -> do case find (unique . snd) $ zip curryargexps paramtypes of Just (e, _) -> bad $ CurriedConsumption fname $ srclocOf e _ -> return () let mkparam i t = newParam ("param_" ++ show i) t pos asIdent p = Ident (paramName p) NoInfo $ srclocOf p params <- zipWithM mkparam [(0::Int)..] $ drop (length curryargs) paramtypes' let fun = AnonymFun params body (TypeDecl (contractTypeBase rt) NoInfo) pos body = Apply fname (zip (curryargexps++map (Var . asIdent) params) $ map diet paramtypes) NoInfo pos void $ checkLambda fun args return $ CurryFun longname curryargexps' (Info rettype') pos where untype ident = ident { identType = NoInfo }
2,471
false
false
0
29
938
756
366
390
null
null
karknu/rws
src/Udp.hs
bsd-3-clause
udpDecl :: Parser Packet -> Parser Packet udpDecl f = do symbol "udp" u <- parseUdpPkt f return (PUdp u)
107
udpDecl :: Parser Packet -> Parser Packet udpDecl f = do symbol "udp" u <- parseUdpPkt f return (PUdp u)
107
udpDecl f = do symbol "udp" u <- parseUdpPkt f return (PUdp u)
65
false
true
0
10
22
57
23
34
null
null
vito/atomo
src/Atomo/Pattern.hs
bsd-3-clause
match ids r (PInstance p) (Object { oDelegates = ds }) = any (match ids r p) ds
83
match ids r (PInstance p) (Object { oDelegates = ds }) = any (match ids r p) ds
83
match ids r (PInstance p) (Object { oDelegates = ds }) = any (match ids r p) ds
83
false
false
0
9
21
49
24
25
null
null
ameingast/yawn
src/Yawn/Util/IO.hs
bsd-3-clause
safeReadFile :: Context -> FilePath -> IO (Maybe (BS.ByteString)) safeReadFile ctx path = tryIO ctx (BS.readFile path)
121
safeReadFile :: Context -> FilePath -> IO (Maybe (BS.ByteString)) safeReadFile ctx path = tryIO ctx (BS.readFile path)
121
safeReadFile ctx path = tryIO ctx (BS.readFile path)
55
false
true
0
11
19
52
25
27
null
null
ktvoelker/robin
src/Main.hs
gpl-3.0
usage :: IO () usage = hPutStrLn stderr "Usage: cabal-build-daemon (start | stop | build | watch | debug)"
108
usage :: IO () usage = hPutStrLn stderr "Usage: cabal-build-daemon (start | stop | build | watch | debug)"
108
usage = hPutStrLn stderr "Usage: cabal-build-daemon (start | stop | build | watch | debug)"
93
false
true
0
6
20
22
10
12
null
null
DavidAlphaFox/ghc
libraries/Cabal/Cabal/Distribution/PackageDescription.hs
bsd-3-clause
hcSharedOptions :: CompilerFlavor -> BuildInfo -> [String] hcSharedOptions = lookupHcOptions sharedOptions
106
hcSharedOptions :: CompilerFlavor -> BuildInfo -> [String] hcSharedOptions = lookupHcOptions sharedOptions
106
hcSharedOptions = lookupHcOptions sharedOptions
47
false
true
0
7
10
25
13
12
null
null
kmate/imperative-edsl
src/Language/Embedded/Imperative/Frontend.hs
bsd-3-clause
-- | Modifier that dereferences another argument deref :: FunArg exp pred -> FunArg exp pred deref = DerefArg
109
deref :: FunArg exp pred -> FunArg exp pred deref = DerefArg
60
deref = DerefArg
16
true
true
0
7
18
32
14
18
null
null
8l/metafun
src/Metafun/Compiler.hs
gpl-3.0
compileExpr (Kiff.UnaryMinus _ e) = MPL.Box MPL.TyInt . MPL.UnaryMinus . unbox <$> compileExpr e
100
compileExpr (Kiff.UnaryMinus _ e) = MPL.Box MPL.TyInt . MPL.UnaryMinus . unbox <$> compileExpr e
100
compileExpr (Kiff.UnaryMinus _ e) = MPL.Box MPL.TyInt . MPL.UnaryMinus . unbox <$> compileExpr e
100
false
false
0
9
17
43
20
23
null
null
jamshidh/ethereum-merkle-patricia-db
test/Main.hs
bsd-3-clause
testBigTest::Assertion testBigTest = do runResourceT $ do db <- openMPDB "/tmp/tmpDB" verifyDBDataIntegrity db (fmap (fst . B16.decode . prefixIfNeeded) <$> bigTest)
175
testBigTest::Assertion testBigTest = do runResourceT $ do db <- openMPDB "/tmp/tmpDB" verifyDBDataIntegrity db (fmap (fst . B16.decode . prefixIfNeeded) <$> bigTest)
175
testBigTest = do runResourceT $ do db <- openMPDB "/tmp/tmpDB" verifyDBDataIntegrity db (fmap (fst . B16.decode . prefixIfNeeded) <$> bigTest)
152
false
true
0
17
30
59
28
31
null
null
zachsully/redo
dist/build/autogen/Paths_redo.hs
bsd-3-clause
libexecdir = "/home/zach/Projects/redo/cabal-dev//libexec"
58
libexecdir = "/home/zach/Projects/redo/cabal-dev//libexec"
58
libexecdir = "/home/zach/Projects/redo/cabal-dev//libexec"
58
false
false
0
4
2
6
3
3
null
null
spockwangs/scheme.in.haskell
list4.3.hs
unlicense
eval (Atom s) = case Prelude.lookup s primitives of Just _ -> Atom "#primitive" Nothing -> Bool False
145
eval (Atom s) = case Prelude.lookup s primitives of Just _ -> Atom "#primitive" Nothing -> Bool False
145
eval (Atom s) = case Prelude.lookup s primitives of Just _ -> Atom "#primitive" Nothing -> Bool False
145
false
false
0
8
61
48
21
27
null
null
joshcough/Scrabble
src/Scrabble/Search.hs
mit
ups :: String -> String ups = List.sort . fmap toUpper
54
ups :: String -> String ups = List.sort . fmap toUpper
54
ups = List.sort . fmap toUpper
30
false
true
1
7
10
32
13
19
null
null
chrisdone/path
src/Path/Include.hs
bsd-3-clause
-- | 'splitExtension' is the inverse of 'addExtension'. It splits the given -- file path into a valid filename and a valid extension. -- -- >>> splitExtension $(mkRelFile "name.foo" ) == Just ($(mkRelFile "name" ), ".foo" ) -- >>> splitExtension $(mkRelFile "name.foo." ) == Just ($(mkRelFile "name" ), ".foo." ) -- >>> splitExtension $(mkRelFile "name.foo.." ) == Just ($(mkRelFile "name" ), ".foo..") -- >>> splitExtension $(mkRelFile "name.bar.foo" ) == Just ($(mkRelFile "name.bar"), ".foo" ) -- >>> splitExtension $(mkRelFile ".name.foo" ) == Just ($(mkRelFile ".name" ), ".foo" ) -- >>> splitExtension $(mkRelFile "name..foo" ) == Just ($(mkRelFile "name." ), ".foo" ) -- >>> splitExtension $(mkRelFile "....foo" ) == Just ($(mkRelFile "..." ), ".foo" ) -- -- Throws 'HasNoExtension' exception if the filename does not have an extension -- or in other words it cannot be split into a valid filename and a valid -- extension. The following cases throw an exception, please note that "." and -- ".." are not valid filenames: -- -- >>> splitExtension $(mkRelFile "name" ) -- >>> splitExtension $(mkRelFile "name." ) -- >>> splitExtension $(mkRelFile "name.." ) -- >>> splitExtension $(mkRelFile ".name" ) -- >>> splitExtension $(mkRelFile "..name" ) -- >>> splitExtension $(mkRelFile "...name") -- -- 'splitExtension' and 'addExtension' are inverses of each other, the -- following laws hold: -- -- @ -- uncurry addExtension . swap >=> splitExtension == return -- splitExtension >=> uncurry addExtension . swap == return -- @ -- -- @since 0.7.0 splitExtension :: MonadThrow m => Path b File -> m (Path b File, String) splitExtension (Path fpath) = if nameDot == [] || ext == [] then throwM $ HasNoExtension fpath else let fname = init nameDot in if fname == [] || fname == "." || fname == ".." then throwM $ HasNoExtension fpath else return ( Path (normalizeDrive drv ++ dir ++ fname) , FilePath.extSeparator : ext ) where -- trailing separators are ignored for the split and considered part of the -- second component in the split. splitLast isSep str = let rstr = reverse str notSep = not . isSep name = (dropWhile notSep . dropWhile isSep) rstr trailingSeps = takeWhile isSep rstr xtn = (takeWhile notSep . dropWhile isSep) rstr in (reverse name, reverse xtn ++ trailingSeps) normalizeDrive | IS_WINDOWS = normalizeTrailingSeps | otherwise = id (drv, pth) = FilePath.splitDrive fpath (dir, file) = splitLast FilePath.isPathSeparator pth (nameDot, ext) = splitLast FilePath.isExtSeparator file -- | Get extension from given file path. Throws 'HasNoExtension' exception if -- the file does not have an extension. The following laws hold: -- -- @ -- flip addExtension file >=> fileExtension == return -- fileExtension == (fmap snd) . splitExtension -- @ -- -- @since 0.5.11
3,040
splitExtension :: MonadThrow m => Path b File -> m (Path b File, String) splitExtension (Path fpath) = if nameDot == [] || ext == [] then throwM $ HasNoExtension fpath else let fname = init nameDot in if fname == [] || fname == "." || fname == ".." then throwM $ HasNoExtension fpath else return ( Path (normalizeDrive drv ++ dir ++ fname) , FilePath.extSeparator : ext ) where -- trailing separators are ignored for the split and considered part of the -- second component in the split. splitLast isSep str = let rstr = reverse str notSep = not . isSep name = (dropWhile notSep . dropWhile isSep) rstr trailingSeps = takeWhile isSep rstr xtn = (takeWhile notSep . dropWhile isSep) rstr in (reverse name, reverse xtn ++ trailingSeps) normalizeDrive | IS_WINDOWS = normalizeTrailingSeps | otherwise = id (drv, pth) = FilePath.splitDrive fpath (dir, file) = splitLast FilePath.isPathSeparator pth (nameDot, ext) = splitLast FilePath.isExtSeparator file -- | Get extension from given file path. Throws 'HasNoExtension' exception if -- the file does not have an extension. The following laws hold: -- -- @ -- flip addExtension file >=> fileExtension == return -- fileExtension == (fmap snd) . splitExtension -- @ -- -- @since 0.5.11
1,446
splitExtension (Path fpath) = if nameDot == [] || ext == [] then throwM $ HasNoExtension fpath else let fname = init nameDot in if fname == [] || fname == "." || fname == ".." then throwM $ HasNoExtension fpath else return ( Path (normalizeDrive drv ++ dir ++ fname) , FilePath.extSeparator : ext ) where -- trailing separators are ignored for the split and considered part of the -- second component in the split. splitLast isSep str = let rstr = reverse str notSep = not . isSep name = (dropWhile notSep . dropWhile isSep) rstr trailingSeps = takeWhile isSep rstr xtn = (takeWhile notSep . dropWhile isSep) rstr in (reverse name, reverse xtn ++ trailingSeps) normalizeDrive | IS_WINDOWS = normalizeTrailingSeps | otherwise = id (drv, pth) = FilePath.splitDrive fpath (dir, file) = splitLast FilePath.isPathSeparator pth (nameDot, ext) = splitLast FilePath.isExtSeparator file -- | Get extension from given file path. Throws 'HasNoExtension' exception if -- the file does not have an extension. The following laws hold: -- -- @ -- flip addExtension file >=> fileExtension == return -- fileExtension == (fmap snd) . splitExtension -- @ -- -- @since 0.5.11
1,373
true
true
0
15
708
386
212
174
null
null
pparkkin/eta
compiler/ETA/DeSugar/Check.hs
bsd-3-clause
untidy_con :: HsConPatDetails Name -> HsConPatDetails Name untidy_con (PrefixCon pats) = PrefixCon (map untidy_pars pats)
121
untidy_con :: HsConPatDetails Name -> HsConPatDetails Name untidy_con (PrefixCon pats) = PrefixCon (map untidy_pars pats)
121
untidy_con (PrefixCon pats) = PrefixCon (map untidy_pars pats)
62
false
true
0
7
14
41
19
22
null
null
spinda/liquidhaskell
tests/gsoc15/unknown/pos/WBL.hs
bsd-3-clause
-- should we insert empty? deleteMin (Node _ _ l r) = merge l r
63
deleteMin (Node _ _ l r) = merge l r
36
deleteMin (Node _ _ l r) = merge l r
36
true
false
0
6
14
28
13
15
null
null
mwu-tow/cuda
Foreign/CUDA/Internal/C2HS.hs
bsd-3-clause
-- Passing Booleans by reference -- withBool :: (Integral a, Storable a) => Bool -> (Ptr a -> IO b) -> IO b withBool = with . fromBool
135
withBool :: (Integral a, Storable a) => Bool -> (Ptr a -> IO b) -> IO b withBool = with . fromBool
98
withBool = with . fromBool
26
true
true
1
11
28
63
30
33
null
null
josuf107/Adverb
Adverb/Common.hs
gpl-3.0
thumpingly = id
15
thumpingly = id
15
thumpingly = id
15
false
false
0
4
2
6
3
3
null
null
llhotka/tiphys
src/Data/Aeson/Zipper/Internal.hs
bsd-3-clause
-- | When at array location, go to the last entry. lastEntry :: Location -> Maybe Location lastEntry (Loc (Array ary) ctx) = if V.null ary then Nothing else Just $ Loc (V.last ary) $ Entry (reverse $ V.toList $ V.init ary) [] ctx
250
lastEntry :: Location -> Maybe Location lastEntry (Loc (Array ary) ctx) = if V.null ary then Nothing else Just $ Loc (V.last ary) $ Entry (reverse $ V.toList $ V.init ary) [] ctx
199
lastEntry (Loc (Array ary) ctx) = if V.null ary then Nothing else Just $ Loc (V.last ary) $ Entry (reverse $ V.toList $ V.init ary) [] ctx
159
true
true
0
11
64
95
47
48
null
null
ezyang/ghc
testsuite/tests/dependent/should_compile/dynamic-paper.hs
bsd-3-clause
loop1 = delta1 (toDynamic delta1)
33
loop1 = delta1 (toDynamic delta1)
33
loop1 = delta1 (toDynamic delta1)
33
false
false
1
7
4
18
7
11
null
null
jonschoning/pinboard
src/Pinboard/ApiTypesLens.hs
mit
noteListItemHashL :: Lens_' NoteListItem Text noteListItemHashL f_acx8 (NoteListItem x1_acx9 x2_acxa x3_acxb x4_acxc x5_acxd x6_acxe) = fmap (\y1_acxf -> NoteListItem x1_acx9 y1_acxf x3_acxb x4_acxc x5_acxd x6_acxe) (f_acx8 x2_acxa)
242
noteListItemHashL :: Lens_' NoteListItem Text noteListItemHashL f_acx8 (NoteListItem x1_acx9 x2_acxa x3_acxb x4_acxc x5_acxd x6_acxe) = fmap (\y1_acxf -> NoteListItem x1_acx9 y1_acxf x3_acxb x4_acxc x5_acxd x6_acxe) (f_acx8 x2_acxa)
242
noteListItemHashL f_acx8 (NoteListItem x1_acx9 x2_acxa x3_acxb x4_acxc x5_acxd x6_acxe) = fmap (\y1_acxf -> NoteListItem x1_acx9 y1_acxf x3_acxb x4_acxc x5_acxd x6_acxe) (f_acx8 x2_acxa)
196
false
true
1
7
36
74
34
40
null
null
pepeiborra/yices-0.0.0.12
Math/SMT/Yices/Parser.hs
bsd-3-clause
if_ = tok "if" >> liftM3 IF expY expY expY
42
if_ = tok "if" >> liftM3 IF expY expY expY
42
if_ = tok "if" >> liftM3 IF expY expY expY
42
false
false
3
5
9
26
10
16
null
null
exercism/xhaskell
exercises/practice/bob/.meta/examples/success-text/src/Bob.hs
mit
isYelling = (&&) <$> T.any isUpper <*> T.all (not . isLower)
60
isYelling = (&&) <$> T.any isUpper <*> T.all (not . isLower)
60
isYelling = (&&) <$> T.any isUpper <*> T.all (not . isLower)
60
false
false
0
8
10
33
17
16
null
null
brendanhay/gogol
gogol-containeranalysis/gen/Network/Google/ContainerAnalysis/Types/Product.hs
mpl-2.0
-- | Required. Immutable. The kind of analysis that is handled by this -- discovery. dAnalysisKind :: Lens' Discovery (Maybe DiscoveryAnalysisKind) dAnalysisKind = lens _dAnalysisKind (\ s a -> s{_dAnalysisKind = a})
224
dAnalysisKind :: Lens' Discovery (Maybe DiscoveryAnalysisKind) dAnalysisKind = lens _dAnalysisKind (\ s a -> s{_dAnalysisKind = a})
139
dAnalysisKind = lens _dAnalysisKind (\ s a -> s{_dAnalysisKind = a})
76
true
true
0
8
39
50
26
24
null
null
olsner/ghc
compiler/prelude/THNames.hs
bsd-3-clause
wordPrimLName = libFun (fsLit "wordPrimL") wordPrimLIdKey
61
wordPrimLName = libFun (fsLit "wordPrimL") wordPrimLIdKey
61
wordPrimLName = libFun (fsLit "wordPrimL") wordPrimLIdKey
61
false
false
0
7
9
17
8
9
null
null
piotrm0/planar
Lexer.hs
artistic-2.0
identifier = Tok.identifier lexer
33
identifier = Tok.identifier lexer
33
identifier = Tok.identifier lexer
33
false
false
0
6
3
11
5
6
null
null
akegalj/snowdrift
app/SnowdriftProcessPayments.hs
agpl-3.0
main :: IO () main = do conf <- fromArgs parseExtra dbconf <- withYamlEnvironment "config/postgresql.yml" (appEnv conf) Database.Persist.Sql.loadConfig >>= Database.Persist.Sql.applyEnv pool_conf <- Database.Persist.Sql.createPoolConfig (dbconf :: Settings.PersistConf) now <- liftIO getCurrentTime runSDB dbconf pool_conf $ do projects <- lift $ projectsToPay now lift $ mapM_ (payout now) projects rebalanceAllPledges
482
main :: IO () main = do conf <- fromArgs parseExtra dbconf <- withYamlEnvironment "config/postgresql.yml" (appEnv conf) Database.Persist.Sql.loadConfig >>= Database.Persist.Sql.applyEnv pool_conf <- Database.Persist.Sql.createPoolConfig (dbconf :: Settings.PersistConf) now <- liftIO getCurrentTime runSDB dbconf pool_conf $ do projects <- lift $ projectsToPay now lift $ mapM_ (payout now) projects rebalanceAllPledges
482
main = do conf <- fromArgs parseExtra dbconf <- withYamlEnvironment "config/postgresql.yml" (appEnv conf) Database.Persist.Sql.loadConfig >>= Database.Persist.Sql.applyEnv pool_conf <- Database.Persist.Sql.createPoolConfig (dbconf :: Settings.PersistConf) now <- liftIO getCurrentTime runSDB dbconf pool_conf $ do projects <- lift $ projectsToPay now lift $ mapM_ (payout now) projects rebalanceAllPledges
468
false
true
0
13
110
137
65
72
null
null
ian-ross/cabal
cabal-install/Distribution/Client/Setup.hs
bsd-3-clause
filterConfigureFlags :: ConfigFlags -> Version -> ConfigFlags filterConfigureFlags flags cabalLibVersion | cabalLibVersion >= Version [1,22,0] [] = flags_latest -- ^ NB: we expect the latest version to be the most common case. | cabalLibVersion < Version [1,3,10] [] = flags_1_3_10 | cabalLibVersion < Version [1,10,0] [] = flags_1_10_0 | cabalLibVersion < Version [1,14,0] [] = flags_1_14_0 | cabalLibVersion < Version [1,18,0] [] = flags_1_18_0 | cabalLibVersion < Version [1,19,1] [] = flags_1_19_0 | cabalLibVersion < Version [1,19,2] [] = flags_1_19_1 | cabalLibVersion < Version [1,21,1] [] = flags_1_20_0 | cabalLibVersion < Version [1,22,0] [] = flags_1_21_0 | otherwise = flags_latest where -- Cabal >= 1.19.1 uses '--dependency' and does not need '--constraint'. flags_latest = flags { configConstraints = [] } -- Cabal < 1.22 doesn't know about '--disable-debug-info'. flags_1_21_0 = flags_latest { configDebugInfo = NoFlag } -- Cabal < 1.21.1 doesn't know about 'disable-relocatable' -- Cabal < 1.21.1 doesn't know about 'enable-profiling' flags_1_20_0 = flags_1_21_0 { configRelocatable = NoFlag , configProf = NoFlag , configProfExe = configProf flags , configProfLib = mappend (configProf flags) (configProfLib flags) , configCoverage = NoFlag , configLibCoverage = configCoverage flags } -- Cabal < 1.19.2 doesn't know about '--exact-configuration' and -- '--enable-library-stripping'. flags_1_19_1 = flags_1_20_0 { configExactConfiguration = NoFlag , configStripLibs = NoFlag } -- Cabal < 1.19.1 uses '--constraint' instead of '--dependency'. flags_1_19_0 = flags_1_19_1 { configDependencies = [] , configConstraints = configConstraints flags } -- Cabal < 1.18.0 doesn't know about --extra-prog-path and --sysconfdir. flags_1_18_0 = flags_1_19_0 { configProgramPathExtra = toNubList [] , configInstallDirs = configInstallDirs_1_18_0} configInstallDirs_1_18_0 = (configInstallDirs flags) { sysconfdir = NoFlag } -- Cabal < 1.14.0 doesn't know about '--disable-benchmarks'. flags_1_14_0 = flags_1_18_0 { configBenchmarks = NoFlag } -- Cabal < 1.10.0 doesn't know about '--disable-tests'. flags_1_10_0 = flags_1_14_0 { configTests = NoFlag } -- Cabal < 1.3.10 does not grok the '--constraints' flag. flags_1_3_10 = flags_1_10_0 { configConstraints = [] } -- ------------------------------------------------------------ -- * Config extra flags -- ------------------------------------------------------------ -- | cabal configure takes some extra flags beyond runghc Setup configure --
2,869
filterConfigureFlags :: ConfigFlags -> Version -> ConfigFlags filterConfigureFlags flags cabalLibVersion | cabalLibVersion >= Version [1,22,0] [] = flags_latest -- ^ NB: we expect the latest version to be the most common case. | cabalLibVersion < Version [1,3,10] [] = flags_1_3_10 | cabalLibVersion < Version [1,10,0] [] = flags_1_10_0 | cabalLibVersion < Version [1,14,0] [] = flags_1_14_0 | cabalLibVersion < Version [1,18,0] [] = flags_1_18_0 | cabalLibVersion < Version [1,19,1] [] = flags_1_19_0 | cabalLibVersion < Version [1,19,2] [] = flags_1_19_1 | cabalLibVersion < Version [1,21,1] [] = flags_1_20_0 | cabalLibVersion < Version [1,22,0] [] = flags_1_21_0 | otherwise = flags_latest where -- Cabal >= 1.19.1 uses '--dependency' and does not need '--constraint'. flags_latest = flags { configConstraints = [] } -- Cabal < 1.22 doesn't know about '--disable-debug-info'. flags_1_21_0 = flags_latest { configDebugInfo = NoFlag } -- Cabal < 1.21.1 doesn't know about 'disable-relocatable' -- Cabal < 1.21.1 doesn't know about 'enable-profiling' flags_1_20_0 = flags_1_21_0 { configRelocatable = NoFlag , configProf = NoFlag , configProfExe = configProf flags , configProfLib = mappend (configProf flags) (configProfLib flags) , configCoverage = NoFlag , configLibCoverage = configCoverage flags } -- Cabal < 1.19.2 doesn't know about '--exact-configuration' and -- '--enable-library-stripping'. flags_1_19_1 = flags_1_20_0 { configExactConfiguration = NoFlag , configStripLibs = NoFlag } -- Cabal < 1.19.1 uses '--constraint' instead of '--dependency'. flags_1_19_0 = flags_1_19_1 { configDependencies = [] , configConstraints = configConstraints flags } -- Cabal < 1.18.0 doesn't know about --extra-prog-path and --sysconfdir. flags_1_18_0 = flags_1_19_0 { configProgramPathExtra = toNubList [] , configInstallDirs = configInstallDirs_1_18_0} configInstallDirs_1_18_0 = (configInstallDirs flags) { sysconfdir = NoFlag } -- Cabal < 1.14.0 doesn't know about '--disable-benchmarks'. flags_1_14_0 = flags_1_18_0 { configBenchmarks = NoFlag } -- Cabal < 1.10.0 doesn't know about '--disable-tests'. flags_1_10_0 = flags_1_14_0 { configTests = NoFlag } -- Cabal < 1.3.10 does not grok the '--constraints' flag. flags_1_3_10 = flags_1_10_0 { configConstraints = [] } -- ------------------------------------------------------------ -- * Config extra flags -- ------------------------------------------------------------ -- | cabal configure takes some extra flags beyond runghc Setup configure --
2,869
filterConfigureFlags flags cabalLibVersion | cabalLibVersion >= Version [1,22,0] [] = flags_latest -- ^ NB: we expect the latest version to be the most common case. | cabalLibVersion < Version [1,3,10] [] = flags_1_3_10 | cabalLibVersion < Version [1,10,0] [] = flags_1_10_0 | cabalLibVersion < Version [1,14,0] [] = flags_1_14_0 | cabalLibVersion < Version [1,18,0] [] = flags_1_18_0 | cabalLibVersion < Version [1,19,1] [] = flags_1_19_0 | cabalLibVersion < Version [1,19,2] [] = flags_1_19_1 | cabalLibVersion < Version [1,21,1] [] = flags_1_20_0 | cabalLibVersion < Version [1,22,0] [] = flags_1_21_0 | otherwise = flags_latest where -- Cabal >= 1.19.1 uses '--dependency' and does not need '--constraint'. flags_latest = flags { configConstraints = [] } -- Cabal < 1.22 doesn't know about '--disable-debug-info'. flags_1_21_0 = flags_latest { configDebugInfo = NoFlag } -- Cabal < 1.21.1 doesn't know about 'disable-relocatable' -- Cabal < 1.21.1 doesn't know about 'enable-profiling' flags_1_20_0 = flags_1_21_0 { configRelocatable = NoFlag , configProf = NoFlag , configProfExe = configProf flags , configProfLib = mappend (configProf flags) (configProfLib flags) , configCoverage = NoFlag , configLibCoverage = configCoverage flags } -- Cabal < 1.19.2 doesn't know about '--exact-configuration' and -- '--enable-library-stripping'. flags_1_19_1 = flags_1_20_0 { configExactConfiguration = NoFlag , configStripLibs = NoFlag } -- Cabal < 1.19.1 uses '--constraint' instead of '--dependency'. flags_1_19_0 = flags_1_19_1 { configDependencies = [] , configConstraints = configConstraints flags } -- Cabal < 1.18.0 doesn't know about --extra-prog-path and --sysconfdir. flags_1_18_0 = flags_1_19_0 { configProgramPathExtra = toNubList [] , configInstallDirs = configInstallDirs_1_18_0} configInstallDirs_1_18_0 = (configInstallDirs flags) { sysconfdir = NoFlag } -- Cabal < 1.14.0 doesn't know about '--disable-benchmarks'. flags_1_14_0 = flags_1_18_0 { configBenchmarks = NoFlag } -- Cabal < 1.10.0 doesn't know about '--disable-tests'. flags_1_10_0 = flags_1_14_0 { configTests = NoFlag } -- Cabal < 1.3.10 does not grok the '--constraints' flag. flags_1_3_10 = flags_1_10_0 { configConstraints = [] } -- ------------------------------------------------------------ -- * Config extra flags -- ------------------------------------------------------------ -- | cabal configure takes some extra flags beyond runghc Setup configure --
2,807
false
true
9
10
705
531
298
233
null
null
shlevy/ghc
compiler/ghci/ByteCodeGen.hs
bsd-3-clause
wordsToBytes :: DynFlags -> WordOff -> ByteOff wordsToBytes dflags = fromIntegral . (* wORD_SIZE dflags) . fromIntegral
119
wordsToBytes :: DynFlags -> WordOff -> ByteOff wordsToBytes dflags = fromIntegral . (* wORD_SIZE dflags) . fromIntegral
119
wordsToBytes dflags = fromIntegral . (* wORD_SIZE dflags) . fromIntegral
72
false
true
0
8
16
37
19
18
null
null
dysinger/amazonka
amazonka-storagegateway/gen/Network/AWS/StorageGateway/ListVolumeRecoveryPoints.hs
mpl-2.0
lvrpGatewayARN :: Lens' ListVolumeRecoveryPoints Text lvrpGatewayARN = lens _lvrpGatewayARN (\s a -> s { _lvrpGatewayARN = a })
127
lvrpGatewayARN :: Lens' ListVolumeRecoveryPoints Text lvrpGatewayARN = lens _lvrpGatewayARN (\s a -> s { _lvrpGatewayARN = a })
127
lvrpGatewayARN = lens _lvrpGatewayARN (\s a -> s { _lvrpGatewayARN = a })
73
false
true
0
9
17
39
21
18
null
null
JensTimmerman/text-benchmarks
src/Data/Text/Benchmarks/Micro/StripBrackets.hs
bsd-3-clause
stripBrackets :: T.Text -> T.Text stripBrackets = snd . T.mapAccumL f (0 :: Int) where f depth c = let depth' = depth + d' c c' | depth > 0 || depth' > 0 = ' ' | otherwise = c in (depth', c') d' '{' = 1 d' '[' = 1 d' '}' = -1 d' ']' = -1 d' _ = 0
318
stripBrackets :: T.Text -> T.Text stripBrackets = snd . T.mapAccumL f (0 :: Int) where f depth c = let depth' = depth + d' c c' | depth > 0 || depth' > 0 = ' ' | otherwise = c in (depth', c') d' '{' = 1 d' '[' = 1 d' '}' = -1 d' ']' = -1 d' _ = 0
318
stripBrackets = snd . T.mapAccumL f (0 :: Int) where f depth c = let depth' = depth + d' c c' | depth > 0 || depth' > 0 = ' ' | otherwise = c in (depth', c') d' '{' = 1 d' '[' = 1 d' '}' = -1 d' ']' = -1 d' _ = 0
284
false
true
0
14
136
149
74
75
null
null
GaloisInc/sk-dev-platform
libs/SCD/src/SCD/Lobster/Gen/CoreSyn.hs
bsd-3-clause
bidi :: DomPort -> DomPort -> Decl bidi = connect B
51
bidi :: DomPort -> DomPort -> Decl bidi = connect B
51
bidi = connect B
16
false
true
0
8
10
28
12
16
null
null
rueshyna/gogol
gogol-books/gen/Network/Google/Books/Types/Product.hs
mpl-2.0
nNotificationGroup :: Lens' Notification (Maybe Text) nNotificationGroup = lens _nNotificationGroup (\ s a -> s{_nNotificationGroup = a})
145
nNotificationGroup :: Lens' Notification (Maybe Text) nNotificationGroup = lens _nNotificationGroup (\ s a -> s{_nNotificationGroup = a})
145
nNotificationGroup = lens _nNotificationGroup (\ s a -> s{_nNotificationGroup = a})
91
false
true
1
9
24
50
24
26
null
null