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
soenkehahn/nhc
src/NhcOptions.hs
bsd-3-clause
withNhcOptions :: [String] -> (NhcOptions -> [String] -> IO ExitCode) -> IO ExitCode withNhcOptions args action = do let (nhcArgs, command) = span ("-" `isPrefixOf`) args parsed = parseOptions nhcArgs case parsedOptions parsed of Just opts -> action opts command Nothing -> case parsedError parsed of Nothing -> do progName <- getProgName putStrLn $ normalizeLines [i| #{progName} - execute commands inside a haskell build environment Allows you to easily execute arbitrary commands inside a build environment that is set up (through nix: http://nixos.org/) according to the cabal file in the current dirctory. With each invocation, the cabal file is checked for modifications and the build environment is updated accordingly. https://github.com/soenkehahn/nhc Usage: #{progName} [OPTIONS] COMMAND All OPTIONS start with one or two dashes ('-'). The first argument that doesn't start with a dash and all following arguments are interpreted as the COMMAND that will be executed in the build environment. (Shell expansion is of course done outside the build environment by the outer shell.) |] putStrLn $ normalizeLines $ parsedHelp parsed putStr $ normalizeLines [i| Examples: #{progName} cabal build #{progName} hdevtools check src/Main.hs #{progName} ghci #{progName} bash |] return $ ExitSuccess Just errorMessage -> do hPutStrLn stderr errorMessage return $ ExitFailure 1
1,694
withNhcOptions :: [String] -> (NhcOptions -> [String] -> IO ExitCode) -> IO ExitCode withNhcOptions args action = do let (nhcArgs, command) = span ("-" `isPrefixOf`) args parsed = parseOptions nhcArgs case parsedOptions parsed of Just opts -> action opts command Nothing -> case parsedError parsed of Nothing -> do progName <- getProgName putStrLn $ normalizeLines [i| #{progName} - execute commands inside a haskell build environment Allows you to easily execute arbitrary commands inside a build environment that is set up (through nix: http://nixos.org/) according to the cabal file in the current dirctory. With each invocation, the cabal file is checked for modifications and the build environment is updated accordingly. https://github.com/soenkehahn/nhc Usage: #{progName} [OPTIONS] COMMAND All OPTIONS start with one or two dashes ('-'). The first argument that doesn't start with a dash and all following arguments are interpreted as the COMMAND that will be executed in the build environment. (Shell expansion is of course done outside the build environment by the outer shell.) |] putStrLn $ normalizeLines $ parsedHelp parsed putStr $ normalizeLines [i| Examples: #{progName} cabal build #{progName} hdevtools check src/Main.hs #{progName} ghci #{progName} bash |] return $ ExitSuccess Just errorMessage -> do hPutStrLn stderr errorMessage return $ ExitFailure 1
1,694
withNhcOptions args action = do let (nhcArgs, command) = span ("-" `isPrefixOf`) args parsed = parseOptions nhcArgs case parsedOptions parsed of Just opts -> action opts command Nothing -> case parsedError parsed of Nothing -> do progName <- getProgName putStrLn $ normalizeLines [i| #{progName} - execute commands inside a haskell build environment Allows you to easily execute arbitrary commands inside a build environment that is set up (through nix: http://nixos.org/) according to the cabal file in the current dirctory. With each invocation, the cabal file is checked for modifications and the build environment is updated accordingly. https://github.com/soenkehahn/nhc Usage: #{progName} [OPTIONS] COMMAND All OPTIONS start with one or two dashes ('-'). The first argument that doesn't start with a dash and all following arguments are interpreted as the COMMAND that will be executed in the build environment. (Shell expansion is of course done outside the build environment by the outer shell.) |] putStrLn $ normalizeLines $ parsedHelp parsed putStr $ normalizeLines [i| Examples: #{progName} cabal build #{progName} hdevtools check src/Main.hs #{progName} ghci #{progName} bash |] return $ ExitSuccess Just errorMessage -> do hPutStrLn stderr errorMessage return $ ExitFailure 1
1,609
false
true
0
16
520
208
101
107
null
null
coolhacks/scripts-hacks
examples/shellcheck-master/ShellCheck/Parser.hs
mit
prop_readIoFile = isOk readIoFile ">> \"$(date +%YYmmDD)\""
59
prop_readIoFile = isOk readIoFile ">> \"$(date +%YYmmDD)\""
59
prop_readIoFile = isOk readIoFile ">> \"$(date +%YYmmDD)\""
59
false
false
0
5
6
11
5
6
null
null
molysgaard/kvante
Kvante.hs
bsd-3-clause
nums = map (\x -> x :+ 0) [1..3]
32
nums = map (\x -> x :+ 0) [1..3]
32
nums = map (\x -> x :+ 0) [1..3]
32
false
false
0
8
8
28
15
13
null
null
mightymoose/liquidhaskell
benchmarks/vector-0.10.0.1/Data/Vector/Fusion/Stream.hs
bsd-3-clause
prescanl = M.prescanl
21
prescanl = M.prescanl
21
prescanl = M.prescanl
21
false
false
0
5
2
8
4
4
null
null
hvr/text
Data/Text/Foreign.hs
bsd-2-clause
-- | /O(n)/ Create a new 'Text' from a 'Ptr' 'Word16' by copying the -- contents of the array. fromPtr :: Ptr Word16 -- ^ source array -> I16 -- ^ length of source array (in 'Word16' units) -> IO Text fromPtr _ (I16 0) = return empty
280
fromPtr :: Ptr Word16 -- ^ source array -> I16 -- ^ length of source array (in 'Word16' units) -> IO Text fromPtr _ (I16 0) = return empty
185
fromPtr _ (I16 0) = return empty
36
true
true
0
7
94
43
22
21
null
null
j-mueller/hldb
webapp/VirtualHom/Svg.hs
bsd-3-clause
-- | The @cx@ attribute. cx :: AttrTag cx = makeAttribute "cx"
62
cx :: AttrTag cx = makeAttribute "cx"
37
cx = makeAttribute "cx"
23
true
true
0
5
11
15
8
7
null
null
bezirg/gpah
src/Generics/GPAH/Date/PPrint.hs
bsd-3-clause
pprint :: Analysis -> FilePath -> IO () pprint (Analysis a1 a2 a3 a4 a5 a6 a7) fp = do let p = [["HackageArchiveCloneTime", a5], ["YearlyUpdatesToPackagesUsingSyb", show $ M.toList a1], ["YearlyUpdatesToPackagesUsingUniplate", show $ M.toList a2], ["YearlyUpdatesToPackagesUsingDerive", show $ M.toList a6], ["YearlyNewPackagesUsingSyb", show $ M.toList a3], ["YearlyNewPackagesUsingUniplate", show $ M.toList a4], ["YearlyNewPackagesUsingDerive", show $ M.toList a7] ] pCSV = printCSV p writeFile fp pCSV putStrLn "Date Results:\n###############" putStrLn pCSV
653
pprint :: Analysis -> FilePath -> IO () pprint (Analysis a1 a2 a3 a4 a5 a6 a7) fp = do let p = [["HackageArchiveCloneTime", a5], ["YearlyUpdatesToPackagesUsingSyb", show $ M.toList a1], ["YearlyUpdatesToPackagesUsingUniplate", show $ M.toList a2], ["YearlyUpdatesToPackagesUsingDerive", show $ M.toList a6], ["YearlyNewPackagesUsingSyb", show $ M.toList a3], ["YearlyNewPackagesUsingUniplate", show $ M.toList a4], ["YearlyNewPackagesUsingDerive", show $ M.toList a7] ] pCSV = printCSV p writeFile fp pCSV putStrLn "Date Results:\n###############" putStrLn pCSV
653
pprint (Analysis a1 a2 a3 a4 a5 a6 a7) fp = do let p = [["HackageArchiveCloneTime", a5], ["YearlyUpdatesToPackagesUsingSyb", show $ M.toList a1], ["YearlyUpdatesToPackagesUsingUniplate", show $ M.toList a2], ["YearlyUpdatesToPackagesUsingDerive", show $ M.toList a6], ["YearlyNewPackagesUsingSyb", show $ M.toList a3], ["YearlyNewPackagesUsingUniplate", show $ M.toList a4], ["YearlyNewPackagesUsingDerive", show $ M.toList a7] ] pCSV = printCSV p writeFile fp pCSV putStrLn "Date Results:\n###############" putStrLn pCSV
613
false
true
0
15
159
206
105
101
null
null
hspec/hspec
hspec-core/src/Test/Hspec/Core/QuickCheck.hs
mit
modifyMaxDiscardRatio :: (Int -> Int) -> SpecWith a -> SpecWith a modifyMaxDiscardRatio = modifyArgs . modify where modify :: (Int -> Int) -> Args -> Args modify f args = args {maxDiscardRatio = f (maxDiscardRatio args)} -- | Use a modified `maxSize` for given spec.
277
modifyMaxDiscardRatio :: (Int -> Int) -> SpecWith a -> SpecWith a modifyMaxDiscardRatio = modifyArgs . modify where modify :: (Int -> Int) -> Args -> Args modify f args = args {maxDiscardRatio = f (maxDiscardRatio args)} -- | Use a modified `maxSize` for given spec.
277
modifyMaxDiscardRatio = modifyArgs . modify where modify :: (Int -> Int) -> Args -> Args modify f args = args {maxDiscardRatio = f (maxDiscardRatio args)} -- | Use a modified `maxSize` for given spec.
211
false
true
0
10
55
101
48
53
null
null
uduki/hsQt
Qtc/ClassTypes/Network.hs
bsd-2-clause
withQUdpSocketResult :: IO (Ptr (TQUdpSocket a)) -> IO (QUdpSocket a) withQUdpSocketResult f = withObjectResult qtc_QUdpSocket_getFinalizer f
143
withQUdpSocketResult :: IO (Ptr (TQUdpSocket a)) -> IO (QUdpSocket a) withQUdpSocketResult f = withObjectResult qtc_QUdpSocket_getFinalizer f
143
withQUdpSocketResult f = withObjectResult qtc_QUdpSocket_getFinalizer f
73
false
true
0
10
17
47
22
25
null
null
nomeata/ghc
compiler/llvmGen/LlvmCodeGen/Data.hs
bsd-3-clause
genStaticLit (CmmFloat r w) = Right $ LMStaticLit (LMFloatLit (fromRational r) (widthToLlvmFloat w))
104
genStaticLit (CmmFloat r w) = Right $ LMStaticLit (LMFloatLit (fromRational r) (widthToLlvmFloat w))
104
genStaticLit (CmmFloat r w) = Right $ LMStaticLit (LMFloatLit (fromRational r) (widthToLlvmFloat w))
104
false
false
2
9
16
46
21
25
null
null
nikki-and-the-robots/nikki
src/Base/Grounds.hs
lgpl-3.0
foregrounds = accessor foregrounds_ (\ a r -> r{foregrounds_ = a})
66
foregrounds = accessor foregrounds_ (\ a r -> r{foregrounds_ = a})
66
foregrounds = accessor foregrounds_ (\ a r -> r{foregrounds_ = a})
66
false
false
1
9
10
33
16
17
null
null
mokus0/s-expression
src/Text/SExpr/Print.hs
bsd-3-clause
canToken [] = False
19
canToken [] = False
19
canToken [] = False
19
false
false
0
6
3
11
5
6
null
null
ribag/ganeti-experiments
src/Ganeti/Constants.hs
gpl-2.0
localstatedir :: String localstatedir = AutoConf.localstatedir
62
localstatedir :: String localstatedir = AutoConf.localstatedir
62
localstatedir = AutoConf.localstatedir
38
false
true
0
5
5
13
7
6
null
null
HaritzPuerto/SemanticsforWhileLanguage
While/Exercises03.hs
mit
aExpDerivSeq (V x) s = (Redex (V x) s):(aExpDerivSeq a' s') where Redex a' s' = sosAexp (Redex (V x) s)
109
aExpDerivSeq (V x) s = (Redex (V x) s):(aExpDerivSeq a' s') where Redex a' s' = sosAexp (Redex (V x) s)
109
aExpDerivSeq (V x) s = (Redex (V x) s):(aExpDerivSeq a' s') where Redex a' s' = sosAexp (Redex (V x) s)
109
false
false
0
9
26
72
35
37
null
null
budgefeeney/ventureforth
chap6/bench/VForth/LocationBench.hs
bsd-3-clause
benchmarks :: [Benchmark] benchmarks = [ bench "length.show" (whnf (T.length . showt) l) , bench "show" (whnf showt l) ] where l = Location { locTitle = "Your Bedroom" , locDescription = T.pack $ unlines [ "You're in your bedroom. It's an utterly disgusting tip of a place. ", "Dirty coffee mugs everywhere, bits of computer and motorbike all ", "over the floor. It's an outrage. You can leave by going north, and ", "maybe you should." ] , locItems = [] }
544
benchmarks :: [Benchmark] benchmarks = [ bench "length.show" (whnf (T.length . showt) l) , bench "show" (whnf showt l) ] where l = Location { locTitle = "Your Bedroom" , locDescription = T.pack $ unlines [ "You're in your bedroom. It's an utterly disgusting tip of a place. ", "Dirty coffee mugs everywhere, bits of computer and motorbike all ", "over the floor. It's an outrage. You can leave by going north, and ", "maybe you should." ] , locItems = [] }
544
benchmarks = [ bench "length.show" (whnf (T.length . showt) l) , bench "show" (whnf showt l) ] where l = Location { locTitle = "Your Bedroom" , locDescription = T.pack $ unlines [ "You're in your bedroom. It's an utterly disgusting tip of a place. ", "Dirty coffee mugs everywhere, bits of computer and motorbike all ", "over the floor. It's an outrage. You can leave by going north, and ", "maybe you should." ] , locItems = [] }
518
false
true
1
11
170
119
61
58
null
null
nakamuray/mangekyo
src/Mangekyo/Type.hs
bsd-2-clause
string Null = return $ String ""
32
string Null = return $ String ""
32
string Null = return $ String ""
32
false
false
3
5
6
20
7
13
null
null
pparkkin/eta
libraries/eta-boot/Eta/PackageDb.hs
bsd-3-clause
-- TODO: we may be able to replace the following with utils from the binary -- package in future. -- | Feed a 'Get' decoder with data chunks from a file. -- decodeFromFile :: FilePath -> DbOpenMode mode t -> Get pkgs -> IO (pkgs, DbOpenMode mode PackageDbLock) decodeFromFile file mode decoder = case mode of DbOpenReadOnly -> do -- When we open the package db in read only mode, there is no need to acquire -- shared lock on non-Windows platform because we update the database with an -- atomic rename, so readers will always see the database in a consistent -- state. #if MIN_VERSION_base(4,10,0) && defined(mingw32_HOST_OS) bracket (lockPackageDbWith SharedLock file) unlockPackageDb $ \_ -> do #endif (, DbOpenReadOnly) <$> decodeFileContents DbOpenReadWrite{} -> do -- When we open the package db in read/write mode, acquire an exclusive lock -- on the database and return it so we can keep it for the duration of the -- update. bracketOnError (lockPackageDb file) unlockPackageDb $ \lock -> do (, DbOpenReadWrite lock) <$> decodeFileContents where decodeFileContents = withBinaryFile file ReadMode $ \hnd -> feed hnd (runGetIncremental decoder) feed hnd (Partial k) = do chunk <- BS.hGet hnd BS.Lazy.defaultChunkSize if BS.null chunk then feed hnd (k Nothing) else feed hnd (k (Just chunk)) feed _ (Done _ _ res) = return res feed _ (Fail _ _ msg) = ioError err where err = mkIOError InappropriateType loc Nothing (Just file) `ioeSetErrorString` msg loc = "Eta.PackageDb.readPackageDb" -- Copied from Cabal's Distribution.Simple.Utils.
1,764
decodeFromFile :: FilePath -> DbOpenMode mode t -> Get pkgs -> IO (pkgs, DbOpenMode mode PackageDbLock) decodeFromFile file mode decoder = case mode of DbOpenReadOnly -> do -- When we open the package db in read only mode, there is no need to acquire -- shared lock on non-Windows platform because we update the database with an -- atomic rename, so readers will always see the database in a consistent -- state. #if MIN_VERSION_base(4,10,0) && defined(mingw32_HOST_OS) bracket (lockPackageDbWith SharedLock file) unlockPackageDb $ \_ -> do #endif (, DbOpenReadOnly) <$> decodeFileContents DbOpenReadWrite{} -> do -- When we open the package db in read/write mode, acquire an exclusive lock -- on the database and return it so we can keep it for the duration of the -- update. bracketOnError (lockPackageDb file) unlockPackageDb $ \lock -> do (, DbOpenReadWrite lock) <$> decodeFileContents where decodeFileContents = withBinaryFile file ReadMode $ \hnd -> feed hnd (runGetIncremental decoder) feed hnd (Partial k) = do chunk <- BS.hGet hnd BS.Lazy.defaultChunkSize if BS.null chunk then feed hnd (k Nothing) else feed hnd (k (Just chunk)) feed _ (Done _ _ res) = return res feed _ (Fail _ _ msg) = ioError err where err = mkIOError InappropriateType loc Nothing (Just file) `ioeSetErrorString` msg loc = "Eta.PackageDb.readPackageDb" -- Copied from Cabal's Distribution.Simple.Utils.
1,606
decodeFromFile file mode decoder = case mode of DbOpenReadOnly -> do -- When we open the package db in read only mode, there is no need to acquire -- shared lock on non-Windows platform because we update the database with an -- atomic rename, so readers will always see the database in a consistent -- state. #if MIN_VERSION_base(4,10,0) && defined(mingw32_HOST_OS) bracket (lockPackageDbWith SharedLock file) unlockPackageDb $ \_ -> do #endif (, DbOpenReadOnly) <$> decodeFileContents DbOpenReadWrite{} -> do -- When we open the package db in read/write mode, acquire an exclusive lock -- on the database and return it so we can keep it for the duration of the -- update. bracketOnError (lockPackageDb file) unlockPackageDb $ \lock -> do (, DbOpenReadWrite lock) <$> decodeFileContents where decodeFileContents = withBinaryFile file ReadMode $ \hnd -> feed hnd (runGetIncremental decoder) feed hnd (Partial k) = do chunk <- BS.hGet hnd BS.Lazy.defaultChunkSize if BS.null chunk then feed hnd (k Nothing) else feed hnd (k (Just chunk)) feed _ (Done _ _ res) = return res feed _ (Fail _ _ msg) = ioError err where err = mkIOError InappropriateType loc Nothing (Just file) `ioeSetErrorString` msg loc = "Eta.PackageDb.readPackageDb" -- Copied from Cabal's Distribution.Simple.Utils.
1,484
true
true
0
16
468
348
178
170
null
null
sgillespie/ghc
compiler/basicTypes/OccName.hs
bsd-3-clause
isDerivedOccName :: OccName -> Bool -- ^ Test for definitions internally generated by GHC. This predicte -- is used to suppress printing of internal definitions in some debug prints isDerivedOccName occ = case occNameString occ of '$':c:_ | isAlphaNum c -> True -- E.g. $wfoo c:':':_ | isAlphaNum c -> True -- E.g. N:blah newtype coercions _other -> False
398
isDerivedOccName :: OccName -> Bool isDerivedOccName occ = case occNameString occ of '$':c:_ | isAlphaNum c -> True -- E.g. $wfoo c:':':_ | isAlphaNum c -> True -- E.g. N:blah newtype coercions _other -> False
251
isDerivedOccName occ = case occNameString occ of '$':c:_ | isAlphaNum c -> True -- E.g. $wfoo c:':':_ | isAlphaNum c -> True -- E.g. N:blah newtype coercions _other -> False
215
true
true
0
11
101
81
39
42
null
null
tjunier/mlgsc
src/CladeModel.hs
mit
cladeName (NucCladeModel nm) = nucCladeName nm
46
cladeName (NucCladeModel nm) = nucCladeName nm
46
cladeName (NucCladeModel nm) = nucCladeName nm
46
false
false
0
6
5
19
8
11
null
null
DenisLila/public
toys/realworldhaskell/Main.hs
mit
main = print (JObject [("dick", JString "butt")])
49
main = print (JObject [("dick", JString "butt")])
49
main = print (JObject [("dick", JString "butt")])
49
false
false
0
10
6
27
14
13
null
null
phischu/fragnix
tests/packages/scotty/Network.HTTP.Types.Header.hs
bsd-3-clause
hTrailer = "Trailer"
31
hTrailer = "Trailer"
31
hTrailer = "Trailer"
31
false
false
1
5
13
10
3
7
null
null
sapek/pandoc
src/Text/Pandoc/Readers/Org.hs
gpl-2.0
enclosedInlines :: OrgParser a -> OrgParser b -> OrgParser (F Inlines) enclosedInlines start end = try $ trimInlinesF . mconcat <$> enclosed start end inline
191
enclosedInlines :: OrgParser a -> OrgParser b -> OrgParser (F Inlines) enclosedInlines start end = try $ trimInlinesF . mconcat <$> enclosed start end inline
191
enclosedInlines start end = try $ trimInlinesF . mconcat <$> enclosed start end inline
88
false
true
0
9
58
58
27
31
null
null
GaloisInc/saw-script
heapster-saw/src/Verifier/SAW/Heapster/GenMonad.hs
bsd-3-clause
gput :: s -> GenStateContT s r s_ r m () gput s = GenStateContT \_ k -> k s ()
78
gput :: s -> GenStateContT s r s_ r m () gput s = GenStateContT \_ k -> k s ()
78
gput s = GenStateContT \_ k -> k s ()
37
false
true
0
8
20
54
25
29
null
null
olsner/ghc
compiler/deSugar/Coverage.hs
bsd-3-clause
addTickHsExpr (ArithSeq ty wit arith_seq) = liftM3 ArithSeq (return ty) (addTickWit wit) (addTickArithSeqInfo arith_seq) where addTickWit Nothing = return Nothing addTickWit (Just fl) = do fl' <- addTickSyntaxExpr hpcSrcSpan fl return (Just fl') -- We might encounter existing ticks (multiple Coverage passes)
444
addTickHsExpr (ArithSeq ty wit arith_seq) = liftM3 ArithSeq (return ty) (addTickWit wit) (addTickArithSeqInfo arith_seq) where addTickWit Nothing = return Nothing addTickWit (Just fl) = do fl' <- addTickSyntaxExpr hpcSrcSpan fl return (Just fl') -- We might encounter existing ticks (multiple Coverage passes)
444
addTickHsExpr (ArithSeq ty wit arith_seq) = liftM3 ArithSeq (return ty) (addTickWit wit) (addTickArithSeqInfo arith_seq) where addTickWit Nothing = return Nothing addTickWit (Just fl) = do fl' <- addTickSyntaxExpr hpcSrcSpan fl return (Just fl') -- We might encounter existing ticks (multiple Coverage passes)
444
false
false
0
11
176
98
46
52
null
null
dalaing/type-systems
src/Fragment/TmLam/Rules/Type/Infer/Offline.hs
bsd-3-clause
tmLamInferTypeRules :: TmLamInferTypeContext e w s r m ki ty pt tm a => InferTypeInput e w s r m (UnifyT ki ty a m) ki ty pt tm a tmLamInferTypeRules = L.inferTypeInput (L.TmLamHelper expectTmLam)
218
tmLamInferTypeRules :: TmLamInferTypeContext e w s r m ki ty pt tm a => InferTypeInput e w s r m (UnifyT ki ty a m) ki ty pt tm a tmLamInferTypeRules = L.inferTypeInput (L.TmLamHelper expectTmLam)
218
tmLamInferTypeRules = L.inferTypeInput (L.TmLamHelper expectTmLam)
68
false
true
0
9
56
89
42
47
null
null
jstolarek/ghc
compiler/ghci/Debugger.hs
bsd-3-clause
showTerm :: GhcMonad m => Term -> m SDoc showTerm term = do dflags <- GHC.getSessionDynFlags if gopt Opt_PrintEvldWithShow dflags then cPprTerm (liftM2 (++) (\_y->[cPprShowable]) cPprTermBase) term else cPprTerm cPprTermBase term where cPprShowable prec t@Term{ty=ty, val=val} = if not (isFullyEvaluatedTerm t) then return Nothing else do hsc_env <- getSession dflags <- GHC.getSessionDynFlags do (new_env, bname) <- bindToFreshName hsc_env ty "showme" setSession new_env -- XXX: this tries to disable logging of errors -- does this still do what it is intended to do -- with the changed error handling and logging? let noop_log _ _ _ _ _ = return () expr = "show " ++ showPpr dflags bname _ <- GHC.setSessionDynFlags dflags{log_action=noop_log} txt_ <- withExtendedLinkEnv [(bname, val)] (GHC.compileExpr expr) let myprec = 10 -- application precedence. TODO Infix constructors let txt = unsafeCoerce# txt_ :: [a] if not (null txt) then return $ Just $ cparen (prec >= myprec && needsParens txt) (text txt) else return Nothing `gfinally` do setSession hsc_env GHC.setSessionDynFlags dflags cPprShowable prec NewtypeWrap{ty=new_ty,wrapped_term=t} = cPprShowable prec t{ty=new_ty} cPprShowable _ _ = return Nothing needsParens ('"':_) = False -- some simple heuristics to see whether parens -- are redundant in an arbitrary Show output needsParens ('(':_) = False needsParens txt = ' ' `elem` txt bindToFreshName hsc_env ty userName = do name <- newGrimName userName let id = AnId $ mkVanillaGlobal name ty new_ic = extendInteractiveContext (hsc_IC hsc_env) [id] return (hsc_env {hsc_IC = new_ic }, name) -- Create new uniques and give them sequentially numbered names
2,126
showTerm :: GhcMonad m => Term -> m SDoc showTerm term = do dflags <- GHC.getSessionDynFlags if gopt Opt_PrintEvldWithShow dflags then cPprTerm (liftM2 (++) (\_y->[cPprShowable]) cPprTermBase) term else cPprTerm cPprTermBase term where cPprShowable prec t@Term{ty=ty, val=val} = if not (isFullyEvaluatedTerm t) then return Nothing else do hsc_env <- getSession dflags <- GHC.getSessionDynFlags do (new_env, bname) <- bindToFreshName hsc_env ty "showme" setSession new_env -- XXX: this tries to disable logging of errors -- does this still do what it is intended to do -- with the changed error handling and logging? let noop_log _ _ _ _ _ = return () expr = "show " ++ showPpr dflags bname _ <- GHC.setSessionDynFlags dflags{log_action=noop_log} txt_ <- withExtendedLinkEnv [(bname, val)] (GHC.compileExpr expr) let myprec = 10 -- application precedence. TODO Infix constructors let txt = unsafeCoerce# txt_ :: [a] if not (null txt) then return $ Just $ cparen (prec >= myprec && needsParens txt) (text txt) else return Nothing `gfinally` do setSession hsc_env GHC.setSessionDynFlags dflags cPprShowable prec NewtypeWrap{ty=new_ty,wrapped_term=t} = cPprShowable prec t{ty=new_ty} cPprShowable _ _ = return Nothing needsParens ('"':_) = False -- some simple heuristics to see whether parens -- are redundant in an arbitrary Show output needsParens ('(':_) = False needsParens txt = ' ' `elem` txt bindToFreshName hsc_env ty userName = do name <- newGrimName userName let id = AnId $ mkVanillaGlobal name ty new_ic = extendInteractiveContext (hsc_IC hsc_env) [id] return (hsc_env {hsc_IC = new_ic }, name) -- Create new uniques and give them sequentially numbered names
2,126
showTerm term = do dflags <- GHC.getSessionDynFlags if gopt Opt_PrintEvldWithShow dflags then cPprTerm (liftM2 (++) (\_y->[cPprShowable]) cPprTermBase) term else cPprTerm cPprTermBase term where cPprShowable prec t@Term{ty=ty, val=val} = if not (isFullyEvaluatedTerm t) then return Nothing else do hsc_env <- getSession dflags <- GHC.getSessionDynFlags do (new_env, bname) <- bindToFreshName hsc_env ty "showme" setSession new_env -- XXX: this tries to disable logging of errors -- does this still do what it is intended to do -- with the changed error handling and logging? let noop_log _ _ _ _ _ = return () expr = "show " ++ showPpr dflags bname _ <- GHC.setSessionDynFlags dflags{log_action=noop_log} txt_ <- withExtendedLinkEnv [(bname, val)] (GHC.compileExpr expr) let myprec = 10 -- application precedence. TODO Infix constructors let txt = unsafeCoerce# txt_ :: [a] if not (null txt) then return $ Just $ cparen (prec >= myprec && needsParens txt) (text txt) else return Nothing `gfinally` do setSession hsc_env GHC.setSessionDynFlags dflags cPprShowable prec NewtypeWrap{ty=new_ty,wrapped_term=t} = cPprShowable prec t{ty=new_ty} cPprShowable _ _ = return Nothing needsParens ('"':_) = False -- some simple heuristics to see whether parens -- are redundant in an arbitrary Show output needsParens ('(':_) = False needsParens txt = ' ' `elem` txt bindToFreshName hsc_env ty userName = do name <- newGrimName userName let id = AnId $ mkVanillaGlobal name ty new_ic = extendInteractiveContext (hsc_IC hsc_env) [id] return (hsc_env {hsc_IC = new_ic }, name) -- Create new uniques and give them sequentially numbered names
2,085
false
true
0
16
706
554
279
275
null
null
scottgw/demonL
Language/DemonL/PrettyPrint.hs
bsd-3-clause
emptyLine = text ""
19
emptyLine = text ""
19
emptyLine = text ""
19
false
false
0
5
3
9
4
5
null
null
snoyberg/ghc
libraries/ghci/GHCi/RemoteTypes.hs
bsd-3-clause
-- | Make a reference to a local value that we can send remotely. -- This reference will keep the value that it refers to alive until -- 'freeRemoteRef' is called. mkRemoteRef :: a -> IO (RemoteRef a) mkRemoteRef a = do sp <- newStablePtr a return $! RemoteRef (toRemotePtr (castStablePtrToPtr sp)) -- | Convert an HValueRef to an HValue. Should only be used if the HValue -- originated in this process.
409
mkRemoteRef :: a -> IO (RemoteRef a) mkRemoteRef a = do sp <- newStablePtr a return $! RemoteRef (toRemotePtr (castStablePtrToPtr sp)) -- | Convert an HValueRef to an HValue. Should only be used if the HValue -- originated in this process.
245
mkRemoteRef a = do sp <- newStablePtr a return $! RemoteRef (toRemotePtr (castStablePtrToPtr sp)) -- | Convert an HValueRef to an HValue. Should only be used if the HValue -- originated in this process.
208
true
true
0
12
77
64
32
32
null
null
athanclark/Idris-dev
src/Idris/Delaborate.hs
bsd-3-clause
showPart ist (TermPart tm) = pprintTerm ist (delabSugared ist tm)
66
showPart ist (TermPart tm) = pprintTerm ist (delabSugared ist tm)
66
showPart ist (TermPart tm) = pprintTerm ist (delabSugared ist tm)
66
false
false
0
7
10
30
14
16
null
null
Elastifile/git-sling
server/src/Sling/Email.hs
gpl-2.0
formatCommitsForEmail :: Options -> Proposal -> [Git.LogEntry] -> Maybe Text -> H.Html formatCommitsForEmail options proposal commits baseUrl = do H.p . H.b $ "Proposal" H.p . fromString $ "Proposed by: " <> T.unpack (formatEmail . proposalEmail $ proposal) H.p $ do H.span "Onto branch: " H.b (fromString . T.unpack . Git.fromBranchName . proposalBranchOnto $ proposal) when (isDryRun options proposal) $ H.span " (Dry run only, branch not moved)" htmlFormatCommitLog commits baseUrl
524
formatCommitsForEmail :: Options -> Proposal -> [Git.LogEntry] -> Maybe Text -> H.Html formatCommitsForEmail options proposal commits baseUrl = do H.p . H.b $ "Proposal" H.p . fromString $ "Proposed by: " <> T.unpack (formatEmail . proposalEmail $ proposal) H.p $ do H.span "Onto branch: " H.b (fromString . T.unpack . Git.fromBranchName . proposalBranchOnto $ proposal) when (isDryRun options proposal) $ H.span " (Dry run only, branch not moved)" htmlFormatCommitLog commits baseUrl
524
formatCommitsForEmail options proposal commits baseUrl = do H.p . H.b $ "Proposal" H.p . fromString $ "Proposed by: " <> T.unpack (formatEmail . proposalEmail $ proposal) H.p $ do H.span "Onto branch: " H.b (fromString . T.unpack . Git.fromBranchName . proposalBranchOnto $ proposal) when (isDryRun options proposal) $ H.span " (Dry run only, branch not moved)" htmlFormatCommitLog commits baseUrl
437
false
true
0
16
110
173
81
92
null
null
elieux/ghc
compiler/typecheck/TcGenDeriv.hs
bsd-3-clause
eqInt_RDR = varQual_RDR gHC_PRIM (fsLit "==#")
52
eqInt_RDR = varQual_RDR gHC_PRIM (fsLit "==#")
52
eqInt_RDR = varQual_RDR gHC_PRIM (fsLit "==#")
52
false
false
0
7
11
17
8
9
null
null
sergv/icfpc2013
haskell/Main.hs
bsd-3-clause
eitherDecode' input = maybe (Left $ "decoding failed for " ++ BS.unpack input) Right $ decode' input
100
eitherDecode' input = maybe (Left $ "decoding failed for " ++ BS.unpack input) Right $ decode' input
100
eitherDecode' input = maybe (Left $ "decoding failed for " ++ BS.unpack input) Right $ decode' input
100
false
false
0
10
16
37
17
20
null
null
zjurelinac/Pljuska
Hash.hs
mit
runInteractive :: IO () runInteractive = do env <- blankEnvironment env' <- runRcFile env startup env' runOnce env' return ()
145
runInteractive :: IO () runInteractive = do env <- blankEnvironment env' <- runRcFile env startup env' runOnce env' return ()
145
runInteractive = do env <- blankEnvironment env' <- runRcFile env startup env' runOnce env' return ()
121
false
true
0
8
39
53
22
31
null
null
stu-smith/project-euler-haskell
Euler-007.hs
mit
factors :: (Integral a) => a -> [a] factors x = filter (\ y -> x /= y && x `mod` y == 0) [1 .. (ceiling $ sqrt $ fromIntegral x)]
130
factors :: (Integral a) => a -> [a] factors x = filter (\ y -> x /= y && x `mod` y == 0) [1 .. (ceiling $ sqrt $ fromIntegral x)]
129
factors x = filter (\ y -> x /= y && x `mod` y == 0) [1 .. (ceiling $ sqrt $ fromIntegral x)]
93
false
true
0
11
32
86
45
41
null
null
cies/gelatin
gelatin-picture/src/Gelatin/Picture.hs
bsd-3-clause
boundingBox cd (Free (Arc (V2 xr yr) start stop n)) = let vs = concatMap (subdivideAdaptive4 100 0) $ Core.arc xr yr start stop in boundsBounds [polyBounds vs, boundingBox cd n]
185
boundingBox cd (Free (Arc (V2 xr yr) start stop n)) = let vs = concatMap (subdivideAdaptive4 100 0) $ Core.arc xr yr start stop in boundsBounds [polyBounds vs, boundingBox cd n]
185
boundingBox cd (Free (Arc (V2 xr yr) start stop n)) = let vs = concatMap (subdivideAdaptive4 100 0) $ Core.arc xr yr start stop in boundsBounds [polyBounds vs, boundingBox cd n]
185
false
false
0
12
38
91
43
48
null
null
vito/atomo
src/Atomo/Types.hs
bsd-3-clause
isTuple _ = False
17
isTuple _ = False
17
isTuple _ = False
17
false
false
0
4
3
10
4
6
null
null
fpinsight/hocilib
src/Database/Ocilib/Statement.hs
bsd-2-clause
-- | Return the number of rows pre-fetched by OCI Client. ociGetPrefetchSize :: Ptr OCI_Statement -> IO CUInt ociGetPrefetchSize st = [C.exp| unsigned int { OCI_GetPrefetchSize($(OCI_Statement *st)) } |]
203
ociGetPrefetchSize :: Ptr OCI_Statement -> IO CUInt ociGetPrefetchSize st = [C.exp| unsigned int { OCI_GetPrefetchSize($(OCI_Statement *st)) } |]
145
ociGetPrefetchSize st = [C.exp| unsigned int { OCI_GetPrefetchSize($(OCI_Statement *st)) } |]
93
true
true
0
7
28
36
18
18
null
null
Pochoir/Pochoir
src/PShow.hs
gpl-3.0
pMul :: String -> String -> String pMul a b = "(" ++ a ++ ") * " ++ b
69
pMul :: String -> String -> String pMul a b = "(" ++ a ++ ") * " ++ b
69
pMul a b = "(" ++ a ++ ") * " ++ b
34
false
true
6
8
19
45
19
26
null
null
codygman/Frames
src/Frames/RecF.hs
bsd-3-clause
mapMonoV :: (Functor f, AllAre a ts) => (a -> a) -> V.Rec f ts -> V.Rec f ts mapMonoV _ V.RNil = V.RNil
103
mapMonoV :: (Functor f, AllAre a ts) => (a -> a) -> V.Rec f ts -> V.Rec f ts mapMonoV _ V.RNil = V.RNil
103
mapMonoV _ V.RNil = V.RNil
26
false
true
0
10
23
71
34
37
null
null
DavidAlphaFox/darcs
src/Darcs/UI/Flags.hs
gpl-2.0
verbosity :: Config -> O.Verbosity verbosity = parseFlags O.verbosity
69
verbosity :: Config -> O.Verbosity verbosity = parseFlags O.verbosity
69
verbosity = parseFlags O.verbosity
34
false
true
0
6
8
22
11
11
null
null
tyoko-dev/jana
src/Jana/Format.hs
bsd-3-clause
formatStmt (Call id args _) = text "call" <+> formatIdent id <> parens (commasep $ map formatIdent args)
106
formatStmt (Call id args _) = text "call" <+> formatIdent id <> parens (commasep $ map formatIdent args)
106
formatStmt (Call id args _) = text "call" <+> formatIdent id <> parens (commasep $ map formatIdent args)
106
false
false
0
9
19
48
22
26
null
null
azadbolour/boardgame
haskell-server/test/BoardGame/Server/Service/PieceProviderSpec.hs
agpl-3.0
letterFrequencies = [ ('A', 10), ('B', 20), ('C', 30), ('D', 40) ]
84
letterFrequencies = [ ('A', 10), ('B', 20), ('C', 30), ('D', 40) ]
84
letterFrequencies = [ ('A', 10), ('B', 20), ('C', 30), ('D', 40) ]
84
false
false
0
6
29
42
27
15
null
null
wangbj/haskell
0092.hs
bsd-2-clause
pr False = "No"
15
pr False = "No"
15
pr False = "No"
15
false
false
0
5
3
9
4
5
null
null
sdiehl/ghc
compiler/GHC/Cmm/Dataflow.hs
bsd-3-clause
joinBlocksOO (BMiddle n) b = blockCons n b
42
joinBlocksOO (BMiddle n) b = blockCons n b
42
joinBlocksOO (BMiddle n) b = blockCons n b
42
false
false
1
6
7
28
10
18
null
null
Zigazou/HaMinitel
src/Minitel/Minitel.hs
gpl-3.0
-- | Waits for an MString of @count@ elements coming from the Minitel. If it -- takes too long, returns what has already been collected. -- This is the non-blocking version readNCount :: (Eq a) => IO a -> Int -> IO [a] readNCount getter' count = readNMString getter' (\sequ -> length sequ == count)
302
readNCount :: (Eq a) => IO a -> Int -> IO [a] readNCount getter' count = readNMString getter' (\sequ -> length sequ == count)
125
readNCount getter' count = readNMString getter' (\sequ -> length sequ == count)
79
true
true
0
9
58
65
34
31
null
null
CloudI/CloudI
src/api/haskell/external/bytestring-0.10.10.0/Data/ByteString/Unsafe.hs
mit
unsafeFinalize :: ByteString -> IO () unsafeFinalize (PS p _ _) = FC.finalizeForeignPtr p
89
unsafeFinalize :: ByteString -> IO () unsafeFinalize (PS p _ _) = FC.finalizeForeignPtr p
89
unsafeFinalize (PS p _ _) = FC.finalizeForeignPtr p
51
false
true
0
7
13
38
18
20
null
null
spechub/Hets
OWL2/Parse.hs
gpl-2.0
objectPropertyCharacter :: CharParser st Character objectPropertyCharacter = choice $ map (\ f -> keyword (show f) >> return f) characters
140
objectPropertyCharacter :: CharParser st Character objectPropertyCharacter = choice $ map (\ f -> keyword (show f) >> return f) characters
140
objectPropertyCharacter = choice $ map (\ f -> keyword (show f) >> return f) characters
89
false
true
0
12
21
49
24
25
null
null
AaronFriel/hs-tls
core/Network/TLS/Handshake/Client.hs
bsd-3-clause
onServerHello _ _ _ p = unexpected (show p) (Just "server hello")
65
onServerHello _ _ _ p = unexpected (show p) (Just "server hello")
65
onServerHello _ _ _ p = unexpected (show p) (Just "server hello")
65
false
false
0
7
11
32
15
17
null
null
mgold/Elm
src/Generate/JavaScript/Expression.hs
bsd-3-clause
generateFunction :: [String] -> Opt.Expr -> State Int Code generateFunction args body = do code <- generateCode body jsExpr (generateFunctionWithArity args code)
170
generateFunction :: [String] -> Opt.Expr -> State Int Code generateFunction args body = do code <- generateCode body jsExpr (generateFunctionWithArity args code)
170
generateFunction args body = do code <- generateCode body jsExpr (generateFunctionWithArity args code)
111
false
true
0
10
30
63
28
35
null
null
mrmonday/Idris-dev
src/Idris/Delaborate.hs
bsd-3-clause
pprintErr' i (Msg s) = text s
29
pprintErr' i (Msg s) = text s
29
pprintErr' i (Msg s) = text s
29
false
false
0
6
6
22
9
13
null
null
jovermann/tip-toi-reveng
src/tttool.hs
mit
main' t ("rewrite": inf : out: []) = rewrite inf out
66
main' t ("rewrite": inf : out: []) = rewrite inf out
66
main' t ("rewrite": inf : out: []) = rewrite inf out
66
false
false
0
10
24
33
16
17
null
null
mtesseract/wosa
src/Nebelfiller.hs
bsd-3-clause
-- Constraint 3 Stats: Return list of those wordset groups which share -- the same two listTwo items. constraintThreeStats_WordsetsSharingListTwoPair :: WordsetMap -> [[Integer]] constraintThreeStats_WordsetsSharingListTwoPair wordsetMap = let wordsetList = MapL.toList wordsetMap in (nubSort . extractIndices . filterCriticalGroups . map (wordsetsSharingListTwoPair wordsetList)) wordsetList where filterCriticalGroups :: [[a]] -> [[a]] filterCriticalGroups = filter (lengthAtLeast 2) extractIndices :: [[(a, b)]] -> [[a]] extractIndices = map listFst wordsetsSharingListTwoPair :: [(Integer, Wordset)] -> (Integer, Wordset) -> [(Integer, Wordset)] wordsetsSharingListTwoPair wssIdx wsIdx = filter (listTwoPairCoincides wsIdx) wssIdx listTwoPairCoincides :: (Integer, Wordset) -> (Integer, Wordset) -> Bool listTwoPairCoincides (_, ws0) (_, ws1) = countListTwoIntersection ws0 ws1 == 2 -- Constraint 3 Checker. Returns True if constraint 3 is satisfied.
1,059
constraintThreeStats_WordsetsSharingListTwoPair :: WordsetMap -> [[Integer]] constraintThreeStats_WordsetsSharingListTwoPair wordsetMap = let wordsetList = MapL.toList wordsetMap in (nubSort . extractIndices . filterCriticalGroups . map (wordsetsSharingListTwoPair wordsetList)) wordsetList where filterCriticalGroups :: [[a]] -> [[a]] filterCriticalGroups = filter (lengthAtLeast 2) extractIndices :: [[(a, b)]] -> [[a]] extractIndices = map listFst wordsetsSharingListTwoPair :: [(Integer, Wordset)] -> (Integer, Wordset) -> [(Integer, Wordset)] wordsetsSharingListTwoPair wssIdx wsIdx = filter (listTwoPairCoincides wsIdx) wssIdx listTwoPairCoincides :: (Integer, Wordset) -> (Integer, Wordset) -> Bool listTwoPairCoincides (_, ws0) (_, ws1) = countListTwoIntersection ws0 ws1 == 2 -- Constraint 3 Checker. Returns True if constraint 3 is satisfied.
957
constraintThreeStats_WordsetsSharingListTwoPair wordsetMap = let wordsetList = MapL.toList wordsetMap in (nubSort . extractIndices . filterCriticalGroups . map (wordsetsSharingListTwoPair wordsetList)) wordsetList where filterCriticalGroups :: [[a]] -> [[a]] filterCriticalGroups = filter (lengthAtLeast 2) extractIndices :: [[(a, b)]] -> [[a]] extractIndices = map listFst wordsetsSharingListTwoPair :: [(Integer, Wordset)] -> (Integer, Wordset) -> [(Integer, Wordset)] wordsetsSharingListTwoPair wssIdx wsIdx = filter (listTwoPairCoincides wsIdx) wssIdx listTwoPairCoincides :: (Integer, Wordset) -> (Integer, Wordset) -> Bool listTwoPairCoincides (_, ws0) (_, ws1) = countListTwoIntersection ws0 ws1 == 2 -- Constraint 3 Checker. Returns True if constraint 3 is satisfied.
880
true
true
6
12
216
261
144
117
null
null
jean-edouard/manager
apptool/Import/Monad.hs
gpl-2.0
runImportRpc = rpc
18
runImportRpc = rpc
18
runImportRpc = rpc
18
false
false
0
4
2
6
3
3
null
null
CloudI/CloudI
src/api/haskell/external/bytestring-0.10.10.0/Data/ByteString/Char8.hs
mit
-- | 'maximum' returns the maximum value from a 'ByteString' maximum :: ByteString -> Char maximum = w2c . B.maximum
116
maximum :: ByteString -> Char maximum = w2c . B.maximum
55
maximum = w2c . B.maximum
25
true
true
0
6
19
22
12
10
null
null
geophf/1HaskellADay
exercises/HAD/Y2017/M07/D26/Exercise.hs
mit
{-- >>> runStateT (fresh "a") Map.empty ((),fromList [("a",Free)]) ... what happens when you declare an already existing variable 'fresh'? ... what should happen? --} -- which means everything that you do with logic variables include the domain -- ... including unification. So, let's get to it. -- What happens when an atom is unified to a variable? unifyAtom2LV :: MonadPlus m => Atom -> Symbol -> StateT LogicDomain m () unifyAtom2LV val var = undefined
461
unifyAtom2LV :: MonadPlus m => Atom -> Symbol -> StateT LogicDomain m () unifyAtom2LV val var = undefined
105
unifyAtom2LV val var = undefined
32
true
true
0
9
79
44
23
21
null
null
copumpkin/charm
src/Architecture/ARM/Instructions/UAL.hs
bsd-3-clause
str Word False = STR
27
str Word False = STR
27
str Word False = STR
27
false
false
1
5
11
16
5
11
null
null
DavidAlphaFox/ghc
libraries/Cabal/Cabal/Distribution/Simple/Haddock.hs
bsd-3-clause
hscolour' :: (String -> IO ()) -- ^ Called when the 'hscolour' exe is not found. -> PackageDescription -> LocalBuildInfo -> [PPSuffixHandler] -> HscolourFlags -> IO () hscolour' onNoHsColour pkg_descr lbi suffixes flags = either onNoHsColour (\(hscolourProg, _, _) -> go hscolourProg) =<< lookupProgramVersion verbosity hscolourProgram (orLaterVersion (Version [1,8] [])) (withPrograms lbi) where go :: ConfiguredProgram -> IO () go hscolourProg = do setupMessage verbosity "Running hscolour for" (packageId pkg_descr) createDirectoryIfMissingVerbose verbosity True $ hscolourPref distPref pkg_descr let pre c = preprocessComponent pkg_descr c lbi False verbosity suffixes withAllComponentsInBuildOrder pkg_descr lbi $ \comp _ -> do pre comp let doExe com = case (compToExe com) of Just exe -> do let outputDir = hscolourPref distPref pkg_descr </> exeName exe </> "src" runHsColour hscolourProg outputDir =<< getExeSourceFiles lbi exe Nothing -> do warn (fromFlag $ hscolourVerbosity flags) "Unsupported component, skipping..." return () case comp of CLib lib -> do let outputDir = hscolourPref distPref pkg_descr </> "src" runHsColour hscolourProg outputDir =<< getLibSourceFiles lbi lib CExe _ -> when (fromFlag (hscolourExecutables flags)) $ doExe comp CTest _ -> when (fromFlag (hscolourTestSuites flags)) $ doExe comp CBench _ -> when (fromFlag (hscolourBenchmarks flags)) $ doExe comp stylesheet = flagToMaybe (hscolourCSS flags) verbosity = fromFlag (hscolourVerbosity flags) distPref = fromFlag (hscolourDistPref flags) runHsColour prog outputDir moduleFiles = do createDirectoryIfMissingVerbose verbosity True outputDir case stylesheet of -- copy the CSS file Nothing | programVersion prog >= Just (Version [1,9] []) -> rawSystemProgram verbosity prog ["-print-css", "-o" ++ outputDir </> "hscolour.css"] | otherwise -> return () Just s -> copyFileVerbose verbosity s (outputDir </> "hscolour.css") forM_ moduleFiles $ \(m, inFile) -> rawSystemProgram verbosity prog ["-css", "-anchor", "-o" ++ outFile m, inFile] where outFile m = outputDir </> intercalate "-" (ModuleName.components m) <.> "html"
2,660
hscolour' :: (String -> IO ()) -- ^ Called when the 'hscolour' exe is not found. -> PackageDescription -> LocalBuildInfo -> [PPSuffixHandler] -> HscolourFlags -> IO () hscolour' onNoHsColour pkg_descr lbi suffixes flags = either onNoHsColour (\(hscolourProg, _, _) -> go hscolourProg) =<< lookupProgramVersion verbosity hscolourProgram (orLaterVersion (Version [1,8] [])) (withPrograms lbi) where go :: ConfiguredProgram -> IO () go hscolourProg = do setupMessage verbosity "Running hscolour for" (packageId pkg_descr) createDirectoryIfMissingVerbose verbosity True $ hscolourPref distPref pkg_descr let pre c = preprocessComponent pkg_descr c lbi False verbosity suffixes withAllComponentsInBuildOrder pkg_descr lbi $ \comp _ -> do pre comp let doExe com = case (compToExe com) of Just exe -> do let outputDir = hscolourPref distPref pkg_descr </> exeName exe </> "src" runHsColour hscolourProg outputDir =<< getExeSourceFiles lbi exe Nothing -> do warn (fromFlag $ hscolourVerbosity flags) "Unsupported component, skipping..." return () case comp of CLib lib -> do let outputDir = hscolourPref distPref pkg_descr </> "src" runHsColour hscolourProg outputDir =<< getLibSourceFiles lbi lib CExe _ -> when (fromFlag (hscolourExecutables flags)) $ doExe comp CTest _ -> when (fromFlag (hscolourTestSuites flags)) $ doExe comp CBench _ -> when (fromFlag (hscolourBenchmarks flags)) $ doExe comp stylesheet = flagToMaybe (hscolourCSS flags) verbosity = fromFlag (hscolourVerbosity flags) distPref = fromFlag (hscolourDistPref flags) runHsColour prog outputDir moduleFiles = do createDirectoryIfMissingVerbose verbosity True outputDir case stylesheet of -- copy the CSS file Nothing | programVersion prog >= Just (Version [1,9] []) -> rawSystemProgram verbosity prog ["-print-css", "-o" ++ outputDir </> "hscolour.css"] | otherwise -> return () Just s -> copyFileVerbose verbosity s (outputDir </> "hscolour.css") forM_ moduleFiles $ \(m, inFile) -> rawSystemProgram verbosity prog ["-css", "-anchor", "-o" ++ outFile m, inFile] where outFile m = outputDir </> intercalate "-" (ModuleName.components m) <.> "html"
2,660
hscolour' onNoHsColour pkg_descr lbi suffixes flags = either onNoHsColour (\(hscolourProg, _, _) -> go hscolourProg) =<< lookupProgramVersion verbosity hscolourProgram (orLaterVersion (Version [1,8] [])) (withPrograms lbi) where go :: ConfiguredProgram -> IO () go hscolourProg = do setupMessage verbosity "Running hscolour for" (packageId pkg_descr) createDirectoryIfMissingVerbose verbosity True $ hscolourPref distPref pkg_descr let pre c = preprocessComponent pkg_descr c lbi False verbosity suffixes withAllComponentsInBuildOrder pkg_descr lbi $ \comp _ -> do pre comp let doExe com = case (compToExe com) of Just exe -> do let outputDir = hscolourPref distPref pkg_descr </> exeName exe </> "src" runHsColour hscolourProg outputDir =<< getExeSourceFiles lbi exe Nothing -> do warn (fromFlag $ hscolourVerbosity flags) "Unsupported component, skipping..." return () case comp of CLib lib -> do let outputDir = hscolourPref distPref pkg_descr </> "src" runHsColour hscolourProg outputDir =<< getLibSourceFiles lbi lib CExe _ -> when (fromFlag (hscolourExecutables flags)) $ doExe comp CTest _ -> when (fromFlag (hscolourTestSuites flags)) $ doExe comp CBench _ -> when (fromFlag (hscolourBenchmarks flags)) $ doExe comp stylesheet = flagToMaybe (hscolourCSS flags) verbosity = fromFlag (hscolourVerbosity flags) distPref = fromFlag (hscolourDistPref flags) runHsColour prog outputDir moduleFiles = do createDirectoryIfMissingVerbose verbosity True outputDir case stylesheet of -- copy the CSS file Nothing | programVersion prog >= Just (Version [1,9] []) -> rawSystemProgram verbosity prog ["-print-css", "-o" ++ outputDir </> "hscolour.css"] | otherwise -> return () Just s -> copyFileVerbose verbosity s (outputDir </> "hscolour.css") forM_ moduleFiles $ \(m, inFile) -> rawSystemProgram verbosity prog ["-css", "-anchor", "-o" ++ outFile m, inFile] where outFile m = outputDir </> intercalate "-" (ModuleName.components m) <.> "html"
2,442
false
true
0
24
838
732
346
386
null
null
ryantm/ghc
libraries/base/Data/Data.hs
bsd-3-clause
eqConstr :: Constr eqConstr = mkConstr orderingDataType "EQ" [] Prefix
78
eqConstr :: Constr eqConstr = mkConstr orderingDataType "EQ" [] Prefix
78
eqConstr = mkConstr orderingDataType "EQ" [] Prefix
59
false
true
0
6
17
28
12
16
null
null
OpenXT/xclibs
xchutils/Tools/Periodic.hs
lgpl-2.1
queue :: Int -> Event -> Context -> Context queue when e (Context es) = Context $ e { waitT = when } : es
109
queue :: Int -> Event -> Context -> Context queue when e (Context es) = Context $ e { waitT = when } : es
109
queue when e (Context es) = Context $ e { waitT = when } : es
65
false
true
2
11
28
62
29
33
null
null
uuhan/Idris-dev
src/Idris/Core/TT.hs
bsd-3-clause
uniqueBinders :: [Name] -> TT Name -> TT Name uniqueBinders ns = ubSet (fromList ns) where ubSet ns (Bind n b sc) = let n' = uniqueNameSet n ns ns' = insert n' ns in Bind n' (fmap (ubSet ns') b) (ubSet ns' sc) ubSet ns (App s f a) = App s (ubSet ns f) (ubSet ns a) ubSet ns t = t
327
uniqueBinders :: [Name] -> TT Name -> TT Name uniqueBinders ns = ubSet (fromList ns) where ubSet ns (Bind n b sc) = let n' = uniqueNameSet n ns ns' = insert n' ns in Bind n' (fmap (ubSet ns') b) (ubSet ns' sc) ubSet ns (App s f a) = App s (ubSet ns f) (ubSet ns a) ubSet ns t = t
327
uniqueBinders ns = ubSet (fromList ns) where ubSet ns (Bind n b sc) = let n' = uniqueNameSet n ns ns' = insert n' ns in Bind n' (fmap (ubSet ns') b) (ubSet ns' sc) ubSet ns (App s f a) = App s (ubSet ns f) (ubSet ns a) ubSet ns t = t
281
false
true
0
13
111
175
83
92
null
null
aelve/guide
back/tests/Selenium.hs
bsd-3-clause
checkNotPresent :: CanSelect a => a -> WD () checkNotPresent x = waitUntil wait_delay $ do es <- selectAll x unless (null es) $ unexpected $ printf "expected %s not to be present on the page" (show x)
208
checkNotPresent :: CanSelect a => a -> WD () checkNotPresent x = waitUntil wait_delay $ do es <- selectAll x unless (null es) $ unexpected $ printf "expected %s not to be present on the page" (show x)
208
checkNotPresent x = waitUntil wait_delay $ do es <- selectAll x unless (null es) $ unexpected $ printf "expected %s not to be present on the page" (show x)
163
false
true
0
13
45
83
36
47
null
null
frenetic-lang/netcore-1.0
src/Frenetic/Sat.hs
bsd-3-clause
forwardsWith (PoUnion p1 p2) p q = ZOr (forwardsWith p1 p q) (forwardsWith p2 p q)
121
forwardsWith (PoUnion p1 p2) p q = ZOr (forwardsWith p1 p q) (forwardsWith p2 p q)
121
forwardsWith (PoUnion p1 p2) p q = ZOr (forwardsWith p1 p q) (forwardsWith p2 p q)
121
false
false
0
7
54
46
22
24
null
null
yogsototh/hascheme
y.hs
mit
isString :: [LispVal] -> LispVal isString ((String _):_) = Bool True
68
isString :: [LispVal] -> LispVal isString ((String _):_) = Bool True
68
isString ((String _):_) = Bool True
35
false
true
0
9
10
37
19
18
null
null
imalsogreg/hackage-matrix-builder
src/WebServer.hs
gpl-3.0
assertFile :: Path Rel File -> String -> IO () assertFile fp contents = do ex <- doesFileExistP fp unless ex $ do putStrLn $ "Writing defaults to " ++ cs fp writeFileP fp contents
191
assertFile :: Path Rel File -> String -> IO () assertFile fp contents = do ex <- doesFileExistP fp unless ex $ do putStrLn $ "Writing defaults to " ++ cs fp writeFileP fp contents
191
assertFile fp contents = do ex <- doesFileExistP fp unless ex $ do putStrLn $ "Writing defaults to " ++ cs fp writeFileP fp contents
144
false
true
0
12
46
81
34
47
null
null
jaor/cats
Cats/FinSet.hs
bsd-3-clause
fsArrowOnto :: (Eq b) => FinSet b -> (b -> b) -> FinSetArrow b fsArrowOnto s@(FS xs) fun = FSA s (zip xs fxs) (fsFromList fxs) where fxs = map fun xs
151
fsArrowOnto :: (Eq b) => FinSet b -> (b -> b) -> FinSetArrow b fsArrowOnto s@(FS xs) fun = FSA s (zip xs fxs) (fsFromList fxs) where fxs = map fun xs
151
fsArrowOnto s@(FS xs) fun = FSA s (zip xs fxs) (fsFromList fxs) where fxs = map fun xs
88
false
true
0
9
33
89
44
45
null
null
grscheller/scheller-linux-archive
grok/Haskell/pythag-triples/drivers/pythagTriples.hs
bsd-3-clause
triplesOrdered1 :: Int -> [Triple] triplesOrdered1 num = take num pythagTriplesOrdered1
87
triplesOrdered1 :: Int -> [Triple] triplesOrdered1 num = take num pythagTriplesOrdered1
87
triplesOrdered1 num = take num pythagTriplesOrdered1
52
false
true
0
6
10
26
13
13
null
null
contivero/hasmin
src/Hasmin/Types/Stylesheet.hs
bsd-3-clause
cleanRule :: [Declaration] -> Reader Config [Declaration] cleanRule ds = do conf <- ask pure $ if shouldCleanRules conf then clean ds else ds
177
cleanRule :: [Declaration] -> Reader Config [Declaration] cleanRule ds = do conf <- ask pure $ if shouldCleanRules conf then clean ds else ds
177
cleanRule ds = do conf <- ask pure $ if shouldCleanRules conf then clean ds else ds
119
false
true
0
9
59
57
28
29
null
null
timbod7/terraform-hs
examples/tf-example.hs
bsd-3-clause
mkPostgres :: NetworkDetails -> AwsDbSubnetGroup -> DBInstanceClass -> TF AwsDbInstance mkPostgres nd subnetGroup instanceClass = do db <- awsDbInstance "db" 5 "postgres" instanceClass "postgres" "password" ( set db_engine_version "9.4.7" . set db_publicly_accessible True . set db_backup_retention_period 3 . set db_db_subnet_group_name (Just (dsg_name subnetGroup)) ) output "dbaddress" (tfRefText (db_address db)) return db
452
mkPostgres :: NetworkDetails -> AwsDbSubnetGroup -> DBInstanceClass -> TF AwsDbInstance mkPostgres nd subnetGroup instanceClass = do db <- awsDbInstance "db" 5 "postgres" instanceClass "postgres" "password" ( set db_engine_version "9.4.7" . set db_publicly_accessible True . set db_backup_retention_period 3 . set db_db_subnet_group_name (Just (dsg_name subnetGroup)) ) output "dbaddress" (tfRefText (db_address db)) return db
452
mkPostgres nd subnetGroup instanceClass = do db <- awsDbInstance "db" 5 "postgres" instanceClass "postgres" "password" ( set db_engine_version "9.4.7" . set db_publicly_accessible True . set db_backup_retention_period 3 . set db_db_subnet_group_name (Just (dsg_name subnetGroup)) ) output "dbaddress" (tfRefText (db_address db)) return db
364
false
true
0
16
76
134
60
74
null
null
rueshyna/gogol
gogol-dfareporting/gen/Network/Google/Resource/DFAReporting/DynamicTargetingKeys/List.hs
mpl-2.0
-- | Select only dynamic targeting keys with this object type. dtklObjectType :: Lens' DynamicTargetingKeysList (Maybe DynamicTargetingKeysListObjectType) dtklObjectType = lens _dtklObjectType (\ s a -> s{_dtklObjectType = a})
234
dtklObjectType :: Lens' DynamicTargetingKeysList (Maybe DynamicTargetingKeysListObjectType) dtklObjectType = lens _dtklObjectType (\ s a -> s{_dtklObjectType = a})
171
dtklObjectType = lens _dtklObjectType (\ s a -> s{_dtklObjectType = a})
79
true
true
0
9
35
48
25
23
null
null
typelead/epm
epm/Distribution/Client/Sandbox/PackageEnvironment.hs
bsd-3-clause
pkgEnvFieldDescrs :: [FieldDescr PackageEnvironment] pkgEnvFieldDescrs = [ simpleField "inherit" (fromFlagOrDefault Disp.empty . fmap Disp.text) (optional parseFilePathQ) pkgEnvInherit (\v pkgEnv -> pkgEnv { pkgEnvInherit = v }) -- FIXME: Should we make these fields part of ~/.cabal/config ? , commaNewLineListField "constraints" Text.disp Text.parse (configExConstraints . savedConfigureExFlags . pkgEnvSavedConfig) (\v pkgEnv -> updateConfigureExFlags pkgEnv (\flags -> flags { configExConstraints = v })) , commaListField "preferences" Text.disp Text.parse (configPreferences . savedConfigureExFlags . pkgEnvSavedConfig) (\v pkgEnv -> updateConfigureExFlags pkgEnv (\flags -> flags { configPreferences = v })) ] ++ map toPkgEnv configFieldDescriptions' where optional = Parse.option mempty . fmap toFlag configFieldDescriptions' :: [FieldDescr SavedConfig] configFieldDescriptions' = filter (\(FieldDescr name _ _) -> name /= "preference" && name /= "constraint") configFieldDescriptions toPkgEnv :: FieldDescr SavedConfig -> FieldDescr PackageEnvironment toPkgEnv fieldDescr = liftField pkgEnvSavedConfig (\savedConfig pkgEnv -> pkgEnv { pkgEnvSavedConfig = savedConfig}) fieldDescr updateConfigureExFlags :: PackageEnvironment -> (ConfigExFlags -> ConfigExFlags) -> PackageEnvironment updateConfigureExFlags pkgEnv f = pkgEnv { pkgEnvSavedConfig = (pkgEnvSavedConfig pkgEnv) { savedConfigureExFlags = f . savedConfigureExFlags . pkgEnvSavedConfig $ pkgEnv } } -- | Read the package environment file.
1,776
pkgEnvFieldDescrs :: [FieldDescr PackageEnvironment] pkgEnvFieldDescrs = [ simpleField "inherit" (fromFlagOrDefault Disp.empty . fmap Disp.text) (optional parseFilePathQ) pkgEnvInherit (\v pkgEnv -> pkgEnv { pkgEnvInherit = v }) -- FIXME: Should we make these fields part of ~/.cabal/config ? , commaNewLineListField "constraints" Text.disp Text.parse (configExConstraints . savedConfigureExFlags . pkgEnvSavedConfig) (\v pkgEnv -> updateConfigureExFlags pkgEnv (\flags -> flags { configExConstraints = v })) , commaListField "preferences" Text.disp Text.parse (configPreferences . savedConfigureExFlags . pkgEnvSavedConfig) (\v pkgEnv -> updateConfigureExFlags pkgEnv (\flags -> flags { configPreferences = v })) ] ++ map toPkgEnv configFieldDescriptions' where optional = Parse.option mempty . fmap toFlag configFieldDescriptions' :: [FieldDescr SavedConfig] configFieldDescriptions' = filter (\(FieldDescr name _ _) -> name /= "preference" && name /= "constraint") configFieldDescriptions toPkgEnv :: FieldDescr SavedConfig -> FieldDescr PackageEnvironment toPkgEnv fieldDescr = liftField pkgEnvSavedConfig (\savedConfig pkgEnv -> pkgEnv { pkgEnvSavedConfig = savedConfig}) fieldDescr updateConfigureExFlags :: PackageEnvironment -> (ConfigExFlags -> ConfigExFlags) -> PackageEnvironment updateConfigureExFlags pkgEnv f = pkgEnv { pkgEnvSavedConfig = (pkgEnvSavedConfig pkgEnv) { savedConfigureExFlags = f . savedConfigureExFlags . pkgEnvSavedConfig $ pkgEnv } } -- | Read the package environment file.
1,776
pkgEnvFieldDescrs = [ simpleField "inherit" (fromFlagOrDefault Disp.empty . fmap Disp.text) (optional parseFilePathQ) pkgEnvInherit (\v pkgEnv -> pkgEnv { pkgEnvInherit = v }) -- FIXME: Should we make these fields part of ~/.cabal/config ? , commaNewLineListField "constraints" Text.disp Text.parse (configExConstraints . savedConfigureExFlags . pkgEnvSavedConfig) (\v pkgEnv -> updateConfigureExFlags pkgEnv (\flags -> flags { configExConstraints = v })) , commaListField "preferences" Text.disp Text.parse (configPreferences . savedConfigureExFlags . pkgEnvSavedConfig) (\v pkgEnv -> updateConfigureExFlags pkgEnv (\flags -> flags { configPreferences = v })) ] ++ map toPkgEnv configFieldDescriptions' where optional = Parse.option mempty . fmap toFlag configFieldDescriptions' :: [FieldDescr SavedConfig] configFieldDescriptions' = filter (\(FieldDescr name _ _) -> name /= "preference" && name /= "constraint") configFieldDescriptions toPkgEnv :: FieldDescr SavedConfig -> FieldDescr PackageEnvironment toPkgEnv fieldDescr = liftField pkgEnvSavedConfig (\savedConfig pkgEnv -> pkgEnv { pkgEnvSavedConfig = savedConfig}) fieldDescr updateConfigureExFlags :: PackageEnvironment -> (ConfigExFlags -> ConfigExFlags) -> PackageEnvironment updateConfigureExFlags pkgEnv f = pkgEnv { pkgEnvSavedConfig = (pkgEnvSavedConfig pkgEnv) { savedConfigureExFlags = f . savedConfigureExFlags . pkgEnvSavedConfig $ pkgEnv } } -- | Read the package environment file.
1,723
false
true
18
13
445
387
204
183
null
null
elieux/ghc
libraries/base/Text/ParserCombinators/ReadPrec.hs
bsd-3-clause
look :: ReadPrec String -- ^ Look-ahead: returns the part of the input that is left, without -- consuming it. look = lift ReadP.look
134
look :: ReadPrec String look = lift ReadP.look
46
look = lift ReadP.look
22
true
true
0
6
25
21
11
10
null
null
nbrunt/JSHOP
src/old/ver1/prototype.hs
mit
remWhitespace :: Code -> Code remWhitespace = cleanup . remove space spaceExceptions
138
remWhitespace :: Code -> Code remWhitespace = cleanup . remove space spaceExceptions
137
remWhitespace = cleanup . remove space spaceExceptions
95
false
true
1
7
65
32
13
19
null
null
rahulmutt/ghcvm
compiler/Eta/Main/GhcMake.hs
bsd-3-clause
noHsFileErr :: DynFlags -> SrcSpan -> String -> ErrMsg noHsFileErr dflags loc path = mkPlainErrMsg dflags loc $ text "Can't find" <+> text path
145
noHsFileErr :: DynFlags -> SrcSpan -> String -> ErrMsg noHsFileErr dflags loc path = mkPlainErrMsg dflags loc $ text "Can't find" <+> text path
145
noHsFileErr dflags loc path = mkPlainErrMsg dflags loc $ text "Can't find" <+> text path
90
false
true
0
7
25
49
23
26
null
null
urbanslug/ghc
compiler/deSugar/DsGRHSs.hs
bsd-3-clause
matchGuards (RecStmt {} : _) _ _ _ = panic "matchGuards RecStmt"
66
matchGuards (RecStmt {} : _) _ _ _ = panic "matchGuards RecStmt"
66
matchGuards (RecStmt {} : _) _ _ _ = panic "matchGuards RecStmt"
66
false
false
1
7
13
27
13
14
null
null
michaelfeathers/vih
editbuffer.hs
mit
deleteLine :: EditBuffer ->EditBuffer deleteLine (EditBuffer topLine location@(_,y) contents) = forceLocation (EditBuffer topLine location newContents) where newContents = unlines [ line | (line, pos) <- numberedLines contents, pos /= y]
240
deleteLine :: EditBuffer ->EditBuffer deleteLine (EditBuffer topLine location@(_,y) contents) = forceLocation (EditBuffer topLine location newContents) where newContents = unlines [ line | (line, pos) <- numberedLines contents, pos /= y]
240
deleteLine (EditBuffer topLine location@(_,y) contents) = forceLocation (EditBuffer topLine location newContents) where newContents = unlines [ line | (line, pos) <- numberedLines contents, pos /= y]
202
false
true
0
9
32
89
46
43
null
null
Fuuzetsu/haddock
haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/Combinator.hs
bsd-2-clause
-- | @many1 p@ applies the action @p@ /one/ or more times. Returns a -- list of the returned values of @p@. -- -- > word = many1 letter many1 :: Alternative f => f a -> f [a] many1 p = liftA2 (:) p (many p)
208
many1 :: Alternative f => f a -> f [a] many1 p = liftA2 (:) p (many p)
70
many1 p = liftA2 (:) p (many p)
31
true
true
0
8
48
53
28
25
null
null
kcsongor/generic-lens
generic-lens/src/Data/Generics/Internal/VL/Prism.hs
bsd-3-clause
build :: Prism s t a b -> b -> t build p = case p (Market Identity Right) of Market bt _ -> coerce bt
104
build :: Prism s t a b -> b -> t build p = case p (Market Identity Right) of Market bt _ -> coerce bt
104
build p = case p (Market Identity Right) of Market bt _ -> coerce bt
71
false
true
0
8
28
65
29
36
null
null
katydid/haslapse
src/Data/Katydid/Relapse/Expr.hs
bsd-3-clause
-- | -- intExpr creates a constant int expression from a input value. intExpr :: Int -> Expr Int intExpr i = Expr { desc = Desc { _name = "int" , _toStr = show i , _hash = i , _params = [] , _hasVar = False } , eval = const $ return i }
271
intExpr :: Int -> Expr Int intExpr i = Expr { desc = Desc { _name = "int" , _toStr = show i , _hash = i , _params = [] , _hasVar = False } , eval = const $ return i }
201
intExpr i = Expr { desc = Desc { _name = "int" , _toStr = show i , _hash = i , _params = [] , _hasVar = False } , eval = const $ return i }
174
true
true
0
10
91
85
48
37
null
null
kdungs/adventofcode2016
04.hs
mit
decrypt :: Room -> DecryptedRoom decrypt r = DecryptedRoom (map decode (name r)) (sector r) where rA = rotatedAlphabet (sector r) decode c = rA M.! c -- Parser.
195
decrypt :: Room -> DecryptedRoom decrypt r = DecryptedRoom (map decode (name r)) (sector r) where rA = rotatedAlphabet (sector r) decode c = rA M.! c -- Parser.
195
decrypt r = DecryptedRoom (map decode (name r)) (sector r) where rA = rotatedAlphabet (sector r) decode c = rA M.! c -- Parser.
162
false
true
4
9
63
89
38
51
null
null
mcschroeder/ghc
compiler/typecheck/TcRnTypes.hs
bsd-3-clause
-- | The following constraints are considered to be a custom type error: -- 1. TypeError msg a b c -- 2. TypeError msg a b c ~ Something (and the other way around) -- 4. C (TypeError msg a b c) (for any parameter of class constraint) getUserTypeErrorMsg :: Ct -> Maybe Type getUserTypeErrorMsg ct | Just (_,t1,t2) <- getEqPredTys_maybe ctT = oneOf [t1,t2] | Just (_,ts) <- getClassPredTys_maybe ctT = oneOf ts | otherwise = userTypeError_maybe ctT where ctT = ctPred ct oneOf xs = msum (map userTypeError_maybe xs)
590
getUserTypeErrorMsg :: Ct -> Maybe Type getUserTypeErrorMsg ct | Just (_,t1,t2) <- getEqPredTys_maybe ctT = oneOf [t1,t2] | Just (_,ts) <- getClassPredTys_maybe ctT = oneOf ts | otherwise = userTypeError_maybe ctT where ctT = ctPred ct oneOf xs = msum (map userTypeError_maybe xs)
339
getUserTypeErrorMsg ct | Just (_,t1,t2) <- getEqPredTys_maybe ctT = oneOf [t1,t2] | Just (_,ts) <- getClassPredTys_maybe ctT = oneOf ts | otherwise = userTypeError_maybe ctT where ctT = ctPred ct oneOf xs = msum (map userTypeError_maybe xs)
299
true
true
1
10
166
129
64
65
null
null
stackbuilders/hapistrano
src/System/Hapistrano/Core.hs
mit
colorizeString :: Color -> String -> String colorizeString color msg = setSGRCode [SetColor Foreground Vivid color] ++ msg ++ setSGRCode [Reset]
146
colorizeString :: Color -> String -> String colorizeString color msg = setSGRCode [SetColor Foreground Vivid color] ++ msg ++ setSGRCode [Reset]
146
colorizeString color msg = setSGRCode [SetColor Foreground Vivid color] ++ msg ++ setSGRCode [Reset]
102
false
true
0
8
22
56
26
30
null
null
rueshyna/gogol
gogol-monitoring/gen/Network/Google/Monitoring/Types/Product.hs
mpl-2.0
-- | Creates a value of 'Group' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'gName' -- -- * 'gDisplayName' -- -- * 'gFilter' -- -- * 'gIsCluster' -- -- * 'gParentName' group' :: Group group' = Group' { _gName = Nothing , _gDisplayName = Nothing , _gFilter = Nothing , _gIsCluster = Nothing , _gParentName = Nothing }
437
group' :: Group group' = Group' { _gName = Nothing , _gDisplayName = Nothing , _gFilter = Nothing , _gIsCluster = Nothing , _gParentName = Nothing }
180
group' = Group' { _gName = Nothing , _gDisplayName = Nothing , _gFilter = Nothing , _gIsCluster = Nothing , _gParentName = Nothing }
160
true
true
0
7
108
66
42
24
null
null
tcsavage/shader-cats
src/ShaderNode.hs
mit
primFn :: Prim (a -> b) -> ShaderGlobals -> a -> b primFn AddP = const (+)
74
primFn :: Prim (a -> b) -> ShaderGlobals -> a -> b primFn AddP = const (+)
74
primFn AddP = const (+)
23
false
true
0
9
16
47
22
25
null
null
input-output-hk/pos-haskell-prototype
core/test/Test/Pos/Core/Bi.hs
mit
roundTripTxFeePolicyBi :: Property roundTripTxFeePolicyBi = eachOf 1000 genTxFeePolicy roundTripsBiBuildable
108
roundTripTxFeePolicyBi :: Property roundTripTxFeePolicyBi = eachOf 1000 genTxFeePolicy roundTripsBiBuildable
108
roundTripTxFeePolicyBi = eachOf 1000 genTxFeePolicy roundTripsBiBuildable
73
false
true
0
5
8
18
9
9
null
null
supki/liblastfm
test/api/Xml/PlaylistSpec.hs
mit
ak' :: Request f APIKey ak' = apiKey "29effec263316a1f8a97f753caaa83e0"
71
ak' :: Request f APIKey ak' = apiKey "29effec263316a1f8a97f753caaa83e0"
71
ak' = apiKey "29effec263316a1f8a97f753caaa83e0"
47
false
true
1
5
8
22
9
13
null
null
robx/puzzle-draw
src/Data/Grid.hs
mit
skeletons :: Eq a => Grid C a -> [Edge C] skeletons = map dualE . edgesGen (==) (const False)
93
skeletons :: Eq a => Grid C a -> [Edge C] skeletons = map dualE . edgesGen (==) (const False)
93
skeletons = map dualE . edgesGen (==) (const False)
51
false
true
0
8
19
53
26
27
null
null
aaronlevin/free-http
src/Network/HTTP/Client/Free.hs
mit
head :: Monad m => RequestType client -> FT (HttpF client) m (ResponseType client) head req = liftF (HttpF HEAD req id)
129
head :: Monad m => RequestType client -> FT (HttpF client) m (ResponseType client) head req = liftF (HttpF HEAD req id)
129
head req = liftF (HttpF HEAD req id)
36
false
true
0
10
31
64
29
35
null
null
dwdyer/anorak
src/haskell/Anorak/Results.hs
gpl-3.0
prepareResults :: [Result] -> Map ByteString Team -> Results prepareResults results aliases = Results results teamResults (Map.map fst homeAndAway) (Map.map snd homeAndAway) matchDays firstHalfByTeam secondHalfByTeam where teamResults = resultsByTeam results aliases matchDays = resultsByDate results (firstHalfResults, secondHalfResults) = splitFirstAndSecondHalf results firstHalfByTeam = resultsByTeam firstHalfResults aliases secondHalfByTeam = resultsByTeam secondHalfResults aliases homeAndAway = splitHomeAndAway teamResults
759
prepareResults :: [Result] -> Map ByteString Team -> Results prepareResults results aliases = Results results teamResults (Map.map fst homeAndAway) (Map.map snd homeAndAway) matchDays firstHalfByTeam secondHalfByTeam where teamResults = resultsByTeam results aliases matchDays = resultsByDate results (firstHalfResults, secondHalfResults) = splitFirstAndSecondHalf results firstHalfByTeam = resultsByTeam firstHalfResults aliases secondHalfByTeam = resultsByTeam secondHalfResults aliases homeAndAway = splitHomeAndAway teamResults
759
prepareResults results aliases = Results results teamResults (Map.map fst homeAndAway) (Map.map snd homeAndAway) matchDays firstHalfByTeam secondHalfByTeam where teamResults = resultsByTeam results aliases matchDays = resultsByDate results (firstHalfResults, secondHalfResults) = splitFirstAndSecondHalf results firstHalfByTeam = resultsByTeam firstHalfResults aliases secondHalfByTeam = resultsByTeam secondHalfResults aliases homeAndAway = splitHomeAndAway teamResults
698
false
true
0
8
281
130
65
65
null
null
nevrenato/Hets_Fork
Maude/Maude2DG.hs
gpl-2.0
{- | qualifies the source sort in the renaming. Sorts only appear in operator mappings with profile and sort mappings -} qualifyRenaming :: Token -> Renaming -> Renaming qualifyRenaming p rnm = case rnm of OpRenaming2 from ar co to -> OpRenaming2 from (map (qualifyType p) ar) (qualifyType p co) to SortRenaming from to -> SortRenaming (qualifySort p from) to _ -> rnm -- | qualifies both the source and target sorts in the renamings
452
qualifyRenaming :: Token -> Renaming -> Renaming qualifyRenaming p rnm = case rnm of OpRenaming2 from ar co to -> OpRenaming2 from (map (qualifyType p) ar) (qualifyType p co) to SortRenaming from to -> SortRenaming (qualifySort p from) to _ -> rnm -- | qualifies both the source and target sorts in the renamings
331
qualifyRenaming p rnm = case rnm of OpRenaming2 from ar co to -> OpRenaming2 from (map (qualifyType p) ar) (qualifyType p co) to SortRenaming from to -> SortRenaming (qualifySort p from) to _ -> rnm -- | qualifies both the source and target sorts in the renamings
282
true
true
0
12
93
112
53
59
null
null
acowley/ghc
testsuite/tests/th/T8028a.hs
bsd-3-clause
x = do n <- newName "F" return [ClosedTypeFamilyD n [] NoSig Nothing []]
79
x = do n <- newName "F" return [ClosedTypeFamilyD n [] NoSig Nothing []]
79
x = do n <- newName "F" return [ClosedTypeFamilyD n [] NoSig Nothing []]
79
false
false
1
11
20
44
18
26
null
null
thoughtpolice/infinity
util/Unlambda.hs
bsd-3-clause
apply I x = return x
27
apply I x = return x
27
apply I x = return x
27
false
false
0
5
12
14
6
8
null
null
sdiehl/ghc
compiler/GHC/Cmm/Ppr.hs
bsd-3-clause
pprConvention Slow = text "<slow-convention>"
62
pprConvention Slow = text "<slow-convention>"
62
pprConvention Slow = text "<slow-convention>"
62
false
false
0
5
21
12
5
7
null
null
edahlgren/protocol-buffers
hprotoc/Text/ProtocolBuffers/ProtoCompile/Resolve.hs
apache-2.0
resolveEnv :: Utf8 -> Env -> Either ErrStr Entity resolveEnv = resolvePredEnv "Any item" (const True)
101
resolveEnv :: Utf8 -> Env -> Either ErrStr Entity resolveEnv = resolvePredEnv "Any item" (const True)
101
resolveEnv = resolvePredEnv "Any item" (const True)
51
false
true
0
7
15
35
17
18
null
null
kmate/raw-feldspar
src/Feldspar/Primitive/Representation.hs
bsd-3-clause
unviewPrimTypeRep (PrimTypeComplex ComplexFloatType) = ComplexFloatT
73
unviewPrimTypeRep (PrimTypeComplex ComplexFloatType) = ComplexFloatT
73
unviewPrimTypeRep (PrimTypeComplex ComplexFloatType) = ComplexFloatT
73
false
false
0
7
9
15
7
8
null
null
elieux/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
gHC_LIST = mkBaseModule (fsLit "GHC.List")
49
gHC_LIST = mkBaseModule (fsLit "GHC.List")
49
gHC_LIST = mkBaseModule (fsLit "GHC.List")
49
false
false
0
7
11
15
7
8
null
null
dgonyeo/hydrazine
src/Hydrazine/Client/UI.hs
mit
showDate :: LocalTime -> String showDate (LocalTime day (TimeOfDay h m s)) = show day ++ " " ++ p h ++ ":" ++ p m ++ ":" ++ p (floor s :: Int) where p = printf "%02d"
198
showDate :: LocalTime -> String showDate (LocalTime day (TimeOfDay h m s)) = show day ++ " " ++ p h ++ ":" ++ p m ++ ":" ++ p (floor s :: Int) where p = printf "%02d"
198
showDate (LocalTime day (TimeOfDay h m s)) = show day ++ " " ++ p h ++ ":" ++ p m ++ ":" ++ p (floor s :: Int) where p = printf "%02d"
166
false
true
0
11
70
92
44
48
null
null
apyrgio/ganeti
src/Ganeti/WConfd/ConfigModifications.hs
bsd-2-clause
-- | Add a new instance to the configuration, release DRBD minors, -- and commit temporary IPs, all while temporarily holding the config -- lock. Return True upon success and False if the config lock was not -- available and the client should retry. -- -- TODO: add verifications to this call; the client should have a lock -- on the name of the instance, and no instance with the given uuid should -- exist. addInstance :: Instance -> ClientId -> WConfdMonad Bool addInstance inst cid = do logDebug $ "AddInstance: client " ++ show (ciIdentifier cid) ++ " adding instance " ++ uuidOf inst ++ " with name " ++ show (instName inst) let addInst = csConfigDataL . configInstancesL . alterContainerL (uuidOf inst) .~ Just inst commitRes tr = mapMOf csConfigDataL $ T.commitReservedIps cid tr r <- modifyConfigWithLock (\tr cs -> commitRes tr $ addInst cs) . T.releaseDRBDMinors $ uuidOf inst logDebug $ "AddInstance: result of config modification is " ++ show r return $ isJust r -- * The list of functions exported to RPC.
1,099
addInstance :: Instance -> ClientId -> WConfdMonad Bool addInstance inst cid = do logDebug $ "AddInstance: client " ++ show (ciIdentifier cid) ++ " adding instance " ++ uuidOf inst ++ " with name " ++ show (instName inst) let addInst = csConfigDataL . configInstancesL . alterContainerL (uuidOf inst) .~ Just inst commitRes tr = mapMOf csConfigDataL $ T.commitReservedIps cid tr r <- modifyConfigWithLock (\tr cs -> commitRes tr $ addInst cs) . T.releaseDRBDMinors $ uuidOf inst logDebug $ "AddInstance: result of config modification is " ++ show r return $ isJust r -- * The list of functions exported to RPC.
690
addInstance inst cid = do logDebug $ "AddInstance: client " ++ show (ciIdentifier cid) ++ " adding instance " ++ uuidOf inst ++ " with name " ++ show (instName inst) let addInst = csConfigDataL . configInstancesL . alterContainerL (uuidOf inst) .~ Just inst commitRes tr = mapMOf csConfigDataL $ T.commitReservedIps cid tr r <- modifyConfigWithLock (\tr cs -> commitRes tr $ addInst cs) . T.releaseDRBDMinors $ uuidOf inst logDebug $ "AddInstance: result of config modification is " ++ show r return $ isJust r -- * The list of functions exported to RPC.
634
true
true
0
15
256
211
100
111
null
null
FranklinChen/doubled-words-haskell
test/DoubledWordsSpec.hs
bsd-3-clause
main :: IO () main = hspec spec
31
main :: IO () main = hspec spec
31
main = hspec spec
17
false
true
0
6
7
19
9
10
null
null
kumasento/accelerate
Data/Array/Accelerate/Analysis/Match.hs
bsd-3-clause
matchPrimFun' (PrimGt s) (PrimGt t) | Just REFL <- matchScalarType s t = Just REFL
86
matchPrimFun' (PrimGt s) (PrimGt t) | Just REFL <- matchScalarType s t = Just REFL
86
matchPrimFun' (PrimGt s) (PrimGt t) | Just REFL <- matchScalarType s t = Just REFL
86
false
false
0
9
18
44
19
25
null
null
eddywestbrook/hobbits
archival/TermTH.hs
bsd-3-clause
-- pretty print terms pretty :: Term a -> String pretty t = pretty' (emptyMb t) emptyMC 0 where pretty' :: Mb ctx (Term a) -> MapCtx StringF ctx -> Int -> String pretty' [nuQQ| Var b |] varnames n = case mbNameBoundP b of Left pf -> unStringF (ctxLookup pf varnames) Right _ -> "free" pretty' [nuQQ| Lam b |] varnames n = let x = "x" ++ show n in "(\\" ++ x ++ "." ++ pretty' (combineMb b) (varnames :> (StringF x)) (n+1) ++ ")" pretty' [nuQQ| App b1 b2 |] varnames n = "(" ++ pretty' b1 varnames n ++ " " ++ pretty' b2 varnames n ++ ")" ---------------------------------------- -- simple operations ---------------------------------------- -- size of a lambda-term
770
pretty :: Term a -> String pretty t = pretty' (emptyMb t) emptyMC 0 where pretty' :: Mb ctx (Term a) -> MapCtx StringF ctx -> Int -> String pretty' [nuQQ| Var b |] varnames n = case mbNameBoundP b of Left pf -> unStringF (ctxLookup pf varnames) Right _ -> "free" pretty' [nuQQ| Lam b |] varnames n = let x = "x" ++ show n in "(\\" ++ x ++ "." ++ pretty' (combineMb b) (varnames :> (StringF x)) (n+1) ++ ")" pretty' [nuQQ| App b1 b2 |] varnames n = "(" ++ pretty' b1 varnames n ++ " " ++ pretty' b2 varnames n ++ ")" ---------------------------------------- -- simple operations ---------------------------------------- -- size of a lambda-term
748
pretty t = pretty' (emptyMb t) emptyMC 0 where pretty' :: Mb ctx (Term a) -> MapCtx StringF ctx -> Int -> String pretty' [nuQQ| Var b |] varnames n = case mbNameBoundP b of Left pf -> unStringF (ctxLookup pf varnames) Right _ -> "free" pretty' [nuQQ| Lam b |] varnames n = let x = "x" ++ show n in "(\\" ++ x ++ "." ++ pretty' (combineMb b) (varnames :> (StringF x)) (n+1) ++ ")" pretty' [nuQQ| App b1 b2 |] varnames n = "(" ++ pretty' b1 varnames n ++ " " ++ pretty' b2 varnames n ++ ")" ---------------------------------------- -- simple operations ---------------------------------------- -- size of a lambda-term
721
true
true
6
19
227
258
132
126
null
null