Source code on Github
{-# OPTIONS --cubical-compatible #-}
module Test.Coercions where

open import Class.Prelude
open import Class.Coercions

𝟚 = ⊀ ⊎ ⊀
pattern 𝕃 = inj₁ tt; pattern ℝ = injβ‚‚ tt

instance
  ↝Bool : 𝟚 ↝ Bool
  ↝Bool .to = Ξ» where
    𝕃 β†’ true
    ℝ β†’ false

  Bool↝ : Bool ↝ 𝟚
  Bool↝ .to = Ξ» where
    true  β†’ 𝕃
    false β†’ ℝ

_ : Bool
_ = to 𝕃

_ : 𝟚
_ = to true

_ : Bool β†’ Bool
_ = not ∘ to[ Bool ] ∘ to[ 𝟚 ]