aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Parser.hs
diff options
context:
space:
mode:
authorAlec Theriault <alec.theriault@gmail.com>2018-12-17 09:25:10 -0500
committerGitHub <noreply@github.com>2018-12-17 09:25:10 -0500
commited43757aa371f9a532665783e27cff1703b4ac90 (patch)
treed797068322124edcd022ebb1a2873a8b7157f0bf /haddock-api/src/Haddock/Parser.hs
parent1380f7fa048ba26f79944452722dff0800b49038 (diff)
Refactor names + unused functions (#982)
This commit should not introduce any change in functionality! * consistently use `getOccString` to convert `Name`s to strings * compare names directly when possible (instead of comparing strings) * get rid of unused utility functions
Diffstat (limited to 'haddock-api/src/Haddock/Parser.hs')
-rw-r--r--haddock-api/src/Haddock/Parser.hs22
1 files changed, 9 insertions, 13 deletions
diff --git a/haddock-api/src/Haddock/Parser.hs b/haddock-api/src/Haddock/Parser.hs
index 58500f1b..e31ea6a8 100644
--- a/haddock-api/src/Haddock/Parser.hs
+++ b/haddock-api/src/Haddock/Parser.hs
@@ -1,8 +1,3 @@
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE StandaloneDeriving
- , FlexibleInstances, UndecidableInstances
- , IncoherentInstances #-}
-{-# LANGUAGE LambdaCase #-}
-- |
-- Module : Haddock.Parser
-- Copyright : (c) Mateusz Kowalczyk 2013,
@@ -19,14 +14,15 @@ module Haddock.Parser ( parseParas
) where
import qualified Documentation.Haddock.Parser as P
-import DynFlags (DynFlags)
-import FastString (mkFastString)
import Documentation.Haddock.Types
-import Lexer (mkPState, unP, ParseResult(POk))
-import Parser (parseIdentifier)
-import RdrName (RdrName)
-import SrcLoc (mkRealSrcLoc, unLoc)
-import StringBuffer (stringToStringBuffer)
+
+import DynFlags ( DynFlags )
+import FastString ( fsLit )
+import Lexer ( mkPState, unP, ParseResult(POk) )
+import Parser ( parseIdentifier )
+import RdrName ( RdrName )
+import SrcLoc ( mkRealSrcLoc, unLoc )
+import StringBuffer ( stringToStringBuffer )
parseParas :: DynFlags -> Maybe Package -> String -> MetaDoc mod RdrName
parseParas d p = overDoc (P.overIdentifier (parseIdent d)) . P.parseParas p
@@ -37,7 +33,7 @@ parseString d = P.overIdentifier (parseIdent d) . P.parseString
parseIdent :: DynFlags -> String -> Maybe RdrName
parseIdent dflags str0 =
let buffer = stringToStringBuffer str0
- realSrcLc = mkRealSrcLoc (mkFastString "<unknown file>") 0 0
+ realSrcLc = mkRealSrcLoc (fsLit "<unknown file>") 0 0
pstate = mkPState dflags buffer realSrcLc
in case unP parseIdentifier pstate of
POk _ name -> Just (unLoc name)