Skip to content

Commit

Permalink
[ re agda#357 ] Make Erase type play nice with instance search
Browse files Browse the repository at this point in the history
  • Loading branch information
jespercockx committed Sep 7, 2024
1 parent 1078344 commit 59cfe72
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions lib/Haskell/Extra/Erase.agda
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ module Haskell.Extra.Erase where
@0 xs : List a

record Erase (@0 a : Set ℓ) : Setwhere
constructor Erased
field @0 get : a
instance constructor Erased
field @0 {{get}} : a
open Erase public
{-# COMPILE AGDA2HS Erase tuple #-}

Expand Down Expand Up @@ -69,11 +69,11 @@ module Haskell.Extra.Erase where
ne = subst NonEmpty p itsNonEmpty
{-# COMPILE AGDA2HS rezzTail inline #-}

rezzErase : {@0 a : Set} {@0 x : a} Rezz (Erased x)
rezzErase {x = x} = Erased x ⟨ refl ⟩
rezzErase : {@0 a : Set} {@0 x : a} Rezz (Erased {{x}})
rezzErase {x = x} = Erased {{x}} ⟨ refl ⟩
{-# COMPILE AGDA2HS rezzErase inline #-}

erase-injective : Erased x ≡ Erased y x ≡ y
erase-injective : Erased {{x}} ≡ Erased {{y}} x ≡ y
erase-injective refl = refl

inspect_by_ : (x : a) (Rezz x b) b
Expand Down
4 changes: 2 additions & 2 deletions test/EraseType.agda
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ open import Haskell.Prelude
open import Haskell.Extra.Erase

testErase : Erase Int
testErase = Erased 42
testErase = Erased {{42}}

{-# COMPILE AGDA2HS testErase #-}

testMatch : Erase Int Erase Int
testMatch (Erased x) = Erased (x + 1)
testMatch (Erased {{x}}) = Erased {{x + 1}}

{-# COMPILE AGDA2HS testMatch #-}

Expand Down

0 comments on commit 59cfe72

Please sign in to comment.