Commit 125d1518 authored by Ryan Scott's avatar Ryan Scott Committed by Ben Gamari

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
parent e8e9f6a7
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
......@@ -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'])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment