\begin{code}
open import Prelude
open import Algebra
open import Cubical.Foundations.Everything using (isSet)

module Data.Set.Hom {ā„“} {š‘† : Type ā„“} (latt : Semilattice š‘†) (sIsSet : isSet š‘†) where


open import Data.Set.Definition
open import Data.Set.Eliminators renaming (⟦_⟧ to ψ⟦_⟧)


open Semilattice latt

module _ {A : Type a} where
\end{code}
%<*hom-ty>
\begin{code}
  ⟦_⟧ : (A → š‘†) → š’¦ A → š‘†
\end{code}
%</hom-ty>
\begin{code}
  ⟦ h ⟧ = ψ⟦ alg ⟧
    where
    alg : ψ A š‘†
    alg .fst āˆ… = ε
    alg .fst (x ∷ xs ⟨ P⟨xs⟩ ⟩) = h x āˆ™ P⟨xs⟩
    alg .snd .c-trunc _ = sIsSet
    alg .snd .c-com x y _ xs = sym (assoc (h x) _ _) ; cong (_āˆ™ xs) (comm (h x) _) ; assoc (h y) _ _
    alg .snd .c-dup x _ xs = sym (assoc (h x) _ _) ; cong (_āˆ™ xs) (idem (h x))
\end{code}