-
Notifications
You must be signed in to change notification settings - Fork 10
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
Tagged implementation #14
Conversation
My ultimate motivation for this is to extend the The main problem is at the moment we rely on the |
Could you expand on this? I'm not familiar with the |
So the use case is around having better support for
The The problem with the current implementation is relies on knowing the Doing the tagging fixes this problem because it can use the type of the user supplied function. In the example above
So the type inference would just work. |
This is the example I added that shows what you can do now:
|
95931b5
to
7864325
Compare
9c0c9e0
to
91a2149
Compare
91a2149
to
1d28041
Compare
-- Names --------------------------------------------------------------- | ||
|
||
fwdNames :: [String] | ||
fwdNames = ["Fwd", "Signal"] |
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.
I'd expect writing Signal
to enforce the type to be Signal. I'm fine with it how it is if that's too much hassle.
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.
Yeah it'd be pretty annoying because I would need an inference_helper to do it..
For what it's worth, this work is extremely useful for my use-case (which sounds very similar to @jonfowler's). I do, however, wish that more of the PR description had made it into the Haddocks. It would have been extremely hard to deduce the motivation for things like, e.g., |
This is a work in progress rework of the type inference solution to use a "Tagged" implementation:
With circuits passing around these Tagged types which include the type of the
Bus
. This has a major advantage for type inference because it can use the type of pre-defined circuits e.g.:Which means the type of input & output (
a
) can be unified.Generated Code
This meas the generated code no longer needs the
inferenceHelper
and can be just written withTagged
stuff:results in:
TaggedBundle
The main challenge is we need to bundle up typed elements. Consider for example:
We will be given
TagFwd (a,b)
but we needTagFwd a
andTagFwd b
. We do this using aTag
bundle class which seems to work nicely in practice.This only needs to support the types with special support in
Circuit
notation i.e. tuples, unit and vec