mdoc-0.1.0.0: src/Mdoc/MacroArg.hs
-- |
--
-- Module : Mdoc.MacroArg
-- Copyright : (c) 2026 Patrick Brisbin
-- License : AGPL-3
-- Maintainer : pbrisbin@gmail.com
-- Stability : experimental
-- Portability : POSIX
module Mdoc.MacroArg
( MacroArg (..)
-- * Lenses
, _Mdocdate
) where
import Mdoc.Prelude
import Data.Time (Day)
import Mdoc.Interpolation
import Mdoc.MacroName
import Mdoc.Optics
data MacroArg
= Mdocdate (Maybe Day)
| InterpolatedArg Interpolation
| Callable MacroName
| Quoted Text
| QuotedComma Text
| Bare Text
deriving stock (Eq, Show)
instance IsString MacroArg where
fromString = Bare . pack
_Mdocdate :: Prism' MacroArg (Maybe Day)
_Mdocdate = prism Mdocdate $ \case
Mdocdate day -> Right day
other -> Left other