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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
et4te/zero | server/src/Zero/Authentication/Handlers.hs | bsd-3-clause | ------------------------------------------------------------------------------
-- auth/start
------------------------------------------------------------------------------
authStart :: SessionId -> Connection -> AuthStart -> Handler AuthStartResult
authStart sid conn AuthStart{..} = do
-- FIXME: head is prone to throw exceptions here.
let srp_A = fst $ head $ readHex $ T.unpack as_A :: Integer
if srp_A `mod` n' == 0 then
throwError $ err403 { errBody = "A mod n was zero, invalid client data" }
else
if isValid (B8.pack $ T.unpack as_I) then do
liftIO $ putStrLn ("Fetching account where email = " ++ show as_I)
maybeAccount <- liftIO $ getAccountByEmail sid conn as_I
case maybeAccount of
Just Account{..} -> do
-- Compute the host challenge
srp_b <- liftIO $ getStdRandom (randomR ((2^512), (2^1024)))
let srp_v = fst $ head $ readHex $ T.unpack a_verifier :: Integer
let srp_B = calcB srp_v srp_b
-- Save state and acquire nonce
liftIO $ putStrLn "Inserting SRP parameters"
nonce <- liftIO $ insertSRPParams sid conn SRPParams
{ srp_user = a_userId
, srp_I = as_I
, srp_b = T.pack (printf "%d" srp_b)
, srp_B = T.pack (printf "%d" srp_B)
, srp_A = T.pack (printf "%d" srp_A)
}
-- TODO: Log this stuff instead of liftIO printing
liftIO $ putStrLn ("verifier = " ++ printf "%d" srp_v)
-- liftIO $ putStrLn ("host b = " ++ printf "%d" srp_b)
-- liftIO $ putStrLn ("host B = " ++ printf "%d" srp_B)
-- liftIO $ putStrLn ("host A = " ++ printf "%d" srp_A)
-- Handshake completed successfully
return $ AuthStartSuccess (T.pack $ printf "%X" srp_B) a_salt nonce
Nothing ->
return $ AuthStartFailure "No account exists for the supplied email address."
else
return $ AuthStartFailure "Invalid e-mail address."
------------------------------------------------------------------------------
-- auth/finish
------------------------------------------------------------------------------
-- | After a successul login attempt, the client initiates an auth attempt. | 2,246 | authStart :: SessionId -> Connection -> AuthStart -> Handler AuthStartResult
authStart sid conn AuthStart{..} = do
-- FIXME: head is prone to throw exceptions here.
let srp_A = fst $ head $ readHex $ T.unpack as_A :: Integer
if srp_A `mod` n' == 0 then
throwError $ err403 { errBody = "A mod n was zero, invalid client data" }
else
if isValid (B8.pack $ T.unpack as_I) then do
liftIO $ putStrLn ("Fetching account where email = " ++ show as_I)
maybeAccount <- liftIO $ getAccountByEmail sid conn as_I
case maybeAccount of
Just Account{..} -> do
-- Compute the host challenge
srp_b <- liftIO $ getStdRandom (randomR ((2^512), (2^1024)))
let srp_v = fst $ head $ readHex $ T.unpack a_verifier :: Integer
let srp_B = calcB srp_v srp_b
-- Save state and acquire nonce
liftIO $ putStrLn "Inserting SRP parameters"
nonce <- liftIO $ insertSRPParams sid conn SRPParams
{ srp_user = a_userId
, srp_I = as_I
, srp_b = T.pack (printf "%d" srp_b)
, srp_B = T.pack (printf "%d" srp_B)
, srp_A = T.pack (printf "%d" srp_A)
}
-- TODO: Log this stuff instead of liftIO printing
liftIO $ putStrLn ("verifier = " ++ printf "%d" srp_v)
-- liftIO $ putStrLn ("host b = " ++ printf "%d" srp_b)
-- liftIO $ putStrLn ("host B = " ++ printf "%d" srp_B)
-- liftIO $ putStrLn ("host A = " ++ printf "%d" srp_A)
-- Handshake completed successfully
return $ AuthStartSuccess (T.pack $ printf "%X" srp_B) a_salt nonce
Nothing ->
return $ AuthStartFailure "No account exists for the supplied email address."
else
return $ AuthStartFailure "Invalid e-mail address."
------------------------------------------------------------------------------
-- auth/finish
------------------------------------------------------------------------------
-- | After a successul login attempt, the client initiates an auth attempt. | 2,073 | authStart sid conn AuthStart{..} = do
-- FIXME: head is prone to throw exceptions here.
let srp_A = fst $ head $ readHex $ T.unpack as_A :: Integer
if srp_A `mod` n' == 0 then
throwError $ err403 { errBody = "A mod n was zero, invalid client data" }
else
if isValid (B8.pack $ T.unpack as_I) then do
liftIO $ putStrLn ("Fetching account where email = " ++ show as_I)
maybeAccount <- liftIO $ getAccountByEmail sid conn as_I
case maybeAccount of
Just Account{..} -> do
-- Compute the host challenge
srp_b <- liftIO $ getStdRandom (randomR ((2^512), (2^1024)))
let srp_v = fst $ head $ readHex $ T.unpack a_verifier :: Integer
let srp_B = calcB srp_v srp_b
-- Save state and acquire nonce
liftIO $ putStrLn "Inserting SRP parameters"
nonce <- liftIO $ insertSRPParams sid conn SRPParams
{ srp_user = a_userId
, srp_I = as_I
, srp_b = T.pack (printf "%d" srp_b)
, srp_B = T.pack (printf "%d" srp_B)
, srp_A = T.pack (printf "%d" srp_A)
}
-- TODO: Log this stuff instead of liftIO printing
liftIO $ putStrLn ("verifier = " ++ printf "%d" srp_v)
-- liftIO $ putStrLn ("host b = " ++ printf "%d" srp_b)
-- liftIO $ putStrLn ("host B = " ++ printf "%d" srp_B)
-- liftIO $ putStrLn ("host A = " ++ printf "%d" srp_A)
-- Handshake completed successfully
return $ AuthStartSuccess (T.pack $ printf "%X" srp_B) a_salt nonce
Nothing ->
return $ AuthStartFailure "No account exists for the supplied email address."
else
return $ AuthStartFailure "Invalid e-mail address."
------------------------------------------------------------------------------
-- auth/finish
------------------------------------------------------------------------------
-- | After a successul login attempt, the client initiates an auth attempt. | 1,996 | true | true | 0 | 23 | 577 | 453 | 231 | 222 | null | null |
capitanbatata/functional-systems-in-haskell | fsh-exercises/src/Iteratee.hs | mit | inumPure :: L.ByteString -> Inum a
inumPure buf (Iter f) = return (f (Chunk buf False)) | 87 | inumPure :: L.ByteString -> Inum a
inumPure buf (Iter f) = return (f (Chunk buf False)) | 87 | inumPure buf (Iter f) = return (f (Chunk buf False)) | 52 | false | true | 0 | 9 | 15 | 48 | 23 | 25 | null | null |
brendanhay/gogol | gogol-script/gen/Network/Google/Resource/Script/Processes/ListScriptProcesses.hs | mpl-2.0 | -- | JSONP
plspCallback :: Lens' ProcessesListScriptProcesses (Maybe Text)
plspCallback
= lens _plspCallback (\ s a -> s{_plspCallback = a}) | 142 | plspCallback :: Lens' ProcessesListScriptProcesses (Maybe Text)
plspCallback
= lens _plspCallback (\ s a -> s{_plspCallback = a}) | 131 | plspCallback
= lens _plspCallback (\ s a -> s{_plspCallback = a}) | 67 | true | true | 0 | 9 | 21 | 48 | 25 | 23 | null | null |
parsonsmatt/free | src/Free.hs | bsd-3-clause | subroutine :: Free (Toy Char) IncompleteException
subroutine = Free (Output 'a' (Pure IncompleteException)) | 107 | subroutine :: Free (Toy Char) IncompleteException
subroutine = Free (Output 'a' (Pure IncompleteException)) | 107 | subroutine = Free (Output 'a' (Pure IncompleteException)) | 57 | false | true | 0 | 9 | 12 | 39 | 19 | 20 | null | null |
tlaitinen/sms | backend/Handler/DB/RouteTextmessagerecipientsqueue.hs | gpl-3.0 | getTextmessagerecipientsqueueR :: forall master. (
YesodAuthPersist master,
AuthEntity master ~ User,
AuthId master ~ Key User,
YesodPersistBackend master ~ SqlBackend)
=> HandlerT DB (HandlerT master IO) A.Value
getTextmessagerecipientsqueueR = lift $ runDB $ do
authId <- lift $ requireAuthId
let baseQuery limitOffsetOrder = from $ \(tr `InnerJoin` c`InnerJoin` tm) -> do
on ((tm ^. TextMessageId) ==. (tr ^. TextMessageRecipientTextMessageId))
on ((c ^. ClientId) ==. (tr ^. TextMessageRecipientClientId))
let trId' = tr ^. TextMessageRecipientId
where_ ((hasReadPerm (val authId) (tm ^. TextMessageId)) &&. ((hasReadPerm (val authId) (c ^. ClientId)) &&. (((tr ^. TextMessageRecipientAccepted) `is` (nothing)) &&. (((tr ^. TextMessageRecipientSent) `is` (nothing)) &&. (((tr ^. TextMessageRecipientDelivered) `is` (nothing)) &&. ((not_ ((tm ^. TextMessageQueued) `is` (nothing))) &&. (((tm ^. TextMessageAborted) `is` (nothing)) &&. (((tm ^. TextMessageDeletedVersionId) `is` (nothing)) &&. (((c ^. ClientDeletedVersionId) `is` (nothing)) &&. (((c ^. ClientAllowSms) ==. ((val True))) &&. ((tr ^. TextMessageRecipientFailCount) <. ((val 2)))))))))))))
_ <- if limitOffsetOrder
then do
offset 0
limit 5
orderBy [ asc (c ^. ClientLastName), asc (c ^. ClientFirstName) ]
else return ()
return (tr ^. TextMessageRecipientId, c ^. ClientPhone, tm ^. TextMessageText)
count <- select $ do
baseQuery False
let countRows' = countRows
orderBy []
return $ (countRows' :: SqlExpr (Database.Esqueleto.Value Int))
results <- select $ baseQuery True
(return $ A.object [
"totalCount" .= ((\(Database.Esqueleto.Value v) -> (v::Int)) (head count)),
"result" .= (toJSON $ map (\row -> case row of
((Database.Esqueleto.Value f1), (Database.Esqueleto.Value f2), (Database.Esqueleto.Value f3)) -> A.object [
"id" .= toJSON f1,
"phone" .= toJSON f2,
"text" .= toJSON f3
]
_ -> A.object []
) results)
]) | 2,283 | getTextmessagerecipientsqueueR :: forall master. (
YesodAuthPersist master,
AuthEntity master ~ User,
AuthId master ~ Key User,
YesodPersistBackend master ~ SqlBackend)
=> HandlerT DB (HandlerT master IO) A.Value
getTextmessagerecipientsqueueR = lift $ runDB $ do
authId <- lift $ requireAuthId
let baseQuery limitOffsetOrder = from $ \(tr `InnerJoin` c`InnerJoin` tm) -> do
on ((tm ^. TextMessageId) ==. (tr ^. TextMessageRecipientTextMessageId))
on ((c ^. ClientId) ==. (tr ^. TextMessageRecipientClientId))
let trId' = tr ^. TextMessageRecipientId
where_ ((hasReadPerm (val authId) (tm ^. TextMessageId)) &&. ((hasReadPerm (val authId) (c ^. ClientId)) &&. (((tr ^. TextMessageRecipientAccepted) `is` (nothing)) &&. (((tr ^. TextMessageRecipientSent) `is` (nothing)) &&. (((tr ^. TextMessageRecipientDelivered) `is` (nothing)) &&. ((not_ ((tm ^. TextMessageQueued) `is` (nothing))) &&. (((tm ^. TextMessageAborted) `is` (nothing)) &&. (((tm ^. TextMessageDeletedVersionId) `is` (nothing)) &&. (((c ^. ClientDeletedVersionId) `is` (nothing)) &&. (((c ^. ClientAllowSms) ==. ((val True))) &&. ((tr ^. TextMessageRecipientFailCount) <. ((val 2)))))))))))))
_ <- if limitOffsetOrder
then do
offset 0
limit 5
orderBy [ asc (c ^. ClientLastName), asc (c ^. ClientFirstName) ]
else return ()
return (tr ^. TextMessageRecipientId, c ^. ClientPhone, tm ^. TextMessageText)
count <- select $ do
baseQuery False
let countRows' = countRows
orderBy []
return $ (countRows' :: SqlExpr (Database.Esqueleto.Value Int))
results <- select $ baseQuery True
(return $ A.object [
"totalCount" .= ((\(Database.Esqueleto.Value v) -> (v::Int)) (head count)),
"result" .= (toJSON $ map (\row -> case row of
((Database.Esqueleto.Value f1), (Database.Esqueleto.Value f2), (Database.Esqueleto.Value f3)) -> A.object [
"id" .= toJSON f1,
"phone" .= toJSON f2,
"text" .= toJSON f3
]
_ -> A.object []
) results)
]) | 2,283 | getTextmessagerecipientsqueueR = lift $ runDB $ do
authId <- lift $ requireAuthId
let baseQuery limitOffsetOrder = from $ \(tr `InnerJoin` c`InnerJoin` tm) -> do
on ((tm ^. TextMessageId) ==. (tr ^. TextMessageRecipientTextMessageId))
on ((c ^. ClientId) ==. (tr ^. TextMessageRecipientClientId))
let trId' = tr ^. TextMessageRecipientId
where_ ((hasReadPerm (val authId) (tm ^. TextMessageId)) &&. ((hasReadPerm (val authId) (c ^. ClientId)) &&. (((tr ^. TextMessageRecipientAccepted) `is` (nothing)) &&. (((tr ^. TextMessageRecipientSent) `is` (nothing)) &&. (((tr ^. TextMessageRecipientDelivered) `is` (nothing)) &&. ((not_ ((tm ^. TextMessageQueued) `is` (nothing))) &&. (((tm ^. TextMessageAborted) `is` (nothing)) &&. (((tm ^. TextMessageDeletedVersionId) `is` (nothing)) &&. (((c ^. ClientDeletedVersionId) `is` (nothing)) &&. (((c ^. ClientAllowSms) ==. ((val True))) &&. ((tr ^. TextMessageRecipientFailCount) <. ((val 2)))))))))))))
_ <- if limitOffsetOrder
then do
offset 0
limit 5
orderBy [ asc (c ^. ClientLastName), asc (c ^. ClientFirstName) ]
else return ()
return (tr ^. TextMessageRecipientId, c ^. ClientPhone, tm ^. TextMessageText)
count <- select $ do
baseQuery False
let countRows' = countRows
orderBy []
return $ (countRows' :: SqlExpr (Database.Esqueleto.Value Int))
results <- select $ baseQuery True
(return $ A.object [
"totalCount" .= ((\(Database.Esqueleto.Value v) -> (v::Int)) (head count)),
"result" .= (toJSON $ map (\row -> case row of
((Database.Esqueleto.Value f1), (Database.Esqueleto.Value f2), (Database.Esqueleto.Value f3)) -> A.object [
"id" .= toJSON f1,
"phone" .= toJSON f2,
"text" .= toJSON f3
]
_ -> A.object []
) results)
]) | 2,050 | false | true | 0 | 40 | 651 | 845 | 450 | 395 | null | null |
5outh/wyas | Evaluator.hs | gpl-2.0 | eqv [DottedList xs x, DottedList ys y] =
eqv [List $ xs ++ [x], List $ ys ++ [y]] | 84 | eqv [DottedList xs x, DottedList ys y] =
eqv [List $ xs ++ [x], List $ ys ++ [y]] | 84 | eqv [DottedList xs x, DottedList ys y] =
eqv [List $ xs ++ [x], List $ ys ++ [y]] | 84 | false | false | 0 | 8 | 21 | 56 | 29 | 27 | null | null |
wjlroe/Fafnir | test-opengl.hs | bsd-3-clause | -- we start with waitForPress action
active lines = loop waitForPress
where
loop action = do
-- draw the entire screen
render lines
-- swap buffer
GLFW.swapBuffers
-- check whether ESC is pressed for termination
p <- GLFW.getKey GLFW.ESC
unless (p == GLFW.Press) $
do
-- perform action
Action action' <- action
-- sleep for 1ms to yield CPU to other applications
GLFW.sleep 0.001
-- only continue when the window is not closed
windowOpen <- getParam Opened
unless (not windowOpen) $
loop action' -- loop with next action
waitForPress = do
b <- GLFW.getMouseButton GLFW.ButtonLeft
case b of
GLFW.Release -> return (Action waitForPress)
GLFW.Press -> do
-- when left mouse button is pressed, add the point
-- to lines and switch to waitForRelease action.
(GL.Position x y) <- GL.get GLFW.mousePos
modifyIORef lines (((x,y):) . ((x,y):))
return (Action waitForRelease)
waitForRelease = do
-- keep track of mouse movement while waiting for button
-- release
(GL.Position x y) <- GL.get GLFW.mousePos
-- update the line with new ending position
modifyIORef lines (((x,y):) . tail)
b <- GLFW.getMouseButton GLFW.ButtonLeft
case b of
-- when button is released, switch back back to
-- waitForPress action
GLFW.Release -> return (Action waitForPress)
GLFW.Press -> return (Action waitForRelease) | 1,639 | active lines = loop waitForPress
where
loop action = do
-- draw the entire screen
render lines
-- swap buffer
GLFW.swapBuffers
-- check whether ESC is pressed for termination
p <- GLFW.getKey GLFW.ESC
unless (p == GLFW.Press) $
do
-- perform action
Action action' <- action
-- sleep for 1ms to yield CPU to other applications
GLFW.sleep 0.001
-- only continue when the window is not closed
windowOpen <- getParam Opened
unless (not windowOpen) $
loop action' -- loop with next action
waitForPress = do
b <- GLFW.getMouseButton GLFW.ButtonLeft
case b of
GLFW.Release -> return (Action waitForPress)
GLFW.Press -> do
-- when left mouse button is pressed, add the point
-- to lines and switch to waitForRelease action.
(GL.Position x y) <- GL.get GLFW.mousePos
modifyIORef lines (((x,y):) . ((x,y):))
return (Action waitForRelease)
waitForRelease = do
-- keep track of mouse movement while waiting for button
-- release
(GL.Position x y) <- GL.get GLFW.mousePos
-- update the line with new ending position
modifyIORef lines (((x,y):) . tail)
b <- GLFW.getMouseButton GLFW.ButtonLeft
case b of
-- when button is released, switch back back to
-- waitForPress action
GLFW.Release -> return (Action waitForPress)
GLFW.Press -> return (Action waitForRelease) | 1,602 | active lines = loop waitForPress
where
loop action = do
-- draw the entire screen
render lines
-- swap buffer
GLFW.swapBuffers
-- check whether ESC is pressed for termination
p <- GLFW.getKey GLFW.ESC
unless (p == GLFW.Press) $
do
-- perform action
Action action' <- action
-- sleep for 1ms to yield CPU to other applications
GLFW.sleep 0.001
-- only continue when the window is not closed
windowOpen <- getParam Opened
unless (not windowOpen) $
loop action' -- loop with next action
waitForPress = do
b <- GLFW.getMouseButton GLFW.ButtonLeft
case b of
GLFW.Release -> return (Action waitForPress)
GLFW.Press -> do
-- when left mouse button is pressed, add the point
-- to lines and switch to waitForRelease action.
(GL.Position x y) <- GL.get GLFW.mousePos
modifyIORef lines (((x,y):) . ((x,y):))
return (Action waitForRelease)
waitForRelease = do
-- keep track of mouse movement while waiting for button
-- release
(GL.Position x y) <- GL.get GLFW.mousePos
-- update the line with new ending position
modifyIORef lines (((x,y):) . tail)
b <- GLFW.getMouseButton GLFW.ButtonLeft
case b of
-- when button is released, switch back back to
-- waitForPress action
GLFW.Release -> return (Action waitForPress)
GLFW.Press -> return (Action waitForRelease) | 1,602 | true | false | 0 | 16 | 552 | 360 | 177 | 183 | null | null |
Cortlandd/haskell-opencv | doc/images.hs | bsd-3-clause | frog :: Frog
frog =
exceptError $ coerceMat $ unsafePerformIO $
imdecode ImreadUnchanged <$> B.readFile "data/kikker.jpg" | 131 | frog :: Frog
frog =
exceptError $ coerceMat $ unsafePerformIO $
imdecode ImreadUnchanged <$> B.readFile "data/kikker.jpg" | 131 | frog =
exceptError $ coerceMat $ unsafePerformIO $
imdecode ImreadUnchanged <$> B.readFile "data/kikker.jpg" | 118 | false | true | 0 | 8 | 25 | 35 | 17 | 18 | null | null |
elginer/Delve | src/SExp.hs | gpl-3.0 | dwspace :: CharParser ( Maybe a )
dwspace = P.oneOf [
P.many1 scomment >> return Nothing
, P.many1 space >> return Nothing
] | 137 | dwspace :: CharParser ( Maybe a )
dwspace = P.oneOf [
P.many1 scomment >> return Nothing
, P.many1 space >> return Nothing
] | 137 | dwspace = P.oneOf [
P.many1 scomment >> return Nothing
, P.many1 space >> return Nothing
] | 103 | false | true | 0 | 9 | 35 | 55 | 26 | 29 | null | null |
frantisekfarka/ghc-dsi | compiler/nativeGen/PPC/Instr.hs | bsd-3-clause | -- | The maximum number of bytes required to spill a register. PPC32
-- has 32-bit GPRs and 64-bit FPRs, while PPC64 has 64-bit GPRs and
-- 64-bit FPRs. So the maximum is 8 regardless of platforms unlike
-- x86. Note that AltiVec's vector registers are 128-bit wide so we
-- must not use this to spill them.
spillSlotSize :: Int
spillSlotSize = 8 | 346 | spillSlotSize :: Int
spillSlotSize = 8 | 38 | spillSlotSize = 8 | 17 | true | true | 0 | 4 | 63 | 16 | 11 | 5 | null | null |
dmjio/stripe | stripe-core/src/Web/Stripe/Recipient.hs | mit | ------------------------------------------------------------------------------
-- | Delete a `Recipient`
deleteRecipient
:: RecipientId -- ^ `RecipiendId` of `Recipient` to delete
-> StripeRequest DeleteRecipient
deleteRecipient
recipientid = request
where request = mkStripeRequest DELETE url params
url = "recipients" </> getRecipientId recipientid
params = [] | 398 | deleteRecipient
:: RecipientId -- ^ `RecipiendId` of `Recipient` to delete
-> StripeRequest DeleteRecipient
deleteRecipient
recipientid = request
where request = mkStripeRequest DELETE url params
url = "recipients" </> getRecipientId recipientid
params = [] | 293 | deleteRecipient
recipientid = request
where request = mkStripeRequest DELETE url params
url = "recipients" </> getRecipientId recipientid
params = [] | 175 | true | true | 0 | 7 | 74 | 63 | 31 | 32 | null | null |
mydaum/cabal | Cabal/Distribution/Simple/CCompiler.hs | bsd-3-clause | cDialectFilenameExtension CPlusPlus False = "ii" | 49 | cDialectFilenameExtension CPlusPlus False = "ii" | 49 | cDialectFilenameExtension CPlusPlus False = "ii" | 49 | false | false | 0 | 5 | 5 | 11 | 5 | 6 | null | null |
mapinguari/SC_HS_Proxy | src/Proxy/Query/Unit.hs | mit | maxHitPoints TerranMissileTurret = 200 | 38 | maxHitPoints TerranMissileTurret = 200 | 38 | maxHitPoints TerranMissileTurret = 200 | 38 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
lightquake/tahoe-serve | TahoeServe.hs | bsd-3-clause | serveAs :: String -> String -> ActionM ()
serveAs "raw" contents = text $ T.pack contents | 89 | serveAs :: String -> String -> ActionM ()
serveAs "raw" contents = text $ T.pack contents | 89 | serveAs "raw" contents = text $ T.pack contents | 47 | false | true | 0 | 9 | 15 | 42 | 19 | 23 | null | null |
brendanhay/gogol | gogol-cloudshell/gen/Network/Google/Resource/CloudShell/Users/Environments/RemovePublicKey.hs | mpl-2.0 | -- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
uerpkUploadType :: Lens' UsersEnvironmentsRemovePublicKey (Maybe Text)
uerpkUploadType
= lens _uerpkUploadType
(\ s a -> s{_uerpkUploadType = a}) | 224 | uerpkUploadType :: Lens' UsersEnvironmentsRemovePublicKey (Maybe Text)
uerpkUploadType
= lens _uerpkUploadType
(\ s a -> s{_uerpkUploadType = a}) | 153 | uerpkUploadType
= lens _uerpkUploadType
(\ s a -> s{_uerpkUploadType = a}) | 82 | true | true | 0 | 9 | 34 | 48 | 25 | 23 | null | null |
marcelosousa/poet | src/Exploration/SUNF/API.hs | gpl-2.0 | get_succ e events = do
ev@Event{..} <- get_event "getISucc(essors)" e events
return succ | 93 | get_succ e events = do
ev@Event{..} <- get_event "getISucc(essors)" e events
return succ | 93 | get_succ e events = do
ev@Event{..} <- get_event "getISucc(essors)" e events
return succ | 93 | false | false | 0 | 10 | 17 | 40 | 18 | 22 | null | null |
jfdm/ottar | src/Ottar/Parser.hs | bsd-3-clause | parseKey :: Parser Message
parseKey = do try parseDecKey
<|> parseEncKey
<|> parseSigKey
<|> parseVerKey
<|> parseSymmKey
<?> "Keys" | 182 | parseKey :: Parser Message
parseKey = do try parseDecKey
<|> parseEncKey
<|> parseSigKey
<|> parseVerKey
<|> parseSymmKey
<?> "Keys" | 182 | parseKey = do try parseDecKey
<|> parseEncKey
<|> parseSigKey
<|> parseVerKey
<|> parseSymmKey
<?> "Keys" | 155 | false | true | 14 | 7 | 68 | 59 | 28 | 31 | null | null |
rhwlo/Scarlet | src/Scarlet/Post/Internal.hs | mit | scanForAssets :: Entryoid e => e -- takes an entryoid
-> [String] -- returns a list of asset URIs as strings
scanForAssets (toPandoc -> Pandoc _ blocks) = scanBlockForAssets =<< blocks
where
scanBlockForAssets :: Block -> [String]
scanBlockForAssets (Plain inlines) = inlines >>= getAssets
scanBlockForAssets (Para inlines) = inlines >>= getAssets
scanBlockForAssets (Div _ divBlocks) = divBlocks >>= scanBlockForAssets
scanBlockForAssets _ = []
getAssets :: Inline -> [String]
getAssets (Image _ (uri, _)) = [uri]
getAssets (Link _ (uri, _)) = [uri]
getAssets _ = [] | 692 | scanForAssets :: Entryoid e => e -- takes an entryoid
-> [String]
scanForAssets (toPandoc -> Pandoc _ blocks) = scanBlockForAssets =<< blocks
where
scanBlockForAssets :: Block -> [String]
scanBlockForAssets (Plain inlines) = inlines >>= getAssets
scanBlockForAssets (Para inlines) = inlines >>= getAssets
scanBlockForAssets (Div _ divBlocks) = divBlocks >>= scanBlockForAssets
scanBlockForAssets _ = []
getAssets :: Inline -> [String]
getAssets (Image _ (uri, _)) = [uri]
getAssets (Link _ (uri, _)) = [uri]
getAssets _ = [] | 642 | scanForAssets (toPandoc -> Pandoc _ blocks) = scanBlockForAssets =<< blocks
where
scanBlockForAssets :: Block -> [String]
scanBlockForAssets (Plain inlines) = inlines >>= getAssets
scanBlockForAssets (Para inlines) = inlines >>= getAssets
scanBlockForAssets (Div _ divBlocks) = divBlocks >>= scanBlockForAssets
scanBlockForAssets _ = []
getAssets :: Inline -> [String]
getAssets (Image _ (uri, _)) = [uri]
getAssets (Link _ (uri, _)) = [uri]
getAssets _ = [] | 562 | true | true | 0 | 8 | 210 | 199 | 105 | 94 | null | null |
nomeata/nt-coerce | tests/LiftAbstract.hs | bsd-3-clause | wrappedAbstactNT :: NT a b -> NT (WrappedAbstract a) (WrappedAbstract b)
wrappedAbstactNT nt = wrappedAbstactNTRaw nt (abs2NT nt) | 129 | wrappedAbstactNT :: NT a b -> NT (WrappedAbstract a) (WrappedAbstract b)
wrappedAbstactNT nt = wrappedAbstactNTRaw nt (abs2NT nt) | 129 | wrappedAbstactNT nt = wrappedAbstactNTRaw nt (abs2NT nt) | 56 | false | true | 0 | 8 | 17 | 54 | 25 | 29 | null | null |
urbanslug/ghc | compiler/hsSyn/HsTypes.hs | bsd-3-clause | splitHsClassTy_maybe :: HsType name -> Maybe (name, [LHsType name])
splitHsClassTy_maybe ty = fmap (\(L _ n, tys) -> (n, tys)) $ splitLHsClassTy_maybe (noLoc ty) | 161 | splitHsClassTy_maybe :: HsType name -> Maybe (name, [LHsType name])
splitHsClassTy_maybe ty = fmap (\(L _ n, tys) -> (n, tys)) $ splitLHsClassTy_maybe (noLoc ty) | 161 | splitHsClassTy_maybe ty = fmap (\(L _ n, tys) -> (n, tys)) $ splitLHsClassTy_maybe (noLoc ty) | 93 | false | true | 0 | 10 | 23 | 77 | 40 | 37 | null | null |
ArekCzarnik/Uthenga | test/Main.hs | bsd-3-clause | setupDB :: IO Mysql.MySQLConn
setupDB = Mysql.connect Mysql.defaultConnectInfo { Mysql.ciDatabase = "uthenga" } | 111 | setupDB :: IO Mysql.MySQLConn
setupDB = Mysql.connect Mysql.defaultConnectInfo { Mysql.ciDatabase = "uthenga" } | 111 | setupDB = Mysql.connect Mysql.defaultConnectInfo { Mysql.ciDatabase = "uthenga" } | 81 | false | true | 0 | 7 | 12 | 33 | 17 | 16 | null | null |
yliu120/K3 | src/Language/K3/Core/Utils.hs | apache-2.0 | -- | Transform a tree by mapping a function over every tree node.
-- The children of a node are pre-transformed recursively
modifyTree :: (Monad m) => (Tree a -> m (Tree a)) -> Tree a -> m (Tree a)
modifyTree f n@(Node _ []) = f n | 232 | modifyTree :: (Monad m) => (Tree a -> m (Tree a)) -> Tree a -> m (Tree a)
modifyTree f n@(Node _ []) = f n | 106 | modifyTree f n@(Node _ []) = f n | 32 | true | true | 0 | 11 | 49 | 82 | 41 | 41 | null | null |
elieux/ghc | compiler/main/HscTypes.hs | bsd-3-clause | typeEnvFromEntities :: [Id] -> [TyCon] -> [FamInst] -> TypeEnv
typeEnvFromEntities ids tcs famInsts =
mkTypeEnv ( map AnId ids
++ map ATyCon all_tcs
++ concatMap implicitTyConThings all_tcs
++ map (ACoAxiom . toBranchedAxiom . famInstAxiom) famInsts
)
where
all_tcs = tcs ++ famInstsRepTyCons famInsts | 359 | typeEnvFromEntities :: [Id] -> [TyCon] -> [FamInst] -> TypeEnv
typeEnvFromEntities ids tcs famInsts =
mkTypeEnv ( map AnId ids
++ map ATyCon all_tcs
++ concatMap implicitTyConThings all_tcs
++ map (ACoAxiom . toBranchedAxiom . famInstAxiom) famInsts
)
where
all_tcs = tcs ++ famInstsRepTyCons famInsts | 359 | typeEnvFromEntities ids tcs famInsts =
mkTypeEnv ( map AnId ids
++ map ATyCon all_tcs
++ concatMap implicitTyConThings all_tcs
++ map (ACoAxiom . toBranchedAxiom . famInstAxiom) famInsts
)
where
all_tcs = tcs ++ famInstsRepTyCons famInsts | 296 | false | true | 0 | 11 | 100 | 103 | 51 | 52 | null | null |
laurencer/confluence-sync | test/DocTests.hs | bsd-3-clause | main :: IO ()
main = doctest ["-isrc"
, "src/Confluence/Sync/ReferenceResolver.hs"
-- Disabled for now because Stack support doesn't work properly
-- (Ambiguous module name errors with Crypto.Hash).
-- , "src/Confluence/Sync/Content.hs"
] | 248 | main :: IO ()
main = doctest ["-isrc"
, "src/Confluence/Sync/ReferenceResolver.hs"
-- Disabled for now because Stack support doesn't work properly
-- (Ambiguous module name errors with Crypto.Hash).
-- , "src/Confluence/Sync/Content.hs"
] | 248 | main = doctest ["-isrc"
, "src/Confluence/Sync/ReferenceResolver.hs"
-- Disabled for now because Stack support doesn't work properly
-- (Ambiguous module name errors with Crypto.Hash).
-- , "src/Confluence/Sync/Content.hs"
] | 234 | false | true | 1 | 6 | 40 | 31 | 16 | 15 | null | null |
bobgru/wreath | src/Wreath.hs | bsd-3-clause | grid :: Double -> Double -> Diagram B
grid w h = grid' (def { gridWidth = w, gridHeight = h }) | 96 | grid :: Double -> Double -> Diagram B
grid w h = grid' (def { gridWidth = w, gridHeight = h }) | 96 | grid w h = grid' (def { gridWidth = w, gridHeight = h }) | 58 | false | true | 0 | 8 | 23 | 47 | 25 | 22 | null | null |
nh2/WashNGo | WASH/HTML/HTMLMonad.hs | bsd-3-clause | abbr = mkElement "abbr" | 27 | abbr = mkElement "abbr" | 27 | abbr = mkElement "abbr" | 27 | false | false | 0 | 5 | 7 | 9 | 4 | 5 | null | null |
ctford/Idris-Elba-dev | src/Idris/REPL.hs | bsd-3-clause | process h fn' (AddProof prf)
= do fn <- do
ex <- runIO $ doesFileExist fn'
let fnExt = fn' <.> "idr"
exExt <- runIO $ doesFileExist fnExt
if ex
then return fn'
else if exExt
then return fnExt
else ifail $ "Neither \""++fn'++"\" nor \""++fnExt++"\" exist"
let fb = fn ++ "~"
runIO $ copyFile fn fb -- make a backup in case something goes wrong!
prog <- runIO $ readFile fb
i <- getIState
let proofs = proof_list i
n' <- case prf of
Nothing -> case proofs of
[] -> ifail "No proof to add"
((x, p) : _) -> return x
Just nm -> return nm
n <- resolveProof n'
case lookup n proofs of
Nothing -> iputStrLn "No proof to add"
Just p -> do let prog' = insertScript (showProof (lit fn) n p) ls
runIO $ writeFile fn (unlines prog')
removeProof n
iputStrLn $ "Added proof " ++ show n
where ls = (lines prog) | 1,171 | process h fn' (AddProof prf)
= do fn <- do
ex <- runIO $ doesFileExist fn'
let fnExt = fn' <.> "idr"
exExt <- runIO $ doesFileExist fnExt
if ex
then return fn'
else if exExt
then return fnExt
else ifail $ "Neither \""++fn'++"\" nor \""++fnExt++"\" exist"
let fb = fn ++ "~"
runIO $ copyFile fn fb -- make a backup in case something goes wrong!
prog <- runIO $ readFile fb
i <- getIState
let proofs = proof_list i
n' <- case prf of
Nothing -> case proofs of
[] -> ifail "No proof to add"
((x, p) : _) -> return x
Just nm -> return nm
n <- resolveProof n'
case lookup n proofs of
Nothing -> iputStrLn "No proof to add"
Just p -> do let prog' = insertScript (showProof (lit fn) n p) ls
runIO $ writeFile fn (unlines prog')
removeProof n
iputStrLn $ "Added proof " ++ show n
where ls = (lines prog) | 1,171 | process h fn' (AddProof prf)
= do fn <- do
ex <- runIO $ doesFileExist fn'
let fnExt = fn' <.> "idr"
exExt <- runIO $ doesFileExist fnExt
if ex
then return fn'
else if exExt
then return fnExt
else ifail $ "Neither \""++fn'++"\" nor \""++fnExt++"\" exist"
let fb = fn ++ "~"
runIO $ copyFile fn fb -- make a backup in case something goes wrong!
prog <- runIO $ readFile fb
i <- getIState
let proofs = proof_list i
n' <- case prf of
Nothing -> case proofs of
[] -> ifail "No proof to add"
((x, p) : _) -> return x
Just nm -> return nm
n <- resolveProof n'
case lookup n proofs of
Nothing -> iputStrLn "No proof to add"
Just p -> do let prog' = insertScript (showProof (lit fn) n p) ls
runIO $ writeFile fn (unlines prog')
removeProof n
iputStrLn $ "Added proof " ++ show n
where ls = (lines prog) | 1,171 | false | false | 0 | 19 | 537 | 358 | 165 | 193 | null | null |
emc2/HUnit-Plus | test/Tests/Test/HUnitPlus/Main.hs | bsd-3-clause | delXMLReport :: IO ()
delXMLReport = removeFile "TestDir/report.xml" >> delTestDir | 82 | delXMLReport :: IO ()
delXMLReport = removeFile "TestDir/report.xml" >> delTestDir | 82 | delXMLReport = removeFile "TestDir/report.xml" >> delTestDir | 60 | false | true | 1 | 6 | 9 | 27 | 11 | 16 | null | null |
michalkonecny/aern2 | aern2-fun-univariate/src/AERN2/Poly/Cheb/MaximumPrime.hs | bsd-3-clause | evalOnDyadic :: PowPoly Integer -> Dyadic -> Integer
evalOnDyadic (PowPoly (Poly ts)) x =
evalHornerAcc (terms_degree ts) 1 (convertExactly 0)
where
evalHornerAcc :: Integer -> Integer -> Integer -> Integer
evalHornerAcc 0 pw sm = xNum*sm + pw*terms_lookupCoeff ts 0
evalHornerAcc k pw sm = evalHornerAcc (k - 1) (xDen*pw) $ xNum*sm + pw*terms_lookupCoeff ts k
xRat = rational x
xDen = denominator xRat
xNum = numerator xRat | 446 | evalOnDyadic :: PowPoly Integer -> Dyadic -> Integer
evalOnDyadic (PowPoly (Poly ts)) x =
evalHornerAcc (terms_degree ts) 1 (convertExactly 0)
where
evalHornerAcc :: Integer -> Integer -> Integer -> Integer
evalHornerAcc 0 pw sm = xNum*sm + pw*terms_lookupCoeff ts 0
evalHornerAcc k pw sm = evalHornerAcc (k - 1) (xDen*pw) $ xNum*sm + pw*terms_lookupCoeff ts k
xRat = rational x
xDen = denominator xRat
xNum = numerator xRat | 446 | evalOnDyadic (PowPoly (Poly ts)) x =
evalHornerAcc (terms_degree ts) 1 (convertExactly 0)
where
evalHornerAcc :: Integer -> Integer -> Integer -> Integer
evalHornerAcc 0 pw sm = xNum*sm + pw*terms_lookupCoeff ts 0
evalHornerAcc k pw sm = evalHornerAcc (k - 1) (xDen*pw) $ xNum*sm + pw*terms_lookupCoeff ts k
xRat = rational x
xDen = denominator xRat
xNum = numerator xRat | 393 | false | true | 2 | 11 | 89 | 188 | 90 | 98 | null | null |
sopvop/snap-server | src/Snap/Internal/Http/Server/Parser.hs | bsd-3-clause | elemIndex c (PS !fp !start !len) = accursedUnutterablePerformIO $
#else
elemIndex c (PS !fp !start !len) = inlinePerformIO $
#endif
withForeignPtr fp $ \p0 -> do
let !p = plusPtr p0 start
q <- memchr p w8 (fromIntegral len)
return $! if q == nullPtr then (-1) else q `minusPtr` p
where
!w8 = c2w c
| 351 | elemIndex c (PS !fp !start !len) = accursedUnutterablePerformIO $
#else
elemIndex c (PS !fp !start !len) = inlinePerformIO $
#endif
withForeignPtr fp $ \p0 -> do
let !p = plusPtr p0 start
q <- memchr p w8 (fromIntegral len)
return $! if q == nullPtr then (-1) else q `minusPtr` p
where
!w8 = c2w c
| 351 | elemIndex c (PS !fp !start !len) = accursedUnutterablePerformIO $
#else
elemIndex c (PS !fp !start !len) = inlinePerformIO $
#endif
withForeignPtr fp $ \p0 -> do
let !p = plusPtr p0 start
q <- memchr p w8 (fromIntegral len)
return $! if q == nullPtr then (-1) else q `minusPtr` p
where
!w8 = c2w c
| 351 | false | false | 0 | 12 | 109 | 121 | 57 | 64 | null | null |
Solonarv/Asteroids | World.hs | mit | size :: Object -> Double
size obj = case typ obj of
Asteroid -> mass (movingPosition obj) ** 0.33 -- This should work
Bullet -> 0 | 137 | size :: Object -> Double
size obj = case typ obj of
Asteroid -> mass (movingPosition obj) ** 0.33 -- This should work
Bullet -> 0 | 137 | size obj = case typ obj of
Asteroid -> mass (movingPosition obj) ** 0.33 -- This should work
Bullet -> 0 | 112 | false | true | 2 | 8 | 33 | 53 | 25 | 28 | null | null |
utky/budget | src/Budget/Core/Data/Date.hs | bsd-3-clause | mkDate :: Integer -> Int -> Int -> Date
mkDate = fromGregorian | 62 | mkDate :: Integer -> Int -> Int -> Date
mkDate = fromGregorian | 62 | mkDate = fromGregorian | 22 | false | true | 0 | 9 | 11 | 30 | 13 | 17 | null | null |
gridaphobe/ghc | compiler/simplCore/SetLevels.hs | bsd-3-clause | lvlLamBndrs :: LevelEnv -> Level -> [OutVar] -> (LevelEnv, [LevelledBndr])
-- Compute the levels for the binders of a lambda group
lvlLamBndrs env lvl bndrs
= lvlBndrs env new_lvl bndrs
where
new_lvl | any is_major bndrs = incMajorLvl lvl
| otherwise = incMinorLvl lvl
is_major bndr = isId bndr && not (isProbablyOneShotLambda bndr)
-- The "probably" part says "don't float things out of a
-- probable one-shot lambda"
-- See Note [Computing one-shot info] in Demand.hs | 524 | lvlLamBndrs :: LevelEnv -> Level -> [OutVar] -> (LevelEnv, [LevelledBndr])
lvlLamBndrs env lvl bndrs
= lvlBndrs env new_lvl bndrs
where
new_lvl | any is_major bndrs = incMajorLvl lvl
| otherwise = incMinorLvl lvl
is_major bndr = isId bndr && not (isProbablyOneShotLambda bndr)
-- The "probably" part says "don't float things out of a
-- probable one-shot lambda"
-- See Note [Computing one-shot info] in Demand.hs | 468 | lvlLamBndrs env lvl bndrs
= lvlBndrs env new_lvl bndrs
where
new_lvl | any is_major bndrs = incMajorLvl lvl
| otherwise = incMinorLvl lvl
is_major bndr = isId bndr && not (isProbablyOneShotLambda bndr)
-- The "probably" part says "don't float things out of a
-- probable one-shot lambda"
-- See Note [Computing one-shot info] in Demand.hs | 393 | true | true | 3 | 11 | 130 | 128 | 58 | 70 | null | null |
bacchanalia/KitchenSink | KitchenSink/Qualified.hs | gpl-3.0 | -- |'VS.izipWith6'
vs_izipWith6 = VS.izipWith6 | 46 | vs_izipWith6 = VS.izipWith6 | 27 | vs_izipWith6 = VS.izipWith6 | 27 | true | false | 0 | 5 | 4 | 9 | 5 | 4 | null | null |
ShellShoccar-jpn/Open-usp-Tukubai | COMMANDS.HS/mdate.hs | mit | filterMode (FEnumDDiff pos diff file) = readF file >>= filterEnumDayDiff pos diff | 81 | filterMode (FEnumDDiff pos diff file) = readF file >>= filterEnumDayDiff pos diff | 81 | filterMode (FEnumDDiff pos diff file) = readF file >>= filterEnumDayDiff pos diff | 81 | false | false | 0 | 7 | 11 | 31 | 14 | 17 | null | null |
sir-murray/lol | Handler/Custom.hs | agpl-3.0 | getCustomR :: Text -> Handler Html
getCustomR name = do
deployment <- getDeploymentId
(Entity _ (Page _ _ piece)) <- runDB $ getBy404 $ UniquePage deployment name
defaultLayout $ setTitle (toHtml name) >> renderPiece piece | 234 | getCustomR :: Text -> Handler Html
getCustomR name = do
deployment <- getDeploymentId
(Entity _ (Page _ _ piece)) <- runDB $ getBy404 $ UniquePage deployment name
defaultLayout $ setTitle (toHtml name) >> renderPiece piece | 234 | getCustomR name = do
deployment <- getDeploymentId
(Entity _ (Page _ _ piece)) <- runDB $ getBy404 $ UniquePage deployment name
defaultLayout $ setTitle (toHtml name) >> renderPiece piece | 199 | false | true | 0 | 11 | 46 | 89 | 41 | 48 | null | null |
text-utf8/text | benchmarks/haskell/Benchmarks/ReadNumbers.hs | bsd-2-clause | string :: (Ord a, Num a) => (t -> [(a, t)]) -> [t] -> a
string reader = foldl' go 1000000
where
go z t = case reader t of [(n, _)] -> min n z
_ -> z | 191 | string :: (Ord a, Num a) => (t -> [(a, t)]) -> [t] -> a
string reader = foldl' go 1000000
where
go z t = case reader t of [(n, _)] -> min n z
_ -> z | 191 | string reader = foldl' go 1000000
where
go z t = case reader t of [(n, _)] -> min n z
_ -> z | 135 | false | true | 0 | 10 | 81 | 107 | 56 | 51 | null | null |
cornell-pl/evolution | email.hs | gpl-3.0 | emailsV2 :: DB.Database
emailsV2 =
DB.putTable "moreEmail" emailTable2
$ DB.putTable "email" emailTable DB.empty
where emailTable = DB.Table ["timestamp", "headers", "body"] records
records = Map.fromList [(0, ["10 May 2012", "From:Satvik", "Hello"]),
(1, ["1 Jan 2013", "From:Raghu", "Greetings"])]
emailTable2 = DB.Table ["starred", "headers", "body"] records2
records2 = Map.fromList [(1, ["true", "From:Raghu", "Hello"]),
(2, ["false", "From:Satvik", "Greetings"])] | 578 | emailsV2 :: DB.Database
emailsV2 =
DB.putTable "moreEmail" emailTable2
$ DB.putTable "email" emailTable DB.empty
where emailTable = DB.Table ["timestamp", "headers", "body"] records
records = Map.fromList [(0, ["10 May 2012", "From:Satvik", "Hello"]),
(1, ["1 Jan 2013", "From:Raghu", "Greetings"])]
emailTable2 = DB.Table ["starred", "headers", "body"] records2
records2 = Map.fromList [(1, ["true", "From:Raghu", "Hello"]),
(2, ["false", "From:Satvik", "Greetings"])] | 578 | emailsV2 =
DB.putTable "moreEmail" emailTable2
$ DB.putTable "email" emailTable DB.empty
where emailTable = DB.Table ["timestamp", "headers", "body"] records
records = Map.fromList [(0, ["10 May 2012", "From:Satvik", "Hello"]),
(1, ["1 Jan 2013", "From:Raghu", "Greetings"])]
emailTable2 = DB.Table ["starred", "headers", "body"] records2
records2 = Map.fromList [(1, ["true", "From:Raghu", "Hello"]),
(2, ["false", "From:Satvik", "Greetings"])] | 554 | false | true | 3 | 8 | 162 | 172 | 100 | 72 | null | null |
pparkkin/eta | compiler/ETA/CodeGen/Main.hs | bsd-3-clause | cgTopBinding dflags (StgRec pairs) = do
_mod <- getModule
let (binders, rhss) = unzip pairs
traceCg $ str "generating (rec) " <+> ppr binders
binders' <- mapM (externaliseId dflags) binders
let pairs' = zip binders' rhss
conRecIds = map fst
$ filter (\(_, expr) -> case expr of
StgRhsCon _ _ _ -> True
_ -> False)
$ pairs'
r = unzipWith (cgTopRhs dflags Recursive conRecIds) pairs'
(infos, codes) = unzip r
addBindings infos
recInfos <- fmap catMaybes
$ forM (zip binders' codes)
$ \(id, code) -> do
mRecInfo <- code
return $ fmap (id,) mRecInfo
genRecInitCode recInfos | 805 | cgTopBinding dflags (StgRec pairs) = do
_mod <- getModule
let (binders, rhss) = unzip pairs
traceCg $ str "generating (rec) " <+> ppr binders
binders' <- mapM (externaliseId dflags) binders
let pairs' = zip binders' rhss
conRecIds = map fst
$ filter (\(_, expr) -> case expr of
StgRhsCon _ _ _ -> True
_ -> False)
$ pairs'
r = unzipWith (cgTopRhs dflags Recursive conRecIds) pairs'
(infos, codes) = unzip r
addBindings infos
recInfos <- fmap catMaybes
$ forM (zip binders' codes)
$ \(id, code) -> do
mRecInfo <- code
return $ fmap (id,) mRecInfo
genRecInitCode recInfos | 805 | cgTopBinding dflags (StgRec pairs) = do
_mod <- getModule
let (binders, rhss) = unzip pairs
traceCg $ str "generating (rec) " <+> ppr binders
binders' <- mapM (externaliseId dflags) binders
let pairs' = zip binders' rhss
conRecIds = map fst
$ filter (\(_, expr) -> case expr of
StgRhsCon _ _ _ -> True
_ -> False)
$ pairs'
r = unzipWith (cgTopRhs dflags Recursive conRecIds) pairs'
(infos, codes) = unzip r
addBindings infos
recInfos <- fmap catMaybes
$ forM (zip binders' codes)
$ \(id, code) -> do
mRecInfo <- code
return $ fmap (id,) mRecInfo
genRecInitCode recInfos | 805 | false | false | 0 | 18 | 333 | 258 | 123 | 135 | null | null |
music-suite/music-pitch-literal | src/Music/Pitch/Literal/Interval.hs | bsd-3-clause | d12 = fromInterval $ IntervalL (1,4,6) | 39 | d12 = fromInterval $ IntervalL (1,4,6) | 39 | d12 = fromInterval $ IntervalL (1,4,6) | 39 | false | false | 0 | 7 | 6 | 22 | 12 | 10 | null | null |
vTurbine/ghc | compiler/basicTypes/Unique.hs | bsd-3-clause | -- Provided here to make it explicit at the call-site that it can
-- introduce non-determinism.
-- See Note [Unique Determinism]
-- See Note [No Ord for Unique]
nonDetCmpUnique :: Unique -> Unique -> Ordering
nonDetCmpUnique (MkUnique u1) (MkUnique u2)
= if u1 == u2 then EQ else if u1 < u2 then LT else GT | 308 | nonDetCmpUnique :: Unique -> Unique -> Ordering
nonDetCmpUnique (MkUnique u1) (MkUnique u2)
= if u1 == u2 then EQ else if u1 < u2 then LT else GT | 147 | nonDetCmpUnique (MkUnique u1) (MkUnique u2)
= if u1 == u2 then EQ else if u1 < u2 then LT else GT | 99 | true | true | 0 | 7 | 57 | 64 | 36 | 28 | null | null |
gnn/Hets | OWL2/XML.hs | gpl-2.0 | -- | parses all children with the given name
filterCh :: String -> Element -> [Element]
filterCh s = filterChildrenName (isSmth s) | 130 | filterCh :: String -> Element -> [Element]
filterCh s = filterChildrenName (isSmth s) | 85 | filterCh s = filterChildrenName (isSmth s) | 42 | true | true | 0 | 7 | 21 | 35 | 18 | 17 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/showSigned_1.hs | mit | primMulNat (Succ x) Zero = Zero | 31 | primMulNat (Succ x) Zero = Zero | 31 | primMulNat (Succ x) Zero = Zero | 31 | false | false | 1 | 6 | 5 | 19 | 8 | 11 | null | null |
zeyuanxy/haskell-playground | write-yourself-a-scheme/chap7/main.hs | mit | cdr :: [LispVal] -> ThrowsError LispVal
cdr [List (x:xs)] = return $ List xs | 76 | cdr :: [LispVal] -> ThrowsError LispVal
cdr [List (x:xs)] = return $ List xs | 76 | cdr [List (x:xs)] = return $ List xs | 36 | false | true | 0 | 8 | 13 | 48 | 23 | 25 | null | null |
Operational-Transformation/ot.hs | test/Control/OperationalTransformation/Text/Tests.hs | mit | prop_apply_length :: T.Text -> Property
prop_apply_length doc = property $ do
op <- genOperation doc
return $ case apply op doc of
Left _ -> False
Right str' -> T.length str' == T.length doc + deltaLength op | 219 | prop_apply_length :: T.Text -> Property
prop_apply_length doc = property $ do
op <- genOperation doc
return $ case apply op doc of
Left _ -> False
Right str' -> T.length str' == T.length doc + deltaLength op | 219 | prop_apply_length doc = property $ do
op <- genOperation doc
return $ case apply op doc of
Left _ -> False
Right str' -> T.length str' == T.length doc + deltaLength op | 179 | false | true | 2 | 15 | 48 | 96 | 41 | 55 | null | null |
adarqui/ToyBox | haskell/Core/src/Core/Square.hs | gpl-3.0 | square :: Int -> Int
square x = x * x | 37 | square :: Int -> Int
square x = x * x | 37 | square x = x * x | 16 | false | true | 1 | 7 | 10 | 29 | 12 | 17 | null | null |
CBMM/petersonfaces | petersonfaces-frontend/src/Main.hs | bsd-3-clause | main :: IO ()
main = mainWidget run''' | 38 | main :: IO ()
main = mainWidget run''' | 38 | main = mainWidget run''' | 24 | false | true | 1 | 6 | 7 | 22 | 9 | 13 | null | null |
brendanhay/gogol | gogol-iamcredentials/gen/Network/Google/Resource/IAMCredentials/Projects/ServiceAccounts/GenerateAccessToken.hs | mpl-2.0 | -- | Upload protocol for media (e.g. \"raw\", \"multipart\").
psagatUploadProtocol :: Lens' ProjectsServiceAccountsGenerateAccessToken (Maybe Text)
psagatUploadProtocol
= lens _psagatUploadProtocol
(\ s a -> s{_psagatUploadProtocol = a}) | 245 | psagatUploadProtocol :: Lens' ProjectsServiceAccountsGenerateAccessToken (Maybe Text)
psagatUploadProtocol
= lens _psagatUploadProtocol
(\ s a -> s{_psagatUploadProtocol = a}) | 183 | psagatUploadProtocol
= lens _psagatUploadProtocol
(\ s a -> s{_psagatUploadProtocol = a}) | 97 | true | true | 0 | 8 | 33 | 49 | 25 | 24 | null | null |
intolerable/GroupProject | src/Emulator/Video/Sprite.hs | bsd-2-clause | -- 2D mapping. Each row of tiles is at a 4000h offset from eachother
nextTileIdx tileIdx _ _ False = tileIdx + 0x00004000 | 121 | nextTileIdx tileIdx _ _ False = tileIdx + 0x00004000 | 52 | nextTileIdx tileIdx _ _ False = tileIdx + 0x00004000 | 52 | true | false | 3 | 5 | 22 | 22 | 9 | 13 | null | null |
BeautifulDestinations/caret | lib/Caret/BFGS.hs | mit | bfgsWith :: BFGSOpts -> Fn -> GradFn -> Point -> Hessian -> Either String (Point, Hessian)
bfgsWith opt@(BFGSOpts _ _ maxiters) f df p0 h0 =
case (hasnan f0, hasnan g0) of
(False, False) -> go 0 b0
errs -> Left $ nanMsg p0 (Just f0) (Just g0)
where go iters b =
if iters > maxiters
then Left "maximum iterations exceeded in bfgs"
else case bfgsStepWith opt f df b of
Left err -> Left err
Right (True, b') -> Right (p b', h b')
Right (False, b') -> go (iters+1) b'
f0 = f p0 ; g0 = df p0
b0 = BFGS p0 f0 g0 (-g0) h0 (maxStep p0)
-- Do a BFGS step with default parameters.
-- | 669 | bfgsWith :: BFGSOpts -> Fn -> GradFn -> Point -> Hessian -> Either String (Point, Hessian)
bfgsWith opt@(BFGSOpts _ _ maxiters) f df p0 h0 =
case (hasnan f0, hasnan g0) of
(False, False) -> go 0 b0
errs -> Left $ nanMsg p0 (Just f0) (Just g0)
where go iters b =
if iters > maxiters
then Left "maximum iterations exceeded in bfgs"
else case bfgsStepWith opt f df b of
Left err -> Left err
Right (True, b') -> Right (p b', h b')
Right (False, b') -> go (iters+1) b'
f0 = f p0 ; g0 = df p0
b0 = BFGS p0 f0 g0 (-g0) h0 (maxStep p0)
-- Do a BFGS step with default parameters.
-- | 669 | bfgsWith opt@(BFGSOpts _ _ maxiters) f df p0 h0 =
case (hasnan f0, hasnan g0) of
(False, False) -> go 0 b0
errs -> Left $ nanMsg p0 (Just f0) (Just g0)
where go iters b =
if iters > maxiters
then Left "maximum iterations exceeded in bfgs"
else case bfgsStepWith opt f df b of
Left err -> Left err
Right (True, b') -> Right (p b', h b')
Right (False, b') -> go (iters+1) b'
f0 = f p0 ; g0 = df p0
b0 = BFGS p0 f0 g0 (-g0) h0 (maxStep p0)
-- Do a BFGS step with default parameters.
-- | 578 | false | true | 2 | 11 | 216 | 279 | 142 | 137 | null | null |
Southern-Exposure-Seed-Exchange/southernexposure.com | server/src/Routes/Utils.hs | gpl-3.0 | -- | Similar to 'mapUpdate', but transforms the inner Maybe value before
-- creating the 'Update'.
mapUpdateWith :: E.PersistField b => EntityField e b -> Maybe a -> (a -> b) -> Maybe (Update e)
mapUpdateWith field param transform =
mapUpdate field $ transform <$> param | 274 | mapUpdateWith :: E.PersistField b => EntityField e b -> Maybe a -> (a -> b) -> Maybe (Update e)
mapUpdateWith field param transform =
mapUpdate field $ transform <$> param | 175 | mapUpdateWith field param transform =
mapUpdate field $ transform <$> param | 79 | true | true | 0 | 11 | 49 | 76 | 37 | 39 | null | null |
dag/heist-highlighter | test/Main.hs | bsd-3-clause | assertTemplateOutput :: B.ByteString -> String -> Assertion
assertTemplateOutput template fixture =
do
ets <- H.loadTemplates "test/templates" $
H.bindSplice "highlight" (highlighterSplice lexer) $
H.defaultHeistState
let ts = either error id ets
Just (b,_) <- H.renderTemplate ts template
f <- B.readFile $ "test/fixtures/" ++ fixture ++ ".html"
toByteString b @?= f | 411 | assertTemplateOutput :: B.ByteString -> String -> Assertion
assertTemplateOutput template fixture =
do
ets <- H.loadTemplates "test/templates" $
H.bindSplice "highlight" (highlighterSplice lexer) $
H.defaultHeistState
let ts = either error id ets
Just (b,_) <- H.renderTemplate ts template
f <- B.readFile $ "test/fixtures/" ++ fixture ++ ".html"
toByteString b @?= f | 411 | assertTemplateOutput template fixture =
do
ets <- H.loadTemplates "test/templates" $
H.bindSplice "highlight" (highlighterSplice lexer) $
H.defaultHeistState
let ts = either error id ets
Just (b,_) <- H.renderTemplate ts template
f <- B.readFile $ "test/fixtures/" ++ fixture ++ ".html"
toByteString b @?= f | 351 | false | true | 0 | 12 | 92 | 131 | 61 | 70 | null | null |
mbudde/jana | src/Jana/Parser.hs | bsd-3-clause | parseProgram :: String -> String -> Either JanaError Program
parseProgram filename text =
case parse program filename text of
Left e -> Left $ toJanaError e
Right r -> Right r | 186 | parseProgram :: String -> String -> Either JanaError Program
parseProgram filename text =
case parse program filename text of
Left e -> Left $ toJanaError e
Right r -> Right r | 186 | parseProgram filename text =
case parse program filename text of
Left e -> Left $ toJanaError e
Right r -> Right r | 125 | false | true | 0 | 9 | 41 | 68 | 31 | 37 | null | null |
robx/puzzle-draw | src/Data/Lib.hs | mit | impossible :: a
impossible = error "impossible" | 47 | impossible :: a
impossible = error "impossible" | 47 | impossible = error "impossible" | 31 | false | true | 0 | 6 | 6 | 21 | 8 | 13 | null | null |
mcschroeder/ghc | compiler/prelude/THNames.hs | bsd-3-clause | tupleKIdKey = mkPreludeMiscIdUnique 410 | 45 | tupleKIdKey = mkPreludeMiscIdUnique 410 | 45 | tupleKIdKey = mkPreludeMiscIdUnique 410 | 45 | false | false | 0 | 5 | 9 | 9 | 4 | 5 | null | null |
hackern/network-hans | src/Network/BSD/ServiceDB.hs | bsd-3-clause | makeService :: String -> Word16 -> String -> [String] -> ServiceEntry
makeService n po pr al = ServiceEntry n al (PortNum po) pr | 128 | makeService :: String -> Word16 -> String -> [String] -> ServiceEntry
makeService n po pr al = ServiceEntry n al (PortNum po) pr | 128 | makeService n po pr al = ServiceEntry n al (PortNum po) pr | 58 | false | true | 0 | 10 | 22 | 59 | 28 | 31 | null | null |
rfranek/duckling | Duckling/Ordinal/ET/Rules.hs | bsd-3-clause | ruleOrdinalDigits :: Rule
ruleOrdinalDigits = Rule
{ name = "ordinal (digits)"
, pattern =
[ regex "0*(\\d+)\\."
]
, prod = \tokens -> case tokens of
(Token RegexMatch (GroupMatch (match:_)):_) -> ordinal <$> parseInt match
_ -> Nothing
} | 266 | ruleOrdinalDigits :: Rule
ruleOrdinalDigits = Rule
{ name = "ordinal (digits)"
, pattern =
[ regex "0*(\\d+)\\."
]
, prod = \tokens -> case tokens of
(Token RegexMatch (GroupMatch (match:_)):_) -> ordinal <$> parseInt match
_ -> Nothing
} | 266 | ruleOrdinalDigits = Rule
{ name = "ordinal (digits)"
, pattern =
[ regex "0*(\\d+)\\."
]
, prod = \tokens -> case tokens of
(Token RegexMatch (GroupMatch (match:_)):_) -> ordinal <$> parseInt match
_ -> Nothing
} | 240 | false | true | 0 | 18 | 66 | 100 | 51 | 49 | null | null |
sitewisely/zellige | test/Data/SpecHelper.hs | apache-2.0 | tupleToGeoPts :: (Double, Double) -> Geospatial.GeoPositionWithoutCRS
tupleToGeoPts (x, y) = Geospatial.GeoPointXY (Geospatial.PointXY x y) | 139 | tupleToGeoPts :: (Double, Double) -> Geospatial.GeoPositionWithoutCRS
tupleToGeoPts (x, y) = Geospatial.GeoPointXY (Geospatial.PointXY x y) | 139 | tupleToGeoPts (x, y) = Geospatial.GeoPointXY (Geospatial.PointXY x y) | 69 | false | true | 0 | 8 | 13 | 47 | 25 | 22 | null | null |
tingtun/jmacro | Language/Javascript/JMacro/TypeCheck.hs | bsd-3-clause | evalTMonad :: TMonad a -> Either String a
evalTMonad (TMonad x) = evalState (runErrorT x) tcStateEmpty | 102 | evalTMonad :: TMonad a -> Either String a
evalTMonad (TMonad x) = evalState (runErrorT x) tcStateEmpty | 102 | evalTMonad (TMonad x) = evalState (runErrorT x) tcStateEmpty | 60 | false | true | 0 | 9 | 15 | 47 | 21 | 26 | null | null |
sherwoodwang/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxSHORT_DASH :: Int
wxSHORT_DASH = 103 | 38 | wxSHORT_DASH :: Int
wxSHORT_DASH = 103 | 38 | wxSHORT_DASH = 103 | 18 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
cdosborn/lit | test/Tests.hs | gpl-2.0 | main = runTestTT $ TestList
[ testDef, testDefFollowedByTitle, testDefWithNewLines, testDefPrecedeWithNL
, testIndentedMacro
, testProse, testProseOnlyNL ] | 169 | main = runTestTT $ TestList
[ testDef, testDefFollowedByTitle, testDefWithNewLines, testDefPrecedeWithNL
, testIndentedMacro
, testProse, testProseOnlyNL ] | 169 | main = runTestTT $ TestList
[ testDef, testDefFollowedByTitle, testDefWithNewLines, testDefPrecedeWithNL
, testIndentedMacro
, testProse, testProseOnlyNL ] | 169 | false | false | 3 | 5 | 29 | 38 | 20 | 18 | null | null |
talw/crisp-compiler | src/Parser.hs | bsd-3-clause | defineP :: Parser Expr
defineP = reservedFuncP "define" $
DefExp <$> LX.identifier <*> exprP | 96 | defineP :: Parser Expr
defineP = reservedFuncP "define" $
DefExp <$> LX.identifier <*> exprP | 96 | defineP = reservedFuncP "define" $
DefExp <$> LX.identifier <*> exprP | 73 | false | true | 0 | 8 | 17 | 31 | 15 | 16 | null | null |
topliceanu/learn | haskell/countdown.hs | mit | -- the expression evaluates to the target value.
-- returns all possible ways of splitting a list into two lists which are non-empty.
-- TODO implement using take() and drop().
split :: [a] -> [([a], [a])]
split [] = [] | 220 | split :: [a] -> [([a], [a])]
split [] = [] | 42 | split [] = [] | 13 | true | true | 0 | 10 | 40 | 49 | 27 | 22 | null | null |
marcellussiegburg/icfp-2015 | Main.hs | mit | parseParametersHelper :: Arguments -> [String] -> Arguments
parseParametersHelper arguments [] = arguments | 106 | parseParametersHelper :: Arguments -> [String] -> Arguments
parseParametersHelper arguments [] = arguments | 106 | parseParametersHelper arguments [] = arguments | 46 | false | true | 0 | 7 | 11 | 29 | 15 | 14 | null | null |
ghc-android/ghc | testsuite/tests/ghci/should_run/ghcirun004.hs | bsd-3-clause | 3794 = 3793 | 11 | 3794 = 3793 | 11 | 3794 = 3793 | 11 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
yoo-e/weixin-mp-sdk | WeiXin/PublicPlatform/Security.hs | mit | pkcs7PaddingEncode :: Int -> ByteString -> ByteString
pkcs7PaddingEncode blk_size bs =
if pad_num <= 0
then bs
else bs <> (replicate pad_num $ fromIntegral pad_num)
where
blen = length bs
pad_num = blk_size - blen `rem` blk_size | 271 | pkcs7PaddingEncode :: Int -> ByteString -> ByteString
pkcs7PaddingEncode blk_size bs =
if pad_num <= 0
then bs
else bs <> (replicate pad_num $ fromIntegral pad_num)
where
blen = length bs
pad_num = blk_size - blen `rem` blk_size | 271 | pkcs7PaddingEncode blk_size bs =
if pad_num <= 0
then bs
else bs <> (replicate pad_num $ fromIntegral pad_num)
where
blen = length bs
pad_num = blk_size - blen `rem` blk_size | 217 | false | true | 0 | 9 | 79 | 78 | 41 | 37 | null | null |
emilaxelsson/compass | examples/NanoFeldspar.hs | bsd-3-clause | sum :: (Num a, Syntax a) => Vector a -> a
sum = fold (+) 0 | 58 | sum :: (Num a, Syntax a) => Vector a -> a
sum = fold (+) 0 | 58 | sum = fold (+) 0 | 16 | false | true | 0 | 8 | 15 | 46 | 22 | 24 | null | null |
GaloisInc/saw-script | saw-core/src/Verifier/SAW/Rewriter.hs | bsd-3-clause | ruleOfProp (R.asApplyAll -> (R.isGlobalDef equalNatIdent -> Just (), [x, y])) ann =
Just $ mkRewriteRule [] x y ann | 117 | ruleOfProp (R.asApplyAll -> (R.isGlobalDef equalNatIdent -> Just (), [x, y])) ann =
Just $ mkRewriteRule [] x y ann | 117 | ruleOfProp (R.asApplyAll -> (R.isGlobalDef equalNatIdent -> Just (), [x, y])) ann =
Just $ mkRewriteRule [] x y ann | 117 | false | false | 2 | 11 | 20 | 62 | 31 | 31 | null | null |
stepcut/minecraft-data | Minecraft/Combinators.hs | bsd-3-clause | -- | standard planes
--
-- While 'xzPlane' might sound more natural, we want the cross product
-- of the two dimensions to be a vector in the same direction as the
-- 3rd.
xyPlane, yzPlane, zxPlane :: Plane
xyPlane = Plane x y | 226 | xyPlane, yzPlane, zxPlane :: Plane
xyPlane = Plane x y | 54 | xyPlane = Plane x y | 19 | true | true | 0 | 5 | 43 | 25 | 17 | 8 | null | null |
katydid/haslapse | src/Data/Katydid/Relapse/Smart.hs | bsd-3-clause | andPat' :: S.Set Pattern -> Pattern
andPat' ps = ps `returnIfSingleton` \ps -> if S.member emptySet ps
then emptySet
else S.delete zanyPat ps `returnIfSingleton` \ps -> if S.member emptyPat ps
then if all nullable ps then emptyPat else emptySet
else ps `returnIfSingleton` \ps ->
mergeLeaves andExpr ps `returnIfSingleton` \ps ->
mergeNodesWithEqualNames andPat ps `returnIfSingleton` \ps ->
let psList = sort $ S.toList ps
in And
{ pats = psList
, _nullable = all nullable psList
, _hash = Expr.hashList (31 * 37) $ map hash psList
} | 654 | andPat' :: S.Set Pattern -> Pattern
andPat' ps = ps `returnIfSingleton` \ps -> if S.member emptySet ps
then emptySet
else S.delete zanyPat ps `returnIfSingleton` \ps -> if S.member emptyPat ps
then if all nullable ps then emptyPat else emptySet
else ps `returnIfSingleton` \ps ->
mergeLeaves andExpr ps `returnIfSingleton` \ps ->
mergeNodesWithEqualNames andPat ps `returnIfSingleton` \ps ->
let psList = sort $ S.toList ps
in And
{ pats = psList
, _nullable = all nullable psList
, _hash = Expr.hashList (31 * 37) $ map hash psList
} | 654 | andPat' ps = ps `returnIfSingleton` \ps -> if S.member emptySet ps
then emptySet
else S.delete zanyPat ps `returnIfSingleton` \ps -> if S.member emptyPat ps
then if all nullable ps then emptyPat else emptySet
else ps `returnIfSingleton` \ps ->
mergeLeaves andExpr ps `returnIfSingleton` \ps ->
mergeNodesWithEqualNames andPat ps `returnIfSingleton` \ps ->
let psList = sort $ S.toList ps
in And
{ pats = psList
, _nullable = all nullable psList
, _hash = Expr.hashList (31 * 37) $ map hash psList
} | 618 | false | true | 0 | 24 | 206 | 204 | 110 | 94 | null | null |
ssaavedra/liquidhaskell | benchmarks/esop2013-submission/Base.hs | bsd-3-clause | {--------------------------------------------------------------------
MergeWithKey
--------------------------------------------------------------------}
-- | /O(n+m)/. A high-performance universal combining function. This function
-- is used to define 'unionWith', 'unionWithKey', 'differenceWith',
-- 'differenceWithKey', 'intersectionWith', 'intersectionWithKey' and can be
-- used to define other custom combine functions.
--
-- Please make sure you know what is going on when using 'mergeWithKey',
-- otherwise you can be surprised by unexpected code growth or even
-- corruption of the data structure.
--
-- When 'mergeWithKey' is given three arguments, it is inlined to the call
-- site. You should therefore use 'mergeWithKey' only to define your custom
-- combining functions. For example, you could define 'unionWithKey',
-- 'differenceWithKey' and 'intersectionWithKey' as
--
-- > myUnionWithKey f m1 m2 = mergeWithKey (\k x1 x2 -> Just (f k x1 x2)) id id m1 m2
-- > myDifferenceWithKey f m1 m2 = mergeWithKey f id (const empty) m1 m2
-- > myIntersectionWithKey f m1 m2 = mergeWithKey (\k x1 x2 -> Just (f k x1 x2)) (const empty) (const empty) m1 m2
--
-- When calling @'mergeWithKey' combine only1 only2@, a function combining two
-- 'IntMap's is created, such that
--
-- * if a key is present in both maps, it is passed with both corresponding
-- values to the @combine@ function. Depending on the result, the key is either
-- present in the result with specified value, or is left out;
--
-- * a nonempty subtree present only in the first map is passed to @only1@ and
-- the output is added to the result;
--
-- * a nonempty subtree present only in the second map is passed to @only2@ and
-- the output is added to the result.
--
-- The @only1@ and @only2@ methods /must return a map with a subset (possibly empty) of the keys of the given map/.
-- The values can be modified arbitrarily. Most common variants of @only1@ and
-- @only2@ are 'id' and @'const' 'empty'@, but for example @'map' f@ or
-- @'filterWithKey' f@ could be used for any @f@.
{-@ mergeWithKey :: (Ord k) => (k -> a -> b -> Maybe c)
-> (lo:MaybeS k -> hi: MaybeS k -> OMap {v: k | (KeyBetween lo hi v) } a -> OMap {v: k | (KeyBetween lo hi v) } c)
-> (lo:MaybeS k -> hi: MaybeS k -> OMap {v: k | (KeyBetween lo hi v) } b -> OMap {v: k | (KeyBetween lo hi v) } c)
-> OMap k a -> OMap k b -> OMap k c @-}
mergeWithKey :: Ord k => (k -> a -> b -> Maybe c) -> (MaybeS k -> MaybeS k -> Map k a -> Map k c) -> (MaybeS k -> MaybeS k -> Map k b -> Map k c)
-> Map k a -> Map k b -> Map k c
mergeWithKey f g1 g2 = go
where
go Tip t2 = g2 NothingS NothingS t2
go t1 Tip = g1 NothingS NothingS t1
go t1 t2 = hedgeMerge f g1 g2 NothingS NothingS t1 t2
{-@ hedgeMerge :: (Ord k) => (k -> a -> b -> Maybe c)
-> (lo:MaybeS k -> hi: MaybeS k -> OMap {v: k | (KeyBetween lo hi v) } a -> OMap {v: k | (KeyBetween lo hi v) } c)
-> (lo:MaybeS k -> hi: MaybeS k -> OMap {v: k | (KeyBetween lo hi v) } b -> OMap {v: k | (KeyBetween lo hi v) } c)
-> lo: MaybeS k
-> hi: MaybeS {v: k | (IfDefLt lo v) }
-> OMap {v: k | (KeyBetween lo hi v) } a
-> {v: OMap k b | (RootBetween lo hi v) }
-> OMap {v: k | (KeyBetween lo hi v)} c @-} | 3,533 | mergeWithKey :: Ord k => (k -> a -> b -> Maybe c) -> (MaybeS k -> MaybeS k -> Map k a -> Map k c) -> (MaybeS k -> MaybeS k -> Map k b -> Map k c)
-> Map k a -> Map k b -> Map k c
mergeWithKey f g1 g2 = go
where
go Tip t2 = g2 NothingS NothingS t2
go t1 Tip = g1 NothingS NothingS t1
go t1 t2 = hedgeMerge f g1 g2 NothingS NothingS t1 t2
{-@ hedgeMerge :: (Ord k) => (k -> a -> b -> Maybe c)
-> (lo:MaybeS k -> hi: MaybeS k -> OMap {v: k | (KeyBetween lo hi v) } a -> OMap {v: k | (KeyBetween lo hi v) } c)
-> (lo:MaybeS k -> hi: MaybeS k -> OMap {v: k | (KeyBetween lo hi v) } b -> OMap {v: k | (KeyBetween lo hi v) } c)
-> lo: MaybeS k
-> hi: MaybeS {v: k | (IfDefLt lo v) }
-> OMap {v: k | (KeyBetween lo hi v) } a
-> {v: OMap k b | (RootBetween lo hi v) }
-> OMap {v: k | (KeyBetween lo hi v)} c @-} | 1,055 | mergeWithKey f g1 g2 = go
where
go Tip t2 = g2 NothingS NothingS t2
go t1 Tip = g1 NothingS NothingS t1
go t1 t2 = hedgeMerge f g1 g2 NothingS NothingS t1 t2
{-@ hedgeMerge :: (Ord k) => (k -> a -> b -> Maybe c)
-> (lo:MaybeS k -> hi: MaybeS k -> OMap {v: k | (KeyBetween lo hi v) } a -> OMap {v: k | (KeyBetween lo hi v) } c)
-> (lo:MaybeS k -> hi: MaybeS k -> OMap {v: k | (KeyBetween lo hi v) } b -> OMap {v: k | (KeyBetween lo hi v) } c)
-> lo: MaybeS k
-> hi: MaybeS {v: k | (IfDefLt lo v) }
-> OMap {v: k | (KeyBetween lo hi v) } a
-> {v: OMap k b | (RootBetween lo hi v) }
-> OMap {v: k | (KeyBetween lo hi v)} c @-} | 863 | true | true | 3 | 14 | 972 | 264 | 133 | 131 | null | null |
slasser/AllStar | GrammarReader/GrammarReader.hs | bsd-3-clause | expansionToATNPath nt exp choiceNum =
let buildMiddleAndFinalStates n symbols =
case symbols of
[] -> [(MIDDLE n, EPS, FINAL nt)]
s : symbols' ->
let edgeLabel = if isUpper s then NT s else T s
in (MIDDLE n, edgeLabel, MIDDLE (n + 1)) : buildMiddleAndFinalStates (n + 1) symbols'
in (INIT nt, EPS, CHOICE nt choiceNum) :
(CHOICE nt choiceNum, EPS, MIDDLE 1) :
buildMiddleAndFinalStates 1 exp | 472 | expansionToATNPath nt exp choiceNum =
let buildMiddleAndFinalStates n symbols =
case symbols of
[] -> [(MIDDLE n, EPS, FINAL nt)]
s : symbols' ->
let edgeLabel = if isUpper s then NT s else T s
in (MIDDLE n, edgeLabel, MIDDLE (n + 1)) : buildMiddleAndFinalStates (n + 1) symbols'
in (INIT nt, EPS, CHOICE nt choiceNum) :
(CHOICE nt choiceNum, EPS, MIDDLE 1) :
buildMiddleAndFinalStates 1 exp | 472 | expansionToATNPath nt exp choiceNum =
let buildMiddleAndFinalStates n symbols =
case symbols of
[] -> [(MIDDLE n, EPS, FINAL nt)]
s : symbols' ->
let edgeLabel = if isUpper s then NT s else T s
in (MIDDLE n, edgeLabel, MIDDLE (n + 1)) : buildMiddleAndFinalStates (n + 1) symbols'
in (INIT nt, EPS, CHOICE nt choiceNum) :
(CHOICE nt choiceNum, EPS, MIDDLE 1) :
buildMiddleAndFinalStates 1 exp | 472 | false | false | 0 | 18 | 148 | 182 | 91 | 91 | null | null |
begriffs/hasql-postgres | tests/Main.hs | mit | test_mappingOfList3 =
session1 $ do
validMappingSession [" 'a' \"b\" \\c\\ " :: Text] | 91 | test_mappingOfList3 =
session1 $ do
validMappingSession [" 'a' \"b\" \\c\\ " :: Text] | 91 | test_mappingOfList3 =
session1 $ do
validMappingSession [" 'a' \"b\" \\c\\ " :: Text] | 91 | false | false | 0 | 9 | 18 | 22 | 11 | 11 | null | null |
RayRacine/aws | Aws/Core.hs | bsd-3-clause | queryList :: (a -> [(B.ByteString, B.ByteString)]) -> B.ByteString -> [a] -> [(B.ByteString, B.ByteString)]
queryList f prefix xs = concat $ zipWith combine prefixList (map f xs)
where prefixList = map (dot prefix . BU.fromString . show) [(1 :: Int) ..]
combine pf = map $ first (pf `dot`)
dot x y = B.concat [x, BU.fromString ".", y]
-- | A \"true\"/\"false\" boolean as requested by some services. | 424 | queryList :: (a -> [(B.ByteString, B.ByteString)]) -> B.ByteString -> [a] -> [(B.ByteString, B.ByteString)]
queryList f prefix xs = concat $ zipWith combine prefixList (map f xs)
where prefixList = map (dot prefix . BU.fromString . show) [(1 :: Int) ..]
combine pf = map $ first (pf `dot`)
dot x y = B.concat [x, BU.fromString ".", y]
-- | A \"true\"/\"false\" boolean as requested by some services. | 424 | queryList f prefix xs = concat $ zipWith combine prefixList (map f xs)
where prefixList = map (dot prefix . BU.fromString . show) [(1 :: Int) ..]
combine pf = map $ first (pf `dot`)
dot x y = B.concat [x, BU.fromString ".", y]
-- | A \"true\"/\"false\" boolean as requested by some services. | 316 | false | true | 0 | 11 | 91 | 176 | 96 | 80 | null | null |
castaway/pandoc | src/Text/Pandoc/Readers/LaTeX.hs | gpl-2.0 | isLowerHex :: Char -> Bool
isLowerHex x = x >= '0' && x <= '9' || x >= 'a' && x <= 'f' | 86 | isLowerHex :: Char -> Bool
isLowerHex x = x >= '0' && x <= '9' || x >= 'a' && x <= 'f' | 86 | isLowerHex x = x >= '0' && x <= '9' || x >= 'a' && x <= 'f' | 59 | false | true | 0 | 11 | 22 | 46 | 23 | 23 | null | null |
romanb/amazonka | amazonka-ec2/gen/Network/AWS/EC2/Types.hs | mpl-2.0 | -- | The IAM instance profile.
lsIamInstanceProfile :: Lens' LaunchSpecification (Maybe IamInstanceProfileSpecification)
lsIamInstanceProfile =
lens _lsIamInstanceProfile (\s a -> s { _lsIamInstanceProfile = a }) | 216 | lsIamInstanceProfile :: Lens' LaunchSpecification (Maybe IamInstanceProfileSpecification)
lsIamInstanceProfile =
lens _lsIamInstanceProfile (\s a -> s { _lsIamInstanceProfile = a }) | 185 | lsIamInstanceProfile =
lens _lsIamInstanceProfile (\s a -> s { _lsIamInstanceProfile = a }) | 95 | true | true | 1 | 9 | 28 | 52 | 25 | 27 | null | null |
sgillespie/ghc | compiler/cmm/CLabel.hs | bsd-3-clause | maybeAsmTemp _ = Nothing | 49 | maybeAsmTemp _ = Nothing | 49 | maybeAsmTemp _ = Nothing | 49 | false | false | 0 | 5 | 28 | 9 | 4 | 5 | null | null |
AlexanderPankiv/ghc | compiler/typecheck/TcEvidence.hs | bsd-3-clause | ppr_co p (TcLRCo lr co) = pprPrefixApp p (ppr lr) [pprParendTcCo co] | 74 | ppr_co p (TcLRCo lr co) = pprPrefixApp p (ppr lr) [pprParendTcCo co] | 74 | ppr_co p (TcLRCo lr co) = pprPrefixApp p (ppr lr) [pprParendTcCo co] | 74 | false | false | 0 | 7 | 17 | 38 | 18 | 20 | null | null |
balangs/eTeak | src/Chan.hs | bsd-3-clause | makeOpenChanContext :: Pos -> [Context Decl] -> [Chan] -> Context Decl
makeOpenChanContext pos cs chans = context
where
chanRefs = flattenChanIndices chans
context = bindingsToContext1 $ map makeOpenChanFromRef chanRefs
makeOpenChanFromRef (ref, indicess) = case decl of
ArrayedDecl {} -> bindIncomplete openChanArray
FlatArrayedDecl {} -> bindIncomplete openChanArray
OpenChanDeclE {} -> bindIncomplete openChanArray
ChanDecl {} -> bindIncomplete $ OpenChanDecl pos ref $ declType decl
PortDecl {} -> bindIncomplete $ OpenChanDecl pos ref $ declType decl
_ -> error $ "makeOpenChanContext: can't make open chan from `" ++ show decl ++ "'"
where
binding = findBindingByRef cs ref
name = bindingName binding
decl = bindingValue binding
bindIncomplete = Binding 0 name OtherNamespace Incomplete
openChanArray = OpenChanDeclE pos ref indicess
-- FIXME indices must be different for different chans | 1,160 | makeOpenChanContext :: Pos -> [Context Decl] -> [Chan] -> Context Decl
makeOpenChanContext pos cs chans = context
where
chanRefs = flattenChanIndices chans
context = bindingsToContext1 $ map makeOpenChanFromRef chanRefs
makeOpenChanFromRef (ref, indicess) = case decl of
ArrayedDecl {} -> bindIncomplete openChanArray
FlatArrayedDecl {} -> bindIncomplete openChanArray
OpenChanDeclE {} -> bindIncomplete openChanArray
ChanDecl {} -> bindIncomplete $ OpenChanDecl pos ref $ declType decl
PortDecl {} -> bindIncomplete $ OpenChanDecl pos ref $ declType decl
_ -> error $ "makeOpenChanContext: can't make open chan from `" ++ show decl ++ "'"
where
binding = findBindingByRef cs ref
name = bindingName binding
decl = bindingValue binding
bindIncomplete = Binding 0 name OtherNamespace Incomplete
openChanArray = OpenChanDeclE pos ref indicess
-- FIXME indices must be different for different chans | 1,156 | makeOpenChanContext pos cs chans = context
where
chanRefs = flattenChanIndices chans
context = bindingsToContext1 $ map makeOpenChanFromRef chanRefs
makeOpenChanFromRef (ref, indicess) = case decl of
ArrayedDecl {} -> bindIncomplete openChanArray
FlatArrayedDecl {} -> bindIncomplete openChanArray
OpenChanDeclE {} -> bindIncomplete openChanArray
ChanDecl {} -> bindIncomplete $ OpenChanDecl pos ref $ declType decl
PortDecl {} -> bindIncomplete $ OpenChanDecl pos ref $ declType decl
_ -> error $ "makeOpenChanContext: can't make open chan from `" ++ show decl ++ "'"
where
binding = findBindingByRef cs ref
name = bindingName binding
decl = bindingValue binding
bindIncomplete = Binding 0 name OtherNamespace Incomplete
openChanArray = OpenChanDeclE pos ref indicess
-- FIXME indices must be different for different chans | 1,085 | false | true | 1 | 10 | 390 | 259 | 124 | 135 | null | null |
tel/saltine | bench/Main.hs | mit | main :: IO ()
main = do
authKeyToEval <- authEnv
authKey <- evaluate $ force authKeyToEval
oneTimeAuthKeyToEval <- oneTimeAuthEnv
oneTimeAuthKey <- evaluate $ force oneTimeAuthKeyToEval
boxToEval <- boxEnv
boxKeys <- evaluate $ force boxToEval
secretboxKeyToEval <- secretboxEnv
secretboxKey <- evaluate $ force secretboxKeyToEval
scmlToEval <- scalarMultEnv
scml <- evaluate $ force scmlToEval
signToEval <- signEnv
signKey <- evaluate $ force signToEval
streamKeyToEval <- streamEnv
streamKey <- evaluate $ force streamKeyToEval
passwordSaltToEval <- passwordEnv
passwordSalt <- evaluate $ force passwordSaltToEval
hashKeysToEval <- hashEnv
hashKeys <- evaluate $ force hashKeysToEval
aes256GCMKeyToEval <- aes256GCMEnv
aes256GCMKey <- evaluate $ force aes256GCMKeyToEval
chaCha20Poly1305KeyToEval <- chaCha20Poly1305Env
chaCha20Poly1305Key <- evaluate $ force chaCha20Poly1305KeyToEval
chaCha20Poly1305IETFKeyToEval <- chaCha20Poly1305IETFEnv
chaCha20Poly1305IETFKey <- evaluate $ force chaCha20Poly1305IETFKeyToEval
xChaCha20Poly1305KeyToEval <- xChaCha20Poly1305Env
xChaCha20Poly1305Key <- evaluate $ force xChaCha20Poly1305KeyToEval
defaultMain [
benchAuth authKey
, benchOneTimeAuth oneTimeAuthKey
, benchBox boxKeys
, benchSecretbox secretboxKey
, benchHash hashKeys
, benchScalarMult scml
, benchSign signKey
, benchStream streamKey
, benchPassword passwordSalt
, benchComparison
, benchAes256GCM aes256GCMKey
, benchChaCha20Poly1305 chaCha20Poly1305Key
, benchChaCha20Poly1305IETF chaCha20Poly1305IETFKey
, benchXChaCha20Poly1305 xChaCha20Poly1305Key
] | 1,691 | main :: IO ()
main = do
authKeyToEval <- authEnv
authKey <- evaluate $ force authKeyToEval
oneTimeAuthKeyToEval <- oneTimeAuthEnv
oneTimeAuthKey <- evaluate $ force oneTimeAuthKeyToEval
boxToEval <- boxEnv
boxKeys <- evaluate $ force boxToEval
secretboxKeyToEval <- secretboxEnv
secretboxKey <- evaluate $ force secretboxKeyToEval
scmlToEval <- scalarMultEnv
scml <- evaluate $ force scmlToEval
signToEval <- signEnv
signKey <- evaluate $ force signToEval
streamKeyToEval <- streamEnv
streamKey <- evaluate $ force streamKeyToEval
passwordSaltToEval <- passwordEnv
passwordSalt <- evaluate $ force passwordSaltToEval
hashKeysToEval <- hashEnv
hashKeys <- evaluate $ force hashKeysToEval
aes256GCMKeyToEval <- aes256GCMEnv
aes256GCMKey <- evaluate $ force aes256GCMKeyToEval
chaCha20Poly1305KeyToEval <- chaCha20Poly1305Env
chaCha20Poly1305Key <- evaluate $ force chaCha20Poly1305KeyToEval
chaCha20Poly1305IETFKeyToEval <- chaCha20Poly1305IETFEnv
chaCha20Poly1305IETFKey <- evaluate $ force chaCha20Poly1305IETFKeyToEval
xChaCha20Poly1305KeyToEval <- xChaCha20Poly1305Env
xChaCha20Poly1305Key <- evaluate $ force xChaCha20Poly1305KeyToEval
defaultMain [
benchAuth authKey
, benchOneTimeAuth oneTimeAuthKey
, benchBox boxKeys
, benchSecretbox secretboxKey
, benchHash hashKeys
, benchScalarMult scml
, benchSign signKey
, benchStream streamKey
, benchPassword passwordSalt
, benchComparison
, benchAes256GCM aes256GCMKey
, benchChaCha20Poly1305 chaCha20Poly1305Key
, benchChaCha20Poly1305IETF chaCha20Poly1305IETFKey
, benchXChaCha20Poly1305 xChaCha20Poly1305Key
] | 1,691 | main = do
authKeyToEval <- authEnv
authKey <- evaluate $ force authKeyToEval
oneTimeAuthKeyToEval <- oneTimeAuthEnv
oneTimeAuthKey <- evaluate $ force oneTimeAuthKeyToEval
boxToEval <- boxEnv
boxKeys <- evaluate $ force boxToEval
secretboxKeyToEval <- secretboxEnv
secretboxKey <- evaluate $ force secretboxKeyToEval
scmlToEval <- scalarMultEnv
scml <- evaluate $ force scmlToEval
signToEval <- signEnv
signKey <- evaluate $ force signToEval
streamKeyToEval <- streamEnv
streamKey <- evaluate $ force streamKeyToEval
passwordSaltToEval <- passwordEnv
passwordSalt <- evaluate $ force passwordSaltToEval
hashKeysToEval <- hashEnv
hashKeys <- evaluate $ force hashKeysToEval
aes256GCMKeyToEval <- aes256GCMEnv
aes256GCMKey <- evaluate $ force aes256GCMKeyToEval
chaCha20Poly1305KeyToEval <- chaCha20Poly1305Env
chaCha20Poly1305Key <- evaluate $ force chaCha20Poly1305KeyToEval
chaCha20Poly1305IETFKeyToEval <- chaCha20Poly1305IETFEnv
chaCha20Poly1305IETFKey <- evaluate $ force chaCha20Poly1305IETFKeyToEval
xChaCha20Poly1305KeyToEval <- xChaCha20Poly1305Env
xChaCha20Poly1305Key <- evaluate $ force xChaCha20Poly1305KeyToEval
defaultMain [
benchAuth authKey
, benchOneTimeAuth oneTimeAuthKey
, benchBox boxKeys
, benchSecretbox secretboxKey
, benchHash hashKeys
, benchScalarMult scml
, benchSign signKey
, benchStream streamKey
, benchPassword passwordSalt
, benchComparison
, benchAes256GCM aes256GCMKey
, benchChaCha20Poly1305 chaCha20Poly1305Key
, benchChaCha20Poly1305IETF chaCha20Poly1305IETFKey
, benchXChaCha20Poly1305 xChaCha20Poly1305Key
] | 1,677 | false | true | 0 | 9 | 295 | 376 | 168 | 208 | null | null |
phaazon/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/Tokens.hs | bsd-3-clause | gl_MATRIX3_NV :: GLenum
gl_MATRIX3_NV = 0x8633 | 46 | gl_MATRIX3_NV :: GLenum
gl_MATRIX3_NV = 0x8633 | 46 | gl_MATRIX3_NV = 0x8633 | 22 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
olorin/amazonka | amazonka-s3/gen/Network/AWS/S3/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'NoncurrentVersionTransition' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'nvtNoncurrentDays'
--
-- * 'nvtStorageClass'
noncurrentVersionTransition
:: Int -- ^ 'nvtNoncurrentDays'
-> TransitionStorageClass -- ^ 'nvtStorageClass'
-> NoncurrentVersionTransition
noncurrentVersionTransition pNoncurrentDays_ pStorageClass_ =
NoncurrentVersionTransition'
{ _nvtNoncurrentDays = pNoncurrentDays_
, _nvtStorageClass = pStorageClass_
} | 569 | noncurrentVersionTransition
:: Int -- ^ 'nvtNoncurrentDays'
-> TransitionStorageClass -- ^ 'nvtStorageClass'
-> NoncurrentVersionTransition
noncurrentVersionTransition pNoncurrentDays_ pStorageClass_ =
NoncurrentVersionTransition'
{ _nvtNoncurrentDays = pNoncurrentDays_
, _nvtStorageClass = pStorageClass_
} | 336 | noncurrentVersionTransition pNoncurrentDays_ pStorageClass_ =
NoncurrentVersionTransition'
{ _nvtNoncurrentDays = pNoncurrentDays_
, _nvtStorageClass = pStorageClass_
} | 184 | true | true | 0 | 8 | 92 | 56 | 32 | 24 | null | null |
gust/feature-creature | users-service/test/Users/RequestSpec.hs | mit | emptyUsers :: [User]
emptyUsers = [] | 36 | emptyUsers :: [User]
emptyUsers = [] | 36 | emptyUsers = [] | 15 | false | true | 0 | 5 | 5 | 16 | 9 | 7 | null | null |
agocorona/MFlow | Demos/Menu.hs | bsd-3-clause | yesodweb= "http://www.yesodweb.com/book/persistent" | 51 | yesodweb= "http://www.yesodweb.com/book/persistent" | 51 | yesodweb= "http://www.yesodweb.com/book/persistent" | 51 | false | false | 0 | 4 | 1 | 6 | 3 | 3 | null | null |
aisamanra/activitystreams-aeson | Codec/ActivityStream/Representation.hs | bsd-3-clause | -- | Create an @Activity@ with an @actor@, @published@, and
-- @provider@ property.
makeActivity :: Object -> UTCTime -> Activity
makeActivity actor published = Activity
$ HM.insert "actor" (toJSON actor)
$ HM.insert "published" (toJSON published)
$ HM.empty | 270 | makeActivity :: Object -> UTCTime -> Activity
makeActivity actor published = Activity
$ HM.insert "actor" (toJSON actor)
$ HM.insert "published" (toJSON published)
$ HM.empty | 184 | makeActivity actor published = Activity
$ HM.insert "actor" (toJSON actor)
$ HM.insert "published" (toJSON published)
$ HM.empty | 138 | true | true | 6 | 7 | 48 | 70 | 33 | 37 | null | null |
SKA-ScienceDataProcessor/RC | MS6/dna/flow/Flow/Vector.hs | apache-2.0 | -- This function will do nothing for vectors obtained using
-- @nullVector@ or @offsetVector@.
freeVector :: Vector a -> IO ()
freeVector (CVector 0 _) = return () | 165 | freeVector :: Vector a -> IO ()
freeVector (CVector 0 _) = return () | 70 | freeVector (CVector 0 _) = return () | 38 | true | true | 0 | 7 | 29 | 41 | 20 | 21 | null | null |
siddhanathan/yi | yi-core/src/Yi/Search.hs | gpl-2.0 | isearchIsEmpty :: EditorM Bool
isearchIsEmpty = do
Isearch s <- getEditorDyn
return . not . T.null . fst3 $ head s | 118 | isearchIsEmpty :: EditorM Bool
isearchIsEmpty = do
Isearch s <- getEditorDyn
return . not . T.null . fst3 $ head s | 118 | isearchIsEmpty = do
Isearch s <- getEditorDyn
return . not . T.null . fst3 $ head s | 87 | false | true | 0 | 10 | 24 | 48 | 22 | 26 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/replicate_1.hs | mit | esEsOrdering LT GT = MyFalse | 28 | esEsOrdering LT GT = MyFalse | 28 | esEsOrdering LT GT = MyFalse | 28 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
JohnLato/iteratee | src/Data/Iteratee/Binary.hs | bsd-3-clause | word32 :: Word8 -> Word8 -> Word8 -> Word8 -> Word32
word32 c1 c2 c3 c4 =
(fromIntegral c1 `shiftL` 24) .|.
(fromIntegral c2 `shiftL` 16) .|.
(fromIntegral c3 `shiftL` 8) .|.
fromIntegral c4 | 200 | word32 :: Word8 -> Word8 -> Word8 -> Word8 -> Word32
word32 c1 c2 c3 c4 =
(fromIntegral c1 `shiftL` 24) .|.
(fromIntegral c2 `shiftL` 16) .|.
(fromIntegral c3 `shiftL` 8) .|.
fromIntegral c4 | 200 | word32 c1 c2 c3 c4 =
(fromIntegral c1 `shiftL` 24) .|.
(fromIntegral c2 `shiftL` 16) .|.
(fromIntegral c3 `shiftL` 8) .|.
fromIntegral c4 | 147 | false | true | 0 | 10 | 43 | 93 | 47 | 46 | null | null |
rolph-recto/liquid-fixpoint | src/Language/Fixpoint/Types/Environments.hs | bsd-3-clause | unionIBindEnv :: IBindEnv -> IBindEnv -> IBindEnv
unionIBindEnv (FB m1) (FB m2) = FB $ m1 `S.union` m2 | 102 | unionIBindEnv :: IBindEnv -> IBindEnv -> IBindEnv
unionIBindEnv (FB m1) (FB m2) = FB $ m1 `S.union` m2 | 102 | unionIBindEnv (FB m1) (FB m2) = FB $ m1 `S.union` m2 | 52 | false | true | 0 | 7 | 17 | 48 | 25 | 23 | null | null |
scottgw/eiffel-typecheck | Language/Eiffel/TypeCheck/TypedExpr.hs | bsd-3-clause | texprTyp (LitDouble _) = realType | 33 | texprTyp (LitDouble _) = realType | 33 | texprTyp (LitDouble _) = realType | 33 | false | false | 0 | 7 | 4 | 15 | 7 | 8 | null | null |
kim/amazonka | amazonka-s3/gen/Network/AWS/S3/CreateMultipartUpload.hs | mpl-2.0 | -- | Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321.
-- Amazon S3 uses this header for a message integrity check to ensure the
-- encryption key was transmitted without error.
cmuSSECustomerKeyMD5 :: Lens' CreateMultipartUpload (Maybe Text)
cmuSSECustomerKeyMD5 =
lens _cmuSSECustomerKeyMD5 (\s a -> s { _cmuSSECustomerKeyMD5 = a }) | 366 | cmuSSECustomerKeyMD5 :: Lens' CreateMultipartUpload (Maybe Text)
cmuSSECustomerKeyMD5 =
lens _cmuSSECustomerKeyMD5 (\s a -> s { _cmuSSECustomerKeyMD5 = a }) | 160 | cmuSSECustomerKeyMD5 =
lens _cmuSSECustomerKeyMD5 (\s a -> s { _cmuSSECustomerKeyMD5 = a }) | 95 | true | true | 0 | 9 | 58 | 48 | 27 | 21 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/Resources/AutoScalingAutoScalingGroup.hs | mit | -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-launchconfigurationname
asasgLaunchConfigurationName :: Lens' AutoScalingAutoScalingGroup (Maybe (Val Text))
asasgLaunchConfigurationName = lens _autoScalingAutoScalingGroupLaunchConfigurationName (\s a -> s { _autoScalingAutoScalingGroupLaunchConfigurationName = a }) | 377 | asasgLaunchConfigurationName :: Lens' AutoScalingAutoScalingGroup (Maybe (Val Text))
asasgLaunchConfigurationName = lens _autoScalingAutoScalingGroupLaunchConfigurationName (\s a -> s { _autoScalingAutoScalingGroupLaunchConfigurationName = a }) | 244 | asasgLaunchConfigurationName = lens _autoScalingAutoScalingGroupLaunchConfigurationName (\s a -> s { _autoScalingAutoScalingGroupLaunchConfigurationName = a }) | 159 | true | true | 0 | 9 | 22 | 52 | 28 | 24 | null | null |
Copilot-Language/sbv-for-copilot | Data/SBV/BitVectors/Model.hs | bsd-3-clause | fullMultiplier :: SIntegral a => SBV a -> SBV a -> (SBV a, SBV a)
fullMultiplier a b
| isSigned a = error "fullMultiplier: only works on unsigned numbers"
| True = (go (ghcBitSize a) 0 a, a*b)
where go 0 p _ = p
go n p x = let (c, p') = ite (lsb x) (fullAdder p b) (false, p)
(o, p'') = shiftIn c p'
(_, x') = shiftIn o x
in go (n-1) p'' x'
shiftIn k v = (lsb v, mask .|. (v `shiftR` 1))
where mask = ite k (bit (ghcBitSize v - 1)) 0
-- | Little-endian blasting of a word into its bits. Also see the 'FromBits' class. | 624 | fullMultiplier :: SIntegral a => SBV a -> SBV a -> (SBV a, SBV a)
fullMultiplier a b
| isSigned a = error "fullMultiplier: only works on unsigned numbers"
| True = (go (ghcBitSize a) 0 a, a*b)
where go 0 p _ = p
go n p x = let (c, p') = ite (lsb x) (fullAdder p b) (false, p)
(o, p'') = shiftIn c p'
(_, x') = shiftIn o x
in go (n-1) p'' x'
shiftIn k v = (lsb v, mask .|. (v `shiftR` 1))
where mask = ite k (bit (ghcBitSize v - 1)) 0
-- | Little-endian blasting of a word into its bits. Also see the 'FromBits' class. | 624 | fullMultiplier a b
| isSigned a = error "fullMultiplier: only works on unsigned numbers"
| True = (go (ghcBitSize a) 0 a, a*b)
where go 0 p _ = p
go n p x = let (c, p') = ite (lsb x) (fullAdder p b) (false, p)
(o, p'') = shiftIn c p'
(_, x') = shiftIn o x
in go (n-1) p'' x'
shiftIn k v = (lsb v, mask .|. (v `shiftR` 1))
where mask = ite k (bit (ghcBitSize v - 1)) 0
-- | Little-endian blasting of a word into its bits. Also see the 'FromBits' class. | 558 | false | true | 3 | 12 | 222 | 275 | 138 | 137 | null | null |
coreyoconnor/yi | src/library/Yi/UI/Vty.hs | gpl-2.0 | drawText :: Vty.Attr -- ^ "Ground" attribute.
-> Int -- ^ The height of the part of the window we are in
-> Int -- ^ The width of the part of the window we are in
-> Int -- ^ The number of spaces to represent a tab character with.
-> [(Char, Vty.Attr)] -- ^ The data to draw.
-> [Vty.Image]
drawText wsty h w tabWidth bufData
| h == 0 || w == 0 = []
| otherwise = renderedLines
where
-- the number of lines that taking wrapping into account,
-- we use this to calculate the number of lines displayed.
wrapped = concatMap (wrapLine w . addSpace . concatMap expandGraphic) $ take h $ lines' bufData
lns0 = take h wrapped
-- fill lines with blanks, so the selection looks ok.
renderedLines = map fillColorLine lns0
colorChar (c, a) = Vty.char a c
fillColorLine :: [(Char, Vty.Attr)] -> Vty.Image
fillColorLine [] = Vty.charFill Vty.defAttr ' ' w 1
fillColorLine l = Vty.horizCat (map colorChar l)
Vty.<|>
Vty.charFill a ' ' (w - length l) 1
where (_, a) = last l
addSpace :: [(Char, Vty.Attr)] -> [(Char, Vty.Attr)]
addSpace [] = [(' ', wsty)]
addSpace l = case mod lineLength w of
0 -> l
_ -> l ++ [(' ', wsty)]
where
lineLength = length l
-- | Cut a string in lines separated by a '\n' char. Note
-- that we remove the newline entirely since it is no longer
-- significant for drawing text.
lines' :: [(Char, a)] -> [[(Char, a)]]
lines' [] = []
lines' s = case s' of
[] -> [l]
((_,_):s'') -> l : lines' s''
where
(l, s') = break ((== '\n') . fst) s
wrapLine :: Int -> [x] -> [[x]]
wrapLine _ [] = []
wrapLine n l = let (x,rest) = splitAt n l in x : wrapLine n rest
expandGraphic ('\t', p) = replicate tabWidth (' ', p)
expandGraphic (c, p)
| numeric < 32 = [('^', p), (chr (numeric + 64), p)]
| otherwise = [(c, p)]
where numeric = ord c | 2,161 | drawText :: Vty.Attr -- ^ "Ground" attribute.
-> Int -- ^ The height of the part of the window we are in
-> Int -- ^ The width of the part of the window we are in
-> Int -- ^ The number of spaces to represent a tab character with.
-> [(Char, Vty.Attr)] -- ^ The data to draw.
-> [Vty.Image]
drawText wsty h w tabWidth bufData
| h == 0 || w == 0 = []
| otherwise = renderedLines
where
-- the number of lines that taking wrapping into account,
-- we use this to calculate the number of lines displayed.
wrapped = concatMap (wrapLine w . addSpace . concatMap expandGraphic) $ take h $ lines' bufData
lns0 = take h wrapped
-- fill lines with blanks, so the selection looks ok.
renderedLines = map fillColorLine lns0
colorChar (c, a) = Vty.char a c
fillColorLine :: [(Char, Vty.Attr)] -> Vty.Image
fillColorLine [] = Vty.charFill Vty.defAttr ' ' w 1
fillColorLine l = Vty.horizCat (map colorChar l)
Vty.<|>
Vty.charFill a ' ' (w - length l) 1
where (_, a) = last l
addSpace :: [(Char, Vty.Attr)] -> [(Char, Vty.Attr)]
addSpace [] = [(' ', wsty)]
addSpace l = case mod lineLength w of
0 -> l
_ -> l ++ [(' ', wsty)]
where
lineLength = length l
-- | Cut a string in lines separated by a '\n' char. Note
-- that we remove the newline entirely since it is no longer
-- significant for drawing text.
lines' :: [(Char, a)] -> [[(Char, a)]]
lines' [] = []
lines' s = case s' of
[] -> [l]
((_,_):s'') -> l : lines' s''
where
(l, s') = break ((== '\n') . fst) s
wrapLine :: Int -> [x] -> [[x]]
wrapLine _ [] = []
wrapLine n l = let (x,rest) = splitAt n l in x : wrapLine n rest
expandGraphic ('\t', p) = replicate tabWidth (' ', p)
expandGraphic (c, p)
| numeric < 32 = [('^', p), (chr (numeric + 64), p)]
| otherwise = [(c, p)]
where numeric = ord c | 2,161 | drawText wsty h w tabWidth bufData
| h == 0 || w == 0 = []
| otherwise = renderedLines
where
-- the number of lines that taking wrapping into account,
-- we use this to calculate the number of lines displayed.
wrapped = concatMap (wrapLine w . addSpace . concatMap expandGraphic) $ take h $ lines' bufData
lns0 = take h wrapped
-- fill lines with blanks, so the selection looks ok.
renderedLines = map fillColorLine lns0
colorChar (c, a) = Vty.char a c
fillColorLine :: [(Char, Vty.Attr)] -> Vty.Image
fillColorLine [] = Vty.charFill Vty.defAttr ' ' w 1
fillColorLine l = Vty.horizCat (map colorChar l)
Vty.<|>
Vty.charFill a ' ' (w - length l) 1
where (_, a) = last l
addSpace :: [(Char, Vty.Attr)] -> [(Char, Vty.Attr)]
addSpace [] = [(' ', wsty)]
addSpace l = case mod lineLength w of
0 -> l
_ -> l ++ [(' ', wsty)]
where
lineLength = length l
-- | Cut a string in lines separated by a '\n' char. Note
-- that we remove the newline entirely since it is no longer
-- significant for drawing text.
lines' :: [(Char, a)] -> [[(Char, a)]]
lines' [] = []
lines' s = case s' of
[] -> [l]
((_,_):s'') -> l : lines' s''
where
(l, s') = break ((== '\n') . fst) s
wrapLine :: Int -> [x] -> [[x]]
wrapLine _ [] = []
wrapLine n l = let (x,rest) = splitAt n l in x : wrapLine n rest
expandGraphic ('\t', p) = replicate tabWidth (' ', p)
expandGraphic (c, p)
| numeric < 32 = [('^', p), (chr (numeric + 64), p)]
| otherwise = [(c, p)]
where numeric = ord c | 1,815 | false | true | 1 | 12 | 773 | 697 | 375 | 322 | null | null |
venkat24/codeworld | funblocks-client/src/Blocks/CodeGen.hs | apache-2.0 | errc :: T.Text -> Block -> SaveErr Expr
errc msg block = SE Comment $ Just $ Error msg block | 92 | errc :: T.Text -> Block -> SaveErr Expr
errc msg block = SE Comment $ Just $ Error msg block | 92 | errc msg block = SE Comment $ Just $ Error msg block | 52 | false | true | 0 | 7 | 19 | 45 | 21 | 24 | null | null |
acowley/ghc | libraries/base/GHC/IO/Exception.hs | bsd-3-clause | heapOverflow = toException HeapOverflow | 40 | heapOverflow = toException HeapOverflow | 40 | heapOverflow = toException HeapOverflow | 40 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
CloudI/CloudI | src/api/haskell/external/binary-0.8.7.0/benchmarks/Benchmark.hs | mit | main :: IO ()
main = do
args <- getArgs
mb <- case args of
(arg:_) -> readIO arg
_ -> return 100
memBench (mb*10)
putStrLn ""
putStrLn "Binary (de)serialisation benchmarks:"
-- do bytewise
sequence_
[ test wordSize chunkSize Host mb
| wordSize <- [1]
, chunkSize <- [16] --1,2,4,8,16]
]
-- now Word16 .. Word64
sequence_
[ test wordSize chunkSize end mb
| wordSize <- [2,4,8]
, chunkSize <- [16]
, end <- [Host] -- ,Big,Little]
]
------------------------------------------------------------------------ | 589 | main :: IO ()
main = do
args <- getArgs
mb <- case args of
(arg:_) -> readIO arg
_ -> return 100
memBench (mb*10)
putStrLn ""
putStrLn "Binary (de)serialisation benchmarks:"
-- do bytewise
sequence_
[ test wordSize chunkSize Host mb
| wordSize <- [1]
, chunkSize <- [16] --1,2,4,8,16]
]
-- now Word16 .. Word64
sequence_
[ test wordSize chunkSize end mb
| wordSize <- [2,4,8]
, chunkSize <- [16]
, end <- [Host] -- ,Big,Little]
]
------------------------------------------------------------------------ | 589 | main = do
args <- getArgs
mb <- case args of
(arg:_) -> readIO arg
_ -> return 100
memBench (mb*10)
putStrLn ""
putStrLn "Binary (de)serialisation benchmarks:"
-- do bytewise
sequence_
[ test wordSize chunkSize Host mb
| wordSize <- [1]
, chunkSize <- [16] --1,2,4,8,16]
]
-- now Word16 .. Word64
sequence_
[ test wordSize chunkSize end mb
| wordSize <- [2,4,8]
, chunkSize <- [16]
, end <- [Host] -- ,Big,Little]
]
------------------------------------------------------------------------ | 575 | false | true | 0 | 13 | 165 | 192 | 94 | 98 | null | null |
SneakingCat/fay-ticker | src/CanvasAPI.hs | gpl-3.0 | -- | Set the text baseline attribute
setTextBaseline :: Context -> String -> Fay ()
setTextBaseline = ffi "%1['textBaseline']=%2" | 129 | setTextBaseline :: Context -> String -> Fay ()
setTextBaseline = ffi "%1['textBaseline']=%2" | 92 | setTextBaseline = ffi "%1['textBaseline']=%2" | 45 | true | true | 0 | 8 | 18 | 28 | 14 | 14 | null | null |
PierreR/streaming | Streaming/Prelude.hs | bsd-3-clause | strictly :: (a,b) -> Of a b
strictly = \(a,b) -> a :> b | 55 | strictly :: (a,b) -> Of a b
strictly = \(a,b) -> a :> b | 55 | strictly = \(a,b) -> a :> b | 27 | false | true | 0 | 6 | 13 | 41 | 23 | 18 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.