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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
rumblesan/proviz | src/Language/Parser.hs | bsd-3-clause | parseProgram :: String -> Either ParserError Program
parseProgram text =
let ps = mkPosState "program" text
s = mkParserState "program" text ps
in do
res <- snd $ runParser' program s
handleRes (partitionEithers res)
where
handleRes (errs, stmts) = if not (null errs)
then Left $ ParseErrorBundle { bundleErrors = NE.fromList errs
, bundlePosState = mkPosState "program" text
}
else Right (Program stmts) | 511 | parseProgram :: String -> Either ParserError Program
parseProgram text =
let ps = mkPosState "program" text
s = mkParserState "program" text ps
in do
res <- snd $ runParser' program s
handleRes (partitionEithers res)
where
handleRes (errs, stmts) = if not (null errs)
then Left $ ParseErrorBundle { bundleErrors = NE.fromList errs
, bundlePosState = mkPosState "program" text
}
else Right (Program stmts) | 511 | parseProgram text =
let ps = mkPosState "program" text
s = mkParserState "program" text ps
in do
res <- snd $ runParser' program s
handleRes (partitionEithers res)
where
handleRes (errs, stmts) = if not (null errs)
then Left $ ParseErrorBundle { bundleErrors = NE.fromList errs
, bundlePosState = mkPosState "program" text
}
else Right (Program stmts) | 458 | false | true | 0 | 11 | 169 | 150 | 73 | 77 | null | null |
noteed/carbon-suit | Text/CarbonSuit/Carbon.hs | bsd-3-clause | blankline :: Parsec String ParserState Char
blankline = skipSpaces >> newline | 77 | blankline :: Parsec String ParserState Char
blankline = skipSpaces >> newline | 77 | blankline = skipSpaces >> newline | 33 | false | true | 0 | 5 | 10 | 22 | 11 | 11 | null | null |
ezyang/ghc | compiler/nativeGen/X86/CodeGen.hs | bsd-3-clause | condIntCode' is32Bit cond x y
| isOperand is32Bit y = do
dflags <- getDynFlags
(x_reg, x_code) <- getNonClobberedReg x
(y_op, y_code) <- getOperand y
let
code = x_code `appOL` y_code `snocOL`
CMP (cmmTypeFormat (cmmExprType dflags x)) y_op (OpReg x_reg)
return (CondCode False cond code)
-- operand vs. anything: invert the comparison so that we can use a
-- single comparison instruction.
| isOperand is32Bit x
, Just revcond <- maybeFlipCond cond = do
dflags <- getDynFlags
(y_reg, y_code) <- getNonClobberedReg y
(x_op, x_code) <- getOperand x
let
code = y_code `appOL` x_code `snocOL`
CMP (cmmTypeFormat (cmmExprType dflags x)) x_op (OpReg y_reg)
return (CondCode False revcond code)
-- anything vs anything | 809 | condIntCode' is32Bit cond x y
| isOperand is32Bit y = do
dflags <- getDynFlags
(x_reg, x_code) <- getNonClobberedReg x
(y_op, y_code) <- getOperand y
let
code = x_code `appOL` y_code `snocOL`
CMP (cmmTypeFormat (cmmExprType dflags x)) y_op (OpReg x_reg)
return (CondCode False cond code)
-- operand vs. anything: invert the comparison so that we can use a
-- single comparison instruction.
| isOperand is32Bit x
, Just revcond <- maybeFlipCond cond = do
dflags <- getDynFlags
(y_reg, y_code) <- getNonClobberedReg y
(x_op, x_code) <- getOperand x
let
code = y_code `appOL` x_code `snocOL`
CMP (cmmTypeFormat (cmmExprType dflags x)) x_op (OpReg y_reg)
return (CondCode False revcond code)
-- anything vs anything | 809 | condIntCode' is32Bit cond x y
| isOperand is32Bit y = do
dflags <- getDynFlags
(x_reg, x_code) <- getNonClobberedReg x
(y_op, y_code) <- getOperand y
let
code = x_code `appOL` y_code `snocOL`
CMP (cmmTypeFormat (cmmExprType dflags x)) y_op (OpReg x_reg)
return (CondCode False cond code)
-- operand vs. anything: invert the comparison so that we can use a
-- single comparison instruction.
| isOperand is32Bit x
, Just revcond <- maybeFlipCond cond = do
dflags <- getDynFlags
(y_reg, y_code) <- getNonClobberedReg y
(x_op, x_code) <- getOperand x
let
code = y_code `appOL` x_code `snocOL`
CMP (cmmTypeFormat (cmmExprType dflags x)) x_op (OpReg y_reg)
return (CondCode False revcond code)
-- anything vs anything | 809 | false | false | 0 | 17 | 207 | 273 | 130 | 143 | null | null |
jonathan-laurent/copilot-kind | src/Copilot/Kind/IL/PrettyPrint.hs | bsd-3-clause | emptyLine = text "" | 19 | emptyLine = text "" | 19 | emptyLine = text "" | 19 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
psibi/yesod | yesod-core/test/YesodCoreTest/ErrorHandling.hs | mit | getErrorInBodyR :: Handler Html
getErrorInBodyR = do
let foo = error "error in body 19328" :: String
defaultLayout [whamlet|#{foo}|] | 140 | getErrorInBodyR :: Handler Html
getErrorInBodyR = do
let foo = error "error in body 19328" :: String
defaultLayout [whamlet|#{foo}|] | 140 | getErrorInBodyR = do
let foo = error "error in body 19328" :: String
defaultLayout [whamlet|#{foo}|] | 108 | false | true | 0 | 10 | 26 | 39 | 20 | 19 | null | null |
teuffy/min-var-ci | src/Data/CSV/Conduit/Persist.hs | mit | -- EKB TODO: since this handles XML and CSV, this whole module should probably be
-- changed to not have "CSV" in the name
csvFormatToAttribValue :: IsString a => CsvFormat -> a
csvFormatToAttribValue CsvFormatCsv = "csv" | 231 | csvFormatToAttribValue :: IsString a => CsvFormat -> a
csvFormatToAttribValue CsvFormatCsv = "csv" | 98 | csvFormatToAttribValue CsvFormatCsv = "csv" | 43 | true | true | 0 | 6 | 45 | 31 | 15 | 16 | null | null |
UU-ComputerScience/uu-cco | uu-cco/src/CCO/Tree/ATerm/Lexer.hs | bsd-3-clause | -- | A 'Lexer' that recognises escaped characters.
escChar :: Lexer Char
escChar = char '\\' *> esc
where
esc = char '\\' <|> char '\"' <|>
'\n' <$ char 'n' <|> '\r' <$ char 'r' <|> '\t' <$ char 't' <|>
(\x y z -> chr (64 * x + 8 * y + z)) <$>
binDigit_ <*> octDigit_ <*> octDigit_
-- | A 'Lexer' that recognises a list of signs. | 368 | escChar :: Lexer Char
escChar = char '\\' *> esc
where
esc = char '\\' <|> char '\"' <|>
'\n' <$ char 'n' <|> '\r' <$ char 'r' <|> '\t' <$ char 't' <|>
(\x y z -> chr (64 * x + 8 * y + z)) <$>
binDigit_ <*> octDigit_ <*> octDigit_
-- | A 'Lexer' that recognises a list of signs. | 317 | escChar = char '\\' *> esc
where
esc = char '\\' <|> char '\"' <|>
'\n' <$ char 'n' <|> '\r' <$ char 'r' <|> '\t' <$ char 't' <|>
(\x y z -> chr (64 * x + 8 * y + z)) <$>
binDigit_ <*> octDigit_ <*> octDigit_
-- | A 'Lexer' that recognises a list of signs. | 295 | true | true | 0 | 16 | 110 | 124 | 61 | 63 | null | null |
flyingleafe/itmo-ctd-se-coursework | src/Model.hs | bsd-3-clause | -- | Cosine cosine function.
cosine :: Point -> Point -> Double
cosine vec1 vec2 =
let dp = dotProd vec1 vec2
mag = norm vec1 * norm vec2
in 1 - dp / mag | 169 | cosine :: Point -> Point -> Double
cosine vec1 vec2 =
let dp = dotProd vec1 vec2
mag = norm vec1 * norm vec2
in 1 - dp / mag | 140 | cosine vec1 vec2 =
let dp = dotProd vec1 vec2
mag = norm vec1 * norm vec2
in 1 - dp / mag | 105 | true | true | 0 | 10 | 50 | 64 | 31 | 33 | null | null |
sdiehl/ghc | compiler/main/HscTypes.hs | bsd-3-clause | -- | Get annotations from modules "below" this one (in the dependency sense)
hptAnns :: HscEnv -> Maybe [(ModuleName, IsBootInterface)] -> [Annotation]
hptAnns hsc_env (Just deps) = hptSomeThingsBelowUs (md_anns . hm_details) False hsc_env deps | 244 | hptAnns :: HscEnv -> Maybe [(ModuleName, IsBootInterface)] -> [Annotation]
hptAnns hsc_env (Just deps) = hptSomeThingsBelowUs (md_anns . hm_details) False hsc_env deps | 167 | hptAnns hsc_env (Just deps) = hptSomeThingsBelowUs (md_anns . hm_details) False hsc_env deps | 92 | true | true | 0 | 9 | 33 | 62 | 33 | 29 | null | null |
ssaavedra/liquidhaskell | src/Language/Haskell/Liquid/Liquid.hs | bsd-3-clause | checkOne :: MbEnv -> Config -> FilePath -> IO (Output Doc, Maybe HscEnv)
------------------------------------------------------------------------------
checkOne mE cfg t = do
z <- actOrDie (checkOne' mE cfg t)
case z of
Left e -> do
d <- exitWithResult cfg t $ mempty { o_result = e }
return (d, Nothing)
Right r ->
return r | 354 | checkOne :: MbEnv -> Config -> FilePath -> IO (Output Doc, Maybe HscEnv)
checkOne mE cfg t = do
z <- actOrDie (checkOne' mE cfg t)
case z of
Left e -> do
d <- exitWithResult cfg t $ mempty { o_result = e }
return (d, Nothing)
Right r ->
return r | 275 | checkOne mE cfg t = do
z <- actOrDie (checkOne' mE cfg t)
case z of
Left e -> do
d <- exitWithResult cfg t $ mempty { o_result = e }
return (d, Nothing)
Right r ->
return r | 202 | true | true | 0 | 15 | 83 | 130 | 62 | 68 | null | null |
brendanhay/gogol | gogol-classroom/gen/Network/Google/Resource/Classroom/UserProFiles/GuardianInvitations/Patch.hs | mpl-2.0 | -- | OAuth access token.
upfgipAccessToken :: Lens' UserProFilesGuardianInvitationsPatch (Maybe Text)
upfgipAccessToken
= lens _upfgipAccessToken
(\ s a -> s{_upfgipAccessToken = a}) | 190 | upfgipAccessToken :: Lens' UserProFilesGuardianInvitationsPatch (Maybe Text)
upfgipAccessToken
= lens _upfgipAccessToken
(\ s a -> s{_upfgipAccessToken = a}) | 165 | upfgipAccessToken
= lens _upfgipAccessToken
(\ s a -> s{_upfgipAccessToken = a}) | 88 | true | true | 1 | 9 | 29 | 51 | 25 | 26 | null | null |
mightymoose/liquidhaskell | benchmarks/text-0.11.2.3/Data/Text/Lazy.hs | bsd-3-clause | init_go t Empty = chunk (T.init t) Empty | 48 | init_go t Empty = chunk (T.init t) Empty | 48 | init_go t Empty = chunk (T.init t) Empty | 48 | false | false | 0 | 8 | 15 | 24 | 11 | 13 | null | null |
olorin/amazonka | amazonka-iam/test/Test/AWS/Gen/IAM.hs | mpl-2.0 | testUploadServerCertificateResponse :: UploadServerCertificateResponse -> TestTree
testUploadServerCertificateResponse = res
"UploadServerCertificateResponse"
"fixture/UploadServerCertificateResponse.proto"
iAM
(Proxy :: Proxy UploadServerCertificate) | 267 | testUploadServerCertificateResponse :: UploadServerCertificateResponse -> TestTree
testUploadServerCertificateResponse = res
"UploadServerCertificateResponse"
"fixture/UploadServerCertificateResponse.proto"
iAM
(Proxy :: Proxy UploadServerCertificate) | 267 | testUploadServerCertificateResponse = res
"UploadServerCertificateResponse"
"fixture/UploadServerCertificateResponse.proto"
iAM
(Proxy :: Proxy UploadServerCertificate) | 184 | false | true | 0 | 6 | 30 | 36 | 17 | 19 | null | null |
hferreiro/replay | testsuite/tests/th/T4056.hs | bsd-3-clause | astTest :: Q [Dec]
astTest = [d|
class C t where
op :: [t] -> [t]
op = undefined
|] | 105 | astTest :: Q [Dec]
astTest = [d|
class C t where
op :: [t] -> [t]
op = undefined
|] | 105 | astTest = [d|
class C t where
op :: [t] -> [t]
op = undefined
|] | 86 | false | true | 0 | 7 | 41 | 27 | 14 | 13 | null | null |
Zankoku-Okuno/ammonite | Language/Ammonite/Interpreter/Data.hs | gpl-3.0 | setField _ _ _ = pure Nothing | 29 | setField _ _ _ = pure Nothing | 29 | setField _ _ _ = pure Nothing | 29 | false | false | 0 | 5 | 6 | 16 | 7 | 9 | null | null |
typelead/epm | epm/Distribution/Client/Targets.hs | bsd-3-clause | -- | Given a package name and a list of matching names, figure out which one it
-- might be referring to. If there is an exact case-sensitive match then that's
-- ok. If it matches just one package case-insensitively then that's also ok.
-- The only problem is if it matches multiple packages case-insensitively, in
-- that case it is ambigious.
--
disambiguatePackageName :: PackageNameEnv
-> PackageName
-> MaybeAmbigious PackageName
disambiguatePackageName (PackageNameEnv pkgNameLookup) name =
case nub (pkgNameLookup name) of
[] -> None
[name'] -> Unambiguous name'
names -> case find (name==) names of
Just name' -> Unambiguous name'
Nothing -> Ambiguous names | 784 | disambiguatePackageName :: PackageNameEnv
-> PackageName
-> MaybeAmbigious PackageName
disambiguatePackageName (PackageNameEnv pkgNameLookup) name =
case nub (pkgNameLookup name) of
[] -> None
[name'] -> Unambiguous name'
names -> case find (name==) names of
Just name' -> Unambiguous name'
Nothing -> Ambiguous names | 435 | disambiguatePackageName (PackageNameEnv pkgNameLookup) name =
case nub (pkgNameLookup name) of
[] -> None
[name'] -> Unambiguous name'
names -> case find (name==) names of
Just name' -> Unambiguous name'
Nothing -> Ambiguous names | 300 | true | true | 0 | 11 | 221 | 112 | 57 | 55 | null | null |
hectorhon/autotrace2 | src/TimeSeriesData/Expressions.hs | bsd-3-clause | eval (TknMinus _ TknInvalid) = return TknInvalid | 53 | eval (TknMinus _ TknInvalid) = return TknInvalid | 53 | eval (TknMinus _ TknInvalid) = return TknInvalid | 53 | false | false | 0 | 7 | 11 | 20 | 9 | 11 | null | null |
bitemyapp/persistent | persistent-test/src/UniqueTest.hs | mit | specs :: Spec
specs = describe "uniqueness constraints" $
#ifdef WITH_NOSQL
return () | 87 | specs :: Spec
specs = describe "uniqueness constraints" $
#ifdef WITH_NOSQL
return () | 87 | specs = describe "uniqueness constraints" $
#ifdef WITH_NOSQL
return () | 73 | false | true | 0 | 6 | 14 | 31 | 13 | 18 | null | null |
keithodulaigh/Hets | CASL/OMDoc.hs | gpl-2.0 | const_if = const_casl "if" | 26 | const_if = const_casl "if" | 26 | const_if = const_casl "if" | 26 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
sebschrader/programmierung-ss2015 | E03/A2.hs | mit | treeEqual :: Tree -> Tree -> Bool
-- Two trees are equal if and only if:
treeEqual NIL NIL
= True | 113 | treeEqual :: Tree -> Tree -> Bool
treeEqual NIL NIL
= True | 74 | treeEqual NIL NIL
= True | 40 | true | true | 0 | 6 | 36 | 25 | 13 | 12 | null | null |
twittner/wai-predicates | src/Data/Predicate/Product.hs | mpl-2.0 | _3' :: a ::: b ::: c -> c
_3' = tl . tl | 39 | _3' :: a ::: b ::: c -> c
_3' = tl . tl | 39 | _3' = tl . tl | 13 | false | true | 0 | 8 | 13 | 34 | 15 | 19 | null | null |
rawlep/EQS | esit.hs | mit | display (Add (Add k j@(Value n)) r)
| n < 0 = display k ++ display (Add j r)
| otherwise = display k ++ "+" ++ display (Add j r) | 155 | display (Add (Add k j@(Value n)) r)
| n < 0 = display k ++ display (Add j r)
| otherwise = display k ++ "+" ++ display (Add j r) | 155 | display (Add (Add k j@(Value n)) r)
| n < 0 = display k ++ display (Add j r)
| otherwise = display k ++ "+" ++ display (Add j r) | 155 | false | false | 0 | 12 | 57 | 93 | 43 | 50 | null | null |
vikraman/ghc | compiler/types/Coercion.hs | bsd-3-clause | coercionSize (CoVarCo _) = 1 | 36 | coercionSize (CoVarCo _) = 1 | 36 | coercionSize (CoVarCo _) = 1 | 36 | false | false | 0 | 7 | 12 | 15 | 7 | 8 | null | null |
nomeata/ghc | compiler/nativeGen/SPARC/Ppr.hs | bsd-3-clause | pprInstr (FADD size reg1 reg2 reg3)
= pprSizeRegRegReg (sLit "fadd") size reg1 reg2 reg3 | 96 | pprInstr (FADD size reg1 reg2 reg3)
= pprSizeRegRegReg (sLit "fadd") size reg1 reg2 reg3 | 96 | pprInstr (FADD size reg1 reg2 reg3)
= pprSizeRegRegReg (sLit "fadd") size reg1 reg2 reg3 | 96 | false | false | 0 | 7 | 21 | 38 | 18 | 20 | null | null |
flipstone/glados | src/Model/FieldTypes.hs | mit | decodeInterests :: Int64 -> Interests
decodeInterests bits = Interests {
interest3DPrinting = testBit bits 0
, interestMetalworking = testBit bits 1
, interestElectronics = testBit bits 2
, interestWoodworking = testBit bits 3
, interestCoworking = testBit bits 4
, interestGaming = testBit bits 5
, interestOther = testBit bits 6
} | 377 | decodeInterests :: Int64 -> Interests
decodeInterests bits = Interests {
interest3DPrinting = testBit bits 0
, interestMetalworking = testBit bits 1
, interestElectronics = testBit bits 2
, interestWoodworking = testBit bits 3
, interestCoworking = testBit bits 4
, interestGaming = testBit bits 5
, interestOther = testBit bits 6
} | 377 | decodeInterests bits = Interests {
interest3DPrinting = testBit bits 0
, interestMetalworking = testBit bits 1
, interestElectronics = testBit bits 2
, interestWoodworking = testBit bits 3
, interestCoworking = testBit bits 4
, interestGaming = testBit bits 5
, interestOther = testBit bits 6
} | 339 | false | true | 0 | 7 | 96 | 97 | 52 | 45 | null | null |
SKA-ScienceDataProcessor/RC | MS6/dna/core/DNA/Channel/File.hs | apache-2.0 | transferFileChan :: FileChan a -- ^ Source file channel
-> FileChan b -- ^ Destination file channel
-> String -- ^ Name of the file to transfer
-> IO ()
transferFileChan from to p =
copyFile (fhPath from </> p) (fhPath to </> p) | 281 | transferFileChan :: FileChan a -- ^ Source file channel
-> FileChan b -- ^ Destination file channel
-> String -- ^ Name of the file to transfer
-> IO ()
transferFileChan from to p =
copyFile (fhPath from </> p) (fhPath to </> p) | 281 | transferFileChan from to p =
copyFile (fhPath from </> p) (fhPath to </> p) | 77 | false | true | 0 | 9 | 96 | 69 | 34 | 35 | null | null |
jstolarek/ghc | compiler/nativeGen/X86/Ppr.hs | bsd-3-clause | pprShift :: LitString -> Size -> Operand -> Operand -> SDoc
pprShift name size src dest
= hcat [
pprMnemonic name size,
pprOperand II8 src, -- src is 8-bit sized
comma,
pprOperand size dest
] | 230 | pprShift :: LitString -> Size -> Operand -> Operand -> SDoc
pprShift name size src dest
= hcat [
pprMnemonic name size,
pprOperand II8 src, -- src is 8-bit sized
comma,
pprOperand size dest
] | 230 | pprShift name size src dest
= hcat [
pprMnemonic name size,
pprOperand II8 src, -- src is 8-bit sized
comma,
pprOperand size dest
] | 170 | false | true | 0 | 8 | 73 | 67 | 34 | 33 | null | null |
DavidAlphaFox/darcs | src/Darcs/Patch/Match.hs | gpl-2.0 | getMatchPattern (SeveralPattern m:_) = Just m | 45 | getMatchPattern (SeveralPattern m:_) = Just m | 45 | getMatchPattern (SeveralPattern m:_) = Just m | 45 | false | false | 0 | 8 | 5 | 22 | 10 | 12 | null | null |
GaloisInc/halvm-ghc | compiler/main/DynFlags.hs | bsd-3-clause | removeUserPkgConf :: DynP ()
removeUserPkgConf = upd $ \s -> s { extraPkgConfs = filter isNotUser . extraPkgConfs s }
where
isNotUser UserPkgConf = False
isNotUser _ = True | 182 | removeUserPkgConf :: DynP ()
removeUserPkgConf = upd $ \s -> s { extraPkgConfs = filter isNotUser . extraPkgConfs s }
where
isNotUser UserPkgConf = False
isNotUser _ = True | 182 | removeUserPkgConf = upd $ \s -> s { extraPkgConfs = filter isNotUser . extraPkgConfs s }
where
isNotUser UserPkgConf = False
isNotUser _ = True | 153 | false | true | 1 | 10 | 38 | 68 | 31 | 37 | null | null |
bitemyapp/ghc | compiler/main/HscTypes.hs | bsd-3-clause | isNoIfaceVectInfo :: IfaceVectInfo -> Bool
isNoIfaceVectInfo (IfaceVectInfo l1 l2 l3 l4 l5)
= null l1 && null l2 && null l3 && null l4 && null l5 | 147 | isNoIfaceVectInfo :: IfaceVectInfo -> Bool
isNoIfaceVectInfo (IfaceVectInfo l1 l2 l3 l4 l5)
= null l1 && null l2 && null l3 && null l4 && null l5 | 147 | isNoIfaceVectInfo (IfaceVectInfo l1 l2 l3 l4 l5)
= null l1 && null l2 && null l3 && null l4 && null l5 | 104 | false | true | 4 | 7 | 28 | 69 | 30 | 39 | null | null |
hvr/jhc | src/E/PrimDecode.hs | mit | a ==> b = (a,b) | 15 | a ==> b = (a,b) | 15 | a ==> b = (a,b) | 15 | false | false | 0 | 6 | 4 | 22 | 10 | 12 | null | null |
ekmett/text | tests/Tests/Properties.hs | bsd-2-clause | t_zip s = L.zip s `eqP` T.zip (packS s) | 49 | t_zip s = L.zip s `eqP` T.zip (packS s) | 49 | t_zip s = L.zip s `eqP` T.zip (packS s) | 49 | false | false | 0 | 8 | 18 | 31 | 15 | 16 | null | null |
uduki/hsQt | Qtc/ClassTypes/Gui.hs | bsd-2-clause | qCastList_QTextBlockFormat x = qcl_QTextBlockFormat [] x | 56 | qCastList_QTextBlockFormat x = qcl_QTextBlockFormat [] x | 56 | qCastList_QTextBlockFormat x = qcl_QTextBlockFormat [] x | 56 | false | false | 0 | 6 | 5 | 16 | 7 | 9 | null | null |
li-zhirui/EoplLangs | src/CallByName/Data.hs | bsd-3-clause | newRef :: ExpressedValue -> StatedTry Ref
newRef val = do
store <- get
let refList = refs store
put $ Store (val:refList)
return . Ref . toInteger . length $ refList | 173 | newRef :: ExpressedValue -> StatedTry Ref
newRef val = do
store <- get
let refList = refs store
put $ Store (val:refList)
return . Ref . toInteger . length $ refList | 173 | newRef val = do
store <- get
let refList = refs store
put $ Store (val:refList)
return . Ref . toInteger . length $ refList | 131 | false | true | 0 | 10 | 38 | 76 | 35 | 41 | null | null |
benjaminselfridge/logix | src/Utils.hs | bsd-3-clause | nubPair :: (Eq a, Eq b) => ([a],[b]) -> ([a],[b])
nubPair (xs, ys) = (nub xs, nub ys) | 85 | nubPair :: (Eq a, Eq b) => ([a],[b]) -> ([a],[b])
nubPair (xs, ys) = (nub xs, nub ys) | 85 | nubPair (xs, ys) = (nub xs, nub ys) | 35 | false | true | 0 | 8 | 17 | 75 | 43 | 32 | null | null |
printedheart/Dao | src/Dao/Rule.hs | agpl-3.0 | -- | When a 'Rule' is being evaluated, mutliple branches of evaluation can be produced in parallel.
-- For example, evaluating:
--
-- @
-- 'Control.Monad.return' "A" 'Control.Applicative.<|>' 'Control.Monad.return' "B" 'Control.Monad.>>=' continue
-- @
--
-- Will result in the @continue@ function being called twice along two parallel branches of
-- evaluation, first with @"A"@ as input, and then with @"B"@ as input.
--
-- The 'prunePath's function allows an inner function to be fully evaluated, collapsing all results
-- and state values along all branches of evaluation into a list data structure. You can then filter
-- the list, effectively pruning future branches of evaluation to the most relevant, in order to
-- make computation more efficient.
--
-- @
-- 'prunePaths' (filterOutResults "B") ('Control.Monad.return' "A" 'Control.Applicative.<|>' 'Control.Monad.return' "B") 'Control.Monad.>>=' continue
-- @
--
-- The above uses a function @filterOutResults@ that would filter the result produced by
-- @return "B"@, so @continue@ function would only have one branch of evaluation to try. Filtering
-- out all results will behave the same as 'Control.Monad.mzero' or 'Control.Applicative.empty'
prunePaths
:: (Monad m, Eq pat, Ord pat, Typeable tok, Typeable err, Typeable st, Typeable a)
=> ([(Either (RuleError err) a, QueryState tok st)] -> [(Either (RuleError err) a, QueryState tok st)])
-> Rule err pat st tok m a -> Rule err pat st tok m a
prunePaths filt f = flip RuleOp f $ RulePrune $ \oqs -> fromMaybe oqs $ filt <$> cast oqs >>= cast | 1,563 | prunePaths
:: (Monad m, Eq pat, Ord pat, Typeable tok, Typeable err, Typeable st, Typeable a)
=> ([(Either (RuleError err) a, QueryState tok st)] -> [(Either (RuleError err) a, QueryState tok st)])
-> Rule err pat st tok m a -> Rule err pat st tok m a
prunePaths filt f = flip RuleOp f $ RulePrune $ \oqs -> fromMaybe oqs $ filt <$> cast oqs >>= cast | 356 | prunePaths filt f = flip RuleOp f $ RulePrune $ \oqs -> fromMaybe oqs $ filt <$> cast oqs >>= cast | 98 | true | true | 0 | 14 | 251 | 215 | 117 | 98 | null | null |
ancientlanguage/haskell-analysis | prepare/src/Prepare/Decompose.hs | mit | decomposeChar '\x04D3' = "\x0430\x0308" | 39 | decomposeChar '\x04D3' = "\x0430\x0308" | 39 | decomposeChar '\x04D3' = "\x0430\x0308" | 39 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
holzensp/ghc | compiler/main/DriverPipeline.hs | bsd-3-clause | linkBinary' :: Bool -> DynFlags -> [FilePath] -> [PackageKey] -> IO ()
linkBinary' staticLink dflags o_files dep_packages = do
let platform = targetPlatform dflags
mySettings = settings dflags
verbFlags = getVerbFlags dflags
output_fn = exeFileName staticLink dflags
-- get the full list of packages to link with, by combining the
-- explicit packages with the auto packages and all of their
-- dependencies, and eliminating duplicates.
full_output_fn <- if isAbsolute output_fn
then return output_fn
else do d <- getCurrentDirectory
return $ normalise (d </> output_fn)
pkg_lib_paths <- getPackageLibraryPath dflags dep_packages
let pkg_lib_path_opts = concatMap get_pkg_lib_path_opts pkg_lib_paths
get_pkg_lib_path_opts l
| osElfTarget (platformOS platform) &&
dynLibLoader dflags == SystemDependent &&
not (gopt Opt_Static dflags)
= let libpath = if gopt Opt_RelativeDynlibPaths dflags
then "$ORIGIN" </>
(l `makeRelativeTo` full_output_fn)
else l
rpath = if gopt Opt_RPath dflags
then ["-Wl,-rpath", "-Wl," ++ libpath]
else []
-- Solaris 11's linker does not support -rpath-link option. It silently
-- ignores it and then complains about next option which is -l<some
-- dir> as being a directory and not expected object file, E.g
-- ld: elf error: file
-- /tmp/ghc-src/libraries/base/dist-install/build:
-- elf_begin: I/O error: region read: Is a directory
rpathlink = if (platformOS platform) == OSSolaris2
then []
else ["-Wl,-rpath-link", "-Wl," ++ l]
in ["-L" ++ l] ++ rpathlink ++ rpath
| osMachOTarget (platformOS platform) &&
dynLibLoader dflags == SystemDependent &&
not (gopt Opt_Static dflags) &&
gopt Opt_RPath dflags
= let libpath = if gopt Opt_RelativeDynlibPaths dflags
then "@loader_path" </>
(l `makeRelativeTo` full_output_fn)
else l
in ["-L" ++ l] ++ ["-Wl,-rpath", "-Wl," ++ libpath]
| otherwise = ["-L" ++ l]
let lib_paths = libraryPaths dflags
let lib_path_opts = map ("-L"++) lib_paths
extraLinkObj <- mkExtraObjToLinkIntoBinary dflags
noteLinkObjs <- mkNoteObjsToLinkIntoBinary dflags dep_packages
pkg_link_opts <- do
(package_hs_libs, extra_libs, other_flags) <- getPackageLinkOpts dflags dep_packages
return $ if staticLink
then package_hs_libs -- If building an executable really means making a static
-- library (e.g. iOS), then we only keep the -l options for
-- HS packages, because libtool doesn't accept other options.
-- In the case of iOS these need to be added by hand to the
-- final link in Xcode.
else other_flags ++ package_hs_libs ++ extra_libs -- -Wl,-u,<sym> contained in other_flags
-- needs to be put before -l<package>,
-- otherwise Solaris linker fails linking
-- a binary with unresolved symbols in RTS
-- which are defined in base package
-- the reason for this is a note in ld(1) about
-- '-u' option: "The placement of this option
-- on the command line is significant.
-- This option must be placed before the library
-- that defines the symbol."
pkg_framework_path_opts <-
if platformUsesFrameworks platform
then do pkg_framework_paths <- getPackageFrameworkPath dflags dep_packages
return $ map ("-F" ++) pkg_framework_paths
else return []
framework_path_opts <-
if platformUsesFrameworks platform
then do let framework_paths = frameworkPaths dflags
return $ map ("-F" ++) framework_paths
else return []
pkg_framework_opts <-
if platformUsesFrameworks platform
then do pkg_frameworks <- getPackageFrameworks dflags dep_packages
return $ concat [ ["-framework", fw] | fw <- pkg_frameworks ]
else return []
framework_opts <-
if platformUsesFrameworks platform
then do let frameworks = cmdlineFrameworks dflags
-- reverse because they're added in reverse order from
-- the cmd line:
return $ concat [ ["-framework", fw]
| fw <- reverse frameworks ]
else return []
-- probably _stub.o files
let extra_ld_inputs = ldInputs dflags
-- Here are some libs that need to be linked at the *end* of
-- the command line, because they contain symbols that are referred to
-- by the RTS. We can't therefore use the ordinary way opts for these.
let
debug_opts | WayDebug `elem` ways dflags = [
#if defined(HAVE_LIBBFD)
"-lbfd", "-liberty"
#endif
]
| otherwise = []
let thread_opts
| WayThreaded `elem` ways dflags =
let os = platformOS (targetPlatform dflags)
in if os == OSOsf3 then ["-lpthread", "-lexc"]
else if os `elem` [OSMinGW32, OSFreeBSD, OSOpenBSD,
OSNetBSD, OSHaiku, OSQNXNTO, OSiOS, OSDarwin]
then []
else ["-lpthread"]
| otherwise = []
rc_objs <- maybeCreateManifest dflags output_fn
let link = if staticLink
then SysTools.runLibtool
else SysTools.runLink
link dflags (
map SysTools.Option verbFlags
++ [ SysTools.Option "-o"
, SysTools.FileOption "" output_fn
]
++ map SysTools.Option (
[]
-- Permit the linker to auto link _symbol to _imp_symbol.
-- This lets us link against DLLs without needing an "import library".
++ (if platformOS platform == OSMinGW32
then ["-Wl,--enable-auto-import"]
else [])
-- '-no_compact_unwind'
-- C++/Objective-C exceptions cannot use optimised
-- stack unwinding code. The optimised form is the
-- default in Xcode 4 on at least x86_64, and
-- without this flag we're also seeing warnings
-- like
-- ld: warning: could not create compact unwind for .LFB3: non-standard register 5 being saved in prolog
-- on x86.
++ (if sLdSupportsCompactUnwind mySettings &&
not staticLink &&
(platformOS platform == OSDarwin || platformOS platform == OSiOS) &&
case platformArch platform of
ArchX86 -> True
ArchX86_64 -> True
ArchARM {} -> True
_ -> False
then ["-Wl,-no_compact_unwind"]
else [])
-- '-no_pie'
-- iOS uses 'dynamic-no-pic', so we must pass this to ld to suppress a warning; see #7722
++ (if platformOS platform == OSiOS &&
not staticLink
then ["-Wl,-no_pie"]
else [])
-- '-Wl,-read_only_relocs,suppress'
-- ld gives loads of warnings like:
-- ld: warning: text reloc in _base_GHCziArr_unsafeArray_info to _base_GHCziArr_unsafeArray_closure
-- when linking any program. We're not sure
-- whether this is something we ought to fix, but
-- for now this flags silences them.
++ (if platformOS platform == OSDarwin &&
platformArch platform == ArchX86 &&
not staticLink
then ["-Wl,-read_only_relocs,suppress"]
else [])
++ o_files
++ lib_path_opts)
++ extra_ld_inputs
++ map SysTools.Option (
rc_objs
++ framework_path_opts
++ framework_opts
++ pkg_lib_path_opts
++ extraLinkObj:noteLinkObjs
++ pkg_link_opts
++ pkg_framework_path_opts
++ pkg_framework_opts
++ debug_opts
++ thread_opts
))
-- parallel only: move binary to another dir -- HWL
success <- runPhase_MoveBinary dflags output_fn
unless success $
throwGhcExceptionIO (InstallationError ("cannot move binary")) | 10,063 | linkBinary' :: Bool -> DynFlags -> [FilePath] -> [PackageKey] -> IO ()
linkBinary' staticLink dflags o_files dep_packages = do
let platform = targetPlatform dflags
mySettings = settings dflags
verbFlags = getVerbFlags dflags
output_fn = exeFileName staticLink dflags
-- get the full list of packages to link with, by combining the
-- explicit packages with the auto packages and all of their
-- dependencies, and eliminating duplicates.
full_output_fn <- if isAbsolute output_fn
then return output_fn
else do d <- getCurrentDirectory
return $ normalise (d </> output_fn)
pkg_lib_paths <- getPackageLibraryPath dflags dep_packages
let pkg_lib_path_opts = concatMap get_pkg_lib_path_opts pkg_lib_paths
get_pkg_lib_path_opts l
| osElfTarget (platformOS platform) &&
dynLibLoader dflags == SystemDependent &&
not (gopt Opt_Static dflags)
= let libpath = if gopt Opt_RelativeDynlibPaths dflags
then "$ORIGIN" </>
(l `makeRelativeTo` full_output_fn)
else l
rpath = if gopt Opt_RPath dflags
then ["-Wl,-rpath", "-Wl," ++ libpath]
else []
-- Solaris 11's linker does not support -rpath-link option. It silently
-- ignores it and then complains about next option which is -l<some
-- dir> as being a directory and not expected object file, E.g
-- ld: elf error: file
-- /tmp/ghc-src/libraries/base/dist-install/build:
-- elf_begin: I/O error: region read: Is a directory
rpathlink = if (platformOS platform) == OSSolaris2
then []
else ["-Wl,-rpath-link", "-Wl," ++ l]
in ["-L" ++ l] ++ rpathlink ++ rpath
| osMachOTarget (platformOS platform) &&
dynLibLoader dflags == SystemDependent &&
not (gopt Opt_Static dflags) &&
gopt Opt_RPath dflags
= let libpath = if gopt Opt_RelativeDynlibPaths dflags
then "@loader_path" </>
(l `makeRelativeTo` full_output_fn)
else l
in ["-L" ++ l] ++ ["-Wl,-rpath", "-Wl," ++ libpath]
| otherwise = ["-L" ++ l]
let lib_paths = libraryPaths dflags
let lib_path_opts = map ("-L"++) lib_paths
extraLinkObj <- mkExtraObjToLinkIntoBinary dflags
noteLinkObjs <- mkNoteObjsToLinkIntoBinary dflags dep_packages
pkg_link_opts <- do
(package_hs_libs, extra_libs, other_flags) <- getPackageLinkOpts dflags dep_packages
return $ if staticLink
then package_hs_libs -- If building an executable really means making a static
-- library (e.g. iOS), then we only keep the -l options for
-- HS packages, because libtool doesn't accept other options.
-- In the case of iOS these need to be added by hand to the
-- final link in Xcode.
else other_flags ++ package_hs_libs ++ extra_libs -- -Wl,-u,<sym> contained in other_flags
-- needs to be put before -l<package>,
-- otherwise Solaris linker fails linking
-- a binary with unresolved symbols in RTS
-- which are defined in base package
-- the reason for this is a note in ld(1) about
-- '-u' option: "The placement of this option
-- on the command line is significant.
-- This option must be placed before the library
-- that defines the symbol."
pkg_framework_path_opts <-
if platformUsesFrameworks platform
then do pkg_framework_paths <- getPackageFrameworkPath dflags dep_packages
return $ map ("-F" ++) pkg_framework_paths
else return []
framework_path_opts <-
if platformUsesFrameworks platform
then do let framework_paths = frameworkPaths dflags
return $ map ("-F" ++) framework_paths
else return []
pkg_framework_opts <-
if platformUsesFrameworks platform
then do pkg_frameworks <- getPackageFrameworks dflags dep_packages
return $ concat [ ["-framework", fw] | fw <- pkg_frameworks ]
else return []
framework_opts <-
if platformUsesFrameworks platform
then do let frameworks = cmdlineFrameworks dflags
-- reverse because they're added in reverse order from
-- the cmd line:
return $ concat [ ["-framework", fw]
| fw <- reverse frameworks ]
else return []
-- probably _stub.o files
let extra_ld_inputs = ldInputs dflags
-- Here are some libs that need to be linked at the *end* of
-- the command line, because they contain symbols that are referred to
-- by the RTS. We can't therefore use the ordinary way opts for these.
let
debug_opts | WayDebug `elem` ways dflags = [
#if defined(HAVE_LIBBFD)
"-lbfd", "-liberty"
#endif
]
| otherwise = []
let thread_opts
| WayThreaded `elem` ways dflags =
let os = platformOS (targetPlatform dflags)
in if os == OSOsf3 then ["-lpthread", "-lexc"]
else if os `elem` [OSMinGW32, OSFreeBSD, OSOpenBSD,
OSNetBSD, OSHaiku, OSQNXNTO, OSiOS, OSDarwin]
then []
else ["-lpthread"]
| otherwise = []
rc_objs <- maybeCreateManifest dflags output_fn
let link = if staticLink
then SysTools.runLibtool
else SysTools.runLink
link dflags (
map SysTools.Option verbFlags
++ [ SysTools.Option "-o"
, SysTools.FileOption "" output_fn
]
++ map SysTools.Option (
[]
-- Permit the linker to auto link _symbol to _imp_symbol.
-- This lets us link against DLLs without needing an "import library".
++ (if platformOS platform == OSMinGW32
then ["-Wl,--enable-auto-import"]
else [])
-- '-no_compact_unwind'
-- C++/Objective-C exceptions cannot use optimised
-- stack unwinding code. The optimised form is the
-- default in Xcode 4 on at least x86_64, and
-- without this flag we're also seeing warnings
-- like
-- ld: warning: could not create compact unwind for .LFB3: non-standard register 5 being saved in prolog
-- on x86.
++ (if sLdSupportsCompactUnwind mySettings &&
not staticLink &&
(platformOS platform == OSDarwin || platformOS platform == OSiOS) &&
case platformArch platform of
ArchX86 -> True
ArchX86_64 -> True
ArchARM {} -> True
_ -> False
then ["-Wl,-no_compact_unwind"]
else [])
-- '-no_pie'
-- iOS uses 'dynamic-no-pic', so we must pass this to ld to suppress a warning; see #7722
++ (if platformOS platform == OSiOS &&
not staticLink
then ["-Wl,-no_pie"]
else [])
-- '-Wl,-read_only_relocs,suppress'
-- ld gives loads of warnings like:
-- ld: warning: text reloc in _base_GHCziArr_unsafeArray_info to _base_GHCziArr_unsafeArray_closure
-- when linking any program. We're not sure
-- whether this is something we ought to fix, but
-- for now this flags silences them.
++ (if platformOS platform == OSDarwin &&
platformArch platform == ArchX86 &&
not staticLink
then ["-Wl,-read_only_relocs,suppress"]
else [])
++ o_files
++ lib_path_opts)
++ extra_ld_inputs
++ map SysTools.Option (
rc_objs
++ framework_path_opts
++ framework_opts
++ pkg_lib_path_opts
++ extraLinkObj:noteLinkObjs
++ pkg_link_opts
++ pkg_framework_path_opts
++ pkg_framework_opts
++ debug_opts
++ thread_opts
))
-- parallel only: move binary to another dir -- HWL
success <- runPhase_MoveBinary dflags output_fn
unless success $
throwGhcExceptionIO (InstallationError ("cannot move binary")) | 10,063 | linkBinary' staticLink dflags o_files dep_packages = do
let platform = targetPlatform dflags
mySettings = settings dflags
verbFlags = getVerbFlags dflags
output_fn = exeFileName staticLink dflags
-- get the full list of packages to link with, by combining the
-- explicit packages with the auto packages and all of their
-- dependencies, and eliminating duplicates.
full_output_fn <- if isAbsolute output_fn
then return output_fn
else do d <- getCurrentDirectory
return $ normalise (d </> output_fn)
pkg_lib_paths <- getPackageLibraryPath dflags dep_packages
let pkg_lib_path_opts = concatMap get_pkg_lib_path_opts pkg_lib_paths
get_pkg_lib_path_opts l
| osElfTarget (platformOS platform) &&
dynLibLoader dflags == SystemDependent &&
not (gopt Opt_Static dflags)
= let libpath = if gopt Opt_RelativeDynlibPaths dflags
then "$ORIGIN" </>
(l `makeRelativeTo` full_output_fn)
else l
rpath = if gopt Opt_RPath dflags
then ["-Wl,-rpath", "-Wl," ++ libpath]
else []
-- Solaris 11's linker does not support -rpath-link option. It silently
-- ignores it and then complains about next option which is -l<some
-- dir> as being a directory and not expected object file, E.g
-- ld: elf error: file
-- /tmp/ghc-src/libraries/base/dist-install/build:
-- elf_begin: I/O error: region read: Is a directory
rpathlink = if (platformOS platform) == OSSolaris2
then []
else ["-Wl,-rpath-link", "-Wl," ++ l]
in ["-L" ++ l] ++ rpathlink ++ rpath
| osMachOTarget (platformOS platform) &&
dynLibLoader dflags == SystemDependent &&
not (gopt Opt_Static dflags) &&
gopt Opt_RPath dflags
= let libpath = if gopt Opt_RelativeDynlibPaths dflags
then "@loader_path" </>
(l `makeRelativeTo` full_output_fn)
else l
in ["-L" ++ l] ++ ["-Wl,-rpath", "-Wl," ++ libpath]
| otherwise = ["-L" ++ l]
let lib_paths = libraryPaths dflags
let lib_path_opts = map ("-L"++) lib_paths
extraLinkObj <- mkExtraObjToLinkIntoBinary dflags
noteLinkObjs <- mkNoteObjsToLinkIntoBinary dflags dep_packages
pkg_link_opts <- do
(package_hs_libs, extra_libs, other_flags) <- getPackageLinkOpts dflags dep_packages
return $ if staticLink
then package_hs_libs -- If building an executable really means making a static
-- library (e.g. iOS), then we only keep the -l options for
-- HS packages, because libtool doesn't accept other options.
-- In the case of iOS these need to be added by hand to the
-- final link in Xcode.
else other_flags ++ package_hs_libs ++ extra_libs -- -Wl,-u,<sym> contained in other_flags
-- needs to be put before -l<package>,
-- otherwise Solaris linker fails linking
-- a binary with unresolved symbols in RTS
-- which are defined in base package
-- the reason for this is a note in ld(1) about
-- '-u' option: "The placement of this option
-- on the command line is significant.
-- This option must be placed before the library
-- that defines the symbol."
pkg_framework_path_opts <-
if platformUsesFrameworks platform
then do pkg_framework_paths <- getPackageFrameworkPath dflags dep_packages
return $ map ("-F" ++) pkg_framework_paths
else return []
framework_path_opts <-
if platformUsesFrameworks platform
then do let framework_paths = frameworkPaths dflags
return $ map ("-F" ++) framework_paths
else return []
pkg_framework_opts <-
if platformUsesFrameworks platform
then do pkg_frameworks <- getPackageFrameworks dflags dep_packages
return $ concat [ ["-framework", fw] | fw <- pkg_frameworks ]
else return []
framework_opts <-
if platformUsesFrameworks platform
then do let frameworks = cmdlineFrameworks dflags
-- reverse because they're added in reverse order from
-- the cmd line:
return $ concat [ ["-framework", fw]
| fw <- reverse frameworks ]
else return []
-- probably _stub.o files
let extra_ld_inputs = ldInputs dflags
-- Here are some libs that need to be linked at the *end* of
-- the command line, because they contain symbols that are referred to
-- by the RTS. We can't therefore use the ordinary way opts for these.
let
debug_opts | WayDebug `elem` ways dflags = [
#if defined(HAVE_LIBBFD)
"-lbfd", "-liberty"
#endif
]
| otherwise = []
let thread_opts
| WayThreaded `elem` ways dflags =
let os = platformOS (targetPlatform dflags)
in if os == OSOsf3 then ["-lpthread", "-lexc"]
else if os `elem` [OSMinGW32, OSFreeBSD, OSOpenBSD,
OSNetBSD, OSHaiku, OSQNXNTO, OSiOS, OSDarwin]
then []
else ["-lpthread"]
| otherwise = []
rc_objs <- maybeCreateManifest dflags output_fn
let link = if staticLink
then SysTools.runLibtool
else SysTools.runLink
link dflags (
map SysTools.Option verbFlags
++ [ SysTools.Option "-o"
, SysTools.FileOption "" output_fn
]
++ map SysTools.Option (
[]
-- Permit the linker to auto link _symbol to _imp_symbol.
-- This lets us link against DLLs without needing an "import library".
++ (if platformOS platform == OSMinGW32
then ["-Wl,--enable-auto-import"]
else [])
-- '-no_compact_unwind'
-- C++/Objective-C exceptions cannot use optimised
-- stack unwinding code. The optimised form is the
-- default in Xcode 4 on at least x86_64, and
-- without this flag we're also seeing warnings
-- like
-- ld: warning: could not create compact unwind for .LFB3: non-standard register 5 being saved in prolog
-- on x86.
++ (if sLdSupportsCompactUnwind mySettings &&
not staticLink &&
(platformOS platform == OSDarwin || platformOS platform == OSiOS) &&
case platformArch platform of
ArchX86 -> True
ArchX86_64 -> True
ArchARM {} -> True
_ -> False
then ["-Wl,-no_compact_unwind"]
else [])
-- '-no_pie'
-- iOS uses 'dynamic-no-pic', so we must pass this to ld to suppress a warning; see #7722
++ (if platformOS platform == OSiOS &&
not staticLink
then ["-Wl,-no_pie"]
else [])
-- '-Wl,-read_only_relocs,suppress'
-- ld gives loads of warnings like:
-- ld: warning: text reloc in _base_GHCziArr_unsafeArray_info to _base_GHCziArr_unsafeArray_closure
-- when linking any program. We're not sure
-- whether this is something we ought to fix, but
-- for now this flags silences them.
++ (if platformOS platform == OSDarwin &&
platformArch platform == ArchX86 &&
not staticLink
then ["-Wl,-read_only_relocs,suppress"]
else [])
++ o_files
++ lib_path_opts)
++ extra_ld_inputs
++ map SysTools.Option (
rc_objs
++ framework_path_opts
++ framework_opts
++ pkg_lib_path_opts
++ extraLinkObj:noteLinkObjs
++ pkg_link_opts
++ pkg_framework_path_opts
++ pkg_framework_opts
++ debug_opts
++ thread_opts
))
-- parallel only: move binary to another dir -- HWL
success <- runPhase_MoveBinary dflags output_fn
unless success $
throwGhcExceptionIO (InstallationError ("cannot move binary")) | 9,992 | false | true | 0 | 27 | 4,469 | 1,390 | 717 | 673 | null | null |
Lyapunov/haskell-programming-from-first-principles | chapter_7/digits.hs | mit | -- tenDigit
tensDigit :: Integral a => a -> a
tensDigit x = d
where xLast = x `div` 10
d = xLast `mod` 10
-- tenDigit2 | 139 | tensDigit :: Integral a => a -> a
tensDigit x = d
where xLast = x `div` 10
d = xLast `mod` 10
-- tenDigit2 | 127 | tensDigit x = d
where xLast = x `div` 10
d = xLast `mod` 10
-- tenDigit2 | 93 | true | true | 1 | 7 | 47 | 54 | 29 | 25 | null | null |
ndmitchell/nsis | src/Development/NSIS/Plugins/WinMessages.hs | bsd-3-clause | wm_COPY = 0x0301 | 40 | wm_COPY = 0x0301 | 40 | wm_COPY = 0x0301 | 40 | false | false | 0 | 4 | 26 | 6 | 3 | 3 | null | null |
sashabu/libcspm | src/Util/Exception.hs | bsd-3-clause | -- | Given a 'SrcSpan' and a pretty printed 'Doc' creates an 'ErrorMessage'.
mkErrorMessage :: SrcSpan -> Doc -> ErrorMessage
mkErrorMessage l d = ErrorMessage l d | 163 | mkErrorMessage :: SrcSpan -> Doc -> ErrorMessage
mkErrorMessage l d = ErrorMessage l d | 86 | mkErrorMessage l d = ErrorMessage l d | 37 | true | true | 0 | 6 | 26 | 30 | 15 | 15 | null | null |
noteed/scp-streams | Network/SCP/Protocol.hs | bsd-3-clause | getFeedback :: InputStream ByteString -> IO Bool
getFeedback feedback = do
i' <- S.readExactly 1 feedback
case i' of
"\0" -> return True
_ -> do
msg <- sGetLine feedback
#ifdef SCP_DEBUG
hPutStrLn stderr ("Bad feedback: " ++ C.unpack msg) >> hFlush stderr
#endif
return False | 305 | getFeedback :: InputStream ByteString -> IO Bool
getFeedback feedback = do
i' <- S.readExactly 1 feedback
case i' of
"\0" -> return True
_ -> do
msg <- sGetLine feedback
#ifdef SCP_DEBUG
hPutStrLn stderr ("Bad feedback: " ++ C.unpack msg) >> hFlush stderr
#endif
return False | 305 | getFeedback feedback = do
i' <- S.readExactly 1 feedback
case i' of
"\0" -> return True
_ -> do
msg <- sGetLine feedback
#ifdef SCP_DEBUG
hPutStrLn stderr ("Bad feedback: " ++ C.unpack msg) >> hFlush stderr
#endif
return False | 256 | false | true | 0 | 19 | 75 | 110 | 48 | 62 | null | null |
anton-dessiatov/json-rpc | examples/time-server.hs | unlicense | respond (IncomingError e) = return $ MsgError e | 47 | respond (IncomingError e) = return $ MsgError e | 47 | respond (IncomingError e) = return $ MsgError e | 47 | false | false | 2 | 6 | 7 | 24 | 10 | 14 | null | null |
ml9951/ThreadScope | tests/SumEulerPar1.hs | bsd-3-clause | -------------------------------------------------------------------------------
euler :: Int -> Int
euler n = length (filter (relprime n) (mkList n)) | 153 | euler :: Int -> Int
euler n = length (filter (relprime n) (mkList n)) | 69 | euler n = length (filter (relprime n) (mkList n)) | 49 | true | true | 0 | 9 | 18 | 42 | 21 | 21 | null | null |
glguy/ssh-hans | src/Network/SSH/Named.hs | bsd-3-clause | lookupNamed :: [Named a] -> ShortByteString -> Maybe a
lookupNamed xs n = fmap namedThing (find (\x -> nameOf x == n) xs) | 121 | lookupNamed :: [Named a] -> ShortByteString -> Maybe a
lookupNamed xs n = fmap namedThing (find (\x -> nameOf x == n) xs) | 121 | lookupNamed xs n = fmap namedThing (find (\x -> nameOf x == n) xs) | 66 | false | true | 0 | 11 | 22 | 61 | 30 | 31 | null | null |
nomeata/codeworld | codeworld-api/src/CodeWorld/Color.hs | apache-2.0 | fromHSL :: Double -> Double -> Double -> Color
fromHSL h s l = RGBA r g b 1
where m1 = l * 2 - m2
m2 | l <= 0.5 = l * (s + 1)
| otherwise = l + s - l * s
r = convert m1 m2 (h / 2 / pi + 1/3)
g = convert m1 m2 (h / 2 / pi )
b = convert m1 m2 (h / 2 / pi - 1/3)
convert m1 m2 h
| h < 0 = convert m1 m2 (h + 1)
| h > 1 = convert m1 m2 (h - 1)
| h * 6 < 1 = m1 + (m2 - m1) * h * 6
| h * 2 < 1 = m2
| h * 3 < 2 = m1 + (m2 - m1) * (2/3 - h) * 6
| otherwise = m1 | 633 | fromHSL :: Double -> Double -> Double -> Color
fromHSL h s l = RGBA r g b 1
where m1 = l * 2 - m2
m2 | l <= 0.5 = l * (s + 1)
| otherwise = l + s - l * s
r = convert m1 m2 (h / 2 / pi + 1/3)
g = convert m1 m2 (h / 2 / pi )
b = convert m1 m2 (h / 2 / pi - 1/3)
convert m1 m2 h
| h < 0 = convert m1 m2 (h + 1)
| h > 1 = convert m1 m2 (h - 1)
| h * 6 < 1 = m1 + (m2 - m1) * h * 6
| h * 2 < 1 = m2
| h * 3 < 2 = m1 + (m2 - m1) * (2/3 - h) * 6
| otherwise = m1 | 633 | fromHSL h s l = RGBA r g b 1
where m1 = l * 2 - m2
m2 | l <= 0.5 = l * (s + 1)
| otherwise = l + s - l * s
r = convert m1 m2 (h / 2 / pi + 1/3)
g = convert m1 m2 (h / 2 / pi )
b = convert m1 m2 (h / 2 / pi - 1/3)
convert m1 m2 h
| h < 0 = convert m1 m2 (h + 1)
| h > 1 = convert m1 m2 (h - 1)
| h * 6 < 1 = m1 + (m2 - m1) * h * 6
| h * 2 < 1 = m2
| h * 3 < 2 = m1 + (m2 - m1) * (2/3 - h) * 6
| otherwise = m1 | 586 | false | true | 6 | 12 | 332 | 361 | 178 | 183 | null | null |
ethercrow/yi | yi-core/src/Yi/Editor.hs | gpl-2.0 | -- | Attach the specified buffer to the current window
switchToBufferE :: BufferRef -> EditorM ()
switchToBufferE bk = windowsA . PL.focus %= \w ->
w & bufkeyA .~ bk
& bufAccessListA %~ forceFold1 . (bufkey w:) . filter (bk /=) | 233 | switchToBufferE :: BufferRef -> EditorM ()
switchToBufferE bk = windowsA . PL.focus %= \w ->
w & bufkeyA .~ bk
& bufAccessListA %~ forceFold1 . (bufkey w:) . filter (bk /=) | 178 | switchToBufferE bk = windowsA . PL.focus %= \w ->
w & bufkeyA .~ bk
& bufAccessListA %~ forceFold1 . (bufkey w:) . filter (bk /=) | 135 | true | true | 4 | 8 | 46 | 79 | 40 | 39 | null | null |
jameseb7/haskell-roguelike | HaskellRoguelike/LevelType.hs | bsd-3-clause | levelWidth :: Int
levelWidth = 80 | 37 | levelWidth :: Int
levelWidth = 80 | 33 | levelWidth = 80 | 15 | false | true | 0 | 6 | 9 | 18 | 7 | 11 | null | null |
ekmett/text | tests/Tests/Properties.hs | bsd-2-clause | t_utf32LE = forAll genUnicode $ (E.decodeUtf32LE . E.encodeUtf32LE) `eq` id | 78 | t_utf32LE = forAll genUnicode $ (E.decodeUtf32LE . E.encodeUtf32LE) `eq` id | 78 | t_utf32LE = forAll genUnicode $ (E.decodeUtf32LE . E.encodeUtf32LE) `eq` id | 78 | false | false | 0 | 9 | 12 | 30 | 16 | 14 | null | null |
vTurbine/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | tcGetTyVar :: String -> Type -> TyVar
tcGetTyVar msg ty = expectJust msg (tcGetTyVar_maybe ty) | 94 | tcGetTyVar :: String -> Type -> TyVar
tcGetTyVar msg ty = expectJust msg (tcGetTyVar_maybe ty) | 94 | tcGetTyVar msg ty = expectJust msg (tcGetTyVar_maybe ty) | 56 | false | true | 0 | 8 | 14 | 40 | 18 | 22 | null | null |
josuf107/Adverb | Adverb/Common.hs | gpl-3.0 | achingly = id | 13 | achingly = id | 13 | achingly = id | 13 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
tjakway/ghcjvm | compiler/main/HscMain.hs | bsd-3-clause | getHscEnv :: Hsc HscEnv
getHscEnv = Hsc $ \e w -> return (e, w) | 63 | getHscEnv :: Hsc HscEnv
getHscEnv = Hsc $ \e w -> return (e, w) | 63 | getHscEnv = Hsc $ \e w -> return (e, w) | 39 | false | true | 0 | 8 | 13 | 34 | 18 | 16 | null | null |
andyarvanitis/Idris-dev | src/IRTS/Lang.hs | bsd-3-clause | lift env (LForce e) = do e' <- lift env e
return (LForce e') | 85 | lift env (LForce e) = do e' <- lift env e
return (LForce e') | 85 | lift env (LForce e) = do e' <- lift env e
return (LForce e') | 85 | false | false | 0 | 9 | 38 | 43 | 18 | 25 | null | null |
fmapfmapfmap/amazonka | amazonka-redshift/gen/Network/AWS/Redshift/DescribeClusterSecurityGroups.hs | mpl-2.0 | -- | The maximum number of response records to return in each call. If the
-- number of remaining response records exceeds the specified 'MaxRecords'
-- value, a value is returned in a 'marker' field of the response. You can
-- retrieve the next set of records by retrying the command with the
-- returned marker value.
--
-- Default: '100'
--
-- Constraints: minimum 20, maximum 100.
dcsgMaxRecords :: Lens' DescribeClusterSecurityGroups (Maybe Int)
dcsgMaxRecords = lens _dcsgMaxRecords (\ s a -> s{_dcsgMaxRecords = a}) | 522 | dcsgMaxRecords :: Lens' DescribeClusterSecurityGroups (Maybe Int)
dcsgMaxRecords = lens _dcsgMaxRecords (\ s a -> s{_dcsgMaxRecords = a}) | 137 | dcsgMaxRecords = lens _dcsgMaxRecords (\ s a -> s{_dcsgMaxRecords = a}) | 71 | true | true | 1 | 9 | 84 | 57 | 33 | 24 | null | null |
dhrosa/shinyfs | Shiny/FS.hs | gpl-3.0 | ledOpenDirectory :: MVar FSState -> FilePath -> IO (Errno)
ledOpenDirectory mvar path = withMVar mvar $ \FSState{fileTree=tree} ->
case (lookupPath path tree) of
Just Dir{} -> return eOK
_ -> return eNOENT | 224 | ledOpenDirectory :: MVar FSState -> FilePath -> IO (Errno)
ledOpenDirectory mvar path = withMVar mvar $ \FSState{fileTree=tree} ->
case (lookupPath path tree) of
Just Dir{} -> return eOK
_ -> return eNOENT | 224 | ledOpenDirectory mvar path = withMVar mvar $ \FSState{fileTree=tree} ->
case (lookupPath path tree) of
Just Dir{} -> return eOK
_ -> return eNOENT | 165 | false | true | 3 | 9 | 50 | 89 | 44 | 45 | null | null |
msullivan/advent-of-code | 2016/A7a.hs | mit | check nus (']':xs) = check (not nus) xs | 39 | check nus (']':xs) = check (not nus) xs | 39 | check nus (']':xs) = check (not nus) xs | 39 | false | false | 0 | 7 | 7 | 29 | 14 | 15 | null | null |
ekmett/wxHaskell | samples/wx/TimeFlows.hs | lgpl-2.1 | {-------------------------------------------------------------------------
The gui
-------------------------------------------------------------------------}
main
= start timeFlows | 184 | main
= start timeFlows | 24 | main
= start timeFlows | 24 | true | false | 1 | 5 | 11 | 13 | 5 | 8 | null | null |
timstclair/experimental | haskell/real_world_haskell/ch05/PrettyJSON.hs | unlicense | series :: Char -> Char -> (a -> Doc) -> [a] -> Doc
series open close item = enclose open close
. fsep . punctuate (char ',') . map item | 158 | series :: Char -> Char -> (a -> Doc) -> [a] -> Doc
series open close item = enclose open close
. fsep . punctuate (char ',') . map item | 158 | series open close item = enclose open close
. fsep . punctuate (char ',') . map item | 107 | false | true | 1 | 10 | 52 | 79 | 37 | 42 | null | null |
steven777400/TwilioIVR | test/Data/TransientStoreSpec.hs | mit | spec :: Spec
spec = do
describe "peek" $ do
it "returns Nothing if db is empty" $ do
db <- create 5 :: IO (TransientStore String)
peek db nil `shouldReturn` Nothing
it "returns Nothing if key not in db" $ do
db <- create 5 :: IO (TransientStore String)
insert db "hello"
result <- peek db nil
result `shouldBe` Nothing
it "returns the value if key in db" $ do
db <- create 5 :: IO (TransientStore String)
key <- insert db "hello"
result <- peek db key
result `shouldBe` (Just "hello")
it "returns the value multiple times" $ do
db <- create 5 :: IO (TransientStore String)
key <- insert db "hello"
result <- peek db key
result `shouldBe` (Just "hello")
result2 <- peek db key
result2 `shouldBe` (Just "hello")
it "returns the value if key one of several in db" $ do
db <- create 5 :: IO (TransientStore String)
key1 <- insert db "hello"
key2 <- insert db "different"
key1 `shouldNotBe` key2
result1 <- peek db key1
result1 `shouldBe` (Just "hello")
result2 <- peek db key2
result2 `shouldBe` (Just "different")
describe "pop" $ do
it "returns a value once only" $ do
db <- create 5 :: IO (TransientStore String)
key <- insert db "hello"
result <- pop db key
result `shouldBe` (Just "hello")
result2 <- pop db key
result2 `shouldBe` Nothing
describe "cleanIfNeeded" $ do
it "should not remove a value after a short time" $ do
db <- create 1 :: IO (TransientStore String)
key <- insert db "hello"
threadDelay 500000
result <- pop db key
result `shouldBe` (Just "hello")
it "should remove a value after a long time, but leave shorter values" $ do
db <- create 1 :: IO (TransientStore String)
key <- insert db "hello"
key3 <- insert db "xyzzy"
threadDelay 500000
result <- peek db key
result `shouldBe` (Just "hello")
key2 <- insert db "different"
threadDelay 900000
result3 <- peek db key3
result3 `shouldBe` Nothing
result2' <- peek db key2
result2' `shouldBe` (Just "different")
threadDelay 2000000
result' <- peek db key
result' `shouldBe` Nothing
result2' <- peek db key2
result2' `shouldBe` Nothing
it "should keep peek'd values alive" $ do
db <- create 1 :: IO (TransientStore String)
key1 <- insert db "hello"
key2 <- insert db "there"
threadDelay 500000
result1 <- peek db key1
result1 `shouldBe` (Just "hello")
result2 <- peek db key2
result2 `shouldBe` (Just "there")
threadDelay 500000
result1 <- peek db key1
result1 `shouldBe` (Just "hello")
threadDelay 500000
result1 <- peek db key1
result1 `shouldBe` (Just "hello")
threadDelay 500000
result1 <- peek db key1
result1 `shouldBe` (Just "hello")
threadDelay 500000
result1 <- peek db key1
result1 `shouldBe` (Just "hello")
result2 <- peek db key2
result2 `shouldBe` Nothing | 3,706 | spec :: Spec
spec = do
describe "peek" $ do
it "returns Nothing if db is empty" $ do
db <- create 5 :: IO (TransientStore String)
peek db nil `shouldReturn` Nothing
it "returns Nothing if key not in db" $ do
db <- create 5 :: IO (TransientStore String)
insert db "hello"
result <- peek db nil
result `shouldBe` Nothing
it "returns the value if key in db" $ do
db <- create 5 :: IO (TransientStore String)
key <- insert db "hello"
result <- peek db key
result `shouldBe` (Just "hello")
it "returns the value multiple times" $ do
db <- create 5 :: IO (TransientStore String)
key <- insert db "hello"
result <- peek db key
result `shouldBe` (Just "hello")
result2 <- peek db key
result2 `shouldBe` (Just "hello")
it "returns the value if key one of several in db" $ do
db <- create 5 :: IO (TransientStore String)
key1 <- insert db "hello"
key2 <- insert db "different"
key1 `shouldNotBe` key2
result1 <- peek db key1
result1 `shouldBe` (Just "hello")
result2 <- peek db key2
result2 `shouldBe` (Just "different")
describe "pop" $ do
it "returns a value once only" $ do
db <- create 5 :: IO (TransientStore String)
key <- insert db "hello"
result <- pop db key
result `shouldBe` (Just "hello")
result2 <- pop db key
result2 `shouldBe` Nothing
describe "cleanIfNeeded" $ do
it "should not remove a value after a short time" $ do
db <- create 1 :: IO (TransientStore String)
key <- insert db "hello"
threadDelay 500000
result <- pop db key
result `shouldBe` (Just "hello")
it "should remove a value after a long time, but leave shorter values" $ do
db <- create 1 :: IO (TransientStore String)
key <- insert db "hello"
key3 <- insert db "xyzzy"
threadDelay 500000
result <- peek db key
result `shouldBe` (Just "hello")
key2 <- insert db "different"
threadDelay 900000
result3 <- peek db key3
result3 `shouldBe` Nothing
result2' <- peek db key2
result2' `shouldBe` (Just "different")
threadDelay 2000000
result' <- peek db key
result' `shouldBe` Nothing
result2' <- peek db key2
result2' `shouldBe` Nothing
it "should keep peek'd values alive" $ do
db <- create 1 :: IO (TransientStore String)
key1 <- insert db "hello"
key2 <- insert db "there"
threadDelay 500000
result1 <- peek db key1
result1 `shouldBe` (Just "hello")
result2 <- peek db key2
result2 `shouldBe` (Just "there")
threadDelay 500000
result1 <- peek db key1
result1 `shouldBe` (Just "hello")
threadDelay 500000
result1 <- peek db key1
result1 `shouldBe` (Just "hello")
threadDelay 500000
result1 <- peek db key1
result1 `shouldBe` (Just "hello")
threadDelay 500000
result1 <- peek db key1
result1 `shouldBe` (Just "hello")
result2 <- peek db key2
result2 `shouldBe` Nothing | 3,706 | spec = do
describe "peek" $ do
it "returns Nothing if db is empty" $ do
db <- create 5 :: IO (TransientStore String)
peek db nil `shouldReturn` Nothing
it "returns Nothing if key not in db" $ do
db <- create 5 :: IO (TransientStore String)
insert db "hello"
result <- peek db nil
result `shouldBe` Nothing
it "returns the value if key in db" $ do
db <- create 5 :: IO (TransientStore String)
key <- insert db "hello"
result <- peek db key
result `shouldBe` (Just "hello")
it "returns the value multiple times" $ do
db <- create 5 :: IO (TransientStore String)
key <- insert db "hello"
result <- peek db key
result `shouldBe` (Just "hello")
result2 <- peek db key
result2 `shouldBe` (Just "hello")
it "returns the value if key one of several in db" $ do
db <- create 5 :: IO (TransientStore String)
key1 <- insert db "hello"
key2 <- insert db "different"
key1 `shouldNotBe` key2
result1 <- peek db key1
result1 `shouldBe` (Just "hello")
result2 <- peek db key2
result2 `shouldBe` (Just "different")
describe "pop" $ do
it "returns a value once only" $ do
db <- create 5 :: IO (TransientStore String)
key <- insert db "hello"
result <- pop db key
result `shouldBe` (Just "hello")
result2 <- pop db key
result2 `shouldBe` Nothing
describe "cleanIfNeeded" $ do
it "should not remove a value after a short time" $ do
db <- create 1 :: IO (TransientStore String)
key <- insert db "hello"
threadDelay 500000
result <- pop db key
result `shouldBe` (Just "hello")
it "should remove a value after a long time, but leave shorter values" $ do
db <- create 1 :: IO (TransientStore String)
key <- insert db "hello"
key3 <- insert db "xyzzy"
threadDelay 500000
result <- peek db key
result `shouldBe` (Just "hello")
key2 <- insert db "different"
threadDelay 900000
result3 <- peek db key3
result3 `shouldBe` Nothing
result2' <- peek db key2
result2' `shouldBe` (Just "different")
threadDelay 2000000
result' <- peek db key
result' `shouldBe` Nothing
result2' <- peek db key2
result2' `shouldBe` Nothing
it "should keep peek'd values alive" $ do
db <- create 1 :: IO (TransientStore String)
key1 <- insert db "hello"
key2 <- insert db "there"
threadDelay 500000
result1 <- peek db key1
result1 `shouldBe` (Just "hello")
result2 <- peek db key2
result2 `shouldBe` (Just "there")
threadDelay 500000
result1 <- peek db key1
result1 `shouldBe` (Just "hello")
threadDelay 500000
result1 <- peek db key1
result1 `shouldBe` (Just "hello")
threadDelay 500000
result1 <- peek db key1
result1 `shouldBe` (Just "hello")
threadDelay 500000
result1 <- peek db key1
result1 `shouldBe` (Just "hello")
result2 <- peek db key2
result2 `shouldBe` Nothing | 3,693 | false | true | 0 | 19 | 1,522 | 1,077 | 487 | 590 | null | null |
snoyberg/ghc | compiler/hsSyn/HsExpr.hs | bsd-3-clause | hsExprNeedsParens (HsUnboundVar {}) = False | 45 | hsExprNeedsParens (HsUnboundVar {}) = False | 45 | hsExprNeedsParens (HsUnboundVar {}) = False | 45 | false | false | 0 | 7 | 6 | 16 | 8 | 8 | null | null |
spencerjanssen/cabal2nix | src/hackage2nix.hs | bsd-3-clause | resolveNixpkgsAttribute :: Nixpkgs -> Attribute -> Maybe Path
resolveNixpkgsAttribute nixpkgs name
| name `elem` ["clang","lldb","llvm"] = Just ["self","llvmPackages"]
| Just paths <- Map.lookup name nixpkgs = getShortestPath (Set.toList (paths `Set.intersection` goodScopes))
| otherwise = Nothing
where
goodScopes :: Set Path
goodScopes = Set.fromList [[], ["xlibs"], ["gnome"], ["gnome3"], ["kde4"]]
getShortestPath :: [Path] -> Maybe Path
getShortestPath [] = Nothing
getShortestPath ps = Just ("pkgs" : minimumBy (on compare length) ps) | 600 | resolveNixpkgsAttribute :: Nixpkgs -> Attribute -> Maybe Path
resolveNixpkgsAttribute nixpkgs name
| name `elem` ["clang","lldb","llvm"] = Just ["self","llvmPackages"]
| Just paths <- Map.lookup name nixpkgs = getShortestPath (Set.toList (paths `Set.intersection` goodScopes))
| otherwise = Nothing
where
goodScopes :: Set Path
goodScopes = Set.fromList [[], ["xlibs"], ["gnome"], ["gnome3"], ["kde4"]]
getShortestPath :: [Path] -> Maybe Path
getShortestPath [] = Nothing
getShortestPath ps = Just ("pkgs" : minimumBy (on compare length) ps) | 600 | resolveNixpkgsAttribute nixpkgs name
| name `elem` ["clang","lldb","llvm"] = Just ["self","llvmPackages"]
| Just paths <- Map.lookup name nixpkgs = getShortestPath (Set.toList (paths `Set.intersection` goodScopes))
| otherwise = Nothing
where
goodScopes :: Set Path
goodScopes = Set.fromList [[], ["xlibs"], ["gnome"], ["gnome3"], ["kde4"]]
getShortestPath :: [Path] -> Maybe Path
getShortestPath [] = Nothing
getShortestPath ps = Just ("pkgs" : minimumBy (on compare length) ps) | 538 | false | true | 1 | 10 | 127 | 217 | 114 | 103 | null | null |
DbIHbKA/vbpca | app/Main.hs | bsd-3-clause | main :: IO ()
main = undefined | 30 | main :: IO ()
main = undefined | 30 | main = undefined | 16 | false | true | 0 | 7 | 6 | 22 | 9 | 13 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Custom/PositionError.hs | mit | throwPositionException :: MonadDOM m => PositionError -> m a
throwPositionException error = do
positionErrorCode <- (toEnum . subtract 1 . fromIntegral) <$> getCode error
positionErrorMessage <- getMessage error
liftIO $ throwIO (PositionException{..}) | 267 | throwPositionException :: MonadDOM m => PositionError -> m a
throwPositionException error = do
positionErrorCode <- (toEnum . subtract 1 . fromIntegral) <$> getCode error
positionErrorMessage <- getMessage error
liftIO $ throwIO (PositionException{..}) | 267 | throwPositionException error = do
positionErrorCode <- (toEnum . subtract 1 . fromIntegral) <$> getCode error
positionErrorMessage <- getMessage error
liftIO $ throwIO (PositionException{..}) | 206 | false | true | 0 | 12 | 46 | 84 | 39 | 45 | null | null |
RobinKrom/fasths | src/Codec/Fast/Encoder.hs | bsd-3-clause | asciiStrF2Cop (AsciiStringField(FieldInstrContent _ (Just Mandatory) (Just (Increment _))))
= throw $ S2 "Increment operator is only applicable to integer fields." | 167 | asciiStrF2Cop (AsciiStringField(FieldInstrContent _ (Just Mandatory) (Just (Increment _))))
= throw $ S2 "Increment operator is only applicable to integer fields." | 167 | asciiStrF2Cop (AsciiStringField(FieldInstrContent _ (Just Mandatory) (Just (Increment _))))
= throw $ S2 "Increment operator is only applicable to integer fields." | 167 | false | false | 2 | 12 | 23 | 53 | 24 | 29 | null | null |
itkovian/number-six | src/NumberSix/Handlers/LastFm.hs | bsd-3-clause | --------------------------------------------------------------------------------
lastFm :: Text -> IO Text
lastFm query = do
result <- httpScrape Xml url id $ \cursor -> do
artist <- nodeText . current <$> findRec (byTagName "artist") cursor
title <- nodeText . current <$> findRec (byTagName "name") cursor
link <- nodeText . current <$> findRec (byTagName "url") cursor
return (artist, title, link)
case result of
Just (artist, title, link) -> textAndUrl
(query <> " listened to: " <> title <> " by " <> artist) link
_ -> randomError
where
url = "http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user="
<> urlEncode query <> "&api_key=87b8b81da496639cb5a295d78e5f8f4d"
-------------------------------------------------------------------------------- | 882 | lastFm :: Text -> IO Text
lastFm query = do
result <- httpScrape Xml url id $ \cursor -> do
artist <- nodeText . current <$> findRec (byTagName "artist") cursor
title <- nodeText . current <$> findRec (byTagName "name") cursor
link <- nodeText . current <$> findRec (byTagName "url") cursor
return (artist, title, link)
case result of
Just (artist, title, link) -> textAndUrl
(query <> " listened to: " <> title <> " by " <> artist) link
_ -> randomError
where
url = "http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user="
<> urlEncode query <> "&api_key=87b8b81da496639cb5a295d78e5f8f4d"
-------------------------------------------------------------------------------- | 801 | lastFm query = do
result <- httpScrape Xml url id $ \cursor -> do
artist <- nodeText . current <$> findRec (byTagName "artist") cursor
title <- nodeText . current <$> findRec (byTagName "name") cursor
link <- nodeText . current <$> findRec (byTagName "url") cursor
return (artist, title, link)
case result of
Just (artist, title, link) -> textAndUrl
(query <> " listened to: " <> title <> " by " <> artist) link
_ -> randomError
where
url = "http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user="
<> urlEncode query <> "&api_key=87b8b81da496639cb5a295d78e5f8f4d"
-------------------------------------------------------------------------------- | 775 | true | true | 0 | 16 | 209 | 213 | 104 | 109 | null | null |
siddhanathan/ghc | compiler/hsSyn/HsExpr.hs | bsd-3-clause | thBrackets :: SDoc -> SDoc -> SDoc
thBrackets pp_kind pp_body = char '[' <> pp_kind <> char '|' <+>
pp_body <+> ptext (sLit "|]") | 158 | thBrackets :: SDoc -> SDoc -> SDoc
thBrackets pp_kind pp_body = char '[' <> pp_kind <> char '|' <+>
pp_body <+> ptext (sLit "|]") | 158 | thBrackets pp_kind pp_body = char '[' <> pp_kind <> char '|' <+>
pp_body <+> ptext (sLit "|]") | 123 | false | true | 0 | 9 | 52 | 55 | 26 | 29 | null | null |
CulpaBS/wbBach | src/Futhark/Analysis/HORepresentation/SOACNest.hs | bsd-3-clause | typeOf (SOACNest _ (Reduce _ _ _ _ accinit)) =
staticShapes $ map subExpType accinit | 86 | typeOf (SOACNest _ (Reduce _ _ _ _ accinit)) =
staticShapes $ map subExpType accinit | 86 | typeOf (SOACNest _ (Reduce _ _ _ _ accinit)) =
staticShapes $ map subExpType accinit | 86 | false | false | 0 | 9 | 16 | 40 | 19 | 21 | null | null |
lcycon/QuickScala | Language/Scala/Parse.hs | gpl-3.0 | commaSep = P.commaSep scalaLexer | 32 | commaSep = P.commaSep scalaLexer | 32 | commaSep = P.commaSep scalaLexer | 32 | false | false | 0 | 6 | 3 | 11 | 5 | 6 | null | null |
bergmark/mmdoc | src/Test.hs | bsd-3-clause | assertEqualSorted :: (Ord a, Show a) => String -> [a] -> [a] -> Assertion
assertEqualSorted name xs ys = assertEqual name (sort xs) (sort ys) | 141 | assertEqualSorted :: (Ord a, Show a) => String -> [a] -> [a] -> Assertion
assertEqualSorted name xs ys = assertEqual name (sort xs) (sort ys) | 141 | assertEqualSorted name xs ys = assertEqual name (sort xs) (sort ys) | 67 | false | true | 0 | 9 | 24 | 70 | 36 | 34 | null | null |
fmapfmapfmap/amazonka | amazonka-swf/gen/Network/AWS/SWF/Types/Product.hs | mpl-2.0 | -- | The ID of the 'DecisionTaskCompleted' event corresponding to the
-- decision task that resulted in the 'CompleteWorkflowExecution' decision
-- to complete this execution. This information can be useful for
-- diagnosing problems by tracing back the chain of events leading up to
-- this event.
weceaDecisionTaskCompletedEventId :: Lens' WorkflowExecutionCompletedEventAttributes Integer
weceaDecisionTaskCompletedEventId = lens _weceaDecisionTaskCompletedEventId (\ s a -> s{_weceaDecisionTaskCompletedEventId = a}) | 520 | weceaDecisionTaskCompletedEventId :: Lens' WorkflowExecutionCompletedEventAttributes Integer
weceaDecisionTaskCompletedEventId = lens _weceaDecisionTaskCompletedEventId (\ s a -> s{_weceaDecisionTaskCompletedEventId = a}) | 221 | weceaDecisionTaskCompletedEventId = lens _weceaDecisionTaskCompletedEventId (\ s a -> s{_weceaDecisionTaskCompletedEventId = a}) | 128 | true | true | 0 | 9 | 62 | 44 | 26 | 18 | null | null |
schernichkin/yarn-client | tools/Main.hs | bsd-3-clause | apiQueryParamtersParser :: Stream s m (Tag String)
=> ParsecT s u m (Bool, (String, [ApiQueryParamter]))
apiQueryParamtersParser =
apiSectionParser ((tag "Query Parameters Supported" *> return False)
<|> (tag "Query Parameters Required" *> return True)) $ do
description <- unlines <$> many paragraph
apiQueryParameters <- mapM (parseString queryParamterParser) =<< fancyList
return (description, apiQueryParameters) | 470 | apiQueryParamtersParser :: Stream s m (Tag String)
=> ParsecT s u m (Bool, (String, [ApiQueryParamter]))
apiQueryParamtersParser =
apiSectionParser ((tag "Query Parameters Supported" *> return False)
<|> (tag "Query Parameters Required" *> return True)) $ do
description <- unlines <$> many paragraph
apiQueryParameters <- mapM (parseString queryParamterParser) =<< fancyList
return (description, apiQueryParameters) | 470 | apiQueryParamtersParser =
apiSectionParser ((tag "Query Parameters Supported" *> return False)
<|> (tag "Query Parameters Required" *> return True)) $ do
description <- unlines <$> many paragraph
apiQueryParameters <- mapM (parseString queryParamterParser) =<< fancyList
return (description, apiQueryParameters) | 341 | false | true | 0 | 12 | 104 | 138 | 68 | 70 | null | null |
Chase-C/Flocking-Haskell | src/Octree.hs | gpl-2.0 | octreeMapM_ func (Node _ _ _ a b c d e f g h) = do
octreeMapM_ func a
octreeMapM_ func b
octreeMapM_ func c
octreeMapM_ func d
octreeMapM_ func e
octreeMapM_ func f
octreeMapM_ func g
octreeMapM_ func h
return () | 248 | octreeMapM_ func (Node _ _ _ a b c d e f g h) = do
octreeMapM_ func a
octreeMapM_ func b
octreeMapM_ func c
octreeMapM_ func d
octreeMapM_ func e
octreeMapM_ func f
octreeMapM_ func g
octreeMapM_ func h
return () | 248 | octreeMapM_ func (Node _ _ _ a b c d e f g h) = do
octreeMapM_ func a
octreeMapM_ func b
octreeMapM_ func c
octreeMapM_ func d
octreeMapM_ func e
octreeMapM_ func f
octreeMapM_ func g
octreeMapM_ func h
return () | 248 | false | false | 0 | 8 | 77 | 111 | 45 | 66 | null | null |
phlummox/ghci-history-parser | src/GHCi/History/Parse/Common.hs | unlicense | -- | @numSpan := \<'num'\> \'-\' \<'num'\>@
numSpan:: Parser (Int, Int)
numSpan = (,) <$> num <*> (char '-' *> num) | 116 | numSpan:: Parser (Int, Int)
numSpan = (,) <$> num <*> (char '-' *> num) | 71 | numSpan = (,) <$> num <*> (char '-' *> num) | 43 | true | true | 0 | 8 | 21 | 42 | 23 | 19 | null | null |
ciderpunx/cv-api | src/Db.hs | gpl-3.0 | -- because we don't have access to the WorkCVId from the JSON resume,
-- we have to delete and re-add our work items
replaceWork :: CvKey -> [Work] -> SqlPersistM ()
replaceWork cvKey ws = do
deleteWhere [WorkCvId ==. Just cvKey]
mapM_ (createWork cvKey) ws | 266 | replaceWork :: CvKey -> [Work] -> SqlPersistM ()
replaceWork cvKey ws = do
deleteWhere [WorkCvId ==. Just cvKey]
mapM_ (createWork cvKey) ws | 149 | replaceWork cvKey ws = do
deleteWhere [WorkCvId ==. Just cvKey]
mapM_ (createWork cvKey) ws | 100 | true | true | 0 | 10 | 53 | 64 | 31 | 33 | null | null |
robertclancy/tapl | inference/lib/Language/Inference/Parser.hs | gpl-2.0 | atom :: Parser Term
atom = bool <|> zero <|> var | 48 | atom :: Parser Term
atom = bool <|> zero <|> var | 48 | atom = bool <|> zero <|> var | 28 | false | true | 0 | 6 | 10 | 22 | 11 | 11 | null | null |
romanb/amazonka | amazonka-autoscaling/gen/Network/AWS/AutoScaling/CreateAutoScalingGroup.hs | mpl-2.0 | -- | The name of the placement group into which you'll launch your instances, if
-- any. For more information, see <http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html Placement Groups>.
casgPlacementGroup :: Lens' CreateAutoScalingGroup (Maybe Text)
casgPlacementGroup =
lens _casgPlacementGroup (\s a -> s { _casgPlacementGroup = a }) | 361 | casgPlacementGroup :: Lens' CreateAutoScalingGroup (Maybe Text)
casgPlacementGroup =
lens _casgPlacementGroup (\s a -> s { _casgPlacementGroup = a }) | 153 | casgPlacementGroup =
lens _casgPlacementGroup (\s a -> s { _casgPlacementGroup = a }) | 89 | true | true | 0 | 9 | 46 | 47 | 26 | 21 | null | null |
DavidAlphaFox/ghc | libraries/Cabal/Cabal/Distribution/Simple/LocalBuildInfo.hs | bsd-3-clause | lookupComponent pkg (CExeName name) =
fmap CExe $ find ((name ==) . exeName) (executables pkg) | 98 | lookupComponent pkg (CExeName name) =
fmap CExe $ find ((name ==) . exeName) (executables pkg) | 98 | lookupComponent pkg (CExeName name) =
fmap CExe $ find ((name ==) . exeName) (executables pkg) | 98 | false | false | 0 | 9 | 18 | 46 | 23 | 23 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/typecheck/TcGenDeriv.hs | bsd-3-clause | leInt_RDR = varQual_RDR gHC_PRIM (fsLit "<=#") | 52 | leInt_RDR = varQual_RDR gHC_PRIM (fsLit "<=#") | 52 | leInt_RDR = varQual_RDR gHC_PRIM (fsLit "<=#") | 52 | false | false | 0 | 7 | 11 | 17 | 8 | 9 | null | null |
tjakway/ghcjvm | compiler/codeGen/StgCmmClosure.hs | bsd-3-clause | closureReEntrant _ = False | 26 | closureReEntrant _ = False | 26 | closureReEntrant _ = False | 26 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
mgsloan/compconfig | env/src/Misc.hs | mit | nxt :: (Eq a, Enum a, Bounded a) => a -> a
nxt x | x == maxBound = minBound
| otherwise = succ x | 102 | nxt :: (Eq a, Enum a, Bounded a) => a -> a
nxt x | x == maxBound = minBound
| otherwise = succ x | 102 | nxt x | x == maxBound = minBound
| otherwise = succ x | 59 | false | true | 0 | 8 | 30 | 64 | 30 | 34 | null | null |
ancientlanguage/haskell-analysis | grammar/src/Grammar/Common/Decompose.hs | mit | decomposeChar '\xFB4E' = "\x05E4\x05BF" | 39 | decomposeChar '\xFB4E' = "\x05E4\x05BF" | 39 | decomposeChar '\xFB4E' = "\x05E4\x05BF" | 39 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
jtapolczai/Hephaestos | Crawling/Hephaestos/Crawlers.hs | apache-2.0 | simpleLinearSucc ::TL.Text -> TL.Text -> Successor SomeException Void (Maybe Int)
simpleLinearSucc xpContent xpLink = htmlSuccessor mempty
$ simpleLinearSucc' xpContent xpLink | 215 | simpleLinearSucc ::TL.Text -> TL.Text -> Successor SomeException Void (Maybe Int)
simpleLinearSucc xpContent xpLink = htmlSuccessor mempty
$ simpleLinearSucc' xpContent xpLink | 215 | simpleLinearSucc xpContent xpLink = htmlSuccessor mempty
$ simpleLinearSucc' xpContent xpLink | 133 | false | true | 0 | 9 | 59 | 53 | 25 | 28 | null | null |
rueshyna/gogol | gogol-drive/gen/Network/Google/Drive/Types/Product.hs | mpl-2.0 | -- | Whether users with only writer permission can modify the file\'s
-- permissions.
fWritersCanShare :: Lens' File (Maybe Bool)
fWritersCanShare
= lens _fWritersCanShare
(\ s a -> s{_fWritersCanShare = a}) | 215 | fWritersCanShare :: Lens' File (Maybe Bool)
fWritersCanShare
= lens _fWritersCanShare
(\ s a -> s{_fWritersCanShare = a}) | 129 | fWritersCanShare
= lens _fWritersCanShare
(\ s a -> s{_fWritersCanShare = a}) | 85 | true | true | 0 | 8 | 38 | 50 | 26 | 24 | null | null |
tangboyun/bio-seq-embl | src/Bio/Seq/EMBL/Parser/Internal.hs | bsd-3-clause | parseJ :: Parser (ByteString,Int,Maybe Int,ByteString,Int)
parseJ = do
pub <- fmap (B8.intercalate " ") $
word `sepBy1` char ' '
vol <- char ' ' *> option 0 decimal
iss <- optional $
char '(' *> decimal <* char ')'
pg <- char ':' *> takeWhile1 (/= '(')
y <- char '(' *> decimal <* char ')' <*
char '.' <* endOfLine
return (pub,vol,iss,pg,y)
where
word = takeWhile1
(\c ->
isAlpha_ascii c ||
isDigit c ||
c == '.' ||
c == '(' ||
c == ')') <*
(do
c1 <- peekChar
case c1 of
Just ' ' -> return ()
_ -> fail "Not word boundary") | 724 | parseJ :: Parser (ByteString,Int,Maybe Int,ByteString,Int)
parseJ = do
pub <- fmap (B8.intercalate " ") $
word `sepBy1` char ' '
vol <- char ' ' *> option 0 decimal
iss <- optional $
char '(' *> decimal <* char ')'
pg <- char ':' *> takeWhile1 (/= '(')
y <- char '(' *> decimal <* char ')' <*
char '.' <* endOfLine
return (pub,vol,iss,pg,y)
where
word = takeWhile1
(\c ->
isAlpha_ascii c ||
isDigit c ||
c == '.' ||
c == '(' ||
c == ')') <*
(do
c1 <- peekChar
case c1 of
Just ' ' -> return ()
_ -> fail "Not word boundary") | 724 | parseJ = do
pub <- fmap (B8.intercalate " ") $
word `sepBy1` char ' '
vol <- char ' ' *> option 0 decimal
iss <- optional $
char '(' *> decimal <* char ')'
pg <- char ':' *> takeWhile1 (/= '(')
y <- char '(' *> decimal <* char ')' <*
char '.' <* endOfLine
return (pub,vol,iss,pg,y)
where
word = takeWhile1
(\c ->
isAlpha_ascii c ||
isDigit c ||
c == '.' ||
c == '(' ||
c == ')') <*
(do
c1 <- peekChar
case c1 of
Just ' ' -> return ()
_ -> fail "Not word boundary") | 665 | false | true | 0 | 16 | 307 | 278 | 134 | 144 | null | null |
parvmor/codeworld | codeworld-collab-server/src/CodeWorld/CollabServer.hs | apache-2.0 | initCollaborationHandler :: CollabServerState -> ClientId -> Snap (Text, Text, CollabId)
initCollaborationHandler state clientId = do
(user, filePath) <- getRequestParams clientId
collabHashPath <- liftIO $ BC.unpack <$> B.readFile filePath
let collabHash = take (length collabHashPath - 3) . takeFileName $ collabHashPath
Just (currentUsers :: [UserDump]) <- liftIO $ decodeStrict <$>
B.readFile (collabHashPath <.> "users")
let userIdent' = uuserIdent $ (filter (\x -> uuserId x == userId user) currentUsers) !! 0
Just (project :: Project) <- liftIO $ decodeStrict <$>
B.readFile collabHashPath
liftIO $ addNewCollaborator state (userId user) userIdent' (projectSource project) $
CollabId . T.pack $ collabHash
return ((userId user), userIdent', CollabId . T.pack $ collabHash) | 829 | initCollaborationHandler :: CollabServerState -> ClientId -> Snap (Text, Text, CollabId)
initCollaborationHandler state clientId = do
(user, filePath) <- getRequestParams clientId
collabHashPath <- liftIO $ BC.unpack <$> B.readFile filePath
let collabHash = take (length collabHashPath - 3) . takeFileName $ collabHashPath
Just (currentUsers :: [UserDump]) <- liftIO $ decodeStrict <$>
B.readFile (collabHashPath <.> "users")
let userIdent' = uuserIdent $ (filter (\x -> uuserId x == userId user) currentUsers) !! 0
Just (project :: Project) <- liftIO $ decodeStrict <$>
B.readFile collabHashPath
liftIO $ addNewCollaborator state (userId user) userIdent' (projectSource project) $
CollabId . T.pack $ collabHash
return ((userId user), userIdent', CollabId . T.pack $ collabHash) | 829 | initCollaborationHandler state clientId = do
(user, filePath) <- getRequestParams clientId
collabHashPath <- liftIO $ BC.unpack <$> B.readFile filePath
let collabHash = take (length collabHashPath - 3) . takeFileName $ collabHashPath
Just (currentUsers :: [UserDump]) <- liftIO $ decodeStrict <$>
B.readFile (collabHashPath <.> "users")
let userIdent' = uuserIdent $ (filter (\x -> uuserId x == userId user) currentUsers) !! 0
Just (project :: Project) <- liftIO $ decodeStrict <$>
B.readFile collabHashPath
liftIO $ addNewCollaborator state (userId user) userIdent' (projectSource project) $
CollabId . T.pack $ collabHash
return ((userId user), userIdent', CollabId . T.pack $ collabHash) | 740 | false | true | 0 | 17 | 153 | 290 | 142 | 148 | null | null |
brendanhay/gogol | gogol-vision/gen/Network/Google/Vision/Types/Product.hs | mpl-2.0 | -- | Confidence of the OCR results for the symbol. Range [0, 1].
gcvvsConfidence :: Lens' GoogleCloudVisionV1p2beta1Symbol (Maybe Double)
gcvvsConfidence
= lens _gcvvsConfidence
(\ s a -> s{_gcvvsConfidence = a})
. mapping _Coerce | 244 | gcvvsConfidence :: Lens' GoogleCloudVisionV1p2beta1Symbol (Maybe Double)
gcvvsConfidence
= lens _gcvvsConfidence
(\ s a -> s{_gcvvsConfidence = a})
. mapping _Coerce | 179 | gcvvsConfidence
= lens _gcvvsConfidence
(\ s a -> s{_gcvvsConfidence = a})
. mapping _Coerce | 106 | true | true | 2 | 8 | 46 | 59 | 28 | 31 | null | null |
fmthoma/ghc | compiler/types/Type.hs | bsd-3-clause | mkReprPrimEqPred :: Type -> Type -> Type
mkReprPrimEqPred ty1 ty2
= WARN( not (k `eqKind` typeKind ty2), ppr ty1 $$ ppr ty2 )
TyConApp eqReprPrimTyCon [k, ty1, ty2]
where
k = typeKind ty1
-- --------------------- Dictionary types --------------------------------- | 277 | mkReprPrimEqPred :: Type -> Type -> Type
mkReprPrimEqPred ty1 ty2
= WARN( not (k `eqKind` typeKind ty2), ppr ty1 $$ ppr ty2 )
TyConApp eqReprPrimTyCon [k, ty1, ty2]
where
k = typeKind ty1
-- --------------------- Dictionary types --------------------------------- | 277 | mkReprPrimEqPred ty1 ty2
= WARN( not (k `eqKind` typeKind ty2), ppr ty1 $$ ppr ty2 )
TyConApp eqReprPrimTyCon [k, ty1, ty2]
where
k = typeKind ty1
-- --------------------- Dictionary types --------------------------------- | 236 | false | true | 0 | 9 | 51 | 86 | 44 | 42 | null | null |
Noeda/caramia | src/Graphics/Caramia/Resource.hs | mit | -- | Promptly finalize a resource.
--
-- This is UNSAFE if you finalize a resource that is being referred to from
-- another resource that you will still use. Consequences will be unpredictable
-- (although you are unlikely to hit a hard crash).
--
-- The ordinary finalizer will be run immediately. The OpenGL finalizer will be
-- run if the current thread is the same OpenGL thread where the resource was
-- created.
--
-- If ordinary finalizer throws an exception, the OpenGL finalizer is not run
-- and the resource is marked as finalized. The exception propagates out from
-- this call to you.
--
-- Does nothing if the resource is already finalized.
finalizeNow :: Resource a -> IO ()
finalizeNow resource = mask_ $ do
maybe_res <- atomicModifyIORef (rawResource resource) $
\old -> ( Nothing, old )
case maybe_res of
Nothing -> return ()
Just (_, opengl_finalizer, normal_finalizer) -> do
normal_finalizer
let schedule = scheduleFinalizer (nativeCid resource)
opengl_finalizer
maybe schedule
(\cid ->
if cid == nativeCid resource
then opengl_finalizer
else schedule)
=<<
currentContextID
-- | Uses a resource.
--
-- Throws an user error if the resource is used in a wrong or dead context. | 1,428 | finalizeNow :: Resource a -> IO ()
finalizeNow resource = mask_ $ do
maybe_res <- atomicModifyIORef (rawResource resource) $
\old -> ( Nothing, old )
case maybe_res of
Nothing -> return ()
Just (_, opengl_finalizer, normal_finalizer) -> do
normal_finalizer
let schedule = scheduleFinalizer (nativeCid resource)
opengl_finalizer
maybe schedule
(\cid ->
if cid == nativeCid resource
then opengl_finalizer
else schedule)
=<<
currentContextID
-- | Uses a resource.
--
-- Throws an user error if the resource is used in a wrong or dead context. | 772 | finalizeNow resource = mask_ $ do
maybe_res <- atomicModifyIORef (rawResource resource) $
\old -> ( Nothing, old )
case maybe_res of
Nothing -> return ()
Just (_, opengl_finalizer, normal_finalizer) -> do
normal_finalizer
let schedule = scheduleFinalizer (nativeCid resource)
opengl_finalizer
maybe schedule
(\cid ->
if cid == nativeCid resource
then opengl_finalizer
else schedule)
=<<
currentContextID
-- | Uses a resource.
--
-- Throws an user error if the resource is used in a wrong or dead context. | 737 | true | true | 0 | 19 | 432 | 177 | 95 | 82 | null | null |
marco-vassena/svc | examples/NetPbm.hs | gpl-3.0 | getImageType :: String -> ImageType
getImageType s | "ascii.pbm" `isSuffixOf` s = PbmType | 89 | getImageType :: String -> ImageType
getImageType s | "ascii.pbm" `isSuffixOf` s = PbmType | 89 | getImageType s | "ascii.pbm" `isSuffixOf` s = PbmType | 53 | false | true | 0 | 8 | 12 | 30 | 15 | 15 | null | null |
anttisalonen/starrover2 | src/SpaceState/City.hs | mit | offerMissionGeneric :: Mission -> AObject -> [String] -> StateT SpaceState IO ()
offerMissionGeneric mis lc msg = do
state <- State.get
let alleg = getAllegiance lc
let txt = intercalate "\n" msg
c <- pressOneOfScreen
(liftIO $ makeTextScreen (100, 500)
[(gamefont state, Color4 1.0 1.0 1.0 1.0, txt)]
(return ()))
[SDLK_y, SDLK_n, SDLK_ESCAPE]
modify $ modAvailMission (const Nothing)
case c of
SDLK_y -> modify $ modPlMissions $ setMission alleg mis
_ -> return () | 570 | offerMissionGeneric :: Mission -> AObject -> [String] -> StateT SpaceState IO ()
offerMissionGeneric mis lc msg = do
state <- State.get
let alleg = getAllegiance lc
let txt = intercalate "\n" msg
c <- pressOneOfScreen
(liftIO $ makeTextScreen (100, 500)
[(gamefont state, Color4 1.0 1.0 1.0 1.0, txt)]
(return ()))
[SDLK_y, SDLK_n, SDLK_ESCAPE]
modify $ modAvailMission (const Nothing)
case c of
SDLK_y -> modify $ modPlMissions $ setMission alleg mis
_ -> return () | 570 | offerMissionGeneric mis lc msg = do
state <- State.get
let alleg = getAllegiance lc
let txt = intercalate "\n" msg
c <- pressOneOfScreen
(liftIO $ makeTextScreen (100, 500)
[(gamefont state, Color4 1.0 1.0 1.0 1.0, txt)]
(return ()))
[SDLK_y, SDLK_n, SDLK_ESCAPE]
modify $ modAvailMission (const Nothing)
case c of
SDLK_y -> modify $ modPlMissions $ setMission alleg mis
_ -> return () | 489 | false | true | 0 | 14 | 177 | 203 | 99 | 104 | null | null |
konn/reactive-objc | AppDelegate.hs | bsd-3-clause | marshalAppDelegate :: AppDelegate -> IO AppDelegate
marshalAppDelegate = return | 79 | marshalAppDelegate :: AppDelegate -> IO AppDelegate
marshalAppDelegate = return | 79 | marshalAppDelegate = return | 27 | false | true | 0 | 6 | 8 | 18 | 9 | 9 | null | null |
rueshyna/sdl2-examples | src/Lesson10.hs | mit | yellowKey :: Maybe (V4 Word8)
yellowKey = Just $ V4 maxBound maxBound 0 maxBound | 80 | yellowKey :: Maybe (V4 Word8)
yellowKey = Just $ V4 maxBound maxBound 0 maxBound | 80 | yellowKey = Just $ V4 maxBound maxBound 0 maxBound | 50 | false | true | 3 | 7 | 13 | 37 | 16 | 21 | null | null |
bendycode/desktop-cleaner | src/MediaType.hs | mit | musicExts = ["flac", "m4a", "ogg", "wav", "aiff"] | 49 | musicExts = ["flac", "m4a", "ogg", "wav", "aiff"] | 49 | musicExts = ["flac", "m4a", "ogg", "wav", "aiff"] | 49 | false | false | 0 | 5 | 6 | 21 | 13 | 8 | null | null |
damianfral/clay | src/Clay/Elements.hs | bsd-3-clause | link = "link" | 13 | link = "link" | 13 | link = "link" | 13 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
spechub/Hets | Common/IRI.hs | gpl-2.0 | ipathNoScheme :: IRIParser st Id
ipathNoScheme = do
s <- flat $ isegmentNzc <:> many slashIsegment
return $ stringToId s | 125 | ipathNoScheme :: IRIParser st Id
ipathNoScheme = do
s <- flat $ isegmentNzc <:> many slashIsegment
return $ stringToId s | 125 | ipathNoScheme = do
s <- flat $ isegmentNzc <:> many slashIsegment
return $ stringToId s | 92 | false | true | 1 | 10 | 24 | 48 | 20 | 28 | null | null |
shlevy/ghc | compiler/stranal/DmdAnal.hs | bsd-3-clause | annotateLamIdBndr :: AnalEnv
-> DFunFlag -- is this lambda at the top of the RHS of a dfun?
-> DmdType -- Demand type of body
-> Id -- Lambda binder
-> (DmdType, -- Demand type of lambda
Id) -- and binder annotated with demand
annotateLamIdBndr env arg_of_dfun dmd_ty id
-- For lambdas we add the demand to the argument demands
-- Only called for Ids
= ASSERT( isId id )
-- pprTrace "annLamBndr" (vcat [ppr id, ppr _dmd_ty]) $
(final_ty, setIdDemandInfo id dmd)
where
-- Watch out! See note [Lambda-bound unfoldings]
final_ty = case maybeUnfoldingTemplate (idUnfolding id) of
Nothing -> main_ty
Just unf -> main_ty `bothDmdType` unf_ty
where
(unf_ty, _) = dmdAnalStar env dmd unf
main_ty = addDemand dmd dmd_ty'
(dmd_ty', dmd) = findBndrDmd env arg_of_dfun dmd_ty id | 1,003 | annotateLamIdBndr :: AnalEnv
-> DFunFlag -- is this lambda at the top of the RHS of a dfun?
-> DmdType -- Demand type of body
-> Id -- Lambda binder
-> (DmdType, -- Demand type of lambda
Id)
annotateLamIdBndr env arg_of_dfun dmd_ty id
-- For lambdas we add the demand to the argument demands
-- Only called for Ids
= ASSERT( isId id )
-- pprTrace "annLamBndr" (vcat [ppr id, ppr _dmd_ty]) $
(final_ty, setIdDemandInfo id dmd)
where
-- Watch out! See note [Lambda-bound unfoldings]
final_ty = case maybeUnfoldingTemplate (idUnfolding id) of
Nothing -> main_ty
Just unf -> main_ty `bothDmdType` unf_ty
where
(unf_ty, _) = dmdAnalStar env dmd unf
main_ty = addDemand dmd dmd_ty'
(dmd_ty', dmd) = findBndrDmd env arg_of_dfun dmd_ty id | 960 | annotateLamIdBndr env arg_of_dfun dmd_ty id
-- For lambdas we add the demand to the argument demands
-- Only called for Ids
= ASSERT( isId id )
-- pprTrace "annLamBndr" (vcat [ppr id, ppr _dmd_ty]) $
(final_ty, setIdDemandInfo id dmd)
where
-- Watch out! See note [Lambda-bound unfoldings]
final_ty = case maybeUnfoldingTemplate (idUnfolding id) of
Nothing -> main_ty
Just unf -> main_ty `bothDmdType` unf_ty
where
(unf_ty, _) = dmdAnalStar env dmd unf
main_ty = addDemand dmd dmd_ty'
(dmd_ty', dmd) = findBndrDmd env arg_of_dfun dmd_ty id | 661 | true | true | 0 | 10 | 364 | 168 | 90 | 78 | null | null |
ZjMNZHgG5jMXw/smallcaps | src/smallcaps/Text/SmallCaps/Config.hs | bsd-3-clause | after :: [String] -> LaTeXElement -> Bool
after names = liftM2 (&&) (liftM2 (||) isMacro isEnvironment) (flip elem (map pack names) . name) | 139 | after :: [String] -> LaTeXElement -> Bool
after names = liftM2 (&&) (liftM2 (||) isMacro isEnvironment) (flip elem (map pack names) . name) | 139 | after names = liftM2 (&&) (liftM2 (||) isMacro isEnvironment) (flip elem (map pack names) . name) | 97 | false | true | 0 | 10 | 22 | 66 | 35 | 31 | null | null |
rad1al/hutton_exercises | notes_ch15.hs | gpl-2.0 | {-
> fst (0, inf)
0
-}
square :: Int -> Int
square n = n * n | 63 | square :: Int -> Int
square n = n * n | 37 | square n = n * n | 16 | true | true | 1 | 7 | 20 | 30 | 13 | 17 | null | null |
elieux/ghc | compiler/hsSyn/HsDecls.hs | bsd-3-clause | tyFamInstDeclLName :: TyFamInstDecl name -> Located name
tyFamInstDeclLName (TyFamInstDecl { tfid_eqn =
(L _ (TyFamEqn { tfe_tycon = ln })) })
= ln | 170 | tyFamInstDeclLName :: TyFamInstDecl name -> Located name
tyFamInstDeclLName (TyFamInstDecl { tfid_eqn =
(L _ (TyFamEqn { tfe_tycon = ln })) })
= ln | 170 | tyFamInstDeclLName (TyFamInstDecl { tfid_eqn =
(L _ (TyFamEqn { tfe_tycon = ln })) })
= ln | 113 | false | true | 0 | 15 | 45 | 56 | 29 | 27 | null | null |
david-caro/shellcheck | ShellCheck/Analytics.hs | gpl-3.0 | prop_checkUnpassedInFunctions2 = verifyNotTree checkUnpassedInFunctions "foo() { echo $1; };" | 93 | prop_checkUnpassedInFunctions2 = verifyNotTree checkUnpassedInFunctions "foo() { echo $1; };" | 93 | prop_checkUnpassedInFunctions2 = verifyNotTree checkUnpassedInFunctions "foo() { echo $1; };" | 93 | false | false | 0 | 5 | 8 | 11 | 5 | 6 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.