Skip to content

Commit

Permalink
Put ∃ in its own module Haskell.Extra.Refinement
Browse files Browse the repository at this point in the history
  • Loading branch information
jespercockx committed Dec 19, 2023
1 parent 90a1dc8 commit fd2ca48
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
8 changes: 1 addition & 7 deletions lib/Haskell/Extra/Dec.agda
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
module Haskell.Extra.Dec where

open import Haskell.Prelude hiding (Reflects)
open import Haskell.Extra.Refinement
open import Agda.Primitive

@0 Reflects : {ℓ} Set Bool Set
Reflects P True = P
Reflects P False = P

record {ℓ ℓ′} (@0 a : Set ℓ) (@0 P : a Set ℓ′) : Set (ℓ ⊔ ℓ′) where
constructor _⟨_⟩
field
value : a
@0 proof : P value
open public
{-# COMPILE AGDA2HS ∃ unboxed #-}

Dec : {ℓ} @0 Set Set
Dec P = ∃ Bool (Reflects P)
Expand Down
15 changes: 15 additions & 0 deletions lib/Haskell/Extra/Refinement.agda
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module Haskell.Extra.Refinement where

open import Haskell.Prelude
open import Agda.Primitive

private variable
ℓ ℓ′ : Level

record (@0 a : Set ℓ) (@0 P : a Set ℓ′) : Set (ℓ ⊔ ℓ′) where
constructor _⟨_⟩
field
value : a
@0 proof : P value
open public
{-# COMPILE AGDA2HS ∃ unboxed #-}

0 comments on commit fd2ca48

Please sign in to comment.