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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
vicfryzel/haskell-twitter | Haq.hs | mit | -- |See http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-statuses%C2%A0destroy
statusesDestroy id creds =
postDecode (baseHN ++ "/statuses/destroy/" ++ id ++ ".json") creds | 181 | statusesDestroy id creds =
postDecode (baseHN ++ "/statuses/destroy/" ++ id ++ ".json") creds | 97 | statusesDestroy id creds =
postDecode (baseHN ++ "/statuses/destroy/" ++ id ++ ".json") creds | 97 | true | false | 0 | 9 | 19 | 32 | 16 | 16 | null | null |
phaazon/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/Tokens.hs | bsd-3-clause | gl_MATRIX_PALETTE_OES :: GLenum
gl_MATRIX_PALETTE_OES = 0x8840 | 62 | gl_MATRIX_PALETTE_OES :: GLenum
gl_MATRIX_PALETTE_OES = 0x8840 | 62 | gl_MATRIX_PALETTE_OES = 0x8840 | 30 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
573/leksah | src/IDE/TextEditor/Yi.hs | gpl-2.0 | withYiBuffer' :: BufferRef -> BufferM a -> IDEM a
withYiBuffer' b f = liftYi $ withEditor $ withGivenBuffer b f | 111 | withYiBuffer' :: BufferRef -> BufferM a -> IDEM a
withYiBuffer' b f = liftYi $ withEditor $ withGivenBuffer b f | 111 | withYiBuffer' b f = liftYi $ withEditor $ withGivenBuffer b f | 61 | false | true | 0 | 8 | 19 | 47 | 21 | 26 | null | null |
bordaigorl/jamesbound | src/Analyse.hs | gpl-2.0 | putSeen s = modify $ \as -> as{seenStates=s} | 44 | putSeen s = modify $ \as -> as{seenStates=s} | 44 | putSeen s = modify $ \as -> as{seenStates=s} | 44 | false | false | 0 | 8 | 7 | 26 | 14 | 12 | null | null |
diku-dk/futhark | src/Language/Futhark/Pretty.hs | isc | prettyName :: IsName v => v -> String
prettyName = prettyDoc 80 . pprName | 73 | prettyName :: IsName v => v -> String
prettyName = prettyDoc 80 . pprName | 73 | prettyName = prettyDoc 80 . pprName | 35 | false | true | 0 | 8 | 13 | 35 | 15 | 20 | null | null |
bacchanalia/KitchenSink | KitchenSink/Qualified.hs | gpl-3.0 | -- |'B.groupBy'
b_groupBy = B.groupBy | 37 | b_groupBy = B.groupBy | 21 | b_groupBy = B.groupBy | 21 | true | false | 0 | 5 | 4 | 9 | 5 | 4 | null | null |
hvr/text | tests/Tests/Properties.hs | bsd-2-clause | -- Input and output.
t_put_get = write_read T.unlines T.filter put get
where put h = withRedirect h IO.stdout . T.putStr
get h = withRedirect h IO.stdin T.getContents | 177 | t_put_get = write_read T.unlines T.filter put get
where put h = withRedirect h IO.stdout . T.putStr
get h = withRedirect h IO.stdin T.getContents | 155 | t_put_get = write_read T.unlines T.filter put get
where put h = withRedirect h IO.stdout . T.putStr
get h = withRedirect h IO.stdin T.getContents | 155 | true | false | 1 | 7 | 37 | 62 | 30 | 32 | null | null |
kelnage/tamarin-prover | lib/theory/src/Theory.hs | gpl-3.0 | prettyDiffLemmaName :: HighlightDocument d => DiffLemma p -> d
prettyDiffLemmaName l = text ((L.get lDiffName l)) | 113 | prettyDiffLemmaName :: HighlightDocument d => DiffLemma p -> d
prettyDiffLemmaName l = text ((L.get lDiffName l)) | 113 | prettyDiffLemmaName l = text ((L.get lDiffName l)) | 50 | false | true | 0 | 9 | 15 | 50 | 22 | 28 | null | null |
kawu/dawg | src/Data/DAWG/Static.hs | bsd-2-clause | -- | A list of outgoing edges.
edges :: Enum a => DAWG a b c -> [(a, DAWG a b c)]
edges d =
[ (toEnum sym, d{ rootID = i })
| (sym, i) <- N.edges n ]
where
n = nodeBy (rootID d) d
-- | Return the sub-DAWG containing all keys beginning with a prefix.
-- The in-memory representation of the resultant DAWG is the same as of
-- the original one, only the pointer to the DAWG root will be different. | 411 | edges :: Enum a => DAWG a b c -> [(a, DAWG a b c)]
edges d =
[ (toEnum sym, d{ rootID = i })
| (sym, i) <- N.edges n ]
where
n = nodeBy (rootID d) d
-- | Return the sub-DAWG containing all keys beginning with a prefix.
-- The in-memory representation of the resultant DAWG is the same as of
-- the original one, only the pointer to the DAWG root will be different. | 380 | edges d =
[ (toEnum sym, d{ rootID = i })
| (sym, i) <- N.edges n ]
where
n = nodeBy (rootID d) d
-- | Return the sub-DAWG containing all keys beginning with a prefix.
-- The in-memory representation of the resultant DAWG is the same as of
-- the original one, only the pointer to the DAWG root will be different. | 329 | true | true | 0 | 9 | 101 | 110 | 59 | 51 | null | null |
forsyde/forsyde-atom | src/ForSyDe/Atom/Skel/Vector/Matrix.hs | bsd-3-clause | isNull _ = False | 16 | isNull _ = False | 16 | isNull _ = False | 16 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
choener/CMCompare | CMCompare.hs | gpl-3.0 | results fastIns optf m1 m2 = opt . concat . elems $ recurse fastIns optf m1 m2 where
(end,lbegin,start,delete,matchP,matchL,insertL,matchR,insertR,branch,opt,finalize) = optf | 176 | results fastIns optf m1 m2 = opt . concat . elems $ recurse fastIns optf m1 m2 where
(end,lbegin,start,delete,matchP,matchL,insertL,matchR,insertR,branch,opt,finalize) = optf | 176 | results fastIns optf m1 m2 = opt . concat . elems $ recurse fastIns optf m1 m2 where
(end,lbegin,start,delete,matchP,matchL,insertL,matchR,insertR,branch,opt,finalize) = optf | 176 | false | false | 0 | 7 | 22 | 83 | 45 | 38 | null | null |
jwaldmann/haskellnews | upstream/snap-app/src/Snap/App/Model.hs | bsd-3-clause | -- | Run a model action at the top-level.
runDB :: s -> c -> Pool -> Model c s () -> IO ()
runDB st conf pool mdl = do
withPoolConnection pool $ \conn -> do
let state = ModelState conn st conf
-- Default to HTML, can be overridden.
runReaderT (runModel mdl) state
-- | Run a model action from within a controller. | 334 | runDB :: s -> c -> Pool -> Model c s () -> IO ()
runDB st conf pool mdl = do
withPoolConnection pool $ \conn -> do
let state = ModelState conn st conf
-- Default to HTML, can be overridden.
runReaderT (runModel mdl) state
-- | Run a model action from within a controller. | 292 | runDB st conf pool mdl = do
withPoolConnection pool $ \conn -> do
let state = ModelState conn st conf
-- Default to HTML, can be overridden.
runReaderT (runModel mdl) state
-- | Run a model action from within a controller. | 243 | true | true | 0 | 14 | 85 | 98 | 47 | 51 | null | null |
jonathan-laurent/copilot-kind | src/Copilot/Kind/Kind2/Translate.hs | bsd-3-clause | toKind2 :: Style -> [PropId] -> [PropId] -> Spec -> K.File
toKind2 style assumptions checkedProps spec =
addAssumptions spec assumptions
$ trSpec (complete spec') predCallsGraph assumptions checkedProps
where predCallsGraph = specDependenciesGraph spec'
spec' = case style of
Inlined -> inline spec
Modular -> removeCycles spec | 363 | toKind2 :: Style -> [PropId] -> [PropId] -> Spec -> K.File
toKind2 style assumptions checkedProps spec =
addAssumptions spec assumptions
$ trSpec (complete spec') predCallsGraph assumptions checkedProps
where predCallsGraph = specDependenciesGraph spec'
spec' = case style of
Inlined -> inline spec
Modular -> removeCycles spec | 363 | toKind2 style assumptions checkedProps spec =
addAssumptions spec assumptions
$ trSpec (complete spec') predCallsGraph assumptions checkedProps
where predCallsGraph = specDependenciesGraph spec'
spec' = case style of
Inlined -> inline spec
Modular -> removeCycles spec | 304 | false | true | 3 | 9 | 80 | 108 | 52 | 56 | null | null |
nomeata/darcs-mirror-arbtt | src/Capture/X11.hs | gpl-2.0 | getProgramName :: Display -> Window -> IO String
getProgramName dpy = fmap resName . getClassHint dpy | 101 | getProgramName :: Display -> Window -> IO String
getProgramName dpy = fmap resName . getClassHint dpy | 101 | getProgramName dpy = fmap resName . getClassHint dpy | 52 | false | true | 0 | 7 | 15 | 35 | 16 | 19 | null | null |
Courseography/courseography | app/Database/Tables.hs | gpl-3.0 | getDayVal "TH" = 3.0 | 20 | getDayVal "TH" = 3.0 | 20 | getDayVal "TH" = 3.0 | 20 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
brendanhay/semver | src/Data/SemVer/Delimited.hs | mpl-2.0 | -- | Lens for the metadata component delimiter. Default: @+@
metadata :: Functor f => (Char -> f Char) -> Delimiters -> f Delimiters
metadata f x = (\y -> x { _delimMeta = y }) <$> f (_delimMeta x) | 197 | metadata :: Functor f => (Char -> f Char) -> Delimiters -> f Delimiters
metadata f x = (\y -> x { _delimMeta = y }) <$> f (_delimMeta x) | 136 | metadata f x = (\y -> x { _delimMeta = y }) <$> f (_delimMeta x) | 64 | true | true | 0 | 9 | 39 | 74 | 38 | 36 | null | null |
abooij/cubicaltt | CTT.hs | mit | showPath :: Val -> Doc
showPath e = case e of
VPath i a@VPath{} -> text (show i) <+> showPath a
VPath i a -> text (show i) <> char '>' <+> showVal a
_ -> showVal e
-- Merge lambdas of the same type | 228 | showPath :: Val -> Doc
showPath e = case e of
VPath i a@VPath{} -> text (show i) <+> showPath a
VPath i a -> text (show i) <> char '>' <+> showVal a
_ -> showVal e
-- Merge lambdas of the same type | 228 | showPath e = case e of
VPath i a@VPath{} -> text (show i) <+> showPath a
VPath i a -> text (show i) <> char '>' <+> showVal a
_ -> showVal e
-- Merge lambdas of the same type | 205 | false | true | 0 | 12 | 75 | 105 | 48 | 57 | null | null |
snoyberg/ghc | compiler/types/Type.hs | bsd-3-clause | tyConAppArgs :: Type -> [Type]
tyConAppArgs ty = tyConAppArgs_maybe ty `orElse` pprPanic "tyConAppArgs" (ppr ty) | 112 | tyConAppArgs :: Type -> [Type]
tyConAppArgs ty = tyConAppArgs_maybe ty `orElse` pprPanic "tyConAppArgs" (ppr ty) | 112 | tyConAppArgs ty = tyConAppArgs_maybe ty `orElse` pprPanic "tyConAppArgs" (ppr ty) | 81 | false | true | 0 | 8 | 14 | 46 | 22 | 24 | null | null |
narurien/ganeti-ceph | src/Ganeti/Utils.hs | gpl-2.0 | -- | Split an 'Either' list into two separate lists (containing the
-- 'Left' and 'Right' elements, plus a \"trail\" list that allows
-- recombination later.
--
-- This is splitter; for recombination, look at 'recombineEithers'.
-- The sum of \"left\" and \"right\" lists should be equal to the
-- original list length, and the trail list should be the same length
-- as well. The entries in the resulting lists are reversed in
-- comparison with the original list.
splitEithers :: [Either a b] -> ([a], [b], [Bool])
splitEithers = foldl' splitter ([], [], [])
where splitter (l, r, t) e =
case e of
Left v -> (v:l, r, False:t)
Right v -> (l, v:r, True:t)
-- | Recombines two \"left\" and \"right\" lists using a \"trail\"
-- list into a single 'Either' list.
--
-- This is the counterpart to 'splitEithers'. It does the opposite
-- transformation, and the output list will be the reverse of the
-- input lists. Since 'splitEithers' also reverses the lists, calling
-- these together will result in the original list.
--
-- Mismatches in the structure of the lists (e.g. inconsistent
-- lengths) are represented via 'Bad'; normally this function should
-- not fail, if lists are passed as generated by 'splitEithers'. | 1,255 | splitEithers :: [Either a b] -> ([a], [b], [Bool])
splitEithers = foldl' splitter ([], [], [])
where splitter (l, r, t) e =
case e of
Left v -> (v:l, r, False:t)
Right v -> (l, v:r, True:t)
-- | Recombines two \"left\" and \"right\" lists using a \"trail\"
-- list into a single 'Either' list.
--
-- This is the counterpart to 'splitEithers'. It does the opposite
-- transformation, and the output list will be the reverse of the
-- input lists. Since 'splitEithers' also reverses the lists, calling
-- these together will result in the original list.
--
-- Mismatches in the structure of the lists (e.g. inconsistent
-- lengths) are represented via 'Bad'; normally this function should
-- not fail, if lists are passed as generated by 'splitEithers'. | 789 | splitEithers = foldl' splitter ([], [], [])
where splitter (l, r, t) e =
case e of
Left v -> (v:l, r, False:t)
Right v -> (l, v:r, True:t)
-- | Recombines two \"left\" and \"right\" lists using a \"trail\"
-- list into a single 'Either' list.
--
-- This is the counterpart to 'splitEithers'. It does the opposite
-- transformation, and the output list will be the reverse of the
-- input lists. Since 'splitEithers' also reverses the lists, calling
-- these together will result in the original list.
--
-- Mismatches in the structure of the lists (e.g. inconsistent
-- lengths) are represented via 'Bad'; normally this function should
-- not fail, if lists are passed as generated by 'splitEithers'. | 738 | true | true | 0 | 9 | 248 | 158 | 97 | 61 | null | null |
cutsea110/servant-csharp | src/CS/JsonDotNet.hs | bsd-3-clause | methodName :: Req Text -> String
methodName = T.unpack . view (reqFuncName.camelCaseL) | 87 | methodName :: Req Text -> String
methodName = T.unpack . view (reqFuncName.camelCaseL) | 87 | methodName = T.unpack . view (reqFuncName.camelCaseL) | 54 | false | true | 0 | 8 | 12 | 32 | 16 | 16 | null | null |
nurpax/hstodo | test/ModelTests.hs | bsd-3-clause | testActivatesList :: Test
testActivatesList = testCase "get list of todos based on activatesOn" $
withNewDb $ \c -> do
let activatesTime = read "2012-08-20 00:00:00" :: UTCTime
today <- getCurrentTime
let todo = (mkDefaultTodo "test1") { M.todoActivatesOn = Just activatesTime }
todo' <- M.saveTodo c defaultUser todo
todos <- M.listTodos c defaultUser Nothing
todos @=? [todo']
todos <- M.listTodos c defaultUser (Just (M.TodoFilter True (Just today)))
todos @=? [todo'] | 506 | testActivatesList :: Test
testActivatesList = testCase "get list of todos based on activatesOn" $
withNewDb $ \c -> do
let activatesTime = read "2012-08-20 00:00:00" :: UTCTime
today <- getCurrentTime
let todo = (mkDefaultTodo "test1") { M.todoActivatesOn = Just activatesTime }
todo' <- M.saveTodo c defaultUser todo
todos <- M.listTodos c defaultUser Nothing
todos @=? [todo']
todos <- M.listTodos c defaultUser (Just (M.TodoFilter True (Just today)))
todos @=? [todo'] | 506 | testActivatesList = testCase "get list of todos based on activatesOn" $
withNewDb $ \c -> do
let activatesTime = read "2012-08-20 00:00:00" :: UTCTime
today <- getCurrentTime
let todo = (mkDefaultTodo "test1") { M.todoActivatesOn = Just activatesTime }
todo' <- M.saveTodo c defaultUser todo
todos <- M.listTodos c defaultUser Nothing
todos @=? [todo']
todos <- M.listTodos c defaultUser (Just (M.TodoFilter True (Just today)))
todos @=? [todo'] | 480 | false | true | 0 | 16 | 103 | 167 | 80 | 87 | null | null |
nitrix/lspace | legacy/Relational.hs | unlicense | readRelation :: Related a => Relation a -> Relational a
readRelation relation@(relationId, outerIORef) = undefined | 114 | readRelation :: Related a => Relation a -> Relational a
readRelation relation@(relationId, outerIORef) = undefined | 114 | readRelation relation@(relationId, outerIORef) = undefined | 58 | false | true | 0 | 7 | 14 | 40 | 20 | 20 | null | null |
robstewart57/path | src/Path.hs | bsd-3-clause | --------------------------------------------------------------------------------
-- Internal functions
-- | Internal use for normalizing a directory.
normalizeDir :: FilePath -> FilePath
normalizeDir =
clean . FilePath.addTrailingPathSeparator . FilePath.normalise
where clean "./" = ""
clean ('/':'/':xs) = clean ('/':xs)
clean x = x
-- | Internal use for normalizing a fileectory. | 404 | normalizeDir :: FilePath -> FilePath
normalizeDir =
clean . FilePath.addTrailingPathSeparator . FilePath.normalise
where clean "./" = ""
clean ('/':'/':xs) = clean ('/':xs)
clean x = x
-- | Internal use for normalizing a fileectory. | 253 | normalizeDir =
clean . FilePath.addTrailingPathSeparator . FilePath.normalise
where clean "./" = ""
clean ('/':'/':xs) = clean ('/':xs)
clean x = x
-- | Internal use for normalizing a fileectory. | 216 | true | true | 1 | 8 | 67 | 81 | 42 | 39 | null | null |
forsyde/forsyde-atom | src/ForSyDe/Atom/MoC/SDF/SADFDemo.hs | bsd-3-clause | -- nop
exeScenario 1 = ((1,1), (0,0,1), \[[rd, rs]] [r] -> ([], [], [replace rd (r <@! rs) r])) | 95 | exeScenario 1 = ((1,1), (0,0,1), \[[rd, rs]] [r] -> ([], [], [replace rd (r <@! rs) r])) | 88 | exeScenario 1 = ((1,1), (0,0,1), \[[rd, rs]] [r] -> ([], [], [replace rd (r <@! rs) r])) | 88 | true | false | 0 | 11 | 18 | 83 | 50 | 33 | null | null |
elfeck/grouphs | test/Test.hs | mit | z7 = znz 7 | 10 | z7 = znz 7 | 10 | z7 = znz 7 | 10 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
unitb/logic-function-tables | src/UnitB/FunctionTable/Spec/Markdown.hs | bsd-3-clause | specToMD :: TeXSpec () -> IO Markdown
specToMD sys = runDocT $ do
cd <- liftIO getCurrentDirectory
forM_ (zip [0..] $ sys^.specs.contents) $ \(i,ln) -> do
case ln of
Left str -> do
tell $ str ()
-- return Nothing
Right (_b,tbl) -> do
r <- lift $ tableImage ([s|table%d|] i) ps def tbl
-- either _ (tell [Ct $ Image "alt text" $ [s|table%d|] i]) r
either (fail . unpack)
(tell . pure . Ct . Image "alt text" . makeRelative cd)
r
-- return $ Just (i,r)
-- forM_ (catMaybes xs) $ \(i,ref) -> do
-- either
-- (fail . unpack)
-- (tell . Markdown . pack . [s|[table%d]: %s\n|] i . makeRelative cd)
-- ref
where
def = mathComm' "dom"
<> renewcommand "between" 3 (raw "#1 \\le #2 \\le #3")
-- <> renewcommand "between" 3 (raw "#1 \\1\\le #2 \\1\\le #3")
<> sys^.newCommands
ps = ["multirow", "amsmath", "amssymb"] | 1,176 | specToMD :: TeXSpec () -> IO Markdown
specToMD sys = runDocT $ do
cd <- liftIO getCurrentDirectory
forM_ (zip [0..] $ sys^.specs.contents) $ \(i,ln) -> do
case ln of
Left str -> do
tell $ str ()
-- return Nothing
Right (_b,tbl) -> do
r <- lift $ tableImage ([s|table%d|] i) ps def tbl
-- either _ (tell [Ct $ Image "alt text" $ [s|table%d|] i]) r
either (fail . unpack)
(tell . pure . Ct . Image "alt text" . makeRelative cd)
r
-- return $ Just (i,r)
-- forM_ (catMaybes xs) $ \(i,ref) -> do
-- either
-- (fail . unpack)
-- (tell . Markdown . pack . [s|[table%d]: %s\n|] i . makeRelative cd)
-- ref
where
def = mathComm' "dom"
<> renewcommand "between" 3 (raw "#1 \\le #2 \\le #3")
-- <> renewcommand "between" 3 (raw "#1 \\1\\le #2 \\1\\le #3")
<> sys^.newCommands
ps = ["multirow", "amsmath", "amssymb"] | 1,176 | specToMD sys = runDocT $ do
cd <- liftIO getCurrentDirectory
forM_ (zip [0..] $ sys^.specs.contents) $ \(i,ln) -> do
case ln of
Left str -> do
tell $ str ()
-- return Nothing
Right (_b,tbl) -> do
r <- lift $ tableImage ([s|table%d|] i) ps def tbl
-- either _ (tell [Ct $ Image "alt text" $ [s|table%d|] i]) r
either (fail . unpack)
(tell . pure . Ct . Image "alt text" . makeRelative cd)
r
-- return $ Just (i,r)
-- forM_ (catMaybes xs) $ \(i,ref) -> do
-- either
-- (fail . unpack)
-- (tell . Markdown . pack . [s|[table%d]: %s\n|] i . makeRelative cd)
-- ref
where
def = mathComm' "dom"
<> renewcommand "between" 3 (raw "#1 \\le #2 \\le #3")
-- <> renewcommand "between" 3 (raw "#1 \\1\\le #2 \\1\\le #3")
<> sys^.newCommands
ps = ["multirow", "amsmath", "amssymb"] | 1,138 | false | true | 0 | 22 | 521 | 253 | 130 | 123 | null | null |
solatis/dissent | src/Dissent/Protocol/Shuffle/Leader.hs | mit | phase1 :: ( MonadIO m
, MonadError String m
, MonadResource m)
=> TQ.Quorum -- ^ The Quorum we operate on
-> m [NS.Socket] -- ^ The sockets we accepted
phase1 quorum =
let accepted = NQ.accept quorum TP.Leader
-- Returns all accepted sockets from all slaves.
--
-- This is a blocking operation.
sockets = (return . map fst) =<< accepted
-- After a connection has been established with a slave, we
-- expect a handshake to occur. At the present moment, this
-- handshake only involves a peer telling us his id, so we know
-- which socket to associate with which peer.
--
-- This is a blocking operation.
handShake socket = do
peerId <- liftIO $ NS.receiveAndDecode socket
either throwError return peerId
-- Now, after this process, we have a list of sockets, and a list
-- of peer ids. Once we put them in a zipped list, we have a convenient
-- way to sort them by peer id, thus allowing us to easily look up a
-- socket by a peer's id.
sortSockets :: [(TP.Id, NS.Socket)] -> [(TP.Id, NS.Socket)]
sortSockets =
let predicate lhs rhs | fst lhs < fst rhs = LT
| fst lhs > fst rhs = GT
| otherwise = EQ
in sortBy predicate
in do
unorderedSockets <- liftResourceT sockets
-- Retrieve all peer ids
peerIds <- mapM handShake unorderedSockets
-- Combine the sockets with the peer ids, sort them based on the peer id,
-- and get a list of the sockets out of it.
return (map snd (sortSockets (zip peerIds unorderedSockets)))
-- | In the second phase, the leader receives all the encrypted messages from all
-- the slaves.
--
-- This is a blocking operation. | 1,853 | phase1 :: ( MonadIO m
, MonadError String m
, MonadResource m)
=> TQ.Quorum -- ^ The Quorum we operate on
-> m [NS.Socket]
phase1 quorum =
let accepted = NQ.accept quorum TP.Leader
-- Returns all accepted sockets from all slaves.
--
-- This is a blocking operation.
sockets = (return . map fst) =<< accepted
-- After a connection has been established with a slave, we
-- expect a handshake to occur. At the present moment, this
-- handshake only involves a peer telling us his id, so we know
-- which socket to associate with which peer.
--
-- This is a blocking operation.
handShake socket = do
peerId <- liftIO $ NS.receiveAndDecode socket
either throwError return peerId
-- Now, after this process, we have a list of sockets, and a list
-- of peer ids. Once we put them in a zipped list, we have a convenient
-- way to sort them by peer id, thus allowing us to easily look up a
-- socket by a peer's id.
sortSockets :: [(TP.Id, NS.Socket)] -> [(TP.Id, NS.Socket)]
sortSockets =
let predicate lhs rhs | fst lhs < fst rhs = LT
| fst lhs > fst rhs = GT
| otherwise = EQ
in sortBy predicate
in do
unorderedSockets <- liftResourceT sockets
-- Retrieve all peer ids
peerIds <- mapM handShake unorderedSockets
-- Combine the sockets with the peer ids, sort them based on the peer id,
-- and get a list of the sockets out of it.
return (map snd (sortSockets (zip peerIds unorderedSockets)))
-- | In the second phase, the leader receives all the encrypted messages from all
-- the slaves.
--
-- This is a blocking operation. | 1,815 | phase1 quorum =
let accepted = NQ.accept quorum TP.Leader
-- Returns all accepted sockets from all slaves.
--
-- This is a blocking operation.
sockets = (return . map fst) =<< accepted
-- After a connection has been established with a slave, we
-- expect a handshake to occur. At the present moment, this
-- handshake only involves a peer telling us his id, so we know
-- which socket to associate with which peer.
--
-- This is a blocking operation.
handShake socket = do
peerId <- liftIO $ NS.receiveAndDecode socket
either throwError return peerId
-- Now, after this process, we have a list of sockets, and a list
-- of peer ids. Once we put them in a zipped list, we have a convenient
-- way to sort them by peer id, thus allowing us to easily look up a
-- socket by a peer's id.
sortSockets :: [(TP.Id, NS.Socket)] -> [(TP.Id, NS.Socket)]
sortSockets =
let predicate lhs rhs | fst lhs < fst rhs = LT
| fst lhs > fst rhs = GT
| otherwise = EQ
in sortBy predicate
in do
unorderedSockets <- liftResourceT sockets
-- Retrieve all peer ids
peerIds <- mapM handShake unorderedSockets
-- Combine the sockets with the peer ids, sort them based on the peer id,
-- and get a list of the sockets out of it.
return (map snd (sortSockets (zip peerIds unorderedSockets)))
-- | In the second phase, the leader receives all the encrypted messages from all
-- the slaves.
--
-- This is a blocking operation. | 1,645 | true | true | 0 | 17 | 593 | 304 | 155 | 149 | null | null |
ingemaradahl/bilder | src/Compiler/Desugar/Extract.hs | lgpl-3.0 | expand (SReturn tkr e:ss) = do
(e',sdecs) ← expandExp e
ss' ← expand ss
return $ sdecs ++ [SReturn tkr e'] ++ ss' | 119 | expand (SReturn tkr e:ss) = do
(e',sdecs) ← expandExp e
ss' ← expand ss
return $ sdecs ++ [SReturn tkr e'] ++ ss' | 119 | expand (SReturn tkr e:ss) = do
(e',sdecs) ← expandExp e
ss' ← expand ss
return $ sdecs ++ [SReturn tkr e'] ++ ss' | 119 | false | false | 0 | 10 | 28 | 70 | 33 | 37 | null | null |
daleooo/barrelfish | tools/mackerel/Attr.hs | mit | attr_is_writeable RC = False | 28 | attr_is_writeable RC = False | 28 | attr_is_writeable RC = False | 28 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
tomwadeson/adventofcode | 07.hs | mit | parseOperator :: ReadP Node
parseOperator = do
gate <- parseGate
parseArrow
label <- parseLabel
return $ Operator gate label | 133 | parseOperator :: ReadP Node
parseOperator = do
gate <- parseGate
parseArrow
label <- parseLabel
return $ Operator gate label | 133 | parseOperator = do
gate <- parseGate
parseArrow
label <- parseLabel
return $ Operator gate label | 105 | false | true | 1 | 9 | 27 | 47 | 19 | 28 | null | null |
y-usuzumi/survive-the-course | www.icourse163.org/ZJU-93001/第四周编程作业/1.hs | bsd-3-clause | | lls <- map head ll
, not $ and $ zipWith (==) lls (tail lls) = False | 72 | | lls <- map head ll
, not $ and $ zipWith (==) lls (tail lls) = False | 72 | | lls <- map head ll
, not $ and $ zipWith (==) lls (tail lls) = False | 72 | false | false | 0 | 11 | 19 | 49 | 23 | 26 | null | null |
jgm/texmath | src/Text/TeXMath/Writers/Pandoc.hs | gpl-2.0 | addSpaces (x:xs) = x : addSpaces xs | 35 | addSpaces (x:xs) = x : addSpaces xs | 35 | addSpaces (x:xs) = x : addSpaces xs | 35 | false | false | 0 | 7 | 6 | 23 | 11 | 12 | null | null |
Philonous/xml-picklers | src/Data/XML/Pickle/Basic.hs | bsd-3-clause | (<++>) :: (Text, Text) -> UnpickleError -> UnpickleError
(<++>) = TraceStep | 75 | (<++>) :: (Text, Text) -> UnpickleError -> UnpickleError
(<++>) = TraceStep | 75 | (<++>) = TraceStep | 18 | false | true | 0 | 6 | 10 | 29 | 18 | 11 | null | null |
ndmitchell/hogle-dead | src/Output/Tags.hs | bsd-3-clause | readTags :: Database -> IO Tags
readTags = memoIO1 $ \(Database file) -> do
pkgs <- readFile' $ file <.> "pkgs"
mods <- readFile' $ file <.> "mods"
let xs = [(x, readIds range) | name:range:tags <- map words $ lines pkgs, x <- ("package",name) : map (splitPair ":") tags] ++
[(("module",name), readIds r) | name:ranges <- map words $ lines mods, r <- ranges]
return $ Tags xs (computeList xs)
where
readIds = both read . splitPair "-" | 475 | readTags :: Database -> IO Tags
readTags = memoIO1 $ \(Database file) -> do
pkgs <- readFile' $ file <.> "pkgs"
mods <- readFile' $ file <.> "mods"
let xs = [(x, readIds range) | name:range:tags <- map words $ lines pkgs, x <- ("package",name) : map (splitPair ":") tags] ++
[(("module",name), readIds r) | name:ranges <- map words $ lines mods, r <- ranges]
return $ Tags xs (computeList xs)
where
readIds = both read . splitPair "-" | 475 | readTags = memoIO1 $ \(Database file) -> do
pkgs <- readFile' $ file <.> "pkgs"
mods <- readFile' $ file <.> "mods"
let xs = [(x, readIds range) | name:range:tags <- map words $ lines pkgs, x <- ("package",name) : map (splitPair ":") tags] ++
[(("module",name), readIds r) | name:ranges <- map words $ lines mods, r <- ranges]
return $ Tags xs (computeList xs)
where
readIds = both read . splitPair "-" | 443 | false | true | 0 | 19 | 119 | 227 | 112 | 115 | null | null |
kawamuray/ganeti | src/Ganeti/JQScheduler.hs | gpl-2.0 | readJobsFromDisk :: IO [JobWithStat]
readJobsFromDisk = do
logInfo "Loading job queue"
qdir <- queueDir
eitherJids <- JQ.getJobIDs [qdir]
let jids = genericResult (const []) JQ.sortJobIDs eitherJids
jidsstring = commaJoin $ map (show . fromJobId) jids
logInfo $ "Non-archived jobs on disk: " ++ jidsstring
jobs <- mapM readJobFromDisk jids
return $ justOk jobs
-- | Set up the job scheduler. This will also start the monitoring
-- of changes to the running jobs. | 483 | readJobsFromDisk :: IO [JobWithStat]
readJobsFromDisk = do
logInfo "Loading job queue"
qdir <- queueDir
eitherJids <- JQ.getJobIDs [qdir]
let jids = genericResult (const []) JQ.sortJobIDs eitherJids
jidsstring = commaJoin $ map (show . fromJobId) jids
logInfo $ "Non-archived jobs on disk: " ++ jidsstring
jobs <- mapM readJobFromDisk jids
return $ justOk jobs
-- | Set up the job scheduler. This will also start the monitoring
-- of changes to the running jobs. | 483 | readJobsFromDisk = do
logInfo "Loading job queue"
qdir <- queueDir
eitherJids <- JQ.getJobIDs [qdir]
let jids = genericResult (const []) JQ.sortJobIDs eitherJids
jidsstring = commaJoin $ map (show . fromJobId) jids
logInfo $ "Non-archived jobs on disk: " ++ jidsstring
jobs <- mapM readJobFromDisk jids
return $ justOk jobs
-- | Set up the job scheduler. This will also start the monitoring
-- of changes to the running jobs. | 446 | false | true | 0 | 13 | 93 | 127 | 60 | 67 | null | null |
rueshyna/gogol | gogol-analytics/gen/Network/Google/Analytics/Types/Product.hs | mpl-2.0 | gddtRows :: Lens' GaDataDataTable [GaDataDataTableRowsItem]
gddtRows
= lens _gddtRows (\ s a -> s{_gddtRows = a}) .
_Default
. _Coerce | 148 | gddtRows :: Lens' GaDataDataTable [GaDataDataTableRowsItem]
gddtRows
= lens _gddtRows (\ s a -> s{_gddtRows = a}) .
_Default
. _Coerce | 148 | gddtRows
= lens _gddtRows (\ s a -> s{_gddtRows = a}) .
_Default
. _Coerce | 88 | false | true | 0 | 11 | 33 | 52 | 27 | 25 | null | null |
GaloisInc/halvm-ghc | compiler/deSugar/Coverage.hs | bsd-3-clause | addTickLHsExprOptAlt :: Bool -> LHsExpr Id -> TM (LHsExpr Id)
addTickLHsExprOptAlt oneOfMany (L pos e0)
= ifDensity TickForCoverage
(allocTickBox (ExpBox oneOfMany) False False pos $ addTickHsExpr e0)
(addTickLHsExpr (L pos e0)) | 246 | addTickLHsExprOptAlt :: Bool -> LHsExpr Id -> TM (LHsExpr Id)
addTickLHsExprOptAlt oneOfMany (L pos e0)
= ifDensity TickForCoverage
(allocTickBox (ExpBox oneOfMany) False False pos $ addTickHsExpr e0)
(addTickLHsExpr (L pos e0)) | 246 | addTickLHsExprOptAlt oneOfMany (L pos e0)
= ifDensity TickForCoverage
(allocTickBox (ExpBox oneOfMany) False False pos $ addTickHsExpr e0)
(addTickLHsExpr (L pos e0)) | 184 | false | true | 0 | 10 | 48 | 90 | 43 | 47 | null | null |
spechub/Hets | Common/Keywords.hs | gpl-2.0 | falseS :: String
falseS = "false" | 33 | falseS :: String
falseS = "false" | 33 | falseS = "false" | 16 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/nativeGen/X86/Ppr.hs | bsd-3-clause | pprInstr (CVTSD2SS from to) = pprRegReg (sLit "cvtsd2ss") from to | 70 | pprInstr (CVTSD2SS from to) = pprRegReg (sLit "cvtsd2ss") from to | 70 | pprInstr (CVTSD2SS from to) = pprRegReg (sLit "cvtsd2ss") from to | 70 | false | false | 0 | 7 | 14 | 30 | 14 | 16 | null | null |
egison/egison | hs-src/Language/Egison/Math/Normalize.hs | mit | termsGcd :: [TermExpr] -> TermExpr
termsGcd ts@(_:_) =
foldl1 (\(Term a xs) (Term b ys) -> Term (gcd a b) (monoGcd xs ys)) ts
where
monoGcd :: Monomial -> Monomial -> Monomial
monoGcd [] _ = []
monoGcd ((x, n):xs) ys =
case f (x, n) ys of
(_, 0) -> monoGcd xs ys
(z, m) -> (z, m) : monoGcd xs ys
f :: (SymbolExpr, Integer) -> Monomial -> (SymbolExpr, Integer)
f (x, _) [] = (x, 0)
f (Quote x, n) ((Quote y, m):ys)
| x == y = (Quote x, min n m)
| x == mathNegate y = (Quote x, min n m)
| otherwise = f (Quote x, n) ys
f (x, n) ((y, m):ys)
| x == y = (x, min n m)
| otherwise = f (x, n) ys | 663 | termsGcd :: [TermExpr] -> TermExpr
termsGcd ts@(_:_) =
foldl1 (\(Term a xs) (Term b ys) -> Term (gcd a b) (monoGcd xs ys)) ts
where
monoGcd :: Monomial -> Monomial -> Monomial
monoGcd [] _ = []
monoGcd ((x, n):xs) ys =
case f (x, n) ys of
(_, 0) -> monoGcd xs ys
(z, m) -> (z, m) : monoGcd xs ys
f :: (SymbolExpr, Integer) -> Monomial -> (SymbolExpr, Integer)
f (x, _) [] = (x, 0)
f (Quote x, n) ((Quote y, m):ys)
| x == y = (Quote x, min n m)
| x == mathNegate y = (Quote x, min n m)
| otherwise = f (Quote x, n) ys
f (x, n) ((y, m):ys)
| x == y = (x, min n m)
| otherwise = f (x, n) ys | 663 | termsGcd ts@(_:_) =
foldl1 (\(Term a xs) (Term b ys) -> Term (gcd a b) (monoGcd xs ys)) ts
where
monoGcd :: Monomial -> Monomial -> Monomial
monoGcd [] _ = []
monoGcd ((x, n):xs) ys =
case f (x, n) ys of
(_, 0) -> monoGcd xs ys
(z, m) -> (z, m) : monoGcd xs ys
f :: (SymbolExpr, Integer) -> Monomial -> (SymbolExpr, Integer)
f (x, _) [] = (x, 0)
f (Quote x, n) ((Quote y, m):ys)
| x == y = (Quote x, min n m)
| x == mathNegate y = (Quote x, min n m)
| otherwise = f (Quote x, n) ys
f (x, n) ((y, m):ys)
| x == y = (x, min n m)
| otherwise = f (x, n) ys | 628 | false | true | 0 | 10 | 211 | 426 | 224 | 202 | null | null |
avieth/postgresql-simple | src/Database/PostgreSQL/Simple/Time/Implementation.hs | bsd-3-clause | parseZonedTimestamp :: B.ByteString -> Either String ZonedTimestamp
parseZonedTimestamp = A.parseOnly (getZonedTimestamp <* A.endOfInput) | 137 | parseZonedTimestamp :: B.ByteString -> Either String ZonedTimestamp
parseZonedTimestamp = A.parseOnly (getZonedTimestamp <* A.endOfInput) | 137 | parseZonedTimestamp = A.parseOnly (getZonedTimestamp <* A.endOfInput) | 69 | false | true | 0 | 8 | 12 | 36 | 18 | 18 | null | null |
xmonad/xmonad-contrib | XMonad/Prompt.hs | bsd-3-clause | handleBuffer :: (String -> String -> (Bool,Bool))
-> KeyStroke
-> Event
-> XP ()
handleBuffer f stroke event@KeyEvent{ev_event_type = t, ev_state = m} = do
keymask <- gets cleanMask <*> pure m
when (t == keyPress) $ handleInputBuffer f keymask stroke event | 303 | handleBuffer :: (String -> String -> (Bool,Bool))
-> KeyStroke
-> Event
-> XP ()
handleBuffer f stroke event@KeyEvent{ev_event_type = t, ev_state = m} = do
keymask <- gets cleanMask <*> pure m
when (t == keyPress) $ handleInputBuffer f keymask stroke event | 303 | handleBuffer f stroke event@KeyEvent{ev_event_type = t, ev_state = m} = do
keymask <- gets cleanMask <*> pure m
when (t == keyPress) $ handleInputBuffer f keymask stroke event | 183 | false | true | 0 | 10 | 88 | 113 | 57 | 56 | null | null |
abailly/hsgames | chinese/src/Chinese/Interpreter.hs | apache-2.0 | interpretAnswer :: Question -> String -> Answer
interpretAnswer (CharToPinyin _) reply = Pinyin reply | 104 | interpretAnswer :: Question -> String -> Answer
interpretAnswer (CharToPinyin _) reply = Pinyin reply | 104 | interpretAnswer (CharToPinyin _) reply = Pinyin reply | 56 | false | true | 0 | 10 | 16 | 38 | 17 | 21 | null | null |
adrienhaxaire/adrienhaxaire.org | update.hs | bsd-3-clause | sitemapUrl :: Entry -> String
sitemapUrl e = "<url>\n"
++ " <loc>" ++ absoluteUrl e ++ "</loc>\n"
++ " <lastmod>" ++ (ymd $ entryDate e) ++ "</lastmod>\n"
++ " <changefreq>never</changefreq>"
++ "</url>\n" | 268 | sitemapUrl :: Entry -> String
sitemapUrl e = "<url>\n"
++ " <loc>" ++ absoluteUrl e ++ "</loc>\n"
++ " <lastmod>" ++ (ymd $ entryDate e) ++ "</lastmod>\n"
++ " <changefreq>never</changefreq>"
++ "</url>\n" | 268 | sitemapUrl e = "<url>\n"
++ " <loc>" ++ absoluteUrl e ++ "</loc>\n"
++ " <lastmod>" ++ (ymd $ entryDate e) ++ "</lastmod>\n"
++ " <changefreq>never</changefreq>"
++ "</url>\n" | 238 | false | true | 12 | 8 | 94 | 75 | 32 | 43 | null | null |
sjcjoosten/amperspiegel | src/TokenAwareParser.hs | gpl-3.0 | makeQuoted :: a -> Atom a
makeQuoted = UserAtom . QuotedString | 62 | makeQuoted :: a -> Atom a
makeQuoted = UserAtom . QuotedString | 62 | makeQuoted = UserAtom . QuotedString | 36 | false | true | 0 | 6 | 10 | 22 | 11 | 11 | null | null |
adarqui/todomvc-haskell-servant-purescript | haskell_src/Todo/App.hs | mit | -- | newTodoApp
--
newTodoApp :: TodoApp
newTodoApp = TodoApp M.empty 0 | 71 | newTodoApp :: TodoApp
newTodoApp = TodoApp M.empty 0 | 52 | newTodoApp = TodoApp M.empty 0 | 30 | true | true | 0 | 6 | 11 | 20 | 11 | 9 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/book/2007-Programming_in_Haskell-1st_Edition-Graham_Hutton/ch_05_7.hs | unlicense | e82 :: [Test]
e82 = U.t "e82"
(count 's' "Mississippi")
4 | 67 | e82 :: [Test]
e82 = U.t "e82"
(count 's' "Mississippi")
4 | 67 | e82 = U.t "e82"
(count 's' "Mississippi")
4 | 53 | false | true | 0 | 7 | 20 | 40 | 17 | 23 | null | null |
charles-l/comp | build_me_a_scheme/scheme.hs | mit | unpackNum notNum = throwError $ TypeMismatch "number" notNum | 60 | unpackNum notNum = throwError $ TypeMismatch "number" notNum | 60 | unpackNum notNum = throwError $ TypeMismatch "number" notNum | 60 | false | false | 1 | 6 | 7 | 21 | 8 | 13 | null | null |
sdiehl/ghc | compiler/utils/Dominators.hs | bsd-3-clause | fromAdj :: [(Node, [Node])] -> Graph
fromAdj = IM.fromList . fmap (second IS.fromList) | 87 | fromAdj :: [(Node, [Node])] -> Graph
fromAdj = IM.fromList . fmap (second IS.fromList) | 86 | fromAdj = IM.fromList . fmap (second IS.fromList) | 49 | false | true | 1 | 9 | 13 | 51 | 25 | 26 | null | null |
liamoc/patches-vector | Data/Patch/Internal.hs | bsd-3-clause | -- | Render a patch on a document as a list of change hunks. Good for displaying
-- a patch to a user.
--
-- prop> forAll (patchesFrom d) $ \p -> Vector.concat (map fst (filter ((/= Deleted) . snd) (hunks p d))) == apply p d
hunks :: Patch a -> Vector a -> Hunks a
hunks (Patch s) i = map eachGroup $ List.groupBy ((==) `on` snd) $ go s i 0
where go [] v _ | Vector.null v = []
| otherwise = [(v, Unchanged)]
go (a : as) v x
| x' <- a ^. index
= let (prefix, rest) = Vector.splitAt (x' - x) v
hunk (Insert _ c) = (Vector.singleton c, Inserted)
hunk (Replace _ _ c) = (Vector.singleton c, Replaced)
hunk (Delete _ c) = (Vector.singleton c, Deleted)
offset (Insert {}) = 0
offset _ = 1
in (if x' > x then ((prefix,Unchanged) :) else id) $ hunk a : go as (Vector.drop (offset a) rest) (x' + offset a)
eachGroup r@((_,st):_) = (Vector.concat (map fst r), st)
eachGroup [] = error "impossible!" | 1,054 | hunks :: Patch a -> Vector a -> Hunks a
hunks (Patch s) i = map eachGroup $ List.groupBy ((==) `on` snd) $ go s i 0
where go [] v _ | Vector.null v = []
| otherwise = [(v, Unchanged)]
go (a : as) v x
| x' <- a ^. index
= let (prefix, rest) = Vector.splitAt (x' - x) v
hunk (Insert _ c) = (Vector.singleton c, Inserted)
hunk (Replace _ _ c) = (Vector.singleton c, Replaced)
hunk (Delete _ c) = (Vector.singleton c, Deleted)
offset (Insert {}) = 0
offset _ = 1
in (if x' > x then ((prefix,Unchanged) :) else id) $ hunk a : go as (Vector.drop (offset a) rest) (x' + offset a)
eachGroup r@((_,st):_) = (Vector.concat (map fst r), st)
eachGroup [] = error "impossible!" | 825 | hunks (Patch s) i = map eachGroup $ List.groupBy ((==) `on` snd) $ go s i 0
where go [] v _ | Vector.null v = []
| otherwise = [(v, Unchanged)]
go (a : as) v x
| x' <- a ^. index
= let (prefix, rest) = Vector.splitAt (x' - x) v
hunk (Insert _ c) = (Vector.singleton c, Inserted)
hunk (Replace _ _ c) = (Vector.singleton c, Replaced)
hunk (Delete _ c) = (Vector.singleton c, Deleted)
offset (Insert {}) = 0
offset _ = 1
in (if x' > x then ((prefix,Unchanged) :) else id) $ hunk a : go as (Vector.drop (offset a) rest) (x' + offset a)
eachGroup r@((_,st):_) = (Vector.concat (map fst r), st)
eachGroup [] = error "impossible!" | 785 | true | true | 2 | 13 | 346 | 420 | 217 | 203 | null | null |
kowey/GenI | geni-test/NLP/GenI/Test/Semantics.hs | gpl-2.0 | isSuccess :: UnificationResult -> Bool
isSuccess NLP.GenI.GeniVal.Failure = False | 81 | isSuccess :: UnificationResult -> Bool
isSuccess NLP.GenI.GeniVal.Failure = False | 81 | isSuccess NLP.GenI.GeniVal.Failure = False | 42 | false | true | 0 | 6 | 8 | 22 | 12 | 10 | null | null |
mettekou/ghc | compiler/typecheck/TcGenDeriv.hs | bsd-3-clause | kind1, kind2 :: Kind
kind1 = liftedTypeKind `mkFunTy` liftedTypeKind | 68 | kind1, kind2 :: Kind
kind1 = liftedTypeKind `mkFunTy` liftedTypeKind | 68 | kind1 = liftedTypeKind `mkFunTy` liftedTypeKind | 47 | false | true | 2 | 6 | 8 | 27 | 12 | 15 | null | null |
vincenthz/hs-crypto-pubkey | Crypto/PubKey/RSA/OAEP.hs | bsd-2-clause | decrypt :: Maybe Blinder -- ^ Optional blinder
-> OAEPParams -- ^ OAEP params to use for decryption
-> PrivateKey -- ^ Private key
-> ByteString -- ^ Cipher text
-> Either Error ByteString
decrypt blinder oaep pk cipher
| B.length cipher /= k = Left MessageSizeIncorrect
| k < 2*hashLen+2 = Left InvalidParameters
| otherwise = unpad oaep (private_size pk) $ dp blinder pk cipher
where -- parameters
k = private_size pk
hashF = oaepHash oaep
hashLen = B.length (hashF B.empty)
-- | Decrypt a ciphertext using OAEP and by automatically generating a blinder. | 677 | decrypt :: Maybe Blinder -- ^ Optional blinder
-> OAEPParams -- ^ OAEP params to use for decryption
-> PrivateKey -- ^ Private key
-> ByteString -- ^ Cipher text
-> Either Error ByteString
decrypt blinder oaep pk cipher
| B.length cipher /= k = Left MessageSizeIncorrect
| k < 2*hashLen+2 = Left InvalidParameters
| otherwise = unpad oaep (private_size pk) $ dp blinder pk cipher
where -- parameters
k = private_size pk
hashF = oaepHash oaep
hashLen = B.length (hashF B.empty)
-- | Decrypt a ciphertext using OAEP and by automatically generating a blinder. | 677 | decrypt blinder oaep pk cipher
| B.length cipher /= k = Left MessageSizeIncorrect
| k < 2*hashLen+2 = Left InvalidParameters
| otherwise = unpad oaep (private_size pk) $ dp blinder pk cipher
where -- parameters
k = private_size pk
hashF = oaepHash oaep
hashLen = B.length (hashF B.empty)
-- | Decrypt a ciphertext using OAEP and by automatically generating a blinder. | 447 | false | true | 0 | 10 | 215 | 159 | 77 | 82 | null | null |
AlexanderPankiv/ghc | compiler/nativeGen/X86/Ppr.hs | bsd-3-clause | pprFormatFormatRegReg :: LitString -> Format -> Format -> Reg -> Reg -> SDoc
pprFormatFormatRegReg name format1 format2 reg1 reg2
= hcat [
char '\t',
ptext name,
pprFormat format1,
pprFormat format2,
space,
pprReg format1 reg1,
comma,
pprReg format2 reg2
] | 326 | pprFormatFormatRegReg :: LitString -> Format -> Format -> Reg -> Reg -> SDoc
pprFormatFormatRegReg name format1 format2 reg1 reg2
= hcat [
char '\t',
ptext name,
pprFormat format1,
pprFormat format2,
space,
pprReg format1 reg1,
comma,
pprReg format2 reg2
] | 326 | pprFormatFormatRegReg name format1 format2 reg1 reg2
= hcat [
char '\t',
ptext name,
pprFormat format1,
pprFormat format2,
space,
pprReg format1 reg1,
comma,
pprReg format2 reg2
] | 249 | false | true | 0 | 9 | 108 | 91 | 46 | 45 | null | null |
mightybyte/reflex-dom-stubs | src/GHCJS/DOM/HTMLInputElement.hs | bsd-3-clause | htmlInputElementGetAutocapitalize = undefined | 45 | htmlInputElementGetAutocapitalize = undefined | 45 | htmlInputElementGetAutocapitalize = undefined | 45 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
dblia/nosql-ganeti | test/hs/Test/Ganeti/Types.hs | gpl-2.0 | -- | Tests equivalence with Python, based on Constants.hs code.
case_CVErrorCode_pyequiv :: Assertion
case_CVErrorCode_pyequiv = do
let all_py_codes = sort C.cvAllEcodesStrings
all_hs_codes = sort $ map Types.cVErrorCodeToRaw [minBound..maxBound]
assertEqual "for CVErrorCode equivalence" all_py_codes all_hs_codes
-- | Test 'Hypervisor' serialisation. | 363 | case_CVErrorCode_pyequiv :: Assertion
case_CVErrorCode_pyequiv = do
let all_py_codes = sort C.cvAllEcodesStrings
all_hs_codes = sort $ map Types.cVErrorCodeToRaw [minBound..maxBound]
assertEqual "for CVErrorCode equivalence" all_py_codes all_hs_codes
-- | Test 'Hypervisor' serialisation. | 299 | case_CVErrorCode_pyequiv = do
let all_py_codes = sort C.cvAllEcodesStrings
all_hs_codes = sort $ map Types.cVErrorCodeToRaw [minBound..maxBound]
assertEqual "for CVErrorCode equivalence" all_py_codes all_hs_codes
-- | Test 'Hypervisor' serialisation. | 261 | true | true | 0 | 12 | 49 | 58 | 29 | 29 | null | null |
GaloisInc/saw-script | heapster-saw/src/Verifier/SAW/Heapster/archival/TypedCrucible.hs | bsd-3-clause | weakenEnvSetPerms :: PermSet ctx' -> Weakening ctx ctx' ->
PermCheckEnv ret ctx -> PermCheckEnv ret ctx'
weakenEnvSetPerms perms w (PermCheckEnv { .. }) =
PermCheckEnv { envCurPerms = perms,
envRetPerms = map (weaken (weakenWeakening1 w)) envRetPerms } | 292 | weakenEnvSetPerms :: PermSet ctx' -> Weakening ctx ctx' ->
PermCheckEnv ret ctx -> PermCheckEnv ret ctx'
weakenEnvSetPerms perms w (PermCheckEnv { .. }) =
PermCheckEnv { envCurPerms = perms,
envRetPerms = map (weaken (weakenWeakening1 w)) envRetPerms } | 292 | weakenEnvSetPerms perms w (PermCheckEnv { .. }) =
PermCheckEnv { envCurPerms = perms,
envRetPerms = map (weaken (weakenWeakening1 w)) envRetPerms } | 166 | false | true | 0 | 12 | 76 | 96 | 46 | 50 | null | null |
coolhacks/scripts-hacks | examples/shellcheck-master/ShellCheck/Parser.hs | mit | readIoNumber = try $ do
x <- many1 digit <|> string "&"
lookAhead readIoFileOp
return x | 99 | readIoNumber = try $ do
x <- many1 digit <|> string "&"
lookAhead readIoFileOp
return x | 99 | readIoNumber = try $ do
x <- many1 digit <|> string "&"
lookAhead readIoFileOp
return x | 99 | false | false | 0 | 10 | 27 | 39 | 16 | 23 | null | null |
brendanhay/gogol | gogol-abusiveexperiencereport/gen/Network/Google/AbusiveExperienceReport/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'ViolatingSitesResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'vsrViolatingSites'
violatingSitesResponse
:: ViolatingSitesResponse
violatingSitesResponse = ViolatingSitesResponse' {_vsrViolatingSites = Nothing} | 334 | violatingSitesResponse
:: ViolatingSitesResponse
violatingSitesResponse = ViolatingSitesResponse' {_vsrViolatingSites = Nothing} | 132 | violatingSitesResponse = ViolatingSitesResponse' {_vsrViolatingSites = Nothing} | 79 | true | true | 1 | 7 | 46 | 28 | 16 | 12 | null | null |
shouya/poi | src/Deploy.hs | gpl-3.0 | deploy :: IO ()
deploy = shelly $ withShellConfig $ do
checkoutLatestSource
runScript | 89 | deploy :: IO ()
deploy = shelly $ withShellConfig $ do
checkoutLatestSource
runScript | 89 | deploy = shelly $ withShellConfig $ do
checkoutLatestSource
runScript | 73 | false | true | 0 | 7 | 16 | 30 | 14 | 16 | null | null |
Zigazou/containers | Data/Sequence.hs | bsd-3-clause | -- | fromList2, given a list and its length, constructs a completely
-- balanced Seq whose elements are that list using the replicateA
-- generalization.
fromList2 :: Int -> [a] -> Seq a
fromList2 n = execState (replicateA n (State ht))
where
ht (x:xs) = (xs, x)
ht [] = error "fromList2: short list"
-- | A 'PQueue' is a simple pairing heap. | 357 | fromList2 :: Int -> [a] -> Seq a
fromList2 n = execState (replicateA n (State ht))
where
ht (x:xs) = (xs, x)
ht [] = error "fromList2: short list"
-- | A 'PQueue' is a simple pairing heap. | 203 | fromList2 n = execState (replicateA n (State ht))
where
ht (x:xs) = (xs, x)
ht [] = error "fromList2: short list"
-- | A 'PQueue' is a simple pairing heap. | 170 | true | true | 1 | 8 | 77 | 95 | 46 | 49 | null | null |
adamschoenemann/simple-frp | src/FRP/TypeChecker.hs | mit | inlineTypes ty trm = return trm | 31 | inlineTypes ty trm = return trm | 31 | inlineTypes ty trm = return trm | 31 | false | false | 0 | 5 | 5 | 14 | 6 | 8 | null | null |
avaitla/Haskell-to-C---Bridge | src/GCCXML/Declarations/PatternParser.hs | bsd-3-clause | join parser name xs (Just sep) = result where
result = name ++ [beginChar parser]
++ " " ++ concat (intersperse sep xs)
++ " " ++ [endChar parser] | 174 | join parser name xs (Just sep) = result where
result = name ++ [beginChar parser]
++ " " ++ concat (intersperse sep xs)
++ " " ++ [endChar parser] | 174 | join parser name xs (Just sep) = result where
result = name ++ [beginChar parser]
++ " " ++ concat (intersperse sep xs)
++ " " ++ [endChar parser] | 174 | false | false | 0 | 11 | 56 | 70 | 35 | 35 | null | null |
aufheben/Y86 | Simulator/src/Simulator/Util.hs | mit | formatInstr (Cmovle ra rb) = irr "cmovle" ra rb | 49 | formatInstr (Cmovle ra rb) = irr "cmovle" ra rb | 49 | formatInstr (Cmovle ra rb) = irr "cmovle" ra rb | 49 | false | false | 0 | 7 | 10 | 24 | 11 | 13 | null | null |
rahulmutt/ghcvm | compiler/Eta/Prelude/PrimOp.hs | bsd-3-clause | primOpInfo IndexByteArrayOp_Double = mkGenPrimOp (fsLit "indexDoubleArray#") [] [byteArrayPrimTy, intPrimTy] (doublePrimTy) | 124 | primOpInfo IndexByteArrayOp_Double = mkGenPrimOp (fsLit "indexDoubleArray#") [] [byteArrayPrimTy, intPrimTy] (doublePrimTy) | 124 | primOpInfo IndexByteArrayOp_Double = mkGenPrimOp (fsLit "indexDoubleArray#") [] [byteArrayPrimTy, intPrimTy] (doublePrimTy) | 124 | false | false | 0 | 7 | 10 | 35 | 18 | 17 | null | null |
mrakgr/futhark | src/Futhark/Representation/Kernels/Simplify.hs | bsd-3-clause | simplifyKernelStm scope (GroupStream pes w maxchunk lam accs arrs) = do
w' <- Engine.simplify w
maxchunk' <- Engine.simplify maxchunk
accs' <- mapM Engine.simplify accs
arrs' <- mapM Engine.simplify arrs
lam' <- simplifyGroupStreamLambda scope lam w
w (map (const Nothing) arrs')
pes' <- inspectPatElems pes $
zip (repeat mempty) $ repeat (Nothing, Nothing)
return [GroupStream pes' w' maxchunk' lam' accs' arrs'] | 447 | simplifyKernelStm scope (GroupStream pes w maxchunk lam accs arrs) = do
w' <- Engine.simplify w
maxchunk' <- Engine.simplify maxchunk
accs' <- mapM Engine.simplify accs
arrs' <- mapM Engine.simplify arrs
lam' <- simplifyGroupStreamLambda scope lam w
w (map (const Nothing) arrs')
pes' <- inspectPatElems pes $
zip (repeat mempty) $ repeat (Nothing, Nothing)
return [GroupStream pes' w' maxchunk' lam' accs' arrs'] | 447 | simplifyKernelStm scope (GroupStream pes w maxchunk lam accs arrs) = do
w' <- Engine.simplify w
maxchunk' <- Engine.simplify maxchunk
accs' <- mapM Engine.simplify accs
arrs' <- mapM Engine.simplify arrs
lam' <- simplifyGroupStreamLambda scope lam w
w (map (const Nothing) arrs')
pes' <- inspectPatElems pes $
zip (repeat mempty) $ repeat (Nothing, Nothing)
return [GroupStream pes' w' maxchunk' lam' accs' arrs'] | 447 | false | false | 0 | 12 | 93 | 171 | 77 | 94 | null | null |
input-output-hk/pos-haskell-prototype | lib/test/Test/Pos/Ssc/SeedSpec.hs | mit | generateKeysAndMpc threshold n = do
keys' <- generate $ nonrepeating n
vssKeys <- sortWith toVssPublicKey <$> generate (nonrepeating n)
let lvssPubKeys = NE.fromList $ map toVssPublicKey vssKeys
(comms, opens) <-
unzip <$> replicateM n (randCommitmentAndOpening threshold lvssPubKeys)
return (keys', NE.fromList vssKeys, comms, opens) | 379 | generateKeysAndMpc threshold n = do
keys' <- generate $ nonrepeating n
vssKeys <- sortWith toVssPublicKey <$> generate (nonrepeating n)
let lvssPubKeys = NE.fromList $ map toVssPublicKey vssKeys
(comms, opens) <-
unzip <$> replicateM n (randCommitmentAndOpening threshold lvssPubKeys)
return (keys', NE.fromList vssKeys, comms, opens) | 379 | generateKeysAndMpc threshold n = do
keys' <- generate $ nonrepeating n
vssKeys <- sortWith toVssPublicKey <$> generate (nonrepeating n)
let lvssPubKeys = NE.fromList $ map toVssPublicKey vssKeys
(comms, opens) <-
unzip <$> replicateM n (randCommitmentAndOpening threshold lvssPubKeys)
return (keys', NE.fromList vssKeys, comms, opens) | 379 | false | false | 0 | 11 | 87 | 122 | 57 | 65 | null | null |
leshchevds/ganeti | src/Ganeti/HTools/Backend/Rapi.hs | bsd-2-clause | parseGroup :: JSRecord -> Result (String, Group.Group)
parseGroup a = do
name <- tryFromObj "Parsing new group" a "name"
let extract s = tryFromObj ("Group '" ++ name ++ "'") a s
let extractDef s d = fromObjWithDefault a s d
uuid <- extract "uuid"
apol <- extract "alloc_policy"
ipol <- extract "ipolicy"
tags <- extract "tags"
nets <- extractDef "networks" []
return (uuid, Group.create name uuid apol nets ipol tags)
-- | Parse cluster data from the info resource. | 485 | parseGroup :: JSRecord -> Result (String, Group.Group)
parseGroup a = do
name <- tryFromObj "Parsing new group" a "name"
let extract s = tryFromObj ("Group '" ++ name ++ "'") a s
let extractDef s d = fromObjWithDefault a s d
uuid <- extract "uuid"
apol <- extract "alloc_policy"
ipol <- extract "ipolicy"
tags <- extract "tags"
nets <- extractDef "networks" []
return (uuid, Group.create name uuid apol nets ipol tags)
-- | Parse cluster data from the info resource. | 485 | parseGroup a = do
name <- tryFromObj "Parsing new group" a "name"
let extract s = tryFromObj ("Group '" ++ name ++ "'") a s
let extractDef s d = fromObjWithDefault a s d
uuid <- extract "uuid"
apol <- extract "alloc_policy"
ipol <- extract "ipolicy"
tags <- extract "tags"
nets <- extractDef "networks" []
return (uuid, Group.create name uuid apol nets ipol tags)
-- | Parse cluster data from the info resource. | 430 | false | true | 0 | 14 | 98 | 181 | 81 | 100 | null | null |
gnn/Hets | HasCASL/InteractiveTests.hs | gpl-2.0 | infoGS :: GenSig -> Doc
infoGS (GenSig mn1 nsl mn2) = sepByCommas [infoMN mn1, parens $ sepBySemis $ map infoNS nsl, infoMN mn2] | 128 | infoGS :: GenSig -> Doc
infoGS (GenSig mn1 nsl mn2) = sepByCommas [infoMN mn1, parens $ sepBySemis $ map infoNS nsl, infoMN mn2] | 128 | infoGS (GenSig mn1 nsl mn2) = sepByCommas [infoMN mn1, parens $ sepBySemis $ map infoNS nsl, infoMN mn2] | 104 | false | true | 0 | 8 | 22 | 59 | 29 | 30 | null | null |
oldmanmike/ghc | compiler/utils/Outputable.hs | bsd-3-clause | -- | Style for printing error messages
mkErrStyle :: DynFlags -> PrintUnqualified -> PprStyle
mkErrStyle dflags qual = mkUserStyle qual (PartWay (pprUserLength dflags)) | 168 | mkErrStyle :: DynFlags -> PrintUnqualified -> PprStyle
mkErrStyle dflags qual = mkUserStyle qual (PartWay (pprUserLength dflags)) | 129 | mkErrStyle dflags qual = mkUserStyle qual (PartWay (pprUserLength dflags)) | 74 | true | true | 0 | 9 | 22 | 42 | 21 | 21 | null | null |
sbidin/sdl2-mixer | src/SDL/Mixer.hs | bsd-3-clause | channelFinishedFunPtr :: IORef (FunPtr (SDL.Raw.Mixer.Channel -> IO ()))
channelFinishedFunPtr = unsafePerformIO $ newIORef nullFunPtr | 134 | channelFinishedFunPtr :: IORef (FunPtr (SDL.Raw.Mixer.Channel -> IO ()))
channelFinishedFunPtr = unsafePerformIO $ newIORef nullFunPtr | 134 | channelFinishedFunPtr = unsafePerformIO $ newIORef nullFunPtr | 61 | false | true | 1 | 11 | 13 | 46 | 22 | 24 | null | null |
xnning/fcore | lib/SymbolicEvaluator.hs | bsd-2-clause | prettyTree (Fork e (Left (l,r))) s stop =
let s1 = pretty e
(s2, stop2) = prettyTree l (s <+> text "&&" <+> s1) stop
(s3, stop3) = prettyTree r (s <+> text "&&" <+> prependNot s1) stop2
in (s2 <> s3, stop3) | 230 | prettyTree (Fork e (Left (l,r))) s stop =
let s1 = pretty e
(s2, stop2) = prettyTree l (s <+> text "&&" <+> s1) stop
(s3, stop3) = prettyTree r (s <+> text "&&" <+> prependNot s1) stop2
in (s2 <> s3, stop3) | 230 | prettyTree (Fork e (Left (l,r))) s stop =
let s1 = pretty e
(s2, stop2) = prettyTree l (s <+> text "&&" <+> s1) stop
(s3, stop3) = prettyTree r (s <+> text "&&" <+> prependNot s1) stop2
in (s2 <> s3, stop3) | 230 | false | false | 0 | 13 | 66 | 126 | 64 | 62 | null | null |
kapilash/ccs2cs | src/Language/CCS/Data.hs | apache-2.0 | isMacro _ = False | 28 | isMacro _ = False | 28 | isMacro _ = False | 28 | false | false | 0 | 4 | 14 | 10 | 4 | 6 | null | null |
laszlopandy/elm-compiler | src/Elm/Compiler/Version.hs | bsd-3-clause | version :: Version
version =
case rawVersion of
major : minor : patch : _ ->
Version major minor patch
[major, minor] ->
Version major minor 0
[major] ->
Version major 0 0
[] ->
error "could not detect version of elm-compiler you are using" | 293 | version :: Version
version =
case rawVersion of
major : minor : patch : _ ->
Version major minor patch
[major, minor] ->
Version major minor 0
[major] ->
Version major 0 0
[] ->
error "could not detect version of elm-compiler you are using" | 293 | version =
case rawVersion of
major : minor : patch : _ ->
Version major minor patch
[major, minor] ->
Version major minor 0
[major] ->
Version major 0 0
[] ->
error "could not detect version of elm-compiler you are using" | 274 | false | true | 0 | 10 | 97 | 92 | 44 | 48 | null | null |
TiloWiklund/pinot | src/Formats.hs | bsd-3-clause | htmlTarget :: TargetFormat
htmlTarget = over (each . _1) (swapExtension ".html") . over (each . _2) compile
where compile = P.toHtml . P.fromNotebook | 151 | htmlTarget :: TargetFormat
htmlTarget = over (each . _1) (swapExtension ".html") . over (each . _2) compile
where compile = P.toHtml . P.fromNotebook | 151 | htmlTarget = over (each . _1) (swapExtension ".html") . over (each . _2) compile
where compile = P.toHtml . P.fromNotebook | 124 | false | true | 0 | 8 | 24 | 61 | 31 | 30 | null | null |
martindavid/code-sandbox | comp90048/assignments/assignment1/HaskellTest.hs | mit | -- | Run the provided test or suite, logging the output to the named file.
test :: String -> String -> TestCase -> IO ()
test username fileName test = do
fhandle <- openFile fileName WriteMode
hPutStrLn fhandle ("Begin test of submission for " ++ username)
testToHandle fhandle False test
hClose fhandle
-- | Run the provided test or suite, logging the output to standard out. | 386 | test :: String -> String -> TestCase -> IO ()
test username fileName test = do
fhandle <- openFile fileName WriteMode
hPutStrLn fhandle ("Begin test of submission for " ++ username)
testToHandle fhandle False test
hClose fhandle
-- | Run the provided test or suite, logging the output to standard out. | 311 | test username fileName test = do
fhandle <- openFile fileName WriteMode
hPutStrLn fhandle ("Begin test of submission for " ++ username)
testToHandle fhandle False test
hClose fhandle
-- | Run the provided test or suite, logging the output to standard out. | 265 | true | true | 0 | 10 | 75 | 85 | 38 | 47 | null | null |
stevezhee/grm | Grm/Prims.hs | bsd-3-clause | lrPoint :: [Point] -> Point
lrPoint xs = case filter ((/=) noPoint) xs of
[] -> noPoint
_ -> Point (minimum $ map beginLoc xs) (maximum $ map endLoc xs) | 156 | lrPoint :: [Point] -> Point
lrPoint xs = case filter ((/=) noPoint) xs of
[] -> noPoint
_ -> Point (minimum $ map beginLoc xs) (maximum $ map endLoc xs) | 156 | lrPoint xs = case filter ((/=) noPoint) xs of
[] -> noPoint
_ -> Point (minimum $ map beginLoc xs) (maximum $ map endLoc xs) | 128 | false | true | 0 | 11 | 33 | 84 | 42 | 42 | null | null |
circuithub/circuithub-prelude | Data/Either/Validation/Extra.hs | mit | -- | Convert a @Success a@ into a @Just a@
successMay :: Validation e a -> Maybe a
successMay (Success x) = Just x | 114 | successMay :: Validation e a -> Maybe a
successMay (Success x) = Just x | 71 | successMay (Success x) = Just x | 31 | true | true | 0 | 6 | 23 | 40 | 18 | 22 | null | null |
snoyberg/ghc | compiler/coreSyn/CoreSyn.hs | bsd-3-clause | mkIntLitInt dflags n = Lit (mkMachInt dflags (toInteger n)) | 59 | mkIntLitInt dflags n = Lit (mkMachInt dflags (toInteger n)) | 59 | mkIntLitInt dflags n = Lit (mkMachInt dflags (toInteger n)) | 59 | false | false | 0 | 9 | 8 | 28 | 13 | 15 | null | null |
GaloisInc/halvm-ghc | compiler/typecheck/TcType.hs | bsd-3-clause | isRhoTy _ = True | 38 | isRhoTy _ = True | 38 | isRhoTy _ = True | 38 | false | false | 0 | 4 | 25 | 10 | 4 | 6 | null | null |
HIPERFIT/futhark | src/Futhark/IR/MC.hs | isc | simplifyProg :: Prog MC -> PassM (Prog MC)
simplifyProg = Simplify.simplifyProg simpleMC rules blockers
where
blockers = Engine.noExtraHoistBlockers
rules = standardRules <> segOpRules | 194 | simplifyProg :: Prog MC -> PassM (Prog MC)
simplifyProg = Simplify.simplifyProg simpleMC rules blockers
where
blockers = Engine.noExtraHoistBlockers
rules = standardRules <> segOpRules | 194 | simplifyProg = Simplify.simplifyProg simpleMC rules blockers
where
blockers = Engine.noExtraHoistBlockers
rules = standardRules <> segOpRules | 151 | false | true | 1 | 8 | 32 | 57 | 27 | 30 | null | null |
wamaral/slaskellbot | src/Util.hs | bsd-3-clause | envFail :: String -> IO String
envFail var = envDefault (error var ++ " not set") var | 85 | envFail :: String -> IO String
envFail var = envDefault (error var ++ " not set") var | 85 | envFail var = envDefault (error var ++ " not set") var | 54 | false | true | 0 | 8 | 16 | 36 | 17 | 19 | null | null |
riottracker/sequencer | src/Sound/Sequencer/Editor.hs | bsd-3-clause | updateNth :: Int -> (a -> a) -> [a] -> [a]
updateNth n u (x:xs)
| n == 0 = u x : xs
| otherwise = x : updateNth (n - 1) u xs | 131 | updateNth :: Int -> (a -> a) -> [a] -> [a]
updateNth n u (x:xs)
| n == 0 = u x : xs
| otherwise = x : updateNth (n - 1) u xs | 131 | updateNth n u (x:xs)
| n == 0 = u x : xs
| otherwise = x : updateNth (n - 1) u xs | 88 | false | true | 1 | 8 | 41 | 92 | 47 | 45 | null | null |
shlevy/ghc | compiler/hsSyn/HsPat.hs | bsd-3-clause | isCompoundPat (VarPat {}) = False | 42 | isCompoundPat (VarPat {}) = False | 42 | isCompoundPat (VarPat {}) = False | 42 | false | false | 0 | 7 | 13 | 16 | 8 | 8 | null | null |
UCSD-PL/RefScript | src/Language/Rsc/Pretty/Types.hs | bsd-3-clause | rangle = char '>' | 19 | rangle = char '>' | 19 | rangle = char '>' | 19 | false | false | 0 | 5 | 5 | 9 | 4 | 5 | null | null |
AlexanderPankiv/ghc | compiler/typecheck/TcRnTypes.hs | bsd-3-clause | {- Note [eqCanRewrite]
~~~~~~~~~~~~~~~~~~~
(eqCanRewrite ct1 ct2) holds if the constraint ct1 (a CTyEqCan of form
tv ~ ty) can be used to rewrite ct2. It must satisfy the properties of
a can-rewrite relation, see Definition [Can-rewrite relation]
With the solver handling Coercible constraints like equality constraints,
the rewrite conditions must take role into account, never allowing
a representational equality to rewrite a nominal one.
Note [Wanteds do not rewrite Wanteds]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We don't allow Wanteds to rewrite Wanteds, because that can give rise
to very confusing type error messages. A good example is Trac #8450.
Here's another
f :: a -> Bool
f x = ( [x,'c'], [x,True] ) `seq` True
Here we get
[W] a ~ Char
[W] a ~ Bool
but we do not want to complain about Bool ~ Char!
Note [Deriveds do rewrite Deriveds]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
However we DO allow Deriveds to rewrite Deriveds, because that's how
improvement works; see Note [The improvement story] in TcInteract.
However, for now at least I'm only letting (Derived,NomEq) rewrite
(Derived,NomEq) and not doing anything for ReprEq. If we have
eqCanRewriteFR (Derived, NomEq) (Derived, _) = True
then we lose the property of Note [Can-rewrite relation]
R2. If f1 >= f, and f2 >= f,
then either f1 >= f2 or f2 >= f1
Consider f1 = (Given, ReprEq)
f2 = (Derived, NomEq)
f = (Derived, ReprEq)
I thought maybe we could never get Derived ReprEq constraints, but
we can; straight from the Wanteds during improvment. And from a Derived
ReprEq we could conceivably get a Derived NomEq improvment (by decomposing
a type constructor with Nomninal role), and hence unify.
Note [canRewriteOrSame]
~~~~~~~~~~~~~~~~~~~~~~~
canRewriteOrSame is similar but
* returns True for Wanted/Wanted.
* works for all kinds of constraints, not just CTyEqCans
See the call sites for explanations.
-}
eqCanRewrite :: CtEvidence -> CtEvidence -> Bool
eqCanRewrite ev1 ev2 = ctEvFlavourRole ev1 `eqCanRewriteFR` ctEvFlavourRole ev2 | 2,062 | eqCanRewrite :: CtEvidence -> CtEvidence -> Bool
eqCanRewrite ev1 ev2 = ctEvFlavourRole ev1 `eqCanRewriteFR` ctEvFlavourRole ev2 | 128 | eqCanRewrite ev1 ev2 = ctEvFlavourRole ev1 `eqCanRewriteFR` ctEvFlavourRole ev2 | 79 | true | true | 0 | 6 | 370 | 37 | 19 | 18 | null | null |
ony/hledger | hledger/Hledger/Cli/CliOptions.hs | gpl-3.0 | -- | Get all sorted unique filenames in the current user's PATH.
-- We do not currently filter out non-file objects or files without execute permission.
likelyExecutablesInPath :: IO [String]
likelyExecutablesInPath = do
pathdirs <- splitOneOf "[:;]" `fmap` getEnvSafe "PATH"
pathfiles <- concat `fmap` mapM getDirectoryContentsSafe pathdirs
return $ nub $ sort pathfiles
-- exclude directories and files without execute permission.
-- These will do a stat for each hledger-*, probably ok.
-- But they need paths, not just filenames
-- exes' <- filterM doesFileExist exe'
-- exes'' <- filterM isExecutable exes'
-- return exes''
-- | Get the sorted unique filenames of all hledger-* executables in
-- the current user's PATH. These are files in any of the PATH directories,
-- named hledger-*, with either no extension (and no periods in the name)
-- or one of the addonExtensions.
-- We do not currently filter out non-file objects or files without execute permission. | 992 | likelyExecutablesInPath :: IO [String]
likelyExecutablesInPath = do
pathdirs <- splitOneOf "[:;]" `fmap` getEnvSafe "PATH"
pathfiles <- concat `fmap` mapM getDirectoryContentsSafe pathdirs
return $ nub $ sort pathfiles
-- exclude directories and files without execute permission.
-- These will do a stat for each hledger-*, probably ok.
-- But they need paths, not just filenames
-- exes' <- filterM doesFileExist exe'
-- exes'' <- filterM isExecutable exes'
-- return exes''
-- | Get the sorted unique filenames of all hledger-* executables in
-- the current user's PATH. These are files in any of the PATH directories,
-- named hledger-*, with either no extension (and no periods in the name)
-- or one of the addonExtensions.
-- We do not currently filter out non-file objects or files without execute permission. | 838 | likelyExecutablesInPath = do
pathdirs <- splitOneOf "[:;]" `fmap` getEnvSafe "PATH"
pathfiles <- concat `fmap` mapM getDirectoryContentsSafe pathdirs
return $ nub $ sort pathfiles
-- exclude directories and files without execute permission.
-- These will do a stat for each hledger-*, probably ok.
-- But they need paths, not just filenames
-- exes' <- filterM doesFileExist exe'
-- exes'' <- filterM isExecutable exes'
-- return exes''
-- | Get the sorted unique filenames of all hledger-* executables in
-- the current user's PATH. These are files in any of the PATH directories,
-- named hledger-*, with either no extension (and no periods in the name)
-- or one of the addonExtensions.
-- We do not currently filter out non-file objects or files without execute permission. | 799 | true | true | 0 | 9 | 176 | 81 | 46 | 35 | null | null |
abbradar/aeson | tests/Properties.hs | bsd-3-clause | isObjectWithSingleField _ = False | 44 | isObjectWithSingleField _ = False | 44 | isObjectWithSingleField _ = False | 44 | false | false | 0 | 4 | 14 | 10 | 4 | 6 | null | null |
mzini/TcT | source/Tct/Method/DP/DependencyGraph.hs | gpl-3.0 | congruence :: CDG -> NodeId -> [NodeId]
congruence cdg n = fromMaybe [] ((map fst . theSCC) `liftM` lookupNodeLabel cdg n) | 122 | congruence :: CDG -> NodeId -> [NodeId]
congruence cdg n = fromMaybe [] ((map fst . theSCC) `liftM` lookupNodeLabel cdg n) | 122 | congruence cdg n = fromMaybe [] ((map fst . theSCC) `liftM` lookupNodeLabel cdg n) | 82 | false | true | 0 | 10 | 20 | 63 | 31 | 32 | null | null |
kadena-io/pact | src/Pact/Docgen.hs | bsd-3-clause | renderFunctions :: Handle -> IO ()
renderFunctions h = do
hPutStrLn h "# Built-in Functions {#builtins}"
let renderSection ns = forM_ (map snd $ sortBy (compare `on` fst) ns) $ \t -> renderTerm h t
forM_ natives $ \(sect,ns) -> do
hPutStrLn h $ "## " ++ unpack (asString sect) ++ " {#" ++ unpack (asString sect) ++ "}"
renderSection ns
hPutStrLn h "## REPL-only functions {#repl-lib}"
hPutStrLn h ""
hPutStrLn h "The following functions are loaded automatically into the interactive REPL, or within script files \
\with a `.repl` extension. They are not available for blockchain-based execution."
hPutStrLn h ""
renderSection (snd replDefs) | 680 | renderFunctions :: Handle -> IO ()
renderFunctions h = do
hPutStrLn h "# Built-in Functions {#builtins}"
let renderSection ns = forM_ (map snd $ sortBy (compare `on` fst) ns) $ \t -> renderTerm h t
forM_ natives $ \(sect,ns) -> do
hPutStrLn h $ "## " ++ unpack (asString sect) ++ " {#" ++ unpack (asString sect) ++ "}"
renderSection ns
hPutStrLn h "## REPL-only functions {#repl-lib}"
hPutStrLn h ""
hPutStrLn h "The following functions are loaded automatically into the interactive REPL, or within script files \
\with a `.repl` extension. They are not available for blockchain-based execution."
hPutStrLn h ""
renderSection (snd replDefs) | 680 | renderFunctions h = do
hPutStrLn h "# Built-in Functions {#builtins}"
let renderSection ns = forM_ (map snd $ sortBy (compare `on` fst) ns) $ \t -> renderTerm h t
forM_ natives $ \(sect,ns) -> do
hPutStrLn h $ "## " ++ unpack (asString sect) ++ " {#" ++ unpack (asString sect) ++ "}"
renderSection ns
hPutStrLn h "## REPL-only functions {#repl-lib}"
hPutStrLn h ""
hPutStrLn h "The following functions are loaded automatically into the interactive REPL, or within script files \
\with a `.repl` extension. They are not available for blockchain-based execution."
hPutStrLn h ""
renderSection (snd replDefs) | 645 | false | true | 0 | 17 | 143 | 199 | 90 | 109 | null | null |
emwap/feldspar-language | src/Feldspar/Core/Interpretation.hs | bsd-3-clause | mkInfoTy :: (Show (Size a), Lattice (Size a)) => TypeRep a -> Info a
mkInfoTy t = Info t universal Map.empty "" | 111 | mkInfoTy :: (Show (Size a), Lattice (Size a)) => TypeRep a -> Info a
mkInfoTy t = Info t universal Map.empty "" | 111 | mkInfoTy t = Info t universal Map.empty "" | 42 | false | true | 0 | 8 | 21 | 62 | 30 | 32 | null | null |
zaxtax/hakaru | haskell/Language/Hakaru/Evaluation/ConstantPropagation.hs | bsd-3-clause | isFoldable :: forall abt b . (ABT Term abt) => Term abt b -> Bool
isFoldable = getAll . foldMap21 (All . isLiteral) | 115 | isFoldable :: forall abt b . (ABT Term abt) => Term abt b -> Bool
isFoldable = getAll . foldMap21 (All . isLiteral) | 115 | isFoldable = getAll . foldMap21 (All . isLiteral) | 49 | false | true | 0 | 9 | 22 | 57 | 28 | 29 | null | null |
DominikDitoIvosevic/Uni | IRG/src/Irg/Lab1/Geometry/Vector.hs | mit | dropElem :: Int -> Vector a -> Vector a
dropElem i vec = V.take i vec <> V.drop (i+1) vec | 89 | dropElem :: Int -> Vector a -> Vector a
dropElem i vec = V.take i vec <> V.drop (i+1) vec | 89 | dropElem i vec = V.take i vec <> V.drop (i+1) vec | 49 | false | true | 0 | 8 | 19 | 55 | 26 | 29 | null | null |
mariefarrell/Hets | Temporal/ModalCaslToCtl.hs | gpl-2.0 | convert (Casl.E (Casl.F phi)) = liftM Ctl.EF (convert' phi) | 59 | convert (Casl.E (Casl.F phi)) = liftM Ctl.EF (convert' phi) | 59 | convert (Casl.E (Casl.F phi)) = liftM Ctl.EF (convert' phi) | 59 | false | false | 0 | 10 | 8 | 38 | 18 | 20 | null | null |
markuspf/Idris-dev | src/IRTS/JavaScript/Codegen.hs | bsd-3-clause | doHiddenClasses :: Set HiddenClass -> Text
doHiddenClasses x =
T.intercalate "\n" (map f $ Set.toList x)
where
f p@(HiddenClass n id 0) = jsStmt2Text $ JsDecConst (jsNameHiddenClass p) $ JsObj [("type", JsInt id)]
f p@(HiddenClass n id arity) =
let vars = map dataPartName $ take arity [1..]
in jsStmt2Text $
JsFun (jsNameHiddenClass p) vars $ JsSeq (JsSet (JsProp JsThis "type") (JsInt id)) $ seqJs
$ map (\tv -> JsSet (JsProp JsThis tv) (JsVar tv)) vars
-- | Generate code for each declaration and collect stats.
-- LFunctions are turned into JS function declarations. They are
-- preceded by a comment that gives their name. Constructor
-- declarations are ignored. | 730 | doHiddenClasses :: Set HiddenClass -> Text
doHiddenClasses x =
T.intercalate "\n" (map f $ Set.toList x)
where
f p@(HiddenClass n id 0) = jsStmt2Text $ JsDecConst (jsNameHiddenClass p) $ JsObj [("type", JsInt id)]
f p@(HiddenClass n id arity) =
let vars = map dataPartName $ take arity [1..]
in jsStmt2Text $
JsFun (jsNameHiddenClass p) vars $ JsSeq (JsSet (JsProp JsThis "type") (JsInt id)) $ seqJs
$ map (\tv -> JsSet (JsProp JsThis tv) (JsVar tv)) vars
-- | Generate code for each declaration and collect stats.
-- LFunctions are turned into JS function declarations. They are
-- preceded by a comment that gives their name. Constructor
-- declarations are ignored. | 730 | doHiddenClasses x =
T.intercalate "\n" (map f $ Set.toList x)
where
f p@(HiddenClass n id 0) = jsStmt2Text $ JsDecConst (jsNameHiddenClass p) $ JsObj [("type", JsInt id)]
f p@(HiddenClass n id arity) =
let vars = map dataPartName $ take arity [1..]
in jsStmt2Text $
JsFun (jsNameHiddenClass p) vars $ JsSeq (JsSet (JsProp JsThis "type") (JsInt id)) $ seqJs
$ map (\tv -> JsSet (JsProp JsThis tv) (JsVar tv)) vars
-- | Generate code for each declaration and collect stats.
-- LFunctions are turned into JS function declarations. They are
-- preceded by a comment that gives their name. Constructor
-- declarations are ignored. | 687 | false | true | 1 | 16 | 171 | 234 | 116 | 118 | null | null |
goldfirere/units | units/Data/Metrology/Linear.hs | bsd-3-clause | -- | Add a point to a vector.
(|.+^|) :: (d1 @~ d2, Affine f, Num a) => Qu d1 l (f a) -> Qu d2 l (Diff f a) -> Qu d1 l (f a)
(Qu a) |.+^| (Qu b) = Qu (a .+^ b) | 159 | (|.+^|) :: (d1 @~ d2, Affine f, Num a) => Qu d1 l (f a) -> Qu d2 l (Diff f a) -> Qu d1 l (f a)
(Qu a) |.+^| (Qu b) = Qu (a .+^ b) | 129 | (Qu a) |.+^| (Qu b) = Qu (a .+^ b) | 34 | true | true | 0 | 10 | 45 | 114 | 57 | 57 | null | null |
vasily-kirichenko/haskell-book | src/Foldables.hs | bsd-3-clause | product' :: (Foldable t, Num a) => t a -> a
product' = foldr (*) 1 | 66 | product' :: (Foldable t, Num a) => t a -> a
product' = foldr (*) 1 | 66 | product' = foldr (*) 1 | 22 | false | true | 0 | 8 | 15 | 46 | 22 | 24 | null | null |
romanb/amazonka | amazonka-ec2/gen/Network/AWS/EC2/AuthorizeSecurityGroupIngress.hs | mpl-2.0 | -- | The start of port range for the TCP and UDP protocols, or an ICMP type
-- number. For the ICMP type number, use '-1' to specify all ICMP types.
asgiFromPort :: Lens' AuthorizeSecurityGroupIngress (Maybe Int)
asgiFromPort = lens _asgiFromPort (\s a -> s { _asgiFromPort = a }) | 280 | asgiFromPort :: Lens' AuthorizeSecurityGroupIngress (Maybe Int)
asgiFromPort = lens _asgiFromPort (\s a -> s { _asgiFromPort = a }) | 131 | asgiFromPort = lens _asgiFromPort (\s a -> s { _asgiFromPort = a }) | 67 | true | true | 1 | 9 | 49 | 52 | 26 | 26 | null | null |
olorin/amazonka | amazonka-cloudwatch-logs/gen/Network/AWS/CloudWatchLogs/Types/Product.hs | mpl-2.0 | -- | Status message related to the 'code'.
etsMessage :: Lens' ExportTaskStatus (Maybe Text)
etsMessage = lens _etsMessage (\ s a -> s{_etsMessage = a}) | 152 | etsMessage :: Lens' ExportTaskStatus (Maybe Text)
etsMessage = lens _etsMessage (\ s a -> s{_etsMessage = a}) | 109 | etsMessage = lens _etsMessage (\ s a -> s{_etsMessage = a}) | 59 | true | true | 0 | 9 | 24 | 46 | 25 | 21 | null | null |
davmre/matrizer | src/Matrizer/RewriteRules.hs | gpl-2.0 | rotateTraceLeft _ _ = Nothing | 29 | rotateTraceLeft _ _ = Nothing | 29 | rotateTraceLeft _ _ = Nothing | 29 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.