Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Accept instances on export lists.

  • Loading branch information...
commit 0186673c580c50fcee43f246a43cf23b4cd0d612 1 parent 31d062a
Marco Túlio Gontijo authored
1  src/Language/Haskell/Exts/Annotated/ExactPrint.hs
View
@@ -331,6 +331,7 @@ instance ExactP ExportSpec where
let k = length (srcInfoPoints l)
in exactP qn >> printInterleaved (zip (srcInfoPoints l) $ "(":replicate (k-2) "," ++ [")"]) cns
EModuleContents l mn -> printString "module" >> exactPC mn
+ EInstance l c t -> printString "instance" >> exactP c >> exactP t
instance ExactP ExportSpecList where
exactP (ExportSpecList l ess) =
1  src/Language/Haskell/Exts/Annotated/Simplify.hs
View
@@ -171,6 +171,7 @@ sExportSpec es = case es of
EThingAll _ qn -> S.EThingAll (sQName qn)
EThingWith _ qn cns -> S.EThingWith (sQName qn) (map sCName cns)
EModuleContents _ mn -> S.EModuleContents (sModuleName mn)
+ EInstance _ c t -> S.EInstance (sQName c) (sQName t)
sImportDecl :: SrcInfo loc => ImportDecl loc -> S.ImportDecl
sImportDecl (ImportDecl l mn qu src mpkg as misl) =
4 src/Language/Haskell/Exts/Annotated/Syntax.hs
View
@@ -247,6 +247,7 @@ data ExportSpec l
-- a datatype exported with some of its constructors.
| EModuleContents l (ModuleName l) -- ^ @module M@:
-- re-export a module.
+ | EInstance l (QName l) (QName l)
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Ord,Show,Typeable,Data)
#else
@@ -1173,6 +1174,7 @@ instance Functor ExportSpec where
EThingAll l qn -> EThingAll (f l) (fmap f qn)
EThingWith l qn cns -> EThingWith (f l) (fmap f qn) (map (fmap f) cns)
EModuleContents l mn -> EModuleContents (f l) (fmap f mn)
+ EInstance l c t -> EInstance (f l) (fmap f c) (fmap f t)
instance Functor ImportDecl where
fmap f (ImportDecl l mn qual src pkg mmn mis) =
@@ -1629,12 +1631,14 @@ instance Annotated ExportSpec where
EThingAll l qn -> l
EThingWith l qn cns -> l
EModuleContents l mn -> l
+ EInstance l c t -> l
amap f es = case es of
EVar l qn -> EVar (f l) qn
EAbs l qn -> EAbs (f l) qn
EThingAll l qn -> EThingAll (f l) qn
EThingWith l qn cns -> EThingWith (f l) qn cns
EModuleContents l mn -> EModuleContents (f l) mn
+ EInstance l c t -> EInstance (f l) c t
instance Annotated ImportDecl where
ann (ImportDecl l mn qual src pkg mmn mis) = l
1  src/Language/Haskell/Exts/InternalParser.ly
View
@@ -390,6 +390,7 @@ The Export List
> | qtyconorcls '(' ')' { EThingWith (ann $1 <++> nIS $3 <** [$2,$3]) $1 [] }
> | qtyconorcls '(' cnames ')' { EThingWith (ann $1 <++> nIS $4 <** ($2:reverse (snd $3) ++ [$4])) $1 (reverse (fst $3)) }
> | 'module' modid { EModuleContents (nIS $1 <++> ann $2 <** [$1]) $2 }
+> | 'instance' qtyconorcls qtyconorcls { EInstance (ann $2) $2 $3 }
-----------------------------------------------------------------------------
Import Declarations
2  src/Language/Haskell/Exts/Pretty.hs
View
@@ -297,6 +297,8 @@ instance Pretty ExportSpec where
pretty (EThingWith name nameList) =
pretty name <> (parenList . map pretty $ nameList)
pretty (EModuleContents m) = text "module" <+> pretty m
+ pretty (EInstance c t)
+ = text "instance" <+> pretty c <+> pretty t
instance Pretty ImportDecl where
pretty (ImportDecl pos m qual src mbPkg mbName mbSpecs) =
1  src/Language/Haskell/Exts/Syntax.hs
View
@@ -220,6 +220,7 @@ data ExportSpec
-- a datatype exported with some of its constructors.
| EModuleContents ModuleName -- ^ @module M@:
-- re-export a module.
+ | EInstance QName QName
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Ord,Show,Typeable,Data)
#else
Please sign in to comment.
Something went wrong with that request. Please try again.