-
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
Dev hoist rhines #61
Open
turion
wants to merge
12
commits into
develop
Choose a base branch
from
dev_hoist_rhines
base: develop
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Dev hoist rhines #61
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
ccd46b6
hoistedClockSchedule
turion 3555f0b
Merge branch 'master' into feature_hoistedclockschedule
turion 6a23586
Renamed hoistClockSchedule
turion 726ded6
Merge branch 'develop' into feature_hoistedclockschedule
turion d55cbc3
Hoist sequential and parallel clocks
turion 4cf0306
Merge branch 'feature_hoistedclockschedule' into dev_hoist_rhines
turion 51a6d2e
Hoist sequential Rhines along monad morphism
turion 9f6bb51
Merge branch 'develop' into dev_hoist_rhines
turion 1a4e41f
Merge branch 'develop' into dev_hoist_rhines
turion aacc3cc
Merge branch 'develop' into dev_hoist_rhines
turion 50f6f3a
Trying to manage hoisting clocks with type classes, but still failing
turion de07236
Merge branch 'develop' into dev_hoist_rhines
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
{-# LANGUAGE GADTs #-} | ||
{-# LANGUAGE RankNTypes #-} | ||
module FRP.Rhine.SF where | ||
|
||
|
||
-- rhine | ||
import FRP.Rhine.Clock | ||
import FRP.Rhine.ResamplingBuffer | ||
import FRP.Rhine.Schedule | ||
import FRP.Rhine.SyncSF | ||
|
||
|
||
{- | 'SF' is an abbreviation for "signal function". | ||
It represents a side-effectful asynchronous /__s__ignal __f__unction/, or signal network, | ||
where input, data processing (including side effects) and output | ||
need not happen at the same time. | ||
|
||
The type parameters are: | ||
|
||
* 'm': The monad in which side effects take place. | ||
* 'cl': The clock of the whole signal network. | ||
It may be sequentially or parallely composed from other clocks. | ||
* 'a': The input type. Input arrives at the rate @Leftmost cl@. | ||
* 'b': The output type. Output arrives at the rate @Rightmost cl@. | ||
-} | ||
data SF m cl a b where | ||
-- | A synchronous monadic stream function is the basic building block. | ||
-- For such an 'SF', data enters and leaves the system at the same rate as it is processed. | ||
Synchronous | ||
:: ( cl ~ Leftmost cl, cl ~ Rightmost cl) | ||
=> SyncSF m cl a b | ||
-> SF m cl a b | ||
-- | Two 'SF's may be sequentially composed if there is a matching 'ResamplingBuffer' between them. | ||
Sequential | ||
:: ( Clock m clab, Clock m clcd | ||
, TimeDomainOf clab ~ TimeDomainOf clcd | ||
, TimeDomainOf clab ~ TimeDomainOf (Rightmost clab) | ||
, TimeDomainOf clcd ~ TimeDomainOf (Leftmost clcd) | ||
) | ||
=> SF m clab a b | ||
-> ResamplingBuffer m (Rightmost clab) (Leftmost clcd) b c | ||
-> SF m clcd c d | ||
-> SF m (SequentialClock m clab clcd) a d | ||
-- | Two 'SF's with the same input and output data may be parallely composed. | ||
Parallel | ||
:: ( Clock m cl1, Clock m cl2 | ||
, TimeDomainOf cl1 ~ TimeDomainOf (Rightmost cl1) | ||
, TimeDomainOf cl2 ~ TimeDomainOf (Rightmost cl2) | ||
, TimeDomainOf cl1 ~ TimeDomainOf cl2 | ||
, TimeDomainOf cl1 ~ TimeDomainOf (Leftmost cl1) | ||
, TimeDomainOf cl2 ~ TimeDomainOf (Leftmost cl2) | ||
) | ||
=> SF m cl1 a b | ||
-> SF m cl2 a b | ||
-> SF m (ParallelClock m cl1 cl2) a b | ||
|
||
-- * Hoist 'SF's along monad morphisms | ||
hoistSeqSF | ||
:: ( Monad m, Monad m' | ||
, cl1 ~ Leftmost cl1, cl1 ~ Rightmost cl1 | ||
, cl2 ~ Leftmost cl2, cl2 ~ Rightmost cl2 | ||
) | ||
=> (forall x . m x -> m' x) | ||
-> SF m (SequentialClock m cl1 cl2) a b | ||
-> SF m' (SequentialClock m' (HoistClock m m' cl1) (HoistClock m m' cl2)) a b | ||
hoistSeqSF monadMorphism (Sequential (Synchronous syncsf1) rb (Synchronous syncsf2)) = | ||
Sequential | ||
(Synchronous $ hoistSyncSFAndClock monadMorphism syncsf1) | ||
(hoistResamplingBufferAndClocks monadMorphism rb) | ||
(Synchronous $ hoistSyncSFAndClock monadMorphism syncsf2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This won't be able to type-check.