Modules

categorical-crypto

  • Prelude

CategoricalCrypto

  • CategoricalCrypto
  • Abstract
  • Abstract2
  • Abstract2.Equivalence
  • Abstract2.Morphism
  • Abstract2.OAPEmulation
  • Abstract2.WideSubcategory
  • Channel.Category
  • Channel.Core
  • Channel.Selection
  • Examples.Basic
  • Examples.Commitment
  • Examples.RelSetup
  • Examples.Signatures
  • FamilyCategory
  • Machine.Constraints
  • Machine.Core
  • MachineAxioms
  • RandomOracle
  • RandomOracle2
  • SFunM
  • Standard
  • Standard2
  • Standard2.Morphism
  • StandardTV
  • UCSetup
  • UCSetup.Morphism
  • VanishingTV

Categories

  • Actegory
  • Actegory.Underlying
  • Category.EquivClosureHelper
  • Coherence.Monoidal
  • Coherence.Monoidal.Compare
  • Coherence.Monoidal.Diagram
  • Coherence.Monoidal.Frontend
  • Coherence.Monoidal.Frontend.Core
  • Coherence.Monoidal.Frontend.Sigma
  • Coherence.Monoidal.MacLane
  • Coherence.Monoidal.Normalize
  • Coherence.Monoidal.Reflect
  • Coherence.Monoidal.Sigma
  • Coherence.Monoidal.Test.Frontend
  • Coherence.Monoidal.Test.InterchangeStress
  • Coherence.Monoidal.Test.Limitations
  • Coherence.Monoidal.Test.SigmaFrontend
  • Coherence.Monoidal.WireCoherence
  • CoherenceIsos
  • Diagram.Coend.Ext.Setoids
  • Discrete
  • FreeMonoidal
  • FreeStrictMonoidal
  • Functor.Monoidal.CurriedTensor
  • Functor.Monoidal.CurriedTensor.Properties
  • Functor.Monoidal.Properties.Ext
  • Functor.Presheaf.Morphism
  • GradedKleisli
  • GradedKleisli.Functorial
  • GradedKleisli.Functorial.Category
  • GradedKleisli.Regrade
  • KernelCongruence
  • KernelCongruence.Reindex
  • LocallyGraded
  • LocallyGraded.FreeActegory
  • LocallyGraded.FreeActegory.Kleisli
  • LocallyGraded.Kleisli
  • Monad.Graded.Ext
  • Monad.Graded.Morphism
  • Monad.Graded.Pullback
  • Monad.Graded.Uncurried
  • Morphism.Reasoning.Ext
  • NaturalTransformationHelper
  • Properties

Class

  • Monad.Ext

Data

  • List.Properties.Ext
  • Maybe.Ext
  • Nat.Poly

LibExt

  • LibExt
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
{-# OPTIONS --cubical-compatible #-}
module Class.Functor.Instances where
 
open import Class.Prelude
open import Class.Functor.Core
 
instance
Functor-Maybe : Functor Maybe
Functor-Maybe = record {Mb′}
where module Mb′ = Mb renaming (map to _<$>_)
 
FunctorLaws-Maybe : FunctorLaws Maybe
FunctorLaws-Maybe = λ where
.fmap-id → λ where (just _) → refl; nothing → refl
.fmap-∘ → λ where (just _) → refl; nothing → refl
 
Functor-List : Functor List
Functor-List ._<$>_ = map
 
FunctorLaws-List : FunctorLaws List
FunctorLaws-List = record {fmap-id = p; fmap-∘ = q}
where
p : ∀ {A : Type ℓ} (x : List A) → fmap id x ≡ x
p = λ where
[] → refl
(x ∷ xs) → cong (x ∷_) (p xs)
 
q : ∀ {A : Type ℓ} {B : Type ℓ′} {C : Type ℓ″} {f : B → C} {g : A → B} (x : List A) →
fmap (f ∘ g) x ≡ (fmap f ∘ fmap g) x
q {f = f}{g} = λ where
[] → refl
(x ∷ xs) → cong (f (g x) ∷_) (q xs)
 
Functor-List⁺ : Functor List⁺
Functor-List⁺ = record {L⁺′}
where module L⁺′ = L⁺ renaming (map to _<$>_)
 
Functor-Vec : ∀ {n} → Functor (flip Vec n)
Functor-Vec = record {V′}
where module V′ = V renaming (map to _<$>_)
 
Functor-TC : Functor TC
Functor-TC = record {R}
where import Reflection.TCM.Syntax as R
 
Functor-Abs : Functor Abs
Functor-Abs = record {R}
where import Reflection.AST.Abstraction as R renaming (map to _<$>_)
 
Functor-Arg : Functor Arg
Functor-Arg = record {R}
where import Reflection.AST.Argument as R renaming (map to _<$>_)
 
Functor-∃Vec : Functor (∃ ∘ Vec)
Functor-∃Vec ._<$>_ f (_ , xs) = -, (f <$> xs)