This commit is contained in:
Igor Ranieri 2025-09-21 08:19:01 +02:00
commit c9f61c4e06
16 changed files with 1366 additions and 0 deletions

26
src/ParserMonad.hs Normal file
View file

@ -0,0 +1,26 @@
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