clash-lang / clash-protocols

a battery-included library for dataflow protocols
Other
19 stars 7 forks source link

Implement custom type class when leaving a Forward unconnected using circuit-notation #92

Open rowanG077 opened 3 months ago

rowanG077 commented 3 months ago

When using circuit notation and explicitly ignoring a stream using _ like so:

board = circuit \in -> inp
    (a, _b) <- idC -< inp
    idC -< a

The Default type class is used to generate Bwd to feed into _b stream. This is undocumented and also dangerous if you happen to have a Default implementation for a Protocol Backwards that does not ack the Forward leading to a deadlock.

We want a seperate type class that defines the backwards that will be used by circuit-notation to drive the backwards of a black holed stream. The easiest way is probably is to define this in plugin itself. Or make the function name an argument to the plugin.

I think the function completeUnderscores needs to be modified to do this.