aboutsummaryrefslogtreecommitdiff
path: root/src/HsParseUtils.lhs
diff options
context:
space:
mode:
Diffstat (limited to 'src/HsParseUtils.lhs')
-rw-r--r--src/HsParseUtils.lhs11
1 files changed, 10 insertions, 1 deletions
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) ->