2 module ParseIface ( parseIface, IfaceStuff(..) ) where
4 #include "HsVersions.h"
6 import HsSyn -- quite a bit of stuff
7 import RdrHsSyn -- oodles of synonyms
8 import HsTypes ( mkHsForAllTy )
10 import Const ( Literal(..), mkMachInt_safe )
11 import BasicTypes ( Fixity(..), FixityDirection(..),
12 NewOrData(..), Version
14 import CostCentre ( CostCentre(..), IsCafCC(..), IsDupdCC(..) )
15 import HsPragmas ( noDataPragmas, noClassPragmas )
16 import Type ( Kind, mkArrowKind, boxedTypeKind, openTypeKind, UsageAnn(..) )
17 import IdInfo ( ArityInfo, exactArity, CprInfo(..) )
20 import RnMonad ( ImportVersion, LocalVersion, ParsedIface(..), WhatsImported(..),
21 RdrNamePragma, ExportItem, RdrAvailInfo, GenAvailInfo(..), WhetherHasOrphans
23 import Bag ( emptyBag, unitBag, snocBag )
24 import FiniteMap ( emptyFM, unitFM, addToFM, plusFM, bagToFM, FiniteMap )
25 import RdrName ( RdrName, mkRdrUnqual, mkSysQual, mkSysUnqual )
26 import Name ( OccName, Provenance )
27 import OccName ( mkSysOccFS,
28 tcName, varName, dataName, clsName, tvName,
31 import Module ( ModuleName, mkSysModuleFS )
32 import PrelMods ( mkTupNameStr, mkUbxTupNameStr )
33 import PrelInfo ( mkTupConRdrName, mkUbxTupConRdrName )
34 import SrcLoc ( SrcLoc )
47 %monad { P }{ thenP }{ returnP }
48 %lexer { lexer } { ITeof }
51 'case' { ITcase } -- Haskell keywords
54 'default' { ITdefault }
55 'deriving' { ITderiving }
64 'instance' { ITinstance }
67 'newtype' { ITnewtype }
73 'qualified' { ITqualified }
76 'forall' { ITforall } -- GHC extension keywords
77 'foreign' { ITforeign }
80 'dynamic' { ITdynamic }
83 '__interface' { ITinterface } -- interface keywords
84 '__export' { IT__export }
85 '__forall' { IT__forall }
86 '__depends' { ITdepends }
87 '__letrec' { ITletrec }
88 '__coerce' { ITcoerce }
89 '__inline_call'{ ITinlineCall }
90 '__inline_me' { ITinlineMe }
91 '__DEFAULT' { ITdefaultbranch }
93 '__integer' { ITinteger_lit }
94 '__float' { ITfloat_lit }
95 '__rational' { ITrational_lit }
96 '__addr' { ITaddr_lit }
97 '__litlit' { ITlit_lit }
98 '__string' { ITstring_lit }
99 '__ccall' { ITccall $$ }
101 '__sccC' { ITsccAllCafs }
107 '__P' { ITspecialise }
109 '__U' { ITunfold $$ }
110 '__S' { ITstrict $$ }
112 '__M' { ITcprinfo $$ }
114 '..' { ITdotdot } -- reserved symbols
127 '/\\' { ITbiglam } -- GHC-extension symbols
129 '{' { ITocurly } -- special symbols
140 VARID { ITvarid $$ } -- identifiers
142 VARSYM { ITvarsym $$ }
143 CONSYM { ITconsym $$ }
144 QVARID { ITqvarid $$ }
145 QCONID { ITqconid $$ }
146 QVARSYM { ITqvarsym $$ }
147 QCONSYM { ITqconsym $$ }
149 PRAGMA { ITpragma $$ }
152 STRING { ITstring $$ }
153 INTEGER { ITinteger $$ }
154 RATIONAL { ITrational $$ }
156 UNKNOWN { ITunknown $$ }
159 -- iface_stuff is the main production.
160 -- It recognises (a) a whole interface file
161 -- (b) a type (so that type sigs can be parsed lazily)
162 -- (c) the IdInfo part of a signature (same reason)
164 iface_stuff :: { IfaceStuff }
165 iface_stuff : iface { let (nm, iff) = $1 in PIface nm iff }
167 | id_info { PIdInfo $1 }
168 | '__R' rules { PRules $2 }
171 iface :: { (ModuleName, ParsedIface) }
172 iface : '__interface' mod_fs INTEGER orphans checkVersion 'where'
178 { ( $2 -- Module name
180 pi_mod = fromInteger $3, -- Module version
182 pi_exports = $7, -- Exports
183 pi_usages = $8, -- Usages
184 pi_insts = $9, -- Local instances
185 pi_decls = $10, -- Decls
186 pi_rules = $11 -- Rules
189 --------------------------------------------------------------------------
191 import_part :: { [ImportVersion OccName] }
193 | import_part import_decl { $2 : $1 }
195 import_decl :: { ImportVersion OccName }
196 import_decl : 'import' mod_fs INTEGER orphans whats_imported ';'
197 { (mkSysModuleFS $2, fromInteger $3, $4, $5) }
198 -- import Foo 3 :: a 1 b 3 c 7 ; means import a,b,c from Foo
199 -- import Foo 3 ; means import all of Foo
200 -- import Foo 3 ! :: ...stuff... ; the ! means that Foo contains orphans
202 orphans :: { WhetherHasOrphans }
206 whats_imported :: { WhatsImported OccName }
207 whats_imported : { Everything }
208 | '::' name_version_pairs { Specifically $2 }
210 name_version_pairs :: { [LocalVersion OccName] }
211 name_version_pairs : { [] }
212 | name_version_pair name_version_pairs { $1 : $2 }
214 name_version_pair :: { LocalVersion OccName }
215 name_version_pair : var_occ INTEGER { ($1, fromInteger $2) }
216 | tc_occ INTEGER { ($1, fromInteger $2) }
219 --------------------------------------------------------------------------
221 exports_part :: { [ExportItem] }
222 exports_part : { [] }
223 | exports_part '__export'
224 mod_fs entities ';' { (mkSysModuleFS $3, $4) : $1 }
226 entities :: { [RdrAvailInfo] }
228 | entity entities { $1 : $2 }
230 entity :: { RdrAvailInfo }
231 entity : tc_occ { AvailTC $1 [$1] }
232 | var_occ { Avail $1 }
233 | tc_occ stuff_inside { AvailTC $1 ($1:$2) }
234 | tc_occ '|' stuff_inside { AvailTC $1 $3 }
236 stuff_inside :: { [OccName] }
237 stuff_inside : '{' val_occs '}' { $2 }
239 val_occ :: { OccName }
243 val_occs :: { [OccName] }
245 | val_occ val_occs { $1 : $2 }
248 --------------------------------------------------------------------------
250 fixity :: { FixityDirection }
251 fixity : 'infixl' { InfixL }
252 | 'infixr' { InfixR }
256 mb_fix : {-nothing-} { 9 }
257 | INTEGER { (fromInteger $1) }
259 -----------------------------------------------------------------------------
261 csigs :: { [RdrNameSig] }
263 | 'where' '{' csigs1 '}' { $3 }
265 csigs1 :: { [RdrNameSig] }
266 csigs1 : csig { [$1] }
267 | csig ';' csigs1 { $1 : $3 }
269 csig :: { RdrNameSig }
270 csig : src_loc var_name '::' type { mkClassOpSig False $2 $4 $1 }
271 | src_loc var_name '=' '::' type { mkClassOpSig True $2 $5 $1 }
273 --------------------------------------------------------------------------
275 instance_decl_part :: { [RdrNameInstDecl] }
276 instance_decl_part : {- empty -} { [] }
277 | instance_decl_part inst_decl { $2 : $1 }
279 inst_decl :: { RdrNameInstDecl }
280 inst_decl : src_loc 'instance' type '=' var_name ';'
282 EmptyMonoBinds {- No bindings -}
283 [] {- No user pragmas -}
288 --------------------------------------------------------------------------
290 decls_part :: { [(Version, RdrNameHsDecl)] }
293 | decls_part version decl ';' { ($2,$3):$1 }
295 decl :: { RdrNameHsDecl }
296 decl : src_loc var_name '::' type maybe_idinfo
297 { SigD (IfaceSig $2 $4 ($5 $2) $1) }
298 | src_loc 'type' tc_name tv_bndrs '=' type
299 { TyClD (TySynonym $3 $4 $6 $1) }
300 | src_loc 'data' decl_context tc_name tv_bndrs constrs
301 { TyClD (TyData DataType $3 $4 $5 $6 Nothing noDataPragmas $1) }
302 | src_loc 'newtype' decl_context tc_name tv_bndrs newtype_constr
303 { TyClD (TyData NewType $3 $4 $5 $6 Nothing noDataPragmas $1) }
304 | src_loc 'class' decl_context tc_name tv_bndrs csigs
305 { TyClD (mkClassDecl $3 $4 $5 $6 EmptyMonoBinds
307 | src_loc fixity mb_fix var_or_data_name
308 { FixD (FixitySig $4 (Fixity $3 $2) $1) }
310 maybe_idinfo :: { RdrName -> [HsIdInfo RdrName] }
311 maybe_idinfo : {- empty -} { \_ -> [] }
312 | src_loc PRAGMA { \x ->
314 PState{bol = 0#, atbol = 1#,
318 POk _ (PIdInfo id_info) -> id_info
320 pprPanic "IdInfo parse failed"
324 -----------------------------------------------------------------------------
326 rules_part :: { [RdrNameRuleDecl] }
327 rules_part : {- empty -} { [] }
328 | src_loc PRAGMA { case parseIface $2
329 PState{bol = 0#, atbol = 1#,
333 POk _ (PRules rules) -> rules
335 pprPanic "Rules parse failed" err
338 rules :: { [RdrNameRuleDecl] }
340 | rule ';' rules { $1:$3 }
342 rule :: { RdrNameRuleDecl }
343 rule : src_loc STRING rule_forall qvar_name
344 core_args '=' core_expr { IfaceRuleDecl $4 (UfRuleBody $2 $3 $5 $7) $1 }
346 rule_forall :: { [UfBinder RdrName] }
347 rule_forall : '__forall' '{' core_bndrs '}' { $3 }
349 -----------------------------------------------------------------------------
351 version :: { Version }
352 version : INTEGER { fromInteger $1 }
354 decl_context :: { RdrNameContext }
355 decl_context : { [] }
356 | '{' context_list1 '}' '=>' { $2 }
358 ----------------------------------------------------------------------------
360 constrs :: { [RdrNameConDecl] {- empty for handwritten abstract -} }
362 | '=' constrs1 { $2 }
364 constrs1 :: { [RdrNameConDecl] }
365 constrs1 : constr { [$1] }
366 | constr '|' constrs1 { $1 : $3 }
368 constr :: { RdrNameConDecl }
369 constr : src_loc ex_stuff data_name batypes { mkConDecl $3 $2 (VanillaCon $4) $1 }
370 | src_loc ex_stuff data_name '{' fields1 '}' { mkConDecl $3 $2 (RecCon $5) $1 }
371 -- We use "data_fs" so as to include ()
373 newtype_constr :: { [RdrNameConDecl] {- Empty if handwritten abstract -} }
374 newtype_constr : { [] }
375 | src_loc '=' ex_stuff data_name atype { [mkConDecl $4 $3 (NewCon $5 Nothing) $1] }
376 | src_loc '=' ex_stuff data_name '{' var_name '::' atype '}'
377 { [mkConDecl $4 $3 (NewCon $8 (Just $6)) $1] }
379 ex_stuff :: { ([HsTyVar RdrName], RdrNameContext) }
380 ex_stuff : { ([],[]) }
381 | '__forall' forall context '=>' { ($2,$3) }
383 batypes :: { [RdrNameBangType] }
385 | batype batypes { $1 : $2 }
387 batype :: { RdrNameBangType }
388 batype : atype { Unbanged $1 }
389 | '!' atype { Banged $2 }
390 | '!' '!' atype { Unpacked $3 }
392 fields1 :: { [([RdrName], RdrNameBangType)] }
393 fields1 : field { [$1] }
394 | field ',' fields1 { $1 : $3 }
396 field :: { ([RdrName], RdrNameBangType) }
397 field : var_names1 '::' type { ($1, Unbanged $3) }
398 | var_names1 '::' '!' type { ($1, Banged $4) }
399 | var_names1 '::' '!' '!' type { ($1, Unpacked $5) }
400 --------------------------------------------------------------------------
402 type :: { RdrNameHsType }
403 type : '__forall' forall context '=>' type
404 { mkHsForAllTy $2 $3 $5 }
405 | btype '->' type { MonoFunTy $1 $3 }
408 forall :: { [HsTyVar RdrName] }
409 forall : '[' tv_bndrs ']' { $2 }
411 context :: { RdrNameContext }
413 | '{' context_list1 '}' { $2 }
415 context_list1 :: { RdrNameContext }
416 context_list1 : class { [$1] }
417 | class ',' context_list1 { $1 : $3 }
419 class :: { (RdrName, [RdrNameHsType]) }
420 class : qcls_name atypes { ($1, $2) }
422 types2 :: { [RdrNameHsType] {- Two or more -} }
423 types2 : type ',' type { [$1,$3] }
424 | type ',' types2 { $1 : $3 }
426 btype :: { RdrNameHsType }
428 | btype atype { MonoTyApp $1 $2 }
429 | '__o' atype { MonoUsgTy UsOnce $2 }
430 | '__m' atype { MonoUsgTy UsMany $2 }
432 atype :: { RdrNameHsType }
433 atype : qtc_name { MonoTyVar $1 }
434 | tv_name { MonoTyVar $1 }
435 | '(' types2 ')' { MonoTupleTy $2 True{-boxed-} }
436 | '(#' type '#)' { MonoTupleTy [$2] False{-unboxed-} }
437 | '(#' types2 '#)' { MonoTupleTy $2 False{-unboxed-} }
438 | '[' type ']' { MonoListTy $2 }
439 | '{' qcls_name atypes '}' { MonoDictTy $2 $3 }
440 | '(' type ')' { $2 }
442 -- This one is dealt with via qtc_name
443 -- | '(' ')' { MonoTupleTy [] True }
445 atypes :: { [RdrNameHsType] {- Zero or more -} }
447 | atype atypes { $1 : $2 }
448 ---------------------------------------------------------------------
449 mod_fs :: { EncodedFS }
452 mod_name :: { ModuleName }
453 : mod_fs { mkSysModuleFS $1 }
456 ---------------------------------------------------
457 var_fs :: { EncodedFS }
461 | 'as' { SLIT("as") }
462 | 'qualified' { SLIT("qualified") }
463 | 'hiding' { SLIT("hiding") }
464 | 'forall' { SLIT("forall") }
465 | 'foreign' { SLIT("foreign") }
466 | 'export' { SLIT("export") }
467 | 'label' { SLIT("label") }
468 | 'dynamic' { SLIT("dynamic") }
469 | 'unsafe' { SLIT("unsafe") }
471 qvar_fs :: { (EncodedFS, EncodedFS) }
475 var_occ :: { OccName }
476 : var_fs { mkSysOccFS varName $1 }
478 var_name :: { RdrName }
479 var_name : var_occ { mkRdrUnqual $1 }
481 qvar_name :: { RdrName }
482 qvar_name : var_name { $1 }
483 | qvar_fs { mkSysQual varName $1 }
485 var_names :: { [RdrName] }
487 | var_name var_names { $1 : $2 }
489 var_names1 :: { [RdrName] }
490 var_names1 : var_name var_names { $1 : $2 }
492 ---------------------------------------------------
493 -- For some bizarre reason,
494 -- (,,,) is dealt with by the parser
495 -- Foo.(,,,) is dealt with by the lexer
498 data_fs :: { EncodedFS }
502 qdata_fs :: { (EncodedFS, EncodedFS) }
506 data_occ :: { OccName }
507 : data_fs { mkSysOccFS dataName $1 }
509 data_name :: { RdrName }
510 : data_occ { mkRdrUnqual $1 }
512 qdata_name :: { RdrName }
513 qdata_name : data_name { $1 }
514 | qdata_fs { mkSysQual dataName $1 }
516 qdata_names :: { [RdrName] }
518 | qdata_name qdata_names { $1 : $2 }
520 var_or_data_name :: { RdrName }
524 ---------------------------------------------------
525 tc_fs :: { EncodedFS }
528 tc_occ :: { OccName }
529 : tc_fs { mkSysOccFS tcName $1 }
531 tc_name :: { RdrName }
532 : tc_occ { mkRdrUnqual $1 }
534 qtc_name :: { RdrName }
536 | qdata_fs { mkSysQual tcName $1 }
538 ---------------------------------------------------
539 cls_name :: { RdrName }
540 : data_fs { mkSysUnqual clsName $1 }
542 qcls_name :: { RdrName }
544 | qdata_fs { mkSysQual clsName $1 }
546 ---------------------------------------------------
547 tv_name :: { RdrName }
548 : VARID { mkSysUnqual tvName $1 }
549 | VARSYM { mkSysUnqual tvName $1 {- Allow t2 as a tyvar -} }
551 tv_bndr :: { HsTyVar RdrName }
552 : tv_name '::' akind { IfaceTyVar $1 $3 }
553 | tv_name { IfaceTyVar $1 boxedTypeKind }
555 tv_bndrs :: { [HsTyVar RdrName] }
557 | tv_bndr tv_bndrs { $1 : $2 }
559 ---------------------------------------------------
562 | akind '->' kind { mkArrowKind $1 $3 }
565 : VARSYM { if $1 == SLIT("*") then
567 else if $1 == SLIT("?") then
569 else panic "ParseInterface: akind"
571 | '(' kind ')' { $2 }
573 --------------------------------------------------------------------------
575 id_info :: { [HsIdInfo RdrName] }
577 | id_info_item id_info { $1 : $2 }
578 | strict_info id_info { $1 ++ $2 }
580 id_info_item :: { HsIdInfo RdrName }
581 : '__A' arity_info { HsArity $2 }
582 | '__U' core_expr { HsUnfold $1 (Just $2) }
583 | '__U' { HsUnfold $1 Nothing }
584 | '__C' { HsNoCafRefs }
586 strict_info :: { [HsIdInfo RdrName] }
587 : cpr worker { ($1:$2) }
588 | strict worker { ($1:$2) }
589 | cpr strict worker { ($1:$2:$3) }
591 cpr :: { HsIdInfo RdrName }
592 : '__M' { HsCprInfo $1 }
594 strict :: { HsIdInfo RdrName }
595 : '__S' { HsStrictness (HsStrictnessInfo $1) }
597 worker :: { [HsIdInfo RdrName] }
598 : qvar_name { [HsWorker $1] }
599 | {- nothing -} { [] }
601 arity_info :: { ArityInfo }
602 : INTEGER { exactArity (fromInteger $1) }
604 -------------------------------------------------------
605 core_expr :: { UfExpr RdrName }
606 core_expr : '\\' core_bndrs '->' core_expr { foldr UfLam $4 $2 }
607 | 'case' core_expr 'of' var_name
608 '{' core_alts '}' { UfCase $2 $4 $6 }
610 | 'let' '{' core_val_bndr '=' core_expr
611 '}' 'in' core_expr { UfLet (UfNonRec $3 $5) $8 }
612 | '__letrec' '{' rec_binds '}'
613 'in' core_expr { UfLet (UfRec $3) $6 }
615 | con_or_primop '{' core_args '}' { UfCon $1 $3 }
616 | '__litlit' STRING atype { UfCon (UfLitLitCon $2 $3) [] }
618 | '__inline_me' core_expr { UfNote UfInlineMe $2 }
619 | '__inline_call' core_expr { UfNote UfInlineCall $2 }
620 | '__coerce' atype core_expr { UfNote (UfCoerce $2) $3 }
621 | scc core_expr { UfNote (UfSCC $1) $2 }
624 fexpr :: { UfExpr RdrName }
625 fexpr : fexpr core_arg { UfApp $1 $2 }
628 core_arg :: { UfExpr RdrName }
629 : '@' atype { UfType $2 }
632 core_args :: { [UfExpr RdrName] }
634 | core_arg core_args { $1 : $2 }
636 core_aexpr :: { UfExpr RdrName } -- Atomic expressions
637 core_aexpr : qvar_name { UfVar $1 }
639 | qdata_name { UfVar $1 }
640 -- This one means that e.g. "True" will parse as
641 -- (UfVar True_Id) rather than (UfCon True_Con []).
642 -- No big deal; it'll be inlined in a jiffy. I tried
643 -- parsing it to (Con con []) directly, but got bitten
644 -- when a real constructor Id showed up in an interface
645 -- file. As usual, a hack bites you in the end.
646 -- If you want to get a UfCon, then use the
647 -- curly-bracket notation (True {}).
649 | core_lit { UfCon (UfLitCon $1) [] }
650 | '(' core_expr ')' { $2 }
651 | '(' comma_exprs2 ')' { UfTuple (mkTupConRdrName (length $2)) $2 }
652 | '(#' core_expr '#)' { UfTuple (mkUbxTupConRdrName 1) [$2] }
653 | '(#' comma_exprs2 '#)' { UfTuple (mkUbxTupConRdrName (length $2)) $2 }
655 -- This one is dealt with by qdata_name: see above comments
656 -- | '(' ')' { UfTuple (mkTupConRdrName 0) [] }
658 comma_exprs2 :: { [UfExpr RdrName] } -- Two or more
659 comma_exprs2 : core_expr ',' core_expr { [$1,$3] }
660 | core_expr ',' comma_exprs2 { $1 : $3 }
662 con_or_primop :: { UfCon RdrName }
663 con_or_primop : qdata_name { UfDataCon $1 }
664 | qvar_name { UfPrimOp $1 }
665 | '__ccall' ccall_string { let
666 (is_dyn, is_casm, may_gc) = $1
668 UfCCallOp $2 is_dyn is_casm may_gc
671 rec_binds :: { [(UfBinder RdrName, UfExpr RdrName)] }
673 | core_val_bndr '=' core_expr ';' rec_binds { ($1,$3) : $5 }
675 core_alts :: { [UfAlt RdrName] }
677 | core_alt ';' core_alts { $1 : $3 }
679 core_alt :: { UfAlt RdrName }
680 core_alt : core_pat '->' core_expr { (fst $1, snd $1, $3) }
682 core_pat :: { (UfCon RdrName, [RdrName]) }
683 core_pat : core_lit { (UfLitCon $1, []) }
684 | '__litlit' STRING atype { (UfLitLitCon $2 $3, []) }
685 | qdata_name var_names { (UfDataCon $1, $2) }
686 | '(' comma_var_names1 ')' { (UfDataCon (mkTupConRdrName (length $2)), $2) }
687 | '(#' comma_var_names1 '#)' { (UfDataCon (mkUbxTupConRdrName (length $2)), $2) }
688 | '__DEFAULT' { (UfDefault, []) }
689 | '(' core_pat ')' { $2 }
692 comma_var_names1 :: { [RdrName] } -- One or more
693 comma_var_names1 : var_name { [$1] }
694 | var_name ',' comma_var_names1 { $1 : $3 }
696 core_lit :: { Literal }
697 core_lit : integer { mkMachInt_safe $1 }
698 | CHAR { MachChar $1 }
699 | STRING { MachStr $1 }
700 | '__string' STRING { NoRepStr $2 (panic "NoRepStr type") }
701 | rational { MachDouble $1 }
702 | '__float' rational { MachFloat $2 }
704 | '__integer' integer { NoRepInteger $2 (panic "NoRepInteger type")
705 -- The type checker will add the types
708 | '__rational' integer integer { NoRepRational ($2 % $3)
709 (panic "NoRepRational type")
710 -- The type checker will add the type
713 | '__addr' integer { MachAddr $2 }
715 integer :: { Integer }
717 | '-' INTEGER { (-$2) }
719 rational :: { Rational }
721 | '-' RATIONAL { (-$2) }
723 core_bndr :: { UfBinder RdrName }
724 core_bndr : core_val_bndr { $1 }
725 | core_tv_bndr { $1 }
727 core_bndrs :: { [UfBinder RdrName] }
729 | core_bndr core_bndrs { $1 : $2 }
731 core_val_bndr :: { UfBinder RdrName }
732 core_val_bndr : var_name '::' atype { UfValBinder $1 $3 }
734 core_tv_bndr :: { UfBinder RdrName }
735 core_tv_bndr : '@' tv_name '::' akind { UfTyBinder $2 $4 }
736 | '@' tv_name { UfTyBinder $2 boxedTypeKind }
738 ccall_string :: { FAST_STRING }
743 ------------------------------------------------------------------------
744 scc :: { CostCentre }
745 : '__sccC' '{' mod_name STRING '}' { AllCafsCC $3 $4 }
746 | '__scc' '{' cc_name mod_name STRING cc_dup cc_caf '}'
747 { NormalCC { cc_name = $3, cc_mod = $4, cc_grp = $5,
748 cc_is_dupd = $6, cc_is_caf = $7 } }
750 cc_name :: { EncodedFS }
754 cc_dup :: { IsDupdCC }
755 cc_dup : { OriginalCC }
758 cc_caf :: { IsCafCC }
762 -------------------------------------------------------------------
764 src_loc :: { SrcLoc }
765 src_loc : {% getSrcLocP }
767 checkVersion :: { () }
768 : {-empty-} {% checkVersion Nothing }
769 | INTEGER {% checkVersion (Just (fromInteger $1)) }
771 -------------------------------------------------------------------
776 happyError buf PState{ loc = loc } = PFailed (ifaceParseErr buf loc)
778 data IfaceStuff = PIface EncodedFS{-.hi module name-} ParsedIface
779 | PIdInfo [HsIdInfo RdrName]
780 | PType RdrNameHsType
781 | PRules [RdrNameRuleDecl]
783 mkConDecl name (ex_tvs, ex_ctxt) details loc = ConDecl name ex_tvs ex_ctxt details loc