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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
TWal/ENS_adac | src/Asm.hs | bsd-3-clause | r10 = R10 | 9 | r10 = R10 | 9 | r10 = R10 | 9 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
manpages/haskonf | test/Haskonf/HaskonfSpec.hs | bsd-2-clause | mainDo :: [String] -> IO ()
mainDo ("--rebuild":xs) = do
_ <- rebuild pname
-- -^- Bad: errors should be addressed in real applications
launch xs | 157 | mainDo :: [String] -> IO ()
mainDo ("--rebuild":xs) = do
_ <- rebuild pname
-- -^- Bad: errors should be addressed in real applications
launch xs | 157 | mainDo ("--rebuild":xs) = do
_ <- rebuild pname
-- -^- Bad: errors should be addressed in real applications
launch xs | 129 | false | true | 0 | 9 | 37 | 55 | 25 | 30 | null | null |
joelmccracken/git-stuff | src/Config.hs | bsd-3-clause | moreThanOneChar :: String -> Bool
moreThanOneChar str =
List.length str > 0 | 77 | moreThanOneChar :: String -> Bool
moreThanOneChar str =
List.length str > 0 | 77 | moreThanOneChar str =
List.length str > 0 | 43 | false | true | 0 | 7 | 13 | 27 | 13 | 14 | null | null |
jwiegley/github | src/GitHub/Endpoints/Repos/Webhooks.hs | bsd-3-clause | - | List hooks.
-- See <https://developer.github.com/v3/repos/hooks/#list-hooks>
webhooksForR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector RepoWebhook)
webhooksForR user repo =
pagedQuery ["repos", toPathPart user, toPathPart repo, "hooks"] []
| 265 | webhooksForR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector RepoWebhook)
webhooksForR user repo =
pagedQuery ["repos", toPathPart user, toPathPart repo, "hooks"] [] | 183 | webhooksForR user repo =
pagedQuery ["repos", toPathPart user, toPathPart repo, "hooks"] [] | 95 | true | true | 1 | 9 | 37 | 60 | 34 | 26 | null | null |
sumitsahrawat/IHaskell | main/Main.hs | mit | replyTo _ CommInfoRequest{} replyHeader state =
let comms = Map.mapKeys (UUID.uuidToString) (openComms state) in
return
(state, CommInfoReply
{ header = replyHeader
, commInfo = Map.map (\(Widget w) -> targetName w) comms
}) | 274 | replyTo _ CommInfoRequest{} replyHeader state =
let comms = Map.mapKeys (UUID.uuidToString) (openComms state) in
return
(state, CommInfoReply
{ header = replyHeader
, commInfo = Map.map (\(Widget w) -> targetName w) comms
}) | 274 | replyTo _ CommInfoRequest{} replyHeader state =
let comms = Map.mapKeys (UUID.uuidToString) (openComms state) in
return
(state, CommInfoReply
{ header = replyHeader
, commInfo = Map.map (\(Widget w) -> targetName w) comms
}) | 274 | false | false | 1 | 13 | 81 | 95 | 49 | 46 | null | null |
Xophmeister/tapestry | Encode.hs | mit | tr :: String -> String
tr = simpleTag "tr" | 42 | tr :: String -> String
tr = simpleTag "tr" | 42 | tr = simpleTag "tr" | 19 | false | true | 0 | 7 | 8 | 25 | 10 | 15 | null | null |
haasn/colour | Data/Colour/Names.hs | mit | mediumvioletred :: (Ord a, Floating a) => Colour a
mediumvioletred = sRGB24 199 21 133 | 86 | mediumvioletred :: (Ord a, Floating a) => Colour a
mediumvioletred = sRGB24 199 21 133 | 86 | mediumvioletred = sRGB24 199 21 133 | 35 | false | true | 0 | 7 | 14 | 43 | 19 | 24 | null | null |
randen/haddock | haddock-api/src/Haddock/Interface/Create.hs | bsd-2-clause | parseOption "not-home" = return (Just OptNotHome) | 56 | parseOption "not-home" = return (Just OptNotHome) | 56 | parseOption "not-home" = return (Just OptNotHome) | 56 | false | false | 0 | 7 | 12 | 18 | 8 | 10 | null | null |
wavewave/hoodle-core | src/Hoodle/Type/Canvas.hs | gpl-3.0 | -- |
defaultEraserWCS :: WidthColorStyle
defaultEraserWCS = WidthColorStyle predefined_eraser_medium ColorWhite | 112 | defaultEraserWCS :: WidthColorStyle
defaultEraserWCS = WidthColorStyle predefined_eraser_medium ColorWhite | 106 | defaultEraserWCS = WidthColorStyle predefined_eraser_medium ColorWhite | 70 | true | true | 0 | 6 | 10 | 23 | 10 | 13 | null | null |
sdiehl/ghc | libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs | bsd-3-clause | isStrict, notStrict, unpacked :: Quote m => m Strict
isStrict = bang noSourceUnpackedness sourceStrict | 102 | isStrict, notStrict, unpacked :: Quote m => m Strict
isStrict = bang noSourceUnpackedness sourceStrict | 102 | isStrict = bang noSourceUnpackedness sourceStrict | 49 | false | true | 0 | 6 | 13 | 30 | 16 | 14 | null | null |
expipiplus1/minizinc | src/Language/MiniZinc/Builder/Internal.hs | mit | conjoin :: Foldable f => f (Expression 'Bool) -> Expression 'Bool
conjoin xs | null xs = true
| otherwise = foldl1 (/\) xs | 133 | conjoin :: Foldable f => f (Expression 'Bool) -> Expression 'Bool
conjoin xs | null xs = true
| otherwise = foldl1 (/\) xs | 133 | conjoin xs | null xs = true
| otherwise = foldl1 (/\) xs | 67 | false | true | 0 | 10 | 34 | 69 | 31 | 38 | null | null |
mcschroeder/ghc | compiler/hsSyn/HsPat.hs | bsd-3-clause | pprUserCon :: (OutputableBndr con, OutputableBndr id) => con -> HsConPatDetails id -> SDoc
pprUserCon c (InfixCon p1 p2) = ppr p1 <+> pprInfixOcc c <+> ppr p2 | 158 | pprUserCon :: (OutputableBndr con, OutputableBndr id) => con -> HsConPatDetails id -> SDoc
pprUserCon c (InfixCon p1 p2) = ppr p1 <+> pprInfixOcc c <+> ppr p2 | 158 | pprUserCon c (InfixCon p1 p2) = ppr p1 <+> pprInfixOcc c <+> ppr p2 | 67 | false | true | 0 | 8 | 26 | 67 | 32 | 35 | null | null |
brendanhay/gogol | gogol-monitoring/gen/Network/Google/Resource/Monitoring/Projects/Groups/List.hs | mpl-2.0 | -- | Required. The project
-- (https:\/\/cloud.google.com\/monitoring\/api\/v3#project_name) whose
-- groups are to be listed. The format is: projects\/[PROJECT_ID_OR_NUMBER]
pglName :: Lens' ProjectsGroupsList Text
pglName = lens _pglName (\ s a -> s{_pglName = a}) | 266 | pglName :: Lens' ProjectsGroupsList Text
pglName = lens _pglName (\ s a -> s{_pglName = a}) | 91 | pglName = lens _pglName (\ s a -> s{_pglName = a}) | 50 | true | true | 1 | 9 | 33 | 45 | 24 | 21 | null | null |
tibbe/event | src/System/Event/Control.hs | bsd-2-clause | setNonBlock :: CInt -> IO ()
setNonBlock fd =
#if __GLASGOW_HASKELL__ >= 611
setNonBlockingFD fd True | 103 | setNonBlock :: CInt -> IO ()
setNonBlock fd =
#if __GLASGOW_HASKELL__ >= 611
setNonBlockingFD fd True | 103 | setNonBlock fd =
#if __GLASGOW_HASKELL__ >= 611
setNonBlockingFD fd True | 74 | false | true | 0 | 8 | 17 | 35 | 15 | 20 | null | null |
smobs/elblog | server/app/Main.hs | bsd-3-clause | getGameHandler :: ReaderT ServerData Handler GameView
getGameHandler = do
ref <- ask
liftIO (atomically $ readTVar (gameViewRef ref)) | 138 | getGameHandler :: ReaderT ServerData Handler GameView
getGameHandler = do
ref <- ask
liftIO (atomically $ readTVar (gameViewRef ref)) | 138 | getGameHandler = do
ref <- ask
liftIO (atomically $ readTVar (gameViewRef ref)) | 84 | false | true | 0 | 12 | 22 | 47 | 22 | 25 | null | null |
tjakway/ghcjvm | compiler/prelude/PrelNames.hs | bsd-3-clause | selectorClassKey = mkPreludeClassUnique 41 | 45 | selectorClassKey = mkPreludeClassUnique 41 | 45 | selectorClassKey = mkPreludeClassUnique 41 | 45 | false | false | 0 | 5 | 6 | 9 | 4 | 5 | null | null |
AlexeyRaga/eta | compiler/ETA/DeSugar/DsForeign.hs | bsd-3-clause | genJavaFCall :: ForeignCall -> ExtendsInfo -> [Type] -> Either PrimRep (Maybe Type) -> Type -> ForeignCall
genJavaFCall (CCall (CCallSpec (StaticTarget label mPkgKey isFun) JavaCallConv safety))
extendsInfo argTypes eResType ioResType
= CCall (CCallSpec (StaticTarget (mkFastString label') mPkgKey isFun) JavaCallConv safety)
where label' = serializeTarget hasObj hasSubclass (not (isJust mObj))
(unpackFS label) argFts resRep
argFts' = repFieldTypes argTypes
argFts = maybe argFts' (: argFts') mObj
resRep = either id (maybe VoidRep typePrimRep) eResType
(hasObj, hasSubclass, mObj) = case tcSplitJavaType_maybe ioResType of
Just (_, tagType, _)
| (hasSubclass, Just clsName) <- getArgClass extendsInfo tagType
-> (True, hasSubclass, Just $ obj clsName)
| otherwise -> (True, False, Nothing)
_ -> (False, False, Nothing) | 959 | genJavaFCall :: ForeignCall -> ExtendsInfo -> [Type] -> Either PrimRep (Maybe Type) -> Type -> ForeignCall
genJavaFCall (CCall (CCallSpec (StaticTarget label mPkgKey isFun) JavaCallConv safety))
extendsInfo argTypes eResType ioResType
= CCall (CCallSpec (StaticTarget (mkFastString label') mPkgKey isFun) JavaCallConv safety)
where label' = serializeTarget hasObj hasSubclass (not (isJust mObj))
(unpackFS label) argFts resRep
argFts' = repFieldTypes argTypes
argFts = maybe argFts' (: argFts') mObj
resRep = either id (maybe VoidRep typePrimRep) eResType
(hasObj, hasSubclass, mObj) = case tcSplitJavaType_maybe ioResType of
Just (_, tagType, _)
| (hasSubclass, Just clsName) <- getArgClass extendsInfo tagType
-> (True, hasSubclass, Just $ obj clsName)
| otherwise -> (True, False, Nothing)
_ -> (False, False, Nothing) | 959 | genJavaFCall (CCall (CCallSpec (StaticTarget label mPkgKey isFun) JavaCallConv safety))
extendsInfo argTypes eResType ioResType
= CCall (CCallSpec (StaticTarget (mkFastString label') mPkgKey isFun) JavaCallConv safety)
where label' = serializeTarget hasObj hasSubclass (not (isJust mObj))
(unpackFS label) argFts resRep
argFts' = repFieldTypes argTypes
argFts = maybe argFts' (: argFts') mObj
resRep = either id (maybe VoidRep typePrimRep) eResType
(hasObj, hasSubclass, mObj) = case tcSplitJavaType_maybe ioResType of
Just (_, tagType, _)
| (hasSubclass, Just clsName) <- getArgClass extendsInfo tagType
-> (True, hasSubclass, Just $ obj clsName)
| otherwise -> (True, False, Nothing)
_ -> (False, False, Nothing) | 852 | false | true | 3 | 13 | 246 | 321 | 159 | 162 | null | null |
ribag/ganeti-experiments | src/Ganeti/Locking/Locks.hs | gpl-2.0 | lockLevel :: GanetiLocks -> LockLevel
lockLevel BGL = LevelCluster | 66 | lockLevel :: GanetiLocks -> LockLevel
lockLevel BGL = LevelCluster | 66 | lockLevel BGL = LevelCluster | 28 | false | true | 0 | 7 | 8 | 24 | 10 | 14 | null | null |
haskell-opengl/OpenGLRaw | src/Graphics/GL/Functions/F08.hs | bsd-3-clause | ptr_glFragmentLightfvSGIX :: FunPtr (GLenum -> GLenum -> Ptr GLfloat -> IO ())
ptr_glFragmentLightfvSGIX = unsafePerformIO $ getCommand "glFragmentLightfvSGIX" | 159 | ptr_glFragmentLightfvSGIX :: FunPtr (GLenum -> GLenum -> Ptr GLfloat -> IO ())
ptr_glFragmentLightfvSGIX = unsafePerformIO $ getCommand "glFragmentLightfvSGIX" | 159 | ptr_glFragmentLightfvSGIX = unsafePerformIO $ getCommand "glFragmentLightfvSGIX" | 80 | false | true | 2 | 10 | 17 | 46 | 21 | 25 | null | null |
utsav2601/cmpe295A | tools/flounder/GHBackend.hs | mit | export_function :: String -> C.Unit
export_function n =
C.GVarDecl C.Extern C.NonConst
(C.Function C.NoScope (C.TypeName "errval_t") params) name Nothing
where
name = export_fn_name n
params = [ C.Param (C.Ptr $ C.TypeName "void") "st",
C.Param (C.Ptr $ C.TypeName "idc_export_callback_fn") "export_cb",
C.Param (C.Ptr $ C.TypeName $ connect_callback_name n) "connect_cb",
C.Param (C.Ptr $ C.Struct "waitset") "ws",
C.Param (C.TypeName "idc_export_flags_t") "flags"] | 566 | export_function :: String -> C.Unit
export_function n =
C.GVarDecl C.Extern C.NonConst
(C.Function C.NoScope (C.TypeName "errval_t") params) name Nothing
where
name = export_fn_name n
params = [ C.Param (C.Ptr $ C.TypeName "void") "st",
C.Param (C.Ptr $ C.TypeName "idc_export_callback_fn") "export_cb",
C.Param (C.Ptr $ C.TypeName $ connect_callback_name n) "connect_cb",
C.Param (C.Ptr $ C.Struct "waitset") "ws",
C.Param (C.TypeName "idc_export_flags_t") "flags"] | 566 | export_function n =
C.GVarDecl C.Extern C.NonConst
(C.Function C.NoScope (C.TypeName "errval_t") params) name Nothing
where
name = export_fn_name n
params = [ C.Param (C.Ptr $ C.TypeName "void") "st",
C.Param (C.Ptr $ C.TypeName "idc_export_callback_fn") "export_cb",
C.Param (C.Ptr $ C.TypeName $ connect_callback_name n) "connect_cb",
C.Param (C.Ptr $ C.Struct "waitset") "ws",
C.Param (C.TypeName "idc_export_flags_t") "flags"] | 530 | false | true | 1 | 11 | 155 | 194 | 96 | 98 | null | null |
bos/critbit | tests/Properties/Common.hs | bsd-2-clause | -- | Compares functions taking two scalars
(=??=) :: Eq' a b => (t -> s -> a) -> (t -> s -> b) -> k -> t -> s -> Property
f =??= g = const $ \t s -> f t s =^= g t s | 164 | (=??=) :: Eq' a b => (t -> s -> a) -> (t -> s -> b) -> k -> t -> s -> Property
f =??= g = const $ \t s -> f t s =^= g t s | 121 | f =??= g = const $ \t s -> f t s =^= g t s | 42 | true | true | 0 | 13 | 47 | 97 | 49 | 48 | null | null |
mrakgr/futhark | src/Futhark/Optimise/Simplifier/Engine.hs | bsd-3-clause | simplifyExtLambda :: MonadEngine m =>
ExtLambda (InnerLore m)
-> [SubExp]
-> [(LParam (Lore m), SE.ScalExp, SE.ScalExp)]
-> m (ExtLambda (Lore m))
simplifyExtLambda lam@(ExtLambda params body rettype) nes parbnds = do
params' <- mapM (simplifyParam simplify) params
let paramnames = HS.fromList $ boundByExtLambda lam
rettype' <- mapM simplify rettype
par_blocker <- asksEngineEnv $ blockHoistPar . envHoistBlockers
body' <- enterLoop $
bindLParams params' $
localVtable extendSymTab $
blockIf (hasFree paramnames `orIf` isConsumed `orIf` par_blocker) $
simplifyBody (map (const Observe) rettype) body
let consumed_in_body = consumedInBody body'
paramWasConsumed p (Var arr)
| p `HS.member` consumed_in_body = consumedName arr
paramWasConsumed _ _ =
return ()
accparams = take (length nes) $ drop 1 params
zipWithM_ paramWasConsumed (map paramName accparams) nes
return $ ExtLambda params' body' rettype'
where extendSymTab vtb =
foldl (\ vt (i,l,u) ->
let i_name = paramName i
in ST.setUpperBound i_name u $
ST.setLowerBound i_name l vt
) vtb parbnds | 1,310 | simplifyExtLambda :: MonadEngine m =>
ExtLambda (InnerLore m)
-> [SubExp]
-> [(LParam (Lore m), SE.ScalExp, SE.ScalExp)]
-> m (ExtLambda (Lore m))
simplifyExtLambda lam@(ExtLambda params body rettype) nes parbnds = do
params' <- mapM (simplifyParam simplify) params
let paramnames = HS.fromList $ boundByExtLambda lam
rettype' <- mapM simplify rettype
par_blocker <- asksEngineEnv $ blockHoistPar . envHoistBlockers
body' <- enterLoop $
bindLParams params' $
localVtable extendSymTab $
blockIf (hasFree paramnames `orIf` isConsumed `orIf` par_blocker) $
simplifyBody (map (const Observe) rettype) body
let consumed_in_body = consumedInBody body'
paramWasConsumed p (Var arr)
| p `HS.member` consumed_in_body = consumedName arr
paramWasConsumed _ _ =
return ()
accparams = take (length nes) $ drop 1 params
zipWithM_ paramWasConsumed (map paramName accparams) nes
return $ ExtLambda params' body' rettype'
where extendSymTab vtb =
foldl (\ vt (i,l,u) ->
let i_name = paramName i
in ST.setUpperBound i_name u $
ST.setLowerBound i_name l vt
) vtb parbnds | 1,310 | simplifyExtLambda lam@(ExtLambda params body rettype) nes parbnds = do
params' <- mapM (simplifyParam simplify) params
let paramnames = HS.fromList $ boundByExtLambda lam
rettype' <- mapM simplify rettype
par_blocker <- asksEngineEnv $ blockHoistPar . envHoistBlockers
body' <- enterLoop $
bindLParams params' $
localVtable extendSymTab $
blockIf (hasFree paramnames `orIf` isConsumed `orIf` par_blocker) $
simplifyBody (map (const Observe) rettype) body
let consumed_in_body = consumedInBody body'
paramWasConsumed p (Var arr)
| p `HS.member` consumed_in_body = consumedName arr
paramWasConsumed _ _ =
return ()
accparams = take (length nes) $ drop 1 params
zipWithM_ paramWasConsumed (map paramName accparams) nes
return $ ExtLambda params' body' rettype'
where extendSymTab vtb =
foldl (\ vt (i,l,u) ->
let i_name = paramName i
in ST.setUpperBound i_name u $
ST.setLowerBound i_name l vt
) vtb parbnds | 1,088 | false | true | 36 | 8 | 406 | 356 | 188 | 168 | null | null |
mettekou/ghc | compiler/coreSyn/CoreSyn.hs | bsd-3-clause | isCompulsoryUnfolding :: Unfolding -> Bool
isCompulsoryUnfolding (CoreUnfolding { uf_src = InlineCompulsory }) = True | 117 | isCompulsoryUnfolding :: Unfolding -> Bool
isCompulsoryUnfolding (CoreUnfolding { uf_src = InlineCompulsory }) = True | 117 | isCompulsoryUnfolding (CoreUnfolding { uf_src = InlineCompulsory }) = True | 74 | false | true | 3 | 7 | 13 | 37 | 17 | 20 | null | null |
rad1al/hutton_exercises | notes_ch11.hs | gpl-2.0 | showPlayer X = [" ", " X ", " "] | 36 | showPlayer X = [" ", " X ", " "] | 36 | showPlayer X = [" ", " X ", " "] | 36 | false | false | 1 | 5 | 13 | 21 | 10 | 11 | null | null |
fffej/HS-Poker | LookupPatternMatch.hs | bsd-3-clause | getValueFromProduct 38709 = 5917 | 32 | getValueFromProduct 38709 = 5917 | 32 | getValueFromProduct 38709 = 5917 | 32 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Generated/RTCPeerConnection.hs | mit | -- | <https://developer.mozilla.org/en-US/docs/Web/API/webkitRTCPeerConnection.signalingState Mozilla webkitRTCPeerConnection.signalingState documentation>
getSignalingState ::
(MonadDOM m) => RTCPeerConnection -> m RTCSignalingState
getSignalingState self
= liftDOM ((self ^. js "signalingState") >>= fromJSValUnchecked) | 342 | getSignalingState ::
(MonadDOM m) => RTCPeerConnection -> m RTCSignalingState
getSignalingState self
= liftDOM ((self ^. js "signalingState") >>= fromJSValUnchecked) | 185 | getSignalingState self
= liftDOM ((self ^. js "signalingState") >>= fromJSValUnchecked) | 89 | true | true | 0 | 10 | 45 | 51 | 26 | 25 | null | null |
ygale/yesod | yesod-test/Yesod/Test.hs | mit | bodyEquals :: String -> YesodExample site ()
bodyEquals text = withResponse $ \ res ->
liftIO $ HUnit.assertBool ("Expected body to equal " ++ text) $
(simpleBody res) == encodeUtf8 (TL.pack text) | 202 | bodyEquals :: String -> YesodExample site ()
bodyEquals text = withResponse $ \ res ->
liftIO $ HUnit.assertBool ("Expected body to equal " ++ text) $
(simpleBody res) == encodeUtf8 (TL.pack text) | 202 | bodyEquals text = withResponse $ \ res ->
liftIO $ HUnit.assertBool ("Expected body to equal " ++ text) $
(simpleBody res) == encodeUtf8 (TL.pack text) | 157 | false | true | 4 | 8 | 37 | 81 | 39 | 42 | null | null |
ocramz/petsc-hs | examples/Test2.hs | gpl-3.0 | -- PETSC_EXTERN PetscErrorCode VecGetArray(Vec,PetscScalar**);
vecGetArray'' v p = [C.exp|int{VecGetArray($(Vec v), $(PetscScalar** p))}|] | 139 | vecGetArray'' v p = [C.exp|int{VecGetArray($(Vec v), $(PetscScalar** p))}|] | 76 | vecGetArray'' v p = [C.exp|int{VecGetArray($(Vec v), $(PetscScalar** p))}|] | 76 | true | false | 0 | 5 | 12 | 18 | 11 | 7 | null | null |
leshchevds/ganeti | src/Ganeti/Hs2Py/OpDoc.hs | bsd-2-clause | opInstanceShutdown :: String
opInstanceShutdown =
"Shutdown an instance." | 75 | opInstanceShutdown :: String
opInstanceShutdown =
"Shutdown an instance." | 75 | opInstanceShutdown =
"Shutdown an instance." | 46 | false | true | 0 | 4 | 9 | 11 | 6 | 5 | null | null |
kawu/ltag | src/NLP/LTAG/Rule.hs | bsd-2-clause | keepRule :: Monad m => Rule n t i f a -> RM n t i f a m ()
-- keepRule = RWS.tell . (:[])
keepRule = P.yield | 108 | keepRule :: Monad m => Rule n t i f a -> RM n t i f a m ()
keepRule = P.yield | 77 | keepRule = P.yield | 18 | true | true | 0 | 9 | 28 | 59 | 27 | 32 | null | null |
5outh/wyas | Evaluator.hs | gpl-2.0 | strBoolBinop :: (String -> String -> Bool)
-> [LispVal]
-> Either LispError LispVal
strBoolBinop = boolBinop unpackStr | 144 | strBoolBinop :: (String -> String -> Bool)
-> [LispVal]
-> Either LispError LispVal
strBoolBinop = boolBinop unpackStr | 144 | strBoolBinop = boolBinop unpackStr | 34 | false | true | 0 | 8 | 42 | 41 | 21 | 20 | null | null |
mlite/hLLVM | src/Llvm/Pass/RewriteDef.hs | bsd-3-clause | rwConversion :: MaybeChange a -> MaybeChange (Conversion a)
rwConversion f (Conversion co tv1 t) = do { tv1' <- f tv1
; return $ Conversion co tv1' t
} | 235 | rwConversion :: MaybeChange a -> MaybeChange (Conversion a)
rwConversion f (Conversion co tv1 t) = do { tv1' <- f tv1
; return $ Conversion co tv1' t
} | 235 | rwConversion f (Conversion co tv1 t) = do { tv1' <- f tv1
; return $ Conversion co tv1' t
} | 175 | false | true | 0 | 8 | 112 | 74 | 34 | 40 | null | null |
green-haskell/ghc | compiler/coreSyn/MkCore.hs | bsd-3-clause | undefinedName :: Name
undefinedName = mkWiredInIdName gHC_ERR (fsLit "undefined") undefinedKey uNDEFINED_ID | 107 | undefinedName :: Name
undefinedName = mkWiredInIdName gHC_ERR (fsLit "undefined") undefinedKey uNDEFINED_ID | 107 | undefinedName = mkWiredInIdName gHC_ERR (fsLit "undefined") undefinedKey uNDEFINED_ID | 85 | false | true | 0 | 7 | 10 | 26 | 13 | 13 | null | null |
Philonous/xml-picklers | src/Data/XML/Pickle.hs | bsd-3-clause | -- | 'xp2Tuple'.
(<#>) :: PU [a] b1 -> PU [a] b2 -> PU [a] (b1, b2)
(<#>) l r = "(<#>)" <??> xp2Tuple l r | 105 | (<#>) :: PU [a] b1 -> PU [a] b2 -> PU [a] (b1, b2)
(<#>) l r = "(<#>)" <??> xp2Tuple l r | 88 | (<#>) l r = "(<#>)" <??> xp2Tuple l r | 37 | true | true | 2 | 9 | 25 | 73 | 38 | 35 | null | null |
shlevy/ghc | compiler/hsSyn/HsUtils.hs | bsd-3-clause | isInfixFunBind :: HsBindLR id1 id2 -> Bool
isInfixFunBind (FunBind _ (MG matches _ _ _) _ _ _)
= any (isInfixMatch . unLoc) (unLoc matches) | 141 | isInfixFunBind :: HsBindLR id1 id2 -> Bool
isInfixFunBind (FunBind _ (MG matches _ _ _) _ _ _)
= any (isInfixMatch . unLoc) (unLoc matches) | 141 | isInfixFunBind (FunBind _ (MG matches _ _ _) _ _ _)
= any (isInfixMatch . unLoc) (unLoc matches) | 98 | false | true | 0 | 9 | 26 | 67 | 33 | 34 | null | null |
girving/duck | duck/ParseOps.hs | bsd-3-clause | prettyop f a = prettyap f a | 27 | prettyop f a = prettyap f a | 27 | prettyop f a = prettyap f a | 27 | false | false | 0 | 5 | 6 | 16 | 7 | 9 | null | null |
DavidAlphaFox/ghc | compiler/basicTypes/Id.hs | bsd-3-clause | zapFragileIdInfo :: Id -> Id
zapFragileIdInfo = zapInfo zapFragileInfo | 70 | zapFragileIdInfo :: Id -> Id
zapFragileIdInfo = zapInfo zapFragileInfo | 70 | zapFragileIdInfo = zapInfo zapFragileInfo | 41 | false | true | 0 | 7 | 8 | 24 | 10 | 14 | null | null |
Proclivis/wxHaskell | samples/contrib/NotebookRight.hs | lgpl-2.1 | main :: IO ()
main
= start gui | 32 | main :: IO ()
main
= start gui | 32 | main
= start gui | 18 | false | true | 0 | 7 | 9 | 25 | 10 | 15 | null | null |
rfranek/duckling | Duckling/TimeGrain/IT/Rules.hs | bsd-3-clause | rules :: [Rule]
rules = map go grains
where
go (name, regexPattern, grain) = Rule
{ name = name
, pattern = [regex regexPattern]
, prod = \_ -> Just $ Token TimeGrain grain
} | 204 | rules :: [Rule]
rules = map go grains
where
go (name, regexPattern, grain) = Rule
{ name = name
, pattern = [regex regexPattern]
, prod = \_ -> Just $ Token TimeGrain grain
} | 204 | rules = map go grains
where
go (name, regexPattern, grain) = Rule
{ name = name
, pattern = [regex regexPattern]
, prod = \_ -> Just $ Token TimeGrain grain
} | 188 | false | true | 0 | 10 | 64 | 91 | 46 | 45 | null | null |
topliceanu/learn | haskell/countdown.hs | mit | -- sort the
isValid Sub x y = x > y | 35 | isValid Sub x y = x > y | 23 | isValid Sub x y = x > y | 23 | true | false | 3 | 5 | 10 | 25 | 9 | 16 | null | null |
lostbean/sledge | src/Texture/Bingham/Constant.hs | gpl-3.0 | -- | Numerical calculation of 4th partial derivative of the normalization constant.
computedFdz4 :: Double -> Double -> Double -> Double -> Double
computedFdz4 z1 z2 z3 z4 = (-1) * dC (U.fromList [0,0,0,1]) (U.fromList [-z1, -z2, -z3, -z4]) | 240 | computedFdz4 :: Double -> Double -> Double -> Double -> Double
computedFdz4 z1 z2 z3 z4 = (-1) * dC (U.fromList [0,0,0,1]) (U.fromList [-z1, -z2, -z3, -z4]) | 156 | computedFdz4 z1 z2 z3 z4 = (-1) * dC (U.fromList [0,0,0,1]) (U.fromList [-z1, -z2, -z3, -z4]) | 93 | true | true | 0 | 10 | 38 | 104 | 55 | 49 | null | null |
nevrenato/Hets_Fork | Interfaces/Command.hs | gpl-2.0 | mkSelectCmd :: SelectCmd -> Command
mkSelectCmd s = SelectCmd s "" | 66 | mkSelectCmd :: SelectCmd -> Command
mkSelectCmd s = SelectCmd s "" | 66 | mkSelectCmd s = SelectCmd s "" | 30 | false | true | 0 | 5 | 10 | 23 | 11 | 12 | null | null |
cocreature/leksah | src/IDE/SourceCandy.hs | gpl-2.0 | candyParser :: CharParser () CandyTableI
candyParser = do
whiteSpace
ls <- P.many oneCandyParser
eof
return ls | 128 | candyParser :: CharParser () CandyTableI
candyParser = do
whiteSpace
ls <- P.many oneCandyParser
eof
return ls | 128 | candyParser = do
whiteSpace
ls <- P.many oneCandyParser
eof
return ls | 87 | false | true | 0 | 9 | 33 | 42 | 18 | 24 | null | null |
remusao/Hodor | src/Language/Brainfuck/Internals/Optim/Cancel.hs | bsd-3-clause | combine :: (Int -> Instr) -> Int -> (Int -> Instr) -> Int -> Instr
combine f1 i1 f2 i2
| i1 == i2 = Nope
| i1 > i2 = f1 (i1 - i2)
| otherwise = f2 (i2 - i1) | 171 | combine :: (Int -> Instr) -> Int -> (Int -> Instr) -> Int -> Instr
combine f1 i1 f2 i2
| i1 == i2 = Nope
| i1 > i2 = f1 (i1 - i2)
| otherwise = f2 (i2 - i1) | 171 | combine f1 i1 f2 i2
| i1 == i2 = Nope
| i1 > i2 = f1 (i1 - i2)
| otherwise = f2 (i2 - i1) | 104 | false | true | 2 | 9 | 56 | 100 | 50 | 50 | null | null |
beni55/hscurses | UI/HSCurses/Logging.hs | lgpl-2.1 | formatTime :: IO String
formatTime =
do let fmt = "%Y-%m-%d %H:%M:%S"
clockT <- getClockTime
calTime <- toCalendarTime clockT
let maxSdecLen = 5
sdec' = show $ ctPicosec calTime
sdec = if length sdec' > maxSdecLen
then take maxSdecLen sdec'
else sdec'
return (formatCalendarTime defaultTimeLocale fmt calTime
++ ":" ++ sdec) | 435 | formatTime :: IO String
formatTime =
do let fmt = "%Y-%m-%d %H:%M:%S"
clockT <- getClockTime
calTime <- toCalendarTime clockT
let maxSdecLen = 5
sdec' = show $ ctPicosec calTime
sdec = if length sdec' > maxSdecLen
then take maxSdecLen sdec'
else sdec'
return (formatCalendarTime defaultTimeLocale fmt calTime
++ ":" ++ sdec) | 435 | formatTime =
do let fmt = "%Y-%m-%d %H:%M:%S"
clockT <- getClockTime
calTime <- toCalendarTime clockT
let maxSdecLen = 5
sdec' = show $ ctPicosec calTime
sdec = if length sdec' > maxSdecLen
then take maxSdecLen sdec'
else sdec'
return (formatCalendarTime defaultTimeLocale fmt calTime
++ ":" ++ sdec) | 411 | false | true | 0 | 13 | 161 | 116 | 53 | 63 | null | null |
danse/haskellers | Foundation.hs | bsd-2-clause | fixBrowserId :: Creds App -> Handler ()
fixBrowserId creds
| credsPlugin creds == "browserid" = runDB $ do
liftIO $ putStrLn "here i am"
let email = credsIdent creds
x <- getBy $ UniqueIdent email
case x of
Just _ -> return ()
Nothing -> do
mu <- selectList [UserEmail ==. Just email, UserVerifiedEmail ==. True] [LimitTo 1]
case mu of
[Entity uid _] -> do
_ <- insert $ Ident email uid
return ()
_ -> return ()
| otherwise = return () | 619 | fixBrowserId :: Creds App -> Handler ()
fixBrowserId creds
| credsPlugin creds == "browserid" = runDB $ do
liftIO $ putStrLn "here i am"
let email = credsIdent creds
x <- getBy $ UniqueIdent email
case x of
Just _ -> return ()
Nothing -> do
mu <- selectList [UserEmail ==. Just email, UserVerifiedEmail ==. True] [LimitTo 1]
case mu of
[Entity uid _] -> do
_ <- insert $ Ident email uid
return ()
_ -> return ()
| otherwise = return () | 619 | fixBrowserId creds
| credsPlugin creds == "browserid" = runDB $ do
liftIO $ putStrLn "here i am"
let email = credsIdent creds
x <- getBy $ UniqueIdent email
case x of
Just _ -> return ()
Nothing -> do
mu <- selectList [UserEmail ==. Just email, UserVerifiedEmail ==. True] [LimitTo 1]
case mu of
[Entity uid _] -> do
_ <- insert $ Ident email uid
return ()
_ -> return ()
| otherwise = return () | 579 | false | true | 0 | 22 | 267 | 212 | 94 | 118 | null | null |
23Skidoo/snap-website | src/Main.hs | bsd-3-clause | main :: IO ()
main = serveSnaplet defaultConfig appInit | 55 | main :: IO ()
main = serveSnaplet defaultConfig appInit | 55 | main = serveSnaplet defaultConfig appInit | 41 | false | true | 0 | 6 | 8 | 21 | 10 | 11 | null | null |
kim/amazonka | amazonka-ec2/gen/Network/AWS/EC2/DescribeTags.hs | mpl-2.0 | -- | The maximum number of results to return for the request in a single page. The
-- remaining results of the initial request can be seen by sending another
-- request with the returned 'NextToken' value. This value can be between 5 and
-- 1000; if 'MaxResults' is given a value larger than 1000, only 1000 results are
-- returned.
dtMaxResults :: Lens' DescribeTags (Maybe Int)
dtMaxResults = lens _dtMaxResults (\s a -> s { _dtMaxResults = a }) | 447 | dtMaxResults :: Lens' DescribeTags (Maybe Int)
dtMaxResults = lens _dtMaxResults (\s a -> s { _dtMaxResults = a }) | 114 | dtMaxResults = lens _dtMaxResults (\s a -> s { _dtMaxResults = a }) | 67 | true | true | 0 | 9 | 79 | 50 | 29 | 21 | null | null |
bos/wreq | httpbin/HttpBin/Server.hs | bsd-3-clause | simpleAuth expect = do
req <- getRequest
case expect req of
Nothing -> modifyResponse $ setResponseCode 400
Just (expected, resp) ->
case getHeader "Authorization" (headers req) of
Nothing -> unauthorized
Just auth | auth == expected -> writeJSON $
resp <> [("authenticated", Bool True)]
| otherwise -> unauthorized | 407 | simpleAuth expect = do
req <- getRequest
case expect req of
Nothing -> modifyResponse $ setResponseCode 400
Just (expected, resp) ->
case getHeader "Authorization" (headers req) of
Nothing -> unauthorized
Just auth | auth == expected -> writeJSON $
resp <> [("authenticated", Bool True)]
| otherwise -> unauthorized | 407 | simpleAuth expect = do
req <- getRequest
case expect req of
Nothing -> modifyResponse $ setResponseCode 400
Just (expected, resp) ->
case getHeader "Authorization" (headers req) of
Nothing -> unauthorized
Just auth | auth == expected -> writeJSON $
resp <> [("authenticated", Bool True)]
| otherwise -> unauthorized | 407 | false | false | 0 | 17 | 139 | 123 | 58 | 65 | null | null |
chadbrewbaker/shellcheck | ShellCheck/Analytics.hs | gpl-3.0 | prop_subshellAssignmentCheck6 = verifyTree subshellAssignmentCheck "( export lol=$(ls); ); echo $lol;" | 105 | prop_subshellAssignmentCheck6 = verifyTree subshellAssignmentCheck "( export lol=$(ls); ); echo $lol;" | 105 | prop_subshellAssignmentCheck6 = verifyTree subshellAssignmentCheck "( export lol=$(ls); ); echo $lol;" | 105 | false | false | 0 | 5 | 12 | 11 | 5 | 6 | null | null |
skogsbaer/HTF | Test/Framework/Preprocessor.hs | lgpl-2.1 | progName :: String
progName = "htfpp" | 37 | progName :: String
progName = "htfpp" | 37 | progName = "htfpp" | 18 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
urbanslug/ghc | compiler/coreSyn/CoreSyn.hs | bsd-3-clause | deTagExpr (Coercion co) = Coercion co | 49 | deTagExpr (Coercion co) = Coercion co | 49 | deTagExpr (Coercion co) = Coercion co | 49 | false | false | 0 | 6 | 17 | 19 | 8 | 11 | null | null |
frantisekfarka/ghc-dsi | compiler/codeGen/StgCmmExtCode.hs | bsd-3-clause | emitAssign :: CmmReg -> CmmExpr -> CmmParse ()
emitAssign l r = code (F.emitAssign l r) | 88 | emitAssign :: CmmReg -> CmmExpr -> CmmParse ()
emitAssign l r = code (F.emitAssign l r) | 88 | emitAssign l r = code (F.emitAssign l r) | 40 | false | true | 0 | 9 | 16 | 47 | 21 | 26 | null | null |
kovach/web2 | src/REPL.hs | mit | freshActor :: SM Actor
freshActor = lift $ ActorObject <$> freshNode | 68 | freshActor :: SM Actor
freshActor = lift $ ActorObject <$> freshNode | 68 | freshActor = lift $ ActorObject <$> freshNode | 45 | false | true | 0 | 6 | 10 | 22 | 11 | 11 | null | null |
jeffwheeler/pointedlist | Data/List/PointedList.hs | bsd-3-clause | -- | Possibly delete the element at the focus, then move the element on the
-- right to the focus. If no element is on the right, focus on the element to
-- the left. If the deletion will cause the list to be empty, return
-- 'Nothing'.
deleteRight :: PointedList a -> Maybe (PointedList a)
deleteRight (PointedList [] _ [] ) = Nothing | 344 | deleteRight :: PointedList a -> Maybe (PointedList a)
deleteRight (PointedList [] _ [] ) = Nothing | 101 | deleteRight (PointedList [] _ [] ) = Nothing | 47 | true | true | 0 | 8 | 72 | 52 | 26 | 26 | null | null |
rahulmutt/ghcvm | compiler/Eta/Prelude/PrelNames.hs | bsd-3-clause | voidPrimTyConKey = mkPreludeTyConUnique 57 | 65 | voidPrimTyConKey = mkPreludeTyConUnique 57 | 65 | voidPrimTyConKey = mkPreludeTyConUnique 57 | 65 | false | false | 0 | 5 | 26 | 9 | 4 | 5 | null | null |
aelve/Jane | Notes.hs | mit | newNote ::
(IO' m, DB' m) =>
[NID] → -- ^ Note's children.
Text → -- ^ Note's title.
m NID -- ^ Created note's 'NID'.
newNote s t = do
nid ← genNid
timeStamp ← liftIO' getZonedTime
let n = Note {
_nid = nid,
_subs = s,
_title = t,
_created = timeStamp,
_lastModified = timeStamp }
notes.at nid .= Just n
return nid
-- | Makes a note a child of another note (without checking if it was already
-- a child!). | 532 | newNote ::
(IO' m, DB' m) =>
[NID] → -- ^ Note's children.
Text → -- ^ Note's title.
m NID
newNote s t = do
nid ← genNid
timeStamp ← liftIO' getZonedTime
let n = Note {
_nid = nid,
_subs = s,
_title = t,
_created = timeStamp,
_lastModified = timeStamp }
notes.at nid .= Just n
return nid
-- | Makes a note a child of another note (without checking if it was already
-- a child!). | 492 | newNote s t = do
nid ← genNid
timeStamp ← liftIO' getZonedTime
let n = Note {
_nid = nid,
_subs = s,
_title = t,
_created = timeStamp,
_lastModified = timeStamp }
notes.at nid .= Just n
return nid
-- | Makes a note a child of another note (without checking if it was already
-- a child!). | 370 | true | true | 0 | 12 | 210 | 134 | 69 | 65 | null | null |
thalerjonathan/phd | thesis/code/concurrent/sugarscape/SugarScapeSTMTVar/src/Model.hs | gpl-3.0 | -- NOTE: this is specified in book page 33 where the initial endowments are set to 5-25
sugarEndowmentRangeStandard :: (Double, Double)
sugarEndowmentRangeStandard = (5.0, 25.0) | 177 | sugarEndowmentRangeStandard :: (Double, Double)
sugarEndowmentRangeStandard = (5.0, 25.0) | 89 | sugarEndowmentRangeStandard = (5.0, 25.0) | 41 | true | true | 0 | 7 | 24 | 31 | 16 | 15 | null | null |
SamirTalwar/advent-of-code | 2021/AOC_18_1.hs | mit | magnitude :: Number -> Int
magnitude (Value n) = n | 50 | magnitude :: Number -> Int
magnitude (Value n) = n | 50 | magnitude (Value n) = n | 23 | false | true | 0 | 9 | 9 | 30 | 13 | 17 | null | null |
input-output-hk/pos-haskell-prototype | wallet/test/unit/Test/Spec/Submission.hs | mit | specBody :: ProtocolMagic -> Spec
specBody pm = do
describe "Test wallet submission layer" $ do
it "supports addition of pending transactions" $
withMaxSuccess 5 $ forAll (genPurePair pm) $ \(unSTB -> (submission, toAdd)) ->
let currentSlot = submission ^. getCurrentSlot
submission' = addPending' toAdd submission
schedule = submission' ^. getSchedule
((ScheduleEvents toSend _),_) = scheduledFor (mapSlot succ currentSlot) schedule
in conjoin [
failIf "localPending set not updated" shouldContainPending (submission' ^. localPendingSet myAccountId) toAdd
-- Check that all the added transactions are scheduled for the next slot
, failIf "not infix of" S.isSubsetOf (toTxIdSet' toAdd) (S.fromList $ toTxIds toSend)
]
it "supports deletion of pending transactions" $
withMaxSuccess 5 $ forAll (genPurePair pm) $ \(unSTB -> (submission, toRemove)) ->
doesNotContainPending toRemove $ remPendingById myAccountId (toTxIdSet' toRemove) submission
it "remPending . addPending = id" $
withMaxSuccess 5 $ forAll (genPurePair pm) $ \(unSTB -> (submission, pending)) ->
let originallyPending = submission ^. localPendingSet myAccountId
currentlyPending = view (localPendingSet myAccountId)
(remPendingById myAccountId
(toTxIdSet' pending)
(addPending' pending submission)
)
in failIf "the two pending set are not equal" ((==) `on` Pending.transactions) originallyPending currentlyPending
it "increases its internal slot after ticking" $ do
withMaxSuccess 5 $ forAll (genPureWalletSubmission pm myAccountId) $ \(unSTB -> submission) ->
let slotNow = submission ^. getCurrentSlot
(_, _, ws') = tick submission
in failIf "internal slot didn't increase" (==) (ws' ^. getCurrentSlot) (mapSlot succ slotNow)
it "constantRetry works predictably" $ do
let policy = constantRetry 1 5
conjoin [
policy (SubmissionCount 0) (Slot 0) === SendIn (Slot 1)
, policy (SubmissionCount 1) (Slot 1) === SendIn (Slot 2)
, policy (SubmissionCount 2) (Slot 2) === SendIn (Slot 3)
, policy (SubmissionCount 3) (Slot 3) === SendIn (Slot 4)
, policy (SubmissionCount 4) (Slot 4) === SendIn (Slot 5)
, policy (SubmissionCount 5) (Slot 5) === CheckConfirmedIn (Slot 6)
]
it "limit retries correctly" $ do
withMaxSuccess 5 $ forAll (genPurePair pm) $ \(unSTB -> (ws, pending)) ->
let ws' = (addPending' pending ws) & wsResubmissionFunction .~ giveUpAfter 3
(evicted1, _, ws1) = tick ws'
(evicted2, _, ws2) = tick ws1
(evicted3, _, ws3) = tick ws2
(evicted4, _, ws4) = tick ws3
(evicted5, _, ws5) = tick ws4
(evicted6, _, _) = tick ws5
in conjoin [
failIf "evicted1 includes any of pending" (\e p -> disjoint (toTxIdSet' p) (toTxIdSet'' e)) evicted1 pending
, failIf "evicted2 includes any of pending" (\e p -> disjoint (toTxIdSet' p) (toTxIdSet'' e)) evicted2 pending
, failIf "evicted3 includes any of pending" (\e p -> disjoint (toTxIdSet' p) (toTxIdSet'' e)) evicted3 pending
, failIf "evicted4 includes any of pending" (\e p -> disjoint (toTxIdSet' p) (toTxIdSet'' e)) evicted4 pending
, failIf "evicted5 doesn't contain all pending" (\e p -> (toTxIdSet' p) `S.isSubsetOf` (toTxIdSet'' e)) evicted5 pending
, failIf "evicted6 contains something from evicted5" (\e6 e5 -> disjoint (toTxIdSet'' e5) (toTxIdSet'' e6)) evicted6 evicted5
]
describe "tickSlot" $ do
-- Given A,B,C,D where D `dependsOn` C `dependsOn` B `dependsOn` A,
-- check that if these 4 are all scheduled within the same slot, they
-- are all scheduled for submission.
it "Given D->C->B->A all in the same slot, they are all sent" $ do
let generator = do (b,c,a,d) <- dependentTransactions pm
ws <- addPending myAccountId (pendingFromTxs (map labelledTxAux [a,b,c,d])) . unSTB <$> genPureWalletSubmission pm myAccountId
txs <- shuffle [b,c,a,d]
return $ STB (ws, txs)
withMaxSuccess 5 $ forAll generator $ \(unSTB -> (submission, txs)) ->
let currentSlot = submission ^. getCurrentSlot
schedule = submission ^. getSchedule
nxtSlot = mapSlot succ currentSlot
scheduledEvents = fst (scheduledFor nxtSlot schedule)
-- Tick directly the next slot, as 'addPending' schedules
-- everything for @currentSlot + 1@.
result = tickSlot nxtSlot submission
in case result of
(toSend, _, _) -> conjoin [
includeEvents "[a,b,c,d] not scheduled" scheduledEvents txs
, S.fromList (toTxIds txs) `isSubsetOf` S.fromList (toTxIds toSend)
]
-- Given A,B,C,D where D `dependsOn` C `dependsOn` B `dependsOn` A,
-- if [A,B,C] are scheduled on slot 2 and [D] on slot 1, we shouldn't
-- send anything.
it "Given D->C->B->A, if C,B,A are in the future, D is not sent this slot" $ do
let generator = do (b,c,a,d) <- dependentTransactions pm
ws <- addPending myAccountId (pendingFromTxs (map labelledTxAux [a,b,c])) . unSTB <$> genPureWalletSubmission pm myAccountId
return $ STB (addPending myAccountId (pendingFromTxs (map labelledTxAux [d])) ((\(_,_,s) -> s) . tick $ ws), d)
withMaxSuccess 5 $ forAll generator $ \(unSTB -> (submission, d)) ->
let currentSlot = submission ^. getCurrentSlot
schedule = submission ^. getSchedule
nxtSlot = mapSlot succ currentSlot
scheduledEvents = fst (scheduledFor nxtSlot schedule)
-- Tick directly the next slot, as 'addPending' schedules
-- everything for @currentSlot + 1@.
result = tickSlot nxtSlot submission
in case result of
(toSend, _, _) -> conjoin [
includeEvent "d scheduled" scheduledEvents d
, failIf "is subset of"
(\x y -> not $ S.isSubsetOf x y)
(S.fromList (toTxIds [d]))
(S.fromList (toTxIds toSend))
]
-- Given A,B,C,D where D `dependsOn` C `dependsOn` B `dependsOn` A, if:
-- * [A,B] are scheduled on slot 1
-- * [D] is scheduled on slot 2
-- * [C] is scheduled on slot 3
-- Then during slot 1 we would send both [A,B], on slot 2 we won't send
-- anything and finally on slot 3 we would send [C,D].
it "Given D->C->B->A, can send [A,B] now, [D,C] in the future" $ do
let generator :: Gen (ShowThroughBuild (WalletSubmission, [LabelledTxAux]))
generator = do (b,c,a,d) <- dependentTransactions pm
ws <- addPending myAccountId (pendingFromTxs (map labelledTxAux [a,b])) . unSTB <$> genPureWalletSubmission pm myAccountId
let (_, _, ws') = tick ws
let ws'' = addPending myAccountId (pendingFromTxs (map labelledTxAux [d])) ws'
return $ STB (ws'', [a,b,c,d])
withMaxSuccess 5 $ forAll generator $ \(unSTB -> (submission1, [a,b,c,d])) ->
let slot1 = submission1 ^. getCurrentSlot
(scheduledInSlot1, confirmed1, _) = tickSlot slot1 submission1
-- Let's assume that @A@ and @B@ finally are adopted,
-- and the wallet calls 'remPending' on them.
modifyPending = addPending myAccountId (pendingFromTxs (map labelledTxAux [c]))
. remPendingById myAccountId (toTxIdSet (pendingFromTxs (map labelledTxAux [a,b])))
(_, _, submission2) = (\(e,s,st) -> (e, s, modifyPending st)) . tick $ submission1
-- We are in slot 2 now. During slot 2, @D@ is scheduled and
-- we add @C@ to be sent during slot 3. However, due to
-- the fact @D@ is depedent on @C@, the scheduler shouldn't
-- schedule @D@, this slot, which will end up in the
-- nursery.
slot2 = submission2 ^. getCurrentSlot
(scheduledInSlot2, confirmed2, _) = tickSlot slot2 submission2
(_, _, submission3) = tick submission2
-- Finally, during slot 3, both @C@ and @D@ are sent.
slot3 = submission3 ^. getCurrentSlot
(scheduledInSlot3, confirmed3, _) = tickSlot slot3 submission3
in conjoin [
slot1 === Slot 1
, slot2 === Slot 2
, slot3 === Slot 3
, includeEvents "[a,b] scheduled slot 1" (ScheduleEvents scheduledInSlot1 confirmed1) [a,b]
, mustNotIncludeEvents "none of [a,b,c,d] was scheduled" (ScheduleEvents scheduledInSlot2 confirmed2) [a,b,c,d]
, includeEvents "[c,d] scheduled slot 3" (ScheduleEvents scheduledInSlot3 confirmed3) [c,d]
] | 10,340 | specBody :: ProtocolMagic -> Spec
specBody pm = do
describe "Test wallet submission layer" $ do
it "supports addition of pending transactions" $
withMaxSuccess 5 $ forAll (genPurePair pm) $ \(unSTB -> (submission, toAdd)) ->
let currentSlot = submission ^. getCurrentSlot
submission' = addPending' toAdd submission
schedule = submission' ^. getSchedule
((ScheduleEvents toSend _),_) = scheduledFor (mapSlot succ currentSlot) schedule
in conjoin [
failIf "localPending set not updated" shouldContainPending (submission' ^. localPendingSet myAccountId) toAdd
-- Check that all the added transactions are scheduled for the next slot
, failIf "not infix of" S.isSubsetOf (toTxIdSet' toAdd) (S.fromList $ toTxIds toSend)
]
it "supports deletion of pending transactions" $
withMaxSuccess 5 $ forAll (genPurePair pm) $ \(unSTB -> (submission, toRemove)) ->
doesNotContainPending toRemove $ remPendingById myAccountId (toTxIdSet' toRemove) submission
it "remPending . addPending = id" $
withMaxSuccess 5 $ forAll (genPurePair pm) $ \(unSTB -> (submission, pending)) ->
let originallyPending = submission ^. localPendingSet myAccountId
currentlyPending = view (localPendingSet myAccountId)
(remPendingById myAccountId
(toTxIdSet' pending)
(addPending' pending submission)
)
in failIf "the two pending set are not equal" ((==) `on` Pending.transactions) originallyPending currentlyPending
it "increases its internal slot after ticking" $ do
withMaxSuccess 5 $ forAll (genPureWalletSubmission pm myAccountId) $ \(unSTB -> submission) ->
let slotNow = submission ^. getCurrentSlot
(_, _, ws') = tick submission
in failIf "internal slot didn't increase" (==) (ws' ^. getCurrentSlot) (mapSlot succ slotNow)
it "constantRetry works predictably" $ do
let policy = constantRetry 1 5
conjoin [
policy (SubmissionCount 0) (Slot 0) === SendIn (Slot 1)
, policy (SubmissionCount 1) (Slot 1) === SendIn (Slot 2)
, policy (SubmissionCount 2) (Slot 2) === SendIn (Slot 3)
, policy (SubmissionCount 3) (Slot 3) === SendIn (Slot 4)
, policy (SubmissionCount 4) (Slot 4) === SendIn (Slot 5)
, policy (SubmissionCount 5) (Slot 5) === CheckConfirmedIn (Slot 6)
]
it "limit retries correctly" $ do
withMaxSuccess 5 $ forAll (genPurePair pm) $ \(unSTB -> (ws, pending)) ->
let ws' = (addPending' pending ws) & wsResubmissionFunction .~ giveUpAfter 3
(evicted1, _, ws1) = tick ws'
(evicted2, _, ws2) = tick ws1
(evicted3, _, ws3) = tick ws2
(evicted4, _, ws4) = tick ws3
(evicted5, _, ws5) = tick ws4
(evicted6, _, _) = tick ws5
in conjoin [
failIf "evicted1 includes any of pending" (\e p -> disjoint (toTxIdSet' p) (toTxIdSet'' e)) evicted1 pending
, failIf "evicted2 includes any of pending" (\e p -> disjoint (toTxIdSet' p) (toTxIdSet'' e)) evicted2 pending
, failIf "evicted3 includes any of pending" (\e p -> disjoint (toTxIdSet' p) (toTxIdSet'' e)) evicted3 pending
, failIf "evicted4 includes any of pending" (\e p -> disjoint (toTxIdSet' p) (toTxIdSet'' e)) evicted4 pending
, failIf "evicted5 doesn't contain all pending" (\e p -> (toTxIdSet' p) `S.isSubsetOf` (toTxIdSet'' e)) evicted5 pending
, failIf "evicted6 contains something from evicted5" (\e6 e5 -> disjoint (toTxIdSet'' e5) (toTxIdSet'' e6)) evicted6 evicted5
]
describe "tickSlot" $ do
-- Given A,B,C,D where D `dependsOn` C `dependsOn` B `dependsOn` A,
-- check that if these 4 are all scheduled within the same slot, they
-- are all scheduled for submission.
it "Given D->C->B->A all in the same slot, they are all sent" $ do
let generator = do (b,c,a,d) <- dependentTransactions pm
ws <- addPending myAccountId (pendingFromTxs (map labelledTxAux [a,b,c,d])) . unSTB <$> genPureWalletSubmission pm myAccountId
txs <- shuffle [b,c,a,d]
return $ STB (ws, txs)
withMaxSuccess 5 $ forAll generator $ \(unSTB -> (submission, txs)) ->
let currentSlot = submission ^. getCurrentSlot
schedule = submission ^. getSchedule
nxtSlot = mapSlot succ currentSlot
scheduledEvents = fst (scheduledFor nxtSlot schedule)
-- Tick directly the next slot, as 'addPending' schedules
-- everything for @currentSlot + 1@.
result = tickSlot nxtSlot submission
in case result of
(toSend, _, _) -> conjoin [
includeEvents "[a,b,c,d] not scheduled" scheduledEvents txs
, S.fromList (toTxIds txs) `isSubsetOf` S.fromList (toTxIds toSend)
]
-- Given A,B,C,D where D `dependsOn` C `dependsOn` B `dependsOn` A,
-- if [A,B,C] are scheduled on slot 2 and [D] on slot 1, we shouldn't
-- send anything.
it "Given D->C->B->A, if C,B,A are in the future, D is not sent this slot" $ do
let generator = do (b,c,a,d) <- dependentTransactions pm
ws <- addPending myAccountId (pendingFromTxs (map labelledTxAux [a,b,c])) . unSTB <$> genPureWalletSubmission pm myAccountId
return $ STB (addPending myAccountId (pendingFromTxs (map labelledTxAux [d])) ((\(_,_,s) -> s) . tick $ ws), d)
withMaxSuccess 5 $ forAll generator $ \(unSTB -> (submission, d)) ->
let currentSlot = submission ^. getCurrentSlot
schedule = submission ^. getSchedule
nxtSlot = mapSlot succ currentSlot
scheduledEvents = fst (scheduledFor nxtSlot schedule)
-- Tick directly the next slot, as 'addPending' schedules
-- everything for @currentSlot + 1@.
result = tickSlot nxtSlot submission
in case result of
(toSend, _, _) -> conjoin [
includeEvent "d scheduled" scheduledEvents d
, failIf "is subset of"
(\x y -> not $ S.isSubsetOf x y)
(S.fromList (toTxIds [d]))
(S.fromList (toTxIds toSend))
]
-- Given A,B,C,D where D `dependsOn` C `dependsOn` B `dependsOn` A, if:
-- * [A,B] are scheduled on slot 1
-- * [D] is scheduled on slot 2
-- * [C] is scheduled on slot 3
-- Then during slot 1 we would send both [A,B], on slot 2 we won't send
-- anything and finally on slot 3 we would send [C,D].
it "Given D->C->B->A, can send [A,B] now, [D,C] in the future" $ do
let generator :: Gen (ShowThroughBuild (WalletSubmission, [LabelledTxAux]))
generator = do (b,c,a,d) <- dependentTransactions pm
ws <- addPending myAccountId (pendingFromTxs (map labelledTxAux [a,b])) . unSTB <$> genPureWalletSubmission pm myAccountId
let (_, _, ws') = tick ws
let ws'' = addPending myAccountId (pendingFromTxs (map labelledTxAux [d])) ws'
return $ STB (ws'', [a,b,c,d])
withMaxSuccess 5 $ forAll generator $ \(unSTB -> (submission1, [a,b,c,d])) ->
let slot1 = submission1 ^. getCurrentSlot
(scheduledInSlot1, confirmed1, _) = tickSlot slot1 submission1
-- Let's assume that @A@ and @B@ finally are adopted,
-- and the wallet calls 'remPending' on them.
modifyPending = addPending myAccountId (pendingFromTxs (map labelledTxAux [c]))
. remPendingById myAccountId (toTxIdSet (pendingFromTxs (map labelledTxAux [a,b])))
(_, _, submission2) = (\(e,s,st) -> (e, s, modifyPending st)) . tick $ submission1
-- We are in slot 2 now. During slot 2, @D@ is scheduled and
-- we add @C@ to be sent during slot 3. However, due to
-- the fact @D@ is depedent on @C@, the scheduler shouldn't
-- schedule @D@, this slot, which will end up in the
-- nursery.
slot2 = submission2 ^. getCurrentSlot
(scheduledInSlot2, confirmed2, _) = tickSlot slot2 submission2
(_, _, submission3) = tick submission2
-- Finally, during slot 3, both @C@ and @D@ are sent.
slot3 = submission3 ^. getCurrentSlot
(scheduledInSlot3, confirmed3, _) = tickSlot slot3 submission3
in conjoin [
slot1 === Slot 1
, slot2 === Slot 2
, slot3 === Slot 3
, includeEvents "[a,b] scheduled slot 1" (ScheduleEvents scheduledInSlot1 confirmed1) [a,b]
, mustNotIncludeEvents "none of [a,b,c,d] was scheduled" (ScheduleEvents scheduledInSlot2 confirmed2) [a,b,c,d]
, includeEvents "[c,d] scheduled slot 3" (ScheduleEvents scheduledInSlot3 confirmed3) [c,d]
] | 10,340 | specBody pm = do
describe "Test wallet submission layer" $ do
it "supports addition of pending transactions" $
withMaxSuccess 5 $ forAll (genPurePair pm) $ \(unSTB -> (submission, toAdd)) ->
let currentSlot = submission ^. getCurrentSlot
submission' = addPending' toAdd submission
schedule = submission' ^. getSchedule
((ScheduleEvents toSend _),_) = scheduledFor (mapSlot succ currentSlot) schedule
in conjoin [
failIf "localPending set not updated" shouldContainPending (submission' ^. localPendingSet myAccountId) toAdd
-- Check that all the added transactions are scheduled for the next slot
, failIf "not infix of" S.isSubsetOf (toTxIdSet' toAdd) (S.fromList $ toTxIds toSend)
]
it "supports deletion of pending transactions" $
withMaxSuccess 5 $ forAll (genPurePair pm) $ \(unSTB -> (submission, toRemove)) ->
doesNotContainPending toRemove $ remPendingById myAccountId (toTxIdSet' toRemove) submission
it "remPending . addPending = id" $
withMaxSuccess 5 $ forAll (genPurePair pm) $ \(unSTB -> (submission, pending)) ->
let originallyPending = submission ^. localPendingSet myAccountId
currentlyPending = view (localPendingSet myAccountId)
(remPendingById myAccountId
(toTxIdSet' pending)
(addPending' pending submission)
)
in failIf "the two pending set are not equal" ((==) `on` Pending.transactions) originallyPending currentlyPending
it "increases its internal slot after ticking" $ do
withMaxSuccess 5 $ forAll (genPureWalletSubmission pm myAccountId) $ \(unSTB -> submission) ->
let slotNow = submission ^. getCurrentSlot
(_, _, ws') = tick submission
in failIf "internal slot didn't increase" (==) (ws' ^. getCurrentSlot) (mapSlot succ slotNow)
it "constantRetry works predictably" $ do
let policy = constantRetry 1 5
conjoin [
policy (SubmissionCount 0) (Slot 0) === SendIn (Slot 1)
, policy (SubmissionCount 1) (Slot 1) === SendIn (Slot 2)
, policy (SubmissionCount 2) (Slot 2) === SendIn (Slot 3)
, policy (SubmissionCount 3) (Slot 3) === SendIn (Slot 4)
, policy (SubmissionCount 4) (Slot 4) === SendIn (Slot 5)
, policy (SubmissionCount 5) (Slot 5) === CheckConfirmedIn (Slot 6)
]
it "limit retries correctly" $ do
withMaxSuccess 5 $ forAll (genPurePair pm) $ \(unSTB -> (ws, pending)) ->
let ws' = (addPending' pending ws) & wsResubmissionFunction .~ giveUpAfter 3
(evicted1, _, ws1) = tick ws'
(evicted2, _, ws2) = tick ws1
(evicted3, _, ws3) = tick ws2
(evicted4, _, ws4) = tick ws3
(evicted5, _, ws5) = tick ws4
(evicted6, _, _) = tick ws5
in conjoin [
failIf "evicted1 includes any of pending" (\e p -> disjoint (toTxIdSet' p) (toTxIdSet'' e)) evicted1 pending
, failIf "evicted2 includes any of pending" (\e p -> disjoint (toTxIdSet' p) (toTxIdSet'' e)) evicted2 pending
, failIf "evicted3 includes any of pending" (\e p -> disjoint (toTxIdSet' p) (toTxIdSet'' e)) evicted3 pending
, failIf "evicted4 includes any of pending" (\e p -> disjoint (toTxIdSet' p) (toTxIdSet'' e)) evicted4 pending
, failIf "evicted5 doesn't contain all pending" (\e p -> (toTxIdSet' p) `S.isSubsetOf` (toTxIdSet'' e)) evicted5 pending
, failIf "evicted6 contains something from evicted5" (\e6 e5 -> disjoint (toTxIdSet'' e5) (toTxIdSet'' e6)) evicted6 evicted5
]
describe "tickSlot" $ do
-- Given A,B,C,D where D `dependsOn` C `dependsOn` B `dependsOn` A,
-- check that if these 4 are all scheduled within the same slot, they
-- are all scheduled for submission.
it "Given D->C->B->A all in the same slot, they are all sent" $ do
let generator = do (b,c,a,d) <- dependentTransactions pm
ws <- addPending myAccountId (pendingFromTxs (map labelledTxAux [a,b,c,d])) . unSTB <$> genPureWalletSubmission pm myAccountId
txs <- shuffle [b,c,a,d]
return $ STB (ws, txs)
withMaxSuccess 5 $ forAll generator $ \(unSTB -> (submission, txs)) ->
let currentSlot = submission ^. getCurrentSlot
schedule = submission ^. getSchedule
nxtSlot = mapSlot succ currentSlot
scheduledEvents = fst (scheduledFor nxtSlot schedule)
-- Tick directly the next slot, as 'addPending' schedules
-- everything for @currentSlot + 1@.
result = tickSlot nxtSlot submission
in case result of
(toSend, _, _) -> conjoin [
includeEvents "[a,b,c,d] not scheduled" scheduledEvents txs
, S.fromList (toTxIds txs) `isSubsetOf` S.fromList (toTxIds toSend)
]
-- Given A,B,C,D where D `dependsOn` C `dependsOn` B `dependsOn` A,
-- if [A,B,C] are scheduled on slot 2 and [D] on slot 1, we shouldn't
-- send anything.
it "Given D->C->B->A, if C,B,A are in the future, D is not sent this slot" $ do
let generator = do (b,c,a,d) <- dependentTransactions pm
ws <- addPending myAccountId (pendingFromTxs (map labelledTxAux [a,b,c])) . unSTB <$> genPureWalletSubmission pm myAccountId
return $ STB (addPending myAccountId (pendingFromTxs (map labelledTxAux [d])) ((\(_,_,s) -> s) . tick $ ws), d)
withMaxSuccess 5 $ forAll generator $ \(unSTB -> (submission, d)) ->
let currentSlot = submission ^. getCurrentSlot
schedule = submission ^. getSchedule
nxtSlot = mapSlot succ currentSlot
scheduledEvents = fst (scheduledFor nxtSlot schedule)
-- Tick directly the next slot, as 'addPending' schedules
-- everything for @currentSlot + 1@.
result = tickSlot nxtSlot submission
in case result of
(toSend, _, _) -> conjoin [
includeEvent "d scheduled" scheduledEvents d
, failIf "is subset of"
(\x y -> not $ S.isSubsetOf x y)
(S.fromList (toTxIds [d]))
(S.fromList (toTxIds toSend))
]
-- Given A,B,C,D where D `dependsOn` C `dependsOn` B `dependsOn` A, if:
-- * [A,B] are scheduled on slot 1
-- * [D] is scheduled on slot 2
-- * [C] is scheduled on slot 3
-- Then during slot 1 we would send both [A,B], on slot 2 we won't send
-- anything and finally on slot 3 we would send [C,D].
it "Given D->C->B->A, can send [A,B] now, [D,C] in the future" $ do
let generator :: Gen (ShowThroughBuild (WalletSubmission, [LabelledTxAux]))
generator = do (b,c,a,d) <- dependentTransactions pm
ws <- addPending myAccountId (pendingFromTxs (map labelledTxAux [a,b])) . unSTB <$> genPureWalletSubmission pm myAccountId
let (_, _, ws') = tick ws
let ws'' = addPending myAccountId (pendingFromTxs (map labelledTxAux [d])) ws'
return $ STB (ws'', [a,b,c,d])
withMaxSuccess 5 $ forAll generator $ \(unSTB -> (submission1, [a,b,c,d])) ->
let slot1 = submission1 ^. getCurrentSlot
(scheduledInSlot1, confirmed1, _) = tickSlot slot1 submission1
-- Let's assume that @A@ and @B@ finally are adopted,
-- and the wallet calls 'remPending' on them.
modifyPending = addPending myAccountId (pendingFromTxs (map labelledTxAux [c]))
. remPendingById myAccountId (toTxIdSet (pendingFromTxs (map labelledTxAux [a,b])))
(_, _, submission2) = (\(e,s,st) -> (e, s, modifyPending st)) . tick $ submission1
-- We are in slot 2 now. During slot 2, @D@ is scheduled and
-- we add @C@ to be sent during slot 3. However, due to
-- the fact @D@ is depedent on @C@, the scheduler shouldn't
-- schedule @D@, this slot, which will end up in the
-- nursery.
slot2 = submission2 ^. getCurrentSlot
(scheduledInSlot2, confirmed2, _) = tickSlot slot2 submission2
(_, _, submission3) = tick submission2
-- Finally, during slot 3, both @C@ and @D@ are sent.
slot3 = submission3 ^. getCurrentSlot
(scheduledInSlot3, confirmed3, _) = tickSlot slot3 submission3
in conjoin [
slot1 === Slot 1
, slot2 === Slot 2
, slot3 === Slot 3
, includeEvents "[a,b] scheduled slot 1" (ScheduleEvents scheduledInSlot1 confirmed1) [a,b]
, mustNotIncludeEvents "none of [a,b,c,d] was scheduled" (ScheduleEvents scheduledInSlot2 confirmed2) [a,b,c,d]
, includeEvents "[c,d] scheduled slot 3" (ScheduleEvents scheduledInSlot3 confirmed3) [c,d]
] | 10,306 | false | true | 0 | 40 | 3,930 | 2,400 | 1,242 | 1,158 | null | null |
ryantm/ghc | testsuite/tests/ffi/should_run/ffi009.hs | bsd-3-clause | manyArgsM12 :: FunTypeM12
manyArgsM12 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 =
((((((((((fromIntegral a1 * 31 + fromIntegral a2) * 31 +
fromIntegral a3) * 31 + fromIntegral a4) * 31 +
fromIntegral a5) * 31 + fromIntegral a6) * 31 +
fromIntegral a7) * 31 + fromIntegral a8) * 31 +
fromIntegral a9) * 31 + fromIntegral a10) * 31 +
fromIntegral a11) * 31 + a12 | 448 | manyArgsM12 :: FunTypeM12
manyArgsM12 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 =
((((((((((fromIntegral a1 * 31 + fromIntegral a2) * 31 +
fromIntegral a3) * 31 + fromIntegral a4) * 31 +
fromIntegral a5) * 31 + fromIntegral a6) * 31 +
fromIntegral a7) * 31 + fromIntegral a8) * 31 +
fromIntegral a9) * 31 + fromIntegral a10) * 31 +
fromIntegral a11) * 31 + a12 | 448 | manyArgsM12 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 =
((((((((((fromIntegral a1 * 31 + fromIntegral a2) * 31 +
fromIntegral a3) * 31 + fromIntegral a4) * 31 +
fromIntegral a5) * 31 + fromIntegral a6) * 31 +
fromIntegral a7) * 31 + fromIntegral a8) * 31 +
fromIntegral a9) * 31 + fromIntegral a10) * 31 +
fromIntegral a11) * 31 + a12 | 422 | false | true | 4 | 35 | 163 | 203 | 93 | 110 | null | null |
vigoos/Farrago-OS | aura-master/aura-master/src/Aura/Flags.hs | gpl-2.0 | notSettingsFlag (TruncTail _) = False | 37 | notSettingsFlag (TruncTail _) = False | 37 | notSettingsFlag (TruncTail _) = False | 37 | false | false | 0 | 7 | 4 | 15 | 7 | 8 | null | null |
DATX02-17-26/DATX02-17-26 | libsrc/Norm/NormM.hs | gpl-2.0 | -- | 'withError': run a normalizer that can error.
-- If an error occurs, the starting term will be returned.
withError :: (HasError e m, Monad m') => NormArrT m a -> NormArrT m' a
withError = withErrorG id | 206 | withError :: (HasError e m, Monad m') => NormArrT m a -> NormArrT m' a
withError = withErrorG id | 96 | withError = withErrorG id | 25 | true | true | 0 | 8 | 38 | 53 | 25 | 28 | null | null |
ekmett/ghclive | prototypes/svgdemo/HintAjax.hs | bsd-3-clause | main :: IO()
main = scotty 3000 $ do
hint <- liftIO $ newHint
middleware logStdoutDev -- serves jquery.js and clock.js from static/
-- middleware $ staticPolicy (noDots >-> addBase "static") -- serves jquery.js and clock.js from static/ with scotty > 3
middleware $ staticRoot "static"
get "/" $ file "hint.html"
get "/hint" $ do
u <- param "fileurl"
e <- param "expr"
t <- liftIO . performHint hint $ runHint e u
case t of
Left error -> json $ A.object ["result" .= cleanShow error, "expr" .= e]
Right string -> json $ A.object ["result" .= renderMarkup string, "expr" .= e]
-- json t
-- runHint :: String -> String -> m String inferred
-- runHint :: String -> String -> InterpreterT IO String | 799 | main :: IO()
main = scotty 3000 $ do
hint <- liftIO $ newHint
middleware logStdoutDev -- serves jquery.js and clock.js from static/
-- middleware $ staticPolicy (noDots >-> addBase "static") -- serves jquery.js and clock.js from static/ with scotty > 3
middleware $ staticRoot "static"
get "/" $ file "hint.html"
get "/hint" $ do
u <- param "fileurl"
e <- param "expr"
t <- liftIO . performHint hint $ runHint e u
case t of
Left error -> json $ A.object ["result" .= cleanShow error, "expr" .= e]
Right string -> json $ A.object ["result" .= renderMarkup string, "expr" .= e]
-- json t
-- runHint :: String -> String -> m String inferred
-- runHint :: String -> String -> InterpreterT IO String | 799 | main = scotty 3000 $ do
hint <- liftIO $ newHint
middleware logStdoutDev -- serves jquery.js and clock.js from static/
-- middleware $ staticPolicy (noDots >-> addBase "static") -- serves jquery.js and clock.js from static/ with scotty > 3
middleware $ staticRoot "static"
get "/" $ file "hint.html"
get "/hint" $ do
u <- param "fileurl"
e <- param "expr"
t <- liftIO . performHint hint $ runHint e u
case t of
Left error -> json $ A.object ["result" .= cleanShow error, "expr" .= e]
Right string -> json $ A.object ["result" .= renderMarkup string, "expr" .= e]
-- json t
-- runHint :: String -> String -> m String inferred
-- runHint :: String -> String -> InterpreterT IO String | 786 | false | true | 1 | 19 | 229 | 202 | 91 | 111 | null | null |
urv/fixhs | src/Data/FIX/Spec/FIX43.hs | lgpl-2.1 | tMDEntryID :: FIXTag
tMDEntryID = FIXTag
{ tName = "MDEntryID"
, tnum = 278
, tparser = toFIXString
, arbitraryValue = FIXString <$> arbitrary } | 157 | tMDEntryID :: FIXTag
tMDEntryID = FIXTag
{ tName = "MDEntryID"
, tnum = 278
, tparser = toFIXString
, arbitraryValue = FIXString <$> arbitrary } | 157 | tMDEntryID = FIXTag
{ tName = "MDEntryID"
, tnum = 278
, tparser = toFIXString
, arbitraryValue = FIXString <$> arbitrary } | 136 | false | true | 0 | 8 | 37 | 45 | 26 | 19 | null | null |
elieux/ghc | compiler/deSugar/DsBinds.hs | bsd-3-clause | -- | Desugar all other kind of bindings, Ids of strict binds are returned to
-- later be forced in the binding gorup body, see Note [Desugar Strict binds]
dsLHsBinds :: LHsBinds Id
-> DsM ([Id], [(Id,CoreExpr)])
dsLHsBinds binds = do { (force_vars, binds') <- ds_lhs_binds binds
; return (force_vars, binds') } | 343 | dsLHsBinds :: LHsBinds Id
-> DsM ([Id], [(Id,CoreExpr)])
dsLHsBinds binds = do { (force_vars, binds') <- ds_lhs_binds binds
; return (force_vars, binds') } | 188 | dsLHsBinds binds = do { (force_vars, binds') <- ds_lhs_binds binds
; return (force_vars, binds') } | 120 | true | true | 0 | 10 | 84 | 80 | 43 | 37 | null | null |
ezyang/ghc | libraries/base/Data/Either.hs | bsd-3-clause | fromRight b _ = b | 25 | fromRight b _ = b | 25 | fromRight b _ = b | 25 | false | false | 0 | 5 | 12 | 11 | 5 | 6 | null | null |
TOSPIO/yi | src/library/Yi/Mode/Haskell.hs | gpl-2.0 | tokRegion :: Tok t -> Region
tokRegion t = mkRegion (tokBegin t) (tokEnd t) | 75 | tokRegion :: Tok t -> Region
tokRegion t = mkRegion (tokBegin t) (tokEnd t) | 75 | tokRegion t = mkRegion (tokBegin t) (tokEnd t) | 46 | false | true | 0 | 7 | 13 | 38 | 18 | 20 | null | null |
bitemyapp/github | Github/Issues/Events.hs | bsd-3-clause | -- | Details on a specific event, by the event's ID.
--
-- > event "thoughtbot" "paperclip" 5335772
event :: String -> String -> Int -> IO (Either Error Event)
event user reqRepoName reqEventId =
githubGet ["repos", user, reqRepoName, "issues", "events", show reqEventId] | 273 | event :: String -> String -> Int -> IO (Either Error Event)
event user reqRepoName reqEventId =
githubGet ["repos", user, reqRepoName, "issues", "events", show reqEventId] | 173 | event user reqRepoName reqEventId =
githubGet ["repos", user, reqRepoName, "issues", "events", show reqEventId] | 113 | true | true | 0 | 10 | 44 | 72 | 38 | 34 | null | null |
kowey/GenI | geni-gui/src/NLP/GenI/GraphvizShow.hs | gpl-2.0 | gvDerivationLab :: T.Text -> TL.Text
gvDerivationLab xs = "Derivation" `TL.append` gvMunge xs | 93 | gvDerivationLab :: T.Text -> TL.Text
gvDerivationLab xs = "Derivation" `TL.append` gvMunge xs | 93 | gvDerivationLab xs = "Derivation" `TL.append` gvMunge xs | 56 | false | true | 0 | 6 | 11 | 33 | 17 | 16 | null | null |
Tosainu/pwn.hs | src/Pwn/Tubes/SSH.hs | mit | defaultSSHConfig :: SSHConfig
defaultSSHConfig = SSHConfig
{ port = 22
, password = ""
, keyFile = Nothing
} | 121 | defaultSSHConfig :: SSHConfig
defaultSSHConfig = SSHConfig
{ port = 22
, password = ""
, keyFile = Nothing
} | 121 | defaultSSHConfig = SSHConfig
{ port = 22
, password = ""
, keyFile = Nothing
} | 91 | false | true | 0 | 7 | 31 | 35 | 20 | 15 | null | null |
google/codeworld | codeworld-api/src/CodeWorld/Picture.hs | apache-2.0 | -- | Reflects a given point across a line through the origin at this
-- angle, in radians. For example, an angle of 0 reflects the point
-- vertically across the x axis, while an angle of @pi / 2@ reflects the
-- point horizontally across the y axis.
reflectedPoint :: Double -> Point -> Point
reflectedPoint th (x, y) = (x * cos a + y * sin a, x * sin a - y * cos a)
where
a = 2 * th
-- | Scales a given point by given x and y scaling factor. Scaling by a
-- negative factor also reflects across that axis.
--
-- >>> scaledPoint 2 3 (10, 10)
-- (20, 30) | 563 | reflectedPoint :: Double -> Point -> Point
reflectedPoint th (x, y) = (x * cos a + y * sin a, x * sin a - y * cos a)
where
a = 2 * th
-- | Scales a given point by given x and y scaling factor. Scaling by a
-- negative factor also reflects across that axis.
--
-- >>> scaledPoint 2 3 (10, 10)
-- (20, 30) | 311 | reflectedPoint th (x, y) = (x * cos a + y * sin a, x * sin a - y * cos a)
where
a = 2 * th
-- | Scales a given point by given x and y scaling factor. Scaling by a
-- negative factor also reflects across that axis.
--
-- >>> scaledPoint 2 3 (10, 10)
-- (20, 30) | 268 | true | true | 0 | 9 | 128 | 93 | 51 | 42 | null | null |
anton-k/sharc-timbre | src/Sharc/Instruments/Cello.hs | bsd-3-clause | note10 :: Note
note10 = Note
(Pitch 116.541 34 "a#2")
11
(Range
(NoteRange
(NoteRangeAmplitude 10022.52 86 9.0e-2)
(NoteRangeHarmonicFreq 1 116.54))
(NoteRange
(NoteRangeAmplitude 233.08 2 1692.0)
(NoteRangeHarmonicFreq 86 10022.52)))
[Harmonic 1 (-1.385) 717.16
,Harmonic 2 (-1.534) 1692.0
,Harmonic 3 (-2.059) 1030.76
,Harmonic 4 (-1.509) 549.35
,Harmonic 5 (-2.22) 137.24
,Harmonic 6 (-1.012) 473.11
,Harmonic 7 (-2.63) 84.8
,Harmonic 8 0.399 359.37
,Harmonic 9 2.543 178.86
,Harmonic 10 (-2.326) 119.49
,Harmonic 11 2.209 8.04
,Harmonic 12 2.432 73.63
,Harmonic 13 1.271 159.97
,Harmonic 14 (-2.296) 101.31
,Harmonic 15 (-1.342) 165.33
,Harmonic 16 2.548 111.7
,Harmonic 17 0.301 123.27
,Harmonic 18 2.199 29.47
,Harmonic 19 (-1.702) 40.22
,Harmonic 20 (-2.609) 20.64
,Harmonic 21 0.862 47.49
,Harmonic 22 (-0.804) 22.04
,Harmonic 23 (-1.194) 17.67
,Harmonic 24 1.106 30.68
,Harmonic 25 (-0.171) 4.99
,Harmonic 26 2.226 19.63
,Harmonic 27 (-0.1) 9.55
,Harmonic 28 (-3.013) 10.9
,Harmonic 29 0.169 3.26
,Harmonic 30 2.836 7.57
,Harmonic 31 (-0.618) 14.01
,Harmonic 32 1.733 12.03
,Harmonic 33 (-2.537) 4.41
,Harmonic 34 2.121 0.54
,Harmonic 35 (-1.017) 0.9
,Harmonic 36 (-2.268) 4.47
,Harmonic 37 2.112 4.21
,Harmonic 38 (-0.431) 2.17
,Harmonic 39 (-0.972) 1.77
,Harmonic 40 2.745 2.49
,Harmonic 41 1.012 3.52
,Harmonic 42 (-2.273) 2.4
,Harmonic 43 (-2.878) 0.84
,Harmonic 44 2.25 0.54
,Harmonic 45 2.495 1.02
,Harmonic 46 3.106 0.49
,Harmonic 47 (-3.077) 1.25
,Harmonic 48 2.458 1.3
,Harmonic 49 (-0.997) 0.3
,Harmonic 50 (-0.22) 0.5
,Harmonic 51 1.219 1.42
,Harmonic 52 (-2.445) 0.99
,Harmonic 53 (-1.784) 1.2
,Harmonic 54 1.526 0.55
,Harmonic 55 0.345 0.94
,Harmonic 56 (-1.395) 1.51
,Harmonic 57 3.035 1.13
,Harmonic 58 0.591 1.02
,Harmonic 59 (-0.684) 0.37
,Harmonic 60 1.694 0.87
,Harmonic 61 (-0.788) 1.09
,Harmonic 62 8.8e-2 0.39
,Harmonic 63 2.043 0.71
,Harmonic 64 (-0.891) 0.92
,Harmonic 65 2.535 0.89
,Harmonic 66 1.554 0.59
,Harmonic 67 0.752 0.72
,Harmonic 68 (-1.676) 0.5
,Harmonic 69 1.439 0.45
,Harmonic 70 (-0.769) 0.76
,Harmonic 71 2.617 0.49
,Harmonic 72 8.1e-2 0.99
,Harmonic 73 0.977 0.45
,Harmonic 74 (-2.284) 0.21
,Harmonic 75 2.476 0.6
,Harmonic 76 (-1.405) 0.12
,Harmonic 77 (-2.346) 0.26
,Harmonic 78 (-1.372) 0.22
,Harmonic 79 (-3.019) 0.52
,Harmonic 80 0.289 0.49
,Harmonic 81 (-1.457) 0.87
,Harmonic 82 2.347 0.61
,Harmonic 83 1.978 0.59
,Harmonic 84 (-0.37) 0.52
,Harmonic 85 2.459 0.16
,Harmonic 86 3.06 9.0e-2] | 2,866 | note10 :: Note
note10 = Note
(Pitch 116.541 34 "a#2")
11
(Range
(NoteRange
(NoteRangeAmplitude 10022.52 86 9.0e-2)
(NoteRangeHarmonicFreq 1 116.54))
(NoteRange
(NoteRangeAmplitude 233.08 2 1692.0)
(NoteRangeHarmonicFreq 86 10022.52)))
[Harmonic 1 (-1.385) 717.16
,Harmonic 2 (-1.534) 1692.0
,Harmonic 3 (-2.059) 1030.76
,Harmonic 4 (-1.509) 549.35
,Harmonic 5 (-2.22) 137.24
,Harmonic 6 (-1.012) 473.11
,Harmonic 7 (-2.63) 84.8
,Harmonic 8 0.399 359.37
,Harmonic 9 2.543 178.86
,Harmonic 10 (-2.326) 119.49
,Harmonic 11 2.209 8.04
,Harmonic 12 2.432 73.63
,Harmonic 13 1.271 159.97
,Harmonic 14 (-2.296) 101.31
,Harmonic 15 (-1.342) 165.33
,Harmonic 16 2.548 111.7
,Harmonic 17 0.301 123.27
,Harmonic 18 2.199 29.47
,Harmonic 19 (-1.702) 40.22
,Harmonic 20 (-2.609) 20.64
,Harmonic 21 0.862 47.49
,Harmonic 22 (-0.804) 22.04
,Harmonic 23 (-1.194) 17.67
,Harmonic 24 1.106 30.68
,Harmonic 25 (-0.171) 4.99
,Harmonic 26 2.226 19.63
,Harmonic 27 (-0.1) 9.55
,Harmonic 28 (-3.013) 10.9
,Harmonic 29 0.169 3.26
,Harmonic 30 2.836 7.57
,Harmonic 31 (-0.618) 14.01
,Harmonic 32 1.733 12.03
,Harmonic 33 (-2.537) 4.41
,Harmonic 34 2.121 0.54
,Harmonic 35 (-1.017) 0.9
,Harmonic 36 (-2.268) 4.47
,Harmonic 37 2.112 4.21
,Harmonic 38 (-0.431) 2.17
,Harmonic 39 (-0.972) 1.77
,Harmonic 40 2.745 2.49
,Harmonic 41 1.012 3.52
,Harmonic 42 (-2.273) 2.4
,Harmonic 43 (-2.878) 0.84
,Harmonic 44 2.25 0.54
,Harmonic 45 2.495 1.02
,Harmonic 46 3.106 0.49
,Harmonic 47 (-3.077) 1.25
,Harmonic 48 2.458 1.3
,Harmonic 49 (-0.997) 0.3
,Harmonic 50 (-0.22) 0.5
,Harmonic 51 1.219 1.42
,Harmonic 52 (-2.445) 0.99
,Harmonic 53 (-1.784) 1.2
,Harmonic 54 1.526 0.55
,Harmonic 55 0.345 0.94
,Harmonic 56 (-1.395) 1.51
,Harmonic 57 3.035 1.13
,Harmonic 58 0.591 1.02
,Harmonic 59 (-0.684) 0.37
,Harmonic 60 1.694 0.87
,Harmonic 61 (-0.788) 1.09
,Harmonic 62 8.8e-2 0.39
,Harmonic 63 2.043 0.71
,Harmonic 64 (-0.891) 0.92
,Harmonic 65 2.535 0.89
,Harmonic 66 1.554 0.59
,Harmonic 67 0.752 0.72
,Harmonic 68 (-1.676) 0.5
,Harmonic 69 1.439 0.45
,Harmonic 70 (-0.769) 0.76
,Harmonic 71 2.617 0.49
,Harmonic 72 8.1e-2 0.99
,Harmonic 73 0.977 0.45
,Harmonic 74 (-2.284) 0.21
,Harmonic 75 2.476 0.6
,Harmonic 76 (-1.405) 0.12
,Harmonic 77 (-2.346) 0.26
,Harmonic 78 (-1.372) 0.22
,Harmonic 79 (-3.019) 0.52
,Harmonic 80 0.289 0.49
,Harmonic 81 (-1.457) 0.87
,Harmonic 82 2.347 0.61
,Harmonic 83 1.978 0.59
,Harmonic 84 (-0.37) 0.52
,Harmonic 85 2.459 0.16
,Harmonic 86 3.06 9.0e-2] | 2,866 | note10 = Note
(Pitch 116.541 34 "a#2")
11
(Range
(NoteRange
(NoteRangeAmplitude 10022.52 86 9.0e-2)
(NoteRangeHarmonicFreq 1 116.54))
(NoteRange
(NoteRangeAmplitude 233.08 2 1692.0)
(NoteRangeHarmonicFreq 86 10022.52)))
[Harmonic 1 (-1.385) 717.16
,Harmonic 2 (-1.534) 1692.0
,Harmonic 3 (-2.059) 1030.76
,Harmonic 4 (-1.509) 549.35
,Harmonic 5 (-2.22) 137.24
,Harmonic 6 (-1.012) 473.11
,Harmonic 7 (-2.63) 84.8
,Harmonic 8 0.399 359.37
,Harmonic 9 2.543 178.86
,Harmonic 10 (-2.326) 119.49
,Harmonic 11 2.209 8.04
,Harmonic 12 2.432 73.63
,Harmonic 13 1.271 159.97
,Harmonic 14 (-2.296) 101.31
,Harmonic 15 (-1.342) 165.33
,Harmonic 16 2.548 111.7
,Harmonic 17 0.301 123.27
,Harmonic 18 2.199 29.47
,Harmonic 19 (-1.702) 40.22
,Harmonic 20 (-2.609) 20.64
,Harmonic 21 0.862 47.49
,Harmonic 22 (-0.804) 22.04
,Harmonic 23 (-1.194) 17.67
,Harmonic 24 1.106 30.68
,Harmonic 25 (-0.171) 4.99
,Harmonic 26 2.226 19.63
,Harmonic 27 (-0.1) 9.55
,Harmonic 28 (-3.013) 10.9
,Harmonic 29 0.169 3.26
,Harmonic 30 2.836 7.57
,Harmonic 31 (-0.618) 14.01
,Harmonic 32 1.733 12.03
,Harmonic 33 (-2.537) 4.41
,Harmonic 34 2.121 0.54
,Harmonic 35 (-1.017) 0.9
,Harmonic 36 (-2.268) 4.47
,Harmonic 37 2.112 4.21
,Harmonic 38 (-0.431) 2.17
,Harmonic 39 (-0.972) 1.77
,Harmonic 40 2.745 2.49
,Harmonic 41 1.012 3.52
,Harmonic 42 (-2.273) 2.4
,Harmonic 43 (-2.878) 0.84
,Harmonic 44 2.25 0.54
,Harmonic 45 2.495 1.02
,Harmonic 46 3.106 0.49
,Harmonic 47 (-3.077) 1.25
,Harmonic 48 2.458 1.3
,Harmonic 49 (-0.997) 0.3
,Harmonic 50 (-0.22) 0.5
,Harmonic 51 1.219 1.42
,Harmonic 52 (-2.445) 0.99
,Harmonic 53 (-1.784) 1.2
,Harmonic 54 1.526 0.55
,Harmonic 55 0.345 0.94
,Harmonic 56 (-1.395) 1.51
,Harmonic 57 3.035 1.13
,Harmonic 58 0.591 1.02
,Harmonic 59 (-0.684) 0.37
,Harmonic 60 1.694 0.87
,Harmonic 61 (-0.788) 1.09
,Harmonic 62 8.8e-2 0.39
,Harmonic 63 2.043 0.71
,Harmonic 64 (-0.891) 0.92
,Harmonic 65 2.535 0.89
,Harmonic 66 1.554 0.59
,Harmonic 67 0.752 0.72
,Harmonic 68 (-1.676) 0.5
,Harmonic 69 1.439 0.45
,Harmonic 70 (-0.769) 0.76
,Harmonic 71 2.617 0.49
,Harmonic 72 8.1e-2 0.99
,Harmonic 73 0.977 0.45
,Harmonic 74 (-2.284) 0.21
,Harmonic 75 2.476 0.6
,Harmonic 76 (-1.405) 0.12
,Harmonic 77 (-2.346) 0.26
,Harmonic 78 (-1.372) 0.22
,Harmonic 79 (-3.019) 0.52
,Harmonic 80 0.289 0.49
,Harmonic 81 (-1.457) 0.87
,Harmonic 82 2.347 0.61
,Harmonic 83 1.978 0.59
,Harmonic 84 (-0.37) 0.52
,Harmonic 85 2.459 0.16
,Harmonic 86 3.06 9.0e-2] | 2,851 | false | true | 0 | 10 | 791 | 1,174 | 605 | 569 | null | null |
vigoo/stack | src/Stack/Config/Docker.hs | bsd-3-clause | -- | Interprets DockerOptsMonoid options.
dockerOptsFromMonoid
:: MonadThrow m
=> Maybe Project -> Path Abs Dir -> DockerOptsMonoid -> m DockerOpts
dockerOptsFromMonoid mproject stackRoot DockerOptsMonoid{..} = do
let dockerEnable =
fromMaybe dockerMonoidDefaultEnable dockerMonoidEnable
dockerImage =
let defaultTag =
case mproject of
Nothing -> ""
Just proj ->
case projectResolver proj of
ResolverSnapshot n@(LTS _ _) ->
":" ++ T.unpack (renderSnapName n)
_ ->
throwM
(ResolverNotSupportedException $
show $ projectResolver proj)
in case dockerMonoidRepoOrImage of
Nothing -> "fpco/stack-build" ++ defaultTag
Just (DockerMonoidImage image) -> image
Just (DockerMonoidRepo repo) ->
case find (`elem` (":@" :: String)) repo of
Just _ -- Repo already specified a tag or digest, so don't append default
->
repo
Nothing -> repo ++ defaultTag
dockerRegistryLogin =
fromMaybe
(isJust (emptyToNothing dockerMonoidRegistryUsername))
dockerMonoidRegistryLogin
dockerRegistryUsername = emptyToNothing dockerMonoidRegistryUsername
dockerRegistryPassword = emptyToNothing dockerMonoidRegistryPassword
dockerAutoPull = fromMaybe False dockerMonoidAutoPull
dockerDetach = fromMaybe False dockerMonoidDetach
dockerPersist = fromMaybe False dockerMonoidPersist
dockerContainerName = emptyToNothing dockerMonoidContainerName
dockerRunArgs = dockerMonoidRunArgs
dockerMount = dockerMonoidMount
dockerEnv = dockerMonoidEnv
dockerSetUser = dockerMonoidSetUser
dockerRequireDockerVersion = simplifyVersionRange dockerMonoidRequireDockerVersion
dockerDatabasePath <-
case dockerMonoidDatabasePath of
Nothing -> return $ stackRoot </> $(mkRelFile "docker.db")
Just fp ->
case parseAbsFile fp of
Left e -> throwM (InvalidDatabasePathException e)
Right p -> return p
dockerStackExe <-
case dockerMonoidStackExe of
Just e -> liftM Just (parseDockerStackExe e)
Nothing -> return Nothing
return DockerOpts{..}
where emptyToNothing Nothing = Nothing
emptyToNothing (Just s) | null s = Nothing
| otherwise = Just s
-- | Exceptions thrown by Stack.Docker.Config. | 2,913 | dockerOptsFromMonoid
:: MonadThrow m
=> Maybe Project -> Path Abs Dir -> DockerOptsMonoid -> m DockerOpts
dockerOptsFromMonoid mproject stackRoot DockerOptsMonoid{..} = do
let dockerEnable =
fromMaybe dockerMonoidDefaultEnable dockerMonoidEnable
dockerImage =
let defaultTag =
case mproject of
Nothing -> ""
Just proj ->
case projectResolver proj of
ResolverSnapshot n@(LTS _ _) ->
":" ++ T.unpack (renderSnapName n)
_ ->
throwM
(ResolverNotSupportedException $
show $ projectResolver proj)
in case dockerMonoidRepoOrImage of
Nothing -> "fpco/stack-build" ++ defaultTag
Just (DockerMonoidImage image) -> image
Just (DockerMonoidRepo repo) ->
case find (`elem` (":@" :: String)) repo of
Just _ -- Repo already specified a tag or digest, so don't append default
->
repo
Nothing -> repo ++ defaultTag
dockerRegistryLogin =
fromMaybe
(isJust (emptyToNothing dockerMonoidRegistryUsername))
dockerMonoidRegistryLogin
dockerRegistryUsername = emptyToNothing dockerMonoidRegistryUsername
dockerRegistryPassword = emptyToNothing dockerMonoidRegistryPassword
dockerAutoPull = fromMaybe False dockerMonoidAutoPull
dockerDetach = fromMaybe False dockerMonoidDetach
dockerPersist = fromMaybe False dockerMonoidPersist
dockerContainerName = emptyToNothing dockerMonoidContainerName
dockerRunArgs = dockerMonoidRunArgs
dockerMount = dockerMonoidMount
dockerEnv = dockerMonoidEnv
dockerSetUser = dockerMonoidSetUser
dockerRequireDockerVersion = simplifyVersionRange dockerMonoidRequireDockerVersion
dockerDatabasePath <-
case dockerMonoidDatabasePath of
Nothing -> return $ stackRoot </> $(mkRelFile "docker.db")
Just fp ->
case parseAbsFile fp of
Left e -> throwM (InvalidDatabasePathException e)
Right p -> return p
dockerStackExe <-
case dockerMonoidStackExe of
Just e -> liftM Just (parseDockerStackExe e)
Nothing -> return Nothing
return DockerOpts{..}
where emptyToNothing Nothing = Nothing
emptyToNothing (Just s) | null s = Nothing
| otherwise = Just s
-- | Exceptions thrown by Stack.Docker.Config. | 2,871 | dockerOptsFromMonoid mproject stackRoot DockerOptsMonoid{..} = do
let dockerEnable =
fromMaybe dockerMonoidDefaultEnable dockerMonoidEnable
dockerImage =
let defaultTag =
case mproject of
Nothing -> ""
Just proj ->
case projectResolver proj of
ResolverSnapshot n@(LTS _ _) ->
":" ++ T.unpack (renderSnapName n)
_ ->
throwM
(ResolverNotSupportedException $
show $ projectResolver proj)
in case dockerMonoidRepoOrImage of
Nothing -> "fpco/stack-build" ++ defaultTag
Just (DockerMonoidImage image) -> image
Just (DockerMonoidRepo repo) ->
case find (`elem` (":@" :: String)) repo of
Just _ -- Repo already specified a tag or digest, so don't append default
->
repo
Nothing -> repo ++ defaultTag
dockerRegistryLogin =
fromMaybe
(isJust (emptyToNothing dockerMonoidRegistryUsername))
dockerMonoidRegistryLogin
dockerRegistryUsername = emptyToNothing dockerMonoidRegistryUsername
dockerRegistryPassword = emptyToNothing dockerMonoidRegistryPassword
dockerAutoPull = fromMaybe False dockerMonoidAutoPull
dockerDetach = fromMaybe False dockerMonoidDetach
dockerPersist = fromMaybe False dockerMonoidPersist
dockerContainerName = emptyToNothing dockerMonoidContainerName
dockerRunArgs = dockerMonoidRunArgs
dockerMount = dockerMonoidMount
dockerEnv = dockerMonoidEnv
dockerSetUser = dockerMonoidSetUser
dockerRequireDockerVersion = simplifyVersionRange dockerMonoidRequireDockerVersion
dockerDatabasePath <-
case dockerMonoidDatabasePath of
Nothing -> return $ stackRoot </> $(mkRelFile "docker.db")
Just fp ->
case parseAbsFile fp of
Left e -> throwM (InvalidDatabasePathException e)
Right p -> return p
dockerStackExe <-
case dockerMonoidStackExe of
Just e -> liftM Just (parseDockerStackExe e)
Nothing -> return Nothing
return DockerOpts{..}
where emptyToNothing Nothing = Nothing
emptyToNothing (Just s) | null s = Nothing
| otherwise = Just s
-- | Exceptions thrown by Stack.Docker.Config. | 2,757 | true | true | 1 | 23 | 1,119 | 534 | 257 | 277 | null | null |
sinelaw/HOpenCV | src/AI/CV/OpenCV/ImgProc.hs | gpl-2.0 | fromCvtColorFlag Luv2LRGB = 81 | 34 | fromCvtColorFlag Luv2LRGB = 81 | 34 | fromCvtColorFlag Luv2LRGB = 81 | 34 | false | false | 0 | 5 | 7 | 9 | 4 | 5 | null | null |
haskell-opengl/OpenGLRaw | src/Graphics/GL/ExtensionPredicates.hs | bsd-3-clause | -- | Is the <https://www.opengl.org/registry/specs/NV/mesh_shader.txt NV_mesh_shader> extension supported?
glGetNVMeshShader :: MonadIO m => m Bool
glGetNVMeshShader = getExtensions >>= (return . member "GL_NV_mesh_shader") | 223 | glGetNVMeshShader :: MonadIO m => m Bool
glGetNVMeshShader = getExtensions >>= (return . member "GL_NV_mesh_shader") | 116 | glGetNVMeshShader = getExtensions >>= (return . member "GL_NV_mesh_shader") | 75 | true | true | 0 | 8 | 22 | 36 | 18 | 18 | null | null |
flipstone/orville | orville-postgresql-libpq/src/Orville/PostgreSQL/Internal/TableDefinition.hs | mit | {- |
Returns the primary key for the table, as defined at construction via 'mkTableDefinition'.
-}
tablePrimaryKey :: TableDefinition (HasKey key) writeEntity readEntity -> PrimaryKey key
tablePrimaryKey def =
case _tablePrimaryKey def of
TableHasKey primaryKey -> primaryKey
{- |
Returns the marshaller for the table, as defined at construction via 'mkTableDefinition'.
-} | 384 | tablePrimaryKey :: TableDefinition (HasKey key) writeEntity readEntity -> PrimaryKey key
tablePrimaryKey def =
case _tablePrimaryKey def of
TableHasKey primaryKey -> primaryKey
{- |
Returns the marshaller for the table, as defined at construction via 'mkTableDefinition'.
-} | 283 | tablePrimaryKey def =
case _tablePrimaryKey def of
TableHasKey primaryKey -> primaryKey
{- |
Returns the marshaller for the table, as defined at construction via 'mkTableDefinition'.
-} | 194 | true | true | 0 | 8 | 62 | 52 | 25 | 27 | null | null |
xicesky/sky-haskell-playground | src/Sky/Parsing/Invertible2.hs | bsd-3-clause | digit :: Syntax' Char Char
digit = Token id $ tokenSet "0123456789" | 67 | digit :: Syntax' Char Char
digit = Token id $ tokenSet "0123456789" | 67 | digit = Token id $ tokenSet "0123456789" | 40 | false | true | 0 | 6 | 11 | 26 | 12 | 14 | null | null |
jekor/templatepg | Database/TemplatePG/Types.hs | mit | -- text
-- as with ints, sacrificing precision/safety for floats
pgTypeFromOID 700 = PGReal | 92 | pgTypeFromOID 700 = PGReal | 27 | pgTypeFromOID 700 = PGReal | 27 | true | false | 0 | 5 | 14 | 11 | 6 | 5 | null | null |
mcschroeder/ghc | compiler/deSugar/Coverage.hs | bsd-3-clause | addTickHsExpr (ExplicitPArr ty es) =
liftM2 ExplicitPArr
(return ty)
(mapM (addTickLHsExpr) es) | 135 | addTickHsExpr (ExplicitPArr ty es) =
liftM2 ExplicitPArr
(return ty)
(mapM (addTickLHsExpr) es) | 135 | addTickHsExpr (ExplicitPArr ty es) =
liftM2 ExplicitPArr
(return ty)
(mapM (addTickLHsExpr) es) | 135 | false | false | 0 | 7 | 51 | 44 | 20 | 24 | null | null |
scast/bigbrother | src/Table.hs | gpl-2.0 | typename (P.ReferenceTo x ) = typename x | 40 | typename (P.ReferenceTo x ) = typename x | 40 | typename (P.ReferenceTo x ) = typename x | 40 | false | false | 0 | 8 | 6 | 20 | 9 | 11 | null | null |
TomMD/cryptol | src/Cryptol/Transform/Specialize.hs | bsd-3-clause | specializeConst :: Expr -> M Expr
specializeConst e0 = do
let (e1, n) = destEProofApps e0
let (e2, ts) = destETApps e1
case e2 of
EVar qname ->
do cache <- getSpecCache
case Map.lookup qname cache of
Nothing -> return e0 -- Primitive/unspecializable variable; leave it alone
Just (decl, tm) ->
case lookupTM ts tm of
Just (qname', _) -> return (EVar qname') -- Already specialized
Nothing -> do -- A new type instance of this function
qname' <- freshName qname ts -- New type instance, record new name
sig' <- instantiateSchema ts n (dSignature decl)
modifySpecCache (Map.adjust (fmap (insertTM ts (qname', Nothing))) qname)
rhs' <- specializeExpr =<< instantiateExpr ts n (dDefinition decl)
let decl' = decl { dName = qname', dSignature = sig', dDefinition = rhs' }
modifySpecCache (Map.adjust (fmap (insertTM ts (qname', Just decl'))) qname)
return (EVar qname')
_ -> return e0 -- type/proof application to non-variable; not specializable | 1,154 | specializeConst :: Expr -> M Expr
specializeConst e0 = do
let (e1, n) = destEProofApps e0
let (e2, ts) = destETApps e1
case e2 of
EVar qname ->
do cache <- getSpecCache
case Map.lookup qname cache of
Nothing -> return e0 -- Primitive/unspecializable variable; leave it alone
Just (decl, tm) ->
case lookupTM ts tm of
Just (qname', _) -> return (EVar qname') -- Already specialized
Nothing -> do -- A new type instance of this function
qname' <- freshName qname ts -- New type instance, record new name
sig' <- instantiateSchema ts n (dSignature decl)
modifySpecCache (Map.adjust (fmap (insertTM ts (qname', Nothing))) qname)
rhs' <- specializeExpr =<< instantiateExpr ts n (dDefinition decl)
let decl' = decl { dName = qname', dSignature = sig', dDefinition = rhs' }
modifySpecCache (Map.adjust (fmap (insertTM ts (qname', Just decl'))) qname)
return (EVar qname')
_ -> return e0 -- type/proof application to non-variable; not specializable | 1,154 | specializeConst e0 = do
let (e1, n) = destEProofApps e0
let (e2, ts) = destETApps e1
case e2 of
EVar qname ->
do cache <- getSpecCache
case Map.lookup qname cache of
Nothing -> return e0 -- Primitive/unspecializable variable; leave it alone
Just (decl, tm) ->
case lookupTM ts tm of
Just (qname', _) -> return (EVar qname') -- Already specialized
Nothing -> do -- A new type instance of this function
qname' <- freshName qname ts -- New type instance, record new name
sig' <- instantiateSchema ts n (dSignature decl)
modifySpecCache (Map.adjust (fmap (insertTM ts (qname', Nothing))) qname)
rhs' <- specializeExpr =<< instantiateExpr ts n (dDefinition decl)
let decl' = decl { dName = qname', dSignature = sig', dDefinition = rhs' }
modifySpecCache (Map.adjust (fmap (insertTM ts (qname', Just decl'))) qname)
return (EVar qname')
_ -> return e0 -- type/proof application to non-variable; not specializable | 1,120 | false | true | 0 | 29 | 364 | 346 | 168 | 178 | null | null |
schell/odin | odin-engine/src/Control/Monad/Trans/NextT.hs | mit | -- | Runs both evented computations (left and then right) each frame and returns
-- the first computation that completes.
withEither :: MonadNext m => m a -> m b -> m (Either a b)
withEither ea eb = ((,) <$> runNext ea <*> runNext eb) >>= \case
( Left a, _) -> done $ Left a
( _, Left b) -> done $ Right b
(Right a, Right b) -> next $ withEither a b
-- | Runs all evented computations (left to right) on each frame and returns
-- the first computation that completes. | 486 | withEither :: MonadNext m => m a -> m b -> m (Either a b)
withEither ea eb = ((,) <$> runNext ea <*> runNext eb) >>= \case
( Left a, _) -> done $ Left a
( _, Left b) -> done $ Right b
(Right a, Right b) -> next $ withEither a b
-- | Runs all evented computations (left to right) on each frame and returns
-- the first computation that completes. | 364 | withEither ea eb = ((,) <$> runNext ea <*> runNext eb) >>= \case
( Left a, _) -> done $ Left a
( _, Left b) -> done $ Right b
(Right a, Right b) -> next $ withEither a b
-- | Runs all evented computations (left to right) on each frame and returns
-- the first computation that completes. | 306 | true | true | 0 | 11 | 114 | 154 | 75 | 79 | null | null |
Daniel-Diaz/FTPLine | Main.hs | bsd-3-clause | lastConn :: FTPLine ()
lastConn
= hand
(const $
withColor Red $ outputStrLn "Last connection doesn't exist.")
$
do appDir <- liftIO ftpLineDir
lc <- liftIO $ readFile $ appDir ++ "/LastConnection"
_ <- (liftIO $ readIO lc) >>= uncurry connect
outputStrLn "Last connection reestablished."
hand
(const $ withColor Red $ outputStrLn "Last login doesn't exist.")
$
do ll <- liftIO $ readFile $ appDir ++ "/LastLogin"
_ <- (liftIO $ readIO ll) >>= ftplogin . Just
outputStrLn "Last login reestablished." | 624 | lastConn :: FTPLine ()
lastConn
= hand
(const $
withColor Red $ outputStrLn "Last connection doesn't exist.")
$
do appDir <- liftIO ftpLineDir
lc <- liftIO $ readFile $ appDir ++ "/LastConnection"
_ <- (liftIO $ readIO lc) >>= uncurry connect
outputStrLn "Last connection reestablished."
hand
(const $ withColor Red $ outputStrLn "Last login doesn't exist.")
$
do ll <- liftIO $ readFile $ appDir ++ "/LastLogin"
_ <- (liftIO $ readIO ll) >>= ftplogin . Just
outputStrLn "Last login reestablished." | 624 | lastConn
= hand
(const $
withColor Red $ outputStrLn "Last connection doesn't exist.")
$
do appDir <- liftIO ftpLineDir
lc <- liftIO $ readFile $ appDir ++ "/LastConnection"
_ <- (liftIO $ readIO lc) >>= uncurry connect
outputStrLn "Last connection reestablished."
hand
(const $ withColor Red $ outputStrLn "Last login doesn't exist.")
$
do ll <- liftIO $ readFile $ appDir ++ "/LastLogin"
_ <- (liftIO $ readIO ll) >>= ftplogin . Just
outputStrLn "Last login reestablished." | 601 | false | true | 0 | 16 | 206 | 178 | 80 | 98 | null | null |
elginer/Delve | src/Symbol.hs | gpl-3.0 | -- render a path, OO-style
render_path :: [ Symbol ] -> Symbol
render_path path =
L.foldl B.append B.empty ( L.intersperse ( B.singleton '.' ) path ) | 153 | render_path :: [ Symbol ] -> Symbol
render_path path =
L.foldl B.append B.empty ( L.intersperse ( B.singleton '.' ) path ) | 126 | render_path path =
L.foldl B.append B.empty ( L.intersperse ( B.singleton '.' ) path ) | 90 | true | true | 0 | 10 | 29 | 53 | 27 | 26 | null | null |
kawamuray/ganeti | src/Ganeti/Constants.hs | gpl-2.0 | cryptoTypeSsh :: String
cryptoTypeSsh = "ssh" | 45 | cryptoTypeSsh :: String
cryptoTypeSsh = "ssh" | 45 | cryptoTypeSsh = "ssh" | 21 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
dikmax/haskell-blog | src/XmlHtmlWriter.hs | bsd-2-clause | writeRawInline (Strong inline) = do
inlines <- concatRawInlines inline
return ("<strong>" `T.append` inlines `T.append` "</strong>") | 136 | writeRawInline (Strong inline) = do
inlines <- concatRawInlines inline
return ("<strong>" `T.append` inlines `T.append` "</strong>") | 136 | writeRawInline (Strong inline) = do
inlines <- concatRawInlines inline
return ("<strong>" `T.append` inlines `T.append` "</strong>") | 136 | false | false | 0 | 10 | 18 | 50 | 25 | 25 | null | null |
pparkkin/eta | compiler/ETA/Prelude/PrimOp.hs | bsd-3-clause | primOpInfo ReadArrayArrayOp_MutableArrayArray = mkGenPrimOp (fsLit "readMutableArrayArrayArray#") [deltaTyVar] [mkMutableArrayArrayPrimTy deltaTy, intPrimTy, mkStatePrimTy deltaTy] ((mkTupleTy UnboxedTuple [mkStatePrimTy deltaTy, mkMutableArrayArrayPrimTy deltaTy])) | 267 | primOpInfo ReadArrayArrayOp_MutableArrayArray = mkGenPrimOp (fsLit "readMutableArrayArrayArray#") [deltaTyVar] [mkMutableArrayArrayPrimTy deltaTy, intPrimTy, mkStatePrimTy deltaTy] ((mkTupleTy UnboxedTuple [mkStatePrimTy deltaTy, mkMutableArrayArrayPrimTy deltaTy])) | 267 | primOpInfo ReadArrayArrayOp_MutableArrayArray = mkGenPrimOp (fsLit "readMutableArrayArrayArray#") [deltaTyVar] [mkMutableArrayArrayPrimTy deltaTy, intPrimTy, mkStatePrimTy deltaTy] ((mkTupleTy UnboxedTuple [mkStatePrimTy deltaTy, mkMutableArrayArrayPrimTy deltaTy])) | 267 | false | false | 0 | 10 | 18 | 65 | 33 | 32 | null | null |
spacekitteh/smcghc | compiler/nativeGen/PPC/CodeGen.hs | bsd-3-clause | extendSExpr rep x = CmmMachOp (MO_SS_Conv rep W32) [x] | 54 | extendSExpr rep x = CmmMachOp (MO_SS_Conv rep W32) [x] | 54 | extendSExpr rep x = CmmMachOp (MO_SS_Conv rep W32) [x] | 54 | false | false | 1 | 7 | 8 | 31 | 13 | 18 | null | null |
jfischoff/modulespection | src/Language/Haskell/TH/Module/Magic.hs | bsd-3-clause | -- | Parse a file and collect all of the declarations names
parseFile :: GhcMonad m => DynFlags -> FilePath -> m [TH.Name]
parseFile dflags filePath = do
src <- liftIO $ readFile filePath
let (warns, L _ hsModule) =
either (error . errString) id
$ parser src dflags filePath
names = mapMaybe getNameMaybe $ hsmodDecls hsModule
return $ map rdrNameToName names | 446 | parseFile :: GhcMonad m => DynFlags -> FilePath -> m [TH.Name]
parseFile dflags filePath = do
src <- liftIO $ readFile filePath
let (warns, L _ hsModule) =
either (error . errString) id
$ parser src dflags filePath
names = mapMaybe getNameMaybe $ hsmodDecls hsModule
return $ map rdrNameToName names | 386 | parseFile dflags filePath = do
src <- liftIO $ readFile filePath
let (warns, L _ hsModule) =
either (error . errString) id
$ parser src dflags filePath
names = mapMaybe getNameMaybe $ hsmodDecls hsModule
return $ map rdrNameToName names | 323 | true | true | 0 | 13 | 148 | 125 | 59 | 66 | null | null |
spacekitteh/smcghc | compiler/main/DynFlags.hs | bsd-3-clause | -- | These @-f\<blah\>@ flags can all be reversed with @-fno-\<blah\>@
fFlags :: [FlagSpec GeneralFlag]
fFlags = [
( "error-spans", Opt_ErrorSpans, nop ),
( "print-explicit-foralls", Opt_PrintExplicitForalls, nop ),
( "print-explicit-kinds", Opt_PrintExplicitKinds, nop ),
( "call-arity", Opt_CallArity, nop ),
( "strictness", Opt_Strictness, nop ),
( "late-dmd-anal", Opt_LateDmdAnal, nop ),
( "specialise", Opt_Specialise, nop ),
( "specialise-aggressively", Opt_SpecialiseAggressively, nop ),
( "float-in", Opt_FloatIn, nop ),
( "static-argument-transformation", Opt_StaticArgumentTransformation, nop ),
( "full-laziness", Opt_FullLaziness, nop ),
( "liberate-case", Opt_LiberateCase, nop ),
( "spec-constr", Opt_SpecConstr, nop ),
( "cse", Opt_CSE, nop ),
( "pedantic-bottoms", Opt_PedanticBottoms, nop ),
( "ignore-interface-pragmas", Opt_IgnoreInterfacePragmas, nop ),
( "omit-interface-pragmas", Opt_OmitInterfacePragmas, nop ),
( "write-interface", Opt_WriteInterface, nop ),
( "expose-all-unfoldings", Opt_ExposeAllUnfoldings, nop ),
( "do-lambda-eta-expansion", Opt_DoLambdaEtaExpansion, nop ),
( "ignore-asserts", Opt_IgnoreAsserts, nop ),
( "do-eta-reduction", Opt_DoEtaReduction, nop ),
( "case-merge", Opt_CaseMerge, nop ),
( "unbox-strict-fields", Opt_UnboxStrictFields, nop ),
( "unbox-small-strict-fields", Opt_UnboxSmallStrictFields, nop ),
( "dicts-cheap", Opt_DictsCheap, nop ),
( "excess-precision", Opt_ExcessPrecision, nop ),
( "eager-blackholing", Opt_EagerBlackHoling, nop ),
( "print-bind-result", Opt_PrintBindResult, nop ),
( "force-recomp", Opt_ForceRecomp, nop ),
( "hpc-no-auto", Opt_Hpc_No_Auto, nop ),
( "rewrite-rules", Opt_EnableRewriteRules, useInstead "enable-rewrite-rules" ),
( "enable-rewrite-rules", Opt_EnableRewriteRules, nop ),
( "break-on-exception", Opt_BreakOnException, nop ),
( "break-on-error", Opt_BreakOnError, nop ),
( "print-evld-with-show", Opt_PrintEvldWithShow, nop ),
( "print-bind-contents", Opt_PrintBindContents, nop ),
( "vectorise", Opt_Vectorise, nop ),
( "vectorisation-avoidance", Opt_VectorisationAvoidance, nop ),
( "regs-graph", Opt_RegsGraph, nop ),
( "regs-iterative", Opt_RegsIterative, nop ),
( "llvm-tbaa", Opt_LlvmTBAA, nop), -- hidden flag
( "llvm-pass-vectors-in-regs", Opt_LlvmPassVectorsInRegisters, nop), -- hidden flag
( "irrefutable-tuples", Opt_IrrefutableTuples, nop ),
( "cmm-sink", Opt_CmmSink, nop ),
( "cmm-elim-common-blocks", Opt_CmmElimCommonBlocks, nop ),
( "omit-yields", Opt_OmitYields, nop ),
( "simple-list-literals", Opt_SimpleListLiterals, nop ),
( "fun-to-thunk", Opt_FunToThunk, nop ),
( "gen-manifest", Opt_GenManifest, nop ),
( "embed-manifest", Opt_EmbedManifest, nop ),
( "ext-core", Opt_EmitExternalCore,
\_ -> deprecate "it has no effect, and will be removed in GHC 7.12" ),
( "shared-implib", Opt_SharedImplib, nop ),
( "ghci-sandbox", Opt_GhciSandbox, nop ),
( "ghci-history", Opt_GhciHistory, nop ),
( "helpful-errors", Opt_HelpfulErrors, nop ),
( "defer-type-errors", Opt_DeferTypeErrors, nop ),
( "building-cabal-package", Opt_BuildingCabalPackage, nop ),
( "implicit-import-qualified", Opt_ImplicitImportQualified, nop ),
( "prof-count-entries", Opt_ProfCountEntries, nop ),
( "prof-cafs", Opt_AutoSccsOnIndividualCafs, nop ),
( "hpc", Opt_Hpc, nop ),
( "pre-inlining", Opt_SimplPreInlining, nop ),
( "flat-cache", Opt_FlatCache, nop ),
( "use-rpaths", Opt_RPath, nop ),
( "kill-absence", Opt_KillAbsence, nop),
( "kill-one-shot", Opt_KillOneShot, nop),
( "dicts-strict", Opt_DictsStrict, nop ),
( "dmd-tx-dict-sel", Opt_DmdTxDictSel, nop ),
( "loopification", Opt_Loopification, nop )
] | 4,938 | fFlags :: [FlagSpec GeneralFlag]
fFlags = [
( "error-spans", Opt_ErrorSpans, nop ),
( "print-explicit-foralls", Opt_PrintExplicitForalls, nop ),
( "print-explicit-kinds", Opt_PrintExplicitKinds, nop ),
( "call-arity", Opt_CallArity, nop ),
( "strictness", Opt_Strictness, nop ),
( "late-dmd-anal", Opt_LateDmdAnal, nop ),
( "specialise", Opt_Specialise, nop ),
( "specialise-aggressively", Opt_SpecialiseAggressively, nop ),
( "float-in", Opt_FloatIn, nop ),
( "static-argument-transformation", Opt_StaticArgumentTransformation, nop ),
( "full-laziness", Opt_FullLaziness, nop ),
( "liberate-case", Opt_LiberateCase, nop ),
( "spec-constr", Opt_SpecConstr, nop ),
( "cse", Opt_CSE, nop ),
( "pedantic-bottoms", Opt_PedanticBottoms, nop ),
( "ignore-interface-pragmas", Opt_IgnoreInterfacePragmas, nop ),
( "omit-interface-pragmas", Opt_OmitInterfacePragmas, nop ),
( "write-interface", Opt_WriteInterface, nop ),
( "expose-all-unfoldings", Opt_ExposeAllUnfoldings, nop ),
( "do-lambda-eta-expansion", Opt_DoLambdaEtaExpansion, nop ),
( "ignore-asserts", Opt_IgnoreAsserts, nop ),
( "do-eta-reduction", Opt_DoEtaReduction, nop ),
( "case-merge", Opt_CaseMerge, nop ),
( "unbox-strict-fields", Opt_UnboxStrictFields, nop ),
( "unbox-small-strict-fields", Opt_UnboxSmallStrictFields, nop ),
( "dicts-cheap", Opt_DictsCheap, nop ),
( "excess-precision", Opt_ExcessPrecision, nop ),
( "eager-blackholing", Opt_EagerBlackHoling, nop ),
( "print-bind-result", Opt_PrintBindResult, nop ),
( "force-recomp", Opt_ForceRecomp, nop ),
( "hpc-no-auto", Opt_Hpc_No_Auto, nop ),
( "rewrite-rules", Opt_EnableRewriteRules, useInstead "enable-rewrite-rules" ),
( "enable-rewrite-rules", Opt_EnableRewriteRules, nop ),
( "break-on-exception", Opt_BreakOnException, nop ),
( "break-on-error", Opt_BreakOnError, nop ),
( "print-evld-with-show", Opt_PrintEvldWithShow, nop ),
( "print-bind-contents", Opt_PrintBindContents, nop ),
( "vectorise", Opt_Vectorise, nop ),
( "vectorisation-avoidance", Opt_VectorisationAvoidance, nop ),
( "regs-graph", Opt_RegsGraph, nop ),
( "regs-iterative", Opt_RegsIterative, nop ),
( "llvm-tbaa", Opt_LlvmTBAA, nop), -- hidden flag
( "llvm-pass-vectors-in-regs", Opt_LlvmPassVectorsInRegisters, nop), -- hidden flag
( "irrefutable-tuples", Opt_IrrefutableTuples, nop ),
( "cmm-sink", Opt_CmmSink, nop ),
( "cmm-elim-common-blocks", Opt_CmmElimCommonBlocks, nop ),
( "omit-yields", Opt_OmitYields, nop ),
( "simple-list-literals", Opt_SimpleListLiterals, nop ),
( "fun-to-thunk", Opt_FunToThunk, nop ),
( "gen-manifest", Opt_GenManifest, nop ),
( "embed-manifest", Opt_EmbedManifest, nop ),
( "ext-core", Opt_EmitExternalCore,
\_ -> deprecate "it has no effect, and will be removed in GHC 7.12" ),
( "shared-implib", Opt_SharedImplib, nop ),
( "ghci-sandbox", Opt_GhciSandbox, nop ),
( "ghci-history", Opt_GhciHistory, nop ),
( "helpful-errors", Opt_HelpfulErrors, nop ),
( "defer-type-errors", Opt_DeferTypeErrors, nop ),
( "building-cabal-package", Opt_BuildingCabalPackage, nop ),
( "implicit-import-qualified", Opt_ImplicitImportQualified, nop ),
( "prof-count-entries", Opt_ProfCountEntries, nop ),
( "prof-cafs", Opt_AutoSccsOnIndividualCafs, nop ),
( "hpc", Opt_Hpc, nop ),
( "pre-inlining", Opt_SimplPreInlining, nop ),
( "flat-cache", Opt_FlatCache, nop ),
( "use-rpaths", Opt_RPath, nop ),
( "kill-absence", Opt_KillAbsence, nop),
( "kill-one-shot", Opt_KillOneShot, nop),
( "dicts-strict", Opt_DictsStrict, nop ),
( "dmd-tx-dict-sel", Opt_DmdTxDictSel, nop ),
( "loopification", Opt_Loopification, nop )
] | 4,867 | fFlags = [
( "error-spans", Opt_ErrorSpans, nop ),
( "print-explicit-foralls", Opt_PrintExplicitForalls, nop ),
( "print-explicit-kinds", Opt_PrintExplicitKinds, nop ),
( "call-arity", Opt_CallArity, nop ),
( "strictness", Opt_Strictness, nop ),
( "late-dmd-anal", Opt_LateDmdAnal, nop ),
( "specialise", Opt_Specialise, nop ),
( "specialise-aggressively", Opt_SpecialiseAggressively, nop ),
( "float-in", Opt_FloatIn, nop ),
( "static-argument-transformation", Opt_StaticArgumentTransformation, nop ),
( "full-laziness", Opt_FullLaziness, nop ),
( "liberate-case", Opt_LiberateCase, nop ),
( "spec-constr", Opt_SpecConstr, nop ),
( "cse", Opt_CSE, nop ),
( "pedantic-bottoms", Opt_PedanticBottoms, nop ),
( "ignore-interface-pragmas", Opt_IgnoreInterfacePragmas, nop ),
( "omit-interface-pragmas", Opt_OmitInterfacePragmas, nop ),
( "write-interface", Opt_WriteInterface, nop ),
( "expose-all-unfoldings", Opt_ExposeAllUnfoldings, nop ),
( "do-lambda-eta-expansion", Opt_DoLambdaEtaExpansion, nop ),
( "ignore-asserts", Opt_IgnoreAsserts, nop ),
( "do-eta-reduction", Opt_DoEtaReduction, nop ),
( "case-merge", Opt_CaseMerge, nop ),
( "unbox-strict-fields", Opt_UnboxStrictFields, nop ),
( "unbox-small-strict-fields", Opt_UnboxSmallStrictFields, nop ),
( "dicts-cheap", Opt_DictsCheap, nop ),
( "excess-precision", Opt_ExcessPrecision, nop ),
( "eager-blackholing", Opt_EagerBlackHoling, nop ),
( "print-bind-result", Opt_PrintBindResult, nop ),
( "force-recomp", Opt_ForceRecomp, nop ),
( "hpc-no-auto", Opt_Hpc_No_Auto, nop ),
( "rewrite-rules", Opt_EnableRewriteRules, useInstead "enable-rewrite-rules" ),
( "enable-rewrite-rules", Opt_EnableRewriteRules, nop ),
( "break-on-exception", Opt_BreakOnException, nop ),
( "break-on-error", Opt_BreakOnError, nop ),
( "print-evld-with-show", Opt_PrintEvldWithShow, nop ),
( "print-bind-contents", Opt_PrintBindContents, nop ),
( "vectorise", Opt_Vectorise, nop ),
( "vectorisation-avoidance", Opt_VectorisationAvoidance, nop ),
( "regs-graph", Opt_RegsGraph, nop ),
( "regs-iterative", Opt_RegsIterative, nop ),
( "llvm-tbaa", Opt_LlvmTBAA, nop), -- hidden flag
( "llvm-pass-vectors-in-regs", Opt_LlvmPassVectorsInRegisters, nop), -- hidden flag
( "irrefutable-tuples", Opt_IrrefutableTuples, nop ),
( "cmm-sink", Opt_CmmSink, nop ),
( "cmm-elim-common-blocks", Opt_CmmElimCommonBlocks, nop ),
( "omit-yields", Opt_OmitYields, nop ),
( "simple-list-literals", Opt_SimpleListLiterals, nop ),
( "fun-to-thunk", Opt_FunToThunk, nop ),
( "gen-manifest", Opt_GenManifest, nop ),
( "embed-manifest", Opt_EmbedManifest, nop ),
( "ext-core", Opt_EmitExternalCore,
\_ -> deprecate "it has no effect, and will be removed in GHC 7.12" ),
( "shared-implib", Opt_SharedImplib, nop ),
( "ghci-sandbox", Opt_GhciSandbox, nop ),
( "ghci-history", Opt_GhciHistory, nop ),
( "helpful-errors", Opt_HelpfulErrors, nop ),
( "defer-type-errors", Opt_DeferTypeErrors, nop ),
( "building-cabal-package", Opt_BuildingCabalPackage, nop ),
( "implicit-import-qualified", Opt_ImplicitImportQualified, nop ),
( "prof-count-entries", Opt_ProfCountEntries, nop ),
( "prof-cafs", Opt_AutoSccsOnIndividualCafs, nop ),
( "hpc", Opt_Hpc, nop ),
( "pre-inlining", Opt_SimplPreInlining, nop ),
( "flat-cache", Opt_FlatCache, nop ),
( "use-rpaths", Opt_RPath, nop ),
( "kill-absence", Opt_KillAbsence, nop),
( "kill-one-shot", Opt_KillOneShot, nop),
( "dicts-strict", Opt_DictsStrict, nop ),
( "dmd-tx-dict-sel", Opt_DmdTxDictSel, nop ),
( "loopification", Opt_Loopification, nop )
] | 4,834 | true | true | 0 | 8 | 1,723 | 871 | 577 | 294 | null | null |
MaxGabriel/yesod | yesod-core/Yesod/Core/Handler.hs | mit | validCsrf (Just _token) Nothing = False | 43 | validCsrf (Just _token) Nothing = False | 43 | validCsrf (Just _token) Nothing = False | 43 | false | false | 0 | 7 | 9 | 17 | 8 | 9 | null | null |
RossMeikleham/Idris-dev | src/IRTS/CodegenC.hs | bsd-3-clause | doOp v (LSHL ITChar) [l, r] = doOp v (LSHL ITNative) [l, r] | 59 | doOp v (LSHL ITChar) [l, r] = doOp v (LSHL ITNative) [l, r] | 59 | doOp v (LSHL ITChar) [l, r] = doOp v (LSHL ITNative) [l, r] | 59 | false | false | 0 | 7 | 12 | 44 | 23 | 21 | null | null |
alicemaz/advent2016 | One.hs | bsd-3-clause | step S (x, y) m = (x, y - m) | 28 | step S (x, y) m = (x, y - m) | 28 | step S (x, y) m = (x, y - m) | 28 | false | false | 1 | 7 | 9 | 35 | 16 | 19 | null | null |
marcmo/hsDiagnosis | src/Diag/Config.hs | bsd-3-clause | defaultConfigFile :: IO String
defaultConfigFile = do home <- System.Directory.getUserDocumentsDirectory
return $ home ++ "/.hsDiagnosis/config.cfg" | 172 | defaultConfigFile :: IO String
defaultConfigFile = do home <- System.Directory.getUserDocumentsDirectory
return $ home ++ "/.hsDiagnosis/config.cfg" | 172 | defaultConfigFile = do home <- System.Directory.getUserDocumentsDirectory
return $ home ++ "/.hsDiagnosis/config.cfg" | 140 | false | true | 0 | 8 | 38 | 35 | 17 | 18 | null | null |
adamse/haddock | haddock-api/src/Haddock/Backends/LaTeX.hs | bsd-2-clause | rdrDocToLaTeX :: Doc RdrName -> LaTeX
rdrDocToLaTeX doc = markup rdrLatexMarkup doc Plain | 89 | rdrDocToLaTeX :: Doc RdrName -> LaTeX
rdrDocToLaTeX doc = markup rdrLatexMarkup doc Plain | 89 | rdrDocToLaTeX doc = markup rdrLatexMarkup doc Plain | 51 | false | true | 0 | 7 | 12 | 33 | 14 | 19 | null | null |
danfran/feed | src/Text/RSS1/Export.hs | bsd-3-clause | xmlChannel :: Channel -> XML.Element
xmlChannel ch =
(qualNode (rss10NS,Nothing) "channel" $ map Elem $
([ xmlLeaf (rss10NS,Nothing) "title" (channelTitle ch)
, xmlLeaf (rss10NS,Nothing) "link" (channelLink ch)
, xmlLeaf (rss10NS,Nothing) "description" (channelDesc ch)
] ++
mb xmlTextInputURI (channelTextInputURI ch) ++
mb xmlImageURI (channelImageURI ch) ++
xmlItemURIs (channelItemURIs ch) ++ map xmlDC (channelDC ch) ++
concat [ mb xmlUpdatePeriod (channelUpdatePeriod ch)
, mb xmlUpdateFreq (channelUpdateFreq ch)
, mb (xmlLeaf (synNS,synPrefix) "updateBase") (channelUpdateBase ch)
] ++
xmlContentItems (channelContent ch) ++
xmlTopics (channelTopics ch) ++
channelOther ch))
{ elAttribs = ( Attr (qualName (rdfNS,rdfPrefix) "about") (channelURI ch) :
channelAttrs ch)} | 921 | xmlChannel :: Channel -> XML.Element
xmlChannel ch =
(qualNode (rss10NS,Nothing) "channel" $ map Elem $
([ xmlLeaf (rss10NS,Nothing) "title" (channelTitle ch)
, xmlLeaf (rss10NS,Nothing) "link" (channelLink ch)
, xmlLeaf (rss10NS,Nothing) "description" (channelDesc ch)
] ++
mb xmlTextInputURI (channelTextInputURI ch) ++
mb xmlImageURI (channelImageURI ch) ++
xmlItemURIs (channelItemURIs ch) ++ map xmlDC (channelDC ch) ++
concat [ mb xmlUpdatePeriod (channelUpdatePeriod ch)
, mb xmlUpdateFreq (channelUpdateFreq ch)
, mb (xmlLeaf (synNS,synPrefix) "updateBase") (channelUpdateBase ch)
] ++
xmlContentItems (channelContent ch) ++
xmlTopics (channelTopics ch) ++
channelOther ch))
{ elAttribs = ( Attr (qualName (rdfNS,rdfPrefix) "about") (channelURI ch) :
channelAttrs ch)} | 921 | xmlChannel ch =
(qualNode (rss10NS,Nothing) "channel" $ map Elem $
([ xmlLeaf (rss10NS,Nothing) "title" (channelTitle ch)
, xmlLeaf (rss10NS,Nothing) "link" (channelLink ch)
, xmlLeaf (rss10NS,Nothing) "description" (channelDesc ch)
] ++
mb xmlTextInputURI (channelTextInputURI ch) ++
mb xmlImageURI (channelImageURI ch) ++
xmlItemURIs (channelItemURIs ch) ++ map xmlDC (channelDC ch) ++
concat [ mb xmlUpdatePeriod (channelUpdatePeriod ch)
, mb xmlUpdateFreq (channelUpdateFreq ch)
, mb (xmlLeaf (synNS,synPrefix) "updateBase") (channelUpdateBase ch)
] ++
xmlContentItems (channelContent ch) ++
xmlTopics (channelTopics ch) ++
channelOther ch))
{ elAttribs = ( Attr (qualName (rdfNS,rdfPrefix) "about") (channelURI ch) :
channelAttrs ch)} | 884 | false | true | 0 | 19 | 241 | 315 | 159 | 156 | null | null |
frasertweedale/freebsd-update-repair | src/Main.hs | mit | main :: IO ()
main = join $ execParser (info commands mempty) | 61 | main :: IO ()
main = join $ execParser (info commands mempty) | 61 | main = join $ execParser (info commands mempty) | 47 | false | true | 0 | 8 | 11 | 31 | 15 | 16 | null | null |
urbanslug/ghc | libraries/base/GHC/Conc/Sync.hs | bsd-3-clause | -- | A variant of 'throw' that can only be used within the 'STM' monad.
--
-- Throwing an exception in @STM@ aborts the transaction and propagates the
-- exception.
--
-- Although 'throwSTM' has a type that is an instance of the type of 'throw', the
-- two functions are subtly different:
--
-- > throw e `seq` x ===> throw e
-- > throwSTM e `seq` x ===> x
--
-- The first example will cause the exception @e@ to be raised,
-- whereas the second one won\'t. In fact, 'throwSTM' will only cause
-- an exception to be raised when it is used within the 'STM' monad.
-- The 'throwSTM' variant should be used in preference to 'throw' to
-- raise an exception within the 'STM' monad because it guarantees
-- ordering with respect to other 'STM' operations, whereas 'throw'
-- does not.
throwSTM :: Exception e => e -> STM a
throwSTM e = STM $ raiseIO# (toException e) | 867 | throwSTM :: Exception e => e -> STM a
throwSTM e = STM $ raiseIO# (toException e) | 81 | throwSTM e = STM $ raiseIO# (toException e) | 43 | true | true | 0 | 8 | 168 | 59 | 37 | 22 | null | null |
csierra/didactic-upgrade-monads | src/Upgrade/Util.hs | gpl-2.0 | runSqlite3 :: DBCmd () SqlValue -> IO ()
runSqlite3 upgrade =
bracket (connectSqlite3 "upgrade.db") close runUpgrade
where close c = commit c >> disconnect c
runUpgrade = runReaderT upgrade . sqlite3Context | 224 | runSqlite3 :: DBCmd () SqlValue -> IO ()
runSqlite3 upgrade =
bracket (connectSqlite3 "upgrade.db") close runUpgrade
where close c = commit c >> disconnect c
runUpgrade = runReaderT upgrade . sqlite3Context | 224 | runSqlite3 upgrade =
bracket (connectSqlite3 "upgrade.db") close runUpgrade
where close c = commit c >> disconnect c
runUpgrade = runReaderT upgrade . sqlite3Context | 183 | false | true | 3 | 8 | 48 | 85 | 36 | 49 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.