-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ fix #340 ] Compile pattern lambda to regular lambda if all proper p…
…atterns are erased
- Loading branch information
1 parent
0fc20cc
commit f0bd92a
Showing
5 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
open import Haskell.Prelude | ||
|
||
Scope = List Bool | ||
|
||
data Telescope (@0 α : Scope) : @0 Scope → Set where | ||
ExtendTel : ∀ {@0 x β} → Bool → Telescope (x ∷ α) β → Telescope α (x ∷ β) | ||
{-# COMPILE AGDA2HS Telescope #-} | ||
|
||
caseTelBind : ∀ {@0 x α β} (tel : Telescope α (x ∷ β)) | ||
→ ((a : Bool) (rest : Telescope (x ∷ α) β) → @0 tel ≡ ExtendTel a rest → d) | ||
→ d | ||
caseTelBind (ExtendTel a tel) f = f a tel refl | ||
|
||
{-# COMPILE AGDA2HS caseTelBind #-} | ||
|
||
checkSubst : ∀ {@0 x α β} (t : Telescope α (x ∷ β)) → Bool | ||
checkSubst t = caseTelBind t λ ty rest → λ where refl → True | ||
{-# COMPILE AGDA2HS checkSubst #-} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,4 +80,5 @@ import Issue305 | |
import Issue302 | ||
import Issue309 | ||
import Issue317 | ||
import ErasedPatternLambda | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module ErasedPatternLambda where | ||
|
||
data Telescope = ExtendTel Bool Telescope | ||
|
||
caseTelBind :: Telescope -> (Bool -> Telescope -> d) -> d | ||
caseTelBind (ExtendTel a tel) f = f a tel | ||
|
||
checkSubst :: Telescope -> Bool | ||
checkSubst t = caseTelBind t (\ ty rest -> True) | ||
|