Documentation

Hale.Base.Data.Proxy

structure Data.Proxy (α : Type u) :

The proxy type $\text{Proxy}(\alpha)$ carries a phantom type parameter $\alpha$ but contains no data. It is the terminal object in the category of types: every type has exactly one function into $\text{Proxy}(\alpha)$.

$$\text{Proxy} : \text{Type}\; u \to \text{Type}$$

    Instances For
      @[implicit_reducible]
      instance Data.instInhabitedProxy {a✝ : Type u_1} :
      Equations
      @[implicit_reducible]
      instance Data.Proxy.instBEq {α : Type u_1} :
      BEq (Proxy α)

      BEq instance for $\text{Proxy}(\alpha)$ — always true since there is only one value.

      Equations
      @[implicit_reducible]
      instance Data.Proxy.instOrd {α : Type u_1} :
      Ord (Proxy α)

      Ord instance for $\text{Proxy}(\alpha)$ — always Ordering.eq since all values are equal.

      Equations
      @[implicit_reducible]
      instance Data.Proxy.instRepr {α : Type u_1} :
      Repr (Proxy α)

      Repr instance for $\text{Proxy}(\alpha)$, displaying as Proxy.mk.

      Equations
      @[implicit_reducible]
      instance Data.Proxy.instHashable {α : Type u_1} :

      Hashable instance for $\text{Proxy}(\alpha)$ — always hashes to $0$.

      Equations
      @[implicit_reducible]
      instance Data.Proxy.instToString {α : Type u_1} :

      ToString instance for $\text{Proxy}(\alpha)$.

      Equations
      @[implicit_reducible]

      Functor instance for $\text{Proxy}$. Since $\text{Proxy}$ carries no data, map is the identity on the structure:

      $$\text{map}\; f\; \text{Proxy.mk} = \text{Proxy.mk}$$

      Equations
      @[implicit_reducible]

      Pure instance for $\text{Proxy}$:

      $$\text{pure}\; a = \text{Proxy.mk}$$

      Equations
      @[implicit_reducible]

      Bind instance for $\text{Proxy}$:

      $$\text{bind}\; \text{Proxy.mk}\; f = \text{Proxy.mk}$$

      Equations
      @[implicit_reducible]

      Seq instance for $\text{Proxy}$:

      $$\text{seq}\; \text{Proxy.mk}\; f = \text{Proxy.mk}$$

      Equations
      @[implicit_reducible]

      SeqLeft instance for $\text{Proxy}$.

      Equations
      @[implicit_reducible]

      SeqRight instance for $\text{Proxy}$.

      Equations
      @[implicit_reducible]

      Applicative instance for $\text{Proxy}$.

      Equations
      • One or more equations did not get rendered due to their size.
      @[implicit_reducible]

      Monad instance for $\text{Proxy}$.

      Equations
      theorem Data.Proxy.map_id {α : Type u_1} (p : Proxy α) :
      id <$> p = p

      Functor identity law: $\text{map}\;\text{id} = \text{id}$.

      $$\text{map}\;\text{id}\;(\text{Proxy.mk}) = \text{Proxy.mk}$$

      theorem Data.Proxy.map_comp {β γ α : Type u_1} (f : βγ) (g : αβ) (p : Proxy α) :
      (f g) <$> p = f <$> g <$> p

      Functor composition law: $\text{map}\;(f \circ g) = \text{map}\;f \circ \text{map}\;g$.

      $$\text{map}\;(f \circ g)\;\text{Proxy.mk} = \text{map}\;f\;(\text{map}\;g\;\text{Proxy.mk})$$

      theorem Data.Proxy.pure_bind {α β : Type u_1} (a : α) (f : αProxy β) :
      pure a >>= f = f a

      Left identity (pure/bind): $\text{bind}\;(\text{pure}\;a)\;f = f\;a$.

      For $\text{Proxy}$, both sides reduce to $\text{Proxy.mk}$.

      theorem Data.Proxy.bind_pure {α : Type u_1} (p : Proxy α) :
      p >>= pure = p

      Right identity (bind/pure): $\text{bind}\;m\;\text{pure} = m$.

      $$\text{bind}\;\text{Proxy.mk}\;\text{pure} = \text{Proxy.mk}$$

      theorem Data.Proxy.bind_assoc {α β γ : Type u_1} (p : Proxy α) (f : αProxy β) (g : βProxy γ) :
      p >>= f >>= g = p >>= fun (x : α) => f x >>= g

      Associativity: $\text{bind}\;(\text{bind}\;m\;f)\;g = \text{bind}\;m\;(\lambda x.\;\text{bind}\;(f\;x)\;g)$.

      For $\text{Proxy}$, all sides reduce to $\text{Proxy.mk}$.