From a4e4c5f822416dbe2b8abe34301e8d3e39051bc1 Mon Sep 17 00:00:00 2001 From: simonmar Date: Mon, 27 May 2002 09:03:52 +0000 Subject: [haddock @ 2002-05-27 09:03:51 by simonmar] Lots of changes: - instances of a class are listed with the class, and instances involving a datatype are listed with that type. Derived instances aren't included at the moment: the calculation to find the instance head for a derived instance is non-trivial. - some formatting changes; use rows with specified height rather than cellspacing in some places. - various fixes (source file links were wrong, amongst others) --- src/HsParseUtils.lhs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/HsParseUtils.lhs') diff --git a/src/HsParseUtils.lhs b/src/HsParseUtils.lhs index 3d795837..148fff07 100644 --- a/src/HsParseUtils.lhs +++ b/src/HsParseUtils.lhs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: HsParseUtils.lhs,v 1.2 2002/04/10 16:10:26 simonmar Exp $ +-- $Id: HsParseUtils.lhs,v 1.3 2002/05/27 09:03:52 simonmar Exp $ -- -- (c) The GHC Team 1997-2000 -- @@ -17,6 +17,7 @@ module HsParseUtils ( , checkPrec -- String -> P String , checkContext -- HsType -> P HsContext , checkAssertion -- HsType -> P HsAsst + , checkInstHeader -- HsType -> P (HsContext, HsAsst) , checkDataHeader -- HsType -> P (HsContext,HsName,[HsName]) , checkSimple -- HsType -> [HsName] -> P ((HsName,[HsName])) , checkPattern -- HsExp -> P HsPat @@ -73,6 +74,14 @@ checkAssertion = checkAssertion' [] checkAssertion' _ _ = parseError "Illegal class assertion" +checkInstHeader :: HsType -> P (HsContext, HsAsst) +checkInstHeader (HsForAllType Nothing ctxt ty) = + checkAssertion ty `thenP` \asst -> + returnP (ctxt, asst) +checkInstHeader ty = + checkAssertion ty `thenP` \asst -> + returnP ([], asst) + checkDataHeader :: HsType -> P (HsContext,HsName,[HsName]) checkDataHeader (HsForAllType Nothing cs t) = checkSimple t [] `thenP` \(c,ts) -> -- cgit v1.2.3