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
ghc-android/ghc
compiler/ghci/ByteCodeGen.hs
bsd-3-clause
emitBc :: ([BcPtr] -> ProtoBCO Name) -> BcM (ProtoBCO Name) emitBc bco = BcM $ \st -> return (st{malloced=[]}, bco (malloced st))
131
emitBc :: ([BcPtr] -> ProtoBCO Name) -> BcM (ProtoBCO Name) emitBc bco = BcM $ \st -> return (st{malloced=[]}, bco (malloced st))
131
emitBc bco = BcM $ \st -> return (st{malloced=[]}, bco (malloced st))
71
false
true
2
9
23
83
41
42
null
null
DougBurke/swish
src/Swish/RDF/Datatype/XSD/Decimal.hs
lgpl-2.1
lcomp :: (a->a->Bool) -> [a] -> Bool lcomp p = liftL2 p head (head . tail)
74
lcomp :: (a->a->Bool) -> [a] -> Bool lcomp p = liftL2 p head (head . tail)
74
lcomp p = liftL2 p head (head . tail)
37
false
true
0
9
15
55
27
28
null
null
facebookincubator/duckling
Duckling/Numeral/KA/Rules.hs
bsd-3-clause
informalMap :: HashMap Text Integer informalMap = HashMap.fromList [ ( "ერთი" , 1 ) , ( "წყვილი" , 2 ) , ( "წყვილები" , 2 ) , ( "ცოტა" , 3 ) , ( "რამდენიმე" , 3 ) , ( "რამოდენიმე" , 3 ) ]
220
informalMap :: HashMap Text Integer informalMap = HashMap.fromList [ ( "ერთი" , 1 ) , ( "წყვილი" , 2 ) , ( "წყვილები" , 2 ) , ( "ცოტა" , 3 ) , ( "რამდენიმე" , 3 ) , ( "რამოდენიმე" , 3 ) ]
220
informalMap = HashMap.fromList [ ( "ერთი" , 1 ) , ( "წყვილი" , 2 ) , ( "წყვილები" , 2 ) , ( "ცოტა" , 3 ) , ( "რამდენიმე" , 3 ) , ( "რამოდენიმე" , 3 ) ]
184
false
true
0
6
77
75
46
29
null
null
thalerjonathan/phd
public/ArtIterating/code/haskell/PureAgentsPar/src/PureAgentsPar.hs
gpl-3.0
kill :: Agent m s e -> Agent m s e kill a = a { killFlag = True }
65
kill :: Agent m s e -> Agent m s e kill a = a { killFlag = True }
65
kill a = a { killFlag = True }
30
false
true
0
7
19
45
21
24
null
null
MerelyAPseudonym/cmdtheline
src/System/Console/CmdTheLine/ArgVal.hs
mit
quintuple :: ( ArgVal a, ArgVal b, ArgVal c, ArgVal d, ArgVal e ) => Char -> Converter ( a, b, c, d, e ) quintuple sep = ( parser', pp' ) where pp' ( x, y, z, w, v ) = pp x <> char sep <+> pp y <> char sep <+> pp z <> char sep <+> pp w <> char sep <+> pp v parser' str = do [ xStr, yStr, zStr, wStr, vStr ] <- if length strs == 3 then Right strs else Left $ E.sepMiss sep str case ( parser xStr, parser yStr, parser zStr, parser wStr, parser vStr ) of ( Right x, Right y, Right z, Right w, Right v ) -> Right ( x, y, z, w, v ) ( Left e, _ , _ , _ , _ ) -> Left $ E.element "pair" xStr e ( _, Left e, _ , _ , _ ) -> Left $ E.element "pair" yStr e ( _, _ , Left e , _ , _ ) -> Left $ E.element "pair" zStr e ( _, _ , _ , Left e , _ ) -> Left $ E.element "pair" wStr e ( _, _ , _ , _ , Left e ) -> Left $ E.element "pair" vStr e where strs = unfoldr split str split [] = Nothing split str = Just $ splitOn sep str
1,167
quintuple :: ( ArgVal a, ArgVal b, ArgVal c, ArgVal d, ArgVal e ) => Char -> Converter ( a, b, c, d, e ) quintuple sep = ( parser', pp' ) where pp' ( x, y, z, w, v ) = pp x <> char sep <+> pp y <> char sep <+> pp z <> char sep <+> pp w <> char sep <+> pp v parser' str = do [ xStr, yStr, zStr, wStr, vStr ] <- if length strs == 3 then Right strs else Left $ E.sepMiss sep str case ( parser xStr, parser yStr, parser zStr, parser wStr, parser vStr ) of ( Right x, Right y, Right z, Right w, Right v ) -> Right ( x, y, z, w, v ) ( Left e, _ , _ , _ , _ ) -> Left $ E.element "pair" xStr e ( _, Left e, _ , _ , _ ) -> Left $ E.element "pair" yStr e ( _, _ , Left e , _ , _ ) -> Left $ E.element "pair" zStr e ( _, _ , _ , Left e , _ ) -> Left $ E.element "pair" wStr e ( _, _ , _ , _ , Left e ) -> Left $ E.element "pair" vStr e where strs = unfoldr split str split [] = Nothing split str = Just $ splitOn sep str
1,167
quintuple sep = ( parser', pp' ) where pp' ( x, y, z, w, v ) = pp x <> char sep <+> pp y <> char sep <+> pp z <> char sep <+> pp w <> char sep <+> pp v parser' str = do [ xStr, yStr, zStr, wStr, vStr ] <- if length strs == 3 then Right strs else Left $ E.sepMiss sep str case ( parser xStr, parser yStr, parser zStr, parser wStr, parser vStr ) of ( Right x, Right y, Right z, Right w, Right v ) -> Right ( x, y, z, w, v ) ( Left e, _ , _ , _ , _ ) -> Left $ E.element "pair" xStr e ( _, Left e, _ , _ , _ ) -> Left $ E.element "pair" yStr e ( _, _ , Left e , _ , _ ) -> Left $ E.element "pair" zStr e ( _, _ , _ , Left e , _ ) -> Left $ E.element "pair" wStr e ( _, _ , _ , _ , Left e ) -> Left $ E.element "pair" vStr e where strs = unfoldr split str split [] = Nothing split str = Just $ splitOn sep str
1,060
false
true
0
13
492
536
278
258
null
null
capn-freako/Haskell_Misc
HackerRank/convex_hull.hs
bsd-3-clause
main :: IO () main = do num_points <- readLn points <- Control.Monad.replicateM num_points ((list2pair . map read . words) `fmap` getLine) -- print (points :: [Point]) -- print $ qsort' snd points -- let points' = [ps | ps <- subsets points, length ps == 3] let points' = convexHull points print $ points2perim points' -- putStrLn "Points\t\t\tPerimeter\tCurl" -- sequence_ $ for points' $ \p -> do -- printf "%22s %5.1f %.3f\n" (show p) (points2perim p) (curl p)
512
main :: IO () main = do num_points <- readLn points <- Control.Monad.replicateM num_points ((list2pair . map read . words) `fmap` getLine) -- print (points :: [Point]) -- print $ qsort' snd points -- let points' = [ps | ps <- subsets points, length ps == 3] let points' = convexHull points print $ points2perim points' -- putStrLn "Points\t\t\tPerimeter\tCurl" -- sequence_ $ for points' $ \p -> do -- printf "%22s %5.1f %.3f\n" (show p) (points2perim p) (curl p)
512
main = do num_points <- readLn points <- Control.Monad.replicateM num_points ((list2pair . map read . words) `fmap` getLine) -- print (points :: [Point]) -- print $ qsort' snd points -- let points' = [ps | ps <- subsets points, length ps == 3] let points' = convexHull points print $ points2perim points' -- putStrLn "Points\t\t\tPerimeter\tCurl" -- sequence_ $ for points' $ \p -> do -- printf "%22s %5.1f %.3f\n" (show p) (points2perim p) (curl p)
498
false
true
0
15
127
95
47
48
null
null
grnet/snf-ganeti
src/Ganeti/Constants.hs
bsd-2-clause
ssNodegroups :: String ssNodegroups = "nodegroups"
50
ssNodegroups :: String ssNodegroups = "nodegroups"
50
ssNodegroups = "nodegroups"
27
false
true
0
6
5
18
7
11
null
null
green-haskell/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
noSelTyConKey = mkPreludeTyConUnique 154
40
noSelTyConKey = mkPreludeTyConUnique 154
40
noSelTyConKey = mkPreludeTyConUnique 154
40
false
false
0
5
3
9
4
5
null
null
ombocomp/repl-toolkit
System/REPL/Ask.hs
apache-2.0
-- |See 'ask'. Always reads the input from stdin. -- -- @ -- ask' a = ask a Nothing -- @ ask' :: (MonadIO m, MonadCatch m) => Asker m a b -> m b ask' a = ask a Nothing
177
ask' :: (MonadIO m, MonadCatch m) => Asker m a b -> m b ask' a = ask a Nothing
88
ask' a = ask a Nothing
22
true
true
0
8
50
59
29
30
null
null
noteed/hicks
Hicks/CmdLine.hs
bsd-3-clause
runCmd CmdUpload{..} = do ms <- withAPIKey $ \u p -> server u p cmdServerUuid case ms of Nothing -> putStrLn "Cannot find server." Just s -> do case filter ((== "public") . ipAccess) $ server'IpAddresses s of ip : _ -> do upload (T.unpack $ ipAddress ip) "22" (T.unpack $ server'Hostname s) _ -> putStrLn "No public IP address."
372
runCmd CmdUpload{..} = do ms <- withAPIKey $ \u p -> server u p cmdServerUuid case ms of Nothing -> putStrLn "Cannot find server." Just s -> do case filter ((== "public") . ipAccess) $ server'IpAddresses s of ip : _ -> do upload (T.unpack $ ipAddress ip) "22" (T.unpack $ server'Hostname s) _ -> putStrLn "No public IP address."
372
runCmd CmdUpload{..} = do ms <- withAPIKey $ \u p -> server u p cmdServerUuid case ms of Nothing -> putStrLn "Cannot find server." Just s -> do case filter ((== "public") . ipAccess) $ server'IpAddresses s of ip : _ -> do upload (T.unpack $ ipAddress ip) "22" (T.unpack $ server'Hostname s) _ -> putStrLn "No public IP address."
372
false
false
0
20
103
146
69
77
null
null
erikd/fastpack
src/Data/FastPack/Functions.hs
bsd-2-clause
peekByteString :: Ptr Word8 -> Int -> Int -> IO ByteString peekByteString srcptr offset len = BSI.create len $ \ destptr -> BSI.memcpy destptr (plusPtr srcptr offset) len
182
peekByteString :: Ptr Word8 -> Int -> Int -> IO ByteString peekByteString srcptr offset len = BSI.create len $ \ destptr -> BSI.memcpy destptr (plusPtr srcptr offset) len
182
peekByteString srcptr offset len = BSI.create len $ \ destptr -> BSI.memcpy destptr (plusPtr srcptr offset) len
123
false
true
0
9
39
67
32
35
null
null
haslab/SecreC
src/Language/SecreC/IO.hs
gpl-3.0
statusOk :: Status statusOk = mempty
36
statusOk :: Status statusOk = mempty
36
statusOk = mempty
17
false
true
0
4
5
11
6
5
null
null
atsukotakahashi/wi
example-configs/yi-vim-colemak.hs
gpl-2.0
myModes :: [AnyMode] myModes = [ AnyMode Haskell.fastMode { -- Disable beautification modePrettify = const $ return () } ]
170
myModes :: [AnyMode] myModes = [ AnyMode Haskell.fastMode { -- Disable beautification modePrettify = const $ return () } ]
170
myModes = [ AnyMode Haskell.fastMode { -- Disable beautification modePrettify = const $ return () } ]
149
false
true
0
12
67
47
23
24
null
null
LightAndLight/pl0-haskell
src/PL0/CodeGen/StackMachine.hs
bsd-3-clause
genStatement SError = throwError "called genStatement on SError"
64
genStatement SError = throwError "called genStatement on SError"
64
genStatement SError = throwError "called genStatement on SError"
64
false
false
0
5
7
13
5
8
null
null
Noeda/dfterm3
main/RealMain.hs
isc
options :: [OptDescr StartupOption] options = [ Option "w" ["websocket"] (ReqArg (Websocket . read) "PORT") "listen for WebSocket connections on this port." , Option "s" ["storage"] (ReqArg StorageLocation "DIRECTORY") "specify which directory to use to store runtime data." , Option "h?" ["help"] (NoArg ShowHelp) "show valid command line options and exit." , Option "p" ["no-default-ports"] (NoArg DontUseDefaultPorts) "do not implicitly open services at some ports (see below)." #ifndef WINDOWS , Option "d" ["daemon", "daemonize"] (OptArg Daemonize "PIDFILE") "run as a daemon (background process)." , Option [] ["syslog"] (NoArg UseSyslog) "use syslog for logging." #endif , Option [] ["admin-password"] (NoArg SetAdminPassword) "ask for the administrator password and exit." , Option [] ["admin-panel"] (ReqArg (AdminPanel . read) "PORT") "serve administrator panel as a web interface on this port." , Option [] ["websocket-http"] (ReqArg (WebsocketHTTP . read) "PORT") ("serve websocket playing interface as a web interface " ++ "on this port.") ]
1,363
options :: [OptDescr StartupOption] options = [ Option "w" ["websocket"] (ReqArg (Websocket . read) "PORT") "listen for WebSocket connections on this port." , Option "s" ["storage"] (ReqArg StorageLocation "DIRECTORY") "specify which directory to use to store runtime data." , Option "h?" ["help"] (NoArg ShowHelp) "show valid command line options and exit." , Option "p" ["no-default-ports"] (NoArg DontUseDefaultPorts) "do not implicitly open services at some ports (see below)." #ifndef WINDOWS , Option "d" ["daemon", "daemonize"] (OptArg Daemonize "PIDFILE") "run as a daemon (background process)." , Option [] ["syslog"] (NoArg UseSyslog) "use syslog for logging." #endif , Option [] ["admin-password"] (NoArg SetAdminPassword) "ask for the administrator password and exit." , Option [] ["admin-panel"] (ReqArg (AdminPanel . read) "PORT") "serve administrator panel as a web interface on this port." , Option [] ["websocket-http"] (ReqArg (WebsocketHTTP . read) "PORT") ("serve websocket playing interface as a web interface " ++ "on this port.") ]
1,363
options = [ Option "w" ["websocket"] (ReqArg (Websocket . read) "PORT") "listen for WebSocket connections on this port." , Option "s" ["storage"] (ReqArg StorageLocation "DIRECTORY") "specify which directory to use to store runtime data." , Option "h?" ["help"] (NoArg ShowHelp) "show valid command line options and exit." , Option "p" ["no-default-ports"] (NoArg DontUseDefaultPorts) "do not implicitly open services at some ports (see below)." #ifndef WINDOWS , Option "d" ["daemon", "daemonize"] (OptArg Daemonize "PIDFILE") "run as a daemon (background process)." , Option [] ["syslog"] (NoArg UseSyslog) "use syslog for logging." #endif , Option [] ["admin-password"] (NoArg SetAdminPassword) "ask for the administrator password and exit." , Option [] ["admin-panel"] (ReqArg (AdminPanel . read) "PORT") "serve administrator panel as a web interface on this port." , Option [] ["websocket-http"] (ReqArg (WebsocketHTTP . read) "PORT") ("serve websocket playing interface as a web interface " ++ "on this port.") ]
1,327
false
true
0
11
457
264
138
126
null
null
vladimir-ipatov/ganeti
test/hs/Test/Ganeti/TestHelper.hs
gpl-2.0
mkConsArbitrary :: (Name, [a]) -> Exp mkConsArbitrary (name, types) = let infix_arb a = InfixE (Just a) (VarE '(<*>)) (Just (VarE 'arbitrary)) constr = AppE (VarE 'pure) (ConE name) in foldl (\a _ -> infix_arb a) constr types
235
mkConsArbitrary :: (Name, [a]) -> Exp mkConsArbitrary (name, types) = let infix_arb a = InfixE (Just a) (VarE '(<*>)) (Just (VarE 'arbitrary)) constr = AppE (VarE 'pure) (ConE name) in foldl (\a _ -> infix_arb a) constr types
235
mkConsArbitrary (name, types) = let infix_arb a = InfixE (Just a) (VarE '(<*>)) (Just (VarE 'arbitrary)) constr = AppE (VarE 'pure) (ConE name) in foldl (\a _ -> infix_arb a) constr types
197
false
true
0
13
47
130
67
63
null
null
kawu/data-named
src/Data/Named/IOB.hs
bsd-2-clause
-- top :: IOB w a -> Atom a -- top = fromJust . topMaybe raw :: Atom a -> a raw (B x) = x
90
raw :: Atom a -> a raw (B x) = x
32
raw (B x) = x
13
true
true
0
9
26
35
16
19
null
null
imalsogreg/hComedi
examples/tut1.hs
gpl-3.0
subDev = SubDevice 0
20
subDev = SubDevice 0
20
subDev = SubDevice 0
20
false
false
0
5
3
9
4
5
null
null
crclark/functional-pearls
src/Weave/Section2.hs
bsd-3-clause
right t@(At _ (PlusCtx2 _ _)) = t
33
right t@(At _ (PlusCtx2 _ _)) = t
33
right t@(At _ (PlusCtx2 _ _)) = t
33
false
false
0
10
7
28
14
14
null
null
mbackenkoehler/ssa-hs
src/SSA/Expr.hs
mit
------------------------------------------------------------------------------ simplify :: Expr -> Expr simplify (BinOp t e1 e2) = tryEval $ BinOp t (tryEval e1) (tryEval e2) where tryEval e = fromMaybe e (Atomic . Const <$> eval e)
238
simplify :: Expr -> Expr simplify (BinOp t e1 e2) = tryEval $ BinOp t (tryEval e1) (tryEval e2) where tryEval e = fromMaybe e (Atomic . Const <$> eval e)
159
simplify (BinOp t e1 e2) = tryEval $ BinOp t (tryEval e1) (tryEval e2) where tryEval e = fromMaybe e (Atomic . Const <$> eval e)
134
true
true
0
8
37
82
40
42
null
null
beni55/ghcjs
test/ghc/integer/integerConstantFolding.hs
mit
orInteger :: Integer orInteger = 100054 .|. 140055
50
orInteger :: Integer orInteger = 100054 .|. 140055
50
orInteger = 100054 .|. 140055
29
false
true
0
5
7
15
8
7
null
null
acowley/ghc
compiler/basicTypes/DataCon.hs
bsd-3-clause
dataConBoxer _ = Nothing
24
dataConBoxer _ = Nothing
24
dataConBoxer _ = Nothing
24
false
false
0
4
3
10
4
6
null
null
HIPERFIT/futhark
src/Language/Futhark/TypeChecker/Modules.hs
isc
mtyTypeAbbrs :: MTy -> M.Map VName TypeBinding mtyTypeAbbrs (MTy _ mod) = modTypeAbbrs mod
90
mtyTypeAbbrs :: MTy -> M.Map VName TypeBinding mtyTypeAbbrs (MTy _ mod) = modTypeAbbrs mod
90
mtyTypeAbbrs (MTy _ mod) = modTypeAbbrs mod
43
false
true
0
7
13
36
17
19
null
null
edgarklerks/dotfiles
.xmonad/TopicMachine.hs
bsd-2-clause
addLabel lbl (SBlock ln) ms = ms {symbolTable = S.insert lbl (Symbol lbl BlockSymbol (Right ln)) (symbolTable ms)}
114
addLabel lbl (SBlock ln) ms = ms {symbolTable = S.insert lbl (Symbol lbl BlockSymbol (Right ln)) (symbolTable ms)}
114
addLabel lbl (SBlock ln) ms = ms {symbolTable = S.insert lbl (Symbol lbl BlockSymbol (Right ln)) (symbolTable ms)}
114
false
false
1
12
17
67
30
37
null
null
CindyLinz/Haskell.js
trans/src/Desugar/PatBind.hs
mit
dePatBindImportDecl :: ImportDecl l -> ImportDecl l dePatBindImportDecl (ImportDecl importAnn importModule importQualified importSrc importSafe importPkg importAs importSpecs) = ImportDecl (id importAnn) (dePatBindModuleName importModule) (id importQualified) (id importSrc) (id importSafe) (fmap (id) importPkg) (fmap (dePatBindModuleName) importAs) (fmap (dePatBindImportSpecList) importSpecs)
395
dePatBindImportDecl :: ImportDecl l -> ImportDecl l dePatBindImportDecl (ImportDecl importAnn importModule importQualified importSrc importSafe importPkg importAs importSpecs) = ImportDecl (id importAnn) (dePatBindModuleName importModule) (id importQualified) (id importSrc) (id importSafe) (fmap (id) importPkg) (fmap (dePatBindModuleName) importAs) (fmap (dePatBindImportSpecList) importSpecs)
395
dePatBindImportDecl (ImportDecl importAnn importModule importQualified importSrc importSafe importPkg importAs importSpecs) = ImportDecl (id importAnn) (dePatBindModuleName importModule) (id importQualified) (id importSrc) (id importSafe) (fmap (id) importPkg) (fmap (dePatBindModuleName) importAs) (fmap (dePatBindImportSpecList) importSpecs)
343
false
true
0
8
37
124
62
62
null
null
badp/ganeti
src/Ganeti/Constants.hs
gpl-2.0
-- | Time for an intra-cluster disk transfer to wait for a connection diskTransferConnectTimeout :: Int diskTransferConnectTimeout = 60
135
diskTransferConnectTimeout :: Int diskTransferConnectTimeout = 60
65
diskTransferConnectTimeout = 60
31
true
true
0
4
18
12
7
5
null
null
derekelkins/servant-server
test/Servant/ServerSpec.hs
bsd-3-clause
queryParamApi :: Proxy QueryParamApi queryParamApi = Proxy
58
queryParamApi :: Proxy QueryParamApi queryParamApi = Proxy
58
queryParamApi = Proxy
21
false
true
0
5
6
14
7
7
null
null
mikegehard/haskellBookExercises
chapter12/MaybeLib.hs
mit
isJust (Just _) = True
22
isJust (Just _) = True
22
isJust (Just _) = True
22
false
false
0
6
4
16
7
9
null
null
KHs000/haskellToys
src/scripts/H-99.hs
mit
rotate'' x 0 = x
17
rotate'' x 0 = x
17
rotate'' x 0 = x
17
false
false
1
5
5
16
5
11
null
null
gergoerdi/chip8-papilio
src/Utils.hs
gpl-2.0
setIdx :: (Clock clk, Rep a, Rep n, Size n) => Matrix n (Reg s clk a) -> Signal clk n -> Signal clk a -> RTL s clk () setIdx regs idx val = CASE [ IF (idx .==. pureS i) $ r := val | (i, r) <- Matrix.assocs regs ]
273
setIdx :: (Clock clk, Rep a, Rep n, Size n) => Matrix n (Reg s clk a) -> Signal clk n -> Signal clk a -> RTL s clk () setIdx regs idx val = CASE [ IF (idx .==. pureS i) $ r := val | (i, r) <- Matrix.assocs regs ]
273
setIdx regs idx val = CASE [ IF (idx .==. pureS i) $ r := val | (i, r) <- Matrix.assocs regs ]
148
false
true
0
12
113
142
68
74
null
null
christiaanb/ghc
compiler/typecheck/TcType.hs
bsd-3-clause
tcTyVarsOfType (ForAllTy tyvar ty) = tcTyVarsOfType ty `delVarSet` tyvar
73
tcTyVarsOfType (ForAllTy tyvar ty) = tcTyVarsOfType ty `delVarSet` tyvar
73
tcTyVarsOfType (ForAllTy tyvar ty) = tcTyVarsOfType ty `delVarSet` tyvar
73
false
false
0
6
9
27
13
14
null
null
fpco/hlint
src/Hint/Comment.hs
bsd-3-clause
ommentHint _ = []
18
commentHint _ = []
18
commentHint _ = []
18
false
false
0
5
4
11
5
6
null
null
Shou/Tombot
Tombot/Funcs.hs
gpl-2.0
nilistToken :: TMVar (Maybe (Int, Text)) anilistToken = unsafePerformIO $ newTMVarIO Nothing
93
anilistToken :: TMVar (Maybe (Int, Text)) anilistToken = unsafePerformIO $ newTMVarIO Nothing
93
anilistToken = unsafePerformIO $ newTMVarIO Nothing
51
false
true
0
8
12
33
17
16
null
null
clample/lamdabtc
backend/src/Protocol/MessageBodies.hs
bsd-3-clause
getVersionMessage :: Get VersionMessage getVersionMessage = do version' <- fromIntegral <$> getWord32le services' <- getWord64be timestamp' <- fromIntegral <$> getWord64le peer' <- getAddr sender' <- getAddr nonce' <- Nonce64 <$> getWord64be userAgent' <- getPayload startHeight' <- get relay' <- toBool <$> getWord8 return (VersionMessage version' nonce' startHeight' sender' peer' relay' timestamp') ------------------------------------
498
getVersionMessage :: Get VersionMessage getVersionMessage = do version' <- fromIntegral <$> getWord32le services' <- getWord64be timestamp' <- fromIntegral <$> getWord64le peer' <- getAddr sender' <- getAddr nonce' <- Nonce64 <$> getWord64be userAgent' <- getPayload startHeight' <- get relay' <- toBool <$> getWord8 return (VersionMessage version' nonce' startHeight' sender' peer' relay' timestamp') ------------------------------------
498
getVersionMessage = do version' <- fromIntegral <$> getWord32le services' <- getWord64be timestamp' <- fromIntegral <$> getWord64le peer' <- getAddr sender' <- getAddr nonce' <- Nonce64 <$> getWord64be userAgent' <- getPayload startHeight' <- get relay' <- toBool <$> getWord8 return (VersionMessage version' nonce' startHeight' sender' peer' relay' timestamp') ------------------------------------
458
false
true
0
9
111
118
54
64
null
null
hvr/lens
src/Control/Lens/Fold.hs
bsd-3-clause
-- | Retrieve a function of the first index and value targeted by an 'IndexedFold' or -- 'IndexedTraversal' (or 'Just' the result from an 'IndexedGetter' or 'IndexedLens'). -- See also ('^@?'). -- -- @ -- 'ipreviews' = 'views' '.' 'ipre' -- @ -- -- This is usually applied in the 'Control.Monad.Reader.Reader' -- 'Control.Monad.Monad' @(->) s@. -- -- @ -- 'ipreviews' :: 'IndexedGetter' i s a -> (i -> a -> r) -> s -> 'Maybe' r -- 'ipreviews' :: 'IndexedFold' i s a -> (i -> a -> r) -> s -> 'Maybe' r -- 'ipreviews' :: 'IndexedLens'' i s a -> (i -> a -> r) -> s -> 'Maybe' r -- 'ipreviews' :: 'IndexedTraversal'' i s a -> (i -> a -> r) -> s -> 'Maybe' r -- @ -- -- However, it may be useful to think of its full generality when working with -- a 'Control.Monad.Monad' transformer stack: -- -- @ -- 'ipreviews' :: 'MonadReader' s m => 'IndexedGetter' i s a -> (i -> a -> r) -> m ('Maybe' r) -- 'ipreviews' :: 'MonadReader' s m => 'IndexedFold' i s a -> (i -> a -> r) -> m ('Maybe' r) -- 'ipreviews' :: 'MonadReader' s m => 'IndexedLens'' i s a -> (i -> a -> r) -> m ('Maybe' r) -- 'ipreviews' :: 'MonadReader' s m => 'IndexedTraversal'' i s a -> (i -> a -> r) -> m ('Maybe' r) -- @ ipreviews :: MonadReader s m => IndexedGetting i (First r) s a -> (i -> a -> r) -> m (Maybe r) ipreviews l f = asks (getFirst . ifoldMapOf l (\i -> First #. Just . f i))
1,380
ipreviews :: MonadReader s m => IndexedGetting i (First r) s a -> (i -> a -> r) -> m (Maybe r) ipreviews l f = asks (getFirst . ifoldMapOf l (\i -> First #. Just . f i))
169
ipreviews l f = asks (getFirst . ifoldMapOf l (\i -> First #. Just . f i))
74
true
true
0
12
310
129
77
52
null
null
sdiehl/ghc
testsuite/tests/codeGen/should_run/cgrun079.hs
bsd-3-clause
addWordC :: Word -> Word -> (Word,Word) addWordC (W# x) (W# y) = case addWordC# x y of (# l,c #) -> (W# (int2Word# c), W# l)
127
addWordC :: Word -> Word -> (Word,Word) addWordC (W# x) (W# y) = case addWordC# x y of (# l,c #) -> (W# (int2Word# c), W# l)
127
addWordC (W# x) (W# y) = case addWordC# x y of (# l,c #) -> (W# (int2Word# c), W# l)
87
false
true
0
12
29
86
42
44
null
null
scolobb/fgl
test/Data/Graph/Inductive/Graph/Properties.hs
bsd-3-clause
gfiltermap_id :: (DynGraph gr, Eq a, Eq b) => gr a b -> Bool gfiltermap_id g = equal (gfiltermap Just g) g
106
gfiltermap_id :: (DynGraph gr, Eq a, Eq b) => gr a b -> Bool gfiltermap_id g = equal (gfiltermap Just g) g
106
gfiltermap_id g = equal (gfiltermap Just g) g
45
false
true
0
7
21
60
29
31
null
null
sdteffen/epanet-haskell
Epanet.hs
gpl-3.0
-- Control types. en_HILEVEL :: Int en_HILEVEL = 1
50
en_HILEVEL :: Int en_HILEVEL = 1
32
en_HILEVEL = 1
14
true
true
0
4
8
12
7
5
null
null
jacekszymanski/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxID_STOP :: Int wxID_STOP = 5124
33
wxID_STOP :: Int wxID_STOP = 5124
33
wxID_STOP = 5124
16
false
true
0
4
5
11
6
5
null
null
robinp/haskell-toys
src/Toys/MonadPar/Main.hs
bsd-3-clause
-- | Alternatives for shooting up stuff in parallel parFoldMap :: (Num a, NFData a) => (a -> Par a) -> [a] -> Par a parFoldMap f xs = join $ (fmap sum . sequence) `fmap` mapM (defer . f) xs
189
parFoldMap :: (Num a, NFData a) => (a -> Par a) -> [a] -> Par a parFoldMap f xs = join $ (fmap sum . sequence) `fmap` mapM (defer . f) xs
137
parFoldMap f xs = join $ (fmap sum . sequence) `fmap` mapM (defer . f) xs
73
true
true
0
9
40
88
46
42
null
null
Philonous/pontarius-xmpp
source/Network/Xmpp/Lens.hs
bsd-3-clause
liftTraversal f inj (PresenceS s) = PresenceS <$> f inj s
67
liftTraversal f inj (PresenceS s) = PresenceS <$> f inj s
67
liftTraversal f inj (PresenceS s) = PresenceS <$> f inj s
67
false
false
0
7
20
28
13
15
null
null
geekrelief/as3tohaxe
ActionhaXe/Data.hs
gpl-3.0
traverseS (p:ps) t dt = if p == (sid $ rootLabel t) then t{ subForest = traverseS' ps (subForest t) dt } else t
112
traverseS (p:ps) t dt = if p == (sid $ rootLabel t) then t{ subForest = traverseS' ps (subForest t) dt } else t
112
traverseS (p:ps) t dt = if p == (sid $ rootLabel t) then t{ subForest = traverseS' ps (subForest t) dt } else t
112
false
false
1
11
24
66
33
33
null
null
bitemyapp/ghc
compiler/basicTypes/PatSyn.hs
bsd-3-clause
patSynArgs :: PatSyn -> [Type] patSynArgs = psArgs
50
patSynArgs :: PatSyn -> [Type] patSynArgs = psArgs
50
patSynArgs = psArgs
19
false
true
0
6
7
18
10
8
null
null
dmp1ce/Haskell-Programming-Exercises
Chapter 24/src/ChapterExercises_5.hs
unlicense
skipComments :: Parser () skipComments = skipMany $ char '-' >> char '-' >> skipMany (noneOf "\n") >> skipEOL
111
skipComments :: Parser () skipComments = skipMany $ char '-' >> char '-' >> skipMany (noneOf "\n") >> skipEOL
111
skipComments = skipMany $ char '-' >> char '-' >> skipMany (noneOf "\n") >> skipEOL
85
false
true
0
9
20
47
22
25
null
null
bitemyapp/ganeti
src/Ganeti/WConfd/ConfigWriter.hs
bsd-2-clause
distMCsAsyncTask :: RuntimeEnts -> FilePath -- ^ Path to the config file -> IO ConfigState -- ^ An action to read the current config -> ResultG (AsyncWorker () ()) distMCsAsyncTask ents cpath cdRef = lift . mkStatelessAsyncTask ERROR "Can't distribute the configuration\ \ to master candidates" $ \_ -> do cd <- liftBase (csConfigData <$> cdRef) :: ResultG ConfigData logDebug $ "Distributing the configuration to master candidates,\ \ serial no " ++ show (serialOf cd) fupload <- prepareRpcCallUploadFile ents cpath execRpcCallAndLog (getMasterCandidates cd) fupload logDebug "Successfully finished distributing the configuration" -- | Construct an asynchronous worker whose action is to construct SSConf -- and distribute it to master candidates. -- The worker's action reads the configuration using the given @IO@ action, -- computes the current SSConf, compares it to the previous version, and -- if different, distributes it.
1,098
distMCsAsyncTask :: RuntimeEnts -> FilePath -- ^ Path to the config file -> IO ConfigState -- ^ An action to read the current config -> ResultG (AsyncWorker () ()) distMCsAsyncTask ents cpath cdRef = lift . mkStatelessAsyncTask ERROR "Can't distribute the configuration\ \ to master candidates" $ \_ -> do cd <- liftBase (csConfigData <$> cdRef) :: ResultG ConfigData logDebug $ "Distributing the configuration to master candidates,\ \ serial no " ++ show (serialOf cd) fupload <- prepareRpcCallUploadFile ents cpath execRpcCallAndLog (getMasterCandidates cd) fupload logDebug "Successfully finished distributing the configuration" -- | Construct an asynchronous worker whose action is to construct SSConf -- and distribute it to master candidates. -- The worker's action reads the configuration using the given @IO@ action, -- computes the current SSConf, compares it to the previous version, and -- if different, distributes it.
1,098
distMCsAsyncTask ents cpath cdRef = lift . mkStatelessAsyncTask ERROR "Can't distribute the configuration\ \ to master candidates" $ \_ -> do cd <- liftBase (csConfigData <$> cdRef) :: ResultG ConfigData logDebug $ "Distributing the configuration to master candidates,\ \ serial no " ++ show (serialOf cd) fupload <- prepareRpcCallUploadFile ents cpath execRpcCallAndLog (getMasterCandidates cd) fupload logDebug "Successfully finished distributing the configuration" -- | Construct an asynchronous worker whose action is to construct SSConf -- and distribute it to master candidates. -- The worker's action reads the configuration using the given @IO@ action, -- computes the current SSConf, compares it to the previous version, and -- if different, distributes it.
883
false
true
0
12
305
148
72
76
null
null
urbanslug/ghc
compiler/utils/Outputable.hs
bsd-3-clause
ppUnless True _ = empty
26
ppUnless True _ = empty
26
ppUnless True _ = empty
26
false
false
0
4
7
13
5
8
null
null
batterseapower/supercompilation-by-evaluation
Supercompile/Drive.hs
bsd-3-clause
taggedTermTagBag :: TaggedTerm -> TagBag taggedTermTagBag = taggedTagBag 2 . unTaggedTerm
89
taggedTermTagBag :: TaggedTerm -> TagBag taggedTermTagBag = taggedTagBag 2 . unTaggedTerm
89
taggedTermTagBag = taggedTagBag 2 . unTaggedTerm
48
false
true
0
6
10
22
11
11
null
null
TachoMex/Haskrypto
src/Haskrypto/EllipticCurve.hs
mit
add :: (Integral t) => EllipticCurve t -> Point t -> Point t -> Point t add _ Infinity a = a
94
add :: (Integral t) => EllipticCurve t -> Point t -> Point t -> Point t add _ Infinity a = a
92
add _ Infinity a = a
20
false
true
0
9
23
55
25
30
null
null
shlevy/ghc
compiler/utils/Outputable.hs
bsd-3-clause
alwaysQualifyModules :: QueryQualifyModule alwaysQualifyModules _ = True
72
alwaysQualifyModules :: QueryQualifyModule alwaysQualifyModules _ = True
72
alwaysQualifyModules _ = True
29
false
true
0
5
6
14
7
7
null
null
kellino/TypeSystems
fullError/TypeCheck.hs
mit
typeof TmError = return TyBot
29
typeof TmError = return TyBot
29
typeof TmError = return TyBot
29
false
false
0
5
4
13
5
8
null
null
arekfu/project_euler
p0096/p0096.hs
mit
checkCol :: (Int, Int) -> Sudoku -> Bool checkCol p s = True
60
checkCol :: (Int, Int) -> Sudoku -> Bool checkCol p s = True
60
checkCol p s = True
19
false
true
0
8
12
36
17
19
null
null
neongreen/megaparsec
tests/Prim.hs
bsd-2-clause
prop_IdentityT_try :: String -> String -> String -> Property prop_IdentityT_try pre s1' s2' = checkParser (runIdentityT p) r s where s1 = pre ++ s1' s2 = pre ++ s2' p = try (string s1) <|> string s2 r | s == s1 || s == s2 = Right s | otherwise = posErr 0 s $ bool [uneStr pre] [uneEof] (null s) ++ [uneStr pre, exStr s1, exStr s2] s = pre
406
prop_IdentityT_try :: String -> String -> String -> Property prop_IdentityT_try pre s1' s2' = checkParser (runIdentityT p) r s where s1 = pre ++ s1' s2 = pre ++ s2' p = try (string s1) <|> string s2 r | s == s1 || s == s2 = Right s | otherwise = posErr 0 s $ bool [uneStr pre] [uneEof] (null s) ++ [uneStr pre, exStr s1, exStr s2] s = pre
406
prop_IdentityT_try pre s1' s2' = checkParser (runIdentityT p) r s where s1 = pre ++ s1' s2 = pre ++ s2' p = try (string s1) <|> string s2 r | s == s1 || s == s2 = Right s | otherwise = posErr 0 s $ bool [uneStr pre] [uneEof] (null s) ++ [uneStr pre, exStr s1, exStr s2] s = pre
345
false
true
6
13
140
183
87
96
null
null
lamdu/lamdu
src/Lamdu/Eval/JS/Compiler.hs
gpl-3.0
compileRecExtend :: Monad m => RowExtend T.Tag V.Term V.Term # Annotated ValId -> M m CodeGen compileRecExtend x = do Flatten.Composite tags mRest <- Flatten.recExtend x & Lens.traverse (compileVal NotTailCall) extends <- tags ^@.. Lens.itraversed <&> _2 %~ codeGenExpression & (traverse . _1) (fmap JS.propId . tagIdent) <&> JS.object case mRest of Nothing -> codeGenFromExpr extends Just rest -> codeGenFromLamStmts [ varinit "x" ((JS.var "Object" $. "assign") `JS.call` [extends, codeGenExpression rest]) , JS.expr (JS.delete (JS.var "x" $. "cacheId")) , JS.returns (JS.var "x") ] & pure
814
compileRecExtend :: Monad m => RowExtend T.Tag V.Term V.Term # Annotated ValId -> M m CodeGen compileRecExtend x = do Flatten.Composite tags mRest <- Flatten.recExtend x & Lens.traverse (compileVal NotTailCall) extends <- tags ^@.. Lens.itraversed <&> _2 %~ codeGenExpression & (traverse . _1) (fmap JS.propId . tagIdent) <&> JS.object case mRest of Nothing -> codeGenFromExpr extends Just rest -> codeGenFromLamStmts [ varinit "x" ((JS.var "Object" $. "assign") `JS.call` [extends, codeGenExpression rest]) , JS.expr (JS.delete (JS.var "x" $. "cacheId")) , JS.returns (JS.var "x") ] & pure
814
compileRecExtend x = do Flatten.Composite tags mRest <- Flatten.recExtend x & Lens.traverse (compileVal NotTailCall) extends <- tags ^@.. Lens.itraversed <&> _2 %~ codeGenExpression & (traverse . _1) (fmap JS.propId . tagIdent) <&> JS.object case mRest of Nothing -> codeGenFromExpr extends Just rest -> codeGenFromLamStmts [ varinit "x" ((JS.var "Object" $. "assign") `JS.call` [extends, codeGenExpression rest]) , JS.expr (JS.delete (JS.var "x" $. "cacheId")) , JS.returns (JS.var "x") ] & pure
720
false
true
0
19
308
253
122
131
null
null
chpatrick/hmidi
examples/SMF.hs
bsd-3-clause
oadSMF :: FilePath -> IO ((Int,TimeBase),[Track]) loadSMF fpath = do h <- openBinaryFile fpath ReadMode mid <- hGetContents h y <- case runParser smf 0 fpath mid of Left err -> fail $ show err Right xx -> return xx hClose h -- hGetContents is lazy, so we should close the file before doing the parsing... return y -- | Timestamps in the resulting list of `MidiEvent'`-s are in the SMF units, so most -- probably you have to convert them, using `timestampUnitInMilisecs`.
519
loadSMF :: FilePath -> IO ((Int,TimeBase),[Track]) loadSMF fpath = do h <- openBinaryFile fpath ReadMode mid <- hGetContents h y <- case runParser smf 0 fpath mid of Left err -> fail $ show err Right xx -> return xx hClose h -- hGetContents is lazy, so we should close the file before doing the parsing... return y -- | Timestamps in the resulting list of `MidiEvent'`-s are in the SMF units, so most -- probably you have to convert them, using `timestampUnitInMilisecs`.
516
loadSMF fpath = do h <- openBinaryFile fpath ReadMode mid <- hGetContents h y <- case runParser smf 0 fpath mid of Left err -> fail $ show err Right xx -> return xx hClose h -- hGetContents is lazy, so we should close the file before doing the parsing... return y -- | Timestamps in the resulting list of `MidiEvent'`-s are in the SMF units, so most -- probably you have to convert them, using `timestampUnitInMilisecs`.
465
false
true
0
12
131
125
58
67
null
null
nikivazou/hscolour
Language/Haskell/HsColour/ACSS.hs
gpl-2.0
hsannot :: Bool -- ^ Whether to include anchors. -> (String, AnnMap) -- ^ Haskell Source, Annotations -> String -- ^ Coloured Haskell source code. hsannot anchor = CSS.pre . (if anchor then -- renderNewLinesAnchors . concatMap (renderAnchors renderAnnotToken) . insertAnnotAnchors else concatMap renderAnnotToken) . annotTokenise
445
hsannot :: Bool -- ^ Whether to include anchors. -> (String, AnnMap) -- ^ Haskell Source, Annotations -> String hsannot anchor = CSS.pre . (if anchor then -- renderNewLinesAnchors . concatMap (renderAnchors renderAnnotToken) . insertAnnotAnchors else concatMap renderAnnotToken) . annotTokenise
399
hsannot anchor = CSS.pre . (if anchor then -- renderNewLinesAnchors . concatMap (renderAnchors renderAnnotToken) . insertAnnotAnchors else concatMap renderAnnotToken) . annotTokenise
256
true
true
2
10
161
77
39
38
null
null
facebookincubator/duckling
Duckling/Time/EL/Rules.hs
bsd-3-clause
ruleThisPartofday :: Rule ruleThisPartofday = Rule { name = "this <part-of-day>" , pattern = [ regex "αυτ([οό]ύ?|ή[νς]?) τ(ον?|η[νς]?)" , Predicate isAPartOfDay ] , prod = \tokens -> case tokens of (_:Token Time td:_) -> Token Time . partOfDay <$> intersect today td _ -> Nothing }
313
ruleThisPartofday :: Rule ruleThisPartofday = Rule { name = "this <part-of-day>" , pattern = [ regex "αυτ([οό]ύ?|ή[νς]?) τ(ον?|η[νς]?)" , Predicate isAPartOfDay ] , prod = \tokens -> case tokens of (_:Token Time td:_) -> Token Time . partOfDay <$> intersect today td _ -> Nothing }
313
ruleThisPartofday = Rule { name = "this <part-of-day>" , pattern = [ regex "αυτ([οό]ύ?|ή[νς]?) τ(ον?|η[νς]?)" , Predicate isAPartOfDay ] , prod = \tokens -> case tokens of (_:Token Time td:_) -> Token Time . partOfDay <$> intersect today td _ -> Nothing }
287
false
true
0
15
77
100
52
48
null
null
cies/gelatin
gelatin-picture/src/Gelatin/PicturePrimitives.hs
bsd-3-clause
-- Now do all the rest of the work for paths. compileCurrentWith (Free (Rectangle sz _)) (Just (StrokeColoring s)) _ t = [(t, Stroked s $ PathPrims $ sizeToPaths $ Size sz)]
198
compileCurrentWith (Free (Rectangle sz _)) (Just (StrokeColoring s)) _ t = [(t, Stroked s $ PathPrims $ sizeToPaths $ Size sz)]
152
compileCurrentWith (Free (Rectangle sz _)) (Just (StrokeColoring s)) _ t = [(t, Stroked s $ PathPrims $ sizeToPaths $ Size sz)]
152
true
false
0
10
56
69
35
34
null
null
ghc-android/ghc
libraries/base/System/Posix/Internals.hs
bsd-3-clause
s_isfifo :: CMode -> Bool s_isfifo cm = c_s_isfifo cm /= 0
58
s_isfifo :: CMode -> Bool s_isfifo cm = c_s_isfifo cm /= 0
58
s_isfifo cm = c_s_isfifo cm /= 0
32
false
true
0
7
11
31
13
18
null
null
wujf/yesod
yesod-bin/Devel.hs
mit
-- | Run a reverse proxy from port 3000 to 3001. If there is no response on -- 3001, give an appropriate message to the user. reverseProxy :: DevelOpts -> I.IORef Int -> IO () reverseProxy opts iappPort = do manager <- newManager conduitManagerSettings let refreshHtml = LB.fromChunks $ return $(embedFile "refreshing.html") let onExc _ req | maybe False (("application/json" `elem`) . parseHttpAccept) (lookup "accept" $ requestHeaders req) = return $ responseLBS status503 [ ("Retry-After", "1") ] "{\"message\":\"Recompiling\"}" | otherwise = return $ responseLBS status200 [ ("content-type", "text/html") , ("Refresh", "1") ] refreshHtml let runProxy = run (develPort opts) $ waiProxyToSettings (const $ do appPort <- liftIO $ I.readIORef iappPort return $ ReverseProxy.WPRProxyDest $ ProxyDest "127.0.0.1" appPort) def { wpsOnExc = \e req f -> onExc e req >>= f , wpsTimeout = if proxyTimeout opts == 0 then Nothing else Just (1000000 * proxyTimeout opts) } manager loop runProxy `Ex.onException` exitFailure where loop proxy = forever $ do void proxy putStrLn "Reverse proxy stopped, but it shouldn't" threadDelay 1000000 putStrLn "Restarting reverse proxy"
1,706
reverseProxy :: DevelOpts -> I.IORef Int -> IO () reverseProxy opts iappPort = do manager <- newManager conduitManagerSettings let refreshHtml = LB.fromChunks $ return $(embedFile "refreshing.html") let onExc _ req | maybe False (("application/json" `elem`) . parseHttpAccept) (lookup "accept" $ requestHeaders req) = return $ responseLBS status503 [ ("Retry-After", "1") ] "{\"message\":\"Recompiling\"}" | otherwise = return $ responseLBS status200 [ ("content-type", "text/html") , ("Refresh", "1") ] refreshHtml let runProxy = run (develPort opts) $ waiProxyToSettings (const $ do appPort <- liftIO $ I.readIORef iappPort return $ ReverseProxy.WPRProxyDest $ ProxyDest "127.0.0.1" appPort) def { wpsOnExc = \e req f -> onExc e req >>= f , wpsTimeout = if proxyTimeout opts == 0 then Nothing else Just (1000000 * proxyTimeout opts) } manager loop runProxy `Ex.onException` exitFailure where loop proxy = forever $ do void proxy putStrLn "Reverse proxy stopped, but it shouldn't" threadDelay 1000000 putStrLn "Restarting reverse proxy"
1,580
reverseProxy opts iappPort = do manager <- newManager conduitManagerSettings let refreshHtml = LB.fromChunks $ return $(embedFile "refreshing.html") let onExc _ req | maybe False (("application/json" `elem`) . parseHttpAccept) (lookup "accept" $ requestHeaders req) = return $ responseLBS status503 [ ("Retry-After", "1") ] "{\"message\":\"Recompiling\"}" | otherwise = return $ responseLBS status200 [ ("content-type", "text/html") , ("Refresh", "1") ] refreshHtml let runProxy = run (develPort opts) $ waiProxyToSettings (const $ do appPort <- liftIO $ I.readIORef iappPort return $ ReverseProxy.WPRProxyDest $ ProxyDest "127.0.0.1" appPort) def { wpsOnExc = \e req f -> onExc e req >>= f , wpsTimeout = if proxyTimeout opts == 0 then Nothing else Just (1000000 * proxyTimeout opts) } manager loop runProxy `Ex.onException` exitFailure where loop proxy = forever $ do void proxy putStrLn "Reverse proxy stopped, but it shouldn't" threadDelay 1000000 putStrLn "Restarting reverse proxy"
1,530
true
true
1
19
716
360
176
184
null
null
green-haskell/ghc
compiler/hsSyn/HsExpr.hs
bsd-3-clause
ppr_cmd (HsCmdLam matches) = pprMatches (LambdaExpr :: HsMatchContext id) matches
83
ppr_cmd (HsCmdLam matches) = pprMatches (LambdaExpr :: HsMatchContext id) matches
83
ppr_cmd (HsCmdLam matches) = pprMatches (LambdaExpr :: HsMatchContext id) matches
83
false
false
0
7
11
31
14
17
null
null
d0kt0r0/Tidal
src/Sound/Tidal/Core.hs
gpl-3.0
in99 :: Pattern Double in99 = cF 0 "99"
39
in99 :: Pattern Double in99 = cF 0 "99"
39
in99 = cF 0 "99"
16
false
true
1
5
8
24
9
15
null
null
jlamothe/match
Match/JSON.hs
gpl-3.0
stringFromObj :: String -> JSON.JSObject JSON.JSValue -> JSON.Result String stringFromObj key obj = do val <- valFromObj key obj case val of JSON.JSString str -> JSON.Ok $ JSON.fromJSString str _ -> JSON.Error $ "could not find string at at key " ++ key
271
stringFromObj :: String -> JSON.JSObject JSON.JSValue -> JSON.Result String stringFromObj key obj = do val <- valFromObj key obj case val of JSON.JSString str -> JSON.Ok $ JSON.fromJSString str _ -> JSON.Error $ "could not find string at at key " ++ key
271
stringFromObj key obj = do val <- valFromObj key obj case val of JSON.JSString str -> JSON.Ok $ JSON.fromJSString str _ -> JSON.Error $ "could not find string at at key " ++ key
195
false
true
0
12
60
93
43
50
null
null
rueshyna/gogol
gogol-youtube/gen/Network/Google/YouTube/Types/Product.hs
mpl-2.0
-- | The visitorId identifies the visitor. tsrVisitorId :: Lens' ThumbnailSetResponse (Maybe Text) tsrVisitorId = lens _tsrVisitorId (\ s a -> s{_tsrVisitorId = a})
166
tsrVisitorId :: Lens' ThumbnailSetResponse (Maybe Text) tsrVisitorId = lens _tsrVisitorId (\ s a -> s{_tsrVisitorId = a})
123
tsrVisitorId = lens _tsrVisitorId (\ s a -> s{_tsrVisitorId = a})
67
true
true
0
9
25
48
25
23
null
null
bobgru/wreath
src/Wreath.hs
bsd-3-clause
wreathLamps' :: WreathLampOptions -> Diagram B wreathLamps' wlo = position (zip (wreathLampPoints wlo) lamps) # centerXY where lamps = map f (cycle cs) f = wreathLampGetLamps wlo cs = wreathLampColors wlo
235
wreathLamps' :: WreathLampOptions -> Diagram B wreathLamps' wlo = position (zip (wreathLampPoints wlo) lamps) # centerXY where lamps = map f (cycle cs) f = wreathLampGetLamps wlo cs = wreathLampColors wlo
235
wreathLamps' wlo = position (zip (wreathLampPoints wlo) lamps) # centerXY where lamps = map f (cycle cs) f = wreathLampGetLamps wlo cs = wreathLampColors wlo
188
false
true
2
10
61
77
37
40
null
null
thielema/gitit
Network/Gitit/Config.hs
gpl-2.0
-- | Get configuration from config file. getConfigFromFile :: FilePath -> IO Config getConfigFromFile fname = do cp <- getDefaultConfigParser readfile cp fname >>= extractConfig . forceEither -- | A version of readfile that treats the file as UTF-8.
254
getConfigFromFile :: FilePath -> IO Config getConfigFromFile fname = do cp <- getDefaultConfigParser readfile cp fname >>= extractConfig . forceEither -- | A version of readfile that treats the file as UTF-8.
213
getConfigFromFile fname = do cp <- getDefaultConfigParser readfile cp fname >>= extractConfig . forceEither -- | A version of readfile that treats the file as UTF-8.
170
true
true
0
9
43
46
22
24
null
null
yuga/jsonschema-gen
src/Data/JSON/Schema/Generator/Convert.hs
bsd-3-clause
jsType (needsNull -> f) (f -> True) SCObject {scNullable = True } = [("type", array ["object", "null" :: Text])]
113
jsType (needsNull -> f) (f -> True) SCObject {scNullable = True } = [("type", array ["object", "null" :: Text])]
113
jsType (needsNull -> f) (f -> True) SCObject {scNullable = True } = [("type", array ["object", "null" :: Text])]
113
false
false
0
8
19
57
32
25
null
null
ombocomp/repl-toolkit
System/REPL/Command.hs
apache-2.0
getName :: T.Text -> Maybe T.Text getName = readArgs >=> L.head
63
getName :: T.Text -> Maybe T.Text getName = readArgs >=> L.head
63
getName = readArgs >=> L.head
29
false
true
2
8
10
36
16
20
null
null
ulricha/dsh
src/Database/DSH/Tests/CombinatorTests.hs
bsd-3-clause
prop_map_break :: (BackendVector b, VectorLang v) => (Integer, [[Integer]]) -> DSHProperty (v TExpr TExpr) b prop_map_break = makePropEq (\z -> Q.map (Q.break ((Q.fst z) Q.==)) (Q.snd z)) (\z -> map (break (fst z ==)) (snd z))
252
prop_map_break :: (BackendVector b, VectorLang v) => (Integer, [[Integer]]) -> DSHProperty (v TExpr TExpr) b prop_map_break = makePropEq (\z -> Q.map (Q.break ((Q.fst z) Q.==)) (Q.snd z)) (\z -> map (break (fst z ==)) (snd z))
252
prop_map_break = makePropEq (\z -> Q.map (Q.break ((Q.fst z) Q.==)) (Q.snd z)) (\z -> map (break (fst z ==)) (snd z))
143
false
true
0
14
61
142
74
68
null
null
d12frosted/optparse-applicative-kb
Options/Applicative/Common.hs
bsd-3-clause
parseError :: MonadP m => String -> m a parseError arg = errorP . ErrorMsg $ msg where msg = case arg of ('-':_) -> "Invalid option `" ++ arg ++ "'" _ -> "Invalid argument `" ++ arg ++ "'"
212
parseError :: MonadP m => String -> m a parseError arg = errorP . ErrorMsg $ msg where msg = case arg of ('-':_) -> "Invalid option `" ++ arg ++ "'" _ -> "Invalid argument `" ++ arg ++ "'"
212
parseError arg = errorP . ErrorMsg $ msg where msg = case arg of ('-':_) -> "Invalid option `" ++ arg ++ "'" _ -> "Invalid argument `" ++ arg ++ "'"
172
false
true
0
9
64
83
41
42
null
null
MasseR/Shopping-list
Handlers/Ajax.hs
bsd-3-clause
append Nothing = return False
29
append Nothing = return False
29
append Nothing = return False
29
false
false
0
5
4
13
5
8
null
null
jstolarek/ghc
compiler/nativeGen/X86/CodeGen.hs
bsd-3-clause
cmmTopCodeGen (CmmData sec dat) = do return [CmmData sec (1, dat)] -- no translation, we just use CmmStatic
110
cmmTopCodeGen (CmmData sec dat) = do return [CmmData sec (1, dat)] -- no translation, we just use CmmStatic
110
cmmTopCodeGen (CmmData sec dat) = do return [CmmData sec (1, dat)] -- no translation, we just use CmmStatic
110
false
false
0
10
20
38
19
19
null
null
ikuehne/craeft-hs
lib/Craeft/Utility.hs
gpl-3.0
renderError (TypeError msg p) = renderHelper "type error" msg p
63
renderError (TypeError msg p) = renderHelper "type error" msg p
63
renderError (TypeError msg p) = renderHelper "type error" msg p
63
false
false
0
7
9
24
11
13
null
null
joshuaunderwood7/HaskeLinGeom
GrammarOfReducedSearches.hs
gpl-3.0
init_i = 0
16
init_i = 0
16
init_i = 0
16
false
false
0
4
8
6
3
3
null
null
mparusinski/Haskell-number-theory-library
ContinuedFractions.hs
gpl-3.0
approxContinuedFraction :: (Integral a) => Ratio a -> Ratio a -> ContinuedFraction a approxContinuedFraction ratio1 ratio2 = ContinuedFraction $ reverse $ approxContinuedFractionMain ratio1 ratio2
200
approxContinuedFraction :: (Integral a) => Ratio a -> Ratio a -> ContinuedFraction a approxContinuedFraction ratio1 ratio2 = ContinuedFraction $ reverse $ approxContinuedFractionMain ratio1 ratio2
200
approxContinuedFraction ratio1 ratio2 = ContinuedFraction $ reverse $ approxContinuedFractionMain ratio1 ratio2
115
false
true
0
8
27
55
26
29
null
null
ohua-dev/ohua-core
core/src/Ohua/ALang/Passes.hs
epl-1.0
reduceLetA :: Expression -> Expression reduceLetA = \case Let assign (Let assign2 val expr3) expr -> Let assign2 val $ reduceLetA $ Let assign expr3 expr e -> e
192
reduceLetA :: Expression -> Expression reduceLetA = \case Let assign (Let assign2 val expr3) expr -> Let assign2 val $ reduceLetA $ Let assign expr3 expr e -> e
192
reduceLetA = \case Let assign (Let assign2 val expr3) expr -> Let assign2 val $ reduceLetA $ Let assign expr3 expr e -> e
153
false
true
0
10
60
66
32
34
null
null
polygonhell/textEditor
src/TextBuffer.hs
bsd-3-clause
startSelection :: Buffer -> Buffer startSelection b@Buffer{..} = b{selection = [Region cpos cpos [RS "selected"]], initialSelectionOffset = cpos} where Cursor{..} = cursor cpos = posToOffset b line col
205
startSelection :: Buffer -> Buffer startSelection b@Buffer{..} = b{selection = [Region cpos cpos [RS "selected"]], initialSelectionOffset = cpos} where Cursor{..} = cursor cpos = posToOffset b line col
205
startSelection b@Buffer{..} = b{selection = [Region cpos cpos [RS "selected"]], initialSelectionOffset = cpos} where Cursor{..} = cursor cpos = posToOffset b line col
170
false
true
0
10
31
83
44
39
null
null
kmels/hledger
hledger-lib/Hledger/Data/Dates.hs
gpl-3.0
-- | Show a DateSpan as a human-readable pseudo-period-expression string. -- dateSpanAsText :: DateSpan -> String -- dateSpanAsText (DateSpan Nothing Nothing) = "all" -- dateSpanAsText (DateSpan Nothing (Just e)) = printf "to %s" (show e) -- dateSpanAsText (DateSpan (Just b) Nothing) = printf "from %s" (show b) -- dateSpanAsText (DateSpan (Just b) (Just e)) = printf "%s to %s" (show b) (show e) -- | Convert a single smart date string to a date span using the provided -- reference date, or raise an error. -- spanFromSmartDateString :: Day -> String -> DateSpan -- spanFromSmartDateString refdate s = spanFromSmartDate refdate sdate -- where -- sdate = fromparse $ parsewith smartdateonly s spanFromSmartDate :: Day -> SmartDate -> DateSpan spanFromSmartDate refdate sdate = DateSpan (Just b) (Just e) where (ry,rm,_) = toGregorian refdate (b,e) = span sdate span :: SmartDate -> (Day,Day) span ("","","today") = (refdate, nextday refdate) span ("","this","day") = (refdate, nextday refdate) span ("","","yesterday") = (prevday refdate, refdate) span ("","last","day") = (prevday refdate, refdate) span ("","","tomorrow") = (nextday refdate, addDays 2 refdate) span ("","next","day") = (nextday refdate, addDays 2 refdate) span ("","last","week") = (prevweek refdate, thisweek refdate) span ("","this","week") = (thisweek refdate, nextweek refdate) span ("","next","week") = (nextweek refdate, startofweek $ addDays 14 refdate) span ("","last","month") = (prevmonth refdate, thismonth refdate) span ("","this","month") = (thismonth refdate, nextmonth refdate) span ("","next","month") = (nextmonth refdate, startofmonth $ addGregorianMonthsClip 2 refdate) span ("","last","quarter") = (prevquarter refdate, thisquarter refdate) span ("","this","quarter") = (thisquarter refdate, nextquarter refdate) span ("","next","quarter") = (nextquarter refdate, startofquarter $ addGregorianMonthsClip 6 refdate) span ("","last","year") = (prevyear refdate, thisyear refdate) span ("","this","year") = (thisyear refdate, nextyear refdate) span ("","next","year") = (nextyear refdate, startofyear $ addGregorianYearsClip 2 refdate) span ("","",d) = (day, nextday day) where day = fromGregorian ry rm (read d) span ("",m,"") = (startofmonth day, nextmonth day) where day = fromGregorian ry (read m) 1 span ("",m,d) = (day, nextday day) where day = fromGregorian ry (read m) (read d) span (y,"","") = (startofyear day, nextyear day) where day = fromGregorian (read y) 1 1 span (y,m,"") = (startofmonth day, nextmonth day) where day = fromGregorian (read y) (read m) 1 span (y,m,d) = (day, nextday day) where day = fromGregorian (read y) (read m) (read d) -- showDay :: Day -> String -- showDay day = printf "%04d/%02d/%02d" y m d where (y,m,d) = toGregorian day -- | Convert a smart date string to an explicit yyyy\/mm\/dd string using -- the provided reference date, or raise an error.
3,183
spanFromSmartDate :: Day -> SmartDate -> DateSpan spanFromSmartDate refdate sdate = DateSpan (Just b) (Just e) where (ry,rm,_) = toGregorian refdate (b,e) = span sdate span :: SmartDate -> (Day,Day) span ("","","today") = (refdate, nextday refdate) span ("","this","day") = (refdate, nextday refdate) span ("","","yesterday") = (prevday refdate, refdate) span ("","last","day") = (prevday refdate, refdate) span ("","","tomorrow") = (nextday refdate, addDays 2 refdate) span ("","next","day") = (nextday refdate, addDays 2 refdate) span ("","last","week") = (prevweek refdate, thisweek refdate) span ("","this","week") = (thisweek refdate, nextweek refdate) span ("","next","week") = (nextweek refdate, startofweek $ addDays 14 refdate) span ("","last","month") = (prevmonth refdate, thismonth refdate) span ("","this","month") = (thismonth refdate, nextmonth refdate) span ("","next","month") = (nextmonth refdate, startofmonth $ addGregorianMonthsClip 2 refdate) span ("","last","quarter") = (prevquarter refdate, thisquarter refdate) span ("","this","quarter") = (thisquarter refdate, nextquarter refdate) span ("","next","quarter") = (nextquarter refdate, startofquarter $ addGregorianMonthsClip 6 refdate) span ("","last","year") = (prevyear refdate, thisyear refdate) span ("","this","year") = (thisyear refdate, nextyear refdate) span ("","next","year") = (nextyear refdate, startofyear $ addGregorianYearsClip 2 refdate) span ("","",d) = (day, nextday day) where day = fromGregorian ry rm (read d) span ("",m,"") = (startofmonth day, nextmonth day) where day = fromGregorian ry (read m) 1 span ("",m,d) = (day, nextday day) where day = fromGregorian ry (read m) (read d) span (y,"","") = (startofyear day, nextyear day) where day = fromGregorian (read y) 1 1 span (y,m,"") = (startofmonth day, nextmonth day) where day = fromGregorian (read y) (read m) 1 span (y,m,d) = (day, nextday day) where day = fromGregorian (read y) (read m) (read d) -- showDay :: Day -> String -- showDay day = printf "%04d/%02d/%02d" y m d where (y,m,d) = toGregorian day -- | Convert a smart date string to an explicit yyyy\/mm\/dd string using -- the provided reference date, or raise an error.
2,472
spanFromSmartDate refdate sdate = DateSpan (Just b) (Just e) where (ry,rm,_) = toGregorian refdate (b,e) = span sdate span :: SmartDate -> (Day,Day) span ("","","today") = (refdate, nextday refdate) span ("","this","day") = (refdate, nextday refdate) span ("","","yesterday") = (prevday refdate, refdate) span ("","last","day") = (prevday refdate, refdate) span ("","","tomorrow") = (nextday refdate, addDays 2 refdate) span ("","next","day") = (nextday refdate, addDays 2 refdate) span ("","last","week") = (prevweek refdate, thisweek refdate) span ("","this","week") = (thisweek refdate, nextweek refdate) span ("","next","week") = (nextweek refdate, startofweek $ addDays 14 refdate) span ("","last","month") = (prevmonth refdate, thismonth refdate) span ("","this","month") = (thismonth refdate, nextmonth refdate) span ("","next","month") = (nextmonth refdate, startofmonth $ addGregorianMonthsClip 2 refdate) span ("","last","quarter") = (prevquarter refdate, thisquarter refdate) span ("","this","quarter") = (thisquarter refdate, nextquarter refdate) span ("","next","quarter") = (nextquarter refdate, startofquarter $ addGregorianMonthsClip 6 refdate) span ("","last","year") = (prevyear refdate, thisyear refdate) span ("","this","year") = (thisyear refdate, nextyear refdate) span ("","next","year") = (nextyear refdate, startofyear $ addGregorianYearsClip 2 refdate) span ("","",d) = (day, nextday day) where day = fromGregorian ry rm (read d) span ("",m,"") = (startofmonth day, nextmonth day) where day = fromGregorian ry (read m) 1 span ("",m,d) = (day, nextday day) where day = fromGregorian ry (read m) (read d) span (y,"","") = (startofyear day, nextyear day) where day = fromGregorian (read y) 1 1 span (y,m,"") = (startofmonth day, nextmonth day) where day = fromGregorian (read y) (read m) 1 span (y,m,d) = (day, nextday day) where day = fromGregorian (read y) (read m) (read d) -- showDay :: Day -> String -- showDay day = printf "%04d/%02d/%02d" y m d where (y,m,d) = toGregorian day -- | Convert a smart date string to an explicit yyyy\/mm\/dd string using -- the provided reference date, or raise an error.
2,422
true
true
0
9
716
986
529
457
null
null
shlevy/ghc
compiler/basicTypes/NameEnv.hs
bsd-3-clause
elemNameEnv x y = elemUFM x y
38
elemNameEnv x y = elemUFM x y
38
elemNameEnv x y = elemUFM x y
38
false
false
0
5
15
16
7
9
null
null
romanb/amazonka
amazonka-opsworks/gen/Network/AWS/OpsWorks/Types.hs
mpl-2.0
-- | 'LifecycleEventConfiguration' constructor. -- -- The fields accessible through corresponding lenses are: -- -- * 'lecShutdown' @::@ 'Maybe' 'ShutdownEventConfiguration' -- lifecycleEventConfiguration :: LifecycleEventConfiguration lifecycleEventConfiguration = LifecycleEventConfiguration { _lecShutdown = Nothing }
328
lifecycleEventConfiguration :: LifecycleEventConfiguration lifecycleEventConfiguration = LifecycleEventConfiguration { _lecShutdown = Nothing }
151
lifecycleEventConfiguration = LifecycleEventConfiguration { _lecShutdown = Nothing }
92
true
true
0
6
39
25
17
8
null
null
spire/spire
src/Spire/Surface/Parser.hs
bsd-3-clause
parseDef = do l <- parseIdent parseOp ":" tp <- parseSyntax parseToken l parseOp "=" tm <- parseSyntax return $ SDef (s2n l) tm tp ----------------------------------------------------------------------
216
parseDef = do l <- parseIdent parseOp ":" tp <- parseSyntax parseToken l parseOp "=" tm <- parseSyntax return $ SDef (s2n l) tm tp ----------------------------------------------------------------------
216
parseDef = do l <- parseIdent parseOp ":" tp <- parseSyntax parseToken l parseOp "=" tm <- parseSyntax return $ SDef (s2n l) tm tp ----------------------------------------------------------------------
216
false
false
0
10
40
66
28
38
null
null
marcelosousa/poet
src/Exploration/POR/ODPOR.hs
gpl-2.0
exploreNext :: State ExploreState () exploreNext = do s@ExploreState{..} <- get forM_ (L.slookup eseq wuts) exploreNextBody -- Lines 16-22
146
exploreNext :: State ExploreState () exploreNext = do s@ExploreState{..} <- get forM_ (L.slookup eseq wuts) exploreNextBody -- Lines 16-22
146
exploreNext = do s@ExploreState{..} <- get forM_ (L.slookup eseq wuts) exploreNextBody -- Lines 16-22
109
false
true
0
10
26
53
26
27
null
null
thoughtpolice/binary-serialise-cbor
Data/Binary/Serialise/CBOR/Decoding.hs
bsd-3-clause
decodeNegWord64 :: Decoder Word64 decodeNegWord64 = #ifdef ARCH_64bit Decoder (\k -> ConsumeNegWord (\w# -> k (W64# w#)))
123
decodeNegWord64 :: Decoder Word64 decodeNegWord64 = #ifdef ARCH_64bit Decoder (\k -> ConsumeNegWord (\w# -> k (W64# w#)))
123
decodeNegWord64 = #ifdef ARCH_64bit Decoder (\k -> ConsumeNegWord (\w# -> k (W64# w#)))
89
false
true
0
12
18
46
24
22
null
null
thielema/optparse-applicative
Options/Applicative/Builder.hs
bsd-3-clause
idm :: Monoid m => m idm = mempty
33
idm :: Monoid m => m idm = mempty
33
idm = mempty
12
false
true
0
7
8
25
10
15
null
null
bergmark/mmdoc
src/Warn.hs
bsd-3-clause
checkStmts :: AST -> [Warning] checkStmts (Function _ _ _ _ _ _ stmts) = concatMap aux stmts where aux :: Stmt -> [Warning] aux (StmtExp e) = return $ W.StmtExp e aux _ = []
187
checkStmts :: AST -> [Warning] checkStmts (Function _ _ _ _ _ _ stmts) = concatMap aux stmts where aux :: Stmt -> [Warning] aux (StmtExp e) = return $ W.StmtExp e aux _ = []
187
checkStmts (Function _ _ _ _ _ _ stmts) = concatMap aux stmts where aux :: Stmt -> [Warning] aux (StmtExp e) = return $ W.StmtExp e aux _ = []
156
false
true
0
9
49
104
48
56
null
null
Teaspot-Studio/Urho3D-Haskell
src/Graphics/Urho3D/Scene/LogicComponent.hs
mit
logicComponentSetUpdateEventMask :: (Parent LogicComponent a, Pointer p a, MonadIO m) => p -- ^ Pointer to logic component -> UpdateEventFlags -- ^ Flags of events that are enabled -> m () logicComponentSetUpdateEventMask p es = liftIO $ do let ptr = parentPointer p w = fromIntegral $ unFlagSet es [C.exp| void { $(LogicComponent* ptr)->SetUpdateEventMask((UpdateEventFlags)$(unsigned int w)) } |] -- | Return what update events are subscribed to.
465
logicComponentSetUpdateEventMask :: (Parent LogicComponent a, Pointer p a, MonadIO m) => p -- ^ Pointer to logic component -> UpdateEventFlags -- ^ Flags of events that are enabled -> m () logicComponentSetUpdateEventMask p es = liftIO $ do let ptr = parentPointer p w = fromIntegral $ unFlagSet es [C.exp| void { $(LogicComponent* ptr)->SetUpdateEventMask((UpdateEventFlags)$(unsigned int w)) } |] -- | Return what update events are subscribed to.
465
logicComponentSetUpdateEventMask p es = liftIO $ do let ptr = parentPointer p w = fromIntegral $ unFlagSet es [C.exp| void { $(LogicComponent* ptr)->SetUpdateEventMask((UpdateEventFlags)$(unsigned int w)) } |] -- | Return what update events are subscribed to.
270
false
true
0
12
83
95
49
46
null
null
hvr/vector
Data/Vector/Unboxed.hs
bsd-3-clause
minIndex = G.minIndex
21
minIndex = G.minIndex
21
minIndex = G.minIndex
21
false
false
0
5
2
8
4
4
null
null
fmap-archive/https-everywhere-rules-raw
src/Data/HTTPSEverywhere/Rules/Raw.hs
gpl-2.0
getRule :: FilePath -> IO Text getRule = readFile
49
getRule :: FilePath -> IO Text getRule = readFile
49
getRule = readFile
18
false
true
0
6
8
18
9
9
null
null
bos/wreq
tests/UnitTests.hs
bsd-3-clause
invalidURL Verb{..} _site = do let noProto (InvalidUrlException _ _) = return () assertThrows "exception if no protocol" noProto (get "wheeee") let noHost (HttpExceptionRequest _ (InvalidDestinationHost _)) = return () assertThrows "exception if no host" noHost (get "http://")
285
invalidURL Verb{..} _site = do let noProto (InvalidUrlException _ _) = return () assertThrows "exception if no protocol" noProto (get "wheeee") let noHost (HttpExceptionRequest _ (InvalidDestinationHost _)) = return () assertThrows "exception if no host" noHost (get "http://")
285
invalidURL Verb{..} _site = do let noProto (InvalidUrlException _ _) = return () assertThrows "exception if no protocol" noProto (get "wheeee") let noHost (HttpExceptionRequest _ (InvalidDestinationHost _)) = return () assertThrows "exception if no host" noHost (get "http://")
285
false
false
1
15
45
113
48
65
null
null
music-suite/music-preludes
tests/tests.hs
bsd-3-clause
converter ext = case ext of "mid" -> "music2midi" "xml" -> "music2musicxml" "ly" -> "music2ly"
101
converter ext = case ext of "mid" -> "music2midi" "xml" -> "music2musicxml" "ly" -> "music2ly"
101
converter ext = case ext of "mid" -> "music2midi" "xml" -> "music2musicxml" "ly" -> "music2ly"
101
false
false
1
8
21
35
15
20
null
null
michaelficarra/purescript
src/Language/PureScript/Docs/RenderedCode/Render.hs
mit
matchType :: Pattern () Type RenderedCode matchType = buildPrettyPrinter operators matchTypeAtom where operators :: OperatorTable () Type RenderedCode operators = OperatorTable [ [ AssocL typeApp $ \f x -> f <> sp <> x ] , [ AssocR appliedFunction $ \arg ret -> mintersperse sp [arg, syntax "->", ret] ] , [ Wrap forall_ $ \idents ty -> mconcat [syntax "forall", sp, mintersperse sp (map ident idents), syntax ".", sp, ty] ] , [ Wrap kinded $ \k ty -> mintersperse sp [ty, syntax "::", renderKind k] ] ]
585
matchType :: Pattern () Type RenderedCode matchType = buildPrettyPrinter operators matchTypeAtom where operators :: OperatorTable () Type RenderedCode operators = OperatorTable [ [ AssocL typeApp $ \f x -> f <> sp <> x ] , [ AssocR appliedFunction $ \arg ret -> mintersperse sp [arg, syntax "->", ret] ] , [ Wrap forall_ $ \idents ty -> mconcat [syntax "forall", sp, mintersperse sp (map ident idents), syntax ".", sp, ty] ] , [ Wrap kinded $ \k ty -> mintersperse sp [ty, syntax "::", renderKind k] ] ]
585
matchType = buildPrettyPrinter operators matchTypeAtom where operators :: OperatorTable () Type RenderedCode operators = OperatorTable [ [ AssocL typeApp $ \f x -> f <> sp <> x ] , [ AssocR appliedFunction $ \arg ret -> mintersperse sp [arg, syntax "->", ret] ] , [ Wrap forall_ $ \idents ty -> mconcat [syntax "forall", sp, mintersperse sp (map ident idents), syntax ".", sp, ty] ] , [ Wrap kinded $ \k ty -> mintersperse sp [ty, syntax "::", renderKind k] ] ]
543
false
true
0
14
170
215
112
103
null
null
7ocb/fuse_adb_fs
lib/Parsers.hs
gpl-3.0
wordId :: Parser String wordId = anyChar `manyTill` space
57
wordId :: Parser String wordId = anyChar `manyTill` space
57
wordId = anyChar `manyTill` space
33
false
true
0
5
8
20
11
9
null
null
ntindall/KVStore
src/KVProtocol.hs
bsd-3-clause
connectToHost :: HostName -> PortID -> IO Handle connectToHost hostname pid@(PortNumber pno) = E.catch (do hostEntry <- BSD.getHostByName hostname sock <- SOCKET.socket AF_INET Stream defaultProtocol SOCKET.setSocketOption sock KeepAlive 1 SOCKET.connect sock (SockAddrInet pno (hostAddress hostEntry)) --convert to handle socketToHandle sock ReadWriteMode ) (\(e :: SomeException) -> do traceIO $ show e threadDelay 1000000 connectToHost hostname pid )
502
connectToHost :: HostName -> PortID -> IO Handle connectToHost hostname pid@(PortNumber pno) = E.catch (do hostEntry <- BSD.getHostByName hostname sock <- SOCKET.socket AF_INET Stream defaultProtocol SOCKET.setSocketOption sock KeepAlive 1 SOCKET.connect sock (SockAddrInet pno (hostAddress hostEntry)) --convert to handle socketToHandle sock ReadWriteMode ) (\(e :: SomeException) -> do traceIO $ show e threadDelay 1000000 connectToHost hostname pid )
502
connectToHost hostname pid@(PortNumber pno) = E.catch (do hostEntry <- BSD.getHostByName hostname sock <- SOCKET.socket AF_INET Stream defaultProtocol SOCKET.setSocketOption sock KeepAlive 1 SOCKET.connect sock (SockAddrInet pno (hostAddress hostEntry)) --convert to handle socketToHandle sock ReadWriteMode ) (\(e :: SomeException) -> do traceIO $ show e threadDelay 1000000 connectToHost hostname pid )
453
false
true
0
13
105
159
73
86
null
null
rsasse/tamarin-prover
lib/theory/src/Theory.hs
gpl-3.0
getClassifiedRules :: ClosedTheory -> ClassifiedRules getClassifiedRules = L.get (crcRules . thyCache)
102
getClassifiedRules :: ClosedTheory -> ClassifiedRules getClassifiedRules = L.get (crcRules . thyCache)
102
getClassifiedRules = L.get (crcRules . thyCache)
48
false
true
0
7
10
27
14
13
null
null
wizzup/advent_of_code
2016/2/part1.hs
mit
step D B5 = B8
14
step D B5 = B8
14
step D B5 = B8
14
false
false
1
5
4
16
5
11
null
null
fibsifan/pandoc
src/Text/Pandoc/Readers/EPUB.hs
gpl-2.0
-- Note that internal reference are aggresively normalised so that all ids -- are of the form "filename#id" -- archiveToEPUB :: (MonadError PandocError m) => ReaderOptions -> Archive -> m (Pandoc, MediaBag) archiveToEPUB os archive = do -- root is path to folder with manifest file in (root, content) <- getManifest archive meta <- parseMeta content (cover, items) <- parseManifest content -- No need to collapse here as the image path is from the manifest file let coverDoc = fromMaybe mempty (imageToPandoc <$> cover) spine <- parseSpine items content let escapedSpine = map (escapeURI . takeFileName . fst) spine Pandoc _ bs <- foldM' (\a b -> ((a <>) . walk (prependHash escapedSpine)) `liftM` parseSpineElem root b) mempty spine let ast = coverDoc <> (Pandoc meta bs) let mediaBag = fetchImages (M.elems items) root archive ast return $ (ast, mediaBag) where os' = os {readerParseRaw = True} parseSpineElem :: MonadError PandocError m => FilePath -> (FilePath, MimeType) -> m Pandoc parseSpineElem (normalise -> r) (normalise -> path, mime) = do when (readerTrace os) (traceM path) doc <- mimeToReader mime r path let docSpan = B.doc $ B.para $ B.spanWith (takeFileName path, [], []) mempty return $ docSpan <> doc mimeToReader :: MonadError PandocError m => MimeType -> FilePath -> FilePath -> m Pandoc mimeToReader "application/xhtml+xml" (normalise -> root) (normalise -> path) = do fname <- findEntryByPathE (root </> path) archive html <- either throwError return . readHtml os' . UTF8.toStringLazy $ fromEntry fname return $ fixInternalReferences path html mimeToReader s _ path | s `elem` imageMimes = return $ imageToPandoc path | otherwise = return $ mempty -- paths should be absolute when this function is called -- renameImages should do this
1,933
archiveToEPUB :: (MonadError PandocError m) => ReaderOptions -> Archive -> m (Pandoc, MediaBag) archiveToEPUB os archive = do -- root is path to folder with manifest file in (root, content) <- getManifest archive meta <- parseMeta content (cover, items) <- parseManifest content -- No need to collapse here as the image path is from the manifest file let coverDoc = fromMaybe mempty (imageToPandoc <$> cover) spine <- parseSpine items content let escapedSpine = map (escapeURI . takeFileName . fst) spine Pandoc _ bs <- foldM' (\a b -> ((a <>) . walk (prependHash escapedSpine)) `liftM` parseSpineElem root b) mempty spine let ast = coverDoc <> (Pandoc meta bs) let mediaBag = fetchImages (M.elems items) root archive ast return $ (ast, mediaBag) where os' = os {readerParseRaw = True} parseSpineElem :: MonadError PandocError m => FilePath -> (FilePath, MimeType) -> m Pandoc parseSpineElem (normalise -> r) (normalise -> path, mime) = do when (readerTrace os) (traceM path) doc <- mimeToReader mime r path let docSpan = B.doc $ B.para $ B.spanWith (takeFileName path, [], []) mempty return $ docSpan <> doc mimeToReader :: MonadError PandocError m => MimeType -> FilePath -> FilePath -> m Pandoc mimeToReader "application/xhtml+xml" (normalise -> root) (normalise -> path) = do fname <- findEntryByPathE (root </> path) archive html <- either throwError return . readHtml os' . UTF8.toStringLazy $ fromEntry fname return $ fixInternalReferences path html mimeToReader s _ path | s `elem` imageMimes = return $ imageToPandoc path | otherwise = return $ mempty -- paths should be absolute when this function is called -- renameImages should do this
1,822
archiveToEPUB os archive = do -- root is path to folder with manifest file in (root, content) <- getManifest archive meta <- parseMeta content (cover, items) <- parseManifest content -- No need to collapse here as the image path is from the manifest file let coverDoc = fromMaybe mempty (imageToPandoc <$> cover) spine <- parseSpine items content let escapedSpine = map (escapeURI . takeFileName . fst) spine Pandoc _ bs <- foldM' (\a b -> ((a <>) . walk (prependHash escapedSpine)) `liftM` parseSpineElem root b) mempty spine let ast = coverDoc <> (Pandoc meta bs) let mediaBag = fetchImages (M.elems items) root archive ast return $ (ast, mediaBag) where os' = os {readerParseRaw = True} parseSpineElem :: MonadError PandocError m => FilePath -> (FilePath, MimeType) -> m Pandoc parseSpineElem (normalise -> r) (normalise -> path, mime) = do when (readerTrace os) (traceM path) doc <- mimeToReader mime r path let docSpan = B.doc $ B.para $ B.spanWith (takeFileName path, [], []) mempty return $ docSpan <> doc mimeToReader :: MonadError PandocError m => MimeType -> FilePath -> FilePath -> m Pandoc mimeToReader "application/xhtml+xml" (normalise -> root) (normalise -> path) = do fname <- findEntryByPathE (root </> path) archive html <- either throwError return . readHtml os' . UTF8.toStringLazy $ fromEntry fname return $ fixInternalReferences path html mimeToReader s _ path | s `elem` imageMimes = return $ imageToPandoc path | otherwise = return $ mempty -- paths should be absolute when this function is called -- renameImages should do this
1,726
true
true
0
16
455
596
296
300
null
null
andbroby/Harlequin
src/Main.hs
gpl-2.0
eqv [_, _] = return $ Bool $ False
34
eqv [_, _] = return $ Bool $ False
34
eqv [_, _] = return $ Bool $ False
34
false
false
2
5
8
25
12
13
null
null
databrary/databrary
test/Model/AuthorizeTest.hs
agpl-3.0
mockParty :: Id Party -> Party mockParty pid = nobodyParty { partyRow = (partyRow nobodyParty) { partyId = pid } }
118
mockParty :: Id Party -> Party mockParty pid = nobodyParty { partyRow = (partyRow nobodyParty) { partyId = pid } }
118
mockParty pid = nobodyParty { partyRow = (partyRow nobodyParty) { partyId = pid } }
87
false
true
0
10
24
52
25
27
null
null
juodaspaulius/clafer-old-customBNFC
src/Language/Clafer/Intermediate/Tracing.hs
mit
traverseEnumId :: EnumId -> [Ast] traverseEnumId _ = []
55
traverseEnumId :: EnumId -> [Ast] traverseEnumId _ = []
55
traverseEnumId _ = []
21
false
true
0
8
8
29
13
16
null
null
forked-upstream-packages-for-ghcjs/ghc
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
------------------------------------------------------------------------------ -- Helpers for translating vector primops. vecVmmType :: PrimOpVecCat -> Length -> Width -> CmmType vecVmmType pocat n w = vec n (vecCmmCat pocat w)
228
vecVmmType :: PrimOpVecCat -> Length -> Width -> CmmType vecVmmType pocat n w = vec n (vecCmmCat pocat w)
105
vecVmmType pocat n w = vec n (vecCmmCat pocat w)
48
true
true
0
7
26
45
23
22
null
null
sopvop/cabal
cabal-install/Distribution/Client/ProjectOrchestration.hs
bsd-3-clause
runProjectBuildPhase :: Verbosity -> ProjectBuildContext -> IO BuildOutcomes runProjectBuildPhase verbosity ProjectBuildContext {..} = fmap (Map.union (previousBuildOutcomes pkgsBuildStatus)) $ rebuildTargets verbosity distDirLayout elaboratedPlan elaboratedShared pkgsBuildStatus buildSettings where previousBuildOutcomes :: BuildStatusMap -> BuildOutcomes previousBuildOutcomes = Map.mapMaybe $ \status -> case status of BuildStatusUpToDate buildSuccess -> Just (Right buildSuccess) --TODO: [nice to have] record build failures persistently _ -> Nothing -- Note that it is a deliberate design choice that the 'buildTargets' is -- not passed to phase 1, and the various bits of input config is not -- passed to phase 2. -- -- We make the install plan without looking at the particular targets the -- user asks us to build. The set of available things we can build is -- discovered from the env and config and is used to make the install plan. -- The targets just tell us which parts of the install plan to execute. -- -- Conversely, executing the plan does not directly depend on any of the -- input config. The bits that are needed (or better, the decisions based -- on it) all go into the install plan. -- Notionally, the 'BuildFlags' should be things that do not affect what -- we build, just how we do it. These ones of course do ------------------------------------------------------------------------------ -- Taking targets into account, selecting what to build -- -- | Adjust an 'ElaboratedInstallPlan' by selecting just those parts of it -- required to build the given user targets. -- -- How to get the 'PackageTarget's from the 'UserBuildTarget' is customisable, -- so that we can change the meaning of @pkgname@ to target a build or -- repl depending on which command is calling it. -- -- Conceptually, every target identifies one or more roots in the -- 'ElaboratedInstallPlan', which we then use to determine the closure -- of what packages need to be built, dropping everything from -- 'ElaboratedInstallPlan' that is unnecessary. -- -- There is a complication, however: In an ideal world, every -- possible target would be a node in the graph. However, it is -- currently not possible (and possibly not even desirable) to invoke a -- Setup script to build *just* one file. Similarly, it is not possible -- to invoke a pre Cabal-1.25 custom Setup script and build only one -- component. In these cases, we want to build the entire package, BUT -- only actually building some of the files/components. This is what -- 'pkgBuildTargets', 'pkgReplTarget' and 'pkgBuildHaddock' control. -- Arguably, these should an out-of-band mechanism rather than stored -- in 'ElaboratedInstallPlan', but it's what we have. We have -- to fiddle around with the ElaboratedConfiguredPackage roots to say -- what it will build. --
3,110
runProjectBuildPhase :: Verbosity -> ProjectBuildContext -> IO BuildOutcomes runProjectBuildPhase verbosity ProjectBuildContext {..} = fmap (Map.union (previousBuildOutcomes pkgsBuildStatus)) $ rebuildTargets verbosity distDirLayout elaboratedPlan elaboratedShared pkgsBuildStatus buildSettings where previousBuildOutcomes :: BuildStatusMap -> BuildOutcomes previousBuildOutcomes = Map.mapMaybe $ \status -> case status of BuildStatusUpToDate buildSuccess -> Just (Right buildSuccess) --TODO: [nice to have] record build failures persistently _ -> Nothing -- Note that it is a deliberate design choice that the 'buildTargets' is -- not passed to phase 1, and the various bits of input config is not -- passed to phase 2. -- -- We make the install plan without looking at the particular targets the -- user asks us to build. The set of available things we can build is -- discovered from the env and config and is used to make the install plan. -- The targets just tell us which parts of the install plan to execute. -- -- Conversely, executing the plan does not directly depend on any of the -- input config. The bits that are needed (or better, the decisions based -- on it) all go into the install plan. -- Notionally, the 'BuildFlags' should be things that do not affect what -- we build, just how we do it. These ones of course do ------------------------------------------------------------------------------ -- Taking targets into account, selecting what to build -- -- | Adjust an 'ElaboratedInstallPlan' by selecting just those parts of it -- required to build the given user targets. -- -- How to get the 'PackageTarget's from the 'UserBuildTarget' is customisable, -- so that we can change the meaning of @pkgname@ to target a build or -- repl depending on which command is calling it. -- -- Conceptually, every target identifies one or more roots in the -- 'ElaboratedInstallPlan', which we then use to determine the closure -- of what packages need to be built, dropping everything from -- 'ElaboratedInstallPlan' that is unnecessary. -- -- There is a complication, however: In an ideal world, every -- possible target would be a node in the graph. However, it is -- currently not possible (and possibly not even desirable) to invoke a -- Setup script to build *just* one file. Similarly, it is not possible -- to invoke a pre Cabal-1.25 custom Setup script and build only one -- component. In these cases, we want to build the entire package, BUT -- only actually building some of the files/components. This is what -- 'pkgBuildTargets', 'pkgReplTarget' and 'pkgBuildHaddock' control. -- Arguably, these should an out-of-band mechanism rather than stored -- in 'ElaboratedInstallPlan', but it's what we have. We have -- to fiddle around with the ElaboratedConfiguredPackage roots to say -- what it will build. --
3,110
runProjectBuildPhase verbosity ProjectBuildContext {..} = fmap (Map.union (previousBuildOutcomes pkgsBuildStatus)) $ rebuildTargets verbosity distDirLayout elaboratedPlan elaboratedShared pkgsBuildStatus buildSettings where previousBuildOutcomes :: BuildStatusMap -> BuildOutcomes previousBuildOutcomes = Map.mapMaybe $ \status -> case status of BuildStatusUpToDate buildSuccess -> Just (Right buildSuccess) --TODO: [nice to have] record build failures persistently _ -> Nothing -- Note that it is a deliberate design choice that the 'buildTargets' is -- not passed to phase 1, and the various bits of input config is not -- passed to phase 2. -- -- We make the install plan without looking at the particular targets the -- user asks us to build. The set of available things we can build is -- discovered from the env and config and is used to make the install plan. -- The targets just tell us which parts of the install plan to execute. -- -- Conversely, executing the plan does not directly depend on any of the -- input config. The bits that are needed (or better, the decisions based -- on it) all go into the install plan. -- Notionally, the 'BuildFlags' should be things that do not affect what -- we build, just how we do it. These ones of course do ------------------------------------------------------------------------------ -- Taking targets into account, selecting what to build -- -- | Adjust an 'ElaboratedInstallPlan' by selecting just those parts of it -- required to build the given user targets. -- -- How to get the 'PackageTarget's from the 'UserBuildTarget' is customisable, -- so that we can change the meaning of @pkgname@ to target a build or -- repl depending on which command is calling it. -- -- Conceptually, every target identifies one or more roots in the -- 'ElaboratedInstallPlan', which we then use to determine the closure -- of what packages need to be built, dropping everything from -- 'ElaboratedInstallPlan' that is unnecessary. -- -- There is a complication, however: In an ideal world, every -- possible target would be a node in the graph. However, it is -- currently not possible (and possibly not even desirable) to invoke a -- Setup script to build *just* one file. Similarly, it is not possible -- to invoke a pre Cabal-1.25 custom Setup script and build only one -- component. In these cases, we want to build the entire package, BUT -- only actually building some of the files/components. This is what -- 'pkgBuildTargets', 'pkgReplTarget' and 'pkgBuildHaddock' control. -- Arguably, these should an out-of-band mechanism rather than stored -- in 'ElaboratedInstallPlan', but it's what we have. We have -- to fiddle around with the ElaboratedConfiguredPackage roots to say -- what it will build. --
2,991
false
true
12
8
727
153
102
51
null
null