summaryrefslogtreecommitdiff
path: root/compiler/iface/TcIface.lhs
diff options
context:
space:
mode:
authorTwan van Laarhoven <twanvl@gmail.com>2013-09-11 15:32:33 +0200
committerHerbert Valerio Riedel <hvr@gnu.org>2013-09-18 09:53:18 +0200
commitbd42c9dfd1c9ce19672e1d63871a237c268e0212 (patch)
tree0d9e6e3fdedae39176751cc62c1458344a0cf781 /compiler/iface/TcIface.lhs
parentb6bc3263d0099e79b437ac5f3c053452c608c710 (diff)
downloadhaskell-bd42c9dfd1c9ce19672e1d63871a237c268e0212.tar.gz
Implement checkable "minimal complete definitions" (#7633)
This commit adds a `{-# MINIMAL #-}` pragma, which defines the possible minimal complete definitions for a class. The body of the pragma is a boolean formula of names. The old warning for missing methods is replaced with this new one. Note: The interface file format is changed to store the minimal complete definition. Authored-by: Twan van Laarhoven <twanvl@gmail.com> Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Diffstat (limited to 'compiler/iface/TcIface.lhs')
-rw-r--r--compiler/iface/TcIface.lhs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/iface/TcIface.lhs b/compiler/iface/TcIface.lhs
index 38043c6454..564189413a 100644
--- a/compiler/iface/TcIface.lhs
+++ b/compiler/iface/TcIface.lhs
@@ -69,6 +69,7 @@ import FastString
import Control.Monad
import qualified Data.Map as Map
+import Data.Traversable ( traverse )
\end{code}
This module takes
@@ -505,7 +506,7 @@ tc_iface_decl _parent ignore_prags
(IfaceClass {ifCtxt = rdr_ctxt, ifName = tc_occ,
ifTyVars = tv_bndrs, ifRoles = roles, ifFDs = rdr_fds,
ifATs = rdr_ats, ifSigs = rdr_sigs,
- ifRec = tc_isrec })
+ ifMinDef = mindef_occ, ifRec = tc_isrec })
-- ToDo: in hs-boot files we should really treat abstract classes specially,
-- as we do abstract tycons
= bindIfaceTyVars tv_bndrs $ \ tyvars -> do
@@ -516,10 +517,11 @@ tc_iface_decl _parent ignore_prags
; sigs <- mapM tc_sig rdr_sigs
; fds <- mapM tc_fd rdr_fds
; traceIf (text "tc-iface-class3" <+> ppr tc_occ)
+ ; mindef <- traverse lookupIfaceTop mindef_occ
; cls <- fixM $ \ cls -> do
{ ats <- mapM (tc_at cls) rdr_ats
; traceIf (text "tc-iface-class4" <+> ppr tc_occ)
- ; buildClass ignore_prags tc_name tyvars roles ctxt fds ats sigs tc_isrec }
+ ; buildClass ignore_prags tc_name tyvars roles ctxt fds ats sigs mindef tc_isrec }
; return (ATyCon (classTyCon cls)) }
where
tc_sc pred = forkM (mk_sc_doc pred) (tcIfaceType pred)