-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for #357 #358
Merged
Merged
Fix for #357 #358
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ffae44a
[ re #357 ] Make Erase type play nice with instance search
jespercockx 1f9ade6
[ re #357 ] Wrap result of `guard` in `Erase`
jespercockx 7a0550e
[ re #357 ] Check that we do not compile Level or Size
jespercockx f663b88
[ re #357 ] Add utility function `noWriteImports`
jespercockx db7f649
[ fix #357 ] Check that type arguments are valid Haskell types before…
jespercockx 2c9ba29
[ re #357 ] Rewrite `\x -> (a -> x)` to `(->) a` and `\x -> ((->) x)`…
jespercockx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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,12 @@ | ||
open import Haskell.Prelude | ||
open import Agda.Primitive | ||
|
||
module Fail.Issue357a where | ||
|
||
k : a → b → a | ||
k x _ = x | ||
{-# COMPILE AGDA2HS k #-} | ||
|
||
testK : Nat | ||
testK = k 42 lzero | ||
{-# COMPILE AGDA2HS testK #-} |
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,16 @@ | ||
open import Haskell.Prelude | ||
open import Agda.Primitive | ||
|
||
module Fail.Issue357b where | ||
|
||
k : a → b → a | ||
k x _ = x | ||
{-# COMPILE AGDA2HS k #-} | ||
|
||
l : Level → Nat | ||
l = k 42 | ||
{-# COMPILE AGDA2HS l #-} | ||
|
||
testK : Nat | ||
testK = l lzero | ||
{-# COMPILE AGDA2HS testK #-} |
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,22 @@ | ||
|
||
open import Haskell.Prelude | ||
|
||
data D1 (t : Set → Set) : Set where | ||
C1 : t Bool → D1 t | ||
|
||
{-# COMPILE AGDA2HS D1 #-} | ||
|
||
f1 : D1 (λ a → Int → a) | ||
f1 = C1 (_== 0) | ||
|
||
{-# COMPILE AGDA2HS f1 #-} | ||
|
||
data D2 (t : Set → Set → Set) : Set where | ||
C2 : t Int Int → D2 t | ||
|
||
{-# COMPILE AGDA2HS D2 #-} | ||
|
||
f2 : D2 (λ a b → a → b) | ||
f2 = C2 (_+ 1) | ||
|
||
{-# COMPILE AGDA2HS f2 #-} |
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 |
---|---|---|
|
@@ -83,4 +83,5 @@ import Issue317 | |
import ErasedPatternLambda | ||
import CustomTuples | ||
import ProjectionLike | ||
import FunCon | ||
|
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,12 @@ | ||
module FunCon where | ||
|
||
data D1 t = C1 (t Bool) | ||
|
||
f1 :: D1 ((->) Int) | ||
f1 = C1 (== 0) | ||
|
||
data D2 t = C2 (t Int Int) | ||
|
||
f2 :: D2 (->) | ||
f2 = C2 (+ 1) | ||
|
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,2 @@ | ||
test/Fail/Issue357a.agda:10,1-6 | ||
Bad Haskell type: Level |
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,2 @@ | ||
test/Fail/Issue357b.agda:10,1-2 | ||
Bad Haskell type: Level |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the motivation for changing the interface of
Erase
and making the field an instance? Seems like it forces explicit brackets{{}}
everywhere.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it was to make sure that instance search could actually find an element of type
Erase A
when there is an erased instance of typeA
in scope. But I found a better way to get the same effect, which does not break backwards compatibility (see newly pushed version).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a situation that arises often? Having instances of
a
laying around? For equality proofs I get, but otherwise not so sure. But I trust you that the interface hasn't changed :). (I would have kept the oldErase
definition and definediErased
separately but it probably doesn't matter much. And with yours one can decide to match and directly introduce an instance, which I don't know if you can do otherwise)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The opposite way (defining
Erased
as the constructor andiErased
as the pattern synonym) is not accepted by Agda: