module Render.Literal where

import Agda.Syntax.Literal ( Literal(..), showChar', showText )
import Render.Class
import Render.RichText
import Render.Name ()
import Render.Common ()

--------------------------------------------------------------------------------

-- | Literal
instance Render Literal where
  render :: Literal -> Inlines
render (LitNat Integer
n)    = [Char] -> Inlines
text ([Char] -> Inlines) -> [Char] -> Inlines
forall a b. (a -> b) -> a -> b
$ Integer -> [Char]
forall a. Show a => a -> [Char]
show Integer
n
  render (LitWord64 Word64
n) = [Char] -> Inlines
text ([Char] -> Inlines) -> [Char] -> Inlines
forall a b. (a -> b) -> a -> b
$ Word64 -> [Char]
forall a. Show a => a -> [Char]
show Word64
n
  render (LitFloat Double
d)  = [Char] -> Inlines
text ([Char] -> Inlines) -> [Char] -> Inlines
forall a b. (a -> b) -> a -> b
$ Double -> [Char]
forall a. Show a => a -> [Char]
show Double
d
  render (LitString Text
s) = [Char] -> Inlines
text ([Char] -> Inlines) -> [Char] -> Inlines
forall a b. (a -> b) -> a -> b
$ Text -> ShowS
showText Text
s [Char]
""
  render (LitChar Char
c)   = [Char] -> Inlines
text ([Char] -> Inlines) -> [Char] -> Inlines
forall a b. (a -> b) -> a -> b
$ [Char]
"'" [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ Char -> ShowS
showChar' Char
c [Char]
"'"
  render (LitQName QName
x)  = QName -> Inlines
forall a. Render a => a -> Inlines
render QName
x
  render (LitMeta TopLevelModuleName
_ MetaId
x) = MetaId -> Inlines
forall a. Render a => a -> Inlines
render MetaId
x