From 600bf296dfa6ba10056dd1b4d9b621b470e5a495 Mon Sep 17 00:00:00 2001 From: Bit Connor Date: Sat, 17 Sep 2011 06:51:29 +0000 Subject: [PATCH] Create tags for function declarations --- src/Tags.hs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Tags.hs b/src/Tags.hs index 0a588b6..dc7253c 100644 --- a/src/Tags.hs +++ b/src/Tags.hs @@ -22,6 +22,7 @@ module Tags import Data.Vector(Vector, (!)) import Language.Haskell.Exts.Annotated (SrcSpan(..), SrcSpanInfo(..)) import Language.Haskell.Exts.Annotated.Syntax +import Language.Haskell.Exts.Pretty (prettyPrintStyleMode, Style(..), Mode(OneLineMode), defaultMode) data Tag = Tag { tagName :: String @@ -120,6 +121,14 @@ createDeclTags (DataDecl _ dataOrNew _ hd constructors _) = NewType _ -> TNewType dataTag = createTag name kind Nothing Nothing loc in dataTag : map (createConstructorTag (kind, name)) constructors +createDeclTags (TypeSig _ names t) = + map createFunctionTag names + where + sig = prettyPrintStyleMode (Style OneLineMode 0 0) defaultMode t + createFunctionTag :: Name SrcSpanInfo -> TagC + createFunctionTag name = + let (n, loc) = extractName name + in createTag n TFunction Nothing (Just sig) loc createDeclTags _ = [] -- TODO Also create tags for record fields