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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tomahawkins/atom | Language/Atom/Expressions.hs | bsd-3-clause | ult (UConst (CWord64 a)) (UConst (CWord64 b)) = ubool $ a < b | 61 | ult (UConst (CWord64 a)) (UConst (CWord64 b)) = ubool $ a < b | 61 | ult (UConst (CWord64 a)) (UConst (CWord64 b)) = ubool $ a < b | 61 | false | false | 0 | 9 | 12 | 43 | 21 | 22 | null | null |
ckaestne/CIDE | CIDE_Language_Haskell/test/WSP/Webserver/ErrorLogger.hs | gpl-3.0 | error_log_chan :: Chan String;
error_log_chan = unsafePerformIO (newChan) | 75 | error_log_chan :: Chan String
error_log_chan = unsafePerformIO (newChan) | 72 | error_log_chan = unsafePerformIO (newChan) | 42 | false | true | 0 | 6 | 9 | 21 | 11 | 10 | null | null |
snoyberg/ghc | compiler/basicTypes/BasicTypes.hs | bsd-3-clause | -- True <=> Occurs inside a non-linear lambda
-- Substituting a redex for this occurrence is
-- dangerous because it might duplicate work.
insideLam, notInsideLam :: InsideLam
insideLam = True | 243 | insideLam, notInsideLam :: InsideLam
insideLam = True | 56 | insideLam = True | 19 | true | true | 0 | 4 | 80 | 16 | 11 | 5 | null | null |
mudphone/ProgrammingInHaskell | src/Ch3.hs | bsd-3-clause | double :: Num a => a -> a
double x = x*2 | 40 | double :: Num a => a -> a
double x = x*2 | 40 | double x = x*2 | 14 | false | true | 0 | 6 | 11 | 29 | 14 | 15 | null | null |
johnjcamilleri/maltese-functional-morphology | lib/Dictionary.hs | lgpl-3.0 | emptyParadigmErrors :: ParadigmErrors
emptyParadigmErrors = (Set.empty,Set.empty) | 81 | emptyParadigmErrors :: ParadigmErrors
emptyParadigmErrors = (Set.empty,Set.empty) | 81 | emptyParadigmErrors = (Set.empty,Set.empty) | 43 | false | true | 0 | 7 | 5 | 28 | 13 | 15 | null | null |
IreneKnapp/Eyeshadow | Haskell/Eyeshadow/Phase/Process.hs | mit | processDeclaration
:: (Eff.Member (Eff.State ProcessingContext) r,
Eff.Member Diagnose r)
=> InvocationOptions
-> FileSpecification
-> SExpression
-> Eff.Eff r ()
processDeclaration options file expression = do
case expression of
SList _ ((SSymbol nameSpan name) : items) -> do
maybeTerm <- getDeclarationName name
case maybeTerm of
Nothing -> diagnoseUnknownNameAtTopLevel file nameSpan
Just term -> do
return ()
_ -> diagnoseInvalidFormAtTopLevel file (spanOf expression) | 537 | processDeclaration
:: (Eff.Member (Eff.State ProcessingContext) r,
Eff.Member Diagnose r)
=> InvocationOptions
-> FileSpecification
-> SExpression
-> Eff.Eff r ()
processDeclaration options file expression = do
case expression of
SList _ ((SSymbol nameSpan name) : items) -> do
maybeTerm <- getDeclarationName name
case maybeTerm of
Nothing -> diagnoseUnknownNameAtTopLevel file nameSpan
Just term -> do
return ()
_ -> diagnoseInvalidFormAtTopLevel file (spanOf expression) | 537 | processDeclaration options file expression = do
case expression of
SList _ ((SSymbol nameSpan name) : items) -> do
maybeTerm <- getDeclarationName name
case maybeTerm of
Nothing -> diagnoseUnknownNameAtTopLevel file nameSpan
Just term -> do
return ()
_ -> diagnoseInvalidFormAtTopLevel file (spanOf expression) | 358 | false | true | 0 | 21 | 124 | 172 | 79 | 93 | null | null |
YLiLarry/db-model | src/DB/Model/Internal/Class.hs | mit | mapModelT :: (m (Either String a) -> n (Either String b)) -> ModelT r m a -> ModelT r n b
mapModelT f x = ModelT $ mapReaderT (mapExceptT f) $ unModelT x | 153 | mapModelT :: (m (Either String a) -> n (Either String b)) -> ModelT r m a -> ModelT r n b
mapModelT f x = ModelT $ mapReaderT (mapExceptT f) $ unModelT x | 153 | mapModelT f x = ModelT $ mapReaderT (mapExceptT f) $ unModelT x | 63 | false | true | 0 | 10 | 32 | 87 | 41 | 46 | null | null |
keera-studios/hsQt | Qtc/Gui/QMessageBox.hs | bsd-2-clause | qMessageBoxStandardIcon_nf :: ((Icon)) -> IO (QPixmap ())
qMessageBoxStandardIcon_nf (x1)
= withObjectRefResult $
qtc_QMessageBox_standardIcon (toCLong $ qEnum_toInt x1) | 175 | qMessageBoxStandardIcon_nf :: ((Icon)) -> IO (QPixmap ())
qMessageBoxStandardIcon_nf (x1)
= withObjectRefResult $
qtc_QMessageBox_standardIcon (toCLong $ qEnum_toInt x1) | 175 | qMessageBoxStandardIcon_nf (x1)
= withObjectRefResult $
qtc_QMessageBox_standardIcon (toCLong $ qEnum_toInt x1) | 117 | false | true | 0 | 9 | 22 | 55 | 28 | 27 | null | null |
egison/egison | hs-src/Language/Egison/PrettyMath/Maxima.hs | mit | showMathExpr' :: MathExpr -> String
showMathExpr' x@(Plus _) = "(" ++ showMathExpr x ++ ")" | 91 | showMathExpr' :: MathExpr -> String
showMathExpr' x@(Plus _) = "(" ++ showMathExpr x ++ ")" | 91 | showMathExpr' x@(Plus _) = "(" ++ showMathExpr x ++ ")" | 55 | false | true | 1 | 10 | 14 | 47 | 20 | 27 | null | null |
skinner33/hlockx | src/Tests.hs | mit | prop_testChecker :: String -> String -> Bool
prop_testChecker x y = (pwCheckTest x y) == (x == y) | 97 | prop_testChecker :: String -> String -> Bool
prop_testChecker x y = (pwCheckTest x y) == (x == y) | 97 | prop_testChecker x y = (pwCheckTest x y) == (x == y) | 52 | false | true | 0 | 7 | 17 | 43 | 22 | 21 | null | null |
spechub/Hets | Common/XUpdate.hs | gpl-2.0 | getXUpdateText :: Monad m => Element -> m String
getXUpdateText e = let
msg = fail "expected single <xupdate:text> element"
in case elChildren e of
[] -> getText e
[s] -> let
q = elName s
u = qName q
in if isXUpdateQN q && u == "text" then getText s else msg
_ -> msg | 299 | getXUpdateText :: Monad m => Element -> m String
getXUpdateText e = let
msg = fail "expected single <xupdate:text> element"
in case elChildren e of
[] -> getText e
[s] -> let
q = elName s
u = qName q
in if isXUpdateQN q && u == "text" then getText s else msg
_ -> msg | 299 | getXUpdateText e = let
msg = fail "expected single <xupdate:text> element"
in case elChildren e of
[] -> getText e
[s] -> let
q = elName s
u = qName q
in if isXUpdateQN q && u == "text" then getText s else msg
_ -> msg | 250 | false | true | 0 | 15 | 87 | 124 | 57 | 67 | null | null |
abasko/linkedhashmap | src/Data/LinkedHashMap/Seq.hs | bsd-3-clause | lookup :: (Eq k, Hashable k) => k -> LinkedHashMap k v -> Maybe v
lookup k0 (LinkedHashMap m0 _ _) = case M.lookup k0 m0 of
Just (Entry _ v) -> Just v
Nothing -> Nothing
| 244 | lookup :: (Eq k, Hashable k) => k -> LinkedHashMap k v -> Maybe v
lookup k0 (LinkedHashMap m0 _ _) = case M.lookup k0 m0 of
Just (Entry _ v) -> Just v
Nothing -> Nothing
| 244 | lookup k0 (LinkedHashMap m0 _ _) = case M.lookup k0 m0 of
Just (Entry _ v) -> Just v
Nothing -> Nothing
| 178 | false | true | 0 | 10 | 111 | 94 | 45 | 49 | null | null |
cliffano/swaggy-jenkins | clients/haskell-http-client/generated/lib/SwaggyJenkins/ModelLens.hs | mit | -- | 'pipelineRunEndTime' Lens
pipelineRunEndTimeL :: Lens_' PipelineRun (Maybe Text)
pipelineRunEndTimeL f PipelineRun{..} = (\pipelineRunEndTime -> PipelineRun { pipelineRunEndTime, ..} ) <$> f pipelineRunEndTime | 214 | pipelineRunEndTimeL :: Lens_' PipelineRun (Maybe Text)
pipelineRunEndTimeL f PipelineRun{..} = (\pipelineRunEndTime -> PipelineRun { pipelineRunEndTime, ..} ) <$> f pipelineRunEndTime | 183 | pipelineRunEndTimeL f PipelineRun{..} = (\pipelineRunEndTime -> PipelineRun { pipelineRunEndTime, ..} ) <$> f pipelineRunEndTime | 128 | true | true | 1 | 8 | 23 | 62 | 30 | 32 | null | null |
tpsinnem/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | annotationColour :: IState -> OutputAnnotation -> Maybe IdrisColour
annotationColour ist _ | not (idris_colourRepl ist) = Nothing | 129 | annotationColour :: IState -> OutputAnnotation -> Maybe IdrisColour
annotationColour ist _ | not (idris_colourRepl ist) = Nothing | 129 | annotationColour ist _ | not (idris_colourRepl ist) = Nothing | 61 | false | true | 0 | 10 | 16 | 42 | 19 | 23 | null | null |
amcphail/hstatistics | lib/Numeric/Statistics/PCA.hs | bsd-3-clause | pca :: I.Array Int (Vector Double) -- the data
-> Double -- eigenvalue threshold
-> (Vector Double, Matrix Double) -- Eignevalues, Principal components
pca d q = let d' = fmap (\x -> x - (scalar $ mean x)) d -- remove the mean from each dimension
d'' = fromColumns $ I.elems d'
(_,vec',uni') = svd d''
vec = toList vec'
uni = toColumns uni'
v' = zip vec uni
v = filter (\(x,_) -> x > q) v' -- keep only eigens > than parameter
(eigs,vs) = unzip v
in (fromList eigs,fromColumns vs) | 625 | pca :: I.Array Int (Vector Double) -- the data
-> Double -- eigenvalue threshold
-> (Vector Double, Matrix Double)
pca d q = let d' = fmap (\x -> x - (scalar $ mean x)) d -- remove the mean from each dimension
d'' = fromColumns $ I.elems d'
(_,vec',uni') = svd d''
vec = toList vec'
uni = toColumns uni'
v' = zip vec uni
v = filter (\(x,_) -> x > q) v' -- keep only eigens > than parameter
(eigs,vs) = unzip v
in (fromList eigs,fromColumns vs) | 588 | pca d q = let d' = fmap (\x -> x - (scalar $ mean x)) d -- remove the mean from each dimension
d'' = fromColumns $ I.elems d'
(_,vec',uni') = svd d''
vec = toList vec'
uni = toColumns uni'
v' = zip vec uni
v = filter (\(x,_) -> x > q) v' -- keep only eigens > than parameter
(eigs,vs) = unzip v
in (fromList eigs,fromColumns vs) | 437 | true | true | 0 | 15 | 238 | 211 | 109 | 102 | null | null |
brendanhay/gogol | gogol-tagmanager/gen/Network/Google/Resource/TagManager/Accounts/Containers/Workspaces/Templates/Get.hs | mpl-2.0 | -- | Creates a value of 'AccountsContainersWorkspacesTemplatesGet' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'aaXgafv'
--
-- * 'aaUploadProtocol'
--
-- * 'aaPath'
--
-- * 'aaAccessToken'
--
-- * 'aaUploadType'
--
-- * 'aaCallback'
accountsContainersWorkspacesTemplatesGet
:: Text -- ^ 'aaPath'
-> AccountsContainersWorkspacesTemplatesGet
accountsContainersWorkspacesTemplatesGet pAaPath_ =
AccountsContainersWorkspacesTemplatesGet'
{ _aaXgafv = Nothing
, _aaUploadProtocol = Nothing
, _aaPath = pAaPath_
, _aaAccessToken = Nothing
, _aaUploadType = Nothing
, _aaCallback = Nothing
} | 711 | accountsContainersWorkspacesTemplatesGet
:: Text -- ^ 'aaPath'
-> AccountsContainersWorkspacesTemplatesGet
accountsContainersWorkspacesTemplatesGet pAaPath_ =
AccountsContainersWorkspacesTemplatesGet'
{ _aaXgafv = Nothing
, _aaUploadProtocol = Nothing
, _aaPath = pAaPath_
, _aaAccessToken = Nothing
, _aaUploadType = Nothing
, _aaCallback = Nothing
} | 389 | accountsContainersWorkspacesTemplatesGet pAaPath_ =
AccountsContainersWorkspacesTemplatesGet'
{ _aaXgafv = Nothing
, _aaUploadProtocol = Nothing
, _aaPath = pAaPath_
, _aaAccessToken = Nothing
, _aaUploadType = Nothing
, _aaCallback = Nothing
} | 274 | true | true | 0 | 6 | 128 | 72 | 50 | 22 | null | null |
docmunch/haskell-box-view | src/Web/Box/View.hs | mit | newApiRequest :: MonadIO m => ApiKey -> ByteString -> m Request
newApiRequest apiKey url =
liftIO (H.parseUrl $ fromByteString url) >>=
addHeader "Authorization" ("Token " <> fromApiKey apiKey) | 197 | newApiRequest :: MonadIO m => ApiKey -> ByteString -> m Request
newApiRequest apiKey url =
liftIO (H.parseUrl $ fromByteString url) >>=
addHeader "Authorization" ("Token " <> fromApiKey apiKey) | 197 | newApiRequest apiKey url =
liftIO (H.parseUrl $ fromByteString url) >>=
addHeader "Authorization" ("Token " <> fromApiKey apiKey) | 133 | false | true | 0 | 9 | 31 | 68 | 32 | 36 | null | null |
mcmaniac/ghc | compiler/cmm/CLabel.hs | bsd-3-clause | mkCAFBlackHoleEntryLabel = CmmLabel rtsPackageId (fsLit "stg_CAF_BLACKHOLE") CmmEntry | 96 | mkCAFBlackHoleEntryLabel = CmmLabel rtsPackageId (fsLit "stg_CAF_BLACKHOLE") CmmEntry | 96 | mkCAFBlackHoleEntryLabel = CmmLabel rtsPackageId (fsLit "stg_CAF_BLACKHOLE") CmmEntry | 96 | false | false | 0 | 7 | 17 | 19 | 9 | 10 | null | null |
erikd/hs-tls | core/Network/TLS/Handshake/Common.hs | bsd-3-clause | extensionLookup :: ExtensionID -> [ExtensionRaw] -> Maybe ByteString
extensionLookup toFind = fmap (\(ExtensionRaw _ content) -> content)
. find (\(ExtensionRaw eid _) -> eid == toFind) | 208 | extensionLookup :: ExtensionID -> [ExtensionRaw] -> Maybe ByteString
extensionLookup toFind = fmap (\(ExtensionRaw _ content) -> content)
. find (\(ExtensionRaw eid _) -> eid == toFind) | 208 | extensionLookup toFind = fmap (\(ExtensionRaw _ content) -> content)
. find (\(ExtensionRaw eid _) -> eid == toFind) | 139 | false | true | 1 | 9 | 48 | 80 | 39 | 41 | null | null |
brendanhay/gogol | gogol-healthcare/gen/Network/Google/Healthcare/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'ExportResourcesRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'errBigQueryDestination'
--
-- * 'errGcsDestination'
exportResourcesRequest
:: ExportResourcesRequest
exportResourcesRequest =
ExportResourcesRequest'
{_errBigQueryDestination = Nothing, _errGcsDestination = Nothing} | 408 | exportResourcesRequest
:: ExportResourcesRequest
exportResourcesRequest =
ExportResourcesRequest'
{_errBigQueryDestination = Nothing, _errGcsDestination = Nothing} | 173 | exportResourcesRequest =
ExportResourcesRequest'
{_errBigQueryDestination = Nothing, _errGcsDestination = Nothing} | 120 | true | true | 0 | 7 | 59 | 42 | 24 | 18 | null | null |
PiotrJustyna/roller | Roller/Types.hs | gpl-2.0 | diceLimit = 99 | 14 | diceLimit = 99 | 14 | diceLimit = 99 | 14 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
thoughtpolice/binary-serialise-cbor | Data/Binary/Serialise/CBOR/Read.hs | bsd-3-clause | go_fast_end (ConsumeInt k) !bs =
case tryConsumeInt (unsafeHead bs) bs of
DecodeFailure -> SlowFail bs "expected int"
DecodedToken sz (I# n#) -> go_fast_end (k n#) (BS.unsafeDrop sz bs) | 211 | go_fast_end (ConsumeInt k) !bs =
case tryConsumeInt (unsafeHead bs) bs of
DecodeFailure -> SlowFail bs "expected int"
DecodedToken sz (I# n#) -> go_fast_end (k n#) (BS.unsafeDrop sz bs) | 211 | go_fast_end (ConsumeInt k) !bs =
case tryConsumeInt (unsafeHead bs) bs of
DecodeFailure -> SlowFail bs "expected int"
DecodedToken sz (I# n#) -> go_fast_end (k n#) (BS.unsafeDrop sz bs) | 211 | false | false | 0 | 11 | 53 | 85 | 39 | 46 | null | null |
dysinger/amazonka | amazonka-ec2/gen/Network/AWS/EC2/Types.hs | mpl-2.0 | -- | The private DNS name assigned to the instance. This DNS name can only be used
-- inside the Amazon EC2 network. This name is not available until the instance
-- enters the 'running' state.
i1PrivateDnsName :: Lens' Instance (Maybe Text)
i1PrivateDnsName = lens _i1PrivateDnsName (\s a -> s { _i1PrivateDnsName = a }) | 321 | i1PrivateDnsName :: Lens' Instance (Maybe Text)
i1PrivateDnsName = lens _i1PrivateDnsName (\s a -> s { _i1PrivateDnsName = a }) | 127 | i1PrivateDnsName = lens _i1PrivateDnsName (\s a -> s { _i1PrivateDnsName = a }) | 79 | true | true | 0 | 9 | 54 | 48 | 27 | 21 | null | null |
t00n/ProjectEuler | LList.hs | epl-1.0 | lengthL :: LList a -> Int
lengthL = getLen | 42 | lengthL :: LList a -> Int
lengthL = getLen | 42 | lengthL = getLen | 16 | false | true | 0 | 6 | 8 | 18 | 9 | 9 | null | null |
marco-vassena/svc | examples/NetPbm.hs | gpl-3.0 | test :: String -> IO ()
test f = do
s <- B.readFile f
case getImageType f of
PbmType -> report $ parseFormat parsePbm s
PgmType -> report $ parseFormat parsePgm s | 174 | test :: String -> IO ()
test f = do
s <- B.readFile f
case getImageType f of
PbmType -> report $ parseFormat parsePbm s
PgmType -> report $ parseFormat parsePgm s | 174 | test f = do
s <- B.readFile f
case getImageType f of
PbmType -> report $ parseFormat parsePbm s
PgmType -> report $ parseFormat parsePgm s | 150 | false | true | 0 | 11 | 43 | 75 | 34 | 41 | null | null |
stefaneng/scheme48 | src/Language/Scheme/Types.hs | mit | showVal (Number contents) = show contents | 41 | showVal (Number contents) = show contents | 41 | showVal (Number contents) = show contents | 41 | false | false | 0 | 7 | 5 | 18 | 8 | 10 | null | null |
snoyberg/ghc | compiler/utils/Pretty.hs | bsd-3-clause | above_ :: Doc -> Bool -> Doc -> Doc
above_ p _ Empty = p | 56 | above_ :: Doc -> Bool -> Doc -> Doc
above_ p _ Empty = p | 56 | above_ p _ Empty = p | 20 | false | true | 0 | 7 | 14 | 30 | 15 | 15 | null | null |
flowbox-public/accelerate-cuda | Data/Array/Accelerate/CUDA/Persistent.hs | bsd-3-clause | -- The root directory of where the various persistent cache files live; the
-- database and each individual binary object. This is inside a folder at the
-- root of the user's home directory.
--
-- Some platforms may have directories assigned to store cache files; Mac OS X
-- uses ~/Library/Caches, for example. This fact is ignored.
--
cacheDirectory :: IO FilePath
cacheDirectory = do
home <- getAppUserDataDirectory "accelerate"
return $ home </> "accelerate-cuda-" ++ showVersion version </> "cache"
-- A relative path to be appended to (presumably) 'cacheDirectory'.
-- | 582 | cacheDirectory :: IO FilePath
cacheDirectory = do
home <- getAppUserDataDirectory "accelerate"
return $ home </> "accelerate-cuda-" ++ showVersion version </> "cache"
-- A relative path to be appended to (presumably) 'cacheDirectory'.
-- | 244 | cacheDirectory = do
home <- getAppUserDataDirectory "accelerate"
return $ home </> "accelerate-cuda-" ++ showVersion version </> "cache"
-- A relative path to be appended to (presumably) 'cacheDirectory'.
-- | 214 | true | true | 0 | 10 | 97 | 55 | 30 | 25 | null | null |
haskell-opengl/OpenGLRaw | src/Graphics/GL/Functions/F09.hs | bsd-3-clause | ptr_glGetArrayObjectfvATI :: FunPtr (GLenum -> GLenum -> Ptr GLfloat -> IO ())
ptr_glGetArrayObjectfvATI = unsafePerformIO $ getCommand "glGetArrayObjectfvATI" | 159 | ptr_glGetArrayObjectfvATI :: FunPtr (GLenum -> GLenum -> Ptr GLfloat -> IO ())
ptr_glGetArrayObjectfvATI = unsafePerformIO $ getCommand "glGetArrayObjectfvATI" | 159 | ptr_glGetArrayObjectfvATI = unsafePerformIO $ getCommand "glGetArrayObjectfvATI" | 80 | false | true | 0 | 11 | 17 | 44 | 21 | 23 | null | null |
input-output-hk/pos-haskell-prototype | wallet/src/Cardano/Wallet/Kernel/DB/Read.hs | mit | pendingByAccount :: DB -> Map HdAccountId Pending
pendingByAccount = liftNoErrorsHd0 HD.pendingByAccount | 104 | pendingByAccount :: DB -> Map HdAccountId Pending
pendingByAccount = liftNoErrorsHd0 HD.pendingByAccount | 104 | pendingByAccount = liftNoErrorsHd0 HD.pendingByAccount | 54 | false | true | 0 | 6 | 10 | 25 | 12 | 13 | null | null |
ScrambledEggsOnToast/needle | Control/Arrow/Needle/Internal/UnevenGrid.hs | mit | here :: GridExamine e (Maybe (GridElem e))
here = do
grid <- getGrid
(rowPos, elemPos) <- getPosition
return $ do
row <- rows grid !? rowPos
element <- elements row !? elemPos
return element
-- | Get the element at the current position. | 273 | here :: GridExamine e (Maybe (GridElem e))
here = do
grid <- getGrid
(rowPos, elemPos) <- getPosition
return $ do
row <- rows grid !? rowPos
element <- elements row !? elemPos
return element
-- | Get the element at the current position. | 273 | here = do
grid <- getGrid
(rowPos, elemPos) <- getPosition
return $ do
row <- rows grid !? rowPos
element <- elements row !? elemPos
return element
-- | Get the element at the current position. | 230 | false | true | 0 | 12 | 79 | 90 | 42 | 48 | null | null |
rawlep/EQS | esit2.hs | mit | sub2add xs = xs | 15 | sub2add xs = xs | 15 | sub2add xs = xs | 15 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
gbaz/cabal | cabal-install/tests/UnitTests/Distribution/Client/Dependency/Modular/QuickCheck.hs | bsd-3-clause | boundedListOf :: Int -> Gen a -> Gen [a]
boundedListOf n gen = take n <$> listOf gen | 84 | boundedListOf :: Int -> Gen a -> Gen [a]
boundedListOf n gen = take n <$> listOf gen | 84 | boundedListOf n gen = take n <$> listOf gen | 43 | false | true | 0 | 8 | 17 | 47 | 21 | 26 | null | null |
ssaavedra/liquidhaskell | benchmarks/vector-0.10.0.1/Data/Vector/Storable/Mutable.hs | bsd-3-clause | unsafeInit = G.unsafeInit | 25 | unsafeInit = G.unsafeInit | 25 | unsafeInit = G.unsafeInit | 25 | false | false | 0 | 5 | 2 | 8 | 4 | 4 | null | null |
seansu4you87/ti108 | TI108/Parser.hs | mit | star :: Parsec String () Operator
star = (\_ -> Mul) <$> char '*' | 65 | star :: Parsec String () Operator
star = (\_ -> Mul) <$> char '*' | 65 | star = (\_ -> Mul) <$> char '*' | 31 | false | true | 1 | 7 | 13 | 38 | 18 | 20 | null | null |
crufter/haquery | src/Haquery.hs | bsd-3-clause | children :: Tag -> [Child]
children (Doctype _ _) = [] | 68 | children :: Tag -> [Child]
children (Doctype _ _) = [] | 68 | children (Doctype _ _) = [] | 32 | false | true | 0 | 9 | 24 | 37 | 17 | 20 | null | null |
timtian090/Playground | Haskell/words/app/Main.hs | mit | main :: IO ()
main = do
gen <- newStdGen
let filledInGrid = fillInBlanks gen grid
game = makeGame filledInGrid languages
hSetBuffering stdout NoBuffering
playTurn game | 199 | main :: IO ()
main = do
gen <- newStdGen
let filledInGrid = fillInBlanks gen grid
game = makeGame filledInGrid languages
hSetBuffering stdout NoBuffering
playTurn game | 199 | main = do
gen <- newStdGen
let filledInGrid = fillInBlanks gen grid
game = makeGame filledInGrid languages
hSetBuffering stdout NoBuffering
playTurn game | 185 | false | true | 0 | 11 | 57 | 67 | 28 | 39 | null | null |
GaloisInc/halvm-ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | typeNatMulTyFamNameKey = mkPreludeTyConUnique 167 | 52 | typeNatMulTyFamNameKey = mkPreludeTyConUnique 167 | 52 | typeNatMulTyFamNameKey = mkPreludeTyConUnique 167 | 52 | false | false | 0 | 5 | 6 | 9 | 4 | 5 | null | null |
ekmett/ghc | compiler/nativeGen/PPC/Ppr.hs | bsd-3-clause | pprInstr (ADD reg1 reg2 ri) = pprLogic (sLit "add") reg1 reg2 ri | 64 | pprInstr (ADD reg1 reg2 ri) = pprLogic (sLit "add") reg1 reg2 ri | 64 | pprInstr (ADD reg1 reg2 ri) = pprLogic (sLit "add") reg1 reg2 ri | 64 | false | false | 0 | 7 | 11 | 34 | 16 | 18 | null | null |
amutake/simple-actor | src/Control/Concurrent/Actor.hs | bsd-3-clause | receive :: ActorWorld r r
receive = ask >>= liftIO . atomically . readTQueue . mailBox | 86 | receive :: ActorWorld r r
receive = ask >>= liftIO . atomically . readTQueue . mailBox | 86 | receive = ask >>= liftIO . atomically . readTQueue . mailBox | 60 | false | true | 3 | 7 | 15 | 38 | 17 | 21 | null | null |
mthvedt/hbridge | src/Solver.hs | epl-1.0 | candidatePlaysH :: IDeal d => d -> Direction -> Maybe Suit -> [Card]
candidatePlaysH d dir msuit =
case concat $ map (\s -> map (\c -> Card (Rank c) s) $ candidatePlaysD d dir s) suits of
[] -> if msuit == Nothing then [] else candidatePlaysH d dir Nothing
x -> x
where suits = case msuit of
(Just s) -> [s]
Nothing -> reverse [Club ..] | 384 | candidatePlaysH :: IDeal d => d -> Direction -> Maybe Suit -> [Card]
candidatePlaysH d dir msuit =
case concat $ map (\s -> map (\c -> Card (Rank c) s) $ candidatePlaysD d dir s) suits of
[] -> if msuit == Nothing then [] else candidatePlaysH d dir Nothing
x -> x
where suits = case msuit of
(Just s) -> [s]
Nothing -> reverse [Club ..] | 384 | candidatePlaysH d dir msuit =
case concat $ map (\s -> map (\c -> Card (Rank c) s) $ candidatePlaysD d dir s) suits of
[] -> if msuit == Nothing then [] else candidatePlaysH d dir Nothing
x -> x
where suits = case msuit of
(Just s) -> [s]
Nothing -> reverse [Club ..] | 315 | false | true | 1 | 16 | 116 | 180 | 88 | 92 | null | null |
JustinUnger/haskell-book | ch15/ex.hs | mit | main :: IO ()
main = do
quickCheck (semigroupAssoc :: TrivialAssoc)
quickCheck (semigroupAssoc :: IdentityAssocInt) | 123 | main :: IO ()
main = do
quickCheck (semigroupAssoc :: TrivialAssoc)
quickCheck (semigroupAssoc :: IdentityAssocInt) | 123 | main = do
quickCheck (semigroupAssoc :: TrivialAssoc)
quickCheck (semigroupAssoc :: IdentityAssocInt) | 109 | false | true | 1 | 9 | 22 | 44 | 20 | 24 | null | null |
ivan-m/paraphrase | benchmarks/CompareParsers.hs | bsd-3-clause | isAlpha_ascii :: Char -> Bool
isAlpha_ascii c = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') | 96 | isAlpha_ascii :: Char -> Bool
isAlpha_ascii c = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') | 96 | isAlpha_ascii c = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') | 66 | false | true | 0 | 9 | 22 | 52 | 27 | 25 | null | null |
seereason/cabal | cabal-install/Distribution/Client/PlanIndex.hs | bsd-3-clause | -- | Given a package index where we assume we want to use all the packages
-- (use 'dependencyClosure' if you need to get such a index subset) find out
-- if the dependencies within it use consistent versions of each package.
-- Return all cases where multiple packages depend on different versions of
-- some other package.
--
-- Each element in the result is a package name along with the packages that
-- depend on it and the versions they require. These are guaranteed to be
-- distinct.
--
dependencyInconsistencies :: forall pkg.
(PackageFixedDeps pkg, HasInstalledPackageId pkg)
=> FakeMap
-> PackageIndex pkg
-> [(PackageName, [(PackageIdentifier, Version)])]
dependencyInconsistencies fakeMap index =
[ (name, [ (pid,packageVersion dep) | (dep,pids) <- uses, pid <- pids])
| (name, ipid_map) <- Map.toList inverseIndex
, let uses = Map.elems ipid_map
, reallyIsInconsistent (map fst uses)
]
where
-- For each package name (of a dependency, somewhere)
-- and each installed ID of that that package
-- the associated package instance
-- and a list of reverse dependencies (as source IDs)
inverseIndex :: Map PackageName (Map InstalledPackageId (pkg, [PackageId]))
inverseIndex = Map.fromListWith (Map.unionWith (\(a,b) (_,b') -> (a,b++b')))
[ (packageName dep, Map.fromList [(ipid,(dep,[packageId pkg]))])
| -- For each package @pkg@
pkg <- allPackages index
-- Find out which @ipid@ @pkg@ depends on
, ipid <- fakeDepends fakeMap pkg
-- And look up those @ipid@ (i.e., @ipid@ is the ID of @dep@)
, Just dep <- [fakeLookupInstalledPackageId fakeMap index ipid]
]
-- If, in a single install plan, we depend on more than one version of a
-- package, then this is ONLY okay in the (rather special) case that we
-- depend on precisely two versions of that package, and one of them
-- depends on the other. This is necessary for example for the base where
-- we have base-3 depending on base-4.
reallyIsInconsistent :: [pkg] -> Bool
reallyIsInconsistent [] = False
reallyIsInconsistent [_p] = False
reallyIsInconsistent [p1, p2] =
let pid1 = installedPackageId p1
pid2 = installedPackageId p2
in Map.findWithDefault pid1 pid1 fakeMap `notElem` fakeDepends fakeMap p2
&& Map.findWithDefault pid2 pid2 fakeMap `notElem` fakeDepends fakeMap p1
reallyIsInconsistent _ = True
-- | Find if there are any cycles in the dependency graph. If there are no
-- cycles the result is @[]@.
--
-- This actually computes the strongly connected components. So it gives us a
-- list of groups of packages where within each group they all depend on each
-- other, directly or indirectly.
-- | 2,873 | dependencyInconsistencies :: forall pkg.
(PackageFixedDeps pkg, HasInstalledPackageId pkg)
=> FakeMap
-> PackageIndex pkg
-> [(PackageName, [(PackageIdentifier, Version)])]
dependencyInconsistencies fakeMap index =
[ (name, [ (pid,packageVersion dep) | (dep,pids) <- uses, pid <- pids])
| (name, ipid_map) <- Map.toList inverseIndex
, let uses = Map.elems ipid_map
, reallyIsInconsistent (map fst uses)
]
where
-- For each package name (of a dependency, somewhere)
-- and each installed ID of that that package
-- the associated package instance
-- and a list of reverse dependencies (as source IDs)
inverseIndex :: Map PackageName (Map InstalledPackageId (pkg, [PackageId]))
inverseIndex = Map.fromListWith (Map.unionWith (\(a,b) (_,b') -> (a,b++b')))
[ (packageName dep, Map.fromList [(ipid,(dep,[packageId pkg]))])
| -- For each package @pkg@
pkg <- allPackages index
-- Find out which @ipid@ @pkg@ depends on
, ipid <- fakeDepends fakeMap pkg
-- And look up those @ipid@ (i.e., @ipid@ is the ID of @dep@)
, Just dep <- [fakeLookupInstalledPackageId fakeMap index ipid]
]
-- If, in a single install plan, we depend on more than one version of a
-- package, then this is ONLY okay in the (rather special) case that we
-- depend on precisely two versions of that package, and one of them
-- depends on the other. This is necessary for example for the base where
-- we have base-3 depending on base-4.
reallyIsInconsistent :: [pkg] -> Bool
reallyIsInconsistent [] = False
reallyIsInconsistent [_p] = False
reallyIsInconsistent [p1, p2] =
let pid1 = installedPackageId p1
pid2 = installedPackageId p2
in Map.findWithDefault pid1 pid1 fakeMap `notElem` fakeDepends fakeMap p2
&& Map.findWithDefault pid2 pid2 fakeMap `notElem` fakeDepends fakeMap p1
reallyIsInconsistent _ = True
-- | Find if there are any cycles in the dependency graph. If there are no
-- cycles the result is @[]@.
--
-- This actually computes the strongly connected components. So it gives us a
-- list of groups of packages where within each group they all depend on each
-- other, directly or indirectly.
-- | 2,378 | dependencyInconsistencies fakeMap index =
[ (name, [ (pid,packageVersion dep) | (dep,pids) <- uses, pid <- pids])
| (name, ipid_map) <- Map.toList inverseIndex
, let uses = Map.elems ipid_map
, reallyIsInconsistent (map fst uses)
]
where
-- For each package name (of a dependency, somewhere)
-- and each installed ID of that that package
-- the associated package instance
-- and a list of reverse dependencies (as source IDs)
inverseIndex :: Map PackageName (Map InstalledPackageId (pkg, [PackageId]))
inverseIndex = Map.fromListWith (Map.unionWith (\(a,b) (_,b') -> (a,b++b')))
[ (packageName dep, Map.fromList [(ipid,(dep,[packageId pkg]))])
| -- For each package @pkg@
pkg <- allPackages index
-- Find out which @ipid@ @pkg@ depends on
, ipid <- fakeDepends fakeMap pkg
-- And look up those @ipid@ (i.e., @ipid@ is the ID of @dep@)
, Just dep <- [fakeLookupInstalledPackageId fakeMap index ipid]
]
-- If, in a single install plan, we depend on more than one version of a
-- package, then this is ONLY okay in the (rather special) case that we
-- depend on precisely two versions of that package, and one of them
-- depends on the other. This is necessary for example for the base where
-- we have base-3 depending on base-4.
reallyIsInconsistent :: [pkg] -> Bool
reallyIsInconsistent [] = False
reallyIsInconsistent [_p] = False
reallyIsInconsistent [p1, p2] =
let pid1 = installedPackageId p1
pid2 = installedPackageId p2
in Map.findWithDefault pid1 pid1 fakeMap `notElem` fakeDepends fakeMap p2
&& Map.findWithDefault pid2 pid2 fakeMap `notElem` fakeDepends fakeMap p1
reallyIsInconsistent _ = True
-- | Find if there are any cycles in the dependency graph. If there are no
-- cycles the result is @[]@.
--
-- This actually computes the strongly connected components. So it gives us a
-- list of groups of packages where within each group they all depend on each
-- other, directly or indirectly.
-- | 2,098 | true | true | 4 | 14 | 712 | 499 | 267 | 232 | null | null |
s9gf4ult/hdbi-tests | Database/HDBI/Tests.hs | bsd-3-clause | -- | `clone` creates new independent connection
connClone :: (Connection con) => con -> Assertion
connClone c = do
newc <- clone c
connStatus newc >>= (@?= ConnOK)
withTransaction newc $ inTransaction c >>= (@?= False)
withTransaction c $ inTransaction newc >>= (@?= False)
disconnect newc
connStatus newc >>= (@?= ConnDisconnected)
-- | Checks that `getColumnNames` and `getColumnsCount` return right result | 421 | connClone :: (Connection con) => con -> Assertion
connClone c = do
newc <- clone c
connStatus newc >>= (@?= ConnOK)
withTransaction newc $ inTransaction c >>= (@?= False)
withTransaction c $ inTransaction newc >>= (@?= False)
disconnect newc
connStatus newc >>= (@?= ConnDisconnected)
-- | Checks that `getColumnNames` and `getColumnsCount` return right result | 373 | connClone c = do
newc <- clone c
connStatus newc >>= (@?= ConnOK)
withTransaction newc $ inTransaction c >>= (@?= False)
withTransaction c $ inTransaction newc >>= (@?= False)
disconnect newc
connStatus newc >>= (@?= ConnDisconnected)
-- | Checks that `getColumnNames` and `getColumnsCount` return right result | 323 | true | true | 0 | 9 | 73 | 115 | 56 | 59 | null | null |
Proclivis/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxSTC_POV_COMMENT :: Int
wxSTC_POV_COMMENT = 1 | 46 | wxSTC_POV_COMMENT :: Int
wxSTC_POV_COMMENT = 1 | 46 | wxSTC_POV_COMMENT = 1 | 21 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
ClathomasPrime/ImpCore | uScheme/src/OpSem.hs | bsd-3-clause | evaluateF (LetF LetRecStar bindings body) (rho0, sigma0) =
let -- rho' maps names to new locations.
-- Sigma is not edited (for now) (except updating next loc)
-- locToExpMap maps locations to expressions
(rho', sigma1, locToExprMap)
= foldl addUnspecifiedBind (rho0, sigma0, []) bindings
addUnspecifiedBind (rho, sigma, locMap) (x,e) =
let (loc, sigma') = nextLocation sigma
rho' = insertRefTo x loc rho
in (rho', sigma', (loc,e):locMap)
-- fold down locToExprMap, changing exprs to vals and updating locs
calcBinds [] sigma = return sigma
calcBinds ((loc,e):binds) sigma =
do (v, sigma') <- e (rho', sigma)
let sigma'' = mutateVal loc v sigma'
calcBinds binds sigma''
in do sigma2 <- calcBinds locToExprMap sigma1
body (rho', sigma2) | 860 | evaluateF (LetF LetRecStar bindings body) (rho0, sigma0) =
let -- rho' maps names to new locations.
-- Sigma is not edited (for now) (except updating next loc)
-- locToExpMap maps locations to expressions
(rho', sigma1, locToExprMap)
= foldl addUnspecifiedBind (rho0, sigma0, []) bindings
addUnspecifiedBind (rho, sigma, locMap) (x,e) =
let (loc, sigma') = nextLocation sigma
rho' = insertRefTo x loc rho
in (rho', sigma', (loc,e):locMap)
-- fold down locToExprMap, changing exprs to vals and updating locs
calcBinds [] sigma = return sigma
calcBinds ((loc,e):binds) sigma =
do (v, sigma') <- e (rho', sigma)
let sigma'' = mutateVal loc v sigma'
calcBinds binds sigma''
in do sigma2 <- calcBinds locToExprMap sigma1
body (rho', sigma2) | 860 | evaluateF (LetF LetRecStar bindings body) (rho0, sigma0) =
let -- rho' maps names to new locations.
-- Sigma is not edited (for now) (except updating next loc)
-- locToExpMap maps locations to expressions
(rho', sigma1, locToExprMap)
= foldl addUnspecifiedBind (rho0, sigma0, []) bindings
addUnspecifiedBind (rho, sigma, locMap) (x,e) =
let (loc, sigma') = nextLocation sigma
rho' = insertRefTo x loc rho
in (rho', sigma', (loc,e):locMap)
-- fold down locToExprMap, changing exprs to vals and updating locs
calcBinds [] sigma = return sigma
calcBinds ((loc,e):binds) sigma =
do (v, sigma') <- e (rho', sigma)
let sigma'' = mutateVal loc v sigma'
calcBinds binds sigma''
in do sigma2 <- calcBinds locToExprMap sigma1
body (rho', sigma2) | 860 | false | false | 0 | 14 | 237 | 255 | 135 | 120 | null | null |
jpfuentes2/swim | test/Spec.hs | mit | membersMap :: [Member] -> Map.Map String Member
membersMap ms =
Map.fromList $ map (\m -> (memberName m, m)) ms | 113 | membersMap :: [Member] -> Map.Map String Member
membersMap ms =
Map.fromList $ map (\m -> (memberName m, m)) ms | 113 | membersMap ms =
Map.fromList $ map (\m -> (memberName m, m)) ms | 65 | false | true | 2 | 9 | 20 | 62 | 30 | 32 | null | null |
thalerjonathan/phd | coding/libraries/chimera/examples/ABS/Segregation/Agent.hs | gpl-3.0 | optimizeSatisfaction OptSimilaritySatisfied = moveSatisfies | 59 | optimizeSatisfaction OptSimilaritySatisfied = moveSatisfies | 59 | optimizeSatisfaction OptSimilaritySatisfied = moveSatisfies | 59 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
DavidAlphaFox/ghc | libraries/containers/Data/IntMap/Base.hs | bsd-3-clause | mapKeys :: (Key->Key) -> IntMap a -> IntMap a
mapKeys f = fromList . foldrWithKey (\k x xs -> (f k, x) : xs) [] | 111 | mapKeys :: (Key->Key) -> IntMap a -> IntMap a
mapKeys f = fromList . foldrWithKey (\k x xs -> (f k, x) : xs) [] | 111 | mapKeys f = fromList . foldrWithKey (\k x xs -> (f k, x) : xs) [] | 65 | false | true | 0 | 11 | 24 | 71 | 36 | 35 | null | null |
rickardlindberg/alldoc | src/TagSoupHelpers.hs | bsd-3-clause | justSections a = Just . sections a | 34 | justSections a = Just . sections a | 34 | justSections a = Just . sections a | 34 | false | false | 1 | 6 | 6 | 19 | 7 | 12 | null | null |
Courseography/courseography | app/DevelopmentConfig.hs | gpl-3.0 | -- CALENDAR RESPONSE DATES
-- | First day of classes for the fall term.
fallStartDate :: Day
fallStartDate = fromGregorian 2021 09 09 | 134 | fallStartDate :: Day
fallStartDate = fromGregorian 2021 09 09 | 61 | fallStartDate = fromGregorian 2021 09 09 | 40 | true | true | 0 | 6 | 23 | 26 | 12 | 14 | null | null |
xu-hao/QueryArrow | QueryArrow-db-cypher/src/QueryArrow/Cypher/Mapping.hs | bsd-3-clause | lookupPred :: String -> String -> PredName
lookupPred ns n =
predName (lookupPredByName (PredName [ns] n)) | 108 | lookupPred :: String -> String -> PredName
lookupPred ns n =
predName (lookupPredByName (PredName [ns] n)) | 108 | lookupPred ns n =
predName (lookupPredByName (PredName [ns] n)) | 65 | false | true | 0 | 10 | 17 | 44 | 22 | 22 | null | null |
avieth/Algebraic | Data/Algebraic/Index.hs | bsd-3-clause | ten :: Index 10
ten = Index | 27 | ten :: Index 10
ten = Index | 27 | ten = Index | 11 | false | true | 0 | 5 | 6 | 14 | 7 | 7 | null | null |
mrsata/memegen | src/Memegen/Lib.hs | mit | -- handler for hello
echoHandler :: S.Handler AppState AppState ()
echoHandler = do
Just param <- S.getParam "echoparam"
writeBS $ B.append "Hello " param
-- handler for showing meme | 187 | echoHandler :: S.Handler AppState AppState ()
echoHandler = do
Just param <- S.getParam "echoparam"
writeBS $ B.append "Hello " param
-- handler for showing meme | 166 | echoHandler = do
Just param <- S.getParam "echoparam"
writeBS $ B.append "Hello " param
-- handler for showing meme | 120 | true | true | 1 | 10 | 33 | 57 | 25 | 32 | null | null |
Paow/encore | src/back/CodeGen/CCodeNames.hs | bsd-3-clause | fieldName :: ID.Name -> CCode Name
fieldName name =
Nam $ encoreName "field" (show name) | 92 | fieldName :: ID.Name -> CCode Name
fieldName name =
Nam $ encoreName "field" (show name) | 92 | fieldName name =
Nam $ encoreName "field" (show name) | 57 | false | true | 0 | 8 | 18 | 38 | 18 | 20 | null | null |
facebookincubator/duckling | Duckling/Time/EN/Rules.hs | bsd-3-clause | ruleAbsorbCommaTOD :: Rule
ruleAbsorbCommaTOD = Rule
{ name = "absorption of , after named day"
, pattern =
[ Predicate isADayOfWeek
, regex ","
]
, prod = \tokens -> case tokens of
(token:_) -> Just token
_ -> Nothing
} | 252 | ruleAbsorbCommaTOD :: Rule
ruleAbsorbCommaTOD = Rule
{ name = "absorption of , after named day"
, pattern =
[ Predicate isADayOfWeek
, regex ","
]
, prod = \tokens -> case tokens of
(token:_) -> Just token
_ -> Nothing
} | 252 | ruleAbsorbCommaTOD = Rule
{ name = "absorption of , after named day"
, pattern =
[ Predicate isADayOfWeek
, regex ","
]
, prod = \tokens -> case tokens of
(token:_) -> Just token
_ -> Nothing
} | 225 | false | true | 0 | 13 | 72 | 84 | 43 | 41 | null | null |
kim/amazonka | amazonka-ec2/gen/Network/AWS/EC2/ModifyNetworkInterfaceAttribute.hs | mpl-2.0 | -- | Indicates whether source/destination checking is enabled. A value of 'true'
-- means checking is enabled, and 'false' means checking is disabled. This value
-- must be 'false' for a NAT instance to perform NAT. For more information, see <http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_NAT_Instance.html NAT Instances> in the /Amazon Virtual Private Cloud User Guide/.
mniaSourceDestCheck :: Lens' ModifyNetworkInterfaceAttribute (Maybe AttributeBooleanValue)
mniaSourceDestCheck =
lens _mniaSourceDestCheck (\s a -> s { _mniaSourceDestCheck = a }) | 567 | mniaSourceDestCheck :: Lens' ModifyNetworkInterfaceAttribute (Maybe AttributeBooleanValue)
mniaSourceDestCheck =
lens _mniaSourceDestCheck (\s a -> s { _mniaSourceDestCheck = a }) | 183 | mniaSourceDestCheck =
lens _mniaSourceDestCheck (\s a -> s { _mniaSourceDestCheck = a }) | 92 | true | true | 0 | 9 | 73 | 48 | 27 | 21 | null | null |
wxwxwwxxx/ghc | compiler/utils/Outputable.hs | bsd-3-clause | unicodeSyntax :: SDoc -> SDoc -> SDoc
unicodeSyntax unicode plain = sdocWithDynFlags $ \dflags ->
if useUnicode dflags && useUnicodeSyntax dflags
then unicode
else plain | 181 | unicodeSyntax :: SDoc -> SDoc -> SDoc
unicodeSyntax unicode plain = sdocWithDynFlags $ \dflags ->
if useUnicode dflags && useUnicodeSyntax dflags
then unicode
else plain | 181 | unicodeSyntax unicode plain = sdocWithDynFlags $ \dflags ->
if useUnicode dflags && useUnicodeSyntax dflags
then unicode
else plain | 143 | false | true | 0 | 9 | 36 | 57 | 27 | 30 | null | null |
brendanhay/gogol | gogol-script/gen/Network/Google/Resource/Script/Projects/GetContent.hs | mpl-2.0 | -- | The version number of the project to retrieve. If not provided, the
-- project\'s HEAD version is returned.
pgcVersionNumber :: Lens' ProjectsGetContent (Maybe Int32)
pgcVersionNumber
= lens _pgcVersionNumber
(\ s a -> s{_pgcVersionNumber = a})
. mapping _Coerce | 281 | pgcVersionNumber :: Lens' ProjectsGetContent (Maybe Int32)
pgcVersionNumber
= lens _pgcVersionNumber
(\ s a -> s{_pgcVersionNumber = a})
. mapping _Coerce | 168 | pgcVersionNumber
= lens _pgcVersionNumber
(\ s a -> s{_pgcVersionNumber = a})
. mapping _Coerce | 109 | true | true | 2 | 8 | 53 | 60 | 29 | 31 | null | null |
shawntan/semantics3-haskell | test.hs | mit | srvUrl = fromJust $ parseURL "https://api.semantics3.com/v1/products?q=%7B%22search%22:%22Apple%20Macb*%22%7D" | 112 | srvUrl = fromJust $ parseURL "https://api.semantics3.com/v1/products?q=%7B%22search%22:%22Apple%20Macb*%22%7D" | 112 | srvUrl = fromJust $ parseURL "https://api.semantics3.com/v1/products?q=%7B%22search%22:%22Apple%20Macb*%22%7D" | 112 | false | false | 3 | 5 | 7 | 17 | 6 | 11 | null | null |
np/lens | src/Control/Lens/Plated.hs | bsd-3-clause | -- | Return a list of all of the editable contexts for every location in the structure in an areas indicated by a user supplied 'Traversal', recursively using 'plate'.
--
-- @'contextsOn' b ≡ 'contextsOnOf' b 'plate'@
--
-- @'contextsOn' :: 'Plated' a => 'Traversal'' s a -> s -> ['Context' a a s]@
contextsOn :: Plated a => LensLike (Bazaar a a) s t a a -> s -> [Context a a t]
contextsOn b = contextsOnOf b plate | 414 | contextsOn :: Plated a => LensLike (Bazaar a a) s t a a -> s -> [Context a a t]
contextsOn b = contextsOnOf b plate | 115 | contextsOn b = contextsOnOf b plate | 35 | true | true | 0 | 9 | 79 | 68 | 35 | 33 | null | null |
lukexi/ghc-7.8-arm64 | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | -- Double ops
translateOp _ DoubleEqOp = Just (MO_F_Eq W64) | 69 | translateOp _ DoubleEqOp = Just (MO_F_Eq W64) | 54 | translateOp _ DoubleEqOp = Just (MO_F_Eq W64) | 54 | true | false | 1 | 7 | 19 | 22 | 10 | 12 | null | null |
prasmussen/magmod | Magento/JS.hs | mit | addJs :: ModuleInfo -> String -> IO ()
addJs info name = do
createJsIfMissing info name | 91 | addJs :: ModuleInfo -> String -> IO ()
addJs info name = do
createJsIfMissing info name | 91 | addJs info name = do
createJsIfMissing info name | 52 | false | true | 0 | 8 | 19 | 37 | 17 | 20 | null | null |
nomeata/incredible | logic/ProofGraph.hs | mit | calcNonScope :: Node a -> UniqSet -> UniqSet -> IM.IntMap NodePath
calcNonScope start stopAtForward stopAtBackward = flip execState IM.empty $ do
backActions <- execWriterT (goForward [] start)
sequence_ backActions
where
-- This goes only forward. It does not go backwards directly, but rather remembers
-- where to start going backwards and returns these actions in a list.
-- Going back too early might cut off certain paths (see trickyEscape test case)
goForward :: NodePath -> Node a -> NonScopeDeferM ()
goForward path n | nu `IS.member` stopAtForward = return ()
| otherwise = do
seen <- lift $ gets (nu `IM.member`)
unless seen $ do
lift $ modify $ IM.insert nu path'
tell $ map (goBackward path') (nodePred n)
mapM_ (goForward path') (nodeSucc n)
where nu = nodeUniq n
path' = nu:path
goBackward :: NodePath -> Node a -> NonScopeM ()
goBackward path n | nu `IS.member` stopAtBackward = return ()
| otherwise = do
seen <- gets (nu `IM.member`)
unless seen $ do
modify $ IM.insert nu path'
mapM_ (goBackward path') (nodePred n)
where nu = nodeUniq n
path' = nu:path | 1,283 | calcNonScope :: Node a -> UniqSet -> UniqSet -> IM.IntMap NodePath
calcNonScope start stopAtForward stopAtBackward = flip execState IM.empty $ do
backActions <- execWriterT (goForward [] start)
sequence_ backActions
where
-- This goes only forward. It does not go backwards directly, but rather remembers
-- where to start going backwards and returns these actions in a list.
-- Going back too early might cut off certain paths (see trickyEscape test case)
goForward :: NodePath -> Node a -> NonScopeDeferM ()
goForward path n | nu `IS.member` stopAtForward = return ()
| otherwise = do
seen <- lift $ gets (nu `IM.member`)
unless seen $ do
lift $ modify $ IM.insert nu path'
tell $ map (goBackward path') (nodePred n)
mapM_ (goForward path') (nodeSucc n)
where nu = nodeUniq n
path' = nu:path
goBackward :: NodePath -> Node a -> NonScopeM ()
goBackward path n | nu `IS.member` stopAtBackward = return ()
| otherwise = do
seen <- gets (nu `IM.member`)
unless seen $ do
modify $ IM.insert nu path'
mapM_ (goBackward path') (nodePred n)
where nu = nodeUniq n
path' = nu:path | 1,283 | calcNonScope start stopAtForward stopAtBackward = flip execState IM.empty $ do
backActions <- execWriterT (goForward [] start)
sequence_ backActions
where
-- This goes only forward. It does not go backwards directly, but rather remembers
-- where to start going backwards and returns these actions in a list.
-- Going back too early might cut off certain paths (see trickyEscape test case)
goForward :: NodePath -> Node a -> NonScopeDeferM ()
goForward path n | nu `IS.member` stopAtForward = return ()
| otherwise = do
seen <- lift $ gets (nu `IM.member`)
unless seen $ do
lift $ modify $ IM.insert nu path'
tell $ map (goBackward path') (nodePred n)
mapM_ (goForward path') (nodeSucc n)
where nu = nodeUniq n
path' = nu:path
goBackward :: NodePath -> Node a -> NonScopeM ()
goBackward path n | nu `IS.member` stopAtBackward = return ()
| otherwise = do
seen <- gets (nu `IM.member`)
unless seen $ do
modify $ IM.insert nu path'
mapM_ (goBackward path') (nodePred n)
where nu = nodeUniq n
path' = nu:path | 1,216 | false | true | 0 | 14 | 392 | 395 | 187 | 208 | null | null |
TransformingMusicology/libaudioDB-haskell | src/Sound/Audio/Database/Query.hs | gpl-3.0 | unsafeApplyQuery :: (Ptr ADB) -> (ADBQuerySpec -> IO a) -> QueryAllocator -> IO a
unsafeApplyQuery adb f allocQuery = unsafeWithQuery adb allocQuery f | 150 | unsafeApplyQuery :: (Ptr ADB) -> (ADBQuerySpec -> IO a) -> QueryAllocator -> IO a
unsafeApplyQuery adb f allocQuery = unsafeWithQuery adb allocQuery f | 150 | unsafeApplyQuery adb f allocQuery = unsafeWithQuery adb allocQuery f | 68 | false | true | 0 | 9 | 22 | 56 | 27 | 29 | null | null |
ahodgen/archer-calc | src/BuiltIn/Stats.hs | bsd-2-clause | biChiDist :: BuiltIn
biChiDist = BuiltIn
{ evalVal = chiDist
, emitVal = const "CHIDIST"
, typeSig = typeNum :-> typeNum :-> typeNum
, argHelp = "x degrees_freedom"
, addHelp = Nothing
} | 210 | biChiDist :: BuiltIn
biChiDist = BuiltIn
{ evalVal = chiDist
, emitVal = const "CHIDIST"
, typeSig = typeNum :-> typeNum :-> typeNum
, argHelp = "x degrees_freedom"
, addHelp = Nothing
} | 210 | biChiDist = BuiltIn
{ evalVal = chiDist
, emitVal = const "CHIDIST"
, typeSig = typeNum :-> typeNum :-> typeNum
, argHelp = "x degrees_freedom"
, addHelp = Nothing
} | 189 | false | true | 0 | 9 | 56 | 58 | 33 | 25 | null | null |
JacquesCarette/literate-scientific-software | code/drasil-data/Data/Drasil/Theories/Physics.hs | bsd-2-clause | weightDeriv :: Derivation
weightDeriv = mkDerivName (phrase QP.weight) $ weave [weightDerivSentences, weightDerivEqns] | 118 | weightDeriv :: Derivation
weightDeriv = mkDerivName (phrase QP.weight) $ weave [weightDerivSentences, weightDerivEqns] | 118 | weightDeriv = mkDerivName (phrase QP.weight) $ weave [weightDerivSentences, weightDerivEqns] | 92 | false | true | 0 | 9 | 11 | 35 | 18 | 17 | null | null |
spoqa/nirum | src/Nirum/Targets/Python/CodeGen.hs | gpl-3.0 | empty :: PythonVersion -> CodeGenContext
empty pythonVer = CodeGenContext
{ standardImports = []
, standardImportSet = []
, thirdPartyImports = []
, localImports = []
, pythonVersion = pythonVer
, dependencies = []
, optionalDependencies = []
, globalDefinitions = []
} | 305 | empty :: PythonVersion -> CodeGenContext
empty pythonVer = CodeGenContext
{ standardImports = []
, standardImportSet = []
, thirdPartyImports = []
, localImports = []
, pythonVersion = pythonVer
, dependencies = []
, optionalDependencies = []
, globalDefinitions = []
} | 305 | empty pythonVer = CodeGenContext
{ standardImports = []
, standardImportSet = []
, thirdPartyImports = []
, localImports = []
, pythonVersion = pythonVer
, dependencies = []
, optionalDependencies = []
, globalDefinitions = []
} | 264 | false | true | 0 | 8 | 77 | 91 | 51 | 40 | null | null |
ekmett/tables | src/Data/Table.hs | bsd-3-clause | count (Table m) = M.size (m^.primaryMap) | 41 | count (Table m) = M.size (m^.primaryMap) | 41 | count (Table m) = M.size (m^.primaryMap) | 41 | false | false | 0 | 7 | 6 | 27 | 13 | 14 | null | null |
abuiles/turbinado-blog | App/Controllers/Posts.hs | bsd-3-clause | remove :: Controller ()
remove = do id' <-getSetting_u "id" :: Controller String
let pId = (read id' :: Integer)
post <- find pId :: Controller Posts
mydelete post -- This function is used to delete a post from the database, due to a minor issue, this function is not generated by the ORM.
-- Check in /App/Models/Posts.hs to see how easy is interact with the database.
redirectTo$ "/Manage/Home" | 489 | remove :: Controller ()
remove = do id' <-getSetting_u "id" :: Controller String
let pId = (read id' :: Integer)
post <- find pId :: Controller Posts
mydelete post -- This function is used to delete a post from the database, due to a minor issue, this function is not generated by the ORM.
-- Check in /App/Models/Posts.hs to see how easy is interact with the database.
redirectTo$ "/Manage/Home" | 489 | remove = do id' <-getSetting_u "id" :: Controller String
let pId = (read id' :: Integer)
post <- find pId :: Controller Posts
mydelete post -- This function is used to delete a post from the database, due to a minor issue, this function is not generated by the ORM.
-- Check in /App/Models/Posts.hs to see how easy is interact with the database.
redirectTo$ "/Manage/Home" | 465 | false | true | 1 | 12 | 161 | 85 | 38 | 47 | null | null |
hpacheco/HAAP | examples/plab/svn/2017li1g183/src/BotHugo183.hs | mit | contrariaPara :: [(Peca,Posicao,Orientacao)] -> Int -> Tempo -> Jogo -> Int -> Double
contrariaPara pecas la tick jogo p = case headMay tgts of
Just (tgt',angulo) -> {-trace ("from " ++ show pos ++ " to " ++ show tgt' ++" "++ show angulo ++ " " ++ show invAngV) $-} angulo
Nothing -> direcao $ getCarro p jogo --error ("contraria " ++ show (direcao $ getCarro p jogo))
where
props = pista jogo
tgts = sortBy maisEstavel $ contrariaPara' la
carro = getCarro p jogo
pos@(posx,posy) = posicao carro
(v,normalizaAngulo -> angV) = componentsToArrow $ velocidade carro
invAngV = normalizaAngulo $ angV-180
Mapa _ tab = mapa jogo
estaPeca = getPeca (pontoToPosicao pos) tab
contrariaPara' :: Int -> [(Ponto,Double)]
contrariaPara' 0 = descobre 0 estaPeca (pontoToPosicao pos)
contrariaPara' la = case atMay pecas (pred la) of
Just (peca,tgt,orientacao) -> let tgts1 = descobre la peca tgt
tgts2 = contrariaPara' (pred la)
in tgts1 ++ tgts2
Nothing -> contrariaPara' (pred la)
descobre :: Int -> Peca -> Posicao -> [(Ponto,Double)]
descobre la peca@(Peca t _) tgt = {-trace ("descobre " ++ show (angulos)) -} angulos
where
angulos = map (mapSnd (normalizaAngulo . snd)) $ filter valida $ map calcula pontos
pontos :: [Ponto]
pontos = centroPeca t tgt : map (flip ladoPonto tgt) lados ++ (if (k_atrito props < 1 && la==0) then cantosCurva peca tgt else [])
lados = ladosPeca peca
calcula :: Ponto -> (Ponto,((Double,Double)))
calcula p = (p,componentsToArrow $ p .-. pos)
valida :: (Ponto,((Double,Double))) -> Bool
valida (_,s) = la == 1 || linhaRecta jogo tick p s
maisEstavel :: (Ponto,Double) -> (Ponto,Double) -> Ordering
maisEstavel (_,th1) (_,th2) = if normalizaAngulo (th1-invAngV) `menorAngulo` normalizaAngulo (th2-invAngV) then LT else GT | 1,985 | contrariaPara :: [(Peca,Posicao,Orientacao)] -> Int -> Tempo -> Jogo -> Int -> Double
contrariaPara pecas la tick jogo p = case headMay tgts of
Just (tgt',angulo) -> {-trace ("from " ++ show pos ++ " to " ++ show tgt' ++" "++ show angulo ++ " " ++ show invAngV) $-} angulo
Nothing -> direcao $ getCarro p jogo --error ("contraria " ++ show (direcao $ getCarro p jogo))
where
props = pista jogo
tgts = sortBy maisEstavel $ contrariaPara' la
carro = getCarro p jogo
pos@(posx,posy) = posicao carro
(v,normalizaAngulo -> angV) = componentsToArrow $ velocidade carro
invAngV = normalizaAngulo $ angV-180
Mapa _ tab = mapa jogo
estaPeca = getPeca (pontoToPosicao pos) tab
contrariaPara' :: Int -> [(Ponto,Double)]
contrariaPara' 0 = descobre 0 estaPeca (pontoToPosicao pos)
contrariaPara' la = case atMay pecas (pred la) of
Just (peca,tgt,orientacao) -> let tgts1 = descobre la peca tgt
tgts2 = contrariaPara' (pred la)
in tgts1 ++ tgts2
Nothing -> contrariaPara' (pred la)
descobre :: Int -> Peca -> Posicao -> [(Ponto,Double)]
descobre la peca@(Peca t _) tgt = {-trace ("descobre " ++ show (angulos)) -} angulos
where
angulos = map (mapSnd (normalizaAngulo . snd)) $ filter valida $ map calcula pontos
pontos :: [Ponto]
pontos = centroPeca t tgt : map (flip ladoPonto tgt) lados ++ (if (k_atrito props < 1 && la==0) then cantosCurva peca tgt else [])
lados = ladosPeca peca
calcula :: Ponto -> (Ponto,((Double,Double)))
calcula p = (p,componentsToArrow $ p .-. pos)
valida :: (Ponto,((Double,Double))) -> Bool
valida (_,s) = la == 1 || linhaRecta jogo tick p s
maisEstavel :: (Ponto,Double) -> (Ponto,Double) -> Ordering
maisEstavel (_,th1) (_,th2) = if normalizaAngulo (th1-invAngV) `menorAngulo` normalizaAngulo (th2-invAngV) then LT else GT | 1,985 | contrariaPara pecas la tick jogo p = case headMay tgts of
Just (tgt',angulo) -> {-trace ("from " ++ show pos ++ " to " ++ show tgt' ++" "++ show angulo ++ " " ++ show invAngV) $-} angulo
Nothing -> direcao $ getCarro p jogo --error ("contraria " ++ show (direcao $ getCarro p jogo))
where
props = pista jogo
tgts = sortBy maisEstavel $ contrariaPara' la
carro = getCarro p jogo
pos@(posx,posy) = posicao carro
(v,normalizaAngulo -> angV) = componentsToArrow $ velocidade carro
invAngV = normalizaAngulo $ angV-180
Mapa _ tab = mapa jogo
estaPeca = getPeca (pontoToPosicao pos) tab
contrariaPara' :: Int -> [(Ponto,Double)]
contrariaPara' 0 = descobre 0 estaPeca (pontoToPosicao pos)
contrariaPara' la = case atMay pecas (pred la) of
Just (peca,tgt,orientacao) -> let tgts1 = descobre la peca tgt
tgts2 = contrariaPara' (pred la)
in tgts1 ++ tgts2
Nothing -> contrariaPara' (pred la)
descobre :: Int -> Peca -> Posicao -> [(Ponto,Double)]
descobre la peca@(Peca t _) tgt = {-trace ("descobre " ++ show (angulos)) -} angulos
where
angulos = map (mapSnd (normalizaAngulo . snd)) $ filter valida $ map calcula pontos
pontos :: [Ponto]
pontos = centroPeca t tgt : map (flip ladoPonto tgt) lados ++ (if (k_atrito props < 1 && la==0) then cantosCurva peca tgt else [])
lados = ladosPeca peca
calcula :: Ponto -> (Ponto,((Double,Double)))
calcula p = (p,componentsToArrow $ p .-. pos)
valida :: (Ponto,((Double,Double))) -> Bool
valida (_,s) = la == 1 || linhaRecta jogo tick p s
maisEstavel :: (Ponto,Double) -> (Ponto,Double) -> Ordering
maisEstavel (_,th1) (_,th2) = if normalizaAngulo (th1-invAngV) `menorAngulo` normalizaAngulo (th2-invAngV) then LT else GT | 1,899 | false | true | 12 | 16 | 527 | 685 | 362 | 323 | null | null |
dmjio/aeson | benchmarks/bench/UnescapePureText1.hs | bsd-3-clause | setByte3 :: (Num a, Bits b, Bits a, Integral b) => a -> b -> a
setByte3 point word = point .|. (fromIntegral (word .&. 0x3f) `shiftL` 12) | 137 | setByte3 :: (Num a, Bits b, Bits a, Integral b) => a -> b -> a
setByte3 point word = point .|. (fromIntegral (word .&. 0x3f) `shiftL` 12) | 137 | setByte3 point word = point .|. (fromIntegral (word .&. 0x3f) `shiftL` 12) | 74 | false | true | 0 | 10 | 27 | 74 | 39 | 35 | null | null |
osa1/rho-torrent | src/Rho/Utils.hs | bsd-3-clause | getResult (Left (_, _, err)) = Left err | 40 | getResult (Left (_, _, err)) = Left err | 40 | getResult (Left (_, _, err)) = Left err | 40 | false | false | 0 | 8 | 8 | 27 | 14 | 13 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/utils/Util.hs | bsd-3-clause | third3 :: (c -> d) -> (a, b, c) -> (a, b, d)
third3 f (a, b, c) = (a, b, f c) | 77 | third3 :: (c -> d) -> (a, b, c) -> (a, b, d)
third3 f (a, b, c) = (a, b, f c) | 77 | third3 f (a, b, c) = (a, b, f c) | 32 | false | true | 0 | 9 | 22 | 76 | 42 | 34 | null | null |
xmonad/xmonad-contrib | XMonad/Util/Paste.hs | bsd-3-clause | -- | The primitive. Allows you to send any combination of 'KeyMask' and 'KeySym' to any 'Window' you specify.
sendKeyWindow :: KeyMask -> KeySym -> Window -> X ()
sendKeyWindow mods key w = withDisplay $ \d -> do
rootw <- asks theRoot
keycode <- io $ keysymToKeycode d key
io $ allocaXEvent $ \ev -> do
setEventType ev keyPress
setKeyEvent ev w rootw none mods keycode True
sendEvent d w True keyPressMask ev
setEventType ev keyRelease
sendEvent d w True keyReleaseMask ev
-- | Convert a unicode character to a 'KeySym'. Ideally, this should
-- work for any unicode character, but see here for details:
-- http://www.cl.cam.ac.uk/~mgk25/ucs/keysyms.txt | 785 | sendKeyWindow :: KeyMask -> KeySym -> Window -> X ()
sendKeyWindow mods key w = withDisplay $ \d -> do
rootw <- asks theRoot
keycode <- io $ keysymToKeycode d key
io $ allocaXEvent $ \ev -> do
setEventType ev keyPress
setKeyEvent ev w rootw none mods keycode True
sendEvent d w True keyPressMask ev
setEventType ev keyRelease
sendEvent d w True keyReleaseMask ev
-- | Convert a unicode character to a 'KeySym'. Ideally, this should
-- work for any unicode character, but see here for details:
-- http://www.cl.cam.ac.uk/~mgk25/ucs/keysyms.txt | 675 | sendKeyWindow mods key w = withDisplay $ \d -> do
rootw <- asks theRoot
keycode <- io $ keysymToKeycode d key
io $ allocaXEvent $ \ev -> do
setEventType ev keyPress
setKeyEvent ev w rootw none mods keycode True
sendEvent d w True keyPressMask ev
setEventType ev keyRelease
sendEvent d w True keyReleaseMask ev
-- | Convert a unicode character to a 'KeySym'. Ideally, this should
-- work for any unicode character, but see here for details:
-- http://www.cl.cam.ac.uk/~mgk25/ucs/keysyms.txt | 622 | true | true | 0 | 14 | 240 | 158 | 72 | 86 | null | null |
ashgti/DTI | src/Language/Perl/Types.hs | mit | showError (Parser parseErr) = "Parse error at " ++ ": " ++ show parseErr | 72 | showError (Parser parseErr) = "Parse error at " ++ ": " ++ show parseErr | 72 | showError (Parser parseErr) = "Parse error at " ++ ": " ++ show parseErr | 72 | false | false | 0 | 7 | 13 | 26 | 12 | 14 | null | null |
hw-hello-world/okta-signin-widget | haskell-scotty/src/Config.hs | mit | ------------------------------
-- Config Data
------------------------------
configFile :: String
configFile = "data/config.json" | 130 | configFile :: String
configFile = "data/config.json" | 52 | configFile = "data/config.json" | 31 | true | true | 0 | 6 | 11 | 21 | 10 | 11 | null | null |
mudphone/HaskellBook | src/Eleven.hs | mit | capitalizeWords :: String -> [(String, String)]
capitalizeWords = go . words
where go (w:ws) = [(w, capitalizeWord w)] ++ go ws
go [] = [] | 148 | capitalizeWords :: String -> [(String, String)]
capitalizeWords = go . words
where go (w:ws) = [(w, capitalizeWord w)] ++ go ws
go [] = [] | 148 | capitalizeWords = go . words
where go (w:ws) = [(w, capitalizeWord w)] ++ go ws
go [] = [] | 100 | false | true | 1 | 8 | 34 | 76 | 41 | 35 | null | null |
rahulmutt/codec-jvm | src/Codec/JVM/ASM/Code/CtrlFlow.hs | apache-2.0 | remove :: (Integral a) => a -> FieldType -> Locals -> Locals
remove n' ft (Locals mp _ mx) = Locals mp' sz' mx
where n = fromIntegral n'
delta = fieldSize ft
deletes = map IntMap.delete (take delta [n, n+1])
mp' = foldl' (flip ($)) mp deletes
sz' = computeNumLocals mp' | 305 | remove :: (Integral a) => a -> FieldType -> Locals -> Locals
remove n' ft (Locals mp _ mx) = Locals mp' sz' mx
where n = fromIntegral n'
delta = fieldSize ft
deletes = map IntMap.delete (take delta [n, n+1])
mp' = foldl' (flip ($)) mp deletes
sz' = computeNumLocals mp' | 305 | remove n' ft (Locals mp _ mx) = Locals mp' sz' mx
where n = fromIntegral n'
delta = fieldSize ft
deletes = map IntMap.delete (take delta [n, n+1])
mp' = foldl' (flip ($)) mp deletes
sz' = computeNumLocals mp' | 244 | false | true | 0 | 9 | 87 | 137 | 69 | 68 | null | null |
tjakway/ghcjvm | compiler/hsSyn/HsUtils.hs | bsd-3-clause | mkLastStmt body = LastStmt body False noSyntaxExpr | 54 | mkLastStmt body = LastStmt body False noSyntaxExpr | 54 | mkLastStmt body = LastStmt body False noSyntaxExpr | 54 | false | false | 0 | 5 | 10 | 16 | 7 | 9 | null | null |
nevrenato/Hets_Fork | Logic/Logic.hs | gpl-2.0 | -- | fail function for static analysis
statFail :: (Language lid, Monad m) => lid -> String -> m a
statFail lid = fail . statErrMsg lid | 135 | statFail :: (Language lid, Monad m) => lid -> String -> m a
statFail lid = fail . statErrMsg lid | 96 | statFail lid = fail . statErrMsg lid | 36 | true | true | 1 | 9 | 26 | 53 | 25 | 28 | null | null |
cbrghostrider/Hacking | HackerRank/Contests/ProjectEuler/011_largestProductGrid.hs | mit | maxProd :: Grid -> Int
maxProd gr = head . reverse . sort . map product . map (map (fetchCell gr)) . nub . concat . map allTuplesForCoord $ allCoords | 150 | maxProd :: Grid -> Int
maxProd gr = head . reverse . sort . map product . map (map (fetchCell gr)) . nub . concat . map allTuplesForCoord $ allCoords | 150 | maxProd gr = head . reverse . sort . map product . map (map (fetchCell gr)) . nub . concat . map allTuplesForCoord $ allCoords | 127 | false | true | 0 | 14 | 30 | 71 | 34 | 37 | null | null |
uduki/hsQt | Qtc/Gui/QTableView.hs | bsd-2-clause | verticalHeader :: QTableView a -> (()) -> IO (QHeaderView ())
verticalHeader x0 ()
= withQHeaderViewResult $
withObjectPtr x0 $ \cobj_x0 ->
qtc_QTableView_verticalHeader cobj_x0 | 187 | verticalHeader :: QTableView a -> (()) -> IO (QHeaderView ())
verticalHeader x0 ()
= withQHeaderViewResult $
withObjectPtr x0 $ \cobj_x0 ->
qtc_QTableView_verticalHeader cobj_x0 | 187 | verticalHeader x0 ()
= withQHeaderViewResult $
withObjectPtr x0 $ \cobj_x0 ->
qtc_QTableView_verticalHeader cobj_x0 | 125 | false | true | 0 | 10 | 32 | 64 | 31 | 33 | null | null |
nevrenato/Hets_Fork | Modal/StatAna.hs | gpl-2.0 | addRigidPred :: PredType -> Id -> ModalSign -> Result ModalSign
addRigidPred ty i m = return
m { rigidPreds = MapSet.insert i ty $ rigidPreds m } | 152 | addRigidPred :: PredType -> Id -> ModalSign -> Result ModalSign
addRigidPred ty i m = return
m { rigidPreds = MapSet.insert i ty $ rigidPreds m } | 152 | addRigidPred ty i m = return
m { rigidPreds = MapSet.insert i ty $ rigidPreds m } | 88 | false | true | 0 | 10 | 33 | 58 | 28 | 30 | null | null |
spacekitteh/smcghc | compiler/nativeGen/X86/Instr.hs | bsd-3-clause | -- memory reference
-- | Returns which registers are read and written as a (read, written)
-- pair.
x86_regUsageOfInstr :: Platform -> Instr -> RegUsage
x86_regUsageOfInstr platform instr
= case instr of
MOV _ src dst -> usageRW src dst
CMOV _ _ src dst -> mkRU (use_R src [dst]) [dst]
MOVZxL _ src dst -> usageRW src dst
MOVSxL _ src dst -> usageRW src dst
LEA _ src dst -> usageRW src dst
ADD _ src dst -> usageRM src dst
ADC _ src dst -> usageRM src dst
SUB _ src dst -> usageRM src dst
IMUL _ src dst -> usageRM src dst
IMUL2 _ src -> mkRU (eax:use_R src []) [eax,edx]
MUL _ src dst -> usageRM src dst
MUL2 _ src -> mkRU (eax:use_R src []) [eax,edx]
DIV _ op -> mkRU (eax:edx:use_R op []) [eax,edx]
IDIV _ op -> mkRU (eax:edx:use_R op []) [eax,edx]
ADD_CC _ src dst -> usageRM src dst
SUB_CC _ src dst -> usageRM src dst
AND _ src dst -> usageRM src dst
OR _ src dst -> usageRM src dst
XOR _ (OpReg src) (OpReg dst)
| src == dst -> mkRU [] [dst]
XOR _ src dst -> usageRM src dst
NOT _ op -> usageM op
BSWAP _ reg -> mkRU [reg] [reg]
NEGI _ op -> usageM op
SHL _ imm dst -> usageRM imm dst
SAR _ imm dst -> usageRM imm dst
SHR _ imm dst -> usageRM imm dst
BT _ _ src -> mkRUR (use_R src [])
PUSH _ op -> mkRUR (use_R op [])
POP _ op -> mkRU [] (def_W op)
TEST _ src dst -> mkRUR (use_R src $! use_R dst [])
CMP _ src dst -> mkRUR (use_R src $! use_R dst [])
SETCC _ op -> mkRU [] (def_W op)
JXX _ _ -> mkRU [] []
JXX_GBL _ _ -> mkRU [] []
JMP op regs -> mkRUR (use_R op regs)
JMP_TBL op _ _ _ -> mkRUR (use_R op [])
CALL (Left _) params -> mkRU params (callClobberedRegs platform)
CALL (Right reg) params -> mkRU (reg:params) (callClobberedRegs platform)
CLTD _ -> mkRU [eax] [edx]
NOP -> mkRU [] []
GMOV src dst -> mkRU [src] [dst]
GLD _ src dst -> mkRU (use_EA src []) [dst]
GST _ src dst -> mkRUR (src : use_EA dst [])
GLDZ dst -> mkRU [] [dst]
GLD1 dst -> mkRU [] [dst]
GFTOI src dst -> mkRU [src] [dst]
GDTOI src dst -> mkRU [src] [dst]
GITOF src dst -> mkRU [src] [dst]
GITOD src dst -> mkRU [src] [dst]
GDTOF src dst -> mkRU [src] [dst]
GADD _ s1 s2 dst -> mkRU [s1,s2] [dst]
GSUB _ s1 s2 dst -> mkRU [s1,s2] [dst]
GMUL _ s1 s2 dst -> mkRU [s1,s2] [dst]
GDIV _ s1 s2 dst -> mkRU [s1,s2] [dst]
GCMP _ src1 src2 -> mkRUR [src1,src2]
GABS _ src dst -> mkRU [src] [dst]
GNEG _ src dst -> mkRU [src] [dst]
GSQRT _ src dst -> mkRU [src] [dst]
GSIN _ _ _ src dst -> mkRU [src] [dst]
GCOS _ _ _ src dst -> mkRU [src] [dst]
GTAN _ _ _ src dst -> mkRU [src] [dst]
CVTSS2SD src dst -> mkRU [src] [dst]
CVTSD2SS src dst -> mkRU [src] [dst]
CVTTSS2SIQ _ src dst -> mkRU (use_R src []) [dst]
CVTTSD2SIQ _ src dst -> mkRU (use_R src []) [dst]
CVTSI2SS _ src dst -> mkRU (use_R src []) [dst]
CVTSI2SD _ src dst -> mkRU (use_R src []) [dst]
FDIV _ src dst -> usageRM src dst
FETCHGOT reg -> mkRU [] [reg]
FETCHPC reg -> mkRU [] [reg]
COMMENT _ -> noUsage
DELTA _ -> noUsage
POPCNT _ src dst -> mkRU (use_R src []) [dst]
BSF _ src dst -> mkRU (use_R src []) [dst]
BSR _ src dst -> mkRU (use_R src []) [dst]
-- note: might be a better way to do this
PREFETCH _ _ src -> mkRU (use_R src []) []
LOCK i -> x86_regUsageOfInstr platform i
XADD _ src dst -> usageMM src dst
CMPXCHG _ src dst -> usageRMM src dst (OpReg eax)
MFENCE -> noUsage
_other -> panic "regUsage: unrecognised instr"
where
-- # Definitions
--
-- Written: If the operand is a register, it's written. If it's an
-- address, registers mentioned in the address are read.
--
-- Modified: If the operand is a register, it's both read and
-- written. If it's an address, registers mentioned in the address
-- are read.
-- 2 operand form; first operand Read; second Written
usageRW :: Operand -> Operand -> RegUsage
usageRW op (OpReg reg) = mkRU (use_R op []) [reg]
usageRW op (OpAddr ea) = mkRUR (use_R op $! use_EA ea [])
usageRW _ _ = panic "X86.RegInfo.usageRW: no match"
-- 2 operand form; first operand Read; second Modified
usageRM :: Operand -> Operand -> RegUsage
usageRM op (OpReg reg) = mkRU (use_R op [reg]) [reg]
usageRM op (OpAddr ea) = mkRUR (use_R op $! use_EA ea [])
usageRM _ _ = panic "X86.RegInfo.usageRM: no match"
-- 2 operand form; first operand Modified; second Modified
usageMM :: Operand -> Operand -> RegUsage
usageMM (OpReg src) (OpReg dst) = mkRU [src, dst] [src, dst]
usageMM (OpReg src) (OpAddr ea) = mkRU (use_EA ea [src]) [src]
usageMM _ _ = panic "X86.RegInfo.usageMM: no match"
-- 3 operand form; first operand Read; second Modified; third Modified
usageRMM :: Operand -> Operand -> Operand -> RegUsage
usageRMM (OpReg src) (OpReg dst) (OpReg reg) = mkRU [src, dst, reg] [dst, reg]
usageRMM (OpReg src) (OpAddr ea) (OpReg reg) = mkRU (use_EA ea [src, reg]) [reg]
usageRMM _ _ _ = panic "X86.RegInfo.usageRMM: no match"
-- 1 operand form; operand Modified
usageM :: Operand -> RegUsage
usageM (OpReg reg) = mkRU [reg] [reg]
usageM (OpAddr ea) = mkRUR (use_EA ea [])
usageM _ = panic "X86.RegInfo.usageM: no match"
-- Registers defd when an operand is written.
def_W (OpReg reg) = [reg]
def_W (OpAddr _ ) = []
def_W _ = panic "X86.RegInfo.def_W: no match"
-- Registers used when an operand is read.
use_R (OpReg reg) tl = reg : tl
use_R (OpImm _) tl = tl
use_R (OpAddr ea) tl = use_EA ea tl
-- Registers used to compute an effective address.
use_EA (ImmAddr _ _) tl = tl
use_EA (AddrBaseIndex base index _) tl =
use_base base $! use_index index tl
where use_base (EABaseReg r) tl = r : tl
use_base _ tl = tl
use_index EAIndexNone tl = tl
use_index (EAIndex i _) tl = i : tl
mkRUR src = src' `seq` RU src' []
where src' = filter (interesting platform) src
mkRU src dst = src' `seq` dst' `seq` RU src' dst'
where src' = filter (interesting platform) src
dst' = filter (interesting platform) dst
-- | Is this register interesting for the register allocator? | 7,040 | x86_regUsageOfInstr :: Platform -> Instr -> RegUsage
x86_regUsageOfInstr platform instr
= case instr of
MOV _ src dst -> usageRW src dst
CMOV _ _ src dst -> mkRU (use_R src [dst]) [dst]
MOVZxL _ src dst -> usageRW src dst
MOVSxL _ src dst -> usageRW src dst
LEA _ src dst -> usageRW src dst
ADD _ src dst -> usageRM src dst
ADC _ src dst -> usageRM src dst
SUB _ src dst -> usageRM src dst
IMUL _ src dst -> usageRM src dst
IMUL2 _ src -> mkRU (eax:use_R src []) [eax,edx]
MUL _ src dst -> usageRM src dst
MUL2 _ src -> mkRU (eax:use_R src []) [eax,edx]
DIV _ op -> mkRU (eax:edx:use_R op []) [eax,edx]
IDIV _ op -> mkRU (eax:edx:use_R op []) [eax,edx]
ADD_CC _ src dst -> usageRM src dst
SUB_CC _ src dst -> usageRM src dst
AND _ src dst -> usageRM src dst
OR _ src dst -> usageRM src dst
XOR _ (OpReg src) (OpReg dst)
| src == dst -> mkRU [] [dst]
XOR _ src dst -> usageRM src dst
NOT _ op -> usageM op
BSWAP _ reg -> mkRU [reg] [reg]
NEGI _ op -> usageM op
SHL _ imm dst -> usageRM imm dst
SAR _ imm dst -> usageRM imm dst
SHR _ imm dst -> usageRM imm dst
BT _ _ src -> mkRUR (use_R src [])
PUSH _ op -> mkRUR (use_R op [])
POP _ op -> mkRU [] (def_W op)
TEST _ src dst -> mkRUR (use_R src $! use_R dst [])
CMP _ src dst -> mkRUR (use_R src $! use_R dst [])
SETCC _ op -> mkRU [] (def_W op)
JXX _ _ -> mkRU [] []
JXX_GBL _ _ -> mkRU [] []
JMP op regs -> mkRUR (use_R op regs)
JMP_TBL op _ _ _ -> mkRUR (use_R op [])
CALL (Left _) params -> mkRU params (callClobberedRegs platform)
CALL (Right reg) params -> mkRU (reg:params) (callClobberedRegs platform)
CLTD _ -> mkRU [eax] [edx]
NOP -> mkRU [] []
GMOV src dst -> mkRU [src] [dst]
GLD _ src dst -> mkRU (use_EA src []) [dst]
GST _ src dst -> mkRUR (src : use_EA dst [])
GLDZ dst -> mkRU [] [dst]
GLD1 dst -> mkRU [] [dst]
GFTOI src dst -> mkRU [src] [dst]
GDTOI src dst -> mkRU [src] [dst]
GITOF src dst -> mkRU [src] [dst]
GITOD src dst -> mkRU [src] [dst]
GDTOF src dst -> mkRU [src] [dst]
GADD _ s1 s2 dst -> mkRU [s1,s2] [dst]
GSUB _ s1 s2 dst -> mkRU [s1,s2] [dst]
GMUL _ s1 s2 dst -> mkRU [s1,s2] [dst]
GDIV _ s1 s2 dst -> mkRU [s1,s2] [dst]
GCMP _ src1 src2 -> mkRUR [src1,src2]
GABS _ src dst -> mkRU [src] [dst]
GNEG _ src dst -> mkRU [src] [dst]
GSQRT _ src dst -> mkRU [src] [dst]
GSIN _ _ _ src dst -> mkRU [src] [dst]
GCOS _ _ _ src dst -> mkRU [src] [dst]
GTAN _ _ _ src dst -> mkRU [src] [dst]
CVTSS2SD src dst -> mkRU [src] [dst]
CVTSD2SS src dst -> mkRU [src] [dst]
CVTTSS2SIQ _ src dst -> mkRU (use_R src []) [dst]
CVTTSD2SIQ _ src dst -> mkRU (use_R src []) [dst]
CVTSI2SS _ src dst -> mkRU (use_R src []) [dst]
CVTSI2SD _ src dst -> mkRU (use_R src []) [dst]
FDIV _ src dst -> usageRM src dst
FETCHGOT reg -> mkRU [] [reg]
FETCHPC reg -> mkRU [] [reg]
COMMENT _ -> noUsage
DELTA _ -> noUsage
POPCNT _ src dst -> mkRU (use_R src []) [dst]
BSF _ src dst -> mkRU (use_R src []) [dst]
BSR _ src dst -> mkRU (use_R src []) [dst]
-- note: might be a better way to do this
PREFETCH _ _ src -> mkRU (use_R src []) []
LOCK i -> x86_regUsageOfInstr platform i
XADD _ src dst -> usageMM src dst
CMPXCHG _ src dst -> usageRMM src dst (OpReg eax)
MFENCE -> noUsage
_other -> panic "regUsage: unrecognised instr"
where
-- # Definitions
--
-- Written: If the operand is a register, it's written. If it's an
-- address, registers mentioned in the address are read.
--
-- Modified: If the operand is a register, it's both read and
-- written. If it's an address, registers mentioned in the address
-- are read.
-- 2 operand form; first operand Read; second Written
usageRW :: Operand -> Operand -> RegUsage
usageRW op (OpReg reg) = mkRU (use_R op []) [reg]
usageRW op (OpAddr ea) = mkRUR (use_R op $! use_EA ea [])
usageRW _ _ = panic "X86.RegInfo.usageRW: no match"
-- 2 operand form; first operand Read; second Modified
usageRM :: Operand -> Operand -> RegUsage
usageRM op (OpReg reg) = mkRU (use_R op [reg]) [reg]
usageRM op (OpAddr ea) = mkRUR (use_R op $! use_EA ea [])
usageRM _ _ = panic "X86.RegInfo.usageRM: no match"
-- 2 operand form; first operand Modified; second Modified
usageMM :: Operand -> Operand -> RegUsage
usageMM (OpReg src) (OpReg dst) = mkRU [src, dst] [src, dst]
usageMM (OpReg src) (OpAddr ea) = mkRU (use_EA ea [src]) [src]
usageMM _ _ = panic "X86.RegInfo.usageMM: no match"
-- 3 operand form; first operand Read; second Modified; third Modified
usageRMM :: Operand -> Operand -> Operand -> RegUsage
usageRMM (OpReg src) (OpReg dst) (OpReg reg) = mkRU [src, dst, reg] [dst, reg]
usageRMM (OpReg src) (OpAddr ea) (OpReg reg) = mkRU (use_EA ea [src, reg]) [reg]
usageRMM _ _ _ = panic "X86.RegInfo.usageRMM: no match"
-- 1 operand form; operand Modified
usageM :: Operand -> RegUsage
usageM (OpReg reg) = mkRU [reg] [reg]
usageM (OpAddr ea) = mkRUR (use_EA ea [])
usageM _ = panic "X86.RegInfo.usageM: no match"
-- Registers defd when an operand is written.
def_W (OpReg reg) = [reg]
def_W (OpAddr _ ) = []
def_W _ = panic "X86.RegInfo.def_W: no match"
-- Registers used when an operand is read.
use_R (OpReg reg) tl = reg : tl
use_R (OpImm _) tl = tl
use_R (OpAddr ea) tl = use_EA ea tl
-- Registers used to compute an effective address.
use_EA (ImmAddr _ _) tl = tl
use_EA (AddrBaseIndex base index _) tl =
use_base base $! use_index index tl
where use_base (EABaseReg r) tl = r : tl
use_base _ tl = tl
use_index EAIndexNone tl = tl
use_index (EAIndex i _) tl = i : tl
mkRUR src = src' `seq` RU src' []
where src' = filter (interesting platform) src
mkRU src dst = src' `seq` dst' `seq` RU src' dst'
where src' = filter (interesting platform) src
dst' = filter (interesting platform) dst
-- | Is this register interesting for the register allocator? | 6,937 | x86_regUsageOfInstr platform instr
= case instr of
MOV _ src dst -> usageRW src dst
CMOV _ _ src dst -> mkRU (use_R src [dst]) [dst]
MOVZxL _ src dst -> usageRW src dst
MOVSxL _ src dst -> usageRW src dst
LEA _ src dst -> usageRW src dst
ADD _ src dst -> usageRM src dst
ADC _ src dst -> usageRM src dst
SUB _ src dst -> usageRM src dst
IMUL _ src dst -> usageRM src dst
IMUL2 _ src -> mkRU (eax:use_R src []) [eax,edx]
MUL _ src dst -> usageRM src dst
MUL2 _ src -> mkRU (eax:use_R src []) [eax,edx]
DIV _ op -> mkRU (eax:edx:use_R op []) [eax,edx]
IDIV _ op -> mkRU (eax:edx:use_R op []) [eax,edx]
ADD_CC _ src dst -> usageRM src dst
SUB_CC _ src dst -> usageRM src dst
AND _ src dst -> usageRM src dst
OR _ src dst -> usageRM src dst
XOR _ (OpReg src) (OpReg dst)
| src == dst -> mkRU [] [dst]
XOR _ src dst -> usageRM src dst
NOT _ op -> usageM op
BSWAP _ reg -> mkRU [reg] [reg]
NEGI _ op -> usageM op
SHL _ imm dst -> usageRM imm dst
SAR _ imm dst -> usageRM imm dst
SHR _ imm dst -> usageRM imm dst
BT _ _ src -> mkRUR (use_R src [])
PUSH _ op -> mkRUR (use_R op [])
POP _ op -> mkRU [] (def_W op)
TEST _ src dst -> mkRUR (use_R src $! use_R dst [])
CMP _ src dst -> mkRUR (use_R src $! use_R dst [])
SETCC _ op -> mkRU [] (def_W op)
JXX _ _ -> mkRU [] []
JXX_GBL _ _ -> mkRU [] []
JMP op regs -> mkRUR (use_R op regs)
JMP_TBL op _ _ _ -> mkRUR (use_R op [])
CALL (Left _) params -> mkRU params (callClobberedRegs platform)
CALL (Right reg) params -> mkRU (reg:params) (callClobberedRegs platform)
CLTD _ -> mkRU [eax] [edx]
NOP -> mkRU [] []
GMOV src dst -> mkRU [src] [dst]
GLD _ src dst -> mkRU (use_EA src []) [dst]
GST _ src dst -> mkRUR (src : use_EA dst [])
GLDZ dst -> mkRU [] [dst]
GLD1 dst -> mkRU [] [dst]
GFTOI src dst -> mkRU [src] [dst]
GDTOI src dst -> mkRU [src] [dst]
GITOF src dst -> mkRU [src] [dst]
GITOD src dst -> mkRU [src] [dst]
GDTOF src dst -> mkRU [src] [dst]
GADD _ s1 s2 dst -> mkRU [s1,s2] [dst]
GSUB _ s1 s2 dst -> mkRU [s1,s2] [dst]
GMUL _ s1 s2 dst -> mkRU [s1,s2] [dst]
GDIV _ s1 s2 dst -> mkRU [s1,s2] [dst]
GCMP _ src1 src2 -> mkRUR [src1,src2]
GABS _ src dst -> mkRU [src] [dst]
GNEG _ src dst -> mkRU [src] [dst]
GSQRT _ src dst -> mkRU [src] [dst]
GSIN _ _ _ src dst -> mkRU [src] [dst]
GCOS _ _ _ src dst -> mkRU [src] [dst]
GTAN _ _ _ src dst -> mkRU [src] [dst]
CVTSS2SD src dst -> mkRU [src] [dst]
CVTSD2SS src dst -> mkRU [src] [dst]
CVTTSS2SIQ _ src dst -> mkRU (use_R src []) [dst]
CVTTSD2SIQ _ src dst -> mkRU (use_R src []) [dst]
CVTSI2SS _ src dst -> mkRU (use_R src []) [dst]
CVTSI2SD _ src dst -> mkRU (use_R src []) [dst]
FDIV _ src dst -> usageRM src dst
FETCHGOT reg -> mkRU [] [reg]
FETCHPC reg -> mkRU [] [reg]
COMMENT _ -> noUsage
DELTA _ -> noUsage
POPCNT _ src dst -> mkRU (use_R src []) [dst]
BSF _ src dst -> mkRU (use_R src []) [dst]
BSR _ src dst -> mkRU (use_R src []) [dst]
-- note: might be a better way to do this
PREFETCH _ _ src -> mkRU (use_R src []) []
LOCK i -> x86_regUsageOfInstr platform i
XADD _ src dst -> usageMM src dst
CMPXCHG _ src dst -> usageRMM src dst (OpReg eax)
MFENCE -> noUsage
_other -> panic "regUsage: unrecognised instr"
where
-- # Definitions
--
-- Written: If the operand is a register, it's written. If it's an
-- address, registers mentioned in the address are read.
--
-- Modified: If the operand is a register, it's both read and
-- written. If it's an address, registers mentioned in the address
-- are read.
-- 2 operand form; first operand Read; second Written
usageRW :: Operand -> Operand -> RegUsage
usageRW op (OpReg reg) = mkRU (use_R op []) [reg]
usageRW op (OpAddr ea) = mkRUR (use_R op $! use_EA ea [])
usageRW _ _ = panic "X86.RegInfo.usageRW: no match"
-- 2 operand form; first operand Read; second Modified
usageRM :: Operand -> Operand -> RegUsage
usageRM op (OpReg reg) = mkRU (use_R op [reg]) [reg]
usageRM op (OpAddr ea) = mkRUR (use_R op $! use_EA ea [])
usageRM _ _ = panic "X86.RegInfo.usageRM: no match"
-- 2 operand form; first operand Modified; second Modified
usageMM :: Operand -> Operand -> RegUsage
usageMM (OpReg src) (OpReg dst) = mkRU [src, dst] [src, dst]
usageMM (OpReg src) (OpAddr ea) = mkRU (use_EA ea [src]) [src]
usageMM _ _ = panic "X86.RegInfo.usageMM: no match"
-- 3 operand form; first operand Read; second Modified; third Modified
usageRMM :: Operand -> Operand -> Operand -> RegUsage
usageRMM (OpReg src) (OpReg dst) (OpReg reg) = mkRU [src, dst, reg] [dst, reg]
usageRMM (OpReg src) (OpAddr ea) (OpReg reg) = mkRU (use_EA ea [src, reg]) [reg]
usageRMM _ _ _ = panic "X86.RegInfo.usageRMM: no match"
-- 1 operand form; operand Modified
usageM :: Operand -> RegUsage
usageM (OpReg reg) = mkRU [reg] [reg]
usageM (OpAddr ea) = mkRUR (use_EA ea [])
usageM _ = panic "X86.RegInfo.usageM: no match"
-- Registers defd when an operand is written.
def_W (OpReg reg) = [reg]
def_W (OpAddr _ ) = []
def_W _ = panic "X86.RegInfo.def_W: no match"
-- Registers used when an operand is read.
use_R (OpReg reg) tl = reg : tl
use_R (OpImm _) tl = tl
use_R (OpAddr ea) tl = use_EA ea tl
-- Registers used to compute an effective address.
use_EA (ImmAddr _ _) tl = tl
use_EA (AddrBaseIndex base index _) tl =
use_base base $! use_index index tl
where use_base (EABaseReg r) tl = r : tl
use_base _ tl = tl
use_index EAIndexNone tl = tl
use_index (EAIndex i _) tl = i : tl
mkRUR src = src' `seq` RU src' []
where src' = filter (interesting platform) src
mkRU src dst = src' `seq` dst' `seq` RU src' dst'
where src' = filter (interesting platform) src
dst' = filter (interesting platform) dst
-- | Is this register interesting for the register allocator? | 6,884 | true | true | 58 | 12 | 2,449 | 2,763 | 1,356 | 1,407 | null | null |
NCrashed/bitmap | Data/Bitmap/IO.hs | bsd-3-clause | owerlawGammaCorrectionChannel
:: PixelComponent t
=> Float -- ^ gamma
-> IOBitmap t -- ^ source image
-> Int -- ^ source channel index
-> Maybe Alignment -- ^ target image alignment
-> IO (IOBitmap t)
powerlawGammaCorrectionChannel gamma bm1 ofs1 malign = do
let nchn1 = bitmapNChannels bm1
siz1 = bitmapSize bm1
when (ofs1<0 || ofs1>=nchn1) $ error "bitmap/powerlawGammaCorrectionChannel: invalid channel index"
bm2 <- newIOBitmapUninitialized siz1 1 malign
powerlawGammaCorrectionChannelInto gamma bm1 ofs1 bm2 0
return bm2
| 587 | powerlawGammaCorrectionChannel
:: PixelComponent t
=> Float -- ^ gamma
-> IOBitmap t -- ^ source image
-> Int -- ^ source channel index
-> Maybe Alignment -- ^ target image alignment
-> IO (IOBitmap t)
powerlawGammaCorrectionChannel gamma bm1 ofs1 malign = do
let nchn1 = bitmapNChannels bm1
siz1 = bitmapSize bm1
when (ofs1<0 || ofs1>=nchn1) $ error "bitmap/powerlawGammaCorrectionChannel: invalid channel index"
bm2 <- newIOBitmapUninitialized siz1 1 malign
powerlawGammaCorrectionChannelInto gamma bm1 ofs1 bm2 0
return bm2 | 584 | powerlawGammaCorrectionChannel gamma bm1 ofs1 malign = do
let nchn1 = bitmapNChannels bm1
siz1 = bitmapSize bm1
when (ofs1<0 || ofs1>=nchn1) $ error "bitmap/powerlawGammaCorrectionChannel: invalid channel index"
bm2 <- newIOBitmapUninitialized siz1 1 malign
powerlawGammaCorrectionChannelInto gamma bm1 ofs1 bm2 0
return bm2 | 341 | false | true | 0 | 13 | 136 | 148 | 68 | 80 | null | null |
silkapp/xmlhtml | src/Text/XmlHtml/Cursor.hs | bsd-3-clause | ------------------------------------------------------------------------------
-- | Navigates a 'Cursor' to its parent in the document.
parent :: Cursor -> Maybe Cursor
parent c@(Cursor _ _ _ ((ls,t,rs):ps))
= Just (Cursor (fromTag t (siblings c)) ls rs ps) | 269 | parent :: Cursor -> Maybe Cursor
parent c@(Cursor _ _ _ ((ls,t,rs):ps))
= Just (Cursor (fromTag t (siblings c)) ls rs ps) | 133 | parent c@(Cursor _ _ _ ((ls,t,rs):ps))
= Just (Cursor (fromTag t (siblings c)) ls rs ps) | 100 | true | true | 0 | 11 | 45 | 83 | 44 | 39 | null | null |
nevrenato/Hets_Fork | OMDoc/ATC_OMDoc.hs | gpl-2.0 | _tcCMPTc :: TyCon
_tcCMPTc = mkTyCon "OMDoc.OMDocInterface.CMP" | 63 | _tcCMPTc :: TyCon
_tcCMPTc = mkTyCon "OMDoc.OMDocInterface.CMP" | 63 | _tcCMPTc = mkTyCon "OMDoc.OMDocInterface.CMP" | 45 | false | true | 0 | 6 | 6 | 21 | 8 | 13 | null | null |
willdonnelly/pastel | Graphics/Pastel/Common/Colors.hs | bsd-3-clause | darkGreen = RGB 0x00 0x88 0x00 | 32 | darkGreen = RGB 0x00 0x88 0x00 | 32 | darkGreen = RGB 0x00 0x88 0x00 | 32 | false | false | 0 | 5 | 7 | 13 | 6 | 7 | null | null |
spechub/Hets | CASL/CCC/FreeTypes.hs | gpl-2.0 | checkPos :: FORMULA f -> Bool
checkPos f = case f of
Quantification _ _ f' _ -> checkPos f'
Junction _ cs _ -> all checkPos cs
Relation i1 c i2 _ -> let
c1 = checkPos i1
c2 = checkPos i2
in if c == Equivalence then c1 == c2 else c1 <= c2
Negation n _ -> not $ checkPos n
Atom b _ -> b
Predication {} -> True
Membership {} -> True
Definedness {} -> True
Equation {} -> True
Sort_gen_ax cs _ -> case cs of
[c] -> case opSymbs c of
[_] -> True
{- just a single constructor creates a unique value
even for multiple one-point components -}
_ -> False
_ -> False
_ -> False | 717 | checkPos :: FORMULA f -> Bool
checkPos f = case f of
Quantification _ _ f' _ -> checkPos f'
Junction _ cs _ -> all checkPos cs
Relation i1 c i2 _ -> let
c1 = checkPos i1
c2 = checkPos i2
in if c == Equivalence then c1 == c2 else c1 <= c2
Negation n _ -> not $ checkPos n
Atom b _ -> b
Predication {} -> True
Membership {} -> True
Definedness {} -> True
Equation {} -> True
Sort_gen_ax cs _ -> case cs of
[c] -> case opSymbs c of
[_] -> True
{- just a single constructor creates a unique value
even for multiple one-point components -}
_ -> False
_ -> False
_ -> False | 717 | checkPos f = case f of
Quantification _ _ f' _ -> checkPos f'
Junction _ cs _ -> all checkPos cs
Relation i1 c i2 _ -> let
c1 = checkPos i1
c2 = checkPos i2
in if c == Equivalence then c1 == c2 else c1 <= c2
Negation n _ -> not $ checkPos n
Atom b _ -> b
Predication {} -> True
Membership {} -> True
Definedness {} -> True
Equation {} -> True
Sort_gen_ax cs _ -> case cs of
[c] -> case opSymbs c of
[_] -> True
{- just a single constructor creates a unique value
even for multiple one-point components -}
_ -> False
_ -> False
_ -> False | 687 | false | true | 0 | 14 | 274 | 246 | 119 | 127 | null | null |
elben/typing-haskell-in-haskell | StaticPrelude.hs | bsd-3-clause | isDenormalizedMfun
= "isDenormalized" :>: (Forall [Star]
([isIn1 cRealFloat (TGen 0)] :=>
(TGen 0 `fn` tBool))) | 169 | isDenormalizedMfun
= "isDenormalized" :>: (Forall [Star]
([isIn1 cRealFloat (TGen 0)] :=>
(TGen 0 `fn` tBool))) | 169 | isDenormalizedMfun
= "isDenormalized" :>: (Forall [Star]
([isIn1 cRealFloat (TGen 0)] :=>
(TGen 0 `fn` tBool))) | 169 | false | false | 1 | 14 | 72 | 58 | 29 | 29 | null | null |
ezyang/ghc | testsuite/tests/numeric/should_run/arith003.hs | bsd-3-clause | non_max_operands = small_operands ++ [ fromIntegral minInt ] | 60 | non_max_operands = small_operands ++ [ fromIntegral minInt ] | 60 | non_max_operands = small_operands ++ [ fromIntegral minInt ] | 60 | false | false | 3 | 7 | 7 | 21 | 8 | 13 | null | null |
dahlia/nirum | src/Nirum/Constructs/DeclarationSet.hs | gpl-3.0 | lookup' :: Declaration a => Identifier -> DeclarationSet a -> Maybe a
lookup' facialName' (DeclarationSet declarations' _) =
M.lookup facialName' declarations' | 163 | lookup' :: Declaration a => Identifier -> DeclarationSet a -> Maybe a
lookup' facialName' (DeclarationSet declarations' _) =
M.lookup facialName' declarations' | 163 | lookup' facialName' (DeclarationSet declarations' _) =
M.lookup facialName' declarations' | 93 | false | true | 0 | 8 | 24 | 57 | 25 | 32 | null | null |
ekmett/containers | tests/map-properties.hs | bsd-3-clause | prop_findMax :: [(Int, Int)] -> Property
prop_findMax ys = length ys > 0 ==>
let xs = List.nubBy ((==) `on` fst) ys
m = fromList xs
in findMax m == List.maximumBy (comparing fst) xs | 193 | prop_findMax :: [(Int, Int)] -> Property
prop_findMax ys = length ys > 0 ==>
let xs = List.nubBy ((==) `on` fst) ys
m = fromList xs
in findMax m == List.maximumBy (comparing fst) xs | 193 | prop_findMax ys = length ys > 0 ==>
let xs = List.nubBy ((==) `on` fst) ys
m = fromList xs
in findMax m == List.maximumBy (comparing fst) xs | 152 | false | true | 3 | 12 | 45 | 102 | 51 | 51 | null | null |
blynn/combotrain | 15-sdl.hs | gpl-3.0 | parity [] = 0 | 13 | parity [] = 0 | 13 | parity [] = 0 | 13 | false | false | 1 | 5 | 3 | 15 | 5 | 10 | null | null |
keithodulaigh/Hets | Isabelle/IsaConsts.hs | gpl-2.0 | -- | some constant
conSome :: Term
conSome = conDouble someS | 60 | conSome :: Term
conSome = conDouble someS | 41 | conSome = conDouble someS | 25 | true | true | 0 | 5 | 10 | 15 | 8 | 7 | null | null |
brendanhay/gogol | gogol-sheets/gen/Network/Google/Sheets/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'DeleteDuplicatesRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dComparisonColumns'
--
-- * 'dRange'
deleteDuplicatesRequest
:: DeleteDuplicatesRequest
deleteDuplicatesRequest =
DeleteDuplicatesRequest' {_dComparisonColumns = Nothing, _dRange = Nothing} | 379 | deleteDuplicatesRequest
:: DeleteDuplicatesRequest
deleteDuplicatesRequest =
DeleteDuplicatesRequest' {_dComparisonColumns = Nothing, _dRange = Nothing} | 158 | deleteDuplicatesRequest =
DeleteDuplicatesRequest' {_dComparisonColumns = Nothing, _dRange = Nothing} | 103 | true | true | 0 | 7 | 55 | 42 | 24 | 18 | null | null |
piccolo-lang/piccolo | src/Core/Parser.hs | gpl-3.0 | commaSep1 :: Parser a -> Parser [a]
commaSep1 = Tok.commaSep1 lexer | 67 | commaSep1 :: Parser a -> Parser [a]
commaSep1 = Tok.commaSep1 lexer | 67 | commaSep1 = Tok.commaSep1 lexer | 31 | false | true | 0 | 7 | 10 | 29 | 14 | 15 | null | null |
ivan-m/paraphrase | src/Text/Paraphrase/Types.hs | bsd-3-clause | -- | As with 'get', but require at least @n@ tokens in the input we
-- receive.
getAtLeast :: (ParseInput s) => Int -> Parser e s s
getAtLeast !n = P $ \ pSt fl sc ->
if checkLength n (input pSt)
then sc pSt (input pSt)
else getAtLeast' n pSt fl sc | 271 | getAtLeast :: (ParseInput s) => Int -> Parser e s s
getAtLeast !n = P $ \ pSt fl sc ->
if checkLength n (input pSt)
then sc pSt (input pSt)
else getAtLeast' n pSt fl sc | 189 | getAtLeast !n = P $ \ pSt fl sc ->
if checkLength n (input pSt)
then sc pSt (input pSt)
else getAtLeast' n pSt fl sc | 137 | true | true | 0 | 10 | 76 | 89 | 45 | 44 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.