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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
stackbuilders/persistent-crud | test/Persistent/CRUDSpec.hs | bsd-3-clause | spec :: Spec
spec =
describe "createUser" $
it "returns the created user id" $ do
let email = "foo@bar.com"
firstName = "Foo"
lastName = "Bar"
numberOfUsers <- withDB $ do
createUser email firstName lastName
countUsers
numberOfUsers `shouldBe` (1 :: Int) | 321 | spec :: Spec
spec =
describe "createUser" $
it "returns the created user id" $ do
let email = "foo@bar.com"
firstName = "Foo"
lastName = "Bar"
numberOfUsers <- withDB $ do
createUser email firstName lastName
countUsers
numberOfUsers `shouldBe` (1 :: Int) | 321 | spec =
describe "createUser" $
it "returns the created user id" $ do
let email = "foo@bar.com"
firstName = "Foo"
lastName = "Bar"
numberOfUsers <- withDB $ do
createUser email firstName lastName
countUsers
numberOfUsers `shouldBe` (1 :: Int) | 308 | false | true | 0 | 12 | 107 | 83 | 41 | 42 | null | null |
Baughn/AES | Codec/Crypto/AES/Random.hs | bsd-3-clause | prandBytes :: Int -> IO B.ByteString
prandBytes n = withMVar ctx $ \aesctx -> do
bytes <- crypt aesctx $ B.replicate (((n+15) `div` 16) * 16) 0
return $ B.take n bytes
-- | A random number generator that gets its input from prandBytes,
-- ensuring purity by storing those bytes for later if you don't
-- discard the generator.
--
-- Using split on this generator isn't supported, but could be.
--
-- Please note that if an asynchronous exception is caught while a
-- random number is being generated, the generator will be wrecked
-- forevermore. | 551 | prandBytes :: Int -> IO B.ByteString
prandBytes n = withMVar ctx $ \aesctx -> do
bytes <- crypt aesctx $ B.replicate (((n+15) `div` 16) * 16) 0
return $ B.take n bytes
-- | A random number generator that gets its input from prandBytes,
-- ensuring purity by storing those bytes for later if you don't
-- discard the generator.
--
-- Using split on this generator isn't supported, but could be.
--
-- Please note that if an asynchronous exception is caught while a
-- random number is being generated, the generator will be wrecked
-- forevermore. | 551 | prandBytes n = withMVar ctx $ \aesctx -> do
bytes <- crypt aesctx $ B.replicate (((n+15) `div` 16) * 16) 0
return $ B.take n bytes
-- | A random number generator that gets its input from prandBytes,
-- ensuring purity by storing those bytes for later if you don't
-- discard the generator.
--
-- Using split on this generator isn't supported, but could be.
--
-- Please note that if an asynchronous exception is caught while a
-- random number is being generated, the generator will be wrecked
-- forevermore. | 514 | false | true | 0 | 17 | 102 | 102 | 55 | 47 | null | null |
VictorCMiraldo/mmm | MMM/OOP/OrdVarSet.hs | mit | -- |Looks up a variable in the current state.
vsLookup :: (IsVar id) => id -> VS id -> Maybe Int
vsLookup i = vsCata (M.lookup i) (const $ M.lookup i) | 150 | vsLookup :: (IsVar id) => id -> VS id -> Maybe Int
vsLookup i = vsCata (M.lookup i) (const $ M.lookup i) | 104 | vsLookup i = vsCata (M.lookup i) (const $ M.lookup i) | 53 | true | true | 0 | 9 | 30 | 69 | 32 | 37 | null | null |
jaapweel/piffle | src/PrettyUtil.hs | gpl-2.0 | {- commad is like the built-in tupled, but with a more conventional
layout -}
commad :: [Doc] -> Doc
commad ds =
parens (align (commad' ds))
where commad' [] =
empty
commad' [x] =
x
commad' (x:xs) =
x <> text ", " <//> commad' xs | 303 | commad :: [Doc] -> Doc
commad ds =
parens (align (commad' ds))
where commad' [] =
empty
commad' [x] =
x
commad' (x:xs) =
x <> text ", " <//> commad' xs | 221 | commad ds =
parens (align (commad' ds))
where commad' [] =
empty
commad' [x] =
x
commad' (x:xs) =
x <> text ", " <//> commad' xs | 198 | true | true | 2 | 9 | 119 | 90 | 45 | 45 | null | null |
bartavelle/reflex-dom-bootstrap-components | src/Reflex/Dom/Lists.hs | bsd-3-clause | filterList :: (MonadWidget t m, Monoid f)
=> [a] -- ^ Initial list
-> f -- ^ Initial filter
-> ([a] -> f -> m (Event t f)) -- ^ list elements display, including a filtering signal
-> (f -> a -> Bool) -- ^ filtering function
-> m (Event t [a]) -- ^ the list in its current form
filterList initlist initFilter dispElems filterElem = do
rec let initMap = M.fromList $ zip ([0..] :: [Int]) initlist
filtermap f = M.filter (filterElem f) initMap
filterD <- foldDyn (flip mappend) initFilter filterE
elemMapD <- mapDyn filtermap filterD
foo <- forDyn filterD $ \f -> dispElems (M.elems (filtermap f)) f
filterE <- dyn foo >>= switchPromptly never
return (M.elems <$> updated elemMapD) | 785 | filterList :: (MonadWidget t m, Monoid f)
=> [a] -- ^ Initial list
-> f -- ^ Initial filter
-> ([a] -> f -> m (Event t f)) -- ^ list elements display, including a filtering signal
-> (f -> a -> Bool) -- ^ filtering function
-> m (Event t [a])
filterList initlist initFilter dispElems filterElem = do
rec let initMap = M.fromList $ zip ([0..] :: [Int]) initlist
filtermap f = M.filter (filterElem f) initMap
filterD <- foldDyn (flip mappend) initFilter filterE
elemMapD <- mapDyn filtermap filterD
foo <- forDyn filterD $ \f -> dispElems (M.elems (filtermap f)) f
filterE <- dyn foo >>= switchPromptly never
return (M.elems <$> updated elemMapD) | 751 | filterList initlist initFilter dispElems filterElem = do
rec let initMap = M.fromList $ zip ([0..] :: [Int]) initlist
filtermap f = M.filter (filterElem f) initMap
filterD <- foldDyn (flip mappend) initFilter filterE
elemMapD <- mapDyn filtermap filterD
foo <- forDyn filterD $ \f -> dispElems (M.elems (filtermap f)) f
filterE <- dyn foo >>= switchPromptly never
return (M.elems <$> updated elemMapD) | 453 | true | true | 0 | 16 | 227 | 272 | 135 | 137 | null | null |
MaartenFaddegon/libgraph | Data/Graph/Libgraph/Core.hs | bsd-3-clause | fstElem :: Eq a => a -> [(a, b)] -> Bool
fstElem x = isJust . (lookup x) | 72 | fstElem :: Eq a => a -> [(a, b)] -> Bool
fstElem x = isJust . (lookup x) | 72 | fstElem x = isJust . (lookup x) | 31 | false | true | 0 | 9 | 17 | 48 | 25 | 23 | null | null |
s9gf4ult/yesod | yesod-core/Yesod/Core/Class/Yesod.hs | mit | laxSameSiteSessions :: IO (Maybe SessionBackend) -> IO (Maybe SessionBackend)
laxSameSiteSessions = sameSiteSession sameSiteLax | 127 | laxSameSiteSessions :: IO (Maybe SessionBackend) -> IO (Maybe SessionBackend)
laxSameSiteSessions = sameSiteSession sameSiteLax | 127 | laxSameSiteSessions = sameSiteSession sameSiteLax | 49 | false | true | 2 | 6 | 12 | 30 | 15 | 15 | null | null |
shlevy/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | -- GHC.Natural types
naturalTyConName :: Name
naturalTyConName = tcQual gHC_NATURAL (fsLit "Natural") naturalTyConKey | 121 | naturalTyConName :: Name
naturalTyConName = tcQual gHC_NATURAL (fsLit "Natural") naturalTyConKey | 100 | naturalTyConName = tcQual gHC_NATURAL (fsLit "Natural") naturalTyConKey | 75 | true | true | 0 | 7 | 16 | 25 | 13 | 12 | null | null |
piyush-kurur/sample-code | haskell/TryGen.hs | unlicense | field :: Text -> RecParser Text
field k = RecParser action
where matcher = (==k) . fst
action kvs = case suf of
[] -> Nothing
((_,v):rest) -> Just (v, pre ++ rest)
where (pre,suf) = break matcher kvs
---------------------- Value instance for some basic types ------------------------- | 341 | field :: Text -> RecParser Text
field k = RecParser action
where matcher = (==k) . fst
action kvs = case suf of
[] -> Nothing
((_,v):rest) -> Just (v, pre ++ rest)
where (pre,suf) = break matcher kvs
---------------------- Value instance for some basic types ------------------------- | 341 | field k = RecParser action
where matcher = (==k) . fst
action kvs = case suf of
[] -> Nothing
((_,v):rest) -> Just (v, pre ++ rest)
where (pre,suf) = break matcher kvs
---------------------- Value instance for some basic types ------------------------- | 308 | false | true | 1 | 12 | 103 | 113 | 59 | 54 | null | null |
databrary/databrary | src/Controller/Register.hs | agpl-3.0 | postPasswordReset :: ActionRoute API
postPasswordReset = action POST (pathAPI </< "user" </< "password") postPasswordResetAction | 128 | postPasswordReset :: ActionRoute API
postPasswordReset = action POST (pathAPI </< "user" </< "password") postPasswordResetAction | 128 | postPasswordReset = action POST (pathAPI </< "user" </< "password") postPasswordResetAction | 91 | false | true | 0 | 8 | 13 | 32 | 16 | 16 | null | null |
jdavidberger/project-euler | prob99.hs | lgpl-3.0 | -- | String split in style of python string.split()
split :: String -> String -> [String]
split tok splitme = unfoldr (sp1 tok) splitme
where sp1 _ "" = Nothing
sp1 t s = case find (t `isSuffixOf`) (inits s) of
Nothing -> Just (s, "")
Just p -> Just (take ((length p) - (length t)) p,
drop (length p) s) | 399 | split :: String -> String -> [String]
split tok splitme = unfoldr (sp1 tok) splitme
where sp1 _ "" = Nothing
sp1 t s = case find (t `isSuffixOf`) (inits s) of
Nothing -> Just (s, "")
Just p -> Just (take ((length p) - (length t)) p,
drop (length p) s) | 347 | split tok splitme = unfoldr (sp1 tok) splitme
where sp1 _ "" = Nothing
sp1 t s = case find (t `isSuffixOf`) (inits s) of
Nothing -> Just (s, "")
Just p -> Just (take ((length p) - (length t)) p,
drop (length p) s) | 309 | true | true | 2 | 14 | 156 | 162 | 78 | 84 | null | null |
MedeaMelana/JsonGrammar2 | src/Language/JsonGrammar/Grammar.hs | bsd-3-clause | -- | Mark a grammar to be of a specific TypeScript type. This doesn't affect the JSON conversion, but when generating TypeScript 'interfaces' a coercion causes the interface generator to stop looking at the underlying grammar and just use the specified TypeScript 'Type' as inferred type instead.
--
-- This is useful if you write a grammar that, for example, wraps a primitive type like string (in which case you would specify @'Predefined' 'StringType'@ as type). Another use is when you find the generated interface can't be described by a 'Grammar', for example because it uses a generic type parameter.
coerce :: Type -> Grammar 'Val t1 t2 -> Grammar 'Val t1 t2
coerce = Coerce | 682 | coerce :: Type -> Grammar 'Val t1 t2 -> Grammar 'Val t1 t2
coerce = Coerce | 74 | coerce = Coerce | 15 | true | true | 0 | 8 | 115 | 40 | 21 | 19 | null | null |
facebookincubator/duckling | Duckling/Volume/RU/Rules.hs | bsd-3-clause | ruleHalfLiter :: Rule
ruleHalfLiter = Rule
{ name = "half liter"
, pattern =
[ regex "поллитра"
]
, prod = \_ -> Just . Token Volume . withUnit TVolume.Litre $ valueOnly 0.5
} | 191 | ruleHalfLiter :: Rule
ruleHalfLiter = Rule
{ name = "half liter"
, pattern =
[ regex "поллитра"
]
, prod = \_ -> Just . Token Volume . withUnit TVolume.Litre $ valueOnly 0.5
} | 191 | ruleHalfLiter = Rule
{ name = "half liter"
, pattern =
[ regex "поллитра"
]
, prod = \_ -> Just . Token Volume . withUnit TVolume.Litre $ valueOnly 0.5
} | 169 | false | true | 0 | 12 | 49 | 75 | 37 | 38 | null | null |
patperry/hs-gsl-random | lib/GSL/Random/Dist.hs | bsd-3-clause | exponentialPInv :: Double -> Double -> Double
exponentialPInv = liftDouble2 gsl_cdf_exponential_Pinv | 100 | exponentialPInv :: Double -> Double -> Double
exponentialPInv = liftDouble2 gsl_cdf_exponential_Pinv | 100 | exponentialPInv = liftDouble2 gsl_cdf_exponential_Pinv | 54 | false | true | 0 | 6 | 10 | 22 | 11 | 11 | null | null |
arirahikkala/straylight-divergence | src/Tile.hs | gpl-3.0 | wallBlocksVision GlassWall = False | 34 | wallBlocksVision GlassWall = False | 34 | wallBlocksVision GlassWall = False | 34 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
shlevy/ghc | compiler/utils/Outputable.hs | bsd-3-clause | -- E.g. "he has one"
speakN 2 = text "two" | 43 | speakN 2 = text "two" | 21 | speakN 2 = text "two" | 21 | true | false | 0 | 5 | 10 | 14 | 6 | 8 | null | null |
aelve/guide | back/src/Guide/Database/Connection.hs | bsd-3-clause | connectionSettings :: Settings
connectionSettings = HC.settings "localhost" 5432 dbUser dbPass dbName | 101 | connectionSettings :: Settings
connectionSettings = HC.settings "localhost" 5432 dbUser dbPass dbName | 101 | connectionSettings = HC.settings "localhost" 5432 dbUser dbPass dbName | 70 | false | true | 0 | 6 | 10 | 24 | 12 | 12 | null | null |
olorin/amazonka | amazonka-ssm/gen/Network/AWS/SSM/CreateDocument.hs | mpl-2.0 | -- | Information about the configuration document.
cdrsDocumentDescription :: Lens' CreateDocumentResponse (Maybe DocumentDescription)
cdrsDocumentDescription = lens _cdrsDocumentDescription (\ s a -> s{_cdrsDocumentDescription = a}) | 233 | cdrsDocumentDescription :: Lens' CreateDocumentResponse (Maybe DocumentDescription)
cdrsDocumentDescription = lens _cdrsDocumentDescription (\ s a -> s{_cdrsDocumentDescription = a}) | 182 | cdrsDocumentDescription = lens _cdrsDocumentDescription (\ s a -> s{_cdrsDocumentDescription = a}) | 98 | true | true | 0 | 9 | 23 | 46 | 25 | 21 | null | null |
PuZZleDucK/Hls | Hcat.hs | gpl-3.0 | main :: IO ()
main = do
term <- setupTermFromEnv
args <- getArgs
let options = processArgs args defaultCat
-- runTermOutput term (termText ("Options: "++(show options)++"\n"))
runTermOutput term (termText (showHelp options))
runTermOutput term (termText (showVersion options))
output <- showOutput options
-- runTermOutput term (termText (output))
return () | 374 | main :: IO ()
main = do
term <- setupTermFromEnv
args <- getArgs
let options = processArgs args defaultCat
-- runTermOutput term (termText ("Options: "++(show options)++"\n"))
runTermOutput term (termText (showHelp options))
runTermOutput term (termText (showVersion options))
output <- showOutput options
-- runTermOutput term (termText (output))
return () | 374 | main = do
term <- setupTermFromEnv
args <- getArgs
let options = processArgs args defaultCat
-- runTermOutput term (termText ("Options: "++(show options)++"\n"))
runTermOutput term (termText (showHelp options))
runTermOutput term (termText (showVersion options))
output <- showOutput options
-- runTermOutput term (termText (output))
return () | 360 | false | true | 0 | 11 | 63 | 104 | 47 | 57 | null | null |
smaccm/capDL-tool | CapDL/PrintModel.hs | bsd-2-clause | prettyNameDecl :: ObjID -> Int-> Doc
prettyNameDecl (n, Nothing) _ = text n <+> equals | 86 | prettyNameDecl :: ObjID -> Int-> Doc
prettyNameDecl (n, Nothing) _ = text n <+> equals | 86 | prettyNameDecl (n, Nothing) _ = text n <+> equals | 49 | false | true | 0 | 6 | 14 | 37 | 19 | 18 | null | null |
ledyba/hs-java | JVM/Common.hs | lgpl-3.0 | toCharList :: B.ByteString -> [Int]
toCharList bstr = map fromIntegral $ B.unpack bstr | 86 | toCharList :: B.ByteString -> [Int]
toCharList bstr = map fromIntegral $ B.unpack bstr | 86 | toCharList bstr = map fromIntegral $ B.unpack bstr | 50 | false | true | 0 | 7 | 12 | 35 | 17 | 18 | null | null |
geekingfrog/project-euler | Problem021.hs | gpl-3.0 | -- sum of proper divisor
d :: Int -> Int
d n = sum $ properDivisors n | 69 | d :: Int -> Int
d n = sum $ properDivisors n | 44 | d n = sum $ properDivisors n | 28 | true | true | 0 | 6 | 16 | 29 | 14 | 15 | null | null |
rkoeninger/GameCom | src/lib/Memory.hs | mit | overflowBit = 6 | 15 | overflowBit = 6 | 15 | overflowBit = 6 | 15 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
ganeti/htools | Ganeti/HTools/IAlloc.hs | gpl-2.0 | formatRVal _ elems =
let (_, _, nodes, _) = head elems
nodes' = map Node.name nodes
in JSArray $ map (JSString . toJSString) nodes' | 147 | formatRVal _ elems =
let (_, _, nodes, _) = head elems
nodes' = map Node.name nodes
in JSArray $ map (JSString . toJSString) nodes' | 147 | formatRVal _ elems =
let (_, _, nodes, _) = head elems
nodes' = map Node.name nodes
in JSArray $ map (JSString . toJSString) nodes' | 147 | false | false | 0 | 10 | 40 | 66 | 33 | 33 | null | null |
sordina/matasano-cryptopals | src/Set1/Challenge_3.hs | mit | encoded = "1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736" | 80 | encoded = "1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736" | 80 | encoded = "1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736" | 80 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
kim/amazonka | amazonka-datapipeline/gen/Network/AWS/DataPipeline/DescribeObjects.hs | mpl-2.0 | -- | Indicates whether there are more results to return.
dorHasMoreResults :: Lens' DescribeObjectsResponse (Maybe Bool)
dorHasMoreResults =
lens _dorHasMoreResults (\s a -> s { _dorHasMoreResults = a }) | 207 | dorHasMoreResults :: Lens' DescribeObjectsResponse (Maybe Bool)
dorHasMoreResults =
lens _dorHasMoreResults (\s a -> s { _dorHasMoreResults = a }) | 150 | dorHasMoreResults =
lens _dorHasMoreResults (\s a -> s { _dorHasMoreResults = a }) | 86 | true | true | 0 | 9 | 32 | 46 | 25 | 21 | null | null |
snoyberg/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | vecElemInjectCast dflags WordVec W16 = Just (mo_WordTo16 dflags) | 66 | vecElemInjectCast dflags WordVec W16 = Just (mo_WordTo16 dflags) | 66 | vecElemInjectCast dflags WordVec W16 = Just (mo_WordTo16 dflags) | 66 | false | false | 0 | 7 | 9 | 22 | 10 | 12 | null | null |
joehillen/aura | src/Aura/Diff.hs | gpl-3.0 | unidiff :: Int -- ^ Number of context lines (typically 3)
-> String -- ^ First header
-> String -- ^ Second header
-> [String] -- ^ First file lines
-> [String] -- ^ Second file lines
-> [String] -- ^ Output lines
unidiff n from to a b =
showUnified from to . hunk n . block $ getGroupedDiff a b | 354 | unidiff :: Int -- ^ Number of context lines (typically 3)
-> String -- ^ First header
-> String -- ^ Second header
-> [String] -- ^ First file lines
-> [String] -- ^ Second file lines
-> [String]
unidiff n from to a b =
showUnified from to . hunk n . block $ getGroupedDiff a b | 335 | unidiff n from to a b =
showUnified from to . hunk n . block $ getGroupedDiff a b | 85 | true | true | 2 | 12 | 120 | 90 | 45 | 45 | null | null |
rvion/lamdu | Lamdu/Eval/Background.hs | gpl-3.0 | aLoadGlobal :: Lens' (Actions pl) (V.GlobalId -> IO (Maybe (Def.Body (V.Val pl))))
aLoadGlobal f Actions{..} = f _aLoadGlobal <&> \_aLoadGlobal -> Actions{..} | 158 | aLoadGlobal :: Lens' (Actions pl) (V.GlobalId -> IO (Maybe (Def.Body (V.Val pl))))
aLoadGlobal f Actions{..} = f _aLoadGlobal <&> \_aLoadGlobal -> Actions{..} | 158 | aLoadGlobal f Actions{..} = f _aLoadGlobal <&> \_aLoadGlobal -> Actions{..} | 75 | false | true | 0 | 15 | 21 | 84 | 42 | 42 | null | null |
brendanhay/gogol | gogol-deploymentmanager/gen/Network/Google/Resource/DeploymentManager/Deployments/List.hs | mpl-2.0 | -- | Upload protocol for media (e.g. \"raw\", \"multipart\").
dlUploadProtocol :: Lens' DeploymentsList (Maybe Text)
dlUploadProtocol
= lens _dlUploadProtocol
(\ s a -> s{_dlUploadProtocol = a}) | 202 | dlUploadProtocol :: Lens' DeploymentsList (Maybe Text)
dlUploadProtocol
= lens _dlUploadProtocol
(\ s a -> s{_dlUploadProtocol = a}) | 140 | dlUploadProtocol
= lens _dlUploadProtocol
(\ s a -> s{_dlUploadProtocol = a}) | 85 | true | true | 0 | 9 | 33 | 46 | 25 | 21 | null | null |
tripattern/haskell | convexHull/src/Main.hs | mit | main :: IO ()
main = putStrLn "Please run the tests to see the algorithms in action!" | 85 | main :: IO ()
main = putStrLn "Please run the tests to see the algorithms in action!" | 85 | main = putStrLn "Please run the tests to see the algorithms in action!" | 71 | false | true | 1 | 6 | 16 | 22 | 9 | 13 | null | null |
brendanhay/gogol | gogol-dlp/gen/Network/Google/Resource/DLP/Projects/Content/Inspect.hs | mpl-2.0 | -- | Upload protocol for media (e.g. \"raw\", \"multipart\").
pciUploadProtocol :: Lens' ProjectsContentInspect (Maybe Text)
pciUploadProtocol
= lens _pciUploadProtocol
(\ s a -> s{_pciUploadProtocol = a}) | 213 | pciUploadProtocol :: Lens' ProjectsContentInspect (Maybe Text)
pciUploadProtocol
= lens _pciUploadProtocol
(\ s a -> s{_pciUploadProtocol = a}) | 151 | pciUploadProtocol
= lens _pciUploadProtocol
(\ s a -> s{_pciUploadProtocol = a}) | 88 | true | true | 2 | 9 | 33 | 55 | 25 | 30 | null | null |
madelgi/linear | src/Algebra/Polynomial/Parser.hs | mit | pMultT = commBinOp "*" (:*:) | 30 | pMultT = commBinOp "*" (:*:) | 30 | pMultT = commBinOp "*" (:*:) | 30 | false | false | 0 | 5 | 6 | 13 | 7 | 6 | null | null |
spinda/liquidhaskell | tests/gsoc15/unknown/pos/Infinity.hs | bsd-3-clause | bar = tail $ tail inf | 21 | bar = tail $ tail inf | 21 | bar = tail $ tail inf | 21 | false | false | 0 | 6 | 5 | 13 | 6 | 7 | null | null |
apyrgio/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | jqtExec :: String
jqtExec = "exec" | 34 | jqtExec :: String
jqtExec = "exec" | 34 | jqtExec = "exec" | 16 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
adinapoli/hspec-expectations | src/Test/Hspec/Expectations/Contrib.hs | mit | isRight (Right _) = True | 24 | isRight (Right _) = True | 24 | isRight (Right _) = True | 24 | false | false | 0 | 6 | 4 | 16 | 7 | 9 | null | null |
pparkkin/eta | compiler/ETA/HsSyn/HsExpr.hs | bsd-3-clause | pprDo ListComp stmts = brackets $ pprComp stmts | 55 | pprDo ListComp stmts = brackets $ pprComp stmts | 55 | pprDo ListComp stmts = brackets $ pprComp stmts | 55 | false | false | 0 | 6 | 15 | 18 | 8 | 10 | null | null |
sashabu/libcspm | src/CSPM/Syntax/DataTypeAnalyser.hs | bsd-3-clause | -- | The set of prelude names that include all values of their type.
builtinCompleteDataTypeSets :: [Name]
builtinCompleteDataTypeSets = map builtInName [
"Bool",
"Char",
"Events",
"Int",
"Proc"
] | 240 | builtinCompleteDataTypeSets :: [Name]
builtinCompleteDataTypeSets = map builtInName [
"Bool",
"Char",
"Events",
"Int",
"Proc"
] | 171 | builtinCompleteDataTypeSets = map builtInName [
"Bool",
"Char",
"Events",
"Int",
"Proc"
] | 133 | true | true | 0 | 6 | 71 | 35 | 21 | 14 | null | null |
gibiansky/hlint | data/Default.hs | bsd-3-clause | error = snd (runState x y) ==> execState x y where _ = noQuickCheck
-- MONAD LIST | 82 | error = snd (runState x y) ==> execState x y where _ = noQuickCheck
-- MONAD LIST | 82 | error = snd (runState x y) ==> execState x y where _ = noQuickCheck
-- MONAD LIST | 82 | false | false | 2 | 6 | 17 | 35 | 15 | 20 | null | null |
facebook/fbthrift | thrift/compiler/test/fixtures/qualified/gen-hs/Module2_Consts.hs | apache-2.0 | c3 :: Module2_Types.Struct
c3 = Module2_Types.default_Struct{Module2_Types.struct_first = Module0_Types.default_Struct{Module0_Types.struct_first = 101, Module0_Types.struct_second = "module0_str"}, Module2_Types.struct_second = Module1_Types.default_Struct{Module1_Types.struct_first = 201, Module1_Types.struct_second = "module1_str"}} | 337 | c3 :: Module2_Types.Struct
c3 = Module2_Types.default_Struct{Module2_Types.struct_first = Module0_Types.default_Struct{Module0_Types.struct_first = 101, Module0_Types.struct_second = "module0_str"}, Module2_Types.struct_second = Module1_Types.default_Struct{Module1_Types.struct_first = 201, Module1_Types.struct_second = "module1_str"}} | 337 | c3 = Module2_Types.default_Struct{Module2_Types.struct_first = Module0_Types.default_Struct{Module0_Types.struct_first = 101, Module0_Types.struct_second = "module0_str"}, Module2_Types.struct_second = Module1_Types.default_Struct{Module1_Types.struct_first = 201, Module1_Types.struct_second = "module1_str"}} | 310 | false | true | 0 | 9 | 20 | 80 | 44 | 36 | null | null |
konn/random-effin | Control/Effect/Random.hs | bsd-3-clause | -- | Return an infinite stream of random values of type a. See 'randoms' for details.
--
-- Since 0.1.0.0
getRandoms :: forall a g l. (Random a, EffectRandom g l) => Effect l [a]
getRandoms = send $ Rand $ \(g :: g) ->
first randoms $ split g | 244 | getRandoms :: forall a g l. (Random a, EffectRandom g l) => Effect l [a]
getRandoms = send $ Rand $ \(g :: g) ->
first randoms $ split g | 138 | getRandoms = send $ Rand $ \(g :: g) ->
first randoms $ split g | 65 | true | true | 0 | 8 | 51 | 76 | 42 | 34 | null | null |
hpacheco/HAAP | examples/plab/svn/2017li1g186/src/BotHugo186.hs | mit | cosDegrees th = cos (radians th) | 32 | cosDegrees th = cos (radians th) | 32 | cosDegrees th = cos (radians th) | 32 | false | false | 0 | 7 | 5 | 18 | 8 | 10 | null | null |
prannayk/conj | Learning/capslocker.hs | gpl-3.0 | main = do
appendFile "one.txt" ("c\n")
interact $ unlines. filter ((<10). length). lines | 92 | main = do
appendFile "one.txt" ("c\n")
interact $ unlines. filter ((<10). length). lines | 92 | main = do
appendFile "one.txt" ("c\n")
interact $ unlines. filter ((<10). length). lines | 92 | false | false | 1 | 12 | 16 | 50 | 23 | 27 | null | null |
yesodweb/shakespeare | Text/Hamlet.hs | mit | varName :: Scope -> String -> Exp
varName _ "" = error "Illegal empty varName" | 78 | varName :: Scope -> String -> Exp
varName _ "" = error "Illegal empty varName" | 78 | varName _ "" = error "Illegal empty varName" | 44 | false | true | 0 | 8 | 14 | 33 | 14 | 19 | null | null |
janschulz/pandoc | src/Text/Pandoc/Readers/Docx/Parse.hs | gpl-2.0 | archiveToMedia :: Archive -> Media
archiveToMedia zf =
mapMaybe (getMediaPair zf) (filter filePathIsMedia (filesInArchive zf)) | 128 | archiveToMedia :: Archive -> Media
archiveToMedia zf =
mapMaybe (getMediaPair zf) (filter filePathIsMedia (filesInArchive zf)) | 128 | archiveToMedia zf =
mapMaybe (getMediaPair zf) (filter filePathIsMedia (filesInArchive zf)) | 93 | false | true | 0 | 9 | 16 | 43 | 21 | 22 | null | null |
ndmitchell/shake | src/Development/Shake/Internal/Rules/Directory.hs | bsd-3-clause | -- | Get the directories in a directory, not including @.@ or @..@.
-- All directories are relative to the argument directory.
-- The result itself is tracked as a dependency, but the directories in the result are not.
-- If the list of directories changes in subsequent builds any rule calling it will rerun.
-- The rules about creating entries described in 'getDirectoryFiles' also apply here.
--
-- > getDirectoryDirs "/Users"
-- > -- Return all directories in the /Users directory
-- > -- e.g. ["Emily","Henry","Neil"]
getDirectoryDirs :: FilePath -> Action [FilePath]
getDirectoryDirs = fmap fromGetDirectoryA . apply1 . GetDirectoryDirsQ | 658 | getDirectoryDirs :: FilePath -> Action [FilePath]
getDirectoryDirs = fmap fromGetDirectoryA . apply1 . GetDirectoryDirsQ | 120 | getDirectoryDirs = fmap fromGetDirectoryA . apply1 . GetDirectoryDirsQ | 70 | true | true | 0 | 7 | 115 | 41 | 25 | 16 | null | null |
oldmanmike/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | -- PrelTup
fstName, sndName :: Name
fstName = varQual dATA_TUPLE (fsLit "fst") fstIdKey | 97 | fstName, sndName :: Name
fstName = varQual dATA_TUPLE (fsLit "fst") fstIdKey | 86 | fstName = varQual dATA_TUPLE (fsLit "fst") fstIdKey | 61 | true | true | 0 | 7 | 22 | 27 | 15 | 12 | null | null |
szbokhar/genetic-boxes | GL/Draw.hs | gpl-2.0 | -- |Function that draws a line between two points
drawLine :: (Num a, VertexComponent a) => Point a -> Point a -> IO ()
drawLine p1 p2 = renderPrimitive Lines
$ mapM_ (\(x,y) -> vertex $ Vertex3 x y 0 )
$ lineV p1 p2 | 224 | drawLine :: (Num a, VertexComponent a) => Point a -> Point a -> IO ()
drawLine p1 p2 = renderPrimitive Lines
$ mapM_ (\(x,y) -> vertex $ Vertex3 x y 0 )
$ lineV p1 p2 | 174 | drawLine p1 p2 = renderPrimitive Lines
$ mapM_ (\(x,y) -> vertex $ Vertex3 x y 0 )
$ lineV p1 p2 | 104 | true | true | 4 | 10 | 52 | 103 | 48 | 55 | null | null |
seereason/stringsearch | Data/ByteString/Search/Internal/BoyerMoore.hs | bsd-3-clause | strictSplitKeepEnd pat = splitter
where
!patLen = S.length pat
searcher = strictSearcher False pat
splitter str
| S.null str = []
| otherwise =
case searcher str of
[] -> [str]
(i:_) -> S.take (i + patLen) str :
splitter (S.drop (i + patLen) str) | 341 | strictSplitKeepEnd pat = splitter
where
!patLen = S.length pat
searcher = strictSearcher False pat
splitter str
| S.null str = []
| otherwise =
case searcher str of
[] -> [str]
(i:_) -> S.take (i + patLen) str :
splitter (S.drop (i + patLen) str) | 341 | strictSplitKeepEnd pat = splitter
where
!patLen = S.length pat
searcher = strictSearcher False pat
splitter str
| S.null str = []
| otherwise =
case searcher str of
[] -> [str]
(i:_) -> S.take (i + patLen) str :
splitter (S.drop (i + patLen) str) | 341 | false | false | 5 | 14 | 139 | 128 | 63 | 65 | null | null |
switchface/helm | examples/flappy/Main.hs | mit | -- | The gravity acceleration for the flapper.
-- Note that the Y component is positive as the downwards
-- direction in our view is the positive end of the Y-axis.
-- The origin (0, 0) is the center of the screen.
gravity :: V2 Double
gravity = V2 0 5 | 252 | gravity :: V2 Double
gravity = V2 0 5 | 37 | gravity = V2 0 5 | 16 | true | true | 1 | 5 | 50 | 26 | 13 | 13 | null | null |
antalsz/hs-to-coq | examples/ghc/gen-files/Lexer.hs | mit | alex_action_70 = special ITcparen | 34 | alex_action_70 = special ITcparen | 34 | alex_action_70 = special ITcparen | 34 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
distillation/language-core | Language/Core/Test/TestSyntax.hs | gpl-3.0 | testRebuildExp = [(LHE.Var (LHE.UnQual (LHE.Ident "v"))) ~=? (rebuildExp (Free "v")),
(LHE.Lambda (LHE.SrcLoc "" 0 0) [LHE.PVar (LHE.Ident "v")] (LHE.Var (LHE.UnQual (LHE.Ident "v")))) ~=? (rebuildExp (Lambda "v" (Bound 0))),
(LHE.Let (LHE.BDecls [LHE.FunBind [LHE.Match (LHE.SrcLoc "" 0 0) (LHE.Ident "v") [] Nothing (LHE.UnGuardedRhs (LHE.Var (LHE.UnQual (LHE.Ident "v'")))) (LHE.BDecls [])]]) (LHE.Var (LHE.UnQual (LHE.Ident "v")))) ~=? (rebuildExp (Let "v" (Free "v'") (Bound 0))),
(LHE.Var (LHE.UnQual (LHE.Ident "funName"))) ~=? (rebuildExp (Fun "funName")),
(LHE.Lit (LHE.Int 0)) ~=? (rebuildExp (Con "Z" [])),
(LHE.Lit (LHE.Int 1)) ~=? (rebuildExp (Con "S" [Con "Z" []])),
(LHE.Lit (LHE.Int 2)) ~=? (rebuildExp (Con "S" [Con "S" [Con "Z" []]])),
(LHE.Lit (LHE.String "a")) ~=? (rebuildExp (Con "StringTransformer" [Con "a" []])),
(LHE.Lit (LHE.String "abc")) ~=? (rebuildExp (Con "StringTransformer" [Con "a" [Con "b" [Con "c" []]]])),
(LHE.Lit (LHE.Char 'c')) ~=? (rebuildExp (Con "CharTransformer" [Con "c" []])),
(LHE.Con (LHE.Special LHE.ListCon)) ~=? (rebuildExp (Con "NilTransformer" [])),
(LHE.Paren (LHE.InfixApp (LHE.Var (LHE.UnQual (LHE.Ident "v"))) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Con (LHE.Special LHE.ListCon)))) ~=? (rebuildExp (Con "ConsTransformer" (Free "v":[]))),
(LHE.Paren (LHE.InfixApp (LHE.Con (LHE.Special LHE.ListCon)) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Con (LHE.Special LHE.ListCon)))) ~=? (rebuildExp (Con "ConsTransformer" (Con "NilTransformer" []:[]))),
(LHE.Paren (LHE.InfixApp (LHE.Var (LHE.UnQual (LHE.Ident "x"))) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Var (LHE.UnQual (LHE.Ident "y"))))) ~=? (rebuildExp (Con "ConsTransformer" [Free "x", Free "y"])),
(LHE.Paren (LHE.InfixApp (LHE.Var (LHE.UnQual (LHE.Ident "x"))) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Paren (LHE.InfixApp (LHE.Var (LHE.UnQual (LHE.Ident "y"))) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Var (LHE.UnQual (LHE.Ident "z"))))))) ~=? (rebuildExp (Con "ConsTransformer" [Free "x", Free "y", Free "z"])),
(LHE.Paren (LHE.InfixApp (LHE.Var (LHE.UnQual (LHE.Ident "x"))) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Paren (LHE.InfixApp (LHE.Var (LHE.UnQual (LHE.Ident "y"))) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Paren (LHE.InfixApp (LHE.Var (LHE.UnQual (LHE.Ident "z"))) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Con (LHE.Special LHE.ListCon)))))))) ~=? (rebuildExp (Con "ConsTransformer" [Free "x", Free "y", Free "z", Con "NilTransformer" []])),
(LHE.App (LHE.App (LHE.Con (LHE.UnQual (LHE.Ident "Just"))) (LHE.Var (LHE.UnQual (LHE.Ident "x")))) (LHE.Var (LHE.UnQual (LHE.Ident "y")))) ~=? (rebuildExp (Con "Just" [Free "x", Free "y"])),
(LHE.InfixApp (LHE.Paren (LHE.Var (LHE.UnQual (LHE.Ident "x")))) (LHE.QVarOp (LHE.UnQual (LHE.Ident "pseq"))) (LHE.Paren (LHE.Var (LHE.UnQual (LHE.Ident "y"))))) ~=? (rebuildExp (Apply (Apply (Fun "pseq") (Free "x")) (Free "y"))),
(LHE.InfixApp (LHE.Paren (LHE.Var (LHE.UnQual (LHE.Ident "x")))) (LHE.QVarOp (LHE.UnQual (LHE.Ident "par"))) (LHE.Paren (LHE.Var (LHE.UnQual (LHE.Ident "y"))))) ~=? (rebuildExp (Apply (Apply (Fun "par") (Free "x")) (Free "y"))),
(LHE.App (LHE.Var (LHE.UnQual (LHE.Ident "x"))) (LHE.Lit (LHE.String "abc"))) ~=? (rebuildExp (Apply (Free "x") (Con "StringTransformer" [Con "a" [Con "b" [Con "c" []]]]))),
(LHE.Case (LHE.Var (LHE.UnQual (LHE.Ident "x"))) [(makeAlt (LHE.PList []) (LHE.Var (LHE.UnQual (LHE.Ident "v")))), (makeAlt (LHE.PParen (LHE.PInfixApp (LHE.PVar (LHE.Ident "x")) (LHE.Special LHE.Cons) (LHE.PList []))) (LHE.Var (LHE.UnQual (LHE.Ident "x"))))]) ~=? (rebuildExp (Case (Free "x") [Branch "NilTransformer" [] (Free "v"), Branch "ConsTransformer" ["x"] (Bound 0)])),
(LHE.Tuple [(LHE.Var (LHE.UnQual (LHE.Ident "v"))), (LHE.Lit (LHE.Int 2)), (LHE.Lit (LHE.String "abc"))]) ~=? (rebuildExp (Tuple [Free "v", Con "S" [Con "S" [Con "Z" []]], Con "StringTransformer" [Con "a" [Con "b" [Con "c" []]]]])),
(LHE.Let (LHE.BDecls [LHE.PatBind (LHE.SrcLoc "" 0 0) (LHE.PTuple [LHE.PVar (LHE.Ident "x"), LHE.PVar (LHE.Ident "y")]) Nothing (LHE.UnGuardedRhs (LHE.App (LHE.Var (LHE.UnQual (LHE.Ident "f"))) (LHE.Var (LHE.UnQual (LHE.Ident "g"))))) (LHE.BDecls [])]) (LHE.App (LHE.Var (LHE.UnQual (LHE.Ident "y"))) (LHE.Var (LHE.UnQual (LHE.Ident "x"))))) ~=? (rebuildExp (TupleLet ["x", "y"] (Apply (Free "f") (Free "g")) (Apply (Bound 0) (Bound 1))))] | 4,736 | testRebuildExp = [(LHE.Var (LHE.UnQual (LHE.Ident "v"))) ~=? (rebuildExp (Free "v")),
(LHE.Lambda (LHE.SrcLoc "" 0 0) [LHE.PVar (LHE.Ident "v")] (LHE.Var (LHE.UnQual (LHE.Ident "v")))) ~=? (rebuildExp (Lambda "v" (Bound 0))),
(LHE.Let (LHE.BDecls [LHE.FunBind [LHE.Match (LHE.SrcLoc "" 0 0) (LHE.Ident "v") [] Nothing (LHE.UnGuardedRhs (LHE.Var (LHE.UnQual (LHE.Ident "v'")))) (LHE.BDecls [])]]) (LHE.Var (LHE.UnQual (LHE.Ident "v")))) ~=? (rebuildExp (Let "v" (Free "v'") (Bound 0))),
(LHE.Var (LHE.UnQual (LHE.Ident "funName"))) ~=? (rebuildExp (Fun "funName")),
(LHE.Lit (LHE.Int 0)) ~=? (rebuildExp (Con "Z" [])),
(LHE.Lit (LHE.Int 1)) ~=? (rebuildExp (Con "S" [Con "Z" []])),
(LHE.Lit (LHE.Int 2)) ~=? (rebuildExp (Con "S" [Con "S" [Con "Z" []]])),
(LHE.Lit (LHE.String "a")) ~=? (rebuildExp (Con "StringTransformer" [Con "a" []])),
(LHE.Lit (LHE.String "abc")) ~=? (rebuildExp (Con "StringTransformer" [Con "a" [Con "b" [Con "c" []]]])),
(LHE.Lit (LHE.Char 'c')) ~=? (rebuildExp (Con "CharTransformer" [Con "c" []])),
(LHE.Con (LHE.Special LHE.ListCon)) ~=? (rebuildExp (Con "NilTransformer" [])),
(LHE.Paren (LHE.InfixApp (LHE.Var (LHE.UnQual (LHE.Ident "v"))) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Con (LHE.Special LHE.ListCon)))) ~=? (rebuildExp (Con "ConsTransformer" (Free "v":[]))),
(LHE.Paren (LHE.InfixApp (LHE.Con (LHE.Special LHE.ListCon)) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Con (LHE.Special LHE.ListCon)))) ~=? (rebuildExp (Con "ConsTransformer" (Con "NilTransformer" []:[]))),
(LHE.Paren (LHE.InfixApp (LHE.Var (LHE.UnQual (LHE.Ident "x"))) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Var (LHE.UnQual (LHE.Ident "y"))))) ~=? (rebuildExp (Con "ConsTransformer" [Free "x", Free "y"])),
(LHE.Paren (LHE.InfixApp (LHE.Var (LHE.UnQual (LHE.Ident "x"))) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Paren (LHE.InfixApp (LHE.Var (LHE.UnQual (LHE.Ident "y"))) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Var (LHE.UnQual (LHE.Ident "z"))))))) ~=? (rebuildExp (Con "ConsTransformer" [Free "x", Free "y", Free "z"])),
(LHE.Paren (LHE.InfixApp (LHE.Var (LHE.UnQual (LHE.Ident "x"))) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Paren (LHE.InfixApp (LHE.Var (LHE.UnQual (LHE.Ident "y"))) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Paren (LHE.InfixApp (LHE.Var (LHE.UnQual (LHE.Ident "z"))) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Con (LHE.Special LHE.ListCon)))))))) ~=? (rebuildExp (Con "ConsTransformer" [Free "x", Free "y", Free "z", Con "NilTransformer" []])),
(LHE.App (LHE.App (LHE.Con (LHE.UnQual (LHE.Ident "Just"))) (LHE.Var (LHE.UnQual (LHE.Ident "x")))) (LHE.Var (LHE.UnQual (LHE.Ident "y")))) ~=? (rebuildExp (Con "Just" [Free "x", Free "y"])),
(LHE.InfixApp (LHE.Paren (LHE.Var (LHE.UnQual (LHE.Ident "x")))) (LHE.QVarOp (LHE.UnQual (LHE.Ident "pseq"))) (LHE.Paren (LHE.Var (LHE.UnQual (LHE.Ident "y"))))) ~=? (rebuildExp (Apply (Apply (Fun "pseq") (Free "x")) (Free "y"))),
(LHE.InfixApp (LHE.Paren (LHE.Var (LHE.UnQual (LHE.Ident "x")))) (LHE.QVarOp (LHE.UnQual (LHE.Ident "par"))) (LHE.Paren (LHE.Var (LHE.UnQual (LHE.Ident "y"))))) ~=? (rebuildExp (Apply (Apply (Fun "par") (Free "x")) (Free "y"))),
(LHE.App (LHE.Var (LHE.UnQual (LHE.Ident "x"))) (LHE.Lit (LHE.String "abc"))) ~=? (rebuildExp (Apply (Free "x") (Con "StringTransformer" [Con "a" [Con "b" [Con "c" []]]]))),
(LHE.Case (LHE.Var (LHE.UnQual (LHE.Ident "x"))) [(makeAlt (LHE.PList []) (LHE.Var (LHE.UnQual (LHE.Ident "v")))), (makeAlt (LHE.PParen (LHE.PInfixApp (LHE.PVar (LHE.Ident "x")) (LHE.Special LHE.Cons) (LHE.PList []))) (LHE.Var (LHE.UnQual (LHE.Ident "x"))))]) ~=? (rebuildExp (Case (Free "x") [Branch "NilTransformer" [] (Free "v"), Branch "ConsTransformer" ["x"] (Bound 0)])),
(LHE.Tuple [(LHE.Var (LHE.UnQual (LHE.Ident "v"))), (LHE.Lit (LHE.Int 2)), (LHE.Lit (LHE.String "abc"))]) ~=? (rebuildExp (Tuple [Free "v", Con "S" [Con "S" [Con "Z" []]], Con "StringTransformer" [Con "a" [Con "b" [Con "c" []]]]])),
(LHE.Let (LHE.BDecls [LHE.PatBind (LHE.SrcLoc "" 0 0) (LHE.PTuple [LHE.PVar (LHE.Ident "x"), LHE.PVar (LHE.Ident "y")]) Nothing (LHE.UnGuardedRhs (LHE.App (LHE.Var (LHE.UnQual (LHE.Ident "f"))) (LHE.Var (LHE.UnQual (LHE.Ident "g"))))) (LHE.BDecls [])]) (LHE.App (LHE.Var (LHE.UnQual (LHE.Ident "y"))) (LHE.Var (LHE.UnQual (LHE.Ident "x"))))) ~=? (rebuildExp (TupleLet ["x", "y"] (Apply (Free "f") (Free "g")) (Apply (Bound 0) (Bound 1))))] | 4,736 | testRebuildExp = [(LHE.Var (LHE.UnQual (LHE.Ident "v"))) ~=? (rebuildExp (Free "v")),
(LHE.Lambda (LHE.SrcLoc "" 0 0) [LHE.PVar (LHE.Ident "v")] (LHE.Var (LHE.UnQual (LHE.Ident "v")))) ~=? (rebuildExp (Lambda "v" (Bound 0))),
(LHE.Let (LHE.BDecls [LHE.FunBind [LHE.Match (LHE.SrcLoc "" 0 0) (LHE.Ident "v") [] Nothing (LHE.UnGuardedRhs (LHE.Var (LHE.UnQual (LHE.Ident "v'")))) (LHE.BDecls [])]]) (LHE.Var (LHE.UnQual (LHE.Ident "v")))) ~=? (rebuildExp (Let "v" (Free "v'") (Bound 0))),
(LHE.Var (LHE.UnQual (LHE.Ident "funName"))) ~=? (rebuildExp (Fun "funName")),
(LHE.Lit (LHE.Int 0)) ~=? (rebuildExp (Con "Z" [])),
(LHE.Lit (LHE.Int 1)) ~=? (rebuildExp (Con "S" [Con "Z" []])),
(LHE.Lit (LHE.Int 2)) ~=? (rebuildExp (Con "S" [Con "S" [Con "Z" []]])),
(LHE.Lit (LHE.String "a")) ~=? (rebuildExp (Con "StringTransformer" [Con "a" []])),
(LHE.Lit (LHE.String "abc")) ~=? (rebuildExp (Con "StringTransformer" [Con "a" [Con "b" [Con "c" []]]])),
(LHE.Lit (LHE.Char 'c')) ~=? (rebuildExp (Con "CharTransformer" [Con "c" []])),
(LHE.Con (LHE.Special LHE.ListCon)) ~=? (rebuildExp (Con "NilTransformer" [])),
(LHE.Paren (LHE.InfixApp (LHE.Var (LHE.UnQual (LHE.Ident "v"))) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Con (LHE.Special LHE.ListCon)))) ~=? (rebuildExp (Con "ConsTransformer" (Free "v":[]))),
(LHE.Paren (LHE.InfixApp (LHE.Con (LHE.Special LHE.ListCon)) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Con (LHE.Special LHE.ListCon)))) ~=? (rebuildExp (Con "ConsTransformer" (Con "NilTransformer" []:[]))),
(LHE.Paren (LHE.InfixApp (LHE.Var (LHE.UnQual (LHE.Ident "x"))) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Var (LHE.UnQual (LHE.Ident "y"))))) ~=? (rebuildExp (Con "ConsTransformer" [Free "x", Free "y"])),
(LHE.Paren (LHE.InfixApp (LHE.Var (LHE.UnQual (LHE.Ident "x"))) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Paren (LHE.InfixApp (LHE.Var (LHE.UnQual (LHE.Ident "y"))) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Var (LHE.UnQual (LHE.Ident "z"))))))) ~=? (rebuildExp (Con "ConsTransformer" [Free "x", Free "y", Free "z"])),
(LHE.Paren (LHE.InfixApp (LHE.Var (LHE.UnQual (LHE.Ident "x"))) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Paren (LHE.InfixApp (LHE.Var (LHE.UnQual (LHE.Ident "y"))) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Paren (LHE.InfixApp (LHE.Var (LHE.UnQual (LHE.Ident "z"))) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Con (LHE.Special LHE.ListCon)))))))) ~=? (rebuildExp (Con "ConsTransformer" [Free "x", Free "y", Free "z", Con "NilTransformer" []])),
(LHE.App (LHE.App (LHE.Con (LHE.UnQual (LHE.Ident "Just"))) (LHE.Var (LHE.UnQual (LHE.Ident "x")))) (LHE.Var (LHE.UnQual (LHE.Ident "y")))) ~=? (rebuildExp (Con "Just" [Free "x", Free "y"])),
(LHE.InfixApp (LHE.Paren (LHE.Var (LHE.UnQual (LHE.Ident "x")))) (LHE.QVarOp (LHE.UnQual (LHE.Ident "pseq"))) (LHE.Paren (LHE.Var (LHE.UnQual (LHE.Ident "y"))))) ~=? (rebuildExp (Apply (Apply (Fun "pseq") (Free "x")) (Free "y"))),
(LHE.InfixApp (LHE.Paren (LHE.Var (LHE.UnQual (LHE.Ident "x")))) (LHE.QVarOp (LHE.UnQual (LHE.Ident "par"))) (LHE.Paren (LHE.Var (LHE.UnQual (LHE.Ident "y"))))) ~=? (rebuildExp (Apply (Apply (Fun "par") (Free "x")) (Free "y"))),
(LHE.App (LHE.Var (LHE.UnQual (LHE.Ident "x"))) (LHE.Lit (LHE.String "abc"))) ~=? (rebuildExp (Apply (Free "x") (Con "StringTransformer" [Con "a" [Con "b" [Con "c" []]]]))),
(LHE.Case (LHE.Var (LHE.UnQual (LHE.Ident "x"))) [(makeAlt (LHE.PList []) (LHE.Var (LHE.UnQual (LHE.Ident "v")))), (makeAlt (LHE.PParen (LHE.PInfixApp (LHE.PVar (LHE.Ident "x")) (LHE.Special LHE.Cons) (LHE.PList []))) (LHE.Var (LHE.UnQual (LHE.Ident "x"))))]) ~=? (rebuildExp (Case (Free "x") [Branch "NilTransformer" [] (Free "v"), Branch "ConsTransformer" ["x"] (Bound 0)])),
(LHE.Tuple [(LHE.Var (LHE.UnQual (LHE.Ident "v"))), (LHE.Lit (LHE.Int 2)), (LHE.Lit (LHE.String "abc"))]) ~=? (rebuildExp (Tuple [Free "v", Con "S" [Con "S" [Con "Z" []]], Con "StringTransformer" [Con "a" [Con "b" [Con "c" []]]]])),
(LHE.Let (LHE.BDecls [LHE.PatBind (LHE.SrcLoc "" 0 0) (LHE.PTuple [LHE.PVar (LHE.Ident "x"), LHE.PVar (LHE.Ident "y")]) Nothing (LHE.UnGuardedRhs (LHE.App (LHE.Var (LHE.UnQual (LHE.Ident "f"))) (LHE.Var (LHE.UnQual (LHE.Ident "g"))))) (LHE.BDecls [])]) (LHE.App (LHE.Var (LHE.UnQual (LHE.Ident "y"))) (LHE.Var (LHE.UnQual (LHE.Ident "x"))))) ~=? (rebuildExp (TupleLet ["x", "y"] (Apply (Free "f") (Free "g")) (Apply (Bound 0) (Bound 1))))] | 4,736 | false | false | 0 | 25 | 884 | 2,683 | 1,357 | 1,326 | null | null |
dillonhuff/IntLang | src/Syntax.hs | bsd-3-clause | accessors (RecordDef _ fields) = zip fields [0..(length fields - 1)] | 68 | accessors (RecordDef _ fields) = zip fields [0..(length fields - 1)] | 68 | accessors (RecordDef _ fields) = zip fields [0..(length fields - 1)] | 68 | false | false | 0 | 9 | 10 | 37 | 18 | 19 | null | null |
DanielSchuessler/th-build | Language/Haskell/TH/Build/Wrappers.hs | bsd-3-clause | -- | Argument-converting wrapper for 'equalP'.
equalP' :: (Convertible typeQ TypeQ, Convertible typeQ' TypeQ) => typeQ -> typeQ' -> PredQ
equalP' = preconvert2 equalP | 166 | equalP' :: (Convertible typeQ TypeQ, Convertible typeQ' TypeQ) => typeQ -> typeQ' -> PredQ
equalP' = preconvert2 equalP | 119 | equalP' = preconvert2 equalP | 28 | true | true | 0 | 7 | 23 | 42 | 22 | 20 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/Resources/IAMPolicy.hs | mit | -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html#cfn-iam-policy-users
iampUsers :: Lens' IAMPolicy (Maybe (ValList Text))
iampUsers = lens _iAMPolicyUsers (\s a -> s { _iAMPolicyUsers = a }) | 237 | iampUsers :: Lens' IAMPolicy (Maybe (ValList Text))
iampUsers = lens _iAMPolicyUsers (\s a -> s { _iAMPolicyUsers = a }) | 120 | iampUsers = lens _iAMPolicyUsers (\s a -> s { _iAMPolicyUsers = a }) | 68 | true | true | 1 | 9 | 22 | 57 | 28 | 29 | null | null |
olsner/ghc | compiler/deSugar/DsArrows.hs | bsd-3-clause | collectEvBinders :: TcEvBinds -> [Id]
collectEvBinders (EvBinds bs) = foldrBag add_ev_bndr [] bs | 98 | collectEvBinders :: TcEvBinds -> [Id]
collectEvBinders (EvBinds bs) = foldrBag add_ev_bndr [] bs | 98 | collectEvBinders (EvBinds bs) = foldrBag add_ev_bndr [] bs | 60 | false | true | 0 | 7 | 14 | 36 | 18 | 18 | null | null |
hvr/unordered-containers | Data/HashMap/Base.hs | bsd-3-clause | equal (Leaf k1 v1) (Leaf k2 v2) =
k1 == k2 && v1 == v2 | 58 | equal (Leaf k1 v1) (Leaf k2 v2) =
k1 == k2 && v1 == v2 | 58 | equal (Leaf k1 v1) (Leaf k2 v2) =
k1 == k2 && v1 == v2 | 58 | false | false | 0 | 7 | 18 | 39 | 19 | 20 | null | null |
hucal/SCMinHS | Scheme/Eval/DynamicTypes.hs | bsd-3-clause | safeTail _ = Nothing | 20 | safeTail _ = Nothing | 20 | safeTail _ = Nothing | 20 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
lkitching/PScheme | src/PScheme/Eval.hs | bsd-3-clause | cdrFn vs = Left $ ArityError 1 (length vs) | 42 | cdrFn vs = Left $ ArityError 1 (length vs) | 42 | cdrFn vs = Left $ ArityError 1 (length vs) | 42 | false | false | 0 | 8 | 8 | 24 | 11 | 13 | null | null |
mariefarrell/Hets | OWL2/ProveFact.hs | gpl-2.0 | factJarS :: String
factJarS = "OWLFact.jar" | 43 | factJarS :: String
factJarS = "OWLFact.jar" | 43 | factJarS = "OWLFact.jar" | 24 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
mariefarrell/Hets | Maude/Maude2DG.hs | gpl-2.0 | instantiateSortStringAux _ _ _ acc = acc | 40 | instantiateSortStringAux _ _ _ acc = acc | 40 | instantiateSortStringAux _ _ _ acc = acc | 40 | false | false | 0 | 5 | 6 | 15 | 7 | 8 | null | null |
tensorflow/haskell | tensorflow-ops/src/TensorFlow/Gradient.hs | apache-2.0 | opGrad "MatMul" nodeDef [toT -> x, toT -> y] [dz] =
let transposeA = lookupAttr nodeDef "transpose_a"
transposeB = lookupAttr nodeDef "transpose_b"
transAttrs a b =
(opAttr "transpose_a" .~ a) . (opAttr "transpose_b" .~ b)
in case (transposeA, transposeB) of
(False, False) ->
[ Just $ matMul' (transAttrs False True) dz y
, Just $ matMul' (transAttrs True False) x dz]
(False, True) ->
[ Just $ matMul dz y
, Just $ matMul' (transAttrs True False) dz x]
(True, False) ->
[ Just $ matMul' (transAttrs False True) y dz
, Just $ matMul x dz]
(True, True) ->
[ Just $ matMul' (transAttrs True True) y dz
, Just $ matMul' (transAttrs True True) dz x] | 798 | opGrad "MatMul" nodeDef [toT -> x, toT -> y] [dz] =
let transposeA = lookupAttr nodeDef "transpose_a"
transposeB = lookupAttr nodeDef "transpose_b"
transAttrs a b =
(opAttr "transpose_a" .~ a) . (opAttr "transpose_b" .~ b)
in case (transposeA, transposeB) of
(False, False) ->
[ Just $ matMul' (transAttrs False True) dz y
, Just $ matMul' (transAttrs True False) x dz]
(False, True) ->
[ Just $ matMul dz y
, Just $ matMul' (transAttrs True False) dz x]
(True, False) ->
[ Just $ matMul' (transAttrs False True) y dz
, Just $ matMul x dz]
(True, True) ->
[ Just $ matMul' (transAttrs True True) y dz
, Just $ matMul' (transAttrs True True) dz x] | 798 | opGrad "MatMul" nodeDef [toT -> x, toT -> y] [dz] =
let transposeA = lookupAttr nodeDef "transpose_a"
transposeB = lookupAttr nodeDef "transpose_b"
transAttrs a b =
(opAttr "transpose_a" .~ a) . (opAttr "transpose_b" .~ b)
in case (transposeA, transposeB) of
(False, False) ->
[ Just $ matMul' (transAttrs False True) dz y
, Just $ matMul' (transAttrs True False) x dz]
(False, True) ->
[ Just $ matMul dz y
, Just $ matMul' (transAttrs True False) dz x]
(True, False) ->
[ Just $ matMul' (transAttrs False True) y dz
, Just $ matMul x dz]
(True, True) ->
[ Just $ matMul' (transAttrs True True) y dz
, Just $ matMul' (transAttrs True True) dz x] | 798 | false | false | 3 | 15 | 269 | 312 | 158 | 154 | null | null |
geophf/1HaskellADay | exercises/HAD/Y2016/M11/D11/BonusSolution.hs | mit | close :: String -> String
close x = x ++ " }" | 45 | close :: String -> String
close x = x ++ " }" | 45 | close x = x ++ " }" | 19 | false | true | 2 | 7 | 11 | 29 | 12 | 17 | null | null |
pbevin/toycss | src/html/ShowHtml.hs | gpl-2.0 | compactOpen node = "<" ++ render (nodeOpen node) ++ ">" | 55 | compactOpen node = "<" ++ render (nodeOpen node) ++ ">" | 55 | compactOpen node = "<" ++ render (nodeOpen node) ++ ">" | 55 | false | false | 1 | 9 | 9 | 30 | 12 | 18 | null | null |
pparkkin/eta | compiler/ETA/BasicTypes/OccName.hs | bsd-3-clause | delFromOccEnv (A x) y = A $ delFromUFM x y | 45 | delFromOccEnv (A x) y = A $ delFromUFM x y | 45 | delFromOccEnv (A x) y = A $ delFromUFM x y | 45 | false | false | 0 | 7 | 12 | 26 | 12 | 14 | null | null |
ndmitchell/tagsoup | test/TagSoup/Generate/Translate.hs | bsd-3-clause | isDecl InfixDecl{} = True | 25 | isDecl InfixDecl{} = True | 25 | isDecl InfixDecl{} = True | 25 | false | false | 1 | 5 | 3 | 16 | 6 | 10 | null | null |
ekmett/ermine | src/Ermine/Pretty/G.hs | bsd-2-clause | prettyG _ _ Slot = text "slot" | 41 | prettyG _ _ Slot = text "slot" | 41 | prettyG _ _ Slot = text "slot" | 41 | false | false | 1 | 5 | 17 | 15 | 6 | 9 | null | null |
harendra-kumar/asyncly | src/Streamly/Internal/Benchmark/Prelude.hs | bsd-3-clause | foldrMReduce = S.foldrM (\x xs -> xs >>= return . (x +)) (return 0) | 67 | foldrMReduce = S.foldrM (\x xs -> xs >>= return . (x +)) (return 0) | 67 | foldrMReduce = S.foldrM (\x xs -> xs >>= return . (x +)) (return 0) | 67 | false | false | 1 | 9 | 13 | 45 | 22 | 23 | null | null |
ekmett/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxSTC_SN_WORD2 :: Int
wxSTC_SN_WORD2 = 7 | 40 | wxSTC_SN_WORD2 :: Int
wxSTC_SN_WORD2 = 7 | 40 | wxSTC_SN_WORD2 = 7 | 18 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
dkensinger/haskell | haskell-primes/NaiveSieveWheel.hs | gpl-3.0 | wheeler n (x:xs) = n : wheeler (n + x) xs | 41 | wheeler n (x:xs) = n : wheeler (n + x) xs | 41 | wheeler n (x:xs) = n : wheeler (n + x) xs | 41 | false | false | 0 | 8 | 10 | 34 | 17 | 17 | null | null |
samvher/translatethenews | app/TTN/View/Core.hs | mit | pageTemplate :: TTNTemplate ctx ()
pageTemplate = html_ ( htmlHead >> htmlBody ) | 80 | pageTemplate :: TTNTemplate ctx ()
pageTemplate = html_ ( htmlHead >> htmlBody ) | 80 | pageTemplate = html_ ( htmlHead >> htmlBody ) | 45 | false | true | 1 | 7 | 12 | 32 | 14 | 18 | null | null |
ethercrow/yi | yi-frontend-vty/src/Yi/Frontend/Vty.hs | gpl-2.0 | main :: FrontendState -> IO ()
main fs = do
tid <- myThreadId
labelThread tid "VtyMain"
exitCode <- takeMVar (fsEndMain fs)
exitWith exitCode | 157 | main :: FrontendState -> IO ()
main fs = do
tid <- myThreadId
labelThread tid "VtyMain"
exitCode <- takeMVar (fsEndMain fs)
exitWith exitCode | 157 | main fs = do
tid <- myThreadId
labelThread tid "VtyMain"
exitCode <- takeMVar (fsEndMain fs)
exitWith exitCode | 126 | false | true | 0 | 10 | 38 | 60 | 26 | 34 | null | null |
GaloisInc/saw-script | src/SAWScript/Prover/MRSolver/Solver.hs | bsd-3-clause | -- | Match a right-nested series of pairs. This is similar to 'asTupleValue'
-- except that it expects a unit value to always be at the end.
asNestedPairs :: Recognizer Term [Term]
asNestedPairs (asPairValue -> Just (x, asNestedPairs -> Just xs)) = Just (x:xs) | 260 | asNestedPairs :: Recognizer Term [Term]
asNestedPairs (asPairValue -> Just (x, asNestedPairs -> Just xs)) = Just (x:xs) | 119 | asNestedPairs (asPairValue -> Just (x, asNestedPairs -> Just xs)) = Just (x:xs) | 79 | true | true | 0 | 11 | 43 | 57 | 30 | 27 | null | null |
rlupton20/haskell-etcd | src/Database/Etcd.hs | lgpl-3.0 | --------------------------------------------------------------------------------
-- Low level API
--------------------------------------------------------------------------------
-- | 'getJ' does a get request for a key, using 'GetOptions' to modify
-- it in various ways. It will extract parts of the returned JSON
-- according to the type of 'FromJSON' instance specified/inferred.
getJ :: (A.FromJSON a) => Key -> GetOptions -> EtcdM (Maybe a)
getJ k o = liftF . fmap A.decode $ Get k o identity | 499 | getJ :: (A.FromJSON a) => Key -> GetOptions -> EtcdM (Maybe a)
getJ k o = liftF . fmap A.decode $ Get k o identity | 114 | getJ k o = liftF . fmap A.decode $ Get k o identity | 51 | true | true | 0 | 11 | 67 | 74 | 38 | 36 | null | null |
ecaustin/haskhol-math | src/HaskHOL/Lib/Arith.hs | bsd-2-clause | thmNOT_LE :: ArithCtxt thry => HOL cls thry HOLThm
thmNOT_LE = Base.thmNOT_LE | 77 | thmNOT_LE :: ArithCtxt thry => HOL cls thry HOLThm
thmNOT_LE = Base.thmNOT_LE | 77 | thmNOT_LE = Base.thmNOT_LE | 26 | false | true | 0 | 7 | 11 | 33 | 14 | 19 | null | null |
Concomitant/LambdaHack | Game/LambdaHack/Client/UI/InventoryClient.hs | bsd-3-clause | doLook :: MonadClientUI m => Bool -> m Slideshow
doLook addMoreMsg = do
Kind.COps{cotile=Kind.Ops{ouniqGroup}} <- getsState scops
let unknownId = ouniqGroup "unknown space"
stgtMode <- getsClient stgtMode
case stgtMode of
Nothing -> return mempty
Just tgtMode -> do
leader <- getLeaderUI
let lidV = tgtLevelId tgtMode
lvl <- getLevel lidV
cursorPos <- cursorToPos
per <- getPerFid lidV
b <- getsState $ getActorBody leader
let p = fromMaybe (bpos b) cursorPos
canSee = ES.member p (totalVisible per)
inhabitants <- if canSee
then getsState $ posToActors p lidV
else return []
seps <- getsClient seps
mnewEps <- makeLine False b p seps
itemToF <- itemToFullClient
let aims = isJust mnewEps
enemyMsg = case inhabitants of
[] -> ""
(_, body) : rest ->
-- Even if it's the leader, give his proper name, not 'you'.
let subjects = map (partActor . snd) inhabitants
subject = MU.WWandW subjects
verb = "be here"
desc =
if not (null rest) -- many actors, only list names
then ""
else case itemDisco $ itemToF (btrunk body) (1, []) of
Nothing -> "" -- no details, only show the name
Just ItemDisco{itemKind} -> IK.idesc itemKind
pdesc = if desc == "" then "" else "(" <> desc <> ")"
in makeSentence [MU.SubjectVerbSg subject verb] <+> pdesc
vis | lvl `at` p == unknownId = "that is"
| not canSee = "you remember"
| not aims = "you are aware of"
| otherwise = "you see"
-- Show general info about current position.
lookMsg <- lookAt True vis canSee p leader enemyMsg
{- targeting is kind of a menu (or at least mode), so this is menu inside
a menu, which is messy, hence disabled until UI overhauled:
-- Check if there's something lying around at current position.
is <- getsState $ getCBag $ CFloor lidV p
if EM.size is <= 2 then
promptToSlideshow lookMsg
else do
msgAdd lookMsg -- TODO: do not add to history
floorItemOverlay lidV p
-}
promptToSlideshow $ lookMsg <+> if addMoreMsg then moreMsg else ""
-- | Create a list of item names. | 2,482 | doLook :: MonadClientUI m => Bool -> m Slideshow
doLook addMoreMsg = do
Kind.COps{cotile=Kind.Ops{ouniqGroup}} <- getsState scops
let unknownId = ouniqGroup "unknown space"
stgtMode <- getsClient stgtMode
case stgtMode of
Nothing -> return mempty
Just tgtMode -> do
leader <- getLeaderUI
let lidV = tgtLevelId tgtMode
lvl <- getLevel lidV
cursorPos <- cursorToPos
per <- getPerFid lidV
b <- getsState $ getActorBody leader
let p = fromMaybe (bpos b) cursorPos
canSee = ES.member p (totalVisible per)
inhabitants <- if canSee
then getsState $ posToActors p lidV
else return []
seps <- getsClient seps
mnewEps <- makeLine False b p seps
itemToF <- itemToFullClient
let aims = isJust mnewEps
enemyMsg = case inhabitants of
[] -> ""
(_, body) : rest ->
-- Even if it's the leader, give his proper name, not 'you'.
let subjects = map (partActor . snd) inhabitants
subject = MU.WWandW subjects
verb = "be here"
desc =
if not (null rest) -- many actors, only list names
then ""
else case itemDisco $ itemToF (btrunk body) (1, []) of
Nothing -> "" -- no details, only show the name
Just ItemDisco{itemKind} -> IK.idesc itemKind
pdesc = if desc == "" then "" else "(" <> desc <> ")"
in makeSentence [MU.SubjectVerbSg subject verb] <+> pdesc
vis | lvl `at` p == unknownId = "that is"
| not canSee = "you remember"
| not aims = "you are aware of"
| otherwise = "you see"
-- Show general info about current position.
lookMsg <- lookAt True vis canSee p leader enemyMsg
{- targeting is kind of a menu (or at least mode), so this is menu inside
a menu, which is messy, hence disabled until UI overhauled:
-- Check if there's something lying around at current position.
is <- getsState $ getCBag $ CFloor lidV p
if EM.size is <= 2 then
promptToSlideshow lookMsg
else do
msgAdd lookMsg -- TODO: do not add to history
floorItemOverlay lidV p
-}
promptToSlideshow $ lookMsg <+> if addMoreMsg then moreMsg else ""
-- | Create a list of item names. | 2,482 | doLook addMoreMsg = do
Kind.COps{cotile=Kind.Ops{ouniqGroup}} <- getsState scops
let unknownId = ouniqGroup "unknown space"
stgtMode <- getsClient stgtMode
case stgtMode of
Nothing -> return mempty
Just tgtMode -> do
leader <- getLeaderUI
let lidV = tgtLevelId tgtMode
lvl <- getLevel lidV
cursorPos <- cursorToPos
per <- getPerFid lidV
b <- getsState $ getActorBody leader
let p = fromMaybe (bpos b) cursorPos
canSee = ES.member p (totalVisible per)
inhabitants <- if canSee
then getsState $ posToActors p lidV
else return []
seps <- getsClient seps
mnewEps <- makeLine False b p seps
itemToF <- itemToFullClient
let aims = isJust mnewEps
enemyMsg = case inhabitants of
[] -> ""
(_, body) : rest ->
-- Even if it's the leader, give his proper name, not 'you'.
let subjects = map (partActor . snd) inhabitants
subject = MU.WWandW subjects
verb = "be here"
desc =
if not (null rest) -- many actors, only list names
then ""
else case itemDisco $ itemToF (btrunk body) (1, []) of
Nothing -> "" -- no details, only show the name
Just ItemDisco{itemKind} -> IK.idesc itemKind
pdesc = if desc == "" then "" else "(" <> desc <> ")"
in makeSentence [MU.SubjectVerbSg subject verb] <+> pdesc
vis | lvl `at` p == unknownId = "that is"
| not canSee = "you remember"
| not aims = "you are aware of"
| otherwise = "you see"
-- Show general info about current position.
lookMsg <- lookAt True vis canSee p leader enemyMsg
{- targeting is kind of a menu (or at least mode), so this is menu inside
a menu, which is messy, hence disabled until UI overhauled:
-- Check if there's something lying around at current position.
is <- getsState $ getCBag $ CFloor lidV p
if EM.size is <= 2 then
promptToSlideshow lookMsg
else do
msgAdd lookMsg -- TODO: do not add to history
floorItemOverlay lidV p
-}
promptToSlideshow $ lookMsg <+> if addMoreMsg then moreMsg else ""
-- | Create a list of item names. | 2,433 | false | true | 9 | 34 | 893 | 560 | 270 | 290 | null | null |
maciej-bendkowski/boltzmann-brain | Data/Boltzmann/System/Paganini.hs | bsd-3-clause | mkVariables :: System a -> Spec (Map String Let)
mkVariables sys = do
xs <- replicateM (size sys) variable
return (M.fromList $ zip (M.keys $ defs sys) xs) | 159 | mkVariables :: System a -> Spec (Map String Let)
mkVariables sys = do
xs <- replicateM (size sys) variable
return (M.fromList $ zip (M.keys $ defs sys) xs) | 159 | mkVariables sys = do
xs <- replicateM (size sys) variable
return (M.fromList $ zip (M.keys $ defs sys) xs) | 110 | false | true | 0 | 13 | 31 | 82 | 38 | 44 | null | null |
gcampax/ghc | compiler/main/Packages.hs | bsd-3-clause | packageFlagErr :: DynFlags
-> PackageFlag
-> [(PackageConfig, UnusablePackageReason)]
-> IO a
-- for missing DPH package we emit a more helpful error message, because
-- this may be the result of using -fdph-par or -fdph-seq.
packageFlagErr dflags (ExposePackage (PackageArg pkg) _) []
| is_dph_package pkg
= throwGhcExceptionIO (CmdLineError (showSDoc dflags $ dph_err))
where dph_err = text "the " <> text pkg <> text " package is not installed."
$$ text "To install it: \"cabal install dph\"."
is_dph_package pkg = "dph" `isPrefixOf` pkg | 618 | packageFlagErr :: DynFlags
-> PackageFlag
-> [(PackageConfig, UnusablePackageReason)]
-> IO a
packageFlagErr dflags (ExposePackage (PackageArg pkg) _) []
| is_dph_package pkg
= throwGhcExceptionIO (CmdLineError (showSDoc dflags $ dph_err))
where dph_err = text "the " <> text pkg <> text " package is not installed."
$$ text "To install it: \"cabal install dph\"."
is_dph_package pkg = "dph" `isPrefixOf` pkg | 485 | packageFlagErr dflags (ExposePackage (PackageArg pkg) _) []
| is_dph_package pkg
= throwGhcExceptionIO (CmdLineError (showSDoc dflags $ dph_err))
where dph_err = text "the " <> text pkg <> text " package is not installed."
$$ text "To install it: \"cabal install dph\"."
is_dph_package pkg = "dph" `isPrefixOf` pkg | 346 | true | true | 1 | 11 | 159 | 134 | 66 | 68 | null | null |
roconnor/data-lens | src/Data/Lens/Multi/Common.hs | bsd-3-clause | frontPL :: MultiLens a b -> PartialLens a b
frontPL (MLens f) = pLens $
coproduct left (right . uncurry store . (extract *** id) . runStoreT) . runStaredStore . f | 164 | frontPL :: MultiLens a b -> PartialLens a b
frontPL (MLens f) = pLens $
coproduct left (right . uncurry store . (extract *** id) . runStoreT) . runStaredStore . f | 164 | frontPL (MLens f) = pLens $
coproduct left (right . uncurry store . (extract *** id) . runStoreT) . runStaredStore . f | 120 | false | true | 0 | 13 | 32 | 80 | 38 | 42 | null | null |
mapinguari/SC_HS_Proxy | src/Proxy/Query/Unit.hs | mit | isBuilding TerranBarracks = False | 33 | isBuilding TerranBarracks = False | 33 | isBuilding TerranBarracks = False | 33 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
Lainepress/easy | Text/RE/TDFA/Sequence.hs | bsd-3-clause | -- | the regex-base monadic, polymorphic match operator
(=~~) :: ( Monad m
, Functor m
, Typeable a
, RegexContext TDFA.Regex (S.Seq Char) a
, RegexMaker TDFA.Regex TDFA.CompOption TDFA.ExecOption String
)
=> (S.Seq Char)
-> RE
-> m a
(=~~) bs rex = addCaptureNames (reCaptureNames rex) <$> matchM (reRegex rex) bs | 379 | (=~~) :: ( Monad m
, Functor m
, Typeable a
, RegexContext TDFA.Regex (S.Seq Char) a
, RegexMaker TDFA.Regex TDFA.CompOption TDFA.ExecOption String
)
=> (S.Seq Char)
-> RE
-> m a
(=~~) bs rex = addCaptureNames (reCaptureNames rex) <$> matchM (reRegex rex) bs | 323 | (=~~) bs rex = addCaptureNames (reCaptureNames rex) <$> matchM (reRegex rex) bs | 79 | true | true | 0 | 9 | 116 | 123 | 63 | 60 | null | null |
edsko/hackage-server | Distribution/Server/Features/Core/Backup.hs | bsd-3-clause | importCabalMetadata fp _ =
fail $ "Invalid cabal metadata in " ++ foldr1 (</>) fp | 85 | importCabalMetadata fp _ =
fail $ "Invalid cabal metadata in " ++ foldr1 (</>) fp | 85 | importCabalMetadata fp _ =
fail $ "Invalid cabal metadata in " ++ foldr1 (</>) fp | 85 | false | false | 0 | 6 | 18 | 26 | 13 | 13 | null | null |
fpco/hedis | test/Test.hs | bsd-3-clause | testForceErrorReply :: Test
testForceErrorReply = testCase "force error reply" $ do
set "key" "value"
-- key is not a hash -> wrong kind of value
reply <- hkeys "key"
assert $ case reply of
Left (Error _) -> True
_ -> False | 268 | testForceErrorReply :: Test
testForceErrorReply = testCase "force error reply" $ do
set "key" "value"
-- key is not a hash -> wrong kind of value
reply <- hkeys "key"
assert $ case reply of
Left (Error _) -> True
_ -> False | 268 | testForceErrorReply = testCase "force error reply" $ do
set "key" "value"
-- key is not a hash -> wrong kind of value
reply <- hkeys "key"
assert $ case reply of
Left (Error _) -> True
_ -> False | 240 | false | true | 0 | 14 | 86 | 69 | 32 | 37 | null | null |
kim/amazonka | amazonka-ec2/gen/Network/AWS/EC2/Types.hs | mpl-2.0 | -- | 'CustomerGateway' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 'cgBgpAsn' @::@ 'Text'
--
-- * 'cgCustomerGatewayId' @::@ 'Text'
--
-- * 'cgIpAddress' @::@ 'Text'
--
-- * 'cgState' @::@ 'Text'
--
-- * 'cgTags' @::@ ['Tag']
--
-- * 'cgType' @::@ 'Text'
--
customerGateway :: Text -- ^ 'cgCustomerGatewayId'
-> Text -- ^ 'cgState'
-> Text -- ^ 'cgType'
-> Text -- ^ 'cgIpAddress'
-> Text -- ^ 'cgBgpAsn'
-> CustomerGateway
customerGateway p1 p2 p3 p4 p5 = CustomerGateway
{ _cgCustomerGatewayId = p1
, _cgState = p2
, _cgType = p3
, _cgIpAddress = p4
, _cgBgpAsn = p5
, _cgTags = mempty
} | 793 | customerGateway :: Text -- ^ 'cgCustomerGatewayId'
-> Text -- ^ 'cgState'
-> Text -- ^ 'cgType'
-> Text -- ^ 'cgIpAddress'
-> Text -- ^ 'cgBgpAsn'
-> CustomerGateway
customerGateway p1 p2 p3 p4 p5 = CustomerGateway
{ _cgCustomerGatewayId = p1
, _cgState = p2
, _cgType = p3
, _cgIpAddress = p4
, _cgBgpAsn = p5
, _cgTags = mempty
} | 496 | customerGateway p1 p2 p3 p4 p5 = CustomerGateway
{ _cgCustomerGatewayId = p1
, _cgState = p2
, _cgType = p3
, _cgIpAddress = p4
, _cgBgpAsn = p5
, _cgTags = mempty
} | 250 | true | true | 0 | 11 | 275 | 110 | 69 | 41 | null | null |
purcell/adventofcodeteam | app/Seven.hs | bsd-3-clause | parseConn :: Parser Connection
parseConn = Connection <$> (parseGate <* string " -> ") <*> parseWire | 100 | parseConn :: Parser Connection
parseConn = Connection <$> (parseGate <* string " -> ") <*> parseWire | 100 | parseConn = Connection <$> (parseGate <* string " -> ") <*> parseWire | 69 | false | true | 0 | 9 | 15 | 32 | 16 | 16 | null | null |
dysinger/amazonka | amazonka-ec2/gen/Network/AWS/EC2/Types.hs | mpl-2.0 | -- | 'SpotInstanceStatus' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 'sisCode' @::@ 'Maybe' 'Text'
--
-- * 'sisMessage' @::@ 'Maybe' 'Text'
--
-- * 'sisUpdateTime' @::@ 'Maybe' 'UTCTime'
--
spotInstanceStatus :: SpotInstanceStatus
spotInstanceStatus = SpotInstanceStatus
{ _sisCode = Nothing
, _sisUpdateTime = Nothing
, _sisMessage = Nothing
} | 409 | spotInstanceStatus :: SpotInstanceStatus
spotInstanceStatus = SpotInstanceStatus
{ _sisCode = Nothing
, _sisUpdateTime = Nothing
, _sisMessage = Nothing
} | 179 | spotInstanceStatus = SpotInstanceStatus
{ _sisCode = Nothing
, _sisUpdateTime = Nothing
, _sisMessage = Nothing
} | 138 | true | true | 0 | 7 | 78 | 45 | 30 | 15 | null | null |
rueshyna/gogol | gogol-admin-datatransfer/gen/Network/Google/DataTransfer/Types.hs | mpl-2.0 | -- | View data transfers between users in your organization
adminDataTransferReadOnlyScope :: Proxy '["https://www.googleapis.com/auth/admin.datatransfer.readonly"]
adminDataTransferReadOnlyScope = Proxy | 203 | adminDataTransferReadOnlyScope :: Proxy '["https://www.googleapis.com/auth/admin.datatransfer.readonly"]
adminDataTransferReadOnlyScope = Proxy | 143 | adminDataTransferReadOnlyScope = Proxy | 38 | true | true | 0 | 8 | 16 | 26 | 12 | 14 | null | null |
DanielSchuessler/hstri | EitherC.hs | gpl-3.0 | failureStr :: Q Exp
failureStr = withCurrentLoc 'failureStrWithLoc | 66 | failureStr :: Q Exp
failureStr = withCurrentLoc 'failureStrWithLoc | 66 | failureStr = withCurrentLoc 'failureStrWithLoc | 46 | false | true | 1 | 5 | 7 | 21 | 9 | 12 | null | null |
timtylin/scholdoc-texmath | src/Text/TeXMath/Readers/TeX.hs | gpl-2.0 | asGroup :: [Exp] -> Exp
asGroup [x] = x | 39 | asGroup :: [Exp] -> Exp
asGroup [x] = x | 39 | asGroup [x] = x | 15 | false | true | 0 | 6 | 8 | 24 | 13 | 11 | null | null |
danr/hipspec | examples/old-examples/hip/Infinite.hs | gpl-3.0 | prop_tail_repeat :: a -> Prop [a]
prop_tail_repeat x = repeat x =:= tail (repeat x) | 83 | prop_tail_repeat :: a -> Prop [a]
prop_tail_repeat x = repeat x =:= tail (repeat x) | 83 | prop_tail_repeat x = repeat x =:= tail (repeat x) | 49 | false | true | 0 | 8 | 14 | 40 | 19 | 21 | null | null |
alexander-at-github/eta | compiler/ETA/Types/TypeRep.hs | bsd-3-clause | ---------------
tidyType :: TidyEnv -> Type -> Type
tidyType _ (LitTy n) = LitTy n | 95 | tidyType :: TidyEnv -> Type -> Type
tidyType _ (LitTy n) = LitTy n | 79 | tidyType _ (LitTy n) = LitTy n | 43 | true | true | 0 | 10 | 27 | 39 | 18 | 21 | null | null |
gbaz/cabal | cabal-install/Distribution/Client/Targets.hs | bsd-3-clause | pkgSpecifierConstraints (SpecificSourcePackage pkg) =
[LabeledPackageConstraint pc ConstraintSourceUserTarget]
where
pc = PackageConstraintVersion (packageName pkg)
(thisVersion (packageVersion pkg))
-- ------------------------------------------------------------
-- * Parsing and checking user targets
-- ------------------------------------------------------------ | 387 | pkgSpecifierConstraints (SpecificSourcePackage pkg) =
[LabeledPackageConstraint pc ConstraintSourceUserTarget]
where
pc = PackageConstraintVersion (packageName pkg)
(thisVersion (packageVersion pkg))
-- ------------------------------------------------------------
-- * Parsing and checking user targets
-- ------------------------------------------------------------ | 387 | pkgSpecifierConstraints (SpecificSourcePackage pkg) =
[LabeledPackageConstraint pc ConstraintSourceUserTarget]
where
pc = PackageConstraintVersion (packageName pkg)
(thisVersion (packageVersion pkg))
-- ------------------------------------------------------------
-- * Parsing and checking user targets
-- ------------------------------------------------------------ | 387 | false | false | 1 | 9 | 47 | 63 | 29 | 34 | null | null |
phaazon/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/Tokens.hs | bsd-3-clause | gl_NUM_EXTENSIONS :: GLenum
gl_NUM_EXTENSIONS = 0x821D | 54 | gl_NUM_EXTENSIONS :: GLenum
gl_NUM_EXTENSIONS = 0x821D | 54 | gl_NUM_EXTENSIONS = 0x821D | 26 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
cdornan/keystore | src/Data/KeyStore/PasswordManager.hs | bsd-3-clause | cast_pmc :: PMConfig p -> p -> p
cast_pmc _ p = p | 49 | cast_pmc :: PMConfig p -> p -> p
cast_pmc _ p = p | 49 | cast_pmc _ p = p | 16 | false | true | 0 | 6 | 12 | 27 | 13 | 14 | null | null |
DavidAlphaFox/ghc | compiler/hsSyn/HsTypes.hs | bsd-3-clause | hsLKiTyVarNames :: LHsTyVarBndrs Name -> [Name]
-- Kind and type variables
hsLKiTyVarNames (HsQTvs { hsq_kvs = kvs, hsq_tvs = tvs })
= kvs ++ map hsLTyVarName tvs | 164 | hsLKiTyVarNames :: LHsTyVarBndrs Name -> [Name]
hsLKiTyVarNames (HsQTvs { hsq_kvs = kvs, hsq_tvs = tvs })
= kvs ++ map hsLTyVarName tvs | 137 | hsLKiTyVarNames (HsQTvs { hsq_kvs = kvs, hsq_tvs = tvs })
= kvs ++ map hsLTyVarName tvs | 89 | true | true | 0 | 9 | 28 | 52 | 28 | 24 | null | null |
green-haskell/ghc | compiler/simplCore/SetLevels.hs | bsd-3-clause | annotateBotStr id (Just (arity, sig)) = id `setIdArity` arity
`setIdStrictness` sig | 126 | annotateBotStr id (Just (arity, sig)) = id `setIdArity` arity
`setIdStrictness` sig | 126 | annotateBotStr id (Just (arity, sig)) = id `setIdArity` arity
`setIdStrictness` sig | 126 | false | false | 0 | 7 | 53 | 37 | 20 | 17 | null | null |
dmcclean/HaTeX | Text/LaTeX/Base/Pretty.hs | bsd-3-clause | docLaTeX (TeXBraces b) = braces $ docLaTeX b | 44 | docLaTeX (TeXBraces b) = braces $ docLaTeX b | 44 | docLaTeX (TeXBraces b) = braces $ docLaTeX b | 44 | false | false | 0 | 6 | 7 | 23 | 10 | 13 | null | null |
agocorona/RefSerialize | Data/RefSerialize/Parser.hs | bsd-3-clause | comma = symbol "," | 28 | comma = symbol "," | 28 | comma = symbol "," | 28 | false | false | 1 | 5 | 13 | 13 | 4 | 9 | null | null |
a143753/AOJ | 1516.hs | apache-2.0 | f ('F':_) = False | 21 | f ('F':_) = False | 21 | f ('F':_) = False | 21 | false | false | 0 | 6 | 7 | 17 | 8 | 9 | null | null |
christiaanb/ghc | compiler/main/GhcMake.hs | bsd-3-clause | -- ^ Load only the dependencies of the given module, but not the module
-- itself.
-- | Try to load the program. See 'LoadHowMuch' for the different modes.
--
-- This function implements the core of GHC's @--make@ mode. It preprocesses,
-- compiles and loads the specified modules, avoiding re-compilation wherever
-- possible. Depending on the target (see 'DynFlags.hscTarget') compilating
-- and loading may result in files being created on disk.
--
-- Calls the 'reportModuleCompilationResult' callback after each compiling
-- each module, whether successful or not.
--
-- Throw a 'SourceError' if errors are encountered before the actual
-- compilation starts (e.g., during dependency analysis). All other errors
-- are reported using the callback.
--
load :: GhcMonad m => LoadHowMuch -> m SuccessFlag
load how_much = do
mod_graph <- depanal [] False
guessOutputFile
hsc_env <- getSession
let hpt1 = hsc_HPT hsc_env
let dflags = hsc_dflags hsc_env
-- The "bad" boot modules are the ones for which we have
-- B.hs-boot in the module graph, but no B.hs
-- The downsweep should have ensured this does not happen
-- (see msDeps)
let all_home_mods = [ms_mod_name s
| s <- mod_graph, not (isBootSummary s)]
bad_boot_mods = [s | s <- mod_graph, isBootSummary s,
not (ms_mod_name s `elem` all_home_mods)]
ASSERT( null bad_boot_mods ) return ()
-- check that the module given in HowMuch actually exists, otherwise
-- topSortModuleGraph will bomb later.
let checkHowMuch (LoadUpTo m) = checkMod m
checkHowMuch (LoadDependenciesOf m) = checkMod m
checkHowMuch _ = id
checkMod m and_then
| m `elem` all_home_mods = and_then
| otherwise = do
liftIO $ errorMsg dflags (text "no such module:" <+>
quotes (ppr m))
return Failed
checkHowMuch how_much $ do
-- mg2_with_srcimps drops the hi-boot nodes, returning a
-- graph with cycles. Among other things, it is used for
-- backing out partially complete cycles following a failed
-- upsweep, and for removing from hpt all the modules
-- not in strict downwards closure, during calls to compile.
let mg2_with_srcimps :: [SCC ModSummary]
mg2_with_srcimps = topSortModuleGraph True mod_graph Nothing
-- If we can determine that any of the {-# SOURCE #-} imports
-- are definitely unnecessary, then emit a warning.
warnUnnecessarySourceImports mg2_with_srcimps
let
-- check the stability property for each module.
stable_mods@(stable_obj,stable_bco)
= checkStability hpt1 mg2_with_srcimps all_home_mods
-- prune bits of the HPT which are definitely redundant now,
-- to save space.
pruned_hpt = pruneHomePackageTable hpt1
(flattenSCCs mg2_with_srcimps)
stable_mods
_ <- liftIO $ evaluate pruned_hpt
-- before we unload anything, make sure we don't leave an old
-- interactive context around pointing to dead bindings. Also,
-- write the pruned HPT to allow the old HPT to be GC'd.
modifySession $ \_ -> discardIC $ hsc_env { hsc_HPT = pruned_hpt }
liftIO $ debugTraceMsg dflags 2 (text "Stable obj:" <+> ppr stable_obj $$
text "Stable BCO:" <+> ppr stable_bco)
-- Unload any modules which are going to be re-linked this time around.
let stable_linkables = [ linkable
| m <- stable_obj++stable_bco,
Just hmi <- [lookupUFM pruned_hpt m],
Just linkable <- [hm_linkable hmi] ]
liftIO $ unload hsc_env stable_linkables
-- We could at this point detect cycles which aren't broken by
-- a source-import, and complain immediately, but it seems better
-- to let upsweep_mods do this, so at least some useful work gets
-- done before the upsweep is abandoned.
--hPutStrLn stderr "after tsort:\n"
--hPutStrLn stderr (showSDoc (vcat (map ppr mg2)))
-- Now do the upsweep, calling compile for each module in
-- turn. Final result is version 3 of everything.
-- Topologically sort the module graph, this time including hi-boot
-- nodes, and possibly just including the portion of the graph
-- reachable from the module specified in the 2nd argument to load.
-- This graph should be cycle-free.
-- If we're restricting the upsweep to a portion of the graph, we
-- also want to retain everything that is still stable.
let full_mg :: [SCC ModSummary]
full_mg = topSortModuleGraph False mod_graph Nothing
maybe_top_mod = case how_much of
LoadUpTo m -> Just m
LoadDependenciesOf m -> Just m
_ -> Nothing
partial_mg0 :: [SCC ModSummary]
partial_mg0 = topSortModuleGraph False mod_graph maybe_top_mod
-- LoadDependenciesOf m: we want the upsweep to stop just
-- short of the specified module (unless the specified module
-- is stable).
partial_mg
| LoadDependenciesOf _mod <- how_much
= ASSERT( case last partial_mg0 of
AcyclicSCC ms -> ms_mod_name ms == _mod; _ -> False )
List.init partial_mg0
| otherwise
= partial_mg0
stable_mg =
[ AcyclicSCC ms
| AcyclicSCC ms <- full_mg,
ms_mod_name ms `elem` stable_obj++stable_bco ]
-- the modules from partial_mg that are not also stable
-- NB. also keep cycles, we need to emit an error message later
unstable_mg = filter not_stable partial_mg
where not_stable (CyclicSCC _) = True
not_stable (AcyclicSCC ms)
= ms_mod_name ms `notElem` stable_obj++stable_bco
-- Load all the stable modules first, before attempting to load
-- an unstable module (#7231).
mg = stable_mg ++ unstable_mg
-- clean up between compilations
let cleanup hsc_env = intermediateCleanTempFiles (hsc_dflags hsc_env)
(flattenSCCs mg2_with_srcimps)
hsc_env
liftIO $ debugTraceMsg dflags 2 (hang (text "Ready for upsweep")
2 (ppr mg))
n_jobs <- case parMakeCount dflags of
Nothing -> liftIO getNumProcessors
Just n -> return n
let upsweep_fn | n_jobs > 1 = parUpsweep n_jobs
| otherwise = upsweep
setSession hsc_env{ hsc_HPT = emptyHomePackageTable }
(upsweep_ok, modsUpswept)
<- upsweep_fn pruned_hpt stable_mods cleanup mg
-- Make modsDone be the summaries for each home module now
-- available; this should equal the domain of hpt3.
-- Get in in a roughly top .. bottom order (hence reverse).
let modsDone = reverse modsUpswept
-- Try and do linking in some form, depending on whether the
-- upsweep was completely or only partially successful.
if succeeded upsweep_ok
then
-- Easy; just relink it all.
do liftIO $ debugTraceMsg dflags 2 (text "Upsweep completely successful.")
-- Clean up after ourselves
hsc_env1 <- getSession
liftIO $ intermediateCleanTempFiles dflags modsDone hsc_env1
-- Issue a warning for the confusing case where the user
-- said '-o foo' but we're not going to do any linking.
-- We attempt linking if either (a) one of the modules is
-- called Main, or (b) the user said -no-hs-main, indicating
-- that main() is going to come from somewhere else.
--
let ofile = outputFile dflags
let no_hs_main = gopt Opt_NoHsMain dflags
let
main_mod = mainModIs dflags
a_root_is_Main = any ((==main_mod).ms_mod) mod_graph
do_linking = a_root_is_Main || no_hs_main || ghcLink dflags == LinkDynLib || ghcLink dflags == LinkStaticLib
when (ghcLink dflags == LinkBinary
&& isJust ofile && not do_linking) $
liftIO $ debugTraceMsg dflags 1 $
text ("Warning: output was redirected with -o, " ++
"but no output will be generated\n" ++
"because there is no " ++
moduleNameString (moduleName main_mod) ++ " module.")
-- link everything together
linkresult <- liftIO $ link (ghcLink dflags) dflags do_linking (hsc_HPT hsc_env1)
loadFinish Succeeded linkresult
else
-- Tricky. We need to back out the effects of compiling any
-- half-done cycles, both so as to clean up the top level envs
-- and to avoid telling the interactive linker to link them.
do liftIO $ debugTraceMsg dflags 2 (text "Upsweep partially successful.")
let modsDone_names
= map ms_mod modsDone
let mods_to_zap_names
= findPartiallyCompletedCycles modsDone_names
mg2_with_srcimps
let mods_to_keep
= filter ((`notElem` mods_to_zap_names).ms_mod)
modsDone
hsc_env1 <- getSession
let hpt4 = retainInTopLevelEnvs (map ms_mod_name mods_to_keep)
(hsc_HPT hsc_env1)
-- Clean up after ourselves
liftIO $ intermediateCleanTempFiles dflags mods_to_keep hsc_env1
-- there should be no Nothings where linkables should be, now
ASSERT(all (isJust.hm_linkable) (eltsUFM (hsc_HPT hsc_env))) do
-- Link everything together
linkresult <- liftIO $ link (ghcLink dflags) dflags False hpt4
modifySession $ \hsc_env -> hsc_env{ hsc_HPT = hpt4 }
loadFinish Failed linkresult
-- | Finish up after a load. | 10,121 | load :: GhcMonad m => LoadHowMuch -> m SuccessFlag
load how_much = do
mod_graph <- depanal [] False
guessOutputFile
hsc_env <- getSession
let hpt1 = hsc_HPT hsc_env
let dflags = hsc_dflags hsc_env
-- The "bad" boot modules are the ones for which we have
-- B.hs-boot in the module graph, but no B.hs
-- The downsweep should have ensured this does not happen
-- (see msDeps)
let all_home_mods = [ms_mod_name s
| s <- mod_graph, not (isBootSummary s)]
bad_boot_mods = [s | s <- mod_graph, isBootSummary s,
not (ms_mod_name s `elem` all_home_mods)]
ASSERT( null bad_boot_mods ) return ()
-- check that the module given in HowMuch actually exists, otherwise
-- topSortModuleGraph will bomb later.
let checkHowMuch (LoadUpTo m) = checkMod m
checkHowMuch (LoadDependenciesOf m) = checkMod m
checkHowMuch _ = id
checkMod m and_then
| m `elem` all_home_mods = and_then
| otherwise = do
liftIO $ errorMsg dflags (text "no such module:" <+>
quotes (ppr m))
return Failed
checkHowMuch how_much $ do
-- mg2_with_srcimps drops the hi-boot nodes, returning a
-- graph with cycles. Among other things, it is used for
-- backing out partially complete cycles following a failed
-- upsweep, and for removing from hpt all the modules
-- not in strict downwards closure, during calls to compile.
let mg2_with_srcimps :: [SCC ModSummary]
mg2_with_srcimps = topSortModuleGraph True mod_graph Nothing
-- If we can determine that any of the {-# SOURCE #-} imports
-- are definitely unnecessary, then emit a warning.
warnUnnecessarySourceImports mg2_with_srcimps
let
-- check the stability property for each module.
stable_mods@(stable_obj,stable_bco)
= checkStability hpt1 mg2_with_srcimps all_home_mods
-- prune bits of the HPT which are definitely redundant now,
-- to save space.
pruned_hpt = pruneHomePackageTable hpt1
(flattenSCCs mg2_with_srcimps)
stable_mods
_ <- liftIO $ evaluate pruned_hpt
-- before we unload anything, make sure we don't leave an old
-- interactive context around pointing to dead bindings. Also,
-- write the pruned HPT to allow the old HPT to be GC'd.
modifySession $ \_ -> discardIC $ hsc_env { hsc_HPT = pruned_hpt }
liftIO $ debugTraceMsg dflags 2 (text "Stable obj:" <+> ppr stable_obj $$
text "Stable BCO:" <+> ppr stable_bco)
-- Unload any modules which are going to be re-linked this time around.
let stable_linkables = [ linkable
| m <- stable_obj++stable_bco,
Just hmi <- [lookupUFM pruned_hpt m],
Just linkable <- [hm_linkable hmi] ]
liftIO $ unload hsc_env stable_linkables
-- We could at this point detect cycles which aren't broken by
-- a source-import, and complain immediately, but it seems better
-- to let upsweep_mods do this, so at least some useful work gets
-- done before the upsweep is abandoned.
--hPutStrLn stderr "after tsort:\n"
--hPutStrLn stderr (showSDoc (vcat (map ppr mg2)))
-- Now do the upsweep, calling compile for each module in
-- turn. Final result is version 3 of everything.
-- Topologically sort the module graph, this time including hi-boot
-- nodes, and possibly just including the portion of the graph
-- reachable from the module specified in the 2nd argument to load.
-- This graph should be cycle-free.
-- If we're restricting the upsweep to a portion of the graph, we
-- also want to retain everything that is still stable.
let full_mg :: [SCC ModSummary]
full_mg = topSortModuleGraph False mod_graph Nothing
maybe_top_mod = case how_much of
LoadUpTo m -> Just m
LoadDependenciesOf m -> Just m
_ -> Nothing
partial_mg0 :: [SCC ModSummary]
partial_mg0 = topSortModuleGraph False mod_graph maybe_top_mod
-- LoadDependenciesOf m: we want the upsweep to stop just
-- short of the specified module (unless the specified module
-- is stable).
partial_mg
| LoadDependenciesOf _mod <- how_much
= ASSERT( case last partial_mg0 of
AcyclicSCC ms -> ms_mod_name ms == _mod; _ -> False )
List.init partial_mg0
| otherwise
= partial_mg0
stable_mg =
[ AcyclicSCC ms
| AcyclicSCC ms <- full_mg,
ms_mod_name ms `elem` stable_obj++stable_bco ]
-- the modules from partial_mg that are not also stable
-- NB. also keep cycles, we need to emit an error message later
unstable_mg = filter not_stable partial_mg
where not_stable (CyclicSCC _) = True
not_stable (AcyclicSCC ms)
= ms_mod_name ms `notElem` stable_obj++stable_bco
-- Load all the stable modules first, before attempting to load
-- an unstable module (#7231).
mg = stable_mg ++ unstable_mg
-- clean up between compilations
let cleanup hsc_env = intermediateCleanTempFiles (hsc_dflags hsc_env)
(flattenSCCs mg2_with_srcimps)
hsc_env
liftIO $ debugTraceMsg dflags 2 (hang (text "Ready for upsweep")
2 (ppr mg))
n_jobs <- case parMakeCount dflags of
Nothing -> liftIO getNumProcessors
Just n -> return n
let upsweep_fn | n_jobs > 1 = parUpsweep n_jobs
| otherwise = upsweep
setSession hsc_env{ hsc_HPT = emptyHomePackageTable }
(upsweep_ok, modsUpswept)
<- upsweep_fn pruned_hpt stable_mods cleanup mg
-- Make modsDone be the summaries for each home module now
-- available; this should equal the domain of hpt3.
-- Get in in a roughly top .. bottom order (hence reverse).
let modsDone = reverse modsUpswept
-- Try and do linking in some form, depending on whether the
-- upsweep was completely or only partially successful.
if succeeded upsweep_ok
then
-- Easy; just relink it all.
do liftIO $ debugTraceMsg dflags 2 (text "Upsweep completely successful.")
-- Clean up after ourselves
hsc_env1 <- getSession
liftIO $ intermediateCleanTempFiles dflags modsDone hsc_env1
-- Issue a warning for the confusing case where the user
-- said '-o foo' but we're not going to do any linking.
-- We attempt linking if either (a) one of the modules is
-- called Main, or (b) the user said -no-hs-main, indicating
-- that main() is going to come from somewhere else.
--
let ofile = outputFile dflags
let no_hs_main = gopt Opt_NoHsMain dflags
let
main_mod = mainModIs dflags
a_root_is_Main = any ((==main_mod).ms_mod) mod_graph
do_linking = a_root_is_Main || no_hs_main || ghcLink dflags == LinkDynLib || ghcLink dflags == LinkStaticLib
when (ghcLink dflags == LinkBinary
&& isJust ofile && not do_linking) $
liftIO $ debugTraceMsg dflags 1 $
text ("Warning: output was redirected with -o, " ++
"but no output will be generated\n" ++
"because there is no " ++
moduleNameString (moduleName main_mod) ++ " module.")
-- link everything together
linkresult <- liftIO $ link (ghcLink dflags) dflags do_linking (hsc_HPT hsc_env1)
loadFinish Succeeded linkresult
else
-- Tricky. We need to back out the effects of compiling any
-- half-done cycles, both so as to clean up the top level envs
-- and to avoid telling the interactive linker to link them.
do liftIO $ debugTraceMsg dflags 2 (text "Upsweep partially successful.")
let modsDone_names
= map ms_mod modsDone
let mods_to_zap_names
= findPartiallyCompletedCycles modsDone_names
mg2_with_srcimps
let mods_to_keep
= filter ((`notElem` mods_to_zap_names).ms_mod)
modsDone
hsc_env1 <- getSession
let hpt4 = retainInTopLevelEnvs (map ms_mod_name mods_to_keep)
(hsc_HPT hsc_env1)
-- Clean up after ourselves
liftIO $ intermediateCleanTempFiles dflags mods_to_keep hsc_env1
-- there should be no Nothings where linkables should be, now
ASSERT(all (isJust.hm_linkable) (eltsUFM (hsc_HPT hsc_env))) do
-- Link everything together
linkresult <- liftIO $ link (ghcLink dflags) dflags False hpt4
modifySession $ \hsc_env -> hsc_env{ hsc_HPT = hpt4 }
loadFinish Failed linkresult
-- | Finish up after a load. | 9,355 | load how_much = do
mod_graph <- depanal [] False
guessOutputFile
hsc_env <- getSession
let hpt1 = hsc_HPT hsc_env
let dflags = hsc_dflags hsc_env
-- The "bad" boot modules are the ones for which we have
-- B.hs-boot in the module graph, but no B.hs
-- The downsweep should have ensured this does not happen
-- (see msDeps)
let all_home_mods = [ms_mod_name s
| s <- mod_graph, not (isBootSummary s)]
bad_boot_mods = [s | s <- mod_graph, isBootSummary s,
not (ms_mod_name s `elem` all_home_mods)]
ASSERT( null bad_boot_mods ) return ()
-- check that the module given in HowMuch actually exists, otherwise
-- topSortModuleGraph will bomb later.
let checkHowMuch (LoadUpTo m) = checkMod m
checkHowMuch (LoadDependenciesOf m) = checkMod m
checkHowMuch _ = id
checkMod m and_then
| m `elem` all_home_mods = and_then
| otherwise = do
liftIO $ errorMsg dflags (text "no such module:" <+>
quotes (ppr m))
return Failed
checkHowMuch how_much $ do
-- mg2_with_srcimps drops the hi-boot nodes, returning a
-- graph with cycles. Among other things, it is used for
-- backing out partially complete cycles following a failed
-- upsweep, and for removing from hpt all the modules
-- not in strict downwards closure, during calls to compile.
let mg2_with_srcimps :: [SCC ModSummary]
mg2_with_srcimps = topSortModuleGraph True mod_graph Nothing
-- If we can determine that any of the {-# SOURCE #-} imports
-- are definitely unnecessary, then emit a warning.
warnUnnecessarySourceImports mg2_with_srcimps
let
-- check the stability property for each module.
stable_mods@(stable_obj,stable_bco)
= checkStability hpt1 mg2_with_srcimps all_home_mods
-- prune bits of the HPT which are definitely redundant now,
-- to save space.
pruned_hpt = pruneHomePackageTable hpt1
(flattenSCCs mg2_with_srcimps)
stable_mods
_ <- liftIO $ evaluate pruned_hpt
-- before we unload anything, make sure we don't leave an old
-- interactive context around pointing to dead bindings. Also,
-- write the pruned HPT to allow the old HPT to be GC'd.
modifySession $ \_ -> discardIC $ hsc_env { hsc_HPT = pruned_hpt }
liftIO $ debugTraceMsg dflags 2 (text "Stable obj:" <+> ppr stable_obj $$
text "Stable BCO:" <+> ppr stable_bco)
-- Unload any modules which are going to be re-linked this time around.
let stable_linkables = [ linkable
| m <- stable_obj++stable_bco,
Just hmi <- [lookupUFM pruned_hpt m],
Just linkable <- [hm_linkable hmi] ]
liftIO $ unload hsc_env stable_linkables
-- We could at this point detect cycles which aren't broken by
-- a source-import, and complain immediately, but it seems better
-- to let upsweep_mods do this, so at least some useful work gets
-- done before the upsweep is abandoned.
--hPutStrLn stderr "after tsort:\n"
--hPutStrLn stderr (showSDoc (vcat (map ppr mg2)))
-- Now do the upsweep, calling compile for each module in
-- turn. Final result is version 3 of everything.
-- Topologically sort the module graph, this time including hi-boot
-- nodes, and possibly just including the portion of the graph
-- reachable from the module specified in the 2nd argument to load.
-- This graph should be cycle-free.
-- If we're restricting the upsweep to a portion of the graph, we
-- also want to retain everything that is still stable.
let full_mg :: [SCC ModSummary]
full_mg = topSortModuleGraph False mod_graph Nothing
maybe_top_mod = case how_much of
LoadUpTo m -> Just m
LoadDependenciesOf m -> Just m
_ -> Nothing
partial_mg0 :: [SCC ModSummary]
partial_mg0 = topSortModuleGraph False mod_graph maybe_top_mod
-- LoadDependenciesOf m: we want the upsweep to stop just
-- short of the specified module (unless the specified module
-- is stable).
partial_mg
| LoadDependenciesOf _mod <- how_much
= ASSERT( case last partial_mg0 of
AcyclicSCC ms -> ms_mod_name ms == _mod; _ -> False )
List.init partial_mg0
| otherwise
= partial_mg0
stable_mg =
[ AcyclicSCC ms
| AcyclicSCC ms <- full_mg,
ms_mod_name ms `elem` stable_obj++stable_bco ]
-- the modules from partial_mg that are not also stable
-- NB. also keep cycles, we need to emit an error message later
unstable_mg = filter not_stable partial_mg
where not_stable (CyclicSCC _) = True
not_stable (AcyclicSCC ms)
= ms_mod_name ms `notElem` stable_obj++stable_bco
-- Load all the stable modules first, before attempting to load
-- an unstable module (#7231).
mg = stable_mg ++ unstable_mg
-- clean up between compilations
let cleanup hsc_env = intermediateCleanTempFiles (hsc_dflags hsc_env)
(flattenSCCs mg2_with_srcimps)
hsc_env
liftIO $ debugTraceMsg dflags 2 (hang (text "Ready for upsweep")
2 (ppr mg))
n_jobs <- case parMakeCount dflags of
Nothing -> liftIO getNumProcessors
Just n -> return n
let upsweep_fn | n_jobs > 1 = parUpsweep n_jobs
| otherwise = upsweep
setSession hsc_env{ hsc_HPT = emptyHomePackageTable }
(upsweep_ok, modsUpswept)
<- upsweep_fn pruned_hpt stable_mods cleanup mg
-- Make modsDone be the summaries for each home module now
-- available; this should equal the domain of hpt3.
-- Get in in a roughly top .. bottom order (hence reverse).
let modsDone = reverse modsUpswept
-- Try and do linking in some form, depending on whether the
-- upsweep was completely or only partially successful.
if succeeded upsweep_ok
then
-- Easy; just relink it all.
do liftIO $ debugTraceMsg dflags 2 (text "Upsweep completely successful.")
-- Clean up after ourselves
hsc_env1 <- getSession
liftIO $ intermediateCleanTempFiles dflags modsDone hsc_env1
-- Issue a warning for the confusing case where the user
-- said '-o foo' but we're not going to do any linking.
-- We attempt linking if either (a) one of the modules is
-- called Main, or (b) the user said -no-hs-main, indicating
-- that main() is going to come from somewhere else.
--
let ofile = outputFile dflags
let no_hs_main = gopt Opt_NoHsMain dflags
let
main_mod = mainModIs dflags
a_root_is_Main = any ((==main_mod).ms_mod) mod_graph
do_linking = a_root_is_Main || no_hs_main || ghcLink dflags == LinkDynLib || ghcLink dflags == LinkStaticLib
when (ghcLink dflags == LinkBinary
&& isJust ofile && not do_linking) $
liftIO $ debugTraceMsg dflags 1 $
text ("Warning: output was redirected with -o, " ++
"but no output will be generated\n" ++
"because there is no " ++
moduleNameString (moduleName main_mod) ++ " module.")
-- link everything together
linkresult <- liftIO $ link (ghcLink dflags) dflags do_linking (hsc_HPT hsc_env1)
loadFinish Succeeded linkresult
else
-- Tricky. We need to back out the effects of compiling any
-- half-done cycles, both so as to clean up the top level envs
-- and to avoid telling the interactive linker to link them.
do liftIO $ debugTraceMsg dflags 2 (text "Upsweep partially successful.")
let modsDone_names
= map ms_mod modsDone
let mods_to_zap_names
= findPartiallyCompletedCycles modsDone_names
mg2_with_srcimps
let mods_to_keep
= filter ((`notElem` mods_to_zap_names).ms_mod)
modsDone
hsc_env1 <- getSession
let hpt4 = retainInTopLevelEnvs (map ms_mod_name mods_to_keep)
(hsc_HPT hsc_env1)
-- Clean up after ourselves
liftIO $ intermediateCleanTempFiles dflags mods_to_keep hsc_env1
-- there should be no Nothings where linkables should be, now
ASSERT(all (isJust.hm_linkable) (eltsUFM (hsc_HPT hsc_env))) do
-- Link everything together
linkresult <- liftIO $ link (ghcLink dflags) dflags False hpt4
modifySession $ \hsc_env -> hsc_env{ hsc_HPT = hpt4 }
loadFinish Failed linkresult
-- | Finish up after a load. | 9,304 | true | true | 29 | 17 | 3,207 | 1,329 | 701 | 628 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.