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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
MSA-Argentina/helojito
|
src-main/Helojito/Options.hs
|
mit
|
typeParser :: Parser Command
typeParser = TaskTypeCommand <$> typeOptsParser
| 76 |
typeParser :: Parser Command
typeParser = TaskTypeCommand <$> typeOptsParser
| 76 |
typeParser = TaskTypeCommand <$> typeOptsParser
| 47 | false | true | 1 | 6 | 8 | 22 | 9 | 13 | null | null |
mlite/hLLVM
|
src/Llvm/Asm/Simplification.hs
|
bsd-3-clause
|
checkImpCount _ = return ()
| 27 |
checkImpCount _ = return ()
| 27 |
checkImpCount _ = return ()
| 27 | false | false | 0 | 5 | 4 | 15 | 6 | 9 | null | null |
zalora/Angel
|
src/Angel/Util.hs
|
bsd-3-clause
|
split :: Eq a => a -> [a] -> [[a]]
split a = catMaybes . foldr go []
where
go x acc = case (x == a, acc) of
(True, xs) -> Nothing:xs
(False, []) -> [Just [x]]
(False, Nothing:rest) -> Just [x]:Nothing:rest
(False, Just xs:rest) -> Just (x:xs):rest
| 277 |
split :: Eq a => a -> [a] -> [[a]]
split a = catMaybes . foldr go []
where
go x acc = case (x == a, acc) of
(True, xs) -> Nothing:xs
(False, []) -> [Just [x]]
(False, Nothing:rest) -> Just [x]:Nothing:rest
(False, Just xs:rest) -> Just (x:xs):rest
| 277 |
split a = catMaybes . foldr go []
where
go x acc = case (x == a, acc) of
(True, xs) -> Nothing:xs
(False, []) -> [Just [x]]
(False, Nothing:rest) -> Just [x]:Nothing:rest
(False, Just xs:rest) -> Just (x:xs):rest
| 242 | false | true | 1 | 11 | 78 | 188 | 95 | 93 | null | null |
ml9951/ghc
|
compiler/typecheck/TcRnTypes.hs
|
bsd-3-clause
|
ctLocOrigin :: CtLoc -> CtOrigin
ctLocOrigin = ctl_origin
| 57 |
ctLocOrigin :: CtLoc -> CtOrigin
ctLocOrigin = ctl_origin
| 57 |
ctLocOrigin = ctl_origin
| 24 | false | true | 0 | 5 | 7 | 15 | 8 | 7 | null | null |
kojiromike/Idris-dev
|
src/Idris/REPL/Browse.hs
|
bsd-3-clause
|
-- | Find the sub-namespaces of a given namespace. The components
-- should be in display order rather than the order that they are in
-- inside of NS constructors.
namespacesInNS :: [String] -> Idris [[String]]
namespacesInNS ns = do let revNS = reverse ns
allNames <- fmap ctxtAlist getContext
return . nub $
[ reverse space | space <- mapMaybe (getNS . fst) allNames
, revNS `isSuffixOf` space
, revNS /= space ]
where getNS (NS _ namespace) = Just (map T.unpack namespace)
getNS _ = Nothing
-- | Find the user-accessible names that occur directly within a given
-- namespace. The components should be in display order rather than
-- the order that they are in inside of NS constructors.
| 854 |
namespacesInNS :: [String] -> Idris [[String]]
namespacesInNS ns = do let revNS = reverse ns
allNames <- fmap ctxtAlist getContext
return . nub $
[ reverse space | space <- mapMaybe (getNS . fst) allNames
, revNS `isSuffixOf` space
, revNS /= space ]
where getNS (NS _ namespace) = Just (map T.unpack namespace)
getNS _ = Nothing
-- | Find the user-accessible names that occur directly within a given
-- namespace. The components should be in display order rather than
-- the order that they are in inside of NS constructors.
| 689 |
namespacesInNS ns = do let revNS = reverse ns
allNames <- fmap ctxtAlist getContext
return . nub $
[ reverse space | space <- mapMaybe (getNS . fst) allNames
, revNS `isSuffixOf` space
, revNS /= space ]
where getNS (NS _ namespace) = Just (map T.unpack namespace)
getNS _ = Nothing
-- | Find the user-accessible names that occur directly within a given
-- namespace. The components should be in display order rather than
-- the order that they are in inside of NS constructors.
| 642 | true | true | 0 | 13 | 285 | 162 | 80 | 82 | null | null |
colah/ImplicitCAD
|
Examples/example11.hs
|
agpl-3.0
|
out = union [
square True (V2 80 80)
, translate (V2 40 40) $ circle 30
]
| 81 |
out = union [
square True (V2 80 80)
, translate (V2 40 40) $ circle 30
]
| 81 |
out = union [
square True (V2 80 80)
, translate (V2 40 40) $ circle 30
]
| 81 | false | false | 1 | 10 | 25 | 50 | 22 | 28 | null | null |
GaloisInc/stack
|
src/Stack/Config.hs
|
bsd-3-clause
|
loadBuildConfig :: (MonadLogger m, MonadIO m, MonadCatch m, MonadReader env m, HasHttpManager env, MonadBaseControl IO m, HasTerminal env)
=> EnvOverride
-> Maybe (Project, Path Abs File, ConfigMonoid)
-> Config
-> Path Abs Dir
-> Maybe Resolver -- override resolver
-> NoBuildConfigStrategy
-> m BuildConfig
loadBuildConfig menv mproject config stackRoot mresolver noConfigStrat = do
env <- ask
let miniConfig = MiniConfig (getHttpManager env) config
(project', stackYamlFP) <- case mproject of
Just (project, fp, _) -> return (project, fp)
Nothing -> case noConfigStrat of
ThrowException -> do
currDir <- getWorkingDir
cabalFiles <- findCabalFiles True currDir
throwM $ NoProjectConfigFound currDir
$ Just $ if null cabalFiles then "new" else "init"
ExecStrategy -> do
let dest :: Path Abs File
dest = destDir </> stackDotYaml
destDir = implicitGlobalDir stackRoot
dest' :: FilePath
dest' = toFilePath dest
createTree destDir
exists <- fileExists dest
if exists
then do
ProjectAndConfigMonoid project _ <- loadYaml dest
when (getTerminal env) $
case mresolver of
Nothing ->
$logInfo ("Using resolver: " <> renderResolver (projectResolver project) <>
" from global config file: " <> T.pack dest')
Just resolver ->
$logInfo ("Using resolver: " <> renderResolver resolver <>
" specified on command line")
return (project, dest)
else do
r <- runReaderT getLatestResolver miniConfig
$logInfo ("Using latest snapshot resolver: " <> renderResolver r)
$logInfo ("Writing global (non-project-specific) config file to: " <> T.pack dest')
$logInfo "Note: You can change the snapshot via the resolver field there."
let p = Project
{ projectPackages = mempty
, projectExtraDeps = mempty
, projectFlags = mempty
, projectResolver = r
}
liftIO $ Yaml.encodeFile dest' p
return (p, dest)
let project = project'
{ projectResolver = fromMaybe (projectResolver project') mresolver
}
ghcVersion <-
case projectResolver project of
ResolverSnapshot snapName -> do
mbp <- runReaderT (loadMiniBuildPlan snapName) miniConfig
return $ mbpGhcVersion mbp
ResolverGhc m -> return $ fromMajorVersion m
let root = parent stackYamlFP
packages' <- mapM (resolvePackageEntry menv root) (projectPackages project)
let packages = Map.fromList $ concat packages'
return BuildConfig
{ bcConfig = config
, bcResolver = projectResolver project
, bcGhcVersionExpected = ghcVersion
, bcPackages = packages
, bcExtraDeps = projectExtraDeps project
, bcRoot = root
, bcStackYaml = stackYamlFP
, bcFlags = projectFlags project
}
-- | Resolve a PackageEntry into a list of paths, downloading and cloning as
-- necessary.
| 3,655 |
loadBuildConfig :: (MonadLogger m, MonadIO m, MonadCatch m, MonadReader env m, HasHttpManager env, MonadBaseControl IO m, HasTerminal env)
=> EnvOverride
-> Maybe (Project, Path Abs File, ConfigMonoid)
-> Config
-> Path Abs Dir
-> Maybe Resolver -- override resolver
-> NoBuildConfigStrategy
-> m BuildConfig
loadBuildConfig menv mproject config stackRoot mresolver noConfigStrat = do
env <- ask
let miniConfig = MiniConfig (getHttpManager env) config
(project', stackYamlFP) <- case mproject of
Just (project, fp, _) -> return (project, fp)
Nothing -> case noConfigStrat of
ThrowException -> do
currDir <- getWorkingDir
cabalFiles <- findCabalFiles True currDir
throwM $ NoProjectConfigFound currDir
$ Just $ if null cabalFiles then "new" else "init"
ExecStrategy -> do
let dest :: Path Abs File
dest = destDir </> stackDotYaml
destDir = implicitGlobalDir stackRoot
dest' :: FilePath
dest' = toFilePath dest
createTree destDir
exists <- fileExists dest
if exists
then do
ProjectAndConfigMonoid project _ <- loadYaml dest
when (getTerminal env) $
case mresolver of
Nothing ->
$logInfo ("Using resolver: " <> renderResolver (projectResolver project) <>
" from global config file: " <> T.pack dest')
Just resolver ->
$logInfo ("Using resolver: " <> renderResolver resolver <>
" specified on command line")
return (project, dest)
else do
r <- runReaderT getLatestResolver miniConfig
$logInfo ("Using latest snapshot resolver: " <> renderResolver r)
$logInfo ("Writing global (non-project-specific) config file to: " <> T.pack dest')
$logInfo "Note: You can change the snapshot via the resolver field there."
let p = Project
{ projectPackages = mempty
, projectExtraDeps = mempty
, projectFlags = mempty
, projectResolver = r
}
liftIO $ Yaml.encodeFile dest' p
return (p, dest)
let project = project'
{ projectResolver = fromMaybe (projectResolver project') mresolver
}
ghcVersion <-
case projectResolver project of
ResolverSnapshot snapName -> do
mbp <- runReaderT (loadMiniBuildPlan snapName) miniConfig
return $ mbpGhcVersion mbp
ResolverGhc m -> return $ fromMajorVersion m
let root = parent stackYamlFP
packages' <- mapM (resolvePackageEntry menv root) (projectPackages project)
let packages = Map.fromList $ concat packages'
return BuildConfig
{ bcConfig = config
, bcResolver = projectResolver project
, bcGhcVersionExpected = ghcVersion
, bcPackages = packages
, bcExtraDeps = projectExtraDeps project
, bcRoot = root
, bcStackYaml = stackYamlFP
, bcFlags = projectFlags project
}
-- | Resolve a PackageEntry into a list of paths, downloading and cloning as
-- necessary.
| 3,655 |
loadBuildConfig menv mproject config stackRoot mresolver noConfigStrat = do
env <- ask
let miniConfig = MiniConfig (getHttpManager env) config
(project', stackYamlFP) <- case mproject of
Just (project, fp, _) -> return (project, fp)
Nothing -> case noConfigStrat of
ThrowException -> do
currDir <- getWorkingDir
cabalFiles <- findCabalFiles True currDir
throwM $ NoProjectConfigFound currDir
$ Just $ if null cabalFiles then "new" else "init"
ExecStrategy -> do
let dest :: Path Abs File
dest = destDir </> stackDotYaml
destDir = implicitGlobalDir stackRoot
dest' :: FilePath
dest' = toFilePath dest
createTree destDir
exists <- fileExists dest
if exists
then do
ProjectAndConfigMonoid project _ <- loadYaml dest
when (getTerminal env) $
case mresolver of
Nothing ->
$logInfo ("Using resolver: " <> renderResolver (projectResolver project) <>
" from global config file: " <> T.pack dest')
Just resolver ->
$logInfo ("Using resolver: " <> renderResolver resolver <>
" specified on command line")
return (project, dest)
else do
r <- runReaderT getLatestResolver miniConfig
$logInfo ("Using latest snapshot resolver: " <> renderResolver r)
$logInfo ("Writing global (non-project-specific) config file to: " <> T.pack dest')
$logInfo "Note: You can change the snapshot via the resolver field there."
let p = Project
{ projectPackages = mempty
, projectExtraDeps = mempty
, projectFlags = mempty
, projectResolver = r
}
liftIO $ Yaml.encodeFile dest' p
return (p, dest)
let project = project'
{ projectResolver = fromMaybe (projectResolver project') mresolver
}
ghcVersion <-
case projectResolver project of
ResolverSnapshot snapName -> do
mbp <- runReaderT (loadMiniBuildPlan snapName) miniConfig
return $ mbpGhcVersion mbp
ResolverGhc m -> return $ fromMajorVersion m
let root = parent stackYamlFP
packages' <- mapM (resolvePackageEntry menv root) (projectPackages project)
let packages = Map.fromList $ concat packages'
return BuildConfig
{ bcConfig = config
, bcResolver = projectResolver project
, bcGhcVersionExpected = ghcVersion
, bcPackages = packages
, bcExtraDeps = projectExtraDeps project
, bcRoot = root
, bcStackYaml = stackYamlFP
, bcFlags = projectFlags project
}
-- | Resolve a PackageEntry into a list of paths, downloading and cloning as
-- necessary.
| 3,234 | false | true | 0 | 30 | 1,454 | 785 | 380 | 405 | null | null |
geophf/1HaskellADay
|
exercises/HAD/Y2017/M07/D05/Exercise.hs
|
mit
|
{--
AHA! I'm BACK!
I'm BACK in the saddle again!
From the Mensa Genius Quiz-a-Day Book by Dr. Abbie F. Salny, July 3 problem:
The following multiplication example uses all the digits from 0 to 9 once and
only once (not counting the intermediate steps). Finish the problem. One number
has been filled in to get you started.
x x x (a)
x 5 (b)
---------
x x x x x (c)
DO IT TO IT!
I LIKE TO MOVE IT, MOVE IT!
--}
multiplicationProblem :: Nums -> Nums -> Nums -> [(Nums, Nums, Nums)]
multiplicationProblem a b c = undefined
| 570 |
multiplicationProblem :: Nums -> Nums -> Nums -> [(Nums, Nums, Nums)]
multiplicationProblem a b c = undefined
| 109 |
multiplicationProblem a b c = undefined
| 39 | true | true | 0 | 9 | 151 | 43 | 24 | 19 | null | null |
faylang/fay-server
|
modules/project/Demo/Tailrecursive.hs
|
bsd-3-clause
|
benchmark :: Fay ()
benchmark = do
start <- getSeconds
printD (sum 1000000 0 :: Double)
end <- getSeconds
printS (show (end-start) ++ "ms")
-- the tail recursive function
| 179 |
benchmark :: Fay ()
benchmark = do
start <- getSeconds
printD (sum 1000000 0 :: Double)
end <- getSeconds
printS (show (end-start) ++ "ms")
-- the tail recursive function
| 179 |
benchmark = do
start <- getSeconds
printD (sum 1000000 0 :: Double)
end <- getSeconds
printS (show (end-start) ++ "ms")
-- the tail recursive function
| 159 | false | true | 0 | 13 | 37 | 77 | 35 | 42 | null | null |
vrom911/Compiler
|
src/Compiler/Rum/Compiler/CodeGen.hs
|
mit
|
--namedInstr :: String -> Instruction -> Codegen Operand
--namedInstr name instruction = do
-- identfiersNames <- gets names
-- let (newName, newNameMap) = uniqueName name identfiersNames
-- modify $ \codegenState -> codegenState { names = newNameMap }
-- addInstr (Name newName) instruction
--
--addInstr :: Name -> Instruction -> Codegen Operand
--addInstr name instruction = do
-- curBlock <- current
-- let curStack = stack curBlock
-- modifyBlock (curBlock { stack = curStack ++ [name := instruction] })
-- return $ LocalReference iType name
terminator :: Named Terminator -> Codegen (Named Terminator)
terminator trm = do
curBlock <- current
case term curBlock of
Just oldTrm -> return oldTrm
Nothing -> do
modifyBlock (curBlock { term = Just trm })
return trm
-------------------------------
--------- Block Stack ---------
-------------------------------
| 936 |
terminator :: Named Terminator -> Codegen (Named Terminator)
terminator trm = do
curBlock <- current
case term curBlock of
Just oldTrm -> return oldTrm
Nothing -> do
modifyBlock (curBlock { term = Just trm })
return trm
-------------------------------
--------- Block Stack ---------
-------------------------------
| 363 |
terminator trm = do
curBlock <- current
case term curBlock of
Just oldTrm -> return oldTrm
Nothing -> do
modifyBlock (curBlock { term = Just trm })
return trm
-------------------------------
--------- Block Stack ---------
-------------------------------
| 302 | true | true | 0 | 16 | 200 | 107 | 57 | 50 | null | null |
DavidAlphaFox/ghc
|
libraries/Cabal/cabal-install/Distribution/Client/Dependency/Modular/Flag.hs
|
bsd-3-clause
|
unFlag :: Flag -> String
unFlag (FlagName fn) = fn
| 50 |
unFlag :: Flag -> String
unFlag (FlagName fn) = fn
| 50 |
unFlag (FlagName fn) = fn
| 25 | false | true | 0 | 9 | 9 | 30 | 13 | 17 | null | null |
juodaspaulius/bclafer_old
|
src/Language/Clafer/Optimizer/Optimizer.hs
|
mit
|
findDupClafer clafer = if null dups
then clafer{elements = map findDupElement $ elements clafer}
else error $ (show $ ident clafer) ++ show dups
where
dups = findDuplicates $ getSubclafers $ elements clafer
| 214 |
findDupClafer clafer = if null dups
then clafer{elements = map findDupElement $ elements clafer}
else error $ (show $ ident clafer) ++ show dups
where
dups = findDuplicates $ getSubclafers $ elements clafer
| 214 |
findDupClafer clafer = if null dups
then clafer{elements = map findDupElement $ elements clafer}
else error $ (show $ ident clafer) ++ show dups
where
dups = findDuplicates $ getSubclafers $ elements clafer
| 214 | false | false | 0 | 10 | 40 | 78 | 38 | 40 | null | null |
enolan/Idris-dev
|
Setup.hs
|
bsd-3-clause
|
make verbosity =
P.runProgramInvocation verbosity . P.simpleProgramInvocation mymake
| 87 |
make verbosity =
P.runProgramInvocation verbosity . P.simpleProgramInvocation mymake
| 87 |
make verbosity =
P.runProgramInvocation verbosity . P.simpleProgramInvocation mymake
| 87 | false | false | 1 | 7 | 10 | 26 | 10 | 16 | null | null |
tamarin-prover/tamarin-prover
|
lib/sapic/src/Sapic/Facts.hs
|
gpl-3.0
|
actionToFact (ProgressTo p pf) = protoFact Linear ("ProgressTo_"++prettyPosition p) $ [varTerm $ varProgress pf]
| 112 |
actionToFact (ProgressTo p pf) = protoFact Linear ("ProgressTo_"++prettyPosition p) $ [varTerm $ varProgress pf]
| 112 |
actionToFact (ProgressTo p pf) = protoFact Linear ("ProgressTo_"++prettyPosition p) $ [varTerm $ varProgress pf]
| 112 | false | false | 0 | 9 | 13 | 47 | 22 | 25 | null | null |
bitemyapp/atomic-write
|
spec/System/AtomicWrite/Writer/TextSpec.hs
|
mit
|
spec :: Spec
spec = describe "atomicWriteFile" $
it "writes contents to a file" $
withSystemTempDirectory "atomicFileTest" $ \tmpDir -> do
let path = joinPath [ tmpDir, "writeTest.tmp" ]
atomicWriteFile path $ pack "just testing"
contents <- readFile path
contents `shouldBe` "just testing"
| 323 |
spec :: Spec
spec = describe "atomicWriteFile" $
it "writes contents to a file" $
withSystemTempDirectory "atomicFileTest" $ \tmpDir -> do
let path = joinPath [ tmpDir, "writeTest.tmp" ]
atomicWriteFile path $ pack "just testing"
contents <- readFile path
contents `shouldBe` "just testing"
| 323 |
spec = describe "atomicWriteFile" $
it "writes contents to a file" $
withSystemTempDirectory "atomicFileTest" $ \tmpDir -> do
let path = joinPath [ tmpDir, "writeTest.tmp" ]
atomicWriteFile path $ pack "just testing"
contents <- readFile path
contents `shouldBe` "just testing"
| 310 | false | true | 0 | 13 | 75 | 94 | 42 | 52 | null | null |
mongodb-haskell/mongodb
|
Database/MongoDB/Connection.hs
|
apache-2.0
|
closeReplicaSet :: ReplicaSet -> IO ()
-- ^ Close all connections to replica set
closeReplicaSet (ReplicaSet _ vMembers _ _) = withMVar vMembers $ mapM_ (maybe (return ()) close . snd)
| 184 |
closeReplicaSet :: ReplicaSet -> IO ()
closeReplicaSet (ReplicaSet _ vMembers _ _) = withMVar vMembers $ mapM_ (maybe (return ()) close . snd)
| 142 |
closeReplicaSet (ReplicaSet _ vMembers _ _) = withMVar vMembers $ mapM_ (maybe (return ()) close . snd)
| 103 | true | true | 0 | 12 | 30 | 66 | 32 | 34 | null | null |
quyse/flaw
|
flaw-font/Flaw/Graphics/Font/Script.hs
|
mit
|
fontScriptKhudawadi :: FontScript
fontScriptKhudawadi = fontScript "Sind"
| 96 |
fontScriptKhudawadi :: FontScript
fontScriptKhudawadi = fontScript "Sind"
| 96 |
fontScriptKhudawadi = fontScript "Sind"
| 51 | false | true | 0 | 5 | 29 | 14 | 7 | 7 | null | null |
unisonweb/platform
|
parser-typechecker/src/Unison/Codebase/Editor/HandleInput.hs
|
mit
|
-- | supply `dest0` if you want to print diff messages
-- supply unchangedMessage if you want to display it if merge had no effect
mergeBranchAndPropagateDefaultPatch :: (Monad m, Var v) => Branch.MergeMode ->
InputDescription -> Maybe (Output v) -> Branch m -> Maybe Path.Path' -> Path.Absolute -> Action' m v ()
mergeBranchAndPropagateDefaultPatch mode inputDescription unchangedMessage srcb dest0 dest =
ifM (mergeBranch mode inputDescription srcb dest0 dest)
(loadPropagateDiffDefaultPatch inputDescription dest0 dest)
(for_ unchangedMessage respond)
where
mergeBranch :: (Monad m, Var v) =>
Branch.MergeMode -> InputDescription -> Branch m -> Maybe Path.Path' -> Path.Absolute -> Action' m v Bool
mergeBranch mode inputDescription srcb dest0 dest = unsafeTime "Merge Branch" $ do
destb <- getAt dest
merged <- eval $ Merge mode srcb destb
b <- updateAtM inputDescription dest (const $ pure merged)
for_ dest0 $ \dest0 ->
diffHelper (Branch.head destb) (Branch.head merged) >>=
respondNumbered . uncurry (ShowDiffAfterMerge dest0 dest)
pure b
| 1,108 |
mergeBranchAndPropagateDefaultPatch :: (Monad m, Var v) => Branch.MergeMode ->
InputDescription -> Maybe (Output v) -> Branch m -> Maybe Path.Path' -> Path.Absolute -> Action' m v ()
mergeBranchAndPropagateDefaultPatch mode inputDescription unchangedMessage srcb dest0 dest =
ifM (mergeBranch mode inputDescription srcb dest0 dest)
(loadPropagateDiffDefaultPatch inputDescription dest0 dest)
(for_ unchangedMessage respond)
where
mergeBranch :: (Monad m, Var v) =>
Branch.MergeMode -> InputDescription -> Branch m -> Maybe Path.Path' -> Path.Absolute -> Action' m v Bool
mergeBranch mode inputDescription srcb dest0 dest = unsafeTime "Merge Branch" $ do
destb <- getAt dest
merged <- eval $ Merge mode srcb destb
b <- updateAtM inputDescription dest (const $ pure merged)
for_ dest0 $ \dest0 ->
diffHelper (Branch.head destb) (Branch.head merged) >>=
respondNumbered . uncurry (ShowDiffAfterMerge dest0 dest)
pure b
| 975 |
mergeBranchAndPropagateDefaultPatch mode inputDescription unchangedMessage srcb dest0 dest =
ifM (mergeBranch mode inputDescription srcb dest0 dest)
(loadPropagateDiffDefaultPatch inputDescription dest0 dest)
(for_ unchangedMessage respond)
where
mergeBranch :: (Monad m, Var v) =>
Branch.MergeMode -> InputDescription -> Branch m -> Maybe Path.Path' -> Path.Absolute -> Action' m v Bool
mergeBranch mode inputDescription srcb dest0 dest = unsafeTime "Merge Branch" $ do
destb <- getAt dest
merged <- eval $ Merge mode srcb destb
b <- updateAtM inputDescription dest (const $ pure merged)
for_ dest0 $ \dest0 ->
diffHelper (Branch.head destb) (Branch.head merged) >>=
respondNumbered . uncurry (ShowDiffAfterMerge dest0 dest)
pure b
| 790 | true | true | 0 | 15 | 211 | 332 | 158 | 174 | null | null |
pparkkin/eta
|
compiler/ETA/TypeCheck/TcRnTypes.hs
|
bsd-3-clause
|
-- | Get the flavour of the given 'Ct'
ctFlavour :: Ct -> CtFlavour
ctFlavour = ctEvFlavour . ctEvidence
| 104 |
ctFlavour :: Ct -> CtFlavour
ctFlavour = ctEvFlavour . ctEvidence
| 65 |
ctFlavour = ctEvFlavour . ctEvidence
| 36 | true | true | 0 | 5 | 18 | 20 | 11 | 9 | null | null |
andyarvanitis/Idris-dev
|
src/Idris/IBC.hs
|
bsd-3-clause
|
safeToEnum :: (Enum a, Bounded a, Integral int) => String -> int -> a
safeToEnum label x' = result
where
x = fromIntegral x'
result
| x < fromEnum (minBound `asTypeOf` result)
|| x > fromEnum (maxBound `asTypeOf` result)
= error $ label ++ ": corrupted binary representation in IBC"
| otherwise = toEnum x
| 353 |
safeToEnum :: (Enum a, Bounded a, Integral int) => String -> int -> a
safeToEnum label x' = result
where
x = fromIntegral x'
result
| x < fromEnum (minBound `asTypeOf` result)
|| x > fromEnum (maxBound `asTypeOf` result)
= error $ label ++ ": corrupted binary representation in IBC"
| otherwise = toEnum x
| 353 |
safeToEnum label x' = result
where
x = fromIntegral x'
result
| x < fromEnum (minBound `asTypeOf` result)
|| x > fromEnum (maxBound `asTypeOf` result)
= error $ label ++ ": corrupted binary representation in IBC"
| otherwise = toEnum x
| 283 | false | true | 5 | 13 | 102 | 139 | 65 | 74 | null | null |
lwm/haskellnews
|
src/HN/Model/Github.hs
|
bsd-3-clause
|
itemExists2 :: Source -> NewItem -> Model c s (Bool)
itemExists2 source item = do
exists <- single ["SELECT true"
,"FROM item"
,"WHERE "
," (source = ? AND link = ?) "]
(source
,niLink item)
case exists :: Maybe Bool of
Just{} -> return True
Nothing -> return False
| 373 |
itemExists2 :: Source -> NewItem -> Model c s (Bool)
itemExists2 source item = do
exists <- single ["SELECT true"
,"FROM item"
,"WHERE "
," (source = ? AND link = ?) "]
(source
,niLink item)
case exists :: Maybe Bool of
Just{} -> return True
Nothing -> return False
| 373 |
itemExists2 source item = do
exists <- single ["SELECT true"
,"FROM item"
,"WHERE "
," (source = ? AND link = ?) "]
(source
,niLink item)
case exists :: Maybe Bool of
Just{} -> return True
Nothing -> return False
| 320 | false | true | 0 | 10 | 157 | 102 | 51 | 51 | null | null |
rahulmutt/ghcvm
|
compiler/Eta/Main/HscTypes.hs
|
bsd-3-clause
|
-- | Retrieve the ExternalPackageState cache.
hscEPS :: HscEnv -> IO ExternalPackageState
hscEPS hsc_env = readIORef (hsc_EPS hsc_env)
| 134 |
hscEPS :: HscEnv -> IO ExternalPackageState
hscEPS hsc_env = readIORef (hsc_EPS hsc_env)
| 88 |
hscEPS hsc_env = readIORef (hsc_EPS hsc_env)
| 44 | true | true | 0 | 7 | 17 | 31 | 15 | 16 | null | null |
silkapp/xmlhtml-xpath
|
src/Xml/XPath/Parser.hs
|
bsd-3-clause
|
relativeLocationPath :: Parser [Step]
relativeLocationPath
= (++)
<$> (step `sepBy1` token "/")
<*> option [] abbreviatedRelativeLocationPath
| 149 |
relativeLocationPath :: Parser [Step]
relativeLocationPath
= (++)
<$> (step `sepBy1` token "/")
<*> option [] abbreviatedRelativeLocationPath
| 149 |
relativeLocationPath
= (++)
<$> (step `sepBy1` token "/")
<*> option [] abbreviatedRelativeLocationPath
| 111 | false | true | 5 | 7 | 23 | 50 | 27 | 23 | null | null |
osa1/language-lua
|
src/Language/Lua/PrettyPrinter.hs
|
bsd-3-clause
|
pprintFunction :: Maybe Doc -> FunBody -> Doc
pprintFunction funname (FunBody args vararg block) =
group (nest 2 (header <$> body) <$> end)
where
header = case funname of
Nothing -> text "function" <+> args'
Just n -> text "function" <+> n <> args'
vararg' = if vararg then ["..."] else []
args' = parens (align (cat (punctuate (comma <> space) (map pprint (args ++ vararg')))))
body = pprint block
end = text "end"
| 472 |
pprintFunction :: Maybe Doc -> FunBody -> Doc
pprintFunction funname (FunBody args vararg block) =
group (nest 2 (header <$> body) <$> end)
where
header = case funname of
Nothing -> text "function" <+> args'
Just n -> text "function" <+> n <> args'
vararg' = if vararg then ["..."] else []
args' = parens (align (cat (punctuate (comma <> space) (map pprint (args ++ vararg')))))
body = pprint block
end = text "end"
| 472 |
pprintFunction funname (FunBody args vararg block) =
group (nest 2 (header <$> body) <$> end)
where
header = case funname of
Nothing -> text "function" <+> args'
Just n -> text "function" <+> n <> args'
vararg' = if vararg then ["..."] else []
args' = parens (align (cat (punctuate (comma <> space) (map pprint (args ++ vararg')))))
body = pprint block
end = text "end"
| 426 | false | true | 0 | 15 | 130 | 188 | 95 | 93 | null | null |
GaloisInc/halvm-ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
-- Type-level naturals
knownNatClassName :: Name
knownNatClassName = clsQual gHC_TYPELITS (fsLit "KnownNat") knownNatClassNameKey
| 133 |
knownNatClassName :: Name
knownNatClassName = clsQual gHC_TYPELITS (fsLit "KnownNat") knownNatClassNameKey
| 110 |
knownNatClassName = clsQual gHC_TYPELITS (fsLit "KnownNat") knownNatClassNameKey
| 84 | true | true | 0 | 7 | 16 | 31 | 14 | 17 | null | null |
jystic/hsimport
|
tests/inputFiles/ModuleTest29.hs
|
bsd-3-clause
|
g :: Int -> Int
g =
where
| 28 |
g :: Int -> Int
g =
where
| 28 |
g =
where
| 12 | false | true | 0 | 7 | 10 | 22 | 9 | 13 | null | null |
jaalonso/I1M-Cod-Temas
|
src/Tema_21/PolPropiedades.hs
|
gpl-2.0
|
-- Comprobación
-- λ> quickCheck prop_consPol
-- +++ OK, passed 100 tests.
-- Propiedad. Si n es mayor que el grado de p y b no es cero, entonces
-- el grado de (consPol n b p) es n.
prop_grado :: Int -> Int -> Polinomio Int -> Property
prop_grado n b p =
n > grado p && b /= 0 ==>
grado (consPol n b p) == n
| 319 |
prop_grado :: Int -> Int -> Polinomio Int -> Property
prop_grado n b p =
n > grado p && b /= 0 ==>
grado (consPol n b p) == n
| 129 |
prop_grado n b p =
n > grado p && b /= 0 ==>
grado (consPol n b p) == n
| 75 | true | true | 9 | 9 | 80 | 90 | 42 | 48 | null | null |
lordcirth/haskell-rogue
|
src/Input.hs
|
gpl-3.0
|
-- https://github.com/jtdaugherty/brick/blob/master/docs/guide.rst#apphandleevent-handling-events
handleInput :: GameState -> T.BrickEvent () e -> T.EventM () (T.Next GameState)
handleInput gs (T.VtyEvent ev) =
case ev of
-- the empty list [] is the list of mod keys
V.EvKey V.KEsc [] -> BMain.halt gs -- press ESC to quit
-- use numpad keys and match on number range to get movement
V.EvKey (V.KChar k) [] | k `elem` ['0'..'9'] -> BMain.continue (fullGameTurn (handleMoveInput k) gs)
-- Temporary testing: when player presses 'a' attempt to attack the first monster in list
--V.EvKey (V.KChar 'a') [] -> BMain.continue (fullGameTurn (actionMelee 0) gs)
-- Or arrow key movement
V.EvKey V.KUp [] -> BMain.continue (fullGameTurn (actionMove ( 0,-1) ) gs)
V.EvKey V.KDown [] -> BMain.continue (fullGameTurn (actionMove ( 0, 1) ) gs)
V.EvKey V.KLeft [] -> BMain.continue (fullGameTurn (actionMove (-1, 0) ) gs)
V.EvKey V.KRight [] -> BMain.continue (fullGameTurn (actionMove ( 1, 0) ) gs)
-- for a key which does nothing, do nothing (redraw identical)
-- could optionally print "That key does nothing!" or something?
_ -> BMain.continue gs
-- Wasn't even a T.VtyEvent
| 1,329 |
handleInput :: GameState -> T.BrickEvent () e -> T.EventM () (T.Next GameState)
handleInput gs (T.VtyEvent ev) =
case ev of
-- the empty list [] is the list of mod keys
V.EvKey V.KEsc [] -> BMain.halt gs -- press ESC to quit
-- use numpad keys and match on number range to get movement
V.EvKey (V.KChar k) [] | k `elem` ['0'..'9'] -> BMain.continue (fullGameTurn (handleMoveInput k) gs)
-- Temporary testing: when player presses 'a' attempt to attack the first monster in list
--V.EvKey (V.KChar 'a') [] -> BMain.continue (fullGameTurn (actionMelee 0) gs)
-- Or arrow key movement
V.EvKey V.KUp [] -> BMain.continue (fullGameTurn (actionMove ( 0,-1) ) gs)
V.EvKey V.KDown [] -> BMain.continue (fullGameTurn (actionMove ( 0, 1) ) gs)
V.EvKey V.KLeft [] -> BMain.continue (fullGameTurn (actionMove (-1, 0) ) gs)
V.EvKey V.KRight [] -> BMain.continue (fullGameTurn (actionMove ( 1, 0) ) gs)
-- for a key which does nothing, do nothing (redraw identical)
-- could optionally print "That key does nothing!" or something?
_ -> BMain.continue gs
-- Wasn't even a T.VtyEvent
| 1,231 |
handleInput gs (T.VtyEvent ev) =
case ev of
-- the empty list [] is the list of mod keys
V.EvKey V.KEsc [] -> BMain.halt gs -- press ESC to quit
-- use numpad keys and match on number range to get movement
V.EvKey (V.KChar k) [] | k `elem` ['0'..'9'] -> BMain.continue (fullGameTurn (handleMoveInput k) gs)
-- Temporary testing: when player presses 'a' attempt to attack the first monster in list
--V.EvKey (V.KChar 'a') [] -> BMain.continue (fullGameTurn (actionMelee 0) gs)
-- Or arrow key movement
V.EvKey V.KUp [] -> BMain.continue (fullGameTurn (actionMove ( 0,-1) ) gs)
V.EvKey V.KDown [] -> BMain.continue (fullGameTurn (actionMove ( 0, 1) ) gs)
V.EvKey V.KLeft [] -> BMain.continue (fullGameTurn (actionMove (-1, 0) ) gs)
V.EvKey V.KRight [] -> BMain.continue (fullGameTurn (actionMove ( 1, 0) ) gs)
-- for a key which does nothing, do nothing (redraw identical)
-- could optionally print "That key does nothing!" or something?
_ -> BMain.continue gs
-- Wasn't even a T.VtyEvent
| 1,151 | true | true | 0 | 14 | 340 | 336 | 170 | 166 | null | null |
ganeti-github-testing/ganeti-test-1
|
src/Ganeti/Constants.hs
|
bsd-2-clause
|
rpcTmoSlow :: Int
rpcTmoSlow = Types.rpcTimeoutToRaw Slow
| 57 |
rpcTmoSlow :: Int
rpcTmoSlow = Types.rpcTimeoutToRaw Slow
| 57 |
rpcTmoSlow = Types.rpcTimeoutToRaw Slow
| 39 | false | true | 0 | 6 | 6 | 16 | 8 | 8 | null | null |
duplode/threepenny-gui
|
src/Graphics/UI/Threepenny/Attributes.hs
|
bsd-3-clause
|
cols = strAttr "cols"
| 38 |
cols = strAttr "cols"
| 38 |
cols = strAttr "cols"
| 38 | false | false | 1 | 5 | 20 | 12 | 4 | 8 | null | null |
ucsd-cse131/01-adder
|
lib/Language/Adder/Parser.hs
|
mit
|
withSpan :: Parser a -> Parser (a, SourceSpan)
withSpan p = do
p1 <- getPosition
x <- p
p2 <- getPosition
return (x, SS p1 p2)
-- | `binder` parses BareBind, used for let-binds and function parameters.
| 211 |
withSpan :: Parser a -> Parser (a, SourceSpan)
withSpan p = do
p1 <- getPosition
x <- p
p2 <- getPosition
return (x, SS p1 p2)
-- | `binder` parses BareBind, used for let-binds and function parameters.
| 211 |
withSpan p = do
p1 <- getPosition
x <- p
p2 <- getPosition
return (x, SS p1 p2)
-- | `binder` parses BareBind, used for let-binds and function parameters.
| 164 | false | true | 0 | 10 | 46 | 74 | 34 | 40 | null | null |
tpsinnem/Idris-dev
|
src/Idris/Core/TT.hs
|
bsd-3-clause
|
isInjective (App _ f a) = isInjective f
| 46 |
isInjective (App _ f a) = isInjective f
| 46 |
isInjective (App _ f a) = isInjective f
| 46 | false | false | 0 | 7 | 14 | 22 | 10 | 12 | null | null |
abakst/symmetry
|
checker/src/Symmetry/SymbEx.hs
|
mit
|
absToIL (AProd _ a b) = do x <- absToIL a
y <- absToIL b
return $ IL.EPair x y
| 132 |
absToIL (AProd _ a b) = do x <- absToIL a
y <- absToIL b
return $ IL.EPair x y
| 132 |
absToIL (AProd _ a b) = do x <- absToIL a
y <- absToIL b
return $ IL.EPair x y
| 132 | false | false | 0 | 9 | 73 | 54 | 23 | 31 | null | null |
jbracker/supermonad-plugin
|
src/Control/Super/Monad/Constrained/Functions.hs
|
bsd-3-clause
|
apAndUnzipM :: ( Return n, ReturnCts n [(b, c)]
, Bind m n n, BindCts m n n (b, c) [(b, c)]
, FunctorCts n [(b, c)] ([b], [c]), FunctorCts n [(b, c)] [(b, c)]
) => (a -> m (b, c)) -> [a] -> n ([b], [c])
mapAndUnzipM f xs = liftM P.unzip (forM xs f)
| 297 |
mapAndUnzipM :: ( Return n, ReturnCts n [(b, c)]
, Bind m n n, BindCts m n n (b, c) [(b, c)]
, FunctorCts n [(b, c)] ([b], [c]), FunctorCts n [(b, c)] [(b, c)]
) => (a -> m (b, c)) -> [a] -> n ([b], [c])
mapAndUnzipM f xs = liftM P.unzip (forM xs f)
| 297 |
mapAndUnzipM f xs = liftM P.unzip (forM xs f)
| 45 | false | true | 0 | 10 | 105 | 197 | 112 | 85 | null | null |
jacekszymanski/wxHaskell
|
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
|
lgpl-2.1
|
wxPAPER_ENV_ITALY :: Int
wxPAPER_ENV_ITALY = 36
| 47 |
wxPAPER_ENV_ITALY :: Int
wxPAPER_ENV_ITALY = 36
| 47 |
wxPAPER_ENV_ITALY = 36
| 22 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
emc2/proglang-util
|
Control/Monad/Messages.hs
|
bsd-3-clause
|
runMessagesT :: (MonadIO m, Message w) => MessagesT w m a -> m a
runMessagesT (MessagesT m) =
do
(res, msgs) <- runWriterT m
liftIO (mapM_ (putStr . show . format) (sort msgs))
return res
| 201 |
runMessagesT :: (MonadIO m, Message w) => MessagesT w m a -> m a
runMessagesT (MessagesT m) =
do
(res, msgs) <- runWriterT m
liftIO (mapM_ (putStr . show . format) (sort msgs))
return res
| 201 |
runMessagesT (MessagesT m) =
do
(res, msgs) <- runWriterT m
liftIO (mapM_ (putStr . show . format) (sort msgs))
return res
| 136 | false | true | 0 | 12 | 48 | 102 | 49 | 53 | null | null |
pbv/codex
|
src/Codex/Evaluate.hs
|
mit
|
runSqlite :: S.Sqlite -> ReaderT S.Sqlite m a -> m a
runSqlite conn = flip runReaderT conn
| 91 |
runSqlite :: S.Sqlite -> ReaderT S.Sqlite m a -> m a
runSqlite conn = flip runReaderT conn
| 91 |
runSqlite conn = flip runReaderT conn
| 38 | false | true | 0 | 8 | 17 | 41 | 19 | 22 | null | null |
danr/hipspec
|
examples/old-examples/hip/Reverse.hs
|
gpl-3.0
|
(++) :: [a] -> [a] -> [a]
(x:xs) ++ ys = x:(xs ++ ys)
| 53 |
(++) :: [a] -> [a] -> [a]
(x:xs) ++ ys = x:(xs ++ ys)
| 53 |
(x:xs) ++ ys = x:(xs ++ ys)
| 27 | false | true | 2 | 11 | 13 | 61 | 31 | 30 | null | null |
anthezium/fractal_flame_renderer_haskell
|
FractalFlame/Histogram.hs
|
bsd-2-clause
|
writeColor vec ix (Color r g b a) = do
mapM_ (uncurry $ MV.unsafeWrite vec)
[(ix , r)
,(ix + 1, g)
,(ix + 2, b)
,(ix + 3, a)
]
return ()
-- | Iterate over vec as if it were a vector of FractalFlame.Types.Color
| 257 |
writeColor vec ix (Color r g b a) = do
mapM_ (uncurry $ MV.unsafeWrite vec)
[(ix , r)
,(ix + 1, g)
,(ix + 2, b)
,(ix + 3, a)
]
return ()
-- | Iterate over vec as if it were a vector of FractalFlame.Types.Color
| 257 |
writeColor vec ix (Color r g b a) = do
mapM_ (uncurry $ MV.unsafeWrite vec)
[(ix , r)
,(ix + 1, g)
,(ix + 2, b)
,(ix + 3, a)
]
return ()
-- | Iterate over vec as if it were a vector of FractalFlame.Types.Color
| 257 | false | false | 0 | 11 | 93 | 105 | 55 | 50 | null | null |
Undeterminant/config-home-gui
|
home/.xmonad/xmonad.hs
|
cc0-1.0
|
myKeyHome10 ProgDvorak = xK_hyphen
| 34 |
myKeyHome10 ProgDvorak = xK_hyphen
| 34 |
myKeyHome10 ProgDvorak = xK_hyphen
| 34 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
10sr/scheme_hs
|
main.hs
|
mit
|
showError (TypeMismatch expected found) = "Invalid type: expected " ++ expected
++ ", found " ++ show found
| 149 |
showError (TypeMismatch expected found) = "Invalid type: expected " ++ expected
++ ", found " ++ show found
| 149 |
showError (TypeMismatch expected found) = "Invalid type: expected " ++ expected
++ ", found " ++ show found
| 149 | false | false | 0 | 7 | 59 | 33 | 15 | 18 | null | null |
rumblesan/improviz
|
src/Gfx/TextRendering.hs
|
bsd-3-clause
|
renderCharacters :: Int -> Int -> TextRenderer -> String -> IO ()
renderCharacters xpos ypos renderer strings = do
GL.blend $= Enabled
GL.blendEquationSeparate $= (FuncAdd, FuncAdd)
GL.blendFuncSeparate $= ((SrcAlpha, OneMinusSrcAlpha), (One, Zero))
GL.depthFunc $= Nothing
GL.clearColor $= colToGLCol (Colour 0.0 0.0 0.0 0.0)
GL.clear [ColorBuffer]
let font = textFont renderer
foldM_
(\(xp, yp) c -> case c of
'\n' -> return (xpos, yp - fontHeight font)
'\t' -> renderCharacterSpace renderer (fontAdvance font) xp yp font
_ -> maybe (return (xp, yp - fontAdvance font))
(\c -> renderChar c xp yp font)
(getCharacter font c)
)
(xpos, ypos)
strings
where
renderChar char xp yp f = do
renderCharacterBGQuad renderer char xp yp f
renderCharacterTextQuad renderer char xp yp f
| 877 |
renderCharacters :: Int -> Int -> TextRenderer -> String -> IO ()
renderCharacters xpos ypos renderer strings = do
GL.blend $= Enabled
GL.blendEquationSeparate $= (FuncAdd, FuncAdd)
GL.blendFuncSeparate $= ((SrcAlpha, OneMinusSrcAlpha), (One, Zero))
GL.depthFunc $= Nothing
GL.clearColor $= colToGLCol (Colour 0.0 0.0 0.0 0.0)
GL.clear [ColorBuffer]
let font = textFont renderer
foldM_
(\(xp, yp) c -> case c of
'\n' -> return (xpos, yp - fontHeight font)
'\t' -> renderCharacterSpace renderer (fontAdvance font) xp yp font
_ -> maybe (return (xp, yp - fontAdvance font))
(\c -> renderChar c xp yp font)
(getCharacter font c)
)
(xpos, ypos)
strings
where
renderChar char xp yp f = do
renderCharacterBGQuad renderer char xp yp f
renderCharacterTextQuad renderer char xp yp f
| 877 |
renderCharacters xpos ypos renderer strings = do
GL.blend $= Enabled
GL.blendEquationSeparate $= (FuncAdd, FuncAdd)
GL.blendFuncSeparate $= ((SrcAlpha, OneMinusSrcAlpha), (One, Zero))
GL.depthFunc $= Nothing
GL.clearColor $= colToGLCol (Colour 0.0 0.0 0.0 0.0)
GL.clear [ColorBuffer]
let font = textFont renderer
foldM_
(\(xp, yp) c -> case c of
'\n' -> return (xpos, yp - fontHeight font)
'\t' -> renderCharacterSpace renderer (fontAdvance font) xp yp font
_ -> maybe (return (xp, yp - fontAdvance font))
(\c -> renderChar c xp yp font)
(getCharacter font c)
)
(xpos, ypos)
strings
where
renderChar char xp yp f = do
renderCharacterBGQuad renderer char xp yp f
renderCharacterTextQuad renderer char xp yp f
| 811 | false | true | 0 | 18 | 221 | 331 | 164 | 167 | null | null |
mzini/qlogic
|
Qlogic/ArcSat.hs
|
gpl-3.0
|
increment (Bound MinusInf) = Bound $ Fin 1
| 42 |
increment (Bound MinusInf) = Bound $ Fin 1
| 42 |
increment (Bound MinusInf) = Bound $ Fin 1
| 42 | false | false | 0 | 7 | 7 | 22 | 10 | 12 | null | null |
penguinland/nlp
|
Lexer.hs
|
gpl-3.0
|
wordToNodes "!" next = [Node ExclamationPoint [] next]
| 54 |
wordToNodes "!" next = [Node ExclamationPoint [] next]
| 54 |
wordToNodes "!" next = [Node ExclamationPoint [] next]
| 54 | false | false | 1 | 7 | 7 | 27 | 11 | 16 | null | null |
ml9951/ghc
|
compiler/nativeGen/X86/CodeGen.hs
|
bsd-3-clause
|
condIntCode' _ cond x y = do
dflags <- getDynFlags
(y_reg, y_code) <- getNonClobberedReg y
(x_op, x_code) <- getRegOrMem x
let
code = y_code `appOL`
x_code `snocOL`
CMP (cmmTypeFormat (cmmExprType dflags x)) (OpReg y_reg) x_op
return (CondCode False cond code)
--------------------------------------------------------------------------------
| 395 |
condIntCode' _ cond x y = do
dflags <- getDynFlags
(y_reg, y_code) <- getNonClobberedReg y
(x_op, x_code) <- getRegOrMem x
let
code = y_code `appOL`
x_code `snocOL`
CMP (cmmTypeFormat (cmmExprType dflags x)) (OpReg y_reg) x_op
return (CondCode False cond code)
--------------------------------------------------------------------------------
| 395 |
condIntCode' _ cond x y = do
dflags <- getDynFlags
(y_reg, y_code) <- getNonClobberedReg y
(x_op, x_code) <- getRegOrMem x
let
code = y_code `appOL`
x_code `snocOL`
CMP (cmmTypeFormat (cmmExprType dflags x)) (OpReg y_reg) x_op
return (CondCode False cond code)
--------------------------------------------------------------------------------
| 395 | false | false | 1 | 16 | 94 | 116 | 57 | 59 | null | null |
themoritz/cabal
|
cabal-testsuite/Test/Cabal/Prelude.hs
|
bsd-3-clause
|
-- | Assuming we've successfully configured a new-build project,
-- read out the plan metadata so that we can use it to do other
-- operations.
withPlan :: TestM a -> TestM a
withPlan m = do
env0 <- getTestEnv
Just plan <- JSON.decode `fmap`
liftIO (BSL.readFile (testDistDir env0 </> "cache" </> "plan.json"))
withReaderT (\env -> env { testPlan = Just plan }) m
-- | Run an executable from a package. Requires 'withPlan' to have
-- been run so that we can find the dist dir.
| 510 |
withPlan :: TestM a -> TestM a
withPlan m = do
env0 <- getTestEnv
Just plan <- JSON.decode `fmap`
liftIO (BSL.readFile (testDistDir env0 </> "cache" </> "plan.json"))
withReaderT (\env -> env { testPlan = Just plan }) m
-- | Run an executable from a package. Requires 'withPlan' to have
-- been run so that we can find the dist dir.
| 366 |
withPlan m = do
env0 <- getTestEnv
Just plan <- JSON.decode `fmap`
liftIO (BSL.readFile (testDistDir env0 </> "cache" </> "plan.json"))
withReaderT (\env -> env { testPlan = Just plan }) m
-- | Run an executable from a package. Requires 'withPlan' to have
-- been run so that we can find the dist dir.
| 335 | true | true | 0 | 15 | 120 | 106 | 54 | 52 | null | null |
alanz/htelehash
|
src/Network/TeleHash/Dht.hs
|
bsd-3-clause
|
insertIntoDht :: HashName -> TeleHash ()
insertIntoDht hn = do
(distance,bucket) <- getBucketContentsForHn hn
logR $ "insertIntoDht:inserting " ++ show (distance,hn)
sw <- get
put $ sw { swDht = Map.insert distance (Set.insert hn bucket) (swDht sw) }
-- ---------------------------------------------------------------------
| 332 |
insertIntoDht :: HashName -> TeleHash ()
insertIntoDht hn = do
(distance,bucket) <- getBucketContentsForHn hn
logR $ "insertIntoDht:inserting " ++ show (distance,hn)
sw <- get
put $ sw { swDht = Map.insert distance (Set.insert hn bucket) (swDht sw) }
-- ---------------------------------------------------------------------
| 332 |
insertIntoDht hn = do
(distance,bucket) <- getBucketContentsForHn hn
logR $ "insertIntoDht:inserting " ++ show (distance,hn)
sw <- get
put $ sw { swDht = Map.insert distance (Set.insert hn bucket) (swDht sw) }
-- ---------------------------------------------------------------------
| 291 | false | true | 0 | 13 | 48 | 107 | 53 | 54 | null | null |
twittner/zeromq-haskell
|
src/System/ZMQ4/Monadic.hs
|
mit
|
socket :: Z.SocketType t => t -> ZMQ z (Socket z t)
socket t = ZMQ $ do
c <- asks _context
s <- asks _sockets
x <- liftIO $ I.mkSocketRepr t c
liftIO $ atomicModifyIORef s $ \ss -> (x:ss, ())
return (Socket (I.Socket x))
| 240 |
socket :: Z.SocketType t => t -> ZMQ z (Socket z t)
socket t = ZMQ $ do
c <- asks _context
s <- asks _sockets
x <- liftIO $ I.mkSocketRepr t c
liftIO $ atomicModifyIORef s $ \ss -> (x:ss, ())
return (Socket (I.Socket x))
| 240 |
socket t = ZMQ $ do
c <- asks _context
s <- asks _sockets
x <- liftIO $ I.mkSocketRepr t c
liftIO $ atomicModifyIORef s $ \ss -> (x:ss, ())
return (Socket (I.Socket x))
| 188 | false | true | 2 | 13 | 65 | 139 | 63 | 76 | null | null |
esmolanka/sexp-grammar
|
sexp-grammar/src/Language/SexpGrammar/Base.hs
|
bsd-3-clause
|
-- | Property by a key grammar. Looks up an S-expression by a
-- specified key and runs a specified grammar on it. Expects the key
-- to be present.
--
-- Note: performs linear lookup, /O(n)/
key
:: Text
-> (forall t. Grammar Position (Sexp :- t) (a :- t))
-> Grammar Position (PropertyList :- t) (PropertyList :- a :- t)
key k g =
coerced (
Flip (insert k (expected $ ppKey k)) >>>
Step >>>
onHead (sealed g) >>>
swap)
| 443 |
key
:: Text
-> (forall t. Grammar Position (Sexp :- t) (a :- t))
-> Grammar Position (PropertyList :- t) (PropertyList :- a :- t)
key k g =
coerced (
Flip (insert k (expected $ ppKey k)) >>>
Step >>>
onHead (sealed g) >>>
swap)
| 251 |
key k g =
coerced (
Flip (insert k (expected $ ppKey k)) >>>
Step >>>
onHead (sealed g) >>>
swap)
| 115 | true | true | 0 | 15 | 106 | 135 | 70 | 65 | null | null |
agrafix/hackage-server
|
Distribution/Server/Framework/ResponseContentTypes.hs
|
bsd-3-clause
|
mkResponseLen :: BS.Lazy.ByteString -> Int -> [(String, String)] -> Response
mkResponseLen bs len headers = Response {
rsCode = 200,
rsHeaders = mkHeaders (("Content-Length", show len) : headers),
rsFlags = nullRsFlags { rsfLength = NoContentLength },
rsBody = bs,
rsValidator = Nothing
}
| 318 |
mkResponseLen :: BS.Lazy.ByteString -> Int -> [(String, String)] -> Response
mkResponseLen bs len headers = Response {
rsCode = 200,
rsHeaders = mkHeaders (("Content-Length", show len) : headers),
rsFlags = nullRsFlags { rsfLength = NoContentLength },
rsBody = bs,
rsValidator = Nothing
}
| 318 |
mkResponseLen bs len headers = Response {
rsCode = 200,
rsHeaders = mkHeaders (("Content-Length", show len) : headers),
rsFlags = nullRsFlags { rsfLength = NoContentLength },
rsBody = bs,
rsValidator = Nothing
}
| 241 | false | true | 0 | 12 | 72 | 107 | 60 | 47 | null | null |
tomahawkins/sls
|
SLS/Netlist.hs
|
bsd-3-clause
|
nets :: Netlist -> [Net]
nets (Netlist _ instances) = nub $ concatMap nets instances
where
nets a = case a of
PMOS a b c -> [a, b, c]
NMOS a b c -> [a, b, c]
Output _ a -> [a]
-- | All internal nets in a netlist.
| 229 |
nets :: Netlist -> [Net]
nets (Netlist _ instances) = nub $ concatMap nets instances
where
nets a = case a of
PMOS a b c -> [a, b, c]
NMOS a b c -> [a, b, c]
Output _ a -> [a]
-- | All internal nets in a netlist.
| 229 |
nets (Netlist _ instances) = nub $ concatMap nets instances
where
nets a = case a of
PMOS a b c -> [a, b, c]
NMOS a b c -> [a, b, c]
Output _ a -> [a]
-- | All internal nets in a netlist.
| 204 | false | true | 0 | 8 | 67 | 112 | 58 | 54 | null | null |
brendanhay/gogol
|
gogol-customsearch/gen/Network/Google/CustomSearch/Types/Product.hs
|
mpl-2.0
|
-- | Properties of the object.
rpAddtional :: Lens' ResultPagemap (HashMap Text JSONValue)
rpAddtional
= lens _rpAddtional (\ s a -> s{_rpAddtional = a}) .
_Coerce
| 171 |
rpAddtional :: Lens' ResultPagemap (HashMap Text JSONValue)
rpAddtional
= lens _rpAddtional (\ s a -> s{_rpAddtional = a}) .
_Coerce
| 140 |
rpAddtional
= lens _rpAddtional (\ s a -> s{_rpAddtional = a}) .
_Coerce
| 80 | true | true | 1 | 9 | 33 | 58 | 28 | 30 | null | null |
ctford/Idris-Elba-dev
|
src/Idris/Core/ProofState.hs
|
bsd-3-clause
|
rewrite _ _ _ _ = fail "Can't rewrite here"
| 43 |
rewrite _ _ _ _ = fail "Can't rewrite here"
| 43 |
rewrite _ _ _ _ = fail "Can't rewrite here"
| 43 | false | false | 1 | 5 | 9 | 18 | 7 | 11 | null | null |
phischu/fragnix
|
builtins/base/GHC.ExecutionStack.hs
|
bsd-3-clause
|
-- | Get a trace of the current execution stack state.
--
-- Returns @Nothing@ if stack trace support isn't available on host machine.
getStackTrace :: IO (Maybe [Location])
getStackTrace = (join . fmap stackFrames) `fmap` collectStackTrace
| 240 |
getStackTrace :: IO (Maybe [Location])
getStackTrace = (join . fmap stackFrames) `fmap` collectStackTrace
| 105 |
getStackTrace = (join . fmap stackFrames) `fmap` collectStackTrace
| 66 | true | true | 0 | 9 | 36 | 48 | 25 | 23 | null | null |
sviperll/LambdaInterpreter
|
src/Lambda/Common.hs
|
gpl-3.0
|
subst _ _ i@(Term C) = i
| 24 |
subst _ _ i@(Term C) = i
| 24 |
subst _ _ i@(Term C) = i
| 24 | false | false | 0 | 8 | 6 | 22 | 11 | 11 | null | null |
brendanhay/gogol
|
gogol-dialogflow/gen/Network/Google/Resource/DialogFlow/Projects/Locations/Agents/Intents/Get.hs
|
mpl-2.0
|
-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
plaigUploadType :: Lens' ProjectsLocationsAgentsIntentsGet (Maybe Text)
plaigUploadType
= lens _plaigUploadType
(\ s a -> s{_plaigUploadType = a})
| 225 |
plaigUploadType :: Lens' ProjectsLocationsAgentsIntentsGet (Maybe Text)
plaigUploadType
= lens _plaigUploadType
(\ s a -> s{_plaigUploadType = a})
| 154 |
plaigUploadType
= lens _plaigUploadType
(\ s a -> s{_plaigUploadType = a})
| 82 | true | true | 0 | 8 | 34 | 49 | 25 | 24 | null | null |
BarrelfishOS/barrelfish
|
tools/sockeye/SockeyeBackendPrologMultiDim.hs
|
mit
|
cal_inst_name :: String -> String
local_inst_name x = "ID_" ++ x
| 67 |
local_inst_name :: String -> String
local_inst_name x = "ID_" ++ x
| 66 |
local_inst_name x = "ID_" ++ x
| 30 | false | true | 0 | 7 | 13 | 27 | 12 | 15 | null | null |
ekohl/ganeti
|
htools/Ganeti/HTools/QC.hs
|
gpl-2.0
|
-- | Create an instance given its spec
createInstance mem dsk vcpus =
Instance.create "inst-unnamed" mem dsk vcpus "running" [] True (-1) (-1)
| 146 |
createInstance mem dsk vcpus =
Instance.create "inst-unnamed" mem dsk vcpus "running" [] True (-1) (-1)
| 107 |
createInstance mem dsk vcpus =
Instance.create "inst-unnamed" mem dsk vcpus "running" [] True (-1) (-1)
| 107 | true | false | 0 | 7 | 26 | 47 | 24 | 23 | null | null |
yuto-matsum/googlecodejam2016-hs
|
src/2010africa/B.hs
|
bsd-3-clause
|
main :: IO ()
main = interact io
| 32 |
main :: IO ()
main = interact io
| 32 |
main = interact io
| 18 | false | true | 0 | 6 | 7 | 19 | 9 | 10 | null | null |
zachsully/hakaru
|
haskell/Language/Hakaru/Pretty/Maple.hs
|
bsd-3-clause
|
maplePDatumCode :: PDatumCode xss vars a -> State [String] ShowS
maplePDatumCode (PInr pat) = op1 "PInr" <$> maplePDatumCode pat
| 128 |
maplePDatumCode :: PDatumCode xss vars a -> State [String] ShowS
maplePDatumCode (PInr pat) = op1 "PInr" <$> maplePDatumCode pat
| 128 |
maplePDatumCode (PInr pat) = op1 "PInr" <$> maplePDatumCode pat
| 63 | false | true | 0 | 7 | 18 | 49 | 23 | 26 | null | null |
DavidAlphaFox/darcs
|
hashed-storage/Storage/Hashed/Tree.hs
|
gpl-2.0
|
itemType :: TreeItem m -> ItemType
itemType (File _) = BlobType
| 63 |
itemType :: TreeItem m -> ItemType
itemType (File _) = BlobType
| 63 |
itemType (File _) = BlobType
| 28 | false | true | 0 | 9 | 10 | 33 | 14 | 19 | null | null |
jwiegley/ghc-release
|
utils/haddock/src/Haddock/Parser.hs
|
gpl-3.0
|
header :: DynFlags -> Parser (Doc RdrName)
header d = do
let psers = map (string . encodeUtf8 . concat . flip replicate "=") [6, 5 .. 1]
pser = foldl1 (<|>) psers
delim <- decodeUtf8 <$> pser
line <- skipHorizontalSpace *> nonEmptyLine >>= return . parseString d
rest <- paragraph d <|> return mempty
return $ docAppend (DocParagraph (DocHeader (Header (length delim) line))) rest
| 396 |
header :: DynFlags -> Parser (Doc RdrName)
header d = do
let psers = map (string . encodeUtf8 . concat . flip replicate "=") [6, 5 .. 1]
pser = foldl1 (<|>) psers
delim <- decodeUtf8 <$> pser
line <- skipHorizontalSpace *> nonEmptyLine >>= return . parseString d
rest <- paragraph d <|> return mempty
return $ docAppend (DocParagraph (DocHeader (Header (length delim) line))) rest
| 396 |
header d = do
let psers = map (string . encodeUtf8 . concat . flip replicate "=") [6, 5 .. 1]
pser = foldl1 (<|>) psers
delim <- decodeUtf8 <$> pser
line <- skipHorizontalSpace *> nonEmptyLine >>= return . parseString d
rest <- paragraph d <|> return mempty
return $ docAppend (DocParagraph (DocHeader (Header (length delim) line))) rest
| 353 | false | true | 0 | 16 | 80 | 170 | 82 | 88 | null | null |
ekmett/wxHaskell
|
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
|
lgpl-2.1
|
wxPAPER_B_PLUS :: Int
wxPAPER_B_PLUS = 56
| 41 |
wxPAPER_B_PLUS :: Int
wxPAPER_B_PLUS = 56
| 41 |
wxPAPER_B_PLUS = 56
| 19 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
saniac/Workouts
|
workout.hs
|
gpl-2.0
|
message goal workouts weights = show (workoutCycle g wo wg)
where g = read goal :: Float
wo = read workouts :: Float
wg = map read (words weights)::[Float]
| 181 |
message goal workouts weights = show (workoutCycle g wo wg)
where g = read goal :: Float
wo = read workouts :: Float
wg = map read (words weights)::[Float]
| 181 |
message goal workouts weights = show (workoutCycle g wo wg)
where g = read goal :: Float
wo = read workouts :: Float
wg = map read (words weights)::[Float]
| 181 | false | false | 5 | 7 | 54 | 75 | 37 | 38 | null | null |
mariefarrell/Hets
|
glade-0.12.5.0/demo/scaling/Scaling.hs
|
gpl-2.0
|
loadImageDlg canvas window (State pb is) = do
putStrLn ("loadImage")
ret <- openFileDialog window
case ret of
Just (filename) -> (loadImage canvas window filename (State pb is))
Nothing -> return (State pb is)
| 223 |
loadImageDlg canvas window (State pb is) = do
putStrLn ("loadImage")
ret <- openFileDialog window
case ret of
Just (filename) -> (loadImage canvas window filename (State pb is))
Nothing -> return (State pb is)
| 223 |
loadImageDlg canvas window (State pb is) = do
putStrLn ("loadImage")
ret <- openFileDialog window
case ret of
Just (filename) -> (loadImage canvas window filename (State pb is))
Nothing -> return (State pb is)
| 223 | false | false | 0 | 13 | 46 | 96 | 45 | 51 | null | null |
pyr/apotiki
|
System/Apotiki/Utils.hs
|
isc
|
-- inspired by MissingH
wschars :: String
wschars = " \t\r\n"
| 62 |
wschars :: String
wschars = " \t\r\n"
| 37 |
wschars = " \t\r\n"
| 19 | true | true | 0 | 4 | 11 | 12 | 7 | 5 | null | null |
lenary/idris-erlang
|
src/IRTS/CodegenErlang/Foreign.hs
|
bsd-3-clause
|
fdesc_to_erlt Erl_Int = EInt
| 29 |
fdesc_to_erlt Erl_Int = EInt
| 29 |
fdesc_to_erlt Erl_Int = EInt
| 29 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
PaulGustafson/stringnet
|
OldTY.hs
|
mit
|
funToMorphism :: Object -> Object -> (SimpleObject -> M.Matrix Scalar) -> Morphism
funToMorphism o1 o2 f = Morphism o1 o2 (map f allSimpleObjects)
| 146 |
funToMorphism :: Object -> Object -> (SimpleObject -> M.Matrix Scalar) -> Morphism
funToMorphism o1 o2 f = Morphism o1 o2 (map f allSimpleObjects)
| 146 |
funToMorphism o1 o2 f = Morphism o1 o2 (map f allSimpleObjects)
| 63 | false | true | 0 | 11 | 22 | 57 | 28 | 29 | null | null |
trskop/command-wrapper
|
command-wrapper-core/src/CommandWrapper/Core/Message.hs
|
bsd-3-clause
|
warningDoc
:: (forall ann. Pretty.Doc ann)
-> Pretty.Doc (Warning Pretty.AnsiStyle)
warningDoc = Pretty.annotate $ Warning (Pretty.color Pretty.Yellow)
| 159 |
warningDoc
:: (forall ann. Pretty.Doc ann)
-> Pretty.Doc (Warning Pretty.AnsiStyle)
warningDoc = Pretty.annotate $ Warning (Pretty.color Pretty.Yellow)
| 159 |
warningDoc = Pretty.annotate $ Warning (Pretty.color Pretty.Yellow)
| 67 | false | true | 0 | 10 | 24 | 65 | 31 | 34 | null | null |
eigengrau/hlint
|
data/Default.hs
|
bsd-3-clause
|
warn = (f `on` g) `on` h ==> f `on` (g . h)
| 44 |
warn = (f `on` g) `on` h ==> f `on` (g . h)
| 44 |
warn = (f `on` g) `on` h ==> f `on` (g . h)
| 44 | false | false | 1 | 9 | 13 | 42 | 23 | 19 | null | null |
phaazon/ghc-mod
|
Language/Haskell/GhcMod/Browse.hs
|
bsd-3-clause
|
showThing :: DynFlags -> TyThing -> Maybe String
showThing dflag tything = showThing' dflag (fromTyThing tything)
| 113 |
showThing :: DynFlags -> TyThing -> Maybe String
showThing dflag tything = showThing' dflag (fromTyThing tything)
| 113 |
showThing dflag tything = showThing' dflag (fromTyThing tything)
| 64 | false | true | 0 | 7 | 15 | 38 | 18 | 20 | null | null |
nushio3/ghc
|
ghc/Main.hs
|
bsd-3-clause
|
checkOptions :: PostLoadMode -> DynFlags -> [(String,Maybe Phase)] -> [String] -> IO ()
-- Final sanity checking before kicking off a compilation (pipeline).
checkOptions mode dflags srcs objs = do
-- Complain about any unknown flags
let unknown_opts = [ f | (f@('-':_), _) <- srcs ]
when (notNull unknown_opts) (unknownFlagsErr unknown_opts)
when (notNull (filter wayRTSOnly (ways dflags))
&& isInterpretiveMode mode) $
hPutStrLn stderr ("Warning: -debug, -threaded and -ticky are ignored by GHCi")
-- -prof and --interactive are not a good combination
when ((filter (not . wayRTSOnly) (ways dflags) /= interpWays)
&& isInterpretiveMode mode
&& not (gopt Opt_ExternalInterpreter dflags)) $
do throwGhcException (UsageError
"-fexternal-interpreter is required when using --interactive with a non-standard way (-prof, -static, or -dynamic).")
-- -ohi sanity check
if (isJust (outputHi dflags) &&
(isCompManagerMode mode || srcs `lengthExceeds` 1))
then throwGhcException (UsageError "-ohi can only be used when compiling a single source file")
else do
-- -o sanity checking
if (srcs `lengthExceeds` 1 && isJust (outputFile dflags)
&& not (isLinkMode mode))
then throwGhcException (UsageError "can't apply -o to multiple source files")
else do
let not_linking = not (isLinkMode mode) || isNoLink (ghcLink dflags)
when (not_linking && not (null objs)) $
hPutStrLn stderr ("Warning: the following files would be used as linker inputs, but linking is not being done: " ++ unwords objs)
-- Check that there are some input files
-- (except in the interactive case)
if null srcs && (null objs || not_linking) && needsInputsMode mode
then throwGhcException (UsageError "no input files")
else do
case mode of
StopBefore HCc | hscTarget dflags /= HscC
-> throwGhcException $ UsageError $
"the option -C is only available with an unregisterised GHC"
_ -> return ()
-- Verify that output files point somewhere sensible.
verifyOutputFiles dflags
-- Compiler output options
-- Called to verify that the output files point somewhere valid.
--
-- The assumption is that the directory portion of these output
-- options will have to exist by the time 'verifyOutputFiles'
-- is invoked.
--
-- We create the directories for -odir, -hidir, -outputdir etc. ourselves if
-- they don't exist, so don't check for those here (#2278).
| 2,562 |
checkOptions :: PostLoadMode -> DynFlags -> [(String,Maybe Phase)] -> [String] -> IO ()
checkOptions mode dflags srcs objs = do
-- Complain about any unknown flags
let unknown_opts = [ f | (f@('-':_), _) <- srcs ]
when (notNull unknown_opts) (unknownFlagsErr unknown_opts)
when (notNull (filter wayRTSOnly (ways dflags))
&& isInterpretiveMode mode) $
hPutStrLn stderr ("Warning: -debug, -threaded and -ticky are ignored by GHCi")
-- -prof and --interactive are not a good combination
when ((filter (not . wayRTSOnly) (ways dflags) /= interpWays)
&& isInterpretiveMode mode
&& not (gopt Opt_ExternalInterpreter dflags)) $
do throwGhcException (UsageError
"-fexternal-interpreter is required when using --interactive with a non-standard way (-prof, -static, or -dynamic).")
-- -ohi sanity check
if (isJust (outputHi dflags) &&
(isCompManagerMode mode || srcs `lengthExceeds` 1))
then throwGhcException (UsageError "-ohi can only be used when compiling a single source file")
else do
-- -o sanity checking
if (srcs `lengthExceeds` 1 && isJust (outputFile dflags)
&& not (isLinkMode mode))
then throwGhcException (UsageError "can't apply -o to multiple source files")
else do
let not_linking = not (isLinkMode mode) || isNoLink (ghcLink dflags)
when (not_linking && not (null objs)) $
hPutStrLn stderr ("Warning: the following files would be used as linker inputs, but linking is not being done: " ++ unwords objs)
-- Check that there are some input files
-- (except in the interactive case)
if null srcs && (null objs || not_linking) && needsInputsMode mode
then throwGhcException (UsageError "no input files")
else do
case mode of
StopBefore HCc | hscTarget dflags /= HscC
-> throwGhcException $ UsageError $
"the option -C is only available with an unregisterised GHC"
_ -> return ()
-- Verify that output files point somewhere sensible.
verifyOutputFiles dflags
-- Compiler output options
-- Called to verify that the output files point somewhere valid.
--
-- The assumption is that the directory portion of these output
-- options will have to exist by the time 'verifyOutputFiles'
-- is invoked.
--
-- We create the directories for -odir, -hidir, -outputdir etc. ourselves if
-- they don't exist, so don't check for those here (#2278).
| 2,487 |
checkOptions mode dflags srcs objs = do
-- Complain about any unknown flags
let unknown_opts = [ f | (f@('-':_), _) <- srcs ]
when (notNull unknown_opts) (unknownFlagsErr unknown_opts)
when (notNull (filter wayRTSOnly (ways dflags))
&& isInterpretiveMode mode) $
hPutStrLn stderr ("Warning: -debug, -threaded and -ticky are ignored by GHCi")
-- -prof and --interactive are not a good combination
when ((filter (not . wayRTSOnly) (ways dflags) /= interpWays)
&& isInterpretiveMode mode
&& not (gopt Opt_ExternalInterpreter dflags)) $
do throwGhcException (UsageError
"-fexternal-interpreter is required when using --interactive with a non-standard way (-prof, -static, or -dynamic).")
-- -ohi sanity check
if (isJust (outputHi dflags) &&
(isCompManagerMode mode || srcs `lengthExceeds` 1))
then throwGhcException (UsageError "-ohi can only be used when compiling a single source file")
else do
-- -o sanity checking
if (srcs `lengthExceeds` 1 && isJust (outputFile dflags)
&& not (isLinkMode mode))
then throwGhcException (UsageError "can't apply -o to multiple source files")
else do
let not_linking = not (isLinkMode mode) || isNoLink (ghcLink dflags)
when (not_linking && not (null objs)) $
hPutStrLn stderr ("Warning: the following files would be used as linker inputs, but linking is not being done: " ++ unwords objs)
-- Check that there are some input files
-- (except in the interactive case)
if null srcs && (null objs || not_linking) && needsInputsMode mode
then throwGhcException (UsageError "no input files")
else do
case mode of
StopBefore HCc | hscTarget dflags /= HscC
-> throwGhcException $ UsageError $
"the option -C is only available with an unregisterised GHC"
_ -> return ()
-- Verify that output files point somewhere sensible.
verifyOutputFiles dflags
-- Compiler output options
-- Called to verify that the output files point somewhere valid.
--
-- The assumption is that the directory portion of these output
-- options will have to exist by the time 'verifyOutputFiles'
-- is invoked.
--
-- We create the directories for -odir, -hidir, -outputdir etc. ourselves if
-- they don't exist, so don't check for those here (#2278).
| 2,399 | true | true | 0 | 23 | 605 | 523 | 262 | 261 | null | null |
4ZP6Capstone2015/ampersand
|
src/Database/Design/Ampersand/Prototype/ObjBinGen.hs
|
gpl-3.0
|
generatePhp :: FSpec -> IO()
generatePhp fSpec =
do { verboseLn (getOpts fSpec) "---------------------------"
; verboseLn (getOpts fSpec) "Generating php Object files with Ampersand"
; verboseLn (getOpts fSpec) "---------------------------"
; writePrototypeFile fSpec "InstallerDBstruct.php" (installerDBstruct fSpec)
-- ; writePrototypeFile fSpec "InstallerTriggers.php" (installerTriggers fSpec)
; writePrototypeFile fSpec "InstallerDefPop.php" (installerDefPop fSpec)
; let dbSettingsFilePath = getGenericsDir fSpec </> "dbSettings.php"
; dbSettingsExists <- doesFileExist dbSettingsFilePath
-- we generate a dbSettings.php only if it does not exist already.
; if dbSettingsExists
then verboseLn (getOpts fSpec) " Using existing dbSettings.php."
else do { verboseLn (getOpts fSpec) " Writing dbSettings.php."
; writePrototypeFile fSpec dbSettingsFilePath dbsettings
}
}
where
dbsettings = unlines $
[ "<?php"
, ""
, "global $DB_host,$DB_user,$DB_pass;"
, "$DB_host='"++addSlashes (sqlHost (getOpts fSpec))++"';"
, "$DB_user='"++addSlashes (sqlLogin (getOpts fSpec))++"';"
, "$DB_pass='"++addSlashes (sqlPwd (getOpts fSpec))++"';"
, ""
, "$DB_link=mysqli_connect($DB_host, $DB_user, $DB_pass)"
, " or exit(\"Error connecting to the database: username / password are probably incorrect.\");"
, ""
]++setSqlModePHP++
[ "?>"
]
| 1,525 |
generatePhp :: FSpec -> IO()
generatePhp fSpec =
do { verboseLn (getOpts fSpec) "---------------------------"
; verboseLn (getOpts fSpec) "Generating php Object files with Ampersand"
; verboseLn (getOpts fSpec) "---------------------------"
; writePrototypeFile fSpec "InstallerDBstruct.php" (installerDBstruct fSpec)
-- ; writePrototypeFile fSpec "InstallerTriggers.php" (installerTriggers fSpec)
; writePrototypeFile fSpec "InstallerDefPop.php" (installerDefPop fSpec)
; let dbSettingsFilePath = getGenericsDir fSpec </> "dbSettings.php"
; dbSettingsExists <- doesFileExist dbSettingsFilePath
-- we generate a dbSettings.php only if it does not exist already.
; if dbSettingsExists
then verboseLn (getOpts fSpec) " Using existing dbSettings.php."
else do { verboseLn (getOpts fSpec) " Writing dbSettings.php."
; writePrototypeFile fSpec dbSettingsFilePath dbsettings
}
}
where
dbsettings = unlines $
[ "<?php"
, ""
, "global $DB_host,$DB_user,$DB_pass;"
, "$DB_host='"++addSlashes (sqlHost (getOpts fSpec))++"';"
, "$DB_user='"++addSlashes (sqlLogin (getOpts fSpec))++"';"
, "$DB_pass='"++addSlashes (sqlPwd (getOpts fSpec))++"';"
, ""
, "$DB_link=mysqli_connect($DB_host, $DB_user, $DB_pass)"
, " or exit(\"Error connecting to the database: username / password are probably incorrect.\");"
, ""
]++setSqlModePHP++
[ "?>"
]
| 1,525 |
generatePhp fSpec =
do { verboseLn (getOpts fSpec) "---------------------------"
; verboseLn (getOpts fSpec) "Generating php Object files with Ampersand"
; verboseLn (getOpts fSpec) "---------------------------"
; writePrototypeFile fSpec "InstallerDBstruct.php" (installerDBstruct fSpec)
-- ; writePrototypeFile fSpec "InstallerTriggers.php" (installerTriggers fSpec)
; writePrototypeFile fSpec "InstallerDefPop.php" (installerDefPop fSpec)
; let dbSettingsFilePath = getGenericsDir fSpec </> "dbSettings.php"
; dbSettingsExists <- doesFileExist dbSettingsFilePath
-- we generate a dbSettings.php only if it does not exist already.
; if dbSettingsExists
then verboseLn (getOpts fSpec) " Using existing dbSettings.php."
else do { verboseLn (getOpts fSpec) " Writing dbSettings.php."
; writePrototypeFile fSpec dbSettingsFilePath dbsettings
}
}
where
dbsettings = unlines $
[ "<?php"
, ""
, "global $DB_host,$DB_user,$DB_pass;"
, "$DB_host='"++addSlashes (sqlHost (getOpts fSpec))++"';"
, "$DB_user='"++addSlashes (sqlLogin (getOpts fSpec))++"';"
, "$DB_pass='"++addSlashes (sqlPwd (getOpts fSpec))++"';"
, ""
, "$DB_link=mysqli_connect($DB_host, $DB_user, $DB_pass)"
, " or exit(\"Error connecting to the database: username / password are probably incorrect.\");"
, ""
]++setSqlModePHP++
[ "?>"
]
| 1,496 | false | true | 2 | 14 | 352 | 310 | 155 | 155 | null | null |
lukexi/animation-pal
|
test/Random.hs
|
bsd-3-clause
|
randomPosition :: MonadIO m => m (V3 GLfloat)
randomPosition = V3
<$> randomRIO' (-10, 10)
<*> randomRIO' (-10, 10)
<*> randomRIO' (-10, 10)
| 152 |
randomPosition :: MonadIO m => m (V3 GLfloat)
randomPosition = V3
<$> randomRIO' (-10, 10)
<*> randomRIO' (-10, 10)
<*> randomRIO' (-10, 10)
| 152 |
randomPosition = V3
<$> randomRIO' (-10, 10)
<*> randomRIO' (-10, 10)
<*> randomRIO' (-10, 10)
| 106 | false | true | 8 | 8 | 34 | 79 | 41 | 38 | null | null |
dsorokin/aivika-experiment-chart
|
examples/InspectionAdjustmentStations/Experiment.hs
|
bsd-3-clause
|
inspectionWaitTime = T.tr $ T.queueWaitTime inspectionQueue
| 66 |
inspectionWaitTime = T.tr $ T.queueWaitTime inspectionQueue
| 66 |
inspectionWaitTime = T.tr $ T.queueWaitTime inspectionQueue
| 66 | false | false | 3 | 6 | 12 | 21 | 8 | 13 | null | null |
dolio/vector
|
Data/Vector/Fusion/Bundle/Monadic.hs
|
bsd-3-clause
|
zipWith6M fn sa sb sc sd se sf
= zipWithM (\(a,b,c) (d,e,f) -> fn a b c d e f) (zip3 sa sb sc)
(zip3 sd se sf)
| 162 |
zipWith6M fn sa sb sc sd se sf
= zipWithM (\(a,b,c) (d,e,f) -> fn a b c d e f) (zip3 sa sb sc)
(zip3 sd se sf)
| 162 |
zipWith6M fn sa sb sc sd se sf
= zipWithM (\(a,b,c) (d,e,f) -> fn a b c d e f) (zip3 sa sb sc)
(zip3 sd se sf)
| 162 | false | false | 0 | 8 | 79 | 94 | 47 | 47 | null | null |
bjpop/blip
|
blipinterpreter/src/Blip/Interpreter/HashTable/CacheLine.hs
|
bsd-3-clause
|
lineSearch2 :: IntArray -> Int -> Elem -> Elem -> IO Int
lineSearch2 !vec !start !x1 !x2 =
-- liftM fromEnum $! unsafeIOToST c
liftM fromEnum $! c
where
c = c_lineSearch_2 (M.toPtr vec) (fI start) (fI x1) (fI x2)
| 229 |
lineSearch2 :: IntArray -> Int -> Elem -> Elem -> IO Int
lineSearch2 !vec !start !x1 !x2 =
-- liftM fromEnum $! unsafeIOToST c
liftM fromEnum $! c
where
c = c_lineSearch_2 (M.toPtr vec) (fI start) (fI x1) (fI x2)
| 229 |
lineSearch2 !vec !start !x1 !x2 =
-- liftM fromEnum $! unsafeIOToST c
liftM fromEnum $! c
where
c = c_lineSearch_2 (M.toPtr vec) (fI start) (fI x1) (fI x2)
| 172 | false | true | 3 | 13 | 56 | 107 | 49 | 58 | null | null |
kawu/factorized-tag-parser
|
src/NLP/Partage/Earley/AutoAP.hs
|
bsd-2-clause
|
parseAuto
:: (SOrd t, SOrd n)
=> Auto n t -- ^ Grammar automaton
-> S.Set n -- ^ The start symbol set
-> Input t -- ^ Input sentence
-> IO [T.Tree n (Maybe t)]
parseAuto auto start input = do
earSt <- earleyAuto auto input
let n = V.length (inputSent input)
return $ parsedTrees earSt start n
-- | See `earley`.
| 377 |
parseAuto
:: (SOrd t, SOrd n)
=> Auto n t -- ^ Grammar automaton
-> S.Set n -- ^ The start symbol set
-> Input t -- ^ Input sentence
-> IO [T.Tree n (Maybe t)]
parseAuto auto start input = do
earSt <- earleyAuto auto input
let n = V.length (inputSent input)
return $ parsedTrees earSt start n
-- | See `earley`.
| 377 |
parseAuto auto start input = do
earSt <- earleyAuto auto input
let n = V.length (inputSent input)
return $ parsedTrees earSt start n
-- | See `earley`.
| 165 | false | true | 0 | 14 | 128 | 132 | 62 | 70 | null | null |
snoyberg/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
mkPolyTyConAppName = varQual tYPEABLE_INTERNAL (fsLit "mkPolyTyConApp") mkPolyTyConAppKey
| 92 |
mkPolyTyConAppName = varQual tYPEABLE_INTERNAL (fsLit "mkPolyTyConApp") mkPolyTyConAppKey
| 92 |
mkPolyTyConAppName = varQual tYPEABLE_INTERNAL (fsLit "mkPolyTyConApp") mkPolyTyConAppKey
| 92 | false | false | 0 | 7 | 9 | 19 | 9 | 10 | null | null |
ryna4c2e/chage
|
InstParser.hs
|
mit
|
parseProgram :: Parser Program
parseProgram = do
maybeList <- sepBy1 parseLine newline
blanks
eof
return $ Program $ catMaybes maybeList
| 144 |
parseProgram :: Parser Program
parseProgram = do
maybeList <- sepBy1 parseLine newline
blanks
eof
return $ Program $ catMaybes maybeList
| 144 |
parseProgram = do
maybeList <- sepBy1 parseLine newline
blanks
eof
return $ Program $ catMaybes maybeList
| 113 | false | true | 0 | 8 | 27 | 46 | 20 | 26 | null | null |
avieth/frappe
|
Reactive/Frappe.hs
|
bsd-3-clause
|
reactive :: (forall a . Event a r (Compose f (React a)) t) -> Reactive r f t
reactive = Reactive
| 96 |
reactive :: (forall a . Event a r (Compose f (React a)) t) -> Reactive r f t
reactive = Reactive
| 96 |
reactive = Reactive
| 19 | false | true | 0 | 12 | 20 | 53 | 27 | 26 | null | null |
Palmik/data-store
|
src/Data/Store.hs
|
bsd-3-clause
|
-- | The expression (@'Data.Store.fromList'' kes@) is @store@
-- containing the given key-element pairs (colliding pairs are not included).
--
-- See also:
--
-- * 'Data.Store.fromList'
--
-- * 'Data.Store.insertList''
--
-- * 'Data.Store.insertList'
fromList' :: I.Empty (I.Index irs ts) => [(I.Key krs ts, v)] -> I.Store tag krs irs ts v
fromList' = insertList' I.empty
| 371 |
fromList' :: I.Empty (I.Index irs ts) => [(I.Key krs ts, v)] -> I.Store tag krs irs ts v
fromList' = insertList' I.empty
| 120 |
fromList' = insertList' I.empty
| 31 | true | true | 0 | 11 | 56 | 83 | 45 | 38 | null | null |
AndyShiue/ende
|
frontend/src/Parsing.hs
|
lgpl-3.0
|
if_clause :: Parser (TaggedTerm Position)
if_clause = do
start <- getWordPair
symbol "if" <?> "if"
cond <- expr
symbol "then" <?> "then"
thenPart <- expr
symbol "else" <?> "else"
elsePart <- expr
let pos = Position start (endPos $ getTag elsePart)
return $ If pos cond thenPart elsePart
| 304 |
if_clause :: Parser (TaggedTerm Position)
if_clause = do
start <- getWordPair
symbol "if" <?> "if"
cond <- expr
symbol "then" <?> "then"
thenPart <- expr
symbol "else" <?> "else"
elsePart <- expr
let pos = Position start (endPos $ getTag elsePart)
return $ If pos cond thenPart elsePart
| 304 |
if_clause = do
start <- getWordPair
symbol "if" <?> "if"
cond <- expr
symbol "then" <?> "then"
thenPart <- expr
symbol "else" <?> "else"
elsePart <- expr
let pos = Position start (endPos $ getTag elsePart)
return $ If pos cond thenPart elsePart
| 262 | false | true | 2 | 14 | 65 | 125 | 52 | 73 | null | null |
colinba/tip-toi-reveng
|
src/GMERun.hs
|
mit
|
completeFromList :: Monad m => [[Char]] -> CompletionFunc m
completeFromList xs = completeWord Nothing " " $ \p -> return
[simpleCompletion x | x <- xs, p `isPrefixOf` x ]
| 183 |
completeFromList :: Monad m => [[Char]] -> CompletionFunc m
completeFromList xs = completeWord Nothing " " $ \p -> return
[simpleCompletion x | x <- xs, p `isPrefixOf` x ]
| 183 |
completeFromList xs = completeWord Nothing " " $ \p -> return
[simpleCompletion x | x <- xs, p `isPrefixOf` x ]
| 123 | false | true | 0 | 9 | 41 | 80 | 39 | 41 | null | null |
mrakgr/futhark
|
src/Futhark/Transform/Rename.hs
|
bsd-3-clause
|
-- | Rename bound variables such that each is unique. The semantics
-- of the expression is unaffected, under the assumption that the
-- expression was correct to begin with. Any free variables are left
-- untouched.
renameExp :: (Renameable lore, MonadFreshNames m) =>
Exp lore -> m (Exp lore)
renameExp = modifyNameSource . runRenamer . rename
| 360 |
renameExp :: (Renameable lore, MonadFreshNames m) =>
Exp lore -> m (Exp lore)
renameExp = modifyNameSource . runRenamer . rename
| 141 |
renameExp = modifyNameSource . runRenamer . rename
| 50 | true | true | 0 | 9 | 71 | 54 | 29 | 25 | null | null |
frontrowed/stratosphere
|
library-gen/Stratosphere/ResourceProperties/EC2InstanceAssociationParameter.hs
|
mit
|
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-ssmassociations-associationparameters.html#cfn-ec2-instance-ssmassociations-associationparameters-value
eciapValue :: Lens' EC2InstanceAssociationParameter (ValList Text)
eciapValue = lens _eC2InstanceAssociationParameterValue (\s a -> s { _eC2InstanceAssociationParameterValue = a })
| 379 |
eciapValue :: Lens' EC2InstanceAssociationParameter (ValList Text)
eciapValue = lens _eC2InstanceAssociationParameterValue (\s a -> s { _eC2InstanceAssociationParameterValue = a })
| 180 |
eciapValue = lens _eC2InstanceAssociationParameterValue (\s a -> s { _eC2InstanceAssociationParameterValue = a })
| 113 | true | true | 0 | 9 | 21 | 46 | 25 | 21 | null | null |
DougBurke/swish
|
tests/N3FormatterTest.hs
|
lgpl-2.1
|
p25 = Res $ makeNSScopedName base2 "p25"
| 40 |
p25 = Res $ makeNSScopedName base2 "p25"
| 40 |
p25 = Res $ makeNSScopedName base2 "p25"
| 40 | false | false | 1 | 6 | 6 | 18 | 7 | 11 | null | null |
osa1/criterion
|
Criterion/Main/Options.hs
|
bsd-2-clause
|
describe :: Config -> ParserInfo Mode
describe cfg = info (helper <*> parseWith cfg) $
header ("Microbenchmark suite - " <> versionInfo) <>
fullDesc <>
footerDoc (unChunk regressionHelp)
| 198 |
describe :: Config -> ParserInfo Mode
describe cfg = info (helper <*> parseWith cfg) $
header ("Microbenchmark suite - " <> versionInfo) <>
fullDesc <>
footerDoc (unChunk regressionHelp)
| 198 |
describe cfg = info (helper <*> parseWith cfg) $
header ("Microbenchmark suite - " <> versionInfo) <>
fullDesc <>
footerDoc (unChunk regressionHelp)
| 160 | false | true | 2 | 8 | 39 | 71 | 32 | 39 | null | null |
haskell/haddock
|
haddock-api/src/Haddock/Backends/Hyperlinker/Renderer.hs
|
bsd-2-clause
|
filterCRLF :: String -> String
filterCRLF ('\r':'\n':cs) = '\n' : filterCRLF cs
| 79 |
filterCRLF :: String -> String
filterCRLF ('\r':'\n':cs) = '\n' : filterCRLF cs
| 79 |
filterCRLF ('\r':'\n':cs) = '\n' : filterCRLF cs
| 48 | false | true | 0 | 7 | 11 | 32 | 16 | 16 | null | null |
nevrenato/Hets_Fork
|
OWL2/AS.hs
|
gpl-2.0
|
nullQName :: QName
nullQName = QN "" "" Abbreviated "" nullRange
| 64 |
nullQName :: QName
nullQName = QN "" "" Abbreviated "" nullRange
| 64 |
nullQName = QN "" "" Abbreviated "" nullRange
| 45 | false | true | 0 | 6 | 10 | 28 | 12 | 16 | null | null |
mapinguari/SC_HS_Proxy
|
src/Proxy/Query/Unit.hs
|
mit
|
maxHitPoints ProtossPhotonCannon = 100
| 38 |
maxHitPoints ProtossPhotonCannon = 100
| 38 |
maxHitPoints ProtossPhotonCannon = 100
| 38 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
suhailshergill/liboleg
|
Language/DefinitionTree.hs
|
bsd-3-clause
|
evalib (f :*: b) s = fairConcatMap (evalib b) (evali f s)
where fairConcatMap k [] = []
fairConcatMap k (a:m) = interleave (k a) (fairConcatMap k m)
| 159 |
evalib (f :*: b) s = fairConcatMap (evalib b) (evali f s)
where fairConcatMap k [] = []
fairConcatMap k (a:m) = interleave (k a) (fairConcatMap k m)
| 159 |
evalib (f :*: b) s = fairConcatMap (evalib b) (evali f s)
where fairConcatMap k [] = []
fairConcatMap k (a:m) = interleave (k a) (fairConcatMap k m)
| 159 | false | false | 2 | 7 | 38 | 102 | 44 | 58 | null | null |
hermish/courseography
|
app/Database/CourseInsertion.hs
|
gpl-3.0
|
insertCourse :: (Courses, T.Text, T.Text) -> SqlPersistM ()
insertCourse (course, breadth, distribution) = do
maybeCourse <- selectFirst [CoursesCode ==. coursesCode course] []
breadthKey <- getBreadthKey breadth
distributionKey <- getDistributionKey distribution
case maybeCourse of
Nothing -> insert_ $ course {coursesBreadth = breadthKey,
coursesDistribution = distributionKey}
Just _ -> return ()
-- | Updates the manualTutorialEnrolment field of the given course.
| 539 |
insertCourse :: (Courses, T.Text, T.Text) -> SqlPersistM ()
insertCourse (course, breadth, distribution) = do
maybeCourse <- selectFirst [CoursesCode ==. coursesCode course] []
breadthKey <- getBreadthKey breadth
distributionKey <- getDistributionKey distribution
case maybeCourse of
Nothing -> insert_ $ course {coursesBreadth = breadthKey,
coursesDistribution = distributionKey}
Just _ -> return ()
-- | Updates the manualTutorialEnrolment field of the given course.
| 539 |
insertCourse (course, breadth, distribution) = do
maybeCourse <- selectFirst [CoursesCode ==. coursesCode course] []
breadthKey <- getBreadthKey breadth
distributionKey <- getDistributionKey distribution
case maybeCourse of
Nothing -> insert_ $ course {coursesBreadth = breadthKey,
coursesDistribution = distributionKey}
Just _ -> return ()
-- | Updates the manualTutorialEnrolment field of the given course.
| 479 | false | true | 0 | 12 | 129 | 139 | 69 | 70 | null | null |
CGenie/haskell-snake
|
src/Game/HSnake/Player.hs
|
gpl-3.0
|
initialComputer :: Player
initialComputer = Player
AI
initialSnakeBottom
(initialSnakeBottom^.direction)
Blue
| 165 |
initialComputer :: Player
initialComputer = Player
AI
initialSnakeBottom
(initialSnakeBottom^.direction)
Blue
| 165 |
initialComputer = Player
AI
initialSnakeBottom
(initialSnakeBottom^.direction)
Blue
| 139 | false | true | 0 | 7 | 65 | 27 | 14 | 13 | null | null |
tpsinnem/Idris-dev
|
src/Idris/Core/Evaluate.hs
|
bsd-3-clause
|
simplifyCasedef :: Name -> ErasureInfo -> Context -> TC Context
simplifyCasedef n ei uctxt
= do let ctxt = definitions uctxt
ctxt' <- case lookupCtxt n ctxt of
[(CaseOp ci ty atys [] ps _, inj, acc, tot, metainf)] ->
return ctxt -- nothing to simplify (or already done...)
[(CaseOp ci ty atys ps_in ps cd, inj, acc, tot, metainf)] ->
do let ps_in' = map simpl ps_in
pdef = map debind ps_in'
CaseDef args sc _ <- simpleCase False (STerm Erased) False CompileTime emptyFC [] atys pdef ei
return $ addDef n (CaseOp ci
ty atys ps_in' ps (cd { cases_totcheck = (args, sc) }),
inj, acc, tot, metainf) ctxt
_ -> return ctxt
return uctxt { definitions = ctxt' }
where
depat acc (Bind n (PVar t) sc)
= depat (n : acc) (instantiate (P Bound n t) sc)
depat acc x = (acc, x)
debind (Right (x, y)) = let (vs, x') = depat [] x
(_, y') = depat [] y in
(vs, x', y')
debind (Left x) = let (vs, x') = depat [] x in
(vs, x', Impossible)
simpl (Right (x, y)) = Right (x, simplify uctxt [] y)
simpl t = t
| 1,411 |
simplifyCasedef :: Name -> ErasureInfo -> Context -> TC Context
simplifyCasedef n ei uctxt
= do let ctxt = definitions uctxt
ctxt' <- case lookupCtxt n ctxt of
[(CaseOp ci ty atys [] ps _, inj, acc, tot, metainf)] ->
return ctxt -- nothing to simplify (or already done...)
[(CaseOp ci ty atys ps_in ps cd, inj, acc, tot, metainf)] ->
do let ps_in' = map simpl ps_in
pdef = map debind ps_in'
CaseDef args sc _ <- simpleCase False (STerm Erased) False CompileTime emptyFC [] atys pdef ei
return $ addDef n (CaseOp ci
ty atys ps_in' ps (cd { cases_totcheck = (args, sc) }),
inj, acc, tot, metainf) ctxt
_ -> return ctxt
return uctxt { definitions = ctxt' }
where
depat acc (Bind n (PVar t) sc)
= depat (n : acc) (instantiate (P Bound n t) sc)
depat acc x = (acc, x)
debind (Right (x, y)) = let (vs, x') = depat [] x
(_, y') = depat [] y in
(vs, x', y')
debind (Left x) = let (vs, x') = depat [] x in
(vs, x', Impossible)
simpl (Right (x, y)) = Right (x, simplify uctxt [] y)
simpl t = t
| 1,411 |
simplifyCasedef n ei uctxt
= do let ctxt = definitions uctxt
ctxt' <- case lookupCtxt n ctxt of
[(CaseOp ci ty atys [] ps _, inj, acc, tot, metainf)] ->
return ctxt -- nothing to simplify (or already done...)
[(CaseOp ci ty atys ps_in ps cd, inj, acc, tot, metainf)] ->
do let ps_in' = map simpl ps_in
pdef = map debind ps_in'
CaseDef args sc _ <- simpleCase False (STerm Erased) False CompileTime emptyFC [] atys pdef ei
return $ addDef n (CaseOp ci
ty atys ps_in' ps (cd { cases_totcheck = (args, sc) }),
inj, acc, tot, metainf) ctxt
_ -> return ctxt
return uctxt { definitions = ctxt' }
where
depat acc (Bind n (PVar t) sc)
= depat (n : acc) (instantiate (P Bound n t) sc)
depat acc x = (acc, x)
debind (Right (x, y)) = let (vs, x') = depat [] x
(_, y') = depat [] y in
(vs, x', y')
debind (Left x) = let (vs, x') = depat [] x in
(vs, x', Impossible)
simpl (Right (x, y)) = Right (x, simplify uctxt [] y)
simpl t = t
| 1,347 | false | true | 2 | 20 | 626 | 548 | 274 | 274 | null | null |
bergmark/haskell-opaleye
|
opaleye-sqlite/src/Opaleye/SQLite/Internal/Column.hs
|
bsd-3-clause
|
binOp :: HPQ.BinOp -> Column a -> Column b -> Column c
binOp op (Column e) (Column e') = Column (HPQ.BinExpr op e e')
| 117 |
binOp :: HPQ.BinOp -> Column a -> Column b -> Column c
binOp op (Column e) (Column e') = Column (HPQ.BinExpr op e e')
| 117 |
binOp op (Column e) (Column e') = Column (HPQ.BinExpr op e e')
| 62 | false | true | 0 | 8 | 23 | 68 | 32 | 36 | null | null |
creichert/persistent
|
persistent-template/Database/Persist/TH.hs
|
mit
|
-- | This special-cases "type_" and strips out its underscore. When
-- used for JSON serialization and deserialization, it works around
-- <https://github.com/yesodweb/persistent/issues/412>
unHaskellNameForJSON :: HaskellName -> Text
unHaskellNameForJSON = fixTypeUnderscore . unHaskellName
where fixTypeUnderscore "type" = "type_"
fixTypeUnderscore name = name
-- | Converts a quasi-quoted syntax into a list of entity definitions, to be
-- used as input to the template haskell generation code (mkPersist).
| 520 |
unHaskellNameForJSON :: HaskellName -> Text
unHaskellNameForJSON = fixTypeUnderscore . unHaskellName
where fixTypeUnderscore "type" = "type_"
fixTypeUnderscore name = name
-- | Converts a quasi-quoted syntax into a list of entity definitions, to be
-- used as input to the template haskell generation code (mkPersist).
| 329 |
unHaskellNameForJSON = fixTypeUnderscore . unHaskellName
where fixTypeUnderscore "type" = "type_"
fixTypeUnderscore name = name
-- | Converts a quasi-quoted syntax into a list of entity definitions, to be
-- used as input to the template haskell generation code (mkPersist).
| 285 | true | true | 1 | 5 | 77 | 43 | 24 | 19 | null | null |
vTurbine/ghc
|
libraries/base/Data/Functor/Classes.hs
|
bsd-3-clause
|
readListWith :: ReadS a -> ReadS [a]
readListWith rp =
readParen False (\r -> [pr | ("[",s) <- lex r, pr <- readl s])
where
readl s = [([],t) | ("]",t) <- lex s] ++
[(x:xs,u) | (x,t) <- rp s, (xs,u) <- readl' t]
readl' s = [([],t) | ("]",t) <- lex s] ++
[(x:xs,v) | (",",t) <- lex s, (x,u) <- rp t, (xs,v) <- readl' u]
-- | Lift the standard 'readsPrec' and 'readList' functions through the
-- type constructor.
| 442 |
readListWith :: ReadS a -> ReadS [a]
readListWith rp =
readParen False (\r -> [pr | ("[",s) <- lex r, pr <- readl s])
where
readl s = [([],t) | ("]",t) <- lex s] ++
[(x:xs,u) | (x,t) <- rp s, (xs,u) <- readl' t]
readl' s = [([],t) | ("]",t) <- lex s] ++
[(x:xs,v) | (",",t) <- lex s, (x,u) <- rp t, (xs,v) <- readl' u]
-- | Lift the standard 'readsPrec' and 'readList' functions through the
-- type constructor.
| 442 |
readListWith rp =
readParen False (\r -> [pr | ("[",s) <- lex r, pr <- readl s])
where
readl s = [([],t) | ("]",t) <- lex s] ++
[(x:xs,u) | (x,t) <- rp s, (xs,u) <- readl' t]
readl' s = [([],t) | ("]",t) <- lex s] ++
[(x:xs,v) | (",",t) <- lex s, (x,u) <- rp t, (xs,v) <- readl' u]
-- | Lift the standard 'readsPrec' and 'readList' functions through the
-- type constructor.
| 405 | false | true | 2 | 10 | 113 | 279 | 145 | 134 | null | null |
shigemk2/haskell_abc
|
bsort-debug.hs
|
mit
|
bubble [x] = [x]
| 16 |
bubble [x] = [x]
| 16 |
bubble [x] = [x]
| 16 | false | false | 0 | 5 | 3 | 16 | 8 | 8 | null | null |
DataStewardshipPortal/ds-form-engine
|
FormElement/FormElement.hs
|
apache-2.0
|
formItem ListElem{ lfi, .. } = lfi
| 34 |
formItem ListElem{ lfi, .. } = lfi
| 34 |
formItem ListElem{ lfi, .. } = lfi
| 34 | false | false | 0 | 7 | 6 | 18 | 9 | 9 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.