open import 1Lab.Path.IdentitySystem
open import 1Lab.Path
open import 1Lab.Type

open import Data.Reflection.Meta
open import Data.Reflection.Name
open import Data.String.Base
open import Data.Float.Base
open import Data.Char.Base
open import Data.Word.Base
open import Data.Dec.Base
open import Data.Nat.Base
open import Data.Id.Base

module Data.Reflection.Literal where

data Literal : Type where
  nat    : (n : Nat)     Literal
  word64 : (n : Word64)  Literal
  float  : (x : Float)   Literal
  char   : (c : Char)    Literal
  string : (s : String)  Literal
  name   : (x : Name)    Literal
  meta   : (x : Meta)    Literal

{-# BUILTIN AGDALITERAL   Literal #-}
{-# BUILTIN AGDALITNAT    nat     #-}
{-# BUILTIN AGDALITWORD64 word64  #-}
{-# BUILTIN AGDALITFLOAT  float   #-}
{-# BUILTIN AGDALITCHAR   char    #-}
{-# BUILTIN AGDALITSTRING string  #-}
{-# BUILTIN AGDALITQNAME  name    #-}
{-# BUILTIN AGDALITMETA   meta    #-}

instance
  Discrete-Literal : Discrete Literal
  Discrete-Literal = Discreteᵢ→discrete λ where
    (nat n) (nat n₁)  case n ≡ᵢ? n₁ of λ where
      (yes reflᵢ)  yes reflᵢ
      (no ¬p)  no λ { reflᵢ  ¬p reflᵢ }
    (word64 n) (word64 n₁)  case n ≡ᵢ? n₁ of λ where
      (yes reflᵢ)  yes reflᵢ
      (no ¬p)  no λ { reflᵢ  ¬p reflᵢ }
    (float x) (float x₁)  case x ≡ᵢ? x₁ of λ where
      (yes reflᵢ)  yes reflᵢ
      (no ¬p)  no λ { reflᵢ  ¬p reflᵢ }
    (char c) (char c₁)  case c ≡ᵢ? c₁ of λ where
      (yes reflᵢ)  yes reflᵢ
      (no ¬p)  no λ { reflᵢ  ¬p reflᵢ }
    (string s) (string s₁)  case s ≡ᵢ? s₁ of λ where
      (yes reflᵢ)  yes reflᵢ
      (no ¬p)  no λ { reflᵢ  ¬p reflᵢ }
    (name x) (name x₁)  case x ≡ᵢ? x₁ of λ where
      (yes reflᵢ)  yes reflᵢ
      (no ¬p)  no λ { reflᵢ  ¬p reflᵢ }
    (meta x) (meta x₁)  case x ≡ᵢ? x₁ of λ where
      (yes reflᵢ)  yes reflᵢ
      (no ¬p)  no λ { reflᵢ  ¬p reflᵢ }

    (nat n) (word64 n₁)  no  ())
    (nat n) (float x)    no  ())
    (nat n) (char c)     no  ())
    (nat n) (string s)   no  ())
    (nat n) (name x)     no  ())
    (nat n) (meta x)     no  ())

    (word64 n) (nat n₁)     no  ())
    (word64 n) (float x)    no  ())
    (word64 n) (char c)     no  ())
    (word64 n) (string s)   no  ())
    (word64 n) (name x)     no  ())
    (word64 n) (meta x)     no  ())

    (float x) (nat n)     no  ())
    (float x) (word64 n)  no  ())
    (float x) (char c)    no  ())
    (float x) (string s)  no  ())
    (float x) (name x₁)   no  ())
    (float x) (meta x₁)   no  ())

    (char c) (nat n)     no  ())
    (char c) (word64 n)  no  ())
    (char c) (float x)   no  ())
    (char c) (string s)  no  ())
    (char c) (name x)    no  ())
    (char c) (meta x)    no  ())

    (string s) (nat n)      no  ())
    (string s) (word64 n)   no  ())
    (string s) (float x)    no  ())
    (string s) (char c)     no  ())
    (string s) (name x)     no  ())
    (string s) (meta x)     no  ())

    (name x) (nat n)     no  ())
    (name x) (word64 n)  no  ())
    (name x) (float x₁)  no  ())
    (name x) (char c)    no  ())
    (name x) (string s)  no  ())
    (name x) (meta x₁)   no  ())

    (meta x) (nat n)     no  ())
    (meta x) (word64 n)  no  ())
    (meta x) (float x₁)  no  ())
    (meta x) (char c)    no  ())
    (meta x) (string s)  no  ())
    (meta x) (name x₁)   no  ())