module Data.Char where
open import Data.Nat using (ℕ)
import Data.Nat.Properties as NatProp
open import Data.Bool using (Bool; true; false)
open import Relation.Nullary
open import Relation.Nullary.Decidable
open import Relation.Binary
import Relation.Binary.On as On
open import Relation.Binary.PropositionalEquality as PropEq using (_≡_)
open import Relation.Binary.PropositionalEquality.TrustMe
open import Data.String.Core using (String; primShowChar)
import Data.Char.Core as Core
open Core public using (Char)
open Core
show : Char → String
show = primShowChar
toNat : Char → ℕ
toNat = primCharToNat
_≟_ : Decidable {A = Char} _≡_
s₁ ≟ s₂ with primCharEquality s₁ s₂
... | true = yes trustMe
... | false = no whatever
where postulate whatever : _
infix 4 _==_
_==_ : Char → Char → Bool
c₁ == c₂ = ⌊ c₁ ≟ c₂ ⌋
private
data P : (Char → Bool) → Set where
p : (c : Char) → P (_==_ c)
unit-test : P (_==_ 'x')
unit-test = p _
setoid : Setoid _ _
setoid = PropEq.setoid Char
decSetoid : DecSetoid _ _
decSetoid = PropEq.decSetoid _≟_
strictTotalOrder : StrictTotalOrder _ _ _
strictTotalOrder = On.strictTotalOrder NatProp.strictTotalOrder toNat