summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormpickering <>2015-09-28 18:09:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2015-09-28 18:09:00 (GMT)
commit5ecab007e7289022da08fcedf63ccedf69c22d0b (patch)
treef280339460907ce35e71a032599f45c48a242565
parent07d195c3afd038ec78da67ec7157e9389762a847 (diff)
version 0.4.1.00.4.1.0
-rw-r--r--ChangeLog3
-rw-r--r--ghc-exactprint.cabal2
-rw-r--r--src/Language/Haskell/GHC/ExactPrint/Annotate.hs9
3 files changed, 10 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 946c2c3..1bfeda6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2015-09-28 v0.4.1
+ * Revert removing cast from markLocated until further inspection in HaRe.
+
2015-09-28 v0.4.0.0
* Rework HasDecls so that there are only instances for which it is
idempotent. Provide functions for managing an LHsBind which is not
diff --git a/ghc-exactprint.cabal b/ghc-exactprint.cabal
index dd651bb..00ec9cd 100644
--- a/ghc-exactprint.cabal
+++ b/ghc-exactprint.cabal
@@ -1,5 +1,5 @@
name: ghc-exactprint
-version: 0.4.0.0
+version: 0.4.1.0
synopsis: ExactPrint for GHC
description: Using the API Annotations available from GHC 7.10.2, this
library provides a means to round trip any code that can
diff --git a/src/Language/Haskell/GHC/ExactPrint/Annotate.hs b/src/Language/Haskell/GHC/ExactPrint/Annotate.hs
index bfb54bd..0e92353 100644
--- a/src/Language/Haskell/GHC/ExactPrint/Annotate.hs
+++ b/src/Language/Haskell/GHC/ExactPrint/Annotate.hs
@@ -191,7 +191,10 @@ markTrailingSemi = markOutside GHC.AnnSemi AnnSemiSep
-- | Constructs a syntax tree which contains information about which
-- annotations are required by each element.
markLocated :: (Annotate ast) => GHC.Located ast -> Annotated ()
-markLocated ast = withLocated ast markAST
+markLocated ast =
+ case cast ast :: Maybe (GHC.LHsDecl GHC.RdrName) of
+ Just d -> markLHsDecl d
+ Nothing -> withLocated ast markAST
withLocated :: Data a
=> GHC.Located a
@@ -269,7 +272,7 @@ instance Annotate (GHC.HsModule GHC.RdrName) where
markMany GHC.AnnSemi -- possible leading semis
mapM_ markLocated imps
- mapM_ (\(GHC.L l ast) -> markAST l ast) decs
+ mapM_ markLocated decs
mark GHC.AnnCloseC -- Possible '}'
@@ -1840,7 +1843,7 @@ instance (GHC.DataId name,GHC.OutputableBndr name,GHC.HasOccName name,Annotate n
markAST _ (GHC.HsBracket (GHC.DecBrL ds)) = do
markWithString GHC.AnnOpen "[d|"
mark GHC.AnnOpenC
- mapM_ (\(GHC.L l d) -> markAST l d) ds
+ mapM_ markLocated ds
mark GHC.AnnCloseC
markWithString GHC.AnnClose "|]"
-- Introduced after the renamer