问题
open import Data.Product using (_×_; ∃; ∃-syntax)
open import Data.List
Any-∃ : ∀ {A : Set} {P : A → Set} {xs : List A} → ∃[ x ∈ xs ] P x
Could not parse the application ∃[ x ∈ xs ] P x
Operators used in the grammar:
∃[_] (prefix notation, level 20) [∃-syntax (C:\Users\Marko\AppData\Roaming\cabal\x86_64-windows-ghc-8.6.5\Agda-2.6.0\lib\agda-stdlib\src\Data\Product.agda:78,1-9)]
when scope checking ∃[ x ∈ xs ] P x
For some reason it seems like it is not importing the precedence properly from the standard library module. Defining it as...
Any-∃ : ∀ {A : Set} {P : A → Set} {xs : List A} → ∃[ x ] P x
...will make it pass parsing, but I am not sure this is doing the right thing for one of the problems I am trying to solve.
What should I do here?
回答1:
∃
is precisely for the cases where you can leave out the domain of the function
because it's evident. Otherwise you are supposed to use Σ
. And indeed Σ-syntax
does give you the ability to write Σ[ x ∈ A ] B
.
来源:https://stackoverflow.com/questions/56356229/how-to-import-the-%e2%88%83-syntax