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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Melvar/Idris-dev | src/Idris/Core/ProofState.hs | bsd-3-clause | deferType :: Name -> Raw -> [Name] -> RunTactic
deferType n fty_in args ctxt env (Bind x (Hole t) (P nt x' ty)) | x == x' =
do (fty, _) <- lift $ check ctxt env fty_in
action (\ps -> let hs = holes ps
ds = deferred ps in
ps { holes = hs \\ [x],
deferred = n : ds })
return (Bind n (GHole 0 [] fty)
(mkApp (P Ref n ty) (map getP args)))
where
getP n = case lookup n env of
Just b -> P Bound n (binderTy b)
Nothing -> error ("deferType can't find " ++ show n) | 622 | deferType :: Name -> Raw -> [Name] -> RunTactic
deferType n fty_in args ctxt env (Bind x (Hole t) (P nt x' ty)) | x == x' =
do (fty, _) <- lift $ check ctxt env fty_in
action (\ps -> let hs = holes ps
ds = deferred ps in
ps { holes = hs \\ [x],
deferred = n : ds })
return (Bind n (GHole 0 [] fty)
(mkApp (P Ref n ty) (map getP args)))
where
getP n = case lookup n env of
Just b -> P Bound n (binderTy b)
Nothing -> error ("deferType can't find " ++ show n) | 622 | deferType n fty_in args ctxt env (Bind x (Hole t) (P nt x' ty)) | x == x' =
do (fty, _) <- lift $ check ctxt env fty_in
action (\ps -> let hs = holes ps
ds = deferred ps in
ps { holes = hs \\ [x],
deferred = n : ds })
return (Bind n (GHole 0 [] fty)
(mkApp (P Ref n ty) (map getP args)))
where
getP n = case lookup n env of
Just b -> P Bound n (binderTy b)
Nothing -> error ("deferType can't find " ++ show n) | 574 | false | true | 1 | 16 | 270 | 283 | 136 | 147 | null | null |
seckcoder/vector | Data/Vector/Fusion/Bundle/Monadic.hs | bsd-3-clause | trans f Bundle{sElems = s, sChunks = cs, sVector = v, sSize = n}
= Bundle { sElems = S.trans f s, sChunks = S.trans f cs, sVector = v, sSize = n } | 148 | trans f Bundle{sElems = s, sChunks = cs, sVector = v, sSize = n}
= Bundle { sElems = S.trans f s, sChunks = S.trans f cs, sVector = v, sSize = n } | 148 | trans f Bundle{sElems = s, sChunks = cs, sVector = v, sSize = n}
= Bundle { sElems = S.trans f s, sChunks = S.trans f cs, sVector = v, sSize = n } | 148 | false | false | 1 | 9 | 35 | 89 | 47 | 42 | null | null |
IreneKnapp/Faction | faction/Distribution/Client/PackageIndex.hs | bsd-3-clause | --
-- * Construction
--
-- | Build an index out of a bunch of packages.
--
-- If there are duplicates, later ones mask earlier ones.
--
fromList :: Package pkg => [pkg] -> PackageIndex pkg
fromList pkgs = mkPackageIndex
. Map.map fixBucket
. Map.fromListWith (++)
$ [ (packageName pkg, [pkg])
| pkg <- pkgs ]
where
fixBucket = -- out of groups of duplicates, later ones mask earlier ones
-- but Map.fromListWith (++) constructs groups in reverse order
map head
-- Eq instance for PackageIdentifier is wrong, so use Ord:
. groupBy (\a b -> EQ == comparing packageId a b)
-- relies on sortBy being a stable sort so we
-- can pick consistently among duplicates
. sortBy (comparing packageId)
--
-- * Updates
--
-- | Merge two indexes.
--
-- Packages from the second mask packages of the same exact name
-- (case-sensitively) from the first.
-- | 1,015 | fromList :: Package pkg => [pkg] -> PackageIndex pkg
fromList pkgs = mkPackageIndex
. Map.map fixBucket
. Map.fromListWith (++)
$ [ (packageName pkg, [pkg])
| pkg <- pkgs ]
where
fixBucket = -- out of groups of duplicates, later ones mask earlier ones
-- but Map.fromListWith (++) constructs groups in reverse order
map head
-- Eq instance for PackageIdentifier is wrong, so use Ord:
. groupBy (\a b -> EQ == comparing packageId a b)
-- relies on sortBy being a stable sort so we
-- can pick consistently among duplicates
. sortBy (comparing packageId)
--
-- * Updates
--
-- | Merge two indexes.
--
-- Packages from the second mask packages of the same exact name
-- (case-sensitively) from the first.
-- | 878 | fromList pkgs = mkPackageIndex
. Map.map fixBucket
. Map.fromListWith (++)
$ [ (packageName pkg, [pkg])
| pkg <- pkgs ]
where
fixBucket = -- out of groups of duplicates, later ones mask earlier ones
-- but Map.fromListWith (++) constructs groups in reverse order
map head
-- Eq instance for PackageIdentifier is wrong, so use Ord:
. groupBy (\a b -> EQ == comparing packageId a b)
-- relies on sortBy being a stable sort so we
-- can pick consistently among duplicates
. sortBy (comparing packageId)
--
-- * Updates
--
-- | Merge two indexes.
--
-- Packages from the second mask packages of the same exact name
-- (case-sensitively) from the first.
-- | 825 | true | true | 0 | 11 | 326 | 150 | 85 | 65 | null | null |
davidlazar/process-extras | src/System/Process/ListLike.hs | mit | -- | System.Process utility functions.
showCreateProcessForUser :: CreateProcess -> String
showCreateProcessForUser p =
showCmdSpecForUser (cmdspec p) ++ maybe "" (\ d -> " (in " ++ d ++ ")") (cwd p) | 203 | showCreateProcessForUser :: CreateProcess -> String
showCreateProcessForUser p =
showCmdSpecForUser (cmdspec p) ++ maybe "" (\ d -> " (in " ++ d ++ ")") (cwd p) | 164 | showCreateProcessForUser p =
showCmdSpecForUser (cmdspec p) ++ maybe "" (\ d -> " (in " ++ d ++ ")") (cwd p) | 112 | true | true | 0 | 10 | 34 | 61 | 31 | 30 | null | null |
Cahu/krpc-hs | src/KRPCHS/SpaceCenter.hs | gpl-3.0 | getContractParameterFundsCompletionStream :: KRPCHS.SpaceCenter.ContractParameter -> RPCContext (KRPCStream (Double))
getContractParameterFundsCompletionStream thisArg = requestStream $ getContractParameterFundsCompletionStreamReq thisArg | 238 | getContractParameterFundsCompletionStream :: KRPCHS.SpaceCenter.ContractParameter -> RPCContext (KRPCStream (Double))
getContractParameterFundsCompletionStream thisArg = requestStream $ getContractParameterFundsCompletionStreamReq thisArg | 238 | getContractParameterFundsCompletionStream thisArg = requestStream $ getContractParameterFundsCompletionStreamReq thisArg | 120 | false | true | 0 | 9 | 13 | 40 | 20 | 20 | null | null |
mkut/milib_haskell | src/Milib/Data/STRef.hs | bsd-3-clause | liftRunSTRef :: (forall s. ST s (STRef s a)) -> a
liftRunSTRef x'' = runST $ do
x' <- x''
x <- readSTRef x'
return x | 125 | liftRunSTRef :: (forall s. ST s (STRef s a)) -> a
liftRunSTRef x'' = runST $ do
x' <- x''
x <- readSTRef x'
return x | 125 | liftRunSTRef x'' = runST $ do
x' <- x''
x <- readSTRef x'
return x | 75 | false | true | 0 | 10 | 34 | 66 | 31 | 35 | null | null |
lukexi/cabal | cabal-install/Distribution/Client/Dependency/Types.hs | bsd-3-clause | -- | Convert 'AllowNewer' to a boolean.
isAllowNewer :: AllowNewer -> Bool
isAllowNewer AllowNewerNone = False | 114 | isAllowNewer :: AllowNewer -> Bool
isAllowNewer AllowNewerNone = False | 74 | isAllowNewer AllowNewerNone = False | 39 | true | true | 0 | 5 | 19 | 19 | 10 | 9 | null | null |
shouya/thinking-dumps | tsp/TestAlgorithm.hs | mit | algorithms :: Map String TSPAlgorithm
algorithms = M.fromList
[("BrutalForce" , algBrutalForce )
,("NearestNeighbor" , algNearestNeighbor )
,("Greedy" , algGreedy )
,("NearestInsertion" , algNearestInsertion )
,("FurthestInsertion" , algFurthestInsertion )
,("ArbitraryInsertion", algArbitraryInsertion )
,("CheapestInsertion" , algCheapestInsertion )
,("ConvexHull" , algConvexHull )
,("NearestMerger" , algNearestMerger )
,("TwoOpt" , algTwoOpt )
,("AnyOpt" , algAnyOpt 2 )
,("KOpt" , algKOpt )
] | 808 | algorithms :: Map String TSPAlgorithm
algorithms = M.fromList
[("BrutalForce" , algBrutalForce )
,("NearestNeighbor" , algNearestNeighbor )
,("Greedy" , algGreedy )
,("NearestInsertion" , algNearestInsertion )
,("FurthestInsertion" , algFurthestInsertion )
,("ArbitraryInsertion", algArbitraryInsertion )
,("CheapestInsertion" , algCheapestInsertion )
,("ConvexHull" , algConvexHull )
,("NearestMerger" , algNearestMerger )
,("TwoOpt" , algTwoOpt )
,("AnyOpt" , algAnyOpt 2 )
,("KOpt" , algKOpt )
] | 808 | algorithms = M.fromList
[("BrutalForce" , algBrutalForce )
,("NearestNeighbor" , algNearestNeighbor )
,("Greedy" , algGreedy )
,("NearestInsertion" , algNearestInsertion )
,("FurthestInsertion" , algFurthestInsertion )
,("ArbitraryInsertion", algArbitraryInsertion )
,("CheapestInsertion" , algCheapestInsertion )
,("ConvexHull" , algConvexHull )
,("NearestMerger" , algNearestMerger )
,("TwoOpt" , algTwoOpt )
,("AnyOpt" , algAnyOpt 2 )
,("KOpt" , algKOpt )
] | 770 | false | true | 0 | 8 | 366 | 132 | 83 | 49 | null | null |
input-output-hk/pos-haskell-prototype | chain/src/Pos/Chain/Block/Header.hs | mit | -- | Lens from 'MainBlockHeader' to 'Signature'.
mainHeaderSignature :: Lens' MainBlockHeader BlockSignature
mainHeaderSignature = gbhConsensus . mcdSignature | 158 | mainHeaderSignature :: Lens' MainBlockHeader BlockSignature
mainHeaderSignature = gbhConsensus . mcdSignature | 109 | mainHeaderSignature = gbhConsensus . mcdSignature | 49 | true | true | 0 | 5 | 16 | 21 | 11 | 10 | null | null |
gcross/LogicGrowsOnTrees | LogicGrowsOnTrees/sources/LogicGrowsOnTrees/Parallel/ExplorationMode.hs | bsd-2-clause | checkpointFromIntermediateProgress (FoundModeUsingPull _) = progressCheckpoint | 78 | checkpointFromIntermediateProgress (FoundModeUsingPull _) = progressCheckpoint | 78 | checkpointFromIntermediateProgress (FoundModeUsingPull _) = progressCheckpoint | 78 | false | false | 0 | 7 | 4 | 15 | 7 | 8 | null | null |
MasseR/xmonadcontrib | XMonad/Util/Dzen.hs | bsd-3-clause | -- | Set the timeout, in seconds. This defaults to 3 seconds if not
-- specified.
timeout :: Rational -> DzenConfig
timeout = timeoutMicro . seconds | 149 | timeout :: Rational -> DzenConfig
timeout = timeoutMicro . seconds | 66 | timeout = timeoutMicro . seconds | 32 | true | true | 1 | 7 | 26 | 29 | 13 | 16 | null | null |
dzotokan/SourceGraph | Parsing/ParseModule.hs | gpl-3.0 | getExp (Paren e) = getExp e | 27 | getExp (Paren e) = getExp e | 27 | getExp (Paren e) = getExp e | 27 | false | false | 0 | 6 | 5 | 19 | 8 | 11 | null | null |
AngelitoJ/HsDynamics | src/Gaussian.hs | bsd-3-clause | -- whatever we found till we hit a newline
--sanitize datablocks
goodDataBlock :: MyParser () GauBlock
goodDataBlock = do
candidate <- datablock
isGood <- blockcheck candidate -- check for sane blocks
if isGood
then return candidate
else fail "GauBlock cardinality is not good" -- TODO: Just tell us what was the offeding block
-- Try to parse one of the known datablock types or give up | 419 | goodDataBlock :: MyParser () GauBlock
goodDataBlock = do
candidate <- datablock
isGood <- blockcheck candidate -- check for sane blocks
if isGood
then return candidate
else fail "GauBlock cardinality is not good" -- TODO: Just tell us what was the offeding block
-- Try to parse one of the known datablock types or give up | 353 | goodDataBlock = do
candidate <- datablock
isGood <- blockcheck candidate -- check for sane blocks
if isGood
then return candidate
else fail "GauBlock cardinality is not good" -- TODO: Just tell us what was the offeding block
-- Try to parse one of the known datablock types or give up | 314 | true | true | 0 | 8 | 97 | 57 | 29 | 28 | null | null |
facebookarchive/lex-pass | src/Lang/Php/Ast/StmtParse.hs | bsd-3-clause | eptLE = binOp BLE tokLEP | 32 | eptLE = binOp BLE tokLEP | 32 | eptLE = binOp BLE tokLEP | 32 | false | false | 1 | 5 | 12 | 15 | 5 | 10 | null | null |
vikraman/ghc | compiler/prelude/THNames.hs | bsd-3-clause | recConEIdKey = mkPreludeMiscIdUnique 294 | 45 | recConEIdKey = mkPreludeMiscIdUnique 294 | 45 | recConEIdKey = mkPreludeMiscIdUnique 294 | 45 | false | false | 0 | 5 | 8 | 9 | 4 | 5 | null | null |
rueshyna/gogol | gogol-adsense/gen/Network/Google/AdSense/Types/Product.hs | mpl-2.0 | -- | Unique identifier of this saved ad style. This should be considered an
-- opaque identifier; it is not safe to rely on it being in any particular
-- format.
savId :: Lens' SavedAdStyle (Maybe Text)
savId = lens _savId (\ s a -> s{_savId = a}) | 247 | savId :: Lens' SavedAdStyle (Maybe Text)
savId = lens _savId (\ s a -> s{_savId = a}) | 85 | savId = lens _savId (\ s a -> s{_savId = a}) | 44 | true | true | 0 | 9 | 47 | 48 | 27 | 21 | null | null |
kazu-yamamoto/webserver | Network/Web/Server/Basic.hs | bsd-3-clause | runAnyMaybeIO :: [IO (Maybe a)] -> IO (Maybe a)
runAnyMaybeIO [] = return Nothing | 85 | runAnyMaybeIO :: [IO (Maybe a)] -> IO (Maybe a)
runAnyMaybeIO [] = return Nothing | 85 | runAnyMaybeIO [] = return Nothing | 37 | false | true | 0 | 10 | 17 | 49 | 22 | 27 | null | null |
Nehmulos/audiobooks.hs | src/Main.hs | gpl-3.0 | main :: IO ()
main = quickHttpServe site | 40 | main :: IO ()
main = quickHttpServe site | 40 | main = quickHttpServe site | 26 | false | true | 0 | 6 | 7 | 19 | 9 | 10 | null | null |
tjakway/ghcjvm | compiler/cmm/SMRep.hs | bsd-3-clause | nonHdrSizeW (ArrayPtrsRep elems ct) = elems + ct | 48 | nonHdrSizeW (ArrayPtrsRep elems ct) = elems + ct | 48 | nonHdrSizeW (ArrayPtrsRep elems ct) = elems + ct | 48 | false | false | 0 | 7 | 7 | 21 | 10 | 11 | null | null |
collective/ECSpooler | backends/haskell/haskell_libs/BinTree.hs | gpl-2.0 | minTree (NodeBT v EmptyBT _) = v | 32 | minTree (NodeBT v EmptyBT _) = v | 32 | minTree (NodeBT v EmptyBT _) = v | 32 | false | false | 0 | 6 | 6 | 20 | 9 | 11 | null | null |
michalkonecny/aern2 | aern2-mfun/src/AERN2/BoxFunMinMax/Expressions/Type.hs | bsd-3-clause | simplifyF (FConn Impl f FFalse) = simplifyF (FNot f) | 81 | simplifyF (FConn Impl f FFalse) = simplifyF (FNot f) | 81 | simplifyF (FConn Impl f FFalse) = simplifyF (FNot f) | 81 | false | false | 0 | 7 | 37 | 28 | 13 | 15 | null | null |
mike-burns/timing-convenience | Data/Time/Convenience.hs | bsd-3-clause | timeSince :: UTCTime -> NominalDiffTime -> Unit -> Direction -> UTCTime
timeSince base n unit direction =
addUTCTime ((calculator unit) n direction) base | 155 | timeSince :: UTCTime -> NominalDiffTime -> Unit -> Direction -> UTCTime
timeSince base n unit direction =
addUTCTime ((calculator unit) n direction) base | 155 | timeSince base n unit direction =
addUTCTime ((calculator unit) n direction) base | 83 | false | true | 0 | 9 | 24 | 55 | 27 | 28 | null | null |
simonmichael/hledger | hledger-lib/Hledger/Data/Dates.hs | gpl-3.0 | spansIntersect [] = nulldatespan | 32 | spansIntersect [] = nulldatespan | 32 | spansIntersect [] = nulldatespan | 32 | false | false | 0 | 6 | 3 | 11 | 5 | 6 | null | null |
bixuanzju/fcore | lib/Src.hs | bsd-2-clause | -- default matrix D(P)
-- pi1 | D(P)
-- c (r1,...,ra) | no row
-- _ | pi2,...pin
defaultMatrix :: [[Pattern]] -> [[Pattern]]
defaultMatrix pats =
[tail list1 | list1 <- pats, isWildcardOrVar . head $ list1] | 289 | defaultMatrix :: [[Pattern]] -> [[Pattern]]
defaultMatrix pats =
[tail list1 | list1 <- pats, isWildcardOrVar . head $ list1] | 129 | defaultMatrix pats =
[tail list1 | list1 <- pats, isWildcardOrVar . head $ list1] | 85 | true | true | 0 | 9 | 119 | 66 | 35 | 31 | null | null |
sandrolovnicki/lambda-calculus-interpreter | src/Reducer.hs | mit | betaNF _ n ex =
if hasBetaRedex ex
then
let (f, s) = betaReduction None n ex
in betaNF None s f
else (ex, n) | 131 | betaNF _ n ex =
if hasBetaRedex ex
then
let (f, s) = betaReduction None n ex
in betaNF None s f
else (ex, n) | 131 | betaNF _ n ex =
if hasBetaRedex ex
then
let (f, s) = betaReduction None n ex
in betaNF None s f
else (ex, n) | 131 | false | false | 0 | 10 | 47 | 62 | 31 | 31 | null | null |
brendanhay/gogol | gogol-tagmanager/gen/Network/Google/Resource/TagManager/Accounts/Containers/Versions/Publish.hs | mpl-2.0 | -- | JSONP
acvpCallback :: Lens' AccountsContainersVersionsPublish (Maybe Text)
acvpCallback
= lens _acvpCallback (\ s a -> s{_acvpCallback = a}) | 147 | acvpCallback :: Lens' AccountsContainersVersionsPublish (Maybe Text)
acvpCallback
= lens _acvpCallback (\ s a -> s{_acvpCallback = a}) | 136 | acvpCallback
= lens _acvpCallback (\ s a -> s{_acvpCallback = a}) | 67 | true | true | 0 | 9 | 21 | 48 | 25 | 23 | null | null |
k-bx/ghcjs | test/ghc/codeGen/cgrun068.hs | mit | read :: MArray s a -> Int -> ST s a
read marr i@(I# i#) =
assert (i >= 0) $
assert (i < length marr) $
ST $ \ s# ->
readArray# (unMArray marr) i# s# | 164 | read :: MArray s a -> Int -> ST s a
read marr i@(I# i#) =
assert (i >= 0) $
assert (i < length marr) $
ST $ \ s# ->
readArray# (unMArray marr) i# s# | 164 | read marr i@(I# i#) =
assert (i >= 0) $
assert (i < length marr) $
ST $ \ s# ->
readArray# (unMArray marr) i# s# | 128 | false | true | 0 | 11 | 52 | 96 | 47 | 49 | null | null |
AlexeyRaga/eta | compiler/ETA/Prelude/PrelNames.hs | bsd-3-clause | negateName = varQual gHC_NUM (fsLit "negate") negateClassOpKey | 74 | negateName = varQual gHC_NUM (fsLit "negate") negateClassOpKey | 74 | negateName = varQual gHC_NUM (fsLit "negate") negateClassOpKey | 74 | false | false | 0 | 7 | 18 | 19 | 9 | 10 | null | null |
DamienCassou/HYahtzee | Game/HYahtzee/Engine/Model.hs | bsd-3-clause | getScore :: YTable -> CombinationName -> Maybe Score
getScore (YTable table) testName = Map.lookup testName table | 113 | getScore :: YTable -> CombinationName -> Maybe Score
getScore (YTable table) testName = Map.lookup testName table | 113 | getScore (YTable table) testName = Map.lookup testName table | 60 | false | true | 0 | 7 | 15 | 40 | 19 | 21 | null | null |
ribag/ganeti-experiments | src/Ganeti/OpCodes.hs | gpl-2.0 | opSummaryVal OpInstanceCreate { opInstanceName = s } = Just s | 61 | opSummaryVal OpInstanceCreate { opInstanceName = s } = Just s | 61 | opSummaryVal OpInstanceCreate { opInstanceName = s } = Just s | 61 | false | false | 0 | 7 | 9 | 22 | 10 | 12 | null | null |
diku-dk/futhark | src/Futhark/Pass/ExtractKernels/StreamKernel.hs | isc | partitionChunkedKernelFoldParameters _ _ =
error "partitionChunkedKernelFoldParameters: lambda takes too few parameters" | 122 | partitionChunkedKernelFoldParameters _ _ =
error "partitionChunkedKernelFoldParameters: lambda takes too few parameters" | 122 | partitionChunkedKernelFoldParameters _ _ =
error "partitionChunkedKernelFoldParameters: lambda takes too few parameters" | 122 | false | false | 0 | 5 | 12 | 14 | 6 | 8 | null | null |
SwiftsNamesake/Southpaw | lib/Southpaw/Picasso/Palette.hs | mit | whitesmoke = (0.96078400, 0.96078400, 0.96078400, 1.0) | 64 | whitesmoke = (0.96078400, 0.96078400, 0.96078400, 1.0) | 64 | whitesmoke = (0.96078400, 0.96078400, 0.96078400, 1.0) | 64 | false | false | 0 | 5 | 15 | 18 | 11 | 7 | null | null |
ekmett/fixed-precision | Numeric/Fixed.hs | bsd-3-clause | bits :: Int -> Q Type
bits 0 = conT ''PrecZero | 46 | bits :: Int -> Q Type
bits 0 = conT ''PrecZero | 46 | bits 0 = conT ''PrecZero | 24 | false | true | 0 | 7 | 10 | 31 | 13 | 18 | null | null |
ddssff/rdf4h | testsuite/tests/Data/RDF/GraphTestUtils.hs | bsd-3-clause | p_query_match_o :: RDF rdf => (rdf -> Triples) -> rdf -> Property
p_query_match_o = mk_query_match_fn sameObj f
where f t = (Nothing, Nothing, Just (objectOf t))
-- verify likewise for fixed subject and predicate with wildcard object | 236 | p_query_match_o :: RDF rdf => (rdf -> Triples) -> rdf -> Property
p_query_match_o = mk_query_match_fn sameObj f
where f t = (Nothing, Nothing, Just (objectOf t))
-- verify likewise for fixed subject and predicate with wildcard object | 236 | p_query_match_o = mk_query_match_fn sameObj f
where f t = (Nothing, Nothing, Just (objectOf t))
-- verify likewise for fixed subject and predicate with wildcard object | 170 | false | true | 0 | 8 | 39 | 67 | 35 | 32 | null | null |
adscib/monad-bayes | test/TestWeighted.hs | mit | result :: MonadSample m => m ((Int,Double), Double)
result = second (exp . ln) <$> runWeighted model | 100 | result :: MonadSample m => m ((Int,Double), Double)
result = second (exp . ln) <$> runWeighted model | 100 | result = second (exp . ln) <$> runWeighted model | 48 | false | true | 0 | 8 | 16 | 50 | 26 | 24 | null | null |
ardumont/haskell-lab | src/programming-in-haskell/ch5.hs | gpl-2.0 | upp2int :: Char -> Int
upp2int c = char2int c 'A' | 49 | upp2int :: Char -> Int
upp2int c = char2int c 'A' | 49 | upp2int c = char2int c 'A' | 26 | false | true | 0 | 5 | 10 | 23 | 11 | 12 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/enumFromThenTo_1.hs | mit | primModNatS0 x y MyTrue = primModNatS (primMinusNatS x (Succ y)) (Succ (Succ y)) | 80 | primModNatS0 x y MyTrue = primModNatS (primMinusNatS x (Succ y)) (Succ (Succ y)) | 80 | primModNatS0 x y MyTrue = primModNatS (primMinusNatS x (Succ y)) (Succ (Succ y)) | 80 | false | false | 0 | 9 | 12 | 44 | 21 | 23 | null | null |
matterhorn-chat/matterhorn | src/Matterhorn/Types.hs | bsd-3-clause | specialMentionName MentionAll = "all" | 37 | specialMentionName MentionAll = "all" | 37 | specialMentionName MentionAll = "all" | 37 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
RossMeikleham/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | mapPTermFC f g (PUnifyLog t) = PUnifyLog (mapPTermFC f g t) | 59 | mapPTermFC f g (PUnifyLog t) = PUnifyLog (mapPTermFC f g t) | 59 | mapPTermFC f g (PUnifyLog t) = PUnifyLog (mapPTermFC f g t) | 59 | false | false | 0 | 7 | 10 | 32 | 15 | 17 | null | null |
kosmikus/getopt-generics | test/System/Console/GetOpt/GenericsSpec.hs | bsd-3-clause | part5 :: Spec
part5 = do
describe "parseArguments" $ do
context "WithoutSelectors" $ do
it "populates fields without selectors from positional arguments" $ do
parse "foo true 23"
`shouldBe` Success (WithoutSelectors "foo" True 23)
it "has good help output for positional arguments" $ do
let OutputAndExit output = parse "--help" :: Result WithoutSelectors
output `shouldSatisfy` ("prog-name [OPTIONS] STRING BOOL INTEGER" `isPrefixOf`)
it "has good error messages for missing positional arguments" $ do
(parse "foo" :: Result WithoutSelectors)
`shouldBe` Errors (
"missing argument of type BOOL" :
"missing argument of type INTEGER" :
[])
it "complains about additional positional arguments" $ do
(parse "foo true 5 bar" :: Result WithoutSelectors)
`shouldBe` Errors ["unknown argument: bar"]
it "allows to use tuples" $ do
(parse "42 bar" :: Result (Int, String))
`shouldBe` Success (42, "bar") | 1,059 | part5 :: Spec
part5 = do
describe "parseArguments" $ do
context "WithoutSelectors" $ do
it "populates fields without selectors from positional arguments" $ do
parse "foo true 23"
`shouldBe` Success (WithoutSelectors "foo" True 23)
it "has good help output for positional arguments" $ do
let OutputAndExit output = parse "--help" :: Result WithoutSelectors
output `shouldSatisfy` ("prog-name [OPTIONS] STRING BOOL INTEGER" `isPrefixOf`)
it "has good error messages for missing positional arguments" $ do
(parse "foo" :: Result WithoutSelectors)
`shouldBe` Errors (
"missing argument of type BOOL" :
"missing argument of type INTEGER" :
[])
it "complains about additional positional arguments" $ do
(parse "foo true 5 bar" :: Result WithoutSelectors)
`shouldBe` Errors ["unknown argument: bar"]
it "allows to use tuples" $ do
(parse "42 bar" :: Result (Int, String))
`shouldBe` Success (42, "bar") | 1,059 | part5 = do
describe "parseArguments" $ do
context "WithoutSelectors" $ do
it "populates fields without selectors from positional arguments" $ do
parse "foo true 23"
`shouldBe` Success (WithoutSelectors "foo" True 23)
it "has good help output for positional arguments" $ do
let OutputAndExit output = parse "--help" :: Result WithoutSelectors
output `shouldSatisfy` ("prog-name [OPTIONS] STRING BOOL INTEGER" `isPrefixOf`)
it "has good error messages for missing positional arguments" $ do
(parse "foo" :: Result WithoutSelectors)
`shouldBe` Errors (
"missing argument of type BOOL" :
"missing argument of type INTEGER" :
[])
it "complains about additional positional arguments" $ do
(parse "foo true 5 bar" :: Result WithoutSelectors)
`shouldBe` Errors ["unknown argument: bar"]
it "allows to use tuples" $ do
(parse "42 bar" :: Result (Int, String))
`shouldBe` Success (42, "bar") | 1,045 | false | true | 0 | 20 | 295 | 243 | 118 | 125 | null | null |
mjhoy/chorebot | src/Chorebot/Assignment.hs | gpl-2.0 | printAssignments :: [Assignment] -> String
printAssignments assignments =
concat $ intersperse "\n" datelines
where assignments' = reverse $ sort assignments
grouped = groupBy (\a b -> (assignmentDay a) == (assignmentDay b)) assignments'
grouped' = map (sortBy (\a b -> (doerEmail (assignmentDoer a)) `compare` (doerEmail (assignmentDoer b)))) grouped
grouped'' = map (groupBy (\a b -> (assignmentDoer a) == (assignmentDoer b))) grouped'
prcd ls@((x:_):_) = [ "[" ++ (assignmentDay x) ++ "]\n\n" ++ (concatMap printAssignmentsUser ls) ]
prcd _ = []
datelines = concatMap prcd grouped''
printAssignmentsUser :: [Assignment] -> String
printAssignmentsUser [] = ""
printAssignmentsUser (x:xs) = (doerName d) ++ " <" ++ (doerEmail d) ++ ">: " ++ "\n" ++ (concatMap printAssignment (x:xs)) ++ "\n"
where d = assignmentDoer x
printAssignment a =
" " ++ (choreTitle c) ++ " <" ++ (choreIdent c) ++ "> " ++ (show $ assignmentDiff a) ++ "\n"
where c = assignmentChore a | 1,075 | printAssignments :: [Assignment] -> String
printAssignments assignments =
concat $ intersperse "\n" datelines
where assignments' = reverse $ sort assignments
grouped = groupBy (\a b -> (assignmentDay a) == (assignmentDay b)) assignments'
grouped' = map (sortBy (\a b -> (doerEmail (assignmentDoer a)) `compare` (doerEmail (assignmentDoer b)))) grouped
grouped'' = map (groupBy (\a b -> (assignmentDoer a) == (assignmentDoer b))) grouped'
prcd ls@((x:_):_) = [ "[" ++ (assignmentDay x) ++ "]\n\n" ++ (concatMap printAssignmentsUser ls) ]
prcd _ = []
datelines = concatMap prcd grouped''
printAssignmentsUser :: [Assignment] -> String
printAssignmentsUser [] = ""
printAssignmentsUser (x:xs) = (doerName d) ++ " <" ++ (doerEmail d) ++ ">: " ++ "\n" ++ (concatMap printAssignment (x:xs)) ++ "\n"
where d = assignmentDoer x
printAssignment a =
" " ++ (choreTitle c) ++ " <" ++ (choreIdent c) ++ "> " ++ (show $ assignmentDiff a) ++ "\n"
where c = assignmentChore a | 1,075 | printAssignments assignments =
concat $ intersperse "\n" datelines
where assignments' = reverse $ sort assignments
grouped = groupBy (\a b -> (assignmentDay a) == (assignmentDay b)) assignments'
grouped' = map (sortBy (\a b -> (doerEmail (assignmentDoer a)) `compare` (doerEmail (assignmentDoer b)))) grouped
grouped'' = map (groupBy (\a b -> (assignmentDoer a) == (assignmentDoer b))) grouped'
prcd ls@((x:_):_) = [ "[" ++ (assignmentDay x) ++ "]\n\n" ++ (concatMap printAssignmentsUser ls) ]
prcd _ = []
datelines = concatMap prcd grouped''
printAssignmentsUser :: [Assignment] -> String
printAssignmentsUser [] = ""
printAssignmentsUser (x:xs) = (doerName d) ++ " <" ++ (doerEmail d) ++ ">: " ++ "\n" ++ (concatMap printAssignment (x:xs)) ++ "\n"
where d = assignmentDoer x
printAssignment a =
" " ++ (choreTitle c) ++ " <" ++ (choreIdent c) ++ "> " ++ (show $ assignmentDiff a) ++ "\n"
where c = assignmentChore a | 1,032 | false | true | 11 | 14 | 263 | 444 | 216 | 228 | null | null |
nikita-volkov/cases | library/Cases.hs | mit | camel :: Delimiter
camel =
fmap Just .
maybe partToText (\l r -> l <> partToText (title r)) | 96 | camel :: Delimiter
camel =
fmap Just .
maybe partToText (\l r -> l <> partToText (title r)) | 96 | camel =
fmap Just .
maybe partToText (\l r -> l <> partToText (title r)) | 77 | false | true | 0 | 11 | 22 | 53 | 24 | 29 | null | null |
rahulmutt/ghcvm | compiler/Eta/DeSugar/Coverage.hs | bsd-3-clause | addTickHsValBinds :: HsValBindsLR Id a -> TM (HsValBindsLR Id b)
addTickHsValBinds (ValBindsOut binds sigs) =
liftM2 ValBindsOut
(mapM (\ (rec,binds') ->
liftM2 (,)
(return rec)
(addTickLHsBinds binds'))
binds)
(return sigs) | 400 | addTickHsValBinds :: HsValBindsLR Id a -> TM (HsValBindsLR Id b)
addTickHsValBinds (ValBindsOut binds sigs) =
liftM2 ValBindsOut
(mapM (\ (rec,binds') ->
liftM2 (,)
(return rec)
(addTickLHsBinds binds'))
binds)
(return sigs) | 400 | addTickHsValBinds (ValBindsOut binds sigs) =
liftM2 ValBindsOut
(mapM (\ (rec,binds') ->
liftM2 (,)
(return rec)
(addTickLHsBinds binds'))
binds)
(return sigs) | 335 | false | true | 0 | 12 | 205 | 99 | 50 | 49 | null | null |
wavewave/hxournal | lib/Application/HXournal/GUI/Menu.hs | bsd-2-clause | int2Color 10 = ColorWhite | 25 | int2Color 10 = ColorWhite | 25 | int2Color 10 = ColorWhite | 25 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
cstrahan/hs-capnp | capnpc-hs/Data/CapnProto/Schema/Generator.hs | mit | capitalize :: String -> String
capitalize [] = [] | 49 | capitalize :: String -> String
capitalize [] = [] | 49 | capitalize [] = [] | 18 | false | true | 0 | 6 | 8 | 22 | 11 | 11 | null | null |
lunaris/hindent | src/main/Main.hs | bsd-3-clause | -- | Main entry point.
main :: IO ()
main =
do args <- getArgs
case consume options (map T.pack args) of
Succeeded (style,exts,mfilepath) ->
case mfilepath of
Just filepath ->
do text <- T.readFile filepath
tmpDir <- getTemporaryDirectory
(fp,h) <- openTempFile tmpDir "hindent.hs"
T.hPutStrLn
h
(either error T.toLazyText (reformat style (Just exts) text))
hFlush h
hClose h
let exdev e = if ioe_errno e == Just ((\(Errno a) -> a) eXDEV)
then copyFile fp filepath >> removeFile fp
else throw e
renameFile fp filepath `catch` exdev
Nothing ->
T.interact (either error T.toLazyText . reformat style (Just exts))
Failed (Wrap (Stopped Version) _) ->
putStrLn ("hindent " ++ showVersion version)
_ ->
error (T.unpack (textDescription (describe options [])))
-- | Options that stop the argument parser. | 1,118 | main :: IO ()
main =
do args <- getArgs
case consume options (map T.pack args) of
Succeeded (style,exts,mfilepath) ->
case mfilepath of
Just filepath ->
do text <- T.readFile filepath
tmpDir <- getTemporaryDirectory
(fp,h) <- openTempFile tmpDir "hindent.hs"
T.hPutStrLn
h
(either error T.toLazyText (reformat style (Just exts) text))
hFlush h
hClose h
let exdev e = if ioe_errno e == Just ((\(Errno a) -> a) eXDEV)
then copyFile fp filepath >> removeFile fp
else throw e
renameFile fp filepath `catch` exdev
Nothing ->
T.interact (either error T.toLazyText . reformat style (Just exts))
Failed (Wrap (Stopped Version) _) ->
putStrLn ("hindent " ++ showVersion version)
_ ->
error (T.unpack (textDescription (describe options [])))
-- | Options that stop the argument parser. | 1,095 | main =
do args <- getArgs
case consume options (map T.pack args) of
Succeeded (style,exts,mfilepath) ->
case mfilepath of
Just filepath ->
do text <- T.readFile filepath
tmpDir <- getTemporaryDirectory
(fp,h) <- openTempFile tmpDir "hindent.hs"
T.hPutStrLn
h
(either error T.toLazyText (reformat style (Just exts) text))
hFlush h
hClose h
let exdev e = if ioe_errno e == Just ((\(Errno a) -> a) eXDEV)
then copyFile fp filepath >> removeFile fp
else throw e
renameFile fp filepath `catch` exdev
Nothing ->
T.interact (either error T.toLazyText . reformat style (Just exts))
Failed (Wrap (Stopped Version) _) ->
putStrLn ("hindent " ++ showVersion version)
_ ->
error (T.unpack (textDescription (describe options [])))
-- | Options that stop the argument parser. | 1,081 | true | true | 0 | 26 | 445 | 349 | 166 | 183 | null | null |
sdiehl/ghc | compiler/coreSyn/CoreUtils.hs | bsd-3-clause | tryEtaReduce :: [Var] -> CoreExpr -> Maybe CoreExpr
tryEtaReduce bndrs body
= go (reverse bndrs) body (mkRepReflCo (exprType body))
where
incoming_arity = count isId bndrs
go :: [Var] -- Binders, innermost first, types [a3,a2,a1]
-> CoreExpr -- Of type tr
-> Coercion -- Of type tr ~ ts
-> Maybe CoreExpr -- Of type a1 -> a2 -> a3 -> ts
-- See Note [Eta reduction with casted arguments]
-- for why we have an accumulating coercion
go [] fun co
| ok_fun fun
, let used_vars = exprFreeVars fun `unionVarSet` tyCoVarsOfCo co
, not (any (`elemVarSet` used_vars) bndrs)
= Just (mkCast fun co) -- Check for any of the binders free in the result
-- including the accumulated coercion
go bs (Tick t e) co
| tickishFloatable t
= fmap (Tick t) $ go bs e co
-- Float app ticks: \x -> Tick t (e x) ==> Tick t e
go (b : bs) (App fun arg) co
| Just (co', ticks) <- ok_arg b arg co
= fmap (flip (foldr mkTick) ticks) $ go bs fun co'
-- Float arg ticks: \x -> e (Tick t x) ==> Tick t e
go _ _ _ = Nothing -- Failure!
---------------
-- Note [Eta reduction conditions]
ok_fun (App fun (Type {})) = ok_fun fun
ok_fun (Cast fun _) = ok_fun fun
ok_fun (Tick _ expr) = ok_fun expr
ok_fun (Var fun_id) = ok_fun_id fun_id || all ok_lam bndrs
ok_fun _fun = False
---------------
ok_fun_id fun = fun_arity fun >= incoming_arity
---------------
fun_arity fun -- See Note [Arity care]
| isLocalId fun
, isStrongLoopBreaker (idOccInfo fun) = 0
| arity > 0 = arity
| isEvaldUnfolding (idUnfolding fun) = 1
-- See Note [Eta reduction of an eval'd function]
| otherwise = 0
where
arity = idArity fun
---------------
ok_lam v = isTyVar v || isEvVar v
---------------
ok_arg :: Var -- Of type bndr_t
-> CoreExpr -- Of type arg_t
-> Coercion -- Of kind (t1~t2)
-> Maybe (Coercion -- Of type (arg_t -> t1 ~ bndr_t -> t2)
-- (and similarly for tyvars, coercion args)
, [Tickish Var])
-- See Note [Eta reduction with casted arguments]
ok_arg bndr (Type ty) co
| Just tv <- getTyVar_maybe ty
, bndr == tv = Just (mkHomoForAllCos [tv] co, [])
ok_arg bndr (Var v) co
| bndr == v = let reflCo = mkRepReflCo (idType bndr)
in Just (mkFunCo Representational reflCo co, [])
ok_arg bndr (Cast e co_arg) co
| (ticks, Var v) <- stripTicksTop tickishFloatable e
, bndr == v
= Just (mkFunCo Representational (mkSymCo co_arg) co, ticks)
-- The simplifier combines multiple casts into one,
-- so we can have a simple-minded pattern match here
ok_arg bndr (Tick t arg) co
| tickishFloatable t, Just (co', ticks) <- ok_arg bndr arg co
= Just (co', t:ticks)
ok_arg _ _ _ = Nothing
{-
Note [Eta reduction of an eval'd function]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In Haskell it is not true that f = \x. f x
because f might be bottom, and 'seq' can distinguish them.
But it *is* true that f = f `seq` \x. f x
and we'd like to simplify the latter to the former. This amounts
to the rule that
* when there is just *one* value argument,
* f is not bottom
we can eta-reduce \x. f x ===> f
This turned up in #7542.
************************************************************************
* *
\subsection{Determining non-updatable right-hand-sides}
* *
************************************************************************
Top-level constructor applications can usually be allocated
statically, but they can't if the constructor, or any of the
arguments, come from another DLL (because we can't refer to static
labels in other DLLs).
If this happens we simply make the RHS into an updatable thunk,
and 'execute' it rather than allocating it statically.
-}
{-
************************************************************************
* *
\subsection{Type utilities}
* *
************************************************************************
-}
-- | True if the type has no non-bottom elements, e.g. when it is an empty
-- datatype, or a GADT with non-satisfiable type parameters, e.g. Int :~: Bool.
-- See Note [Bottoming expressions]
--
-- See Note [No alternatives lint check] for another use of this function. | 4,923 | tryEtaReduce :: [Var] -> CoreExpr -> Maybe CoreExpr
tryEtaReduce bndrs body
= go (reverse bndrs) body (mkRepReflCo (exprType body))
where
incoming_arity = count isId bndrs
go :: [Var] -- Binders, innermost first, types [a3,a2,a1]
-> CoreExpr -- Of type tr
-> Coercion -- Of type tr ~ ts
-> Maybe CoreExpr -- Of type a1 -> a2 -> a3 -> ts
-- See Note [Eta reduction with casted arguments]
-- for why we have an accumulating coercion
go [] fun co
| ok_fun fun
, let used_vars = exprFreeVars fun `unionVarSet` tyCoVarsOfCo co
, not (any (`elemVarSet` used_vars) bndrs)
= Just (mkCast fun co) -- Check for any of the binders free in the result
-- including the accumulated coercion
go bs (Tick t e) co
| tickishFloatable t
= fmap (Tick t) $ go bs e co
-- Float app ticks: \x -> Tick t (e x) ==> Tick t e
go (b : bs) (App fun arg) co
| Just (co', ticks) <- ok_arg b arg co
= fmap (flip (foldr mkTick) ticks) $ go bs fun co'
-- Float arg ticks: \x -> e (Tick t x) ==> Tick t e
go _ _ _ = Nothing -- Failure!
---------------
-- Note [Eta reduction conditions]
ok_fun (App fun (Type {})) = ok_fun fun
ok_fun (Cast fun _) = ok_fun fun
ok_fun (Tick _ expr) = ok_fun expr
ok_fun (Var fun_id) = ok_fun_id fun_id || all ok_lam bndrs
ok_fun _fun = False
---------------
ok_fun_id fun = fun_arity fun >= incoming_arity
---------------
fun_arity fun -- See Note [Arity care]
| isLocalId fun
, isStrongLoopBreaker (idOccInfo fun) = 0
| arity > 0 = arity
| isEvaldUnfolding (idUnfolding fun) = 1
-- See Note [Eta reduction of an eval'd function]
| otherwise = 0
where
arity = idArity fun
---------------
ok_lam v = isTyVar v || isEvVar v
---------------
ok_arg :: Var -- Of type bndr_t
-> CoreExpr -- Of type arg_t
-> Coercion -- Of kind (t1~t2)
-> Maybe (Coercion -- Of type (arg_t -> t1 ~ bndr_t -> t2)
-- (and similarly for tyvars, coercion args)
, [Tickish Var])
-- See Note [Eta reduction with casted arguments]
ok_arg bndr (Type ty) co
| Just tv <- getTyVar_maybe ty
, bndr == tv = Just (mkHomoForAllCos [tv] co, [])
ok_arg bndr (Var v) co
| bndr == v = let reflCo = mkRepReflCo (idType bndr)
in Just (mkFunCo Representational reflCo co, [])
ok_arg bndr (Cast e co_arg) co
| (ticks, Var v) <- stripTicksTop tickishFloatable e
, bndr == v
= Just (mkFunCo Representational (mkSymCo co_arg) co, ticks)
-- The simplifier combines multiple casts into one,
-- so we can have a simple-minded pattern match here
ok_arg bndr (Tick t arg) co
| tickishFloatable t, Just (co', ticks) <- ok_arg bndr arg co
= Just (co', t:ticks)
ok_arg _ _ _ = Nothing
{-
Note [Eta reduction of an eval'd function]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In Haskell it is not true that f = \x. f x
because f might be bottom, and 'seq' can distinguish them.
But it *is* true that f = f `seq` \x. f x
and we'd like to simplify the latter to the former. This amounts
to the rule that
* when there is just *one* value argument,
* f is not bottom
we can eta-reduce \x. f x ===> f
This turned up in #7542.
************************************************************************
* *
\subsection{Determining non-updatable right-hand-sides}
* *
************************************************************************
Top-level constructor applications can usually be allocated
statically, but they can't if the constructor, or any of the
arguments, come from another DLL (because we can't refer to static
labels in other DLLs).
If this happens we simply make the RHS into an updatable thunk,
and 'execute' it rather than allocating it statically.
-}
{-
************************************************************************
* *
\subsection{Type utilities}
* *
************************************************************************
-}
-- | True if the type has no non-bottom elements, e.g. when it is an empty
-- datatype, or a GADT with non-satisfiable type parameters, e.g. Int :~: Bool.
-- See Note [Bottoming expressions]
--
-- See Note [No alternatives lint check] for another use of this function. | 4,923 | tryEtaReduce bndrs body
= go (reverse bndrs) body (mkRepReflCo (exprType body))
where
incoming_arity = count isId bndrs
go :: [Var] -- Binders, innermost first, types [a3,a2,a1]
-> CoreExpr -- Of type tr
-> Coercion -- Of type tr ~ ts
-> Maybe CoreExpr -- Of type a1 -> a2 -> a3 -> ts
-- See Note [Eta reduction with casted arguments]
-- for why we have an accumulating coercion
go [] fun co
| ok_fun fun
, let used_vars = exprFreeVars fun `unionVarSet` tyCoVarsOfCo co
, not (any (`elemVarSet` used_vars) bndrs)
= Just (mkCast fun co) -- Check for any of the binders free in the result
-- including the accumulated coercion
go bs (Tick t e) co
| tickishFloatable t
= fmap (Tick t) $ go bs e co
-- Float app ticks: \x -> Tick t (e x) ==> Tick t e
go (b : bs) (App fun arg) co
| Just (co', ticks) <- ok_arg b arg co
= fmap (flip (foldr mkTick) ticks) $ go bs fun co'
-- Float arg ticks: \x -> e (Tick t x) ==> Tick t e
go _ _ _ = Nothing -- Failure!
---------------
-- Note [Eta reduction conditions]
ok_fun (App fun (Type {})) = ok_fun fun
ok_fun (Cast fun _) = ok_fun fun
ok_fun (Tick _ expr) = ok_fun expr
ok_fun (Var fun_id) = ok_fun_id fun_id || all ok_lam bndrs
ok_fun _fun = False
---------------
ok_fun_id fun = fun_arity fun >= incoming_arity
---------------
fun_arity fun -- See Note [Arity care]
| isLocalId fun
, isStrongLoopBreaker (idOccInfo fun) = 0
| arity > 0 = arity
| isEvaldUnfolding (idUnfolding fun) = 1
-- See Note [Eta reduction of an eval'd function]
| otherwise = 0
where
arity = idArity fun
---------------
ok_lam v = isTyVar v || isEvVar v
---------------
ok_arg :: Var -- Of type bndr_t
-> CoreExpr -- Of type arg_t
-> Coercion -- Of kind (t1~t2)
-> Maybe (Coercion -- Of type (arg_t -> t1 ~ bndr_t -> t2)
-- (and similarly for tyvars, coercion args)
, [Tickish Var])
-- See Note [Eta reduction with casted arguments]
ok_arg bndr (Type ty) co
| Just tv <- getTyVar_maybe ty
, bndr == tv = Just (mkHomoForAllCos [tv] co, [])
ok_arg bndr (Var v) co
| bndr == v = let reflCo = mkRepReflCo (idType bndr)
in Just (mkFunCo Representational reflCo co, [])
ok_arg bndr (Cast e co_arg) co
| (ticks, Var v) <- stripTicksTop tickishFloatable e
, bndr == v
= Just (mkFunCo Representational (mkSymCo co_arg) co, ticks)
-- The simplifier combines multiple casts into one,
-- so we can have a simple-minded pattern match here
ok_arg bndr (Tick t arg) co
| tickishFloatable t, Just (co', ticks) <- ok_arg bndr arg co
= Just (co', t:ticks)
ok_arg _ _ _ = Nothing
{-
Note [Eta reduction of an eval'd function]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In Haskell it is not true that f = \x. f x
because f might be bottom, and 'seq' can distinguish them.
But it *is* true that f = f `seq` \x. f x
and we'd like to simplify the latter to the former. This amounts
to the rule that
* when there is just *one* value argument,
* f is not bottom
we can eta-reduce \x. f x ===> f
This turned up in #7542.
************************************************************************
* *
\subsection{Determining non-updatable right-hand-sides}
* *
************************************************************************
Top-level constructor applications can usually be allocated
statically, but they can't if the constructor, or any of the
arguments, come from another DLL (because we can't refer to static
labels in other DLLs).
If this happens we simply make the RHS into an updatable thunk,
and 'execute' it rather than allocating it statically.
-}
{-
************************************************************************
* *
\subsection{Type utilities}
* *
************************************************************************
-}
-- | True if the type has no non-bottom elements, e.g. when it is an empty
-- datatype, or a GADT with non-satisfiable type parameters, e.g. Int :~: Bool.
-- See Note [Bottoming expressions]
--
-- See Note [No alternatives lint check] for another use of this function. | 4,871 | false | true | 5 | 12 | 1,643 | 912 | 441 | 471 | null | null |
eryx67/haskell-libtorrent | src/Network/Libtorrent/TorrentHandle.hs | bsd-3-clause | forceRecheck :: MonadIO m => TorrentHandle -> m ()
forceRecheck ho =
liftIO . withPtr ho $ \hoPtr ->
checkError [except| { $(torrent_handle * hoPtr)->force_recheck(); } |] | 191 | forceRecheck :: MonadIO m => TorrentHandle -> m ()
forceRecheck ho =
liftIO . withPtr ho $ \hoPtr ->
checkError [except| { $(torrent_handle * hoPtr)->force_recheck(); } |] | 191 | forceRecheck ho =
liftIO . withPtr ho $ \hoPtr ->
checkError [except| { $(torrent_handle * hoPtr)->force_recheck(); } |] | 139 | false | true | 0 | 8 | 46 | 53 | 27 | 26 | null | null |
lucas8/MPSI | ipt/recursive/conv/conv.hs | mit | parse ('a':'p':'p':' ':l) = (approxp 2 (read l) (1e-10), True) | 63 | parse ('a':'p':'p':' ':l) = (approxp 2 (read l) (1e-10), True) | 63 | parse ('a':'p':'p':' ':l) = (approxp 2 (read l) (1e-10), True) | 63 | false | false | 0 | 9 | 10 | 51 | 26 | 25 | null | null |
kirstin-rhys/nestedmap | src/Data/Nested/Forest.hs | bsd-3-clause | fromFoldable ∷ (Foldable φ, Foldable ψ, Ord κ) ⇒ ψ (φ (κ, α)) → Forest κ α
fromFoldable = fromFoldableForest | 108 | fromFoldable ∷ (Foldable φ, Foldable ψ, Ord κ) ⇒ ψ (φ (κ, α)) → Forest κ α
fromFoldable = fromFoldableForest | 108 | fromFoldable = fromFoldableForest | 33 | false | true | 0 | 10 | 19 | 56 | 29 | 27 | null | null |
bitemyapp/hlint | src/Test/InputOutput.hs | bsd-3-clause | matchStar (x:xs) (y:ys) = x == y && matchStar xs ys | 51 | matchStar (x:xs) (y:ys) = x == y && matchStar xs ys | 51 | matchStar (x:xs) (y:ys) = x == y && matchStar xs ys | 51 | false | false | 2 | 6 | 10 | 36 | 17 | 19 | null | null |
d3alek/SudokuH | CSPframework.hs | bsd-2-clause | -- Deletes a single value from a domain.
domain_del :: Int -> Domain -> Domain
domain_del i d = delete i d | 106 | domain_del :: Int -> Domain -> Domain
domain_del i d = delete i d | 65 | domain_del i d = delete i d | 27 | true | true | 0 | 6 | 21 | 30 | 15 | 15 | null | null |
rwoll-hmc/project | src/Utils.hs | mit | -- | Format a into a line of `=` symbols totalling 80 characters.
fmtString s = unlines [divider, padText s, divider]
where
divider = replicate 80 '='
padText t = "==== " ++ t ++ " " ++ replicate (76 - length s - 2) '=' | 229 | fmtString s = unlines [divider, padText s, divider]
where
divider = replicate 80 '='
padText t = "==== " ++ t ++ " " ++ replicate (76 - length s - 2) '=' | 163 | fmtString s = unlines [divider, padText s, divider]
where
divider = replicate 80 '='
padText t = "==== " ++ t ++ " " ++ replicate (76 - length s - 2) '=' | 163 | true | false | 1 | 10 | 55 | 77 | 38 | 39 | null | null |
ksaveljev/hake-2 | src/Game/GameMisc.hs | bsd-3-clause | spLightMine2 :: Ref EdictT -> Quake ()
spLightMine2 edictRef = do
gameImport <- use $ gameBaseGlobals.gbGameImport
let modelIndex = gameImport^.giModelIndex
linkEntity = gameImport^.giLinkEntity
modelIdx <- modelIndex (Just "models/objects/minelite/light2/tris.md2")
modifyRef edictRef (\v -> v & eMoveType .~ Constants.moveTypeNone
& eSolid .~ Constants.solidBbox
& eEntityState.esModelIndex .~ modelIdx)
linkEntity edictRef
{-
- QUAKED misc_gib_arm (1 0 0) (-8 -8 -8) (8 8 8) Intended for use with the
- target_spawner
-} | 630 | spLightMine2 :: Ref EdictT -> Quake ()
spLightMine2 edictRef = do
gameImport <- use $ gameBaseGlobals.gbGameImport
let modelIndex = gameImport^.giModelIndex
linkEntity = gameImport^.giLinkEntity
modelIdx <- modelIndex (Just "models/objects/minelite/light2/tris.md2")
modifyRef edictRef (\v -> v & eMoveType .~ Constants.moveTypeNone
& eSolid .~ Constants.solidBbox
& eEntityState.esModelIndex .~ modelIdx)
linkEntity edictRef
{-
- QUAKED misc_gib_arm (1 0 0) (-8 -8 -8) (8 8 8) Intended for use with the
- target_spawner
-} | 630 | spLightMine2 edictRef = do
gameImport <- use $ gameBaseGlobals.gbGameImport
let modelIndex = gameImport^.giModelIndex
linkEntity = gameImport^.giLinkEntity
modelIdx <- modelIndex (Just "models/objects/minelite/light2/tris.md2")
modifyRef edictRef (\v -> v & eMoveType .~ Constants.moveTypeNone
& eSolid .~ Constants.solidBbox
& eEntityState.esModelIndex .~ modelIdx)
linkEntity edictRef
{-
- QUAKED misc_gib_arm (1 0 0) (-8 -8 -8) (8 8 8) Intended for use with the
- target_spawner
-} | 591 | false | true | 0 | 15 | 174 | 130 | 62 | 68 | null | null |
brendanhay/gogol | gogol-jobs/gen/Network/Google/Jobs/Types/Product.hs | mpl-2.0 | -- | Required if allow_missing_ids is unset or \`false\`. The client-defined
-- scope or source of the service call, which typically is the domain on
-- which the service has been implemented and is currently being run. For
-- example, if the service is being run by client *Foo, Inc.*, on job board
-- www.foo.com and career site www.bar.com, then this field is set to
-- \"foo.com\" for use on the job board, and \"bar.com\" for use on the
-- career site. Note that any improvements to the model for a particular
-- tenant site rely on this field being set correctly to a unique domain.
-- The maximum number of allowed characters is 255.
rmDomain :: Lens' RequestMetadata (Maybe Text)
rmDomain = lens _rmDomain (\ s a -> s{_rmDomain = a}) | 741 | rmDomain :: Lens' RequestMetadata (Maybe Text)
rmDomain = lens _rmDomain (\ s a -> s{_rmDomain = a}) | 100 | rmDomain = lens _rmDomain (\ s a -> s{_rmDomain = a}) | 53 | true | true | 0 | 9 | 131 | 54 | 33 | 21 | null | null |
kyren/hstecs | library/Tecs/Definitions.hs | unlicense | compDesc CompMinusD = ("-D", 0x0f) | 34 | compDesc CompMinusD = ("-D", 0x0f) | 34 | compDesc CompMinusD = ("-D", 0x0f) | 34 | false | false | 0 | 5 | 4 | 15 | 8 | 7 | null | null |
Rydgel/flappy-haskell | src/Rendering.hs | mit | destroyAudios :: SFX -> IO ()
destroyAudios as = do
destroyAudio $ unAudio $ dieA as
destroyAudio $ unAudio $ hitA as
destroyAudio $ unAudio $ pointA as
destroyAudio $ unAudio $ swooshA as
destroyAudio $ unAudio $ wingA as | 232 | destroyAudios :: SFX -> IO ()
destroyAudios as = do
destroyAudio $ unAudio $ dieA as
destroyAudio $ unAudio $ hitA as
destroyAudio $ unAudio $ pointA as
destroyAudio $ unAudio $ swooshA as
destroyAudio $ unAudio $ wingA as | 232 | destroyAudios as = do
destroyAudio $ unAudio $ dieA as
destroyAudio $ unAudio $ hitA as
destroyAudio $ unAudio $ pointA as
destroyAudio $ unAudio $ swooshA as
destroyAudio $ unAudio $ wingA as | 202 | false | true | 0 | 8 | 49 | 93 | 41 | 52 | null | null |
benjaminselfridge/logix | src/Calculi.hs | bsd-3-clause | a_x_t = SubstPat "x" (TermPat "t") "A" | 38 | a_x_t = SubstPat "x" (TermPat "t") "A" | 38 | a_x_t = SubstPat "x" (TermPat "t") "A" | 38 | false | false | 1 | 7 | 6 | 22 | 9 | 13 | null | null |
SkyA1ex/tetris | src/Figures.hs | bsd-3-clause | getFigures Corner1 D2 = Figure Corner1 D2 [(0,0),(0,-1),(0,1),(1,1)] | 68 | getFigures Corner1 D2 = Figure Corner1 D2 [(0,0),(0,-1),(0,1),(1,1)] | 68 | getFigures Corner1 D2 = Figure Corner1 D2 [(0,0),(0,-1),(0,1),(1,1)] | 68 | false | false | 0 | 8 | 7 | 56 | 33 | 23 | null | null |
meimisaki/Rin | src/Type/Unify.hs | mit | unifyVar :: TyMeta -> Tau -> TI ()
unifyVar var1 tau2 = do
mbTau1 <- readMeta var1
case mbTau1 of
Nothing -> unifyUnboundVar var1 tau2
Just tau1 -> unify tau1 tau2 | 175 | unifyVar :: TyMeta -> Tau -> TI ()
unifyVar var1 tau2 = do
mbTau1 <- readMeta var1
case mbTau1 of
Nothing -> unifyUnboundVar var1 tau2
Just tau1 -> unify tau1 tau2 | 175 | unifyVar var1 tau2 = do
mbTau1 <- readMeta var1
case mbTau1 of
Nothing -> unifyUnboundVar var1 tau2
Just tau1 -> unify tau1 tau2 | 140 | false | true | 0 | 11 | 42 | 76 | 33 | 43 | null | null |
rodrigogribeiro/mptc | src/Tc/Kc/KcEnv.hs | bsd-3-clause | -- removing some entries with specified Id's
(^-) :: KcEnv -> [Id] -> KcEnv
env ^- ids = Map.filterWithKey (\k _ -> (identry k) `notElem` ids) env | 147 | (^-) :: KcEnv -> [Id] -> KcEnv
env ^- ids = Map.filterWithKey (\k _ -> (identry k) `notElem` ids) env | 101 | env ^- ids = Map.filterWithKey (\k _ -> (identry k) `notElem` ids) env | 70 | true | true | 0 | 10 | 27 | 60 | 33 | 27 | null | null |
sdiehl/ghc | compiler/basicTypes/OccName.hs | bsd-3-clause | pprNameSpaceBrief TvName = text "tv" | 39 | pprNameSpaceBrief TvName = text "tv" | 39 | pprNameSpaceBrief TvName = text "tv" | 39 | false | false | 0 | 5 | 7 | 12 | 5 | 7 | null | null |
markus-git/PBKDF2 | src/Hard.hs | bsd-3-clause | foldlHM
:: (HBlock -> HInt -> Hardware ()) -- update function.
-> HBlock -- initial block.
-> HInt -- lower range.
-> HInt -- upper range.
-> Hardware HBlock
foldlHM f b l u =
do for l u (\ix -> f b ix)
return b
-------------------------------------------------------------------------------- | 310 | foldlHM
:: (HBlock -> HInt -> Hardware ()) -- update function.
-> HBlock -- initial block.
-> HInt -- lower range.
-> HInt -- upper range.
-> Hardware HBlock
foldlHM f b l u =
do for l u (\ix -> f b ix)
return b
-------------------------------------------------------------------------------- | 310 | foldlHM f b l u =
do for l u (\ix -> f b ix)
return b
-------------------------------------------------------------------------------- | 142 | false | true | 0 | 11 | 64 | 94 | 46 | 48 | null | null |
lukexi/tinyrick | app/EditorRick.hs | bsd-3-clause | fontFile :: FilePath
fontFile = "fonts/SourceCodePro-Regular.ttf" | 65 | fontFile :: FilePath
fontFile = "fonts/SourceCodePro-Regular.ttf" | 65 | fontFile = "fonts/SourceCodePro-Regular.ttf" | 44 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
slpopejoy/fadno-xml | src/Fadno/MusicXml/MusicXml30.hs | bsd-2-clause | -- | Smart constructor for 'Beam'
mkBeam :: BeamValue -> Beam
mkBeam a = Beam a Nothing Nothing Nothing Nothing | 111 | mkBeam :: BeamValue -> Beam
mkBeam a = Beam a Nothing Nothing Nothing Nothing | 77 | mkBeam a = Beam a Nothing Nothing Nothing Nothing | 49 | true | true | 0 | 5 | 19 | 30 | 15 | 15 | null | null |
sanjoy/echoes | src/HIR/HIR.hs | gpl-3.0 | openLambdas (IntT lit) = IntT lit | 33 | openLambdas (IntT lit) = IntT lit | 33 | openLambdas (IntT lit) = IntT lit | 33 | false | false | 0 | 6 | 5 | 19 | 8 | 11 | null | null |
haroldcarr/juno | app/X/Run.hs | bsd-3-clause | logDir = "log" | 17 | logDir = "log" | 17 | logDir = "log" | 17 | false | false | 1 | 5 | 5 | 10 | 3 | 7 | null | null |
zepto-lang/zepto-js | src/Zepto/Macro.hs | gpl-2.0 | macroEval _ lisp@_ = return lisp | 32 | macroEval _ lisp@_ = return lisp | 32 | macroEval _ lisp@_ = return lisp | 32 | false | false | 0 | 6 | 5 | 20 | 9 | 11 | null | null |
geraud/access | library/Access/Process.hs | mit | getInstanceData :: [Predicate] -> Account -> IO [InstanceMetaData]
getInstanceData predicates a = do
instancesData <- loadInstancesMetaData a
return $ filter (filterResults predicates) instancesData | 206 | getInstanceData :: [Predicate] -> Account -> IO [InstanceMetaData]
getInstanceData predicates a = do
instancesData <- loadInstancesMetaData a
return $ filter (filterResults predicates) instancesData | 206 | getInstanceData predicates a = do
instancesData <- loadInstancesMetaData a
return $ filter (filterResults predicates) instancesData | 139 | false | true | 0 | 11 | 30 | 66 | 30 | 36 | null | null |
jaspervdj/lorem-markdownum | lib/LoremMarkdownum/Gen/Markdown.hs | bsd-3-clause | printBlock mc (QuoteB p) = printWrapIndent "> " $
printText "> " >> printParagraph mc p | 99 | printBlock mc (QuoteB p) = printWrapIndent "> " $
printText "> " >> printParagraph mc p | 99 | printBlock mc (QuoteB p) = printWrapIndent "> " $
printText "> " >> printParagraph mc p | 99 | false | false | 0 | 7 | 27 | 36 | 16 | 20 | null | null |
alphaKAI/mal | haskell/Printer.hs | mpl-2.0 | _pr_str pr (MalVector items _) = "[" ++ (_pr_list pr " " items) ++ "]" | 73 | _pr_str pr (MalVector items _) = "[" ++ (_pr_list pr " " items) ++ "]" | 73 | _pr_str pr (MalVector items _) = "[" ++ (_pr_list pr " " items) ++ "]" | 73 | false | false | 0 | 8 | 17 | 39 | 18 | 21 | null | null |
stormont/hs-mapreduce | Distributed/MapReduce/Controller.hs | apache-2.0 | timeOutNode :: (Eq i, Eq j) => Controller j i r -> Node i j r -> Controller j i r
timeOutNode c n =
if all (/= n) (nodes c)
then c
else case currentJob n of
Nothing -> unregisterNode c n
Just x -> unregisterNode c' n
where c' = pushJob x c | 292 | timeOutNode :: (Eq i, Eq j) => Controller j i r -> Node i j r -> Controller j i r
timeOutNode c n =
if all (/= n) (nodes c)
then c
else case currentJob n of
Nothing -> unregisterNode c n
Just x -> unregisterNode c' n
where c' = pushJob x c | 292 | timeOutNode c n =
if all (/= n) (nodes c)
then c
else case currentJob n of
Nothing -> unregisterNode c n
Just x -> unregisterNode c' n
where c' = pushJob x c | 210 | false | true | 0 | 11 | 107 | 131 | 63 | 68 | null | null |
sdiehl/ghc | compiler/basicTypes/VarSet.hs | bsd-3-clause | disjointVarSet s1 s2 = disjointUFM (getUniqSet s1) (getUniqSet s2) | 68 | disjointVarSet s1 s2 = disjointUFM (getUniqSet s1) (getUniqSet s2) | 68 | disjointVarSet s1 s2 = disjointUFM (getUniqSet s1) (getUniqSet s2) | 68 | false | false | 0 | 7 | 10 | 28 | 13 | 15 | null | null |
tjakway/ghcjvm | compiler/llvmGen/LlvmCodeGen/CodeGen.hs | bsd-3-clause | genCallWithOverflow
:: ForeignTarget -> Width -> [CmmFormal] -> [CmmActual] -> LlvmM StmtData
genCallWithOverflow t@(PrimTarget op) w [dstV, dstO] [lhs, rhs] = do
-- So far this was only tested for the following four CallishMachOps.
let valid = op `elem` [ MO_Add2 w
, MO_AddIntC w
, MO_SubIntC w
, MO_SubWordC w
]
MASSERT(valid)
let width = widthToLlvmInt w
-- This will do most of the work of generating the call to the intrinsic and
-- extracting the values from the struct.
(value, overflowBit, (stmts, top)) <-
genCallExtract t w (lhs, rhs) (width, i1)
-- value is i<width>, but overflowBit is i1, so we need to cast (Cmm expects
-- both to be i<width>)
(overflow, zext) <- doExpr width $ Cast LM_Zext overflowBit width
dstRegV <- getCmmReg (CmmLocal dstV)
dstRegO <- getCmmReg (CmmLocal dstO)
let storeV = Store value dstRegV
storeO = Store overflow dstRegO
return (stmts `snocOL` zext `snocOL` storeV `snocOL` storeO, top) | 1,115 | genCallWithOverflow
:: ForeignTarget -> Width -> [CmmFormal] -> [CmmActual] -> LlvmM StmtData
genCallWithOverflow t@(PrimTarget op) w [dstV, dstO] [lhs, rhs] = do
-- So far this was only tested for the following four CallishMachOps.
let valid = op `elem` [ MO_Add2 w
, MO_AddIntC w
, MO_SubIntC w
, MO_SubWordC w
]
MASSERT(valid)
let width = widthToLlvmInt w
-- This will do most of the work of generating the call to the intrinsic and
-- extracting the values from the struct.
(value, overflowBit, (stmts, top)) <-
genCallExtract t w (lhs, rhs) (width, i1)
-- value is i<width>, but overflowBit is i1, so we need to cast (Cmm expects
-- both to be i<width>)
(overflow, zext) <- doExpr width $ Cast LM_Zext overflowBit width
dstRegV <- getCmmReg (CmmLocal dstV)
dstRegO <- getCmmReg (CmmLocal dstO)
let storeV = Store value dstRegV
storeO = Store overflow dstRegO
return (stmts `snocOL` zext `snocOL` storeV `snocOL` storeO, top) | 1,115 | genCallWithOverflow t@(PrimTarget op) w [dstV, dstO] [lhs, rhs] = do
-- So far this was only tested for the following four CallishMachOps.
let valid = op `elem` [ MO_Add2 w
, MO_AddIntC w
, MO_SubIntC w
, MO_SubWordC w
]
MASSERT(valid)
let width = widthToLlvmInt w
-- This will do most of the work of generating the call to the intrinsic and
-- extracting the values from the struct.
(value, overflowBit, (stmts, top)) <-
genCallExtract t w (lhs, rhs) (width, i1)
-- value is i<width>, but overflowBit is i1, so we need to cast (Cmm expects
-- both to be i<width>)
(overflow, zext) <- doExpr width $ Cast LM_Zext overflowBit width
dstRegV <- getCmmReg (CmmLocal dstV)
dstRegO <- getCmmReg (CmmLocal dstO)
let storeV = Store value dstRegV
storeO = Store overflow dstRegO
return (stmts `snocOL` zext `snocOL` storeV `snocOL` storeO, top) | 1,019 | false | true | 0 | 13 | 338 | 291 | 152 | 139 | null | null |
gridaphobe/target | examples/MapTests.hs | mit | hedgeDiff_bad blo bhi t (Bin _ kx _ l r) = merge_bad kx (hedgeDiff_bad blo bmi (trim_bad blo bmi t) l)
(hedgeDiff_bad bmi bhi (trim_bad bmi bhi t) r)
where bmi = JustS kx
--LIQUID: having trouble injecting bug here | 271 | hedgeDiff_bad blo bhi t (Bin _ kx _ l r) = merge_bad kx (hedgeDiff_bad blo bmi (trim_bad blo bmi t) l)
(hedgeDiff_bad bmi bhi (trim_bad bmi bhi t) r)
where bmi = JustS kx
--LIQUID: having trouble injecting bug here | 271 | hedgeDiff_bad blo bhi t (Bin _ kx _ l r) = merge_bad kx (hedgeDiff_bad blo bmi (trim_bad blo bmi t) l)
(hedgeDiff_bad bmi bhi (trim_bad bmi bhi t) r)
where bmi = JustS kx
--LIQUID: having trouble injecting bug here | 271 | false | false | 0 | 9 | 96 | 92 | 45 | 47 | null | null |
anttisalonen/lvm | src/stau/TypeCheck.hs | gpl-3.0 | sigTypeToType _ [] = throwError "Invalid type signature" | 60 | sigTypeToType _ [] = throwError "Invalid type signature" | 60 | sigTypeToType _ [] = throwError "Invalid type signature" | 60 | false | false | 0 | 6 | 11 | 16 | 7 | 9 | null | null |
brendanhay/gogol | gogol-appengine/gen/Network/Google/Resource/AppEngine/Apps/Services/Versions/Instances/Delete.hs | mpl-2.0 | -- | Part of \`name\`. Name of the resource requested. Example:
-- apps\/myapp\/services\/default\/versions\/v1\/instances\/instance-1.
aAppsId :: Lens' AppsServicesVersionsInstancesDelete Text
aAppsId = lens _aAppsId (\ s a -> s{_aAppsId = a}) | 244 | aAppsId :: Lens' AppsServicesVersionsInstancesDelete Text
aAppsId = lens _aAppsId (\ s a -> s{_aAppsId = a}) | 108 | aAppsId = lens _aAppsId (\ s a -> s{_aAppsId = a}) | 50 | true | true | 1 | 9 | 28 | 46 | 23 | 23 | null | null |
sdiehl/ghc | compiler/specialise/Rules.hs | bsd-3-clause | roughTopName :: CoreExpr -> Maybe Name
roughTopName (Type ty) = case tcSplitTyConApp_maybe ty of
Just (tc,_) -> Just (getName tc)
Nothing -> Nothing | 214 | roughTopName :: CoreExpr -> Maybe Name
roughTopName (Type ty) = case tcSplitTyConApp_maybe ty of
Just (tc,_) -> Just (getName tc)
Nothing -> Nothing | 214 | roughTopName (Type ty) = case tcSplitTyConApp_maybe ty of
Just (tc,_) -> Just (getName tc)
Nothing -> Nothing | 175 | false | true | 0 | 10 | 88 | 64 | 31 | 33 | null | null |
evancz/cli | src/Develop/Generate/NotFound.hs | bsd-3-clause | html :: H.Html
html =
Help.makeHtml
"Page Not Found"
("/" ++ StaticFiles.elmPath)
"Elm.NotFound.fullscreen();" | 124 | html :: H.Html
html =
Help.makeHtml
"Page Not Found"
("/" ++ StaticFiles.elmPath)
"Elm.NotFound.fullscreen();" | 124 | html =
Help.makeHtml
"Page Not Found"
("/" ++ StaticFiles.elmPath)
"Elm.NotFound.fullscreen();" | 109 | false | true | 0 | 7 | 26 | 40 | 17 | 23 | null | null |
sashabu/libcspm | src/CSPM/Evaluator/ValueSet.hs | bsd-3-clause | empty (CompositeSet ss) = F.and (fmap empty ss) | 47 | empty (CompositeSet ss) = F.and (fmap empty ss) | 47 | empty (CompositeSet ss) = F.and (fmap empty ss) | 47 | false | false | 0 | 7 | 7 | 28 | 13 | 15 | null | null |
mtesseract/silverratio-jeopardy | src/jeopardy.hs | gpl-2.0 | _GUIInitPlayer :: IORef State -> IO ()
_GUIInitPlayer state' = do
state <- readIORef state'
assert (isJust (stateCurrentPlayer state)) $ return ()
let builder = stateBuilder state
playerID' = stateCurrentPlayer state
playerID = assert (isJust playerID') $ fromJust playerID'
playerTable = statePlayers state
-- We assume it is a valid PlayerID!
player' = M.lookup playerID playerTable
player = assert (isJust player') $ fromJust player'
win <- _GUIWindow builder "window_player_init"
labelName <- _GUILabel builder "player_init_name"
labelSetText labelName $ playerName player
parent <- _GUIWindow builder "window2"
windowSetTransientFor win parent
windowSetModal win True
widgetShow win | 745 | _GUIInitPlayer :: IORef State -> IO ()
_GUIInitPlayer state' = do
state <- readIORef state'
assert (isJust (stateCurrentPlayer state)) $ return ()
let builder = stateBuilder state
playerID' = stateCurrentPlayer state
playerID = assert (isJust playerID') $ fromJust playerID'
playerTable = statePlayers state
-- We assume it is a valid PlayerID!
player' = M.lookup playerID playerTable
player = assert (isJust player') $ fromJust player'
win <- _GUIWindow builder "window_player_init"
labelName <- _GUILabel builder "player_init_name"
labelSetText labelName $ playerName player
parent <- _GUIWindow builder "window2"
windowSetTransientFor win parent
windowSetModal win True
widgetShow win | 745 | _GUIInitPlayer state' = do
state <- readIORef state'
assert (isJust (stateCurrentPlayer state)) $ return ()
let builder = stateBuilder state
playerID' = stateCurrentPlayer state
playerID = assert (isJust playerID') $ fromJust playerID'
playerTable = statePlayers state
-- We assume it is a valid PlayerID!
player' = M.lookup playerID playerTable
player = assert (isJust player') $ fromJust player'
win <- _GUIWindow builder "window_player_init"
labelName <- _GUILabel builder "player_init_name"
labelSetText labelName $ playerName player
parent <- _GUIWindow builder "window2"
windowSetTransientFor win parent
windowSetModal win True
widgetShow win | 706 | false | true | 0 | 13 | 149 | 217 | 96 | 121 | null | null |
alexander-at-github/eta | compiler/ETA/Main/HscMain.hs | bsd-3-clause | outputForeignStubs dflags (ForeignStubs _ _ classExports) =
map f $ foreignExportsList classExports
where f (classSpec, (methodDefs, fieldDefs)) =
mkClassFile java7 [Public, Super] (jvmify className) (Just superClass)
interfaces fieldDefs methodDefs''
where className:specs = T.words classSpec
methodDefs' = genClInit className : methodDefs
methodDefs'' = if hasConstructor
then methodDefs'
else mkDefaultConstructor className superClass
: methodDefs'
hasConstructor = any (\(MethodDef _ (UName n) _ _) ->
n == "<init>") methodDefs
(superClass, interfaces) = parseSpecs specs jobjectC []
parseSpecs ("extends":superClass:xs) _ is = parseSpecs xs (jvmify superClass) is
parseSpecs ("implements":interface:xs) sc is = parseSpecs xs sc (jvmify interface:is)
parseSpecs [] sc is = (sc, reverse is)
parseSpecs _ _ _ = error $ "Invalid foreign export spec."
jvmify = T.map (\c -> if c == '.' then '/' else c)
genClInit cls = mkMethodDef cls [Public, Static] "<clinit>" [] void $ fold
[ iconst jint (fromIntegral 0)
, new (jarray jstring)
, invokestatic (mkMethodRef "eta/runtime/RtsConfig"
"getDefault" [] (ret rtsConfigType))
, invokestatic (mkMethodRef "eta/runtime/Rts" "hsInit"
[jarray jstring, rtsConfigType] void)
, vreturn ] | 1,723 | outputForeignStubs dflags (ForeignStubs _ _ classExports) =
map f $ foreignExportsList classExports
where f (classSpec, (methodDefs, fieldDefs)) =
mkClassFile java7 [Public, Super] (jvmify className) (Just superClass)
interfaces fieldDefs methodDefs''
where className:specs = T.words classSpec
methodDefs' = genClInit className : methodDefs
methodDefs'' = if hasConstructor
then methodDefs'
else mkDefaultConstructor className superClass
: methodDefs'
hasConstructor = any (\(MethodDef _ (UName n) _ _) ->
n == "<init>") methodDefs
(superClass, interfaces) = parseSpecs specs jobjectC []
parseSpecs ("extends":superClass:xs) _ is = parseSpecs xs (jvmify superClass) is
parseSpecs ("implements":interface:xs) sc is = parseSpecs xs sc (jvmify interface:is)
parseSpecs [] sc is = (sc, reverse is)
parseSpecs _ _ _ = error $ "Invalid foreign export spec."
jvmify = T.map (\c -> if c == '.' then '/' else c)
genClInit cls = mkMethodDef cls [Public, Static] "<clinit>" [] void $ fold
[ iconst jint (fromIntegral 0)
, new (jarray jstring)
, invokestatic (mkMethodRef "eta/runtime/RtsConfig"
"getDefault" [] (ret rtsConfigType))
, invokestatic (mkMethodRef "eta/runtime/Rts" "hsInit"
[jarray jstring, rtsConfigType] void)
, vreturn ] | 1,723 | outputForeignStubs dflags (ForeignStubs _ _ classExports) =
map f $ foreignExportsList classExports
where f (classSpec, (methodDefs, fieldDefs)) =
mkClassFile java7 [Public, Super] (jvmify className) (Just superClass)
interfaces fieldDefs methodDefs''
where className:specs = T.words classSpec
methodDefs' = genClInit className : methodDefs
methodDefs'' = if hasConstructor
then methodDefs'
else mkDefaultConstructor className superClass
: methodDefs'
hasConstructor = any (\(MethodDef _ (UName n) _ _) ->
n == "<init>") methodDefs
(superClass, interfaces) = parseSpecs specs jobjectC []
parseSpecs ("extends":superClass:xs) _ is = parseSpecs xs (jvmify superClass) is
parseSpecs ("implements":interface:xs) sc is = parseSpecs xs sc (jvmify interface:is)
parseSpecs [] sc is = (sc, reverse is)
parseSpecs _ _ _ = error $ "Invalid foreign export spec."
jvmify = T.map (\c -> if c == '.' then '/' else c)
genClInit cls = mkMethodDef cls [Public, Static] "<clinit>" [] void $ fold
[ iconst jint (fromIntegral 0)
, new (jarray jstring)
, invokestatic (mkMethodRef "eta/runtime/RtsConfig"
"getDefault" [] (ret rtsConfigType))
, invokestatic (mkMethodRef "eta/runtime/Rts" "hsInit"
[jarray jstring, rtsConfigType] void)
, vreturn ] | 1,723 | false | false | 7 | 12 | 663 | 479 | 235 | 244 | null | null |
random-j-farmer/hs-little-helper | Application.hs | mit | shutdownApp :: App -> IO ()
shutdownApp _ = return () | 53 | shutdownApp :: App -> IO ()
shutdownApp _ = return () | 53 | shutdownApp _ = return () | 25 | false | true | 0 | 7 | 10 | 28 | 13 | 15 | null | null |
xosmig/haskell-hw-game | app/Main.hs | bsd-3-clause | drawStringHere w s = updateWindow w (drawString s) | 50 | drawStringHere w s = updateWindow w (drawString s) | 50 | drawStringHere w s = updateWindow w (drawString s) | 50 | false | false | 0 | 7 | 7 | 22 | 10 | 12 | null | null |
facebookincubator/duckling | Duckling/Rules/Common.hs | bsd-3-clause | rules (Seal TimeGrain) = [] | 27 | rules (Seal TimeGrain) = [] | 27 | rules (Seal TimeGrain) = [] | 27 | false | false | 0 | 7 | 4 | 17 | 8 | 9 | null | null |
tolysz/prepare-ghcjs | spec-lts8/cabal/cabal-install/Distribution/Client/Dependency/TopDown.hs | bsd-3-clause | listOf disp (x0:x1:xs) = disp x0 ++ go x1 xs
where go x [] = " and " ++ disp x
go x (x':xs') = ", " ++ disp x ++ go x' xs'
-- ------------------------------------------------------------
-- * Construct a dependency graph
-- ------------------------------------------------------------
-- | Builds a graph of the package dependencies.
--
-- Dependencies on other packages that are not in the index are discarded.
-- You can check if there are any such dependencies with 'brokenPackages'.
--
-- The top-down solver gets its own implementation, because both
-- `dependencyGraph` in `Distribution.Client.PlanIndex` (in cabal-install) and
-- `dependencyGraph` in `Distribution.Simple.PackageIndex` (in Cabal) both work
-- with `PackageIndex` from `Cabal` (that is, a package index indexed by
-- installed package IDs rather than package names).
--
-- Ideally we would switch the top-down solver over to use that too, so that
-- this duplication could be avoided, but that's a bit of work and the top-down
-- solver is legacy code anyway.
--
-- (NOTE: This is called at two types: InstalledPackage and FinalSelectedPackage.) | 1,136 | listOf disp (x0:x1:xs) = disp x0 ++ go x1 xs
where go x [] = " and " ++ disp x
go x (x':xs') = ", " ++ disp x ++ go x' xs'
-- ------------------------------------------------------------
-- * Construct a dependency graph
-- ------------------------------------------------------------
-- | Builds a graph of the package dependencies.
--
-- Dependencies on other packages that are not in the index are discarded.
-- You can check if there are any such dependencies with 'brokenPackages'.
--
-- The top-down solver gets its own implementation, because both
-- `dependencyGraph` in `Distribution.Client.PlanIndex` (in cabal-install) and
-- `dependencyGraph` in `Distribution.Simple.PackageIndex` (in Cabal) both work
-- with `PackageIndex` from `Cabal` (that is, a package index indexed by
-- installed package IDs rather than package names).
--
-- Ideally we would switch the top-down solver over to use that too, so that
-- this duplication could be avoided, but that's a bit of work and the top-down
-- solver is legacy code anyway.
--
-- (NOTE: This is called at two types: InstalledPackage and FinalSelectedPackage.) | 1,136 | listOf disp (x0:x1:xs) = disp x0 ++ go x1 xs
where go x [] = " and " ++ disp x
go x (x':xs') = ", " ++ disp x ++ go x' xs'
-- ------------------------------------------------------------
-- * Construct a dependency graph
-- ------------------------------------------------------------
-- | Builds a graph of the package dependencies.
--
-- Dependencies on other packages that are not in the index are discarded.
-- You can check if there are any such dependencies with 'brokenPackages'.
--
-- The top-down solver gets its own implementation, because both
-- `dependencyGraph` in `Distribution.Client.PlanIndex` (in cabal-install) and
-- `dependencyGraph` in `Distribution.Simple.PackageIndex` (in Cabal) both work
-- with `PackageIndex` from `Cabal` (that is, a package index indexed by
-- installed package IDs rather than package names).
--
-- Ideally we would switch the top-down solver over to use that too, so that
-- this duplication could be avoided, but that's a bit of work and the top-down
-- solver is legacy code anyway.
--
-- (NOTE: This is called at two types: InstalledPackage and FinalSelectedPackage.) | 1,136 | false | false | 0 | 7 | 191 | 114 | 61 | 53 | null | null |
nevrenato/Hets_Fork | LF/ImplOL.hs | gpl-2.0 | makeSigSenOL :: Morphism -> Sign -> [Annoted BASIC_ITEM] ->
IO (Sign,[(NAME,Sentence)])
makeSigSenOL ltruth sig items = do
-- make a Twelf file
let sen_type = case mapSymbol sen_type_symbol ltruth of
Nothing -> error $ badSenTypeError
Just t -> show $ pretty t
let lSyn = target ltruth
file <- mkImport lSyn
let imp = mkRead file
let cont1 = if sig == lSyn then "" else printLocalDefs sig
let cont2 = printSigItems $ getSigItems items
let cont3 = printSenItems sen_type $ getSenItems items
let s1 = mkSig gen_sig1 $ mkIncl (sigModule lSyn) ++ cont1 ++ cont2
let s2 = mkSig gen_sig2 $ mkIncl gen_sig1 ++ cont3
let contents = imp ++ "\n" ++ s1 ++ "\n" ++ s2
writeFile gen_file contents
-- run Twelf on the created file
libs <- twelf2SigMor HETS gen_file
-- construct the signature and sentences
sig1 <- getSigFromLibs gen_sig1 libs
sig2 <- getSigFromLibs gen_sig2 libs
let sens = getSens sig2
return (sig1,sens) | 1,013 | makeSigSenOL :: Morphism -> Sign -> [Annoted BASIC_ITEM] ->
IO (Sign,[(NAME,Sentence)])
makeSigSenOL ltruth sig items = do
-- make a Twelf file
let sen_type = case mapSymbol sen_type_symbol ltruth of
Nothing -> error $ badSenTypeError
Just t -> show $ pretty t
let lSyn = target ltruth
file <- mkImport lSyn
let imp = mkRead file
let cont1 = if sig == lSyn then "" else printLocalDefs sig
let cont2 = printSigItems $ getSigItems items
let cont3 = printSenItems sen_type $ getSenItems items
let s1 = mkSig gen_sig1 $ mkIncl (sigModule lSyn) ++ cont1 ++ cont2
let s2 = mkSig gen_sig2 $ mkIncl gen_sig1 ++ cont3
let contents = imp ++ "\n" ++ s1 ++ "\n" ++ s2
writeFile gen_file contents
-- run Twelf on the created file
libs <- twelf2SigMor HETS gen_file
-- construct the signature and sentences
sig1 <- getSigFromLibs gen_sig1 libs
sig2 <- getSigFromLibs gen_sig2 libs
let sens = getSens sig2
return (sig1,sens) | 1,013 | makeSigSenOL ltruth sig items = do
-- make a Twelf file
let sen_type = case mapSymbol sen_type_symbol ltruth of
Nothing -> error $ badSenTypeError
Just t -> show $ pretty t
let lSyn = target ltruth
file <- mkImport lSyn
let imp = mkRead file
let cont1 = if sig == lSyn then "" else printLocalDefs sig
let cont2 = printSigItems $ getSigItems items
let cont3 = printSenItems sen_type $ getSenItems items
let s1 = mkSig gen_sig1 $ mkIncl (sigModule lSyn) ++ cont1 ++ cont2
let s2 = mkSig gen_sig2 $ mkIncl gen_sig1 ++ cont3
let contents = imp ++ "\n" ++ s1 ++ "\n" ++ s2
writeFile gen_file contents
-- run Twelf on the created file
libs <- twelf2SigMor HETS gen_file
-- construct the signature and sentences
sig1 <- getSigFromLibs gen_sig1 libs
sig2 <- getSigFromLibs gen_sig2 libs
let sens = getSens sig2
return (sig1,sens) | 909 | false | true | 0 | 15 | 259 | 343 | 159 | 184 | null | null |
brendanhay/gogol | gogol-pagespeed/gen/Network/Google/PageSpeed/Types/Product.hs | mpl-2.0 | -- | The weight this audit\'s score has on the overall category score.
arWeight :: Lens' AuditRefs (Maybe Double)
arWeight
= lens _arWeight (\ s a -> s{_arWeight = a}) .
mapping _Coerce | 193 | arWeight :: Lens' AuditRefs (Maybe Double)
arWeight
= lens _arWeight (\ s a -> s{_arWeight = a}) .
mapping _Coerce | 122 | arWeight
= lens _arWeight (\ s a -> s{_arWeight = a}) .
mapping _Coerce | 79 | true | true | 1 | 9 | 40 | 59 | 28 | 31 | null | null |
ggkitsas/HaLVM | src/HALVMCore/Hypervisor/Control.hs | bsd-3-clause | setDomainMaxVCPUs :: DomId -> Word32 -> IO ()
setDomainMaxVCPUs dom numcpus =
domainControlOp DomCtlSetDomainMaxVCPUs (fromDomId dom)
(\ p -> poke p numcpus)
(\ _ _ _ -> return ()) | 190 | setDomainMaxVCPUs :: DomId -> Word32 -> IO ()
setDomainMaxVCPUs dom numcpus =
domainControlOp DomCtlSetDomainMaxVCPUs (fromDomId dom)
(\ p -> poke p numcpus)
(\ _ _ _ -> return ()) | 190 | setDomainMaxVCPUs dom numcpus =
domainControlOp DomCtlSetDomainMaxVCPUs (fromDomId dom)
(\ p -> poke p numcpus)
(\ _ _ _ -> return ()) | 144 | false | true | 0 | 8 | 38 | 76 | 37 | 39 | null | null |
mightymoose/liquidhaskell | tests/pos/SimplerNotation.hs | bsd-3-clause | {-@ myDiv :: x:Int -> y:{Int | y != 0} -> {v:Int | v = x / y} @-}
myDiv :: Int -> Int -> Int
myDiv = div | 104 | myDiv :: Int -> Int -> Int
myDiv = div | 38 | myDiv = div | 11 | true | true | 0 | 6 | 28 | 20 | 11 | 9 | null | null |
CIFASIS/wavy | src/Splitter.hs | bsd-3-clause | splitFile :: FilePath -> IO ()
splitFile filePath = do
riffFile <- decodeWaveFile filePath
case splitWavFile riffFile of
Left error -> putStrLn error
Right files -> zipWithM_ encodeWaveFile filenames files
where
filenames = fmap filenameFor [1..]
filenameFor n = base ++ "." ++ show n ++ ext
(base, ext) = splitExtension filePath
-- TODO If a fact chunk is present then this function should update it | 440 | splitFile :: FilePath -> IO ()
splitFile filePath = do
riffFile <- decodeWaveFile filePath
case splitWavFile riffFile of
Left error -> putStrLn error
Right files -> zipWithM_ encodeWaveFile filenames files
where
filenames = fmap filenameFor [1..]
filenameFor n = base ++ "." ++ show n ++ ext
(base, ext) = splitExtension filePath
-- TODO If a fact chunk is present then this function should update it | 440 | splitFile filePath = do
riffFile <- decodeWaveFile filePath
case splitWavFile riffFile of
Left error -> putStrLn error
Right files -> zipWithM_ encodeWaveFile filenames files
where
filenames = fmap filenameFor [1..]
filenameFor n = base ++ "." ++ show n ++ ext
(base, ext) = splitExtension filePath
-- TODO If a fact chunk is present then this function should update it | 409 | false | true | 0 | 10 | 105 | 125 | 59 | 66 | null | null |
urbanslug/ghc | testsuite/tests/parser/should_compile/read011.hs | bsd-3-clause | f3 :: IO a -> IO [a]
f3 x = do
v <- x
return (g v)
where
g x = [x,x] | 77 | f3 :: IO a -> IO [a]
f3 x = do
v <- x
return (g v)
where
g x = [x,x] | 77 | f3 x = do
v <- x
return (g v)
where
g x = [x,x] | 56 | false | true | 1 | 9 | 30 | 70 | 31 | 39 | null | null |
alphalambda/k12math | contrib/MHills/GeometryLessons/code/teacher/key_lesson3N1.hs | mit | midpoint (x1,y1) (x2,y2) = ((x1+x2)/2,(y1+y2)/2) | 48 | midpoint (x1,y1) (x2,y2) = ((x1+x2)/2,(y1+y2)/2) | 48 | midpoint (x1,y1) (x2,y2) = ((x1+x2)/2,(y1+y2)/2) | 48 | false | false | 0 | 8 | 4 | 51 | 29 | 22 | null | null |
sethfowler/pygmalion | indexers/Pygmalion/Index/Source.hs | bsd-3-clause | route loc s c k@C.Cursor_ClassTemplatePartialSpecialization = visitReferences loc s k c >> visitDefinitions loc s k c | 117 | route loc s c k@C.Cursor_ClassTemplatePartialSpecialization = visitReferences loc s k c >> visitDefinitions loc s k c | 117 | route loc s c k@C.Cursor_ClassTemplatePartialSpecialization = visitReferences loc s k c >> visitDefinitions loc s k c | 117 | false | false | 0 | 7 | 16 | 42 | 20 | 22 | null | null |
braidchat/greeterbot | src/Data/Event.hs | epl-1.0 | makeNewUser _ = Nothing | 23 | makeNewUser _ = Nothing | 23 | makeNewUser _ = Nothing | 23 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
5hubh4m/99-haskell-problems | Lists.hs | mit | rmDuplicate xs
| head xs == head (tail xs) = rmDuplicate (tail xs)
| otherwise = head xs : rmDuplicate (tail xs) | 116 | rmDuplicate xs
| head xs == head (tail xs) = rmDuplicate (tail xs)
| otherwise = head xs : rmDuplicate (tail xs) | 116 | rmDuplicate xs
| head xs == head (tail xs) = rmDuplicate (tail xs)
| otherwise = head xs : rmDuplicate (tail xs) | 116 | false | false | 1 | 11 | 25 | 63 | 28 | 35 | null | null |
nek0/haskelloids | src/InGame.hs | gpl-3.0 | loadGame
:: Affection ()
-> Affection ()
-> UserData
-> Affection ()
loadGame stateChange clean ud = do
liftIO $ logIO A.Debug "loading game"
nhs <- newHaskelloids (haskImage ud)
kid <- partSubscribe
(subKeyboard $ subsystems ud)
(handleGameKeys stateChange clean ud)
oldship <- liftIO $ readMVar (ship ud)
void $ liftIO $ swapMVar (stateUUIDs ud) (UUIDClean [] [kid])
void $ liftIO $ swapMVar (haskelloids ud) (nhs)
void $ liftIO $ swapMVar (ship ud) (oldship
{ sPos = V2 400 300
, sVel = V2 0 0
, sRot = 0
, sThrust = False
})
void $ liftIO $ swapMVar (shots ud) []
void $ liftIO $ swapMVar (wonlost ud) Nothing
void $ liftIO $ swapMVar (state ud) InGame | 712 | loadGame
:: Affection ()
-> Affection ()
-> UserData
-> Affection ()
loadGame stateChange clean ud = do
liftIO $ logIO A.Debug "loading game"
nhs <- newHaskelloids (haskImage ud)
kid <- partSubscribe
(subKeyboard $ subsystems ud)
(handleGameKeys stateChange clean ud)
oldship <- liftIO $ readMVar (ship ud)
void $ liftIO $ swapMVar (stateUUIDs ud) (UUIDClean [] [kid])
void $ liftIO $ swapMVar (haskelloids ud) (nhs)
void $ liftIO $ swapMVar (ship ud) (oldship
{ sPos = V2 400 300
, sVel = V2 0 0
, sRot = 0
, sThrust = False
})
void $ liftIO $ swapMVar (shots ud) []
void $ liftIO $ swapMVar (wonlost ud) Nothing
void $ liftIO $ swapMVar (state ud) InGame | 712 | loadGame stateChange clean ud = do
liftIO $ logIO A.Debug "loading game"
nhs <- newHaskelloids (haskImage ud)
kid <- partSubscribe
(subKeyboard $ subsystems ud)
(handleGameKeys stateChange clean ud)
oldship <- liftIO $ readMVar (ship ud)
void $ liftIO $ swapMVar (stateUUIDs ud) (UUIDClean [] [kid])
void $ liftIO $ swapMVar (haskelloids ud) (nhs)
void $ liftIO $ swapMVar (ship ud) (oldship
{ sPos = V2 400 300
, sVel = V2 0 0
, sRot = 0
, sThrust = False
})
void $ liftIO $ swapMVar (shots ud) []
void $ liftIO $ swapMVar (wonlost ud) Nothing
void $ liftIO $ swapMVar (state ud) InGame | 635 | false | true | 0 | 13 | 173 | 321 | 152 | 169 | null | null |
chreekat/snowdrift | Handler/User.hs | agpl-3.0 | checkConfirmDelete :: UserId -> Text -> Handler User
checkConfirmDelete user_id hash = do
confirm_uri <- getUrlRender <*> (pure $ UserConfirmDeleteR user_id hash)
muser_email <- runDB $ fetchUserEmail user_id
case muser_email of
Nothing -> notFound
Just email -> runYDB $ do
-- Check whether the hash is in the DB.
void $ getBy404 $ UniqueDeleteConfirmation user_id email confirm_uri
get404 user_id | 465 | checkConfirmDelete :: UserId -> Text -> Handler User
checkConfirmDelete user_id hash = do
confirm_uri <- getUrlRender <*> (pure $ UserConfirmDeleteR user_id hash)
muser_email <- runDB $ fetchUserEmail user_id
case muser_email of
Nothing -> notFound
Just email -> runYDB $ do
-- Check whether the hash is in the DB.
void $ getBy404 $ UniqueDeleteConfirmation user_id email confirm_uri
get404 user_id | 465 | checkConfirmDelete user_id hash = do
confirm_uri <- getUrlRender <*> (pure $ UserConfirmDeleteR user_id hash)
muser_email <- runDB $ fetchUserEmail user_id
case muser_email of
Nothing -> notFound
Just email -> runYDB $ do
-- Check whether the hash is in the DB.
void $ getBy404 $ UniqueDeleteConfirmation user_id email confirm_uri
get404 user_id | 412 | false | true | 0 | 14 | 125 | 115 | 53 | 62 | null | null |
bhamrick/hsmath | Math/Polynomial/Modular.hs | bsd-3-clause | modularEvaluate :: P Integer -> Integer -> Integer -> Integer
modularEvaluate (P []) n x = 0 | 92 | modularEvaluate :: P Integer -> Integer -> Integer -> Integer
modularEvaluate (P []) n x = 0 | 92 | modularEvaluate (P []) n x = 0 | 30 | false | true | 0 | 12 | 16 | 47 | 21 | 26 | null | null |
rblaze/haskell-dbus | tests/DBusTests/Address.hs | apache-2.0 | test_FormatAddresses :: TestTree
test_FormatAddresses = testProperty "formatAddresses" prop where
prop = forAll (smallListOf1 gen_Address) check where
check pairs = let
addrs = do
(method, params) <- pairs
let Just addr = address method params
return addr
bytes = formatAddresses addrs
parsed = parseAddresses bytes
in parsed == Just addrs | 415 | test_FormatAddresses :: TestTree
test_FormatAddresses = testProperty "formatAddresses" prop where
prop = forAll (smallListOf1 gen_Address) check where
check pairs = let
addrs = do
(method, params) <- pairs
let Just addr = address method params
return addr
bytes = formatAddresses addrs
parsed = parseAddresses bytes
in parsed == Just addrs | 415 | test_FormatAddresses = testProperty "formatAddresses" prop where
prop = forAll (smallListOf1 gen_Address) check where
check pairs = let
addrs = do
(method, params) <- pairs
let Just addr = address method params
return addr
bytes = formatAddresses addrs
parsed = parseAddresses bytes
in parsed == Just addrs | 382 | false | true | 0 | 14 | 124 | 113 | 54 | 59 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.