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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
olsner/ghc | compiler/coreSyn/MkCore.hs | bsd-3-clause | -- | Build a small tuple holding the specified expressions
-- One-tuples are flattened; see Note [Flattening one-tuples]
mkCoreTup :: [CoreExpr] -> CoreExpr
mkCoreTup [] = Var unitDataConId | 190 | mkCoreTup :: [CoreExpr] -> CoreExpr
mkCoreTup [] = Var unitDataConId | 69 | mkCoreTup [] = Var unitDataConId | 33 | true | true | 0 | 6 | 28 | 28 | 15 | 13 | null | null |
akfidjeland/NeMo | src/api/autogen/Matlab.hs | gpl-2.0 | mexType ApiULong = "uint64_t" | 29 | mexType ApiULong = "uint64_t" | 29 | mexType ApiULong = "uint64_t" | 29 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
bitemyapp/serials | server/Serials/Route/App.hs | mit | checkErrorText :: ServantErr -> App (Either Text a) -> App a
checkErrorText err action = do
res <- action
case res of
Left e -> throwError $ err { errBody = TLE.encodeUtf8 $ TL.fromStrict e }
Right v -> return v
-- what if it could return an invalid error OR an application error?
-- well, it already handles fail, just have it throw if needed
-- it might be nice to map other types, like .... using ExceptT for invalid stuff
----------------------------------------------------------------
--type TestAPI =
--"a" :> Get String
-- :<|> "b" :> Get String
-- :<|> "c" :> Get String
--testServer' :: AppConfig -> Server TestAPI
--testServer' config = enter (Nat $ (runAppT config)) testServerT
---- wow, it's IN My monad here! that's swell
--testServerT ::ServerT TestAPI App
--testServerT = getA :<|> getB :<|> getC
--where
--getA :: App String
--getA = giveMeAMessage
---- you can also lift IO functions
----getA = liftIO $ woot
---- I can map app functions that return Maybes and Eithers to
---- app exceptions using little functions like this
--getB :: App String
--getB = isNotFound $ testWoot
--getC :: App String
--getC = isError $ testErr
--giveMeAMessage :: App String
--giveMeAMessage = do
--one <- asks appName
--two <- return "asdf"
----throwError $ Invalid "Goooo"
--return $ show one <> two
--testWoot :: App (Maybe String)
--testWoot = return $ Nothing
--testErr :: App (Either String String)
--testErr = return $ Left "Oh no!"
----getProgName' :: MonadIO m => m String
----getProgName' = liftIO $ getProgName
--woot :: IO String
--woot = return "hello"
-- ToStatus ------------------------------------------------------
--class ToStatus a where
--toStatus :: a val -> Either ServantErr val
--instance ToStatus Maybe where
--toStatus Nothing = Left $ err404
--toStatus (Just v) = Right v
--instance Show a => ToStatus (Either a) where
--toStatus (Left e) = Left $ err500 { errBody = "Server Error: " <> BL.pack (show e) }
--toStatus (Right v) = Right v
--liftE :: ToStatus a => IO (a v) -> EitherT ServantErr IO v
--liftE action = EitherT $ toStatus <$> action
--errUnauthorized :: Text -> ServantErr
--errUnauthorized err = err401 { errReasonPhrase = unpack err }
--errText :: ServantErr -> Text -> ServantErr
--errText err txt = err { errBody = TLE.encodeUtf8 $ TL.fromStrict txt }
--liftErr :: (err -> ServantErr) -> IO (Either err res) -> EitherT ServantErr IO res
--liftErr toErr action = do
--eres <- liftIO action
--case eres of
--Left err -> left (toErr err)
--Right res -> return res
--liftErrText :: ServantErr -> IO (Either Text res) -> EitherT ServantErr IO res
--liftErrText err = liftErr (errText err)
--liftDb :: Pool RethinkDBHandle -> RethinkIO a -> Handler a
--liftDb h a = liftIO $ runReaderT a h | 2,878 | checkErrorText :: ServantErr -> App (Either Text a) -> App a
checkErrorText err action = do
res <- action
case res of
Left e -> throwError $ err { errBody = TLE.encodeUtf8 $ TL.fromStrict e }
Right v -> return v
-- what if it could return an invalid error OR an application error?
-- well, it already handles fail, just have it throw if needed
-- it might be nice to map other types, like .... using ExceptT for invalid stuff
----------------------------------------------------------------
--type TestAPI =
--"a" :> Get String
-- :<|> "b" :> Get String
-- :<|> "c" :> Get String
--testServer' :: AppConfig -> Server TestAPI
--testServer' config = enter (Nat $ (runAppT config)) testServerT
---- wow, it's IN My monad here! that's swell
--testServerT ::ServerT TestAPI App
--testServerT = getA :<|> getB :<|> getC
--where
--getA :: App String
--getA = giveMeAMessage
---- you can also lift IO functions
----getA = liftIO $ woot
---- I can map app functions that return Maybes and Eithers to
---- app exceptions using little functions like this
--getB :: App String
--getB = isNotFound $ testWoot
--getC :: App String
--getC = isError $ testErr
--giveMeAMessage :: App String
--giveMeAMessage = do
--one <- asks appName
--two <- return "asdf"
----throwError $ Invalid "Goooo"
--return $ show one <> two
--testWoot :: App (Maybe String)
--testWoot = return $ Nothing
--testErr :: App (Either String String)
--testErr = return $ Left "Oh no!"
----getProgName' :: MonadIO m => m String
----getProgName' = liftIO $ getProgName
--woot :: IO String
--woot = return "hello"
-- ToStatus ------------------------------------------------------
--class ToStatus a where
--toStatus :: a val -> Either ServantErr val
--instance ToStatus Maybe where
--toStatus Nothing = Left $ err404
--toStatus (Just v) = Right v
--instance Show a => ToStatus (Either a) where
--toStatus (Left e) = Left $ err500 { errBody = "Server Error: " <> BL.pack (show e) }
--toStatus (Right v) = Right v
--liftE :: ToStatus a => IO (a v) -> EitherT ServantErr IO v
--liftE action = EitherT $ toStatus <$> action
--errUnauthorized :: Text -> ServantErr
--errUnauthorized err = err401 { errReasonPhrase = unpack err }
--errText :: ServantErr -> Text -> ServantErr
--errText err txt = err { errBody = TLE.encodeUtf8 $ TL.fromStrict txt }
--liftErr :: (err -> ServantErr) -> IO (Either err res) -> EitherT ServantErr IO res
--liftErr toErr action = do
--eres <- liftIO action
--case eres of
--Left err -> left (toErr err)
--Right res -> return res
--liftErrText :: ServantErr -> IO (Either Text res) -> EitherT ServantErr IO res
--liftErrText err = liftErr (errText err)
--liftDb :: Pool RethinkDBHandle -> RethinkIO a -> Handler a
--liftDb h a = liftIO $ runReaderT a h | 2,878 | checkErrorText err action = do
res <- action
case res of
Left e -> throwError $ err { errBody = TLE.encodeUtf8 $ TL.fromStrict e }
Right v -> return v
-- what if it could return an invalid error OR an application error?
-- well, it already handles fail, just have it throw if needed
-- it might be nice to map other types, like .... using ExceptT for invalid stuff
----------------------------------------------------------------
--type TestAPI =
--"a" :> Get String
-- :<|> "b" :> Get String
-- :<|> "c" :> Get String
--testServer' :: AppConfig -> Server TestAPI
--testServer' config = enter (Nat $ (runAppT config)) testServerT
---- wow, it's IN My monad here! that's swell
--testServerT ::ServerT TestAPI App
--testServerT = getA :<|> getB :<|> getC
--where
--getA :: App String
--getA = giveMeAMessage
---- you can also lift IO functions
----getA = liftIO $ woot
---- I can map app functions that return Maybes and Eithers to
---- app exceptions using little functions like this
--getB :: App String
--getB = isNotFound $ testWoot
--getC :: App String
--getC = isError $ testErr
--giveMeAMessage :: App String
--giveMeAMessage = do
--one <- asks appName
--two <- return "asdf"
----throwError $ Invalid "Goooo"
--return $ show one <> two
--testWoot :: App (Maybe String)
--testWoot = return $ Nothing
--testErr :: App (Either String String)
--testErr = return $ Left "Oh no!"
----getProgName' :: MonadIO m => m String
----getProgName' = liftIO $ getProgName
--woot :: IO String
--woot = return "hello"
-- ToStatus ------------------------------------------------------
--class ToStatus a where
--toStatus :: a val -> Either ServantErr val
--instance ToStatus Maybe where
--toStatus Nothing = Left $ err404
--toStatus (Just v) = Right v
--instance Show a => ToStatus (Either a) where
--toStatus (Left e) = Left $ err500 { errBody = "Server Error: " <> BL.pack (show e) }
--toStatus (Right v) = Right v
--liftE :: ToStatus a => IO (a v) -> EitherT ServantErr IO v
--liftE action = EitherT $ toStatus <$> action
--errUnauthorized :: Text -> ServantErr
--errUnauthorized err = err401 { errReasonPhrase = unpack err }
--errText :: ServantErr -> Text -> ServantErr
--errText err txt = err { errBody = TLE.encodeUtf8 $ TL.fromStrict txt }
--liftErr :: (err -> ServantErr) -> IO (Either err res) -> EitherT ServantErr IO res
--liftErr toErr action = do
--eres <- liftIO action
--case eres of
--Left err -> left (toErr err)
--Right res -> return res
--liftErrText :: ServantErr -> IO (Either Text res) -> EitherT ServantErr IO res
--liftErrText err = liftErr (errText err)
--liftDb :: Pool RethinkDBHandle -> RethinkIO a -> Handler a
--liftDb h a = liftIO $ runReaderT a h | 2,817 | false | true | 0 | 15 | 608 | 159 | 108 | 51 | null | null |
pushkinma/frag | app/Main.hs | gpl-2.0 | mouseMotion :: IORef OGLInput -> MotionCallback
mouseMotion newInput newCursorPos = do
lst <- readIORef newInput
case lst of
(Just inp) -> writeIORef newInput (Just inp)
_ -> writeIORef newInput (Just MouseMove {pos=newCursorPos}) | 263 | mouseMotion :: IORef OGLInput -> MotionCallback
mouseMotion newInput newCursorPos = do
lst <- readIORef newInput
case lst of
(Just inp) -> writeIORef newInput (Just inp)
_ -> writeIORef newInput (Just MouseMove {pos=newCursorPos}) | 263 | mouseMotion newInput newCursorPos = do
lst <- readIORef newInput
case lst of
(Just inp) -> writeIORef newInput (Just inp)
_ -> writeIORef newInput (Just MouseMove {pos=newCursorPos}) | 215 | false | true | 0 | 15 | 64 | 93 | 43 | 50 | null | null |
faylang/fay-jquery | src/JQuery.hs | bsd-3-clause | getOuterWidth :: JQuery -> Fay Double
getOuterWidth = ffi "%1['outerWidth']()" | 78 | getOuterWidth :: JQuery -> Fay Double
getOuterWidth = ffi "%1['outerWidth']()" | 78 | getOuterWidth = ffi "%1['outerWidth']()" | 40 | false | true | 0 | 7 | 9 | 27 | 11 | 16 | null | null |
krattai/noo-ebs | docs/zeroMQ-guide2/examples/Haskell/rtmama.hs | bsd-2-clause | -- In general, although locks are an antipattern in ZeroMQ, we need a lock
-- for the stdout handle, otherwise we will get jumbled text. We don't
-- use the lock for anything zeroMQ related, just output to screen.
workerThread :: Context -> MVar () -> IO ()
workerThread ctx lock = withSocket ctx Req $ \worker -> do
setId worker
connect worker "ipc://routing.ipc"
let work_func val = do
send worker (pack "ready") []
workload <- receive worker []
if unpack workload == "END"
then withMVar lock $ \_ -> putStrLn $ "Processed: " ++ show val ++ " tasks"
else work_func (val+1)
work_func 0 | 652 | workerThread :: Context -> MVar () -> IO ()
workerThread ctx lock = withSocket ctx Req $ \worker -> do
setId worker
connect worker "ipc://routing.ipc"
let work_func val = do
send worker (pack "ready") []
workload <- receive worker []
if unpack workload == "END"
then withMVar lock $ \_ -> putStrLn $ "Processed: " ++ show val ++ " tasks"
else work_func (val+1)
work_func 0 | 436 | workerThread ctx lock = withSocket ctx Req $ \worker -> do
setId worker
connect worker "ipc://routing.ipc"
let work_func val = do
send worker (pack "ready") []
workload <- receive worker []
if unpack workload == "END"
then withMVar lock $ \_ -> putStrLn $ "Processed: " ++ show val ++ " tasks"
else work_func (val+1)
work_func 0 | 392 | true | true | 0 | 19 | 170 | 170 | 79 | 91 | null | null |
unisonweb/platform | parser-typechecker/src/Unison/Util/Pretty.hs | mit | column2Header
:: Pretty ColorText -> Pretty ColorText -> [(Pretty ColorText, Pretty ColorText)] -> Pretty ColorText
column2Header left right = column2sep " " . ((fmap CT.hiBlack left, fmap CT.hiBlack right):) | 211 | column2Header
:: Pretty ColorText -> Pretty ColorText -> [(Pretty ColorText, Pretty ColorText)] -> Pretty ColorText
column2Header left right = column2sep " " . ((fmap CT.hiBlack left, fmap CT.hiBlack right):) | 211 | column2Header left right = column2sep " " . ((fmap CT.hiBlack left, fmap CT.hiBlack right):) | 93 | false | true | 0 | 10 | 31 | 87 | 42 | 45 | null | null |
mettekou/ghc | compiler/types/TyCoRep.hs | bsd-3-clause | extendCvSubst :: TCvSubst -> CoVar -> Coercion -> TCvSubst
extendCvSubst (TCvSubst in_scope tenv cenv) v co
= TCvSubst in_scope tenv (extendVarEnv cenv v co) | 159 | extendCvSubst :: TCvSubst -> CoVar -> Coercion -> TCvSubst
extendCvSubst (TCvSubst in_scope tenv cenv) v co
= TCvSubst in_scope tenv (extendVarEnv cenv v co) | 159 | extendCvSubst (TCvSubst in_scope tenv cenv) v co
= TCvSubst in_scope tenv (extendVarEnv cenv v co) | 100 | false | true | 0 | 7 | 25 | 57 | 28 | 29 | null | null |
McCraeAndrew/cpi-ide | CPi/Signals.hs | gpl-3.0 | sig env p solver tr (Rels i f1 f2)
= sig env p solver tr (Neg (Until i (Neg f1) (Neg f2))) | 95 | sig env p solver tr (Rels i f1 f2)
= sig env p solver tr (Neg (Until i (Neg f1) (Neg f2))) | 95 | sig env p solver tr (Rels i f1 f2)
= sig env p solver tr (Neg (Until i (Neg f1) (Neg f2))) | 95 | false | false | 0 | 11 | 26 | 66 | 32 | 34 | null | null |
alexander-at-github/eta | compiler/ETA/Prelude/PrelNames.hs | bsd-3-clause | unpackCStringFoldrName = varQual gHC_CSTRING (fsLit "unpackFoldrCString#") unpackCStringFoldrIdKey | 99 | unpackCStringFoldrName = varQual gHC_CSTRING (fsLit "unpackFoldrCString#") unpackCStringFoldrIdKey | 99 | unpackCStringFoldrName = varQual gHC_CSTRING (fsLit "unpackFoldrCString#") unpackCStringFoldrIdKey | 99 | false | false | 1 | 7 | 7 | 22 | 9 | 13 | null | null |
osa1/Idris-dev | src/Idris/ElabDecls.hs | bsd-3-clause | elabDecl' what info (PParams f ns ps)
= do i <- getIState
logLvl 1 $ "Expanding params block with " ++ show ns ++ " decls " ++
show (concatMap tldeclared ps)
let nblock = pblock i
mapM_ (elabDecl' what info) nblock
where
pinfo = let ds = concatMap tldeclared ps
newps = params info ++ ns
dsParams = map (\n -> (n, map fst newps)) ds
newb = addAlist dsParams (inblock info) in
info { params = newps,
inblock = newb }
pblock i = map (expandParamsD False i id ns
(concatMap tldeclared ps)) ps | 655 | elabDecl' what info (PParams f ns ps)
= do i <- getIState
logLvl 1 $ "Expanding params block with " ++ show ns ++ " decls " ++
show (concatMap tldeclared ps)
let nblock = pblock i
mapM_ (elabDecl' what info) nblock
where
pinfo = let ds = concatMap tldeclared ps
newps = params info ++ ns
dsParams = map (\n -> (n, map fst newps)) ds
newb = addAlist dsParams (inblock info) in
info { params = newps,
inblock = newb }
pblock i = map (expandParamsD False i id ns
(concatMap tldeclared ps)) ps | 655 | elabDecl' what info (PParams f ns ps)
= do i <- getIState
logLvl 1 $ "Expanding params block with " ++ show ns ++ " decls " ++
show (concatMap tldeclared ps)
let nblock = pblock i
mapM_ (elabDecl' what info) nblock
where
pinfo = let ds = concatMap tldeclared ps
newps = params info ++ ns
dsParams = map (\n -> (n, map fst newps)) ds
newb = addAlist dsParams (inblock info) in
info { params = newps,
inblock = newb }
pblock i = map (expandParamsD False i id ns
(concatMap tldeclared ps)) ps | 655 | false | false | 2 | 13 | 261 | 237 | 110 | 127 | null | null |
frontrowed/wai | wai-extra/test/WaiExtraSpec.hs | mit | caseStreamLBS :: Assertion
caseStreamLBS = flip runSession streamLBSApp $ do
sres <- request defaultRequest
assertStatus 200 sres
assertBody "test" sres | 164 | caseStreamLBS :: Assertion
caseStreamLBS = flip runSession streamLBSApp $ do
sres <- request defaultRequest
assertStatus 200 sres
assertBody "test" sres | 164 | caseStreamLBS = flip runSession streamLBSApp $ do
sres <- request defaultRequest
assertStatus 200 sres
assertBody "test" sres | 137 | false | true | 0 | 9 | 31 | 46 | 20 | 26 | null | null |
mdsteele/fallback | src/Fallback/Data/QuadTree.hs | gpl-3.0 | nodeMember :: Int -> Int -> Int -> Node -> Bool
nodeMember _ _ _ Empty = False | 78 | nodeMember :: Int -> Int -> Int -> Node -> Bool
nodeMember _ _ _ Empty = False | 78 | nodeMember _ _ _ Empty = False | 30 | false | true | 0 | 8 | 17 | 36 | 18 | 18 | null | null |
FranklinChen/Hugs | demos/Tree.hs | bsd-3-clause | mapTree f (Lf x) = Lf (f x) | 28 | mapTree f (Lf x) = Lf (f x) | 28 | mapTree f (Lf x) = Lf (f x) | 28 | false | false | 0 | 7 | 8 | 26 | 12 | 14 | null | null |
sdiehl/ghc | compiler/GHC/Hs/Binds.hs | bsd-3-clause | hasSpecPrags :: TcSpecPrags -> Bool
hasSpecPrags (SpecPrags ps) = not (null ps) | 79 | hasSpecPrags :: TcSpecPrags -> Bool
hasSpecPrags (SpecPrags ps) = not (null ps) | 79 | hasSpecPrags (SpecPrags ps) = not (null ps) | 43 | false | true | 0 | 7 | 11 | 33 | 16 | 17 | null | null |
hguenther/gtl | lib/Language/GTL/Model.hs | bsd-3-clause | gtlParseSpec :: Options -> [Declaration] -> ErrorIO (GTLSpec String)
gtlParseSpec opts decls = do
let aliases = foldl (\mp decl -> case decl of
TypeAlias name tp -> Map.insert name tp mp
_ -> mp) Map.empty decls
init_mdls <- sequence [ do
let (args, constDecls) = splitArgs (modelArgs mdl)
mback <- liftIO $ initAllBackend (modelType mdl) opts args
case mback of
Nothing -> throwError $ "Couldn't initialize backend "++(modelType mdl)
Just back -> return (mdl,back,constDecls)
| Model mdl <- decls
]
let all_aliases = Map.unions [ allAliases back | (_,back,_) <- init_mdls ]
mdls <- sequence [ gtlParseModel back cd all_aliases aliases m | (m,back,cd) <- init_mdls ]
let mdl_mp = Map.fromList [ (name,mdl) | (name,mdl,_) <- mdls ]
enums = Set.unions [ enum | (_,_,enum) <- mdls ]
insts <- sequence
[ do
mdl <- case Map.lookup (instanceModel i) mdl_mp of
Nothing -> throwError $ "Model "++(instanceModel i)++" not found."
Just m -> return m
contr <- mapM (gtlParseContract (gtlModelInput mdl) (gtlModelOutput mdl) (Map.union (gtlModelInput mdl) (gtlModelOutput mdl)) enums) (instanceContract i)
return (instanceName i,GTLInstance { gtlInstanceModel = instanceModel i
, gtlInstanceContract = contr
, gtlInstanceDefaults = Map.empty
})
| Instance i <- decls ]
let inst_mp = Map.fromList insts
alltp = Map.fromList [ ((q,n),tp)
| (q,inst) <- insts
, let mdl = mdl_mp!(gtlInstanceModel inst)
, (n,tp) <- Map.toList $ Map.union (gtlModelInput mdl) (gtlModelOutput mdl)
]
vexpr <- makeTypedExpr (\q n inf -> case q of
Nothing -> throwError "No unqualified variables allowed in verify clause"
Just rq -> return ((rq,n),Input)
) alltp enums (case concat [ v | Verify (VerifyDecl v) <- decls ] of
[] -> (startPosn,GConstBool True)
x -> foldl1 (\l@(p,_) r -> (p,GBin GOpAnd NoTime l r)) x)
conns <- sequence [ do
finst <- case Map.lookup f inst_mp of
Nothing -> throwError $ "Instance "++f++" not found."
Just x -> return x
let fmdl = mdl_mp!(gtlInstanceModel finst)
tinst <- case Map.lookup t inst_mp of
Nothing -> throwError $ "Instance "++t++" not found."
Just x -> return x
let tmdl = mdl_mp!(gtlInstanceModel tinst)
fvar <- case Map.lookup fv (gtlModelOutput fmdl) of
Nothing -> throwError $ "Variable "++f++"."++fv++" not found or not an output variable."
Just x -> return x
tvar <- case Map.lookup tv (gtlModelInput tmdl) of
Nothing -> throwError $ "Variable "++t++"."++tv++" not found or not an input variable."
Just x -> return x
ftp <- resolveIndices fvar fi
ttp <- resolveIndices tvar ti
if ftp `isSubtypeOf` ttp then return (GTLConnPt f fv fi,GTLConnPt t tv ti)
else throwError $ "Type mismatch between "++f++"."++fv++show fi++"("++show ftp++") and "++t++"."++tv++show ti++"("++show ttp++")."
| Connect (ConnectDecl f fv fi t tv ti) <- decls ]
return $ GTLSpec { gtlSpecModels = mdl_mp
, gtlSpecInstances = inst_mp
, gtlSpecVerify = vexpr
, gtlSpecConnections = conns
} | 4,250 | gtlParseSpec :: Options -> [Declaration] -> ErrorIO (GTLSpec String)
gtlParseSpec opts decls = do
let aliases = foldl (\mp decl -> case decl of
TypeAlias name tp -> Map.insert name tp mp
_ -> mp) Map.empty decls
init_mdls <- sequence [ do
let (args, constDecls) = splitArgs (modelArgs mdl)
mback <- liftIO $ initAllBackend (modelType mdl) opts args
case mback of
Nothing -> throwError $ "Couldn't initialize backend "++(modelType mdl)
Just back -> return (mdl,back,constDecls)
| Model mdl <- decls
]
let all_aliases = Map.unions [ allAliases back | (_,back,_) <- init_mdls ]
mdls <- sequence [ gtlParseModel back cd all_aliases aliases m | (m,back,cd) <- init_mdls ]
let mdl_mp = Map.fromList [ (name,mdl) | (name,mdl,_) <- mdls ]
enums = Set.unions [ enum | (_,_,enum) <- mdls ]
insts <- sequence
[ do
mdl <- case Map.lookup (instanceModel i) mdl_mp of
Nothing -> throwError $ "Model "++(instanceModel i)++" not found."
Just m -> return m
contr <- mapM (gtlParseContract (gtlModelInput mdl) (gtlModelOutput mdl) (Map.union (gtlModelInput mdl) (gtlModelOutput mdl)) enums) (instanceContract i)
return (instanceName i,GTLInstance { gtlInstanceModel = instanceModel i
, gtlInstanceContract = contr
, gtlInstanceDefaults = Map.empty
})
| Instance i <- decls ]
let inst_mp = Map.fromList insts
alltp = Map.fromList [ ((q,n),tp)
| (q,inst) <- insts
, let mdl = mdl_mp!(gtlInstanceModel inst)
, (n,tp) <- Map.toList $ Map.union (gtlModelInput mdl) (gtlModelOutput mdl)
]
vexpr <- makeTypedExpr (\q n inf -> case q of
Nothing -> throwError "No unqualified variables allowed in verify clause"
Just rq -> return ((rq,n),Input)
) alltp enums (case concat [ v | Verify (VerifyDecl v) <- decls ] of
[] -> (startPosn,GConstBool True)
x -> foldl1 (\l@(p,_) r -> (p,GBin GOpAnd NoTime l r)) x)
conns <- sequence [ do
finst <- case Map.lookup f inst_mp of
Nothing -> throwError $ "Instance "++f++" not found."
Just x -> return x
let fmdl = mdl_mp!(gtlInstanceModel finst)
tinst <- case Map.lookup t inst_mp of
Nothing -> throwError $ "Instance "++t++" not found."
Just x -> return x
let tmdl = mdl_mp!(gtlInstanceModel tinst)
fvar <- case Map.lookup fv (gtlModelOutput fmdl) of
Nothing -> throwError $ "Variable "++f++"."++fv++" not found or not an output variable."
Just x -> return x
tvar <- case Map.lookup tv (gtlModelInput tmdl) of
Nothing -> throwError $ "Variable "++t++"."++tv++" not found or not an input variable."
Just x -> return x
ftp <- resolveIndices fvar fi
ttp <- resolveIndices tvar ti
if ftp `isSubtypeOf` ttp then return (GTLConnPt f fv fi,GTLConnPt t tv ti)
else throwError $ "Type mismatch between "++f++"."++fv++show fi++"("++show ftp++") and "++t++"."++tv++show ti++"("++show ttp++")."
| Connect (ConnectDecl f fv fi t tv ti) <- decls ]
return $ GTLSpec { gtlSpecModels = mdl_mp
, gtlSpecInstances = inst_mp
, gtlSpecVerify = vexpr
, gtlSpecConnections = conns
} | 4,250 | gtlParseSpec opts decls = do
let aliases = foldl (\mp decl -> case decl of
TypeAlias name tp -> Map.insert name tp mp
_ -> mp) Map.empty decls
init_mdls <- sequence [ do
let (args, constDecls) = splitArgs (modelArgs mdl)
mback <- liftIO $ initAllBackend (modelType mdl) opts args
case mback of
Nothing -> throwError $ "Couldn't initialize backend "++(modelType mdl)
Just back -> return (mdl,back,constDecls)
| Model mdl <- decls
]
let all_aliases = Map.unions [ allAliases back | (_,back,_) <- init_mdls ]
mdls <- sequence [ gtlParseModel back cd all_aliases aliases m | (m,back,cd) <- init_mdls ]
let mdl_mp = Map.fromList [ (name,mdl) | (name,mdl,_) <- mdls ]
enums = Set.unions [ enum | (_,_,enum) <- mdls ]
insts <- sequence
[ do
mdl <- case Map.lookup (instanceModel i) mdl_mp of
Nothing -> throwError $ "Model "++(instanceModel i)++" not found."
Just m -> return m
contr <- mapM (gtlParseContract (gtlModelInput mdl) (gtlModelOutput mdl) (Map.union (gtlModelInput mdl) (gtlModelOutput mdl)) enums) (instanceContract i)
return (instanceName i,GTLInstance { gtlInstanceModel = instanceModel i
, gtlInstanceContract = contr
, gtlInstanceDefaults = Map.empty
})
| Instance i <- decls ]
let inst_mp = Map.fromList insts
alltp = Map.fromList [ ((q,n),tp)
| (q,inst) <- insts
, let mdl = mdl_mp!(gtlInstanceModel inst)
, (n,tp) <- Map.toList $ Map.union (gtlModelInput mdl) (gtlModelOutput mdl)
]
vexpr <- makeTypedExpr (\q n inf -> case q of
Nothing -> throwError "No unqualified variables allowed in verify clause"
Just rq -> return ((rq,n),Input)
) alltp enums (case concat [ v | Verify (VerifyDecl v) <- decls ] of
[] -> (startPosn,GConstBool True)
x -> foldl1 (\l@(p,_) r -> (p,GBin GOpAnd NoTime l r)) x)
conns <- sequence [ do
finst <- case Map.lookup f inst_mp of
Nothing -> throwError $ "Instance "++f++" not found."
Just x -> return x
let fmdl = mdl_mp!(gtlInstanceModel finst)
tinst <- case Map.lookup t inst_mp of
Nothing -> throwError $ "Instance "++t++" not found."
Just x -> return x
let tmdl = mdl_mp!(gtlInstanceModel tinst)
fvar <- case Map.lookup fv (gtlModelOutput fmdl) of
Nothing -> throwError $ "Variable "++f++"."++fv++" not found or not an output variable."
Just x -> return x
tvar <- case Map.lookup tv (gtlModelInput tmdl) of
Nothing -> throwError $ "Variable "++t++"."++tv++" not found or not an input variable."
Just x -> return x
ftp <- resolveIndices fvar fi
ttp <- resolveIndices tvar ti
if ftp `isSubtypeOf` ttp then return (GTLConnPt f fv fi,GTLConnPt t tv ti)
else throwError $ "Type mismatch between "++f++"."++fv++show fi++"("++show ftp++") and "++t++"."++tv++show ti++"("++show ttp++")."
| Connect (ConnectDecl f fv fi t tv ti) <- decls ]
return $ GTLSpec { gtlSpecModels = mdl_mp
, gtlSpecInstances = inst_mp
, gtlSpecVerify = vexpr
, gtlSpecConnections = conns
} | 4,181 | false | true | 0 | 27 | 1,836 | 1,287 | 640 | 647 | null | null |
randen/cabal | Cabal/Distribution/Version.hs | bsd-3-clause | nonEmpty (LowerBound l lb, UpperBound u ub) =
(l < u) || (l == u && lb == InclusiveBound && ub == InclusiveBound) | 115 | nonEmpty (LowerBound l lb, UpperBound u ub) =
(l < u) || (l == u && lb == InclusiveBound && ub == InclusiveBound) | 115 | nonEmpty (LowerBound l lb, UpperBound u ub) =
(l < u) || (l == u && lb == InclusiveBound && ub == InclusiveBound) | 115 | false | false | 1 | 9 | 24 | 62 | 31 | 31 | null | null |
23Skidoo/text | Data/Text/Lazy.hs | bsd-2-clause | -- | /O(n)/ Convert a 'String' into a 'Text'.
--
-- Subject to fusion. Performs replacement on invalid scalar values.
pack :: String -> Text
pack = unstream . S.streamList . L.map safe | 185 | pack :: String -> Text
pack = unstream . S.streamList . L.map safe | 66 | pack = unstream . S.streamList . L.map safe | 43 | true | true | 0 | 7 | 33 | 33 | 18 | 15 | null | null |
rueshyna/gogol | gogol-dfareporting/gen/Network/Google/DFAReporting/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'RemarketingListShare' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rlsSharedAdvertiserIds'
--
-- * 'rlsKind'
--
-- * 'rlsRemarketingListId'
--
-- * 'rlsSharedAccountIds'
remarketingListShare
:: RemarketingListShare
remarketingListShare =
RemarketingListShare'
{ _rlsSharedAdvertiserIds = Nothing
, _rlsKind = "dfareporting#remarketingListShare"
, _rlsRemarketingListId = Nothing
, _rlsSharedAccountIds = Nothing
} | 555 | remarketingListShare
:: RemarketingListShare
remarketingListShare =
RemarketingListShare'
{ _rlsSharedAdvertiserIds = Nothing
, _rlsKind = "dfareporting#remarketingListShare"
, _rlsRemarketingListId = Nothing
, _rlsSharedAccountIds = Nothing
} | 271 | remarketingListShare =
RemarketingListShare'
{ _rlsSharedAdvertiserIds = Nothing
, _rlsKind = "dfareporting#remarketingListShare"
, _rlsRemarketingListId = Nothing
, _rlsSharedAccountIds = Nothing
} | 222 | true | true | 1 | 7 | 96 | 55 | 35 | 20 | null | null |
dfordivam/functorrent | src/FuncTorrent/Bencode.hs | gpl-3.0 | bValToInfoDict :: BVal -> Maybe (Map String BVal)
bValToInfoDict (Bdict dict) = Just dict | 93 | bValToInfoDict :: BVal -> Maybe (Map String BVal)
bValToInfoDict (Bdict dict) = Just dict | 93 | bValToInfoDict (Bdict dict) = Just dict | 39 | false | true | 0 | 9 | 17 | 43 | 19 | 24 | null | null |
emilaxelsson/ag-graph | examples/Feldspar.hs | bsd-3-clause | sizeInfI :: (Size :< atts) => Inh Feldspar atts (Env Size)
-- Insert `v` with the size of `a` into the environment:
sizeInfI (Let v a b) = b |-> Map.insert v (sizeOf a) above | 174 | sizeInfI :: (Size :< atts) => Inh Feldspar atts (Env Size)
sizeInfI (Let v a b) = b |-> Map.insert v (sizeOf a) above | 117 | sizeInfI (Let v a b) = b |-> Map.insert v (sizeOf a) above | 58 | true | true | 1 | 8 | 34 | 73 | 36 | 37 | null | null |
MiroslavVitkov/voiceid | misc/hw2.hs | mit | -- Remove massages, that are not error with severity >= 50.
filterList :: [L.LogMessage] -> [L.LogMessage]
filterList [] = [] | 125 | filterList :: [L.LogMessage] -> [L.LogMessage]
filterList [] = [] | 65 | filterList [] = [] | 18 | true | true | 0 | 7 | 19 | 33 | 18 | 15 | null | null |
fmapfmapfmap/amazonka | amazonka-kms/gen/Network/AWS/KMS/Decrypt.hs | mpl-2.0 | -- | ARN of the key used to perform the decryption. This value is returned if
-- no errors are encountered during the operation.
drsKeyId :: Lens' DecryptResponse (Maybe Text)
drsKeyId = lens _drsKeyId (\ s a -> s{_drsKeyId = a}) | 229 | drsKeyId :: Lens' DecryptResponse (Maybe Text)
drsKeyId = lens _drsKeyId (\ s a -> s{_drsKeyId = a}) | 100 | drsKeyId = lens _drsKeyId (\ s a -> s{_drsKeyId = a}) | 53 | true | true | 1 | 9 | 40 | 52 | 26 | 26 | null | null |
Palmik/data-store | src/Data/Store/Storable.hs | bsd-3-clause | -- | See @'Data.Store.update'@ (the keys of the updated elements are obtained using the
-- @'Data.Store.Storable.Storable.key'@ function).
update :: (Storable v, S.IsSelection sel)
=> (v -> Maybe v)
-> sel tag (StoreKRS v) (StoreIRS v) (StoreTS v)
-> S.Store tag (StoreKRS v) (StoreIRS v) (StoreTS v) v
-> Maybe (S.Store tag (StoreKRS v) (StoreIRS v) (StoreTS v) v)
update tr = S.update (maybe Nothing (\v -> Just (v, Just $! key v)) . tr) | 467 | update :: (Storable v, S.IsSelection sel)
=> (v -> Maybe v)
-> sel tag (StoreKRS v) (StoreIRS v) (StoreTS v)
-> S.Store tag (StoreKRS v) (StoreIRS v) (StoreTS v) v
-> Maybe (S.Store tag (StoreKRS v) (StoreIRS v) (StoreTS v) v)
update tr = S.update (maybe Nothing (\v -> Just (v, Just $! key v)) . tr) | 328 | update tr = S.update (maybe Nothing (\v -> Just (v, Just $! key v)) . tr) | 73 | true | true | 0 | 14 | 101 | 191 | 96 | 95 | null | null |
cmc-haskell-2015/checkers | src/AIPlayer/Internal.hs | lgpl-3.0 | -- | Вспомогательная Функция подсчета для чуть лучшего среднего уровня сложности
logFrom :: AIAttr -> AIAttr -> Double
logFrom me@(AIAttr a b) enemy@(AIAttr c d) = 2 * (logBase 2 (2 * a * (4 * b + 1) + a + b + 1)) - (logBase 10 (((c * d)) / (c + d + 1) + 1)) - d * 2 | 266 | logFrom :: AIAttr -> AIAttr -> Double
logFrom me@(AIAttr a b) enemy@(AIAttr c d) = 2 * (logBase 2 (2 * a * (4 * b + 1) + a + b + 1)) - (logBase 10 (((c * d)) / (c + d + 1) + 1)) - d * 2 | 185 | logFrom me@(AIAttr a b) enemy@(AIAttr c d) = 2 * (logBase 2 (2 * a * (4 * b + 1) + a + b + 1)) - (logBase 10 (((c * d)) / (c + d + 1) + 1)) - d * 2 | 147 | true | true | 0 | 18 | 62 | 145 | 77 | 68 | null | null |
wavewave/madgraph-auto-dataset | src/HEP/Automation/MadGraph/Dataset/Set20110311set1.hs | gpl-3.0 | processTTBar0or1jet :: [Char]
processTTBar0or1jet =
"\ngenerate P P > t t~ QED=99 @1 \nadd process P P > t t~ J QED=99 @2 \n" | 130 | processTTBar0or1jet :: [Char]
processTTBar0or1jet =
"\ngenerate P P > t t~ QED=99 @1 \nadd process P P > t t~ J QED=99 @2 \n" | 130 | processTTBar0or1jet =
"\ngenerate P P > t t~ QED=99 @1 \nadd process P P > t t~ J QED=99 @2 \n" | 100 | false | true | 0 | 5 | 28 | 14 | 8 | 6 | null | null |
davidzhulijun/TAM | PushdownAutomaton/State2.hs | bsd-3-clause | gcompile :: (Forward (mem i),Copointed mem, Ord n, MapLike m, Stack stack ) =>
(i -> m n v -> qs -> (qs, m n (StackCommd v))) -> Trans x (PDAState qs (m n (stack v)) (mem i))
gcompile f = Trans g
where g _ st = PDAState qs' (stackoperate comds' (st^.memory)) (next (st^.input))
where stkm = mapWithKeyM (st^.memory) (\_ -> top)
ch = copoint (st^.input)
(qs', comds') = f ch stkm (st^.q)
stackoperate comds stkmap = mapWithKeyM stkmap sop
where sop k sta = stackoperation (lookupM comds k) sta | 579 | gcompile :: (Forward (mem i),Copointed mem, Ord n, MapLike m, Stack stack ) =>
(i -> m n v -> qs -> (qs, m n (StackCommd v))) -> Trans x (PDAState qs (m n (stack v)) (mem i))
gcompile f = Trans g
where g _ st = PDAState qs' (stackoperate comds' (st^.memory)) (next (st^.input))
where stkm = mapWithKeyM (st^.memory) (\_ -> top)
ch = copoint (st^.input)
(qs', comds') = f ch stkm (st^.q)
stackoperate comds stkmap = mapWithKeyM stkmap sop
where sop k sta = stackoperation (lookupM comds k) sta | 579 | gcompile f = Trans g
where g _ st = PDAState qs' (stackoperate comds' (st^.memory)) (next (st^.input))
where stkm = mapWithKeyM (st^.memory) (\_ -> top)
ch = copoint (st^.input)
(qs', comds') = f ch stkm (st^.q)
stackoperate comds stkmap = mapWithKeyM stkmap sop
where sop k sta = stackoperation (lookupM comds k) sta | 401 | false | true | 0 | 14 | 177 | 287 | 146 | 141 | null | null |
dahlia/nirum | src/Nirum/Parser.hs | gpl-3.0 | methodSet :: Parser (DeclarationSet Method)
methodSet = do
methods' <- methods <?> "service methods"
handleNameDuplication "method" methods' return | 155 | methodSet :: Parser (DeclarationSet Method)
methodSet = do
methods' <- methods <?> "service methods"
handleNameDuplication "method" methods' return | 155 | methodSet = do
methods' <- methods <?> "service methods"
handleNameDuplication "method" methods' return | 111 | false | true | 0 | 8 | 25 | 41 | 19 | 22 | null | null |
markus1189/lambda-feed | src/LambdaFeed.hs | gpl-3.0 | pandocRender :: String -> String
pandocRender = either (const "<Could not render this content>")
(Pandoc.writeMarkdown def)
. Pandoc.readHtml def | 180 | pandocRender :: String -> String
pandocRender = either (const "<Could not render this content>")
(Pandoc.writeMarkdown def)
. Pandoc.readHtml def | 180 | pandocRender = either (const "<Could not render this content>")
(Pandoc.writeMarkdown def)
. Pandoc.readHtml def | 147 | false | true | 1 | 7 | 53 | 51 | 22 | 29 | null | null |
fmapfmapfmap/amazonka | amazonka-elasticache/gen/Network/AWS/ElastiCache/DeleteReplicationGroup.hs | mpl-2.0 | -- | Creates a value of 'DeleteReplicationGroup' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'drgFinalSnapshotIdentifier'
--
-- * 'drgRetainPrimaryCluster'
--
-- * 'drgReplicationGroupId'
deleteReplicationGroup
:: Text -- ^ 'drgReplicationGroupId'
-> DeleteReplicationGroup
deleteReplicationGroup pReplicationGroupId_ =
DeleteReplicationGroup'
{ _drgFinalSnapshotIdentifier = Nothing
, _drgRetainPrimaryCluster = Nothing
, _drgReplicationGroupId = pReplicationGroupId_
} | 587 | deleteReplicationGroup
:: Text -- ^ 'drgReplicationGroupId'
-> DeleteReplicationGroup
deleteReplicationGroup pReplicationGroupId_ =
DeleteReplicationGroup'
{ _drgFinalSnapshotIdentifier = Nothing
, _drgRetainPrimaryCluster = Nothing
, _drgReplicationGroupId = pReplicationGroupId_
} | 310 | deleteReplicationGroup pReplicationGroupId_ =
DeleteReplicationGroup'
{ _drgFinalSnapshotIdentifier = Nothing
, _drgRetainPrimaryCluster = Nothing
, _drgReplicationGroupId = pReplicationGroupId_
} | 216 | true | true | 0 | 6 | 94 | 48 | 32 | 16 | null | null |
hvr/lens | src/Control/Lens/TH.hs | bsd-3-clause | -- | Make a top level isomorphism injecting /into/ the type.
--
-- The supplied name is required to be for a type with a single constructor
-- that has a single argument.
--
-- /e.g./
--
-- @
-- newtype 'List' a = 'List' [a]
-- 'makeIso' ''List
-- @
--
-- will create
--
-- @
-- 'list' :: 'Iso' [a] [b] ('List' a) ('List' b)
-- @
--
-- @
-- 'makeIso' = 'makeLensesWith' 'isoRules'
-- @
makeIso :: Name -> Q [Dec]
makeIso = makeLensesWith isoRules | 446 | makeIso :: Name -> Q [Dec]
makeIso = makeLensesWith isoRules | 60 | makeIso = makeLensesWith isoRules | 33 | true | true | 0 | 7 | 89 | 45 | 33 | 12 | null | null |
conal/shady-render | src/Shady/Uniform.hs | agpl-3.0 | set4 :: (a -> gla) -> (GlLoc -> gla -> gla -> gla -> gla -> IO ())
-> GlLoc -> Vec4 a -> IO ()
set4 from set l w = set l (from a) (from b) (from c) (from d)
where (a,b,c,d) = un4 w | 188 | set4 :: (a -> gla) -> (GlLoc -> gla -> gla -> gla -> gla -> IO ())
-> GlLoc -> Vec4 a -> IO ()
set4 from set l w = set l (from a) (from b) (from c) (from d)
where (a,b,c,d) = un4 w | 188 | set4 from set l w = set l (from a) (from b) (from c) (from d)
where (a,b,c,d) = un4 w | 87 | false | true | 0 | 14 | 54 | 137 | 69 | 68 | null | null |
sinelaw/HOpenCV | src/AI/CV/OpenCV/ImgProc.hs | gpl-2.0 | fromCvtColorFlag BayerBG2RGB = fromCvtColorFlag BayerRG2BGR | 59 | fromCvtColorFlag BayerBG2RGB = fromCvtColorFlag BayerRG2BGR | 59 | fromCvtColorFlag BayerBG2RGB = fromCvtColorFlag BayerRG2BGR | 59 | false | false | 0 | 5 | 4 | 12 | 5 | 7 | null | null |
DougBurke/swish | src/Swish/RDF/Vocabulary/FOAF.hs | lgpl-2.1 | -- | @foaf:firstName@ from <http://xmlns.com/foaf/spec/#term_firstName>.
foaffirstName :: ScopedName
foaffirstName = toF "firstName" | 133 | foaffirstName :: ScopedName
foaffirstName = toF "firstName" | 59 | foaffirstName = toF "firstName" | 31 | true | true | 0 | 5 | 12 | 15 | 8 | 7 | null | null |
Happy0/snowdrift | Handler/Comment.hs | agpl-3.0 | -- | Make a comment action widget (close, delete, etc.). Unexported. Call one of
-- makeCloseCommentWidget, makeDeleteCommentWidget, etc. directly.
makeCommentActionWidget :: (CommentActionPermissions -> Bool) -> Widget -> MakeCommentActionWidget
makeCommentActionWidget
can_perform_action
form_widget
comment@(Entity comment_id _)
user
make_handler_info
mods
get_max_depth
is_preview = do
-- Just checking action permissions - we *don't* want to pass make_handler_info 'mods'.
-- Consider previewing a 'close' action: presumably, 'mods' will add the comment to
-- the 'close' map, which would mean the 'can_close' action would be False!
action_permissions <-
lookupErr "makeCommentActionWidget: comment id not found in map" comment_id
<$> commentHandlerMakeActionPermissionsMap (make_handler_info def) [comment]
unless (can_perform_action action_permissions)
(permissionDenied "You don't have permission to perform this action.")
makeCommentTreeWidget
make_handler_info
comment
(Just user)
mods
get_max_depth
is_preview
form_widget | 1,206 | makeCommentActionWidget :: (CommentActionPermissions -> Bool) -> Widget -> MakeCommentActionWidget
makeCommentActionWidget
can_perform_action
form_widget
comment@(Entity comment_id _)
user
make_handler_info
mods
get_max_depth
is_preview = do
-- Just checking action permissions - we *don't* want to pass make_handler_info 'mods'.
-- Consider previewing a 'close' action: presumably, 'mods' will add the comment to
-- the 'close' map, which would mean the 'can_close' action would be False!
action_permissions <-
lookupErr "makeCommentActionWidget: comment id not found in map" comment_id
<$> commentHandlerMakeActionPermissionsMap (make_handler_info def) [comment]
unless (can_perform_action action_permissions)
(permissionDenied "You don't have permission to perform this action.")
makeCommentTreeWidget
make_handler_info
comment
(Just user)
mods
get_max_depth
is_preview
form_widget | 1,058 | makeCommentActionWidget
can_perform_action
form_widget
comment@(Entity comment_id _)
user
make_handler_info
mods
get_max_depth
is_preview = do
-- Just checking action permissions - we *don't* want to pass make_handler_info 'mods'.
-- Consider previewing a 'close' action: presumably, 'mods' will add the comment to
-- the 'close' map, which would mean the 'can_close' action would be False!
action_permissions <-
lookupErr "makeCommentActionWidget: comment id not found in map" comment_id
<$> commentHandlerMakeActionPermissionsMap (make_handler_info def) [comment]
unless (can_perform_action action_permissions)
(permissionDenied "You don't have permission to perform this action.")
makeCommentTreeWidget
make_handler_info
comment
(Just user)
mods
get_max_depth
is_preview
form_widget | 959 | true | true | 0 | 11 | 290 | 133 | 67 | 66 | null | null |
DaMSL/K3 | src/Language/K3/Codegen/Haskell.hs | apache-2.0 | typ' (tag &&& children -> (TTuple, ch)) = mapM typ' ch >>= return . tupleType | 77 | typ' (tag &&& children -> (TTuple, ch)) = mapM typ' ch >>= return . tupleType | 77 | typ' (tag &&& children -> (TTuple, ch)) = mapM typ' ch >>= return . tupleType | 77 | false | false | 0 | 7 | 14 | 40 | 20 | 20 | null | null |
daleooo/barrelfish | tools/flounder/THCBackend.hs | mit | rpc_argdecl ServerSide ifn (RPCArgIn _ _) = [] | 46 | rpc_argdecl ServerSide ifn (RPCArgIn _ _) = [] | 46 | rpc_argdecl ServerSide ifn (RPCArgIn _ _) = [] | 46 | false | false | 0 | 7 | 7 | 25 | 11 | 14 | null | null |
alfpark/bond | compiler/src/Language/Bond/Codegen/TypeMapping.hs | mit | cppTypeCustomAlloc _lloc (BT_Nullable element) = "bond::nullable<" <>> elementTypeName element <<> ">" | 102 | cppTypeCustomAlloc _lloc (BT_Nullable element) = "bond::nullable<" <>> elementTypeName element <<> ">" | 102 | cppTypeCustomAlloc _lloc (BT_Nullable element) = "bond::nullable<" <>> elementTypeName element <<> ">" | 102 | false | false | 0 | 7 | 10 | 28 | 13 | 15 | null | null |
kazu-yamamoto/wai | warp/test/ExceptionSpec.hs | mit | withTestServer :: (Int -> IO a) -> IO a
withTestServer inner = bracket
(N.bindRandomPortTCP "127.0.0.1")
(close . snd)
$ \(prt, lsocket) -> do
withAsync (runSettingsSocket defaultSettings lsocket testApp)
$ \_ -> inner prt | 254 | withTestServer :: (Int -> IO a) -> IO a
withTestServer inner = bracket
(N.bindRandomPortTCP "127.0.0.1")
(close . snd)
$ \(prt, lsocket) -> do
withAsync (runSettingsSocket defaultSettings lsocket testApp)
$ \_ -> inner prt | 254 | withTestServer inner = bracket
(N.bindRandomPortTCP "127.0.0.1")
(close . snd)
$ \(prt, lsocket) -> do
withAsync (runSettingsSocket defaultSettings lsocket testApp)
$ \_ -> inner prt | 214 | false | true | 2 | 12 | 64 | 97 | 47 | 50 | null | null |
fffej/HS-Poker | Hand.hs | bsd-3-clause | groupSize (OneOneOneOneOneGroup _ _ _ _ _) = 5 | 46 | groupSize (OneOneOneOneOneGroup _ _ _ _ _) = 5 | 46 | groupSize (OneOneOneOneOneGroup _ _ _ _ _) = 5 | 46 | false | false | 0 | 7 | 8 | 23 | 11 | 12 | null | null |
stephenpascoe/mongo-sql | src/Transfuser/Types.hs | bsd-3-clause | bsonTypeToInt Null = 10 | 23 | bsonTypeToInt Null = 10 | 23 | bsonTypeToInt Null = 10 | 23 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
m15k/hs-nexpose-client | nexpose/src/Nexpose/API/Logout.hs | mit | xpLogoutRequest :: PU [UNode String] LogoutRequest
xpLogoutRequest =
xpWrap ( uncurry LogoutRequest,
\(LogoutRequest s si) -> (s,si)) $
xpElemAttrs "LogoutRequest"
(xpPair
(xpOption (xpAttr "sync-id" xpText0))
(xpAttr "session-id" xpText0)) | 276 | xpLogoutRequest :: PU [UNode String] LogoutRequest
xpLogoutRequest =
xpWrap ( uncurry LogoutRequest,
\(LogoutRequest s si) -> (s,si)) $
xpElemAttrs "LogoutRequest"
(xpPair
(xpOption (xpAttr "sync-id" xpText0))
(xpAttr "session-id" xpText0)) | 276 | xpLogoutRequest =
xpWrap ( uncurry LogoutRequest,
\(LogoutRequest s si) -> (s,si)) $
xpElemAttrs "LogoutRequest"
(xpPair
(xpOption (xpAttr "sync-id" xpText0))
(xpAttr "session-id" xpText0)) | 225 | false | true | 0 | 10 | 63 | 93 | 47 | 46 | null | null |
mitchellwrosen/statsd-haskell | src/Statsd.hs | lgpl-3.0 | -- | Run a StatsdT computation, which pushes metrics to StatsD.
--
-- > {-# LANGUAGE OverloadedStrings #-}
-- > {-# LANGUAGE RecordWildCards #-}
-- >
-- > module Main where
-- >
-- > import Network
-- > import Network.Socket
-- > import Statsd
-- >
-- > main :: IO ()
-- > main = do
-- > let hints = defaultHints
-- > { addrFamily = AF_INET
-- > , addrSocketType = Datagram
-- > }
-- > host = "localhost"
-- > service = "8125"
-- >
-- > AddrInfo{..}:_ <- getAddrInfo (Just hints) (Just host) (Just service)
-- > runStatsd addrFamily addrSocketType addrProtocol addrAddress $ do
-- > statsdCounter "foo" 1
-- > statsdTimer "bar" 25
runStatsd :: (MonadBaseControl IO m, MonadIO m)
=> Family
-> SocketType
-> ProtocolNumber
-> SockAddr
-> StatsdT m a -> m a
runStatsd family socket_type protocol_num sock_addr (StatsdT action) =
withSocket family socket_type protocol_num sock_addr $ \sock -> do
(a, bss) <- runWriterT (runReaderT action sock)
liftIO $ sendAll sock (BS.intercalate "\n" bss)
return a
-- | Push to a StatsD counter.
--
-- > statsdCounter "foo" 1 == "foo:1|c" | 1,265 | runStatsd :: (MonadBaseControl IO m, MonadIO m)
=> Family
-> SocketType
-> ProtocolNumber
-> SockAddr
-> StatsdT m a -> m a
runStatsd family socket_type protocol_num sock_addr (StatsdT action) =
withSocket family socket_type protocol_num sock_addr $ \sock -> do
(a, bss) <- runWriterT (runReaderT action sock)
liftIO $ sendAll sock (BS.intercalate "\n" bss)
return a
-- | Push to a StatsD counter.
--
-- > statsdCounter "foo" 1 == "foo:1|c" | 519 | runStatsd family socket_type protocol_num sock_addr (StatsdT action) =
withSocket family socket_type protocol_num sock_addr $ \sock -> do
(a, bss) <- runWriterT (runReaderT action sock)
liftIO $ sendAll sock (BS.intercalate "\n" bss)
return a
-- | Push to a StatsD counter.
--
-- > statsdCounter "foo" 1 == "foo:1|c" | 345 | true | true | 0 | 13 | 384 | 170 | 96 | 74 | null | null |
plow-technologies/shakespeare-dynamic | ghcjs-shakespeare-dynamic/src/Shakespeare/Ophelia/Parser.hs | mit | fromTree' :: (Monad m, Functor m) => Parser ([a] -> m a) -> T.Tree String -> m (Result a)
fromTree' builder (T.Node st ch) = do
let buildT = parseString builder (Columns 0 0) st
ch' <- T.sequenceA <$> T.forM ch (fromTree' builder)
T.sequence $ buildT <*> ch'
-- | Parse a set of strings based on their indentation and form a tree
-- structure | 351 | fromTree' :: (Monad m, Functor m) => Parser ([a] -> m a) -> T.Tree String -> m (Result a)
fromTree' builder (T.Node st ch) = do
let buildT = parseString builder (Columns 0 0) st
ch' <- T.sequenceA <$> T.forM ch (fromTree' builder)
T.sequence $ buildT <*> ch'
-- | Parse a set of strings based on their indentation and form a tree
-- structure | 351 | fromTree' builder (T.Node st ch) = do
let buildT = parseString builder (Columns 0 0) st
ch' <- T.sequenceA <$> T.forM ch (fromTree' builder)
T.sequence $ buildT <*> ch'
-- | Parse a set of strings based on their indentation and form a tree
-- structure | 261 | false | true | 0 | 12 | 73 | 144 | 70 | 74 | null | null |
aelve/guide | back/src/Guide/Views/Utils.hs | bsd-3-clause | -- See Note [show-hide]
sectionSpan
:: Monad m
=> Text -- ^ Section name (or names)
-> [Attribute] -- ^ Additional attributes
-> HtmlT m () -- ^ Content of the section
-> HtmlT m ()
sectionSpan t attrs = span_ (class_ (t <> " section ") : attrs) | 272 | sectionSpan
:: Monad m
=> Text -- ^ Section name (or names)
-> [Attribute] -- ^ Additional attributes
-> HtmlT m () -- ^ Content of the section
-> HtmlT m ()
sectionSpan t attrs = span_ (class_ (t <> " section ") : attrs) | 248 | sectionSpan t attrs = span_ (class_ (t <> " section ") : attrs) | 63 | true | true | 0 | 11 | 75 | 80 | 40 | 40 | null | null |
purcell/adventofcode2016 | src/Day21.hs | bsd-3-clause | unapply s (Move a b) = apply s $ Move b a | 41 | unapply s (Move a b) = apply s $ Move b a | 41 | unapply s (Move a b) = apply s $ Move b a | 41 | false | false | 0 | 7 | 11 | 31 | 14 | 17 | null | null |
nablaa/hirchess | src/IRC.hs | gpl-2.0 | -- prevent flooding
write :: Handle -> String -> String -> IO ()
write h s t = do
_ <- hPrintf h "%s %s\r\n" s t
printf "> %s %s\n" s t | 143 | write :: Handle -> String -> String -> IO ()
write h s t = do
_ <- hPrintf h "%s %s\r\n" s t
printf "> %s %s\n" s t | 122 | write h s t = do
_ <- hPrintf h "%s %s\r\n" s t
printf "> %s %s\n" s t | 77 | true | true | 0 | 10 | 40 | 67 | 30 | 37 | null | null |
tolysz/prepare-ghcjs | spec-lts8/base/GHC/Event/Control.hs | bsd-3-clause | sendMessage :: Fd -> ControlMessage -> IO Int
sendMessage fd msg = alloca $ \p -> do
case msg of
CMsgWakeup -> poke p io_MANAGER_WAKEUP
CMsgDie -> poke p io_MANAGER_DIE
CMsgSignal _fp _s -> errorWithoutStackTrace "Signals can only be sent from within the RTS"
fromIntegral `fmap` c_write (fromIntegral fd) p 1
#if defined(HAVE_EVENTFD) | 369 | sendMessage :: Fd -> ControlMessage -> IO Int
sendMessage fd msg = alloca $ \p -> do
case msg of
CMsgWakeup -> poke p io_MANAGER_WAKEUP
CMsgDie -> poke p io_MANAGER_DIE
CMsgSignal _fp _s -> errorWithoutStackTrace "Signals can only be sent from within the RTS"
fromIntegral `fmap` c_write (fromIntegral fd) p 1
#if defined(HAVE_EVENTFD) | 369 | sendMessage fd msg = alloca $ \p -> do
case msg of
CMsgWakeup -> poke p io_MANAGER_WAKEUP
CMsgDie -> poke p io_MANAGER_DIE
CMsgSignal _fp _s -> errorWithoutStackTrace "Signals can only be sent from within the RTS"
fromIntegral `fmap` c_write (fromIntegral fd) p 1
#if defined(HAVE_EVENTFD) | 323 | false | true | 0 | 12 | 86 | 102 | 49 | 53 | null | null |
dmjio/servant-swagger | src/Servant/Swagger/Internal/Test.hs | bsd-3-clause | maybeCounterExample (Just s) = counterexample s (property False) | 64 | maybeCounterExample (Just s) = counterexample s (property False) | 64 | maybeCounterExample (Just s) = counterexample s (property False) | 64 | false | false | 0 | 7 | 7 | 27 | 12 | 15 | null | null |
palf/haskellSDL2Examples | examples/lesson06/src/Lesson06.hs | gpl-2.0 | draw :: (MonadIO m) => SDL.Window -> SDL.Surface -> SDL.Surface -> m ()
draw w s t
= SDL.surfaceBlitScaled t Nothing s Nothing
>> SDL.updateWindowSurface w | 159 | draw :: (MonadIO m) => SDL.Window -> SDL.Surface -> SDL.Surface -> m ()
draw w s t
= SDL.surfaceBlitScaled t Nothing s Nothing
>> SDL.updateWindowSurface w | 159 | draw w s t
= SDL.surfaceBlitScaled t Nothing s Nothing
>> SDL.updateWindowSurface w | 87 | false | true | 2 | 10 | 29 | 71 | 34 | 37 | null | null |
opqdonut/nikls | src/Model.hs | gpl-3.0 | transactionBalances :: Transaction -> Balances
transactionBalances t = mappend (transactionPositive t) (transactionNegative t) | 126 | transactionBalances :: Transaction -> Balances
transactionBalances t = mappend (transactionPositive t) (transactionNegative t) | 126 | transactionBalances t = mappend (transactionPositive t) (transactionNegative t) | 79 | false | true | 0 | 7 | 12 | 35 | 17 | 18 | null | null |
xekoukou/idris-malfunction | src/IRTS/CodegenMalfunction.hs | mit | -- fixme safety
cgOp LWriteStr [_, str] =
S [A "apply", S [A "global", A "$Pervasives", A "$print_string"], cgVar str] | 120 | cgOp LWriteStr [_, str] =
S [A "apply", S [A "global", A "$Pervasives", A "$print_string"], cgVar str] | 104 | cgOp LWriteStr [_, str] =
S [A "apply", S [A "global", A "$Pervasives", A "$print_string"], cgVar str] | 104 | true | false | 0 | 9 | 21 | 57 | 29 | 28 | null | null |
DanielSchuessler/hstri | ConcreteNormal.hs | gpl-3.0 | posOfCornerOfTri
:: NmTri -> NormalCorner -> CornerPosition
posOfCornerOfTri x c = assert (r1==r2) $ r1
where
(r1,r2) = map2 (discPosToCornerPos_helper posOfArcOfTri x c) (True,False) | 191 | posOfCornerOfTri
:: NmTri -> NormalCorner -> CornerPosition
posOfCornerOfTri x c = assert (r1==r2) $ r1
where
(r1,r2) = map2 (discPosToCornerPos_helper posOfArcOfTri x c) (True,False) | 191 | posOfCornerOfTri x c = assert (r1==r2) $ r1
where
(r1,r2) = map2 (discPosToCornerPos_helper posOfArcOfTri x c) (True,False) | 129 | false | true | 0 | 8 | 31 | 77 | 39 | 38 | null | null |
choener/RNAdesign | BioInf/RNAdesign/Graph.hs | gpl-3.0 | mkUnionGraph = unions . map (pairlistToGraph . (mkD1S :: String -> D1Secondary)) | 80 | mkUnionGraph = unions . map (pairlistToGraph . (mkD1S :: String -> D1Secondary)) | 80 | mkUnionGraph = unions . map (pairlistToGraph . (mkD1S :: String -> D1Secondary)) | 80 | false | false | 0 | 10 | 11 | 30 | 16 | 14 | null | null |
yarbroughw/advent | src/Day2.hs | bsd-3-clause | ribbonFeet :: Box -> Int
ribbonFeet (Box l w h) = wrap + bow
where wrap = sum $ map (*2) $ take 2 $ sort [l,w,h]
bow = l*w*h | 134 | ribbonFeet :: Box -> Int
ribbonFeet (Box l w h) = wrap + bow
where wrap = sum $ map (*2) $ take 2 $ sort [l,w,h]
bow = l*w*h | 134 | ribbonFeet (Box l w h) = wrap + bow
where wrap = sum $ map (*2) $ take 2 $ sort [l,w,h]
bow = l*w*h | 109 | false | true | 1 | 11 | 39 | 88 | 45 | 43 | null | null |
ribag/ganeti-experiments | src/Ganeti/Constants.hs | gpl-2.0 | ssNodeVmCapable :: String
ssNodeVmCapable = "node_vm_capable" | 61 | ssNodeVmCapable :: String
ssNodeVmCapable = "node_vm_capable" | 61 | ssNodeVmCapable = "node_vm_capable" | 35 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Generated/Navigator.hs | mit | -- | <https://developer.mozilla.org/en-US/docs/Web/API/Navigator.vibrate Mozilla Navigator.vibrate documentation>
vibratePattern :: (MonadDOM m) => Navigator -> [Word] -> m Bool
vibratePattern self pattern'
= liftDOM
((self ^. jsf "vibrate" [toJSVal (array pattern')]) >>= valToBool) | 292 | vibratePattern :: (MonadDOM m) => Navigator -> [Word] -> m Bool
vibratePattern self pattern'
= liftDOM
((self ^. jsf "vibrate" [toJSVal (array pattern')]) >>= valToBool) | 177 | vibratePattern self pattern'
= liftDOM
((self ^. jsf "vibrate" [toJSVal (array pattern')]) >>= valToBool) | 113 | true | true | 0 | 14 | 39 | 74 | 38 | 36 | null | null |
keent/stack | src/Stack/Types/Config.hs | bsd-3-clause | configMonoidOSName :: Text
configMonoidOSName = "os" | 52 | configMonoidOSName :: Text
configMonoidOSName = "os" | 52 | configMonoidOSName = "os" | 25 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
Paow/encore | src/ir/Identifiers.hs | bsd-3-clause | isEmptyNamespace :: Namespace -> Bool
isEmptyNamespace (NSExplicit []) = True | 77 | isEmptyNamespace :: Namespace -> Bool
isEmptyNamespace (NSExplicit []) = True | 77 | isEmptyNamespace (NSExplicit []) = True | 39 | false | true | 0 | 8 | 9 | 26 | 13 | 13 | null | null |
nevrenato/HetsAlloy | Maude/Shellout.hs | gpl-2.0 | final "endfth" = True | 21 | final "endfth" = True | 21 | final "endfth" = True | 21 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
ekalosak/haskell-practice | helloWorld/baby2.hs | lgpl-3.0 | initials :: [Char] -> [Char] -> [Char]
initials (f:_) (l:_) = (f : ". ") ++ (l : ".") | 85 | initials :: [Char] -> [Char] -> [Char]
initials (f:_) (l:_) = (f : ". ") ++ (l : ".") | 85 | initials (f:_) (l:_) = (f : ". ") ++ (l : ".") | 46 | false | true | 0 | 10 | 18 | 71 | 37 | 34 | null | null |
ghc-android/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | translateOp dflags SllOp = Just (mo_wordShl dflags) | 60 | translateOp dflags SllOp = Just (mo_wordShl dflags) | 60 | translateOp dflags SllOp = Just (mo_wordShl dflags) | 60 | false | false | 0 | 7 | 15 | 20 | 9 | 11 | null | null |
AlexanderPankiv/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | uWordDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "UWord") | 62 | uWordDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "UWord") | 62 | uWordDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "UWord") | 62 | false | false | 0 | 7 | 7 | 17 | 8 | 9 | null | null |
conal/hermit | src/HERMIT/Monad.hs | bsd-2-clause | -- | Allow HermitM to be embedded in another monad with proper capabilities.
embedHermitM :: (HasHermitMEnv m, HasLemmas m, LiftCoreM m) => HermitM a -> m a
embedHermitM hm = do
env <- getHermitMEnv
r <- liftCoreM (runHermitM hm env) >>= runKureM return fail
when (hResChanged r) $ forM_ (toList (hResLemmas r)) $ uncurry insertLemma
return $ hResult r | 368 | embedHermitM :: (HasHermitMEnv m, HasLemmas m, LiftCoreM m) => HermitM a -> m a
embedHermitM hm = do
env <- getHermitMEnv
r <- liftCoreM (runHermitM hm env) >>= runKureM return fail
when (hResChanged r) $ forM_ (toList (hResLemmas r)) $ uncurry insertLemma
return $ hResult r | 291 | embedHermitM hm = do
env <- getHermitMEnv
r <- liftCoreM (runHermitM hm env) >>= runKureM return fail
when (hResChanged r) $ forM_ (toList (hResLemmas r)) $ uncurry insertLemma
return $ hResult r | 211 | true | true | 0 | 13 | 74 | 128 | 59 | 69 | null | null |
triplepointfive/hogldev | tutorial24/Tutorial24.hs | mit | initializeGlutCallbacks :: Mesh
-> Mesh
-> ShadowMapFBO
-> LightingTechnique
-> ShadowMapTechnique
-> IORef GLfloat
-> IORef Camera
-> Texture
-> IO ()
initializeGlutCallbacks mesh quad shadowMapFBO lightingEffect shadowMapEffect gScale cameraRef texture = do
displayCallback $=
renderSceneCB mesh quad shadowMapFBO lightingEffect shadowMapEffect gScale cameraRef texture
idleCallback $= Just (idleCB gScale cameraRef)
specialCallback $= Just (specialKeyboardCB cameraRef)
keyboardCallback $= Just keyboardCB
passiveMotionCallback $= Just (passiveMotionCB cameraRef) | 789 | initializeGlutCallbacks :: Mesh
-> Mesh
-> ShadowMapFBO
-> LightingTechnique
-> ShadowMapTechnique
-> IORef GLfloat
-> IORef Camera
-> Texture
-> IO ()
initializeGlutCallbacks mesh quad shadowMapFBO lightingEffect shadowMapEffect gScale cameraRef texture = do
displayCallback $=
renderSceneCB mesh quad shadowMapFBO lightingEffect shadowMapEffect gScale cameraRef texture
idleCallback $= Just (idleCB gScale cameraRef)
specialCallback $= Just (specialKeyboardCB cameraRef)
keyboardCallback $= Just keyboardCB
passiveMotionCallback $= Just (passiveMotionCB cameraRef) | 789 | initializeGlutCallbacks mesh quad shadowMapFBO lightingEffect shadowMapEffect gScale cameraRef texture = do
displayCallback $=
renderSceneCB mesh quad shadowMapFBO lightingEffect shadowMapEffect gScale cameraRef texture
idleCallback $= Just (idleCB gScale cameraRef)
specialCallback $= Just (specialKeyboardCB cameraRef)
keyboardCallback $= Just keyboardCB
passiveMotionCallback $= Just (passiveMotionCB cameraRef) | 445 | false | true | 0 | 14 | 286 | 155 | 71 | 84 | null | null |
ekmett/predictors | src/Data/Predictor/Probability.hs | bsd-2-clause | delay :: Pr a -> Pr a
delay p = Pr [(1,Right p)] | 48 | delay :: Pr a -> Pr a
delay p = Pr [(1,Right p)] | 48 | delay p = Pr [(1,Right p)] | 26 | false | true | 0 | 8 | 12 | 43 | 20 | 23 | null | null |
tjakway/ghcjvm | compiler/nativeGen/X86/CodeGen.hs | bsd-3-clause | getRegister' dflags is32Bit (CmmMachOp mop [x]) = do -- unary MachOps
sse2 <- sse2Enabled
case mop of
MO_F_Neg w
| sse2 -> sse2NegCode w x
| otherwise -> trivialUFCode FF80 (GNEG FF80) x
MO_S_Neg w -> triv_ucode NEGI (intFormat w)
MO_Not w -> triv_ucode NOT (intFormat w)
-- Nop conversions
MO_UU_Conv W32 W8 -> toI8Reg W32 x
MO_SS_Conv W32 W8 -> toI8Reg W32 x
MO_UU_Conv W16 W8 -> toI8Reg W16 x
MO_SS_Conv W16 W8 -> toI8Reg W16 x
MO_UU_Conv W32 W16 -> toI16Reg W32 x
MO_SS_Conv W32 W16 -> toI16Reg W32 x
MO_UU_Conv W64 W32 | not is32Bit -> conversionNop II64 x
MO_SS_Conv W64 W32 | not is32Bit -> conversionNop II64 x
MO_UU_Conv W64 W16 | not is32Bit -> toI16Reg W64 x
MO_SS_Conv W64 W16 | not is32Bit -> toI16Reg W64 x
MO_UU_Conv W64 W8 | not is32Bit -> toI8Reg W64 x
MO_SS_Conv W64 W8 | not is32Bit -> toI8Reg W64 x
MO_UU_Conv rep1 rep2 | rep1 == rep2 -> conversionNop (intFormat rep1) x
MO_SS_Conv rep1 rep2 | rep1 == rep2 -> conversionNop (intFormat rep1) x
-- widenings
MO_UU_Conv W8 W32 -> integerExtend W8 W32 MOVZxL x
MO_UU_Conv W16 W32 -> integerExtend W16 W32 MOVZxL x
MO_UU_Conv W8 W16 -> integerExtend W8 W16 MOVZxL x
MO_SS_Conv W8 W32 -> integerExtend W8 W32 MOVSxL x
MO_SS_Conv W16 W32 -> integerExtend W16 W32 MOVSxL x
MO_SS_Conv W8 W16 -> integerExtend W8 W16 MOVSxL x
MO_UU_Conv W8 W64 | not is32Bit -> integerExtend W8 W64 MOVZxL x
MO_UU_Conv W16 W64 | not is32Bit -> integerExtend W16 W64 MOVZxL x
MO_UU_Conv W32 W64 | not is32Bit -> integerExtend W32 W64 MOVZxL x
MO_SS_Conv W8 W64 | not is32Bit -> integerExtend W8 W64 MOVSxL x
MO_SS_Conv W16 W64 | not is32Bit -> integerExtend W16 W64 MOVSxL x
MO_SS_Conv W32 W64 | not is32Bit -> integerExtend W32 W64 MOVSxL x
-- for 32-to-64 bit zero extension, amd64 uses an ordinary movl.
-- However, we don't want the register allocator to throw it
-- away as an unnecessary reg-to-reg move, so we keep it in
-- the form of a movzl and print it as a movl later.
MO_FF_Conv W32 W64
| sse2 -> coerceFP2FP W64 x
| otherwise -> conversionNop FF80 x
MO_FF_Conv W64 W32 -> coerceFP2FP W32 x
MO_FS_Conv from to -> coerceFP2Int from to x
MO_SF_Conv from to -> coerceInt2FP from to x
MO_V_Insert {} -> needLlvm
MO_V_Extract {} -> needLlvm
MO_V_Add {} -> needLlvm
MO_V_Sub {} -> needLlvm
MO_V_Mul {} -> needLlvm
MO_VS_Quot {} -> needLlvm
MO_VS_Rem {} -> needLlvm
MO_VS_Neg {} -> needLlvm
MO_VU_Quot {} -> needLlvm
MO_VU_Rem {} -> needLlvm
MO_VF_Insert {} -> needLlvm
MO_VF_Extract {} -> needLlvm
MO_VF_Add {} -> needLlvm
MO_VF_Sub {} -> needLlvm
MO_VF_Mul {} -> needLlvm
MO_VF_Quot {} -> needLlvm
MO_VF_Neg {} -> needLlvm
_other -> pprPanic "getRegister" (pprMachOp mop)
where
triv_ucode :: (Format -> Operand -> Instr) -> Format -> NatM Register
triv_ucode instr format = trivialUCode format (instr format) x
-- signed or unsigned extension.
integerExtend :: Width -> Width
-> (Format -> Operand -> Operand -> Instr)
-> CmmExpr -> NatM Register
integerExtend from to instr expr = do
(reg,e_code) <- if from == W8 then getByteReg expr
else getSomeReg expr
let
code dst =
e_code `snocOL`
instr (intFormat from) (OpReg reg) (OpReg dst)
return (Any (intFormat to) code)
toI8Reg :: Width -> CmmExpr -> NatM Register
toI8Reg new_rep expr
= do codefn <- getAnyReg expr
return (Any (intFormat new_rep) codefn)
-- HACK: use getAnyReg to get a byte-addressable register.
-- If the source was a Fixed register, this will add the
-- mov instruction to put it into the desired destination.
-- We're assuming that the destination won't be a fixed
-- non-byte-addressable register; it won't be, because all
-- fixed registers are word-sized.
toI16Reg = toI8Reg -- for now
conversionNop :: Format -> CmmExpr -> NatM Register
conversionNop new_format expr
= do e_code <- getRegister' dflags is32Bit expr
return (swizzleRegisterRep e_code new_format) | 4,696 | getRegister' dflags is32Bit (CmmMachOp mop [x]) = do -- unary MachOps
sse2 <- sse2Enabled
case mop of
MO_F_Neg w
| sse2 -> sse2NegCode w x
| otherwise -> trivialUFCode FF80 (GNEG FF80) x
MO_S_Neg w -> triv_ucode NEGI (intFormat w)
MO_Not w -> triv_ucode NOT (intFormat w)
-- Nop conversions
MO_UU_Conv W32 W8 -> toI8Reg W32 x
MO_SS_Conv W32 W8 -> toI8Reg W32 x
MO_UU_Conv W16 W8 -> toI8Reg W16 x
MO_SS_Conv W16 W8 -> toI8Reg W16 x
MO_UU_Conv W32 W16 -> toI16Reg W32 x
MO_SS_Conv W32 W16 -> toI16Reg W32 x
MO_UU_Conv W64 W32 | not is32Bit -> conversionNop II64 x
MO_SS_Conv W64 W32 | not is32Bit -> conversionNop II64 x
MO_UU_Conv W64 W16 | not is32Bit -> toI16Reg W64 x
MO_SS_Conv W64 W16 | not is32Bit -> toI16Reg W64 x
MO_UU_Conv W64 W8 | not is32Bit -> toI8Reg W64 x
MO_SS_Conv W64 W8 | not is32Bit -> toI8Reg W64 x
MO_UU_Conv rep1 rep2 | rep1 == rep2 -> conversionNop (intFormat rep1) x
MO_SS_Conv rep1 rep2 | rep1 == rep2 -> conversionNop (intFormat rep1) x
-- widenings
MO_UU_Conv W8 W32 -> integerExtend W8 W32 MOVZxL x
MO_UU_Conv W16 W32 -> integerExtend W16 W32 MOVZxL x
MO_UU_Conv W8 W16 -> integerExtend W8 W16 MOVZxL x
MO_SS_Conv W8 W32 -> integerExtend W8 W32 MOVSxL x
MO_SS_Conv W16 W32 -> integerExtend W16 W32 MOVSxL x
MO_SS_Conv W8 W16 -> integerExtend W8 W16 MOVSxL x
MO_UU_Conv W8 W64 | not is32Bit -> integerExtend W8 W64 MOVZxL x
MO_UU_Conv W16 W64 | not is32Bit -> integerExtend W16 W64 MOVZxL x
MO_UU_Conv W32 W64 | not is32Bit -> integerExtend W32 W64 MOVZxL x
MO_SS_Conv W8 W64 | not is32Bit -> integerExtend W8 W64 MOVSxL x
MO_SS_Conv W16 W64 | not is32Bit -> integerExtend W16 W64 MOVSxL x
MO_SS_Conv W32 W64 | not is32Bit -> integerExtend W32 W64 MOVSxL x
-- for 32-to-64 bit zero extension, amd64 uses an ordinary movl.
-- However, we don't want the register allocator to throw it
-- away as an unnecessary reg-to-reg move, so we keep it in
-- the form of a movzl and print it as a movl later.
MO_FF_Conv W32 W64
| sse2 -> coerceFP2FP W64 x
| otherwise -> conversionNop FF80 x
MO_FF_Conv W64 W32 -> coerceFP2FP W32 x
MO_FS_Conv from to -> coerceFP2Int from to x
MO_SF_Conv from to -> coerceInt2FP from to x
MO_V_Insert {} -> needLlvm
MO_V_Extract {} -> needLlvm
MO_V_Add {} -> needLlvm
MO_V_Sub {} -> needLlvm
MO_V_Mul {} -> needLlvm
MO_VS_Quot {} -> needLlvm
MO_VS_Rem {} -> needLlvm
MO_VS_Neg {} -> needLlvm
MO_VU_Quot {} -> needLlvm
MO_VU_Rem {} -> needLlvm
MO_VF_Insert {} -> needLlvm
MO_VF_Extract {} -> needLlvm
MO_VF_Add {} -> needLlvm
MO_VF_Sub {} -> needLlvm
MO_VF_Mul {} -> needLlvm
MO_VF_Quot {} -> needLlvm
MO_VF_Neg {} -> needLlvm
_other -> pprPanic "getRegister" (pprMachOp mop)
where
triv_ucode :: (Format -> Operand -> Instr) -> Format -> NatM Register
triv_ucode instr format = trivialUCode format (instr format) x
-- signed or unsigned extension.
integerExtend :: Width -> Width
-> (Format -> Operand -> Operand -> Instr)
-> CmmExpr -> NatM Register
integerExtend from to instr expr = do
(reg,e_code) <- if from == W8 then getByteReg expr
else getSomeReg expr
let
code dst =
e_code `snocOL`
instr (intFormat from) (OpReg reg) (OpReg dst)
return (Any (intFormat to) code)
toI8Reg :: Width -> CmmExpr -> NatM Register
toI8Reg new_rep expr
= do codefn <- getAnyReg expr
return (Any (intFormat new_rep) codefn)
-- HACK: use getAnyReg to get a byte-addressable register.
-- If the source was a Fixed register, this will add the
-- mov instruction to put it into the desired destination.
-- We're assuming that the destination won't be a fixed
-- non-byte-addressable register; it won't be, because all
-- fixed registers are word-sized.
toI16Reg = toI8Reg -- for now
conversionNop :: Format -> CmmExpr -> NatM Register
conversionNop new_format expr
= do e_code <- getRegister' dflags is32Bit expr
return (swizzleRegisterRep e_code new_format) | 4,696 | getRegister' dflags is32Bit (CmmMachOp mop [x]) = do -- unary MachOps
sse2 <- sse2Enabled
case mop of
MO_F_Neg w
| sse2 -> sse2NegCode w x
| otherwise -> trivialUFCode FF80 (GNEG FF80) x
MO_S_Neg w -> triv_ucode NEGI (intFormat w)
MO_Not w -> triv_ucode NOT (intFormat w)
-- Nop conversions
MO_UU_Conv W32 W8 -> toI8Reg W32 x
MO_SS_Conv W32 W8 -> toI8Reg W32 x
MO_UU_Conv W16 W8 -> toI8Reg W16 x
MO_SS_Conv W16 W8 -> toI8Reg W16 x
MO_UU_Conv W32 W16 -> toI16Reg W32 x
MO_SS_Conv W32 W16 -> toI16Reg W32 x
MO_UU_Conv W64 W32 | not is32Bit -> conversionNop II64 x
MO_SS_Conv W64 W32 | not is32Bit -> conversionNop II64 x
MO_UU_Conv W64 W16 | not is32Bit -> toI16Reg W64 x
MO_SS_Conv W64 W16 | not is32Bit -> toI16Reg W64 x
MO_UU_Conv W64 W8 | not is32Bit -> toI8Reg W64 x
MO_SS_Conv W64 W8 | not is32Bit -> toI8Reg W64 x
MO_UU_Conv rep1 rep2 | rep1 == rep2 -> conversionNop (intFormat rep1) x
MO_SS_Conv rep1 rep2 | rep1 == rep2 -> conversionNop (intFormat rep1) x
-- widenings
MO_UU_Conv W8 W32 -> integerExtend W8 W32 MOVZxL x
MO_UU_Conv W16 W32 -> integerExtend W16 W32 MOVZxL x
MO_UU_Conv W8 W16 -> integerExtend W8 W16 MOVZxL x
MO_SS_Conv W8 W32 -> integerExtend W8 W32 MOVSxL x
MO_SS_Conv W16 W32 -> integerExtend W16 W32 MOVSxL x
MO_SS_Conv W8 W16 -> integerExtend W8 W16 MOVSxL x
MO_UU_Conv W8 W64 | not is32Bit -> integerExtend W8 W64 MOVZxL x
MO_UU_Conv W16 W64 | not is32Bit -> integerExtend W16 W64 MOVZxL x
MO_UU_Conv W32 W64 | not is32Bit -> integerExtend W32 W64 MOVZxL x
MO_SS_Conv W8 W64 | not is32Bit -> integerExtend W8 W64 MOVSxL x
MO_SS_Conv W16 W64 | not is32Bit -> integerExtend W16 W64 MOVSxL x
MO_SS_Conv W32 W64 | not is32Bit -> integerExtend W32 W64 MOVSxL x
-- for 32-to-64 bit zero extension, amd64 uses an ordinary movl.
-- However, we don't want the register allocator to throw it
-- away as an unnecessary reg-to-reg move, so we keep it in
-- the form of a movzl and print it as a movl later.
MO_FF_Conv W32 W64
| sse2 -> coerceFP2FP W64 x
| otherwise -> conversionNop FF80 x
MO_FF_Conv W64 W32 -> coerceFP2FP W32 x
MO_FS_Conv from to -> coerceFP2Int from to x
MO_SF_Conv from to -> coerceInt2FP from to x
MO_V_Insert {} -> needLlvm
MO_V_Extract {} -> needLlvm
MO_V_Add {} -> needLlvm
MO_V_Sub {} -> needLlvm
MO_V_Mul {} -> needLlvm
MO_VS_Quot {} -> needLlvm
MO_VS_Rem {} -> needLlvm
MO_VS_Neg {} -> needLlvm
MO_VU_Quot {} -> needLlvm
MO_VU_Rem {} -> needLlvm
MO_VF_Insert {} -> needLlvm
MO_VF_Extract {} -> needLlvm
MO_VF_Add {} -> needLlvm
MO_VF_Sub {} -> needLlvm
MO_VF_Mul {} -> needLlvm
MO_VF_Quot {} -> needLlvm
MO_VF_Neg {} -> needLlvm
_other -> pprPanic "getRegister" (pprMachOp mop)
where
triv_ucode :: (Format -> Operand -> Instr) -> Format -> NatM Register
triv_ucode instr format = trivialUCode format (instr format) x
-- signed or unsigned extension.
integerExtend :: Width -> Width
-> (Format -> Operand -> Operand -> Instr)
-> CmmExpr -> NatM Register
integerExtend from to instr expr = do
(reg,e_code) <- if from == W8 then getByteReg expr
else getSomeReg expr
let
code dst =
e_code `snocOL`
instr (intFormat from) (OpReg reg) (OpReg dst)
return (Any (intFormat to) code)
toI8Reg :: Width -> CmmExpr -> NatM Register
toI8Reg new_rep expr
= do codefn <- getAnyReg expr
return (Any (intFormat new_rep) codefn)
-- HACK: use getAnyReg to get a byte-addressable register.
-- If the source was a Fixed register, this will add the
-- mov instruction to put it into the desired destination.
-- We're assuming that the destination won't be a fixed
-- non-byte-addressable register; it won't be, because all
-- fixed registers are word-sized.
toI16Reg = toI8Reg -- for now
conversionNop :: Format -> CmmExpr -> NatM Register
conversionNop new_format expr
= do e_code <- getRegister' dflags is32Bit expr
return (swizzleRegisterRep e_code new_format) | 4,696 | false | false | 1 | 13 | 1,561 | 1,352 | 613 | 739 | null | null |
beni55/hscurses | UI/HSCurses/CursesHelper.hs | lgpl-2.1 | displayKey KeyEnd = "<End>" | 27 | displayKey KeyEnd = "<End>" | 27 | displayKey KeyEnd = "<End>" | 27 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
RoboNickBot/talkbot | src/TalkBot/Data.hs | gpl-3.0 | tDist :: TBlob -> TBlob -> TDist
tDist tb1 tb2 =
if tb1 == tb2
then Perfect
else Score $ length (tIntersect tb1 tb2) | 123 | tDist :: TBlob -> TBlob -> TDist
tDist tb1 tb2 =
if tb1 == tb2
then Perfect
else Score $ length (tIntersect tb1 tb2) | 123 | tDist tb1 tb2 =
if tb1 == tb2
then Perfect
else Score $ length (tIntersect tb1 tb2) | 90 | false | true | 2 | 8 | 30 | 58 | 27 | 31 | null | null |
jbaum98/graphics | src/Data/Picture/Drawing/Lighting.hs | bsd-3-clause | boundColor :: Double -> Double
boundColor n | n < 0 = 0 | 55 | boundColor :: Double -> Double
boundColor n | n < 0 = 0 | 55 | boundColor n | n < 0 = 0 | 24 | false | true | 0 | 8 | 12 | 28 | 13 | 15 | null | null |
bos/text-format | benchmarks/Simple.hs | bsd-2-clause | dpi :: Double
dpi = pi | 22 | dpi :: Double
dpi = pi | 22 | dpi = pi | 8 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
ian-ross/cabal | Cabal/Distribution/Simple/Setup.hs | bsd-3-clause | defaultInstallFlags :: InstallFlags
defaultInstallFlags = InstallFlags {
installPackageDB = NoFlag,
installDistPref = NoFlag,
installUseWrapper = Flag False,
installInPlace = Flag False,
installVerbosity = Flag normal
} | 246 | defaultInstallFlags :: InstallFlags
defaultInstallFlags = InstallFlags {
installPackageDB = NoFlag,
installDistPref = NoFlag,
installUseWrapper = Flag False,
installInPlace = Flag False,
installVerbosity = Flag normal
} | 246 | defaultInstallFlags = InstallFlags {
installPackageDB = NoFlag,
installDistPref = NoFlag,
installUseWrapper = Flag False,
installInPlace = Flag False,
installVerbosity = Flag normal
} | 210 | false | true | 0 | 8 | 52 | 59 | 31 | 28 | null | null |
themoritz/cabal | cabal-testsuite/tests/fail.test.hs | bsd-3-clause | main = setupTest $ do
-- the following is a hack to check that `setup configure` indeed
-- fails: all tests use `assertFailure` which uses `error` if the fail
--
-- note: we cannot use `fails $ do ...` here since that only checks that all
-- assertions fail. If there is no assertion in `m`, then `fails m` will *succeed*.
-- That's not what we want. So `fails (return ())` for example succeeds, even though
-- `return ()` doesn't fail.
succeededRef <- liftIO $ newIORef True
setup "configure" [] `Catch.catch` \(_ :: ErrorCall) ->
liftIO $ writeIORef succeededRef False
succeeded <- liftIO $ readIORef succeededRef
assertBool "test should have failed, but succeeded instead (configure exits with failure)" $ not succeeded | 748 | main = setupTest $ do
-- the following is a hack to check that `setup configure` indeed
-- fails: all tests use `assertFailure` which uses `error` if the fail
--
-- note: we cannot use `fails $ do ...` here since that only checks that all
-- assertions fail. If there is no assertion in `m`, then `fails m` will *succeed*.
-- That's not what we want. So `fails (return ())` for example succeeds, even though
-- `return ()` doesn't fail.
succeededRef <- liftIO $ newIORef True
setup "configure" [] `Catch.catch` \(_ :: ErrorCall) ->
liftIO $ writeIORef succeededRef False
succeeded <- liftIO $ readIORef succeededRef
assertBool "test should have failed, but succeeded instead (configure exits with failure)" $ not succeeded | 748 | main = setupTest $ do
-- the following is a hack to check that `setup configure` indeed
-- fails: all tests use `assertFailure` which uses `error` if the fail
--
-- note: we cannot use `fails $ do ...` here since that only checks that all
-- assertions fail. If there is no assertion in `m`, then `fails m` will *succeed*.
-- That's not what we want. So `fails (return ())` for example succeeds, even though
-- `return ()` doesn't fail.
succeededRef <- liftIO $ newIORef True
setup "configure" [] `Catch.catch` \(_ :: ErrorCall) ->
liftIO $ writeIORef succeededRef False
succeeded <- liftIO $ readIORef succeededRef
assertBool "test should have failed, but succeeded instead (configure exits with failure)" $ not succeeded | 748 | false | false | 3 | 11 | 146 | 102 | 49 | 53 | null | null |
DavidAlphaFox/ghc | libraries/xhtml/Text/XHtml/Strict/Attributes.hs | bsd-3-clause | archive = strAttr "archive" | 41 | archive = strAttr "archive" | 41 | archive = strAttr "archive" | 41 | false | false | 0 | 5 | 17 | 9 | 4 | 5 | null | null |
jeroennoels/exact-real | test/Main.hs | mit | run _ = timeIt $ sequence_ $ map putStrLn $ toImage $ sortWalk $ sampleMandelbrot | 81 | run _ = timeIt $ sequence_ $ map putStrLn $ toImage $ sortWalk $ sampleMandelbrot | 81 | run _ = timeIt $ sequence_ $ map putStrLn $ toImage $ sortWalk $ sampleMandelbrot | 81 | false | false | 0 | 9 | 14 | 32 | 15 | 17 | null | null |
ezyang/ghc | compiler/coreSyn/CoreStats.hs | bsd-3-clause | bindingStats :: TopLevelFlag -> Var -> CoreExpr -> CoreStats
bindingStats top_lvl v r = letBndrStats top_lvl v `plusCS` exprStats r | 131 | bindingStats :: TopLevelFlag -> Var -> CoreExpr -> CoreStats
bindingStats top_lvl v r = letBndrStats top_lvl v `plusCS` exprStats r | 131 | bindingStats top_lvl v r = letBndrStats top_lvl v `plusCS` exprStats r | 70 | false | true | 0 | 7 | 19 | 44 | 22 | 22 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/coreSyn/CoreUtils.hs | bsd-3-clause | exprIsCheap' good_app (Cast e _) = exprIsCheap' good_app e | 60 | exprIsCheap' good_app (Cast e _) = exprIsCheap' good_app e | 60 | exprIsCheap' good_app (Cast e _) = exprIsCheap' good_app e | 60 | false | false | 0 | 7 | 10 | 24 | 11 | 13 | null | null |
mkaput/janus | src/Language/Janus/AST.hs | mit | showVal (JDouble x) = show x | 28 | showVal (JDouble x) = show x | 28 | showVal (JDouble x) = show x | 28 | false | false | 0 | 6 | 5 | 19 | 8 | 11 | null | null |
ekmett/containers | Data/IntMap/Strict.hs | bsd-3-clause | -- | /O(n+m)/. Difference with a combining function. When two equal keys are
-- encountered, the combining function is applied to the key and both values.
-- If it returns 'Nothing', the element is discarded (proper set difference).
-- If it returns (@'Just' y@), the element is updated with a new value @y@.
--
-- > let f k al ar = if al == "b" then Just ((show k) ++ ":" ++ al ++ "|" ++ ar) else Nothing
-- > differenceWithKey f (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (3, "B"), (10, "C")])
-- > == singleton 3 "3:b|B"
differenceWithKey :: (Key -> a -> b -> Maybe a) -> IntMap a -> IntMap b -> IntMap a
differenceWithKey f m1 m2
= mergeWithKey f id (const Nil) m1 m2 | 688 | differenceWithKey :: (Key -> a -> b -> Maybe a) -> IntMap a -> IntMap b -> IntMap a
differenceWithKey f m1 m2
= mergeWithKey f id (const Nil) m1 m2 | 149 | differenceWithKey f m1 m2
= mergeWithKey f id (const Nil) m1 m2 | 65 | true | true | 0 | 10 | 139 | 82 | 43 | 39 | null | null |
rsasse/tamarin-prover | lib/theory/src/Theory.hs | gpl-3.0 | -- | Add intruder proof rules to left diff cache.
addIntrRuleACsDiffLeftDiff :: [IntrRuleAC] -> OpenDiffTheory -> OpenDiffTheory
addIntrRuleACsDiffLeftDiff rs' thy = modify (diffThyDiffCacheLeft) (\rs -> nub $ rs ++ rs') thy | 224 | addIntrRuleACsDiffLeftDiff :: [IntrRuleAC] -> OpenDiffTheory -> OpenDiffTheory
addIntrRuleACsDiffLeftDiff rs' thy = modify (diffThyDiffCacheLeft) (\rs -> nub $ rs ++ rs') thy | 174 | addIntrRuleACsDiffLeftDiff rs' thy = modify (diffThyDiffCacheLeft) (\rs -> nub $ rs ++ rs') thy | 95 | true | true | 0 | 9 | 30 | 54 | 29 | 25 | null | null |
jlamothe/passman | test/Spec/JSON.hs | lgpl-3.0 | g'' :: StdGen
(bar, g'') = newPWData g' | 39 | g'' :: StdGen
(bar, g'') = newPWData g' | 39 | (bar, g'') = newPWData g' | 25 | false | true | 1 | 5 | 7 | 24 | 11 | 13 | null | null |
mthom/abominable-klambda-compiler | Compiler/CodeGenerator.hs | bsd-3-clause | expr (ETrapError test handler)
| [ELambda e hcode] <- handler =
infixE (Just (doE (stmts test))) (funcExpT "catchError")
(Just (lamE [bangP (varP e)] (doE (stmts hcode))))
| otherwise = error "trap-error: type violation." | 321 | expr (ETrapError test handler)
| [ELambda e hcode] <- handler =
infixE (Just (doE (stmts test))) (funcExpT "catchError")
(Just (lamE [bangP (varP e)] (doE (stmts hcode))))
| otherwise = error "trap-error: type violation." | 321 | expr (ETrapError test handler)
| [ELambda e hcode] <- handler =
infixE (Just (doE (stmts test))) (funcExpT "catchError")
(Just (lamE [bangP (varP e)] (doE (stmts hcode))))
| otherwise = error "trap-error: type violation." | 321 | false | false | 0 | 14 | 132 | 116 | 55 | 61 | null | null |
fmapfmapfmap/amazonka | amazonka-cloudwatch-logs/gen/Network/AWS/CloudWatchLogs/PutDestination.hs | mpl-2.0 | -- | The ARN of an IAM role that grants Amazon CloudWatch Logs permissions to
-- do Amazon Kinesis PutRecord requests on the desitnation stream.
pdRoleARN :: Lens' PutDestination Text
pdRoleARN = lens _pdRoleARN (\ s a -> s{_pdRoleARN = a}) | 240 | pdRoleARN :: Lens' PutDestination Text
pdRoleARN = lens _pdRoleARN (\ s a -> s{_pdRoleARN = a}) | 95 | pdRoleARN = lens _pdRoleARN (\ s a -> s{_pdRoleARN = a}) | 56 | true | true | 0 | 9 | 40 | 41 | 23 | 18 | null | null |
fffej/sql-server-gen | src/Database/SqlServer/Create/DataType.hs | bsd-2-clause | storageOptions (SmallDateTime s) = s | 36 | storageOptions (SmallDateTime s) = s | 36 | storageOptions (SmallDateTime s) = s | 36 | false | false | 0 | 7 | 4 | 15 | 7 | 8 | null | null |
Hi-Angel/yi | yi-core/src/Yi/Misc.hs | gpl-2.0 | -- | A simple wrapper to adjust the current indentation using
-- the mode specific indentation function but according to the
-- given indent behaviour.
adjIndent :: IndentBehaviour -> BufferM ()
adjIndent ib = withSyntaxB' (\m s -> modeIndent m s ib) | 250 | adjIndent :: IndentBehaviour -> BufferM ()
adjIndent ib = withSyntaxB' (\m s -> modeIndent m s ib) | 98 | adjIndent ib = withSyntaxB' (\m s -> modeIndent m s ib) | 55 | true | true | 0 | 8 | 41 | 46 | 24 | 22 | null | null |
j5b/ps-pc | ConsoleOutput.hs | gpl-3.0 | conceptToConsole (Forall rel (Neg T)) = forallConsole++" "++rel++" ("++botConsole++")" | 86 | conceptToConsole (Forall rel (Neg T)) = forallConsole++" "++rel++" ("++botConsole++")" | 86 | conceptToConsole (Forall rel (Neg T)) = forallConsole++" "++rel++" ("++botConsole++")" | 86 | false | false | 0 | 9 | 8 | 44 | 21 | 23 | null | null |
sweirich/hs-inferno | test/G.hs | bsd-3-clause | ml3 = Let "id" Nothing ml1
(Pair (App (Var "id") (Bool True))
(App (Var "id") (Pair (Bool True) (Bool False)))) | 126 | ml3 = Let "id" Nothing ml1
(Pair (App (Var "id") (Bool True))
(App (Var "id") (Pair (Bool True) (Bool False)))) | 126 | ml3 = Let "id" Nothing ml1
(Pair (App (Var "id") (Bool True))
(App (Var "id") (Pair (Bool True) (Bool False)))) | 126 | false | false | 1 | 12 | 34 | 81 | 38 | 43 | null | null |
mydaum/cabal | Cabal/Distribution/GetOpt.hs | bsd-3-clause | errNoArg :: String -> OptKind a
errNoArg optStr = OptErr ("option `" ++ optStr ++ "' doesn't allow an argument\n") | 114 | errNoArg :: String -> OptKind a
errNoArg optStr = OptErr ("option `" ++ optStr ++ "' doesn't allow an argument\n") | 114 | errNoArg optStr = OptErr ("option `" ++ optStr ++ "' doesn't allow an argument\n") | 82 | false | true | 0 | 8 | 19 | 39 | 18 | 21 | null | null |
rueshyna/gogol | gogol-servicecontrol/gen/Network/Google/ServiceControl/Types/Product.hs | mpl-2.0 | -- | End time of the operation. Required when the operation is used in
-- ServiceController.Report, but optional when the operation is used in
-- ServiceController.Check.
oEndTime :: Lens' Operation (Maybe UTCTime)
oEndTime
= lens _oEndTime (\ s a -> s{_oEndTime = a}) .
mapping _DateTime | 296 | oEndTime :: Lens' Operation (Maybe UTCTime)
oEndTime
= lens _oEndTime (\ s a -> s{_oEndTime = a}) .
mapping _DateTime | 125 | oEndTime
= lens _oEndTime (\ s a -> s{_oEndTime = a}) .
mapping _DateTime | 81 | true | true | 1 | 9 | 53 | 61 | 30 | 31 | null | null |
beni55/haste-compiler | libraries/ghc-7.10/base/Data/Traversable.hs | bsd-3-clause | -- | This function may be used as a value for `Data.Foldable.foldMap`
-- in a `Foldable` instance.
foldMapDefault :: (Traversable t, Monoid m) => (a -> m) -> t a -> m
foldMapDefault f = getConst . traverse (Const . f) | 217 | foldMapDefault :: (Traversable t, Monoid m) => (a -> m) -> t a -> m
foldMapDefault f = getConst . traverse (Const . f) | 118 | foldMapDefault f = getConst . traverse (Const . f) | 50 | true | true | 0 | 8 | 40 | 63 | 33 | 30 | null | null |
cacay/language-sill | Language/Krill/Utility/Pretty.hs | mit | rightArrow :: Doc
rightArrow = text "->" | 40 | rightArrow :: Doc
rightArrow = text "->" | 40 | rightArrow = text "->" | 22 | false | true | 0 | 5 | 6 | 14 | 7 | 7 | null | null |
flowbox-public/imagemagick | test/ImageTest.hs | apache-2.0 | test_signature :: IO ()
test_signature = withImage "mona-lisa.jpg" $ \w -> do
let signature = "f7695e173f691f59c5939e1898eafa6491bdf1439c60ecce7edfe4b3d101bf22"
testedSignature <- getImageSignature w
liftIO $ testedSignature @?= signature | 244 | test_signature :: IO ()
test_signature = withImage "mona-lisa.jpg" $ \w -> do
let signature = "f7695e173f691f59c5939e1898eafa6491bdf1439c60ecce7edfe4b3d101bf22"
testedSignature <- getImageSignature w
liftIO $ testedSignature @?= signature | 244 | test_signature = withImage "mona-lisa.jpg" $ \w -> do
let signature = "f7695e173f691f59c5939e1898eafa6491bdf1439c60ecce7edfe4b3d101bf22"
testedSignature <- getImageSignature w
liftIO $ testedSignature @?= signature | 220 | false | true | 0 | 11 | 30 | 58 | 27 | 31 | null | null |
sapek/pandoc | src/Text/Pandoc/Readers/Org.hs | gpl-2.0 | translateLang "sh" = "bash" | 35 | translateLang "sh" = "bash" | 35 | translateLang "sh" = "bash" | 35 | false | false | 0 | 5 | 11 | 9 | 4 | 5 | null | null |
Cahu/krpc-hs | src/KRPCHS/SpaceCenter.hs | gpl-3.0 | {-
- A list of resource names that can be stored.
-}
getResourcesNames :: KRPCHS.SpaceCenter.Resources -> RPCContext ([Data.Text.Text])
getResourcesNames thisArg = do
let r = makeRequest "SpaceCenter" "Resources_get_Names" [makeArgument 0 thisArg]
res <- sendRequest r
processResponse res | 302 | getResourcesNames :: KRPCHS.SpaceCenter.Resources -> RPCContext ([Data.Text.Text])
getResourcesNames thisArg = do
let r = makeRequest "SpaceCenter" "Resources_get_Names" [makeArgument 0 thisArg]
res <- sendRequest r
processResponse res | 247 | getResourcesNames thisArg = do
let r = makeRequest "SpaceCenter" "Resources_get_Names" [makeArgument 0 thisArg]
res <- sendRequest r
processResponse res | 164 | true | true | 0 | 13 | 50 | 79 | 37 | 42 | null | null |
supermitch/learn-haskell | real-world-haskell/ch04/Sum.hs | mit | -- We can also use currying to make this better. This gives us a function
-- of the same type!
niceSum' :: [Integer] -> Integer
niceSum' = foldl (+) 0 | 151 | niceSum' :: [Integer] -> Integer
niceSum' = foldl (+) 0 | 55 | niceSum' = foldl (+) 0 | 22 | true | true | 0 | 6 | 30 | 27 | 16 | 11 | null | null |
bgamari/shaking-up-ghc | src/Hadrian/Utilities.hs | bsd-3-clause | colourCode Yellow = "33" | 24 | colourCode Yellow = "33" | 24 | colourCode Yellow = "33" | 24 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
forste/haReFork | tools/base/AST/HasBaseStruct.hs | bsd-3-clause | kpred = base Kpred | 23 | kpred = base Kpred | 23 | kpred = base Kpred | 23 | false | false | 0 | 5 | 8 | 9 | 4 | 5 | null | null |
beni55/pandoc | src/Text/Pandoc/Writers/Docbook.hs | gpl-2.0 | alignmentToString :: Alignment -> [Char]
alignmentToString alignment = case alignment of
AlignLeft -> "left"
AlignRight -> "right"
AlignCenter -> "center"
AlignDefault -> "left" | 309 | alignmentToString :: Alignment -> [Char]
alignmentToString alignment = case alignment of
AlignLeft -> "left"
AlignRight -> "right"
AlignCenter -> "center"
AlignDefault -> "left" | 309 | alignmentToString alignment = case alignment of
AlignLeft -> "left"
AlignRight -> "right"
AlignCenter -> "center"
AlignDefault -> "left" | 268 | false | true | 0 | 8 | 154 | 53 | 26 | 27 | null | null |
nickbart1980/pandoc | src/Text/Pandoc/Writers/FB2.hs | gpl-2.0 | -- | Create a plain-text XML content.
txt :: String -> Content
txt s = Text $ CData CDataText s Nothing | 103 | txt :: String -> Content
txt s = Text $ CData CDataText s Nothing | 65 | txt s = Text $ CData CDataText s Nothing | 40 | true | true | 0 | 6 | 20 | 33 | 16 | 17 | null | null |
rumuki/rumuki-server | test/Handler/PlaybackGrantSpec.hs | gpl-3.0 | spec :: Spec
spec = withApp $ do
describe "getPlaybackGrantR" $ do
it "returns the decryptable key cipher text" $ do
device <- makeDevice
(Entity gid originalGrant) <- makeGrant device id
makeRequestWithGrantId gid
responseSatisfies "has key cipher text" $ \(Object o) ->
let (Object grant) = o ! "playbackGrant"
(String ct) = grant ! "keyCipher"
pubKey = (B64.decodeLenient . encodeUtf8) ct
in H.member "keyCipher" grant &&
H.member "keyOffset" grant &&
pubKey == playbackGrantKeyCipher originalGrant
it "removes the grant thereafter" $ do
(_, Entity gid _) <- makeRequest
statusIs 200
mGrant <- runDB $ DB.get gid
boolIsTrue "grant has been removed" $ isNothing mGrant
it "second request fails" $ do
(_, (Entity gid _)) <- makeRequest
statusIs 200
makeRequestWithGrantId gid
statusIs 404
it "does not return any expired grants" $ do
aMinuteAgo <- liftIO $ addUTCTime (-60) <$> getCurrentTime
device <- makeDevice
(Entity gid _) <- makeGrant device $ \g -> g { playbackGrantExpires = aMinuteAgo }
makeRequestWithGrantId gid
statusIs 404
it "does not succeed with a mismatched recording id" $ do
device <- makeDevice
(Entity gid _) <- makeGrant device $
\g -> g { playbackGrantRecordingUID = "notrecording123" }
makeRequestWithGrantId gid
statusIs 404
where
recordingUID = "recording123"
makeDevice = runDB $ retrieve $ factoryDevice id
makeGrant device transform = do
runDB $ factoryPlaybackGrant device $ \g ->
transform g { playbackGrantRecordingUID = recordingUID }
makeRequestWithGrantId gid = requestJSON $ do
setUrl (PlaybackGrantR recordingUID gid)
setMethod "GET"
makeRequest = do
device <- makeDevice
grant@(Entity gid _) <- makeGrant device id
makeRequestWithGrantId gid
return (device, grant) | 2,033 | spec :: Spec
spec = withApp $ do
describe "getPlaybackGrantR" $ do
it "returns the decryptable key cipher text" $ do
device <- makeDevice
(Entity gid originalGrant) <- makeGrant device id
makeRequestWithGrantId gid
responseSatisfies "has key cipher text" $ \(Object o) ->
let (Object grant) = o ! "playbackGrant"
(String ct) = grant ! "keyCipher"
pubKey = (B64.decodeLenient . encodeUtf8) ct
in H.member "keyCipher" grant &&
H.member "keyOffset" grant &&
pubKey == playbackGrantKeyCipher originalGrant
it "removes the grant thereafter" $ do
(_, Entity gid _) <- makeRequest
statusIs 200
mGrant <- runDB $ DB.get gid
boolIsTrue "grant has been removed" $ isNothing mGrant
it "second request fails" $ do
(_, (Entity gid _)) <- makeRequest
statusIs 200
makeRequestWithGrantId gid
statusIs 404
it "does not return any expired grants" $ do
aMinuteAgo <- liftIO $ addUTCTime (-60) <$> getCurrentTime
device <- makeDevice
(Entity gid _) <- makeGrant device $ \g -> g { playbackGrantExpires = aMinuteAgo }
makeRequestWithGrantId gid
statusIs 404
it "does not succeed with a mismatched recording id" $ do
device <- makeDevice
(Entity gid _) <- makeGrant device $
\g -> g { playbackGrantRecordingUID = "notrecording123" }
makeRequestWithGrantId gid
statusIs 404
where
recordingUID = "recording123"
makeDevice = runDB $ retrieve $ factoryDevice id
makeGrant device transform = do
runDB $ factoryPlaybackGrant device $ \g ->
transform g { playbackGrantRecordingUID = recordingUID }
makeRequestWithGrantId gid = requestJSON $ do
setUrl (PlaybackGrantR recordingUID gid)
setMethod "GET"
makeRequest = do
device <- makeDevice
grant@(Entity gid _) <- makeGrant device id
makeRequestWithGrantId gid
return (device, grant) | 2,033 | spec = withApp $ do
describe "getPlaybackGrantR" $ do
it "returns the decryptable key cipher text" $ do
device <- makeDevice
(Entity gid originalGrant) <- makeGrant device id
makeRequestWithGrantId gid
responseSatisfies "has key cipher text" $ \(Object o) ->
let (Object grant) = o ! "playbackGrant"
(String ct) = grant ! "keyCipher"
pubKey = (B64.decodeLenient . encodeUtf8) ct
in H.member "keyCipher" grant &&
H.member "keyOffset" grant &&
pubKey == playbackGrantKeyCipher originalGrant
it "removes the grant thereafter" $ do
(_, Entity gid _) <- makeRequest
statusIs 200
mGrant <- runDB $ DB.get gid
boolIsTrue "grant has been removed" $ isNothing mGrant
it "second request fails" $ do
(_, (Entity gid _)) <- makeRequest
statusIs 200
makeRequestWithGrantId gid
statusIs 404
it "does not return any expired grants" $ do
aMinuteAgo <- liftIO $ addUTCTime (-60) <$> getCurrentTime
device <- makeDevice
(Entity gid _) <- makeGrant device $ \g -> g { playbackGrantExpires = aMinuteAgo }
makeRequestWithGrantId gid
statusIs 404
it "does not succeed with a mismatched recording id" $ do
device <- makeDevice
(Entity gid _) <- makeGrant device $
\g -> g { playbackGrantRecordingUID = "notrecording123" }
makeRequestWithGrantId gid
statusIs 404
where
recordingUID = "recording123"
makeDevice = runDB $ retrieve $ factoryDevice id
makeGrant device transform = do
runDB $ factoryPlaybackGrant device $ \g ->
transform g { playbackGrantRecordingUID = recordingUID }
makeRequestWithGrantId gid = requestJSON $ do
setUrl (PlaybackGrantR recordingUID gid)
setMethod "GET"
makeRequest = do
device <- makeDevice
grant@(Entity gid _) <- makeGrant device id
makeRequestWithGrantId gid
return (device, grant) | 2,020 | false | true | 0 | 23 | 582 | 584 | 268 | 316 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.