2 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1996
4 \section{Haskell abstract syntax definition}
6 This module glues together the pieces of the Haskell abstract syntax,
7 which is declared in the various \tr{Hs*} modules. This module,
8 therefore, is almost nothing but re-exporting.
11 #include "HsVersions.h"
15 -- NB: don't reexport HsCore or HsPragmas;
16 -- this module tells about "real Haskell"
22 EXP_MODULE(HsImpExp) ,
24 EXP_MODULE(HsMatches) ,
34 import HsDecls ( HsDecl(..), TyDecl(..), InstDecl(..), ClassDecl(..),
37 ConDecl(..), ConDetails(..), BangType(..),
38 IfaceSig(..), HsIdInfo, SpecDataSig(..), SpecInstSig(..),
47 import HsPragmas ( ClassPragmas, ClassOpPragmas,
48 DataPragmas, GenPragmas, InstancePragmas )
50 import TyCon ( NewOrData(..) )
53 import FiniteMap ( FiniteMap )
54 import Outputable ( ifPprShowAll, ifnotPprForUser, interpp'SP, Outputable(..) )
56 import SrcLoc ( SrcLoc )
57 #if __GLASGOW_HASKELL__ >= 202
62 @Fake@ is a placeholder type; for when tyvars and uvars aren't used.
66 instance Outputable Fake
69 All we actually declare here is the top-level structure for a module.
71 data HsModule tyvar uvar name pat
74 (Maybe Version) -- source interface version number
75 (Maybe [IE name]) -- export list; Nothing => export everything
76 -- Just [] => export *nothing* (???)
77 -- Just [...] => as you would expect...
78 [ImportDecl name] -- We snaffle interesting stuff out of the
79 -- imported interfaces early on, adding that
80 -- info to TyDecls/etc; so this list is
81 -- often empty, downstream.
83 [HsDecl tyvar uvar name pat] -- Type, class, value, and interface signature decls
88 instance (NamedThing name, Outputable name, Outputable pat,
89 Eq tyvar, Outputable tyvar, Eq uvar, Outputable uvar)
90 => Outputable (HsModule tyvar uvar name pat) where
92 ppr sty (HsModule name iface_version exports imports fixities
95 ifPprShowAll sty (ppr sty src_loc),
96 ifnotPprForUser sty (pp_iface_version iface_version),
98 Nothing -> hsep [ptext SLIT("module"), ptext name, ptext SLIT("where")]
100 hsep [ptext SLIT("module"), ptext name, lparen],
101 nest 8 (interpp'SP sty es),
102 nest 4 (ptext SLIT(") where"))
109 pp_nonnull [] = empty
110 pp_nonnull xs = vcat (map (ppr sty) xs)
112 pp_iface_version Nothing = empty
113 pp_iface_version (Just n) = hsep [text "{-# INTERFACE", int n, text "#-}"]