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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pbv/codex | src/Codex/Tester/InputOutput.hs | mit | javaBuild :: Tester Build
javaBuild = do
javac_cmd <- configured "language.java.compiler"
java_cmd <- configured "language.java.runtime"
limits <- configLimits "language.java.limits"
-- name for public java class with the main method
classname <- fromMaybe "Main" <$> metadata "java-main"
javac:javac_args <- parseArgs javac_cmd
java:java_args <- parseArgs java_cmd
let make tmpdir (Code _ code) = do
let java_file = tmpdir </> classname <.> "java"
let classfile = tmpdir </> classname <.> "class"
T.writeFile java_file code
chmod (executable . readable . writeable) tmpdir
chmod readable java_file
runCompiler (Just limits) javac (javac_args ++ [java_file])
return classfile
let run classfile cwd args stdin = do
let classpath = takeDirectory classfile
let args' = java_args ++ ["-cp", classpath, classname] ++ args
safeExec limits java cwd args' stdin
return (Build (=="java") make run)
-- builder for Haskell programs | 1,023 | javaBuild :: Tester Build
javaBuild = do
javac_cmd <- configured "language.java.compiler"
java_cmd <- configured "language.java.runtime"
limits <- configLimits "language.java.limits"
-- name for public java class with the main method
classname <- fromMaybe "Main" <$> metadata "java-main"
javac:javac_args <- parseArgs javac_cmd
java:java_args <- parseArgs java_cmd
let make tmpdir (Code _ code) = do
let java_file = tmpdir </> classname <.> "java"
let classfile = tmpdir </> classname <.> "class"
T.writeFile java_file code
chmod (executable . readable . writeable) tmpdir
chmod readable java_file
runCompiler (Just limits) javac (javac_args ++ [java_file])
return classfile
let run classfile cwd args stdin = do
let classpath = takeDirectory classfile
let args' = java_args ++ ["-cp", classpath, classname] ++ args
safeExec limits java cwd args' stdin
return (Build (=="java") make run)
-- builder for Haskell programs | 1,023 | javaBuild = do
javac_cmd <- configured "language.java.compiler"
java_cmd <- configured "language.java.runtime"
limits <- configLimits "language.java.limits"
-- name for public java class with the main method
classname <- fromMaybe "Main" <$> metadata "java-main"
javac:javac_args <- parseArgs javac_cmd
java:java_args <- parseArgs java_cmd
let make tmpdir (Code _ code) = do
let java_file = tmpdir </> classname <.> "java"
let classfile = tmpdir </> classname <.> "class"
T.writeFile java_file code
chmod (executable . readable . writeable) tmpdir
chmod readable java_file
runCompiler (Just limits) javac (javac_args ++ [java_file])
return classfile
let run classfile cwd args stdin = do
let classpath = takeDirectory classfile
let args' = java_args ++ ["-cp", classpath, classname] ++ args
safeExec limits java cwd args' stdin
return (Build (=="java") make run)
-- builder for Haskell programs | 997 | false | true | 0 | 18 | 231 | 312 | 141 | 171 | null | null |
brendanhay/gogol | gogol-shopping-content/gen/Network/Google/Resource/Content/Shoppingadsprogram/Get.hs | mpl-2.0 | -- | Upload protocol for media (e.g. \"raw\", \"multipart\").
sgUploadProtocol :: Lens' ShoppingadsprogramGet (Maybe Text)
sgUploadProtocol
= lens _sgUploadProtocol
(\ s a -> s{_sgUploadProtocol = a}) | 208 | sgUploadProtocol :: Lens' ShoppingadsprogramGet (Maybe Text)
sgUploadProtocol
= lens _sgUploadProtocol
(\ s a -> s{_sgUploadProtocol = a}) | 146 | sgUploadProtocol
= lens _sgUploadProtocol
(\ s a -> s{_sgUploadProtocol = a}) | 85 | true | true | 1 | 9 | 33 | 51 | 25 | 26 | null | null |
wyn/blash | tests/TestBlashImpl.hs | bsd-3-clause | prop_scalM :: BlasArgs Double -> Double -> Property
prop_scalM (BlasArgs (Positive n) xs (NonZero incx) _ _) da = monadicIO $ do
-- expected uses the CBLAS implementation via inline-c
expected <- run $ do
let expected' = VS.fromList (coerce xs)
da' = coerce da
n' = fromIntegral n
incx' = fromIntegral incx
cblas_scalW n' da' expected' incx'
return expected'
-- actual calls the monadic haskell implementation directly
actual <- run $ do
actual' <- VS.thaw $ VS.fromList xs
BI.scalM n da actual' incx
VS.freeze actual'
-- invariant: same size as ys always
assert (length xs == VS.length actual)
assert (length xs == VS.length expected)
-- invariant: both methods give same answer
let ass = VS.toList actual
ess = VS.toList expected
assert $ and $ zipWith (\a e -> a ~== coerce e) ass ess
-- -- | 879 | prop_scalM :: BlasArgs Double -> Double -> Property
prop_scalM (BlasArgs (Positive n) xs (NonZero incx) _ _) da = monadicIO $ do
-- expected uses the CBLAS implementation via inline-c
expected <- run $ do
let expected' = VS.fromList (coerce xs)
da' = coerce da
n' = fromIntegral n
incx' = fromIntegral incx
cblas_scalW n' da' expected' incx'
return expected'
-- actual calls the monadic haskell implementation directly
actual <- run $ do
actual' <- VS.thaw $ VS.fromList xs
BI.scalM n da actual' incx
VS.freeze actual'
-- invariant: same size as ys always
assert (length xs == VS.length actual)
assert (length xs == VS.length expected)
-- invariant: both methods give same answer
let ass = VS.toList actual
ess = VS.toList expected
assert $ and $ zipWith (\a e -> a ~== coerce e) ass ess
-- -- | 879 | prop_scalM (BlasArgs (Positive n) xs (NonZero incx) _ _) da = monadicIO $ do
-- expected uses the CBLAS implementation via inline-c
expected <- run $ do
let expected' = VS.fromList (coerce xs)
da' = coerce da
n' = fromIntegral n
incx' = fromIntegral incx
cblas_scalW n' da' expected' incx'
return expected'
-- actual calls the monadic haskell implementation directly
actual <- run $ do
actual' <- VS.thaw $ VS.fromList xs
BI.scalM n da actual' incx
VS.freeze actual'
-- invariant: same size as ys always
assert (length xs == VS.length actual)
assert (length xs == VS.length expected)
-- invariant: both methods give same answer
let ass = VS.toList actual
ess = VS.toList expected
assert $ and $ zipWith (\a e -> a ~== coerce e) ass ess
-- -- | 827 | false | true | 0 | 17 | 222 | 287 | 134 | 153 | null | null |
urbanslug/ghc | testsuite/tests/concurrent/should_run/allocLimit1.hs | bsd-3-clause | main = do
setAllocationCounter (10*1024)
enableAllocationLimit
print (length [1..]) | 89 | main = do
setAllocationCounter (10*1024)
enableAllocationLimit
print (length [1..]) | 89 | main = do
setAllocationCounter (10*1024)
enableAllocationLimit
print (length [1..]) | 89 | false | false | 1 | 11 | 14 | 41 | 17 | 24 | null | null |
ben-schulz/Idris-dev | src/Idris/IdeMode.hs | bsd-3-clause | encodeErr :: Err -> String
encodeErr e = UTF8.toString . Base64.encode . Lazy.toStrict . Binary.encode $ e | 106 | encodeErr :: Err -> String
encodeErr e = UTF8.toString . Base64.encode . Lazy.toStrict . Binary.encode $ e | 106 | encodeErr e = UTF8.toString . Base64.encode . Lazy.toStrict . Binary.encode $ e | 79 | false | true | 0 | 9 | 16 | 48 | 22 | 26 | null | null |
mrjones/workouts | src/Workouts.hs | mit | simpleMessageHtml :: String -> H.Html
simpleMessageHtml msg =
H.html $ do
headHtml "Hello, world!"
H.body $ do
H.toHtml msg | 139 | simpleMessageHtml :: String -> H.Html
simpleMessageHtml msg =
H.html $ do
headHtml "Hello, world!"
H.body $ do
H.toHtml msg | 139 | simpleMessageHtml msg =
H.html $ do
headHtml "Hello, world!"
H.body $ do
H.toHtml msg | 101 | false | true | 0 | 12 | 34 | 49 | 22 | 27 | null | null |
rcampbell/vcard | VCard.hs | apache-2.0 | x :: Parser CL
x = do
g <- try (do g <- group
lookAhead (istring "X-")
return g)
n <- manyTill (alphaNum <|> char '-') (oneOf ";:") -- 1*
p <- params
v <- manyTill anyChar crlf
return $ CL g (X_NAME n) p (TEXT v)
{- | I/O -}
-- | Reading | 280 | x :: Parser CL
x = do
g <- try (do g <- group
lookAhead (istring "X-")
return g)
n <- manyTill (alphaNum <|> char '-') (oneOf ";:") -- 1*
p <- params
v <- manyTill anyChar crlf
return $ CL g (X_NAME n) p (TEXT v)
{- | I/O -}
-- | Reading | 280 | x = do
g <- try (do g <- group
lookAhead (istring "X-")
return g)
n <- manyTill (alphaNum <|> char '-') (oneOf ";:") -- 1*
p <- params
v <- manyTill anyChar crlf
return $ CL g (X_NAME n) p (TEXT v)
{- | I/O -}
-- | Reading | 265 | false | true | 0 | 15 | 96 | 136 | 61 | 75 | null | null |
SneakingCat/fay-ticker | src/CanvasAPI.hs | gpl-3.0 | translate' :: Context -> Double -> Double -> Fay ()
translate' = ffi "%1['translate'](%2,%3)" | 93 | translate' :: Context -> Double -> Double -> Fay ()
translate' = ffi "%1['translate'](%2,%3)" | 93 | translate' = ffi "%1['translate'](%2,%3)" | 41 | false | true | 0 | 9 | 13 | 31 | 15 | 16 | null | null |
kim/amazonka | amazonka-redshift/gen/Network/AWS/Redshift/Types.hs | mpl-2.0 | -- | A list of the VPC 'Subnet' elements.
csg1Subnets :: Lens' ClusterSubnetGroup [Subnet]
csg1Subnets = lens _csg1Subnets (\s a -> s { _csg1Subnets = a }) . _List | 163 | csg1Subnets :: Lens' ClusterSubnetGroup [Subnet]
csg1Subnets = lens _csg1Subnets (\s a -> s { _csg1Subnets = a }) . _List | 121 | csg1Subnets = lens _csg1Subnets (\s a -> s { _csg1Subnets = a }) . _List | 72 | true | true | 0 | 10 | 28 | 47 | 26 | 21 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/llvmGen/LlvmCodeGen/Base.hs | bsd-3-clause | markUsedVar :: LlvmVar -> LlvmM ()
markUsedVar v = modifyEnv $ \env -> env { envUsedVars = v : envUsedVars env } | 112 | markUsedVar :: LlvmVar -> LlvmM ()
markUsedVar v = modifyEnv $ \env -> env { envUsedVars = v : envUsedVars env } | 112 | markUsedVar v = modifyEnv $ \env -> env { envUsedVars = v : envUsedVars env } | 77 | false | true | 0 | 11 | 21 | 52 | 25 | 27 | null | null |
hvr/lens | src/Control/Lens/TH.hs | bsd-3-clause | underscorePrefixRules :: LensRules
underscorePrefixRules = LensRules mLowerName fld (const Nothing) $
Set.fromList [SingletonIso, SingletonAndField, CreateClass,
CreateInstance, BuildTraversals, GenerateSignatures]
where
fld cs = Just ('_':cs) | 271 | underscorePrefixRules :: LensRules
underscorePrefixRules = LensRules mLowerName fld (const Nothing) $
Set.fromList [SingletonIso, SingletonAndField, CreateClass,
CreateInstance, BuildTraversals, GenerateSignatures]
where
fld cs = Just ('_':cs) | 271 | underscorePrefixRules = LensRules mLowerName fld (const Nothing) $
Set.fromList [SingletonIso, SingletonAndField, CreateClass,
CreateInstance, BuildTraversals, GenerateSignatures]
where
fld cs = Just ('_':cs) | 236 | false | true | 0 | 8 | 51 | 72 | 38 | 34 | null | null |
giorgidze/Hydra | hydra-solver-sundials/Setup.hs | bsd-3-clause | (('-' : 'I' : d) : ss) = d : extraIDs ss | 42 | (('-' : 'I' : d) : ss) = d : extraIDs ss | 42 | (('-' : 'I' : d) : ss) = d : extraIDs ss | 42 | false | false | 0 | 9 | 13 | 32 | 16 | 16 | null | null |
christiaanb/ghc | compiler/nativeGen/X86/CodeGen.hs | bsd-3-clause | getRegister' dflags is32Bit (CmmMachOp mop [x]) = do -- unary MachOps
sse2 <- sse2Enabled
case mop of
MO_F_Neg w
| sse2 -> sse2NegCode w x
| otherwise -> trivialUFCode FF80 (GNEG FF80) x
MO_S_Neg w -> triv_ucode NEGI (intSize w)
MO_Not w -> triv_ucode NOT (intSize w)
-- Nop conversions
MO_UU_Conv W32 W8 -> toI8Reg W32 x
MO_SS_Conv W32 W8 -> toI8Reg W32 x
MO_UU_Conv W16 W8 -> toI8Reg W16 x
MO_SS_Conv W16 W8 -> toI8Reg W16 x
MO_UU_Conv W32 W16 -> toI16Reg W32 x
MO_SS_Conv W32 W16 -> toI16Reg W32 x
MO_UU_Conv W64 W32 | not is32Bit -> conversionNop II64 x
MO_SS_Conv W64 W32 | not is32Bit -> conversionNop II64 x
MO_UU_Conv W64 W16 | not is32Bit -> toI16Reg W64 x
MO_SS_Conv W64 W16 | not is32Bit -> toI16Reg W64 x
MO_UU_Conv W64 W8 | not is32Bit -> toI8Reg W64 x
MO_SS_Conv W64 W8 | not is32Bit -> toI8Reg W64 x
MO_UU_Conv rep1 rep2 | rep1 == rep2 -> conversionNop (intSize rep1) x
MO_SS_Conv rep1 rep2 | rep1 == rep2 -> conversionNop (intSize rep1) x
-- widenings
MO_UU_Conv W8 W32 -> integerExtend W8 W32 MOVZxL x
MO_UU_Conv W16 W32 -> integerExtend W16 W32 MOVZxL x
MO_UU_Conv W8 W16 -> integerExtend W8 W16 MOVZxL x
MO_SS_Conv W8 W32 -> integerExtend W8 W32 MOVSxL x
MO_SS_Conv W16 W32 -> integerExtend W16 W32 MOVSxL x
MO_SS_Conv W8 W16 -> integerExtend W8 W16 MOVSxL x
MO_UU_Conv W8 W64 | not is32Bit -> integerExtend W8 W64 MOVZxL x
MO_UU_Conv W16 W64 | not is32Bit -> integerExtend W16 W64 MOVZxL x
MO_UU_Conv W32 W64 | not is32Bit -> integerExtend W32 W64 MOVZxL x
MO_SS_Conv W8 W64 | not is32Bit -> integerExtend W8 W64 MOVSxL x
MO_SS_Conv W16 W64 | not is32Bit -> integerExtend W16 W64 MOVSxL x
MO_SS_Conv W32 W64 | not is32Bit -> integerExtend W32 W64 MOVSxL x
-- for 32-to-64 bit zero extension, amd64 uses an ordinary movl.
-- However, we don't want the register allocator to throw it
-- away as an unnecessary reg-to-reg move, so we keep it in
-- the form of a movzl and print it as a movl later.
MO_FF_Conv W32 W64
| sse2 -> coerceFP2FP W64 x
| otherwise -> conversionNop FF80 x
MO_FF_Conv W64 W32 -> coerceFP2FP W32 x
MO_FS_Conv from to -> coerceFP2Int from to x
MO_SF_Conv from to -> coerceInt2FP from to x
MO_V_Insert {} -> needLlvm
MO_V_Extract {} -> needLlvm
MO_V_Add {} -> needLlvm
MO_V_Sub {} -> needLlvm
MO_V_Mul {} -> needLlvm
MO_VS_Quot {} -> needLlvm
MO_VS_Rem {} -> needLlvm
MO_VS_Neg {} -> needLlvm
MO_VU_Quot {} -> needLlvm
MO_VU_Rem {} -> needLlvm
MO_VF_Insert {} -> needLlvm
MO_VF_Extract {} -> needLlvm
MO_VF_Add {} -> needLlvm
MO_VF_Sub {} -> needLlvm
MO_VF_Mul {} -> needLlvm
MO_VF_Quot {} -> needLlvm
MO_VF_Neg {} -> needLlvm
_other -> pprPanic "getRegister" (pprMachOp mop)
where
triv_ucode :: (Size -> Operand -> Instr) -> Size -> NatM Register
triv_ucode instr size = trivialUCode size (instr size) x
-- signed or unsigned extension.
integerExtend :: Width -> Width
-> (Size -> Operand -> Operand -> Instr)
-> CmmExpr -> NatM Register
integerExtend from to instr expr = do
(reg,e_code) <- if from == W8 then getByteReg expr
else getSomeReg expr
let
code dst =
e_code `snocOL`
instr (intSize from) (OpReg reg) (OpReg dst)
return (Any (intSize to) code)
toI8Reg :: Width -> CmmExpr -> NatM Register
toI8Reg new_rep expr
= do codefn <- getAnyReg expr
return (Any (intSize new_rep) codefn)
-- HACK: use getAnyReg to get a byte-addressable register.
-- If the source was a Fixed register, this will add the
-- mov instruction to put it into the desired destination.
-- We're assuming that the destination won't be a fixed
-- non-byte-addressable register; it won't be, because all
-- fixed registers are word-sized.
toI16Reg = toI8Reg -- for now
conversionNop :: Size -> CmmExpr -> NatM Register
conversionNop new_size expr
= do e_code <- getRegister' dflags is32Bit expr
return (swizzleRegisterRep e_code new_size) | 4,664 | getRegister' dflags is32Bit (CmmMachOp mop [x]) = do -- unary MachOps
sse2 <- sse2Enabled
case mop of
MO_F_Neg w
| sse2 -> sse2NegCode w x
| otherwise -> trivialUFCode FF80 (GNEG FF80) x
MO_S_Neg w -> triv_ucode NEGI (intSize w)
MO_Not w -> triv_ucode NOT (intSize w)
-- Nop conversions
MO_UU_Conv W32 W8 -> toI8Reg W32 x
MO_SS_Conv W32 W8 -> toI8Reg W32 x
MO_UU_Conv W16 W8 -> toI8Reg W16 x
MO_SS_Conv W16 W8 -> toI8Reg W16 x
MO_UU_Conv W32 W16 -> toI16Reg W32 x
MO_SS_Conv W32 W16 -> toI16Reg W32 x
MO_UU_Conv W64 W32 | not is32Bit -> conversionNop II64 x
MO_SS_Conv W64 W32 | not is32Bit -> conversionNop II64 x
MO_UU_Conv W64 W16 | not is32Bit -> toI16Reg W64 x
MO_SS_Conv W64 W16 | not is32Bit -> toI16Reg W64 x
MO_UU_Conv W64 W8 | not is32Bit -> toI8Reg W64 x
MO_SS_Conv W64 W8 | not is32Bit -> toI8Reg W64 x
MO_UU_Conv rep1 rep2 | rep1 == rep2 -> conversionNop (intSize rep1) x
MO_SS_Conv rep1 rep2 | rep1 == rep2 -> conversionNop (intSize rep1) x
-- widenings
MO_UU_Conv W8 W32 -> integerExtend W8 W32 MOVZxL x
MO_UU_Conv W16 W32 -> integerExtend W16 W32 MOVZxL x
MO_UU_Conv W8 W16 -> integerExtend W8 W16 MOVZxL x
MO_SS_Conv W8 W32 -> integerExtend W8 W32 MOVSxL x
MO_SS_Conv W16 W32 -> integerExtend W16 W32 MOVSxL x
MO_SS_Conv W8 W16 -> integerExtend W8 W16 MOVSxL x
MO_UU_Conv W8 W64 | not is32Bit -> integerExtend W8 W64 MOVZxL x
MO_UU_Conv W16 W64 | not is32Bit -> integerExtend W16 W64 MOVZxL x
MO_UU_Conv W32 W64 | not is32Bit -> integerExtend W32 W64 MOVZxL x
MO_SS_Conv W8 W64 | not is32Bit -> integerExtend W8 W64 MOVSxL x
MO_SS_Conv W16 W64 | not is32Bit -> integerExtend W16 W64 MOVSxL x
MO_SS_Conv W32 W64 | not is32Bit -> integerExtend W32 W64 MOVSxL x
-- for 32-to-64 bit zero extension, amd64 uses an ordinary movl.
-- However, we don't want the register allocator to throw it
-- away as an unnecessary reg-to-reg move, so we keep it in
-- the form of a movzl and print it as a movl later.
MO_FF_Conv W32 W64
| sse2 -> coerceFP2FP W64 x
| otherwise -> conversionNop FF80 x
MO_FF_Conv W64 W32 -> coerceFP2FP W32 x
MO_FS_Conv from to -> coerceFP2Int from to x
MO_SF_Conv from to -> coerceInt2FP from to x
MO_V_Insert {} -> needLlvm
MO_V_Extract {} -> needLlvm
MO_V_Add {} -> needLlvm
MO_V_Sub {} -> needLlvm
MO_V_Mul {} -> needLlvm
MO_VS_Quot {} -> needLlvm
MO_VS_Rem {} -> needLlvm
MO_VS_Neg {} -> needLlvm
MO_VU_Quot {} -> needLlvm
MO_VU_Rem {} -> needLlvm
MO_VF_Insert {} -> needLlvm
MO_VF_Extract {} -> needLlvm
MO_VF_Add {} -> needLlvm
MO_VF_Sub {} -> needLlvm
MO_VF_Mul {} -> needLlvm
MO_VF_Quot {} -> needLlvm
MO_VF_Neg {} -> needLlvm
_other -> pprPanic "getRegister" (pprMachOp mop)
where
triv_ucode :: (Size -> Operand -> Instr) -> Size -> NatM Register
triv_ucode instr size = trivialUCode size (instr size) x
-- signed or unsigned extension.
integerExtend :: Width -> Width
-> (Size -> Operand -> Operand -> Instr)
-> CmmExpr -> NatM Register
integerExtend from to instr expr = do
(reg,e_code) <- if from == W8 then getByteReg expr
else getSomeReg expr
let
code dst =
e_code `snocOL`
instr (intSize from) (OpReg reg) (OpReg dst)
return (Any (intSize to) code)
toI8Reg :: Width -> CmmExpr -> NatM Register
toI8Reg new_rep expr
= do codefn <- getAnyReg expr
return (Any (intSize new_rep) codefn)
-- HACK: use getAnyReg to get a byte-addressable register.
-- If the source was a Fixed register, this will add the
-- mov instruction to put it into the desired destination.
-- We're assuming that the destination won't be a fixed
-- non-byte-addressable register; it won't be, because all
-- fixed registers are word-sized.
toI16Reg = toI8Reg -- for now
conversionNop :: Size -> CmmExpr -> NatM Register
conversionNop new_size expr
= do e_code <- getRegister' dflags is32Bit expr
return (swizzleRegisterRep e_code new_size) | 4,664 | getRegister' dflags is32Bit (CmmMachOp mop [x]) = do -- unary MachOps
sse2 <- sse2Enabled
case mop of
MO_F_Neg w
| sse2 -> sse2NegCode w x
| otherwise -> trivialUFCode FF80 (GNEG FF80) x
MO_S_Neg w -> triv_ucode NEGI (intSize w)
MO_Not w -> triv_ucode NOT (intSize w)
-- Nop conversions
MO_UU_Conv W32 W8 -> toI8Reg W32 x
MO_SS_Conv W32 W8 -> toI8Reg W32 x
MO_UU_Conv W16 W8 -> toI8Reg W16 x
MO_SS_Conv W16 W8 -> toI8Reg W16 x
MO_UU_Conv W32 W16 -> toI16Reg W32 x
MO_SS_Conv W32 W16 -> toI16Reg W32 x
MO_UU_Conv W64 W32 | not is32Bit -> conversionNop II64 x
MO_SS_Conv W64 W32 | not is32Bit -> conversionNop II64 x
MO_UU_Conv W64 W16 | not is32Bit -> toI16Reg W64 x
MO_SS_Conv W64 W16 | not is32Bit -> toI16Reg W64 x
MO_UU_Conv W64 W8 | not is32Bit -> toI8Reg W64 x
MO_SS_Conv W64 W8 | not is32Bit -> toI8Reg W64 x
MO_UU_Conv rep1 rep2 | rep1 == rep2 -> conversionNop (intSize rep1) x
MO_SS_Conv rep1 rep2 | rep1 == rep2 -> conversionNop (intSize rep1) x
-- widenings
MO_UU_Conv W8 W32 -> integerExtend W8 W32 MOVZxL x
MO_UU_Conv W16 W32 -> integerExtend W16 W32 MOVZxL x
MO_UU_Conv W8 W16 -> integerExtend W8 W16 MOVZxL x
MO_SS_Conv W8 W32 -> integerExtend W8 W32 MOVSxL x
MO_SS_Conv W16 W32 -> integerExtend W16 W32 MOVSxL x
MO_SS_Conv W8 W16 -> integerExtend W8 W16 MOVSxL x
MO_UU_Conv W8 W64 | not is32Bit -> integerExtend W8 W64 MOVZxL x
MO_UU_Conv W16 W64 | not is32Bit -> integerExtend W16 W64 MOVZxL x
MO_UU_Conv W32 W64 | not is32Bit -> integerExtend W32 W64 MOVZxL x
MO_SS_Conv W8 W64 | not is32Bit -> integerExtend W8 W64 MOVSxL x
MO_SS_Conv W16 W64 | not is32Bit -> integerExtend W16 W64 MOVSxL x
MO_SS_Conv W32 W64 | not is32Bit -> integerExtend W32 W64 MOVSxL x
-- for 32-to-64 bit zero extension, amd64 uses an ordinary movl.
-- However, we don't want the register allocator to throw it
-- away as an unnecessary reg-to-reg move, so we keep it in
-- the form of a movzl and print it as a movl later.
MO_FF_Conv W32 W64
| sse2 -> coerceFP2FP W64 x
| otherwise -> conversionNop FF80 x
MO_FF_Conv W64 W32 -> coerceFP2FP W32 x
MO_FS_Conv from to -> coerceFP2Int from to x
MO_SF_Conv from to -> coerceInt2FP from to x
MO_V_Insert {} -> needLlvm
MO_V_Extract {} -> needLlvm
MO_V_Add {} -> needLlvm
MO_V_Sub {} -> needLlvm
MO_V_Mul {} -> needLlvm
MO_VS_Quot {} -> needLlvm
MO_VS_Rem {} -> needLlvm
MO_VS_Neg {} -> needLlvm
MO_VU_Quot {} -> needLlvm
MO_VU_Rem {} -> needLlvm
MO_VF_Insert {} -> needLlvm
MO_VF_Extract {} -> needLlvm
MO_VF_Add {} -> needLlvm
MO_VF_Sub {} -> needLlvm
MO_VF_Mul {} -> needLlvm
MO_VF_Quot {} -> needLlvm
MO_VF_Neg {} -> needLlvm
_other -> pprPanic "getRegister" (pprMachOp mop)
where
triv_ucode :: (Size -> Operand -> Instr) -> Size -> NatM Register
triv_ucode instr size = trivialUCode size (instr size) x
-- signed or unsigned extension.
integerExtend :: Width -> Width
-> (Size -> Operand -> Operand -> Instr)
-> CmmExpr -> NatM Register
integerExtend from to instr expr = do
(reg,e_code) <- if from == W8 then getByteReg expr
else getSomeReg expr
let
code dst =
e_code `snocOL`
instr (intSize from) (OpReg reg) (OpReg dst)
return (Any (intSize to) code)
toI8Reg :: Width -> CmmExpr -> NatM Register
toI8Reg new_rep expr
= do codefn <- getAnyReg expr
return (Any (intSize new_rep) codefn)
-- HACK: use getAnyReg to get a byte-addressable register.
-- If the source was a Fixed register, this will add the
-- mov instruction to put it into the desired destination.
-- We're assuming that the destination won't be a fixed
-- non-byte-addressable register; it won't be, because all
-- fixed registers are word-sized.
toI16Reg = toI8Reg -- for now
conversionNop :: Size -> CmmExpr -> NatM Register
conversionNop new_size expr
= do e_code <- getRegister' dflags is32Bit expr
return (swizzleRegisterRep e_code new_size) | 4,664 | false | false | 1 | 13 | 1,561 | 1,353 | 613 | 740 | null | null |
lally/orgmode | src/Data/OrgMode/OrgDocView.hs | bsd-3-clause | mergeSorted xl@(x:xs) yl@(y:ys) =
case compare x y of
EQ -> x:(mergeSorted xs yl)
LT -> x:(mergeSorted xs yl)
GT -> y:(mergeSorted xl ys) | 151 | mergeSorted xl@(x:xs) yl@(y:ys) =
case compare x y of
EQ -> x:(mergeSorted xs yl)
LT -> x:(mergeSorted xs yl)
GT -> y:(mergeSorted xl ys) | 151 | mergeSorted xl@(x:xs) yl@(y:ys) =
case compare x y of
EQ -> x:(mergeSorted xs yl)
LT -> x:(mergeSorted xs yl)
GT -> y:(mergeSorted xl ys) | 151 | false | false | 0 | 10 | 37 | 94 | 48 | 46 | null | null |
google/codeworld | codeworld-auth/app/Main.hs | apache-2.0 | pDumpAccounts :: Parser Command
pDumpAccounts = DumpAccounts <$> pStore | 71 | pDumpAccounts :: Parser Command
pDumpAccounts = DumpAccounts <$> pStore | 71 | pDumpAccounts = DumpAccounts <$> pStore | 39 | false | true | 1 | 6 | 8 | 22 | 9 | 13 | null | null |
HJvT/hdirect | src/Parser.hs | bsd-3-clause | action_89 x = happyTcHack x happyReduce_46 | 42 | action_89 x = happyTcHack x happyReduce_46 | 42 | action_89 x = happyTcHack x happyReduce_46 | 42 | false | false | 0 | 5 | 5 | 14 | 6 | 8 | null | null |
bagl/takusen-oracle | Database/Test/Enumerator.hs | bsd-3-clause | sqlBindString = "select ? from tdual union select ? from tdual order by 1" | 74 | sqlBindString = "select ? from tdual union select ? from tdual order by 1" | 74 | sqlBindString = "select ? from tdual union select ? from tdual order by 1" | 74 | false | false | 1 | 5 | 13 | 10 | 3 | 7 | null | null |
ezyang/ghc | compiler/types/TyCoRep.hs | bsd-3-clause | tidyType env (CoercionTy co) = CoercionTy $! (tidyCo env co) | 65 | tidyType env (CoercionTy co) = CoercionTy $! (tidyCo env co) | 65 | tidyType env (CoercionTy co) = CoercionTy $! (tidyCo env co) | 65 | false | false | 0 | 7 | 14 | 31 | 14 | 17 | null | null |
giorgidze/HCodecs | src/Codec/Internal/TestSuite.hs | bsd-3-clause | testParserBuilder :: IO ()
testParserBuilder = do
putStrLn "TESTING PARSING AND BUILDING OF NUMERICAL TYPES"
quickCheck $ roundTrip putWord8 getWord8
quickCheck $ roundTrip putWord16be getWord16be
quickCheck $ roundTrip putWord16le getWord16le
quickCheck $ \w -> roundTrip putWord24be getWord24be (w .&. 0xFFFFFF)
quickCheck $ \w -> roundTrip putWord24le getWord24le (w .&. 0xFFFFFF)
quickCheck $ roundTrip putWord32be getWord32be
quickCheck $ roundTrip putWord32le getWord32le
quickCheck $ roundTrip putWord64be getWord64be
quickCheck $ roundTrip putWord64le getWord64le
quickCheck $ roundTrip putInt8 getInt8
quickCheck $ roundTrip putInt16be getInt16be
quickCheck $ roundTrip putInt16le getInt16le
quickCheck $ roundTrip putInt32be getInt32be
quickCheck $ roundTrip putInt32le getInt32le
quickCheck $ roundTrip putInt64be getInt64be
quickCheck $ roundTrip putInt64le getInt64le
quickCheck $ roundTrip putWordHost getWordHost
quickCheck $ roundTrip putWord16host getWord16host
quickCheck $ roundTrip putWord32host getWord32host
quickCheck $ roundTrip putWord64host getWord64host
quickCheck $ roundTrip putVarLenBe getVarLenBe
quickCheck $ roundTrip putVarLenLe getVarLenLe
putStrLn "TESTING PARSING AND BUILDING OF String and ByteString"
quickCheck $ \s1 s2 -> roundTrip (\s -> putString s `mappend` putString s2) (getString $ length s1) s1
quickCheck $ \s1 s2 -> roundTrip (\s -> fromByteString s `mappend` fromByteString s2) (getByteString $ B.length s1) s1
quickCheck $ \s1 s2 -> roundTrip (\s -> fromLazyByteString s `mappend` fromLazyByteString s2) (getLazyByteString $ L.length s1) s1
quickCheck $ \bs -> roundTrip fromLazyByteString getRemainingLazyByteString bs | 1,734 | testParserBuilder :: IO ()
testParserBuilder = do
putStrLn "TESTING PARSING AND BUILDING OF NUMERICAL TYPES"
quickCheck $ roundTrip putWord8 getWord8
quickCheck $ roundTrip putWord16be getWord16be
quickCheck $ roundTrip putWord16le getWord16le
quickCheck $ \w -> roundTrip putWord24be getWord24be (w .&. 0xFFFFFF)
quickCheck $ \w -> roundTrip putWord24le getWord24le (w .&. 0xFFFFFF)
quickCheck $ roundTrip putWord32be getWord32be
quickCheck $ roundTrip putWord32le getWord32le
quickCheck $ roundTrip putWord64be getWord64be
quickCheck $ roundTrip putWord64le getWord64le
quickCheck $ roundTrip putInt8 getInt8
quickCheck $ roundTrip putInt16be getInt16be
quickCheck $ roundTrip putInt16le getInt16le
quickCheck $ roundTrip putInt32be getInt32be
quickCheck $ roundTrip putInt32le getInt32le
quickCheck $ roundTrip putInt64be getInt64be
quickCheck $ roundTrip putInt64le getInt64le
quickCheck $ roundTrip putWordHost getWordHost
quickCheck $ roundTrip putWord16host getWord16host
quickCheck $ roundTrip putWord32host getWord32host
quickCheck $ roundTrip putWord64host getWord64host
quickCheck $ roundTrip putVarLenBe getVarLenBe
quickCheck $ roundTrip putVarLenLe getVarLenLe
putStrLn "TESTING PARSING AND BUILDING OF String and ByteString"
quickCheck $ \s1 s2 -> roundTrip (\s -> putString s `mappend` putString s2) (getString $ length s1) s1
quickCheck $ \s1 s2 -> roundTrip (\s -> fromByteString s `mappend` fromByteString s2) (getByteString $ B.length s1) s1
quickCheck $ \s1 s2 -> roundTrip (\s -> fromLazyByteString s `mappend` fromLazyByteString s2) (getLazyByteString $ L.length s1) s1
quickCheck $ \bs -> roundTrip fromLazyByteString getRemainingLazyByteString bs | 1,734 | testParserBuilder = do
putStrLn "TESTING PARSING AND BUILDING OF NUMERICAL TYPES"
quickCheck $ roundTrip putWord8 getWord8
quickCheck $ roundTrip putWord16be getWord16be
quickCheck $ roundTrip putWord16le getWord16le
quickCheck $ \w -> roundTrip putWord24be getWord24be (w .&. 0xFFFFFF)
quickCheck $ \w -> roundTrip putWord24le getWord24le (w .&. 0xFFFFFF)
quickCheck $ roundTrip putWord32be getWord32be
quickCheck $ roundTrip putWord32le getWord32le
quickCheck $ roundTrip putWord64be getWord64be
quickCheck $ roundTrip putWord64le getWord64le
quickCheck $ roundTrip putInt8 getInt8
quickCheck $ roundTrip putInt16be getInt16be
quickCheck $ roundTrip putInt16le getInt16le
quickCheck $ roundTrip putInt32be getInt32be
quickCheck $ roundTrip putInt32le getInt32le
quickCheck $ roundTrip putInt64be getInt64be
quickCheck $ roundTrip putInt64le getInt64le
quickCheck $ roundTrip putWordHost getWordHost
quickCheck $ roundTrip putWord16host getWord16host
quickCheck $ roundTrip putWord32host getWord32host
quickCheck $ roundTrip putWord64host getWord64host
quickCheck $ roundTrip putVarLenBe getVarLenBe
quickCheck $ roundTrip putVarLenLe getVarLenLe
putStrLn "TESTING PARSING AND BUILDING OF String and ByteString"
quickCheck $ \s1 s2 -> roundTrip (\s -> putString s `mappend` putString s2) (getString $ length s1) s1
quickCheck $ \s1 s2 -> roundTrip (\s -> fromByteString s `mappend` fromByteString s2) (getByteString $ B.length s1) s1
quickCheck $ \s1 s2 -> roundTrip (\s -> fromLazyByteString s `mappend` fromLazyByteString s2) (getLazyByteString $ L.length s1) s1
quickCheck $ \bs -> roundTrip fromLazyByteString getRemainingLazyByteString bs | 1,707 | false | true | 0 | 13 | 268 | 496 | 227 | 269 | null | null |
deepfire/Ruin | Development/Ruin.hs | bsd-2-clause | buildable_output (Buildable _ (Target _ _ _ file _ _) _ _ _ _ _) = file | 100 | buildable_output (Buildable _ (Target _ _ _ file _ _) _ _ _ _ _) = file | 100 | buildable_output (Buildable _ (Target _ _ _ file _ _) _ _ _ _ _) = file | 100 | false | false | 0 | 9 | 45 | 43 | 21 | 22 | null | null |
phylake/avm3 | abc/util.hs | mit | toBytes {- 0x43 -} (CallMethod u30_1 u30_2) = 1 + u30Bytes u30_1 + u30Bytes u30_2 | 81 | toBytes {- 0x43 -} (CallMethod u30_1 u30_2) = 1 + u30Bytes u30_1 + u30Bytes u30_2 | 81 | toBytes {- 0x43 -} (CallMethod u30_1 u30_2) = 1 + u30Bytes u30_1 + u30Bytes u30_2 | 81 | false | false | 0 | 7 | 14 | 32 | 15 | 17 | null | null |
tinco/nanc | Nanc/IR/Expression/Binary.hs | mit | binaryOp ts CRmdOp a b = liftM2 (,) (srem (qualifiedTypeToType ts (snd a)) (fst a) (fst b)) (return $ snd a) | 108 | binaryOp ts CRmdOp a b = liftM2 (,) (srem (qualifiedTypeToType ts (snd a)) (fst a) (fst b)) (return $ snd a) | 108 | binaryOp ts CRmdOp a b = liftM2 (,) (srem (qualifiedTypeToType ts (snd a)) (fst a) (fst b)) (return $ snd a) | 108 | false | false | 0 | 11 | 20 | 71 | 35 | 36 | null | null |
mit-plv/riscv-semantics | src/Spec/ExecuteA64.hs | bsd-3-clause | execute :: forall p t. (RiscvMachine p t) => InstructionA64 -> p ()
-- begin ast
execute (Lr_d rd rs1 aqrl) = do
a <- getRegister rs1
addr <- translate Load 8 a
makeReservation addr
x <- loadDouble Execute addr
setRegister rd (int64ToReg x) | 250 | execute :: forall p t. (RiscvMachine p t) => InstructionA64 -> p ()
execute (Lr_d rd rs1 aqrl) = do
a <- getRegister rs1
addr <- translate Load 8 a
makeReservation addr
x <- loadDouble Execute addr
setRegister rd (int64ToReg x) | 237 | execute (Lr_d rd rs1 aqrl) = do
a <- getRegister rs1
addr <- translate Load 8 a
makeReservation addr
x <- loadDouble Execute addr
setRegister rd (int64ToReg x) | 169 | true | true | 0 | 9 | 53 | 107 | 50 | 57 | null | null |
davidpdrsn/alisp | src/CodeGen/JsToStr.hs | bsd-3-clause | exprToStrSym :: String -> JS.Expr -> JS.Expr -> String
exprToStrSym s a b = exprToStr a ++ s ++ exprToStr b | 107 | exprToStrSym :: String -> JS.Expr -> JS.Expr -> String
exprToStrSym s a b = exprToStr a ++ s ++ exprToStr b | 107 | exprToStrSym s a b = exprToStr a ++ s ++ exprToStr b | 52 | false | true | 0 | 9 | 20 | 53 | 24 | 29 | null | null |
nomeata/ghc | compiler/llvmGen/LlvmCodeGen/Data.hs | bsd-3-clause | isSecConstant UninitialisedData = False | 45 | isSecConstant UninitialisedData = False | 45 | isSecConstant UninitialisedData = False | 45 | false | false | 0 | 4 | 9 | 10 | 4 | 6 | null | null |
dolio/vector | Data/Vector.hs | bsd-3-clause | minimum = G.minimum | 19 | minimum = G.minimum | 19 | minimum = G.minimum | 19 | false | false | 1 | 6 | 2 | 12 | 4 | 8 | null | null |
tkonolige/dbignore | bytestring-trie/src/Data/Trie/Internal.hs | bsd-3-clause | showTrie :: (Show a) => Trie a -> String
showTrie t = shows' id t ""
where
spaces f = map (const ' ') (f "")
shows' _ Empty = (".\n"++)
shows' ss (Branch p m l r) =
let s' = ("--"++) . shows p . (","++) . shows m . ("-+"++)
ss' = ss . (tail (spaces s') ++)
in s' . shows' (ss' . ("|"++)) l
. ss' . ("|\n"++)
. ss' . ("`"++) . shows' (ss' . (" "++)) r
shows' ss (Arc k mv t') =
let s' = ("--"++) . shows k
. maybe id (\v -> ("-("++) . shows v . (")"++)) mv
. ("--"++)
in s' . shows' (ss . (spaces s' ++)) t'
-- TODO?? a Read instance? hrm... should I?
-- TODO: consider an instance more like the new one for Data.Map. Better? | 779 | showTrie :: (Show a) => Trie a -> String
showTrie t = shows' id t ""
where
spaces f = map (const ' ') (f "")
shows' _ Empty = (".\n"++)
shows' ss (Branch p m l r) =
let s' = ("--"++) . shows p . (","++) . shows m . ("-+"++)
ss' = ss . (tail (spaces s') ++)
in s' . shows' (ss' . ("|"++)) l
. ss' . ("|\n"++)
. ss' . ("`"++) . shows' (ss' . (" "++)) r
shows' ss (Arc k mv t') =
let s' = ("--"++) . shows k
. maybe id (\v -> ("-("++) . shows v . (")"++)) mv
. ("--"++)
in s' . shows' (ss . (spaces s' ++)) t'
-- TODO?? a Read instance? hrm... should I?
-- TODO: consider an instance more like the new one for Data.Map. Better? | 779 | showTrie t = shows' id t ""
where
spaces f = map (const ' ') (f "")
shows' _ Empty = (".\n"++)
shows' ss (Branch p m l r) =
let s' = ("--"++) . shows p . (","++) . shows m . ("-+"++)
ss' = ss . (tail (spaces s') ++)
in s' . shows' (ss' . ("|"++)) l
. ss' . ("|\n"++)
. ss' . ("`"++) . shows' (ss' . (" "++)) r
shows' ss (Arc k mv t') =
let s' = ("--"++) . shows k
. maybe id (\v -> ("-("++) . shows v . (")"++)) mv
. ("--"++)
in s' . shows' (ss . (spaces s' ++)) t'
-- TODO?? a Read instance? hrm... should I?
-- TODO: consider an instance more like the new one for Data.Map. Better? | 738 | false | true | 5 | 16 | 297 | 361 | 184 | 177 | null | null |
urbanslug/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | isRuntimeUnkSkol :: TyVar -> Bool
-- Called only in TcErrors; see Note [Runtime skolems] there
isRuntimeUnkSkol x
| isTcTyVar x, RuntimeUnk <- tcTyVarDetails x = True
| otherwise = False | 224 | isRuntimeUnkSkol :: TyVar -> Bool
isRuntimeUnkSkol x
| isTcTyVar x, RuntimeUnk <- tcTyVarDetails x = True
| otherwise = False | 163 | isRuntimeUnkSkol x
| isTcTyVar x, RuntimeUnk <- tcTyVarDetails x = True
| otherwise = False | 129 | true | true | 1 | 9 | 67 | 47 | 22 | 25 | null | null |
kairuku/stack | src/Stack/Docker.hs | bsd-3-clause | -- | Command-line argument for "docker"
dockerCmdName :: String
dockerCmdName = "docker" | 88 | dockerCmdName :: String
dockerCmdName = "docker" | 48 | dockerCmdName = "docker" | 24 | true | true | 0 | 6 | 11 | 19 | 8 | 11 | null | null |
brendanhay/gogol | gogol-dfareporting/gen/Network/Google/Resource/DFAReporting/FloodlightActivities/Get.hs | mpl-2.0 | -- | User profile ID associated with this request.
fProFileId :: Lens' FloodlightActivitiesGet Int64
fProFileId
= lens _fProFileId (\ s a -> s{_fProFileId = a}) .
_Coerce | 178 | fProFileId :: Lens' FloodlightActivitiesGet Int64
fProFileId
= lens _fProFileId (\ s a -> s{_fProFileId = a}) .
_Coerce | 127 | fProFileId
= lens _fProFileId (\ s a -> s{_fProFileId = a}) .
_Coerce | 77 | true | true | 1 | 10 | 34 | 49 | 24 | 25 | null | null |
Michaelt293/Lipid-Haskell | test/Lipid/GlycerolipidSpec.hs | gpl-3.0 | spec :: Spec
spec = do
return () | 34 | spec :: Spec
spec = do
return () | 34 | spec = do
return () | 21 | false | true | 0 | 9 | 9 | 26 | 10 | 16 | null | null |
mchakravarty/gloss-game | Graphics/Gloss/Game.hs | bsd-3-clause | -- |Turn a JPEG file into a picture.
--
-- NB: Define loaded pictures on the toplevel to avoid reloading.
--
jpg :: FilePath -> Picture
jpg fname = maybe (text "JPEG ERROR") id (unsafePerformIO $ loadJuicyJPG fname) | 215 | jpg :: FilePath -> Picture
jpg fname = maybe (text "JPEG ERROR") id (unsafePerformIO $ loadJuicyJPG fname) | 106 | jpg fname = maybe (text "JPEG ERROR") id (unsafePerformIO $ loadJuicyJPG fname) | 79 | true | true | 0 | 8 | 37 | 48 | 25 | 23 | null | null |
Bolpat/CardGames | src/Utility.hs | gpl-3.0 | -- | returns a list of indices, where at any index the element of the given list is a maximal element, according to the ordering funciton.
indicesOfMaximaBy :: (a -> a -> Ordering) -> [a] -> [Int]
indicesOfMaximaBy _ [] = [] | 231 | indicesOfMaximaBy :: (a -> a -> Ordering) -> [a] -> [Int]
indicesOfMaximaBy _ [] = [] | 92 | indicesOfMaximaBy _ [] = [] | 34 | true | true | 0 | 8 | 48 | 46 | 25 | 21 | null | null |
ssaavedra/liquidhaskell | tests/pos/maybe3.hs | bsd-3-clause | -- -> hi : {v: Maybe {v: a | ( isJust(hi0) && (v = fromJust(hi0)) && ((isJust(lo)) => (v >= fromJust(lo))))} | v = hi0 }
{-@ foo :: lo0 : Maybe a
-> lo : {v: Maybe {v: a | (isJust(lo0) && (v = fromJust(lo0))) } | v = lo0 }
-> hi0 : Maybe a
-> hi : {v: Maybe {v: a | ( isJust(hi0) && (v = fromJust(hi0))) }
| (((isJust(lo) && isJust(v)) => (fromJust(v) >= fromJust(lo))) && (v = hi0)) }
-> Bool @-}
foo :: Maybe a -> Maybe a -> Maybe a -> Maybe a -> Bool
foo lo0 lo hi0 hi = bar (id hi) (id lo) | 557 | foo :: Maybe a -> Maybe a -> Maybe a -> Maybe a -> Bool
foo lo0 lo hi0 hi = bar (id hi) (id lo) | 95 | foo lo0 lo hi0 hi = bar (id hi) (id lo) | 39 | true | true | 0 | 10 | 177 | 73 | 33 | 40 | null | null |
yousufmsoliman/music | Source (Haskell)/Control.hs | gpl-3.0 | testTime (TL x _) = x | 21 | testTime (TL x _) = x | 21 | testTime (TL x _) = x | 21 | false | false | 0 | 7 | 5 | 17 | 8 | 9 | null | null |
cullina/Extractor | src/UnbalancedTree.hs | bsd-3-clause | unbalancedSubTree' (False:bs) =
let l = unbalancedSubTree' bs
r = newSubTree (length bs)
in Branch (sizeOf l + sizeOf r) l r | 141 | unbalancedSubTree' (False:bs) =
let l = unbalancedSubTree' bs
r = newSubTree (length bs)
in Branch (sizeOf l + sizeOf r) l r | 141 | unbalancedSubTree' (False:bs) =
let l = unbalancedSubTree' bs
r = newSubTree (length bs)
in Branch (sizeOf l + sizeOf r) l r | 141 | false | false | 0 | 11 | 38 | 64 | 30 | 34 | null | null |
mettekou/ghc | compiler/basicTypes/Literal.hs | bsd-3-clause | pprLiteral add_par (LitInteger i _) = pprIntegerVal add_par i | 61 | pprLiteral add_par (LitInteger i _) = pprIntegerVal add_par i | 61 | pprLiteral add_par (LitInteger i _) = pprIntegerVal add_par i | 61 | false | false | 0 | 7 | 8 | 24 | 11 | 13 | null | null |
hvr/hackage-cli | lib/Distribution/Server/Util/CabalRevisions.hs | gpl-3.0 | logChange :: Change -> CheckM ()
logChange change = CheckM (tell [change]) | 74 | logChange :: Change -> CheckM ()
logChange change = CheckM (tell [change]) | 74 | logChange change = CheckM (tell [change]) | 41 | false | true | 0 | 8 | 11 | 35 | 17 | 18 | null | null |
ntc2/optparse-applicative | Options/Applicative/Extra.hs | bsd-3-clause | -- | A hidden \"helper\" option which always fails.
helper :: Parser (a -> a)
helper = abortOption ShowHelpText $ mconcat
[ long "help"
, short 'h'
, help "Show this help text"
, hidden ] | 195 | helper :: Parser (a -> a)
helper = abortOption ShowHelpText $ mconcat
[ long "help"
, short 'h'
, help "Show this help text"
, hidden ] | 143 | helper = abortOption ShowHelpText $ mconcat
[ long "help"
, short 'h'
, help "Show this help text"
, hidden ] | 117 | true | true | 0 | 7 | 43 | 53 | 27 | 26 | null | null |
tuturto/space-privateers | GameDefinition/Content/ItemKindActor.hs | bsd-3-clause | scout = warrior
{ iname = "scout"
, iaspects = [ AddMaxHP 40, AddMaxCalm 60, AddSpeed 25
, AddSight 4
, AddSkills $ EM.fromList [(AbProject, 2), (AbApply, 1)]]
, idesc = "Fast and keen scouts are essential any fighting force."
, ikit = [("fist", COrgan), ("foot", COrgan), ("eye 5", COrgan), ("sapient brain", COrgan),
("any arrow", CInv), ("any vial", CInv), ("any vial", CInv)]
} | 447 | scout = warrior
{ iname = "scout"
, iaspects = [ AddMaxHP 40, AddMaxCalm 60, AddSpeed 25
, AddSight 4
, AddSkills $ EM.fromList [(AbProject, 2), (AbApply, 1)]]
, idesc = "Fast and keen scouts are essential any fighting force."
, ikit = [("fist", COrgan), ("foot", COrgan), ("eye 5", COrgan), ("sapient brain", COrgan),
("any arrow", CInv), ("any vial", CInv), ("any vial", CInv)]
} | 447 | scout = warrior
{ iname = "scout"
, iaspects = [ AddMaxHP 40, AddMaxCalm 60, AddSpeed 25
, AddSight 4
, AddSkills $ EM.fromList [(AbProject, 2), (AbApply, 1)]]
, idesc = "Fast and keen scouts are essential any fighting force."
, ikit = [("fist", COrgan), ("foot", COrgan), ("eye 5", COrgan), ("sapient brain", COrgan),
("any arrow", CInv), ("any vial", CInv), ("any vial", CInv)]
} | 447 | false | false | 1 | 12 | 128 | 156 | 93 | 63 | null | null |
rueshyna/gogol | gogol-appengine/gen/Network/Google/Resource/AppEngine/Apps/Services/Versions/Get.hs | mpl-2.0 | -- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
asvgUploadType :: Lens' AppsServicesVersionsGet (Maybe Text)
asvgUploadType
= lens _asvgUploadType
(\ s a -> s{_asvgUploadType = a}) | 211 | asvgUploadType :: Lens' AppsServicesVersionsGet (Maybe Text)
asvgUploadType
= lens _asvgUploadType
(\ s a -> s{_asvgUploadType = a}) | 140 | asvgUploadType
= lens _asvgUploadType
(\ s a -> s{_asvgUploadType = a}) | 79 | true | true | 0 | 9 | 34 | 48 | 25 | 23 | null | null |
proger/cron | test/System/Cron/ParserSpec.hs | bsd-2-clause | spec :: Spec
spec = sequence_ [describeCronSchedule,
describeCronScheduleLoose,
describeCrontab,
describeCrontabEntry] | 172 | spec :: Spec
spec = sequence_ [describeCronSchedule,
describeCronScheduleLoose,
describeCrontab,
describeCrontabEntry] | 172 | spec = sequence_ [describeCronSchedule,
describeCronScheduleLoose,
describeCrontab,
describeCrontabEntry] | 159 | false | true | 0 | 6 | 63 | 32 | 16 | 16 | null | null |
bartavelle/publicsnippets | performanceparsing/06customparser.hs | bsd-3-clause | filetype :: Parser FileType
filetype = anyChar >>= maybe (fail "invalid file type") return . char2ft | 100 | filetype :: Parser FileType
filetype = anyChar >>= maybe (fail "invalid file type") return . char2ft | 100 | filetype = anyChar >>= maybe (fail "invalid file type") return . char2ft | 72 | false | true | 0 | 9 | 15 | 33 | 16 | 17 | null | null |
gnn/Hets | OWL2/Profiles.hs | gpl-2.0 | ontologyP :: Ontology -> Profiles
ontologyP ont =
let anns = ann ont
fr = ontFrames ont
in andProfileList [andList frame fr, andList annotations anns] | 166 | ontologyP :: Ontology -> Profiles
ontologyP ont =
let anns = ann ont
fr = ontFrames ont
in andProfileList [andList frame fr, andList annotations anns] | 166 | ontologyP ont =
let anns = ann ont
fr = ontFrames ont
in andProfileList [andList frame fr, andList annotations anns] | 132 | false | true | 0 | 9 | 40 | 59 | 28 | 31 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/playpen/hcpn/examples/critical_region.hs | unlicense | b_enter_critical :: Mark -> [Mark]
b_enter_critical m =
do
let shared_resource_marking = shared_resource m
let b_waiting_marking = b_waiting m
let b_in_critical_marking = b_in_critical m
((), shared_resource_marking) <- select $ shared_resource_marking
((), b_waiting_marking) <- select $ b_waiting_marking
if True
then return m{
shared_resource = shared_resource_marking
, b_waiting = b_waiting_marking
, b_in_critical = (()) : b_in_critical_marking
}
else fail "guard failed" | 579 | b_enter_critical :: Mark -> [Mark]
b_enter_critical m =
do
let shared_resource_marking = shared_resource m
let b_waiting_marking = b_waiting m
let b_in_critical_marking = b_in_critical m
((), shared_resource_marking) <- select $ shared_resource_marking
((), b_waiting_marking) <- select $ b_waiting_marking
if True
then return m{
shared_resource = shared_resource_marking
, b_waiting = b_waiting_marking
, b_in_critical = (()) : b_in_critical_marking
}
else fail "guard failed" | 578 | b_enter_critical m =
do
let shared_resource_marking = shared_resource m
let b_waiting_marking = b_waiting m
let b_in_critical_marking = b_in_critical m
((), shared_resource_marking) <- select $ shared_resource_marking
((), b_waiting_marking) <- select $ b_waiting_marking
if True
then return m{
shared_resource = shared_resource_marking
, b_waiting = b_waiting_marking
, b_in_critical = (()) : b_in_critical_marking
}
else fail "guard failed" | 543 | false | true | 0 | 14 | 160 | 147 | 73 | 74 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Generated/TextTrackList.hs | mit | -- | <https://developer.mozilla.org/en-US/docs/Web/API/TextTrackList.item Mozilla TextTrackList.item documentation>
item_ :: (MonadDOM m) => TextTrackList -> Word -> m ()
item_ self index
= liftDOM (void (self ^. jsf "item" [toJSVal index])) | 244 | item_ :: (MonadDOM m) => TextTrackList -> Word -> m ()
item_ self index
= liftDOM (void (self ^. jsf "item" [toJSVal index])) | 127 | item_ self index
= liftDOM (void (self ^. jsf "item" [toJSVal index])) | 72 | true | true | 0 | 12 | 31 | 70 | 34 | 36 | null | null |
andrewthad/vinyl-vectors | src/Data/Vector/Vinyl/Default/Empty/Monomorphic.hs | bsd-3-clause | -- Zipping
-- -------
-- -- | /O(min(m,n))/ Zip two vectors with the given function.
-- zipWith :: ( G.Vector u a, G.Vector v a'
-- , G.Vector u b, G.Vector v b'
-- , G.Vector u c, G.Vector v c'
-- ) => ((a,a') -> (b,b') -> (c,c'))
-- -> Vector u v (a,a') -> Vector u v (b,b') -> Vector u v (c,c')
-- zipWith = G.zipWith
-- {-# INLINE zipWith #-}
--
-- -- | Zip three vectors with the given function.
--
-- zipWith3 :: ( G.Vector u a, G.Vector v a'
-- , G.Vector u b, G.Vector v b'
-- , G.Vector u c, G.Vector v c'
-- , G.Vector u d, G.Vector v d'
-- ) => ((a,a') -> (b,b') -> (c,c') -> (d, d'))
-- -> Vector u v (a,a') -> Vector u v (b,b') -> Vector u v (c,c') -> Vector u v (d,d')
-- zipWith3 = G.zipWith3
-- {-# INLINE zipWith3 #-}
--
-- zipWith4 :: ( G.Vector u a, G.Vector v a'
-- , G.Vector u b, G.Vector v b'
-- , G.Vector u c, G.Vector v c'
-- , G.Vector u d, G.Vector v d'
-- , G.Vector u e, G.Vector v e'
-- ) => ((a,a') -> (b,b') -> (c,c') -> (d, d') -> (e,e'))
-- -> Vector u v (a,a') -> Vector u v (b,b') -> Vector u v (c,c') -> Vector u v (d,d') -> Vector u v (e,e')
-- zipWith4 = G.zipWith4
-- {-# INLINE zipWith4 #-}
--
-- zipWith5 :: ( G.Vector u a, G.Vector v a'
-- , G.Vector u b, G.Vector v b'
-- , G.Vector u c, G.Vector v c'
-- , G.Vector u d, G.Vector v d'
-- , G.Vector u e, G.Vector v e'
-- , G.Vector u f, G.Vector v f'
-- ) => ((a,a') -> (b,b') -> (c,c') -> (d, d') -> (e,e') -> (f,f'))
-- -> Vector u v (a,a') -> Vector u v (b,b') -> Vector u v (c,c') -> Vector u v (d,d') -> Vector u v (e,e') -> Vector u v (f,f')
-- zipWith5 = G.zipWith5
-- {-# INLINE zipWith5 #-}
--
-- zipWith6 :: ( G.Vector u a, G.Vector v a'
-- , G.Vector u b, G.Vector v b'
-- , G.Vector u c, G.Vector v c'
-- , G.Vector u d, G.Vector v d'
-- , G.Vector u e, G.Vector v e'
-- , G.Vector u f, G.Vector v f'
-- , G.Vector u g, G.Vector v g'
-- ) => ((a,a') -> (b,b') -> (c,c') -> (d, d') -> (e,e') -> (f,f') -> (g,g'))
-- -> Vector u v (a,a') -> Vector u v (b,b') -> Vector u v (c,c') -> Vector u v (d,d') -> Vector u v (e,e') -> Vector u v (f,f') -> Vector u v (g,g')
-- zipWith6 = G.zipWith6
-- {-# INLINE zipWith6 #-}
--
-- -- | /O(min(m,n))/ Zip two vectors with a function that also takes the
-- -- elements' indices.
-- izipWith :: ( G.Vector u a, G.Vector v a'
-- , G.Vector u b, G.Vector v b'
-- , G.Vector u c, G.Vector v c'
-- ) => (Int -> (a,a') -> (b,b') -> (c,c'))
-- -> Vector u v (a,a') -> Vector u v (b,b') -> Vector u v (c,c')
-- izipWith = G.izipWith
-- {-# INLINE izipWith #-}
--
-- -- | Zip three vectors and their indices with the given function.
-- izipWith3 :: ( G.Vector u a, G.Vector v a'
-- , G.Vector u b, G.Vector v b'
-- , G.Vector u c, G.Vector v c'
-- , G.Vector u d, G.Vector v d'
-- ) => (Int -> (a,a') -> (b,b') -> (c,c') -> (d, d'))
-- -> Vector u v (a,a') -> Vector u v (b,b') -> Vector u v (c,c') -> Vector u v (d,d')
-- izipWith3 = G.izipWith3
-- {-# INLINE izipWith3 #-}
--
-- izipWith4 :: ( G.Vector u a, G.Vector v a'
-- , G.Vector u b, G.Vector v b'
-- , G.Vector u c, G.Vector v c'
-- , G.Vector u d, G.Vector v d'
-- , G.Vector u e, G.Vector v e'
-- ) => (Int -> (a,a') -> (b,b') -> (c,c') -> (d, d') -> (e,e'))
-- -> Vector u v (a,a') -> Vector u v (b,b') -> Vector u v (c,c') -> Vector u v (d,d') -> Vector u v (e,e')
-- izipWith4 = G.izipWith4
-- {-# INLINE izipWith4 #-}
--
-- izipWith5 :: ( G.Vector u a, G.Vector v a'
-- , G.Vector u b, G.Vector v b'
-- , G.Vector u c, G.Vector v c'
-- , G.Vector u d, G.Vector v d'
-- , G.Vector u e, G.Vector v e'
-- , G.Vector u f, G.Vector v f'
-- ) => (Int -> (a,a') -> (b,b') -> (c,c') -> (d, d') -> (e,e') -> (f,f'))
-- -> Vector u v (a,a') -> Vector u v (b,b') -> Vector u v (c,c') -> Vector u v (d,d') -> Vector u v (e,e') -> Vector u v (f,f')
-- izipWith5 = G.izipWith5
-- {-# INLINE izipWith5 #-}
--
-- izipWith6 :: ( G.Vector u a, G.Vector v a'
-- , G.Vector u b, G.Vector v b'
-- , G.Vector u c, G.Vector v c'
-- , G.Vector u d, G.Vector v d'
-- , G.Vector u e, G.Vector v e'
-- , G.Vector u f, G.Vector v f'
-- , G.Vector u g, G.Vector v g'
-- ) => (Int -> (a,a') -> (b,b') -> (c,c') -> (d, d') -> (e,e') -> (f,f') -> (g,g'))
-- -> Vector u v (a,a') -> Vector u v (b,b') -> Vector u v (c,c') -> Vector u v (d,d') -> Vector u v (e,e') -> Vector u v (f,f') -> Vector u v (g,g')
-- izipWith6 = G.izipWith6
-- {-# INLINE izipWith6 #-}
-- Monadic zipping
-- ---------------
-- | /O(min(m,n))/ Zip the two vectors with the monadic action and yield a
-- vector of results
zipWithM :: (Monad m, G.Vector Vector (Rec Identity rs), G.Vector Vector (Rec Identity ss), G.Vector Vector (Rec Identity ts))
=> (Rec Identity rs -> Rec Identity ss -> m (Rec Identity ts)) -> Vector (Rec Identity rs) -> Vector (Rec Identity ss) -> m (Vector (Rec Identity ts))
zipWithM = G.zipWithM | 5,730 | zipWithM :: (Monad m, G.Vector Vector (Rec Identity rs), G.Vector Vector (Rec Identity ss), G.Vector Vector (Rec Identity ts))
=> (Rec Identity rs -> Rec Identity ss -> m (Rec Identity ts)) -> Vector (Rec Identity rs) -> Vector (Rec Identity ss) -> m (Vector (Rec Identity ts))
zipWithM = G.zipWithM | 308 | zipWithM = G.zipWithM | 21 | true | true | 0 | 13 | 2,015 | 270 | 189 | 81 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/Resources/RedshiftCluster.hs | mit | -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-clusterversion
rcClusterVersion :: Lens' RedshiftCluster (Maybe (Val Text))
rcClusterVersion = lens _redshiftClusterClusterVersion (\s a -> s { _redshiftClusterClusterVersion = a }) | 304 | rcClusterVersion :: Lens' RedshiftCluster (Maybe (Val Text))
rcClusterVersion = lens _redshiftClusterClusterVersion (\s a -> s { _redshiftClusterClusterVersion = a }) | 166 | rcClusterVersion = lens _redshiftClusterClusterVersion (\s a -> s { _redshiftClusterClusterVersion = a }) | 105 | true | true | 1 | 9 | 22 | 55 | 28 | 27 | null | null |
koba-e964/hayashii-mcc | zekamashi/RegAlloc.hs | bsd-3-clause | getLoc :: VId -> M VId
getLoc (VId nm) = do
x <- gets (fromJust . Map.lookup nm . regmap)
return $! VId $! show x | 117 | getLoc :: VId -> M VId
getLoc (VId nm) = do
x <- gets (fromJust . Map.lookup nm . regmap)
return $! VId $! show x | 117 | getLoc (VId nm) = do
x <- gets (fromJust . Map.lookup nm . regmap)
return $! VId $! show x | 94 | false | true | 0 | 13 | 29 | 71 | 32 | 39 | null | null |
green-haskell/ghc | compiler/nativeGen/Dwarf/Types.hs | bsd-3-clause | -- | Header for the .debug_frame section. Here we emit the "Common
-- Information Entry" record that etablishes general call frame
-- parameters and the default stack layout.
pprDwarfFrame :: DwarfFrame -> SDoc
pprDwarfFrame DwarfFrame{dwCieLabel=cieLabel,dwCieInit=cieInit,dwCieProcs=procs}
= sdocWithPlatform $ \plat ->
let cieStartLabel= mkAsmTempDerivedLabel cieLabel (fsLit "_start")
cieEndLabel = mkAsmTempEndLabel cieLabel
length = ppr cieEndLabel <> char '-' <> ppr cieStartLabel
spReg = dwarfGlobalRegNo plat Sp
retReg = dwarfReturnRegNo plat
wordSize = platformWordSize plat
pprInit (g, uw) = pprSetUnwind plat g (Nothing, uw)
in vcat [ ppr cieLabel <> colon
, pprData4' length -- Length of CIE
, ppr cieStartLabel <> colon
, pprData4' (ptext (sLit "-1"))
-- Common Information Entry marker (-1 = 0xf..f)
, pprByte 3 -- CIE version (we require DWARF 3)
, pprByte 0 -- Augmentation (none)
, pprByte 1 -- Code offset multiplicator
, pprByte (128-fromIntegral wordSize)
-- Data offset multiplicator
-- (stacks grow down => "-w" in signed LEB128)
, pprByte retReg -- virtual register holding return address
] $$
-- Initial unwind table
vcat (map pprInit $ Map.toList cieInit) $$
vcat [ -- RET = *CFA
pprByte (dW_CFA_offset+retReg)
, pprByte 0
-- Sp' = CFA
-- (we need to set this manually as our Sp register is
-- often not the architecture's default stack register)
, pprByte dW_CFA_val_offset
, pprLEBWord (fromIntegral spReg)
, pprLEBWord 0
] $$
wordAlign $$
ppr cieEndLabel <> colon $$
-- Procedure unwind tables
vcat (map (pprFrameProc cieLabel cieInit) procs) | 2,038 | pprDwarfFrame :: DwarfFrame -> SDoc
pprDwarfFrame DwarfFrame{dwCieLabel=cieLabel,dwCieInit=cieInit,dwCieProcs=procs}
= sdocWithPlatform $ \plat ->
let cieStartLabel= mkAsmTempDerivedLabel cieLabel (fsLit "_start")
cieEndLabel = mkAsmTempEndLabel cieLabel
length = ppr cieEndLabel <> char '-' <> ppr cieStartLabel
spReg = dwarfGlobalRegNo plat Sp
retReg = dwarfReturnRegNo plat
wordSize = platformWordSize plat
pprInit (g, uw) = pprSetUnwind plat g (Nothing, uw)
in vcat [ ppr cieLabel <> colon
, pprData4' length -- Length of CIE
, ppr cieStartLabel <> colon
, pprData4' (ptext (sLit "-1"))
-- Common Information Entry marker (-1 = 0xf..f)
, pprByte 3 -- CIE version (we require DWARF 3)
, pprByte 0 -- Augmentation (none)
, pprByte 1 -- Code offset multiplicator
, pprByte (128-fromIntegral wordSize)
-- Data offset multiplicator
-- (stacks grow down => "-w" in signed LEB128)
, pprByte retReg -- virtual register holding return address
] $$
-- Initial unwind table
vcat (map pprInit $ Map.toList cieInit) $$
vcat [ -- RET = *CFA
pprByte (dW_CFA_offset+retReg)
, pprByte 0
-- Sp' = CFA
-- (we need to set this manually as our Sp register is
-- often not the architecture's default stack register)
, pprByte dW_CFA_val_offset
, pprLEBWord (fromIntegral spReg)
, pprLEBWord 0
] $$
wordAlign $$
ppr cieEndLabel <> colon $$
-- Procedure unwind tables
vcat (map (pprFrameProc cieLabel cieInit) procs) | 1,863 | pprDwarfFrame DwarfFrame{dwCieLabel=cieLabel,dwCieInit=cieInit,dwCieProcs=procs}
= sdocWithPlatform $ \plat ->
let cieStartLabel= mkAsmTempDerivedLabel cieLabel (fsLit "_start")
cieEndLabel = mkAsmTempEndLabel cieLabel
length = ppr cieEndLabel <> char '-' <> ppr cieStartLabel
spReg = dwarfGlobalRegNo plat Sp
retReg = dwarfReturnRegNo plat
wordSize = platformWordSize plat
pprInit (g, uw) = pprSetUnwind plat g (Nothing, uw)
in vcat [ ppr cieLabel <> colon
, pprData4' length -- Length of CIE
, ppr cieStartLabel <> colon
, pprData4' (ptext (sLit "-1"))
-- Common Information Entry marker (-1 = 0xf..f)
, pprByte 3 -- CIE version (we require DWARF 3)
, pprByte 0 -- Augmentation (none)
, pprByte 1 -- Code offset multiplicator
, pprByte (128-fromIntegral wordSize)
-- Data offset multiplicator
-- (stacks grow down => "-w" in signed LEB128)
, pprByte retReg -- virtual register holding return address
] $$
-- Initial unwind table
vcat (map pprInit $ Map.toList cieInit) $$
vcat [ -- RET = *CFA
pprByte (dW_CFA_offset+retReg)
, pprByte 0
-- Sp' = CFA
-- (we need to set this manually as our Sp register is
-- often not the architecture's default stack register)
, pprByte dW_CFA_val_offset
, pprLEBWord (fromIntegral spReg)
, pprLEBWord 0
] $$
wordAlign $$
ppr cieEndLabel <> colon $$
-- Procedure unwind tables
vcat (map (pprFrameProc cieLabel cieInit) procs) | 1,827 | true | true | 0 | 21 | 706 | 367 | 192 | 175 | null | null |
olsner/ghc | compiler/cmm/SMRep.hs | bsd-3-clause | isThunkRep (HeapRep _ _ _ ThunkSelector{}) = True | 49 | isThunkRep (HeapRep _ _ _ ThunkSelector{}) = True | 49 | isThunkRep (HeapRep _ _ _ ThunkSelector{}) = True | 49 | false | false | 0 | 7 | 7 | 26 | 12 | 14 | null | null |
johanneshilden/trombone | Keyman.hs | bsd-3-clause | getConfig (_:xs) hd = getConfig xs hd | 45 | getConfig (_:xs) hd = getConfig xs hd | 45 | getConfig (_:xs) hd = getConfig xs hd | 45 | false | false | 1 | 6 | 14 | 23 | 11 | 12 | null | null |
peti/funcmp | FMP/Color.hs | gpl-3.0 | graduateHigh :: Color -> Color -> Double -> Color
graduateHigh c1 c2 a = graduate c1 c2 a 256 | 120 | graduateHigh :: Color -> Color -> Double -> Color
graduateHigh c1 c2 a = graduate c1 c2 a 256 | 120 | graduateHigh c1 c2 a = graduate c1 c2 a 256 | 53 | false | true | 0 | 7 | 45 | 39 | 19 | 20 | null | null |
leshchevds/ganeti | test/hs/Test/Ganeti/OpCodes.hs | bsd-2-clause | arbitraryDataCollectorInterval :: Gen (Maybe (GenericContainer String Int))
arbitraryDataCollectorInterval = do
els <- listOf . elements $ CU.toList C.dataCollectorNames
intervals <- vector $ length els
genMaybe . return . containerFromList $ zip els intervals | 267 | arbitraryDataCollectorInterval :: Gen (Maybe (GenericContainer String Int))
arbitraryDataCollectorInterval = do
els <- listOf . elements $ CU.toList C.dataCollectorNames
intervals <- vector $ length els
genMaybe . return . containerFromList $ zip els intervals | 267 | arbitraryDataCollectorInterval = do
els <- listOf . elements $ CU.toList C.dataCollectorNames
intervals <- vector $ length els
genMaybe . return . containerFromList $ zip els intervals | 191 | false | true | 0 | 10 | 39 | 84 | 39 | 45 | null | null |
ptol/oczor | src/Oczor/CodeGen/CodeGenElisp.hs | mit | parensNest [] = parens empty | 28 | parensNest [] = parens empty | 28 | parensNest [] = parens empty | 28 | false | false | 1 | 5 | 4 | 18 | 6 | 12 | null | null |
tnrangwi/haskellGames4iPad | Tools.hs | mit | -- | Paint String array to screen.
paint :: [String] -> IO ()
paint s = mapM_ putStrLn [""] >> mapM_ putStrLn s >> (mapM_ putStrLn $ take (Settings.screenSize - 1 - length s) (repeat "")) | 187 | paint :: [String] -> IO ()
paint s = mapM_ putStrLn [""] >> mapM_ putStrLn s >> (mapM_ putStrLn $ take (Settings.screenSize - 1 - length s) (repeat "")) | 152 | paint s = mapM_ putStrLn [""] >> mapM_ putStrLn s >> (mapM_ putStrLn $ take (Settings.screenSize - 1 - length s) (repeat "")) | 125 | true | true | 3 | 10 | 35 | 83 | 41 | 42 | null | null |
aaronc/Idris-dev | src/Idris/Reflection.hs | bsd-3-clause | reifyTTApp t [tt]
| t == reflm "UType" = liftM UType (reifyUniverse tt) | 82 | reifyTTApp t [tt]
| t == reflm "UType" = liftM UType (reifyUniverse tt) | 82 | reifyTTApp t [tt]
| t == reflm "UType" = liftM UType (reifyUniverse tt) | 82 | false | false | 0 | 9 | 23 | 40 | 17 | 23 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/ResourceProperties/ElasticLoadBalancingV2ListenerRuleAuthenticateOidcConfig.hs | mit | -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-listenerrule-authenticateoidcconfig.html#cfn-elasticloadbalancingv2-listenerrule-authenticateoidcconfig-authorizationendpoint
elbvlraocAuthorizationEndpoint :: Lens' ElasticLoadBalancingV2ListenerRuleAuthenticateOidcConfig (Val Text)
elbvlraocAuthorizationEndpoint = lens _elasticLoadBalancingV2ListenerRuleAuthenticateOidcConfigAuthorizationEndpoint (\s a -> s { _elasticLoadBalancingV2ListenerRuleAuthenticateOidcConfigAuthorizationEndpoint = a }) | 554 | elbvlraocAuthorizationEndpoint :: Lens' ElasticLoadBalancingV2ListenerRuleAuthenticateOidcConfig (Val Text)
elbvlraocAuthorizationEndpoint = lens _elasticLoadBalancingV2ListenerRuleAuthenticateOidcConfigAuthorizationEndpoint (\s a -> s { _elasticLoadBalancingV2ListenerRuleAuthenticateOidcConfigAuthorizationEndpoint = a }) | 323 | elbvlraocAuthorizationEndpoint = lens _elasticLoadBalancingV2ListenerRuleAuthenticateOidcConfigAuthorizationEndpoint (\s a -> s { _elasticLoadBalancingV2ListenerRuleAuthenticateOidcConfigAuthorizationEndpoint = a }) | 215 | true | true | 0 | 9 | 21 | 46 | 25 | 21 | null | null |
ezyang/ghc | compiler/simplCore/OccurAnal.hs | bsd-3-clause | combineUsageDetailsList :: [UsageDetails] -> UsageDetails
combineUsageDetailsList = foldl (+++) emptyDetails | 108 | combineUsageDetailsList :: [UsageDetails] -> UsageDetails
combineUsageDetailsList = foldl (+++) emptyDetails | 108 | combineUsageDetailsList = foldl (+++) emptyDetails | 50 | false | true | 0 | 6 | 9 | 25 | 14 | 11 | null | null |
UU-ComputerScience/uu-cco | uu-cco-examples/src/PpATerm.hs | bsd-3-clause | main = ioWrap (parser >>> printer) | 34 | main = ioWrap (parser >>> printer) | 34 | main = ioWrap (parser >>> printer) | 34 | false | false | 0 | 7 | 5 | 16 | 8 | 8 | null | null |
erikd/hs-tls | debug/src/Stunnel.hs | bsd-3-clause | onNull defVal l | null l = defVal
| otherwise = l | 68 | onNull defVal l | null l = defVal
| otherwise = l | 68 | onNull defVal l | null l = defVal
| otherwise = l | 68 | false | false | 0 | 8 | 30 | 29 | 12 | 17 | null | null |
fmapfmapfmap/amazonka | amazonka-rds/gen/Network/AWS/RDS/DescribeDBSnapshots.hs | mpl-2.0 | -- | This parameter is not currently supported.
ddsFilters :: Lens' DescribeDBSnapshots [Filter]
ddsFilters = lens _ddsFilters (\ s a -> s{_ddsFilters = a}) . _Default . _Coerce | 177 | ddsFilters :: Lens' DescribeDBSnapshots [Filter]
ddsFilters = lens _ddsFilters (\ s a -> s{_ddsFilters = a}) . _Default . _Coerce | 129 | ddsFilters = lens _ddsFilters (\ s a -> s{_ddsFilters = a}) . _Default . _Coerce | 80 | true | true | 0 | 11 | 27 | 51 | 28 | 23 | null | null |
input-output-hk/pos-haskell-prototype | wallet/src/Cardano/Wallet/WalletLayer/Kernel/Transactions.hs | mit | toTransaction :: MonadIO m
=> Kernel.PassiveWallet
-> TxMeta
-> m (Either HD.UnknownHdAccount V1.Transaction)
toTransaction wallet meta = liftIO $ do
db <- liftIO $ Kernel.getWalletSnapshot wallet
sc <- liftIO $ Node.getSlotCount (wallet ^. Kernel.walletNode)
currentSlot <- Node.getTipSlotId (wallet ^. Kernel.walletNode)
return $ runExcept $ metaToTx db sc currentSlot meta
-- | Type Casting for Account filtering from V1 to MetaData Types. | 501 | toTransaction :: MonadIO m
=> Kernel.PassiveWallet
-> TxMeta
-> m (Either HD.UnknownHdAccount V1.Transaction)
toTransaction wallet meta = liftIO $ do
db <- liftIO $ Kernel.getWalletSnapshot wallet
sc <- liftIO $ Node.getSlotCount (wallet ^. Kernel.walletNode)
currentSlot <- Node.getTipSlotId (wallet ^. Kernel.walletNode)
return $ runExcept $ metaToTx db sc currentSlot meta
-- | Type Casting for Account filtering from V1 to MetaData Types. | 501 | toTransaction wallet meta = liftIO $ do
db <- liftIO $ Kernel.getWalletSnapshot wallet
sc <- liftIO $ Node.getSlotCount (wallet ^. Kernel.walletNode)
currentSlot <- Node.getTipSlotId (wallet ^. Kernel.walletNode)
return $ runExcept $ metaToTx db sc currentSlot meta
-- | Type Casting for Account filtering from V1 to MetaData Types. | 349 | false | true | 0 | 13 | 119 | 135 | 64 | 71 | null | null |
tingtun/jmacro | Language/Javascript/JMacro/Base.hs | bsd-3-clause | composOpFold :: Compos t => b -> (b -> b -> b) -> (forall a. t a -> b) -> t c -> b
composOpFold z c f = unC . compos (\_ -> C z) (\(C x) (C y) -> C (c x y)) (C . f) | 164 | composOpFold :: Compos t => b -> (b -> b -> b) -> (forall a. t a -> b) -> t c -> b
composOpFold z c f = unC . compos (\_ -> C z) (\(C x) (C y) -> C (c x y)) (C . f) | 164 | composOpFold z c f = unC . compos (\_ -> C z) (\(C x) (C y) -> C (c x y)) (C . f) | 81 | false | true | 0 | 12 | 47 | 132 | 67 | 65 | null | null |
tom-szczarkowski/matasano-crypto-puzzles-solutions | set6/Ciphers.hs | mit | decrypt CBC cipher key input =
liftM (unpad . unblocks . zipWith xorBuffers (blocks input)) $
mapM (blockCipher Decrypt cipher key) (drop 1 $ blocks input) | 160 | decrypt CBC cipher key input =
liftM (unpad . unblocks . zipWith xorBuffers (blocks input)) $
mapM (blockCipher Decrypt cipher key) (drop 1 $ blocks input) | 160 | decrypt CBC cipher key input =
liftM (unpad . unblocks . zipWith xorBuffers (blocks input)) $
mapM (blockCipher Decrypt cipher key) (drop 1 $ blocks input) | 160 | false | false | 0 | 10 | 30 | 76 | 34 | 42 | null | null |
ckaestne/CIDE | CIDE_Language_Haskell/test/fromviral/Barchart.hs | gpl-3.0 | -- A function that yields a picture of a multi-bar
multiBar :: Int -> Int -> [Int] -> Pic;
multiBar barWidth height values =
let { n = length values;
w = barWidth `div` (n + 1);
gap = 2;
bs = [plainBar (fst p) black (w - gap) height (snd p) | p <- zip colors values];
f = \p q -> Trans w 0 q `Super` p
}
in foldr f NoPic bs | 380 | multiBar :: Int -> Int -> [Int] -> Pic
multiBar barWidth height values =
let { n = length values;
w = barWidth `div` (n + 1);
gap = 2;
bs = [plainBar (fst p) black (w - gap) height (snd p) | p <- zip colors values];
f = \p q -> Trans w 0 q `Super` p
}
in foldr f NoPic bs | 324 | multiBar barWidth height values =
let { n = length values;
w = barWidth `div` (n + 1);
gap = 2;
bs = [plainBar (fst p) black (w - gap) height (snd p) | p <- zip colors values];
f = \p q -> Trans w 0 q `Super` p
}
in foldr f NoPic bs | 285 | true | true | 0 | 12 | 131 | 161 | 88 | 73 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/course/2014-06-upenn/cis194/src/HW05_HC.hs | unlicense | ------------------------------------------------------------------------------
hw05 :: IO T.Counts
hw05 = do
T.runTestTT ex1
T.runTestTT ex2
T.runTestTT ex3
T.runTestTT ex4
T.runTestTT ex5
T.runTestTT ex6
T.runTestTT ex6'
-- End of file. | 267 | hw05 :: IO T.Counts
hw05 = do
T.runTestTT ex1
T.runTestTT ex2
T.runTestTT ex3
T.runTestTT ex4
T.runTestTT ex5
T.runTestTT ex6
T.runTestTT ex6'
-- End of file. | 187 | hw05 = do
T.runTestTT ex1
T.runTestTT ex2
T.runTestTT ex3
T.runTestTT ex4
T.runTestTT ex5
T.runTestTT ex6
T.runTestTT ex6'
-- End of file. | 167 | true | true | 0 | 9 | 55 | 80 | 32 | 48 | null | null |
ssaavedra/liquidhaskell | src/Language/Haskell/Liquid/Constraint/Axioms.hs | bsd-3-clause | -------------------------------------------------------------------------------
-------------------- Combine Proofs ----------------------------------------
-------------------------------------------------------------------------------
makeCombineType Nothing
= panic Nothing "proofType not found" | 303 | makeCombineType Nothing
= panic Nothing "proofType not found" | 63 | makeCombineType Nothing
= panic Nothing "proofType not found" | 63 | true | false | 0 | 5 | 18 | 17 | 9 | 8 | null | null |
ancientlanguage/haskell-analysis | grammar/src/Grammar/Common/Decompose.hs | mit | decomposeChar '\x0226' = "\x0041\x0307" | 39 | decomposeChar '\x0226' = "\x0041\x0307" | 39 | decomposeChar '\x0226' = "\x0041\x0307" | 39 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
hkuplg/fcore | examples/case_studies/PureLambda.hs | bsd-2-clause | alphaCongruent (Abs x tx) (Abs y ty)
| x == y = alphaCongruent tx ty
| otherwise = alphaCongruent (subst (Var z) x tx) (subst (Var z) y ty)
where z = genNewIde $ freeVars tx `Set.union` freeVars ty | 288 | alphaCongruent (Abs x tx) (Abs y ty)
| x == y = alphaCongruent tx ty
| otherwise = alphaCongruent (subst (Var z) x tx) (subst (Var z) y ty)
where z = genNewIde $ freeVars tx `Set.union` freeVars ty | 288 | alphaCongruent (Abs x tx) (Abs y ty)
| x == y = alphaCongruent tx ty
| otherwise = alphaCongruent (subst (Var z) x tx) (subst (Var z) y ty)
where z = genNewIde $ freeVars tx `Set.union` freeVars ty | 288 | false | false | 1 | 9 | 129 | 116 | 55 | 61 | null | null |
jaapweel/piffle | src/CPretty.hs | gpl-2.0 | pb Float =
text "float" | 27 | pb Float =
text "float" | 27 | pb Float =
text "float" | 27 | false | false | 0 | 5 | 8 | 13 | 5 | 8 | null | null |
shayan-najd/MiniLava | Lava/Generic.hs | bsd-3-clause | ifThenElse :: Generic a => Signal Bool -> a -> a -> a
ifThenElse c x y = construct (iff (struct x) (struct y))
where
iff (Object a) (Object b) = Object $ case getTyp $ unsymbol a of
TBool -> unSignal $ ifBool c (Signal a) (Signal b)
TInt -> unSignal $ ifInt c (Signal a) (Signal b)
iff (Compound as) (Compound bs) =
Compound [iff a b
| (a , b) <- zip as bs]
iff _ _ = error "Bad Conditional"
{-
instance Choice b => Choice (a -> b) where
ifThenElse cond (f, g) =
\a -> ifThenElse cond (f a, g a)
-} | 588 | ifThenElse :: Generic a => Signal Bool -> a -> a -> a
ifThenElse c x y = construct (iff (struct x) (struct y))
where
iff (Object a) (Object b) = Object $ case getTyp $ unsymbol a of
TBool -> unSignal $ ifBool c (Signal a) (Signal b)
TInt -> unSignal $ ifInt c (Signal a) (Signal b)
iff (Compound as) (Compound bs) =
Compound [iff a b
| (a , b) <- zip as bs]
iff _ _ = error "Bad Conditional"
{-
instance Choice b => Choice (a -> b) where
ifThenElse cond (f, g) =
\a -> ifThenElse cond (f a, g a)
-} | 588 | ifThenElse c x y = construct (iff (struct x) (struct y))
where
iff (Object a) (Object b) = Object $ case getTyp $ unsymbol a of
TBool -> unSignal $ ifBool c (Signal a) (Signal b)
TInt -> unSignal $ ifInt c (Signal a) (Signal b)
iff (Compound as) (Compound bs) =
Compound [iff a b
| (a , b) <- zip as bs]
iff _ _ = error "Bad Conditional"
{-
instance Choice b => Choice (a -> b) where
ifThenElse cond (f, g) =
\a -> ifThenElse cond (f a, g a)
-} | 534 | false | true | 2 | 13 | 197 | 227 | 111 | 116 | null | null |
tumarkin/vandelay | src/Vandelay/App/Template/ParserT.hs | bsd-3-clause | getPrioritizedItem (Sec a) = a | 31 | getPrioritizedItem (Sec a) = a | 31 | getPrioritizedItem (Sec a) = a | 31 | false | false | 0 | 6 | 5 | 16 | 7 | 9 | null | null |
jimsnow/glome | GlomeVec/Data/Glome/Texture.hs | gpl-2.0 | turbulence p n =
let newp = vscale p 0.5
t = fabs (noise p)
in t + (0.5 * (turbulence newp (n-1))) | 105 | turbulence p n =
let newp = vscale p 0.5
t = fabs (noise p)
in t + (0.5 * (turbulence newp (n-1))) | 105 | turbulence p n =
let newp = vscale p 0.5
t = fabs (noise p)
in t + (0.5 * (turbulence newp (n-1))) | 105 | false | false | 3 | 11 | 29 | 73 | 33 | 40 | null | null |
bitemyapp/tf-idf-1 | src/Main.hs | mit | sortedFrequency :: [Freq] -> [Freq]
sortedFrequency = sortBy (compare `on` snd) | 79 | sortedFrequency :: [Freq] -> [Freq]
sortedFrequency = sortBy (compare `on` snd) | 79 | sortedFrequency = sortBy (compare `on` snd) | 43 | false | true | 0 | 7 | 10 | 33 | 19 | 14 | null | null |
facebook/Haxl | Haxl/Core/Parallel.hs | bsd-3-clause | -- | Parallel version of '(.||)'. Both arguments are evaluated in
-- parallel, and if either returns 'True' then the other is
-- not evaluated any further.
--
-- WARNING: exceptions may be unpredictable when using 'pOr'. If one
-- argument returns 'True' before the other completes, then 'pOr'
-- returns 'True' immediately, ignoring a possible exception that
-- the other argument may have produced if it had been allowed to
-- complete.
pOr :: GenHaxl u w Bool -> GenHaxl u w Bool -> GenHaxl u w Bool
pOr x y = biselect_opt discrim discrim left right x y
where
discrim True = Left ()
discrim False = Right ()
left _ = True
right _ = False
-- | Parallel version of '(.&&)'. Both arguments are evaluated in
-- parallel, and if either returns 'False' then the other is
-- not evaluated any further.
--
-- WARNING: exceptions may be unpredictable when using 'pAnd'. If one
-- argument returns 'False' before the other completes, then 'pAnd'
-- returns 'False' immediately, ignoring a possible exception that
-- the other argument may have produced if it had been allowed to
-- complete. | 1,107 | pOr :: GenHaxl u w Bool -> GenHaxl u w Bool -> GenHaxl u w Bool
pOr x y = biselect_opt discrim discrim left right x y
where
discrim True = Left ()
discrim False = Right ()
left _ = True
right _ = False
-- | Parallel version of '(.&&)'. Both arguments are evaluated in
-- parallel, and if either returns 'False' then the other is
-- not evaluated any further.
--
-- WARNING: exceptions may be unpredictable when using 'pAnd'. If one
-- argument returns 'False' before the other completes, then 'pAnd'
-- returns 'False' immediately, ignoring a possible exception that
-- the other argument may have produced if it had been allowed to
-- complete. | 666 | pOr x y = biselect_opt discrim discrim left right x y
where
discrim True = Left ()
discrim False = Right ()
left _ = True
right _ = False
-- | Parallel version of '(.&&)'. Both arguments are evaluated in
-- parallel, and if either returns 'False' then the other is
-- not evaluated any further.
--
-- WARNING: exceptions may be unpredictable when using 'pAnd'. If one
-- argument returns 'False' before the other completes, then 'pAnd'
-- returns 'False' immediately, ignoring a possible exception that
-- the other argument may have produced if it had been allowed to
-- complete. | 602 | true | true | 0 | 7 | 214 | 126 | 67 | 59 | null | null |
olorin/amazonka | amazonka-iam/gen/Network/AWS/IAM/GetAccountAuthorizationDetails.hs | mpl-2.0 | -- | A list containing information about IAM groups.
gaadrsGroupDetailList :: Lens' GetAccountAuthorizationDetailsResponse [GroupDetail]
gaadrsGroupDetailList = lens _gaadrsGroupDetailList (\ s a -> s{_gaadrsGroupDetailList = a}) . _Default . _Coerce | 250 | gaadrsGroupDetailList :: Lens' GetAccountAuthorizationDetailsResponse [GroupDetail]
gaadrsGroupDetailList = lens _gaadrsGroupDetailList (\ s a -> s{_gaadrsGroupDetailList = a}) . _Default . _Coerce | 197 | gaadrsGroupDetailList = lens _gaadrsGroupDetailList (\ s a -> s{_gaadrsGroupDetailList = a}) . _Default . _Coerce | 113 | true | true | 1 | 11 | 28 | 55 | 28 | 27 | null | null |
vincenthz/cryptonite | Crypto/ECC/Simple/Types.hs | bsd-3-clause | paramSEC_p128r2 = CurveParameters
{ curveEccA = 0xd6031998d1b3bbfebf59cc9bbff9aee1
, curveEccB = 0x5eeefca380d02919dc2c6558bb6d8a5d
, curveEccG = Point 0x7b6aa5d85e572983e6fb32a7cdebc140
0x27b6916a894d3aee7106fe805fc34b44
, curveEccN = 0x3fffffff7fffffffbe0024720613b5a3
, curveEccH = 4
} | 332 | paramSEC_p128r2 = CurveParameters
{ curveEccA = 0xd6031998d1b3bbfebf59cc9bbff9aee1
, curveEccB = 0x5eeefca380d02919dc2c6558bb6d8a5d
, curveEccG = Point 0x7b6aa5d85e572983e6fb32a7cdebc140
0x27b6916a894d3aee7106fe805fc34b44
, curveEccN = 0x3fffffff7fffffffbe0024720613b5a3
, curveEccH = 4
} | 332 | paramSEC_p128r2 = CurveParameters
{ curveEccA = 0xd6031998d1b3bbfebf59cc9bbff9aee1
, curveEccB = 0x5eeefca380d02919dc2c6558bb6d8a5d
, curveEccG = Point 0x7b6aa5d85e572983e6fb32a7cdebc140
0x27b6916a894d3aee7106fe805fc34b44
, curveEccN = 0x3fffffff7fffffffbe0024720613b5a3
, curveEccH = 4
} | 332 | false | false | 0 | 8 | 69 | 47 | 27 | 20 | null | null |
creswick/maxent-hs | Numeric/MaxEnt/Train/Internal.hs | apache-2.0 | ctxsToNum :: Ord a => (FeatureMapping a, [TrainContext]) -> [Context a] ->
(FeatureMapping a, [TrainContext])
ctxsToNum acc = foldl ctxToNum acc | 157 | ctxsToNum :: Ord a => (FeatureMapping a, [TrainContext]) -> [Context a] ->
(FeatureMapping a, [TrainContext])
ctxsToNum acc = foldl ctxToNum acc | 157 | ctxsToNum acc = foldl ctxToNum acc | 34 | false | true | 0 | 9 | 33 | 64 | 33 | 31 | null | null |
flowbox-public/mainland-pretty | Text/PrettyPrint/Mainland.hs | bsd-3-clause | -- | The document @space@ consists of a space, \" \".
space :: Doc
space = char ' ' | 83 | space :: Doc
space = char ' ' | 29 | space = char ' ' | 16 | true | true | 0 | 5 | 18 | 15 | 8 | 7 | null | null |
rimmington/eclogues | eclogues/src/Eclogues/Job.hs | bsd-3-clause | jobAvailability :: Stage -> Availability
jobAvailability Finished = Available | 77 | jobAvailability :: Stage -> Availability
jobAvailability Finished = Available | 77 | jobAvailability Finished = Available | 36 | false | true | 0 | 5 | 8 | 22 | 10 | 12 | null | null |
sdiehl/ghc | compiler/main/HscTypes.hs | bsd-3-clause | mkQualPackage :: DynFlags -> QueryQualifyPackage
mkQualPackage dflags uid
| uid == mainUnitId || uid == interactiveUnitId
-- Skip the lookup if it's main, since it won't be in the package
-- database!
= False
| Just pkgid <- mb_pkgid
, searchPackageId dflags pkgid `lengthIs` 1
-- this says: we are given a package pkg-0.1@MMM, are there only one
-- exposed packages whose package ID is pkg-0.1?
= False
| otherwise
= True
where mb_pkgid = fmap sourcePackageId (lookupUnit dflags uid)
-- | A function which only qualifies package names if necessary; but
-- qualifies all other identifiers. | 662 | mkQualPackage :: DynFlags -> QueryQualifyPackage
mkQualPackage dflags uid
| uid == mainUnitId || uid == interactiveUnitId
-- Skip the lookup if it's main, since it won't be in the package
-- database!
= False
| Just pkgid <- mb_pkgid
, searchPackageId dflags pkgid `lengthIs` 1
-- this says: we are given a package pkg-0.1@MMM, are there only one
-- exposed packages whose package ID is pkg-0.1?
= False
| otherwise
= True
where mb_pkgid = fmap sourcePackageId (lookupUnit dflags uid)
-- | A function which only qualifies package names if necessary; but
-- qualifies all other identifiers. | 662 | mkQualPackage dflags uid
| uid == mainUnitId || uid == interactiveUnitId
-- Skip the lookup if it's main, since it won't be in the package
-- database!
= False
| Just pkgid <- mb_pkgid
, searchPackageId dflags pkgid `lengthIs` 1
-- this says: we are given a package pkg-0.1@MMM, are there only one
-- exposed packages whose package ID is pkg-0.1?
= False
| otherwise
= True
where mb_pkgid = fmap sourcePackageId (lookupUnit dflags uid)
-- | A function which only qualifies package names if necessary; but
-- qualifies all other identifiers. | 613 | false | true | 0 | 10 | 169 | 104 | 53 | 51 | null | null |
green-haskell/ghc | compiler/simplCore/SetLevels.hs | bsd-3-clause | lvlExpr env (_, AnnCoercion co) = return (Coercion (substCo (le_subst env) co)) | 79 | lvlExpr env (_, AnnCoercion co) = return (Coercion (substCo (le_subst env) co)) | 79 | lvlExpr env (_, AnnCoercion co) = return (Coercion (substCo (le_subst env) co)) | 79 | false | false | 0 | 11 | 11 | 45 | 21 | 24 | null | null |
lpeterse/koka | src/Static/BindingGroups.hs | apache-2.0 | dependencyBinding :: Name -> UserValueBinder UserExpr -> (UserValueBinder UserExpr, Deps)
dependencyBinding modName vb
= (vb{ binderExpr = depBody }, M.singleton (binderName vb) freeVar)
where
(depBody, freeVar) = dependencyExpr modName (binderExpr vb) | 265 | dependencyBinding :: Name -> UserValueBinder UserExpr -> (UserValueBinder UserExpr, Deps)
dependencyBinding modName vb
= (vb{ binderExpr = depBody }, M.singleton (binderName vb) freeVar)
where
(depBody, freeVar) = dependencyExpr modName (binderExpr vb) | 265 | dependencyBinding modName vb
= (vb{ binderExpr = depBody }, M.singleton (binderName vb) freeVar)
where
(depBody, freeVar) = dependencyExpr modName (binderExpr vb) | 175 | false | true | 0 | 10 | 43 | 94 | 47 | 47 | null | null |
brendanhay/gogol | gogol-blogger/gen/Network/Google/Blogger/Types/Product.hs | mpl-2.0 | -- | The body content of this Page, in HTML.
pagContent :: Lens' Page (Maybe Text)
pagContent
= lens _pagContent (\ s a -> s{_pagContent = a}) | 144 | pagContent :: Lens' Page (Maybe Text)
pagContent
= lens _pagContent (\ s a -> s{_pagContent = a}) | 99 | pagContent
= lens _pagContent (\ s a -> s{_pagContent = a}) | 61 | true | true | 2 | 9 | 28 | 55 | 25 | 30 | null | null |
batterseapower/chsc | Evaluator/Residualise.hs | bsd-3-clause | residualiseHeap :: Heap -> (IdSupply -> ((Out [(Var, Doc)], Out [(Var, FVedTerm)]), Out FVedTerm)) -> (Out [(Var, Doc)], Out FVedTerm)
residualiseHeap (Heap h ids) (($ ids) -> ((floats_static_k, floats_nonstatic_k), e)) = (floats_static_h ++ floats_static_k, letRecSmart (floats_nonstatic_h ++ floats_nonstatic_k) e)
where (floats_static_h, floats_nonstatic_h) = residualisePureHeap ids h | 390 | residualiseHeap :: Heap -> (IdSupply -> ((Out [(Var, Doc)], Out [(Var, FVedTerm)]), Out FVedTerm)) -> (Out [(Var, Doc)], Out FVedTerm)
residualiseHeap (Heap h ids) (($ ids) -> ((floats_static_k, floats_nonstatic_k), e)) = (floats_static_h ++ floats_static_k, letRecSmart (floats_nonstatic_h ++ floats_nonstatic_k) e)
where (floats_static_h, floats_nonstatic_h) = residualisePureHeap ids h | 390 | residualiseHeap (Heap h ids) (($ ids) -> ((floats_static_k, floats_nonstatic_k), e)) = (floats_static_h ++ floats_static_k, letRecSmart (floats_nonstatic_h ++ floats_nonstatic_k) e)
where (floats_static_h, floats_nonstatic_h) = residualisePureHeap ids h | 255 | false | true | 1 | 14 | 47 | 168 | 93 | 75 | null | null |
mydaum/cabal | cabal-install/Distribution/Solver/Modular/Dependency.hs | bsd-3-clause | goalToVar :: Goal a -> Var a
goalToVar (Goal v _) = v | 53 | goalToVar :: Goal a -> Var a
goalToVar (Goal v _) = v | 53 | goalToVar (Goal v _) = v | 24 | false | true | 0 | 7 | 12 | 32 | 15 | 17 | null | null |
brendanhay/gogol | gogol-youtube/gen/Network/Google/Resource/YouTube/ChannelSections/List.hs | mpl-2.0 | -- | OAuth access token.
cslAccessToken :: Lens' ChannelSectionsList (Maybe Text)
cslAccessToken
= lens _cslAccessToken
(\ s a -> s{_cslAccessToken = a}) | 161 | cslAccessToken :: Lens' ChannelSectionsList (Maybe Text)
cslAccessToken
= lens _cslAccessToken
(\ s a -> s{_cslAccessToken = a}) | 136 | cslAccessToken
= lens _cslAccessToken
(\ s a -> s{_cslAccessToken = a}) | 79 | true | true | 1 | 9 | 29 | 52 | 25 | 27 | null | null |
mariefarrell/Hets | CASL/CCC/OnePoint.hs | gpl-2.0 | evaluateOnePointFORMULA sig (Equation (Sorted_term _ sort1 _) _
(Sorted_term _ sort2 _) _) =
if not (Set.member sort1 (sortSet sig))
&& not (Set.member sort2 (sortSet sig)) then Just True
else Nothing | 233 | evaluateOnePointFORMULA sig (Equation (Sorted_term _ sort1 _) _
(Sorted_term _ sort2 _) _) =
if not (Set.member sort1 (sortSet sig))
&& not (Set.member sort2 (sortSet sig)) then Just True
else Nothing | 233 | evaluateOnePointFORMULA sig (Equation (Sorted_term _ sort1 _) _
(Sorted_term _ sort2 _) _) =
if not (Set.member sort1 (sortSet sig))
&& not (Set.member sort2 (sortSet sig)) then Just True
else Nothing | 233 | false | false | 0 | 11 | 63 | 96 | 47 | 49 | null | null |
snoyberg/ghc | testsuite/tests/programs/galois_raytrace/Eval.hs | bsd-3-clause | eval :: MonadEval m => State -> m Stack
eval st =
do { () <- return () -- $ unsafePerformIO (print st) -- Functional debugger
; if moreCode st then
do { tick -- tick first, so as to catch loops on new eval.
; st' <- step st
; eval st'
}
else return (stack st)
} | 338 | eval :: MonadEval m => State -> m Stack
eval st =
do { () <- return () -- $ unsafePerformIO (print st) -- Functional debugger
; if moreCode st then
do { tick -- tick first, so as to catch loops on new eval.
; st' <- step st
; eval st'
}
else return (stack st)
} | 338 | eval st =
do { () <- return () -- $ unsafePerformIO (print st) -- Functional debugger
; if moreCode st then
do { tick -- tick first, so as to catch loops on new eval.
; st' <- step st
; eval st'
}
else return (stack st)
} | 298 | false | true | 0 | 12 | 135 | 98 | 47 | 51 | null | null |
ocean0yohsuke/Scheme | src/Scheme/Parser.hs | bsd-3-clause | pREAL :: Parser Expr
pREAL = try (pPlus <|> pMinus) <?> "real number"
where
pPlus = do
l <- many1 digit
char '.'
r <- many1 digit
(*:) $ REAL (read $ l ++ "." ++ r)
pMinus = do
char '-'
REAL n <- pPlus
(*:) $ REAL (n*(-1)) | 290 | pREAL :: Parser Expr
pREAL = try (pPlus <|> pMinus) <?> "real number"
where
pPlus = do
l <- many1 digit
char '.'
r <- many1 digit
(*:) $ REAL (read $ l ++ "." ++ r)
pMinus = do
char '-'
REAL n <- pPlus
(*:) $ REAL (n*(-1)) | 290 | pREAL = try (pPlus <|> pMinus) <?> "real number"
where
pPlus = do
l <- many1 digit
char '.'
r <- many1 digit
(*:) $ REAL (read $ l ++ "." ++ r)
pMinus = do
char '-'
REAL n <- pPlus
(*:) $ REAL (n*(-1)) | 269 | false | true | 0 | 12 | 117 | 134 | 64 | 70 | null | null |
thalerjonathan/phd | public/ArtIterating/code/haskell/PureAgentsSeq/src/HeroesAndCowards/HACModel.hs | gpl-3.0 | drawRandomIgnoring :: (RandomGen g, Eq a) => g -> [a] -> [a] -> (a, g)
drawRandomIgnoring g xs is
| any (==randElem) is = drawRandomIgnoring g' xs is
| otherwise = (randElem, g')
where
(randIdx, g') = randomR(0, length xs - 1) g
randElem = xs !! randIdx | 293 | drawRandomIgnoring :: (RandomGen g, Eq a) => g -> [a] -> [a] -> (a, g)
drawRandomIgnoring g xs is
| any (==randElem) is = drawRandomIgnoring g' xs is
| otherwise = (randElem, g')
where
(randIdx, g') = randomR(0, length xs - 1) g
randElem = xs !! randIdx | 293 | drawRandomIgnoring g xs is
| any (==randElem) is = drawRandomIgnoring g' xs is
| otherwise = (randElem, g')
where
(randIdx, g') = randomR(0, length xs - 1) g
randElem = xs !! randIdx | 222 | false | true | 0 | 10 | 87 | 135 | 71 | 64 | null | null |
dysinger/amazonka | amazonka-kms/gen/Network/AWS/KMS/DisableKey.hs | mpl-2.0 | -- | A unique identifier for the customer master key. This value can be a globally
-- unique identifier or the fully specified ARN to a key. Key ARN Example -
-- arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012 Globally Unique Key ID Example - 12345678-1234-1234-123456789012
--
dkKeyId :: Lens' DisableKey Text
dkKeyId = lens _dkKeyId (\s a -> s { _dkKeyId = a }) | 392 | dkKeyId :: Lens' DisableKey Text
dkKeyId = lens _dkKeyId (\s a -> s { _dkKeyId = a }) | 85 | dkKeyId = lens _dkKeyId (\s a -> s { _dkKeyId = a }) | 52 | true | true | 1 | 9 | 59 | 49 | 25 | 24 | null | null |
ryantm/ghc | compiler/nativeGen/X86/CodeGen.hs | bsd-3-clause | getNonClobberedOperand :: CmmExpr -> NatM (Operand, InstrBlock)
getNonClobberedOperand (CmmLit lit) = do
use_sse2 <- sse2Enabled
if use_sse2 && isSuitableFloatingPointLit lit
then do
let CmmFloat _ w = lit
Amode addr code <- memConstant (widthInBytes w) lit
return (OpAddr addr, code)
else do
is32Bit <- is32BitPlatform
dflags <- getDynFlags
if is32BitLit is32Bit lit && not (isFloatType (cmmLitType dflags lit))
then return (OpImm (litToImm lit), nilOL)
else getNonClobberedOperand_generic (CmmLit lit) | 549 | getNonClobberedOperand :: CmmExpr -> NatM (Operand, InstrBlock)
getNonClobberedOperand (CmmLit lit) = do
use_sse2 <- sse2Enabled
if use_sse2 && isSuitableFloatingPointLit lit
then do
let CmmFloat _ w = lit
Amode addr code <- memConstant (widthInBytes w) lit
return (OpAddr addr, code)
else do
is32Bit <- is32BitPlatform
dflags <- getDynFlags
if is32BitLit is32Bit lit && not (isFloatType (cmmLitType dflags lit))
then return (OpImm (litToImm lit), nilOL)
else getNonClobberedOperand_generic (CmmLit lit) | 549 | getNonClobberedOperand (CmmLit lit) = do
use_sse2 <- sse2Enabled
if use_sse2 && isSuitableFloatingPointLit lit
then do
let CmmFloat _ w = lit
Amode addr code <- memConstant (widthInBytes w) lit
return (OpAddr addr, code)
else do
is32Bit <- is32BitPlatform
dflags <- getDynFlags
if is32BitLit is32Bit lit && not (isFloatType (cmmLitType dflags lit))
then return (OpImm (litToImm lit), nilOL)
else getNonClobberedOperand_generic (CmmLit lit) | 485 | false | true | 0 | 16 | 113 | 189 | 89 | 100 | null | null |
KommuSoft/dep-software | Dep.Ui.Utils.hs | gpl-3.0 | linC 81 = '\x2524' | 19 | linC 81 = '\x2524' | 19 | linC 81 = '\x2524' | 19 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
kmate/HaRe | old/testing/introPattern/MultiParamIn5AST.hs | bsd-3-clause | tl x = tail x | 13 | tl x = tail x | 13 | tl x = tail x | 13 | false | false | 1 | 5 | 4 | 16 | 5 | 11 | null | null |
janm399/equationsolver | src/EquationSolver/AttoparsecParser.hs | apache-2.0 | -- |Parser that matches single alphas
variable :: Parser Expr
variable = AC.anyChar >>= return . Variable
<?> "variable" | 137 | variable :: Parser Expr
variable = AC.anyChar >>= return . Variable
<?> "variable" | 95 | variable = AC.anyChar >>= return . Variable
<?> "variable" | 71 | true | true | 0 | 8 | 35 | 29 | 15 | 14 | null | null |
lechimp-p/Typogenetics | TyGen.hs | mit | execute' context
| topC context == Nothing = context
| null . enzyme $ context = context
| otherwise =
let (e:es) = enzyme context
context' = apply e context
in execute' $ context' { enzyme = es } | 237 | execute' context
| topC context == Nothing = context
| null . enzyme $ context = context
| otherwise =
let (e:es) = enzyme context
context' = apply e context
in execute' $ context' { enzyme = es } | 237 | execute' context
| topC context == Nothing = context
| null . enzyme $ context = context
| otherwise =
let (e:es) = enzyme context
context' = apply e context
in execute' $ context' { enzyme = es } | 237 | false | false | 1 | 10 | 79 | 93 | 44 | 49 | null | null |
kim/amazonka | amazonka-sns/gen/Network/AWS/SNS/Types.hs | mpl-2.0 | -- | 'Subscription' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 's1Endpoint' @::@ 'Maybe' 'Text'
--
-- * 's1Owner' @::@ 'Maybe' 'Text'
--
-- * 's1Protocol' @::@ 'Maybe' 'Text'
--
-- * 's1SubscriptionArn' @::@ 'Maybe' 'Text'
--
-- * 's1TopicArn' @::@ 'Maybe' 'Text'
--
subscription :: Subscription
subscription = Subscription
{ _s1SubscriptionArn = Nothing
, _s1Owner = Nothing
, _s1Protocol = Nothing
, _s1Endpoint = Nothing
, _s1TopicArn = Nothing
} | 544 | subscription :: Subscription
subscription = Subscription
{ _s1SubscriptionArn = Nothing
, _s1Owner = Nothing
, _s1Protocol = Nothing
, _s1Endpoint = Nothing
, _s1TopicArn = Nothing
} | 237 | subscription = Subscription
{ _s1SubscriptionArn = Nothing
, _s1Owner = Nothing
, _s1Protocol = Nothing
, _s1Endpoint = Nothing
, _s1TopicArn = Nothing
} | 208 | true | true | 0 | 7 | 130 | 61 | 42 | 19 | null | null |
mettekou/ghc | compiler/deSugar/DsBinds.hs | bsd-3-clause | dsHsBind dflags
(AbsBinds { abs_tvs = tyvars, abs_ev_vars = dicts
, abs_exports = exports, abs_ev_binds = ev_binds
, abs_binds = binds })
-- See Note [Desugaring AbsBinds]
= addDictsDs (toTcTypeBag (listToBag dicts)) $
-- addDictsDs: push type constraints deeper for pattern match check
do { (local_force_vars, bind_prs) <- ds_lhs_binds binds
; let core_bind = Rec [ makeCorePair dflags (add_inline lcl_id) False 0 rhs
| (lcl_id, rhs) <- bind_prs ]
-- Monomorphic recursion possible, hence Rec
new_force_vars = get_new_force_vars local_force_vars
locals = map abe_mono exports
all_locals = locals ++ new_force_vars
tup_expr = mkBigCoreVarTup all_locals
tup_ty = exprType tup_expr
; ds_binds <- dsTcEvBinds_s ev_binds
; let poly_tup_rhs = mkLams tyvars $ mkLams dicts $
mkCoreLets ds_binds $
Let core_bind $
tup_expr
; poly_tup_id <- newSysLocalDs (exprType poly_tup_rhs)
-- Find corresponding global or make up a new one: sometimes
-- we need to make new export to desugar strict binds, see
-- Note [Desugar Strict binds]
; (exported_force_vars, extra_exports) <- get_exports local_force_vars
; let mk_bind (ABE { abe_wrap = wrap
, abe_poly = global
, abe_mono = local, abe_prags = spec_prags })
-- See Note [AbsBinds wrappers] in HsBinds
= do { tup_id <- newSysLocalDs tup_ty
; rhs <- dsHsWrapper wrap $
mkLams tyvars $ mkLams dicts $
mkTupleSelector all_locals local tup_id $
mkVarApps (Var poly_tup_id) (tyvars ++ dicts)
; let rhs_for_spec = Let (NonRec poly_tup_id poly_tup_rhs) rhs
; (spec_binds, rules) <- dsSpecs rhs_for_spec spec_prags
; let global' = (global `setInlinePragma` defaultInlinePragma)
`addIdSpecialisations` rules
-- Kill the INLINE pragma because it applies to
-- the user written (local) function. The global
-- Id is just the selector. Hmm.
; return ((global', rhs) : fromOL spec_binds) }
; export_binds_s <- mapM mk_bind (exports ++ extra_exports)
; return (exported_force_vars
,(poly_tup_id, poly_tup_rhs) :
concat export_binds_s) }
where
inline_env :: IdEnv Id -- Maps a monomorphic local Id to one with
-- the inline pragma from the source
-- The type checker put the inline pragma
-- on the *global* Id, so we need to transfer it
inline_env
= mkVarEnv [ (lcl_id, setInlinePragma lcl_id prag)
| ABE { abe_mono = lcl_id, abe_poly = gbl_id } <- exports
, let prag = idInlinePragma gbl_id ]
add_inline :: Id -> Id -- tran
add_inline lcl_id = lookupVarEnv inline_env lcl_id
`orElse` lcl_id
global_env :: IdEnv Id -- Maps local Id to its global exported Id
global_env =
mkVarEnv [ (local, global)
| ABE { abe_mono = local, abe_poly = global } <- exports
]
-- find variables that are not exported
get_new_force_vars lcls =
foldr (\lcl acc -> case lookupVarEnv global_env lcl of
Just _ -> acc
Nothing -> lcl:acc)
[] lcls
-- find exports or make up new exports for force variables
get_exports :: [Id] -> DsM ([Id], [ABExport Id])
get_exports lcls =
foldM (\(glbls, exports) lcl ->
case lookupVarEnv global_env lcl of
Just glbl -> return (glbl:glbls, exports)
Nothing -> do export <- mk_export lcl
let glbl = abe_poly export
return (glbl:glbls, export:exports))
([],[]) lcls
mk_export local =
do global <- newSysLocalDs
(exprType (mkLams tyvars (mkLams dicts (Var local))))
return (ABE {abe_poly = global
,abe_mono = local
,abe_wrap = WpHole
,abe_prags = SpecPrags []})
-- AbsBindsSig is a combination of AbsBinds and FunBind | 4,735 | dsHsBind dflags
(AbsBinds { abs_tvs = tyvars, abs_ev_vars = dicts
, abs_exports = exports, abs_ev_binds = ev_binds
, abs_binds = binds })
-- See Note [Desugaring AbsBinds]
= addDictsDs (toTcTypeBag (listToBag dicts)) $
-- addDictsDs: push type constraints deeper for pattern match check
do { (local_force_vars, bind_prs) <- ds_lhs_binds binds
; let core_bind = Rec [ makeCorePair dflags (add_inline lcl_id) False 0 rhs
| (lcl_id, rhs) <- bind_prs ]
-- Monomorphic recursion possible, hence Rec
new_force_vars = get_new_force_vars local_force_vars
locals = map abe_mono exports
all_locals = locals ++ new_force_vars
tup_expr = mkBigCoreVarTup all_locals
tup_ty = exprType tup_expr
; ds_binds <- dsTcEvBinds_s ev_binds
; let poly_tup_rhs = mkLams tyvars $ mkLams dicts $
mkCoreLets ds_binds $
Let core_bind $
tup_expr
; poly_tup_id <- newSysLocalDs (exprType poly_tup_rhs)
-- Find corresponding global or make up a new one: sometimes
-- we need to make new export to desugar strict binds, see
-- Note [Desugar Strict binds]
; (exported_force_vars, extra_exports) <- get_exports local_force_vars
; let mk_bind (ABE { abe_wrap = wrap
, abe_poly = global
, abe_mono = local, abe_prags = spec_prags })
-- See Note [AbsBinds wrappers] in HsBinds
= do { tup_id <- newSysLocalDs tup_ty
; rhs <- dsHsWrapper wrap $
mkLams tyvars $ mkLams dicts $
mkTupleSelector all_locals local tup_id $
mkVarApps (Var poly_tup_id) (tyvars ++ dicts)
; let rhs_for_spec = Let (NonRec poly_tup_id poly_tup_rhs) rhs
; (spec_binds, rules) <- dsSpecs rhs_for_spec spec_prags
; let global' = (global `setInlinePragma` defaultInlinePragma)
`addIdSpecialisations` rules
-- Kill the INLINE pragma because it applies to
-- the user written (local) function. The global
-- Id is just the selector. Hmm.
; return ((global', rhs) : fromOL spec_binds) }
; export_binds_s <- mapM mk_bind (exports ++ extra_exports)
; return (exported_force_vars
,(poly_tup_id, poly_tup_rhs) :
concat export_binds_s) }
where
inline_env :: IdEnv Id -- Maps a monomorphic local Id to one with
-- the inline pragma from the source
-- The type checker put the inline pragma
-- on the *global* Id, so we need to transfer it
inline_env
= mkVarEnv [ (lcl_id, setInlinePragma lcl_id prag)
| ABE { abe_mono = lcl_id, abe_poly = gbl_id } <- exports
, let prag = idInlinePragma gbl_id ]
add_inline :: Id -> Id -- tran
add_inline lcl_id = lookupVarEnv inline_env lcl_id
`orElse` lcl_id
global_env :: IdEnv Id -- Maps local Id to its global exported Id
global_env =
mkVarEnv [ (local, global)
| ABE { abe_mono = local, abe_poly = global } <- exports
]
-- find variables that are not exported
get_new_force_vars lcls =
foldr (\lcl acc -> case lookupVarEnv global_env lcl of
Just _ -> acc
Nothing -> lcl:acc)
[] lcls
-- find exports or make up new exports for force variables
get_exports :: [Id] -> DsM ([Id], [ABExport Id])
get_exports lcls =
foldM (\(glbls, exports) lcl ->
case lookupVarEnv global_env lcl of
Just glbl -> return (glbl:glbls, exports)
Nothing -> do export <- mk_export lcl
let glbl = abe_poly export
return (glbl:glbls, export:exports))
([],[]) lcls
mk_export local =
do global <- newSysLocalDs
(exprType (mkLams tyvars (mkLams dicts (Var local))))
return (ABE {abe_poly = global
,abe_mono = local
,abe_wrap = WpHole
,abe_prags = SpecPrags []})
-- AbsBindsSig is a combination of AbsBinds and FunBind | 4,735 | dsHsBind dflags
(AbsBinds { abs_tvs = tyvars, abs_ev_vars = dicts
, abs_exports = exports, abs_ev_binds = ev_binds
, abs_binds = binds })
-- See Note [Desugaring AbsBinds]
= addDictsDs (toTcTypeBag (listToBag dicts)) $
-- addDictsDs: push type constraints deeper for pattern match check
do { (local_force_vars, bind_prs) <- ds_lhs_binds binds
; let core_bind = Rec [ makeCorePair dflags (add_inline lcl_id) False 0 rhs
| (lcl_id, rhs) <- bind_prs ]
-- Monomorphic recursion possible, hence Rec
new_force_vars = get_new_force_vars local_force_vars
locals = map abe_mono exports
all_locals = locals ++ new_force_vars
tup_expr = mkBigCoreVarTup all_locals
tup_ty = exprType tup_expr
; ds_binds <- dsTcEvBinds_s ev_binds
; let poly_tup_rhs = mkLams tyvars $ mkLams dicts $
mkCoreLets ds_binds $
Let core_bind $
tup_expr
; poly_tup_id <- newSysLocalDs (exprType poly_tup_rhs)
-- Find corresponding global or make up a new one: sometimes
-- we need to make new export to desugar strict binds, see
-- Note [Desugar Strict binds]
; (exported_force_vars, extra_exports) <- get_exports local_force_vars
; let mk_bind (ABE { abe_wrap = wrap
, abe_poly = global
, abe_mono = local, abe_prags = spec_prags })
-- See Note [AbsBinds wrappers] in HsBinds
= do { tup_id <- newSysLocalDs tup_ty
; rhs <- dsHsWrapper wrap $
mkLams tyvars $ mkLams dicts $
mkTupleSelector all_locals local tup_id $
mkVarApps (Var poly_tup_id) (tyvars ++ dicts)
; let rhs_for_spec = Let (NonRec poly_tup_id poly_tup_rhs) rhs
; (spec_binds, rules) <- dsSpecs rhs_for_spec spec_prags
; let global' = (global `setInlinePragma` defaultInlinePragma)
`addIdSpecialisations` rules
-- Kill the INLINE pragma because it applies to
-- the user written (local) function. The global
-- Id is just the selector. Hmm.
; return ((global', rhs) : fromOL spec_binds) }
; export_binds_s <- mapM mk_bind (exports ++ extra_exports)
; return (exported_force_vars
,(poly_tup_id, poly_tup_rhs) :
concat export_binds_s) }
where
inline_env :: IdEnv Id -- Maps a monomorphic local Id to one with
-- the inline pragma from the source
-- The type checker put the inline pragma
-- on the *global* Id, so we need to transfer it
inline_env
= mkVarEnv [ (lcl_id, setInlinePragma lcl_id prag)
| ABE { abe_mono = lcl_id, abe_poly = gbl_id } <- exports
, let prag = idInlinePragma gbl_id ]
add_inline :: Id -> Id -- tran
add_inline lcl_id = lookupVarEnv inline_env lcl_id
`orElse` lcl_id
global_env :: IdEnv Id -- Maps local Id to its global exported Id
global_env =
mkVarEnv [ (local, global)
| ABE { abe_mono = local, abe_poly = global } <- exports
]
-- find variables that are not exported
get_new_force_vars lcls =
foldr (\lcl acc -> case lookupVarEnv global_env lcl of
Just _ -> acc
Nothing -> lcl:acc)
[] lcls
-- find exports or make up new exports for force variables
get_exports :: [Id] -> DsM ([Id], [ABExport Id])
get_exports lcls =
foldM (\(glbls, exports) lcl ->
case lookupVarEnv global_env lcl of
Just glbl -> return (glbl:glbls, exports)
Nothing -> do export <- mk_export lcl
let glbl = abe_poly export
return (glbl:glbls, export:exports))
([],[]) lcls
mk_export local =
do global <- newSysLocalDs
(exprType (mkLams tyvars (mkLams dicts (Var local))))
return (ABE {abe_poly = global
,abe_mono = local
,abe_wrap = WpHole
,abe_prags = SpecPrags []})
-- AbsBindsSig is a combination of AbsBinds and FunBind | 4,735 | false | false | 32 | 18 | 1,914 | 948 | 503 | 445 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.