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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mcschroeder/ghc | compiler/prelude/TysWiredIn.hs | bsd-3-clause | mkWiredInTyConName :: BuiltInSyntax -> Module -> FastString -> Unique -> TyCon -> Name
mkWiredInTyConName built_in modu fs unique tycon
= mkWiredInName modu (mkTcOccFS fs) unique
(ATyCon tycon) -- Relevant TyCon
built_in | 265 | mkWiredInTyConName :: BuiltInSyntax -> Module -> FastString -> Unique -> TyCon -> Name
mkWiredInTyConName built_in modu fs unique tycon
= mkWiredInName modu (mkTcOccFS fs) unique
(ATyCon tycon) -- Relevant TyCon
built_in | 265 | mkWiredInTyConName built_in modu fs unique tycon
= mkWiredInName modu (mkTcOccFS fs) unique
(ATyCon tycon) -- Relevant TyCon
built_in | 178 | false | true | 0 | 9 | 75 | 66 | 33 | 33 | null | null |
farre/grin | Test.hs | bsd-3-clause | test7 :: Pattern a => Grin a
test7 = do
Var x <- unit (5 :: Integer)
Var y <- switch x $ on
(\(Var x) -> unit' x)
(\(Foo a b) -> unit' x)
unit y | 176 | test7 :: Pattern a => Grin a
test7 = do
Var x <- unit (5 :: Integer)
Var y <- switch x $ on
(\(Var x) -> unit' x)
(\(Foo a b) -> unit' x)
unit y | 176 | test7 = do
Var x <- unit (5 :: Integer)
Var y <- switch x $ on
(\(Var x) -> unit' x)
(\(Foo a b) -> unit' x)
unit y | 147 | false | true | 0 | 13 | 68 | 104 | 49 | 55 | null | null |
meiersi/scyther-proof | src/Text/PrettyPrint/Class.hs | gpl-3.0 | punctuate p (d:ds) = go d ds
where
go d' [] = [d']
go d' (e:es) = (d' <> p) : go e es | 146 | punctuate p (d:ds) = go d ds
where
go d' [] = [d']
go d' (e:es) = (d' <> p) : go e es | 146 | punctuate p (d:ds) = go d ds
where
go d' [] = [d']
go d' (e:es) = (d' <> p) : go e es | 146 | false | false | 0 | 9 | 84 | 73 | 37 | 36 | null | null |
TrevorBender/caves | src/Game.hs | gpl-3.0 | offsetDir NE = offsetDir N <+> offsetDir E | 42 | offsetDir NE = offsetDir N <+> offsetDir E | 42 | offsetDir NE = offsetDir N <+> offsetDir E | 42 | false | false | 0 | 6 | 7 | 19 | 8 | 11 | null | null |
tpsinnem/Idris-dev | src/Idris/Core/ProofTerm.hs | bsd-3-clause | rebuildBinder tm (GuessT p t) = Guess (rebuildTerm tm p) t | 58 | rebuildBinder tm (GuessT p t) = Guess (rebuildTerm tm p) t | 58 | rebuildBinder tm (GuessT p t) = Guess (rebuildTerm tm p) t | 58 | false | false | 0 | 7 | 10 | 32 | 15 | 17 | null | null |
nsmryan/Misc | src/SeqZip.hs | bsd-3-clause | zipRight 0 z = z | 16 | zipRight 0 z = z | 16 | zipRight 0 z = z | 16 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
vikraman/ghc | compiler/hsSyn/HsPat.hs | bsd-3-clause | hsPatNeedsParens p@(ConPatOut {}) = conPatNeedsParens (pat_args p) | 69 | hsPatNeedsParens p@(ConPatOut {}) = conPatNeedsParens (pat_args p) | 69 | hsPatNeedsParens p@(ConPatOut {}) = conPatNeedsParens (pat_args p) | 69 | false | false | 0 | 8 | 9 | 28 | 14 | 14 | null | null |
haroldcarr/juno | src/Juno/Types/Base.hs | bsd-3-clause | startTerm :: Term
startTerm = Term (-1) | 39 | startTerm :: Term
startTerm = Term (-1) | 39 | startTerm = Term (-1) | 21 | false | true | 0 | 7 | 6 | 25 | 11 | 14 | null | null |
reflex-frp/reflex | src/Reflex/Class.hs | bsd-3-clause | -- | Split the event into separate events for 'Left' and 'Right' values.
fanEither :: Reflex t => Event t (Either a b) -> (Event t a, Event t b)
fanEither e =
let justLeft = either Just (const Nothing)
justRight = either (const Nothing) Just
in (mapMaybe justLeft e, mapMaybe justRight e) | 298 | fanEither :: Reflex t => Event t (Either a b) -> (Event t a, Event t b)
fanEither e =
let justLeft = either Just (const Nothing)
justRight = either (const Nothing) Just
in (mapMaybe justLeft e, mapMaybe justRight e) | 225 | fanEither e =
let justLeft = either Just (const Nothing)
justRight = either (const Nothing) Just
in (mapMaybe justLeft e, mapMaybe justRight e) | 153 | true | true | 0 | 11 | 62 | 109 | 53 | 56 | null | null |
phaazon/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/Tokens.hs | bsd-3-clause | gl_VERTEX_STREAM1_ATI :: GLenum
gl_VERTEX_STREAM1_ATI = 0x876D | 62 | gl_VERTEX_STREAM1_ATI :: GLenum
gl_VERTEX_STREAM1_ATI = 0x876D | 62 | gl_VERTEX_STREAM1_ATI = 0x876D | 30 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
snoyberg/ghc | compiler/utils/BooleanFormula.hs | bsd-3-clause | eval :: (a -> Bool) -> BooleanFormula a -> Bool
eval f (Var x) = f x | 69 | eval :: (a -> Bool) -> BooleanFormula a -> Bool
eval f (Var x) = f x | 69 | eval f (Var x) = f x | 21 | false | true | 0 | 7 | 17 | 48 | 22 | 26 | null | null |
koba-e964/hayashii-mcc | llvm/Emit.hs | bsd-3-clause | funtypeToLLVMType :: Type.Type -> AST.Type
funtypeToLLVMType ty = case ty of
TFun ls ret -> AST.FunctionType (typeToLLVMType ret) (map typeToLLVMType ls) False
_ -> error "not a funtype" | 190 | funtypeToLLVMType :: Type.Type -> AST.Type
funtypeToLLVMType ty = case ty of
TFun ls ret -> AST.FunctionType (typeToLLVMType ret) (map typeToLLVMType ls) False
_ -> error "not a funtype" | 190 | funtypeToLLVMType ty = case ty of
TFun ls ret -> AST.FunctionType (typeToLLVMType ret) (map typeToLLVMType ls) False
_ -> error "not a funtype" | 147 | false | true | 5 | 9 | 31 | 71 | 33 | 38 | null | null |
athanclark/listvsgeneric | test/CompetitionSpec.hs | bsd-3-clause | spec :: TestTree
spec = testGroup "# Competition"
[ QC.testProperty "*`toIntMap` should be equivalent" toIntMap
] | 117 | spec :: TestTree
spec = testGroup "# Competition"
[ QC.testProperty "*`toIntMap` should be equivalent" toIntMap
] | 117 | spec = testGroup "# Competition"
[ QC.testProperty "*`toIntMap` should be equivalent" toIntMap
] | 100 | false | true | 0 | 8 | 19 | 34 | 14 | 20 | null | null |
nushio3/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | pickQuantifiablePreds
:: TyVarSet -- Quantifying over these
-> TcThetaType -- Proposed constraints to quantify
-> TcThetaType -- A subset that we can actually quantify
-- This function decides whether a particular constraint shoudl be
-- quantified over, given the type variables that are being quantified
pickQuantifiablePreds qtvs theta
= let flex_ctxt = True in -- Quantify over non-tyvar constraints, even without
-- -XFlexibleContexts: see Trac #10608, #10351
-- flex_ctxt <- xoptM Opt_FlexibleContexts
filter (pick_me flex_ctxt) theta
where
pick_me flex_ctxt pred
= case classifyPredType pred of
ClassPred cls tys
| isIPClass cls -> True -- See note [Inheriting implicit parameters]
| otherwise -> pick_cls_pred flex_ctxt cls tys
EqPred ReprEq ty1 ty2 -> pick_cls_pred flex_ctxt coercibleClass [ty1, ty2]
-- representational equality is like a class constraint
EqPred NomEq ty1 ty2 -> quant_fun ty1 || quant_fun ty2
IrredPred ty -> tyCoVarsOfType ty `intersectsVarSet` qtvs
pick_cls_pred flex_ctxt cls tys
= tyCoVarsOfTypes tys `intersectsVarSet` qtvs
&& (checkValidClsArgs flex_ctxt cls tys)
-- Only quantify over predicates that checkValidType
-- will pass! See Trac #10351.
-- See Note [Quantifying over equality constraints]
quant_fun ty
= case tcSplitTyConApp_maybe ty of
Just (tc, tys) | isTypeFamilyTyCon tc
-> tyCoVarsOfTypes tys `intersectsVarSet` qtvs
_ -> False
-- Superclasses | 1,684 | pickQuantifiablePreds
:: TyVarSet -- Quantifying over these
-> TcThetaType -- Proposed constraints to quantify
-> TcThetaType
pickQuantifiablePreds qtvs theta
= let flex_ctxt = True in -- Quantify over non-tyvar constraints, even without
-- -XFlexibleContexts: see Trac #10608, #10351
-- flex_ctxt <- xoptM Opt_FlexibleContexts
filter (pick_me flex_ctxt) theta
where
pick_me flex_ctxt pred
= case classifyPredType pred of
ClassPred cls tys
| isIPClass cls -> True -- See note [Inheriting implicit parameters]
| otherwise -> pick_cls_pred flex_ctxt cls tys
EqPred ReprEq ty1 ty2 -> pick_cls_pred flex_ctxt coercibleClass [ty1, ty2]
-- representational equality is like a class constraint
EqPred NomEq ty1 ty2 -> quant_fun ty1 || quant_fun ty2
IrredPred ty -> tyCoVarsOfType ty `intersectsVarSet` qtvs
pick_cls_pred flex_ctxt cls tys
= tyCoVarsOfTypes tys `intersectsVarSet` qtvs
&& (checkValidClsArgs flex_ctxt cls tys)
-- Only quantify over predicates that checkValidType
-- will pass! See Trac #10351.
-- See Note [Quantifying over equality constraints]
quant_fun ty
= case tcSplitTyConApp_maybe ty of
Just (tc, tys) | isTypeFamilyTyCon tc
-> tyCoVarsOfTypes tys `intersectsVarSet` qtvs
_ -> False
-- Superclasses | 1,497 | pickQuantifiablePreds qtvs theta
= let flex_ctxt = True in -- Quantify over non-tyvar constraints, even without
-- -XFlexibleContexts: see Trac #10608, #10351
-- flex_ctxt <- xoptM Opt_FlexibleContexts
filter (pick_me flex_ctxt) theta
where
pick_me flex_ctxt pred
= case classifyPredType pred of
ClassPred cls tys
| isIPClass cls -> True -- See note [Inheriting implicit parameters]
| otherwise -> pick_cls_pred flex_ctxt cls tys
EqPred ReprEq ty1 ty2 -> pick_cls_pred flex_ctxt coercibleClass [ty1, ty2]
-- representational equality is like a class constraint
EqPred NomEq ty1 ty2 -> quant_fun ty1 || quant_fun ty2
IrredPred ty -> tyCoVarsOfType ty `intersectsVarSet` qtvs
pick_cls_pred flex_ctxt cls tys
= tyCoVarsOfTypes tys `intersectsVarSet` qtvs
&& (checkValidClsArgs flex_ctxt cls tys)
-- Only quantify over predicates that checkValidType
-- will pass! See Trac #10351.
-- See Note [Quantifying over equality constraints]
quant_fun ty
= case tcSplitTyConApp_maybe ty of
Just (tc, tys) | isTypeFamilyTyCon tc
-> tyCoVarsOfTypes tys `intersectsVarSet` qtvs
_ -> False
-- Superclasses | 1,348 | true | true | 4 | 11 | 487 | 288 | 137 | 151 | null | null |
ihc/futhark | src/Futhark/Pass/ExtractKernels/Distribution.hs | isc | targetScope :: Target -> Scope Kernels
targetScope = scopeOfPattern . fst | 73 | targetScope :: Target -> Scope Kernels
targetScope = scopeOfPattern . fst | 73 | targetScope = scopeOfPattern . fst | 34 | false | true | 0 | 6 | 10 | 22 | 11 | 11 | null | null |
MiroslavVitkov/voiceid | misc/hw2.hs | mit | toString (m:l) = [show m] ++ toString l | 39 | toString (m:l) = [show m] ++ toString l | 39 | toString (m:l) = [show m] ++ toString l | 39 | false | false | 0 | 7 | 7 | 29 | 14 | 15 | null | null |
573/leksah | src/IDE/Pane/HLint.hs | gpl-2.0 | removeRemaining :: TreeStore a -> TreePath -> IO ()
removeRemaining store path = do
found <- treeStoreRemove store path
when found $ removeRemaining store path | 170 | removeRemaining :: TreeStore a -> TreePath -> IO ()
removeRemaining store path = do
found <- treeStoreRemove store path
when found $ removeRemaining store path | 169 | removeRemaining store path = do
found <- treeStoreRemove store path
when found $ removeRemaining store path | 117 | false | true | 0 | 8 | 35 | 59 | 26 | 33 | null | null |
ku-fpg/kansas-amber | System/Hardware/Haskino/Compiler.hs | bsd-3-clause | compileCommand (WriteRemoteRefW32 (RemoteRefW32 i) e) = do
compileShallowPrimitiveError "writeRemoteRefW32"
return () | 121 | compileCommand (WriteRemoteRefW32 (RemoteRefW32 i) e) = do
compileShallowPrimitiveError "writeRemoteRefW32"
return () | 121 | compileCommand (WriteRemoteRefW32 (RemoteRefW32 i) e) = do
compileShallowPrimitiveError "writeRemoteRefW32"
return () | 121 | false | false | 0 | 9 | 14 | 37 | 16 | 21 | null | null |
rahulmutt/ghcvm | compiler/Eta/Types/CoAxiom.hs | bsd-3-clause | brListFoldlM_ :: forall a b m br. Monad m
=> (a -> b -> m a) -> a -> BranchList b br -> m ()
brListFoldlM_ f z brs = do { _ <- go z brs
; return () }
where go :: forall br'. Monad m => a -> BranchList b br' -> m a
go acc (FirstBranch b) = f acc b
go acc (NextBranch h t) = do { fh <- f acc h
; go fh t }
-- zipWith | 412 | brListFoldlM_ :: forall a b m br. Monad m
=> (a -> b -> m a) -> a -> BranchList b br -> m ()
brListFoldlM_ f z brs = do { _ <- go z brs
; return () }
where go :: forall br'. Monad m => a -> BranchList b br' -> m a
go acc (FirstBranch b) = f acc b
go acc (NextBranch h t) = do { fh <- f acc h
; go fh t }
-- zipWith | 412 | brListFoldlM_ f z brs = do { _ <- go z brs
; return () }
where go :: forall br'. Monad m => a -> BranchList b br' -> m a
go acc (FirstBranch b) = f acc b
go acc (NextBranch h t) = do { fh <- f acc h
; go fh t }
-- zipWith | 305 | false | true | 6 | 11 | 182 | 187 | 94 | 93 | null | null |
robeverest/accelerate | Data/Array/Accelerate/Interpreter.hs | bsd-3-clause | evalPrim (PrimBXor ty) = evalBXor ty | 47 | evalPrim (PrimBXor ty) = evalBXor ty | 47 | evalPrim (PrimBXor ty) = evalBXor ty | 47 | false | false | 0 | 7 | 16 | 18 | 8 | 10 | null | null |
adamwalker/xbee | Xbee.hs | bsd-3-clause | receive :: Parser RecvPacket
receive = do
word8 0x7e --start byte
word8 0x00 --msb
lsb <- getWord8Escaped
word8 0x81 --cmd
addressMSB <- getWord8Escaped
addressLSB <- getWord8Escaped
let sourceAddr = (fromIntegral addressMSB `shift` 8) .|. fromIntegral addressLSB
rssi <- getWord8Escaped
recvOptions <- getWord8Escaped
recvData <- liftM BS.pack $ replicateM (fromIntegral lsb - 5) getWord8Escaped
cs <- getWord8Escaped
unless (checkCSum $ 0x81 : addressMSB : addressLSB : rssi : recvOptions : cs : BS.unpack recvData) (fail "checksum failed")
return RecvPacket {..} | 647 | receive :: Parser RecvPacket
receive = do
word8 0x7e --start byte
word8 0x00 --msb
lsb <- getWord8Escaped
word8 0x81 --cmd
addressMSB <- getWord8Escaped
addressLSB <- getWord8Escaped
let sourceAddr = (fromIntegral addressMSB `shift` 8) .|. fromIntegral addressLSB
rssi <- getWord8Escaped
recvOptions <- getWord8Escaped
recvData <- liftM BS.pack $ replicateM (fromIntegral lsb - 5) getWord8Escaped
cs <- getWord8Escaped
unless (checkCSum $ 0x81 : addressMSB : addressLSB : rssi : recvOptions : cs : BS.unpack recvData) (fail "checksum failed")
return RecvPacket {..} | 647 | receive = do
word8 0x7e --start byte
word8 0x00 --msb
lsb <- getWord8Escaped
word8 0x81 --cmd
addressMSB <- getWord8Escaped
addressLSB <- getWord8Escaped
let sourceAddr = (fromIntegral addressMSB `shift` 8) .|. fromIntegral addressLSB
rssi <- getWord8Escaped
recvOptions <- getWord8Escaped
recvData <- liftM BS.pack $ replicateM (fromIntegral lsb - 5) getWord8Escaped
cs <- getWord8Escaped
unless (checkCSum $ 0x81 : addressMSB : addressLSB : rssi : recvOptions : cs : BS.unpack recvData) (fail "checksum failed")
return RecvPacket {..} | 618 | false | true | 0 | 16 | 160 | 203 | 92 | 111 | null | null |
ozgurakgun/Idris-dev | src/Idris/Core/CaseTree.hs | bsd-3-clause | stripLambdas x = x | 18 | stripLambdas x = x | 18 | stripLambdas x = x | 18 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
ezyang/ghc | compiler/typecheck/TcRnTypes.hs | bsd-3-clause | insolubleWantedCt :: Ct -> Bool
-- Definitely insoluble, in particular /excluding/ type-hole constraints
insolubleWantedCt ct
| isGivenCt ct = False -- See Note [Given insolubles]
| isHoleCt ct = isOutOfScopeCt ct -- See Note [Insoluble holes]
| insolubleEqCt ct = True
| otherwise = False | 327 | insolubleWantedCt :: Ct -> Bool
insolubleWantedCt ct
| isGivenCt ct = False -- See Note [Given insolubles]
| isHoleCt ct = isOutOfScopeCt ct -- See Note [Insoluble holes]
| insolubleEqCt ct = True
| otherwise = False | 254 | insolubleWantedCt ct
| isGivenCt ct = False -- See Note [Given insolubles]
| isHoleCt ct = isOutOfScopeCt ct -- See Note [Insoluble holes]
| insolubleEqCt ct = True
| otherwise = False | 222 | true | true | 0 | 8 | 82 | 78 | 34 | 44 | null | null |
wereHamster/nauva | pkg/hs/color/test/Test.hs | mit | _unColorV :: Getter (ColorV a) (a, a, a)
_unColorV = to unColorV | 64 | _unColorV :: Getter (ColorV a) (a, a, a)
_unColorV = to unColorV | 64 | _unColorV = to unColorV | 23 | false | true | 0 | 8 | 11 | 40 | 19 | 21 | null | null |
rueshyna/gogol | gogol-proximitybeacon/gen/Network/Google/ProximityBeacon/Types/Product.hs | mpl-2.0 | -- | Some beacons may require a user to provide an authorization key before
-- changing any of its configuration (e.g. broadcast frames, transmit
-- power). This field provides a place to store and control access to that
-- key. This field is populated in responses to \`GET
-- \/v1beta1\/beacons\/3!beaconId\` from users with write access to the
-- given beacon. That is to say: If the user is authorized to write the
-- beacon\'s confidential data in the service, the service considers them
-- authorized to configure the beacon. Note that this key grants nothing on
-- the service, only on the beacon itself.
bProvisioningKey :: Lens' Beacon (Maybe ByteString)
bProvisioningKey
= lens _bProvisioningKey
(\ s a -> s{_bProvisioningKey = a})
. mapping _Bytes | 772 | bProvisioningKey :: Lens' Beacon (Maybe ByteString)
bProvisioningKey
= lens _bProvisioningKey
(\ s a -> s{_bProvisioningKey = a})
. mapping _Bytes | 160 | bProvisioningKey
= lens _bProvisioningKey
(\ s a -> s{_bProvisioningKey = a})
. mapping _Bytes | 108 | true | true | 2 | 8 | 137 | 67 | 36 | 31 | null | null |
Javran/misc | syb-play/src/Main.hs | mit | printTree :: Show a => Tree a -> IO ()
printTree t = putStrLn (drawTree (fmap show t)) | 86 | printTree :: Show a => Tree a -> IO ()
printTree t = putStrLn (drawTree (fmap show t)) | 86 | printTree t = putStrLn (drawTree (fmap show t)) | 47 | false | true | 0 | 9 | 17 | 50 | 23 | 27 | null | null |
danr/hipspec | testsuite/prod/zeno_version/PropT50.hs | gpl-3.0 | qexp x (S n) acc = qexp x n (x * acc) | 37 | qexp x (S n) acc = qexp x n (x * acc) | 37 | qexp x (S n) acc = qexp x n (x * acc) | 37 | false | false | 0 | 7 | 11 | 33 | 16 | 17 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/Resources/SSMResourceDataSync.hs | mit | -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-resourcedatasync.html#cfn-ssm-resourcedatasync-syncformat
ssmrdsSyncFormat :: Lens' SSMResourceDataSync (Val Text)
ssmrdsSyncFormat = lens _sSMResourceDataSyncSyncFormat (\s a -> s { _sSMResourceDataSyncSyncFormat = a }) | 304 | ssmrdsSyncFormat :: Lens' SSMResourceDataSync (Val Text)
ssmrdsSyncFormat = lens _sSMResourceDataSyncSyncFormat (\s a -> s { _sSMResourceDataSyncSyncFormat = a }) | 162 | ssmrdsSyncFormat = lens _sSMResourceDataSyncSyncFormat (\s a -> s { _sSMResourceDataSyncSyncFormat = a }) | 105 | true | true | 0 | 9 | 21 | 46 | 25 | 21 | null | null |
zjhmale/HMF | src/FCP/Infer.hs | bsd-3-clause | canNotUnifyError :: T -> T -> Infer ()
canNotUnifyError t1 t2 = error $ "cannot unify types " ++ show t1 ++ " and " ++ show t2 | 126 | canNotUnifyError :: T -> T -> Infer ()
canNotUnifyError t1 t2 = error $ "cannot unify types " ++ show t1 ++ " and " ++ show t2 | 126 | canNotUnifyError t1 t2 = error $ "cannot unify types " ++ show t1 ++ " and " ++ show t2 | 87 | false | true | 0 | 8 | 27 | 55 | 25 | 30 | null | null |
shugo/gwist | Gwist/Command.hs | bsd-2-clause | createGistFile :: FilePath -> IO GistFile
createGistFile filename =
GistFile (FP.takeFileName $ UTF8.decodeString filename) <$>
LBS.readFile filename | 162 | createGistFile :: FilePath -> IO GistFile
createGistFile filename =
GistFile (FP.takeFileName $ UTF8.decodeString filename) <$>
LBS.readFile filename | 162 | createGistFile filename =
GistFile (FP.takeFileName $ UTF8.decodeString filename) <$>
LBS.readFile filename | 120 | false | true | 0 | 9 | 29 | 52 | 23 | 29 | null | null |
rahulmutt/ghcvm | libraries/base/GHC/IO/Handle.hs | bsd-3-clause | showHandle' :: String -> Bool -> Handle -> IO String
showHandle' filepath is_duplex h =
withHandle_ "showHandle" h $ \hdl_ ->
let
showType | is_duplex = showString "duplex (read-write)"
| otherwise = shows (haType hdl_)
in
return
(( showChar '{' .
showHdl (haType hdl_)
(showString "loc=" . showString filepath . showChar ',' .
showString "type=" . showType . showChar ',' .
showString "buffering=" . showBufMode (unsafePerformIO (readIORef (haCharBuffer hdl_))) (haBufferMode hdl_) . showString "}" )
) "")
where
showHdl :: HandleType -> ShowS -> ShowS
showHdl ht cont =
case ht of
ClosedHandle -> shows ht . showString "}"
_ -> cont
showBufMode :: Buffer e -> BufferMode -> ShowS
showBufMode buf bmo =
case bmo of
NoBuffering -> showString "none"
LineBuffering -> showString "line"
BlockBuffering (Just n) -> showString "block " . showParen True (shows n)
BlockBuffering Nothing -> showString "block " . showParen True (shows def)
where
def :: Int
def = bufSize buf | 1,164 | showHandle' :: String -> Bool -> Handle -> IO String
showHandle' filepath is_duplex h =
withHandle_ "showHandle" h $ \hdl_ ->
let
showType | is_duplex = showString "duplex (read-write)"
| otherwise = shows (haType hdl_)
in
return
(( showChar '{' .
showHdl (haType hdl_)
(showString "loc=" . showString filepath . showChar ',' .
showString "type=" . showType . showChar ',' .
showString "buffering=" . showBufMode (unsafePerformIO (readIORef (haCharBuffer hdl_))) (haBufferMode hdl_) . showString "}" )
) "")
where
showHdl :: HandleType -> ShowS -> ShowS
showHdl ht cont =
case ht of
ClosedHandle -> shows ht . showString "}"
_ -> cont
showBufMode :: Buffer e -> BufferMode -> ShowS
showBufMode buf bmo =
case bmo of
NoBuffering -> showString "none"
LineBuffering -> showString "line"
BlockBuffering (Just n) -> showString "block " . showParen True (shows n)
BlockBuffering Nothing -> showString "block " . showParen True (shows def)
where
def :: Int
def = bufSize buf | 1,164 | showHandle' filepath is_duplex h =
withHandle_ "showHandle" h $ \hdl_ ->
let
showType | is_duplex = showString "duplex (read-write)"
| otherwise = shows (haType hdl_)
in
return
(( showChar '{' .
showHdl (haType hdl_)
(showString "loc=" . showString filepath . showChar ',' .
showString "type=" . showType . showChar ',' .
showString "buffering=" . showBufMode (unsafePerformIO (readIORef (haCharBuffer hdl_))) (haBufferMode hdl_) . showString "}" )
) "")
where
showHdl :: HandleType -> ShowS -> ShowS
showHdl ht cont =
case ht of
ClosedHandle -> shows ht . showString "}"
_ -> cont
showBufMode :: Buffer e -> BufferMode -> ShowS
showBufMode buf bmo =
case bmo of
NoBuffering -> showString "none"
LineBuffering -> showString "line"
BlockBuffering (Just n) -> showString "block " . showParen True (shows n)
BlockBuffering Nothing -> showString "block " . showParen True (shows def)
where
def :: Int
def = bufSize buf | 1,111 | false | true | 0 | 24 | 352 | 374 | 175 | 199 | null | null |
pkamenarsky/channels-websockets | src/Network/WebSockets/Channel.hs | bsd-3-clause | extractState :: (ToJSON sid, ToJSON cid) => ChannelsState sid cid msg -> STM Value
extractState state = do
sq <- L.toList $ M.stream $ sessionQueue state
cq <- L.toList $ MM.stream $ channelQueues state
sc <- L.toList $ MM.stream $ sessionChannels state
count <- readTVar $ queueCount state
return $ object
[ "session_queue" .= map fst sq
, "channel_queues" .= map fst cq
, "session_channels" .= sc
, "queue_count" .= count
] | 455 | extractState :: (ToJSON sid, ToJSON cid) => ChannelsState sid cid msg -> STM Value
extractState state = do
sq <- L.toList $ M.stream $ sessionQueue state
cq <- L.toList $ MM.stream $ channelQueues state
sc <- L.toList $ MM.stream $ sessionChannels state
count <- readTVar $ queueCount state
return $ object
[ "session_queue" .= map fst sq
, "channel_queues" .= map fst cq
, "session_channels" .= sc
, "queue_count" .= count
] | 455 | extractState state = do
sq <- L.toList $ M.stream $ sessionQueue state
cq <- L.toList $ MM.stream $ channelQueues state
sc <- L.toList $ MM.stream $ sessionChannels state
count <- readTVar $ queueCount state
return $ object
[ "session_queue" .= map fst sq
, "channel_queues" .= map fst cq
, "session_channels" .= sc
, "queue_count" .= count
] | 372 | false | true | 0 | 11 | 101 | 171 | 81 | 90 | null | null |
mikebenfield/hclaws | src/Math/Hclaws/Systems/ShallowWater.hs | isc | h :: F.TensorBoxed '[2] Double -> Double
h t = F.pIndex t (Proxy::Proxy '[0]) | 77 | h :: F.TensorBoxed '[2] Double -> Double
h t = F.pIndex t (Proxy::Proxy '[0]) | 77 | h t = F.pIndex t (Proxy::Proxy '[0]) | 36 | false | true | 0 | 9 | 13 | 56 | 27 | 29 | null | null |
Peaker/lamdu | test/Tests/Sugar.hs | gpl-3.0 | testExtract :: Test
testExtract =
testSugarActions "extract-lambda-with-let.json" [lift . (^?! action)]
& testCase "extract"
where
action =
replBody . _BodyLam . lamFunc . fBody . annotation . plActions .
extract
-- Test for issue #402
-- https://trello.com/c/ClDnsGQi/402-wrong-result-when-inlining-from-hole-results | 362 | testExtract :: Test
testExtract =
testSugarActions "extract-lambda-with-let.json" [lift . (^?! action)]
& testCase "extract"
where
action =
replBody . _BodyLam . lamFunc . fBody . annotation . plActions .
extract
-- Test for issue #402
-- https://trello.com/c/ClDnsGQi/402-wrong-result-when-inlining-from-hole-results | 362 | testExtract =
testSugarActions "extract-lambda-with-let.json" [lift . (^?! action)]
& testCase "extract"
where
action =
replBody . _BodyLam . lamFunc . fBody . annotation . plActions .
extract
-- Test for issue #402
-- https://trello.com/c/ClDnsGQi/402-wrong-result-when-inlining-from-hole-results | 342 | false | true | 2 | 10 | 81 | 70 | 36 | 34 | null | null |
vTurbine/ghc | compiler/coreSyn/MkCore.hs | bsd-3-clause | -- | Build a big tuple holding the specified variables
-- One-tuples are flattened; see Note [Flattening one-tuples]
mkBigCoreVarTup :: [Id] -> CoreExpr
mkBigCoreVarTup ids = mkBigCoreTup (map Var ids) | 201 | mkBigCoreVarTup :: [Id] -> CoreExpr
mkBigCoreVarTup ids = mkBigCoreTup (map Var ids) | 84 | mkBigCoreVarTup ids = mkBigCoreTup (map Var ids) | 48 | true | true | 0 | 7 | 29 | 34 | 18 | 16 | null | null |
keera-studios/hsQt | examples/widgets.hs | bsd-2-clause | add_grid :: IO (QWidget a)
add_grid
= do
gridGroupBox <- qGroupBox "Grid layout"
gridLayout <- qGridLayout ()
add_lablins gridLayout "Lines" 3 0
smallEditor <- qTextEdit ()
setPlainText smallEditor "This widget takes up about two thirds of the grid layout."
addWidget gridLayout (smallEditor, 0::Int, 2::Int, 4::Int, 1::Int)
setColumnStretch gridLayout (2, 20)
setLayout gridGroupBox gridLayout
return $ objectCast gridGroupBox | 465 | add_grid :: IO (QWidget a)
add_grid
= do
gridGroupBox <- qGroupBox "Grid layout"
gridLayout <- qGridLayout ()
add_lablins gridLayout "Lines" 3 0
smallEditor <- qTextEdit ()
setPlainText smallEditor "This widget takes up about two thirds of the grid layout."
addWidget gridLayout (smallEditor, 0::Int, 2::Int, 4::Int, 1::Int)
setColumnStretch gridLayout (2, 20)
setLayout gridGroupBox gridLayout
return $ objectCast gridGroupBox | 465 | add_grid
= do
gridGroupBox <- qGroupBox "Grid layout"
gridLayout <- qGridLayout ()
add_lablins gridLayout "Lines" 3 0
smallEditor <- qTextEdit ()
setPlainText smallEditor "This widget takes up about two thirds of the grid layout."
addWidget gridLayout (smallEditor, 0::Int, 2::Int, 4::Int, 1::Int)
setColumnStretch gridLayout (2, 20)
setLayout gridGroupBox gridLayout
return $ objectCast gridGroupBox | 438 | false | true | 0 | 9 | 94 | 143 | 67 | 76 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/index_4.hs | mit | range00 z MyTrue = Cons z Nil | 29 | range00 z MyTrue = Cons z Nil | 29 | range00 z MyTrue = Cons z Nil | 29 | false | false | 1 | 5 | 6 | 21 | 7 | 14 | null | null |
Bodigrim/arithmoi | Math/NumberTheory/Moduli/Equations.hs | mit | solveLinearCoprime :: Integer -> Integer -> Integer -> Maybe Integer
solveLinearCoprime 1 _ _ = Just 0 | 102 | solveLinearCoprime :: Integer -> Integer -> Integer -> Maybe Integer
solveLinearCoprime 1 _ _ = Just 0 | 102 | solveLinearCoprime 1 _ _ = Just 0 | 33 | false | true | 0 | 9 | 16 | 40 | 18 | 22 | null | null |
sdiehl/ghc | compiler/deSugar/DsArrows.hs | bsd-3-clause | trimInput
:: ([Id] -> DsM (CoreExpr, DIdSet))
-> DsM (CoreExpr, -- desugared expression
DIdSet, -- subset of local vars that occur free
[Id]) -- same local vars as a list, fed back to
-- the inner function to form the tuple of
-- inputs to the arrow.
trimInput build_arrow
= fixDs (\ ~(_,_,env_ids) -> do
(core_cmd, free_vars) <- build_arrow env_ids
return (core_cmd, free_vars, dVarSetElems free_vars)) | 557 | trimInput
:: ([Id] -> DsM (CoreExpr, DIdSet))
-> DsM (CoreExpr, -- desugared expression
DIdSet, -- subset of local vars that occur free
[Id])
trimInput build_arrow
= fixDs (\ ~(_,_,env_ids) -> do
(core_cmd, free_vars) <- build_arrow env_ids
return (core_cmd, free_vars, dVarSetElems free_vars)) | 374 | trimInput build_arrow
= fixDs (\ ~(_,_,env_ids) -> do
(core_cmd, free_vars) <- build_arrow env_ids
return (core_cmd, free_vars, dVarSetElems free_vars)) | 170 | true | true | 0 | 12 | 218 | 117 | 64 | 53 | null | null |
AlexanderPankiv/ghc | libraries/base/GHC/Show.hs | bsd-3-clause | showLitChar '\SO' s = protectEsc (== 'H') (showString "\\SO") s | 73 | showLitChar '\SO' s = protectEsc (== 'H') (showString "\\SO") s | 73 | showLitChar '\SO' s = protectEsc (== 'H') (showString "\\SO") s | 73 | false | false | 0 | 7 | 19 | 28 | 14 | 14 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/playpen/art-of-multiprocessor-programming-herlihy.hs | unlicense | tfp1 :: [T.Test]
tfp1 = U.t "tfp1"
(unsafePerformIO testFork4)
(1000005, sum trExpectedResult) | 108 | tfp1 :: [T.Test]
tfp1 = U.t "tfp1"
(unsafePerformIO testFork4)
(1000005, sum trExpectedResult) | 108 | tfp1 = U.t "tfp1"
(unsafePerformIO testFork4)
(1000005, sum trExpectedResult) | 91 | false | true | 0 | 7 | 25 | 40 | 21 | 19 | null | null |
ZjMNZHgG5jMXw/smallcaps | src/smallcaps/Text/SmallCaps/TeX.hs | bsd-3-clause | isBlock :: TeXElement -> Bool
isBlock (Block _) = True | 54 | isBlock :: TeXElement -> Bool
isBlock (Block _) = True | 54 | isBlock (Block _) = True | 24 | false | true | 0 | 7 | 9 | 24 | 12 | 12 | null | null |
tjakway/ghcjvm | compiler/utils/Util.hs | bsd-3-clause | cmpList _ _ [] = GT | 26 | cmpList _ _ [] = GT | 26 | cmpList _ _ [] = GT | 26 | false | false | 2 | 5 | 12 | 18 | 6 | 12 | null | null |
prowdsponsor/country-codes | src/Data/CountryCodes/ISO31661.hs | bsd-3-clause | fromMText "DE" = Just DE | 24 | fromMText "DE" = Just DE | 24 | fromMText "DE" = Just DE | 24 | false | false | 0 | 5 | 4 | 12 | 5 | 7 | null | null |
rahulmutt/ghcvm | libraries/base/Control/Concurrent/Chan.hs | bsd-3-clause | -- benchmarks show that unboxing the MVar here is worthwhile, because
-- although it leads to higher allocation, the channel data takes up
-- less space and is therefore quicker to GC.
-- See the Concurrent Haskell paper for a diagram explaining the
-- how the different channel operations proceed.
-- @newChan@ sets up the read and write end of a channel by initialising
-- these two @MVar@s with an empty @MVar@.
-- |Build and returns a new instance of 'Chan'.
newChan :: IO (Chan a)
newChan = do
hole <- newEmptyMVar
readVar <- newMVar hole
writeVar <- newMVar hole
return (Chan readVar writeVar)
-- To put an element on a channel, a new hole at the write end is created.
-- What was previously the empty @MVar@ at the back of the channel is then
-- filled in with a new stream element holding the entered value and the
-- new hole.
-- |Write a value to a 'Chan'. | 889 | newChan :: IO (Chan a)
newChan = do
hole <- newEmptyMVar
readVar <- newMVar hole
writeVar <- newMVar hole
return (Chan readVar writeVar)
-- To put an element on a channel, a new hole at the write end is created.
-- What was previously the empty @MVar@ at the back of the channel is then
-- filled in with a new stream element holding the entered value and the
-- new hole.
-- |Write a value to a 'Chan'. | 419 | newChan = do
hole <- newEmptyMVar
readVar <- newMVar hole
writeVar <- newMVar hole
return (Chan readVar writeVar)
-- To put an element on a channel, a new hole at the write end is created.
-- What was previously the empty @MVar@ at the back of the channel is then
-- filled in with a new stream element holding the entered value and the
-- new hole.
-- |Write a value to a 'Chan'. | 396 | true | true | 0 | 9 | 182 | 74 | 40 | 34 | null | null |
fffej/HS-Poker | LookupPatternMatch.hs | bsd-3-clause | getValueFromProduct 235445 = 2795 | 33 | getValueFromProduct 235445 = 2795 | 33 | getValueFromProduct 235445 = 2795 | 33 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
tzakian/super-eager-evaluation | Utils.hs | mit | addNode a (DAG src snk grph) = DAG src snk $ Map.insert a Set.empty grph | 72 | addNode a (DAG src snk grph) = DAG src snk $ Map.insert a Set.empty grph | 72 | addNode a (DAG src snk grph) = DAG src snk $ Map.insert a Set.empty grph | 72 | false | false | 0 | 7 | 14 | 41 | 19 | 22 | null | null |
banacorn/formal-language | haskell-legacy/test.hs | mit | propUnionDFA :: Property
propUnionDFA = do
alphabets <- alphabetTestLimit genAlphabets
-- DFA 0
states0 <- stateTestLimit genStates
dfa0 <- genDFA states0 alphabets
-- DFA 1
states1 <- stateTestLimit genStates
dfa1 <- genDFA states1 alphabets
forAll (genLanguage alphabets) (\ language ->
let dfa = dfa0 `unionDFA` dfa1 in
automaton dfa0 language == automaton dfa language ||
automaton dfa1 language == automaton dfa language
) | 529 | propUnionDFA :: Property
propUnionDFA = do
alphabets <- alphabetTestLimit genAlphabets
-- DFA 0
states0 <- stateTestLimit genStates
dfa0 <- genDFA states0 alphabets
-- DFA 1
states1 <- stateTestLimit genStates
dfa1 <- genDFA states1 alphabets
forAll (genLanguage alphabets) (\ language ->
let dfa = dfa0 `unionDFA` dfa1 in
automaton dfa0 language == automaton dfa language ||
automaton dfa1 language == automaton dfa language
) | 529 | propUnionDFA = do
alphabets <- alphabetTestLimit genAlphabets
-- DFA 0
states0 <- stateTestLimit genStates
dfa0 <- genDFA states0 alphabets
-- DFA 1
states1 <- stateTestLimit genStates
dfa1 <- genDFA states1 alphabets
forAll (genLanguage alphabets) (\ language ->
let dfa = dfa0 `unionDFA` dfa1 in
automaton dfa0 language == automaton dfa language ||
automaton dfa1 language == automaton dfa language
) | 504 | false | true | 0 | 15 | 164 | 138 | 64 | 74 | null | null |
ksaveljev/hake-2 | src/Game/Monsters/MSuperTank.hs | bsd-3-clause | superTankFramesAttack3 :: V.Vector MFrameT
superTankFramesAttack3 =
V.fromList [ MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
] | 1,596 | superTankFramesAttack3 :: V.Vector MFrameT
superTankFramesAttack3 =
V.fromList [ MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
] | 1,596 | superTankFramesAttack3 =
V.fromList [ MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
, MFrameT (Just GameAI.aiMove) 0 Nothing
] | 1,553 | false | true | 0 | 10 | 578 | 507 | 253 | 254 | null | null |
gnn/Hets | OWL2/Rename.hs | gpl-2.0 | uniteSign :: Sign -> Sign -> Result Sign
uniteSign s1 s2 = do
let (pm, tm) = integPref (prefixMap s1) (prefixMap s2)
if Map.null tm then return (addSign s1 s2) {prefixMap = pm}
else fail "Static analysis could not unite signatures" | 245 | uniteSign :: Sign -> Sign -> Result Sign
uniteSign s1 s2 = do
let (pm, tm) = integPref (prefixMap s1) (prefixMap s2)
if Map.null tm then return (addSign s1 s2) {prefixMap = pm}
else fail "Static analysis could not unite signatures" | 245 | uniteSign s1 s2 = do
let (pm, tm) = integPref (prefixMap s1) (prefixMap s2)
if Map.null tm then return (addSign s1 s2) {prefixMap = pm}
else fail "Static analysis could not unite signatures" | 204 | false | true | 0 | 13 | 54 | 103 | 49 | 54 | null | null |
limansky/wbxml | src/Wbxml/SAX.hs | bsd-3-clause | parseEndTag = do
lift $ word8 tokenEnd
(ParseState p ap (t:ts)) <- get
put $ ParseState p ap ts
return $ EndTag t
-- content = element | string | extension | entity | pi | opaque | 200 | parseEndTag = do
lift $ word8 tokenEnd
(ParseState p ap (t:ts)) <- get
put $ ParseState p ap ts
return $ EndTag t
-- content = element | string | extension | entity | pi | opaque | 200 | parseEndTag = do
lift $ word8 tokenEnd
(ParseState p ap (t:ts)) <- get
put $ ParseState p ap ts
return $ EndTag t
-- content = element | string | extension | entity | pi | opaque | 200 | false | false | 0 | 11 | 58 | 65 | 30 | 35 | null | null |
hemio-ev/libghc-acme | src/Network/ACME/JWS.hs | lgpl-3.0 | newAcmeJwsHeader ::
URL -- ^ Request URL
-> JWK -- ^ Private key
-> JWK -- ^ Public key
-> AcmeJwsNonce -- ^ Nonce
-> Maybe URL -- ^ Kid
-> Either AcmeErr (AcmeJwsHeader Protection)
newAcmeJwsHeader vUrl vJwkPrivate vJwkPublic vNonce vKid
-- Boulder sais
-- 'detail: signature type 'PS512' in JWS header is not supported'
= do
vBestAlg <- bestAlg
return
AcmeJwsHeader
{ _acmeJwsHeader = setAuth $ newJWSHeader (Protected, vBestAlg)
, _acmeJwsHeaderNonce = vNonce
, _acmeJwsHeaderUrl = vUrl
}
where
bestAlg =
case bestJWSAlg vJwkPrivate of
Right PS512 -> return RS256
Right x -> return x
Left e -> throwError $ AcmeErrJws e
setAuth =
case vKid of
Just k ->
set kid (Just $ HeaderParam Protected (T.pack $ urlToString k))
Nothing -> set jwk (Just $ HeaderParam Protected vJwkPublic)
-- | Removes private key | 928 | newAcmeJwsHeader ::
URL -- ^ Request URL
-> JWK -- ^ Private key
-> JWK -- ^ Public key
-> AcmeJwsNonce -- ^ Nonce
-> Maybe URL -- ^ Kid
-> Either AcmeErr (AcmeJwsHeader Protection)
newAcmeJwsHeader vUrl vJwkPrivate vJwkPublic vNonce vKid
-- Boulder sais
-- 'detail: signature type 'PS512' in JWS header is not supported'
= do
vBestAlg <- bestAlg
return
AcmeJwsHeader
{ _acmeJwsHeader = setAuth $ newJWSHeader (Protected, vBestAlg)
, _acmeJwsHeaderNonce = vNonce
, _acmeJwsHeaderUrl = vUrl
}
where
bestAlg =
case bestJWSAlg vJwkPrivate of
Right PS512 -> return RS256
Right x -> return x
Left e -> throwError $ AcmeErrJws e
setAuth =
case vKid of
Just k ->
set kid (Just $ HeaderParam Protected (T.pack $ urlToString k))
Nothing -> set jwk (Just $ HeaderParam Protected vJwkPublic)
-- | Removes private key | 928 | newAcmeJwsHeader vUrl vJwkPrivate vJwkPublic vNonce vKid
-- Boulder sais
-- 'detail: signature type 'PS512' in JWS header is not supported'
= do
vBestAlg <- bestAlg
return
AcmeJwsHeader
{ _acmeJwsHeader = setAuth $ newJWSHeader (Protected, vBestAlg)
, _acmeJwsHeaderNonce = vNonce
, _acmeJwsHeaderUrl = vUrl
}
where
bestAlg =
case bestJWSAlg vJwkPrivate of
Right PS512 -> return RS256
Right x -> return x
Left e -> throwError $ AcmeErrJws e
setAuth =
case vKid of
Just k ->
set kid (Just $ HeaderParam Protected (T.pack $ urlToString k))
Nothing -> set jwk (Just $ HeaderParam Protected vJwkPublic)
-- | Removes private key | 731 | false | true | 5 | 13 | 257 | 183 | 99 | 84 | null | null |
m-alvarez/jhc | src/Util/ExitCodes.hs | mit | -- EX_TEMPFAIL -- temporary failure, indicating something that
-- is not really an error. In sendmail, this means
-- that a mailer (e.g.) could not create a connection,
-- and the request should be reattempted later.
exitCodeTempFailure = ExitFailure 75 | 257 | exitCodeTempFailure = ExitFailure 75 | 36 | exitCodeTempFailure = ExitFailure 75 | 36 | true | false | 0 | 5 | 43 | 13 | 8 | 5 | null | null |
arjuncomar/revelation | Revelation/Rect.hs | bsd-3-clause | genAccessor o f = o . unsafePerformIO . f . extractRectI | 56 | genAccessor o f = o . unsafePerformIO . f . extractRectI | 56 | genAccessor o f = o . unsafePerformIO . f . extractRectI | 56 | false | false | 2 | 6 | 10 | 29 | 11 | 18 | null | null |
Xuyuanp/hscheme | main.hs | apache-2.0 | showVal :: LispVal -> String
showVal (String contents) = "\"" ++ contents ++ "\"" | 88 | showVal :: LispVal -> String
showVal (String contents) = "\"" ++ contents ++ "\"" | 88 | showVal (String contents) = "\"" ++ contents ++ "\"" | 59 | false | true | 0 | 6 | 20 | 36 | 17 | 19 | null | null |
yuvallanger/threepenny-gui | samples/DragNDropExample.hs | bsd-3-clause | mkDragPair :: Color -> Int -> UI (Element, Element)
mkDragPair color position = do
elDrag <- UI.new #. "box-drag"
# set UI.style [("left", show position ++ "px"), ("color",color)]
# set text "Drag me!"
# set UI.draggable True
# set UI.dragData color
elDrop <- UI.new #. "box-drop"
# set UI.style [("border","2px solid " ++ color), ("left", show position ++ "px")]
dropSuccess <- liftIO $ newIORef False
on UI.dragStart elDrag $ \_ -> void $
element elDrop
# set text "Drop here!"
# set UI.droppable True
on UI.dragEnd elDrag $ \_ -> void $ do
dropped <- liftIO $ readIORef dropSuccess
when (not dropped) $ void $
element elDrop
# set text ""
# set UI.droppable False
on UI.drop elDrop $ \color' -> when (color == color') $ void $ do
liftIO $ writeIORef dropSuccess True
delete elDrag
element elDrop
# set text "Dropped!"
# set UI.droppable False
return (elDrag, elDrop) | 1,090 | mkDragPair :: Color -> Int -> UI (Element, Element)
mkDragPair color position = do
elDrag <- UI.new #. "box-drag"
# set UI.style [("left", show position ++ "px"), ("color",color)]
# set text "Drag me!"
# set UI.draggable True
# set UI.dragData color
elDrop <- UI.new #. "box-drop"
# set UI.style [("border","2px solid " ++ color), ("left", show position ++ "px")]
dropSuccess <- liftIO $ newIORef False
on UI.dragStart elDrag $ \_ -> void $
element elDrop
# set text "Drop here!"
# set UI.droppable True
on UI.dragEnd elDrag $ \_ -> void $ do
dropped <- liftIO $ readIORef dropSuccess
when (not dropped) $ void $
element elDrop
# set text ""
# set UI.droppable False
on UI.drop elDrop $ \color' -> when (color == color') $ void $ do
liftIO $ writeIORef dropSuccess True
delete elDrag
element elDrop
# set text "Dropped!"
# set UI.droppable False
return (elDrag, elDrop) | 1,090 | mkDragPair color position = do
elDrag <- UI.new #. "box-drag"
# set UI.style [("left", show position ++ "px"), ("color",color)]
# set text "Drag me!"
# set UI.draggable True
# set UI.dragData color
elDrop <- UI.new #. "box-drop"
# set UI.style [("border","2px solid " ++ color), ("left", show position ++ "px")]
dropSuccess <- liftIO $ newIORef False
on UI.dragStart elDrag $ \_ -> void $
element elDrop
# set text "Drop here!"
# set UI.droppable True
on UI.dragEnd elDrag $ \_ -> void $ do
dropped <- liftIO $ readIORef dropSuccess
when (not dropped) $ void $
element elDrop
# set text ""
# set UI.droppable False
on UI.drop elDrop $ \color' -> when (color == color') $ void $ do
liftIO $ writeIORef dropSuccess True
delete elDrag
element elDrop
# set text "Dropped!"
# set UI.droppable False
return (elDrag, elDrop) | 1,038 | false | true | 0 | 18 | 369 | 399 | 190 | 209 | null | null |
sdiehl/ghc | compiler/types/Type.hs | bsd-3-clause | tcTypeKind (FunTy { ft_af = af, ft_res = res })
| InvisArg <- af
, tcIsConstraintKind (tcTypeKind res)
= constraintKind -- Eq a => Ord a :: Constraint
| otherwise -- Eq a => a -> a :: TYPE LiftedRep
= liftedTypeKind | 253 | tcTypeKind (FunTy { ft_af = af, ft_res = res })
| InvisArg <- af
, tcIsConstraintKind (tcTypeKind res)
= constraintKind -- Eq a => Ord a :: Constraint
| otherwise -- Eq a => a -> a :: TYPE LiftedRep
= liftedTypeKind | 253 | tcTypeKind (FunTy { ft_af = af, ft_res = res })
| InvisArg <- af
, tcIsConstraintKind (tcTypeKind res)
= constraintKind -- Eq a => Ord a :: Constraint
| otherwise -- Eq a => a -> a :: TYPE LiftedRep
= liftedTypeKind | 253 | false | false | 0 | 10 | 79 | 65 | 32 | 33 | null | null |
adnelson/Idris-dev | src/Idris/Reflection.hs | bsd-3-clause | reflectErr (Inaccessible n) = raw_apply (Var $ reflErrName "Inaccessible") [reflectName n] | 90 | reflectErr (Inaccessible n) = raw_apply (Var $ reflErrName "Inaccessible") [reflectName n] | 90 | reflectErr (Inaccessible n) = raw_apply (Var $ reflErrName "Inaccessible") [reflectName n] | 90 | false | false | 0 | 8 | 10 | 36 | 17 | 19 | null | null |
markusle/husky | test/CalculatorTest.hs | gpl-3.0 | simpleTest8 :: GoodTestCase
simpleTest8 = ("(((((((3.0+3.0)))))*(((((9.0+8.0)))))))"
, DblResult 102.0) | 117 | simpleTest8 :: GoodTestCase
simpleTest8 = ("(((((((3.0+3.0)))))*(((((9.0+8.0)))))))"
, DblResult 102.0) | 117 | simpleTest8 = ("(((((((3.0+3.0)))))*(((((9.0+8.0)))))))"
, DblResult 102.0) | 89 | false | true | 0 | 6 | 22 | 20 | 11 | 9 | null | null |
jessica-taylor/quipp2 | src/Quipp/Interpreter.hs | mit | splitFunctionType other = ([], other) | 37 | splitFunctionType other = ([], other) | 37 | splitFunctionType other = ([], other) | 37 | false | false | 0 | 6 | 4 | 17 | 9 | 8 | null | null |
ppelleti/hs-wiringPi | src-dummy/System/Hardware/WiringPi/Foreign.hs | bsd-3-clause | intEdgeToInt INT_EDGE_FALLING = 12 | 34 | intEdgeToInt INT_EDGE_FALLING = 12 | 34 | intEdgeToInt INT_EDGE_FALLING = 12 | 34 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
chreekat/snowdrift | tests/NotifyTest.hs | agpl-3.0 | errUnlessUniqueEmailNotif' file = errEmailNotif' file errUnlessUniqueEmailNotif | 79 | errUnlessUniqueEmailNotif' file = errEmailNotif' file errUnlessUniqueEmailNotif | 79 | errUnlessUniqueEmailNotif' file = errEmailNotif' file errUnlessUniqueEmailNotif | 79 | false | false | 0 | 5 | 5 | 14 | 6 | 8 | null | null |
jacekszymanski/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxFONTSIZE_LARGE :: Int
wxFONTSIZE_LARGE = 1 | 44 | wxFONTSIZE_LARGE :: Int
wxFONTSIZE_LARGE = 1 | 44 | wxFONTSIZE_LARGE = 1 | 20 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
UCSD-PL/RefScript | src/Language/Rsc/Typecheck/Types.hs | bsd-3-clause | trIM = mkRelMut "Immutable" | 29 | trIM = mkRelMut "Immutable" | 29 | trIM = mkRelMut "Immutable" | 29 | false | false | 0 | 5 | 5 | 9 | 4 | 5 | null | null |
JohnLato/iteratee | src/Data/Iteratee/Base.hs | bsd-3-clause | -- | Create a @ContReturn@ from a step function.
nextStep :: Monad m => Cont s m a -> m (ContReturn s m a)
nextStep = contMoreM . icont | 135 | nextStep :: Monad m => Cont s m a -> m (ContReturn s m a)
nextStep = contMoreM . icont | 86 | nextStep = contMoreM . icont | 28 | true | true | 0 | 9 | 28 | 47 | 23 | 24 | null | null |
scharris/hmq | ForeignKeyLink.hs | bsd-3-clause | isManyToOne _ = False | 21 | isManyToOne _ = False | 21 | isManyToOne _ = False | 21 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
chrisbanks/cpiwb | CPi/Logic.hs | gpl-3.0 | reconcileVal env (Quot v1 v2) = Quot (reconcileVal env v1) (reconcileVal env v2) | 80 | reconcileVal env (Quot v1 v2) = Quot (reconcileVal env v1) (reconcileVal env v2) | 80 | reconcileVal env (Quot v1 v2) = Quot (reconcileVal env v1) (reconcileVal env v2) | 80 | false | false | 0 | 7 | 12 | 40 | 19 | 21 | null | null |
nikivazou/thesis | text/refinementreflection/Peano.hs | bsd-3-clause | plus (S n) m = S (plus n m) | 27 | plus (S n) m = S (plus n m) | 27 | plus (S n) m = S (plus n m) | 27 | false | false | 0 | 7 | 8 | 28 | 13 | 15 | null | null |
siddhanathan/ghc | compiler/rename/RnTypes.hs | bsd-3-clause | ---------------
mk_hs_op_ty :: (LHsType Name -> LHsType Name -> HsType Name)
-> Name -> Fixity -> LHsType Name
-> (LHsType Name -> LHsType Name -> HsType Name)
-> Name -> Fixity -> LHsType Name -> LHsType Name -> SrcSpan
-> RnM (HsType Name)
mk_hs_op_ty mk1 op1 fix1 ty1
mk2 op2 fix2 ty21 ty22 loc2
| nofix_error = do { precParseErr (op1,fix1) (op2,fix2)
; return (mk1 ty1 (L loc2 (mk2 ty21 ty22))) }
| associate_right = return (mk1 ty1 (L loc2 (mk2 ty21 ty22)))
| otherwise = do { -- Rearrange to ((ty1 `op1` ty21) `op2` ty22)
new_ty <- mkHsOpTyRn mk1 op1 fix1 ty1 ty21
; return (mk2 (noLoc new_ty) ty22) }
where
(nofix_error, associate_right) = compareFixity fix1 fix2
--------------------------- | 859 | mk_hs_op_ty :: (LHsType Name -> LHsType Name -> HsType Name)
-> Name -> Fixity -> LHsType Name
-> (LHsType Name -> LHsType Name -> HsType Name)
-> Name -> Fixity -> LHsType Name -> LHsType Name -> SrcSpan
-> RnM (HsType Name)
mk_hs_op_ty mk1 op1 fix1 ty1
mk2 op2 fix2 ty21 ty22 loc2
| nofix_error = do { precParseErr (op1,fix1) (op2,fix2)
; return (mk1 ty1 (L loc2 (mk2 ty21 ty22))) }
| associate_right = return (mk1 ty1 (L loc2 (mk2 ty21 ty22)))
| otherwise = do { -- Rearrange to ((ty1 `op1` ty21) `op2` ty22)
new_ty <- mkHsOpTyRn mk1 op1 fix1 ty1 ty21
; return (mk2 (noLoc new_ty) ty22) }
where
(nofix_error, associate_right) = compareFixity fix1 fix2
--------------------------- | 843 | mk_hs_op_ty mk1 op1 fix1 ty1
mk2 op2 fix2 ty21 ty22 loc2
| nofix_error = do { precParseErr (op1,fix1) (op2,fix2)
; return (mk1 ty1 (L loc2 (mk2 ty21 ty22))) }
| associate_right = return (mk1 ty1 (L loc2 (mk2 ty21 ty22)))
| otherwise = do { -- Rearrange to ((ty1 `op1` ty21) `op2` ty22)
new_ty <- mkHsOpTyRn mk1 op1 fix1 ty1 ty21
; return (mk2 (noLoc new_ty) ty22) }
where
(nofix_error, associate_right) = compareFixity fix1 fix2
--------------------------- | 569 | true | true | 2 | 17 | 279 | 293 | 145 | 148 | null | null |
mettekou/ghc | compiler/hsSyn/HsExpr.hs | bsd-3-clause | ppr_expr (RecordCon { rcon_con_name = con_id, rcon_flds = rbinds })
= hang (ppr con_id) 2 (ppr rbinds) | 104 | ppr_expr (RecordCon { rcon_con_name = con_id, rcon_flds = rbinds })
= hang (ppr con_id) 2 (ppr rbinds) | 104 | ppr_expr (RecordCon { rcon_con_name = con_id, rcon_flds = rbinds })
= hang (ppr con_id) 2 (ppr rbinds) | 104 | false | false | 0 | 8 | 18 | 48 | 24 | 24 | null | null |
leshchevds/ganeti | test/hs/Test/Ganeti/Types.hs | bsd-2-clause | case_NonEmpty_fail :: Assertion
case_NonEmpty_fail =
assertEqual "building non-empty list from an empty list"
(Bad "Received empty value for non-empty list") (mkNonEmpty ([]::[Int])) | 188 | case_NonEmpty_fail :: Assertion
case_NonEmpty_fail =
assertEqual "building non-empty list from an empty list"
(Bad "Received empty value for non-empty list") (mkNonEmpty ([]::[Int])) | 188 | case_NonEmpty_fail =
assertEqual "building non-empty list from an empty list"
(Bad "Received empty value for non-empty list") (mkNonEmpty ([]::[Int])) | 156 | false | true | 0 | 9 | 27 | 43 | 22 | 21 | null | null |
jwiegley/ghc-release | libraries/transformers/Control/Monad/Trans/Cont.hs | gpl-3.0 | -- | Apply a function to transform the continuation passed to a CPS
-- computation.
--
-- * @'runContT' ('withContT' f m) = 'runContT' m . f@
withContT :: ((b -> m r) -> (a -> m r)) -> ContT r m a -> ContT r m b
withContT f m = ContT $ runContT m . f | 250 | withContT :: ((b -> m r) -> (a -> m r)) -> ContT r m a -> ContT r m b
withContT f m = ContT $ runContT m . f | 108 | withContT f m = ContT $ runContT m . f | 38 | true | true | 0 | 10 | 57 | 80 | 41 | 39 | null | null |
roberth/uu-helium | test/runtimeerrors/ErrorFunction.hs | gpl-3.0 | main :: Int
main = error "My hoovercraft is full of eels" | 57 | main :: Int
main = error "My hoovercraft is full of eels" | 57 | main = error "My hoovercraft is full of eels" | 45 | false | true | 0 | 5 | 11 | 14 | 7 | 7 | null | null |
zeekay/lambdabot | lambdabot-utils/Lambdabot/Util.hs | mit | -- | Break a String into it's first word, and the rest of the string. Example:
--
-- > split_first_word "A fine day" ===> ("A", "fine day)
splitFirstWord :: String -- ^ String to be broken
-> (String, String)
splitFirstWord xs = (w, dropWhile isSpace xs')
where (w, xs') = break isSpace xs
-- | Get the first word of a string. Example:
--
-- > first_word "This is a fine day" ===> "This" | 407 | splitFirstWord :: String -- ^ String to be broken
-> (String, String)
splitFirstWord xs = (w, dropWhile isSpace xs')
where (w, xs') = break isSpace xs
-- | Get the first word of a string. Example:
--
-- > first_word "This is a fine day" ===> "This" | 268 | splitFirstWord xs = (w, dropWhile isSpace xs')
where (w, xs') = break isSpace xs
-- | Get the first word of a string. Example:
--
-- > first_word "This is a fine day" ===> "This" | 181 | true | true | 0 | 8 | 93 | 67 | 37 | 30 | null | null |
danr/hipspec | testsuite/prod/zeno_version/PropT13.hs | gpl-3.0 | Z == _ = False | 18 | Z == _ = False | 18 | Z == _ = False | 18 | false | false | 0 | 5 | 8 | 16 | 6 | 10 | null | null |
urbanslug/ghc | testsuite/tests/perf/compiler/T783.hs | bsd-3-clause | foo x | x == 477 = 477 | 22 | foo x | x == 477 = 477 | 22 | foo x | x == 477 = 477 | 22 | false | false | 0 | 8 | 7 | 23 | 9 | 14 | null | null |
timtylin/scholdoc | src/Text/Pandoc/Writers/Haddock.hs | gpl-2.0 | blockToHaddock _ (RawBlock f str)
| f == "haddock" = do
return $ text str <> text "\n"
| otherwise = return empty | 123 | blockToHaddock _ (RawBlock f str)
| f == "haddock" = do
return $ text str <> text "\n"
| otherwise = return empty | 123 | blockToHaddock _ (RawBlock f str)
| f == "haddock" = do
return $ text str <> text "\n"
| otherwise = return empty | 123 | false | false | 0 | 10 | 32 | 63 | 27 | 36 | null | null |
ben-schulz/Idris-dev | src/Idris/DSL.hs | bsd-3-clause | -- | Replace DSL-bound variable in a term
var :: DSL -> Name -> PTerm -> Int -> PTerm
var dsl n t i = v' i t where
v' i (PRef fc hl x) | x == n =
case dsl_var dsl of
Nothing -> PElabError (Msg "No 'variable' defined in dsl")
Just v -> PApp fc v [pexp (mkVar fc i)]
v' i (PLam fc n nfc ty sc)
| Nothing <- dsl_lambda dsl
= PLam fc n nfc ty (v' i sc)
| otherwise = PLam fc n nfc (v' i ty) (v' (i + 1) sc)
v' i (PLet fc n nfc ty val sc)
| Nothing <- dsl_let dsl
= PLet fc n nfc (v' i ty) (v' i val) (v' i sc)
| otherwise = PLet fc n nfc (v' i ty) (v' i val) (v' (i + 1) sc)
v' i (PPi p n fc ty sc)
| Nothing <- dsl_pi dsl
= PPi p n fc (v' i ty) (v' i sc)
| otherwise = PPi p n fc (v' i ty) (v' (i+1) sc)
v' i (PTyped l r) = PTyped (v' i l) (v' i r)
v' i (PApp f x as) = PApp f (v' i x) (fmap (fmap (v' i)) as)
v' i (PWithApp f x a) = PWithApp f (v' i x) (v' i a)
v' i (PCase f t as) = PCase f (v' i t) (fmap (pmap (v' i)) as)
v' i (PPair f hls p l r) = PPair f hls p (v' i l) (v' i r)
v' i (PDPair f hls p l t r) = PDPair f hls p (v' i l) (v' i t) (v' i r)
v' i (PAlternative ms a as) = PAlternative ms a $ map (v' i) as
v' i (PHidden t) = PHidden (v' i t)
v' i (PIdiom f t) = PIdiom f (v' i t)
v' i (PDoBlock ds) = PDoBlock (map (fmap (v' i)) ds)
v' i (PNoImplicits t) = PNoImplicits (v' i t)
v' i t = t
mkVar fc 0 = case index_first dsl of
Nothing -> PElabError (Msg "No index_first defined")
Just f -> setFC fc f
mkVar fc n = case index_next dsl of
Nothing -> PElabError (Msg "No index_next defined")
Just f -> PApp fc f [pexp (mkVar fc (n-1))]
setFC fc (PRef _ _ n) = PRef fc [] n
setFC fc (PApp _ f xs) = PApp fc (setFC fc f) (map (fmap (setFC fc)) xs)
setFC fc t = t | 1,963 | var :: DSL -> Name -> PTerm -> Int -> PTerm
var dsl n t i = v' i t where
v' i (PRef fc hl x) | x == n =
case dsl_var dsl of
Nothing -> PElabError (Msg "No 'variable' defined in dsl")
Just v -> PApp fc v [pexp (mkVar fc i)]
v' i (PLam fc n nfc ty sc)
| Nothing <- dsl_lambda dsl
= PLam fc n nfc ty (v' i sc)
| otherwise = PLam fc n nfc (v' i ty) (v' (i + 1) sc)
v' i (PLet fc n nfc ty val sc)
| Nothing <- dsl_let dsl
= PLet fc n nfc (v' i ty) (v' i val) (v' i sc)
| otherwise = PLet fc n nfc (v' i ty) (v' i val) (v' (i + 1) sc)
v' i (PPi p n fc ty sc)
| Nothing <- dsl_pi dsl
= PPi p n fc (v' i ty) (v' i sc)
| otherwise = PPi p n fc (v' i ty) (v' (i+1) sc)
v' i (PTyped l r) = PTyped (v' i l) (v' i r)
v' i (PApp f x as) = PApp f (v' i x) (fmap (fmap (v' i)) as)
v' i (PWithApp f x a) = PWithApp f (v' i x) (v' i a)
v' i (PCase f t as) = PCase f (v' i t) (fmap (pmap (v' i)) as)
v' i (PPair f hls p l r) = PPair f hls p (v' i l) (v' i r)
v' i (PDPair f hls p l t r) = PDPair f hls p (v' i l) (v' i t) (v' i r)
v' i (PAlternative ms a as) = PAlternative ms a $ map (v' i) as
v' i (PHidden t) = PHidden (v' i t)
v' i (PIdiom f t) = PIdiom f (v' i t)
v' i (PDoBlock ds) = PDoBlock (map (fmap (v' i)) ds)
v' i (PNoImplicits t) = PNoImplicits (v' i t)
v' i t = t
mkVar fc 0 = case index_first dsl of
Nothing -> PElabError (Msg "No index_first defined")
Just f -> setFC fc f
mkVar fc n = case index_next dsl of
Nothing -> PElabError (Msg "No index_next defined")
Just f -> PApp fc f [pexp (mkVar fc (n-1))]
setFC fc (PRef _ _ n) = PRef fc [] n
setFC fc (PApp _ f xs) = PApp fc (setFC fc f) (map (fmap (setFC fc)) xs)
setFC fc t = t | 1,921 | var dsl n t i = v' i t where
v' i (PRef fc hl x) | x == n =
case dsl_var dsl of
Nothing -> PElabError (Msg "No 'variable' defined in dsl")
Just v -> PApp fc v [pexp (mkVar fc i)]
v' i (PLam fc n nfc ty sc)
| Nothing <- dsl_lambda dsl
= PLam fc n nfc ty (v' i sc)
| otherwise = PLam fc n nfc (v' i ty) (v' (i + 1) sc)
v' i (PLet fc n nfc ty val sc)
| Nothing <- dsl_let dsl
= PLet fc n nfc (v' i ty) (v' i val) (v' i sc)
| otherwise = PLet fc n nfc (v' i ty) (v' i val) (v' (i + 1) sc)
v' i (PPi p n fc ty sc)
| Nothing <- dsl_pi dsl
= PPi p n fc (v' i ty) (v' i sc)
| otherwise = PPi p n fc (v' i ty) (v' (i+1) sc)
v' i (PTyped l r) = PTyped (v' i l) (v' i r)
v' i (PApp f x as) = PApp f (v' i x) (fmap (fmap (v' i)) as)
v' i (PWithApp f x a) = PWithApp f (v' i x) (v' i a)
v' i (PCase f t as) = PCase f (v' i t) (fmap (pmap (v' i)) as)
v' i (PPair f hls p l r) = PPair f hls p (v' i l) (v' i r)
v' i (PDPair f hls p l t r) = PDPair f hls p (v' i l) (v' i t) (v' i r)
v' i (PAlternative ms a as) = PAlternative ms a $ map (v' i) as
v' i (PHidden t) = PHidden (v' i t)
v' i (PIdiom f t) = PIdiom f (v' i t)
v' i (PDoBlock ds) = PDoBlock (map (fmap (v' i)) ds)
v' i (PNoImplicits t) = PNoImplicits (v' i t)
v' i t = t
mkVar fc 0 = case index_first dsl of
Nothing -> PElabError (Msg "No index_first defined")
Just f -> setFC fc f
mkVar fc n = case index_next dsl of
Nothing -> PElabError (Msg "No index_next defined")
Just f -> PApp fc f [pexp (mkVar fc (n-1))]
setFC fc (PRef _ _ n) = PRef fc [] n
setFC fc (PApp _ f xs) = PApp fc (setFC fc f) (map (fmap (setFC fc)) xs)
setFC fc t = t | 1,877 | true | true | 0 | 16 | 719 | 1,156 | 555 | 601 | null | null |
dbp/karamaan-opaleye | Karamaan/Opaleye/Manipulation.hs | bsd-3-clause | arrangeUpdateDef :: (Default TableExprRunner t u,
Default (PPOfContravariant Assocer) t' t',
Default TableMaybeWrapper t t') =>
Table t -> ExprArr u t' -> ExprArr u (Wire Bool)
-> SqlUpdate
arrangeUpdateDef = arrangeUpdate def def' def
where def' = unPPOfContravariant def | 356 | arrangeUpdateDef :: (Default TableExprRunner t u,
Default (PPOfContravariant Assocer) t' t',
Default TableMaybeWrapper t t') =>
Table t -> ExprArr u t' -> ExprArr u (Wire Bool)
-> SqlUpdate
arrangeUpdateDef = arrangeUpdate def def' def
where def' = unPPOfContravariant def | 356 | arrangeUpdateDef = arrangeUpdate def def' def
where def' = unPPOfContravariant def | 84 | false | true | 1 | 11 | 123 | 102 | 48 | 54 | null | null |
sinelaw/fresh | src/Fresh/InferMonad.hs | gpl-2.0 | freshRVar :: Infer s (TypeVar (STRef s) a)
freshRVar = freshTVarK Composite | 75 | freshRVar :: Infer s (TypeVar (STRef s) a)
freshRVar = freshTVarK Composite | 75 | freshRVar = freshTVarK Composite | 32 | false | true | 0 | 9 | 11 | 33 | 16 | 17 | null | null |
vaibhav276/exercism_haskell | run-length-encoding/test/Tests.hs | mit | bothCases :: [Case]
bothCases =
[ Case { description = "decode . encode combination"
, input = "zzz ZZ zZ"
, expected = "zzz ZZ zZ"
}
] | 187 | bothCases :: [Case]
bothCases =
[ Case { description = "decode . encode combination"
, input = "zzz ZZ zZ"
, expected = "zzz ZZ zZ"
}
] | 187 | bothCases =
[ Case { description = "decode . encode combination"
, input = "zzz ZZ zZ"
, expected = "zzz ZZ zZ"
}
] | 167 | false | true | 0 | 7 | 79 | 37 | 23 | 14 | null | null |
bernstein/ircfs | Ircfs/Filesystem.hs | bsd-3-clause | fileToQreq n "name" = Just (Qname n) | 37 | fileToQreq n "name" = Just (Qname n) | 37 | fileToQreq n "name" = Just (Qname n) | 37 | false | false | 0 | 7 | 7 | 22 | 9 | 13 | null | null |
tadeuzagallo/verve-lang | src/Typing/Substitution.hs | mit | applySubst _ Bot = Bot | 22 | applySubst _ Bot = Bot | 22 | applySubst _ Bot = Bot | 22 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
brendanhay/gogol | gogol-streetviewpublish/gen/Network/Google/StreetViewPublish/Types/Product.hs | mpl-2.0 | -- | The estimated horizontal accuracy of this pose in meters with 68%
-- confidence (one standard deviation). For example, on Android, this value
-- is available from this method:
-- https:\/\/developer.android.com\/reference\/android\/location\/Location#getAccuracy().
-- Other platforms have different methods of obtaining similar accuracy
-- estimations.
pAccuracyMeters :: Lens' Pose (Maybe Double)
pAccuracyMeters
= lens _pAccuracyMeters
(\ s a -> s{_pAccuracyMeters = a})
. mapping _Coerce | 510 | pAccuracyMeters :: Lens' Pose (Maybe Double)
pAccuracyMeters
= lens _pAccuracyMeters
(\ s a -> s{_pAccuracyMeters = a})
. mapping _Coerce | 151 | pAccuracyMeters
= lens _pAccuracyMeters
(\ s a -> s{_pAccuracyMeters = a})
. mapping _Coerce | 106 | true | true | 0 | 10 | 77 | 60 | 33 | 27 | null | null |
jacekszymanski/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxCB_SIMPLE :: Int
wxCB_SIMPLE = 4 | 34 | wxCB_SIMPLE :: Int
wxCB_SIMPLE = 4 | 34 | wxCB_SIMPLE = 4 | 15 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
harlanhaskins/Letter | Haskell/app/REPL/Parser.hs | mit | commandToken long short = choice' $ map (symbol . (':':)) [long, short] | 71 | commandToken long short = choice' $ map (symbol . (':':)) [long, short] | 71 | commandToken long short = choice' $ map (symbol . (':':)) [long, short] | 71 | false | false | 0 | 9 | 11 | 37 | 20 | 17 | null | null |
apyrgio/snf-ganeti | src/Ganeti/Hs2Py/OpDoc.hs | bsd-2-clause | opGroupRename :: String
opGroupRename =
"Rename a node group in the cluster." | 79 | opGroupRename :: String
opGroupRename =
"Rename a node group in the cluster." | 79 | opGroupRename =
"Rename a node group in the cluster." | 55 | false | true | 0 | 4 | 13 | 11 | 6 | 5 | null | null |
mariefarrell/Hets | Maude/Symbol.hs | gpl-2.0 | isType :: Symbol -> Bool
isType symb = case symb of
Sort _ -> True
Kind _ -> True
_ -> False | 104 | isType :: Symbol -> Bool
isType symb = case symb of
Sort _ -> True
Kind _ -> True
_ -> False | 104 | isType symb = case symb of
Sort _ -> True
Kind _ -> True
_ -> False | 79 | false | true | 4 | 5 | 33 | 43 | 22 | 21 | null | null |
DavidAlphaFox/darcs | containers-0.5.2.1/Darcs/Data/Set/Base.hs | gpl-2.0 | showsTree :: Show a => Bool -> [String] -> [String] -> Set a -> ShowS
showsTree wide lbars rbars t
= case t of
Tip -> showsBars lbars . showString "|\n"
Bin _ x Tip Tip
-> showsBars lbars . shows x . showString "\n"
Bin _ x l r
-> showsTree wide (withBar rbars) (withEmpty rbars) r .
showWide wide rbars .
showsBars lbars . shows x . showString "\n" .
showWide wide lbars .
showsTree wide (withEmpty lbars) (withBar lbars) l | 516 | showsTree :: Show a => Bool -> [String] -> [String] -> Set a -> ShowS
showsTree wide lbars rbars t
= case t of
Tip -> showsBars lbars . showString "|\n"
Bin _ x Tip Tip
-> showsBars lbars . shows x . showString "\n"
Bin _ x l r
-> showsTree wide (withBar rbars) (withEmpty rbars) r .
showWide wide rbars .
showsBars lbars . shows x . showString "\n" .
showWide wide lbars .
showsTree wide (withEmpty lbars) (withBar lbars) l | 516 | showsTree wide lbars rbars t
= case t of
Tip -> showsBars lbars . showString "|\n"
Bin _ x Tip Tip
-> showsBars lbars . shows x . showString "\n"
Bin _ x l r
-> showsTree wide (withBar rbars) (withEmpty rbars) r .
showWide wide rbars .
showsBars lbars . shows x . showString "\n" .
showWide wide lbars .
showsTree wide (withEmpty lbars) (withBar lbars) l | 446 | false | true | 0 | 16 | 174 | 204 | 95 | 109 | null | null |
peterkmurphy/preference | src/OurTests/TestStuff.hs | bsd-3-clause | testFilterminindexes24 = filterminindexes [1] [2, 1, 2] @?= [1] | 63 | testFilterminindexes24 = filterminindexes [1] [2, 1, 2] @?= [1] | 63 | testFilterminindexes24 = filterminindexes [1] [2, 1, 2] @?= [1] | 63 | false | false | 0 | 7 | 8 | 30 | 17 | 13 | null | null |
Gabriel439/Haskell-Record-Library | src/Record.hs | bsd-3-clause | indent :: String -> String
indent = unlines . transform . lines
where
transform (l:ls) = l:map (" " ++) ls
transform [] = [""]
-- | Run the supplied command, logging useful context and output to `~/.record` | 229 | indent :: String -> String
indent = unlines . transform . lines
where
transform (l:ls) = l:map (" " ++) ls
transform [] = [""]
-- | Run the supplied command, logging useful context and output to `~/.record` | 229 | indent = unlines . transform . lines
where
transform (l:ls) = l:map (" " ++) ls
transform [] = [""]
-- | Run the supplied command, logging useful context and output to `~/.record` | 202 | false | true | 0 | 7 | 60 | 68 | 36 | 32 | null | null |
kawamuray/ganeti | src/Ganeti/Constants.hs | gpl-2.0 | -- * Job queue test
jqtMsgprefix :: String
jqtMsgprefix = "TESTMSG=" | 69 | jqtMsgprefix :: String
jqtMsgprefix = "TESTMSG=" | 48 | jqtMsgprefix = "TESTMSG=" | 25 | true | true | 0 | 4 | 11 | 12 | 7 | 5 | null | null |
da-x/ghc | compiler/deSugar/Coverage.hs | bsd-3-clause | addTickHsExpr (HsProc pat cmdtop) =
liftM2 HsProc
(addTickLPat pat)
(liftL (addTickHsCmdTop) cmdtop) | 140 | addTickHsExpr (HsProc pat cmdtop) =
liftM2 HsProc
(addTickLPat pat)
(liftL (addTickHsCmdTop) cmdtop) | 140 | addTickHsExpr (HsProc pat cmdtop) =
liftM2 HsProc
(addTickLPat pat)
(liftL (addTickHsCmdTop) cmdtop) | 140 | false | false | 0 | 8 | 51 | 41 | 20 | 21 | null | null |
forste/haReFork | tools/hs2html/hslex2html.hs | bsd-3-clause | main =
do args <- getArgs
if null args
then interact hslex2html
else mapM_ hsfile2html args | 112 | main =
do args <- getArgs
if null args
then interact hslex2html
else mapM_ hsfile2html args | 112 | main =
do args <- getArgs
if null args
then interact hslex2html
else mapM_ hsfile2html args | 112 | false | false | 1 | 9 | 36 | 39 | 16 | 23 | null | null |
tcrayford/hafka | Network/Kafka/Specs/Kafka/EndToEnd/BasicConsumerSpecs.hs | bsd-3-clause | produceToConsume :: Spec
produceToConsume = it "can push -> pop an message" $ do
let stream = Stream (Topic "produceToConsume") (Partition 4)
(testProducer, testConsumer) = coupledProducerConsumer stream
message = Message "produceToConsume"
result <- newEmptyMVar
produce testProducer [message]
recordMatching testConsumer message result
waitFor result message (return ()) | 424 | produceToConsume :: Spec
produceToConsume = it "can push -> pop an message" $ do
let stream = Stream (Topic "produceToConsume") (Partition 4)
(testProducer, testConsumer) = coupledProducerConsumer stream
message = Message "produceToConsume"
result <- newEmptyMVar
produce testProducer [message]
recordMatching testConsumer message result
waitFor result message (return ()) | 424 | produceToConsume = it "can push -> pop an message" $ do
let stream = Stream (Topic "produceToConsume") (Partition 4)
(testProducer, testConsumer) = coupledProducerConsumer stream
message = Message "produceToConsume"
result <- newEmptyMVar
produce testProducer [message]
recordMatching testConsumer message result
waitFor result message (return ()) | 399 | false | true | 0 | 14 | 97 | 120 | 54 | 66 | null | null |
tomahawkins/atom | Language/Atom/Expressions.hs | bsd-3-clause | -- | Equal.
(==.) :: EqE a => E a -> E a -> E Bool
(==.) = Eq | 61 | (==.) :: EqE a => E a -> E a -> E Bool
(==.) = Eq | 49 | (==.) = Eq | 10 | true | true | 0 | 8 | 18 | 40 | 21 | 19 | null | null |
alanz/hroq | src/Data/Concurrent/Queue/Roq/Mnesia.hs | bsd-3-clause | -- ---------------------------------------------------------------------
persistTableInfo :: Map.Map TableName TableMeta -> Process ()
persistTableInfo ti = do
logt $ "HroqMnesia.persistTableInfo starting for"
-- logm $ "HroqMnesia.persistTableInfo starting for:" ++ (show ti)
res <- liftIO $ Exception.try $ defaultWrite (tableNameToFileName schemaTable) (encode ti)
case res of
Left (e :: SomeException) -> logm $ "HroqMnesia.persistTableInfo:error:" ++ (show e)
Right _ -> logt $ "HroqMnesia.persistTableInfo done"
-- ---------------------------------------------------------------------
-- |Record the table details into the meta information. | 665 | persistTableInfo :: Map.Map TableName TableMeta -> Process ()
persistTableInfo ti = do
logt $ "HroqMnesia.persistTableInfo starting for"
-- logm $ "HroqMnesia.persistTableInfo starting for:" ++ (show ti)
res <- liftIO $ Exception.try $ defaultWrite (tableNameToFileName schemaTable) (encode ti)
case res of
Left (e :: SomeException) -> logm $ "HroqMnesia.persistTableInfo:error:" ++ (show e)
Right _ -> logt $ "HroqMnesia.persistTableInfo done"
-- ---------------------------------------------------------------------
-- |Record the table details into the meta information. | 591 | persistTableInfo ti = do
logt $ "HroqMnesia.persistTableInfo starting for"
-- logm $ "HroqMnesia.persistTableInfo starting for:" ++ (show ti)
res <- liftIO $ Exception.try $ defaultWrite (tableNameToFileName schemaTable) (encode ti)
case res of
Left (e :: SomeException) -> logm $ "HroqMnesia.persistTableInfo:error:" ++ (show e)
Right _ -> logt $ "HroqMnesia.persistTableInfo done"
-- ---------------------------------------------------------------------
-- |Record the table details into the meta information. | 529 | true | true | 0 | 12 | 89 | 125 | 61 | 64 | null | null |
yoo-e/yesod-helpers | Yesod/Helpers/Message.hs | bsd-3-clause | formMessageToYH (MsgInvalidEmail x) = MsgFormMsgInvalidEmail x | 67 | formMessageToYH (MsgInvalidEmail x) = MsgFormMsgInvalidEmail x | 67 | formMessageToYH (MsgInvalidEmail x) = MsgFormMsgInvalidEmail x | 67 | false | false | 0 | 7 | 10 | 18 | 8 | 10 | null | null |
abuiles/turbinado-blog | Turbinado/Server/Handlers/RequestHandler.hs | bsd-3-clause | -- | The main request handler. This runs standard and custom preFilters
-- then runs the Controller and View.
requestHandler :: Controller ()
requestHandler = do
debugM $ " requestHandler : running pre and main filters"
-- Run the Pre filters, the page
sequence_ $ preFilters ++
customPreFilters ++
[ retrieveAndRunController
, retrieveAndRunLayout
]
debugM $ " requestHandler : running post filters"
sequence_ (customPostFilters ++ postFilters)
-- | This function dynamically loads (if needed) the 'Controller'
-- using the information provided by the 'Routes'. Controllers reside
-- in @App/Controllers@. | 749 | requestHandler :: Controller ()
requestHandler = do
debugM $ " requestHandler : running pre and main filters"
-- Run the Pre filters, the page
sequence_ $ preFilters ++
customPreFilters ++
[ retrieveAndRunController
, retrieveAndRunLayout
]
debugM $ " requestHandler : running post filters"
sequence_ (customPostFilters ++ postFilters)
-- | This function dynamically loads (if needed) the 'Controller'
-- using the information provided by the 'Routes'. Controllers reside
-- in @App/Controllers@. | 638 | requestHandler = do
debugM $ " requestHandler : running pre and main filters"
-- Run the Pre filters, the page
sequence_ $ preFilters ++
customPreFilters ++
[ retrieveAndRunController
, retrieveAndRunLayout
]
debugM $ " requestHandler : running post filters"
sequence_ (customPostFilters ++ postFilters)
-- | This function dynamically loads (if needed) the 'Controller'
-- using the information provided by the 'Routes'. Controllers reside
-- in @App/Controllers@. | 606 | true | true | 0 | 9 | 231 | 70 | 37 | 33 | null | null |
ghc-android/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | emitPrimOp dflags [res] CtzOp [w] = emitCtzCall res w (wordWidth dflags) | 74 | emitPrimOp dflags [res] CtzOp [w] = emitCtzCall res w (wordWidth dflags) | 74 | emitPrimOp dflags [res] CtzOp [w] = emitCtzCall res w (wordWidth dflags) | 74 | false | false | 0 | 7 | 12 | 34 | 17 | 17 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.