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
wyager/Neks
Network/Neks/DataStore.hs
mit
load :: [Map.Map k v] -> STM (DataStore k v) load = fmap DataStore . Vector.mapM newTMVar . fromList
100
load :: [Map.Map k v] -> STM (DataStore k v) load = fmap DataStore . Vector.mapM newTMVar . fromList
100
load = fmap DataStore . Vector.mapM newTMVar . fromList
55
false
true
0
8
18
52
25
27
null
null
diku-dk/futhark
src/Futhark/CodeGen/ImpGen/GPU/ToOpenCL.hs
isc
onHostOp _ (ImpGPU.GetSizeMax v size_class) = return $ ImpOpenCL.GetSizeMax v size_class
90
onHostOp _ (ImpGPU.GetSizeMax v size_class) = return $ ImpOpenCL.GetSizeMax v size_class
90
onHostOp _ (ImpGPU.GetSizeMax v size_class) = return $ ImpOpenCL.GetSizeMax v size_class
90
false
false
0
8
12
32
15
17
null
null
green-haskell/ghc
libraries/base/Data/OldList.hs
bsd-3-clause
unwords [] = ""
29
unwords [] = ""
29
unwords [] = ""
29
false
false
0
6
17
11
5
6
null
null
abakst/liquidhaskell
src/Language/Haskell/Liquid/Types/PredType.hs
bsd-3-clause
pappSort :: Int -> Sort pappSort n = FFunc (2 * n) $ [ptycon] ++ args ++ [boolSort] where ptycon = fAppTC predFTyCon $ FVar <$> [0..n-1] args = FVar <$> [n..(2*n-1)]
177
pappSort :: Int -> Sort pappSort n = FFunc (2 * n) $ [ptycon] ++ args ++ [boolSort] where ptycon = fAppTC predFTyCon $ FVar <$> [0..n-1] args = FVar <$> [n..(2*n-1)]
177
pappSort n = FFunc (2 * n) $ [ptycon] ++ args ++ [boolSort] where ptycon = fAppTC predFTyCon $ FVar <$> [0..n-1] args = FVar <$> [n..(2*n-1)]
153
false
true
1
10
43
101
52
49
null
null
OS2World/DEV-UTIL-HUGS
oldlib/MinHeap.hs
bsd-3-clause
foldr f e E = e
15
foldr f e E = e
15
foldr f e E = e
15
false
false
1
5
5
19
6
13
null
null
mrehayden1/lji
src/LJI/Music/Notation/Scales.hs
bsd-3-clause
chromaticScale' (Natural F) Major Desc = return . cyc 7 $ [f , gf , g , af , a , bf , cf , c , df , d , ef , e ]
130
chromaticScale' (Natural F) Major Desc = return . cyc 7 $ [f , gf , g , af , a , bf , cf , c , df , d , ef , e ]
130
chromaticScale' (Natural F) Major Desc = return . cyc 7 $ [f , gf , g , af , a , bf , cf , c , df , d , ef , e ]
130
false
false
0
7
52
66
38
28
null
null
bitemyapp/ghc
libraries/base/GHC/Conc/Sync.hs
bsd-3-clause
thenSTM :: STM a -> STM b -> STM b thenSTM (STM m) k = STM ( \s -> case m s of (# new_s, _ #) -> unSTM k new_s )
120
thenSTM :: STM a -> STM b -> STM b thenSTM (STM m) k = STM ( \s -> case m s of (# new_s, _ #) -> unSTM k new_s )
120
thenSTM (STM m) k = STM ( \s -> case m s of (# new_s, _ #) -> unSTM k new_s )
85
false
true
0
11
39
73
35
38
null
null
DavidAlphaFox/CacheDNS
src/CacheDNS/IPC/Mailbox.hs
bsd-3-clause
newMailboxIO :: IO (Mailbox m) newMailboxIO = do _read <- newTVarIO [] _write <- newTVarIO [] return (Mailbox _read _write) {-| Write a value to a 'Mailbox'. -}
168
newMailboxIO :: IO (Mailbox m) newMailboxIO = do _read <- newTVarIO [] _write <- newTVarIO [] return (Mailbox _read _write) {-| Write a value to a 'Mailbox'. -}
168
newMailboxIO = do _read <- newTVarIO [] _write <- newTVarIO [] return (Mailbox _read _write) {-| Write a value to a 'Mailbox'. -}
137
false
true
0
9
35
59
27
32
null
null
anammari/pandoc
src/Text/Pandoc/Readers/RST.hs
gpl-2.0
rawListItem :: GenParser Char ParserState Int -> GenParser Char ParserState (Int, [Char]) rawListItem start = try $ do markerLength <- start firstLine <- manyTill anyChar newline restLines <- many (listLine markerLength) return (markerLength, (firstLine ++ "\n" ++ (concat restLines))) -- continuation of a list item - indented and separated by blankline or -- (in compact lists) endline. -- Note: nested lists are parsed as continuations.
463
rawListItem :: GenParser Char ParserState Int -> GenParser Char ParserState (Int, [Char]) rawListItem start = try $ do markerLength <- start firstLine <- manyTill anyChar newline restLines <- many (listLine markerLength) return (markerLength, (firstLine ++ "\n" ++ (concat restLines))) -- continuation of a list item - indented and separated by blankline or -- (in compact lists) endline. -- Note: nested lists are parsed as continuations.
463
rawListItem start = try $ do markerLength <- start firstLine <- manyTill anyChar newline restLines <- many (listLine markerLength) return (markerLength, (firstLine ++ "\n" ++ (concat restLines))) -- continuation of a list item - indented and separated by blankline or -- (in compact lists) endline. -- Note: nested lists are parsed as continuations.
361
false
true
0
13
88
112
56
56
null
null
positiondev/orged
src/Main.hs
isc
workerThread :: MVar State -> MVar Bool -> IO () workerThread clients request = forever $ do v <- readMVar request when v $ do modifyMVar_ request (const (return False)) broadcast clients "Starting sync..." Lib.run (broadcast clients) broadcast clients "Finished sync..." threadDelay 100000
353
workerThread :: MVar State -> MVar Bool -> IO () workerThread clients request = forever $ do v <- readMVar request when v $ do modifyMVar_ request (const (return False)) broadcast clients "Starting sync..." Lib.run (broadcast clients) broadcast clients "Finished sync..." threadDelay 100000
353
workerThread clients request = forever $ do v <- readMVar request when v $ do modifyMVar_ request (const (return False)) broadcast clients "Starting sync..." Lib.run (broadcast clients) broadcast clients "Finished sync..." threadDelay 100000
304
false
true
0
16
105
120
50
70
null
null
rueshyna/gogol
gogol-firebase-rules/gen/Network/Google/Resource/FirebaseRules/Projects/Releases/Get.hs
mpl-2.0
-- | V1 error format. pXgafv :: Lens' ProjectsReleasesGet (Maybe Xgafv) pXgafv = lens _pXgafv (\ s a -> s{_pXgafv = a})
119
pXgafv :: Lens' ProjectsReleasesGet (Maybe Xgafv) pXgafv = lens _pXgafv (\ s a -> s{_pXgafv = a})
97
pXgafv = lens _pXgafv (\ s a -> s{_pXgafv = a})
47
true
true
0
9
21
46
25
21
null
null
xich/scotty
Network/Wai/Middleware/Static.hs
bsd-3-clause
extensions fp = case dropWhile (/= '.') fp of [] -> [] s -> let ext = tail s in ext : extensions ext
165
extensions fp = case dropWhile (/= '.') fp of [] -> [] s -> let ext = tail s in ext : extensions ext
165
extensions fp = case dropWhile (/= '.') fp of [] -> [] s -> let ext = tail s in ext : extensions ext
165
false
false
0
12
88
59
28
31
null
null
rsasse/tamarin-prover
src/Web/Theory.hs
gpl-3.0
getNextElement :: (a -> Bool) -> [a] -> Maybe a getNextElement _ [] = Nothing
77
getNextElement :: (a -> Bool) -> [a] -> Maybe a getNextElement _ [] = Nothing
77
getNextElement _ [] = Nothing
29
false
true
0
7
14
39
20
19
null
null
PeterScott/haskell-kyoto-tycoon
Database/KyotoTycoon/TSVRPC.hs
bsd-3-clause
-- Parse a line like "HTTP/1.1 200 OK\r\n" replyLine :: Parser ReturnStatus replyLine = toStatus <$> (string "HTTP/1.1 " *> takeWhile1 P8.isDigit_w8 <* toEol) where toStatus "200" = StatusSuccess toStatus "400" = StatusInvalidRequest toStatus "450" = StatusBadResult toStatus "500" = StatusServerError toStatus "501" = StatusNotImplemented toStatus _ = StatusUnknown -- Parse the Content-Type line, and return the decoding function.
491
replyLine :: Parser ReturnStatus replyLine = toStatus <$> (string "HTTP/1.1 " *> takeWhile1 P8.isDigit_w8 <* toEol) where toStatus "200" = StatusSuccess toStatus "400" = StatusInvalidRequest toStatus "450" = StatusBadResult toStatus "500" = StatusServerError toStatus "501" = StatusNotImplemented toStatus _ = StatusUnknown -- Parse the Content-Type line, and return the decoding function.
448
replyLine = toStatus <$> (string "HTTP/1.1 " *> takeWhile1 P8.isDigit_w8 <* toEol) where toStatus "200" = StatusSuccess toStatus "400" = StatusInvalidRequest toStatus "450" = StatusBadResult toStatus "500" = StatusServerError toStatus "501" = StatusNotImplemented toStatus _ = StatusUnknown -- Parse the Content-Type line, and return the decoding function.
415
true
true
1
10
117
94
45
49
null
null
Ongy/monky
Monky/Network/Dynamic.hs
lgpl-3.0
-- |Logic for adding a new device to our Handles gotNew :: Int -> String -> Handles -> IO Handles gotNew index name m = case IM.lookup index m of Nothing -> do h <- getNetworkHandle name return $IM.insert index (NetHandle name h) m Just (NetHandle x v) -> if x == name then return m else do h <- getNetworkHandle name closeNetworkHandle v return $IM.adjust (const (NetHandle name h)) index m -- |Logic for removing a handle form Handles after we lost the interface
523
gotNew :: Int -> String -> Handles -> IO Handles gotNew index name m = case IM.lookup index m of Nothing -> do h <- getNetworkHandle name return $IM.insert index (NetHandle name h) m Just (NetHandle x v) -> if x == name then return m else do h <- getNetworkHandle name closeNetworkHandle v return $IM.adjust (const (NetHandle name h)) index m -- |Logic for removing a handle form Handles after we lost the interface
474
gotNew index name m = case IM.lookup index m of Nothing -> do h <- getNetworkHandle name return $IM.insert index (NetHandle name h) m Just (NetHandle x v) -> if x == name then return m else do h <- getNetworkHandle name closeNetworkHandle v return $IM.adjust (const (NetHandle name h)) index m -- |Logic for removing a handle form Handles after we lost the interface
425
true
true
2
14
143
167
77
90
null
null
mcschroeder/ghc
compiler/main/GhcMake.hs
bsd-3-clause
packageModErr :: DynFlags -> ModuleName -> ErrMsg packageModErr dflags mod = mkPlainErrMsg dflags noSrcSpan $ text "module" <+> quotes (ppr mod) <+> text "is a package module"
185
packageModErr :: DynFlags -> ModuleName -> ErrMsg packageModErr dflags mod = mkPlainErrMsg dflags noSrcSpan $ text "module" <+> quotes (ppr mod) <+> text "is a package module"
185
packageModErr dflags mod = mkPlainErrMsg dflags noSrcSpan $ text "module" <+> quotes (ppr mod) <+> text "is a package module"
135
false
true
0
9
36
56
26
30
null
null
da-x/lamdu
Lamdu/Data/Export/JSON/Codec.hs
gpl-3.0
decodeSquashed :: (Aeson.FromJSON j, Monoid a) => String -> (j -> AesonTypes.Parser a) -> ExhaustiveDecoder a decodeSquashed name decode o = jsum' [ o .: name >>= lift . decode , pure mempty ]
216
decodeSquashed :: (Aeson.FromJSON j, Monoid a) => String -> (j -> AesonTypes.Parser a) -> ExhaustiveDecoder a decodeSquashed name decode o = jsum' [ o .: name >>= lift . decode , pure mempty ]
216
decodeSquashed name decode o = jsum' [ o .: name >>= lift . decode , pure mempty ]
98
false
true
0
11
57
82
41
41
null
null
mumuki/mulang
src/Language/Mulang/Parsers/Java.hs
gpl-3.0
muNormalizeReference (SimpleSend Self "assertTrue" [expression]) = M.Assert False $ Truth expression
108
muNormalizeReference (SimpleSend Self "assertTrue" [expression]) = M.Assert False $ Truth expression
108
muNormalizeReference (SimpleSend Self "assertTrue" [expression]) = M.Assert False $ Truth expression
108
false
false
0
8
18
34
16
18
null
null
vladimir-ipatov/ganeti
test/hs/Test/Ganeti/Runtime.hs
gpl-2.0
case_UsersGroups :: Assertion case_UsersGroups = do -- note: we don't have here a programatic way to list all users, so -- we harcode some parts of the two (hs/py) lists let daemons = [minBound..maxBound]::[GanetiDaemon] users = map daemonUser daemons groups = map daemonGroup $ map DaemonGroup daemons ++ map ExtraGroup [minBound..maxBound] py_stdout <- runPython "from ganeti import constants\n\ \from ganeti import serializer\n\ \import sys\n\ \users = [constants.MASTERD_USER,\n\ \ constants.NODED_USER,\n\ \ constants.RAPI_USER,\n\ \ constants.CONFD_USER,\n\ \ constants.LUXID_USER,\n\ \ constants.MOND_USER,\n\ \ ]\n\ \groups = [constants.MASTERD_GROUP,\n\ \ constants.NODED_GROUP,\n\ \ constants.RAPI_GROUP,\n\ \ constants.CONFD_GROUP,\n\ \ constants.LUXID_GROUP,\n\ \ constants.MOND_GROUP,\n\ \ constants.DAEMONS_GROUP,\n\ \ constants.ADMIN_GROUP,\n\ \ ]\n\ \encoded = (users, groups)\n\ \print serializer.Dump(encoded)" "" >>= checkPythonResult let deserialised = J.decode py_stdout::J.Result ([String], [String]) (py_users, py_groups) <- case deserialised of J.Ok ops -> return ops J.Error msg -> assertFailure ("Unable to decode users/groups: " ++ msg) -- this already raised an expection, but we need it for proper -- types >> fail "Unable to decode users/groups" assertEqual "Mismatch in number of returned users" (length py_users) (length users) assertEqual "Mismatch in number of returned users" (length py_groups) (length groups) mapM_ (uncurry (assertEqual "Different result for users") ) $ zip py_users users mapM_ (uncurry (assertEqual "Different result for groups") ) $ zip py_groups groups
2,136
case_UsersGroups :: Assertion case_UsersGroups = do -- note: we don't have here a programatic way to list all users, so -- we harcode some parts of the two (hs/py) lists let daemons = [minBound..maxBound]::[GanetiDaemon] users = map daemonUser daemons groups = map daemonGroup $ map DaemonGroup daemons ++ map ExtraGroup [minBound..maxBound] py_stdout <- runPython "from ganeti import constants\n\ \from ganeti import serializer\n\ \import sys\n\ \users = [constants.MASTERD_USER,\n\ \ constants.NODED_USER,\n\ \ constants.RAPI_USER,\n\ \ constants.CONFD_USER,\n\ \ constants.LUXID_USER,\n\ \ constants.MOND_USER,\n\ \ ]\n\ \groups = [constants.MASTERD_GROUP,\n\ \ constants.NODED_GROUP,\n\ \ constants.RAPI_GROUP,\n\ \ constants.CONFD_GROUP,\n\ \ constants.LUXID_GROUP,\n\ \ constants.MOND_GROUP,\n\ \ constants.DAEMONS_GROUP,\n\ \ constants.ADMIN_GROUP,\n\ \ ]\n\ \encoded = (users, groups)\n\ \print serializer.Dump(encoded)" "" >>= checkPythonResult let deserialised = J.decode py_stdout::J.Result ([String], [String]) (py_users, py_groups) <- case deserialised of J.Ok ops -> return ops J.Error msg -> assertFailure ("Unable to decode users/groups: " ++ msg) -- this already raised an expection, but we need it for proper -- types >> fail "Unable to decode users/groups" assertEqual "Mismatch in number of returned users" (length py_users) (length users) assertEqual "Mismatch in number of returned users" (length py_groups) (length groups) mapM_ (uncurry (assertEqual "Different result for users") ) $ zip py_users users mapM_ (uncurry (assertEqual "Different result for groups") ) $ zip py_groups groups
2,136
case_UsersGroups = do -- note: we don't have here a programatic way to list all users, so -- we harcode some parts of the two (hs/py) lists let daemons = [minBound..maxBound]::[GanetiDaemon] users = map daemonUser daemons groups = map daemonGroup $ map DaemonGroup daemons ++ map ExtraGroup [minBound..maxBound] py_stdout <- runPython "from ganeti import constants\n\ \from ganeti import serializer\n\ \import sys\n\ \users = [constants.MASTERD_USER,\n\ \ constants.NODED_USER,\n\ \ constants.RAPI_USER,\n\ \ constants.CONFD_USER,\n\ \ constants.LUXID_USER,\n\ \ constants.MOND_USER,\n\ \ ]\n\ \groups = [constants.MASTERD_GROUP,\n\ \ constants.NODED_GROUP,\n\ \ constants.RAPI_GROUP,\n\ \ constants.CONFD_GROUP,\n\ \ constants.LUXID_GROUP,\n\ \ constants.MOND_GROUP,\n\ \ constants.DAEMONS_GROUP,\n\ \ constants.ADMIN_GROUP,\n\ \ ]\n\ \encoded = (users, groups)\n\ \print serializer.Dump(encoded)" "" >>= checkPythonResult let deserialised = J.decode py_stdout::J.Result ([String], [String]) (py_users, py_groups) <- case deserialised of J.Ok ops -> return ops J.Error msg -> assertFailure ("Unable to decode users/groups: " ++ msg) -- this already raised an expection, but we need it for proper -- types >> fail "Unable to decode users/groups" assertEqual "Mismatch in number of returned users" (length py_users) (length users) assertEqual "Mismatch in number of returned users" (length py_groups) (length groups) mapM_ (uncurry (assertEqual "Different result for users") ) $ zip py_users users mapM_ (uncurry (assertEqual "Different result for groups") ) $ zip py_groups groups
2,106
false
true
0
14
727
283
138
145
null
null
ice1000/OI-codes
codewars/101-200/is-prime-number.hs
agpl-3.0
isPrime 3 = True
16
isPrime 3 = True
16
isPrime 3 = True
16
false
false
0
4
3
10
4
6
null
null
purebred-mua/purebred
src/Purebred/Types.hs
agpl-3.0
nmSentTag :: Lens' NotmuchSettings Tag nmSentTag = lens _nmSentTag (\nm x -> nm { _nmSentTag = x })
99
nmSentTag :: Lens' NotmuchSettings Tag nmSentTag = lens _nmSentTag (\nm x -> nm { _nmSentTag = x })
99
nmSentTag = lens _nmSentTag (\nm x -> nm { _nmSentTag = x })
60
false
true
0
9
17
39
21
18
null
null
meiersi/blaze-builder
benchmarks/FastPut.hs
bsd-3-clause
traceBuilder :: String -> Builder traceBuilder msg = Builder $ \k br@(BufRange op ope) -> do putStrLn $ "traceBuilder " ++ show (op, ope) ++ ": " ++ msg k br
166
traceBuilder :: String -> Builder traceBuilder msg = Builder $ \k br@(BufRange op ope) -> do putStrLn $ "traceBuilder " ++ show (op, ope) ++ ": " ++ msg k br
165
traceBuilder msg = Builder $ \k br@(BufRange op ope) -> do putStrLn $ "traceBuilder " ++ show (op, ope) ++ ": " ++ msg k br
131
false
true
0
13
39
74
37
37
null
null
FunPixCode/fungl
src/Graphics/FunGL/Render.hs
bsd-3-clause
-- | render triangles drawArrays :: Int -> IO () drawArrays n = glDrawArrays GL_TRIANGLES 0 (fromIntegral n)
108
drawArrays :: Int -> IO () drawArrays n = glDrawArrays GL_TRIANGLES 0 (fromIntegral n)
86
drawArrays n = glDrawArrays GL_TRIANGLES 0 (fromIntegral n)
59
true
true
0
7
17
37
18
19
null
null
bitemyapp/kbnlp.hs
OpenCalais.hs
agpl-3.0
baseParams = "<c:params xmlns:c=\"http://s.opencalais.com/1/pred/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"><c:processingDirectives c:contentType=\"text/txt\" c:outputFormat=\"xml/rdf\"></c:processingDirectives><c:userDirectives c:allowDistribution=\"true\" c:allowSearch=\"true\" c:externalID=\"17cabs901\" c:submitter=\"ABC\"></c:userDirectives><c:externalMetadata></c:externalMetadata></c:params>"
418
baseParams = "<c:params xmlns:c=\"http://s.opencalais.com/1/pred/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"><c:processingDirectives c:contentType=\"text/txt\" c:outputFormat=\"xml/rdf\"></c:processingDirectives><c:userDirectives c:allowDistribution=\"true\" c:allowSearch=\"true\" c:externalID=\"17cabs901\" c:submitter=\"ABC\"></c:userDirectives><c:externalMetadata></c:externalMetadata></c:params>"
418
baseParams = "<c:params xmlns:c=\"http://s.opencalais.com/1/pred/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"><c:processingDirectives c:contentType=\"text/txt\" c:outputFormat=\"xml/rdf\"></c:processingDirectives><c:userDirectives c:allowDistribution=\"true\" c:allowSearch=\"true\" c:externalID=\"17cabs901\" c:submitter=\"ABC\"></c:userDirectives><c:externalMetadata></c:externalMetadata></c:params>"
418
false
false
0
4
10
6
3
3
null
null
sherwoodwang/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/Events.hs
lgpl-2.1
-- | Get the current context menu event handler. windowGetOnContextMenu :: Window a -> IO (IO ()) windowGetOnContextMenu window = unsafeWindowGetHandlerState window wxEVT_CONTEXT_MENU skipCurrentEvent
202
windowGetOnContextMenu :: Window a -> IO (IO ()) windowGetOnContextMenu window = unsafeWindowGetHandlerState window wxEVT_CONTEXT_MENU skipCurrentEvent
153
windowGetOnContextMenu window = unsafeWindowGetHandlerState window wxEVT_CONTEXT_MENU skipCurrentEvent
104
true
true
0
9
25
40
19
21
null
null
olsner/m3
Main.hs
bsd-3-clause
tryImportModule name path = do let modPath = addExtension (path </> nameToPath name) ".m" --printf "tryImportModule: %s: Trying %s\n" (show name) modPath e <- doesFileExist modPath if e then Just <$> parse modPath else return Nothing
241
tryImportModule name path = do let modPath = addExtension (path </> nameToPath name) ".m" --printf "tryImportModule: %s: Trying %s\n" (show name) modPath e <- doesFileExist modPath if e then Just <$> parse modPath else return Nothing
241
tryImportModule name path = do let modPath = addExtension (path </> nameToPath name) ".m" --printf "tryImportModule: %s: Trying %s\n" (show name) modPath e <- doesFileExist modPath if e then Just <$> parse modPath else return Nothing
241
false
false
0
13
43
67
31
36
null
null
paolino/metronome
Control/Concurrent/STMOrIO.hs
bsd-3-clause
md :: (Monad m, RW m z) => z a -> (a -> a) -> m () md x f = rd x >>= \y -> wr x (f y)
85
md :: (Monad m, RW m z) => z a -> (a -> a) -> m () md x f = rd x >>= \y -> wr x (f y)
85
md x f = rd x >>= \y -> wr x (f y)
34
false
true
0
9
29
79
39
40
null
null
plaimi/authochan
test/Authochan/Tests/Message.hs
agpl-3.0
propIntegrity :: Gen Property propIntegrity = do c <- genClient m <- suchThat (genMessage c) $ \x -> smNonce x > clientNonce c m' <- mutateMessage m return $ m /= m' ==> verifyMessage c m' === Nothing
210
propIntegrity :: Gen Property propIntegrity = do c <- genClient m <- suchThat (genMessage c) $ \x -> smNonce x > clientNonce c m' <- mutateMessage m return $ m /= m' ==> verifyMessage c m' === Nothing
210
propIntegrity = do c <- genClient m <- suchThat (genMessage c) $ \x -> smNonce x > clientNonce c m' <- mutateMessage m return $ m /= m' ==> verifyMessage c m' === Nothing
180
false
true
0
11
47
90
41
49
null
null
Alxandr/Phidoc
test/Main.hs
bsd-3-clause
tests :: Test tests = test [ "resolve tests" ~: resolveTests , "walk tests" ~: walkTests , "rewrite tests" ~: rewriteTests ]
137
tests :: Test tests = test [ "resolve tests" ~: resolveTests , "walk tests" ~: walkTests , "rewrite tests" ~: rewriteTests ]
137
tests = test [ "resolve tests" ~: resolveTests , "walk tests" ~: walkTests , "rewrite tests" ~: rewriteTests ]
123
false
true
0
7
34
35
19
16
null
null
dlewissandy/lambda-blas
test/Foreign.hs
bsd-3-clause
srotg_unsafe = rotgHelper srotg_unsafe_
39
srotg_unsafe = rotgHelper srotg_unsafe_
39
srotg_unsafe = rotgHelper srotg_unsafe_
39
false
false
1
5
3
13
4
9
null
null
yuto-matsum/googlecodejam2016-hs
src/q1a/A.hs
bsd-3-clause
{-| >>> addPrefixes ["A","B","C"] ["Case #1: A","Case #2: B","Case #3: C"] -} addPrefixes :: [String] -> [String] addPrefixes = zipWith addPrefix [1..] where addPrefix :: Int -> String -> String addPrefix i s = "Case #" ++ show i ++ ": " ++ s {-| >>> solve "CAB" "CAB" >>> solve "JAM" "MJA" >>> solve "CODE" "OCDE" >>> solve "ABAAB" "BBAAA" >>> solve "CABCBBABC" "CCCABBBAB" >>> solve "ABCABCABC" "CCCBAABAB" >>> solve "ZXCASDQWE" "ZXCASDQWE" -}
450
addPrefixes :: [String] -> [String] addPrefixes = zipWith addPrefix [1..] where addPrefix :: Int -> String -> String addPrefix i s = "Case #" ++ show i ++ ": " ++ s {-| >>> solve "CAB" "CAB" >>> solve "JAM" "MJA" >>> solve "CODE" "OCDE" >>> solve "ABAAB" "BBAAA" >>> solve "CABCBBABC" "CCCABBBAB" >>> solve "ABCABCABC" "CCCBAABAB" >>> solve "ZXCASDQWE" "ZXCASDQWE" -}
372
addPrefixes = zipWith addPrefix [1..] where addPrefix :: Int -> String -> String addPrefix i s = "Case #" ++ show i ++ ": " ++ s {-| >>> solve "CAB" "CAB" >>> solve "JAM" "MJA" >>> solve "CODE" "OCDE" >>> solve "ABAAB" "BBAAA" >>> solve "CABCBBABC" "CCCABBBAB" >>> solve "ABCABCABC" "CCCBAABAB" >>> solve "ZXCASDQWE" "ZXCASDQWE" -}
336
true
true
0
10
78
78
39
39
null
null
Oscarzhao/haskell
functional_program_design/ch05/sudoku_v1.hs
apache-2.0
choices :: Grid -> Matrix [Digit] choices m = zipWith rowCandidate [0..] m where candidate idxR idxC y = if blank y then (digits \\ (union (union (exR!!idxR) (exC!!idxC)) (exB!!(unitNum idxR idxC))) ) else [y] rowCandidate idxR xs = zipWith (candidate idxR) [0..] xs (exR, exC, exB) = exclude m
342
choices :: Grid -> Matrix [Digit] choices m = zipWith rowCandidate [0..] m where candidate idxR idxC y = if blank y then (digits \\ (union (union (exR!!idxR) (exC!!idxC)) (exB!!(unitNum idxR idxC))) ) else [y] rowCandidate idxR xs = zipWith (candidate idxR) [0..] xs (exR, exC, exB) = exclude m
342
choices m = zipWith rowCandidate [0..] m where candidate idxR idxC y = if blank y then (digits \\ (union (union (exR!!idxR) (exC!!idxC)) (exB!!(unitNum idxR idxC))) ) else [y] rowCandidate idxR xs = zipWith (candidate idxR) [0..] xs (exR, exC, exB) = exclude m
308
false
true
0
13
97
168
84
84
null
null
FranklinChen/hugs98-plus-Sep2006
packages/base/Data/ByteString/Lazy.hs
bsd-3-clause
count :: Word8 -> ByteString -> Int64 count w (LPS xs) = L.foldl' (\n ps -> n + fromIntegral (P.count w ps)) 0 xs
113
count :: Word8 -> ByteString -> Int64 count w (LPS xs) = L.foldl' (\n ps -> n + fromIntegral (P.count w ps)) 0 xs
113
count w (LPS xs) = L.foldl' (\n ps -> n + fromIntegral (P.count w ps)) 0 xs
75
false
true
0
12
23
71
34
37
null
null
Motions/motions
src/Bio/Motions/Format/DumpDeserialisation.hs
apache-2.0
readPosition :: Point -> Maybe Vec3 readPosition Point{..} = do [x', y', z'] <- mapM (fmap fromIntegral) [x, y, z] return $ V3 x' y' z'
143
readPosition :: Point -> Maybe Vec3 readPosition Point{..} = do [x', y', z'] <- mapM (fmap fromIntegral) [x, y, z] return $ V3 x' y' z'
143
readPosition Point{..} = do [x', y', z'] <- mapM (fmap fromIntegral) [x, y, z] return $ V3 x' y' z'
107
false
true
0
10
33
77
39
38
null
null
urbanslug/ghc
testsuite/tests/perf/compiler/T783.hs
bsd-3-clause
foo x | x == 169 = 169
22
foo x | x == 169 = 169
22
foo x | x == 169 = 169
22
false
false
0
8
7
23
9
14
null
null
apyrgio/snf-ganeti
src/Ganeti/HTools/Backend/Luxi.hs
bsd-2-clause
-- * Utility functions -- | Get values behind \"data\" part of the result. getData :: (Monad m) => JSValue -> m JSValue getData (JSObject o) = fromObj (fromJSObject o) "data"
175
getData :: (Monad m) => JSValue -> m JSValue getData (JSObject o) = fromObj (fromJSObject o) "data"
99
getData (JSObject o) = fromObj (fromJSObject o) "data"
54
true
true
0
7
31
53
26
27
null
null
nbloomf/feivel
src/Feivel/Parse/Tuple.hs
gpl-3.0
pTupleLiteral :: [Type] -> (Type -> ParseM Expr) -> ParseM TupleExpr pTupleLiteral typs pE = fmap TupleExpr $ pAtLocus $ pTupleLiteralOf typs pE
144
pTupleLiteral :: [Type] -> (Type -> ParseM Expr) -> ParseM TupleExpr pTupleLiteral typs pE = fmap TupleExpr $ pAtLocus $ pTupleLiteralOf typs pE
144
pTupleLiteral typs pE = fmap TupleExpr $ pAtLocus $ pTupleLiteralOf typs pE
75
false
true
0
9
22
56
27
29
null
null
kawu/crf-chain1
src/Data/CRF/Chain1/Inference.hs
bsd-2-clause
forward :: AccF -> Model -> Xs -> ProbArray forward acc crf sent = DP.flexible2 (0, V.length sent) wordBounds (\t k -> withMem (computePsi crf sent k) t k) where wordBounds k | k == V.length sent = (Lb 0, Lb 0) | otherwise = (Lb 0, Lb $ lbNum crf - 1) -- | Forward table equation, where k is current position, x is a label -- on current position and psi is a psi table computed for current -- position. -- FIXME: null sentence? withMem psi alpha k x | k == 0 = psi x * sgValue crf x | k == V.length sent = acc [ alpha (k - 1) y | y <- lbSet crf ] | otherwise = acc [ alpha (k - 1) y * psi x * valueL crf ix | (y, ix) <- prevIxs crf x ] -- | Backward table computation.
792
forward :: AccF -> Model -> Xs -> ProbArray forward acc crf sent = DP.flexible2 (0, V.length sent) wordBounds (\t k -> withMem (computePsi crf sent k) t k) where wordBounds k | k == V.length sent = (Lb 0, Lb 0) | otherwise = (Lb 0, Lb $ lbNum crf - 1) -- | Forward table equation, where k is current position, x is a label -- on current position and psi is a psi table computed for current -- position. -- FIXME: null sentence? withMem psi alpha k x | k == 0 = psi x * sgValue crf x | k == V.length sent = acc [ alpha (k - 1) y | y <- lbSet crf ] | otherwise = acc [ alpha (k - 1) y * psi x * valueL crf ix | (y, ix) <- prevIxs crf x ] -- | Backward table computation.
792
forward acc crf sent = DP.flexible2 (0, V.length sent) wordBounds (\t k -> withMem (computePsi crf sent k) t k) where wordBounds k | k == V.length sent = (Lb 0, Lb 0) | otherwise = (Lb 0, Lb $ lbNum crf - 1) -- | Forward table equation, where k is current position, x is a label -- on current position and psi is a psi table computed for current -- position. -- FIXME: null sentence? withMem psi alpha k x | k == 0 = psi x * sgValue crf x | k == V.length sent = acc [ alpha (k - 1) y | y <- lbSet crf ] | otherwise = acc [ alpha (k - 1) y * psi x * valueL crf ix | (y, ix) <- prevIxs crf x ] -- | Backward table computation.
748
false
true
0
12
274
296
143
153
null
null
tjakway/ghcjvm
compiler/main/DriverPipeline.hs
bsd-3-clause
haveRtsOptsFlags :: DynFlags -> Bool haveRtsOptsFlags dflags = isJust (rtsOpts dflags) || case rtsOptsEnabled dflags of RtsOptsSafeOnly -> False _ -> True -- | Find out path to @ghcversion.h@ file
286
haveRtsOptsFlags :: DynFlags -> Bool haveRtsOptsFlags dflags = isJust (rtsOpts dflags) || case rtsOptsEnabled dflags of RtsOptsSafeOnly -> False _ -> True -- | Find out path to @ghcversion.h@ file
286
haveRtsOptsFlags dflags = isJust (rtsOpts dflags) || case rtsOptsEnabled dflags of RtsOptsSafeOnly -> False _ -> True -- | Find out path to @ghcversion.h@ file
249
false
true
0
8
119
51
25
26
null
null
fiigii/control-flow
ControlFlow.hs
mit
buildResult (Conditional t p p1 p2 : cs) d w= if t `member` findD p d then let (d', w') = add p2 (findD p1 d) d w in buildResult cs d' w' else buildResult cs d w
174
buildResult (Conditional t p p1 p2 : cs) d w= if t `member` findD p d then let (d', w') = add p2 (findD p1 d) d w in buildResult cs d' w' else buildResult cs d w
174
buildResult (Conditional t p p1 p2 : cs) d w= if t `member` findD p d then let (d', w') = add p2 (findD p1 d) d w in buildResult cs d' w' else buildResult cs d w
174
false
false
0
12
50
97
48
49
null
null
dermesser/Brainfuch
BFdbg.hs
mit
showStacks :: [StackCode] -> String showStacks stacks = foldl1 (\a e -> a ++ "\n" ++ e) stackstrings where stackstrings = map showStack stacks
146
showStacks :: [StackCode] -> String showStacks stacks = foldl1 (\a e -> a ++ "\n" ++ e) stackstrings where stackstrings = map showStack stacks
146
showStacks stacks = foldl1 (\a e -> a ++ "\n" ++ e) stackstrings where stackstrings = map showStack stacks
110
false
true
0
9
27
57
29
28
null
null
realli/chatqy
src/Qy/Chat/Internal.hs
mit
kickClientOutOfRoom :: Client -> Room -> STM () kickClientOutOfRoom client@Client{..} room@Room{..} = do roomSet <- readTVar clientRooms let newRoomSet = Set.delete room roomSet writeTVar clientRooms newRoomSet -- cache all room's Tchan as a flat list writeTVar clientRoomChans $ P.map getRoomChan $ Set.toAscList newRoomSet modifyTVar roomClients $ Set.delete client
391
kickClientOutOfRoom :: Client -> Room -> STM () kickClientOutOfRoom client@Client{..} room@Room{..} = do roomSet <- readTVar clientRooms let newRoomSet = Set.delete room roomSet writeTVar clientRooms newRoomSet -- cache all room's Tchan as a flat list writeTVar clientRoomChans $ P.map getRoomChan $ Set.toAscList newRoomSet modifyTVar roomClients $ Set.delete client
391
kickClientOutOfRoom client@Client{..} room@Room{..} = do roomSet <- readTVar clientRooms let newRoomSet = Set.delete room roomSet writeTVar clientRooms newRoomSet -- cache all room's Tchan as a flat list writeTVar clientRoomChans $ P.map getRoomChan $ Set.toAscList newRoomSet modifyTVar roomClients $ Set.delete client
343
false
true
0
11
71
121
55
66
null
null
EFulmer/haskell-scheme-wikibook
src/Exercises/Ch2/Pt2/Base.hs
bsd-3-clause
-- End Lisp parsing functions. -- Start recursive parsers: parseList :: Parser LispVal parseList = liftM List $ sepBy parseExpr spaces
136
parseList :: Parser LispVal parseList = liftM List $ sepBy parseExpr spaces
75
parseList = liftM List $ sepBy parseExpr spaces
47
true
true
2
6
22
34
15
19
null
null
rahulmutt/ghcvm
compiler/Eta/Prelude/PrelNames.hs
bsd-3-clause
appendIdKey = mkPreludeMiscIdUnique 3
56
appendIdKey = mkPreludeMiscIdUnique 3
56
appendIdKey = mkPreludeMiscIdUnique 3
56
false
false
0
5
22
9
4
5
null
null
ben-schulz/Idris-dev
src/Idris/Reflection.hs
bsd-3-clause
reifyApp ist t [errs] | t == reflm "Fail" = fmap TFail (reifyReportParts errs)
91
reifyApp ist t [errs] | t == reflm "Fail" = fmap TFail (reifyReportParts errs)
91
reifyApp ist t [errs] | t == reflm "Fail" = fmap TFail (reifyReportParts errs)
91
false
false
0
9
26
40
18
22
null
null
Noeda/rwpas
src/RWPAS/Control/ControlMonad.hs
mit
leaveCorpse :: ControlActorMonad s m => ItemAppearance -> Text -> m () leaveCorpse appearance corpse_name = do coords <- myCoordinates ac <- myActor world.itemAt coords .= Just (sentinelItem (corpse_name <> " corpse") & itemAppearance .~ appearance) world.actorAt coords .= Nothing emitMessage $ ac^.actorName <> " is DEAD, R.I.P."
372
leaveCorpse :: ControlActorMonad s m => ItemAppearance -> Text -> m () leaveCorpse appearance corpse_name = do coords <- myCoordinates ac <- myActor world.itemAt coords .= Just (sentinelItem (corpse_name <> " corpse") & itemAppearance .~ appearance) world.actorAt coords .= Nothing emitMessage $ ac^.actorName <> " is DEAD, R.I.P."
372
leaveCorpse appearance corpse_name = do coords <- myCoordinates ac <- myActor world.itemAt coords .= Just (sentinelItem (corpse_name <> " corpse") & itemAppearance .~ appearance) world.actorAt coords .= Nothing emitMessage $ ac^.actorName <> " is DEAD, R.I.P."
301
false
true
0
14
88
115
53
62
null
null
CarstenKoenig/YouVote
src/server/Application.hs
bsd-3-clause
getPollStatHandler :: (MonadError ServantErr m, Poll.InterpretRepository m) => PollId -> m PollStat getPollStatHandler pId = do found <- Poll.interpret $ Poll.loadPollStats pId case found of Right poll -> pure poll Left err -> throwError (badRequest $ BSL.pack err) where badRequest err = err400 { errBody = err }
352
getPollStatHandler :: (MonadError ServantErr m, Poll.InterpretRepository m) => PollId -> m PollStat getPollStatHandler pId = do found <- Poll.interpret $ Poll.loadPollStats pId case found of Right poll -> pure poll Left err -> throwError (badRequest $ BSL.pack err) where badRequest err = err400 { errBody = err }
352
getPollStatHandler pId = do found <- Poll.interpret $ Poll.loadPollStats pId case found of Right poll -> pure poll Left err -> throwError (badRequest $ BSL.pack err) where badRequest err = err400 { errBody = err }
237
false
true
0
14
86
119
57
62
null
null
adinapoli/Shelly.hs
src/Shelly/Base.hs
bsd-3-clause
toTextIgnore :: FilePath -> Text toTextIgnore fp = case FP.toText fp of Left f -> f Right f -> f -- | a print lifted into 'Sh'
168
toTextIgnore :: FilePath -> Text toTextIgnore fp = case FP.toText fp of Left f -> f Right f -> f -- | a print lifted into 'Sh'
168
toTextIgnore fp = case FP.toText fp of Left f -> f Right f -> f -- | a print lifted into 'Sh'
135
false
true
0
8
68
52
23
29
null
null
sdiehl/ghc
compiler/basicTypes/RdrName.hs
bsd-3-clause
mkGlobalRdrEnv :: [GlobalRdrElt] -> GlobalRdrEnv mkGlobalRdrEnv gres = foldr add emptyGlobalRdrEnv gres where add gre env = extendOccEnv_Acc insertGRE singleton env (greOccName gre) gre
263
mkGlobalRdrEnv :: [GlobalRdrElt] -> GlobalRdrEnv mkGlobalRdrEnv gres = foldr add emptyGlobalRdrEnv gres where add gre env = extendOccEnv_Acc insertGRE singleton env (greOccName gre) gre
263
mkGlobalRdrEnv gres = foldr add emptyGlobalRdrEnv gres where add gre env = extendOccEnv_Acc insertGRE singleton env (greOccName gre) gre
214
false
true
0
7
101
58
28
30
null
null
ghc-android/ghc
testsuite/tests/ghci/should_run/ghcirun004.hs
bsd-3-clause
3157 = 3156
11
3157 = 3156
11
3157 = 3156
11
false
false
1
5
2
10
3
7
null
null
mydaum/cabal
Cabal/Distribution/Simple/Command.hs
bsd-3-clause
viewAsFieldDescr :: OptionField a -> FieldDescr a viewAsFieldDescr (OptionField _n []) = error "Distribution.command.viewAsFieldDescr: unexpected"
148
viewAsFieldDescr :: OptionField a -> FieldDescr a viewAsFieldDescr (OptionField _n []) = error "Distribution.command.viewAsFieldDescr: unexpected"
148
viewAsFieldDescr (OptionField _n []) = error "Distribution.command.viewAsFieldDescr: unexpected"
98
false
true
0
8
16
37
17
20
null
null
brendanhay/gogol
gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs
mpl-2.0
-- | Id of the Repricing rule for this report. rrrRuleId :: Lens' RepricingRuleReport (Maybe Text) rrrRuleId = lens _rrrRuleId (\ s a -> s{_rrrRuleId = a})
157
rrrRuleId :: Lens' RepricingRuleReport (Maybe Text) rrrRuleId = lens _rrrRuleId (\ s a -> s{_rrrRuleId = a})
110
rrrRuleId = lens _rrrRuleId (\ s a -> s{_rrrRuleId = a})
58
true
true
0
9
28
48
25
23
null
null
RossMeikleham/Idris-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
mapPTermFC f g (PType fc) = PType (f fc)
40
mapPTermFC f g (PType fc) = PType (f fc)
40
mapPTermFC f g (PType fc) = PType (f fc)
40
false
false
0
7
8
28
13
15
null
null
kailuowang/Tenjin
back-end/Application.hs
mit
develMain :: IO () develMain = develMainHelper getApplicationDev
64
develMain :: IO () develMain = develMainHelper getApplicationDev
64
develMain = develMainHelper getApplicationDev
45
false
true
0
7
7
25
10
15
null
null
brendanhay/gogol
gogol-serviceconsumermanagement/gen/Network/Google/ServiceConsumerManagement/Types/Product.hs
mpl-2.0
-- | Creates a value of 'HTTPRule' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'httprSelector' -- -- * 'httprPost' -- -- * 'httprBody' -- -- * 'httprCustom' -- -- * 'httprResponseBody' -- -- * 'httprPatch' -- -- * 'httprGet' -- -- * 'httprAdditionalBindings' -- -- * 'httprDelete' -- -- * 'httprPut' hTTPRule :: HTTPRule hTTPRule = HTTPRule' { _httprSelector = Nothing , _httprPost = Nothing , _httprBody = Nothing , _httprCustom = Nothing , _httprResponseBody = Nothing , _httprPatch = Nothing , _httprGet = Nothing , _httprAdditionalBindings = Nothing , _httprDelete = Nothing , _httprPut = Nothing }
741
hTTPRule :: HTTPRule hTTPRule = HTTPRule' { _httprSelector = Nothing , _httprPost = Nothing , _httprBody = Nothing , _httprCustom = Nothing , _httprResponseBody = Nothing , _httprPatch = Nothing , _httprGet = Nothing , _httprAdditionalBindings = Nothing , _httprDelete = Nothing , _httprPut = Nothing }
352
hTTPRule = HTTPRule' { _httprSelector = Nothing , _httprPost = Nothing , _httprBody = Nothing , _httprCustom = Nothing , _httprResponseBody = Nothing , _httprPatch = Nothing , _httprGet = Nothing , _httprAdditionalBindings = Nothing , _httprDelete = Nothing , _httprPut = Nothing }
327
true
true
0
6
166
96
70
26
null
null
apyrgio/snf-ganeti
test/hs/Test/Ganeti/TestCommon.hs
bsd-2-clause
-- | Computes the relative error of two 'Double' numbers. -- -- This is the \"relative error\" algorithm in -- http:\/\/randomascii.wordpress.com\/2012\/02\/25\/ -- comparing-floating-point-numbers-2012-edition (URL split due to too -- long line). relativeError :: Double -> Double -> Double relativeError d1 d2 = let delta = abs $ d1 - d2 a1 = abs d1 a2 = abs d2 greatest = max a1 a2 in if delta == 0 then 0 else delta / greatest
466
relativeError :: Double -> Double -> Double relativeError d1 d2 = let delta = abs $ d1 - d2 a1 = abs d1 a2 = abs d2 greatest = max a1 a2 in if delta == 0 then 0 else delta / greatest
218
relativeError d1 d2 = let delta = abs $ d1 - d2 a1 = abs d1 a2 = abs d2 greatest = max a1 a2 in if delta == 0 then 0 else delta / greatest
174
true
true
2
10
109
97
50
47
null
null
gcampax/ghc
compiler/prelude/TysPrim.hs
bsd-3-clause
{- ************************************************************************ * * FunTyCon * * ************************************************************************ -} funTyConName :: Name funTyConName = mkPrimTyConName (fsLit "(->)") funTyConKey funTyCon
411
funTyConName :: Name funTyConName = mkPrimTyConName (fsLit "(->)") funTyConKey funTyCon
87
funTyConName = mkPrimTyConName (fsLit "(->)") funTyConKey funTyCon
66
true
true
0
7
173
31
14
17
null
null
tjakway/ghcjvm
compiler/types/InstEnv.hs
bsd-3-clause
pprInstanceHdr :: ClsInst -> SDoc -- Prints the ClsInst as an instance declaration pprInstanceHdr (ClsInst { is_flag = flag, is_dfun = dfun }) = text "instance" <+> ppr flag <+> pprSigmaType (idType dfun)
206
pprInstanceHdr :: ClsInst -> SDoc pprInstanceHdr (ClsInst { is_flag = flag, is_dfun = dfun }) = text "instance" <+> ppr flag <+> pprSigmaType (idType dfun)
157
pprInstanceHdr (ClsInst { is_flag = flag, is_dfun = dfun }) = text "instance" <+> ppr flag <+> pprSigmaType (idType dfun)
123
true
true
2
8
34
65
32
33
null
null
spechub/Hets
GUI/ShowLibGraph.hs
gpl-2.0
-- | Reloads all Libraries and the Library Dependency Graph reloadLibGraph' :: GInfo -> IORef DaVinciGraphTypeSyn -> IORef NodeEdgeList -> IO () reloadLibGraph' gi graph nodesEdges = do graph' <- readIORef graph (nodes, edges) <- readIORef nodesEdges let ln = libName gi libfile = libNameToFile ln m <- anaLib (hetcatsOpts gi) { outtypes = [] } libfile case m of Nothing -> errorDialog "Error" $ "Error when reloading file '" ++ libfile ++ "'" Just (_, le) -> do closeOpenWindows gi mapM_ (deleteArc graph') edges mapM_ (deleteNode graph') nodes addNodesAndEdges gi graph graph' nodesEdges writeIORef (intState gi) emptyIntState { i_state = Just $ emptyIntIState le ln , filename = libfile } mShowGraph gi ln
855
reloadLibGraph' :: GInfo -> IORef DaVinciGraphTypeSyn -> IORef NodeEdgeList -> IO () reloadLibGraph' gi graph nodesEdges = do graph' <- readIORef graph (nodes, edges) <- readIORef nodesEdges let ln = libName gi libfile = libNameToFile ln m <- anaLib (hetcatsOpts gi) { outtypes = [] } libfile case m of Nothing -> errorDialog "Error" $ "Error when reloading file '" ++ libfile ++ "'" Just (_, le) -> do closeOpenWindows gi mapM_ (deleteArc graph') edges mapM_ (deleteNode graph') nodes addNodesAndEdges gi graph graph' nodesEdges writeIORef (intState gi) emptyIntState { i_state = Just $ emptyIntIState le ln , filename = libfile } mShowGraph gi ln
795
reloadLibGraph' gi graph nodesEdges = do graph' <- readIORef graph (nodes, edges) <- readIORef nodesEdges let ln = libName gi libfile = libNameToFile ln m <- anaLib (hetcatsOpts gi) { outtypes = [] } libfile case m of Nothing -> errorDialog "Error" $ "Error when reloading file '" ++ libfile ++ "'" Just (_, le) -> do closeOpenWindows gi mapM_ (deleteArc graph') edges mapM_ (deleteNode graph') nodes addNodesAndEdges gi graph graph' nodesEdges writeIORef (intState gi) emptyIntState { i_state = Just $ emptyIntIState le ln , filename = libfile } mShowGraph gi ln
694
true
true
0
16
260
250
117
133
null
null
rueshyna/gogol
gogol-sheets/gen/Network/Google/Sheets/Types/Product.hs
mpl-2.0
-- | Creates a value of 'BatchUpdateValuesResponse' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'buvrTotalUpdatedColumns' -- -- * 'buvrResponses' -- -- * 'buvrSpreadsheetId' -- -- * 'buvrTotalUpdatedSheets' -- -- * 'buvrTotalUpdatedCells' -- -- * 'buvrTotalUpdatedRows' batchUpdateValuesResponse :: BatchUpdateValuesResponse batchUpdateValuesResponse = BatchUpdateValuesResponse' { _buvrTotalUpdatedColumns = Nothing , _buvrResponses = Nothing , _buvrSpreadsheetId = Nothing , _buvrTotalUpdatedSheets = Nothing , _buvrTotalUpdatedCells = Nothing , _buvrTotalUpdatedRows = Nothing }
706
batchUpdateValuesResponse :: BatchUpdateValuesResponse batchUpdateValuesResponse = BatchUpdateValuesResponse' { _buvrTotalUpdatedColumns = Nothing , _buvrResponses = Nothing , _buvrSpreadsheetId = Nothing , _buvrTotalUpdatedSheets = Nothing , _buvrTotalUpdatedCells = Nothing , _buvrTotalUpdatedRows = Nothing }
347
batchUpdateValuesResponse = BatchUpdateValuesResponse' { _buvrTotalUpdatedColumns = Nothing , _buvrResponses = Nothing , _buvrSpreadsheetId = Nothing , _buvrTotalUpdatedSheets = Nothing , _buvrTotalUpdatedCells = Nothing , _buvrTotalUpdatedRows = Nothing }
288
true
true
1
7
120
71
47
24
null
null
taktoa/TSBot
library/Web/TSBot/ClientQuery/Response.hs
mit
-- | Update a CQR with a new value insert :: AName -> CQValue -> CQR -> CQR insert a v (CQR m) = CQR $ M.insert a v m
117
insert :: AName -> CQValue -> CQR -> CQR insert a v (CQR m) = CQR $ M.insert a v m
82
insert a v (CQR m) = CQR $ M.insert a v m
41
true
true
0
7
29
54
26
28
null
null
mathk/arm-isa
Arm/Core.hs
mit
nextBlocksFromInstruction state ArmInstr {blockOffset=off, cond=Uncond, args=(BranchArgs imm)} = [fromIntegral imm + nextPc off state]
134
nextBlocksFromInstruction state ArmInstr {blockOffset=off, cond=Uncond, args=(BranchArgs imm)} = [fromIntegral imm + nextPc off state]
134
nextBlocksFromInstruction state ArmInstr {blockOffset=off, cond=Uncond, args=(BranchArgs imm)} = [fromIntegral imm + nextPc off state]
134
false
false
0
10
13
54
28
26
null
null
WraithM/peertrader-backend
src/PeerTrader/Route/User.hs
bsd-3-clause
handleCheckTerms :: AppHandler () handleCheckTerms = method GET getCheckTerms <|> method POST setCheckTerms where setCheckTerms = withCurrentUser $ \n -> do -- TODO Just pattern Just checkTerm <- getParam "checkTerms" A.setCheckTerms n (readCheckTerm checkTerm) readCheckTerm "false" = False readCheckTerm "true" = True readCheckTerm _ = True getCheckTerms = withCurrentUser_ $ \n -> do Just terms <- A.getCheckTerms n writeJSON $ object [ "checkTerms" .= terms ] -- | This handler requires the user to be logged in. -- There is no database cost to this proceedure. This only requires -- that the username be in the session. -- TODO Perhaps should throw a 401 Unauthorized here.
743
handleCheckTerms :: AppHandler () handleCheckTerms = method GET getCheckTerms <|> method POST setCheckTerms where setCheckTerms = withCurrentUser $ \n -> do -- TODO Just pattern Just checkTerm <- getParam "checkTerms" A.setCheckTerms n (readCheckTerm checkTerm) readCheckTerm "false" = False readCheckTerm "true" = True readCheckTerm _ = True getCheckTerms = withCurrentUser_ $ \n -> do Just terms <- A.getCheckTerms n writeJSON $ object [ "checkTerms" .= terms ] -- | This handler requires the user to be logged in. -- There is no database cost to this proceedure. This only requires -- that the username be in the session. -- TODO Perhaps should throw a 401 Unauthorized here.
743
handleCheckTerms = method GET getCheckTerms <|> method POST setCheckTerms where setCheckTerms = withCurrentUser $ \n -> do -- TODO Just pattern Just checkTerm <- getParam "checkTerms" A.setCheckTerms n (readCheckTerm checkTerm) readCheckTerm "false" = False readCheckTerm "true" = True readCheckTerm _ = True getCheckTerms = withCurrentUser_ $ \n -> do Just terms <- A.getCheckTerms n writeJSON $ object [ "checkTerms" .= terms ] -- | This handler requires the user to be logged in. -- There is no database cost to this proceedure. This only requires -- that the username be in the session. -- TODO Perhaps should throw a 401 Unauthorized here.
709
false
true
0
12
170
151
74
77
null
null
gridaphobe/cabal
cabal-install/Distribution/Client/Setup.hs
bsd-3-clause
buildExOptions :: ShowOrParseArgs -> [OptionField BuildExFlags] buildExOptions _showOrParseArgs = option [] ["only"] "Don't reinstall add-source dependencies (sandbox-only)" buildOnly (\v flags -> flags { buildOnly = v }) (noArg (Flag SkipAddSourceDepsCheck)) : []
275
buildExOptions :: ShowOrParseArgs -> [OptionField BuildExFlags] buildExOptions _showOrParseArgs = option [] ["only"] "Don't reinstall add-source dependencies (sandbox-only)" buildOnly (\v flags -> flags { buildOnly = v }) (noArg (Flag SkipAddSourceDepsCheck)) : []
275
buildExOptions _showOrParseArgs = option [] ["only"] "Don't reinstall add-source dependencies (sandbox-only)" buildOnly (\v flags -> flags { buildOnly = v }) (noArg (Flag SkipAddSourceDepsCheck)) : []
211
false
true
2
8
42
88
42
46
null
null
sboosali/commands
commands-core/sources/Commands/RHS/Derived.hs
mit
-- TODO take the traversal from either the non-terminal or the functor into the right-hand side again. finds any hidden children right-hand sides. -- TODO always terminates, even on recursive grammars getTerminals' :: (Eq t) => (forall x. n t f x -> [t] -> [t]) -> (forall x. f x -> [t]) -> RHS n t f a -> [t] getTerminals' fromN fromF = List.nub . foldRHS' fromN (:[]) fromF [] [] (<>) concat id id id
420
getTerminals' :: (Eq t) => (forall x. n t f x -> [t] -> [t]) -> (forall x. f x -> [t]) -> RHS n t f a -> [t] getTerminals' fromN fromF = List.nub . foldRHS' fromN (:[]) fromF [] [] (<>) concat id id id
217
getTerminals' fromN fromF = List.nub . foldRHS' fromN (:[]) fromF [] [] (<>) concat id id id
94
true
true
1
12
95
143
75
68
null
null
shayan-najd/MiniLava
Lava/Library/Patterns.hs
bsd-3-clause
parl :: ([a] -> [b]) -> ([a] -> [b]) -> [a] -> [b] parl circ1 circ2 = halveList ->- (circ1 -|- circ2) ->- append
112
parl :: ([a] -> [b]) -> ([a] -> [b]) -> [a] -> [b] parl circ1 circ2 = halveList ->- (circ1 -|- circ2) ->- append
112
parl circ1 circ2 = halveList ->- (circ1 -|- circ2) ->- append
61
false
true
0
9
23
75
42
33
null
null
Elarnon/npc-gen
Pathfinder/Class.hs
bsd-3-clause
newInstance :: Integer -> ClassInstance newInstance i = ClassInstance { lvl = i }
81
newInstance :: Integer -> ClassInstance newInstance i = ClassInstance { lvl = i }
81
newInstance i = ClassInstance { lvl = i }
41
false
true
0
7
13
35
16
19
null
null
nickbart1980/pandoc
src/Text/Pandoc/Readers/LaTeX.hs
gpl-2.0
breve c = [c]
15
breve c = [c]
15
breve c = [c]
15
false
false
0
5
5
12
6
6
null
null
phischu/fragnix
benchmarks/containers/Data.Sequence.hs
bsd-3-clause
addDigits4 m1 (Four a b c d) e f g h (Two i j) m2 = appendTree4 m1 (node3 a b c) (node3 d e f) (node2 g h) (node2 i j) m2
125
addDigits4 m1 (Four a b c d) e f g h (Two i j) m2 = appendTree4 m1 (node3 a b c) (node3 d e f) (node2 g h) (node2 i j) m2
125
addDigits4 m1 (Four a b c d) e f g h (Two i j) m2 = appendTree4 m1 (node3 a b c) (node3 d e f) (node2 g h) (node2 i j) m2
125
false
false
1
7
36
105
45
60
null
null
mettekou/ghc
compiler/typecheck/TcBinds.hs
bsd-3-clause
tcVect (HsVectTypeOut _ _ _) = panic "TcBinds.tcVect: Unexpected 'HsVectTypeOut'"
83
tcVect (HsVectTypeOut _ _ _) = panic "TcBinds.tcVect: Unexpected 'HsVectTypeOut'"
83
tcVect (HsVectTypeOut _ _ _) = panic "TcBinds.tcVect: Unexpected 'HsVectTypeOut'"
83
false
false
0
6
11
23
10
13
null
null
willdonnelly/dyre
Config/Dyre/Compile.hs
bsd-3-clause
getCabalStoreGhcArgs :: String -> FilePath -> [String] getCabalStoreGhcArgs proj = mkArgs . go . fmap dropTrailingPathSeparator . splitPath where go :: [String] -> Maybe (String {- unit-id -}, [String] {- package-db -}) go (".cabal" : "store" : hc : unit : _) = case splitOn '-' unit of [s, _, _] | s == proj -> Just (unit, [".cabal", "store", hc, "package.db"]) _ -> Nothing go (h : t@(_cabal : _store : _hc : _unit : _)) = fmap (h:) <$> go t go _ = Nothing mkArgs Nothing = [] mkArgs (Just (unitId, pkgDb)) = ["-package-db", joinPath pkgDb, "-package-id", unitId]
616
getCabalStoreGhcArgs :: String -> FilePath -> [String] getCabalStoreGhcArgs proj = mkArgs . go . fmap dropTrailingPathSeparator . splitPath where go :: [String] -> Maybe (String {- unit-id -}, [String] {- package-db -}) go (".cabal" : "store" : hc : unit : _) = case splitOn '-' unit of [s, _, _] | s == proj -> Just (unit, [".cabal", "store", hc, "package.db"]) _ -> Nothing go (h : t@(_cabal : _store : _hc : _unit : _)) = fmap (h:) <$> go t go _ = Nothing mkArgs Nothing = [] mkArgs (Just (unitId, pkgDb)) = ["-package-db", joinPath pkgDb, "-package-id", unitId]
616
getCabalStoreGhcArgs proj = mkArgs . go . fmap dropTrailingPathSeparator . splitPath where go :: [String] -> Maybe (String {- unit-id -}, [String] {- package-db -}) go (".cabal" : "store" : hc : unit : _) = case splitOn '-' unit of [s, _, _] | s == proj -> Just (unit, [".cabal", "store", hc, "package.db"]) _ -> Nothing go (h : t@(_cabal : _store : _hc : _unit : _)) = fmap (h:) <$> go t go _ = Nothing mkArgs Nothing = [] mkArgs (Just (unitId, pkgDb)) = ["-package-db", joinPath pkgDb, "-package-id", unitId]
561
false
true
0
13
151
261
140
121
null
null
rueshyna/gogol
gogol-monitoring/gen/Network/Google/Resource/Monitoring/Projects/CollectdTimeSeries/Create.hs
mpl-2.0
-- | Pretty-print response. pctscPp :: Lens' ProjectsCollectdTimeSeriesCreate Bool pctscPp = lens _pctscPp (\ s a -> s{_pctscPp = a})
133
pctscPp :: Lens' ProjectsCollectdTimeSeriesCreate Bool pctscPp = lens _pctscPp (\ s a -> s{_pctscPp = a})
105
pctscPp = lens _pctscPp (\ s a -> s{_pctscPp = a})
50
true
true
0
9
19
40
22
18
null
null
ezyang/ghc
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
genericWordQuotRemOp :: DynFlags -> GenericOp genericWordQuotRemOp dflags [res_q, res_r] [arg_x, arg_y] = emit $ mkAssign (CmmLocal res_q) (CmmMachOp (MO_U_Quot (wordWidth dflags)) [arg_x, arg_y]) <*> mkAssign (CmmLocal res_r) (CmmMachOp (MO_U_Rem (wordWidth dflags)) [arg_x, arg_y])
331
genericWordQuotRemOp :: DynFlags -> GenericOp genericWordQuotRemOp dflags [res_q, res_r] [arg_x, arg_y] = emit $ mkAssign (CmmLocal res_q) (CmmMachOp (MO_U_Quot (wordWidth dflags)) [arg_x, arg_y]) <*> mkAssign (CmmLocal res_r) (CmmMachOp (MO_U_Rem (wordWidth dflags)) [arg_x, arg_y])
331
genericWordQuotRemOp dflags [res_q, res_r] [arg_x, arg_y] = emit $ mkAssign (CmmLocal res_q) (CmmMachOp (MO_U_Quot (wordWidth dflags)) [arg_x, arg_y]) <*> mkAssign (CmmLocal res_r) (CmmMachOp (MO_U_Rem (wordWidth dflags)) [arg_x, arg_y])
285
false
true
2
11
80
125
62
63
null
null
vincenthz/hs-foundation
basement/Basement/Numerical/Additive.hs
bsd-3-clause
scaleEnum 1 a = a
17
scaleEnum 1 a = a
17
scaleEnum 1 a = a
17
false
false
1
5
4
16
5
11
null
null
olorin/amazonka
amazonka-ec2/gen/Network/AWS/EC2/Types/Product.hs
mpl-2.0
-- | Creates a value of 'AvailabilityZoneMessage' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'azmMessage' availabilityZoneMessage :: AvailabilityZoneMessage availabilityZoneMessage = AvailabilityZoneMessage' { _azmMessage = Nothing }
339
availabilityZoneMessage :: AvailabilityZoneMessage availabilityZoneMessage = AvailabilityZoneMessage' { _azmMessage = Nothing }
143
availabilityZoneMessage = AvailabilityZoneMessage' { _azmMessage = Nothing }
88
true
true
0
6
60
24
16
8
null
null
abailly/hsgames
acquire/src/Acquire/Game/Turn.hs
apache-2.0
possiblePlay (Game _ _ plys _ _ (_, ResolveMerger (DisposeStock _ buyer buyee price (next:_)) _)) = case stockLookup buyee (ownedStock $ plys M.! next) of Nothing -> [Pass] Just n -> Pass : [SellStock next buyee price k | k <- [ 1 .. n ] ] ++ [ExchangeStock next buyer buyee k | k <- [ 1 .. n `div` 2 ] ]
349
possiblePlay (Game _ _ plys _ _ (_, ResolveMerger (DisposeStock _ buyer buyee price (next:_)) _)) = case stockLookup buyee (ownedStock $ plys M.! next) of Nothing -> [Pass] Just n -> Pass : [SellStock next buyee price k | k <- [ 1 .. n ] ] ++ [ExchangeStock next buyer buyee k | k <- [ 1 .. n `div` 2 ] ]
349
possiblePlay (Game _ _ plys _ _ (_, ResolveMerger (DisposeStock _ buyer buyee price (next:_)) _)) = case stockLookup buyee (ownedStock $ plys M.! next) of Nothing -> [Pass] Just n -> Pass : [SellStock next buyee price k | k <- [ 1 .. n ] ] ++ [ExchangeStock next buyer buyee k | k <- [ 1 .. n `div` 2 ] ]
349
false
false
0
13
109
163
85
78
null
null
sgillespie/ghc
compiler/typecheck/TcType.hs
bsd-3-clause
isRigidEqPred _ _ = False
25
isRigidEqPred _ _ = False
25
isRigidEqPred _ _ = False
25
false
false
1
5
4
12
5
7
null
null
thlorenz/WebToInk
webtoink-converter/WebToInk/Converter/ConverterService.hs
bsd-2-clause
main = testConverter
20
main = testConverter
20
main = testConverter
20
false
false
0
4
2
6
3
3
null
null
sdiehl/ghc
testsuite/tests/rename/should_compile/ExplicitForAllRules1.hs
bsd-3-clause
g :: a -> b -> () g _ _ = ()
28
g :: a -> b -> () g _ _ = ()
28
g _ _ = ()
10
false
true
0
9
11
34
15
19
null
null
mankyKitty/leesp
src/Main.hs
mit
cons :: [LispVal] -> ThrowsError LispVal cons [x1, List []] = return $ List [x1]
91
cons :: [LispVal] -> ThrowsError LispVal cons [x1, List []] = return $ List [x1]
91
cons [x1, List []] = return $ List [x1]
50
false
true
0
10
25
49
24
25
null
null
amccausl/Swish
Swish/HaskellRDF/SwishScript.hs
lgpl-2.1
ssCheckStep rn eagf ecgf (Right rss) = let errmsg1 = "Rule not in proof step ruleset(s): " errmsg2 = "Error in proof step antecedent graph(s): " errmsg3 = "Error in proof step consequent graph: " in do { let mrul = getMaybeContextRule rn rss :: Maybe RDFRule ; esag <- sequence $ eagf -- [Either String RDFFormula]] ; let eags = sequence $ esag :: Either String [RDFFormula] ; ecg <- ecgf -- Either String RDFFormula ; let est = case (mrul,eags,ecg) of (Nothing,_,_) -> Left (errmsg1++show rn) (_,Left er,_) -> Left (errmsg2++er) (_,_,Left er) -> Left (errmsg3++er) (Just rul,Right ags,Right cg) -> Right $ makeRDFProofStep rul ags cg ; return est }
934
ssCheckStep rn eagf ecgf (Right rss) = let errmsg1 = "Rule not in proof step ruleset(s): " errmsg2 = "Error in proof step antecedent graph(s): " errmsg3 = "Error in proof step consequent graph: " in do { let mrul = getMaybeContextRule rn rss :: Maybe RDFRule ; esag <- sequence $ eagf -- [Either String RDFFormula]] ; let eags = sequence $ esag :: Either String [RDFFormula] ; ecg <- ecgf -- Either String RDFFormula ; let est = case (mrul,eags,ecg) of (Nothing,_,_) -> Left (errmsg1++show rn) (_,Left er,_) -> Left (errmsg2++er) (_,_,Left er) -> Left (errmsg3++er) (Just rul,Right ags,Right cg) -> Right $ makeRDFProofStep rul ags cg ; return est }
934
ssCheckStep rn eagf ecgf (Right rss) = let errmsg1 = "Rule not in proof step ruleset(s): " errmsg2 = "Error in proof step antecedent graph(s): " errmsg3 = "Error in proof step consequent graph: " in do { let mrul = getMaybeContextRule rn rss :: Maybe RDFRule ; esag <- sequence $ eagf -- [Either String RDFFormula]] ; let eags = sequence $ esag :: Either String [RDFFormula] ; ecg <- ecgf -- Either String RDFFormula ; let est = case (mrul,eags,ecg) of (Nothing,_,_) -> Left (errmsg1++show rn) (_,Left er,_) -> Left (errmsg2++er) (_,_,Left er) -> Left (errmsg3++er) (Just rul,Right ags,Right cg) -> Right $ makeRDFProofStep rul ags cg ; return est }
934
false
false
0
18
397
263
135
128
null
null
jwiegley/ghc-release
libraries/Cabal/cabal-install/Distribution/Client/Config.hs
gpl-3.0
loadConfig :: Verbosity -> Flag FilePath -> Flag Bool -> IO SavedConfig loadConfig verbosity configFileFlag userInstallFlag = addBaseConf $ do let sources = [ ("commandline option", return . flagToMaybe $ configFileFlag), ("env var CABAL_CONFIG", lookup "CABAL_CONFIG" `liftM` getEnvironment), ("default config file", Just `liftM` defaultConfigFile) ] getSource [] = error "no config file path candidate found." getSource ((msg,action): xs) = action >>= maybe (getSource xs) (return . (,) msg) (source, configFile) <- getSource sources minp <- readConfigFile mempty configFile case minp of Nothing -> do notice verbosity $ "Config file path source is " ++ source ++ "." notice verbosity $ "Config file " ++ configFile ++ " not found." notice verbosity $ "Writing default configuration to " ++ configFile commentConf <- commentSavedConfig initialConf <- initialSavedConfig writeConfigFile configFile commentConf initialConf return initialConf Just (ParseOk ws conf) -> do unless (null ws) $ warn verbosity $ unlines (map (showPWarning configFile) ws) return conf Just (ParseFailed err) -> do let (line, msg) = locatedErrorMsg err warn verbosity $ "Error parsing config file " ++ configFile ++ maybe "" (\n -> ':' : show n) line ++ ":\n" ++ msg warn verbosity "Using default configuration." initialSavedConfig where addBaseConf body = do base <- baseSavedConfig extra <- body return (updateInstallDirs userInstallFlag (base `mappend` extra))
1,654
loadConfig :: Verbosity -> Flag FilePath -> Flag Bool -> IO SavedConfig loadConfig verbosity configFileFlag userInstallFlag = addBaseConf $ do let sources = [ ("commandline option", return . flagToMaybe $ configFileFlag), ("env var CABAL_CONFIG", lookup "CABAL_CONFIG" `liftM` getEnvironment), ("default config file", Just `liftM` defaultConfigFile) ] getSource [] = error "no config file path candidate found." getSource ((msg,action): xs) = action >>= maybe (getSource xs) (return . (,) msg) (source, configFile) <- getSource sources minp <- readConfigFile mempty configFile case minp of Nothing -> do notice verbosity $ "Config file path source is " ++ source ++ "." notice verbosity $ "Config file " ++ configFile ++ " not found." notice verbosity $ "Writing default configuration to " ++ configFile commentConf <- commentSavedConfig initialConf <- initialSavedConfig writeConfigFile configFile commentConf initialConf return initialConf Just (ParseOk ws conf) -> do unless (null ws) $ warn verbosity $ unlines (map (showPWarning configFile) ws) return conf Just (ParseFailed err) -> do let (line, msg) = locatedErrorMsg err warn verbosity $ "Error parsing config file " ++ configFile ++ maybe "" (\n -> ':' : show n) line ++ ":\n" ++ msg warn verbosity "Using default configuration." initialSavedConfig where addBaseConf body = do base <- baseSavedConfig extra <- body return (updateInstallDirs userInstallFlag (base `mappend` extra))
1,654
loadConfig verbosity configFileFlag userInstallFlag = addBaseConf $ do let sources = [ ("commandline option", return . flagToMaybe $ configFileFlag), ("env var CABAL_CONFIG", lookup "CABAL_CONFIG" `liftM` getEnvironment), ("default config file", Just `liftM` defaultConfigFile) ] getSource [] = error "no config file path candidate found." getSource ((msg,action): xs) = action >>= maybe (getSource xs) (return . (,) msg) (source, configFile) <- getSource sources minp <- readConfigFile mempty configFile case minp of Nothing -> do notice verbosity $ "Config file path source is " ++ source ++ "." notice verbosity $ "Config file " ++ configFile ++ " not found." notice verbosity $ "Writing default configuration to " ++ configFile commentConf <- commentSavedConfig initialConf <- initialSavedConfig writeConfigFile configFile commentConf initialConf return initialConf Just (ParseOk ws conf) -> do unless (null ws) $ warn verbosity $ unlines (map (showPWarning configFile) ws) return conf Just (ParseFailed err) -> do let (line, msg) = locatedErrorMsg err warn verbosity $ "Error parsing config file " ++ configFile ++ maybe "" (\n -> ':' : show n) line ++ ":\n" ++ msg warn verbosity "Using default configuration." initialSavedConfig where addBaseConf body = do base <- baseSavedConfig extra <- body return (updateInstallDirs userInstallFlag (base `mappend` extra))
1,582
false
true
0
20
423
488
234
254
null
null
urbanslug/ghc
compiler/types/Type.hs
bsd-3-clause
mkPiTypes :: [Var] -> Type -> Type -- ^ 'mkPiType' for multiple type or value arguments mkPiType v ty | isId v = mkFunTy (varType v) ty | otherwise = mkForAllTy v ty
175
mkPiTypes :: [Var] -> Type -> Type mkPiType v ty | isId v = mkFunTy (varType v) ty | otherwise = mkForAllTy v ty
121
mkPiType v ty | isId v = mkFunTy (varType v) ty | otherwise = mkForAllTy v ty
86
true
true
0
8
42
69
31
38
null
null
aweinstock314/sheedb_weinsa_crypto2015_project
writeups/GenerateStackDiagram.hs
agpl-3.0
arrow x1 x2 x3 y1 y2 = [s|\\draw[->] (%?,%?) -- (%?,%?) -- (%?,%?) -- (%?,%?);|] x1 y1 x2 y1 x2 y2 x3 y2 where
110
arrow x1 x2 x3 y1 y2 = [s|\\draw[->] (%?,%?) -- (%?,%?) -- (%?,%?) -- (%?,%?);|] x1 y1 x2 y1 x2 y2 x3 y2 where
110
arrow x1 x2 x3 y1 y2 = [s|\\draw[->] (%?,%?) -- (%?,%?) -- (%?,%?) -- (%?,%?);|] x1 y1 x2 y1 x2 y2 x3 y2 where
110
false
false
1
5
23
47
21
26
null
null
shlevy/ghc
compiler/types/TyCoRep.hs
bsd-3-clause
substCoWith :: HasCallStack => [TyVar] -> [Type] -> Coercion -> Coercion substCoWith tvs tys = ASSERT( tvs `equalLength` tys ) substCo (zipTvSubst tvs tys)
177
substCoWith :: HasCallStack => [TyVar] -> [Type] -> Coercion -> Coercion substCoWith tvs tys = ASSERT( tvs `equalLength` tys ) substCo (zipTvSubst tvs tys)
177
substCoWith tvs tys = ASSERT( tvs `equalLength` tys ) substCo (zipTvSubst tvs tys)
104
false
true
0
10
45
71
34
37
null
null
bixuanzju/SCore
src/Template.hs
gpl-3.0
primConstr :: Int -> Int -> TiState -> TiState primConstr tag arity (output,stack,dump,heap,globals,stats) = (output ,drop arity stack ,dump ,hUpdate heap (stack !! arity) (NData tag addrs) ,globals ,stats) where addrs = take arity $ getArgs heap (tail stack)
315
primConstr :: Int -> Int -> TiState -> TiState primConstr tag arity (output,stack,dump,heap,globals,stats) = (output ,drop arity stack ,dump ,hUpdate heap (stack !! arity) (NData tag addrs) ,globals ,stats) where addrs = take arity $ getArgs heap (tail stack)
315
primConstr tag arity (output,stack,dump,heap,globals,stats) = (output ,drop arity stack ,dump ,hUpdate heap (stack !! arity) (NData tag addrs) ,globals ,stats) where addrs = take arity $ getArgs heap (tail stack)
268
false
true
0
8
94
119
64
55
null
null
Copilot-Language/sbv-for-copilot
Data/SBV/BitVectors/Model.hs
bsd-3-clause
sBool :: String -> Symbolic SBool sBool = symbolic
50
sBool :: String -> Symbolic SBool sBool = symbolic
50
sBool = symbolic
16
false
true
0
6
8
18
9
9
null
null
markuspf/Idris-dev
src/Idris/Core/Evaluate.hs
bsd-3-clause
canonical _ = False
19
canonical _ = False
19
canonical _ = False
19
false
false
0
4
3
10
4
6
null
null
mpickering/HaRe
old/refactorer/RefacConDef.hs
bsd-3-clause
-- folding against a constant definition subConstantDef args = do let fileName = args!!0 beginRow = read (args!!1)::Int beginCol = read (args!!2)::Int endRow = read (args!!3)::Int endCol = read (args!!4)::Int AbstractIO.putStrLn "subConstantDef" (inscps, exps, mod, tokList) <- parseSourceFile fileName let (pnt,subExp) = findDefNameAndExp tokList (beginRow, beginCol) (endRow, endCol) mod if isPatBind pnt then do -- constant folding... else do -- function folding let exp = locToExp (beginRow, beginCol) (endRow, endCol) tokList mod (mod', ((tokList', m) , _)) <- runStateT (doSubstitution pnt exp mod) ((tokList,False),( 0, 0)) writeRefactoredFiles False [((fileName, m), (tokList', mod'))]
887
subConstantDef args = do let fileName = args!!0 beginRow = read (args!!1)::Int beginCol = read (args!!2)::Int endRow = read (args!!3)::Int endCol = read (args!!4)::Int AbstractIO.putStrLn "subConstantDef" (inscps, exps, mod, tokList) <- parseSourceFile fileName let (pnt,subExp) = findDefNameAndExp tokList (beginRow, beginCol) (endRow, endCol) mod if isPatBind pnt then do -- constant folding... else do -- function folding let exp = locToExp (beginRow, beginCol) (endRow, endCol) tokList mod (mod', ((tokList', m) , _)) <- runStateT (doSubstitution pnt exp mod) ((tokList,False),( 0, 0)) writeRefactoredFiles False [((fileName, m), (tokList', mod'))]
845
subConstantDef args = do let fileName = args!!0 beginRow = read (args!!1)::Int beginCol = read (args!!2)::Int endRow = read (args!!3)::Int endCol = read (args!!4)::Int AbstractIO.putStrLn "subConstantDef" (inscps, exps, mod, tokList) <- parseSourceFile fileName let (pnt,subExp) = findDefNameAndExp tokList (beginRow, beginCol) (endRow, endCol) mod if isPatBind pnt then do -- constant folding... else do -- function folding let exp = locToExp (beginRow, beginCol) (endRow, endCol) tokList mod (mod', ((tokList', m) , _)) <- runStateT (doSubstitution pnt exp mod) ((tokList,False),( 0, 0)) writeRefactoredFiles False [((fileName, m), (tokList', mod'))]
845
true
false
1
15
285
299
162
137
null
null
tidalcycles/tidal-midi
Sound/Tidal/MIDI/Tanzbar.hs
gpl-3.0
(track_delay_cv1, track_delay_cv1_p) = pF "track_delay_cv1" (Just 0)
68
(track_delay_cv1, track_delay_cv1_p) = pF "track_delay_cv1" (Just 0)
68
(track_delay_cv1, track_delay_cv1_p) = pF "track_delay_cv1" (Just 0)
68
false
false
0
7
6
24
12
12
null
null
Mathnerd314/lamdu
src/Lamdu/CodeEdit/ExpressionEdit/HoleEdit.hs
gpl-3.0
makeHiddenResultsMWidget NoHiddenResults _ = return Nothing
59
makeHiddenResultsMWidget NoHiddenResults _ = return Nothing
59
makeHiddenResultsMWidget NoHiddenResults _ = return Nothing
59
false
false
0
5
5
16
6
10
null
null
CindyLinz/Haskell.js
trans/src/Desugar/List.hs
mit
deListPatField (PFieldPun l qName) = PFieldPun (id l) (deListQName qName)
73
deListPatField (PFieldPun l qName) = PFieldPun (id l) (deListQName qName)
73
deListPatField (PFieldPun l qName) = PFieldPun (id l) (deListQName qName)
73
false
false
0
7
9
34
16
18
null
null
geophf/1HaskellADay
exercises/HAD/Y2018/M06/D04/Exercise.hs
mit
main :: IO () main = undefined
30
main :: IO () main = undefined
30
main = undefined
16
false
true
0
7
6
22
9
13
null
null
mbakke/ganeti
src/Ganeti/Runtime.hs
bsd-2-clause
daemonGroup (ExtraGroup AdminGroup) = AutoConf.adminGroup
61
daemonGroup (ExtraGroup AdminGroup) = AutoConf.adminGroup
61
daemonGroup (ExtraGroup AdminGroup) = AutoConf.adminGroup
61
false
false
0
7
8
17
8
9
null
null
GaloisInc/feed
Text/Feed/Constructor.hs
bsd-3-clause
withFeedHome :: FeedSetter URLString withFeedHome url fe = case fe of Feed.Types.AtomFeed f -> Feed.Types.AtomFeed f{feedLinks=newSelf:Atom.feedLinks f} -- ToDo: fix, the <link> element is for the HTML home of the channel, not the -- location of the feed itself. Struggling to find if there is a common way -- to represent this outside of RSS 2.0 standard elements.. Feed.Types.RSSFeed f -> Feed.Types.RSSFeed f{rssChannel=(rssChannel f){rssLink=url}} Feed.Types.RSS1Feed f -> Feed.Types.RSS1Feed f{feedChannel=(feedChannel f){channelURI=url}} Feed.Types.XMLFeed f -> Feed.Types.XMLFeed $ mapMaybeChildren (\ e -> if (elName e == unqual "channel") then Just (mapMaybeChildren (\ e2 -> if (elName e2 == unqual "link") then Just (unode "link" url) else Nothing) e) else Nothing) f where newSelf = (nullLink url){ linkRel=Just (Left "self") , linkType=Just "application/atom+xml" } -- | 'withFeedHTML' sets the URL where an HTML version of the -- feed is published.
1,186
withFeedHome :: FeedSetter URLString withFeedHome url fe = case fe of Feed.Types.AtomFeed f -> Feed.Types.AtomFeed f{feedLinks=newSelf:Atom.feedLinks f} -- ToDo: fix, the <link> element is for the HTML home of the channel, not the -- location of the feed itself. Struggling to find if there is a common way -- to represent this outside of RSS 2.0 standard elements.. Feed.Types.RSSFeed f -> Feed.Types.RSSFeed f{rssChannel=(rssChannel f){rssLink=url}} Feed.Types.RSS1Feed f -> Feed.Types.RSS1Feed f{feedChannel=(feedChannel f){channelURI=url}} Feed.Types.XMLFeed f -> Feed.Types.XMLFeed $ mapMaybeChildren (\ e -> if (elName e == unqual "channel") then Just (mapMaybeChildren (\ e2 -> if (elName e2 == unqual "link") then Just (unode "link" url) else Nothing) e) else Nothing) f where newSelf = (nullLink url){ linkRel=Just (Left "self") , linkType=Just "application/atom+xml" } -- | 'withFeedHTML' sets the URL where an HTML version of the -- feed is published.
1,185
withFeedHome url fe = case fe of Feed.Types.AtomFeed f -> Feed.Types.AtomFeed f{feedLinks=newSelf:Atom.feedLinks f} -- ToDo: fix, the <link> element is for the HTML home of the channel, not the -- location of the feed itself. Struggling to find if there is a common way -- to represent this outside of RSS 2.0 standard elements.. Feed.Types.RSSFeed f -> Feed.Types.RSSFeed f{rssChannel=(rssChannel f){rssLink=url}} Feed.Types.RSS1Feed f -> Feed.Types.RSS1Feed f{feedChannel=(feedChannel f){channelURI=url}} Feed.Types.XMLFeed f -> Feed.Types.XMLFeed $ mapMaybeChildren (\ e -> if (elName e == unqual "channel") then Just (mapMaybeChildren (\ e2 -> if (elName e2 == unqual "link") then Just (unode "link" url) else Nothing) e) else Nothing) f where newSelf = (nullLink url){ linkRel=Just (Left "self") , linkType=Just "application/atom+xml" } -- | 'withFeedHTML' sets the URL where an HTML version of the -- feed is published.
1,148
false
true
11
16
359
285
151
134
null
null
Happstack/happstack-server
tests/Happstack/Server/Tests.hs
bsd-3-clause
-- |All of the tests for happstack-util should be listed here. allTests :: Test allTests = "happstack-server tests" ~: [ cookieParserTest , acceptEncodingParserTest , multipart , compressFilterResponseTest , matchMethodTest , cookieHeaderOrderTest , pContentDispositionFilename ]
507
allTests :: Test allTests = "happstack-server tests" ~: [ cookieParserTest , acceptEncodingParserTest , multipart , compressFilterResponseTest , matchMethodTest , cookieHeaderOrderTest , pContentDispositionFilename ]
444
allTests = "happstack-server tests" ~: [ cookieParserTest , acceptEncodingParserTest , multipart , compressFilterResponseTest , matchMethodTest , cookieHeaderOrderTest , pContentDispositionFilename ]
427
true
true
2
6
261
44
24
20
null
null
keithodulaigh/Hets
CSL/ReduceInterpreter.hs
gpl-2.0
redCheck :: (AssignmentStore s, MonadResult s) => (String -> s [EXPRESSION]) -> (EXPRESSION -> s EXPRESSION) -> EXPRESSION -> s Bool redCheck ef trans e = do e' <- trans e el <- ef $ printBooleanExpr e' if null el then error $ "redCheck: expression " ++ show e' ++ " couldn't be evaluated" else return $ getBooleanFromExpr $ head el {- ---------------------------------------------------------------------- The Standard Communication Interface ---------------------------------------------------------------------- -}
561
redCheck :: (AssignmentStore s, MonadResult s) => (String -> s [EXPRESSION]) -> (EXPRESSION -> s EXPRESSION) -> EXPRESSION -> s Bool redCheck ef trans e = do e' <- trans e el <- ef $ printBooleanExpr e' if null el then error $ "redCheck: expression " ++ show e' ++ " couldn't be evaluated" else return $ getBooleanFromExpr $ head el {- ---------------------------------------------------------------------- The Standard Communication Interface ---------------------------------------------------------------------- -}
561
redCheck ef trans e = do e' <- trans e el <- ef $ printBooleanExpr e' if null el then error $ "redCheck: expression " ++ show e' ++ " couldn't be evaluated" else return $ getBooleanFromExpr $ head el {- ---------------------------------------------------------------------- The Standard Communication Interface ---------------------------------------------------------------------- -}
398
false
true
0
10
112
136
66
70
null
null
nilthehuman/H-99
BinaryTrees.hs
unlicense
replace (Branch x l r) new (Left ps) = Branch x (replace l new ps) r
69
replace (Branch x l r) new (Left ps) = Branch x (replace l new ps) r
69
replace (Branch x l r) new (Left ps) = Branch x (replace l new ps) r
69
false
false
0
7
16
46
22
24
null
null
peterokagey/haskellOEIS
src/Miscellaneous/A261863.hs
apache-2.0
a261863 :: Integral a => a -> a a261863 n = a143480 n `div` n
61
a261863 :: Integral a => a -> a a261863 n = a143480 n `div` n
61
a261863 n = a143480 n `div` n
29
false
true
0
6
14
34
17
17
null
null
sseefried/task
src/ExportCmd.hs
bsd-3-clause
recordToRow :: TimeZone -> Record -> Row recordToRow tz r = [ (g . R.recStart $ r), (g . R.recFinish $ r), (f . R.recDescr $ r), (f . T.pack . show . R.duration $ r) ] ++ map h (R.recKeyValues r) where f = encodeUtf8 g = BS.pack . isoTime tz h (key,value) = encodeUtf8 key `BS.append` ":" `BS.append` encodeUtf8 value
397
recordToRow :: TimeZone -> Record -> Row recordToRow tz r = [ (g . R.recStart $ r), (g . R.recFinish $ r), (f . R.recDescr $ r), (f . T.pack . show . R.duration $ r) ] ++ map h (R.recKeyValues r) where f = encodeUtf8 g = BS.pack . isoTime tz h (key,value) = encodeUtf8 key `BS.append` ":" `BS.append` encodeUtf8 value
397
recordToRow tz r = [ (g . R.recStart $ r), (g . R.recFinish $ r), (f . R.recDescr $ r), (f . T.pack . show . R.duration $ r) ] ++ map h (R.recKeyValues r) where f = encodeUtf8 g = BS.pack . isoTime tz h (key,value) = encodeUtf8 key `BS.append` ":" `BS.append` encodeUtf8 value
356
false
true
2
12
141
174
92
82
null
null