123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475-------------------------------------------------------------------------- The Agda standard library---- Strict combinators (i.e. that use call-by-value)------------------------------------------------------------------------ -- The contents of this module is also accessible via the `Function`-- module. {-# OPTIONS --cubical-compatible --safe #-} module Function.Strict where open import Agda.Builtin.Equality using (_≡_)open import Function.Base using (flip)open import Level using (Level) private variable a b : Level A B : Set a infixl 0 _!|>_ _!|>′_infixr -1 _$!_ _$!′_ -------------------------------------------------------------------------- Dependent combinators -- These are functions whose output has a type that depends on the-- value of the input to the function. open import Agda.Builtin.Strict public renaming ( primForce to force ; primForceLemma to force-≡ ) -- Application_$!_ : ∀ {A : Set a} {B : A → Set b} → ((x : A) → B x) → ((x : A) → B x)f $! x = force x f -- Flipped application_!|>_ : ∀ {A : Set a} {B : A → Set b} → (a : A) → (∀ a → B a) → B a_!|>_ = flip _$!_ -------------------------------------------------------------------------- Non-dependent combinators -- Any of the above operations for dependent functions will also work-- for non-dependent functions but sometimes Agda has difficulty-- inferring the non-dependency. Primed (′ = \prime) versions of the-- operations are therefore provided below that sometimes have better-- inference properties. seq : A → B → Bseq a b = force a (λ _ → b) seq-≡ : (a : A) (b : B) → seq a b ≡ bseq-≡ a b = force-≡ a (λ _ → b) force′ : A → (A → B) → Bforce′ = force force′-≡ : (a : A) (f : A → B) → force′ a f ≡ f aforce′-≡ = force-≡ -- Application_$!′_ : (A → B) → (A → B)_$!′_ = _$!_ -- Flipped application_!|>′_ : A → (A → B) → B_!|>′_ = _!|>_