aboutsummaryrefslogtreecommitdiff
path: root/src/HsParseUtils.lhs
diff options
context:
space:
mode:
authorsimonmar <unknown>2002-05-27 09:03:52 +0000
committersimonmar <unknown>2002-05-27 09:03:52 +0000
commita4e4c5f822416dbe2b8abe34301e8d3e39051bc1 (patch)
tree48743b04e3ebced1288b7ee51700f01fb4d02fa3 /src/HsParseUtils.lhs
parent01c2ddd27ae8776b03464d091d6dce989b7ee13f (diff)
[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)
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) ->