Skip to content

Commit

Permalink
Add helper function refineMaybe (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
jespercockx authored Jan 19, 2024
1 parent 984821a commit f37dff8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/Haskell/Extra/Refinement.agda
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,11 @@ mapRefine : {@0 P Q : a → Set ℓ} (@0 f : ∀ {x} → P x → Q x) → ∃ a
mapRefine f (x ⟨ p ⟩) = x ⟨ f p ⟩

{-# COMPILE AGDA2HS mapRefine transparent #-}

refineMaybe : {@0 P : a Set ℓ}
(mx : Maybe a) @0 ( {x} mx ≡ Just x P x)
Maybe (∃ a P)
refineMaybe Nothing f = Nothing
refineMaybe (Just x) f = Just (x ⟨ f refl ⟩)

{-# COMPILE AGDA2HS refineMaybe transparent #-}

0 comments on commit f37dff8

Please sign in to comment.