-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Input, output and internal events and signals #17
Comments
A temporary solution is in the However, it is not satisfactory at the moment, as one can mix Does it make sense to consider concepts parameterised by |
Note, STGs are usually defined on a set of signals |
We could treat |
It seems we are stuck between a rock and a hard place.
Could we not add some verification for non-overlap of signals? It would mean the nice implementation can be used, and avoid some problems. |
There is one reason we might want both data Signal = A | B | C
-- For circuit1 signal B is an output
circuit1 = rise (Input A) ~> rise (Output B) <> ...
-- For circuit2 signal B is an input
circuit2 = rise (Input B) ~> rise (Output C) <> ...
-- In the overall system, we compose the circuits and B is either internal or output
system = circuit1 <> circuit2 <> ... So, we have the following possible interplay of signal types above:
Is this useful? If yes, we might want to allow both Note that the specifications for |
In this case could we not verify that signals are not defined as both inputs and outputs local to a scenario. I feel this is the same issue, possibly made more complicated. I didn't think of it like this, and really it would be useful for this sort of purpose, and probably a good idea to keep it therefore. This then raises several other points, such as, do we aim to try and change signal types? My question is, could/should we force it to be internal in the composition, |
@jrbeaumont Perhaps, this leads us to a new type of concept: Let's assume we compose two concepts
I think the above captures all possible combinations (up to commutativity). Note, with the above rule, Also, the errors above would probably be quite hard to make checkable at compile time... |
Actually, errors are strange. We do want to sometimes compose two concepts with the same output! This happens in buffer, for example: rise (Input A) ~> rise (Output B) <> fall (Input A) ~> fall (Output B) Maybe there are no errors after all! |
If we allow all possible compositions then the following seems reasonable:
I think the rule is actually pretty simple and is a data SignalType = Unused | Input | Internal | Output deriving Ord
compose :: SignalType -> SignalType -> SignalType
compose = max This means that we could implement the |
A bit more elaborated: data SignalType = Unused | Input | Internal | Output deriving Ord
mempty' :: Signal -> SignalType
mempty' = const Unused
mappend' :: (Signal -> SignalType) -> (Signal -> SignalType) -> Signal -> SignalType
mappend' f g = \s -> f s `max` g s
inputs :: [Signal] -> (Signal -> SignalType)
inputs ins = \s -> if s `elem` ins then Input else Unused
outputs :: [Signal] -> (Signal -> SignalType)
outputs outs = \s -> if s `elem` outs then Output else Unused
m1 :: Signal -> SignalType
m1 = inputs [a, b]
m2 :: Signal -> SignalType
m2 = outputs [b, c] |
Fixed in #38. |
Right now we don't distinguish between input/output/internal events and signals. I think this is one of the reasons we can't quite figure out the right way to deal with initialisation concepts #11.
Also, STGs do require to assign signals into groups so we will have to do it anyway at some point. Let's use this issue to discuss this.
The text was updated successfully, but these errors were encountered: