summaryrefslogtreecommitdiff
path: root/compiler/typecheck/TcPatSyn.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2017-12-20 15:36:49 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2017-12-21 14:14:21 +0000
commit584cbd4a19887497776ce1f61c15df652b8b2ea4 (patch)
treed38a508d7e3a4f243d4750174cf2a5d611f327da /compiler/typecheck/TcPatSyn.hs
parent4d41e9212d1fdf109f2d0174d204644446f5874c (diff)
downloadhaskell-584cbd4a19887497776ce1f61c15df652b8b2ea4.tar.gz
Simplify HsPatSynDetails
This is a pure refactoring. Use HsConDetails to implement HsPatSynDetails, instead of defining a whole new data type. Less code, fewer types, all good.
Diffstat (limited to 'compiler/typecheck/TcPatSyn.hs')
-rw-r--r--compiler/typecheck/TcPatSyn.hs17
1 files changed, 8 insertions, 9 deletions
diff --git a/compiler/typecheck/TcPatSyn.hs b/compiler/typecheck/TcPatSyn.hs
index 2bd30f4c06..7e21af5faa 100644
--- a/compiler/typecheck/TcPatSyn.hs
+++ b/compiler/typecheck/TcPatSyn.hs
@@ -402,12 +402,11 @@ collectPatSynArgInfo :: HsPatSynDetails (Located Name)
-> ([Name], [Name], Bool)
collectPatSynArgInfo details =
case details of
- PrefixPatSyn names -> (map unLoc names, [], False)
- InfixPatSyn name1 name2 -> (map unLoc [name1, name2], [], True)
- RecordPatSyn names ->
- let (vars, sels) = unzip (map splitRecordPatSyn names)
- in (vars, sels, False)
-
+ PrefixCon names -> (map unLoc names, [], False)
+ InfixCon name1 name2 -> (map unLoc [name1, name2], [], True)
+ RecCon names -> (vars, sels, False)
+ where
+ (vars, sels) = unzip (map splitRecordPatSyn names)
where
splitRecordPatSyn :: RecordPatSynField (Located Name)
-> (Name, Name)
@@ -710,9 +709,9 @@ tcPatSynBuilderBind (PSB { psb_id = L loc name, psb_def = lpat
(noLoc EmptyLocalBinds)
args = case details of
- PrefixPatSyn args -> args
- InfixPatSyn arg1 arg2 -> [arg1, arg2]
- RecordPatSyn args -> map recordPatSynPatVar args
+ PrefixCon args -> args
+ InfixCon arg1 arg2 -> [arg1, arg2]
+ RecCon args -> map recordPatSynPatVar args
add_dummy_arg :: MatchGroup GhcRn (LHsExpr GhcRn)
-> MatchGroup GhcRn (LHsExpr GhcRn)