{-# LANGUAGE ViewPatterns #-}

module GHC.Rename.Doc ( rnHsDoc, rnLHsDoc, rnMbLHsDoc ) where

import GHC.Prelude

import GHC.Tc.Types
import GHC.Hs
import GHC.Types.SrcLoc


rnMbLHsDoc :: Maybe LHsDocString -> RnM (Maybe LHsDocString)
rnMbLHsDoc :: Maybe LHsDocString -> RnM (Maybe LHsDocString)
rnMbLHsDoc Maybe LHsDocString
mb_doc = case Maybe LHsDocString
mb_doc of
  Just LHsDocString
doc -> do
    LHsDocString
doc' <- LHsDocString -> RnM LHsDocString
rnLHsDoc LHsDocString
doc
    Maybe LHsDocString -> RnM (Maybe LHsDocString)
forall (m :: * -> *) a. Monad m => a -> m a
return (LHsDocString -> Maybe LHsDocString
forall a. a -> Maybe a
Just LHsDocString
doc')
  Maybe LHsDocString
Nothing -> Maybe LHsDocString -> RnM (Maybe LHsDocString)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe LHsDocString
forall a. Maybe a
Nothing

rnLHsDoc :: LHsDocString -> RnM LHsDocString
rnLHsDoc :: LHsDocString -> RnM LHsDocString
rnLHsDoc (L SrcSpan
pos HsDocString
doc) = do
  HsDocString
doc' <- HsDocString -> RnM HsDocString
rnHsDoc HsDocString
doc
  LHsDocString -> RnM LHsDocString
forall (m :: * -> *) a. Monad m => a -> m a
return (SrcSpan -> HsDocString -> LHsDocString
forall l e. l -> e -> GenLocated l e
L SrcSpan
pos HsDocString
doc')

rnHsDoc :: HsDocString -> RnM HsDocString
rnHsDoc :: HsDocString -> RnM HsDocString
rnHsDoc = HsDocString -> RnM HsDocString
forall (f :: * -> *) a. Applicative f => a -> f a
pure