Source code on Github
{-# OPTIONS --safe #-}
module Prelude.Views where

open import Prelude.Init; open SetAsType

private variable A : Type 

record _▷_ (A : Type ) (B : Type ℓ′) : Type ( ⊔ₗ ℓ′) where
  field
    view : A  B
    unview : B  A
    unview∘view :  x  unview (view x)  x
    view∘unview :  y  view (unview y)  y

open _▷_ ⦃...⦄ public

view_as_ : A  (B : Type ℓ′)  _ : A  B   B
view x as B = view {B = B} x