projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add Data and Typeable instances to HsSyn
[ghc-hetmet.git]
/
compiler
/
basicTypes
/
SrcLoc.lhs
diff --git
a/compiler/basicTypes/SrcLoc.lhs
b/compiler/basicTypes/SrcLoc.lhs
index
1a01980
..
8bed6c1
100644
(file)
--- a/
compiler/basicTypes/SrcLoc.lhs
+++ b/
compiler/basicTypes/SrcLoc.lhs
@@
-69,11
+69,14
@@
module SrcLoc (
spans, isSubspanOf
) where
spans, isSubspanOf
) where
+#include "Typeable.h"
+
import Util
import Outputable
import FastString
import Data.Bits
import Util
import Outputable
import FastString
import Data.Bits
+import Data.Data
\end{code}
%************************************************************************
\end{code}
%************************************************************************
@@
-181,6
+184,14
@@
instance Outputable SrcLoc where
char '\"', pprFastFilePath src_path, text " #-}"]
ppr (UnhelpfulLoc s) = ftext s
char '\"', pprFastFilePath src_path, text " #-}"]
ppr (UnhelpfulLoc s) = ftext s
+
+INSTANCE_TYPEABLE0(SrcSpan,srcSpanTc,"SrcSpan")
+
+instance Data SrcSpan where
+ -- don't traverse?
+ toConstr _ = abstractConstr "SrcSpan"
+ gunfold _ _ = error "gunfold"
+ dataTypeOf _ = mkNoRepType "SrcSpan"
\end{code}
%************************************************************************
\end{code}
%************************************************************************
@@
-443,6
+454,7
@@
pprDefnLoc loc
\begin{code}
-- | We attach SrcSpans to lots of things, so let's have a datatype for it.
data Located e = L SrcSpan e
\begin{code}
-- | We attach SrcSpans to lots of things, so let's have a datatype for it.
data Located e = L SrcSpan e
+ deriving (Typeable, Data)
unLoc :: Located e -> e
unLoc (L _ e) = e
unLoc :: Located e -> e
unLoc (L _ e) = e