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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
gbaz/cabal
|
cabal-install/Distribution/Client/Dependency/Modular/IndexConversion.hs
|
bsd-3-clause
|
-- | Convenience function to delete a 'FlaggedDep' if it's
-- for a 'PN' that isn't actually real.
filterIPNs :: IPNs -> Dependency -> FlaggedDep Component PN -> FlaggedDeps Component PN
filterIPNs ipns (Dependency pn _) fd
| S.notMember pn ipns = [fd]
| otherwise = []
| 287 |
filterIPNs :: IPNs -> Dependency -> FlaggedDep Component PN -> FlaggedDeps Component PN
filterIPNs ipns (Dependency pn _) fd
| S.notMember pn ipns = [fd]
| otherwise = []
| 188 |
filterIPNs ipns (Dependency pn _) fd
| S.notMember pn ipns = [fd]
| otherwise = []
| 100 | true | true | 0 | 9 | 64 | 77 | 37 | 40 | null | null |
mainland/dph
|
dph-lifted-copy/Data/Array/Parallel/Lifted/Combinators.hs
|
bsd-3-clause
|
slicePA_l (PArray n# is) (PArray _ lens) (PArray _ xss)
= PArray n#
$ case xss of { PNested segd xs ->
PNested segd'
$ bpermutePD xs (elementsSegd# segd')
(U.zipWith (+) (U.indices_s segd')
(U.replicate_s segd'
(U.zipWith (+) (fromScalarPData is)
(U.indicesSegd segd)))) }
where
segd' = U.lengthsToSegd (fromScalarPData lens)
-- update ---------------------------------------------------------------------
-- | Copy the source array in the destination, using new values for the given indices.
| 649 |
slicePA_l (PArray n# is) (PArray _ lens) (PArray _ xss)
= PArray n#
$ case xss of { PNested segd xs ->
PNested segd'
$ bpermutePD xs (elementsSegd# segd')
(U.zipWith (+) (U.indices_s segd')
(U.replicate_s segd'
(U.zipWith (+) (fromScalarPData is)
(U.indicesSegd segd)))) }
where
segd' = U.lengthsToSegd (fromScalarPData lens)
-- update ---------------------------------------------------------------------
-- | Copy the source array in the destination, using new values for the given indices.
| 649 |
slicePA_l (PArray n# is) (PArray _ lens) (PArray _ xss)
= PArray n#
$ case xss of { PNested segd xs ->
PNested segd'
$ bpermutePD xs (elementsSegd# segd')
(U.zipWith (+) (U.indices_s segd')
(U.replicate_s segd'
(U.zipWith (+) (fromScalarPData is)
(U.indicesSegd segd)))) }
where
segd' = U.lengthsToSegd (fromScalarPData lens)
-- update ---------------------------------------------------------------------
-- | Copy the source array in the destination, using new values for the given indices.
| 649 | false | false | 2 | 18 | 223 | 163 | 82 | 81 | null | null |
rahulmutt/ghcvm
|
compiler/Eta/BasicTypes/DataCon.hs
|
bsd-3-clause
|
dataConFieldLabels :: DataCon -> [FieldLabel]
dataConFieldLabels = dcFields
| 75 |
dataConFieldLabels :: DataCon -> [FieldLabel]
dataConFieldLabels = dcFields
| 75 |
dataConFieldLabels = dcFields
| 29 | false | true | 0 | 6 | 7 | 18 | 10 | 8 | null | null |
DaMSL/K3
|
src/Language/K3/Parser/ProgramBuilder.hs
|
apache-2.0
|
{- Runtime functions -}
openBuiltinFn :: K3 Expression
openBuiltinFn = EC.variable "openBuiltin"
| 96 |
openBuiltinFn :: K3 Expression
openBuiltinFn = EC.variable "openBuiltin"
| 72 |
openBuiltinFn = EC.variable "openBuiltin"
| 41 | true | true | 0 | 6 | 11 | 20 | 10 | 10 | null | null |
kmate/raw-feldspar
|
src/Feldspar/Data/Vector.hs
|
bsd-3-clause
|
-- | Append two vectors to make a 'Push' vector
(++) :: (Pushy m vec1 a, Pushy m vec2 a, Monad m) => vec1 -> vec2 -> Push m a
vec1 ++ vec2 = Push (len1 + length v2) $ \write ->
dumpPush v1 write >> dumpPush v2 (write . (+len1))
where
v1 = toPush vec1
v2 = toPush vec2
len1 = length v1
-- Concatenate nested vectors to a 'Push' vector
| 356 |
(++) :: (Pushy m vec1 a, Pushy m vec2 a, Monad m) => vec1 -> vec2 -> Push m a
vec1 ++ vec2 = Push (len1 + length v2) $ \write ->
dumpPush v1 write >> dumpPush v2 (write . (+len1))
where
v1 = toPush vec1
v2 = toPush vec2
len1 = length v1
-- Concatenate nested vectors to a 'Push' vector
| 308 |
vec1 ++ vec2 = Push (len1 + length v2) $ \write ->
dumpPush v1 write >> dumpPush v2 (write . (+len1))
where
v1 = toPush vec1
v2 = toPush vec2
len1 = length v1
-- Concatenate nested vectors to a 'Push' vector
| 230 | true | true | 0 | 11 | 94 | 140 | 71 | 69 | null | null |
huggablemonad/smooch
|
app/tests/ParseCelSpec.hs
|
gpl-3.0
|
-- | Old style with invalid height.
invalidOldCel4 :: ByteString
invalidOldCel4 =
let header = makeOldHeader 1 0
celData = BS.singleton 0x00
in BS.concat [header, celData]
| 181 |
invalidOldCel4 :: ByteString
invalidOldCel4 =
let header = makeOldHeader 1 0
celData = BS.singleton 0x00
in BS.concat [header, celData]
| 145 |
invalidOldCel4 =
let header = makeOldHeader 1 0
celData = BS.singleton 0x00
in BS.concat [header, celData]
| 116 | true | true | 0 | 10 | 35 | 55 | 26 | 29 | null | null |
FranklinChen/Idris-dev
|
src/Idris/Core/Evaluate.hs
|
bsd-3-clause
|
canonical (VUType _) = True
| 27 |
canonical (VUType _) = True
| 27 |
canonical (VUType _) = True
| 27 | false | false | 0 | 7 | 4 | 15 | 7 | 8 | null | null |
amccausl/Swish
|
Swish/HaskellRDF/N3ParserTest.hs
|
lgpl-2.1
|
tx1630 = arc b5 p2 o2
| 21 |
tx1630 = arc b5 p2 o2
| 21 |
tx1630 = arc b5 p2 o2
| 21 | false | false | 0 | 5 | 5 | 13 | 6 | 7 | null | null |
SEEK-Org/evaporate
|
src/Stack.hs
|
mit
|
throwIfStackFailed a = throwM $ StackOperationFailed a
| 66 |
throwIfStackFailed a = throwM $ StackOperationFailed a
| 66 |
throwIfStackFailed a = throwM $ StackOperationFailed a
| 66 | false | false | 0 | 6 | 18 | 16 | 7 | 9 | null | null |
vito/hummus
|
src/Hummus/Types.hs
|
bsd-3-clause
|
toList :: Value ans -> [Value ans]
toList (Pair a b) = a : toList b
| 67 |
toList :: Value ans -> [Value ans]
toList (Pair a b) = a : toList b
| 67 |
toList (Pair a b) = a : toList b
| 32 | false | true | 2 | 9 | 15 | 49 | 21 | 28 | null | null |
sgillespie/ghc
|
compiler/typecheck/TcType.hs
|
bsd-3-clause
|
isSigMaybe (ConArgCtxt n) = Just n
| 36 |
isSigMaybe (ConArgCtxt n) = Just n
| 36 |
isSigMaybe (ConArgCtxt n) = Just n
| 36 | false | false | 0 | 7 | 7 | 18 | 8 | 10 | null | null |
klarh/hasdy
|
test/NeighborList.hs
|
apache-2.0
|
triplify (x:y:z:rest) = (x, y, z):triplify rest
| 47 |
triplify (x:y:z:rest) = (x, y, z):triplify rest
| 47 |
triplify (x:y:z:rest) = (x, y, z):triplify rest
| 47 | false | false | 0 | 9 | 6 | 40 | 21 | 19 | null | null |
Zigazou/containers
|
Data/Tree.hs
|
bsd-3-clause
|
unfoldForestM f = Prelude.mapM (unfoldTreeM f)
| 46 |
unfoldForestM f = Prelude.mapM (unfoldTreeM f)
| 46 |
unfoldForestM f = Prelude.mapM (unfoldTreeM f)
| 46 | false | false | 1 | 7 | 5 | 23 | 9 | 14 | null | null |
anton-dessiatov/stack
|
src/Stack/Types/Config.hs
|
bsd-3-clause
|
installationRootDeps :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir)
installationRootDeps = do
root <- view stackRootL
-- TODO: also useShaPathOnWindows here, once #1173 is resolved.
psc <- platformSnapAndCompilerRel
return $ root </> $(mkRelDir "snapshots") </> psc
-- | Installation root for locals
| 344 |
installationRootDeps :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir)
installationRootDeps = do
root <- view stackRootL
-- TODO: also useShaPathOnWindows here, once #1173 is resolved.
psc <- platformSnapAndCompilerRel
return $ root </> $(mkRelDir "snapshots") </> psc
-- | Installation root for locals
| 344 |
installationRootDeps = do
root <- view stackRootL
-- TODO: also useShaPathOnWindows here, once #1173 is resolved.
psc <- platformSnapAndCompilerRel
return $ root </> $(mkRelDir "snapshots") </> psc
-- | Installation root for locals
| 248 | false | true | 0 | 11 | 63 | 92 | 43 | 49 | null | null |
mietek/untitled-wai
|
src/Access.hs
|
bsd-3-clause
|
createPrivsTable :: DB -> IO ()
createPrivsTable db = do
execute_ db [sql|
CREATE TABLE privs
( priv_id serial PRIMARY KEY
, priv_name text NOT NULL UNIQUE
)
|]
createAudit db "privs"
| 229 |
createPrivsTable :: DB -> IO ()
createPrivsTable db = do
execute_ db [sql|
CREATE TABLE privs
( priv_id serial PRIMARY KEY
, priv_name text NOT NULL UNIQUE
)
|]
createAudit db "privs"
| 229 |
createPrivsTable db = do
execute_ db [sql|
CREATE TABLE privs
( priv_id serial PRIMARY KEY
, priv_name text NOT NULL UNIQUE
)
|]
createAudit db "privs"
| 197 | false | true | 0 | 7 | 77 | 43 | 21 | 22 | null | null |
mrmonday/Idris-dev
|
src/Idris/Primitives.hs
|
bsd-3-clause
|
bUn (ITFixed IT16) op [B16 x] = Just $ B16 (op x)
| 53 |
bUn (ITFixed IT16) op [B16 x] = Just $ B16 (op x)
| 53 |
bUn (ITFixed IT16) op [B16 x] = Just $ B16 (op x)
| 53 | false | false | 0 | 8 | 15 | 38 | 18 | 20 | null | null |
chwthewke/horbits
|
testsuite/Horbits/UI/CameraTest.hs
|
bsd-3-clause
|
genCamera :: Gen (OrthoCamera Double)
genCamera = do
cx <- double
cy <- double
cz <- double
col <- choose (0, pi)
lng <- choose (0, 2 * pi)
s <- double
w <- int
h <- int
return $ OrthoCamera (V3 cx cy cz) col lng s w h $ linearZoom 1 (1, 10)
where
double = choose (0, 1000) `suchThat` (> 0)
int = choose (100, 2000)
| 361 |
genCamera :: Gen (OrthoCamera Double)
genCamera = do
cx <- double
cy <- double
cz <- double
col <- choose (0, pi)
lng <- choose (0, 2 * pi)
s <- double
w <- int
h <- int
return $ OrthoCamera (V3 cx cy cz) col lng s w h $ linearZoom 1 (1, 10)
where
double = choose (0, 1000) `suchThat` (> 0)
int = choose (100, 2000)
| 361 |
genCamera = do
cx <- double
cy <- double
cz <- double
col <- choose (0, pi)
lng <- choose (0, 2 * pi)
s <- double
w <- int
h <- int
return $ OrthoCamera (V3 cx cy cz) col lng s w h $ linearZoom 1 (1, 10)
where
double = choose (0, 1000) `suchThat` (> 0)
int = choose (100, 2000)
| 323 | false | true | 4 | 11 | 114 | 196 | 92 | 104 | null | null |
Fuuzetsu/cabal2nix
|
src/Distribution/Nixpkgs/Haskell/FromCabal/Normalize.hs
|
bsd-3-clause
|
quote [] = []
| 22 |
quote [] = []
| 22 |
quote [] = []
| 22 | false | false | 0 | 6 | 12 | 13 | 6 | 7 | null | null |
DavidAlphaFox/ghc
|
libraries/bytestring/Data/ByteString/Char8.hs
|
bsd-3-clause
|
unlines :: [ByteString] -> ByteString
unlines [] = empty
| 56 |
unlines :: [ByteString] -> ByteString
unlines [] = empty
| 56 |
unlines [] = empty
| 18 | false | true | 0 | 6 | 8 | 23 | 12 | 11 | null | null |
llllllllll/htst
|
Htst/Runner.hs
|
gpl-2.0
|
-- drop the root '/'
-- | Recursive copy of a directory into the tmpDir.
-- Only copies the files that match the predicate.
cpR :: (String -> Bool) -> FilePath -> IO ()
cpR pred d = find always applyPred d >>= mapM_ cp
where
cp p = doesDirectoryExist p
>>= \b -> (if b
then createDirectoryIfMissing True
else copyFile p) $ underTmp p
applyPred = pred <$> filePath ||? (== Directory) <$> fileType
-- | Runs an asynchronous 'Job'
| 510 |
cpR :: (String -> Bool) -> FilePath -> IO ()
cpR pred d = find always applyPred d >>= mapM_ cp
where
cp p = doesDirectoryExist p
>>= \b -> (if b
then createDirectoryIfMissing True
else copyFile p) $ underTmp p
applyPred = pred <$> filePath ||? (== Directory) <$> fileType
-- | Runs an asynchronous 'Job'
| 384 |
cpR pred d = find always applyPred d >>= mapM_ cp
where
cp p = doesDirectoryExist p
>>= \b -> (if b
then createDirectoryIfMissing True
else copyFile p) $ underTmp p
applyPred = pred <$> filePath ||? (== Directory) <$> fileType
-- | Runs an asynchronous 'Job'
| 339 | true | true | 14 | 9 | 163 | 143 | 67 | 76 | null | null |
GRACeFUL-project/GRACe
|
examples/CLD.hs
|
bsd-3-clause
|
constructSum :: [Port Sign] -> GCM (Port Sign)
constructSum [] = do
p <- createPort
set p 0
return p
| 106 |
constructSum :: [Port Sign] -> GCM (Port Sign)
constructSum [] = do
p <- createPort
set p 0
return p
| 106 |
constructSum [] = do
p <- createPort
set p 0
return p
| 59 | false | true | 0 | 9 | 25 | 61 | 26 | 35 | null | null |
co-dan/warm_fuzzy_things
|
src/Data/Functor/Algebra.hs
|
bsd-3-clause
|
optPlus = optPlus'
| 18 |
optPlus = optPlus'
| 18 |
optPlus = optPlus'
| 18 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
ulricha/algebra-sql
|
src/Database/Algebra/SQL/Render/Query.hs
|
bsd-3-clause
|
renderExtractField ExtractMonth = kw "month"
| 44 |
renderExtractField ExtractMonth = kw "month"
| 44 |
renderExtractField ExtractMonth = kw "month"
| 44 | false | false | 0 | 5 | 4 | 12 | 5 | 7 | null | null |
Gwin73/Schemini
|
src/one-file-version/Schemini.hs
|
mit
|
primEnv = M.fromList
[("+", Function $ intIntBinop (+)),
("-", Function $ intIntBinop (-)),
("*", Function $ intIntBinop (*)),
("/", Function $ intIntBinop div),
("mod", Function $ intIntBinop mod),
("=", Function $ intBoolBinop (==)),
(">", Function $ intBoolBinop (>)),
(">=", Function $ intBoolBinop (>=)),
("<", Function $ intBoolBinop (<)),
("<=", Function $ intBoolBinop (<=)),
("int?", Function $ lispvalQ unpackInt),
("bool?", Function $ lispvalQ unpackBool),
("str-append", Function $ binop unpackStr unpackStr String (++)),
("int->str", Function $ unop unpackInt String show),
("str->int", Function $ unop unpackStr Int read),
("str-length", Function $ unop unpackStr Int (toInteger . length)),
("str=?", Function $ binop unpackStr unpackStr Bool (==)),
("str?", Function $ lispvalQ unpackStr),
("car", Function $ unop unpackLst id (head)),
("cdr", Function $ unop unpackLst List (tail)),
("cons", Function $ binop Right unpackLst List (:)),
("list?", Function $ lispvalQ unpackLst),
("equal?", Function equal),
("print-line", IOFunction printLine),
("read-line", IOFunction readLine)
]
| 1,207 |
primEnv = M.fromList
[("+", Function $ intIntBinop (+)),
("-", Function $ intIntBinop (-)),
("*", Function $ intIntBinop (*)),
("/", Function $ intIntBinop div),
("mod", Function $ intIntBinop mod),
("=", Function $ intBoolBinop (==)),
(">", Function $ intBoolBinop (>)),
(">=", Function $ intBoolBinop (>=)),
("<", Function $ intBoolBinop (<)),
("<=", Function $ intBoolBinop (<=)),
("int?", Function $ lispvalQ unpackInt),
("bool?", Function $ lispvalQ unpackBool),
("str-append", Function $ binop unpackStr unpackStr String (++)),
("int->str", Function $ unop unpackInt String show),
("str->int", Function $ unop unpackStr Int read),
("str-length", Function $ unop unpackStr Int (toInteger . length)),
("str=?", Function $ binop unpackStr unpackStr Bool (==)),
("str?", Function $ lispvalQ unpackStr),
("car", Function $ unop unpackLst id (head)),
("cdr", Function $ unop unpackLst List (tail)),
("cons", Function $ binop Right unpackLst List (:)),
("list?", Function $ lispvalQ unpackLst),
("equal?", Function equal),
("print-line", IOFunction printLine),
("read-line", IOFunction readLine)
]
| 1,207 |
primEnv = M.fromList
[("+", Function $ intIntBinop (+)),
("-", Function $ intIntBinop (-)),
("*", Function $ intIntBinop (*)),
("/", Function $ intIntBinop div),
("mod", Function $ intIntBinop mod),
("=", Function $ intBoolBinop (==)),
(">", Function $ intBoolBinop (>)),
(">=", Function $ intBoolBinop (>=)),
("<", Function $ intBoolBinop (<)),
("<=", Function $ intBoolBinop (<=)),
("int?", Function $ lispvalQ unpackInt),
("bool?", Function $ lispvalQ unpackBool),
("str-append", Function $ binop unpackStr unpackStr String (++)),
("int->str", Function $ unop unpackInt String show),
("str->int", Function $ unop unpackStr Int read),
("str-length", Function $ unop unpackStr Int (toInteger . length)),
("str=?", Function $ binop unpackStr unpackStr Bool (==)),
("str?", Function $ lispvalQ unpackStr),
("car", Function $ unop unpackLst id (head)),
("cdr", Function $ unop unpackLst List (tail)),
("cons", Function $ binop Right unpackLst List (:)),
("list?", Function $ lispvalQ unpackLst),
("equal?", Function equal),
("print-line", IOFunction printLine),
("read-line", IOFunction readLine)
]
| 1,207 | false | false | 0 | 10 | 254 | 472 | 273 | 199 | null | null |
sleepomeno/TForth
|
src/TF/Util.hs
|
apache-2.0
|
fromThree' (Three' (x,y)) = (x,y) & both %~ view _Wrapped & uncurry zip
| 71 |
fromThree' (Three' (x,y)) = (x,y) & both %~ view _Wrapped & uncurry zip
| 71 |
fromThree' (Three' (x,y)) = (x,y) & both %~ view _Wrapped & uncurry zip
| 71 | false | false | 0 | 8 | 12 | 45 | 23 | 22 | null | null |
sebaste/dotfiles
|
.xmonad/xmonad.hs
|
mit
|
-- Border color for focused window.
myFocusedBorderColor = "#2973bc"
| 68 |
myFocusedBorderColor = "#2973bc"
| 32 |
myFocusedBorderColor = "#2973bc"
| 32 | true | false | 0 | 4 | 8 | 7 | 4 | 3 | null | null |
kovach/libsbp
|
haskell/src/SwiftNav/SBP/Piksi.hs
|
lgpl-3.0
|
msgResetFilters :: Word16
msgResetFilters = 0x0022
| 50 |
msgResetFilters :: Word16
msgResetFilters = 0x0022
| 50 |
msgResetFilters = 0x0022
| 24 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
hferreiro/replay
|
compiler/cmm/CLabel.hs
|
bsd-3-clause
|
needsCDecl (LargeBitmapLabel _) = False
| 47 |
needsCDecl (LargeBitmapLabel _) = False
| 47 |
needsCDecl (LargeBitmapLabel _) = False
| 47 | false | false | 0 | 7 | 12 | 15 | 7 | 8 | null | null |
oldmanmike/ghc
|
compiler/main/DynFlags.hs
|
bsd-3-clause
|
package_flags_deps :: [(Deprecation, Flag (CmdLineP DynFlags))]
package_flags_deps = [
------- Packages ----------------------------------------------------
make_ord_flag defFlag "package-db"
(HasArg (addPkgConfRef . PkgConfFile))
, make_ord_flag defFlag "clear-package-db" (NoArg clearPkgConf)
, make_ord_flag defFlag "no-global-package-db" (NoArg removeGlobalPkgConf)
, make_ord_flag defFlag "no-user-package-db" (NoArg removeUserPkgConf)
, make_ord_flag defFlag "global-package-db"
(NoArg (addPkgConfRef GlobalPkgConf))
, make_ord_flag defFlag "user-package-db"
(NoArg (addPkgConfRef UserPkgConf))
-- backwards compat with GHC<=7.4 :
, make_dep_flag defFlag "package-conf"
(HasArg $ addPkgConfRef . PkgConfFile) "Use -package-db instead"
, make_dep_flag defFlag "no-user-package-conf"
(NoArg removeUserPkgConf) "Use -no-user-package-db instead"
, make_ord_flag defGhcFlag "package-name" (HasArg $ \name -> do
upd (setUnitId name))
-- TODO: Since we JUST deprecated
-- -this-package-key, let's keep this
-- undeprecated for another cycle.
-- Deprecate this eventually.
-- deprecate "Use -this-unit-id instead")
, make_dep_flag defGhcFlag "this-package-key" (HasArg $ upd . setUnitId)
"Use -this-unit-id instead"
, make_ord_flag defGhcFlag "this-unit-id" (hasArg setUnitId)
, make_ord_flag defFlag "package" (HasArg exposePackage)
, make_ord_flag defFlag "plugin-package-id" (HasArg exposePluginPackageId)
, make_ord_flag defFlag "plugin-package" (HasArg exposePluginPackage)
, make_ord_flag defFlag "package-id" (HasArg exposePackageId)
, make_ord_flag defFlag "hide-package" (HasArg hidePackage)
, make_ord_flag defFlag "hide-all-packages"
(NoArg (setGeneralFlag Opt_HideAllPackages))
, make_ord_flag defFlag "hide-all-plugin-packages"
(NoArg (setGeneralFlag Opt_HideAllPluginPackages))
, make_ord_flag defFlag "package-env" (HasArg setPackageEnv)
, make_ord_flag defFlag "ignore-package" (HasArg ignorePackage)
, make_dep_flag defFlag "syslib" (HasArg exposePackage) "Use -package instead"
, make_ord_flag defFlag "distrust-all-packages"
(NoArg (setGeneralFlag Opt_DistrustAllPackages))
, make_ord_flag defFlag "trust" (HasArg trustPackage)
, make_ord_flag defFlag "distrust" (HasArg distrustPackage)
]
where
setPackageEnv env = upd $ \s -> s { packageEnv = Just env }
-- | Make a list of flags for shell completion.
-- Filter all available flags into two groups, for interactive GHC vs all other.
| 2,925 |
package_flags_deps :: [(Deprecation, Flag (CmdLineP DynFlags))]
package_flags_deps = [
------- Packages ----------------------------------------------------
make_ord_flag defFlag "package-db"
(HasArg (addPkgConfRef . PkgConfFile))
, make_ord_flag defFlag "clear-package-db" (NoArg clearPkgConf)
, make_ord_flag defFlag "no-global-package-db" (NoArg removeGlobalPkgConf)
, make_ord_flag defFlag "no-user-package-db" (NoArg removeUserPkgConf)
, make_ord_flag defFlag "global-package-db"
(NoArg (addPkgConfRef GlobalPkgConf))
, make_ord_flag defFlag "user-package-db"
(NoArg (addPkgConfRef UserPkgConf))
-- backwards compat with GHC<=7.4 :
, make_dep_flag defFlag "package-conf"
(HasArg $ addPkgConfRef . PkgConfFile) "Use -package-db instead"
, make_dep_flag defFlag "no-user-package-conf"
(NoArg removeUserPkgConf) "Use -no-user-package-db instead"
, make_ord_flag defGhcFlag "package-name" (HasArg $ \name -> do
upd (setUnitId name))
-- TODO: Since we JUST deprecated
-- -this-package-key, let's keep this
-- undeprecated for another cycle.
-- Deprecate this eventually.
-- deprecate "Use -this-unit-id instead")
, make_dep_flag defGhcFlag "this-package-key" (HasArg $ upd . setUnitId)
"Use -this-unit-id instead"
, make_ord_flag defGhcFlag "this-unit-id" (hasArg setUnitId)
, make_ord_flag defFlag "package" (HasArg exposePackage)
, make_ord_flag defFlag "plugin-package-id" (HasArg exposePluginPackageId)
, make_ord_flag defFlag "plugin-package" (HasArg exposePluginPackage)
, make_ord_flag defFlag "package-id" (HasArg exposePackageId)
, make_ord_flag defFlag "hide-package" (HasArg hidePackage)
, make_ord_flag defFlag "hide-all-packages"
(NoArg (setGeneralFlag Opt_HideAllPackages))
, make_ord_flag defFlag "hide-all-plugin-packages"
(NoArg (setGeneralFlag Opt_HideAllPluginPackages))
, make_ord_flag defFlag "package-env" (HasArg setPackageEnv)
, make_ord_flag defFlag "ignore-package" (HasArg ignorePackage)
, make_dep_flag defFlag "syslib" (HasArg exposePackage) "Use -package instead"
, make_ord_flag defFlag "distrust-all-packages"
(NoArg (setGeneralFlag Opt_DistrustAllPackages))
, make_ord_flag defFlag "trust" (HasArg trustPackage)
, make_ord_flag defFlag "distrust" (HasArg distrustPackage)
]
where
setPackageEnv env = upd $ \s -> s { packageEnv = Just env }
-- | Make a list of flags for shell completion.
-- Filter all available flags into two groups, for interactive GHC vs all other.
| 2,925 |
package_flags_deps = [
------- Packages ----------------------------------------------------
make_ord_flag defFlag "package-db"
(HasArg (addPkgConfRef . PkgConfFile))
, make_ord_flag defFlag "clear-package-db" (NoArg clearPkgConf)
, make_ord_flag defFlag "no-global-package-db" (NoArg removeGlobalPkgConf)
, make_ord_flag defFlag "no-user-package-db" (NoArg removeUserPkgConf)
, make_ord_flag defFlag "global-package-db"
(NoArg (addPkgConfRef GlobalPkgConf))
, make_ord_flag defFlag "user-package-db"
(NoArg (addPkgConfRef UserPkgConf))
-- backwards compat with GHC<=7.4 :
, make_dep_flag defFlag "package-conf"
(HasArg $ addPkgConfRef . PkgConfFile) "Use -package-db instead"
, make_dep_flag defFlag "no-user-package-conf"
(NoArg removeUserPkgConf) "Use -no-user-package-db instead"
, make_ord_flag defGhcFlag "package-name" (HasArg $ \name -> do
upd (setUnitId name))
-- TODO: Since we JUST deprecated
-- -this-package-key, let's keep this
-- undeprecated for another cycle.
-- Deprecate this eventually.
-- deprecate "Use -this-unit-id instead")
, make_dep_flag defGhcFlag "this-package-key" (HasArg $ upd . setUnitId)
"Use -this-unit-id instead"
, make_ord_flag defGhcFlag "this-unit-id" (hasArg setUnitId)
, make_ord_flag defFlag "package" (HasArg exposePackage)
, make_ord_flag defFlag "plugin-package-id" (HasArg exposePluginPackageId)
, make_ord_flag defFlag "plugin-package" (HasArg exposePluginPackage)
, make_ord_flag defFlag "package-id" (HasArg exposePackageId)
, make_ord_flag defFlag "hide-package" (HasArg hidePackage)
, make_ord_flag defFlag "hide-all-packages"
(NoArg (setGeneralFlag Opt_HideAllPackages))
, make_ord_flag defFlag "hide-all-plugin-packages"
(NoArg (setGeneralFlag Opt_HideAllPluginPackages))
, make_ord_flag defFlag "package-env" (HasArg setPackageEnv)
, make_ord_flag defFlag "ignore-package" (HasArg ignorePackage)
, make_dep_flag defFlag "syslib" (HasArg exposePackage) "Use -package instead"
, make_ord_flag defFlag "distrust-all-packages"
(NoArg (setGeneralFlag Opt_DistrustAllPackages))
, make_ord_flag defFlag "trust" (HasArg trustPackage)
, make_ord_flag defFlag "distrust" (HasArg distrustPackage)
]
where
setPackageEnv env = upd $ \s -> s { packageEnv = Just env }
-- | Make a list of flags for shell completion.
-- Filter all available flags into two groups, for interactive GHC vs all other.
| 2,861 | false | true | 0 | 14 | 780 | 526 | 271 | 255 | null | null |
khajavi/pandoc
|
src/Text/Pandoc/Readers/Markdown.hs
|
gpl-2.0
|
escapedChar :: GenParser Char ParserState Inline
escapedChar = do
char '\\'
state <- getState
result <- option '\\' $ if stateStrict state
then oneOf "\\`*_{}[]()>#+-.!~"
else satisfy (not . isAlphaNum)
return $ case result of
' ' -> Str "\160" -- "\ " is a nonbreaking space
'\n' -> LineBreak -- "\[newline]" is a linebreak
_ -> Str [result]
| 465 |
escapedChar :: GenParser Char ParserState Inline
escapedChar = do
char '\\'
state <- getState
result <- option '\\' $ if stateStrict state
then oneOf "\\`*_{}[]()>#+-.!~"
else satisfy (not . isAlphaNum)
return $ case result of
' ' -> Str "\160" -- "\ " is a nonbreaking space
'\n' -> LineBreak -- "\[newline]" is a linebreak
_ -> Str [result]
| 465 |
escapedChar = do
char '\\'
state <- getState
result <- option '\\' $ if stateStrict state
then oneOf "\\`*_{}[]()>#+-.!~"
else satisfy (not . isAlphaNum)
return $ case result of
' ' -> Str "\160" -- "\ " is a nonbreaking space
'\n' -> LineBreak -- "\[newline]" is a linebreak
_ -> Str [result]
| 416 | false | true | 1 | 13 | 181 | 113 | 52 | 61 | null | null |
mdsteele/fallback
|
src/Fallback/State/Tags.hs
|
gpl-3.0
|
abilityName RopeDart = "Rope Dart"
| 34 |
abilityName RopeDart = "Rope Dart"
| 34 |
abilityName RopeDart = "Rope Dart"
| 34 | false | false | 1 | 5 | 4 | 13 | 4 | 9 | null | null |
polachok/hs-nginx
|
src/Nginx/Main.hs
|
mit
|
eventsD = EventsDirective <$> (string "events" *> skipSpace *> char '{' *> skipSpace *> many events <* skipSpace <* char '}')
| 125 |
eventsD = EventsDirective <$> (string "events" *> skipSpace *> char '{' *> skipSpace *> many events <* skipSpace <* char '}')
| 125 |
eventsD = EventsDirective <$> (string "events" *> skipSpace *> char '{' *> skipSpace *> many events <* skipSpace <* char '}')
| 125 | false | false | 1 | 14 | 20 | 53 | 23 | 30 | null | null |
sonyandy/tnt
|
Control/Monad/Code/Opcode.hs
|
bsd-3-clause
|
d2f :: Word8
d2f = 0x90
| 23 |
d2f :: Word8
d2f = 0x90
| 23 |
d2f = 0x90
| 10 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
jcgruenhage/dendrite
|
vendor/src/github.com/apache/thrift/lib/hs/src/Thrift/Protocol/Binary.hs
|
apache-2.0
|
parseBinaryValue T_DOUBLE = TDouble . bsToDouble <$> P.take 8
| 61 |
parseBinaryValue T_DOUBLE = TDouble . bsToDouble <$> P.take 8
| 61 |
parseBinaryValue T_DOUBLE = TDouble . bsToDouble <$> P.take 8
| 61 | false | false | 0 | 7 | 8 | 22 | 10 | 12 | null | null |
kearnh/HToyRayTracer
|
src/OBJParser.hs
|
bsd-3-clause
|
handleParserResult :: a -> Either ParseError a -> IO a
handleParserResult def pr = do
case pr of
Left e -> do putStrLn "Failed parsing input file:"
print e
return def
Right x -> return x
| 255 |
handleParserResult :: a -> Either ParseError a -> IO a
handleParserResult def pr = do
case pr of
Left e -> do putStrLn "Failed parsing input file:"
print e
return def
Right x -> return x
| 255 |
handleParserResult def pr = do
case pr of
Left e -> do putStrLn "Failed parsing input file:"
print e
return def
Right x -> return x
| 200 | false | true | 0 | 12 | 104 | 78 | 33 | 45 | null | null |
YellPika/Hannel
|
src/Control/Concurrent/Transactional/Event/Trail.hs
|
mit
|
dependencies :: Trail -> [Trail]
dependencies trail =
trail :
case path trail of
[] -> []
Choose _:xs -> dependencies (trail { path = xs })
Swap partner cRef1 cRef2 : xs ->
extend partner (Swap (trail { path = xs }) cRef2 cRef1) :
dependencies trail { path = xs } ++
dependencies partner
| 355 |
dependencies :: Trail -> [Trail]
dependencies trail =
trail :
case path trail of
[] -> []
Choose _:xs -> dependencies (trail { path = xs })
Swap partner cRef1 cRef2 : xs ->
extend partner (Swap (trail { path = xs }) cRef2 cRef1) :
dependencies trail { path = xs } ++
dependencies partner
| 355 |
dependencies trail =
trail :
case path trail of
[] -> []
Choose _:xs -> dependencies (trail { path = xs })
Swap partner cRef1 cRef2 : xs ->
extend partner (Swap (trail { path = xs }) cRef2 cRef1) :
dependencies trail { path = xs } ++
dependencies partner
| 322 | false | true | 0 | 16 | 123 | 134 | 68 | 66 | null | null |
lukexi/bindings-Oculus
|
test/case1/GLFWWindow.hs
|
apache-2.0
|
keyPress s _ GLFW.Key'A _ GLFW.KeyState'Released _
= writeIORef (lKey s) 0
| 81 |
keyPress s _ GLFW.Key'A _ GLFW.KeyState'Released _
= writeIORef (lKey s) 0
| 81 |
keyPress s _ GLFW.Key'A _ GLFW.KeyState'Released _
= writeIORef (lKey s) 0
| 81 | false | false | 0 | 7 | 18 | 34 | 16 | 18 | null | null |
abuiles/turbinado-blog
|
Turbinado/Environment/Logger.hs
|
bsd-3-clause
|
criticalM :: (HasEnvironment m) => String -> m ()
criticalM = wrapLoggerLock (L.logM "Turbinado" L.CRITICAL)
| 112 |
criticalM :: (HasEnvironment m) => String -> m ()
criticalM = wrapLoggerLock (L.logM "Turbinado" L.CRITICAL)
| 112 |
criticalM = wrapLoggerLock (L.logM "Turbinado" L.CRITICAL)
| 62 | false | true | 0 | 9 | 18 | 49 | 23 | 26 | null | null |
brownplt/webbits
|
src/BrownPLT/JavaScript/Analysis/Environment.hs
|
bsd-3-clause
|
nest :: Partial -> Partial
nest partial = Partial M.empty M.empty [partial]
| 75 |
nest :: Partial -> Partial
nest partial = Partial M.empty M.empty [partial]
| 75 |
nest partial = Partial M.empty M.empty [partial]
| 48 | false | true | 0 | 6 | 11 | 32 | 16 | 16 | null | null |
forste/haReFork
|
tools/hs2alfa/tst1.hs
|
bsd-3-clause
|
mapLengthProp f xs = length (map f xs) == length xs
| 51 |
mapLengthProp f xs = length (map f xs) == length xs
| 51 |
mapLengthProp f xs = length (map f xs) == length xs
| 51 | false | false | 1 | 8 | 10 | 33 | 13 | 20 | null | null |
jamesdarcy/DicomH
|
src/Data/Dicom/Tag.hs
|
bsd-3-clause
|
-- | Group 0x0028
nUMBER_OF_FRAMES :: DicomTag
nUMBER_OF_FRAMES = 0x00280008
| 76 |
nUMBER_OF_FRAMES :: DicomTag
nUMBER_OF_FRAMES = 0x00280008
| 58 |
nUMBER_OF_FRAMES = 0x00280008
| 29 | true | true | 0 | 4 | 9 | 12 | 7 | 5 | null | null |
jameshsmith/HRL
|
Server/Main.hs
|
mit
|
-- | Read an Int from an ASCII bytestring
readInt :: BS.ByteString -> Int
readInt = BS.foldl' (\x y -> x * 10 + (fromIntegral (y - 48))) 0
| 138 |
readInt :: BS.ByteString -> Int
readInt = BS.foldl' (\x y -> x * 10 + (fromIntegral (y - 48))) 0
| 96 |
readInt = BS.foldl' (\x y -> x * 10 + (fromIntegral (y - 48))) 0
| 64 | true | true | 0 | 12 | 28 | 56 | 30 | 26 | null | null |
ml9951/ghc
|
compiler/basicTypes/Module.hs
|
bsd-3-clause
|
mkModuleEnv :: [(Module, a)] -> ModuleEnv a
mkModuleEnv xs = ModuleEnv (Map.fromList xs)
| 88 |
mkModuleEnv :: [(Module, a)] -> ModuleEnv a
mkModuleEnv xs = ModuleEnv (Map.fromList xs)
| 88 |
mkModuleEnv xs = ModuleEnv (Map.fromList xs)
| 44 | false | true | 0 | 8 | 12 | 41 | 21 | 20 | null | null |
peterstuart/dark-sky
|
test/ResponseSpec.hs
|
mit
|
emptyDataPoint :: POSIXTime -> DP.DataPoint
emptyDataPoint time =
DP.emptyDataPoint
{ DP.time = time
}
| 108 |
emptyDataPoint :: POSIXTime -> DP.DataPoint
emptyDataPoint time =
DP.emptyDataPoint
{ DP.time = time
}
| 108 |
emptyDataPoint time =
DP.emptyDataPoint
{ DP.time = time
}
| 64 | false | true | 0 | 8 | 19 | 41 | 19 | 22 | null | null |
prt2121/haskell-practice
|
parconc/distrib-ping/ping.hs
|
apache-2.0
|
-- >>
-- <<master
master :: Process ()
master = do
node <- getSelfNode -- <1>
say $ printf "spawning on %s" (show node)
pid <- spawn node $(mkStaticClosure 'pingServer) -- <2>
mypid <- getSelfPid -- <3>
say $ printf "sending ping to %s" (show pid)
send pid (Ping mypid) -- <4>
Pong _ <- expect -- <5>
say "pong."
terminate -- <6>
-- >>
-- <<main
| 531 |
master :: Process ()
master = do
node <- getSelfNode -- <1>
say $ printf "spawning on %s" (show node)
pid <- spawn node $(mkStaticClosure 'pingServer) -- <2>
mypid <- getSelfPid -- <3>
say $ printf "sending ping to %s" (show pid)
send pid (Ping mypid) -- <4>
Pong _ <- expect -- <5>
say "pong."
terminate -- <6>
-- >>
-- <<main
| 512 |
master = do
node <- getSelfNode -- <1>
say $ printf "spawning on %s" (show node)
pid <- spawn node $(mkStaticClosure 'pingServer) -- <2>
mypid <- getSelfPid -- <3>
say $ printf "sending ping to %s" (show pid)
send pid (Ping mypid) -- <4>
Pong _ <- expect -- <5>
say "pong."
terminate -- <6>
-- >>
-- <<main
| 491 | true | true | 0 | 11 | 252 | 129 | 62 | 67 | null | null |
qrilka/xlsx
|
src/Codec/Xlsx/Types/Internal.hs
|
mit
|
unsafeRefId :: Int -> RefId
unsafeRefId num = RefId $ "rId" <> txti num
| 71 |
unsafeRefId :: Int -> RefId
unsafeRefId num = RefId $ "rId" <> txti num
| 71 |
unsafeRefId num = RefId $ "rId" <> txti num
| 43 | false | true | 0 | 6 | 13 | 29 | 14 | 15 | null | null |
bflyblue/parse-quote
|
Datalink.hs
|
unlicense
|
datalink :: Link -> Get Datalink
datalink DLT_EN10MB = ethernet
| 63 |
datalink :: Link -> Get Datalink
datalink DLT_EN10MB = ethernet
| 63 |
datalink DLT_EN10MB = ethernet
| 30 | false | true | 0 | 7 | 9 | 26 | 11 | 15 | null | null |
hspec/hspec
|
hspec-core/src/Test/Hspec/Core/Config.hs
|
mit
|
readConfigFiles :: IO [ConfigFile]
readConfigFiles = do
global <- readGlobalConfigFile
local <- readLocalConfigFile
return $ catMaybes [global, local]
| 156 |
readConfigFiles :: IO [ConfigFile]
readConfigFiles = do
global <- readGlobalConfigFile
local <- readLocalConfigFile
return $ catMaybes [global, local]
| 156 |
readConfigFiles = do
global <- readGlobalConfigFile
local <- readLocalConfigFile
return $ catMaybes [global, local]
| 121 | false | true | 0 | 9 | 23 | 47 | 23 | 24 | null | null |
ihc/futhark
|
src/Futhark/Internalise/TypesValues.hs
|
isc
|
internaliseUniqueness E.Unique = I.Unique
| 41 |
internaliseUniqueness E.Unique = I.Unique
| 41 |
internaliseUniqueness E.Unique = I.Unique
| 41 | false | false | 0 | 6 | 3 | 13 | 6 | 7 | null | null |
yu-i9/thih
|
src/Thih/Static/Prelude.hs
|
bsd-3-clause
|
tBool = TCon (Tycon "Bool" Star)
| 36 |
tBool = TCon (Tycon "Bool" Star)
| 36 |
tBool = TCon (Tycon "Bool" Star)
| 36 | false | false | 0 | 7 | 9 | 17 | 8 | 9 | null | null |
mightymoose/liquidhaskell
|
tests/pos/GhcSort2.hs
|
bsd-3-clause
|
wrap :: a -> [a]
wrap x = [x]
| 29 |
wrap :: a -> [a]
wrap x = [x]
| 29 |
wrap x = [x]
| 12 | false | true | 0 | 8 | 8 | 30 | 14 | 16 | null | null |
lshemesh/Slide
|
src/Board.hs
|
mit
|
getCoords :: Int -> Coords
getCoords x = swap $ x `divMod` 3
| 60 |
getCoords :: Int -> Coords
getCoords x = swap $ x `divMod` 3
| 60 |
getCoords x = swap $ x `divMod` 3
| 33 | false | true | 2 | 7 | 12 | 34 | 16 | 18 | null | null |
kmilner/tamarin-prover
|
lib/theory/src/Theory/Proof.hs
|
gpl-3.0
|
annotateProof :: (ProofStep a -> [b] -> b) -> Proof a -> Proof b
annotateProof f =
go
where
go (LNode step@(ProofStep method _) cs) =
LNode (ProofStep method info') cs'
where
cs' = M.map go cs
info' = f step (map (psInfo . root . snd) (M.toList cs'))
-- | Annotate a proof in a bottom-up fashion.
| 337 |
annotateProof :: (ProofStep a -> [b] -> b) -> Proof a -> Proof b
annotateProof f =
go
where
go (LNode step@(ProofStep method _) cs) =
LNode (ProofStep method info') cs'
where
cs' = M.map go cs
info' = f step (map (psInfo . root . snd) (M.toList cs'))
-- | Annotate a proof in a bottom-up fashion.
| 337 |
annotateProof f =
go
where
go (LNode step@(ProofStep method _) cs) =
LNode (ProofStep method info') cs'
where
cs' = M.map go cs
info' = f step (map (psInfo . root . snd) (M.toList cs'))
-- | Annotate a proof in a bottom-up fashion.
| 272 | false | true | 0 | 12 | 98 | 140 | 70 | 70 | null | null |
beni55/hermit
|
src/HERMIT/Name.hs
|
bsd-2-clause
|
findInNSModGuts :: (LiftCoreM m, HasHermitMEnv m, MonadIO m, MonadThings m)
=> NameSpace -> HermitName -> m Named
findInNSModGuts ns nm = do
rdrEnv <- liftM mg_rdr_env getModGuts
case lookupGRE_RdrName (toRdrName ns nm) rdrEnv of
[gre] -> nameToNamed $ gre_name gre
[] -> findInNSPackageDB ns nm
_ -> fail "findInNSModGuts: multiple names returned"
-- | Looks for Named in package database, or built-in packages.
| 468 |
findInNSModGuts :: (LiftCoreM m, HasHermitMEnv m, MonadIO m, MonadThings m)
=> NameSpace -> HermitName -> m Named
findInNSModGuts ns nm = do
rdrEnv <- liftM mg_rdr_env getModGuts
case lookupGRE_RdrName (toRdrName ns nm) rdrEnv of
[gre] -> nameToNamed $ gre_name gre
[] -> findInNSPackageDB ns nm
_ -> fail "findInNSModGuts: multiple names returned"
-- | Looks for Named in package database, or built-in packages.
| 468 |
findInNSModGuts ns nm = do
rdrEnv <- liftM mg_rdr_env getModGuts
case lookupGRE_RdrName (toRdrName ns nm) rdrEnv of
[gre] -> nameToNamed $ gre_name gre
[] -> findInNSPackageDB ns nm
_ -> fail "findInNSModGuts: multiple names returned"
-- | Looks for Named in package database, or built-in packages.
| 338 | false | true | 0 | 12 | 118 | 130 | 61 | 69 | null | null |
colinba/tip-toi-reveng
|
src/GMEWriter.hs
|
mit
|
offsetsAndThen :: [SPut] -> SPut
offsetsAndThen = mapFstMapSnd . map go
where go x = FunSplit putWord32 (getAddress x)
| 122 |
offsetsAndThen :: [SPut] -> SPut
offsetsAndThen = mapFstMapSnd . map go
where go x = FunSplit putWord32 (getAddress x)
| 122 |
offsetsAndThen = mapFstMapSnd . map go
where go x = FunSplit putWord32 (getAddress x)
| 89 | false | true | 0 | 9 | 22 | 46 | 23 | 23 | null | null |
39aldo39/klfc
|
src/Ahk.hs
|
gpl-3.0
|
printAhk' ∷ Ahk → String
printAhk' (Ahk singletonKeys keys) = unlines $
[ "; Generated by KLFC " ⊕ versionStr
, "; https://github.com/39aldo39/klfc"
, ""
, "#MaxHotkeysPerInterval 200"
, "#MaxThreadsPerHotkey 10"
, ""
, "SendUps(ByRef modifiers) {"
, " for index, modifier in modifiers {"
, " if (modifier == \"Caps\")"
, " SetCapsLockState, off"
, " else if (modifier == \"Num\")"
, " SetNumLockState, off"
, " else if InStr(modifier, \"Extend\")"
, " %modifier% := false"
, " else"
, " Send {%modifier% Up}"
, " }"
, " modifiers := Object()"
, "}"
, ""
, "SendAsUnicode(string) {"
, " Result := \"\""
, " Loop, Parse, string"
, " Result .= Format(\"{{}U+{:04x}{}}\", Ord(A_LoopField))"
, " Send {Blind}%Result%"
, "}"
, ""
, "DeadKeys := ComObjCreate(\"Scripting.Dictionary\")"
, ""
, "DeadKey(baseChar, table, name := \"\") {"
, " Global ActiveDeadKey"
, " if (ActiveDeadKey != \"\") {"
, " NewActiveDeadKey := ComObjCreate(\"Scripting.Dictionary\")"
, " for key in table {"
, " value := table.item(key)"
, " NewActiveDeadKey.item(key) := ActiveDeadKey.item(value)"
, " }"
, " result := ActiveDeadKey.item(name)"
, " if (IsObject(result)) {"
, " for key in result {"
, " value := result.item(key)"
, " NewActiveDeadKey.item(key) := value"
, " }"
, " } else if (result != \"\") {"
, " ActiveDeadKey := \"\""
, " SendAsUnicode(result)"
, " Return"
, " }"
, " ActiveDeadKey := NewActiveDeadKey"
, " Return"
, " }"
, " ActiveDeadKey := table"
, " Input key, L1, {Esc}{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}{Left}{Right}{Up}{Down}{Home}{End}{PgUp}{PgDn}{Del}{Ins}{BS}{PrintScreen}{Pause}{AppsKey}"
, " If InStr(ErrorLevel, \"EndKey:\") {"
, " ActiveDeadKey := \"\""
, " value := SubStr(ErrorLevel, 8)"
, " Send {Blind}{%value%}"
, " SendAsUnicode(baseChar)"
, " } else if (ErrorLevel != \"NewInput\") {"
, " value := ActiveDeadKey.item(key)"
, " ActiveDeadKey := \"\""
, " if (IsObject(value)) {"
, " DeadKey(baseChar, value)"
, " } else if (value != \"\") {"
, " SendAsUnicode(value)"
, " } else {"
, " SendAsUnicode(baseChar . key)"
, " }"
, " }"
, "}"
, ""
] ⧺ concatMap printAhkBinding singletonKeys
⧺ concatMap printAhkKey keys
| 2,604 |
printAhk' ∷ Ahk → String
printAhk' (Ahk singletonKeys keys) = unlines $
[ "; Generated by KLFC " ⊕ versionStr
, "; https://github.com/39aldo39/klfc"
, ""
, "#MaxHotkeysPerInterval 200"
, "#MaxThreadsPerHotkey 10"
, ""
, "SendUps(ByRef modifiers) {"
, " for index, modifier in modifiers {"
, " if (modifier == \"Caps\")"
, " SetCapsLockState, off"
, " else if (modifier == \"Num\")"
, " SetNumLockState, off"
, " else if InStr(modifier, \"Extend\")"
, " %modifier% := false"
, " else"
, " Send {%modifier% Up}"
, " }"
, " modifiers := Object()"
, "}"
, ""
, "SendAsUnicode(string) {"
, " Result := \"\""
, " Loop, Parse, string"
, " Result .= Format(\"{{}U+{:04x}{}}\", Ord(A_LoopField))"
, " Send {Blind}%Result%"
, "}"
, ""
, "DeadKeys := ComObjCreate(\"Scripting.Dictionary\")"
, ""
, "DeadKey(baseChar, table, name := \"\") {"
, " Global ActiveDeadKey"
, " if (ActiveDeadKey != \"\") {"
, " NewActiveDeadKey := ComObjCreate(\"Scripting.Dictionary\")"
, " for key in table {"
, " value := table.item(key)"
, " NewActiveDeadKey.item(key) := ActiveDeadKey.item(value)"
, " }"
, " result := ActiveDeadKey.item(name)"
, " if (IsObject(result)) {"
, " for key in result {"
, " value := result.item(key)"
, " NewActiveDeadKey.item(key) := value"
, " }"
, " } else if (result != \"\") {"
, " ActiveDeadKey := \"\""
, " SendAsUnicode(result)"
, " Return"
, " }"
, " ActiveDeadKey := NewActiveDeadKey"
, " Return"
, " }"
, " ActiveDeadKey := table"
, " Input key, L1, {Esc}{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}{Left}{Right}{Up}{Down}{Home}{End}{PgUp}{PgDn}{Del}{Ins}{BS}{PrintScreen}{Pause}{AppsKey}"
, " If InStr(ErrorLevel, \"EndKey:\") {"
, " ActiveDeadKey := \"\""
, " value := SubStr(ErrorLevel, 8)"
, " Send {Blind}{%value%}"
, " SendAsUnicode(baseChar)"
, " } else if (ErrorLevel != \"NewInput\") {"
, " value := ActiveDeadKey.item(key)"
, " ActiveDeadKey := \"\""
, " if (IsObject(value)) {"
, " DeadKey(baseChar, value)"
, " } else if (value != \"\") {"
, " SendAsUnicode(value)"
, " } else {"
, " SendAsUnicode(baseChar . key)"
, " }"
, " }"
, "}"
, ""
] ⧺ concatMap printAhkBinding singletonKeys
⧺ concatMap printAhkKey keys
| 2,604 |
printAhk' (Ahk singletonKeys keys) = unlines $
[ "; Generated by KLFC " ⊕ versionStr
, "; https://github.com/39aldo39/klfc"
, ""
, "#MaxHotkeysPerInterval 200"
, "#MaxThreadsPerHotkey 10"
, ""
, "SendUps(ByRef modifiers) {"
, " for index, modifier in modifiers {"
, " if (modifier == \"Caps\")"
, " SetCapsLockState, off"
, " else if (modifier == \"Num\")"
, " SetNumLockState, off"
, " else if InStr(modifier, \"Extend\")"
, " %modifier% := false"
, " else"
, " Send {%modifier% Up}"
, " }"
, " modifiers := Object()"
, "}"
, ""
, "SendAsUnicode(string) {"
, " Result := \"\""
, " Loop, Parse, string"
, " Result .= Format(\"{{}U+{:04x}{}}\", Ord(A_LoopField))"
, " Send {Blind}%Result%"
, "}"
, ""
, "DeadKeys := ComObjCreate(\"Scripting.Dictionary\")"
, ""
, "DeadKey(baseChar, table, name := \"\") {"
, " Global ActiveDeadKey"
, " if (ActiveDeadKey != \"\") {"
, " NewActiveDeadKey := ComObjCreate(\"Scripting.Dictionary\")"
, " for key in table {"
, " value := table.item(key)"
, " NewActiveDeadKey.item(key) := ActiveDeadKey.item(value)"
, " }"
, " result := ActiveDeadKey.item(name)"
, " if (IsObject(result)) {"
, " for key in result {"
, " value := result.item(key)"
, " NewActiveDeadKey.item(key) := value"
, " }"
, " } else if (result != \"\") {"
, " ActiveDeadKey := \"\""
, " SendAsUnicode(result)"
, " Return"
, " }"
, " ActiveDeadKey := NewActiveDeadKey"
, " Return"
, " }"
, " ActiveDeadKey := table"
, " Input key, L1, {Esc}{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}{Left}{Right}{Up}{Down}{Home}{End}{PgUp}{PgDn}{Del}{Ins}{BS}{PrintScreen}{Pause}{AppsKey}"
, " If InStr(ErrorLevel, \"EndKey:\") {"
, " ActiveDeadKey := \"\""
, " value := SubStr(ErrorLevel, 8)"
, " Send {Blind}{%value%}"
, " SendAsUnicode(baseChar)"
, " } else if (ErrorLevel != \"NewInput\") {"
, " value := ActiveDeadKey.item(key)"
, " ActiveDeadKey := \"\""
, " if (IsObject(value)) {"
, " DeadKey(baseChar, value)"
, " } else if (value != \"\") {"
, " SendAsUnicode(value)"
, " } else {"
, " SendAsUnicode(baseChar . key)"
, " }"
, " }"
, "}"
, ""
] ⧺ concatMap printAhkBinding singletonKeys
⧺ concatMap printAhkKey keys
| 2,579 | false | true | 2 | 8 | 802 | 266 | 167 | 99 | null | null |
x456/binary
|
benchmarks/Builder.hs
|
bsd-3-clause
|
fromWord8s (x:xs) = singleton x <> fromWord8s xs
| 48 |
fromWord8s (x:xs) = singleton x <> fromWord8s xs
| 48 |
fromWord8s (x:xs) = singleton x <> fromWord8s xs
| 48 | false | false | 0 | 7 | 7 | 26 | 12 | 14 | null | null |
Icelandjack/lens
|
src/Control/Lens/Setter.hs
|
bsd-3-clause
|
-- | Adjust every target of an 'IndexedSetter', 'IndexedLens' or 'IndexedTraversal'
-- with access to the index.
--
-- @
-- ('%@~') ≡ 'iover'
-- @
--
-- When you do not need access to the index then ('%~') is more liberal in what it can accept.
--
-- @
-- l '%~' f ≡ l '%@~' 'const' f
-- @
--
-- @
-- ('%@~') :: 'IndexedSetter' i s t a b -> (i -> a -> b) -> s -> t
-- ('%@~') :: 'IndexedLens' i s t a b -> (i -> a -> b) -> s -> t
-- ('%@~') :: 'IndexedTraversal' i s t a b -> (i -> a -> b) -> s -> t
-- @
(%@~) :: AnIndexedSetter i s t a b -> (i -> a -> b) -> s -> t
l %@~ f = l %~ Indexed f
| 599 |
(%@~) :: AnIndexedSetter i s t a b -> (i -> a -> b) -> s -> t
l %@~ f = l %~ Indexed f
| 86 |
l %@~ f = l %~ Indexed f
| 24 | true | true | 0 | 10 | 156 | 82 | 49 | 33 | null | null |
ambiata/mafia
|
src/Mafia/Process.hs
|
bsd-3-clause
|
callFrom_ :: (Functor m, MonadIO m, MonadCatch m)
=> (ProcessError -> e)
-> Directory
-> File
-> [Argument]
-> EitherT e m ()
callFrom_ up dir cmd args = do
Pass <- callFrom up dir cmd args
return ()
-- | Capture the output of a process when it fails.
--
| 310 |
callFrom_ :: (Functor m, MonadIO m, MonadCatch m)
=> (ProcessError -> e)
-> Directory
-> File
-> [Argument]
-> EitherT e m ()
callFrom_ up dir cmd args = do
Pass <- callFrom up dir cmd args
return ()
-- | Capture the output of a process when it fails.
--
| 309 |
callFrom_ up dir cmd args = do
Pass <- callFrom up dir cmd args
return ()
-- | Capture the output of a process when it fails.
--
| 133 | false | true | 0 | 12 | 106 | 107 | 52 | 55 | null | null |
girving/duck
|
duck/InferMonad.hs
|
bsd-3-clause
|
typeReError :: (Pretty s, MonadError TypeError m) => SrcLoc -> s -> m a -> m a
typeReError l m f = catchError f $ \te -> typeError l $ nestedPunct ':' m te
| 155 |
typeReError :: (Pretty s, MonadError TypeError m) => SrcLoc -> s -> m a -> m a
typeReError l m f = catchError f $ \te -> typeError l $ nestedPunct ':' m te
| 155 |
typeReError l m f = catchError f $ \te -> typeError l $ nestedPunct ':' m te
| 76 | false | true | 0 | 9 | 33 | 79 | 38 | 41 | null | null |
andyarvanitis/Idris-dev
|
src/IRTS/CodegenC.hs
|
bsd-3-clause
|
doOp v (LGe ITChar) [l, r] = doOp v (LGe ITNative) [l, r]
| 57 |
doOp v (LGe ITChar) [l, r] = doOp v (LGe ITNative) [l, r]
| 57 |
doOp v (LGe ITChar) [l, r] = doOp v (LGe ITNative) [l, r]
| 57 | false | false | 0 | 7 | 12 | 44 | 23 | 21 | null | null |
wayofthepie/audire
|
src/Lib.hs
|
bsd-3-clause
|
parseEtherFrame :: Parser EthernetFrame
parseEtherFrame = EthernetFrame
<$> take 6
<*> take 6
<*> take 2
<*> takeByteString
| 139 |
parseEtherFrame :: Parser EthernetFrame
parseEtherFrame = EthernetFrame
<$> take 6
<*> take 6
<*> take 2
<*> takeByteString
| 139 |
parseEtherFrame = EthernetFrame
<$> take 6
<*> take 6
<*> take 2
<*> takeByteString
| 99 | false | true | 0 | 9 | 33 | 39 | 18 | 21 | null | null |
da-x/ghc
|
compiler/main/DriverPipeline.hs
|
bsd-3-clause
|
-- | What phase to run after one of the backend code generators has run
hscPostBackendPhase :: DynFlags -> HscSource -> HscTarget -> Phase
hscPostBackendPhase _ HsBootFile _ = StopLn
| 186 |
hscPostBackendPhase :: DynFlags -> HscSource -> HscTarget -> Phase
hscPostBackendPhase _ HsBootFile _ = StopLn
| 114 |
hscPostBackendPhase _ HsBootFile _ = StopLn
| 47 | true | true | 0 | 7 | 33 | 31 | 16 | 15 | null | null |
jean-edouard/manager
|
apptool/OVF/AllocationUnit.hs
|
gpl-2.0
|
int_p = many1 digit >>= return . (read :: String -> Integer)
| 60 |
int_p = many1 digit >>= return . (read :: String -> Integer)
| 60 |
int_p = many1 digit >>= return . (read :: String -> Integer)
| 60 | false | false | 0 | 7 | 11 | 27 | 14 | 13 | null | null |
vikraman/ghc
|
compiler/basicTypes/IdInfo.hs
|
bsd-3-clause
|
setInlinePragInfo :: IdInfo -> InlinePragma -> IdInfo
setInlinePragInfo info pr = pr `seq` info { inlinePragInfo = pr }
| 119 |
setInlinePragInfo :: IdInfo -> InlinePragma -> IdInfo
setInlinePragInfo info pr = pr `seq` info { inlinePragInfo = pr }
| 119 |
setInlinePragInfo info pr = pr `seq` info { inlinePragInfo = pr }
| 65 | false | true | 0 | 8 | 18 | 47 | 23 | 24 | null | null |
aquatir/remember_java_api
|
code-sample-haskell/typed_fp_basics_cource/02_function_in_haskell/code.hs
|
mit
|
funk :: Int -> Int
funk x = undefined
| 37 |
funk :: Int -> Int
funk x = undefined
| 37 |
funk x = undefined
| 18 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
mikebenfield/ftensor
|
test/Tests/Math/Ftensor/General.hs
|
isc
|
case_v1 :: Assertion
case_v1 = case v1 of
Tensor arr -> arr @?= fromList [1::Int,2,3]
| 89 |
case_v1 :: Assertion
case_v1 = case v1 of
Tensor arr -> arr @?= fromList [1::Int,2,3]
| 89 |
case_v1 = case v1 of
Tensor arr -> arr @?= fromList [1::Int,2,3]
| 68 | false | true | 0 | 10 | 18 | 49 | 24 | 25 | null | null |
diagrams/diagrams-reflex
|
example/src/Colors.hs
|
bsd-3-clause
|
textD :: (Show a, Monoid m) => a -> QDiagram B V2 Double m
textD = fmap (annotate mempty) . D.text . show
| 105 |
textD :: (Show a, Monoid m) => a -> QDiagram B V2 Double m
textD = fmap (annotate mempty) . D.text . show
| 105 |
textD = fmap (annotate mempty) . D.text . show
| 46 | false | true | 0 | 9 | 22 | 58 | 29 | 29 | null | null |
mboes/vCard
|
Text/VCard/Format/Directory.hs
|
lgpl-3.0
|
writeVCard :: VCard -> B.ByteString
writeVCard (VCard ver attrs) =
D.printDirectory' $ [begin, version] ++ concat (Map.elems attrs) ++ [end]
where attr typ val = D.Prop (D.nakedType typ) [] val
begin = D.Prop (D.nakedType "BEGIN") [] (D.Text "VCARD")
end = D.Prop (D.nakedType "END") [] (D.Text "VCARD")
version = D.Prop (D.nakedType "VERSION") [] $
D.Text $ B.concat [ showBS $ version_major ver, "."
, showBS $ version_minor ver ]
| 534 |
writeVCard :: VCard -> B.ByteString
writeVCard (VCard ver attrs) =
D.printDirectory' $ [begin, version] ++ concat (Map.elems attrs) ++ [end]
where attr typ val = D.Prop (D.nakedType typ) [] val
begin = D.Prop (D.nakedType "BEGIN") [] (D.Text "VCARD")
end = D.Prop (D.nakedType "END") [] (D.Text "VCARD")
version = D.Prop (D.nakedType "VERSION") [] $
D.Text $ B.concat [ showBS $ version_major ver, "."
, showBS $ version_minor ver ]
| 534 |
writeVCard (VCard ver attrs) =
D.printDirectory' $ [begin, version] ++ concat (Map.elems attrs) ++ [end]
where attr typ val = D.Prop (D.nakedType typ) [] val
begin = D.Prop (D.nakedType "BEGIN") [] (D.Text "VCARD")
end = D.Prop (D.nakedType "END") [] (D.Text "VCARD")
version = D.Prop (D.nakedType "VERSION") [] $
D.Text $ B.concat [ showBS $ version_major ver, "."
, showBS $ version_minor ver ]
| 498 | false | true | 6 | 10 | 169 | 237 | 110 | 127 | null | null |
CulpaBS/wbBach
|
src/Futhark/Optimise/Fusion.hs
|
bsd-3-clause
|
bindRes :: FusedRes -> FusionGM a -> FusionGM a
bindRes rrr = local (\x -> x { fusedRes = rrr })
| 96 |
bindRes :: FusedRes -> FusionGM a -> FusionGM a
bindRes rrr = local (\x -> x { fusedRes = rrr })
| 96 |
bindRes rrr = local (\x -> x { fusedRes = rrr })
| 48 | false | true | 0 | 9 | 20 | 47 | 24 | 23 | null | null |
ntc2/cryptol
|
src/Cryptol/ModuleSystem/Monad.hs
|
bsd-3-clause
|
getSolverConfig :: ModuleM T.SolverConfig
getSolverConfig = ModuleT $ do
me <- get
return (meSolverConfig me)
| 114 |
getSolverConfig :: ModuleM T.SolverConfig
getSolverConfig = ModuleT $ do
me <- get
return (meSolverConfig me)
| 114 |
getSolverConfig = ModuleT $ do
me <- get
return (meSolverConfig me)
| 72 | false | true | 0 | 10 | 19 | 39 | 18 | 21 | null | null |
arowM/haskell-bookkeeping
|
test/Doctest.hs
|
mit
|
ghcExtensions :: [String]
ghcExtensions =
[ "-XOverloadedStrings"
, "-XRecordWildCards"
, "-XStrict"
, "-XStrictData"
]
| 139 |
ghcExtensions :: [String]
ghcExtensions =
[ "-XOverloadedStrings"
, "-XRecordWildCards"
, "-XStrict"
, "-XStrictData"
]
| 139 |
ghcExtensions =
[ "-XOverloadedStrings"
, "-XRecordWildCards"
, "-XStrict"
, "-XStrictData"
]
| 113 | false | true | 0 | 5 | 33 | 26 | 16 | 10 | null | null |
clockworkdevstudio/Idlewild-Lang
|
Semantics.hs
|
bsd-2-clause
|
nullExpressionSemantics (Statement {statementID = EXPRESSION_NULL}) =
do let value = 0
ints <- gets semanticStateInts
if Map.lookup value ints == Nothing
then addInt value
else return ()
| 238 |
nullExpressionSemantics (Statement {statementID = EXPRESSION_NULL}) =
do let value = 0
ints <- gets semanticStateInts
if Map.lookup value ints == Nothing
then addInt value
else return ()
| 238 |
nullExpressionSemantics (Statement {statementID = EXPRESSION_NULL}) =
do let value = 0
ints <- gets semanticStateInts
if Map.lookup value ints == Nothing
then addInt value
else return ()
| 238 | false | false | 0 | 10 | 78 | 70 | 33 | 37 | null | null |
fcostantini/PlEb
|
src/Xspf.hs
|
gpl-3.0
|
xspfPrelude :: String -> String
xspfPrelude name = "<?wpl version=\"1.0\" encoding=\"UTF-8\"?>\n" ++
"<playlist xmlns=\"http://xspf.org/ns/0/\" xmlns:vlc=\"http://www.videolan.org/vlc/playlist/ns/0/\" version=\"1\">\n" ++
"<title>" ++ name ++ "</title>\n" ++
"<trackList>\n"
| 331 |
xspfPrelude :: String -> String
xspfPrelude name = "<?wpl version=\"1.0\" encoding=\"UTF-8\"?>\n" ++
"<playlist xmlns=\"http://xspf.org/ns/0/\" xmlns:vlc=\"http://www.videolan.org/vlc/playlist/ns/0/\" version=\"1\">\n" ++
"<title>" ++ name ++ "</title>\n" ++
"<trackList>\n"
| 331 |
xspfPrelude name = "<?wpl version=\"1.0\" encoding=\"UTF-8\"?>\n" ++
"<playlist xmlns=\"http://xspf.org/ns/0/\" xmlns:vlc=\"http://www.videolan.org/vlc/playlist/ns/0/\" version=\"1\">\n" ++
"<title>" ++ name ++ "</title>\n" ++
"<trackList>\n"
| 299 | false | true | 0 | 9 | 80 | 42 | 20 | 22 | null | null |
thalerjonathan/phd
|
coding/libraries/chimera/src/FRP/Chimera/Environment/Discrete.hs
|
gpl-3.0
|
topLeftDelta :: Discrete2dCoord
topLeftDelta = (-1, -1)
| 60 |
topLeftDelta :: Discrete2dCoord
topLeftDelta = (-1, -1)
| 60 |
topLeftDelta = (-1, -1)
| 28 | false | true | 0 | 6 | 11 | 21 | 12 | 9 | null | null |
bartoszw/wtk
|
Text/WtkParser.hs
|
bsd-3-clause
|
many :: Parser a -> Parser [a]
many (Parser p) = Parser many'
where many' x =
case p x of
Left err -> Right (x,[])
Right (x',a) ->
let Right (x'',rest) = many' x'
in Right (x'',a:rest)
| 276 |
many :: Parser a -> Parser [a]
many (Parser p) = Parser many'
where many' x =
case p x of
Left err -> Right (x,[])
Right (x',a) ->
let Right (x'',rest) = many' x'
in Right (x'',a:rest)
| 275 |
many (Parser p) = Parser many'
where many' x =
case p x of
Left err -> Right (x,[])
Right (x',a) ->
let Right (x'',rest) = many' x'
in Right (x'',a:rest)
| 244 | false | true | 0 | 13 | 129 | 130 | 62 | 68 | null | null |
forked-upstream-packages-for-ghcjs/ghc
|
compiler/nativeGen/PPC/Ppr.hs
|
bsd-3-clause
|
pprInstr (MULLW_MayOflo reg1 reg2 reg3) = vcat [
hcat [ ptext (sLit "\tmullwo\t"), pprReg reg1, ptext (sLit ", "),
pprReg reg2, ptext (sLit ", "),
pprReg reg3 ],
hcat [ ptext (sLit "\tmfxer\t"), pprReg reg1 ],
hcat [ ptext (sLit "\trlwinm\t"), pprReg reg1, ptext (sLit ", "),
pprReg reg1, ptext (sLit ", "),
ptext (sLit "2, 31, 31") ]
]
| 536 |
pprInstr (MULLW_MayOflo reg1 reg2 reg3) = vcat [
hcat [ ptext (sLit "\tmullwo\t"), pprReg reg1, ptext (sLit ", "),
pprReg reg2, ptext (sLit ", "),
pprReg reg3 ],
hcat [ ptext (sLit "\tmfxer\t"), pprReg reg1 ],
hcat [ ptext (sLit "\trlwinm\t"), pprReg reg1, ptext (sLit ", "),
pprReg reg1, ptext (sLit ", "),
ptext (sLit "2, 31, 31") ]
]
| 536 |
pprInstr (MULLW_MayOflo reg1 reg2 reg3) = vcat [
hcat [ ptext (sLit "\tmullwo\t"), pprReg reg1, ptext (sLit ", "),
pprReg reg2, ptext (sLit ", "),
pprReg reg3 ],
hcat [ ptext (sLit "\tmfxer\t"), pprReg reg1 ],
hcat [ ptext (sLit "\trlwinm\t"), pprReg reg1, ptext (sLit ", "),
pprReg reg1, ptext (sLit ", "),
ptext (sLit "2, 31, 31") ]
]
| 536 | false | false | 0 | 11 | 259 | 172 | 85 | 87 | null | null |
dalaing/free
|
src/Control/Applicative/Trans/Free.hs
|
bsd-3-clause
|
liftApT :: Applicative g => f a -> ApT f g a
liftApT x = ApT (pure (Ap x (pure id)))
| 84 |
liftApT :: Applicative g => f a -> ApT f g a
liftApT x = ApT (pure (Ap x (pure id)))
| 84 |
liftApT x = ApT (pure (Ap x (pure id)))
| 39 | false | true | 0 | 11 | 20 | 58 | 27 | 31 | null | null |
forgit/Rosalind
|
lcsm.hs
|
gpl-2.0
|
aaa (x:xs) xx = map (lcstr x) (filter (/= x) xx) ++ aaa xs xx
| 61 |
aaa (x:xs) xx = map (lcstr x) (filter (/= x) xx) ++ aaa xs xx
| 61 |
aaa (x:xs) xx = map (lcstr x) (filter (/= x) xx) ++ aaa xs xx
| 61 | false | false | 0 | 9 | 14 | 51 | 25 | 26 | null | null |
beni55/hermit
|
src/HERMIT/Kure/Universes.hs
|
bsd-2-clause
|
-- | Promote a rewrite on 'CoreBind'.
promoteBindR :: (Monad m, Injection CoreBind g) => Rewrite c m CoreBind -> Rewrite c m g
promoteBindR = promoteWithFailMsgR "This rewrite can only succeed at binding group nodes."
| 217 |
promoteBindR :: (Monad m, Injection CoreBind g) => Rewrite c m CoreBind -> Rewrite c m g
promoteBindR = promoteWithFailMsgR "This rewrite can only succeed at binding group nodes."
| 179 |
promoteBindR = promoteWithFailMsgR "This rewrite can only succeed at binding group nodes."
| 90 | true | true | 0 | 7 | 35 | 50 | 25 | 25 | null | null |
bitemyapp/Haskell-Turtle-Library
|
src/Turtle/Pattern.hs
|
bsd-3-clause
|
{-| Match an unsigned decimal number
>>> match decimal "123"
[123]
>>> match decimal "-123"
[]
-}
decimal :: Num n => Pattern n
decimal = do
ds <- some digit
return (foldl' step 0 ds)
where
step n d = n * 10 + fromIntegral (ord d - ord '0')
{-| Transform a numeric parser to accept an optional leading @\'+\'@ or @\'-\'@
sign
>>> match (signed decimal) "+123"
[123]
>>> match (signed decimal) "-123"
[-123]
>>> match (signed decimal) "123"
[123]
-}
| 471 |
decimal :: Num n => Pattern n
decimal = do
ds <- some digit
return (foldl' step 0 ds)
where
step n d = n * 10 + fromIntegral (ord d - ord '0')
{-| Transform a numeric parser to accept an optional leading @\'+\'@ or @\'-\'@
sign
>>> match (signed decimal) "+123"
[123]
>>> match (signed decimal) "-123"
[-123]
>>> match (signed decimal) "123"
[123]
-}
| 371 |
decimal = do
ds <- some digit
return (foldl' step 0 ds)
where
step n d = n * 10 + fromIntegral (ord d - ord '0')
{-| Transform a numeric parser to accept an optional leading @\'+\'@ or @\'-\'@
sign
>>> match (signed decimal) "+123"
[123]
>>> match (signed decimal) "-123"
[-123]
>>> match (signed decimal) "123"
[123]
-}
| 341 | true | true | 4 | 9 | 106 | 97 | 41 | 56 | null | null |
hansbugge/cubicaltt
|
Eval.hs
|
mit
|
pathComp :: Name -> Val -> Val -> Val -> System Val -> Val
pathComp i a u u' us = VPath j $ comp i a (u `face` (i ~> 0)) us'
where j = fresh (Atom i,a,us,u,u')
us' = insertsSystem [(j ~> 0, u), (j ~> 1, u')] us
-- Grad Lemma, takes an iso f, a system us and a value v, s.t. f us =
-- border v. Outputs (u,p) s.t. border u = us and a path p between v
-- and f u.
| 374 |
pathComp :: Name -> Val -> Val -> Val -> System Val -> Val
pathComp i a u u' us = VPath j $ comp i a (u `face` (i ~> 0)) us'
where j = fresh (Atom i,a,us,u,u')
us' = insertsSystem [(j ~> 0, u), (j ~> 1, u')] us
-- Grad Lemma, takes an iso f, a system us and a value v, s.t. f us =
-- border v. Outputs (u,p) s.t. border u = us and a path p between v
-- and f u.
| 374 |
pathComp i a u u' us = VPath j $ comp i a (u `face` (i ~> 0)) us'
where j = fresh (Atom i,a,us,u,u')
us' = insertsSystem [(j ~> 0, u), (j ~> 1, u')] us
-- Grad Lemma, takes an iso f, a system us and a value v, s.t. f us =
-- border v. Outputs (u,p) s.t. border u = us and a path p between v
-- and f u.
| 315 | false | true | 1 | 10 | 101 | 145 | 79 | 66 | null | null |
DavidAlphaFox/ghc
|
libraries/filepath/System/FilePath/Internal.hs
|
bsd-3-clause
|
hasLeadingPathSeparator x = isPathSeparator (head x)
| 52 |
hasLeadingPathSeparator x = isPathSeparator (head x)
| 52 |
hasLeadingPathSeparator x = isPathSeparator (head x)
| 52 | false | false | 0 | 7 | 5 | 18 | 8 | 10 | null | null |
apyrgio/snf-ganeti
|
src/Ganeti/DataCollectors/Drbd.hs
|
bsd-2-clause
|
buildDCReport :: FilePath -> Maybe FilePath -> IO DCReport
buildDCReport statusFile pairingFile =
buildJsonReport statusFile pairingFile >>=
buildReport dcName dcVersion dcFormatVersion dcCategory dcKind
| 209 |
buildDCReport :: FilePath -> Maybe FilePath -> IO DCReport
buildDCReport statusFile pairingFile =
buildJsonReport statusFile pairingFile >>=
buildReport dcName dcVersion dcFormatVersion dcCategory dcKind
| 209 |
buildDCReport statusFile pairingFile =
buildJsonReport statusFile pairingFile >>=
buildReport dcName dcVersion dcFormatVersion dcCategory dcKind
| 150 | false | true | 0 | 7 | 28 | 50 | 23 | 27 | null | null |
jeffreyrosenbluth/NYC-meetup
|
meetup/DiagramTree.hs
|
mit
|
example :: Diagram B
example = connectOutside' arrow1 "circle" "<>"
. connectOutside' arrow1 "square" "<>"
. connectOutside' arrow1 "arrow" "scale"
. connectOutside' arrow1 "<>" "scale"
$ vsep 3 [d, vsep 4 [c, hsep 1 [a, b, r] # centerX]]
where
arrow1 = with & arrowHead .~ noHead & gaps .~ 10
-- example = connect' arrow1 "1" "2"
-- . connect' arrow2 "4" "3"
-- . connect' arrow3 "1" "6"
-- . connectOutside' arrow4 "4" "8"
-- . connect' arrow5 "9" "5"
-- . connectOutside' arrow6 "8" "9"
-- . connectOutside' arrow7 "8" "7"
-- $ cGrid
-- where
-- -- The arrows
-- arrow1 = with & arrowHead .~ dart & headLength .~ veryLarge
-- & arrowTail .~ quill & shaftStyle %~ lw thick
-- & arrowShaft .~ shaft0 & headStyle %~ fc blue
-- & tailStyle %~ fc red & tailLength .~ large
--
-- arrow2 = with & arrowHead .~ dart & headLength .~ large
-- & arrowTail .~ dart' & tailLength .~ large
-- & shaftStyle %~ lw thin & arrowShaft .~ shaft1
--
-- arrow3 = with & arrowHead .~ thorn & headLength .~ large
-- & arrowShaft .~ quartercircle & arrowTail .~ noTail
-- & gaps .~ normal
--
-- arrow4 = with & arrowHead .~ dart & arrowTail .~ dart'
-- & headLength .~ large & tailLength .~ large
-- & arrowShaft .~ shaft2 & headStyle %~ fc teal
-- & tailStyle %~ fc teal & shaftStyle %~ lw thick . lc teal
--
-- arrow5 = with & arrowTail .~ spike' & tailLength .~ large
-- & arrowShaft .~ semicircle & arrowHead .~ spike
-- & headLength .~ veryLarge & headStyle %~ fc darkorange
-- & tailStyle %~ fc darkorange
-- & shaftStyle %~ lw veryThick . lc navy
--
-- arrow6 = with & arrowHead .~ tri & arrowTail .~ tri'
-- & headLength .~ large
-- & headStyle %~ fc black . opacity 0.5
-- & tailStyle %~ fc black . opacity 0.5
-- & shaftStyle %~ lw thick
-- & shaftStyle %~ dashingN [0.01,0.02,0.03,0.01] 0
--
-- arrow7 = arrow6 & arrowHead .~ tri & arrowTail .~ tri'
| 2,357 |
example :: Diagram B
example = connectOutside' arrow1 "circle" "<>"
. connectOutside' arrow1 "square" "<>"
. connectOutside' arrow1 "arrow" "scale"
. connectOutside' arrow1 "<>" "scale"
$ vsep 3 [d, vsep 4 [c, hsep 1 [a, b, r] # centerX]]
where
arrow1 = with & arrowHead .~ noHead & gaps .~ 10
-- example = connect' arrow1 "1" "2"
-- . connect' arrow2 "4" "3"
-- . connect' arrow3 "1" "6"
-- . connectOutside' arrow4 "4" "8"
-- . connect' arrow5 "9" "5"
-- . connectOutside' arrow6 "8" "9"
-- . connectOutside' arrow7 "8" "7"
-- $ cGrid
-- where
-- -- The arrows
-- arrow1 = with & arrowHead .~ dart & headLength .~ veryLarge
-- & arrowTail .~ quill & shaftStyle %~ lw thick
-- & arrowShaft .~ shaft0 & headStyle %~ fc blue
-- & tailStyle %~ fc red & tailLength .~ large
--
-- arrow2 = with & arrowHead .~ dart & headLength .~ large
-- & arrowTail .~ dart' & tailLength .~ large
-- & shaftStyle %~ lw thin & arrowShaft .~ shaft1
--
-- arrow3 = with & arrowHead .~ thorn & headLength .~ large
-- & arrowShaft .~ quartercircle & arrowTail .~ noTail
-- & gaps .~ normal
--
-- arrow4 = with & arrowHead .~ dart & arrowTail .~ dart'
-- & headLength .~ large & tailLength .~ large
-- & arrowShaft .~ shaft2 & headStyle %~ fc teal
-- & tailStyle %~ fc teal & shaftStyle %~ lw thick . lc teal
--
-- arrow5 = with & arrowTail .~ spike' & tailLength .~ large
-- & arrowShaft .~ semicircle & arrowHead .~ spike
-- & headLength .~ veryLarge & headStyle %~ fc darkorange
-- & tailStyle %~ fc darkorange
-- & shaftStyle %~ lw veryThick . lc navy
--
-- arrow6 = with & arrowHead .~ tri & arrowTail .~ tri'
-- & headLength .~ large
-- & headStyle %~ fc black . opacity 0.5
-- & tailStyle %~ fc black . opacity 0.5
-- & shaftStyle %~ lw thick
-- & shaftStyle %~ dashingN [0.01,0.02,0.03,0.01] 0
--
-- arrow7 = arrow6 & arrowHead .~ tri & arrowTail .~ tri'
| 2,357 |
example = connectOutside' arrow1 "circle" "<>"
. connectOutside' arrow1 "square" "<>"
. connectOutside' arrow1 "arrow" "scale"
. connectOutside' arrow1 "<>" "scale"
$ vsep 3 [d, vsep 4 [c, hsep 1 [a, b, r] # centerX]]
where
arrow1 = with & arrowHead .~ noHead & gaps .~ 10
-- example = connect' arrow1 "1" "2"
-- . connect' arrow2 "4" "3"
-- . connect' arrow3 "1" "6"
-- . connectOutside' arrow4 "4" "8"
-- . connect' arrow5 "9" "5"
-- . connectOutside' arrow6 "8" "9"
-- . connectOutside' arrow7 "8" "7"
-- $ cGrid
-- where
-- -- The arrows
-- arrow1 = with & arrowHead .~ dart & headLength .~ veryLarge
-- & arrowTail .~ quill & shaftStyle %~ lw thick
-- & arrowShaft .~ shaft0 & headStyle %~ fc blue
-- & tailStyle %~ fc red & tailLength .~ large
--
-- arrow2 = with & arrowHead .~ dart & headLength .~ large
-- & arrowTail .~ dart' & tailLength .~ large
-- & shaftStyle %~ lw thin & arrowShaft .~ shaft1
--
-- arrow3 = with & arrowHead .~ thorn & headLength .~ large
-- & arrowShaft .~ quartercircle & arrowTail .~ noTail
-- & gaps .~ normal
--
-- arrow4 = with & arrowHead .~ dart & arrowTail .~ dart'
-- & headLength .~ large & tailLength .~ large
-- & arrowShaft .~ shaft2 & headStyle %~ fc teal
-- & tailStyle %~ fc teal & shaftStyle %~ lw thick . lc teal
--
-- arrow5 = with & arrowTail .~ spike' & tailLength .~ large
-- & arrowShaft .~ semicircle & arrowHead .~ spike
-- & headLength .~ veryLarge & headStyle %~ fc darkorange
-- & tailStyle %~ fc darkorange
-- & shaftStyle %~ lw veryThick . lc navy
--
-- arrow6 = with & arrowHead .~ tri & arrowTail .~ tri'
-- & headLength .~ large
-- & headStyle %~ fc black . opacity 0.5
-- & tailStyle %~ fc black . opacity 0.5
-- & shaftStyle %~ lw thick
-- & shaftStyle %~ dashingN [0.01,0.02,0.03,0.01] 0
--
-- arrow7 = arrow6 & arrowHead .~ tri & arrowTail .~ tri'
| 2,336 | false | true | 0 | 12 | 877 | 164 | 103 | 61 | null | null |
wxwxwwxxx/ghc
|
compiler/cmm/MkGraph.hs
|
bsd-3-clause
|
catAGraphs :: [CmmAGraph] -> CmmAGraph
catAGraphs = concatOL
| 69 |
catAGraphs :: [CmmAGraph] -> CmmAGraph
catAGraphs = concatOL
| 69 |
catAGraphs = concatOL
| 26 | false | true | 0 | 7 | 16 | 25 | 11 | 14 | null | null |
tpsinnem/Idris-dev
|
src/IRTS/CodegenC.hs
|
bsd-3-clause
|
hdr_export :: Export -> String
hdr_export (ExportData n) = "typedef VAL " ++ cdesc n ++ ";\n"
| 93 |
hdr_export :: Export -> String
hdr_export (ExportData n) = "typedef VAL " ++ cdesc n ++ ";\n"
| 93 |
hdr_export (ExportData n) = "typedef VAL " ++ cdesc n ++ ";\n"
| 62 | false | true | 0 | 9 | 16 | 41 | 18 | 23 | null | null |
mettekou/ghc
|
compiler/simplCore/SetLevels.hs
|
bsd-3-clause
|
-- Don't share cases
lvlMFE strict_ctxt env ann_expr
| floatTopLvlOnly env && not (isTopLvl dest_lvl)
-- Only floating to the top level is allowed.
|| isUnliftedType (exprType expr)
-- Can't let-bind it; see Note [Unlifted MFEs]
-- This includes coercions, which we don't want to float anyway
-- NB: no need to substitute cos isUnliftedType doesn't change
|| isLevityPolymorphic (typeKind (exprType expr))
-- We can't let-bind levity polymorphic expressions
-- See Note [Levity polymorphism invariants] in CoreSyn
|| notWorthFloating ann_expr abs_vars
|| not float_me
= -- Don't float it out
lvlExpr env ann_expr
| otherwise -- Float it out!
= do { expr' <- lvlFloatRhs abs_vars dest_lvl env ann_expr
; var <- newLvlVar expr' is_bot
; return (Let (NonRec (TB var (FloatMe dest_lvl)) expr')
(mkVarApps (Var var) abs_vars)) }
where
expr = deAnnotate ann_expr
fvs = freeVarsOf ann_expr
is_bot = exprIsBottom expr -- Note [Bottoming floats]
dest_lvl = destLevel env fvs (isFunction ann_expr) is_bot
abs_vars = abstractVars dest_lvl env fvs
-- A decision to float entails let-binding this thing, and we only do
-- that if we'll escape a value lambda, or will go to the top level.
float_me = dest_lvl `ltMajLvl` (le_ctxt_lvl env) -- Escapes a value lambda
-- OLD CODE: not (exprIsCheap expr) || isTopLvl dest_lvl
-- see Note [Escaping a value lambda]
|| (isTopLvl dest_lvl -- Only float if we are going to the top level
&& floatConsts env -- and the floatConsts flag is on
&& not strict_ctxt) -- Don't float from a strict context
-- We are keen to float something to the top level, even if it does not
-- escape a lambda, because then it needs no allocation. But it's controlled
-- by a flag, because doing this too early loses opportunities for RULES
-- which (needless to say) are important in some nofib programs
-- (gcd is an example).
--
-- Beware:
-- concat = /\ a -> foldr ..a.. (++) []
-- was getting turned into
-- lvl = /\ a -> foldr ..a.. (++) []
-- concat = /\ a -> lvl a
-- which is pretty stupid. Hence the strict_ctxt test
--
-- Also a strict contxt includes uboxed values, and they
-- can't be bound at top level
{-
Note [Unlifted MFEs]
~~~~~~~~~~~~~~~~~~~~
We don't float unlifted MFEs, which potentially loses big opportunites.
For example:
\x -> f (h y)
where h :: Int -> Int# is expensive. We'd like to float the (h y) outside
the \x, but we don't because it's unboxed. Possible solution: box it.
Note [Bottoming floats]
~~~~~~~~~~~~~~~~~~~~~~~
If we see
f = \x. g (error "urk")
we'd like to float the call to error, to get
lvl = error "urk"
f = \x. g lvl
Furthermore, we want to float a bottoming expression even if it has free
variables:
f = \x. g (let v = h x in error ("urk" ++ v))
Then we'd like to abstact over 'x' can float the whole arg of g:
lvl = \x. let v = h x in error ("urk" ++ v)
f = \x. g (lvl x)
See Maessen's paper 1999 "Bottom extraction: factoring error handling out
of functional programs" (unpublished I think).
When we do this, we set the strictness and arity of the new bottoming
Id, *immediately*, for three reasons:
* To prevent the abstracted thing being immediately inlined back in again
via preInlineUnconditionally. The latter has a test for bottoming Ids
to stop inlining them, so we'd better make sure it *is* a bottoming Id!
* So that it's properly exposed as such in the interface file, even if
this is all happening after strictness analysis.
* In case we do CSE with the same expression that *is* marked bottom
lvl = error "urk"
x{str=bot) = error "urk"
Here we don't want to replace 'x' with 'lvl', else we may get Lint
errors, e.g. via a case with empty alternatives: (case x of {})
Lint complains unless the scrutinee of such a case is clearly bottom.
This was reported in Trac #11290. But since the whole bottoming-float
thing is based on the cheap-and-cheerful exprIsBottom, I'm not sure
that it'll nail all such cases.
Note [Bottoming floats: eta expansion] c.f Note [Bottoming floats]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tiresomely, though, the simplifier has an invariant that the manifest
arity of the RHS should be the same as the arity; but we can't call
etaExpand during SetLevels because it works over a decorated form of
CoreExpr. So we do the eta expansion later, in FloatOut.
Note [Case MFEs]
~~~~~~~~~~~~~~~~
We don't float a case expression as an MFE from a strict context. Why not?
Because in doing so we share a tiny bit of computation (the switch) but
in exchange we build a thunk, which is bad. This case reduces allocation
by 7% in spectral/puzzle (a rather strange benchmark) and 1.2% in real/fem.
Doesn't change any other allocation at all.
-}
| 5,213 |
lvlMFE strict_ctxt env ann_expr
| floatTopLvlOnly env && not (isTopLvl dest_lvl)
-- Only floating to the top level is allowed.
|| isUnliftedType (exprType expr)
-- Can't let-bind it; see Note [Unlifted MFEs]
-- This includes coercions, which we don't want to float anyway
-- NB: no need to substitute cos isUnliftedType doesn't change
|| isLevityPolymorphic (typeKind (exprType expr))
-- We can't let-bind levity polymorphic expressions
-- See Note [Levity polymorphism invariants] in CoreSyn
|| notWorthFloating ann_expr abs_vars
|| not float_me
= -- Don't float it out
lvlExpr env ann_expr
| otherwise -- Float it out!
= do { expr' <- lvlFloatRhs abs_vars dest_lvl env ann_expr
; var <- newLvlVar expr' is_bot
; return (Let (NonRec (TB var (FloatMe dest_lvl)) expr')
(mkVarApps (Var var) abs_vars)) }
where
expr = deAnnotate ann_expr
fvs = freeVarsOf ann_expr
is_bot = exprIsBottom expr -- Note [Bottoming floats]
dest_lvl = destLevel env fvs (isFunction ann_expr) is_bot
abs_vars = abstractVars dest_lvl env fvs
-- A decision to float entails let-binding this thing, and we only do
-- that if we'll escape a value lambda, or will go to the top level.
float_me = dest_lvl `ltMajLvl` (le_ctxt_lvl env) -- Escapes a value lambda
-- OLD CODE: not (exprIsCheap expr) || isTopLvl dest_lvl
-- see Note [Escaping a value lambda]
|| (isTopLvl dest_lvl -- Only float if we are going to the top level
&& floatConsts env -- and the floatConsts flag is on
&& not strict_ctxt) -- Don't float from a strict context
-- We are keen to float something to the top level, even if it does not
-- escape a lambda, because then it needs no allocation. But it's controlled
-- by a flag, because doing this too early loses opportunities for RULES
-- which (needless to say) are important in some nofib programs
-- (gcd is an example).
--
-- Beware:
-- concat = /\ a -> foldr ..a.. (++) []
-- was getting turned into
-- lvl = /\ a -> foldr ..a.. (++) []
-- concat = /\ a -> lvl a
-- which is pretty stupid. Hence the strict_ctxt test
--
-- Also a strict contxt includes uboxed values, and they
-- can't be bound at top level
{-
Note [Unlifted MFEs]
~~~~~~~~~~~~~~~~~~~~
We don't float unlifted MFEs, which potentially loses big opportunites.
For example:
\x -> f (h y)
where h :: Int -> Int# is expensive. We'd like to float the (h y) outside
the \x, but we don't because it's unboxed. Possible solution: box it.
Note [Bottoming floats]
~~~~~~~~~~~~~~~~~~~~~~~
If we see
f = \x. g (error "urk")
we'd like to float the call to error, to get
lvl = error "urk"
f = \x. g lvl
Furthermore, we want to float a bottoming expression even if it has free
variables:
f = \x. g (let v = h x in error ("urk" ++ v))
Then we'd like to abstact over 'x' can float the whole arg of g:
lvl = \x. let v = h x in error ("urk" ++ v)
f = \x. g (lvl x)
See Maessen's paper 1999 "Bottom extraction: factoring error handling out
of functional programs" (unpublished I think).
When we do this, we set the strictness and arity of the new bottoming
Id, *immediately*, for three reasons:
* To prevent the abstracted thing being immediately inlined back in again
via preInlineUnconditionally. The latter has a test for bottoming Ids
to stop inlining them, so we'd better make sure it *is* a bottoming Id!
* So that it's properly exposed as such in the interface file, even if
this is all happening after strictness analysis.
* In case we do CSE with the same expression that *is* marked bottom
lvl = error "urk"
x{str=bot) = error "urk"
Here we don't want to replace 'x' with 'lvl', else we may get Lint
errors, e.g. via a case with empty alternatives: (case x of {})
Lint complains unless the scrutinee of such a case is clearly bottom.
This was reported in Trac #11290. But since the whole bottoming-float
thing is based on the cheap-and-cheerful exprIsBottom, I'm not sure
that it'll nail all such cases.
Note [Bottoming floats: eta expansion] c.f Note [Bottoming floats]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tiresomely, though, the simplifier has an invariant that the manifest
arity of the RHS should be the same as the arity; but we can't call
etaExpand during SetLevels because it works over a decorated form of
CoreExpr. So we do the eta expansion later, in FloatOut.
Note [Case MFEs]
~~~~~~~~~~~~~~~~
We don't float a case expression as an MFE from a strict context. Why not?
Because in doing so we share a tiny bit of computation (the switch) but
in exchange we build a thunk, which is bad. This case reduces allocation
by 7% in spectral/puzzle (a rather strange benchmark) and 1.2% in real/fem.
Doesn't change any other allocation at all.
-}
| 5,191 |
lvlMFE strict_ctxt env ann_expr
| floatTopLvlOnly env && not (isTopLvl dest_lvl)
-- Only floating to the top level is allowed.
|| isUnliftedType (exprType expr)
-- Can't let-bind it; see Note [Unlifted MFEs]
-- This includes coercions, which we don't want to float anyway
-- NB: no need to substitute cos isUnliftedType doesn't change
|| isLevityPolymorphic (typeKind (exprType expr))
-- We can't let-bind levity polymorphic expressions
-- See Note [Levity polymorphism invariants] in CoreSyn
|| notWorthFloating ann_expr abs_vars
|| not float_me
= -- Don't float it out
lvlExpr env ann_expr
| otherwise -- Float it out!
= do { expr' <- lvlFloatRhs abs_vars dest_lvl env ann_expr
; var <- newLvlVar expr' is_bot
; return (Let (NonRec (TB var (FloatMe dest_lvl)) expr')
(mkVarApps (Var var) abs_vars)) }
where
expr = deAnnotate ann_expr
fvs = freeVarsOf ann_expr
is_bot = exprIsBottom expr -- Note [Bottoming floats]
dest_lvl = destLevel env fvs (isFunction ann_expr) is_bot
abs_vars = abstractVars dest_lvl env fvs
-- A decision to float entails let-binding this thing, and we only do
-- that if we'll escape a value lambda, or will go to the top level.
float_me = dest_lvl `ltMajLvl` (le_ctxt_lvl env) -- Escapes a value lambda
-- OLD CODE: not (exprIsCheap expr) || isTopLvl dest_lvl
-- see Note [Escaping a value lambda]
|| (isTopLvl dest_lvl -- Only float if we are going to the top level
&& floatConsts env -- and the floatConsts flag is on
&& not strict_ctxt) -- Don't float from a strict context
-- We are keen to float something to the top level, even if it does not
-- escape a lambda, because then it needs no allocation. But it's controlled
-- by a flag, because doing this too early loses opportunities for RULES
-- which (needless to say) are important in some nofib programs
-- (gcd is an example).
--
-- Beware:
-- concat = /\ a -> foldr ..a.. (++) []
-- was getting turned into
-- lvl = /\ a -> foldr ..a.. (++) []
-- concat = /\ a -> lvl a
-- which is pretty stupid. Hence the strict_ctxt test
--
-- Also a strict contxt includes uboxed values, and they
-- can't be bound at top level
{-
Note [Unlifted MFEs]
~~~~~~~~~~~~~~~~~~~~
We don't float unlifted MFEs, which potentially loses big opportunites.
For example:
\x -> f (h y)
where h :: Int -> Int# is expensive. We'd like to float the (h y) outside
the \x, but we don't because it's unboxed. Possible solution: box it.
Note [Bottoming floats]
~~~~~~~~~~~~~~~~~~~~~~~
If we see
f = \x. g (error "urk")
we'd like to float the call to error, to get
lvl = error "urk"
f = \x. g lvl
Furthermore, we want to float a bottoming expression even if it has free
variables:
f = \x. g (let v = h x in error ("urk" ++ v))
Then we'd like to abstact over 'x' can float the whole arg of g:
lvl = \x. let v = h x in error ("urk" ++ v)
f = \x. g (lvl x)
See Maessen's paper 1999 "Bottom extraction: factoring error handling out
of functional programs" (unpublished I think).
When we do this, we set the strictness and arity of the new bottoming
Id, *immediately*, for three reasons:
* To prevent the abstracted thing being immediately inlined back in again
via preInlineUnconditionally. The latter has a test for bottoming Ids
to stop inlining them, so we'd better make sure it *is* a bottoming Id!
* So that it's properly exposed as such in the interface file, even if
this is all happening after strictness analysis.
* In case we do CSE with the same expression that *is* marked bottom
lvl = error "urk"
x{str=bot) = error "urk"
Here we don't want to replace 'x' with 'lvl', else we may get Lint
errors, e.g. via a case with empty alternatives: (case x of {})
Lint complains unless the scrutinee of such a case is clearly bottom.
This was reported in Trac #11290. But since the whole bottoming-float
thing is based on the cheap-and-cheerful exprIsBottom, I'm not sure
that it'll nail all such cases.
Note [Bottoming floats: eta expansion] c.f Note [Bottoming floats]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tiresomely, though, the simplifier has an invariant that the manifest
arity of the RHS should be the same as the arity; but we can't call
etaExpand during SetLevels because it works over a decorated form of
CoreExpr. So we do the eta expansion later, in FloatOut.
Note [Case MFEs]
~~~~~~~~~~~~~~~~
We don't float a case expression as an MFE from a strict context. Why not?
Because in doing so we share a tiny bit of computation (the switch) but
in exchange we build a thunk, which is bad. This case reduces allocation
by 7% in spectral/puzzle (a rather strange benchmark) and 1.2% in real/fem.
Doesn't change any other allocation at all.
-}
| 5,191 | true | false | 5 | 16 | 1,405 | 317 | 168 | 149 | null | null |
brownsys/nettle-openflow
|
src/Nettle/OpenFlow/MessagesBinary.hs
|
bsd-3-clause
|
-----------------------------------------
-- Stats Reply parser
-----------------------------------------
getStatsReply :: Int -> Get StatsReply
getStatsReply headerLen = do
statsType <- getWord16be
flags <- getWord16be
let bodyLen = headerLen - (headerSize + 4)
let moreFlag = flags == 0x0001
if statsType == ofpstFlow
then do flowStats <- getFlowStatsReplies bodyLen
return (FlowStatsReply moreFlag flowStats)
else if statsType == ofpstPort
then do portStats <- getPortStatsReplies bodyLen
return (PortStatsReply moreFlag portStats)
else if statsType == ofpstAggregate
then do aggStats <- getAggregateStatsReplies bodyLen
return (AggregateFlowStatsReply aggStats)
else if statsType == ofpstTable
then do tableStats <- getTableStatsReplies bodyLen
return (TableStatsReply moreFlag tableStats)
else if statsType == ofpstDesc
then do desc <- getDescriptionReply
return (DescriptionReply desc)
else
#if OPENFLOW_VERSION==1
if statsType == ofpstQueue
then do queueStats <- getQueueStatsReplies bodyLen
return (QueueStatsReply moreFlag queueStats)
else
#endif
error ("unhandled stats reply message with type: " ++ show statsType)
#if OPENFLOW_VERSION==1
| 1,618 |
getStatsReply :: Int -> Get StatsReply
getStatsReply headerLen = do
statsType <- getWord16be
flags <- getWord16be
let bodyLen = headerLen - (headerSize + 4)
let moreFlag = flags == 0x0001
if statsType == ofpstFlow
then do flowStats <- getFlowStatsReplies bodyLen
return (FlowStatsReply moreFlag flowStats)
else if statsType == ofpstPort
then do portStats <- getPortStatsReplies bodyLen
return (PortStatsReply moreFlag portStats)
else if statsType == ofpstAggregate
then do aggStats <- getAggregateStatsReplies bodyLen
return (AggregateFlowStatsReply aggStats)
else if statsType == ofpstTable
then do tableStats <- getTableStatsReplies bodyLen
return (TableStatsReply moreFlag tableStats)
else if statsType == ofpstDesc
then do desc <- getDescriptionReply
return (DescriptionReply desc)
else
#if OPENFLOW_VERSION==1
if statsType == ofpstQueue
then do queueStats <- getQueueStatsReplies bodyLen
return (QueueStatsReply moreFlag queueStats)
else
#endif
error ("unhandled stats reply message with type: " ++ show statsType)
#if OPENFLOW_VERSION==1
| 1,511 |
getStatsReply headerLen = do
statsType <- getWord16be
flags <- getWord16be
let bodyLen = headerLen - (headerSize + 4)
let moreFlag = flags == 0x0001
if statsType == ofpstFlow
then do flowStats <- getFlowStatsReplies bodyLen
return (FlowStatsReply moreFlag flowStats)
else if statsType == ofpstPort
then do portStats <- getPortStatsReplies bodyLen
return (PortStatsReply moreFlag portStats)
else if statsType == ofpstAggregate
then do aggStats <- getAggregateStatsReplies bodyLen
return (AggregateFlowStatsReply aggStats)
else if statsType == ofpstTable
then do tableStats <- getTableStatsReplies bodyLen
return (TableStatsReply moreFlag tableStats)
else if statsType == ofpstDesc
then do desc <- getDescriptionReply
return (DescriptionReply desc)
else
#if OPENFLOW_VERSION==1
if statsType == ofpstQueue
then do queueStats <- getQueueStatsReplies bodyLen
return (QueueStatsReply moreFlag queueStats)
else
#endif
error ("unhandled stats reply message with type: " ++ show statsType)
#if OPENFLOW_VERSION==1
| 1,472 | true | true | 1 | 15 | 607 | 305 | 145 | 160 | null | null |
christiaanb/ghc
|
compiler/simplCore/CoreMonad.hs
|
bsd-3-clause
|
tickString (UnfoldingDone _) = "UnfoldingDone"
| 57 |
tickString (UnfoldingDone _) = "UnfoldingDone"
| 57 |
tickString (UnfoldingDone _) = "UnfoldingDone"
| 57 | false | false | 0 | 7 | 15 | 15 | 7 | 8 | null | null |
polarina/sdl2
|
Graphics/UI/SDL/Event.hs
|
bsd-3-clause
|
gameControllerMappingForGUID :: MonadIO m => JoystickGUID -> m CString
gameControllerMappingForGUID guid = liftIO . alloca $ \ptr -> do
poke ptr guid
gameControllerMappingForGUID' ptr
| 188 |
gameControllerMappingForGUID :: MonadIO m => JoystickGUID -> m CString
gameControllerMappingForGUID guid = liftIO . alloca $ \ptr -> do
poke ptr guid
gameControllerMappingForGUID' ptr
| 188 |
gameControllerMappingForGUID guid = liftIO . alloca $ \ptr -> do
poke ptr guid
gameControllerMappingForGUID' ptr
| 117 | false | true | 0 | 9 | 28 | 55 | 25 | 30 | null | null |
susu/haskell-problems
|
ProjectEuler/Numbering.hs
|
gpl-3.0
|
is_prime x = length dividers == 0
where dividers = (filter (dividable x) [2..floor (sqrt (fromIntegral x))])
| 112 |
is_prime x = length dividers == 0
where dividers = (filter (dividable x) [2..floor (sqrt (fromIntegral x))])
| 112 |
is_prime x = length dividers == 0
where dividers = (filter (dividable x) [2..floor (sqrt (fromIntegral x))])
| 112 | false | false | 0 | 12 | 20 | 58 | 28 | 30 | null | null |
ezyang/ghc
|
testsuite/tests/pmcheck/should_compile/T9951.hs
|
bsd-3-clause
|
f :: [a] -> ()
f x = case x of
[] -> ()
(_:_) -> ()
| 55 |
f :: [a] -> ()
f x = case x of
[] -> ()
(_:_) -> ()
| 55 |
f x = case x of
[] -> ()
(_:_) -> ()
| 40 | false | true | 0 | 9 | 20 | 58 | 28 | 30 | null | null |
romanb/amazonka
|
amazonka-ec2/gen/Network/AWS/EC2/Types.hs
|
mpl-2.0
|
-- | The number of secondary private IP addresses. You can't specify this option
-- and specify more than one private IP address using the private IP addresses
-- option.
inisSecondaryPrivateIpAddressCount :: Lens' InstanceNetworkInterfaceSpecification (Maybe Int)
inisSecondaryPrivateIpAddressCount =
lens _inisSecondaryPrivateIpAddressCount
(\s a -> s { _inisSecondaryPrivateIpAddressCount = a })
| 410 |
inisSecondaryPrivateIpAddressCount :: Lens' InstanceNetworkInterfaceSpecification (Maybe Int)
inisSecondaryPrivateIpAddressCount =
lens _inisSecondaryPrivateIpAddressCount
(\s a -> s { _inisSecondaryPrivateIpAddressCount = a })
| 239 |
inisSecondaryPrivateIpAddressCount =
lens _inisSecondaryPrivateIpAddressCount
(\s a -> s { _inisSecondaryPrivateIpAddressCount = a })
| 145 | true | true | 0 | 8 | 60 | 49 | 27 | 22 | null | null |
chpatrick/slither-bot
|
src/SlitherBot/UtilityGrid.hs
|
bsd-3-clause
|
foodRadius :: Double
foodRadius = 20
| 36 |
foodRadius :: Double
foodRadius = 20
| 36 |
foodRadius = 20
| 15 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
Valiev/contests
|
darkus/201509/Ant.hs
|
mit
|
change_price P L K H = 25
| 25 |
change_price P L K H = 25
| 25 |
change_price P L K H = 25
| 25 | false | false | 0 | 5 | 6 | 18 | 7 | 11 | null | null |
feliposz/learning-stuff
|
haskell/c9lectures-ch2.hs
|
mit
|
{-
Function calls in haskell vs other languages
Math:
f(a,b) + cd f(x) f(x,y) f(g(x)) f(x, g(y)) f(x)g(y)
C#, Java, C, etc:
f(a,b) + c*d f(x) f(x,y) f(g(x) f(x, g(y)) f(x)*g(y)
Haskell:
f a b + c * d f x f x y f (g x) f x (g y) f x * g y
-}
f x = x * 3
| 304 |
f x = x * 3
| 11 |
f x = x * 3
| 11 | true | false | 0 | 5 | 114 | 14 | 7 | 7 | null | null |
ambiata/mafia
|
src/Mafia/Twine/Parallel.hs
|
bsd-3-clause
|
consume :: forall a b c e . (Queue a -> IO b) -> Int -> (a -> IO (Either e c)) -> IO (Either (RunError e) (b, [c]))
consume pro fork action = flip catchAll (pure . Left . BlowUpError) $ do
q <- newQueue fork -- not fork
producer <- async $ pro q
workers <- (emptyWorkers :: IO (Workers c))
sem <- new fork
early <- newEmptyMVar
terminator <- async $ takeMVar early
let spawn :: IO ()
spawn = do
m <- tryReadQueue q
flip (maybe $ return ()) m $ \a -> do
w <- do
M.wait sem
async $ flip finally (signal sem) $ do
r <- action a
case r of
Left e ->
putMVar early e >>
throwM EarlyTermination
Right c ->
pure $! c
addWorker workers w
let check = do
threadDelay 1000 {-- 1 ms --}
p <- poll producer
e <- isQueueEmpty q
pure $ (isJust p) && e
submitter <- async $ untilM_ spawn check
let waiter = runEitherT $ do
(i, _) <- bimapEitherT WorkerError id . EitherT $ waitEitherBoth terminator producer submitter
ws <- liftIO $ getWorkers workers
ii <- mapM (bimapEitherT WorkerError id . EitherT . waitEither terminator) ws
pure $ (i, ii)
waiter `catch` (\(_ :: EarlyTermination) ->
failWorkers workers >>
(Left . WorkerError) <$> wait terminator)
| 1,404 |
consume :: forall a b c e . (Queue a -> IO b) -> Int -> (a -> IO (Either e c)) -> IO (Either (RunError e) (b, [c]))
consume pro fork action = flip catchAll (pure . Left . BlowUpError) $ do
q <- newQueue fork -- not fork
producer <- async $ pro q
workers <- (emptyWorkers :: IO (Workers c))
sem <- new fork
early <- newEmptyMVar
terminator <- async $ takeMVar early
let spawn :: IO ()
spawn = do
m <- tryReadQueue q
flip (maybe $ return ()) m $ \a -> do
w <- do
M.wait sem
async $ flip finally (signal sem) $ do
r <- action a
case r of
Left e ->
putMVar early e >>
throwM EarlyTermination
Right c ->
pure $! c
addWorker workers w
let check = do
threadDelay 1000 {-- 1 ms --}
p <- poll producer
e <- isQueueEmpty q
pure $ (isJust p) && e
submitter <- async $ untilM_ spawn check
let waiter = runEitherT $ do
(i, _) <- bimapEitherT WorkerError id . EitherT $ waitEitherBoth terminator producer submitter
ws <- liftIO $ getWorkers workers
ii <- mapM (bimapEitherT WorkerError id . EitherT . waitEither terminator) ws
pure $ (i, ii)
waiter `catch` (\(_ :: EarlyTermination) ->
failWorkers workers >>
(Left . WorkerError) <$> wait terminator)
| 1,404 |
consume pro fork action = flip catchAll (pure . Left . BlowUpError) $ do
q <- newQueue fork -- not fork
producer <- async $ pro q
workers <- (emptyWorkers :: IO (Workers c))
sem <- new fork
early <- newEmptyMVar
terminator <- async $ takeMVar early
let spawn :: IO ()
spawn = do
m <- tryReadQueue q
flip (maybe $ return ()) m $ \a -> do
w <- do
M.wait sem
async $ flip finally (signal sem) $ do
r <- action a
case r of
Left e ->
putMVar early e >>
throwM EarlyTermination
Right c ->
pure $! c
addWorker workers w
let check = do
threadDelay 1000 {-- 1 ms --}
p <- poll producer
e <- isQueueEmpty q
pure $ (isJust p) && e
submitter <- async $ untilM_ spawn check
let waiter = runEitherT $ do
(i, _) <- bimapEitherT WorkerError id . EitherT $ waitEitherBoth terminator producer submitter
ws <- liftIO $ getWorkers workers
ii <- mapM (bimapEitherT WorkerError id . EitherT . waitEither terminator) ws
pure $ (i, ii)
waiter `catch` (\(_ :: EarlyTermination) ->
failWorkers workers >>
(Left . WorkerError) <$> wait terminator)
| 1,288 | false | true | 0 | 27 | 490 | 565 | 266 | 299 | null | null |
michalkonecny/polypaver
|
src/PolyPaver/DeriveBounds.hs
|
bsd-3-clause
|
scanHypotheses ::
(Eq l, HasDefaultValue l, Hashable l) =>
Form l
-> IMap.IntMap (Maybe Rational, Maybe Rational)
-> IMap.IntMap (Maybe Rational, Maybe Rational)
scanHypotheses (Implies h c) =
scanHypotheses c . scanHypothesis h
| 249 |
scanHypotheses ::
(Eq l, HasDefaultValue l, Hashable l) =>
Form l
-> IMap.IntMap (Maybe Rational, Maybe Rational)
-> IMap.IntMap (Maybe Rational, Maybe Rational)
scanHypotheses (Implies h c) =
scanHypotheses c . scanHypothesis h
| 249 |
scanHypotheses (Implies h c) =
scanHypotheses c . scanHypothesis h
| 70 | false | true | 0 | 11 | 53 | 99 | 47 | 52 | null | null |
ChrisPenner/rasa
|
rasa-ext-cursors/src/Rasa/Ext/Cursors/Internal/Base.hs
|
gpl-3.0
|
-- | Adds a new range to the list of ranges.
addRange :: CrdRange -> BufAction ()
addRange r = overRanges (r:)
| 110 |
addRange :: CrdRange -> BufAction ()
addRange r = overRanges (r:)
| 65 |
addRange r = overRanges (r:)
| 28 | true | true | 0 | 8 | 21 | 36 | 17 | 19 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.