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 'forall' { ITforall } -- GHC extension keywords
74 'foreign' { ITforeign }
77 'dynamic' { ITdynamic }
80 '__interface' { ITinterface } -- interface keywords
81 '__export' { IT__export }
82 '__forall' { IT__forall }
83 '__depends' { ITdepends }
84 '__letrec' { ITletrec }
85 '__coerce' { ITcoerce }
86 '__inline_call'{ ITinlineCall }
87 '__inline_me' { ITinlineMe }
88 '__DEFAULT' { ITdefaultbranch }
90 '__integer' { ITinteger_lit }
91 '__float' { ITfloat_lit }
92 '__rational' { ITrational_lit }
93 '__addr' { ITaddr_lit }
94 '__litlit' { ITlit_lit }
95 '__string' { ITstring_lit }
96 '__ccall' { ITccall $$ }
98 '__sccC' { ITsccAllCafs }
104 '__P' { ITspecialise }
106 '__U' { ITunfold $$ }
107 '__S' { ITstrict $$ }
109 '__M' { ITcprinfo $$ }
111 '..' { ITdotdot } -- reserved symbols
124 '/\\' { ITbiglam } -- GHC-extension symbols
126 '{' { ITocurly } -- special symbols
137 VARID { ITvarid $$ } -- identifiers
139 VARSYM { ITvarsym $$ }
140 CONSYM { ITconsym $$ }
141 QVARID { ITqvarid $$ }
142 QCONID { ITqconid $$ }
143 QVARSYM { ITqvarsym $$ }
144 QCONSYM { ITqconsym $$ }
146 PRAGMA { ITpragma $$ }
149 STRING { ITstring $$ }
150 INTEGER { ITinteger $$ }
151 RATIONAL { ITrational $$ }
152 CLITLIT { ITlitlit $$ }
154 UNKNOWN { ITunknown $$ }
157 -- iface_stuff is the main production.
158 -- It recognises (a) a whole interface file
159 -- (b) a type (so that type sigs can be parsed lazily)
160 -- (c) the IdInfo part of a signature (same reason)
162 iface_stuff :: { IfaceStuff }
163 iface_stuff : iface { let (nm, iff) = $1 in PIface nm iff }
165 | id_info { PIdInfo $1 }
166 | '__R' rules { PRules $2 }
169 iface :: { (ModuleName, ParsedIface) }
170 iface : '__interface' mod_fs INTEGER orphans checkVersion 'where'
176 { ( $2 -- Module name
178 pi_mod = fromInteger $3, -- Module version
180 pi_exports = $7, -- Exports
181 pi_usages = $8, -- Usages
182 pi_insts = $9, -- Local instances
183 pi_decls = $10, -- Decls
184 pi_rules = $11 -- Rules
187 --------------------------------------------------------------------------
189 import_part :: { [ImportVersion OccName] }
191 | import_part import_decl { $2 : $1 }
193 import_decl :: { ImportVersion OccName }
194 import_decl : 'import' mod_fs INTEGER orphans whats_imported ';'
195 { (mkSysModuleFS $2, fromInteger $3, $4, $5) }
196 -- import Foo 3 :: a 1 b 3 c 7 ; means import a,b,c from Foo
197 -- import Foo 3 ; means import all of Foo
198 -- import Foo 3 ! :: ...stuff... ; the ! means that Foo contains orphans
200 orphans :: { WhetherHasOrphans }
204 whats_imported :: { WhatsImported OccName }
205 whats_imported : { Everything }
206 | '::' name_version_pairs { Specifically $2 }
208 name_version_pairs :: { [LocalVersion OccName] }
209 name_version_pairs : { [] }
210 | name_version_pair name_version_pairs { $1 : $2 }
212 name_version_pair :: { LocalVersion OccName }
213 name_version_pair : var_occ INTEGER { ($1, fromInteger $2) }
214 | tc_occ INTEGER { ($1, fromInteger $2) }
217 --------------------------------------------------------------------------
219 exports_part :: { [ExportItem] }
220 exports_part : { [] }
221 | exports_part '__export'
222 mod_fs entities ';' { (mkSysModuleFS $3, $4) : $1 }
224 entities :: { [RdrAvailInfo] }
226 | entity entities { $1 : $2 }
228 entity :: { RdrAvailInfo }
229 entity : tc_occ { AvailTC $1 [$1] }
230 | var_occ { Avail $1 }
231 | tc_occ stuff_inside { AvailTC $1 ($1:$2) }
232 | tc_occ '|' stuff_inside { AvailTC $1 $3 }
234 stuff_inside :: { [OccName] }
235 stuff_inside : '{' val_occs '}' { $2 }
237 val_occ :: { OccName }
241 val_occs :: { [OccName] }
243 | val_occ val_occs { $1 : $2 }
246 --------------------------------------------------------------------------
248 fixity :: { FixityDirection }
249 fixity : 'infixl' { InfixL }
250 | 'infixr' { InfixR }
254 mb_fix : {-nothing-} { 9 }
255 | INTEGER { (fromInteger $1) }
257 -----------------------------------------------------------------------------
259 csigs :: { [RdrNameSig] }
261 | 'where' '{' csigs1 '}' { $3 }
263 csigs1 :: { [RdrNameSig] }
264 csigs1 : csig { [$1] }
265 | csig ';' csigs1 { $1 : $3 }
267 csig :: { RdrNameSig }
268 csig : src_loc var_name '::' type { mkClassOpSig False $2 $4 $1 }
269 | src_loc var_name '=' '::' type { mkClassOpSig True $2 $5 $1 }
271 --------------------------------------------------------------------------
273 instance_decl_part :: { [RdrNameInstDecl] }
274 instance_decl_part : {- empty -} { [] }
275 | instance_decl_part inst_decl { $2 : $1 }
277 inst_decl :: { RdrNameInstDecl }
278 inst_decl : src_loc 'instance' type '=' var_name ';'
280 EmptyMonoBinds {- No bindings -}
281 [] {- No user pragmas -}
286 --------------------------------------------------------------------------
288 decls_part :: { [(Version, RdrNameHsDecl)] }
291 | decls_part version decl ';' { ($2,$3):$1 }
293 decl :: { RdrNameHsDecl }
294 decl : src_loc var_name '::' type maybe_idinfo
295 { SigD (IfaceSig $2 $4 ($5 $2) $1) }
296 | src_loc 'type' tc_name tv_bndrs '=' type
297 { TyClD (TySynonym $3 $4 $6 $1) }
298 | src_loc 'data' decl_context tc_name tv_bndrs constrs
299 { TyClD (TyData DataType $3 $4 $5 $6 Nothing noDataPragmas $1) }
300 | src_loc 'newtype' decl_context tc_name tv_bndrs newtype_constr
301 { TyClD (TyData NewType $3 $4 $5 $6 Nothing noDataPragmas $1) }
302 | src_loc 'class' decl_context tc_name tv_bndrs csigs
303 { TyClD (mkClassDecl $3 $4 $5 $6 EmptyMonoBinds
305 | src_loc fixity mb_fix var_or_data_name
306 { FixD (FixitySig $4 (Fixity $3 $2) $1) }
308 maybe_idinfo :: { RdrName -> [HsIdInfo RdrName] }
309 maybe_idinfo : {- empty -} { \_ -> [] }
310 | src_loc PRAGMA { \x ->
312 PState{bol = 0#, atbol = 1#,
316 POk _ (PIdInfo id_info) -> id_info
318 pprPanic "IdInfo parse failed"
322 -----------------------------------------------------------------------------
324 rules_part :: { [RdrNameRuleDecl] }
325 rules_part : {- empty -} { [] }
326 | src_loc PRAGMA { case parseIface $2
327 PState{bol = 0#, atbol = 1#,
331 POk _ (PRules rules) -> rules
333 pprPanic "Rules parse failed" err
336 rules :: { [RdrNameRuleDecl] }
338 | rule ';' rules { $1:$3 }
340 rule :: { RdrNameRuleDecl }
341 rule : src_loc STRING rule_forall qvar_name
342 core_args '=' core_expr { IfaceRuleDecl $4 (UfRuleBody $2 $3 $5 $7) $1 }
344 rule_forall :: { [UfBinder RdrName] }
345 rule_forall : '__forall' '{' core_bndrs '}' { $3 }
347 -----------------------------------------------------------------------------
349 version :: { Version }
350 version : INTEGER { fromInteger $1 }
352 decl_context :: { RdrNameContext }
353 decl_context : { [] }
354 | '{' context_list1 '}' '=>' { $2 }
356 ----------------------------------------------------------------------------
358 constrs :: { [RdrNameConDecl] {- empty for handwritten abstract -} }
360 | '=' constrs1 { $2 }
362 constrs1 :: { [RdrNameConDecl] }
363 constrs1 : constr { [$1] }
364 | constr '|' constrs1 { $1 : $3 }
366 constr :: { RdrNameConDecl }
367 constr : src_loc ex_stuff data_name batypes { mkConDecl $3 $2 (VanillaCon $4) $1 }
368 | src_loc ex_stuff data_name '{' fields1 '}' { mkConDecl $3 $2 (RecCon $5) $1 }
369 -- We use "data_fs" so as to include ()
371 newtype_constr :: { [RdrNameConDecl] {- Empty if handwritten abstract -} }
372 newtype_constr : { [] }
373 | src_loc '=' ex_stuff data_name atype { [mkConDecl $4 $3 (NewCon $5 Nothing) $1] }
374 | src_loc '=' ex_stuff data_name '{' var_name '::' atype '}'
375 { [mkConDecl $4 $3 (NewCon $8 (Just $6)) $1] }
377 ex_stuff :: { ([HsTyVar RdrName], RdrNameContext) }
378 ex_stuff : { ([],[]) }
379 | '__forall' forall context '=>' { ($2,$3) }
381 batypes :: { [RdrNameBangType] }
383 | batype batypes { $1 : $2 }
385 batype :: { RdrNameBangType }
386 batype : atype { Unbanged $1 }
387 | '!' atype { Banged $2 }
388 | '!' '!' atype { Unpacked $3 }
390 fields1 :: { [([RdrName], RdrNameBangType)] }
391 fields1 : field { [$1] }
392 | field ',' fields1 { $1 : $3 }
394 field :: { ([RdrName], RdrNameBangType) }
395 field : var_names1 '::' type { ($1, Unbanged $3) }
396 | var_names1 '::' '!' type { ($1, Banged $4) }
397 | var_names1 '::' '!' '!' type { ($1, Unpacked $5) }
398 --------------------------------------------------------------------------
400 type :: { RdrNameHsType }
401 type : '__forall' forall context '=>' type
402 { mkHsForAllTy $2 $3 $5 }
403 | btype '->' type { MonoFunTy $1 $3 }
406 forall :: { [HsTyVar RdrName] }
407 forall : '[' tv_bndrs ']' { $2 }
409 context :: { RdrNameContext }
411 | '{' context_list1 '}' { $2 }
413 context_list1 :: { RdrNameContext }
414 context_list1 : class { [$1] }
415 | class ',' context_list1 { $1 : $3 }
417 class :: { (RdrName, [RdrNameHsType]) }
418 class : qcls_name atypes { ($1, $2) }
420 types2 :: { [RdrNameHsType] {- Two or more -} }
421 types2 : type ',' type { [$1,$3] }
422 | type ',' types2 { $1 : $3 }
424 btype :: { RdrNameHsType }
426 | btype atype { MonoTyApp $1 $2 }
427 | '__o' atype { MonoUsgTy UsOnce $2 }
428 | '__m' atype { MonoUsgTy UsMany $2 }
430 atype :: { RdrNameHsType }
431 atype : qtc_name { MonoTyVar $1 }
432 | tv_name { MonoTyVar $1 }
433 | '(' types2 ')' { MonoTupleTy $2 True{-boxed-} }
434 | '(#' type '#)' { MonoTupleTy [$2] False{-unboxed-} }
435 | '(#' types2 '#)' { MonoTupleTy $2 False{-unboxed-} }
436 | '[' type ']' { MonoListTy $2 }
437 | '{' qcls_name atypes '}' { MonoDictTy $2 $3 }
438 | '(' type ')' { $2 }
440 -- This one is dealt with via qtc_name
441 -- | '(' ')' { MonoTupleTy [] True }
443 atypes :: { [RdrNameHsType] {- Zero or more -} }
445 | atype atypes { $1 : $2 }
446 ---------------------------------------------------------------------
447 mod_fs :: { EncodedFS }
450 mod_name :: { ModuleName }
451 : mod_fs { mkSysModuleFS $1 }
454 ---------------------------------------------------
455 var_fs :: { EncodedFS }
459 | 'forall' { SLIT("forall") }
460 | 'foreign' { SLIT("foreign") }
461 | 'export' { SLIT("export") }
462 | 'label' { SLIT("label") }
463 | 'dynamic' { SLIT("dynamic") }
464 | 'unsafe' { SLIT("unsafe") }
466 qvar_fs :: { (EncodedFS, EncodedFS) }
470 var_occ :: { OccName }
471 : var_fs { mkSysOccFS varName $1 }
473 var_name :: { RdrName }
474 var_name : var_occ { mkRdrUnqual $1 }
476 qvar_name :: { RdrName }
477 qvar_name : var_name { $1 }
478 | qvar_fs { mkSysQual varName $1 }
480 var_names :: { [RdrName] }
482 | var_name var_names { $1 : $2 }
484 var_names1 :: { [RdrName] }
485 var_names1 : var_name var_names { $1 : $2 }
487 ---------------------------------------------------
488 -- For some bizarre reason,
489 -- (,,,) is dealt with by the parser
490 -- Foo.(,,,) is dealt with by the lexer
493 data_fs :: { EncodedFS }
497 qdata_fs :: { (EncodedFS, EncodedFS) }
501 data_occ :: { OccName }
502 : data_fs { mkSysOccFS dataName $1 }
504 data_name :: { RdrName }
505 : data_occ { mkRdrUnqual $1 }
507 qdata_name :: { RdrName }
508 qdata_name : data_name { $1 }
509 | qdata_fs { mkSysQual dataName $1 }
511 qdata_names :: { [RdrName] }
513 | qdata_name qdata_names { $1 : $2 }
515 var_or_data_name :: { RdrName }
519 ---------------------------------------------------
520 tc_fs :: { EncodedFS }
523 tc_occ :: { OccName }
524 : tc_fs { mkSysOccFS tcName $1 }
526 tc_name :: { RdrName }
527 : tc_occ { mkRdrUnqual $1 }
529 qtc_name :: { RdrName }
531 | qdata_fs { mkSysQual tcName $1 }
533 ---------------------------------------------------
534 cls_name :: { RdrName }
535 : data_fs { mkSysUnqual clsName $1 }
537 qcls_name :: { RdrName }
539 | qdata_fs { mkSysQual clsName $1 }
541 ---------------------------------------------------
542 tv_name :: { RdrName }
543 : VARID { mkSysUnqual tvName $1 }
544 | VARSYM { mkSysUnqual tvName $1 {- Allow t2 as a tyvar -} }
546 tv_bndr :: { HsTyVar RdrName }
547 : tv_name '::' akind { IfaceTyVar $1 $3 }
548 | tv_name { IfaceTyVar $1 boxedTypeKind }
550 tv_bndrs :: { [HsTyVar RdrName] }
552 | tv_bndr tv_bndrs { $1 : $2 }
554 ---------------------------------------------------
557 | akind '->' kind { mkArrowKind $1 $3 }
560 : VARSYM { if $1 == SLIT("*") then
562 else if $1 == SLIT("?") then
564 else panic "ParseInterface: akind"
566 | '(' kind ')' { $2 }
568 --------------------------------------------------------------------------
570 id_info :: { [HsIdInfo RdrName] }
572 | id_info_item id_info { $1 : $2 }
573 | strict_info id_info { $1 ++ $2 }
575 id_info_item :: { HsIdInfo RdrName }
576 : '__A' arity_info { HsArity $2 }
577 | '__U' core_expr { HsUnfold $1 (Just $2) }
578 | '__U' { HsUnfold $1 Nothing }
579 | '__C' { HsNoCafRefs }
581 strict_info :: { [HsIdInfo RdrName] }
582 : cpr worker { ($1:$2) }
583 | strict worker { ($1:$2) }
584 | cpr strict worker { ($1:$2:$3) }
586 cpr :: { HsIdInfo RdrName }
587 : '__M' { HsCprInfo $1 }
589 strict :: { HsIdInfo RdrName }
590 : '__S' { HsStrictness (HsStrictnessInfo $1) }
592 worker :: { [HsIdInfo RdrName] }
593 : qvar_name { [HsWorker $1] }
594 | {- nothing -} { [] }
596 arity_info :: { ArityInfo }
597 : INTEGER { exactArity (fromInteger $1) }
599 -------------------------------------------------------
600 core_expr :: { UfExpr RdrName }
601 core_expr : '\\' core_bndrs '->' core_expr { foldr UfLam $4 $2 }
602 | 'case' core_expr 'of' var_name
603 '{' core_alts '}' { UfCase $2 $4 $6 }
605 | 'let' '{' core_val_bndr '=' core_expr
606 '}' 'in' core_expr { UfLet (UfNonRec $3 $5) $8 }
607 | '__letrec' '{' rec_binds '}'
608 'in' core_expr { UfLet (UfRec $3) $6 }
610 | con_or_primop '{' core_args '}' { UfCon $1 $3 }
611 | '__litlit' STRING atype { UfCon (UfLitLitCon $2 $3) [] }
613 | '__inline_me' core_expr { UfNote UfInlineMe $2 }
614 | '__inline_call' core_expr { UfNote UfInlineCall $2 }
615 | '__coerce' atype core_expr { UfNote (UfCoerce $2) $3 }
616 | scc core_expr { UfNote (UfSCC $1) $2 }
619 fexpr :: { UfExpr RdrName }
620 fexpr : fexpr core_arg { UfApp $1 $2 }
623 core_arg :: { UfExpr RdrName }
624 : '@' atype { UfType $2 }
627 core_args :: { [UfExpr RdrName] }
629 | core_arg core_args { $1 : $2 }
631 core_aexpr :: { UfExpr RdrName } -- Atomic expressions
632 core_aexpr : qvar_name { UfVar $1 }
634 | qdata_name { UfVar $1 }
635 -- This one means that e.g. "True" will parse as
636 -- (UfVar True_Id) rather than (UfCon True_Con []).
637 -- No big deal; it'll be inlined in a jiffy. I tried
638 -- parsing it to (Con con []) directly, but got bitten
639 -- when a real constructor Id showed up in an interface
640 -- file. As usual, a hack bites you in the end.
641 -- If you want to get a UfCon, then use the
642 -- curly-bracket notation (True {}).
644 | core_lit { UfCon (UfLitCon $1) [] }
645 | '(' core_expr ')' { $2 }
646 | '(' comma_exprs2 ')' { UfTuple (mkTupConRdrName (length $2)) $2 }
647 | '(#' core_expr '#)' { UfTuple (mkUbxTupConRdrName 1) [$2] }
648 | '(#' comma_exprs2 '#)' { UfTuple (mkUbxTupConRdrName (length $2)) $2 }
650 -- This one is dealt with by qdata_name: see above comments
651 -- | '(' ')' { UfTuple (mkTupConRdrName 0) [] }
653 comma_exprs2 :: { [UfExpr RdrName] } -- Two or more
654 comma_exprs2 : core_expr ',' core_expr { [$1,$3] }
655 | core_expr ',' comma_exprs2 { $1 : $3 }
657 con_or_primop :: { UfCon RdrName }
658 con_or_primop : qdata_name { UfDataCon $1 }
659 | qvar_name { UfPrimOp $1 }
660 | '__ccall' ccall_string { let
661 (is_dyn, is_casm, may_gc) = $1
663 UfCCallOp $2 is_dyn is_casm may_gc
666 rec_binds :: { [(UfBinder RdrName, UfExpr RdrName)] }
668 | core_val_bndr '=' core_expr ';' rec_binds { ($1,$3) : $5 }
670 core_alts :: { [UfAlt RdrName] }
672 | core_alt ';' core_alts { $1 : $3 }
674 core_alt :: { UfAlt RdrName }
675 core_alt : core_pat '->' core_expr { (fst $1, snd $1, $3) }
677 core_pat :: { (UfCon RdrName, [RdrName]) }
678 core_pat : core_lit { (UfLitCon $1, []) }
679 | '__litlit' STRING atype { (UfLitLitCon $2 $3, []) }
680 | qdata_name var_names { (UfDataCon $1, $2) }
681 | '(' comma_var_names1 ')' { (UfDataCon (mkTupConRdrName (length $2)), $2) }
682 | '(#' comma_var_names1 '#)' { (UfDataCon (mkUbxTupConRdrName (length $2)), $2) }
683 | '__DEFAULT' { (UfDefault, []) }
684 | '(' core_pat ')' { $2 }
687 comma_var_names1 :: { [RdrName] } -- One or more
688 comma_var_names1 : var_name { [$1] }
689 | var_name ',' comma_var_names1 { $1 : $3 }
691 core_lit :: { Literal }
692 core_lit : integer { mkMachInt_safe $1 }
693 | CHAR { MachChar $1 }
694 | STRING { MachStr $1 }
695 | '__string' STRING { NoRepStr $2 (panic "NoRepStr type") }
696 | rational { MachDouble $1 }
697 | '__float' rational { MachFloat $2 }
699 | '__integer' integer { NoRepInteger $2 (panic "NoRepInteger type")
700 -- The type checker will add the types
703 | '__rational' integer integer { NoRepRational ($2 % $3)
704 (panic "NoRepRational type")
705 -- The type checker will add the type
708 | '__addr' integer { MachAddr $2 }
710 integer :: { Integer }
712 | '-' INTEGER { (-$2) }
714 rational :: { Rational }
716 | '-' RATIONAL { (-$2) }
718 core_bndr :: { UfBinder RdrName }
719 core_bndr : core_val_bndr { $1 }
720 | core_tv_bndr { $1 }
722 core_bndrs :: { [UfBinder RdrName] }
724 | core_bndr core_bndrs { $1 : $2 }
726 core_val_bndr :: { UfBinder RdrName }
727 core_val_bndr : var_name '::' atype { UfValBinder $1 $3 }
729 core_tv_bndr :: { UfBinder RdrName }
730 core_tv_bndr : '@' tv_name '::' akind { UfTyBinder $2 $4 }
731 | '@' tv_name { UfTyBinder $2 boxedTypeKind }
733 ccall_string :: { FAST_STRING }
739 ------------------------------------------------------------------------
740 scc :: { CostCentre }
741 : '__sccC' '{' mod_name STRING '}' { AllCafsCC $3 $4 }
742 | '__scc' '{' cc_name mod_name STRING cc_dup cc_caf '}'
743 { NormalCC { cc_name = $3, cc_mod = $4, cc_grp = $5,
744 cc_is_dupd = $6, cc_is_caf = $7 } }
746 cc_name :: { EncodedFS }
750 cc_dup :: { IsDupdCC }
751 cc_dup : { OriginalCC }
754 cc_caf :: { IsCafCC }
758 -------------------------------------------------------------------
760 src_loc :: { SrcLoc }
761 src_loc : {% getSrcLocP }
763 checkVersion :: { () }
764 : {-empty-} {% checkVersion Nothing }
765 | INTEGER {% checkVersion (Just (fromInteger $1)) }
767 -------------------------------------------------------------------
772 happyError buf PState{ loc = loc } = PFailed (ifaceParseErr buf loc)
774 data IfaceStuff = PIface EncodedFS{-.hi module name-} ParsedIface
775 | PIdInfo [HsIdInfo RdrName]
776 | PType RdrNameHsType
777 | PRules [RdrNameRuleDecl]
779 mkConDecl name (ex_tvs, ex_ctxt) details loc = ConDecl name ex_tvs ex_ctxt details loc