123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354-------------------------------------------------------------------------- The Agda standard library---- Wrapper for the proof irrelevance modality---- This allows us to store proof irrelevant witnesses in a record and-- use projections to manipulate them without having to turn on the-- unsafe option --irrelevant-projections.-- Cf. Data.Refinement for a use case------------------------------------------------------------------------ {-# OPTIONS --cubical-compatible --safe #-} module Data.Irrelevant where open import Level using (Level) private variable a b c : Level A : Set a B : Set b C : Set c -------------------------------------------------------------------------- Type record Irrelevant (A : Set a) : Set a where constructor [_] field .irrelevant : Aopen Irrelevant public -------------------------------------------------------------------------- Algebraic structure: Functor, Appplicative and Monad-like map : (A → B) → Irrelevant A → Irrelevant Bmap f [ a ] = [ f a ] pure : A → Irrelevant Apure x = [ x ] infixl 4 _<*>__<*>_ : Irrelevant (A → B) → Irrelevant A → Irrelevant B[ f ] <*> [ a ] = [ f a ] infixl 1 _>>=__>>=_ : Irrelevant A → (.A → Irrelevant B) → Irrelevant B[ a ] >>= f = f a -------------------------------------------------------------------------- Other functions zipWith : (A → B → C) → Irrelevant A → Irrelevant B → Irrelevant CzipWith f a b = ⦇ f a b ⦈