Skip to content
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

Add new module Dec for decidability proofs (compiled to Bool) #247

Merged
merged 6 commits into from
Dec 20, 2023

Conversation

jespercockx
Copy link
Member

No description provided.

@@ -0,0 +1,27 @@
module Haskell.Extra.Dec where

open import Haskell.Prelude hiding (Reflects)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think you could remove the old definition of Reflects? and maybe just define patterns synonyms for ofY and ofN if you don't want to touch Haskell.Law too much.

On a side note, I don't think anything from Haskell.Law should be exported in Haskell.Prelude.

@flupe
Copy link
Contributor

flupe commented Dec 13, 2023

Currently, this module (if it was compiled to Haskell) would generate a single type alias type Dec = Bool. Using Dec from some other module compiled with agda2hs would thus produce Haskell code with an explicit import to Haskell.Extra.Dec which doesn't exist.

Two ways to go about it:

  • Hardcode the mapping from Haskell.Extra.Dec.Dec to Bool in agda2hs, and as a policy enforce that all definitions in Haskell.Extra get desugared into Haskell code that still has no dependencies other than the (Haskell) Prelude.
  • Have an extended (agda2hs) Haskell prelude available as a Haskell library.

@jespercockx
Copy link
Member Author

Ideally we would not compile Dec at all and instead have agda2hs rewrite it to Bool. That shouldn't be too hard to do.

@flupe
Copy link
Contributor

flupe commented Dec 13, 2023

Yeah, I was also thinking about your other opened PRs defining modules in Haskell.Extra like loop.

@jespercockx
Copy link
Member Author

@jespercockx jespercockx reopened this Dec 19, 2023
@jespercockx
Copy link
Member Author

That "close PR" button is altogether too close to the "comment" button

@jespercockx
Copy link
Member Author

I've updated this PR to address your comments @flupe , the commits should be self-explanatory.

@flupe
Copy link
Contributor

flupe commented Dec 19, 2023

Very nice! So currently putting inline after the identifier in the COMPILE pragma doesn't throw any error and is just ignored?

@jespercockx jespercockx merged commit aa0ae8d into agda:master Dec 20, 2023
7 checks passed
@flupe flupe mentioned this pull request Dec 20, 2023
@jespercockx jespercockx added this to the 1.3 milestone Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants