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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
xmonad/xmonad-contrib | XMonad/Util/Parser.hs | bsd-3-clause | -- | Succeeds if and only if we are at the end of input.
eof :: Parser ()
eof = coerce ReadP.eof | 96 | eof :: Parser ()
eof = coerce ReadP.eof | 39 | eof = coerce ReadP.eof | 22 | true | true | 0 | 7 | 21 | 28 | 12 | 16 | null | null |
k0001/gtk2hs | tools/c2hs/base/state/State.hs | gpl-3.0 | -- raise a fatal user-defined error (EXPORTED)
--
-- * such an error my be caught and handled using `fatalsHandeledBy'
--
fatal :: String -> PreCST e s a
fatal = CST . StateTrans.fatal | 185 | fatal :: String -> PreCST e s a
fatal = CST . StateTrans.fatal | 63 | fatal = CST . StateTrans.fatal | 31 | true | true | 0 | 7 | 34 | 38 | 19 | 19 | null | null |
erochest/ribot | src/Text/Ribot/Mimic.hs | bsd-3-clause | triples :: a -> [a] -> [(a, a, a)]
triples fill xs = L.zip3 xxs (L.drop 1 xxs) (L.drop 2 xxs)
where xxs = (fill : fill : xs) ++ [fill, fill] | 144 | triples :: a -> [a] -> [(a, a, a)]
triples fill xs = L.zip3 xxs (L.drop 1 xxs) (L.drop 2 xxs)
where xxs = (fill : fill : xs) ++ [fill, fill] | 144 | triples fill xs = L.zip3 xxs (L.drop 1 xxs) (L.drop 2 xxs)
where xxs = (fill : fill : xs) ++ [fill, fill] | 109 | false | true | 0 | 8 | 35 | 97 | 52 | 45 | null | null |
rahulmutt/ghcvm | compiler/Eta/Core/MkCore.hs | bsd-3-clause | mkEqBox :: Coercion -> CoreExpr
mkEqBox co = ASSERT2( typeKind ty2 `eqKind` k, ppr co $$ ppr ty1 $$ ppr ty2 $$ ppr (typeKind ty1) $$ ppr (typeKind ty2) )
Var (dataConWorkId datacon) `mkTyApps` [k, ty1, ty2] `App` Coercion co
where (Pair ty1 ty2, role) = coercionKindRole co
k = typeKind ty1
datacon = case role of
Nominal -> eqBoxDataCon
Representational -> coercibleDataCon
Phantom -> pprPanic "mkEqBox does not support boxing phantom coercions"
(ppr co)
{-
************************************************************************
* *
\subsection{Tuple constructors}
* *
************************************************************************
-}
{-
Creating tuples and their types for Core expressions
@mkBigCoreVarTup@ builds a tuple; the inverse to @mkTupleSelector@.
* If it has only one element, it is the identity function.
* If there are more elements than a big tuple can have, it nests
the tuples.
Note [Flattening one-tuples]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This family of functions creates a tuple of variables/expressions/types.
mkCoreTup [e1,e2,e3] = (e1,e2,e3)
What if there is just one variable/expression/type in the agument?
We could do one of two things:
* Flatten it out, so that
mkCoreTup [e1] = e1
* Built a one-tuple (see Note [One-tuples] in TysWiredIn)
mkCoreTup1 [e1] = Unit e1
We use a suffix "1" to indicate this.
Usually we want the former, but occasionally the latter.
-}
-- | Build a small tuple holding the specified variables
-- One-tuples are flattened; see Note [Flattening of one-tuples] | 1,809 | mkEqBox :: Coercion -> CoreExpr
mkEqBox co = ASSERT2( typeKind ty2 `eqKind` k, ppr co $$ ppr ty1 $$ ppr ty2 $$ ppr (typeKind ty1) $$ ppr (typeKind ty2) )
Var (dataConWorkId datacon) `mkTyApps` [k, ty1, ty2] `App` Coercion co
where (Pair ty1 ty2, role) = coercionKindRole co
k = typeKind ty1
datacon = case role of
Nominal -> eqBoxDataCon
Representational -> coercibleDataCon
Phantom -> pprPanic "mkEqBox does not support boxing phantom coercions"
(ppr co)
{-
************************************************************************
* *
\subsection{Tuple constructors}
* *
************************************************************************
-}
{-
Creating tuples and their types for Core expressions
@mkBigCoreVarTup@ builds a tuple; the inverse to @mkTupleSelector@.
* If it has only one element, it is the identity function.
* If there are more elements than a big tuple can have, it nests
the tuples.
Note [Flattening one-tuples]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This family of functions creates a tuple of variables/expressions/types.
mkCoreTup [e1,e2,e3] = (e1,e2,e3)
What if there is just one variable/expression/type in the agument?
We could do one of two things:
* Flatten it out, so that
mkCoreTup [e1] = e1
* Built a one-tuple (see Note [One-tuples] in TysWiredIn)
mkCoreTup1 [e1] = Unit e1
We use a suffix "1" to indicate this.
Usually we want the former, but occasionally the latter.
-}
-- | Build a small tuple holding the specified variables
-- One-tuples are flattened; see Note [Flattening of one-tuples] | 1,809 | mkEqBox co = ASSERT2( typeKind ty2 `eqKind` k, ppr co $$ ppr ty1 $$ ppr ty2 $$ ppr (typeKind ty1) $$ ppr (typeKind ty2) )
Var (dataConWorkId datacon) `mkTyApps` [k, ty1, ty2] `App` Coercion co
where (Pair ty1 ty2, role) = coercionKindRole co
k = typeKind ty1
datacon = case role of
Nominal -> eqBoxDataCon
Representational -> coercibleDataCon
Phantom -> pprPanic "mkEqBox does not support boxing phantom coercions"
(ppr co)
{-
************************************************************************
* *
\subsection{Tuple constructors}
* *
************************************************************************
-}
{-
Creating tuples and their types for Core expressions
@mkBigCoreVarTup@ builds a tuple; the inverse to @mkTupleSelector@.
* If it has only one element, it is the identity function.
* If there are more elements than a big tuple can have, it nests
the tuples.
Note [Flattening one-tuples]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This family of functions creates a tuple of variables/expressions/types.
mkCoreTup [e1,e2,e3] = (e1,e2,e3)
What if there is just one variable/expression/type in the agument?
We could do one of two things:
* Flatten it out, so that
mkCoreTup [e1] = e1
* Built a one-tuple (see Note [One-tuples] in TysWiredIn)
mkCoreTup1 [e1] = Unit e1
We use a suffix "1" to indicate this.
Usually we want the former, but occasionally the latter.
-}
-- | Build a small tuple holding the specified variables
-- One-tuples are flattened; see Note [Flattening of one-tuples] | 1,777 | false | true | 2 | 13 | 513 | 186 | 96 | 90 | null | null |
hspec/hspec-wai | src/Test/Hspec/Wai/Util.hs | mit | safeToString :: ByteString -> Maybe String
safeToString bs = do
str <- either (const Nothing) (Just . T.unpack) (T.decodeUtf8' bs)
let isSafe = not $ case str of
[] -> True
_ -> isSpace (last str) || any (not . isPrint) str
guard isSafe >> return str
-- for compatibility with older versions of `bytestring` | 331 | safeToString :: ByteString -> Maybe String
safeToString bs = do
str <- either (const Nothing) (Just . T.unpack) (T.decodeUtf8' bs)
let isSafe = not $ case str of
[] -> True
_ -> isSpace (last str) || any (not . isPrint) str
guard isSafe >> return str
-- for compatibility with older versions of `bytestring` | 331 | safeToString bs = do
str <- either (const Nothing) (Just . T.unpack) (T.decodeUtf8' bs)
let isSafe = not $ case str of
[] -> True
_ -> isSpace (last str) || any (not . isPrint) str
guard isSafe >> return str
-- for compatibility with older versions of `bytestring` | 288 | false | true | 0 | 18 | 78 | 133 | 62 | 71 | null | null |
mainland/nikola | src/Data/Array/Nikola/Backend/CUDA/Haskell/Ex.hs | bsd-3-clause | popVal :: Ex ()
popVal =
modify $ \s -> s { exVals = tail (exVals s) } | 74 | popVal :: Ex ()
popVal =
modify $ \s -> s { exVals = tail (exVals s) } | 74 | popVal =
modify $ \s -> s { exVals = tail (exVals s) } | 58 | false | true | 0 | 11 | 21 | 42 | 22 | 20 | null | null |
ihc/futhark | src/Futhark/Representation/Primitive.hs | isc | -- | The size of a value of a given primitive type in bites.
primBitSize :: PrimType -> Int
primBitSize = (*8) . primByteSize | 125 | primBitSize :: PrimType -> Int
primBitSize = (*8) . primByteSize | 64 | primBitSize = (*8) . primByteSize | 33 | true | true | 0 | 6 | 23 | 24 | 14 | 10 | null | null |
dysinger/amazonka | amazonka-s3/gen/Network/AWS/S3/PutObject.hs | mpl-2.0 | -- | The date and time at which the object is no longer cacheable.
poExpires :: Lens' PutObject (Maybe UTCTime)
poExpires = lens _poExpires (\s a -> s { _poExpires = a }) . mapping _Time | 186 | poExpires :: Lens' PutObject (Maybe UTCTime)
poExpires = lens _poExpires (\s a -> s { _poExpires = a }) . mapping _Time | 119 | poExpires = lens _poExpires (\s a -> s { _poExpires = a }) . mapping _Time | 74 | true | true | 0 | 10 | 35 | 53 | 28 | 25 | null | null |
holzensp/ghc | compiler/llvmGen/LlvmCodeGen/Base.hs | bsd-3-clause | -- | Translate a Cmm Float Width to a LlvmType.
widthToLlvmFloat :: Width -> LlvmType
widthToLlvmFloat W32 = LMFloat | 117 | widthToLlvmFloat :: Width -> LlvmType
widthToLlvmFloat W32 = LMFloat | 69 | widthToLlvmFloat W32 = LMFloat | 31 | true | true | 0 | 5 | 19 | 19 | 10 | 9 | null | null |
rahulmutt/codec-jvm | src/Codec/JVM/Opcode.hs | apache-2.0 | fstore_1 = Opcode 0x44 | 22 | fstore_1 = Opcode 0x44 | 22 | fstore_1 = Opcode 0x44 | 22 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
GaloisInc/saw-script | crux-mir-comp/test/Test.hs | bsd-3-clause | symbTest :: FilePath -> IO TestTree
symbTest dir =
do exists <- doesDirectoryExist dir
rustFiles <- if exists then findByExtension [".rs"] dir else return []
return $
testGroup "Output testing"
[ doGoldenTest (takeBaseName rustFile) goodFile outFile $
withFile outFile WriteMode $ \h ->
runCrux rustFile h RcmSymbolic
| rustFile <- rustFiles
-- Skip hidden files, such as editor swap files
, not $ "." `isPrefixOf` takeFileName rustFile
, let goodFile = replaceExtension rustFile ".good"
, let outFile = replaceExtension rustFile ".out"
] | 642 | symbTest :: FilePath -> IO TestTree
symbTest dir =
do exists <- doesDirectoryExist dir
rustFiles <- if exists then findByExtension [".rs"] dir else return []
return $
testGroup "Output testing"
[ doGoldenTest (takeBaseName rustFile) goodFile outFile $
withFile outFile WriteMode $ \h ->
runCrux rustFile h RcmSymbolic
| rustFile <- rustFiles
-- Skip hidden files, such as editor swap files
, not $ "." `isPrefixOf` takeFileName rustFile
, let goodFile = replaceExtension rustFile ".good"
, let outFile = replaceExtension rustFile ".out"
] | 642 | symbTest dir =
do exists <- doesDirectoryExist dir
rustFiles <- if exists then findByExtension [".rs"] dir else return []
return $
testGroup "Output testing"
[ doGoldenTest (takeBaseName rustFile) goodFile outFile $
withFile outFile WriteMode $ \h ->
runCrux rustFile h RcmSymbolic
| rustFile <- rustFiles
-- Skip hidden files, such as editor swap files
, not $ "." `isPrefixOf` takeFileName rustFile
, let goodFile = replaceExtension rustFile ".good"
, let outFile = replaceExtension rustFile ".out"
] | 606 | false | true | 0 | 14 | 185 | 168 | 81 | 87 | null | null |
xpika/mohws | src/Network/MoHWS/Utility.hs | bsd-3-clause | die :: String -> IO ()
die err = do hPutStrLn stderr err
exitFailure
-----------------------------------------------------------------------------
-- String utils | 176 | die :: String -> IO ()
die err = do hPutStrLn stderr err
exitFailure
-----------------------------------------------------------------------------
-- String utils | 176 | die err = do hPutStrLn stderr err
exitFailure
-----------------------------------------------------------------------------
-- String utils | 153 | false | true | 0 | 8 | 31 | 41 | 18 | 23 | null | null |
keithodulaigh/Hets | CSL/Parse_Test.hs | gpl-2.0 | res15 = runParser aFormula (emptyAnnos ()) "" "true" | 52 | res15 = runParser aFormula (emptyAnnos ()) "" "true" | 52 | res15 = runParser aFormula (emptyAnnos ()) "" "true" | 52 | false | false | 1 | 8 | 7 | 26 | 11 | 15 | null | null |
GaloisInc/galua | galua-dbg/src/Galua/Debugger/View.hs | mit | hexNumber :: Number -> String
hexNumber (Double d) = doubleToHex d | 66 | hexNumber :: Number -> String
hexNumber (Double d) = doubleToHex d | 66 | hexNumber (Double d) = doubleToHex d | 36 | false | true | 0 | 7 | 10 | 27 | 13 | 14 | null | null |
ku-fpg/kansas-amber | System/Hardware/Haskino/Protocol.hs | bsd-3-clause | packageExpr (OrI16 e1 e2) = packageTwoSubExpr (exprCmdVal EXPR_INT16 EXPR_OR) e1 e2 | 83 | packageExpr (OrI16 e1 e2) = packageTwoSubExpr (exprCmdVal EXPR_INT16 EXPR_OR) e1 e2 | 83 | packageExpr (OrI16 e1 e2) = packageTwoSubExpr (exprCmdVal EXPR_INT16 EXPR_OR) e1 e2 | 83 | false | false | 0 | 7 | 10 | 32 | 15 | 17 | null | null |
sampou-org/pfad | Code/Code20.hs | bsd-3-clause | nearest :: Value -> [(Expr, Value)] -> (Expr, Value)
nearest n ((e,v) : evs) = if d == 0 then (e,v)
else search n d (e,v) evs
where d = abs (n-v) | 203 | nearest :: Value -> [(Expr, Value)] -> (Expr, Value)
nearest n ((e,v) : evs) = if d == 0 then (e,v)
else search n d (e,v) evs
where d = abs (n-v) | 203 | nearest n ((e,v) : evs) = if d == 0 then (e,v)
else search n d (e,v) evs
where d = abs (n-v) | 150 | false | true | 1 | 11 | 89 | 115 | 59 | 56 | null | null |
meteogrid/dropdirwatch | plugins/FTP.hs | bsd-3-clause | upload (FTPUri uri@URI{uriPath=destDir}) filename
= ($$ createSink uri {uriPath=destDir ++ takeFileName filename}) | 116 | upload (FTPUri uri@URI{uriPath=destDir}) filename
= ($$ createSink uri {uriPath=destDir ++ takeFileName filename}) | 116 | upload (FTPUri uri@URI{uriPath=destDir}) filename
= ($$ createSink uri {uriPath=destDir ++ takeFileName filename}) | 116 | false | false | 1 | 11 | 13 | 56 | 27 | 29 | null | null |
sopvop/cabal | cabal-install/Distribution/Client/IndexUtils.hs | bsd-3-clause | tarEntriesList :: Show e => Tar.Entries e -> [(BlockNo, Tar.Entry)]
tarEntriesList = go 0
where
go !_ Tar.Done = []
go !_ (Tar.Fail e) = error ("tarEntriesList: " ++ show e)
go !n (Tar.Next e es') = (n, e) : go (Tar.nextEntryOffset e n) es' | 266 | tarEntriesList :: Show e => Tar.Entries e -> [(BlockNo, Tar.Entry)]
tarEntriesList = go 0
where
go !_ Tar.Done = []
go !_ (Tar.Fail e) = error ("tarEntriesList: " ++ show e)
go !n (Tar.Next e es') = (n, e) : go (Tar.nextEntryOffset e n) es' | 266 | tarEntriesList = go 0
where
go !_ Tar.Done = []
go !_ (Tar.Fail e) = error ("tarEntriesList: " ++ show e)
go !n (Tar.Next e es') = (n, e) : go (Tar.nextEntryOffset e n) es' | 198 | false | true | 2 | 11 | 70 | 140 | 69 | 71 | null | null |
klpn/highlighting-kate | Text/Highlighting/Kate/Format/HTML.hs | gpl-2.0 | short SpecialCharTok = "sc" | 30 | short SpecialCharTok = "sc" | 30 | short SpecialCharTok = "sc" | 30 | false | false | 0 | 5 | 6 | 9 | 4 | 5 | null | null |
google-research/dex-lang | src/lib/Serialize.hs | bsd-3-clause | prettyVal :: (MonadIO1 m, EnvReader m, Fallible1 m) => Val n -> m n (Doc ann)
prettyVal val = case val of
-- Pretty-print tables.
Lam (LamExpr (LamBinder _ _ TabArrow _) _) -> do
atoms <- getTableElements val
elems <- forM atoms \atom -> do
case atom of
Con (Lit (Word8Lit c)) -> return $ showChar (toEnum @Char $ fromIntegral c) ""
Con (Lit (Word32Lit c)) -> return $ "0x" ++ showHex c ""
Con (Lit (Word64Lit c)) -> return $ "0x" ++ showHex c ""
_ -> pprintVal atom
TabTy b resultTy <- getType val
idxSetDoc <- return case binderType b of
Fin _ -> mempty -- (Fin n) is not shown
idxSet -> "@" <> pretty idxSet -- Otherwise, show explicit index set
elemsDoc <- return case resultTy of
-- Print table of characters as a string literal.
TC (BaseType (Scalar Word8Type)) -> pretty ('"': concat elems ++ "\"")
_ -> pretty elems
return $ elemsDoc <> idxSetDoc
DataCon name _ _ _ args -> do
mapM prettyVal args <&> \case
[] -> pretty name
args' -> parens $ pretty name <+> hsep args'
Con con -> case con of
ProdCon [] -> return $ pretty ()
ProdCon [x, y] -> do
xStr <- pprintVal x
yStr <- pprintVal y
return $ pretty (xStr, yStr)
ProdCon _ -> error "Unexpected product type: only binary products available in surface language."
SumAsProd ty (TagRepVal trep) payload -> do
let t = fromIntegral trep
case ty of
TypeCon _ dataDefName _ -> do
DataDef _ _ dataCons <- lookupDataDef dataDefName
DataConDef conName _ <- return $ dataCons !! t
mapM prettyVal (payload !! t) <&> \case
[] -> pretty conName
args -> parens $ pretty conName <+> hsep args
VariantTy (NoExt types) -> return $ pretty variant
where
[value] = payload !! t
(theLabel, repeatNum) = toList (reflectLabels types) !! t
variant = Variant (NoExt types) theLabel repeatNum value
_ -> error "SumAsProd with an unsupported type"
_ -> return $ pretty con
Record (LabeledItems row) -> do
let separator = line' <> ","
let bindwith = " ="
let elems = concatMap (\(k, vs) -> map (k,) (toList vs)) (M.toAscList row)
let fmElem = \(label, v) -> ((pretty label <> bindwith) <+>) <$> prettyVal v
docs <- mapM fmElem elems
let innerDoc = "{" <> flatAlt " " ""
<> concatWith (surround (separator <> " ")) docs
<> "}"
return $ align $ group innerDoc
atom -> return $ prettyPrec atom LowestPrec
-- === taking memory snapshots for serializing heap-backed dex values === | 2,670 | prettyVal :: (MonadIO1 m, EnvReader m, Fallible1 m) => Val n -> m n (Doc ann)
prettyVal val = case val of
-- Pretty-print tables.
Lam (LamExpr (LamBinder _ _ TabArrow _) _) -> do
atoms <- getTableElements val
elems <- forM atoms \atom -> do
case atom of
Con (Lit (Word8Lit c)) -> return $ showChar (toEnum @Char $ fromIntegral c) ""
Con (Lit (Word32Lit c)) -> return $ "0x" ++ showHex c ""
Con (Lit (Word64Lit c)) -> return $ "0x" ++ showHex c ""
_ -> pprintVal atom
TabTy b resultTy <- getType val
idxSetDoc <- return case binderType b of
Fin _ -> mempty -- (Fin n) is not shown
idxSet -> "@" <> pretty idxSet -- Otherwise, show explicit index set
elemsDoc <- return case resultTy of
-- Print table of characters as a string literal.
TC (BaseType (Scalar Word8Type)) -> pretty ('"': concat elems ++ "\"")
_ -> pretty elems
return $ elemsDoc <> idxSetDoc
DataCon name _ _ _ args -> do
mapM prettyVal args <&> \case
[] -> pretty name
args' -> parens $ pretty name <+> hsep args'
Con con -> case con of
ProdCon [] -> return $ pretty ()
ProdCon [x, y] -> do
xStr <- pprintVal x
yStr <- pprintVal y
return $ pretty (xStr, yStr)
ProdCon _ -> error "Unexpected product type: only binary products available in surface language."
SumAsProd ty (TagRepVal trep) payload -> do
let t = fromIntegral trep
case ty of
TypeCon _ dataDefName _ -> do
DataDef _ _ dataCons <- lookupDataDef dataDefName
DataConDef conName _ <- return $ dataCons !! t
mapM prettyVal (payload !! t) <&> \case
[] -> pretty conName
args -> parens $ pretty conName <+> hsep args
VariantTy (NoExt types) -> return $ pretty variant
where
[value] = payload !! t
(theLabel, repeatNum) = toList (reflectLabels types) !! t
variant = Variant (NoExt types) theLabel repeatNum value
_ -> error "SumAsProd with an unsupported type"
_ -> return $ pretty con
Record (LabeledItems row) -> do
let separator = line' <> ","
let bindwith = " ="
let elems = concatMap (\(k, vs) -> map (k,) (toList vs)) (M.toAscList row)
let fmElem = \(label, v) -> ((pretty label <> bindwith) <+>) <$> prettyVal v
docs <- mapM fmElem elems
let innerDoc = "{" <> flatAlt " " ""
<> concatWith (surround (separator <> " ")) docs
<> "}"
return $ align $ group innerDoc
atom -> return $ prettyPrec atom LowestPrec
-- === taking memory snapshots for serializing heap-backed dex values === | 2,670 | prettyVal val = case val of
-- Pretty-print tables.
Lam (LamExpr (LamBinder _ _ TabArrow _) _) -> do
atoms <- getTableElements val
elems <- forM atoms \atom -> do
case atom of
Con (Lit (Word8Lit c)) -> return $ showChar (toEnum @Char $ fromIntegral c) ""
Con (Lit (Word32Lit c)) -> return $ "0x" ++ showHex c ""
Con (Lit (Word64Lit c)) -> return $ "0x" ++ showHex c ""
_ -> pprintVal atom
TabTy b resultTy <- getType val
idxSetDoc <- return case binderType b of
Fin _ -> mempty -- (Fin n) is not shown
idxSet -> "@" <> pretty idxSet -- Otherwise, show explicit index set
elemsDoc <- return case resultTy of
-- Print table of characters as a string literal.
TC (BaseType (Scalar Word8Type)) -> pretty ('"': concat elems ++ "\"")
_ -> pretty elems
return $ elemsDoc <> idxSetDoc
DataCon name _ _ _ args -> do
mapM prettyVal args <&> \case
[] -> pretty name
args' -> parens $ pretty name <+> hsep args'
Con con -> case con of
ProdCon [] -> return $ pretty ()
ProdCon [x, y] -> do
xStr <- pprintVal x
yStr <- pprintVal y
return $ pretty (xStr, yStr)
ProdCon _ -> error "Unexpected product type: only binary products available in surface language."
SumAsProd ty (TagRepVal trep) payload -> do
let t = fromIntegral trep
case ty of
TypeCon _ dataDefName _ -> do
DataDef _ _ dataCons <- lookupDataDef dataDefName
DataConDef conName _ <- return $ dataCons !! t
mapM prettyVal (payload !! t) <&> \case
[] -> pretty conName
args -> parens $ pretty conName <+> hsep args
VariantTy (NoExt types) -> return $ pretty variant
where
[value] = payload !! t
(theLabel, repeatNum) = toList (reflectLabels types) !! t
variant = Variant (NoExt types) theLabel repeatNum value
_ -> error "SumAsProd with an unsupported type"
_ -> return $ pretty con
Record (LabeledItems row) -> do
let separator = line' <> ","
let bindwith = " ="
let elems = concatMap (\(k, vs) -> map (k,) (toList vs)) (M.toAscList row)
let fmElem = \(label, v) -> ((pretty label <> bindwith) <+>) <$> prettyVal v
docs <- mapM fmElem elems
let innerDoc = "{" <> flatAlt " " ""
<> concatWith (surround (separator <> " ")) docs
<> "}"
return $ align $ group innerDoc
atom -> return $ prettyPrec atom LowestPrec
-- === taking memory snapshots for serializing heap-backed dex values === | 2,592 | false | true | 5 | 21 | 787 | 960 | 461 | 499 | null | null |
green-haskell/ghc | compiler/cmm/CmmNode.hs | bsd-3-clause | mapExpM f (CmmCondBranch e ti fi) = (\x -> CmmCondBranch x ti fi) `fmap` f e | 78 | mapExpM f (CmmCondBranch e ti fi) = (\x -> CmmCondBranch x ti fi) `fmap` f e | 78 | mapExpM f (CmmCondBranch e ti fi) = (\x -> CmmCondBranch x ti fi) `fmap` f e | 78 | false | false | 0 | 8 | 17 | 47 | 23 | 24 | null | null |
shlevy/ghc | compiler/codeGen/StgCmmProf.hs | bsd-3-clause | -- | The profiling header words in a static closure
staticProfHdr :: DynFlags -> CostCentreStack -> [CmmLit]
staticProfHdr dflags ccs
= ifProfilingL dflags [mkCCostCentreStack ccs, staticLdvInit dflags] | 203 | staticProfHdr :: DynFlags -> CostCentreStack -> [CmmLit]
staticProfHdr dflags ccs
= ifProfilingL dflags [mkCCostCentreStack ccs, staticLdvInit dflags] | 151 | staticProfHdr dflags ccs
= ifProfilingL dflags [mkCCostCentreStack ccs, staticLdvInit dflags] | 94 | true | true | 0 | 7 | 27 | 50 | 24 | 26 | null | null |
akc/sym | tests/ListStat.hs | bsd-3-clause | asc0 w = sum [ 1 | (x,y) <- ascents w, y-x == 1 ] | 51 | asc0 w = sum [ 1 | (x,y) <- ascents w, y-x == 1 ] | 51 | asc0 w = sum [ 1 | (x,y) <- ascents w, y-x == 1 ] | 51 | false | false | 0 | 9 | 16 | 44 | 22 | 22 | null | null |
enolan/Idris-dev | src/Idris/REPL.hs | bsd-3-clause | process fn (Undefine names) = undefine names
where
undefine :: [Name] -> Idris ()
undefine [] = do
allDefined <- idris_repl_defs `fmap` get
undefine' allDefined []
-- Keep track of which names you've removed so you can
-- print them out to the user afterward
undefine names = undefine' names []
undefine' [] list = do iRenderResult $ printUndefinedNames list
return ()
undefine' (n:names) already = do
allDefined <- idris_repl_defs `fmap` get
if n `elem` allDefined
then do undefinedJustNow <- undefClosure n
undefine' names (undefinedJustNow ++ already)
else do tclift $ tfail $ Msg ("Can't undefine " ++ show n ++ " because it wasn't defined at the repl")
undefine' names already
undefOne n = do fputState (ctxt_lookup n . known_terms) Nothing
-- for now just assume it's an interface. Eventually we'll want some kind of
-- smart detection of exactly what kind of name we're undefining.
fputState (ctxt_lookup n . known_interfaces) Nothing
fmodifyState repl_definitions (delete n)
undefClosure n =
do replDefs <- idris_repl_defs `fmap` get
callGraph <- whoCalls n
let users = case lookup n callGraph of
Just ns -> nub ns
Nothing -> fail ("Tried to undefine nonexistent name" ++ show n)
undefinedJustNow <- concat `fmap` mapM undefClosure users
undefOne n
return (nub (n : undefinedJustNow)) | 1,612 | process fn (Undefine names) = undefine names
where
undefine :: [Name] -> Idris ()
undefine [] = do
allDefined <- idris_repl_defs `fmap` get
undefine' allDefined []
-- Keep track of which names you've removed so you can
-- print them out to the user afterward
undefine names = undefine' names []
undefine' [] list = do iRenderResult $ printUndefinedNames list
return ()
undefine' (n:names) already = do
allDefined <- idris_repl_defs `fmap` get
if n `elem` allDefined
then do undefinedJustNow <- undefClosure n
undefine' names (undefinedJustNow ++ already)
else do tclift $ tfail $ Msg ("Can't undefine " ++ show n ++ " because it wasn't defined at the repl")
undefine' names already
undefOne n = do fputState (ctxt_lookup n . known_terms) Nothing
-- for now just assume it's an interface. Eventually we'll want some kind of
-- smart detection of exactly what kind of name we're undefining.
fputState (ctxt_lookup n . known_interfaces) Nothing
fmodifyState repl_definitions (delete n)
undefClosure n =
do replDefs <- idris_repl_defs `fmap` get
callGraph <- whoCalls n
let users = case lookup n callGraph of
Just ns -> nub ns
Nothing -> fail ("Tried to undefine nonexistent name" ++ show n)
undefinedJustNow <- concat `fmap` mapM undefClosure users
undefOne n
return (nub (n : undefinedJustNow)) | 1,612 | process fn (Undefine names) = undefine names
where
undefine :: [Name] -> Idris ()
undefine [] = do
allDefined <- idris_repl_defs `fmap` get
undefine' allDefined []
-- Keep track of which names you've removed so you can
-- print them out to the user afterward
undefine names = undefine' names []
undefine' [] list = do iRenderResult $ printUndefinedNames list
return ()
undefine' (n:names) already = do
allDefined <- idris_repl_defs `fmap` get
if n `elem` allDefined
then do undefinedJustNow <- undefClosure n
undefine' names (undefinedJustNow ++ already)
else do tclift $ tfail $ Msg ("Can't undefine " ++ show n ++ " because it wasn't defined at the repl")
undefine' names already
undefOne n = do fputState (ctxt_lookup n . known_terms) Nothing
-- for now just assume it's an interface. Eventually we'll want some kind of
-- smart detection of exactly what kind of name we're undefining.
fputState (ctxt_lookup n . known_interfaces) Nothing
fmodifyState repl_definitions (delete n)
undefClosure n =
do replDefs <- idris_repl_defs `fmap` get
callGraph <- whoCalls n
let users = case lookup n callGraph of
Just ns -> nub ns
Nothing -> fail ("Tried to undefine nonexistent name" ++ show n)
undefinedJustNow <- concat `fmap` mapM undefClosure users
undefOne n
return (nub (n : undefinedJustNow)) | 1,612 | false | false | 7 | 17 | 527 | 410 | 195 | 215 | null | null |
bitemyapp/ghc | compiler/typecheck/TcGenGenerics.hs | bsd-3-clause | mkBindsMetaD :: FixityEnv -> TyCon
-> ( LHsBinds RdrName -- Datatype instance
, [LHsBinds RdrName] -- Constructor instances
, [[LHsBinds RdrName]]) -- Selector instances
mkBindsMetaD fix_env tycon = (dtBinds, allConBinds, allSelBinds)
where
mkBag l = foldr1 unionBags
[ unitBag (mkRdrFunBind (L loc name) matches)
| (name, matches) <- l ]
dtBinds = mkBag ( [ (datatypeName_RDR, dtName_matches)
, (moduleName_RDR, moduleName_matches)]
++ ifElseEmpty (isNewTyCon tycon)
[ (isNewtypeName_RDR, isNewtype_matches) ] )
allConBinds = map conBinds datacons
conBinds c = mkBag ( [ (conName_RDR, conName_matches c)]
++ ifElseEmpty (dataConIsInfix c)
[ (conFixity_RDR, conFixity_matches c) ]
++ ifElseEmpty (length (dataConFieldLabels c) > 0)
[ (conIsRecord_RDR, conIsRecord_matches c) ]
)
ifElseEmpty p x = if p then x else []
fixity c = case lookupFixity fix_env (dataConName c) of
Fixity n InfixL -> buildFix n leftAssocDataCon_RDR
Fixity n InfixR -> buildFix n rightAssocDataCon_RDR
Fixity n InfixN -> buildFix n notAssocDataCon_RDR
buildFix n assoc = nlHsApps infixDataCon_RDR [nlHsVar assoc
, nlHsIntLit (toInteger n)]
allSelBinds = map (map selBinds) datasels
selBinds s = mkBag [(selName_RDR, selName_matches s)]
loc = srcLocSpan (getSrcLoc tycon)
mkStringLHS s = [mkSimpleHsAlt nlWildPat (nlHsLit (mkHsString s))]
datacons = tyConDataCons tycon
datasels = map dataConFieldLabels datacons
tyConName_user = case tyConFamInst_maybe tycon of
Just (ptycon, _) -> tyConName ptycon
Nothing -> tyConName tycon
dtName_matches = mkStringLHS . occNameString . nameOccName
$ tyConName_user
moduleName_matches = mkStringLHS . moduleNameString . moduleName
. nameModule . tyConName $ tycon
isNewtype_matches = [mkSimpleHsAlt nlWildPat (nlHsVar true_RDR)]
conName_matches c = mkStringLHS . occNameString . nameOccName
. dataConName $ c
conFixity_matches c = [mkSimpleHsAlt nlWildPat (fixity c)]
conIsRecord_matches _ = [mkSimpleHsAlt nlWildPat (nlHsVar true_RDR)]
selName_matches s = mkStringLHS (occNameString (nameOccName s))
--------------------------------------------------------------------------------
-- Dealing with sums
-------------------------------------------------------------------------------- | 3,062 | mkBindsMetaD :: FixityEnv -> TyCon
-> ( LHsBinds RdrName -- Datatype instance
, [LHsBinds RdrName] -- Constructor instances
, [[LHsBinds RdrName]])
mkBindsMetaD fix_env tycon = (dtBinds, allConBinds, allSelBinds)
where
mkBag l = foldr1 unionBags
[ unitBag (mkRdrFunBind (L loc name) matches)
| (name, matches) <- l ]
dtBinds = mkBag ( [ (datatypeName_RDR, dtName_matches)
, (moduleName_RDR, moduleName_matches)]
++ ifElseEmpty (isNewTyCon tycon)
[ (isNewtypeName_RDR, isNewtype_matches) ] )
allConBinds = map conBinds datacons
conBinds c = mkBag ( [ (conName_RDR, conName_matches c)]
++ ifElseEmpty (dataConIsInfix c)
[ (conFixity_RDR, conFixity_matches c) ]
++ ifElseEmpty (length (dataConFieldLabels c) > 0)
[ (conIsRecord_RDR, conIsRecord_matches c) ]
)
ifElseEmpty p x = if p then x else []
fixity c = case lookupFixity fix_env (dataConName c) of
Fixity n InfixL -> buildFix n leftAssocDataCon_RDR
Fixity n InfixR -> buildFix n rightAssocDataCon_RDR
Fixity n InfixN -> buildFix n notAssocDataCon_RDR
buildFix n assoc = nlHsApps infixDataCon_RDR [nlHsVar assoc
, nlHsIntLit (toInteger n)]
allSelBinds = map (map selBinds) datasels
selBinds s = mkBag [(selName_RDR, selName_matches s)]
loc = srcLocSpan (getSrcLoc tycon)
mkStringLHS s = [mkSimpleHsAlt nlWildPat (nlHsLit (mkHsString s))]
datacons = tyConDataCons tycon
datasels = map dataConFieldLabels datacons
tyConName_user = case tyConFamInst_maybe tycon of
Just (ptycon, _) -> tyConName ptycon
Nothing -> tyConName tycon
dtName_matches = mkStringLHS . occNameString . nameOccName
$ tyConName_user
moduleName_matches = mkStringLHS . moduleNameString . moduleName
. nameModule . tyConName $ tycon
isNewtype_matches = [mkSimpleHsAlt nlWildPat (nlHsVar true_RDR)]
conName_matches c = mkStringLHS . occNameString . nameOccName
. dataConName $ c
conFixity_matches c = [mkSimpleHsAlt nlWildPat (fixity c)]
conIsRecord_matches _ = [mkSimpleHsAlt nlWildPat (nlHsVar true_RDR)]
selName_matches s = mkStringLHS (occNameString (nameOccName s))
--------------------------------------------------------------------------------
-- Dealing with sums
-------------------------------------------------------------------------------- | 3,040 | mkBindsMetaD fix_env tycon = (dtBinds, allConBinds, allSelBinds)
where
mkBag l = foldr1 unionBags
[ unitBag (mkRdrFunBind (L loc name) matches)
| (name, matches) <- l ]
dtBinds = mkBag ( [ (datatypeName_RDR, dtName_matches)
, (moduleName_RDR, moduleName_matches)]
++ ifElseEmpty (isNewTyCon tycon)
[ (isNewtypeName_RDR, isNewtype_matches) ] )
allConBinds = map conBinds datacons
conBinds c = mkBag ( [ (conName_RDR, conName_matches c)]
++ ifElseEmpty (dataConIsInfix c)
[ (conFixity_RDR, conFixity_matches c) ]
++ ifElseEmpty (length (dataConFieldLabels c) > 0)
[ (conIsRecord_RDR, conIsRecord_matches c) ]
)
ifElseEmpty p x = if p then x else []
fixity c = case lookupFixity fix_env (dataConName c) of
Fixity n InfixL -> buildFix n leftAssocDataCon_RDR
Fixity n InfixR -> buildFix n rightAssocDataCon_RDR
Fixity n InfixN -> buildFix n notAssocDataCon_RDR
buildFix n assoc = nlHsApps infixDataCon_RDR [nlHsVar assoc
, nlHsIntLit (toInteger n)]
allSelBinds = map (map selBinds) datasels
selBinds s = mkBag [(selName_RDR, selName_matches s)]
loc = srcLocSpan (getSrcLoc tycon)
mkStringLHS s = [mkSimpleHsAlt nlWildPat (nlHsLit (mkHsString s))]
datacons = tyConDataCons tycon
datasels = map dataConFieldLabels datacons
tyConName_user = case tyConFamInst_maybe tycon of
Just (ptycon, _) -> tyConName ptycon
Nothing -> tyConName tycon
dtName_matches = mkStringLHS . occNameString . nameOccName
$ tyConName_user
moduleName_matches = mkStringLHS . moduleNameString . moduleName
. nameModule . tyConName $ tycon
isNewtype_matches = [mkSimpleHsAlt nlWildPat (nlHsVar true_RDR)]
conName_matches c = mkStringLHS . occNameString . nameOccName
. dataConName $ c
conFixity_matches c = [mkSimpleHsAlt nlWildPat (fixity c)]
conIsRecord_matches _ = [mkSimpleHsAlt nlWildPat (nlHsVar true_RDR)]
selName_matches s = mkStringLHS (occNameString (nameOccName s))
--------------------------------------------------------------------------------
-- Dealing with sums
-------------------------------------------------------------------------------- | 2,839 | true | true | 19 | 25 | 1,143 | 680 | 349 | 331 | null | null |
GaloisInc/halvm-ghc | utils/deriveConstants/Main.hs | bsd-3-clause | structFieldH :: Where -> String -> String -> Wanteds
structFieldH w = structFieldHelper w w | 91 | structFieldH :: Where -> String -> String -> Wanteds
structFieldH w = structFieldHelper w w | 91 | structFieldH w = structFieldHelper w w | 38 | false | true | 0 | 7 | 14 | 31 | 15 | 16 | null | null |
DarrenMowat/blackbox | tests/results/ScopeTests.hs | unlicense | test8 :: String -> [Int] -> (Bool, Bool)
test8 s is = (t8inner1 is == length s, t8inner2 is == length s)
where
t8inner1 [] = 0
t8inner1 (s1:ss) = {- In Scope [ s :: String, is :: [Int], t8inner1 :: [t0] -> a0, length :: [a0] -> Int, t8inner2 :: [a0] -> Int, s1 :: Int, ss :: [t0], Return Type :: Int ] -}1 + t8inner1 ss
t8inner2 xs = length xs
{-
Test Purpose: Testing inline function where there is more than one inline
fucntion
Expected Scope [ s :: String, is :: [Int], xs :: [Int]]
Expected Return Type [ Return Type :: Int ]
-} | 587 | test8 :: String -> [Int] -> (Bool, Bool)
test8 s is = (t8inner1 is == length s, t8inner2 is == length s)
where
t8inner1 [] = 0
t8inner1 (s1:ss) = {- In Scope [ s :: String, is :: [Int], t8inner1 :: [t0] -> a0, length :: [a0] -> Int, t8inner2 :: [a0] -> Int, s1 :: Int, ss :: [t0], Return Type :: Int ] -}1 + t8inner1 ss
t8inner2 xs = length xs
{-
Test Purpose: Testing inline function where there is more than one inline
fucntion
Expected Scope [ s :: String, is :: [Int], xs :: [Int]]
Expected Return Type [ Return Type :: Int ]
-} | 587 | test8 s is = (t8inner1 is == length s, t8inner2 is == length s)
where
t8inner1 [] = 0
t8inner1 (s1:ss) = {- In Scope [ s :: String, is :: [Int], t8inner1 :: [t0] -> a0, length :: [a0] -> Int, t8inner2 :: [a0] -> Int, s1 :: Int, ss :: [t0], Return Type :: Int ] -}1 + t8inner1 ss
t8inner2 xs = length xs
{-
Test Purpose: Testing inline function where there is more than one inline
fucntion
Expected Scope [ s :: String, is :: [Int], xs :: [Int]]
Expected Return Type [ Return Type :: Int ]
-} | 546 | false | true | 0 | 9 | 165 | 106 | 54 | 52 | null | null |
rzetterberg/x11-xinput | Graphics/X11/XInput/Functions.hs | bsd-3-clause | xinputMinor = 0 | 15 | xinputMinor = 0 | 15 | xinputMinor = 0 | 15 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
keera-studios/hsQt | Qtc/ClassTypes/Gui.hs | bsd-2-clause | qCast_QListWidget :: Object a -> IO (QListWidget ())
qCast_QListWidget _qobj
= return (objectCast _qobj) | 106 | qCast_QListWidget :: Object a -> IO (QListWidget ())
qCast_QListWidget _qobj
= return (objectCast _qobj) | 106 | qCast_QListWidget _qobj
= return (objectCast _qobj) | 53 | false | true | 0 | 9 | 15 | 41 | 19 | 22 | null | null |
qnikst/distributed-process-extras | src/Control/Distributed/Process/Extras/SystemLog.hs | bsd-3-clause | addFormatter :: (Routable r)
=> r
-> Closure (Message -> Process (Maybe String))
-> Process ()
addFormatter r clj = sendTo r $ AddFormatter clj | 182 | addFormatter :: (Routable r)
=> r
-> Closure (Message -> Process (Maybe String))
-> Process ()
addFormatter r clj = sendTo r $ AddFormatter clj | 182 | addFormatter r clj = sendTo r $ AddFormatter clj | 48 | false | true | 0 | 13 | 63 | 67 | 32 | 35 | null | null |
unisonweb/platform | codebase2/codebase-sqlite/U/Codebase/Sqlite/Serialization.hs | mit | putTermEdit :: MonadPut m => TermEdit.LocalTermEdit -> m ()
putTermEdit TermEdit.Deprecate = putWord8 0 | 103 | putTermEdit :: MonadPut m => TermEdit.LocalTermEdit -> m ()
putTermEdit TermEdit.Deprecate = putWord8 0 | 103 | putTermEdit TermEdit.Deprecate = putWord8 0 | 43 | false | true | 0 | 8 | 13 | 37 | 17 | 20 | null | null |
alphalambda/k12math | contrib/MHills/GeometryLessons/code/teacher/key_lesson7b.hs | mit | myPicture points =
drawPoints [a,b,c,d] &
drawLabels [a,b,c,d] ["A","B","C","D"] &
drawSegment (a,b) &
drawSegment (b,c) &
drawSegment (c,a) &
drawSegment (a,d) &
drawSegment (b,d)
where [a,b] = take 2 points
[c,d] = circle_circle (a,b) (b,a) | 284 | myPicture points =
drawPoints [a,b,c,d] &
drawLabels [a,b,c,d] ["A","B","C","D"] &
drawSegment (a,b) &
drawSegment (b,c) &
drawSegment (c,a) &
drawSegment (a,d) &
drawSegment (b,d)
where [a,b] = take 2 points
[c,d] = circle_circle (a,b) (b,a) | 284 | myPicture points =
drawPoints [a,b,c,d] &
drawLabels [a,b,c,d] ["A","B","C","D"] &
drawSegment (a,b) &
drawSegment (b,c) &
drawSegment (c,a) &
drawSegment (a,d) &
drawSegment (b,d)
where [a,b] = take 2 points
[c,d] = circle_circle (a,b) (b,a) | 284 | false | false | 0 | 11 | 76 | 172 | 95 | 77 | null | null |
lukexi/ghc-7.8-arm64 | compiler/utils/Encoding.hs | bsd-3-clause | decode_lower 'p' = '+' | 22 | decode_lower 'p' = '+' | 22 | decode_lower 'p' = '+' | 22 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
facebookincubator/duckling | Duckling/Time/RO/Rules.hs | bsd-3-clause | ruleDayofmonthNonOrdinalNamedmonth :: Rule
ruleDayofmonthNonOrdinalNamedmonth = Rule
{ name = "<day-of-month> (non ordinal) <named-month>"
, pattern =
[ Predicate isDOMInteger
, Predicate isAMonth
]
, prod = \tokens -> case tokens of
(token:Token Time td:_) -> Token Time <$> intersectDOM td token
_ -> Nothing
} | 344 | ruleDayofmonthNonOrdinalNamedmonth :: Rule
ruleDayofmonthNonOrdinalNamedmonth = Rule
{ name = "<day-of-month> (non ordinal) <named-month>"
, pattern =
[ Predicate isDOMInteger
, Predicate isAMonth
]
, prod = \tokens -> case tokens of
(token:Token Time td:_) -> Token Time <$> intersectDOM td token
_ -> Nothing
} | 344 | ruleDayofmonthNonOrdinalNamedmonth = Rule
{ name = "<day-of-month> (non ordinal) <named-month>"
, pattern =
[ Predicate isDOMInteger
, Predicate isAMonth
]
, prod = \tokens -> case tokens of
(token:Token Time td:_) -> Token Time <$> intersectDOM td token
_ -> Nothing
} | 301 | false | true | 0 | 15 | 76 | 96 | 50 | 46 | null | null |
flipstone/kioku | src/Database/Kioku/Internal/TrieIndex.hs | mit | breakCommonPrefixMultiKey :: MultiKey
-> BS.ByteString
-> (BS.ByteString, MultiKey, BS.ByteString)
breakCommonPrefixMultiKey (MultiKey prefix kids isEnd) arc =
case breakCommonPrefix prefix arc of
-- The entire MultiKey prefix was a prefix of the arc, AND there was some
-- arc remaining, so we need descend to kids of the MultiKey and continue
-- breaking
-- Is there a better way to scan through the children multikeys than dropWhile?
-- By nature of the MultiKey data structure, only one child can possibly match
(common, "", remArc) | not (BS.null remArc) ->
let commonIsEmpty ("", _, _) = True
commonIsEmpty _ = False
in case dropWhile commonIsEmpty $ map (\k -> breakCommonPrefixMultiKey k remArc) kids of
((common', key, remArc'):_) -> (common <> common', key, remArc')
_ -> (common, MultiKey "" [] False, remArc)
-- If there is any remaining prefix from the original MultiKey *OR* there
-- was any remaining arc that didn't match with the original Prefix, then
-- we definitely don't need to descend into the kids. We can just return
-- a new MultiKey with the remaining prefix
(common, remPrefix, remArc) ->
(common, MultiKey remPrefix kids isEnd, remArc) | 1,351 | breakCommonPrefixMultiKey :: MultiKey
-> BS.ByteString
-> (BS.ByteString, MultiKey, BS.ByteString)
breakCommonPrefixMultiKey (MultiKey prefix kids isEnd) arc =
case breakCommonPrefix prefix arc of
-- The entire MultiKey prefix was a prefix of the arc, AND there was some
-- arc remaining, so we need descend to kids of the MultiKey and continue
-- breaking
-- Is there a better way to scan through the children multikeys than dropWhile?
-- By nature of the MultiKey data structure, only one child can possibly match
(common, "", remArc) | not (BS.null remArc) ->
let commonIsEmpty ("", _, _) = True
commonIsEmpty _ = False
in case dropWhile commonIsEmpty $ map (\k -> breakCommonPrefixMultiKey k remArc) kids of
((common', key, remArc'):_) -> (common <> common', key, remArc')
_ -> (common, MultiKey "" [] False, remArc)
-- If there is any remaining prefix from the original MultiKey *OR* there
-- was any remaining arc that didn't match with the original Prefix, then
-- we definitely don't need to descend into the kids. We can just return
-- a new MultiKey with the remaining prefix
(common, remPrefix, remArc) ->
(common, MultiKey remPrefix kids isEnd, remArc) | 1,351 | breakCommonPrefixMultiKey (MultiKey prefix kids isEnd) arc =
case breakCommonPrefix prefix arc of
-- The entire MultiKey prefix was a prefix of the arc, AND there was some
-- arc remaining, so we need descend to kids of the MultiKey and continue
-- breaking
-- Is there a better way to scan through the children multikeys than dropWhile?
-- By nature of the MultiKey data structure, only one child can possibly match
(common, "", remArc) | not (BS.null remArc) ->
let commonIsEmpty ("", _, _) = True
commonIsEmpty _ = False
in case dropWhile commonIsEmpty $ map (\k -> breakCommonPrefixMultiKey k remArc) kids of
((common', key, remArc'):_) -> (common <> common', key, remArc')
_ -> (common, MultiKey "" [] False, remArc)
-- If there is any remaining prefix from the original MultiKey *OR* there
-- was any remaining arc that didn't match with the original Prefix, then
-- we definitely don't need to descend into the kids. We can just return
-- a new MultiKey with the remaining prefix
(common, remPrefix, remArc) ->
(common, MultiKey remPrefix kids isEnd, remArc) | 1,200 | false | true | 0 | 16 | 373 | 249 | 137 | 112 | null | null |
urbanslug/ghc | compiler/basicTypes/DataCon.hs | bsd-3-clause | promoteKind :: Kind -> SuperKind
-- Promote the kind of a type constructor
-- from (* -> * -> *) to (BOX -> BOX -> BOX)
promoteKind (TyConApp tc [])
| tc `hasKey` liftedTypeKindTyConKey = superKind | 199 | promoteKind :: Kind -> SuperKind
promoteKind (TyConApp tc [])
| tc `hasKey` liftedTypeKindTyConKey = superKind | 112 | promoteKind (TyConApp tc [])
| tc `hasKey` liftedTypeKindTyConKey = superKind | 79 | true | true | 0 | 10 | 37 | 48 | 23 | 25 | null | null |
ganeti/ganeti | src/Ganeti/THH/Types.hs | bsd-2-clause | uncurryVar :: Name -> Q Exp
uncurryVar name = do
t <- typeOfFun name
appE (uncurryVarType t) (varE name)
-- | Generic 'curry' that constructs a curring function of a given arity. | 183 | uncurryVar :: Name -> Q Exp
uncurryVar name = do
t <- typeOfFun name
appE (uncurryVarType t) (varE name)
-- | Generic 'curry' that constructs a curring function of a given arity. | 183 | uncurryVar name = do
t <- typeOfFun name
appE (uncurryVarType t) (varE name)
-- | Generic 'curry' that constructs a curring function of a given arity. | 155 | false | true | 0 | 9 | 36 | 52 | 24 | 28 | null | null |
rleshchinskiy/vector | Data/Vector/Fusion/Stream/Monadic.hs | bsd-3-clause | scanlM' f z s = z `seq` (z `cons` postscanlM f z s) | 51 | scanlM' f z s = z `seq` (z `cons` postscanlM f z s) | 51 | scanlM' f z s = z `seq` (z `cons` postscanlM f z s) | 51 | false | false | 1 | 9 | 12 | 41 | 19 | 22 | null | null |
FranklinChen/hugs98-plus-Sep2006 | packages/network/Network/URI.hs | bsd-3-clause | hierPart :: URIParser ((Maybe URIAuth),String)
hierPart =
do { try (string "//")
; ua <- uauthority
; up <- pathAbEmpty
; return (ua,up)
}
<|> do { up <- pathAbs
; return (Nothing,up)
}
<|> do { up <- pathRootLess
; return (Nothing,up)
}
<|> do { return (Nothing,"")
} | 400 | hierPart :: URIParser ((Maybe URIAuth),String)
hierPart =
do { try (string "//")
; ua <- uauthority
; up <- pathAbEmpty
; return (ua,up)
}
<|> do { up <- pathAbs
; return (Nothing,up)
}
<|> do { up <- pathRootLess
; return (Nothing,up)
}
<|> do { return (Nothing,"")
} | 400 | hierPart =
do { try (string "//")
; ua <- uauthority
; up <- pathAbEmpty
; return (ua,up)
}
<|> do { up <- pathAbs
; return (Nothing,up)
}
<|> do { up <- pathRootLess
; return (Nothing,up)
}
<|> do { return (Nothing,"")
} | 353 | false | true | 9 | 9 | 181 | 149 | 80 | 69 | null | null |
mdunsmuir/routequery-service | src/Com/Google/Transit/Realtime/TripUpdate/StopTimeUpdate/ScheduleRelationship.hs | gpl-3.0 | toMaybe'Enum 1 = Prelude'.Just SKIPPED | 38 | toMaybe'Enum 1 = Prelude'.Just SKIPPED | 38 | toMaybe'Enum 1 = Prelude'.Just SKIPPED | 38 | false | false | 1 | 6 | 4 | 17 | 6 | 11 | null | null |
silkapp/tagsoup | TagSoup/Test.hs | bsd-3-clause | warnTests :: Test ()
warnTests = do
let p = parseTagsOptions parseOptions{optTagPosition=True,optTagWarning=True}
wt x = [(msg,c) | TagWarning msg:TagPosition _ c:_ <- tails $ p x]
wt "neil &foo bar" === [("Unknown entity: foo",10)] | 248 | warnTests :: Test ()
warnTests = do
let p = parseTagsOptions parseOptions{optTagPosition=True,optTagWarning=True}
wt x = [(msg,c) | TagWarning msg:TagPosition _ c:_ <- tails $ p x]
wt "neil &foo bar" === [("Unknown entity: foo",10)] | 248 | warnTests = do
let p = parseTagsOptions parseOptions{optTagPosition=True,optTagWarning=True}
wt x = [(msg,c) | TagWarning msg:TagPosition _ c:_ <- tails $ p x]
wt "neil &foo bar" === [("Unknown entity: foo",10)] | 227 | false | true | 0 | 15 | 49 | 115 | 57 | 58 | null | null |
JenniferWang/incremental-haskell | src/Node.hs | mit | isStaleP :: (Eq a) => NodeRef a -> StateIO Bool
isStaleP ref = do
node <- readNodeRef ref
stbnum <- getStbNum
let rcp = node^.value.recomputedAt
if (stbnum == rcp)
then return False
else case node^.kind of
ArrayFold _ _ _ -> isStaleWithRespectToAChild node
Uninitialized -> error "[Node.isStale] The node is uninitialized"
Invalid -> return False
Variable _ _ set_at -> return $ set_at > rcp
-- A const node is stale only at initialization.
Const _ -> return $ Stb.isNone rcp
Map _ _ -> isStaleWithRespectToAChild node
Map2 _ _ _ -> isStaleWithRespectToAChild node
Map3 _ _ _ _ -> isStaleWithRespectToAChild node
Map4 _ _ _ _ _ -> isStaleWithRespectToAChild node
Bind _ _ _ _ -> isStaleWithRespectToAChild node
_ -> return $ Stb.isNone rcp | 993 | isStaleP :: (Eq a) => NodeRef a -> StateIO Bool
isStaleP ref = do
node <- readNodeRef ref
stbnum <- getStbNum
let rcp = node^.value.recomputedAt
if (stbnum == rcp)
then return False
else case node^.kind of
ArrayFold _ _ _ -> isStaleWithRespectToAChild node
Uninitialized -> error "[Node.isStale] The node is uninitialized"
Invalid -> return False
Variable _ _ set_at -> return $ set_at > rcp
-- A const node is stale only at initialization.
Const _ -> return $ Stb.isNone rcp
Map _ _ -> isStaleWithRespectToAChild node
Map2 _ _ _ -> isStaleWithRespectToAChild node
Map3 _ _ _ _ -> isStaleWithRespectToAChild node
Map4 _ _ _ _ _ -> isStaleWithRespectToAChild node
Bind _ _ _ _ -> isStaleWithRespectToAChild node
_ -> return $ Stb.isNone rcp | 993 | isStaleP ref = do
node <- readNodeRef ref
stbnum <- getStbNum
let rcp = node^.value.recomputedAt
if (stbnum == rcp)
then return False
else case node^.kind of
ArrayFold _ _ _ -> isStaleWithRespectToAChild node
Uninitialized -> error "[Node.isStale] The node is uninitialized"
Invalid -> return False
Variable _ _ set_at -> return $ set_at > rcp
-- A const node is stale only at initialization.
Const _ -> return $ Stb.isNone rcp
Map _ _ -> isStaleWithRespectToAChild node
Map2 _ _ _ -> isStaleWithRespectToAChild node
Map3 _ _ _ _ -> isStaleWithRespectToAChild node
Map4 _ _ _ _ _ -> isStaleWithRespectToAChild node
Bind _ _ _ _ -> isStaleWithRespectToAChild node
_ -> return $ Stb.isNone rcp | 945 | false | true | 0 | 13 | 378 | 269 | 124 | 145 | null | null |
sdiehl/ghc | testsuite/tests/profiling/should_run/T3001-2.hs | bsd-3-clause | mptyBuilder :: Builder
emptyBuilder = Builder id
| 49 | emptyBuilder :: Builder
emptyBuilder = Builder id | 49 | emptyBuilder = Builder id | 25 | false | true | 0 | 5 | 7 | 14 | 7 | 7 | null | null |
beijaflor-io/haskell-language-dockerfile | src/Language/Dockerfile/EDSL.hs | gpl-3.0 | runD (RunArgs as n) = runDef Syntax.Run as n | 44 | runD (RunArgs as n) = runDef Syntax.Run as n | 44 | runD (RunArgs as n) = runDef Syntax.Run as n | 44 | false | false | 0 | 6 | 8 | 27 | 12 | 15 | null | null |
kojiromike/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | getImps (PImp _ _ _ n tm : xs) = (n, tm) : getImps xs | 54 | getImps (PImp _ _ _ n tm : xs) = (n, tm) : getImps xs | 54 | getImps (PImp _ _ _ n tm : xs) = (n, tm) : getImps xs | 54 | false | false | 0 | 7 | 15 | 41 | 20 | 21 | null | null |
Helkafen/cabal | Cabal/Distribution/Simple/Command.hs | bsd-3-clause | commandsRun :: CommandUI a
-> [Command action]
-> [String]
-> CommandParse (a, CommandParse action)
commandsRun globalCommand commands args =
case commandParseArgs globalCommand True args of
CommandHelp help -> CommandHelp help
CommandList opts -> CommandList (opts ++ commandNames)
CommandErrors errs -> CommandErrors errs
CommandReadyToGo (mkflags, args') -> case args' of
("help":cmdArgs) -> handleHelpCommand cmdArgs
(name:cmdArgs) -> case lookupCommand name of
[Command _ _ action _]
-> CommandReadyToGo (flags, action cmdArgs)
_ -> CommandReadyToGo (flags, badCommand name)
[] -> CommandReadyToGo (flags, noCommand)
where flags = mkflags (commandDefaultFlags globalCommand)
where
lookupCommand cname = [ cmd | cmd@(Command cname' _ _ _) <- commands'
, cname' == cname ]
noCommand = CommandErrors ["no command given (try --help)\n"]
badCommand cname = CommandErrors ["unrecognised command: " ++ cname
++ " (try --help)\n"]
commands' = commands ++ [commandAddAction helpCommandUI undefined]
commandNames = [ name | (Command name _ _ NormalCommand) <- commands' ]
-- A bit of a hack: support "prog help" as a synonym of "prog --help"
-- furthermore, support "prog help command" as "prog command --help"
handleHelpCommand cmdArgs =
case commandParseArgs helpCommandUI True cmdArgs of
CommandHelp help -> CommandHelp help
CommandList list -> CommandList (list ++ commandNames)
CommandErrors _ -> CommandHelp globalHelp
CommandReadyToGo (_,[]) -> CommandHelp globalHelp
CommandReadyToGo (_,(name:cmdArgs')) ->
case lookupCommand name of
[Command _ _ action _] ->
case action ("--help":cmdArgs') of
CommandHelp help -> CommandHelp help
CommandList _ -> CommandList []
_ -> CommandHelp globalHelp
_ -> badCommand name
where globalHelp = commandHelp globalCommand
-- | Utility function, many commands do not accept additional flags. This
-- action fails with a helpful error message if the user supplies any extra.
-- | 2,401 | commandsRun :: CommandUI a
-> [Command action]
-> [String]
-> CommandParse (a, CommandParse action)
commandsRun globalCommand commands args =
case commandParseArgs globalCommand True args of
CommandHelp help -> CommandHelp help
CommandList opts -> CommandList (opts ++ commandNames)
CommandErrors errs -> CommandErrors errs
CommandReadyToGo (mkflags, args') -> case args' of
("help":cmdArgs) -> handleHelpCommand cmdArgs
(name:cmdArgs) -> case lookupCommand name of
[Command _ _ action _]
-> CommandReadyToGo (flags, action cmdArgs)
_ -> CommandReadyToGo (flags, badCommand name)
[] -> CommandReadyToGo (flags, noCommand)
where flags = mkflags (commandDefaultFlags globalCommand)
where
lookupCommand cname = [ cmd | cmd@(Command cname' _ _ _) <- commands'
, cname' == cname ]
noCommand = CommandErrors ["no command given (try --help)\n"]
badCommand cname = CommandErrors ["unrecognised command: " ++ cname
++ " (try --help)\n"]
commands' = commands ++ [commandAddAction helpCommandUI undefined]
commandNames = [ name | (Command name _ _ NormalCommand) <- commands' ]
-- A bit of a hack: support "prog help" as a synonym of "prog --help"
-- furthermore, support "prog help command" as "prog command --help"
handleHelpCommand cmdArgs =
case commandParseArgs helpCommandUI True cmdArgs of
CommandHelp help -> CommandHelp help
CommandList list -> CommandList (list ++ commandNames)
CommandErrors _ -> CommandHelp globalHelp
CommandReadyToGo (_,[]) -> CommandHelp globalHelp
CommandReadyToGo (_,(name:cmdArgs')) ->
case lookupCommand name of
[Command _ _ action _] ->
case action ("--help":cmdArgs') of
CommandHelp help -> CommandHelp help
CommandList _ -> CommandList []
_ -> CommandHelp globalHelp
_ -> badCommand name
where globalHelp = commandHelp globalCommand
-- | Utility function, many commands do not accept additional flags. This
-- action fails with a helpful error message if the user supplies any extra.
-- | 2,401 | commandsRun globalCommand commands args =
case commandParseArgs globalCommand True args of
CommandHelp help -> CommandHelp help
CommandList opts -> CommandList (opts ++ commandNames)
CommandErrors errs -> CommandErrors errs
CommandReadyToGo (mkflags, args') -> case args' of
("help":cmdArgs) -> handleHelpCommand cmdArgs
(name:cmdArgs) -> case lookupCommand name of
[Command _ _ action _]
-> CommandReadyToGo (flags, action cmdArgs)
_ -> CommandReadyToGo (flags, badCommand name)
[] -> CommandReadyToGo (flags, noCommand)
where flags = mkflags (commandDefaultFlags globalCommand)
where
lookupCommand cname = [ cmd | cmd@(Command cname' _ _ _) <- commands'
, cname' == cname ]
noCommand = CommandErrors ["no command given (try --help)\n"]
badCommand cname = CommandErrors ["unrecognised command: " ++ cname
++ " (try --help)\n"]
commands' = commands ++ [commandAddAction helpCommandUI undefined]
commandNames = [ name | (Command name _ _ NormalCommand) <- commands' ]
-- A bit of a hack: support "prog help" as a synonym of "prog --help"
-- furthermore, support "prog help command" as "prog command --help"
handleHelpCommand cmdArgs =
case commandParseArgs helpCommandUI True cmdArgs of
CommandHelp help -> CommandHelp help
CommandList list -> CommandList (list ++ commandNames)
CommandErrors _ -> CommandHelp globalHelp
CommandReadyToGo (_,[]) -> CommandHelp globalHelp
CommandReadyToGo (_,(name:cmdArgs')) ->
case lookupCommand name of
[Command _ _ action _] ->
case action ("--help":cmdArgs') of
CommandHelp help -> CommandHelp help
CommandList _ -> CommandList []
_ -> CommandHelp globalHelp
_ -> badCommand name
where globalHelp = commandHelp globalCommand
-- | Utility function, many commands do not accept additional flags. This
-- action fails with a helpful error message if the user supplies any extra.
-- | 2,265 | false | true | 11 | 15 | 755 | 562 | 283 | 279 | null | null |
yiannist/ganeti | src/Ganeti/UDSServer.hs | bsd-2-clause | -- | Creates a Unix socket and binds it to the specified @path@.
openServerSocket :: FilePath -> IO S.Socket
openServerSocket path = do
sock <- S.socket S.AF_UNIX S.Stream S.defaultProtocol
S.bindSocket sock (S.SockAddrUnix path)
return sock | 247 | openServerSocket :: FilePath -> IO S.Socket
openServerSocket path = do
sock <- S.socket S.AF_UNIX S.Stream S.defaultProtocol
S.bindSocket sock (S.SockAddrUnix path)
return sock | 182 | openServerSocket path = do
sock <- S.socket S.AF_UNIX S.Stream S.defaultProtocol
S.bindSocket sock (S.SockAddrUnix path)
return sock | 138 | true | true | 0 | 10 | 40 | 70 | 32 | 38 | null | null |
ayachigin/DeepLearningFromScratch | src/Util.hs | bsd-3-clause | (=~) :: (Ord a, Fractional a) => a -> a -> Int -> Bool
a =~ b = f
where f x = a <= (b + (0.1^(x))) &&
a >= (b - (0.1^(x))) | 138 | (=~) :: (Ord a, Fractional a) => a -> a -> Int -> Bool
a =~ b = f
where f x = a <= (b + (0.1^(x))) &&
a >= (b - (0.1^(x))) | 138 | a =~ b = f
where f x = a <= (b + (0.1^(x))) &&
a >= (b - (0.1^(x))) | 83 | false | true | 5 | 11 | 49 | 115 | 58 | 57 | null | null |
Jonplussed/purescript-webgl-raw | generator/IDL/Cleaner.hs | gpl-2.0 | -- private functions
partition :: Decl -> IDL -> IDL
partition e@Enum{} idl = idl
{ enums = Map.insert (enumName e) e (enums idl)
} | 140 | partition :: Decl -> IDL -> IDL
partition e@Enum{} idl = idl
{ enums = Map.insert (enumName e) e (enums idl)
} | 118 | partition e@Enum{} idl = idl
{ enums = Map.insert (enumName e) e (enums idl)
} | 86 | true | true | 6 | 7 | 33 | 61 | 32 | 29 | null | null |
ethanpailes/bbc | src/Parse.hs | bsd-3-clause | sc :: Parser ()
sc = L.space (void spaceNoNewline) lineComment blockComment
where lineComment = L.skipLineComment "//"
blockComment = L.skipBlockComment "/*" "*/"
spaceNoNewline = satisfy $ liftM2 (&&) (/= '\n') isSpace | 243 | sc :: Parser ()
sc = L.space (void spaceNoNewline) lineComment blockComment
where lineComment = L.skipLineComment "//"
blockComment = L.skipBlockComment "/*" "*/"
spaceNoNewline = satisfy $ liftM2 (&&) (/= '\n') isSpace | 243 | sc = L.space (void spaceNoNewline) lineComment blockComment
where lineComment = L.skipLineComment "//"
blockComment = L.skipBlockComment "/*" "*/"
spaceNoNewline = satisfy $ liftM2 (&&) (/= '\n') isSpace | 227 | false | true | 3 | 7 | 53 | 82 | 40 | 42 | null | null |
headprogrammingczar/cabal | cabal-install/Distribution/Client/InstallPlan.hs | bsd-3-clause | showPlanPackageTag (Configured _) = "Configured" | 51 | showPlanPackageTag (Configured _) = "Configured" | 51 | showPlanPackageTag (Configured _) = "Configured" | 51 | false | false | 0 | 7 | 7 | 15 | 7 | 8 | null | null |
viloocity/CMQ | dist/build/autogen/Paths_cmq_haskell.hs | mit | libdir = "/root/.cabal/lib/cmq-haskell-0.0.1/ghc-7.0.3" | 59 | libdir = "/root/.cabal/lib/cmq-haskell-0.0.1/ghc-7.0.3" | 59 | libdir = "/root/.cabal/lib/cmq-haskell-0.0.1/ghc-7.0.3" | 59 | false | false | 0 | 4 | 6 | 6 | 3 | 3 | null | null |
pgj/bead | src/Bead/View/ContentHandler.hs | bsd-3-clause | getParameter :: Parameter a -> ContentHandler' b a
getParameter param = do
reqParam <- getParam . B.pack . name $ param
maybe
(throwError . strMsg $ notFound param) -- TODO: I18N
(decodeParamValue param)
reqParam
-- Calculates a list of values named and decoded by the given parameter
-- If the parameter is not found throws an error, if one of the parameter
-- values are not decodable throws an error otherwise
-- returns a list of the decoded values | 469 | getParameter :: Parameter a -> ContentHandler' b a
getParameter param = do
reqParam <- getParam . B.pack . name $ param
maybe
(throwError . strMsg $ notFound param) -- TODO: I18N
(decodeParamValue param)
reqParam
-- Calculates a list of values named and decoded by the given parameter
-- If the parameter is not found throws an error, if one of the parameter
-- values are not decodable throws an error otherwise
-- returns a list of the decoded values | 469 | getParameter param = do
reqParam <- getParam . B.pack . name $ param
maybe
(throwError . strMsg $ notFound param) -- TODO: I18N
(decodeParamValue param)
reqParam
-- Calculates a list of values named and decoded by the given parameter
-- If the parameter is not found throws an error, if one of the parameter
-- values are not decodable throws an error otherwise
-- returns a list of the decoded values | 418 | false | true | 0 | 11 | 95 | 82 | 41 | 41 | null | null |
chengzh2008/hpffp | src/ch07-FunctionPattern/wherePenguinsLive.hs | bsd-3-clause | antarcticPenguin :: Penguin -> Bool
antarcticPenguin (Peng Antarctica) = True | 77 | antarcticPenguin :: Penguin -> Bool
antarcticPenguin (Peng Antarctica) = True | 77 | antarcticPenguin (Peng Antarctica) = True | 41 | false | true | 0 | 7 | 9 | 24 | 12 | 12 | null | null |
keithodulaigh/Hets | CASL/Sign.hs | gpl-2.0 | getSyntaxTable :: Sign f e -> (PrecMap, AssocMap)
getSyntaxTable sig = let gannos = globAnnos sig
in (mkPrecIntMap $ prec_annos gannos, assoc_annos gannos) | 176 | getSyntaxTable :: Sign f e -> (PrecMap, AssocMap)
getSyntaxTable sig = let gannos = globAnnos sig
in (mkPrecIntMap $ prec_annos gannos, assoc_annos gannos) | 176 | getSyntaxTable sig = let gannos = globAnnos sig
in (mkPrecIntMap $ prec_annos gannos, assoc_annos gannos) | 126 | false | true | 0 | 9 | 43 | 59 | 29 | 30 | null | null |
tonicebrian/TAPL | src/TAPL/Core.hs | gpl-3.0 | eval (TmFalse _) = False | 24 | eval (TmFalse _) = False | 24 | eval (TmFalse _) = False | 24 | false | false | 0 | 6 | 4 | 16 | 7 | 9 | null | null |
poxu/pandoc | src/Text/Pandoc/Writers/LaTeX.hs | gpl-2.0 | isListBlock _ = False | 38 | isListBlock _ = False | 38 | isListBlock _ = False | 38 | false | false | 0 | 5 | 20 | 9 | 4 | 5 | null | null |
narrative/stack | src/Stack/Setup.hs | bsd-3-clause | installDockerStackExe
:: (MonadIO m, MonadMask m, MonadLogger m, MonadReader env m, HasConfig env, HasHttpManager env, MonadBaseControl IO m)
=> SetupInfo
-> Path Abs File
-> ArchiveType
-> Path Abs Dir
-> m ()
installDockerStackExe _ archiveFile _ destDir = do
(_,tarTool) <-
checkDependencies $
(,) <$> checkDependency "gzip" <*> checkDependency "tar"
menv <- getMinimalEnvOverride
ensureDir destDir
readInNull
destDir
tarTool
menv
["xf", toFilePath archiveFile, "--strip-components", "1"]
Nothing | 595 | installDockerStackExe
:: (MonadIO m, MonadMask m, MonadLogger m, MonadReader env m, HasConfig env, HasHttpManager env, MonadBaseControl IO m)
=> SetupInfo
-> Path Abs File
-> ArchiveType
-> Path Abs Dir
-> m ()
installDockerStackExe _ archiveFile _ destDir = do
(_,tarTool) <-
checkDependencies $
(,) <$> checkDependency "gzip" <*> checkDependency "tar"
menv <- getMinimalEnvOverride
ensureDir destDir
readInNull
destDir
tarTool
menv
["xf", toFilePath archiveFile, "--strip-components", "1"]
Nothing | 595 | installDockerStackExe _ archiveFile _ destDir = do
(_,tarTool) <-
checkDependencies $
(,) <$> checkDependency "gzip" <*> checkDependency "tar"
menv <- getMinimalEnvOverride
ensureDir destDir
readInNull
destDir
tarTool
menv
["xf", toFilePath archiveFile, "--strip-components", "1"]
Nothing | 360 | false | true | 0 | 12 | 161 | 181 | 87 | 94 | null | null |
revnull/crashboard | src/App.hs | gpl-2.0 | tableExists :: S.Connection -> String -> IO Bool
tableExists conn nam = do
r <- S.query conn
"SELECT name FROM sqlite_master WHERE type='table' AND name=?"
(Only nam)
case (r :: [Only String]) of
[Only _] -> return True
_ -> return False | 277 | tableExists :: S.Connection -> String -> IO Bool
tableExists conn nam = do
r <- S.query conn
"SELECT name FROM sqlite_master WHERE type='table' AND name=?"
(Only nam)
case (r :: [Only String]) of
[Only _] -> return True
_ -> return False | 277 | tableExists conn nam = do
r <- S.query conn
"SELECT name FROM sqlite_master WHERE type='table' AND name=?"
(Only nam)
case (r :: [Only String]) of
[Only _] -> return True
_ -> return False | 228 | false | true | 0 | 12 | 81 | 99 | 46 | 53 | null | null |
DNNX/hyphenation | src/Text/Hyphenation/Exception.hs | bsd-3-clause | scoreException (x:ys)
| x == '-' = 1 : if null ys then [] else scoreException (tail ys)
| otherwise = 0 : scoreException ys | 128 | scoreException (x:ys)
| x == '-' = 1 : if null ys then [] else scoreException (tail ys)
| otherwise = 0 : scoreException ys | 128 | scoreException (x:ys)
| x == '-' = 1 : if null ys then [] else scoreException (tail ys)
| otherwise = 0 : scoreException ys | 128 | false | false | 1 | 10 | 29 | 66 | 32 | 34 | null | null |
schell/blocks | src/App/Input.hs | bsd-3-clause | getInput :: Window -- ^ The window.
-> Input -- ^ The previous input state.
-> IO Input -- ^ The new input state and any input events.
getInput win (Input s _) = do
pollEvents
(keys, buttons, position, (w, h)) <- getCurrentInput win
let events' = keyEvents++buttonEvents++moveEvents++winEvents
keyEvents = getKeyEventsBetween (_keysPressed s) keys
buttonEvents= getButtonEventsBetween (_mouseButtonsPressed s) buttons
moveEvents = [ MouseMovedTo position | position /= _mousePosition s ]
winEvents = if winSize == _windowSize s then [] else [WindowSizeChangedTo winSize]
winSize = (fromIntegral w, fromIntegral h)
return $ Input (InputState keys position buttons winSize) events' | 771 | getInput :: Window -- ^ The window.
-> Input -- ^ The previous input state.
-> IO Input
getInput win (Input s _) = do
pollEvents
(keys, buttons, position, (w, h)) <- getCurrentInput win
let events' = keyEvents++buttonEvents++moveEvents++winEvents
keyEvents = getKeyEventsBetween (_keysPressed s) keys
buttonEvents= getButtonEventsBetween (_mouseButtonsPressed s) buttons
moveEvents = [ MouseMovedTo position | position /= _mousePosition s ]
winEvents = if winSize == _windowSize s then [] else [WindowSizeChangedTo winSize]
winSize = (fromIntegral w, fromIntegral h)
return $ Input (InputState keys position buttons winSize) events' | 724 | getInput win (Input s _) = do
pollEvents
(keys, buttons, position, (w, h)) <- getCurrentInput win
let events' = keyEvents++buttonEvents++moveEvents++winEvents
keyEvents = getKeyEventsBetween (_keysPressed s) keys
buttonEvents= getButtonEventsBetween (_mouseButtonsPressed s) buttons
moveEvents = [ MouseMovedTo position | position /= _mousePosition s ]
winEvents = if winSize == _windowSize s then [] else [WindowSizeChangedTo winSize]
winSize = (fromIntegral w, fromIntegral h)
return $ Input (InputState keys position buttons winSize) events' | 613 | true | true | 0 | 14 | 188 | 218 | 110 | 108 | null | null |
fmapfmapfmap/amazonka | amazonka-support/gen/Network/AWS/Support/Types/Product.hs | mpl-2.0 | -- | The category code for the support case.
cCode :: Lens' Category (Maybe Text)
cCode = lens _cCode (\ s a -> s{_cCode = a}) | 126 | cCode :: Lens' Category (Maybe Text)
cCode = lens _cCode (\ s a -> s{_cCode = a}) | 81 | cCode = lens _cCode (\ s a -> s{_cCode = a}) | 44 | true | true | 0 | 9 | 25 | 46 | 25 | 21 | null | null |
fmapfmapfmap/amazonka | amazonka-ec2/gen/Network/AWS/EC2/Types/Product.hs | mpl-2.0 | -- | The URL of the disk image from which the snapshot is created.
stdURL :: Lens' SnapshotTaskDetail (Maybe Text)
stdURL = lens _stdURL (\ s a -> s{_stdURL = a}) | 162 | stdURL :: Lens' SnapshotTaskDetail (Maybe Text)
stdURL = lens _stdURL (\ s a -> s{_stdURL = a}) | 95 | stdURL = lens _stdURL (\ s a -> s{_stdURL = a}) | 47 | true | true | 0 | 9 | 30 | 46 | 25 | 21 | null | null |
zaxtax/hakaru | haskell/Language/Hakaru/Pretty/Concrete.hs | bsd-3-clause | --ppSCon p App_ = \(e1 :* e2 :* End) -> ppArg e1 ++ parens True (ppArg e2)
ppSCon _ App_ = \(e1 :* e2 :* End) -> prettyApps e1 e2 | 129 | ppSCon _ App_ = \(e1 :* e2 :* End) -> prettyApps e1 e2 | 54 | ppSCon _ App_ = \(e1 :* e2 :* End) -> prettyApps e1 e2 | 54 | true | false | 0 | 8 | 29 | 33 | 17 | 16 | null | null |
puffnfresh/blimp | Blimp/Main.hs | mit | compileExp (Paren a) = compileExp a | 35 | compileExp (Paren a) = compileExp a | 35 | compileExp (Paren a) = compileExp a | 35 | false | false | 0 | 7 | 5 | 18 | 8 | 10 | null | null |
qpliu/esolang | 01_/hs/compiler2/CodeGen.hs | gpl-3.0 | writeFreeEvalParamConcatValueDefn :: GenLLVM ()
writeFreeEvalParamConcatValueDefn = do
writeCode "define private fastcc void "
writeCode "@freeEvalParamConcat(i8* %evalParam) {"
writeNewLabel
evalParam <- writeNewLocal "bitcast i8* %evalParam to "
writeConcatValueEvalParamType "*"
ptr1 <- writeGetElementPtr (writeConcatValueEvalParamType "")
(Left evalParam) "i32 0,i32 0"
value1 <- writeLoad (writeValueType "*") ptr1
writeUnref (Left value1)
ptr2 <- writeGetElementPtr (writeConcatValueEvalParamType "")
(Left evalParam) "i32 0,i32 1"
value2 <- writeLoad (writeValueType "*") ptr2
writeUnref (Left value2)
writeFree (Right "%evalParam")
writeCode " ret void"
writeCode " }" | 795 | writeFreeEvalParamConcatValueDefn :: GenLLVM ()
writeFreeEvalParamConcatValueDefn = do
writeCode "define private fastcc void "
writeCode "@freeEvalParamConcat(i8* %evalParam) {"
writeNewLabel
evalParam <- writeNewLocal "bitcast i8* %evalParam to "
writeConcatValueEvalParamType "*"
ptr1 <- writeGetElementPtr (writeConcatValueEvalParamType "")
(Left evalParam) "i32 0,i32 0"
value1 <- writeLoad (writeValueType "*") ptr1
writeUnref (Left value1)
ptr2 <- writeGetElementPtr (writeConcatValueEvalParamType "")
(Left evalParam) "i32 0,i32 1"
value2 <- writeLoad (writeValueType "*") ptr2
writeUnref (Left value2)
writeFree (Right "%evalParam")
writeCode " ret void"
writeCode " }" | 795 | writeFreeEvalParamConcatValueDefn = do
writeCode "define private fastcc void "
writeCode "@freeEvalParamConcat(i8* %evalParam) {"
writeNewLabel
evalParam <- writeNewLocal "bitcast i8* %evalParam to "
writeConcatValueEvalParamType "*"
ptr1 <- writeGetElementPtr (writeConcatValueEvalParamType "")
(Left evalParam) "i32 0,i32 0"
value1 <- writeLoad (writeValueType "*") ptr1
writeUnref (Left value1)
ptr2 <- writeGetElementPtr (writeConcatValueEvalParamType "")
(Left evalParam) "i32 0,i32 1"
value2 <- writeLoad (writeValueType "*") ptr2
writeUnref (Left value2)
writeFree (Right "%evalParam")
writeCode " ret void"
writeCode " }" | 747 | false | true | 0 | 10 | 193 | 183 | 78 | 105 | null | null |
unisonweb/platform | codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs | mit | loadWatchesByWatchKind :: DB m => WatchKind -> m [Reference.IdH]
loadWatchesByWatchKind k = query sql (Only k) where sql = [here|
SELECT hash_id, component_index FROM watch WHERE watch_kind_id = ?
|] | 201 | loadWatchesByWatchKind :: DB m => WatchKind -> m [Reference.IdH]
loadWatchesByWatchKind k = query sql (Only k) where sql = [here|
SELECT hash_id, component_index FROM watch WHERE watch_kind_id = ?
|] | 201 | loadWatchesByWatchKind k = query sql (Only k) where sql = [here|
SELECT hash_id, component_index FROM watch WHERE watch_kind_id = ?
|] | 136 | false | true | 0 | 9 | 31 | 55 | 29 | 26 | null | null |
nomeata/cryptonite | tests/KAT_PBKDF2.hs | bsd-3-clause | vectors_hmac_sha256 :: [ (VectParams, ByteString) ]
vectors_hmac_sha256 =
[ ( ("password", "salt", 2, 32)
, "\xae\x4d\x0c\x95\xaf\x6b\x46\xd3\x2d\x0a\xdf\xf9\x28\xf0\x6d\xd0\x2a\x30\x3f\x8e\xf3\xc2\x51\xdf\xd6\xe2\xd8\x5a\x95\x47\x4c\x43"
)
, ( ("passwordPASSWORDpassword", "saltSALTsaltSALTsaltSALTsaltSALTsalt", 4096, 40)
, "\x34\x8c\x89\xdb\xcb\xd3\x2b\x2f\x32\xd8\x14\xb8\x11\x6e\x84\xcf\x2b\x17\x34\x7e\xbc\x18\x00\x18\x1c\x4e\x2a\x1f\xb8\xdd\x53\xe1\xc6\x35\x51\x8c\x7d\xac\x47\xe9"
)
] | 540 | vectors_hmac_sha256 :: [ (VectParams, ByteString) ]
vectors_hmac_sha256 =
[ ( ("password", "salt", 2, 32)
, "\xae\x4d\x0c\x95\xaf\x6b\x46\xd3\x2d\x0a\xdf\xf9\x28\xf0\x6d\xd0\x2a\x30\x3f\x8e\xf3\xc2\x51\xdf\xd6\xe2\xd8\x5a\x95\x47\x4c\x43"
)
, ( ("passwordPASSWORDpassword", "saltSALTsaltSALTsaltSALTsaltSALTsalt", 4096, 40)
, "\x34\x8c\x89\xdb\xcb\xd3\x2b\x2f\x32\xd8\x14\xb8\x11\x6e\x84\xcf\x2b\x17\x34\x7e\xbc\x18\x00\x18\x1c\x4e\x2a\x1f\xb8\xdd\x53\xe1\xc6\x35\x51\x8c\x7d\xac\x47\xe9"
)
] | 540 | vectors_hmac_sha256 =
[ ( ("password", "salt", 2, 32)
, "\xae\x4d\x0c\x95\xaf\x6b\x46\xd3\x2d\x0a\xdf\xf9\x28\xf0\x6d\xd0\x2a\x30\x3f\x8e\xf3\xc2\x51\xdf\xd6\xe2\xd8\x5a\x95\x47\x4c\x43"
)
, ( ("passwordPASSWORDpassword", "saltSALTsaltSALTsaltSALTsaltSALTsalt", 4096, 40)
, "\x34\x8c\x89\xdb\xcb\xd3\x2b\x2f\x32\xd8\x14\xb8\x11\x6e\x84\xcf\x2b\x17\x34\x7e\xbc\x18\x00\x18\x1c\x4e\x2a\x1f\xb8\xdd\x53\xe1\xc6\x35\x51\x8c\x7d\xac\x47\xe9"
)
] | 488 | false | true | 0 | 7 | 74 | 62 | 40 | 22 | null | null |
haskell/haddock | haddock-api/src/Haddock/Backends/Xhtml/Decl.hs | bsd-2-clause | ppr_tylit :: HsTyLit -> Html
ppr_tylit (HsNumTy _ n) = toHtml (show n) | 70 | ppr_tylit :: HsTyLit -> Html
ppr_tylit (HsNumTy _ n) = toHtml (show n) | 70 | ppr_tylit (HsNumTy _ n) = toHtml (show n) | 41 | false | true | 0 | 9 | 12 | 40 | 18 | 22 | null | null |
MaxwellBo/Advent_Of_Code_2016 | Day_17.hs | bsd-3-clause | partOne :: Path
partOne = C.drop (C.length seed) . head $ paths | 63 | partOne :: Path
partOne = C.drop (C.length seed) . head $ paths | 63 | partOne = C.drop (C.length seed) . head $ paths | 47 | false | true | 0 | 10 | 11 | 32 | 16 | 16 | null | null |
alvisespano/Lw | extras/hml-prototype/PPrint.hs | gpl-3.0 | flatten (Column f) = Column (flatten . f) | 46 | flatten (Column f) = Column (flatten . f) | 46 | flatten (Column f) = Column (flatten . f) | 46 | false | false | 0 | 7 | 12 | 25 | 12 | 13 | null | null |
elbrujohalcon/hPage | src/HPage/Test/Server.hs | bsd-3-clause | prop_new_page :: HPS.ServerHandle -> Int -> Bool
prop_new_page hps i' =
unsafePerformIO $ HPS.runIn hps $ do
let i = if abs i' > 10 then 10 else abs i' + 1
_ <- HP.setPageText "" 0
HP.closeAllPages
pc0 <- HP.getPageCount
pi0 <- HP.getPageIndex
pt0 <- HP.getPageText
pss <- (flip mapM) [1..i] $ \x -> do
HP.addPage
psc <- HP.getPageCount
psi <- HP.getPageIndex
pst <- HP.getPageText
HP.setPageIndex $ psc - 1
_ <- HP.setPageText ("old "++ show x) 0
return (x, psc, psi, pst)
let results = (0,pc0,pi0,pt0):pss
-- liftDebugIO results
return $ all (\(k, kc, ki, kt) ->
kc == k+1 &&
ki == 0 &&
kt == "") $ results | 1,796 | prop_new_page :: HPS.ServerHandle -> Int -> Bool
prop_new_page hps i' =
unsafePerformIO $ HPS.runIn hps $ do
let i = if abs i' > 10 then 10 else abs i' + 1
_ <- HP.setPageText "" 0
HP.closeAllPages
pc0 <- HP.getPageCount
pi0 <- HP.getPageIndex
pt0 <- HP.getPageText
pss <- (flip mapM) [1..i] $ \x -> do
HP.addPage
psc <- HP.getPageCount
psi <- HP.getPageIndex
pst <- HP.getPageText
HP.setPageIndex $ psc - 1
_ <- HP.setPageText ("old "++ show x) 0
return (x, psc, psi, pst)
let results = (0,pc0,pi0,pt0):pss
-- liftDebugIO results
return $ all (\(k, kc, ki, kt) ->
kc == k+1 &&
ki == 0 &&
kt == "") $ results | 1,796 | prop_new_page hps i' =
unsafePerformIO $ HPS.runIn hps $ do
let i = if abs i' > 10 then 10 else abs i' + 1
_ <- HP.setPageText "" 0
HP.closeAllPages
pc0 <- HP.getPageCount
pi0 <- HP.getPageIndex
pt0 <- HP.getPageText
pss <- (flip mapM) [1..i] $ \x -> do
HP.addPage
psc <- HP.getPageCount
psi <- HP.getPageIndex
pst <- HP.getPageText
HP.setPageIndex $ psc - 1
_ <- HP.setPageText ("old "++ show x) 0
return (x, psc, psi, pst)
let results = (0,pc0,pi0,pt0):pss
-- liftDebugIO results
return $ all (\(k, kc, ki, kt) ->
kc == k+1 &&
ki == 0 &&
kt == "") $ results | 1,747 | false | true | 0 | 18 | 1,299 | 317 | 156 | 161 | null | null |
chrissound/ArchPackageCompareStats | src/CompareFormTemplate.hs | bsd-3-clause | generateRecordSplices :: [Text] -> I.Splice IO
generateRecordSplices = I.mapSplices generateRecordSplice | 104 | generateRecordSplices :: [Text] -> I.Splice IO
generateRecordSplices = I.mapSplices generateRecordSplice | 104 | generateRecordSplices = I.mapSplices generateRecordSplice | 57 | false | true | 0 | 7 | 9 | 28 | 14 | 14 | null | null |
mariefarrell/Hets | CommonLogic/Tools.hs | gpl-2.0 | {- -----------------------------------------------------------------------------
Misc functions --
----------------------------------------------------------------------------- -}
{- | Finds a free discourse name (appends "_" at the end until free name found)
given the set of all discourse names -}
freeName :: (String, Int) -> Set NAME -> (NAME, Int)
freeName (s, i) ns =
if Set.member n ns
then freeName (s, i + 1) ns
else (n, i + 1)
where n = mkSimpleId (s ++ "_" ++ [intToDigit i])
{- -----------------------------------------------------------------------------
Functions to compute the set of individual constants (discourse items), --
these work by recursing into all subelements --
----------------------------------------------------------------------------- -}
-- | maps @f@ to @ts@ and unifies the results | 932 | freeName :: (String, Int) -> Set NAME -> (NAME, Int)
freeName (s, i) ns =
if Set.member n ns
then freeName (s, i + 1) ns
else (n, i + 1)
where n = mkSimpleId (s ++ "_" ++ [intToDigit i])
{- -----------------------------------------------------------------------------
Functions to compute the set of individual constants (discourse items), --
these work by recursing into all subelements --
----------------------------------------------------------------------------- -}
-- | maps @f@ to @ts@ and unifies the results | 572 | freeName (s, i) ns =
if Set.member n ns
then freeName (s, i + 1) ns
else (n, i + 1)
where n = mkSimpleId (s ++ "_" ++ [intToDigit i])
{- -----------------------------------------------------------------------------
Functions to compute the set of individual constants (discourse items), --
these work by recursing into all subelements --
----------------------------------------------------------------------------- -}
-- | maps @f@ to @ts@ and unifies the results | 519 | true | true | 0 | 11 | 219 | 116 | 65 | 51 | null | null |
Thhethssmuz/ppp | src/Writer.hs | mit | toPdf :: Text -> IO BS.ByteString
toPdf tex = do
let doc = Pandoc nullMeta []
pdf <- runIOorExplode $ makePDF "xelatex" [] (\_ _ -> return tex) writer doc
case pdf of
Left err -> do
BS.hPutStrLn stderr err
exitFailure
Right bs -> return bs | 285 | toPdf :: Text -> IO BS.ByteString
toPdf tex = do
let doc = Pandoc nullMeta []
pdf <- runIOorExplode $ makePDF "xelatex" [] (\_ _ -> return tex) writer doc
case pdf of
Left err -> do
BS.hPutStrLn stderr err
exitFailure
Right bs -> return bs | 285 | toPdf tex = do
let doc = Pandoc nullMeta []
pdf <- runIOorExplode $ makePDF "xelatex" [] (\_ _ -> return tex) writer doc
case pdf of
Left err -> do
BS.hPutStrLn stderr err
exitFailure
Right bs -> return bs | 251 | false | true | 0 | 14 | 91 | 122 | 54 | 68 | null | null |
sdiehl/ghc | compiler/coreSyn/CoreUtils.hs | bsd-3-clause | diffExpr top env (Cast e1 co1) (Cast e2 co2)
| eqCoercionX env co1 co2 = diffExpr top env e1 e2 | 113 | diffExpr top env (Cast e1 co1) (Cast e2 co2)
| eqCoercionX env co1 co2 = diffExpr top env e1 e2 | 113 | diffExpr top env (Cast e1 co1) (Cast e2 co2)
| eqCoercionX env co1 co2 = diffExpr top env e1 e2 | 113 | false | false | 0 | 8 | 37 | 53 | 24 | 29 | null | null |
sir-murray/lol | Import/Phone.hs | agpl-3.0 | phoneField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Field m Phone
phoneField = Field { fieldParse = parse, fieldView = view, fieldEnctype = UrlEncoded }
where
parse = parseHelper parsePhone'
view myid name attrs v r = do
toWidget [hamlet|
<input type="text" id=#{myid} name=#{name} *{attrs} :r:required value="#{showVal v}">
|]
toWidget [julius|
$("##{rawJS myid}").on('change', function()
{
});
|]
showVal (Left s) = s
showVal (Right (Phone s)) = s | 502 | phoneField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Field m Phone
phoneField = Field { fieldParse = parse, fieldView = view, fieldEnctype = UrlEncoded }
where
parse = parseHelper parsePhone'
view myid name attrs v r = do
toWidget [hamlet|
<input type="text" id=#{myid} name=#{name} *{attrs} :r:required value="#{showVal v}">
|]
toWidget [julius|
$("##{rawJS myid}").on('change', function()
{
});
|]
showVal (Left s) = s
showVal (Right (Phone s)) = s | 502 | phoneField = Field { fieldParse = parse, fieldView = view, fieldEnctype = UrlEncoded }
where
parse = parseHelper parsePhone'
view myid name attrs v r = do
toWidget [hamlet|
<input type="text" id=#{myid} name=#{name} *{attrs} :r:required value="#{showVal v}">
|]
toWidget [julius|
$("##{rawJS myid}").on('change', function()
{
});
|]
showVal (Left s) = s
showVal (Right (Phone s)) = s | 418 | false | true | 1 | 10 | 104 | 156 | 75 | 81 | null | null |
fhaust/vector-split | src/Data/Vector/Split/Internal.hs | bsd-3-clause | condense [] = [] | 39 | condense [] = [] | 39 | condense [] = [] | 39 | false | false | 0 | 6 | 26 | 13 | 6 | 7 | null | null |
martin-kolinek/some-board-game-rules | src/Universe/Player.hs | mit | getPlayerResources :: Universe -> PlayerId -> Resources
getPlayerResources universe player = fromMaybe initialResources $ universe ^? (players . ix player . playerResources) | 173 | getPlayerResources :: Universe -> PlayerId -> Resources
getPlayerResources universe player = fromMaybe initialResources $ universe ^? (players . ix player . playerResources) | 173 | getPlayerResources universe player = fromMaybe initialResources $ universe ^? (players . ix player . playerResources) | 117 | false | true | 0 | 9 | 21 | 49 | 24 | 25 | null | null |
barrucadu/search-party | tests/CountDown.hs | mit | ops :: [Op]
ops = [Add,Sub,Mul,Div] | 88 | ops :: [Op]
ops = [Add,Sub,Mul,Div] | 88 | ops = [Add,Sub,Mul,Div] | 50 | false | true | 0 | 5 | 58 | 26 | 16 | 10 | null | null |
joe9/barrelfish | tools/flounder/UMPCommon.hs | mit | tx_handler_case :: UMPParams -> String -> String -> MsgFragment -> [C.Stmt]
tx_handler_case p ifn mn (MsgFragment words) = [
C.SComment "check if we can send another message",
C.If (C.Unary C.Not $ C.Call "flounder_stub_ump_can_send" [stateaddr])
[C.Ex $ C.Assignment (C.Variable "tx_notify") (C.Variable "true"),
C.Break] [],
C.SBlank,
C.SComment "send the next fragment",
C.Ex $ C.Assignment msgvar $ C.Call "ump_chan_get_next" [chanaddr, ctrladdr],
C.Ex $ C.Call "flounder_stub_ump_control_fill"
[stateaddr, ctrladdr, C.Variable $ msg_enum_elem_name ifn mn],
C.StmtList
[C.Ex $ C.Assignment (msgword n) (fragment_word_to_expr (ump_arch p) ifn mn (words !! n))
| n <- [0 .. length(words) - 1], words !! n /= []],
C.Ex $ C.Call "flounder_stub_ump_barrier" [],
C.Ex $ C.Assignment msgheader ctrlvar]
where
ctrlvar = C.Variable "ctrl"
ctrladdr = C.AddressOf ctrlvar
statevar = C.DerefField my_bindvar "ump_state"
stateaddr = C.AddressOf statevar
msgvar = C.Variable "msg"
msgword n = C.DerefField msgvar "data" `C.SubscriptOf` (C.NumConstant $ toInteger n)
msgheader = C.DerefField msgvar "header" `C.FieldOf` "control"
chanaddr = C.AddressOf $ C.FieldOf statevar "chan" | 1,325 | tx_handler_case :: UMPParams -> String -> String -> MsgFragment -> [C.Stmt]
tx_handler_case p ifn mn (MsgFragment words) = [
C.SComment "check if we can send another message",
C.If (C.Unary C.Not $ C.Call "flounder_stub_ump_can_send" [stateaddr])
[C.Ex $ C.Assignment (C.Variable "tx_notify") (C.Variable "true"),
C.Break] [],
C.SBlank,
C.SComment "send the next fragment",
C.Ex $ C.Assignment msgvar $ C.Call "ump_chan_get_next" [chanaddr, ctrladdr],
C.Ex $ C.Call "flounder_stub_ump_control_fill"
[stateaddr, ctrladdr, C.Variable $ msg_enum_elem_name ifn mn],
C.StmtList
[C.Ex $ C.Assignment (msgword n) (fragment_word_to_expr (ump_arch p) ifn mn (words !! n))
| n <- [0 .. length(words) - 1], words !! n /= []],
C.Ex $ C.Call "flounder_stub_ump_barrier" [],
C.Ex $ C.Assignment msgheader ctrlvar]
where
ctrlvar = C.Variable "ctrl"
ctrladdr = C.AddressOf ctrlvar
statevar = C.DerefField my_bindvar "ump_state"
stateaddr = C.AddressOf statevar
msgvar = C.Variable "msg"
msgword n = C.DerefField msgvar "data" `C.SubscriptOf` (C.NumConstant $ toInteger n)
msgheader = C.DerefField msgvar "header" `C.FieldOf` "control"
chanaddr = C.AddressOf $ C.FieldOf statevar "chan" | 1,325 | tx_handler_case p ifn mn (MsgFragment words) = [
C.SComment "check if we can send another message",
C.If (C.Unary C.Not $ C.Call "flounder_stub_ump_can_send" [stateaddr])
[C.Ex $ C.Assignment (C.Variable "tx_notify") (C.Variable "true"),
C.Break] [],
C.SBlank,
C.SComment "send the next fragment",
C.Ex $ C.Assignment msgvar $ C.Call "ump_chan_get_next" [chanaddr, ctrladdr],
C.Ex $ C.Call "flounder_stub_ump_control_fill"
[stateaddr, ctrladdr, C.Variable $ msg_enum_elem_name ifn mn],
C.StmtList
[C.Ex $ C.Assignment (msgword n) (fragment_word_to_expr (ump_arch p) ifn mn (words !! n))
| n <- [0 .. length(words) - 1], words !! n /= []],
C.Ex $ C.Call "flounder_stub_ump_barrier" [],
C.Ex $ C.Assignment msgheader ctrlvar]
where
ctrlvar = C.Variable "ctrl"
ctrladdr = C.AddressOf ctrlvar
statevar = C.DerefField my_bindvar "ump_state"
stateaddr = C.AddressOf statevar
msgvar = C.Variable "msg"
msgword n = C.DerefField msgvar "data" `C.SubscriptOf` (C.NumConstant $ toInteger n)
msgheader = C.DerefField msgvar "header" `C.FieldOf` "control"
chanaddr = C.AddressOf $ C.FieldOf statevar "chan" | 1,249 | false | true | 5 | 13 | 308 | 485 | 239 | 246 | null | null |
tibbe/ghc | compiler/nativeGen/X86/CodeGen.hs | bsd-3-clause | isVecExpr :: CmmExpr -> Bool
isVecExpr (CmmMachOp (MO_V_Insert {}) _) = True | 78 | isVecExpr :: CmmExpr -> Bool
isVecExpr (CmmMachOp (MO_V_Insert {}) _) = True | 78 | isVecExpr (CmmMachOp (MO_V_Insert {}) _) = True | 49 | false | true | 0 | 9 | 13 | 33 | 17 | 16 | null | null |
kawu/french-tag | src/NLP/Partage4Xmg/Gen.hs | bsd-2-clause | rmDups :: (Monad m, Ord a) => Pipe a a m ()
rmDups =
E.evalStateT pipe S.empty
where
pipe = E.forever $ do
x <- lift await
isMember <- S.member x <$> E.get
E.unless isMember $ do
lift (yield x)
E.modify (S.insert x) | 273 | rmDups :: (Monad m, Ord a) => Pipe a a m ()
rmDups =
E.evalStateT pipe S.empty
where
pipe = E.forever $ do
x <- lift await
isMember <- S.member x <$> E.get
E.unless isMember $ do
lift (yield x)
E.modify (S.insert x) | 273 | rmDups =
E.evalStateT pipe S.empty
where
pipe = E.forever $ do
x <- lift await
isMember <- S.member x <$> E.get
E.unless isMember $ do
lift (yield x)
E.modify (S.insert x) | 229 | false | true | 3 | 14 | 100 | 139 | 60 | 79 | null | null |
copumpkin/charm | src/Architecture/ARM/Pretty.hs | bsd-3-clause | showGeneralInstruction (Conditional cond x) = printf (showInstruction x) (showCondition cond) | 93 | showGeneralInstruction (Conditional cond x) = printf (showInstruction x) (showCondition cond) | 93 | showGeneralInstruction (Conditional cond x) = printf (showInstruction x) (showCondition cond) | 93 | false | false | 0 | 7 | 9 | 34 | 16 | 18 | null | null |
ghcjs/ghcjs | src/Compiler/JMacro/Combinators.hs | mit | math_atan = math_ "atan" | 24 | math_atan = math_ "atan" | 24 | math_atan = math_ "atan" | 24 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
dsorokin/aivika-experiment-chart | Simulation/Aivika/Experiment/Chart/XYChartView.hs | bsd-3-clause | header :: XYChartViewState r -> Int -> HtmlWriter ()
header st index =
do writeHtmlHeader3WithId ("id" ++ show index) $
writeHtmlText (xyChartTitle $ xyChartView st)
let description = xyChartDescription $ xyChartView st
unless (null description) $
writeHtmlParagraph $
writeHtmlText description
-- | Get the TOC item. | 353 | header :: XYChartViewState r -> Int -> HtmlWriter ()
header st index =
do writeHtmlHeader3WithId ("id" ++ show index) $
writeHtmlText (xyChartTitle $ xyChartView st)
let description = xyChartDescription $ xyChartView st
unless (null description) $
writeHtmlParagraph $
writeHtmlText description
-- | Get the TOC item. | 353 | header st index =
do writeHtmlHeader3WithId ("id" ++ show index) $
writeHtmlText (xyChartTitle $ xyChartView st)
let description = xyChartDescription $ xyChartView st
unless (null description) $
writeHtmlParagraph $
writeHtmlText description
-- | Get the TOC item. | 300 | false | true | 0 | 11 | 81 | 105 | 48 | 57 | null | null |
urbanslug/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | translateOp _ (VecDivOp FloatVec n w) = Just (MO_VF_Quot n w) | 61 | translateOp _ (VecDivOp FloatVec n w) = Just (MO_VF_Quot n w) | 61 | translateOp _ (VecDivOp FloatVec n w) = Just (MO_VF_Quot n w) | 61 | false | false | 1 | 7 | 10 | 34 | 15 | 19 | null | null |
andyarvanitis/Idris-dev | src/Idris/Core/Typecheck.hs | bsd-3-clause | errEnv = map (\(x, b) -> (x, binderTy b)) | 41 | errEnv = map (\(x, b) -> (x, binderTy b)) | 41 | errEnv = map (\(x, b) -> (x, binderTy b)) | 41 | false | false | 1 | 9 | 8 | 36 | 18 | 18 | null | null |
k32/zenmaster | LinkGrammar/Parsec.hs | unlicense | parseLink :: String -> Either String [Rule]
parseLink s = f $ parse (T.whiteSpace linkGrammarDef *> linkGrammar <* eof) "undefined" s
where f (Right a) = Right a
f (Left a) = Left $ printError s a | 211 | parseLink :: String -> Either String [Rule]
parseLink s = f $ parse (T.whiteSpace linkGrammarDef *> linkGrammar <* eof) "undefined" s
where f (Right a) = Right a
f (Left a) = Left $ printError s a | 211 | parseLink s = f $ parse (T.whiteSpace linkGrammarDef *> linkGrammar <* eof) "undefined" s
where f (Right a) = Right a
f (Left a) = Left $ printError s a | 167 | false | true | 1 | 11 | 51 | 95 | 46 | 49 | null | null |
razvan9310/barrelfish | hake/TreeDB.hs | mit | tdbBuild :: [FilePath] -> TreeDB
tdbBuild files = foldr tdbAdd tdbEmpty files | 77 | tdbBuild :: [FilePath] -> TreeDB
tdbBuild files = foldr tdbAdd tdbEmpty files | 77 | tdbBuild files = foldr tdbAdd tdbEmpty files | 44 | false | true | 0 | 6 | 11 | 28 | 14 | 14 | null | null |
sethfowler/pygmalion | indexers/Pygmalion/Index/Source.hs | bsd-3-clause | toSourceKind C.Cursor_PreprocessingDirective = PreprocessingDirective | 81 | toSourceKind C.Cursor_PreprocessingDirective = PreprocessingDirective | 81 | toSourceKind C.Cursor_PreprocessingDirective = PreprocessingDirective | 81 | false | false | 0 | 6 | 15 | 11 | 5 | 6 | null | null |
ancientlanguage/haskell-analysis | prepare/src/Prepare/Decompose.hs | mit | decomposeChar '\x1F5B' = "\x03A5\x0314\x0300" | 45 | decomposeChar '\x1F5B' = "\x03A5\x0314\x0300" | 45 | decomposeChar '\x1F5B' = "\x03A5\x0314\x0300" | 45 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
ryantm/ghc | libraries/base/GHC/IO/Encoding/UTF16.hs | bsd-3-clause | utf16be_EF :: CodingFailureMode -> IO (TextEncoder ())
utf16be_EF cfm =
return (BufferCodec {
encode = utf16be_encode,
recover = recoverEncode cfm,
close = return (),
getState = return (),
setState = const $ return ()
}) | 303 | utf16be_EF :: CodingFailureMode -> IO (TextEncoder ())
utf16be_EF cfm =
return (BufferCodec {
encode = utf16be_encode,
recover = recoverEncode cfm,
close = return (),
getState = return (),
setState = const $ return ()
}) | 303 | utf16be_EF cfm =
return (BufferCodec {
encode = utf16be_encode,
recover = recoverEncode cfm,
close = return (),
getState = return (),
setState = const $ return ()
}) | 248 | false | true | 0 | 11 | 117 | 94 | 48 | 46 | null | null |
green-haskell/ghc | includes/CodeGen.Platform.hs | bsd-3-clause | globalRegMaybe (YmmReg 4) = Just (RealRegSingle REG_YMM4) | 71 | globalRegMaybe (YmmReg 4) = Just (RealRegSingle REG_YMM4) | 71 | globalRegMaybe (YmmReg 4) = Just (RealRegSingle REG_YMM4) | 71 | false | false | 0 | 7 | 20 | 24 | 11 | 13 | null | null |
green-haskell/ghc | compiler/basicTypes/OccName.hs | bsd-3-clause | otherNameSpace DataName = VarName | 33 | otherNameSpace DataName = VarName | 33 | otherNameSpace DataName = VarName | 33 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
mightymoose/liquidhaskell | benchmarks/icfp15/pos/FindRec.hs | bsd-3-clause | {-@ fread ::
h:FHandle -> RIO<{w:World | Rd w h},\w1 x -> {w2:World | NoChange w1 w2}> String @-}
fread :: FHandle -> RIO String
fread = undefined | 148 | fread :: FHandle -> RIO String
fread = undefined | 48 | fread = undefined | 17 | true | true | 0 | 7 | 29 | 25 | 11 | 14 | null | null |
hanshoglund/hamid | src/System/Win32/MIDI.hs | bsd-3-clause | idiOutSendSysEx :: HMIDIOUT -> [Word8] -> IO ()
midiOutSendSysEx handle msg' = do
let msg = 0xf0 : (msg' ++ [0xf7])
--print msg
mmresult <- withMidiOutHeader handle msg c_midiOutLongMsg
when (mmresult /=0) $ mmOutError mmresult
| 248 | midiOutSendSysEx :: HMIDIOUT -> [Word8] -> IO ()
midiOutSendSysEx handle msg' = do
let msg = 0xf0 : (msg' ++ [0xf7])
--print msg
mmresult <- withMidiOutHeader handle msg c_midiOutLongMsg
when (mmresult /=0) $ mmOutError mmresult | 248 | midiOutSendSysEx handle msg' = do
let msg = 0xf0 : (msg' ++ [0xf7])
--print msg
mmresult <- withMidiOutHeader handle msg c_midiOutLongMsg
when (mmresult /=0) $ mmOutError mmresult | 199 | false | true | 0 | 13 | 55 | 90 | 44 | 46 | null | null |
rueshyna/gogol | gogol-replicapool/gen/Network/Google/Resource/ReplicaPool/ZoneOperations/List.hs | mpl-2.0 | -- | Optional. Maximum count of results to be returned. Maximum value is 500
-- and default value is 500.
zolMaxResults :: Lens' ZoneOperationsList Word32
zolMaxResults
= lens _zolMaxResults
(\ s a -> s{_zolMaxResults = a})
. _Coerce | 247 | zolMaxResults :: Lens' ZoneOperationsList Word32
zolMaxResults
= lens _zolMaxResults
(\ s a -> s{_zolMaxResults = a})
. _Coerce | 141 | zolMaxResults
= lens _zolMaxResults
(\ s a -> s{_zolMaxResults = a})
. _Coerce | 92 | true | true | 0 | 10 | 51 | 47 | 25 | 22 | null | null |
AlexanderPankiv/ghc | compiler/main/DynFlags.hs | bsd-3-clause | pgm_a :: DynFlags -> (String,[Option])
pgm_a dflags = sPgm_a (settings dflags) | 94 | pgm_a :: DynFlags -> (String,[Option])
pgm_a dflags = sPgm_a (settings dflags) | 94 | pgm_a dflags = sPgm_a (settings dflags) | 39 | false | true | 0 | 9 | 26 | 42 | 20 | 22 | null | null |
PepeLui17/Proyecto_Lenguajes_De_Programacion_Segundo_Parcial | Heap.hs | gpl-2.0 | -- | @'takeWhile' p h@: List the longest prefix of items in @h@ that satisfy @p@.
takeWhile :: (HeapItem pol item) => (item -> Bool) -> Heap pol item -> [item]
takeWhile p = fst . (span p) | 188 | takeWhile :: (HeapItem pol item) => (item -> Bool) -> Heap pol item -> [item]
takeWhile p = fst . (span p) | 106 | takeWhile p = fst . (span p) | 28 | true | true | 0 | 8 | 37 | 59 | 31 | 28 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.