-
Notifications
You must be signed in to change notification settings - Fork 165
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
--functor and --agda cannot be used simultaneously #405
Comments
It would seem that (to no ones surprise) solving this problem is harder than it first seemed, due to having to add parameters all over the agda backend to keep track of if the functor options is enabled and having to find some way to "intelligently" parameterize all types from categories correctly. I'm giving up on my own attempts. |
I think this isn't too hard to get to work. On the Agda side, we could have: data Exp' (A : Set) : Set where
int : (a : A) (x : Integer) → Exp' A
BNFC'Position = Maybe (Pair Nat Nat)
Exp = Exp' BNFC'Position This would limit polymorphism to level 0, but bind directly to the code that the Haskell backend produces. |
This updates the generated abstract syntax (AST.agda) so that data types are parametrized, and instantiated to #BNFCPosition.
While the PR you opened would close this particular issue, perhaps it would be nice to keep track of what features can and cannot be used simultaneously? It would be much nicer for BNFC to state that the combination is not supported than to discover later down the line, as was the case here. |
Underscores are placeholders in Agda, so e.g. the name Foo_' is invalid, since ' by itself is not a valid name.
Generalize `definedRules` to `definedRules'` using a configuration record that is instantiated to both Haskell and Agda.
This updates the generated abstract syntax (AST.agda) so that data types are parametrized, and instantiated to #BNFCPosition.
Underscores are placeholders in Agda, so e.g. the name Foo_' is invalid, since ' by itself is not a valid name.
Generalize `definedRules` to `definedRules'` using a configuration record that is instantiated to both Haskell and Agda.
Using the
--functor
flag and the--agda
flag simultaneously generates code which passes the agda typechecker but fails to compile. Here is a very simple example:Running make yield the following type errors:
Looking at
ASTTest.agda
andAbsTest.hs
we can see the issue:All that really needs to be done is to parameterize the agda datatype, provide a translation of
BNFC'Position
inASTTest.agda
, correct the type signatures of agda functions handling the AST (and thereby also adding a dummy lambda to the COMPILE pragma because of the new implicit argument).I'm currently looking into the codebase to see if I'd be able to fix this myself.
The text was updated successfully, but these errors were encountered: