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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mettekou/ghc | compiler/utils/Util.hs | bsd-3-clause | stretchZipWith :: (a -> Bool) -> b -> (a->b->c) -> [a] -> [b] -> [c]
-- ^ @stretchZipWith p z f xs ys@ stretches @ys@ by inserting @z@ in
-- the places where @p@ returns @True@
stretchZipWith _ _ _ [] _ = [] | 212 | stretchZipWith :: (a -> Bool) -> b -> (a->b->c) -> [a] -> [b] -> [c]
stretchZipWith _ _ _ [] _ = [] | 103 | stretchZipWith _ _ _ [] _ = [] | 34 | true | true | 0 | 10 | 48 | 75 | 41 | 34 | null | null |
tel/hs-nanomsg | src/Network/Nanomsg/C.hs | apache-2.0 | -- | Creates a new "fully-loaded" socket.
new :: Protocol p => p -> IO (Socket p)
new = newSocket domSP | 103 | new :: Protocol p => p -> IO (Socket p)
new = newSocket domSP | 61 | new = newSocket domSP | 21 | true | true | 0 | 10 | 20 | 41 | 18 | 23 | null | null |
jaapweel/bloop | CompileBloopScheme.hs | gpl-2.0 | ce (Binop o e1 e2) = S.List [ S.Atom o, ce e1, ce e2] | 55 | ce (Binop o e1 e2) = S.List [ S.Atom o, ce e1, ce e2] | 55 | ce (Binop o e1 e2) = S.List [ S.Atom o, ce e1, ce e2] | 55 | false | false | 0 | 8 | 15 | 45 | 21 | 24 | null | null |
JacquesCarette/literate-scientific-software | code/drasil-data/Data/Drasil/Quantities/Physics.hs | bsd-2-clause | distance = uc CP.distance lD metre | 46 | distance = uc CP.distance lD metre | 46 | distance = uc CP.distance lD metre | 46 | false | false | 1 | 6 | 17 | 19 | 7 | 12 | null | null |
mariefarrell/Hets | CSL/Interpreter.hs | gpl-2.0 | asErrorMsg :: ASError -> String
asErrorMsg (ASError _ s) = s | 60 | asErrorMsg :: ASError -> String
asErrorMsg (ASError _ s) = s | 60 | asErrorMsg (ASError _ s) = s | 28 | false | true | 0 | 9 | 10 | 32 | 14 | 18 | null | null |
DanielSchuessler/hstri | ConcreteNormal/Identification.hs | gpl-3.0 | tc_type :: (Show a, TriangulationDSnakeItem a) => T (Concrete a) -> T a
tc_type = mapT c_type | 93 | tc_type :: (Show a, TriangulationDSnakeItem a) => T (Concrete a) -> T a
tc_type = mapT c_type | 93 | tc_type = mapT c_type | 21 | false | true | 0 | 10 | 16 | 51 | 23 | 28 | null | null |
nevrenato/HetsAlloy | Common/Lexer.hs | gpl-2.0 | oBracketT :: CharParser st Token
oBracketT = asSeparator "[" | 60 | oBracketT :: CharParser st Token
oBracketT = asSeparator "[" | 60 | oBracketT = asSeparator "[" | 27 | false | true | 0 | 6 | 8 | 25 | 10 | 15 | null | null |
snoyberg/ghc | compiler/utils/Pretty.hs | bsd-3-clause | lparen = char '(' | 17 | lparen = char '(' | 17 | lparen = char '(' | 17 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
michaelficarra/purescript | src/Language/PureScript/Sugar/TypeClasses/Deriving.hs | mit | dataMaybe :: ModuleName
dataMaybe = ModuleName [ ProperName "Data", ProperName "Maybe" ] | 88 | dataMaybe :: ModuleName
dataMaybe = ModuleName [ ProperName "Data", ProperName "Maybe" ] | 88 | dataMaybe = ModuleName [ ProperName "Data", ProperName "Maybe" ] | 64 | false | true | 0 | 7 | 11 | 26 | 13 | 13 | null | null |
input-output-hk/pos-haskell-prototype | networking/src/Data/NonEmptySet.hs | mit | delete :: Ord t => t -> NonEmptySet t -> Maybe (NonEmptySet t)
delete t (NonEmptySet t' set) = case (t == t', S.minView set) of
(False, _) -> Just $ NonEmptySet t' (S.delete t set)
(True, Nothing) -> Nothing
(True, Just (t'', set')) -> Just $ NonEmptySet t'' set' | 298 | delete :: Ord t => t -> NonEmptySet t -> Maybe (NonEmptySet t)
delete t (NonEmptySet t' set) = case (t == t', S.minView set) of
(False, _) -> Just $ NonEmptySet t' (S.delete t set)
(True, Nothing) -> Nothing
(True, Just (t'', set')) -> Just $ NonEmptySet t'' set' | 298 | delete t (NonEmptySet t' set) = case (t == t', S.minView set) of
(False, _) -> Just $ NonEmptySet t' (S.delete t set)
(True, Nothing) -> Nothing
(True, Just (t'', set')) -> Just $ NonEmptySet t'' set' | 235 | false | true | 0 | 12 | 84 | 143 | 73 | 70 | null | null |
jahaynes/crawler | src/Workers.hs | mit | makeErrorLogger :: Crawler bq -> (Loggable -> IO ()) -> ErrorLogger bq
makeErrorLogger crawler logFunc =
ErrorLogger { E.getLogQueue = T.getLogQueue crawler
, E.getLogFunction = logFunc
} | 226 | makeErrorLogger :: Crawler bq -> (Loggable -> IO ()) -> ErrorLogger bq
makeErrorLogger crawler logFunc =
ErrorLogger { E.getLogQueue = T.getLogQueue crawler
, E.getLogFunction = logFunc
} | 226 | makeErrorLogger crawler logFunc =
ErrorLogger { E.getLogQueue = T.getLogQueue crawler
, E.getLogFunction = logFunc
} | 155 | false | true | 0 | 10 | 65 | 65 | 33 | 32 | null | null |
mrakgr/futhark | src/futhark-test.hs | bsd-3-clause | checkError _ _ =
return () | 28 | checkError _ _ =
return () | 28 | checkError _ _ =
return () | 28 | false | false | 1 | 6 | 7 | 17 | 7 | 10 | null | null |
crogers1/manager | xenmgr/Vm/Queries.hs | gpl-2.0 | getDisk' :: MonadRpc XmError m => Uuid -> DiskID -> m Disk
getDisk' uuid diskID = getDisk uuid diskID >>= \disk -> case disk of
Just d -> return d
Nothing-> failNoSuchDisk | 175 | getDisk' :: MonadRpc XmError m => Uuid -> DiskID -> m Disk
getDisk' uuid diskID = getDisk uuid diskID >>= \disk -> case disk of
Just d -> return d
Nothing-> failNoSuchDisk | 175 | getDisk' uuid diskID = getDisk uuid diskID >>= \disk -> case disk of
Just d -> return d
Nothing-> failNoSuchDisk | 116 | false | true | 0 | 10 | 35 | 72 | 34 | 38 | null | null |
sopvop/cabal | cabal-install/Distribution/Client/Install.hs | bsd-3-clause | installUnpackedPackage
:: Verbosity
-> Lock
-> Int
-> SetupScriptOptions
-> ConfigFlags
-> InstallFlags
-> HaddockFlags
-> Compiler
-> ProgramDb
-> Platform
-> PackageDescription
-> ReadyPackage
-> PackageDescriptionOverride
-> Maybe FilePath -- ^ Directory to change to before starting the installation.
-> UseLogFile -- ^ File to log output to (if any)
-> IO BuildOutcome
installUnpackedPackage verbosity installLock numJobs
scriptOptions
configFlags installFlags haddockFlags comp progdb
platform pkg rpkg pkgoverride workingDir useLogFile = do
-- Override the .cabal file if necessary
case pkgoverride of
Nothing -> return ()
Just pkgtxt -> do
let descFilePath = fromMaybe "." workingDir
</> display (packageName pkgid) <.> "cabal"
info verbosity $
"Updating " ++ display (packageName pkgid) <.> "cabal"
++ " with the latest revision from the index."
writeFileAtomic descFilePath pkgtxt
-- Make sure that we pass --libsubdir etc to 'setup configure' (necessary if
-- the setup script was compiled against an old version of the Cabal lib).
configFlags' <- addDefaultInstallDirs configFlags
-- Filter out flags not supported by the old versions of the Cabal lib.
let configureFlags :: Version -> ConfigFlags
configureFlags = filterConfigureFlags configFlags' {
configVerbosity = toFlag verbosity'
}
-- Path to the optional log file.
mLogPath <- maybeLogPath
logDirChange (maybe putStr appendFile mLogPath) workingDir $ do
-- Configure phase
onFailure ConfigureFailed $ do
when (numJobs > 1) $ notice verbosity $
"Configuring " ++ display pkgid ++ "..."
setup configureCommand configureFlags mLogPath
-- Build phase
onFailure BuildFailed $ do
when (numJobs > 1) $ notice verbosity $
"Building " ++ display pkgid ++ "..."
setup buildCommand' buildFlags mLogPath
-- Doc generation phase
docsResult <- if shouldHaddock
then (do setup haddockCommand haddockFlags' mLogPath
return DocsOk)
`catchIO` (\_ -> return DocsFailed)
`catchExit` (\_ -> return DocsFailed)
else return DocsNotTried
-- Tests phase
onFailure TestsFailed $ do
when (testsEnabled && PackageDescription.hasTests pkg) $
setup Cabal.testCommand testFlags mLogPath
let testsResult | testsEnabled = TestsOk
| otherwise = TestsNotTried
-- Install phase
onFailure InstallFailed $ criticalSection installLock $ do
-- Actual installation
withWin32SelfUpgrade verbosity uid configFlags
cinfo platform pkg $ do
setup Cabal.copyCommand copyFlags mLogPath
-- Capture installed package configuration file, so that
-- it can be incorporated into the final InstallPlan
ipkgs <- genPkgConfs mLogPath
let ipkgs' = case ipkgs of
[ipkg] -> [ipkg { Installed.installedUnitId = uid }]
_ -> assert (any ((== uid)
. Installed.installedUnitId)
ipkgs) ipkgs
let packageDBs = interpretPackageDbFlags
(fromFlag (configUserInstall configFlags))
(configPackageDBs configFlags)
forM_ ipkgs' $ \ipkg' ->
registerPackage verbosity comp progdb
NoMultiInstance
packageDBs ipkg'
return (Right (BuildResult docsResult testsResult (find ((==uid).installedUnitId) ipkgs')))
where
pkgid = packageId pkg
uid = installedUnitId rpkg
cinfo = compilerInfo comp
buildCommand' = buildCommand progdb
buildFlags _ = emptyBuildFlags {
buildDistPref = configDistPref configFlags,
buildVerbosity = toFlag verbosity'
}
shouldHaddock = fromFlag (installDocumentation installFlags)
haddockFlags' _ = haddockFlags {
haddockVerbosity = toFlag verbosity',
haddockDistPref = configDistPref configFlags
}
testsEnabled = fromFlag (configTests configFlags)
&& fromFlagOrDefault False (installRunTests installFlags)
testFlags _ = Cabal.emptyTestFlags {
Cabal.testDistPref = configDistPref configFlags
}
copyFlags _ = Cabal.emptyCopyFlags {
Cabal.copyDistPref = configDistPref configFlags,
Cabal.copyDest = toFlag InstallDirs.NoCopyDest,
Cabal.copyVerbosity = toFlag verbosity'
}
shouldRegister = PackageDescription.hasLibs pkg
registerFlags _ = Cabal.emptyRegisterFlags {
Cabal.regDistPref = configDistPref configFlags,
Cabal.regVerbosity = toFlag verbosity'
}
verbosity' = maybe verbosity snd useLogFile
tempTemplate name = name ++ "-" ++ display pkgid
addDefaultInstallDirs :: ConfigFlags -> IO ConfigFlags
addDefaultInstallDirs configFlags' = do
defInstallDirs <- InstallDirs.defaultInstallDirs flavor userInstall False
return $ configFlags' {
configInstallDirs = fmap Cabal.Flag .
InstallDirs.substituteInstallDirTemplates env $
InstallDirs.combineInstallDirs fromFlagOrDefault
defInstallDirs (configInstallDirs configFlags)
}
where
CompilerId flavor _ = compilerInfoId cinfo
env = initialPathTemplateEnv pkgid uid cinfo platform
userInstall = fromFlagOrDefault defaultUserInstall
(configUserInstall configFlags')
genPkgConfs :: Maybe FilePath
-> IO [Installed.InstalledPackageInfo]
genPkgConfs mLogPath =
if shouldRegister then do
tmp <- getTemporaryDirectory
withTempDirectory verbosity tmp (tempTemplate "pkgConf") $ \dir -> do
let pkgConfDest = dir </> "pkgConf"
registerFlags' version = (registerFlags version) {
Cabal.regGenPkgConf = toFlag (Just pkgConfDest)
}
setup Cabal.registerCommand registerFlags' mLogPath
is_dir <- doesDirectoryExist pkgConfDest
let notHidden = not . isHidden
isHidden name = "." `isPrefixOf` name
if is_dir
-- Sort so that each prefix of the package
-- configurations is well formed
then mapM (readPkgConf pkgConfDest) . sort . filter notHidden
=<< getDirectoryContents pkgConfDest
else fmap (:[]) $ readPkgConf "." pkgConfDest
else return []
readPkgConf :: FilePath -> FilePath
-> IO Installed.InstalledPackageInfo
readPkgConf pkgConfDir pkgConfFile =
(withUTF8FileContents (pkgConfDir </> pkgConfFile) $ \pkgConfText ->
case Installed.parseInstalledPackageInfo pkgConfText of
Installed.ParseFailed perror -> pkgConfParseFailed perror
Installed.ParseOk warns pkgConf -> do
unless (null warns) $
warn verbosity $ unlines (map (showPWarning pkgConfFile) warns)
return pkgConf)
pkgConfParseFailed :: Installed.PError -> IO a
pkgConfParseFailed perror =
die $ "Couldn't parse the output of 'setup register --gen-pkg-config':"
++ show perror
maybeLogPath :: IO (Maybe FilePath)
maybeLogPath =
case useLogFile of
Nothing -> return Nothing
Just (mkLogFileName, _) -> do
let logFileName = mkLogFileName (packageId pkg) uid
logDir = takeDirectory logFileName
unless (null logDir) $ createDirectoryIfMissing True logDir
logFileExists <- doesFileExist logFileName
when logFileExists $ removeFile logFileName
return (Just logFileName)
setup cmd flags mLogPath =
Exception.bracket
(traverse (\path -> openFile path AppendMode) mLogPath)
(traverse_ hClose)
(\logFileHandle ->
setupWrapper verbosity
scriptOptions { useLoggingHandle = logFileHandle
, useWorkingDir = workingDir }
(Just pkg)
cmd flags [])
-- helper | 8,570 | installUnpackedPackage
:: Verbosity
-> Lock
-> Int
-> SetupScriptOptions
-> ConfigFlags
-> InstallFlags
-> HaddockFlags
-> Compiler
-> ProgramDb
-> Platform
-> PackageDescription
-> ReadyPackage
-> PackageDescriptionOverride
-> Maybe FilePath -- ^ Directory to change to before starting the installation.
-> UseLogFile -- ^ File to log output to (if any)
-> IO BuildOutcome
installUnpackedPackage verbosity installLock numJobs
scriptOptions
configFlags installFlags haddockFlags comp progdb
platform pkg rpkg pkgoverride workingDir useLogFile = do
-- Override the .cabal file if necessary
case pkgoverride of
Nothing -> return ()
Just pkgtxt -> do
let descFilePath = fromMaybe "." workingDir
</> display (packageName pkgid) <.> "cabal"
info verbosity $
"Updating " ++ display (packageName pkgid) <.> "cabal"
++ " with the latest revision from the index."
writeFileAtomic descFilePath pkgtxt
-- Make sure that we pass --libsubdir etc to 'setup configure' (necessary if
-- the setup script was compiled against an old version of the Cabal lib).
configFlags' <- addDefaultInstallDirs configFlags
-- Filter out flags not supported by the old versions of the Cabal lib.
let configureFlags :: Version -> ConfigFlags
configureFlags = filterConfigureFlags configFlags' {
configVerbosity = toFlag verbosity'
}
-- Path to the optional log file.
mLogPath <- maybeLogPath
logDirChange (maybe putStr appendFile mLogPath) workingDir $ do
-- Configure phase
onFailure ConfigureFailed $ do
when (numJobs > 1) $ notice verbosity $
"Configuring " ++ display pkgid ++ "..."
setup configureCommand configureFlags mLogPath
-- Build phase
onFailure BuildFailed $ do
when (numJobs > 1) $ notice verbosity $
"Building " ++ display pkgid ++ "..."
setup buildCommand' buildFlags mLogPath
-- Doc generation phase
docsResult <- if shouldHaddock
then (do setup haddockCommand haddockFlags' mLogPath
return DocsOk)
`catchIO` (\_ -> return DocsFailed)
`catchExit` (\_ -> return DocsFailed)
else return DocsNotTried
-- Tests phase
onFailure TestsFailed $ do
when (testsEnabled && PackageDescription.hasTests pkg) $
setup Cabal.testCommand testFlags mLogPath
let testsResult | testsEnabled = TestsOk
| otherwise = TestsNotTried
-- Install phase
onFailure InstallFailed $ criticalSection installLock $ do
-- Actual installation
withWin32SelfUpgrade verbosity uid configFlags
cinfo platform pkg $ do
setup Cabal.copyCommand copyFlags mLogPath
-- Capture installed package configuration file, so that
-- it can be incorporated into the final InstallPlan
ipkgs <- genPkgConfs mLogPath
let ipkgs' = case ipkgs of
[ipkg] -> [ipkg { Installed.installedUnitId = uid }]
_ -> assert (any ((== uid)
. Installed.installedUnitId)
ipkgs) ipkgs
let packageDBs = interpretPackageDbFlags
(fromFlag (configUserInstall configFlags))
(configPackageDBs configFlags)
forM_ ipkgs' $ \ipkg' ->
registerPackage verbosity comp progdb
NoMultiInstance
packageDBs ipkg'
return (Right (BuildResult docsResult testsResult (find ((==uid).installedUnitId) ipkgs')))
where
pkgid = packageId pkg
uid = installedUnitId rpkg
cinfo = compilerInfo comp
buildCommand' = buildCommand progdb
buildFlags _ = emptyBuildFlags {
buildDistPref = configDistPref configFlags,
buildVerbosity = toFlag verbosity'
}
shouldHaddock = fromFlag (installDocumentation installFlags)
haddockFlags' _ = haddockFlags {
haddockVerbosity = toFlag verbosity',
haddockDistPref = configDistPref configFlags
}
testsEnabled = fromFlag (configTests configFlags)
&& fromFlagOrDefault False (installRunTests installFlags)
testFlags _ = Cabal.emptyTestFlags {
Cabal.testDistPref = configDistPref configFlags
}
copyFlags _ = Cabal.emptyCopyFlags {
Cabal.copyDistPref = configDistPref configFlags,
Cabal.copyDest = toFlag InstallDirs.NoCopyDest,
Cabal.copyVerbosity = toFlag verbosity'
}
shouldRegister = PackageDescription.hasLibs pkg
registerFlags _ = Cabal.emptyRegisterFlags {
Cabal.regDistPref = configDistPref configFlags,
Cabal.regVerbosity = toFlag verbosity'
}
verbosity' = maybe verbosity snd useLogFile
tempTemplate name = name ++ "-" ++ display pkgid
addDefaultInstallDirs :: ConfigFlags -> IO ConfigFlags
addDefaultInstallDirs configFlags' = do
defInstallDirs <- InstallDirs.defaultInstallDirs flavor userInstall False
return $ configFlags' {
configInstallDirs = fmap Cabal.Flag .
InstallDirs.substituteInstallDirTemplates env $
InstallDirs.combineInstallDirs fromFlagOrDefault
defInstallDirs (configInstallDirs configFlags)
}
where
CompilerId flavor _ = compilerInfoId cinfo
env = initialPathTemplateEnv pkgid uid cinfo platform
userInstall = fromFlagOrDefault defaultUserInstall
(configUserInstall configFlags')
genPkgConfs :: Maybe FilePath
-> IO [Installed.InstalledPackageInfo]
genPkgConfs mLogPath =
if shouldRegister then do
tmp <- getTemporaryDirectory
withTempDirectory verbosity tmp (tempTemplate "pkgConf") $ \dir -> do
let pkgConfDest = dir </> "pkgConf"
registerFlags' version = (registerFlags version) {
Cabal.regGenPkgConf = toFlag (Just pkgConfDest)
}
setup Cabal.registerCommand registerFlags' mLogPath
is_dir <- doesDirectoryExist pkgConfDest
let notHidden = not . isHidden
isHidden name = "." `isPrefixOf` name
if is_dir
-- Sort so that each prefix of the package
-- configurations is well formed
then mapM (readPkgConf pkgConfDest) . sort . filter notHidden
=<< getDirectoryContents pkgConfDest
else fmap (:[]) $ readPkgConf "." pkgConfDest
else return []
readPkgConf :: FilePath -> FilePath
-> IO Installed.InstalledPackageInfo
readPkgConf pkgConfDir pkgConfFile =
(withUTF8FileContents (pkgConfDir </> pkgConfFile) $ \pkgConfText ->
case Installed.parseInstalledPackageInfo pkgConfText of
Installed.ParseFailed perror -> pkgConfParseFailed perror
Installed.ParseOk warns pkgConf -> do
unless (null warns) $
warn verbosity $ unlines (map (showPWarning pkgConfFile) warns)
return pkgConf)
pkgConfParseFailed :: Installed.PError -> IO a
pkgConfParseFailed perror =
die $ "Couldn't parse the output of 'setup register --gen-pkg-config':"
++ show perror
maybeLogPath :: IO (Maybe FilePath)
maybeLogPath =
case useLogFile of
Nothing -> return Nothing
Just (mkLogFileName, _) -> do
let logFileName = mkLogFileName (packageId pkg) uid
logDir = takeDirectory logFileName
unless (null logDir) $ createDirectoryIfMissing True logDir
logFileExists <- doesFileExist logFileName
when logFileExists $ removeFile logFileName
return (Just logFileName)
setup cmd flags mLogPath =
Exception.bracket
(traverse (\path -> openFile path AppendMode) mLogPath)
(traverse_ hClose)
(\logFileHandle ->
setupWrapper verbosity
scriptOptions { useLoggingHandle = logFileHandle
, useWorkingDir = workingDir }
(Just pkg)
cmd flags [])
-- helper | 8,570 | installUnpackedPackage verbosity installLock numJobs
scriptOptions
configFlags installFlags haddockFlags comp progdb
platform pkg rpkg pkgoverride workingDir useLogFile = do
-- Override the .cabal file if necessary
case pkgoverride of
Nothing -> return ()
Just pkgtxt -> do
let descFilePath = fromMaybe "." workingDir
</> display (packageName pkgid) <.> "cabal"
info verbosity $
"Updating " ++ display (packageName pkgid) <.> "cabal"
++ " with the latest revision from the index."
writeFileAtomic descFilePath pkgtxt
-- Make sure that we pass --libsubdir etc to 'setup configure' (necessary if
-- the setup script was compiled against an old version of the Cabal lib).
configFlags' <- addDefaultInstallDirs configFlags
-- Filter out flags not supported by the old versions of the Cabal lib.
let configureFlags :: Version -> ConfigFlags
configureFlags = filterConfigureFlags configFlags' {
configVerbosity = toFlag verbosity'
}
-- Path to the optional log file.
mLogPath <- maybeLogPath
logDirChange (maybe putStr appendFile mLogPath) workingDir $ do
-- Configure phase
onFailure ConfigureFailed $ do
when (numJobs > 1) $ notice verbosity $
"Configuring " ++ display pkgid ++ "..."
setup configureCommand configureFlags mLogPath
-- Build phase
onFailure BuildFailed $ do
when (numJobs > 1) $ notice verbosity $
"Building " ++ display pkgid ++ "..."
setup buildCommand' buildFlags mLogPath
-- Doc generation phase
docsResult <- if shouldHaddock
then (do setup haddockCommand haddockFlags' mLogPath
return DocsOk)
`catchIO` (\_ -> return DocsFailed)
`catchExit` (\_ -> return DocsFailed)
else return DocsNotTried
-- Tests phase
onFailure TestsFailed $ do
when (testsEnabled && PackageDescription.hasTests pkg) $
setup Cabal.testCommand testFlags mLogPath
let testsResult | testsEnabled = TestsOk
| otherwise = TestsNotTried
-- Install phase
onFailure InstallFailed $ criticalSection installLock $ do
-- Actual installation
withWin32SelfUpgrade verbosity uid configFlags
cinfo platform pkg $ do
setup Cabal.copyCommand copyFlags mLogPath
-- Capture installed package configuration file, so that
-- it can be incorporated into the final InstallPlan
ipkgs <- genPkgConfs mLogPath
let ipkgs' = case ipkgs of
[ipkg] -> [ipkg { Installed.installedUnitId = uid }]
_ -> assert (any ((== uid)
. Installed.installedUnitId)
ipkgs) ipkgs
let packageDBs = interpretPackageDbFlags
(fromFlag (configUserInstall configFlags))
(configPackageDBs configFlags)
forM_ ipkgs' $ \ipkg' ->
registerPackage verbosity comp progdb
NoMultiInstance
packageDBs ipkg'
return (Right (BuildResult docsResult testsResult (find ((==uid).installedUnitId) ipkgs')))
where
pkgid = packageId pkg
uid = installedUnitId rpkg
cinfo = compilerInfo comp
buildCommand' = buildCommand progdb
buildFlags _ = emptyBuildFlags {
buildDistPref = configDistPref configFlags,
buildVerbosity = toFlag verbosity'
}
shouldHaddock = fromFlag (installDocumentation installFlags)
haddockFlags' _ = haddockFlags {
haddockVerbosity = toFlag verbosity',
haddockDistPref = configDistPref configFlags
}
testsEnabled = fromFlag (configTests configFlags)
&& fromFlagOrDefault False (installRunTests installFlags)
testFlags _ = Cabal.emptyTestFlags {
Cabal.testDistPref = configDistPref configFlags
}
copyFlags _ = Cabal.emptyCopyFlags {
Cabal.copyDistPref = configDistPref configFlags,
Cabal.copyDest = toFlag InstallDirs.NoCopyDest,
Cabal.copyVerbosity = toFlag verbosity'
}
shouldRegister = PackageDescription.hasLibs pkg
registerFlags _ = Cabal.emptyRegisterFlags {
Cabal.regDistPref = configDistPref configFlags,
Cabal.regVerbosity = toFlag verbosity'
}
verbosity' = maybe verbosity snd useLogFile
tempTemplate name = name ++ "-" ++ display pkgid
addDefaultInstallDirs :: ConfigFlags -> IO ConfigFlags
addDefaultInstallDirs configFlags' = do
defInstallDirs <- InstallDirs.defaultInstallDirs flavor userInstall False
return $ configFlags' {
configInstallDirs = fmap Cabal.Flag .
InstallDirs.substituteInstallDirTemplates env $
InstallDirs.combineInstallDirs fromFlagOrDefault
defInstallDirs (configInstallDirs configFlags)
}
where
CompilerId flavor _ = compilerInfoId cinfo
env = initialPathTemplateEnv pkgid uid cinfo platform
userInstall = fromFlagOrDefault defaultUserInstall
(configUserInstall configFlags')
genPkgConfs :: Maybe FilePath
-> IO [Installed.InstalledPackageInfo]
genPkgConfs mLogPath =
if shouldRegister then do
tmp <- getTemporaryDirectory
withTempDirectory verbosity tmp (tempTemplate "pkgConf") $ \dir -> do
let pkgConfDest = dir </> "pkgConf"
registerFlags' version = (registerFlags version) {
Cabal.regGenPkgConf = toFlag (Just pkgConfDest)
}
setup Cabal.registerCommand registerFlags' mLogPath
is_dir <- doesDirectoryExist pkgConfDest
let notHidden = not . isHidden
isHidden name = "." `isPrefixOf` name
if is_dir
-- Sort so that each prefix of the package
-- configurations is well formed
then mapM (readPkgConf pkgConfDest) . sort . filter notHidden
=<< getDirectoryContents pkgConfDest
else fmap (:[]) $ readPkgConf "." pkgConfDest
else return []
readPkgConf :: FilePath -> FilePath
-> IO Installed.InstalledPackageInfo
readPkgConf pkgConfDir pkgConfFile =
(withUTF8FileContents (pkgConfDir </> pkgConfFile) $ \pkgConfText ->
case Installed.parseInstalledPackageInfo pkgConfText of
Installed.ParseFailed perror -> pkgConfParseFailed perror
Installed.ParseOk warns pkgConf -> do
unless (null warns) $
warn verbosity $ unlines (map (showPWarning pkgConfFile) warns)
return pkgConf)
pkgConfParseFailed :: Installed.PError -> IO a
pkgConfParseFailed perror =
die $ "Couldn't parse the output of 'setup register --gen-pkg-config':"
++ show perror
maybeLogPath :: IO (Maybe FilePath)
maybeLogPath =
case useLogFile of
Nothing -> return Nothing
Just (mkLogFileName, _) -> do
let logFileName = mkLogFileName (packageId pkg) uid
logDir = takeDirectory logFileName
unless (null logDir) $ createDirectoryIfMissing True logDir
logFileExists <- doesFileExist logFileName
when logFileExists $ removeFile logFileName
return (Just logFileName)
setup cmd flags mLogPath =
Exception.bracket
(traverse (\path -> openFile path AppendMode) mLogPath)
(traverse_ hClose)
(\logFileHandle ->
setupWrapper verbosity
scriptOptions { useLoggingHandle = logFileHandle
, useWorkingDir = workingDir }
(Just pkg)
cmd flags [])
-- helper | 8,164 | false | true | 0 | 34 | 2,773 | 1,790 | 870 | 920 | null | null |
nomeata/cryptonite | tests/ChaCha.hs | bsd-3-clause | b8_256_k0_i0 =
"\x3e\x00\xef\x2f\x89\x5f\x40\xd6\x7f\x5b\xb8\xe8\x1f\x09\xa5\xa1\x2c\x84\x0e\xc3\xce\x9a\x7f\x3b\x18\x1b\xe1\x88\xef\x71\x1a\x1e\x98\x4c\xe1\x72\xb9\x21\x6f\x41\x9f\x44\x53\x67\x45\x6d\x56\x19\x31\x4a\x42\xa3\xda\x86\xb0\x01\x38\x7b\xfd\xb8\x0e\x0c\xfe\x42\xd2\xae\xfa\x0d\xea\xa5\xc1\x51\xbf\x0a\xdb\x6c\x01\xf2\xa5\xad\xc0\xfd\x58\x12\x59\xf9\xa2\xaa\xdc\xf2\x0f\x8f\xd5\x66\xa2\x6b\x50\x32\xec\x38\xbb\xc5\xda\x98\xee\x0c\x6f\x56\x8b\x87\x2a\x65\xa0\x8a\xbf\x25\x1d\xeb\x21\xbb\x4b\x56\xe5\xd8\x82\x1e\x68\xaa" | 533 | b8_256_k0_i0 =
"\x3e\x00\xef\x2f\x89\x5f\x40\xd6\x7f\x5b\xb8\xe8\x1f\x09\xa5\xa1\x2c\x84\x0e\xc3\xce\x9a\x7f\x3b\x18\x1b\xe1\x88\xef\x71\x1a\x1e\x98\x4c\xe1\x72\xb9\x21\x6f\x41\x9f\x44\x53\x67\x45\x6d\x56\x19\x31\x4a\x42\xa3\xda\x86\xb0\x01\x38\x7b\xfd\xb8\x0e\x0c\xfe\x42\xd2\xae\xfa\x0d\xea\xa5\xc1\x51\xbf\x0a\xdb\x6c\x01\xf2\xa5\xad\xc0\xfd\x58\x12\x59\xf9\xa2\xaa\xdc\xf2\x0f\x8f\xd5\x66\xa2\x6b\x50\x32\xec\x38\xbb\xc5\xda\x98\xee\x0c\x6f\x56\x8b\x87\x2a\x65\xa0\x8a\xbf\x25\x1d\xeb\x21\xbb\x4b\x56\xe5\xd8\x82\x1e\x68\xaa" | 533 | b8_256_k0_i0 =
"\x3e\x00\xef\x2f\x89\x5f\x40\xd6\x7f\x5b\xb8\xe8\x1f\x09\xa5\xa1\x2c\x84\x0e\xc3\xce\x9a\x7f\x3b\x18\x1b\xe1\x88\xef\x71\x1a\x1e\x98\x4c\xe1\x72\xb9\x21\x6f\x41\x9f\x44\x53\x67\x45\x6d\x56\x19\x31\x4a\x42\xa3\xda\x86\xb0\x01\x38\x7b\xfd\xb8\x0e\x0c\xfe\x42\xd2\xae\xfa\x0d\xea\xa5\xc1\x51\xbf\x0a\xdb\x6c\x01\xf2\xa5\xad\xc0\xfd\x58\x12\x59\xf9\xa2\xaa\xdc\xf2\x0f\x8f\xd5\x66\xa2\x6b\x50\x32\xec\x38\xbb\xc5\xda\x98\xee\x0c\x6f\x56\x8b\x87\x2a\x65\xa0\x8a\xbf\x25\x1d\xeb\x21\xbb\x4b\x56\xe5\xd8\x82\x1e\x68\xaa" | 533 | false | false | 0 | 4 | 6 | 6 | 3 | 3 | null | null |
cchalmers/geometry | src/Geometry/Trace.hs | bsd-3-clause | mkTrace :: (Point v n -> v n -> Seq n) -> Trace v n
mkTrace = Trace | 67 | mkTrace :: (Point v n -> v n -> Seq n) -> Trace v n
mkTrace = Trace | 67 | mkTrace = Trace | 15 | false | true | 0 | 9 | 17 | 42 | 20 | 22 | null | null |
quyse/flaw | flaw-visual/Flaw/Visual/Geometry/Basic.hs | mit | planeVertices
:: (VG.Vector v a, VG.Vector v Int)
=> (Float -> Float -> a) -- ^ Function producing vertex for specified coordinates (from 0 to 1).
-> Int -- ^ Width in cells (i.e. 1 for a simple quad).
-> Int -- ^ Height in cells (i.e. 1 for a simple quad).
-> v a
planeVertices f width height = patchTopology (VG.fromList $ map (uncurry f) vertices) (width + 1) (height + 1) where
vertices =
[ ( fromIntegral i * heightCoef
, fromIntegral j * widthCoef
)
| i <- [0 .. height]
, j <- [0 .. width]
]
widthCoef = 1 / fromIntegral width
heightCoef = 1 / fromIntegral height
-- | Raw vertices for a sphere.
-- For 0th meridian it produces double vertices (with longitude = 0 and pi * 2), giving a chance for different vertices
-- (for example, to use different texture coordinates). | 823 | planeVertices
:: (VG.Vector v a, VG.Vector v Int)
=> (Float -> Float -> a) -- ^ Function producing vertex for specified coordinates (from 0 to 1).
-> Int -- ^ Width in cells (i.e. 1 for a simple quad).
-> Int -- ^ Height in cells (i.e. 1 for a simple quad).
-> v a
planeVertices f width height = patchTopology (VG.fromList $ map (uncurry f) vertices) (width + 1) (height + 1) where
vertices =
[ ( fromIntegral i * heightCoef
, fromIntegral j * widthCoef
)
| i <- [0 .. height]
, j <- [0 .. width]
]
widthCoef = 1 / fromIntegral width
heightCoef = 1 / fromIntegral height
-- | Raw vertices for a sphere.
-- For 0th meridian it produces double vertices (with longitude = 0 and pi * 2), giving a chance for different vertices
-- (for example, to use different texture coordinates). | 823 | planeVertices f width height = patchTopology (VG.fromList $ map (uncurry f) vertices) (width + 1) (height + 1) where
vertices =
[ ( fromIntegral i * heightCoef
, fromIntegral j * widthCoef
)
| i <- [0 .. height]
, j <- [0 .. width]
]
widthCoef = 1 / fromIntegral width
heightCoef = 1 / fromIntegral height
-- | Raw vertices for a sphere.
-- For 0th meridian it produces double vertices (with longitude = 0 and pi * 2), giving a chance for different vertices
-- (for example, to use different texture coordinates). | 548 | false | true | 0 | 10 | 194 | 199 | 106 | 93 | null | null |
stites/reinforce | reinforce-algorithms/src/Reinforce/Agents/QTable.hs | bsd-3-clause | lambdaL :: Lens' (QTableState o a r) (Either r (Integer, r, Integer -> r -> r))
lambdaL = lens lambda $ \(QTableState a _) b -> QTableState a b | 143 | lambdaL :: Lens' (QTableState o a r) (Either r (Integer, r, Integer -> r -> r))
lambdaL = lens lambda $ \(QTableState a _) b -> QTableState a b | 143 | lambdaL = lens lambda $ \(QTableState a _) b -> QTableState a b | 63 | false | true | 0 | 10 | 28 | 78 | 40 | 38 | null | null |
arnihermann/timedreb2erl | src/Language/Rebeca/Printrebeca.hs | mit | prPrec :: Int -> Int -> Doc -> Doc
prPrec i j = if j<i then parenth else id | 75 | prPrec :: Int -> Int -> Doc -> Doc
prPrec i j = if j<i then parenth else id | 75 | prPrec i j = if j<i then parenth else id | 40 | false | true | 0 | 9 | 18 | 46 | 22 | 24 | null | null |
mgrabmueller/harpy | Harpy/X86CodeGen.hs | bsd-3-clause | x86_movss_to_reg :: XMMLocation xmm => Word8 -> xmm -> CodeGen e s ()
x86_movss_to_reg dreg reg =
do emit8 0xf3
emit8 0x0f
emit8 0x10
xmm_location_emit dreg reg | 185 | x86_movss_to_reg :: XMMLocation xmm => Word8 -> xmm -> CodeGen e s ()
x86_movss_to_reg dreg reg =
do emit8 0xf3
emit8 0x0f
emit8 0x10
xmm_location_emit dreg reg | 185 | x86_movss_to_reg dreg reg =
do emit8 0xf3
emit8 0x0f
emit8 0x10
xmm_location_emit dreg reg | 115 | false | true | 0 | 9 | 51 | 66 | 28 | 38 | null | null |
keithodulaigh/Hets | CASL/AS_Basic_CASL.der.hs | gpl-2.0 | mkAnyEq :: Equality -> TERM f -> TERM f -> FORMULA f
mkAnyEq e f f' = Equation f e f' nullRange | 95 | mkAnyEq :: Equality -> TERM f -> TERM f -> FORMULA f
mkAnyEq e f f' = Equation f e f' nullRange | 95 | mkAnyEq e f f' = Equation f e f' nullRange | 42 | false | true | 0 | 8 | 21 | 48 | 22 | 26 | null | null |
alexander-at-github/eta | compiler/ETA/Prelude/PrimOp.hs | bsd-3-clause | primOpCanFail ReadOffAddrOp_Word64 = True | 41 | primOpCanFail ReadOffAddrOp_Word64 = True | 41 | primOpCanFail ReadOffAddrOp_Word64 = True | 41 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
alexander-at-github/eta | compiler/ETA/Types/Type.hs | bsd-3-clause | -- | Substitute within several 'Type's
substTys :: TvSubst -> [Type] -> [Type]
substTys subst tys | isEmptyTvSubst subst = tys
| otherwise = map (subst_ty subst) tys | 195 | substTys :: TvSubst -> [Type] -> [Type]
substTys subst tys | isEmptyTvSubst subst = tys
| otherwise = map (subst_ty subst) tys | 156 | substTys subst tys | isEmptyTvSubst subst = tys
| otherwise = map (subst_ty subst) tys | 116 | true | true | 0 | 8 | 57 | 60 | 29 | 31 | null | null |
nablaa/hchesslib | src/Chess/Internal/Move.hs | gpl-2.0 | boardAfterMove board (EnPassant (Piece player _) from to@(row, col)) = movePiece from to (removePiece board (epSquare player))
where epSquare White = (row + 1, col)
epSquare Black = (row - 1, col) | 218 | boardAfterMove board (EnPassant (Piece player _) from to@(row, col)) = movePiece from to (removePiece board (epSquare player))
where epSquare White = (row + 1, col)
epSquare Black = (row - 1, col) | 218 | boardAfterMove board (EnPassant (Piece player _) from to@(row, col)) = movePiece from to (removePiece board (epSquare player))
where epSquare White = (row + 1, col)
epSquare Black = (row - 1, col) | 218 | false | false | 0 | 9 | 53 | 99 | 51 | 48 | null | null |
mightymoose/liquidhaskell | benchmarks/bytestring-0.9.2.1/Data/ByteString/Lazy.hs | bsd-3-clause | splitAt :: Int64 -> ByteString -> (ByteString, ByteString)
splitAt i cs0 | i <= 0 = (Empty, cs0) | 96 | splitAt :: Int64 -> ByteString -> (ByteString, ByteString)
splitAt i cs0 | i <= 0 = (Empty, cs0) | 96 | splitAt i cs0 | i <= 0 = (Empty, cs0) | 37 | false | true | 0 | 8 | 17 | 46 | 24 | 22 | null | null |
konn/pandoc-japanese-filters | japanese-filter.hs | gpl-2.0 | procJapanese mfmt (RawInline "latex" src)
| Right [hat'|\rensuji{\hask{rt}}|] <- parseLaTeX (T.pack src)
= let toI = inlify . readLaTeX' myReaderOpts . T.unpack . render
in renderJapanese mfmt $ TatechuYoko $ toI rt | 223 | procJapanese mfmt (RawInline "latex" src)
| Right [hat'|\rensuji{\hask{rt}}|] <- parseLaTeX (T.pack src)
= let toI = inlify . readLaTeX' myReaderOpts . T.unpack . render
in renderJapanese mfmt $ TatechuYoko $ toI rt | 223 | procJapanese mfmt (RawInline "latex" src)
| Right [hat'|\rensuji{\hask{rt}}|] <- parseLaTeX (T.pack src)
= let toI = inlify . readLaTeX' myReaderOpts . T.unpack . render
in renderJapanese mfmt $ TatechuYoko $ toI rt | 223 | false | false | 0 | 13 | 39 | 89 | 42 | 47 | null | null |
daewon/til | exercism/haskell/largest-series-product/src/Series.hs | mpl-2.0 | windows :: Int -> [a] -> [[a]]
windows n xs = filter pLenEq windows'
where
windows' = transpose (take n tails')
tails' = tails xs
pLenEq = (== n) . length | 168 | windows :: Int -> [a] -> [[a]]
windows n xs = filter pLenEq windows'
where
windows' = transpose (take n tails')
tails' = tails xs
pLenEq = (== n) . length | 168 | windows n xs = filter pLenEq windows'
where
windows' = transpose (take n tails')
tails' = tails xs
pLenEq = (== n) . length | 137 | false | true | 3 | 10 | 44 | 90 | 42 | 48 | null | null |
HairyDude/pdxparse | src/SettingsTypes.hs | mit | -- | Get the localization string for a given key, if it exists.
getGameL10nIfPresent :: (IsGameData (GameData g), Monad m) => Text -> PPT g m (Maybe Text)
getGameL10nIfPresent key = fmap content <$> HM.lookup key <$> getCurrentLang | 231 | getGameL10nIfPresent :: (IsGameData (GameData g), Monad m) => Text -> PPT g m (Maybe Text)
getGameL10nIfPresent key = fmap content <$> HM.lookup key <$> getCurrentLang | 167 | getGameL10nIfPresent key = fmap content <$> HM.lookup key <$> getCurrentLang | 76 | true | true | 0 | 9 | 37 | 69 | 34 | 35 | null | null |
bgamari/text | src/Data/Text/Lazy.hs | bsd-2-clause | -- | /O(n)/ Joins words using single space characters.
unwords :: [Text] -> Text
unwords = intercalate (singleton ' ') | 118 | unwords :: [Text] -> Text
unwords = intercalate (singleton ' ') | 63 | unwords = intercalate (singleton ' ') | 37 | true | true | 0 | 7 | 19 | 28 | 15 | 13 | null | null |
bj4rtmar/sdl2 | src/SDL/Raw/Thread.hs | bsd-3-clause | atomicIncRef :: Ptr Atomic -> IO CInt
atomicIncRef a = atomicAdd a 1 | 68 | atomicIncRef :: Ptr Atomic -> IO CInt
atomicIncRef a = atomicAdd a 1 | 68 | atomicIncRef a = atomicAdd a 1 | 30 | false | true | 0 | 7 | 12 | 35 | 14 | 21 | null | null |
rfranek/duckling | Duckling/Time/HE/Rules.hs | bsd-3-clause | ruleNamedmonth9 :: Rule
ruleNamedmonth9 = Rule
{ name = "named-month"
, pattern =
[ regex "\x05e1\x05e4\x05d8\x05de\x05d1\x05e8"
]
, prod = \_ -> tt $ month 9
} | 176 | ruleNamedmonth9 :: Rule
ruleNamedmonth9 = Rule
{ name = "named-month"
, pattern =
[ regex "\x05e1\x05e4\x05d8\x05de\x05d1\x05e8"
]
, prod = \_ -> tt $ month 9
} | 176 | ruleNamedmonth9 = Rule
{ name = "named-month"
, pattern =
[ regex "\x05e1\x05e4\x05d8\x05de\x05d1\x05e8"
]
, prod = \_ -> tt $ month 9
} | 152 | false | true | 0 | 10 | 42 | 53 | 29 | 24 | null | null |
DanielWaterworth/Idris-dev | src/IRTS/CodegenLLVM.hs | bsd-3-clause | outputModule tm file Executable m = withTmpFile $ \obj -> do
outputModule tm obj Object m
cc <- getCC
defs <- (</> "llvm" </> "libidris_rts.a") <$> getDataDir
exit <- rawSystem cc [obj, defs, "-lm", "-lgmp", "-lgc", "-o", file]
when (exit /= ExitSuccess) $ ierror "FAILURE: Linking" | 292 | outputModule tm file Executable m = withTmpFile $ \obj -> do
outputModule tm obj Object m
cc <- getCC
defs <- (</> "llvm" </> "libidris_rts.a") <$> getDataDir
exit <- rawSystem cc [obj, defs, "-lm", "-lgmp", "-lgc", "-o", file]
when (exit /= ExitSuccess) $ ierror "FAILURE: Linking" | 292 | outputModule tm file Executable m = withTmpFile $ \obj -> do
outputModule tm obj Object m
cc <- getCC
defs <- (</> "llvm" </> "libidris_rts.a") <$> getDataDir
exit <- rawSystem cc [obj, defs, "-lm", "-lgmp", "-lgc", "-o", file]
when (exit /= ExitSuccess) $ ierror "FAILURE: Linking" | 292 | false | false | 0 | 12 | 55 | 119 | 58 | 61 | null | null |
advancedtelematic/quickcheck-state-machine-model | src/Test/StateMachine/Utils.hs | bsd-3-clause | shrinkListS :: forall a. (a -> [Shrunk a]) -> [a] -> [Shrunk [a]]
shrinkListS f = \xs -> concat [
map (Shrunk True) (shrinkList (const []) xs)
, shrinkOne xs
, [Shrunk False xs]
]
where
shrinkOne :: [a] -> [Shrunk [a]]
shrinkOne [] = []
shrinkOne (x:xs) = [Shrunk True (x' : xs) | Shrunk True x' <- f x]
++ [Shrunk True (x : xs') | Shrunk True xs' <- shrinkOne xs]
-- | Shrink list without shrinking elements. | 467 | shrinkListS :: forall a. (a -> [Shrunk a]) -> [a] -> [Shrunk [a]]
shrinkListS f = \xs -> concat [
map (Shrunk True) (shrinkList (const []) xs)
, shrinkOne xs
, [Shrunk False xs]
]
where
shrinkOne :: [a] -> [Shrunk [a]]
shrinkOne [] = []
shrinkOne (x:xs) = [Shrunk True (x' : xs) | Shrunk True x' <- f x]
++ [Shrunk True (x : xs') | Shrunk True xs' <- shrinkOne xs]
-- | Shrink list without shrinking elements. | 467 | shrinkListS f = \xs -> concat [
map (Shrunk True) (shrinkList (const []) xs)
, shrinkOne xs
, [Shrunk False xs]
]
where
shrinkOne :: [a] -> [Shrunk [a]]
shrinkOne [] = []
shrinkOne (x:xs) = [Shrunk True (x' : xs) | Shrunk True x' <- f x]
++ [Shrunk True (x : xs') | Shrunk True xs' <- shrinkOne xs]
-- | Shrink list without shrinking elements. | 401 | false | true | 2 | 13 | 138 | 237 | 118 | 119 | null | null |
plumlife/cabal | Cabal/Distribution/Simple/GHCJS.hs | bsd-3-clause | findGhcjsPkgGhcVersion :: Verbosity -> FilePath -> IO (Maybe Version)
findGhcjsPkgGhcVersion verbosity pgm =
findProgramVersion "--numeric-ghc-version" id verbosity pgm | 170 | findGhcjsPkgGhcVersion :: Verbosity -> FilePath -> IO (Maybe Version)
findGhcjsPkgGhcVersion verbosity pgm =
findProgramVersion "--numeric-ghc-version" id verbosity pgm | 170 | findGhcjsPkgGhcVersion verbosity pgm =
findProgramVersion "--numeric-ghc-version" id verbosity pgm | 100 | false | true | 0 | 9 | 19 | 42 | 20 | 22 | null | null |
termite2/tsl | Frontend/ExprFlatten.hs | bsd-3-clause | exprFlatten' iid s (EField p e f) =
let ?scope = s
in case exprTypeSpec e of
TemplateTypeSpec _ tn -> case objGet (ObjTemplate $ getTemplate tn) f of
ObjGVar _ v -> ETerm p [itreeFlattenName (itreeRelToAbsPath iid (epath e)) (name v)]
ObjWire _ w -> ETerm p [itreeFlattenName (itreeRelToAbsPath iid (epath e)) (name w)]
where epath (ETerm _ n) = n
epath (EField _ e' n) = epath e' ++ [n]
_ -> EField p e f | 626 | exprFlatten' iid s (EField p e f) =
let ?scope = s
in case exprTypeSpec e of
TemplateTypeSpec _ tn -> case objGet (ObjTemplate $ getTemplate tn) f of
ObjGVar _ v -> ETerm p [itreeFlattenName (itreeRelToAbsPath iid (epath e)) (name v)]
ObjWire _ w -> ETerm p [itreeFlattenName (itreeRelToAbsPath iid (epath e)) (name w)]
where epath (ETerm _ n) = n
epath (EField _ e' n) = epath e' ++ [n]
_ -> EField p e f | 626 | exprFlatten' iid s (EField p e f) =
let ?scope = s
in case exprTypeSpec e of
TemplateTypeSpec _ tn -> case objGet (ObjTemplate $ getTemplate tn) f of
ObjGVar _ v -> ETerm p [itreeFlattenName (itreeRelToAbsPath iid (epath e)) (name v)]
ObjWire _ w -> ETerm p [itreeFlattenName (itreeRelToAbsPath iid (epath e)) (name w)]
where epath (ETerm _ n) = n
epath (EField _ e' n) = epath e' ++ [n]
_ -> EField p e f | 626 | false | false | 0 | 19 | 298 | 218 | 104 | 114 | null | null |
Concomitant/LambdaHack | Game/LambdaHack/Common/Flavour.hs | bsd-3-clause | colorToPlainName Red = "red" | 34 | colorToPlainName Red = "red" | 34 | colorToPlainName Red = "red" | 34 | false | false | 0 | 5 | 9 | 9 | 4 | 5 | null | null |
mariefarrell/Hets | Driver/Options.hs | gpl-2.0 | defLogicIsDMU :: HetcatsOpts -> Bool
defLogicIsDMU = isDefLogic "DMU" | 69 | defLogicIsDMU :: HetcatsOpts -> Bool
defLogicIsDMU = isDefLogic "DMU" | 69 | defLogicIsDMU = isDefLogic "DMU" | 32 | false | true | 0 | 7 | 8 | 24 | 10 | 14 | null | null |
ekmett/type-int | Data/Type/Hex/Stage3.hs | bsd-2-clause | tSucc :: TSucc n m => n -> m; tSucc = undefined | 47 | tSucc :: TSucc n m => n -> m
tSucc = undefined | 46 | tSucc = undefined | 17 | false | true | 0 | 6 | 11 | 29 | 14 | 15 | null | null |
rueshyna/gogol | gogol-customsearch/gen/Network/Google/CustomSearch/Types/Product.hs | mpl-2.0 | sPromotions :: Lens' Search [Promotion]
sPromotions
= lens _sPromotions (\ s a -> s{_sPromotions = a}) .
_Default
. _Coerce | 137 | sPromotions :: Lens' Search [Promotion]
sPromotions
= lens _sPromotions (\ s a -> s{_sPromotions = a}) .
_Default
. _Coerce | 137 | sPromotions
= lens _sPromotions (\ s a -> s{_sPromotions = a}) .
_Default
. _Coerce | 97 | false | true | 0 | 11 | 33 | 52 | 27 | 25 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/ResourceProperties/CodeBuildProjectSource.hs | mit | -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-source.html#cfn-codebuild-project-source-gitclonedepth
cbpsGitCloneDepth :: Lens' CodeBuildProjectSource (Maybe (Val Integer))
cbpsGitCloneDepth = lens _codeBuildProjectSourceGitCloneDepth (\s a -> s { _codeBuildProjectSourceGitCloneDepth = a }) | 345 | cbpsGitCloneDepth :: Lens' CodeBuildProjectSource (Maybe (Val Integer))
cbpsGitCloneDepth = lens _codeBuildProjectSourceGitCloneDepth (\s a -> s { _codeBuildProjectSourceGitCloneDepth = a }) | 190 | cbpsGitCloneDepth = lens _codeBuildProjectSourceGitCloneDepth (\s a -> s { _codeBuildProjectSourceGitCloneDepth = a }) | 118 | true | true | 1 | 9 | 22 | 57 | 28 | 29 | null | null |
abakst/Zoepis | Zoepis/ZVector.hs | gpl-3.0 | toGLd :: Double -> GLdouble
toGLd = unsafeCoerce | 48 | toGLd :: Double -> GLdouble
toGLd = unsafeCoerce | 48 | toGLd = unsafeCoerce | 20 | false | true | 0 | 5 | 7 | 15 | 8 | 7 | null | null |
rcook/mlutil | mlutil/src/MLUtil/Random.hs | mit | -- |Is extract indices value valid or not
isValidExtractIndices :: ExtractIndices -> Bool
isValidExtractIndices ei = helper (eiC ei) (eiN ei) (eiIs ei)
where
helper c n is
| length is /= c = False
| otherwise = helper' n is
where
helper' n (i : is)
| i < 0 || i >= n = False
| otherwise = helper' (n - 1) is
helper' n [] = True
-- |Extract elements | 469 | isValidExtractIndices :: ExtractIndices -> Bool
isValidExtractIndices ei = helper (eiC ei) (eiN ei) (eiIs ei)
where
helper c n is
| length is /= c = False
| otherwise = helper' n is
where
helper' n (i : is)
| i < 0 || i >= n = False
| otherwise = helper' (n - 1) is
helper' n [] = True
-- |Extract elements | 427 | isValidExtractIndices ei = helper (eiC ei) (eiN ei) (eiIs ei)
where
helper c n is
| length is /= c = False
| otherwise = helper' n is
where
helper' n (i : is)
| i < 0 || i >= n = False
| otherwise = helper' (n - 1) is
helper' n [] = True
-- |Extract elements | 379 | true | true | 0 | 12 | 193 | 156 | 75 | 81 | null | null |
zeniuseducation/poly-euler | Alfa/haskell/tutorial/four.hs | epl-1.0 | next_grad m1 m2 = tan $ (pi - 2*diff) + am1
where
am1 = atan m1
diff = am1 - (atan m2) | 91 | next_grad m1 m2 = tan $ (pi - 2*diff) + am1
where
am1 = atan m1
diff = am1 - (atan m2) | 91 | next_grad m1 m2 = tan $ (pi - 2*diff) + am1
where
am1 = atan m1
diff = am1 - (atan m2) | 91 | false | false | 3 | 9 | 26 | 67 | 28 | 39 | null | null |
green-haskell/ghc | compiler/utils/Binary.hs | bsd-3-clause | newByteArray :: Int# -> IO MBA
newByteArray sz = IO $ \s ->
case newByteArray# sz s of { (# s, arr #) ->
(# s, MBA arr #) } | 127 | newByteArray :: Int# -> IO MBA
newByteArray sz = IO $ \s ->
case newByteArray# sz s of { (# s, arr #) ->
(# s, MBA arr #) } | 127 | newByteArray sz = IO $ \s ->
case newByteArray# sz s of { (# s, arr #) ->
(# s, MBA arr #) } | 96 | false | true | 0 | 11 | 33 | 60 | 31 | 29 | null | null |
peterokagey/haskellOEIS | test/Tables/A272327Spec.hs | apache-2.0 | spec :: Spec
spec = describe "A272327" $
it "correctly computes the first 20 elements" $
take 20 (map a272327 [1..]) `shouldBe` expectedValue where
expectedValue = [2,4,2,6,4,2,8,6,4,2,10,6,6,4,2,12,10,6,6,4] | 220 | spec :: Spec
spec = describe "A272327" $
it "correctly computes the first 20 elements" $
take 20 (map a272327 [1..]) `shouldBe` expectedValue where
expectedValue = [2,4,2,6,4,2,8,6,4,2,10,6,6,4,2,12,10,6,6,4] | 220 | spec = describe "A272327" $
it "correctly computes the first 20 elements" $
take 20 (map a272327 [1..]) `shouldBe` expectedValue where
expectedValue = [2,4,2,6,4,2,8,6,4,2,10,6,6,4,2,12,10,6,6,4] | 207 | false | true | 0 | 10 | 38 | 114 | 68 | 46 | null | null |
TomMD/ghc | compiler/cmm/SMRep.hs | bsd-3-clause | isStaticNoCafCon _ = False | 52 | isStaticNoCafCon _ = False | 52 | isStaticNoCafCon _ = False | 52 | false | false | 0 | 5 | 29 | 9 | 4 | 5 | null | null |
hxw/conlecterm | src/SendControl.hs | bsd-2-clause | sym '7' = (X.noModMask, X.stringToKeysym "7") | 45 | sym '7' = (X.noModMask, X.stringToKeysym "7") | 45 | sym '7' = (X.noModMask, X.stringToKeysym "7") | 45 | false | false | 0 | 7 | 5 | 23 | 11 | 12 | null | null |
wavewave/EventAnalysis | lib/HEP/Automation/EventAnalysis/Command.hs | bsd-2-clause | commandLineProcess (LowMassAnalysis hsfp) = do
startLowMassAnalysis hsfp | 76 | commandLineProcess (LowMassAnalysis hsfp) = do
startLowMassAnalysis hsfp | 76 | commandLineProcess (LowMassAnalysis hsfp) = do
startLowMassAnalysis hsfp | 76 | false | false | 0 | 7 | 10 | 22 | 9 | 13 | null | null |
CulpaBS/wbBach | src/Futhark/Optimise/Simplifier/ClosedForm.hs | bsd-3-clause | makeBindMap :: Body lore -> HM.HashMap VName (Exp lore)
makeBindMap = HM.fromList . mapMaybe isSingletonBinding . bodyBindings
where isSingletonBinding (Let pat _ e) = case patternNames pat of
[v] -> Just (v,e)
_ -> Nothing | 247 | makeBindMap :: Body lore -> HM.HashMap VName (Exp lore)
makeBindMap = HM.fromList . mapMaybe isSingletonBinding . bodyBindings
where isSingletonBinding (Let pat _ e) = case patternNames pat of
[v] -> Just (v,e)
_ -> Nothing | 247 | makeBindMap = HM.fromList . mapMaybe isSingletonBinding . bodyBindings
where isSingletonBinding (Let pat _ e) = case patternNames pat of
[v] -> Just (v,e)
_ -> Nothing | 191 | false | true | 0 | 9 | 58 | 102 | 48 | 54 | null | null |
johanneshilden/dyckword | src/Math/DyckWord/Binary.hs | bsd-3-clause | ofSize :: (Size -> Integer -> b) -> Size -> [b]
ofSize f s = f s <$> [0 .. catalan (fromIntegral s) - 1] | 104 | ofSize :: (Size -> Integer -> b) -> Size -> [b]
ofSize f s = f s <$> [0 .. catalan (fromIntegral s) - 1] | 104 | ofSize f s = f s <$> [0 .. catalan (fromIntegral s) - 1] | 56 | false | true | 2 | 10 | 24 | 71 | 34 | 37 | null | null |
olsner/ghc | compiler/deSugar/DsArrows.hs | bsd-3-clause | dsTrimCmdArg
:: IdSet -- set of local vars available to this command
-> [Id] -- list of vars in the input to this command
-> LHsCmdTop Id -- command argument to desugar
-> DsM (CoreExpr, -- desugared expression
DIdSet) -- subset of local vars that occur free
dsTrimCmdArg local_vars env_ids (L _ (HsCmdTop cmd stack_ty cmd_ty ids)) = do
(meth_binds, meth_ids) <- mkCmdEnv ids
(core_cmd, free_vars, env_ids') <- dsfixCmd meth_ids local_vars stack_ty cmd_ty cmd
stack_id <- newSysLocalDs stack_ty
trim_code <- matchEnvStack env_ids stack_id (buildEnvStack env_ids' stack_id)
let
in_ty = envStackType env_ids stack_ty
in_ty' = envStackType env_ids' stack_ty
arg_code = if env_ids' == env_ids then core_cmd else
do_premap meth_ids in_ty in_ty' cmd_ty trim_code core_cmd
return (mkLets meth_binds arg_code, free_vars)
-- Given D; xs |-a c : stk --> t, builds c with xs fed back.
-- Typically needs to be prefixed with arr (\(p, stk) -> ((xs),stk)) | 1,108 | dsTrimCmdArg
:: IdSet -- set of local vars available to this command
-> [Id] -- list of vars in the input to this command
-> LHsCmdTop Id -- command argument to desugar
-> DsM (CoreExpr, -- desugared expression
DIdSet)
dsTrimCmdArg local_vars env_ids (L _ (HsCmdTop cmd stack_ty cmd_ty ids)) = do
(meth_binds, meth_ids) <- mkCmdEnv ids
(core_cmd, free_vars, env_ids') <- dsfixCmd meth_ids local_vars stack_ty cmd_ty cmd
stack_id <- newSysLocalDs stack_ty
trim_code <- matchEnvStack env_ids stack_id (buildEnvStack env_ids' stack_id)
let
in_ty = envStackType env_ids stack_ty
in_ty' = envStackType env_ids' stack_ty
arg_code = if env_ids' == env_ids then core_cmd else
do_premap meth_ids in_ty in_ty' cmd_ty trim_code core_cmd
return (mkLets meth_binds arg_code, free_vars)
-- Given D; xs |-a c : stk --> t, builds c with xs fed back.
-- Typically needs to be prefixed with arr (\(p, stk) -> ((xs),stk)) | 1,060 | dsTrimCmdArg local_vars env_ids (L _ (HsCmdTop cmd stack_ty cmd_ty ids)) = do
(meth_binds, meth_ids) <- mkCmdEnv ids
(core_cmd, free_vars, env_ids') <- dsfixCmd meth_ids local_vars stack_ty cmd_ty cmd
stack_id <- newSysLocalDs stack_ty
trim_code <- matchEnvStack env_ids stack_id (buildEnvStack env_ids' stack_id)
let
in_ty = envStackType env_ids stack_ty
in_ty' = envStackType env_ids' stack_ty
arg_code = if env_ids' == env_ids then core_cmd else
do_premap meth_ids in_ty in_ty' cmd_ty trim_code core_cmd
return (mkLets meth_binds arg_code, free_vars)
-- Given D; xs |-a c : stk --> t, builds c with xs fed back.
-- Typically needs to be prefixed with arr (\(p, stk) -> ((xs),stk)) | 748 | true | true | 0 | 11 | 311 | 218 | 111 | 107 | null | null |
urbanslug/ghc | compiler/utils/ListSetOps.hs | bsd-3-clause | equivClasses _ stuff@[_] = [stuff] | 36 | equivClasses _ stuff@[_] = [stuff] | 36 | equivClasses _ stuff@[_] = [stuff] | 36 | false | false | 0 | 7 | 6 | 20 | 11 | 9 | null | null |
GaloisInc/halvm-ghc | libraries/template-haskell/Language/Haskell/TH/Ppr.hs | bsd-3-clause | pprExp _ (UnboundVarE v) = pprName' Applied v | 45 | pprExp _ (UnboundVarE v) = pprName' Applied v | 45 | pprExp _ (UnboundVarE v) = pprName' Applied v | 45 | false | false | 1 | 6 | 7 | 24 | 10 | 14 | null | null |
expipiplus1/vulkan | generate-new/vma/VMA/RenderParams.hs | bsd-3-clause | -- TODO: Generate this automatically
vulkanManifest
:: ((Name -> ConstrainedVar) -> Sem r Name)
-> ExtensibleStructStyle r
-> RenderParams
-> CType
-> Maybe (Sem r Type)
vulkanManifest getVar structStyle RenderParams {..} =
let vk =
Just
. pure
. ConT
. mkName
. T.unpack
. ((vulkanModulePrefix <> ".") <>)
. unName
. mkTyName
someVk t = Just $ do
let structTyCon =
ConT
. mkName
. T.unpack
. ((vulkanModulePrefix <> ".") <>)
. unName
. mkTyName
$ t
case structStyle of
Unwrapped -> (structTyCon :@) . VarT <$> getVar (Extends structTyCon)
UnwrappedHole -> pure $ structTyCon :@ WildCardT
Wrapped -> pure $ ConT (mkName "SomeStruct") :@ structTyCon
in \case
TypeName n
| n
`elem` [ "VkFlags"
, "VkAllocation"
, "VkAllocationCallbacks"
, "VkBool32"
, "VkCommandBuffer_T"
, "VkDeviceMemory"
, "VkDeviceSize"
, "VkDevice_T"
, "VkExternalMemoryHandleTypeFlagsKHR"
, "VkInstance_T"
, "VkMemoryPropertyFlags"
, "VkPhysicalDevice_T"
, "VkBuffer"
, "VkBufferCopy"
, "VkBufferMemoryRequirementsInfo2"
, "VkImage"
, "VkMappedMemoryRange"
, "VkMemoryMapFlags"
, "VkMemoryRequirements"
, "VkPhysicalDeviceMemoryProperties"
, "VkPhysicalDeviceProperties"
, "VkResult"
]
-> vk n
| n
`elem` [ "VkMemoryAllocateInfo"
, "VkBindBufferMemoryInfo"
, "VkBindImageMemoryInfo"
, "VkBufferCreateInfo"
, "VkImageCreateInfo"
, "VkMemoryRequirements2"
, "VkImageMemoryRequirementsInfo2"
, "VkPhysicalDeviceMemoryProperties2"
]
-> someVk n
_ -> Nothing | 2,329 | vulkanManifest
:: ((Name -> ConstrainedVar) -> Sem r Name)
-> ExtensibleStructStyle r
-> RenderParams
-> CType
-> Maybe (Sem r Type)
vulkanManifest getVar structStyle RenderParams {..} =
let vk =
Just
. pure
. ConT
. mkName
. T.unpack
. ((vulkanModulePrefix <> ".") <>)
. unName
. mkTyName
someVk t = Just $ do
let structTyCon =
ConT
. mkName
. T.unpack
. ((vulkanModulePrefix <> ".") <>)
. unName
. mkTyName
$ t
case structStyle of
Unwrapped -> (structTyCon :@) . VarT <$> getVar (Extends structTyCon)
UnwrappedHole -> pure $ structTyCon :@ WildCardT
Wrapped -> pure $ ConT (mkName "SomeStruct") :@ structTyCon
in \case
TypeName n
| n
`elem` [ "VkFlags"
, "VkAllocation"
, "VkAllocationCallbacks"
, "VkBool32"
, "VkCommandBuffer_T"
, "VkDeviceMemory"
, "VkDeviceSize"
, "VkDevice_T"
, "VkExternalMemoryHandleTypeFlagsKHR"
, "VkInstance_T"
, "VkMemoryPropertyFlags"
, "VkPhysicalDevice_T"
, "VkBuffer"
, "VkBufferCopy"
, "VkBufferMemoryRequirementsInfo2"
, "VkImage"
, "VkMappedMemoryRange"
, "VkMemoryMapFlags"
, "VkMemoryRequirements"
, "VkPhysicalDeviceMemoryProperties"
, "VkPhysicalDeviceProperties"
, "VkResult"
]
-> vk n
| n
`elem` [ "VkMemoryAllocateInfo"
, "VkBindBufferMemoryInfo"
, "VkBindImageMemoryInfo"
, "VkBufferCreateInfo"
, "VkImageCreateInfo"
, "VkMemoryRequirements2"
, "VkImageMemoryRequirementsInfo2"
, "VkPhysicalDeviceMemoryProperties2"
]
-> someVk n
_ -> Nothing | 2,292 | vulkanManifest getVar structStyle RenderParams {..} =
let vk =
Just
. pure
. ConT
. mkName
. T.unpack
. ((vulkanModulePrefix <> ".") <>)
. unName
. mkTyName
someVk t = Just $ do
let structTyCon =
ConT
. mkName
. T.unpack
. ((vulkanModulePrefix <> ".") <>)
. unName
. mkTyName
$ t
case structStyle of
Unwrapped -> (structTyCon :@) . VarT <$> getVar (Extends structTyCon)
UnwrappedHole -> pure $ structTyCon :@ WildCardT
Wrapped -> pure $ ConT (mkName "SomeStruct") :@ structTyCon
in \case
TypeName n
| n
`elem` [ "VkFlags"
, "VkAllocation"
, "VkAllocationCallbacks"
, "VkBool32"
, "VkCommandBuffer_T"
, "VkDeviceMemory"
, "VkDeviceSize"
, "VkDevice_T"
, "VkExternalMemoryHandleTypeFlagsKHR"
, "VkInstance_T"
, "VkMemoryPropertyFlags"
, "VkPhysicalDevice_T"
, "VkBuffer"
, "VkBufferCopy"
, "VkBufferMemoryRequirementsInfo2"
, "VkImage"
, "VkMappedMemoryRange"
, "VkMemoryMapFlags"
, "VkMemoryRequirements"
, "VkPhysicalDeviceMemoryProperties"
, "VkPhysicalDeviceProperties"
, "VkResult"
]
-> vk n
| n
`elem` [ "VkMemoryAllocateInfo"
, "VkBindBufferMemoryInfo"
, "VkBindImageMemoryInfo"
, "VkBufferCreateInfo"
, "VkImageCreateInfo"
, "VkMemoryRequirements2"
, "VkImageMemoryRequirementsInfo2"
, "VkPhysicalDeviceMemoryProperties2"
]
-> someVk n
_ -> Nothing | 2,149 | true | true | 21 | 13 | 1,092 | 379 | 212 | 167 | null | null |
nevrenato/Hets_Fork | CASL/Overload.hs | gpl-2.0 | qualifyPreds :: Id -> Range -> [[(PredType, [TERM f])]] -> [[FORMULA f]]
qualifyPreds ide = map . map . qualifyPred ide | 119 | qualifyPreds :: Id -> Range -> [[(PredType, [TERM f])]] -> [[FORMULA f]]
qualifyPreds ide = map . map . qualifyPred ide | 119 | qualifyPreds ide = map . map . qualifyPred ide | 46 | false | true | 1 | 13 | 20 | 70 | 35 | 35 | null | null |
mainland/nikola | src/Data/Vector/UnboxedForeign.hs | bsd-3-clause | minIndex = G.minIndex | 21 | minIndex = G.minIndex | 21 | minIndex = G.minIndex | 21 | false | false | 0 | 5 | 2 | 8 | 4 | 4 | null | null |
chrisbanks/cpiwb | CPi/Parser.hs | gpl-3.0 | pFGtee = do s <- fidentifier
fOp "|>"
return $ LBC.Gtee s | 82 | pFGtee = do s <- fidentifier
fOp "|>"
return $ LBC.Gtee s | 82 | pFGtee = do s <- fidentifier
fOp "|>"
return $ LBC.Gtee s | 82 | false | false | 1 | 10 | 36 | 35 | 13 | 22 | null | null |
supki/libjenkins | src/Jenkins/Rest/Method.hs | bsd-2-clause | -- | Nodes data
--
-- >>> format python computer
-- "computer/api/python"
computer :: Method 'Complete f
computer = "computer" | 126 | computer :: Method 'Complete f
computer = "computer" | 52 | computer = "computer" | 21 | true | true | 0 | 7 | 19 | 28 | 14 | 14 | null | null |
bamboo/idris-cil | src/IRTS/CodegenCil.hs | bsd-3-clause | nothingType :: TypeDef
nothingType = privateSealedClass className noExtends noImplements
[nothing] [defaultCtorDef, cctor] []
where className = "Nothing"
nothing = Field [FaStatic, FaPublic, FaInitOnly] Cil.Object nothingFieldName
cctor = Constructor [MaStatic] Void []
[ newobj "" className []
, stsfld Cil.Object "" className nothingFieldName
, ret ] | 462 | nothingType :: TypeDef
nothingType = privateSealedClass className noExtends noImplements
[nothing] [defaultCtorDef, cctor] []
where className = "Nothing"
nothing = Field [FaStatic, FaPublic, FaInitOnly] Cil.Object nothingFieldName
cctor = Constructor [MaStatic] Void []
[ newobj "" className []
, stsfld Cil.Object "" className nothingFieldName
, ret ] | 462 | nothingType = privateSealedClass className noExtends noImplements
[nothing] [defaultCtorDef, cctor] []
where className = "Nothing"
nothing = Field [FaStatic, FaPublic, FaInitOnly] Cil.Object nothingFieldName
cctor = Constructor [MaStatic] Void []
[ newobj "" className []
, stsfld Cil.Object "" className nothingFieldName
, ret ] | 439 | false | true | 2 | 8 | 154 | 115 | 61 | 54 | null | null |
juanpaucar/hadron | src/Hadron/Run.hs | bsd-3-clause | hdfsPut :: RunContext -> L.LocalFile -> FilePath -> IO ()
hdfsPut rc f1 f2 = case rc of
LocalRun lrs -> L.runLocal lrs (L.hdfsPut f1 (LocalFile f2))
HadoopRun e _ -> withLocalFile rc f1 $ \ lf -> H.hdfsPut e lf f2
------------------------------------------------------------------------------- | 303 | hdfsPut :: RunContext -> L.LocalFile -> FilePath -> IO ()
hdfsPut rc f1 f2 = case rc of
LocalRun lrs -> L.runLocal lrs (L.hdfsPut f1 (LocalFile f2))
HadoopRun e _ -> withLocalFile rc f1 $ \ lf -> H.hdfsPut e lf f2
------------------------------------------------------------------------------- | 303 | hdfsPut rc f1 f2 = case rc of
LocalRun lrs -> L.runLocal lrs (L.hdfsPut f1 (LocalFile f2))
HadoopRun e _ -> withLocalFile rc f1 $ \ lf -> H.hdfsPut e lf f2
------------------------------------------------------------------------------- | 245 | false | true | 4 | 11 | 52 | 105 | 51 | 54 | null | null |
keithodulaigh/Hets | utils/itcor/GenItCorrections.hs | gpl-2.0 | post_proc :: String -> String
post_proc str = '\"' : '[' : concatMap conv str ++ "]\""
where conv c = case c of
'\"' -> "\\\""
-- substitute umlauts with \196\214\220\223\228\246\252
'\196' -> "\\196"
'\214' -> "\\214"
'\220' -> "\\220"
'\223' -> "\\223"
'\228' -> "\\228"
'\246' -> "\\246"
'\252' -> "\\252"
_ -> [c]
-- -------- Parser for Table generated with "width-it-table.tex" --------- | 587 | post_proc :: String -> String
post_proc str = '\"' : '[' : concatMap conv str ++ "]\""
where conv c = case c of
'\"' -> "\\\""
-- substitute umlauts with \196\214\220\223\228\246\252
'\196' -> "\\196"
'\214' -> "\\214"
'\220' -> "\\220"
'\223' -> "\\223"
'\228' -> "\\228"
'\246' -> "\\246"
'\252' -> "\\252"
_ -> [c]
-- -------- Parser for Table generated with "width-it-table.tex" --------- | 587 | post_proc str = '\"' : '[' : concatMap conv str ++ "]\""
where conv c = case c of
'\"' -> "\\\""
-- substitute umlauts with \196\214\220\223\228\246\252
'\196' -> "\\196"
'\214' -> "\\214"
'\220' -> "\\220"
'\223' -> "\\223"
'\228' -> "\\228"
'\246' -> "\\246"
'\252' -> "\\252"
_ -> [c]
-- -------- Parser for Table generated with "width-it-table.tex" --------- | 557 | false | true | 0 | 10 | 259 | 108 | 55 | 53 | null | null |
AlexeyRaga/eta | compiler/ETA/Prelude/PrimOp.hs | bsd-3-clause | primOpInfo MaskUninterruptibleOp = mkGenPrimOp (fsLit "maskUninterruptible#") [alphaTyVar] [(mkFunTy (mkStatePrimTy realWorldTy) ((mkTupleTy UnboxedTuple [mkStatePrimTy realWorldTy, alphaTy]))), mkStatePrimTy realWorldTy] ((mkTupleTy UnboxedTuple [mkStatePrimTy realWorldTy, alphaTy])) | 286 | primOpInfo MaskUninterruptibleOp = mkGenPrimOp (fsLit "maskUninterruptible#") [alphaTyVar] [(mkFunTy (mkStatePrimTy realWorldTy) ((mkTupleTy UnboxedTuple [mkStatePrimTy realWorldTy, alphaTy]))), mkStatePrimTy realWorldTy] ((mkTupleTy UnboxedTuple [mkStatePrimTy realWorldTy, alphaTy])) | 286 | primOpInfo MaskUninterruptibleOp = mkGenPrimOp (fsLit "maskUninterruptible#") [alphaTyVar] [(mkFunTy (mkStatePrimTy realWorldTy) ((mkTupleTy UnboxedTuple [mkStatePrimTy realWorldTy, alphaTy]))), mkStatePrimTy realWorldTy] ((mkTupleTy UnboxedTuple [mkStatePrimTy realWorldTy, alphaTy])) | 286 | false | false | 0 | 13 | 22 | 91 | 47 | 44 | null | null |
ghc-android/ghc | testsuite/tests/ghci/should_run/ghcirun004.hs | bsd-3-clause | 3572 = 3571 | 11 | 3572 = 3571 | 11 | 3572 = 3571 | 11 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
karun012/transmat | test/Transmat/TransmatSpec.hs | unlicense | main :: IO ()
main = hspec spec | 31 | main :: IO ()
main = hspec spec | 31 | main = hspec spec | 17 | false | true | 0 | 6 | 7 | 19 | 9 | 10 | null | null |
glguy/config-value | src/Config/Value.hs | mit | -- | Returns the annotation for a value.
valueAnn :: Value a -> a
valueAnn v =
case v of
Sections a _ -> a
Number a _ -> a
Text a _ -> a
Atom a _ -> a
List a _ -> a | 200 | valueAnn :: Value a -> a
valueAnn v =
case v of
Sections a _ -> a
Number a _ -> a
Text a _ -> a
Atom a _ -> a
List a _ -> a | 159 | valueAnn v =
case v of
Sections a _ -> a
Number a _ -> a
Text a _ -> a
Atom a _ -> a
List a _ -> a | 134 | true | true | 0 | 8 | 80 | 87 | 39 | 48 | null | null |
Cosocket-LLC/kahn | v2.0/src/KAHN/MIMI.hs | bsd-3-clause | mimi :: Config -> ZMQ z ()
mimi cfg = do
mimsub <- socket Sub
bind mimsub (cfgMIMSUB cfg)
mimpub <- socket Pub
bind mimpub (cfgMIMPUB cfg)
subscribe mimsub "ITAG"
m2bout <- socket Pub
connect m2bout (cfgBBIN cfg)
m2bin <- socket Sub
connect m2bin (cfgBBOUT cfg)
subscribe m2bin "OTAG"
async $ proxy mimpub m2bin Nothing
forever $ do
addr <- receive mimsub
more <- moreToReceive mimsub
when more $ do
cont <- receive mimsub
send m2bout [SendMore] "ITAG"
send m2bout [] $ B.pack (show (ITAG (B.unpack cont))) | 610 | mimi :: Config -> ZMQ z ()
mimi cfg = do
mimsub <- socket Sub
bind mimsub (cfgMIMSUB cfg)
mimpub <- socket Pub
bind mimpub (cfgMIMPUB cfg)
subscribe mimsub "ITAG"
m2bout <- socket Pub
connect m2bout (cfgBBIN cfg)
m2bin <- socket Sub
connect m2bin (cfgBBOUT cfg)
subscribe m2bin "OTAG"
async $ proxy mimpub m2bin Nothing
forever $ do
addr <- receive mimsub
more <- moreToReceive mimsub
when more $ do
cont <- receive mimsub
send m2bout [SendMore] "ITAG"
send m2bout [] $ B.pack (show (ITAG (B.unpack cont))) | 610 | mimi cfg = do
mimsub <- socket Sub
bind mimsub (cfgMIMSUB cfg)
mimpub <- socket Pub
bind mimpub (cfgMIMPUB cfg)
subscribe mimsub "ITAG"
m2bout <- socket Pub
connect m2bout (cfgBBIN cfg)
m2bin <- socket Sub
connect m2bin (cfgBBOUT cfg)
subscribe m2bin "OTAG"
async $ proxy mimpub m2bin Nothing
forever $ do
addr <- receive mimsub
more <- moreToReceive mimsub
when more $ do
cont <- receive mimsub
send m2bout [SendMore] "ITAG"
send m2bout [] $ B.pack (show (ITAG (B.unpack cont))) | 583 | false | true | 0 | 21 | 190 | 250 | 107 | 143 | null | null |
flbulgarelli/hs-inspector | src/Language/Haskell/Explorer.hs | mit | concatRhs rhs l = [rhs] ++ concatMap rhsForBinding l | 52 | concatRhs rhs l = [rhs] ++ concatMap rhsForBinding l | 52 | concatRhs rhs l = [rhs] ++ concatMap rhsForBinding l | 52 | false | false | 0 | 6 | 8 | 23 | 11 | 12 | null | null |
FranklinChen/hugs98-plus-Sep2006 | packages/GLUT/examples/RedBook/Model.hs | bsd-3-clause | keyboard _ _ _ _ = return () | 42 | keyboard _ _ _ _ = return () | 42 | keyboard _ _ _ _ = return () | 42 | false | false | 1 | 6 | 21 | 18 | 8 | 10 | null | null |
shlomobauer/BuildIT | src/OutBuild.hs | apache-2.0 | anyIfsLBl (LBlockList a b) = if anyIfsLB b == True then True else anyIfsLBl a | 77 | anyIfsLBl (LBlockList a b) = if anyIfsLB b == True then True else anyIfsLBl a | 77 | anyIfsLBl (LBlockList a b) = if anyIfsLB b == True then True else anyIfsLBl a | 77 | false | false | 0 | 7 | 14 | 35 | 17 | 18 | null | null |
rueshyna/gogol | gogol-slides/gen/Network/Google/Slides/Types/Product.hs | mpl-2.0 | -- | The range of text to apply the bullet presets to, based on TextElement
-- indexes.
cpbrTextRange :: Lens' CreateParagraphBulletsRequest (Maybe Range)
cpbrTextRange
= lens _cpbrTextRange
(\ s a -> s{_cpbrTextRange = a}) | 231 | cpbrTextRange :: Lens' CreateParagraphBulletsRequest (Maybe Range)
cpbrTextRange
= lens _cpbrTextRange
(\ s a -> s{_cpbrTextRange = a}) | 143 | cpbrTextRange
= lens _cpbrTextRange
(\ s a -> s{_cpbrTextRange = a}) | 76 | true | true | 0 | 9 | 41 | 49 | 26 | 23 | null | null |
spechub/Hets | ExtModal/Parse_AS.hs | gpl-2.0 | emDotFormulae :: [Annotation] -> [VAR_DECL] -> Range -> AParser st FrameForm
emDotFormulae a v p = fmap (axiomsToFrames a v p)
$ dotFormulae False ext_modal_reserved_words | 173 | emDotFormulae :: [Annotation] -> [VAR_DECL] -> Range -> AParser st FrameForm
emDotFormulae a v p = fmap (axiomsToFrames a v p)
$ dotFormulae False ext_modal_reserved_words | 173 | emDotFormulae a v p = fmap (axiomsToFrames a v p)
$ dotFormulae False ext_modal_reserved_words | 96 | false | true | 2 | 8 | 26 | 64 | 31 | 33 | null | null |
themattchan/tandoori | library/Tandoori/Typing/MonoEnv.hs | bsd-3-clause | getMonoVar :: MonoEnv -> VarName -> Maybe Ty
getMonoVar m name = Map.lookup name (monovars m) | 93 | getMonoVar :: MonoEnv -> VarName -> Maybe Ty
getMonoVar m name = Map.lookup name (monovars m) | 93 | getMonoVar m name = Map.lookup name (monovars m) | 48 | false | true | 0 | 7 | 15 | 40 | 19 | 21 | null | null |
corajr/shmonad | src/Control/Monad/Shmonad/Expression.hs | bsd-2-clause | orElse :: Expr (Cmd a i o) -> Expr (Cmd b i1 o1) -> Expr (Cmd c i2 o2)
orElse = Or | 82 | orElse :: Expr (Cmd a i o) -> Expr (Cmd b i1 o1) -> Expr (Cmd c i2 o2)
orElse = Or | 82 | orElse = Or | 11 | false | true | 0 | 10 | 21 | 64 | 29 | 35 | null | null |
sopvop/cabal | cabal-install/Distribution/Client/IndexUtils.hs | bsd-3-clause | packageDesc :: PackageEntry -> GenericPackageDescription
packageDesc (NormalPackage _ descr _ _) = descr | 105 | packageDesc :: PackageEntry -> GenericPackageDescription
packageDesc (NormalPackage _ descr _ _) = descr | 105 | packageDesc (NormalPackage _ descr _ _) = descr | 48 | false | true | 0 | 7 | 13 | 30 | 15 | 15 | null | null |
ezyang/ghc | compiler/nativeGen/PPC/Ppr.hs | bsd-3-clause | pprImm (ImmCLbl l) = ppr l | 29 | pprImm (ImmCLbl l) = ppr l | 29 | pprImm (ImmCLbl l) = ppr l | 29 | false | false | 0 | 7 | 8 | 18 | 8 | 10 | null | null |
ancientlanguage/haskell-analysis | prepare/src/Prepare/Decompose.hs | mit | decomposeChar '\x2F9D2' = "\x8C55" | 34 | decomposeChar '\x2F9D2' = "\x8C55" | 34 | decomposeChar '\x2F9D2' = "\x8C55" | 34 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
erantapaa/haskell-pentago | src/PentagoBits.hs | mit | maskbits v m b = (v .&. (complement m) .|. b) | 45 | maskbits v m b = (v .&. (complement m) .|. b) | 45 | maskbits v m b = (v .&. (complement m) .|. b) | 45 | false | false | 0 | 9 | 10 | 30 | 15 | 15 | null | null |
FPBrno/dht-dks | src/Data/DHT/DKS/Type/Storage.hs | bsd-3-clause | insert :: DksHash -> Encoding -> DksStorage -> IO ()
insert k v (DksStorage ref) = atomicModifyIORef' ref $ (, ()) <$> insert' k v | 130 | insert :: DksHash -> Encoding -> DksStorage -> IO ()
insert k v (DksStorage ref) = atomicModifyIORef' ref $ (, ()) <$> insert' k v | 130 | insert k v (DksStorage ref) = atomicModifyIORef' ref $ (, ()) <$> insert' k v | 77 | false | true | 0 | 11 | 24 | 67 | 32 | 35 | null | null |
frublox/aichanbot | app/Main.hs | bsd-3-clause | port :: Int
port = 6667 | 23 | port :: Int
port = 6667 | 23 | port = 6667 | 11 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
nushio3/ghc | compiler/basicTypes/RdrName.hs | bsd-3-clause | delLocalRdrEnvList :: LocalRdrEnv -> [OccName] -> LocalRdrEnv
delLocalRdrEnvList lre@(LRE { lre_env = env }) occs
= lre { lre_env = delListFromOccEnv env occs } | 162 | delLocalRdrEnvList :: LocalRdrEnv -> [OccName] -> LocalRdrEnv
delLocalRdrEnvList lre@(LRE { lre_env = env }) occs
= lre { lre_env = delListFromOccEnv env occs } | 162 | delLocalRdrEnvList lre@(LRE { lre_env = env }) occs
= lre { lre_env = delListFromOccEnv env occs } | 100 | false | true | 0 | 10 | 25 | 59 | 31 | 28 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/basicTypes/DataCon.hs | bsd-3-clause | -- | The existentially-quantified type variables of the constructor
dataConExTyVars :: DataCon -> [TyVar]
dataConExTyVars = dcExTyVars | 134 | dataConExTyVars :: DataCon -> [TyVar]
dataConExTyVars = dcExTyVars | 66 | dataConExTyVars = dcExTyVars | 28 | true | true | 0 | 8 | 16 | 26 | 12 | 14 | null | null |
Erdwolf/autotool-bonn | src/Petri/Deadlock.hs | gpl-2.0 | example :: Config
example = Config
{ num_places = 4
, num_transitions = 4
, Petri.Deadlock.capacity = Unbounded
-- All_Bounded 1
, max_transition_length = 10
} | 210 | example :: Config
example = Config
{ num_places = 4
, num_transitions = 4
, Petri.Deadlock.capacity = Unbounded
-- All_Bounded 1
, max_transition_length = 10
} | 210 | example = Config
{ num_places = 4
, num_transitions = 4
, Petri.Deadlock.capacity = Unbounded
-- All_Bounded 1
, max_transition_length = 10
} | 192 | false | true | 0 | 6 | 76 | 41 | 26 | 15 | null | null |
leventdinckal/haskell-nvd3 | src/Graphics/NVD3/Types.hs | bsd-3-clause | mkNumVals :: V.Vector Float -> V.Vector Float -> V.Vector Point
mkNumVals v1 v2 = V.map (uncurry PNum) (V.zip v1 v2) | 116 | mkNumVals :: V.Vector Float -> V.Vector Float -> V.Vector Point
mkNumVals v1 v2 = V.map (uncurry PNum) (V.zip v1 v2) | 116 | mkNumVals v1 v2 = V.map (uncurry PNum) (V.zip v1 v2) | 52 | false | true | 0 | 9 | 19 | 67 | 30 | 37 | null | null |
cmika/mnuh | src/CMUDict.hs | bsd-3-clause | dictFile :: Parser [(ByteString, [Phone_Str])]
dictFile = rights <$> AP.manyTill (AP.eitherP comment entry) AP.endOfInput | 121 | dictFile :: Parser [(ByteString, [Phone_Str])]
dictFile = rights <$> AP.manyTill (AP.eitherP comment entry) AP.endOfInput | 121 | dictFile = rights <$> AP.manyTill (AP.eitherP comment entry) AP.endOfInput | 74 | false | true | 4 | 8 | 13 | 57 | 26 | 31 | null | null |
armoredsoftware/protocol | tpm/mainline/protoMonad/ProtoActions.hs | bsd-3-clause | --TODO: In Proto monad?
genSign :: Binary a => PrivateKey -> [a] -> (SignedData [a])
genSign priKey inData =
let bytes = packImpl inData
signature = realSign priKey bytes in
SignedData inData signature | 212 | genSign :: Binary a => PrivateKey -> [a] -> (SignedData [a])
genSign priKey inData =
let bytes = packImpl inData
signature = realSign priKey bytes in
SignedData inData signature | 187 | genSign priKey inData =
let bytes = packImpl inData
signature = realSign priKey bytes in
SignedData inData signature | 126 | true | true | 0 | 12 | 43 | 80 | 37 | 43 | null | null |
k0001/gtk2hs | tools/apiGen/src/MarshalFixup.hs | gpl-3.0 | knownMiscType "GtkIconSet" = True | 34 | knownMiscType "GtkIconSet" = True | 34 | knownMiscType "GtkIconSet" = True | 34 | false | false | 0 | 4 | 4 | 10 | 4 | 6 | null | null |
ghcjs/ghcjs | src/Gen2/Object.hs | mit | putListOf :: (a -> PutS) -> [a] -> PutS
putListOf p xs = do
lift (DB.putWord32le (fromIntegral $ length xs))
mapM_ p xs | 123 | putListOf :: (a -> PutS) -> [a] -> PutS
putListOf p xs = do
lift (DB.putWord32le (fromIntegral $ length xs))
mapM_ p xs | 123 | putListOf p xs = do
lift (DB.putWord32le (fromIntegral $ length xs))
mapM_ p xs | 83 | false | true | 0 | 12 | 26 | 66 | 32 | 34 | null | null |
josiah14/lambdaline | LambdaLine/XTerm/Colors.hs | gpl-3.0 | blue :: Color
blue = "19" | 25 | blue :: Color
blue = "19" | 25 | blue = "19" | 11 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
randen/cabal | Cabal/Distribution/Simple/Utils.hs | bsd-3-clause | -- | This is like 'copyFiles' but uses 'installMaybeExecutableFile'.
--
installMaybeExecutableFiles :: Verbosity -> FilePath -> [(FilePath, FilePath)]
-> IO ()
installMaybeExecutableFiles = copyFilesWith installMaybeExecutableFile | 261 | installMaybeExecutableFiles :: Verbosity -> FilePath -> [(FilePath, FilePath)]
-> IO ()
installMaybeExecutableFiles = copyFilesWith installMaybeExecutableFile | 189 | installMaybeExecutableFiles = copyFilesWith installMaybeExecutableFile | 70 | true | true | 0 | 9 | 55 | 42 | 23 | 19 | null | null |
fmapfmapfmap/amazonka | amazonka-kms/gen/Network/AWS/KMS/CreateAlias.hs | mpl-2.0 | -- | Creates a value of 'CreateAliasResponse' with the minimum fields required to make a request.
--
createAliasResponse
:: CreateAliasResponse
createAliasResponse = CreateAliasResponse' | 190 | createAliasResponse
:: CreateAliasResponse
createAliasResponse = CreateAliasResponse' | 89 | createAliasResponse = CreateAliasResponse' | 42 | true | true | 0 | 4 | 26 | 13 | 8 | 5 | null | null |
mikebenfield/ftensor | src/Math/Ftensor/General.hs | isc | trace
:: forall a e (dim::Nat)
. (Additive e, KnownType dim Int, A.Array a e)
=> Tensor a '[dim, dim] e
-> e
trace (Tensor arr) = runST $ sumAt 0 dim1 len (return . A.index arr)
where
len = A.length arr
dim1 = 1 + summon (Proxy::Proxy dim)
| 267 | trace
:: forall a e (dim::Nat)
. (Additive e, KnownType dim Int, A.Array a e)
=> Tensor a '[dim, dim] e
-> e
trace (Tensor arr) = runST $ sumAt 0 dim1 len (return . A.index arr)
where
len = A.length arr
dim1 = 1 + summon (Proxy::Proxy dim)
| 267 | trace (Tensor arr) = runST $ sumAt 0 dim1 len (return . A.index arr)
where
len = A.length arr
dim1 = 1 + summon (Proxy::Proxy dim)
| 142 | false | true | 6 | 11 | 76 | 151 | 73 | 78 | null | null |
mrakgr/futhark | src/Futhark/Representation/SOACS/SOAC.hs | bsd-3-clause | typeCheckSOAC (Stream ass size form lam arrexps) = do
let accexps = getStreamAccums form
mapM_ (TC.requireI [Prim Cert]) ass
TC.require [Prim int32] size
accargs <- mapM TC.checkArg accexps
arrargs <- mapM lookupType arrexps
_ <- TC.checkSOACArrayArgs size arrexps
let chunk = head $ extLambdaParams lam
let asArg t = (t, mempty)
inttp = Prim int32
lamarrs'= map (`setOuterSize` Var (paramName chunk)) arrargs
TC.checkExtLambda lam $ asArg inttp : accargs ++ map asArg lamarrs'
let acc_len= length accexps
let lamrtp = take acc_len $ extLambdaReturnType lam
unless (staticShapes (map TC.argType accargs) == lamrtp) $
TC.bad $ TC.TypeError "Stream with inconsistent accumulator type in lambda."
-- check reduce's lambda, if any
_ <- case form of
RedLike _ _ lam0 _ -> do
let acct = map TC.argType accargs
outerRetType = lambdaReturnType lam0
TC.checkLambda lam0 $ map TC.noArgAliases $ accargs ++ accargs
unless (acct == outerRetType) $
TC.bad $ TC.TypeError $
"Initial value is of type " ++ prettyTuple acct ++
", but stream's reduce lambda returns type " ++ prettyTuple outerRetType ++ "."
_ -> return ()
-- just get the dflow of lambda on the fakearg, which does not alias
-- arr, so we can later check that aliases of arr are not used inside lam.
-- let fakearg = (fromDecl $ addNames $ removeNames $ typeOf arr', mempty, srclocOf pos)
let fake_lamarrs' = map asArg lamarrs'
(_,occurs) <- TC.collectOccurences $
TC.checkExtLambda lam $ asArg inttp : accargs ++ fake_lamarrs'
let usages = TC.usageMap occurs
arr_aliases <- mapM TC.lookupAliases arrexps
let aliased_syms = HS.toList $ HS.fromList $ concatMap HS.toList arr_aliases
when (any (`HM.member` usages) aliased_syms) $
TC.bad $ TC.TypeError "Stream with input array used inside lambda."
-- check outerdim of Lambda's streamed-in array params are NOT specified,
-- and that return type inner dimens are all specified but not as other
-- lambda parameters!
let lamarr_rtp = drop acc_len $ extLambdaReturnType lam
lamarr_ptp = map paramType $ drop (acc_len+1) $ extLambdaParams lam
names_lamparams = HS.fromList $ map paramName $ extLambdaParams lam
_ <- mapM (checkOuterDim (paramName chunk) . head . shapeDims . arrayShape) lamarr_ptp
_ <- mapM (checkInnerDim names_lamparams . tail . extShapeDims . arrayShape) lamarr_rtp
return ()
where checkOuterDim chunknm outdim = do
let chunk_str = textual chunknm
case outdim of
Constant _ ->
TC.bad $ TC.TypeError
("Stream: outer dimension of stream should NOT"++
" be specified since it is "++chunk_str++"by default.")
Var idd ->
unless (idd == chunknm) $
TC.bad $ TC.TypeError
("Stream: outer dimension of stream should NOT"++
" be specified since it is "++chunk_str++"by default.")
boundDim (Free (Var idd)) = return $ Just idd
boundDim (Free _ ) = return Nothing
boundDim (Ext _ ) =
TC.bad $ TC.TypeError $
"Stream's lambda: inner dimensions of the"++
" streamed-out arrays MUST be specified!"
checkInnerDim lamparnms innerdims = do
rtp_iner_syms <- catMaybes <$> mapM boundDim innerdims
case find (`HS.member` lamparnms) rtp_iner_syms of
Just name -> TC.bad $ TC.TypeError $
"Stream's lambda: " ++ pretty name ++
" cannot specify an inner result shape"
_ -> return True | 3,839 | typeCheckSOAC (Stream ass size form lam arrexps) = do
let accexps = getStreamAccums form
mapM_ (TC.requireI [Prim Cert]) ass
TC.require [Prim int32] size
accargs <- mapM TC.checkArg accexps
arrargs <- mapM lookupType arrexps
_ <- TC.checkSOACArrayArgs size arrexps
let chunk = head $ extLambdaParams lam
let asArg t = (t, mempty)
inttp = Prim int32
lamarrs'= map (`setOuterSize` Var (paramName chunk)) arrargs
TC.checkExtLambda lam $ asArg inttp : accargs ++ map asArg lamarrs'
let acc_len= length accexps
let lamrtp = take acc_len $ extLambdaReturnType lam
unless (staticShapes (map TC.argType accargs) == lamrtp) $
TC.bad $ TC.TypeError "Stream with inconsistent accumulator type in lambda."
-- check reduce's lambda, if any
_ <- case form of
RedLike _ _ lam0 _ -> do
let acct = map TC.argType accargs
outerRetType = lambdaReturnType lam0
TC.checkLambda lam0 $ map TC.noArgAliases $ accargs ++ accargs
unless (acct == outerRetType) $
TC.bad $ TC.TypeError $
"Initial value is of type " ++ prettyTuple acct ++
", but stream's reduce lambda returns type " ++ prettyTuple outerRetType ++ "."
_ -> return ()
-- just get the dflow of lambda on the fakearg, which does not alias
-- arr, so we can later check that aliases of arr are not used inside lam.
-- let fakearg = (fromDecl $ addNames $ removeNames $ typeOf arr', mempty, srclocOf pos)
let fake_lamarrs' = map asArg lamarrs'
(_,occurs) <- TC.collectOccurences $
TC.checkExtLambda lam $ asArg inttp : accargs ++ fake_lamarrs'
let usages = TC.usageMap occurs
arr_aliases <- mapM TC.lookupAliases arrexps
let aliased_syms = HS.toList $ HS.fromList $ concatMap HS.toList arr_aliases
when (any (`HM.member` usages) aliased_syms) $
TC.bad $ TC.TypeError "Stream with input array used inside lambda."
-- check outerdim of Lambda's streamed-in array params are NOT specified,
-- and that return type inner dimens are all specified but not as other
-- lambda parameters!
let lamarr_rtp = drop acc_len $ extLambdaReturnType lam
lamarr_ptp = map paramType $ drop (acc_len+1) $ extLambdaParams lam
names_lamparams = HS.fromList $ map paramName $ extLambdaParams lam
_ <- mapM (checkOuterDim (paramName chunk) . head . shapeDims . arrayShape) lamarr_ptp
_ <- mapM (checkInnerDim names_lamparams . tail . extShapeDims . arrayShape) lamarr_rtp
return ()
where checkOuterDim chunknm outdim = do
let chunk_str = textual chunknm
case outdim of
Constant _ ->
TC.bad $ TC.TypeError
("Stream: outer dimension of stream should NOT"++
" be specified since it is "++chunk_str++"by default.")
Var idd ->
unless (idd == chunknm) $
TC.bad $ TC.TypeError
("Stream: outer dimension of stream should NOT"++
" be specified since it is "++chunk_str++"by default.")
boundDim (Free (Var idd)) = return $ Just idd
boundDim (Free _ ) = return Nothing
boundDim (Ext _ ) =
TC.bad $ TC.TypeError $
"Stream's lambda: inner dimensions of the"++
" streamed-out arrays MUST be specified!"
checkInnerDim lamparnms innerdims = do
rtp_iner_syms <- catMaybes <$> mapM boundDim innerdims
case find (`HS.member` lamparnms) rtp_iner_syms of
Just name -> TC.bad $ TC.TypeError $
"Stream's lambda: " ++ pretty name ++
" cannot specify an inner result shape"
_ -> return True | 3,839 | typeCheckSOAC (Stream ass size form lam arrexps) = do
let accexps = getStreamAccums form
mapM_ (TC.requireI [Prim Cert]) ass
TC.require [Prim int32] size
accargs <- mapM TC.checkArg accexps
arrargs <- mapM lookupType arrexps
_ <- TC.checkSOACArrayArgs size arrexps
let chunk = head $ extLambdaParams lam
let asArg t = (t, mempty)
inttp = Prim int32
lamarrs'= map (`setOuterSize` Var (paramName chunk)) arrargs
TC.checkExtLambda lam $ asArg inttp : accargs ++ map asArg lamarrs'
let acc_len= length accexps
let lamrtp = take acc_len $ extLambdaReturnType lam
unless (staticShapes (map TC.argType accargs) == lamrtp) $
TC.bad $ TC.TypeError "Stream with inconsistent accumulator type in lambda."
-- check reduce's lambda, if any
_ <- case form of
RedLike _ _ lam0 _ -> do
let acct = map TC.argType accargs
outerRetType = lambdaReturnType lam0
TC.checkLambda lam0 $ map TC.noArgAliases $ accargs ++ accargs
unless (acct == outerRetType) $
TC.bad $ TC.TypeError $
"Initial value is of type " ++ prettyTuple acct ++
", but stream's reduce lambda returns type " ++ prettyTuple outerRetType ++ "."
_ -> return ()
-- just get the dflow of lambda on the fakearg, which does not alias
-- arr, so we can later check that aliases of arr are not used inside lam.
-- let fakearg = (fromDecl $ addNames $ removeNames $ typeOf arr', mempty, srclocOf pos)
let fake_lamarrs' = map asArg lamarrs'
(_,occurs) <- TC.collectOccurences $
TC.checkExtLambda lam $ asArg inttp : accargs ++ fake_lamarrs'
let usages = TC.usageMap occurs
arr_aliases <- mapM TC.lookupAliases arrexps
let aliased_syms = HS.toList $ HS.fromList $ concatMap HS.toList arr_aliases
when (any (`HM.member` usages) aliased_syms) $
TC.bad $ TC.TypeError "Stream with input array used inside lambda."
-- check outerdim of Lambda's streamed-in array params are NOT specified,
-- and that return type inner dimens are all specified but not as other
-- lambda parameters!
let lamarr_rtp = drop acc_len $ extLambdaReturnType lam
lamarr_ptp = map paramType $ drop (acc_len+1) $ extLambdaParams lam
names_lamparams = HS.fromList $ map paramName $ extLambdaParams lam
_ <- mapM (checkOuterDim (paramName chunk) . head . shapeDims . arrayShape) lamarr_ptp
_ <- mapM (checkInnerDim names_lamparams . tail . extShapeDims . arrayShape) lamarr_rtp
return ()
where checkOuterDim chunknm outdim = do
let chunk_str = textual chunknm
case outdim of
Constant _ ->
TC.bad $ TC.TypeError
("Stream: outer dimension of stream should NOT"++
" be specified since it is "++chunk_str++"by default.")
Var idd ->
unless (idd == chunknm) $
TC.bad $ TC.TypeError
("Stream: outer dimension of stream should NOT"++
" be specified since it is "++chunk_str++"by default.")
boundDim (Free (Var idd)) = return $ Just idd
boundDim (Free _ ) = return Nothing
boundDim (Ext _ ) =
TC.bad $ TC.TypeError $
"Stream's lambda: inner dimensions of the"++
" streamed-out arrays MUST be specified!"
checkInnerDim lamparnms innerdims = do
rtp_iner_syms <- catMaybes <$> mapM boundDim innerdims
case find (`HS.member` lamparnms) rtp_iner_syms of
Just name -> TC.bad $ TC.TypeError $
"Stream's lambda: " ++ pretty name ++
" cannot specify an inner result shape"
_ -> return True | 3,839 | false | false | 4 | 22 | 1,162 | 990 | 466 | 524 | null | null |
shlevy/ghc | compiler/cmm/CmmUtils.hs | bsd-3-clause | cmmIndexExpr :: DynFlags
-> Width -- Width w
-> CmmExpr -- Address of vector of items of width w
-> CmmExpr -- Which element of the vector (0 based)
-> CmmExpr -- Address of i'th element
cmmIndexExpr dflags width base (CmmLit (CmmInt n _)) = cmmIndex dflags width base (fromInteger n) | 370 | cmmIndexExpr :: DynFlags
-> Width -- Width w
-> CmmExpr -- Address of vector of items of width w
-> CmmExpr -- Which element of the vector (0 based)
-> CmmExpr
cmmIndexExpr dflags width base (CmmLit (CmmInt n _)) = cmmIndex dflags width base (fromInteger n) | 335 | cmmIndexExpr dflags width base (CmmLit (CmmInt n _)) = cmmIndex dflags width base (fromInteger n) | 97 | true | true | 0 | 9 | 136 | 69 | 36 | 33 | null | null |
tardate/LittleCodingKata | haskell/hello_world/hello_world.hs | mit | parse [] = hello_world | 22 | parse [] = hello_world | 22 | parse [] = hello_world | 22 | false | false | 1 | 5 | 3 | 15 | 5 | 10 | null | null |
sykora/verse | src/Language/Verse/Transform/Music.hs | gpl-3.0 | scriptInclude :: String -> Rendering HtmlRenderContext
scriptInclude path = H.script ! A.src (fromString path) $ mempty | 119 | scriptInclude :: String -> Rendering HtmlRenderContext
scriptInclude path = H.script ! A.src (fromString path) $ mempty | 119 | scriptInclude path = H.script ! A.src (fromString path) $ mempty | 64 | false | true | 0 | 9 | 15 | 42 | 20 | 22 | null | null |
dsabel/stmshf | Benchmarks/misc/sabel/nonterm3.hs | bsd-3-clause | main =
do
tv <- newTVarIO 0
s <- newEmptyMVar
forkIO $ fast tv s
forkIO $ slow tv s
threadDelay 10000
takeMVar s
putStrLn "got first"
takeMVar s
putStrLn "got second" | 187 | main =
do
tv <- newTVarIO 0
s <- newEmptyMVar
forkIO $ fast tv s
forkIO $ slow tv s
threadDelay 10000
takeMVar s
putStrLn "got first"
takeMVar s
putStrLn "got second" | 187 | main =
do
tv <- newTVarIO 0
s <- newEmptyMVar
forkIO $ fast tv s
forkIO $ slow tv s
threadDelay 10000
takeMVar s
putStrLn "got first"
takeMVar s
putStrLn "got second" | 187 | false | false | 0 | 8 | 52 | 77 | 30 | 47 | null | null |
jwiegley/ghc-release | libraries/base/Data/Fixed.hs | gpl-3.0 | chopZeros a = show a | 20 | chopZeros a = show a | 20 | chopZeros a = show a | 20 | false | false | 1 | 5 | 4 | 15 | 5 | 10 | null | null |
brendanhay/gogol | gogol-compute/gen/Network/Google/Resource/Compute/RegionNotificationEndpoints/List.hs | mpl-2.0 | -- | Name of the region scoping this request.
rnelRegion :: Lens' RegionNotificationEndpointsList Text
rnelRegion
= lens _rnelRegion (\ s a -> s{_rnelRegion = a}) | 164 | rnelRegion :: Lens' RegionNotificationEndpointsList Text
rnelRegion
= lens _rnelRegion (\ s a -> s{_rnelRegion = a}) | 118 | rnelRegion
= lens _rnelRegion (\ s a -> s{_rnelRegion = a}) | 61 | true | true | 1 | 9 | 26 | 46 | 22 | 24 | null | null |
jwiegley/ghc-release | compiler/llvmGen/Llvm/Types.hs | gpl-3.0 | -- | Return the 'LlvmLinkageType' for a 'LlvmVar'
getLink :: LlvmVar -> LlvmLinkageType
getLink (LMGlobalVar _ _ l _ _ _) = l | 125 | getLink :: LlvmVar -> LlvmLinkageType
getLink (LMGlobalVar _ _ l _ _ _) = l | 75 | getLink (LMGlobalVar _ _ l _ _ _) = l | 37 | true | true | 0 | 9 | 22 | 41 | 19 | 22 | null | null |
nickbart1980/pandoc | src/Text/Pandoc/Readers/LaTeX.hs | gpl-2.0 | circ 'i' = "î" | 14 | circ 'i' = "î" | 14 | circ 'i' = "î" | 14 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.