-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add fusion rules #18
Comments
I like this idea. Although, it does require rewriting a bunch of other functions in terms of |
Has anyone tried generalizing the streams in data Stream f m r where
Stream :: (s -> StreamF s f m r) -> s -> Stream f m r
data StreamF s f m r =
Step (f s)
| Effect (m s)
| Return r I really don't have time to look into that this week, but it might be worth thinking about. I suspect the overly weak constraint on |
|
Huh... Actually, using the same approach |
I certainly don't know which ones we want, but it would be nice to get some sort of fusion. Here's one possibility to consider:
The
hoist
,maps
, and>>=
operations can be combined into a single operationIf we so desire, we can rewrite applications of
hoist
,maps
, and>>=
to applications ofhoistMapsBind
, and then fuse them using the following rule:But of course there could be much more general fusion opportunities we should be considering instead. I am especially curious about whether there's any way to convince GHC to do some of the heavy lifting itself.
The text was updated successfully, but these errors were encountered: