[project @ 1998-12-22 18:52:04 by simonm]
[ghc-hetmet.git] / ghc / compiler / hsSyn / HsSyn.lhs
index 2f7ec51..fb63e87 100644 (file)
@@ -30,14 +30,8 @@ module HsSyn (
 #include "HsVersions.h"
 
 -- friends:
+import HsDecls         
 import HsBinds
-import HsDecls         ( HsDecl(..), TyDecl(..), InstDecl(..), ClassDecl(..), 
-                         DefaultDecl(..), ForeignDecl(..), ForKind(..),
-                         ExtName(..), isDynamic,  FixityDecl(..), 
-                         ConDecl(..), ConDetails(..), BangType(..),
-                         IfaceSig(..),  SpecDataSig(..), 
-                         hsDeclName
-                       )
 import HsExpr
 import HsImpExp
 import HsBasic
@@ -45,18 +39,18 @@ import HsMatches
 import HsPat
 import HsTypes
 import HsCore
-import BasicTypes      ( Fixity, Version, NewOrData, IfaceFlavour, Module )
+import BasicTypes      ( Fixity, Version, NewOrData, IfaceFlavour )
 
 -- others:
 import Outputable
 import SrcLoc          ( SrcLoc )
 import Bag
-import Name            ( NamedThing )
+import Name            ( Module, NamedThing, pprModule )
 \end{code}
 
 All we actually declare here is the top-level structure for a module.
 \begin{code}
-data HsModule flexi name pat
+data HsModule name pat
   = HsModule
        Module                  -- module name
        (Maybe Version)         -- source interface version number
@@ -67,27 +61,25 @@ data HsModule flexi name pat
                                -- imported interfaces early on, adding that
                                -- info to TyDecls/etc; so this list is
                                -- often empty, downstream.
-       [FixityDecl name]
-       [HsDecl flexi name pat] -- Type, class, value, and interface signature decls
+       [HsDecl name pat]       -- Type, class, value, and interface signature decls
        SrcLoc
 \end{code}
 
 \begin{code}
 instance (NamedThing name, Outputable name, Outputable pat)
-       => Outputable (HsModule flexi name pat) where
+       => Outputable (HsModule name pat) where
 
-    ppr (HsModule name iface_version exports imports fixities
+    ppr (HsModule name iface_version exports imports
                      decls src_loc)
       = vcat [
            case exports of
-             Nothing -> hsep [ptext SLIT("module"), ptext name, ptext SLIT("where")]
+             Nothing -> hsep [ptext SLIT("module"), pprModule name, ptext SLIT("where")]
              Just es -> vcat [
-                           hsep [ptext SLIT("module"), ptext name, lparen],
+                           hsep [ptext SLIT("module"), pprModule name, lparen],
                            nest 8 (interpp'SP es),
                            nest 4 (ptext SLIT(") where"))
                          ],
            pp_nonnull imports,
-           pp_nonnull fixities,
            pp_nonnull decls
        ]
       where
@@ -119,19 +111,19 @@ where
 it should return @[x, y, f, a, b]@ (remember, order important).
 
 \begin{code}
-collectTopBinders :: HsBinds flexi name (InPat name) -> Bag (name,SrcLoc)
+collectTopBinders :: HsBinds name (InPat name) -> Bag (name,SrcLoc)
 collectTopBinders EmptyBinds     = emptyBag
 collectTopBinders (MonoBind b _ _) = collectMonoBinders b
 collectTopBinders (ThenBinds b1 b2)
  = collectTopBinders b1 `unionBags` collectTopBinders b2
 
-collectMonoBinders :: MonoBinds flexi name (InPat name) -> Bag (name,SrcLoc)
-collectMonoBinders EmptyMonoBinds                     = emptyBag
-collectMonoBinders (PatMonoBind pat grhss_w_binds loc) = listToBag (map (\v->(v,loc)) (collectPatBinders pat))
-collectMonoBinders (FunMonoBind f _ matches loc)       = unitBag (f,loc)
-collectMonoBinders (VarMonoBind v expr)               = error "collectMonoBinders"
-collectMonoBinders (CoreMonoBind v expr)              = error "collectMonoBinders"
-collectMonoBinders (AndMonoBinds bs1 bs2)
- = collectMonoBinders bs1 `unionBags` collectMonoBinders bs2
+collectMonoBinders :: MonoBinds name (InPat name) -> Bag (name,SrcLoc)
+collectMonoBinders EmptyMonoBinds               = emptyBag
+collectMonoBinders (PatMonoBind pat _ loc)      = listToBag (map (\v->(v,loc)) (collectPatBinders pat))
+collectMonoBinders (FunMonoBind f _ matches loc) = unitBag (f,loc)
+collectMonoBinders (VarMonoBind v expr)         = error "collectMonoBinders"
+collectMonoBinders (CoreMonoBind v expr)        = error "collectMonoBinders"
+collectMonoBinders (AndMonoBinds bs1 bs2)       = collectMonoBinders bs1 `unionBags`
+                                                  collectMonoBinders bs2
 \end{code}