Commit 62155a60 authored by Ömer Sinan Ağacan's avatar Ömer Sinan Ağacan
Browse files

TcTyClsDecls: use zipWith3M_ instead of generating triplets

parent 29ca4a19
...@@ -2139,18 +2139,18 @@ checkValidDataCon dflags existential_ok tc con ...@@ -2139,18 +2139,18 @@ checkValidDataCon dflags existential_ok tc con
-- Check that UNPACK pragmas and bangs work out -- Check that UNPACK pragmas and bangs work out
-- E.g. reject data T = MkT {-# UNPACK #-} Int -- No "!" -- E.g. reject data T = MkT {-# UNPACK #-} Int -- No "!"
-- data T = MkT {-# UNPACK #-} !a -- Can't unpack -- data T = MkT {-# UNPACK #-} !a -- Can't unpack
; mapM_ check_bang (zip3 (dataConSrcBangs con) (dataConImplBangs con) [1..]) ; zipWith3M_ check_bang (dataConSrcBangs con) (dataConImplBangs con) [1..]
; traceTc "Done validity of data con" (ppr con <+> ppr (dataConRepType con)) ; traceTc "Done validity of data con" (ppr con <+> ppr (dataConRepType con))
} }
where where
ctxt = ConArgCtxt (dataConName con) ctxt = ConArgCtxt (dataConName con)
check_bang (HsSrcBang _ _ SrcLazy, _, n) check_bang (HsSrcBang _ _ SrcLazy) _ n
| not (xopt LangExt.StrictData dflags) | not (xopt LangExt.StrictData dflags)
= addErrTc = addErrTc
(bad_bang n (ptext (sLit "Lazy annotation (~) without StrictData"))) (bad_bang n (ptext (sLit "Lazy annotation (~) without StrictData")))
check_bang (HsSrcBang _ want_unpack strict_mark, rep_bang, n) check_bang (HsSrcBang _ want_unpack strict_mark) rep_bang n
| isSrcUnpacked want_unpack, not is_strict | isSrcUnpacked want_unpack, not is_strict
= addWarnTc (bad_bang n (ptext (sLit "UNPACK pragma lacks '!'"))) = addWarnTc (bad_bang n (ptext (sLit "UNPACK pragma lacks '!'")))
| isSrcUnpacked want_unpack | isSrcUnpacked want_unpack
...@@ -2164,7 +2164,7 @@ checkValidDataCon dflags existential_ok tc con ...@@ -2164,7 +2164,7 @@ checkValidDataCon dflags existential_ok tc con
NoSrcStrict -> xopt LangExt.StrictData dflags NoSrcStrict -> xopt LangExt.StrictData dflags
bang -> isSrcStrict bang bang -> isSrcStrict bang
check_bang _ check_bang _ _ _
= return () = return ()
bad_bang n herald bad_bang n herald
......
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