-
Notifications
You must be signed in to change notification settings - Fork 21
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
Simplify initClock
?
#304
Comments
… through strictness * Maybe through simplifying initClock (#304) * Looking at the Core it turns out that erased clock isn't completely simplified, and it's somehow obvious because it can't be inlined since it's recursive * I was hoping that if the automaton is evaluated strictly enough, it would be reduced to WHNF before reactimation starts but it's unclear whether this would even be visible in Core
… through strictness * Maybe through simplifying initClock (#304) * Looking at the Core it turns out that erased clock isn't completely simplified, and it's somehow obvious because it can't be inlined since it's recursive * I was hoping that if the automaton is evaluated strictly enough, it would be reduced to WHNF before reactimation starts but it's unclear whether this would even be visible in Core
… through strictness * Maybe through simplifying initClock (#304) * Looking at the Core it turns out that erased clock isn't completely simplified, and it's somehow obvious because it can't be inlined since it's recursive * I was hoping that if the automaton is evaluated strictly enough, it would be reduced to WHNF before reactimation starts but it's unclear whether this would even be visible in Core
… through strictness * Maybe through simplifying initClock (#304) * Looking at the Core it turns out that erased clock isn't completely simplified, and it's somehow obvious because it can't be inlined since it's recursive * I was hoping that if the automaton is evaluated strictly enough, it would be reduced to WHNF before reactimation starts but it's unclear whether this would even be visible in Core
… through strictness * Maybe through simplifying initClock (#304) * Looking at the Core it turns out that erased clock isn't completely simplified, and it's somehow obvious because it can't be inlined since it's recursive * I was hoping that if the automaton is evaluated strictly enough, it would be reduced to WHNF before reactimation starts but it's unclear whether this would even be visible in Core
… through strictness * Maybe through simplifying initClock (#304) * Looking at the Core it turns out that erased clock isn't completely simplified, and it's somehow obvious because it can't be inlined since it's recursive * I was hoping that if the automaton is evaluated strictly enough, it would be reduced to WHNF before reactimation starts but it's unclear whether this would even be visible in Core
… through strictness * Maybe through simplifying initClock (#304) * Looking at the Core it turns out that erased clock isn't completely simplified, and it's somehow obvious because it can't be inlined since it's recursive * I was hoping that if the automaton is evaluated strictly enough, it would be reduced to WHNF before reactimation starts but it's unclear whether this would even be visible in Core
… through strictness * Maybe through simplifying initClock (#304) * Looking at the Core it turns out that erased clock isn't completely simplified, and it's somehow obvious because it can't be inlined since it's recursive * I was hoping that if the automaton is evaluated strictly enough, it would be reduced to WHNF before reactimation starts but it's unclear whether this would even be visible in Core
… through strictness * Maybe through simplifying initClock (#304) * Looking at the Core it turns out that erased clock isn't completely simplified, and it's somehow obvious because it can't be inlined since it's recursive * I was hoping that if the automaton is evaluated strictly enough, it would be reduced to WHNF before reactimation starts but it's unclear whether this would even be visible in Core
… through strictness * Maybe through simplifying initClock (#304) * Looking at the Core it turns out that erased clock isn't completely simplified, and it's somehow obvious because it can't be inlined since it's recursive * I was hoping that if the automaton is evaluated strictly enough, it would be reduced to WHNF before reactimation starts but it's unclear whether this would even be visible in Core
… through strictness * Maybe through simplifying initClock (#304) * Looking at the Core it turns out that erased clock isn't completely simplified, and it's somehow obvious because it can't be inlined since it's recursive * I was hoping that if the automaton is evaluated strictly enough, it would be reduced to WHNF before reactimation starts but it's unclear whether this would even be visible in Core
… through strictness * Maybe through simplifying initClock (#304) * Looking at the Core it turns out that erased clock isn't completely simplified, and it's somehow obvious because it can't be inlined since it's recursive * I was hoping that if the automaton is evaluated strictly enough, it would be reduced to WHNF before reactimation starts but it's unclear whether this would even be visible in Core
… through strictness * Maybe through simplifying initClock (#304) * Looking at the Core it turns out that erased clock isn't completely simplified, and it's somehow obvious because it can't be inlined since it's recursive * I was hoping that if the automaton is evaluated strictly enough, it would be reduced to WHNF before reactimation starts but it's unclear whether this would even be visible in Core
That's actually the wrong approach: The clock value should already contain the initialised resource! So if anything, there should be an action |
There is a big semantic change that I'm unsure about. On I'm not sure how to proceed then. I see several different stances:
class Clock m cl where
initialTime :: cl -> m (Time cl)
initClock :: cl -> Automaton m () (Time cl, Tag cl) or even class Clock m cl where
initialTime :: cl -> m (Time cl)
initClock :: Automaton m cl (Time cl, Tag cl) In latter case, the running clock is completely known statically, which is great. |
But this also means that many clocks like |
But that's not such a problem if |
How about initClockM :: m cl -> MSF m () (Time cl, Tag cl)
initClock :: cl -> MSF m () (Time cl, Tag cl)
initClock = initClockM . pure |
Since long, I wanted to simplify the type signature of
initClock
fromto
There are several reasons for the more complicated type signature:
m
action can be used to initialise a resource. (Although this is usually the least concern, the initialization could also happen upon the first tick, or be done with aReaderT
newtype.)m
action is used to generate an initial time. This has several advantages:Maybe
)But there are also downsides to this complicated type signature:
initClock
directly returns a running clock, we could simply merge the timestamp streams.With #299 (automata) there would be a new downside: The state of the running clock is typically not known statically (because it is hidden behind a monadic action), therefore GHC cannot optimize the whole
Rhine
further after clock erasure. This causes a performance degradation that is not easily justifiable.Overall I believe that after #299, a serious attempt at simplification should be made.
The text was updated successfully, but these errors were encountered: