diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2018-03-02 14:17:52 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-03-02 15:41:03 -0500 |
commit | 125d15181c7ac8d8fbaa43f799f9e3876dc2f57b (patch) | |
tree | c942ff7aaff556bd94d8d23582b61bf64730accc /testsuite/tests/profiling/should_compile | |
parent | e8e9f6a7a6d857efe6e3b2aec0c4964f9a8fa09a (diff) | |
download | haskell-125d15181c7ac8d8fbaa43f799f9e3876dc2f57b.tar.gz |
Add regression test for #12790
Test Plan: make test TEST=T12790
Reviewers: bgamari, mpickering
Reviewed By: mpickering
Subscribers: mpickering, dfeuer, rwbarton, thomie, carter
GHC Trac Issues: #12790
Differential Revision: https://phabricator.haskell.org/D4412
Diffstat (limited to 'testsuite/tests/profiling/should_compile')
-rw-r--r-- | testsuite/tests/profiling/should_compile/T12790.hs | 48 | ||||
-rw-r--r-- | testsuite/tests/profiling/should_compile/all.T | 1 |
2 files changed, 49 insertions, 0 deletions
diff --git a/testsuite/tests/profiling/should_compile/T12790.hs b/testsuite/tests/profiling/should_compile/T12790.hs new file mode 100644 index 0000000000..3c3f7d487e --- /dev/null +++ b/testsuite/tests/profiling/should_compile/T12790.hs @@ -0,0 +1,48 @@ +module T12790 (list) where + +import Data.Foldable (asum) +import Text.ParserCombinators.Parsec (Parser, sepBy, try) + +data Expr + = Var Fixity String + | App Expr Expr + +data Fixity = Pref | Inf + +cons, nil :: Expr +cons = Var Inf ":" +nil = Var Pref "[]" + +brackets :: Parser a -> Parser a +brackets = undefined + +symbol :: String -> Parser String +symbol = undefined + +list :: Parser Expr +list = asum (map (try . brackets) plist) where + plist = [ + foldr (\e1 e2 -> cons `App` e1 `App` e2) nil `fmap` + (myParser False `sepBy` symbol ","), + do e <- myParser False + _ <- symbol ".." + return $ Var Pref "enumFrom" `App` e, + do e <- myParser False + _ <- symbol "," + e' <- myParser False + _ <- symbol ".." + return $ Var Pref "enumFromThen" `App` e `App` e', + do e <- myParser False + _ <- symbol ".." + e' <- myParser False + return $ Var Pref "enumFromTo" `App` e `App` e', + do e <- myParser False + _ <- symbol "," + e' <- myParser False + _ <- symbol ".." + e'' <- myParser False + return $ Var Pref "enumFromThenTo" `App` e `App` e' `App` e'' + ] + +myParser :: Bool -> Parser Expr +myParser = undefined diff --git a/testsuite/tests/profiling/should_compile/all.T b/testsuite/tests/profiling/should_compile/all.T index 155206ab7b..1ebcb07be4 100644 --- a/testsuite/tests/profiling/should_compile/all.T +++ b/testsuite/tests/profiling/should_compile/all.T @@ -5,3 +5,4 @@ test('prof002', [only_ways(['normal']), req_profiling], compile_and_run, ['-prof test('T2410', [only_ways(['normal']), req_profiling], compile, ['-O2 -prof -fprof-cafs']) test('T5889', [only_ways(['normal']), req_profiling, extra_files(['T5889/A.hs', 'T5889/B.hs'])], multimod_compile, ['A B', '-O -prof -fno-prof-count-entries -v0']) +test('T12790', [only_ways(['normal']), req_profiling], compile, ['-O -prof']) |