Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Tobias Decking
GHC
Commits
cd2c71bb
Commit
cd2c71bb
authored
Feb 21, 2007
by
simonpj@microsoft.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow GADT syntax for newtypes
Fixes Trac #1154. Please merge. Tests are tc225, and tcfail176.
parent
479f4cac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
compiler/typecheck/TcTyClsDecls.lhs
compiler/typecheck/TcTyClsDecls.lhs
+11
-8
No files found.
compiler/typecheck/TcTyClsDecls.lhs
View file @
cd2c71bb
...
...
@@ -748,19 +748,22 @@ tcConDecl :: Bool -- True <=> -funbox-strict_fields
-> TcM DataCon
tcConDecl unbox_strict NewType tycon tc_tvs -- Newtypes
(ConDecl name _ ex_tvs ex_ctxt details ResTyH98 _)
= do { let tc_datacon field_lbls arg_ty
(ConDecl name _ tvs ex_ctxt details res_ty _)
= tcTyVarBndrs tvs $ \ tvs' -> do
do { (univ_tvs, ex_tvs, eq_preds, data_tc) <- tcResultType tycon tc_tvs tvs' res_ty
-- Check that a newtype has no existential stuff
; checkTc (null ex_tvs && null (unLoc ex_ctxt)) (newtypeExError name)
; let tc_datacon field_lbls arg_ty
= do { arg_ty' <- tcHsKindedType arg_ty -- No bang on newtype
; buildDataCon (unLoc name) False {- Prefix -}
[NotMarkedStrict]
(map unLoc field_lbls)
tc
_tvs [] -- No existentials
[] [] -- No equalities, predicates
univ
_tvs [] -- No existentials
[] []
-- No equalities, predicates
[arg_ty']
tycon }
-- Check that a newtype has no existential stuff
; checkTc (null ex_tvs && null (unLoc ex_ctxt)) (newtypeExError name)
data_tc }
; case details of
PrefixCon [arg_ty] -> tc_datacon [] arg_ty
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment