forked from elland/haddock2
26 lines
661 B
Haskell
26 lines
661 B
Haskell
module ParserMonad where
|
|
|
|
import Data.String
|
|
import Data.Text (Text)
|
|
import Data.Text qualified as Text
|
|
import Text.Parsec (Parsec)
|
|
import Text.Parsec qualified as Parsec
|
|
|
|
import Types
|
|
|
|
type Parser = Parsec Text ParserState
|
|
|
|
instance (a ~ Text) => IsString (Parser a) where
|
|
fromString = fmap Text.pack . Parsec.string
|
|
|
|
{- | The only bit of information we really care about trudging along with us
|
|
through parsing is the version attached to a @\@since@ annotation - if
|
|
the doc even contained one.
|
|
-}
|
|
newtype ParserState = ParserState
|
|
{ since :: Maybe Since
|
|
}
|
|
deriving (Eq, Show)
|
|
|
|
initialParserState :: ParserState
|
|
initialParserState = ParserState Nothing
|