[project @ 1999-02-11 16:33:44 by simonpj]
[ghc-hetmet.git] / ghc / compiler / basicTypes / BasicTypes.lhs
index d19f0bd..cec3fa8 100644 (file)
@@ -1,5 +1,5 @@
 %
-% (c) The GRASP/AQUA Project, Glasgow University, 1997
+% (c) The GRASP/AQUA Project, Glasgow University, 1997-1998
 %
 \section[BasicTypes]{Miscellanous types}
 
@@ -13,58 +13,53 @@ types that
 \end{itemize}
 
 \begin{code}
-#include "HsVersions.h"
-
 module BasicTypes(
-       SYN_IE(Version), SYN_IE(Arity),
-       SYN_IE(Module), moduleString, pprModule,
-       Fixity(..), FixityDirection(..),
-       NewOrData(..)
+       Version, Arity, 
+       Unused, unused,
+       Fixity(..), FixityDirection(..), StrictnessMark(..),
+       NewOrData(..), TopLevelFlag(..), RecFlag(..)
    ) where
 
-IMP_Ubiq()
+#include "HsVersions.h"
 
-import Pretty
 import Outputable
-
 \end{code}
 
 %************************************************************************
 %*                                                                     *
-\subsection[Arity]{Arity}
+\subsection[Unused]{Unused}
 %*                                                                     *
 %************************************************************************
 
+Used as a placeholder in types.
+
 \begin{code}
-type Arity = Int
+type Unused = ()
+
+unused :: Unused
+unused = error "Unused is used!"
 \end{code}
 
 
 %************************************************************************
 %*                                                                     *
-\subsection[Version]{Module and identifier version numbers}
+\subsection[Arity]{Arity}
 %*                                                                     *
 %************************************************************************
 
 \begin{code}
-type Version = Int
+type Arity = Int
 \end{code}
 
 
 %************************************************************************
 %*                                                                     *
-\subsection[Module]{The name of a module}
+\subsection[Version]{Module and identifier version numbers}
 %*                                                                     *
 %************************************************************************
 
 \begin{code}
-type Module   = FAST_STRING
-
-moduleString :: Module -> String
-moduleString mod = _UNPK_ mod
-
-pprModule :: PprStyle -> Module -> Doc
-pprModule sty m = ptext m
+type Version = Int
 \end{code}
 
 
@@ -80,12 +75,12 @@ data FixityDirection = InfixL | InfixR | InfixN
                     deriving(Eq)
 
 instance Outputable Fixity where
-    ppr sty (Fixity prec dir) = hcat [ppr sty dir, space, int prec]
+    ppr (Fixity prec dir) = hcat [ppr dir, space, int prec]
 
 instance Outputable FixityDirection where
-    ppr sty InfixL = ptext SLIT("infixl")
-    ppr sty InfixR = ptext SLIT("infixr")
-    ppr sty InfixN = ptext SLIT("infix")
+    ppr InfixL = ptext SLIT("infixl")
+    ppr InfixR = ptext SLIT("infixr")
+    ppr InfixN = ptext SLIT("infix")
 
 instance Eq Fixity where               -- Used to determine if two fixities conflict
   (Fixity p1 dir1) == (Fixity p2 dir2) = p1==p2 && dir1 == dir2
@@ -100,7 +95,46 @@ instance Eq Fixity where            -- Used to determine if two fixities conflict
 
 \begin{code}
 data NewOrData
-  = NewType        -- "newtype Blah ..."
-  | DataType       -- "data Blah ..."
-  deriving( Eq )
+  = NewType    -- "newtype Blah ..."
+  | DataType   -- "data Blah ..."
+  | EnumType   -- Enumeration; all constructors are nullary
+  deriving( Eq )       -- Needed because Demand derives Eq
+\end{code}
+
+The @RecFlag@ tells whether the thing is part of a recursive group or not.
+
+
+%************************************************************************
+%*                                                                     *
+\subsection[Top-level/local]{Top-level/not-top level flag}
+%*                                                                     *
+%************************************************************************
+
+\begin{code}
+data TopLevelFlag
+  = TopLevel
+  | NotTopLevel
+\end{code}
+
+
+%************************************************************************
+%*                                                                     *
+\subsection[Top-level/local]{Top-level/not-top level flag}
+%*                                                                     *
+%************************************************************************
+
+\begin{code} 
+data RecFlag = Recursive 
+            | NonRecursive
+\end{code}
+
+%************************************************************************
+%*                                                                     *
+\subsection{Strictness indication}
+%*                                                                     *
+%************************************************************************
+
+\begin{code}
+data StrictnessMark = MarkedStrict
+                   | NotMarkedStrict
 \end{code}