... | @@ -2,7 +2,7 @@ |
... | @@ -2,7 +2,7 @@ |
|
This page is intended for practical notes on why list functions and rules are written as they are, why they're not written other ways, ideas about what will/won't fuse properly and why, and descriptions of issues affecting fusion. It will also have open questions of various sorts. It's currently a bit disorganized; hopefully someone will find a way to set it in order.
|
|
This page is intended for practical notes on why list functions and rules are written as they are, why they're not written other ways, ideas about what will/won't fuse properly and why, and descriptions of issues affecting fusion. It will also have open questions of various sorts. It's currently a bit disorganized; hopefully someone will find a way to set it in order.
|
|
|
|
|
|
|
|
|
|
Q: I know that `foldr/build` fusion is [ not always safe](http://www.haskell.org/haskellwiki/Correctness_of_short_cut_fusion#In_the_presence_of_seq) in the presence of `seq` (and `pseq`, strict fields, bang patterns, etc.). What exactly do I need to know about this when writing functions I want GHC to fuse safely? \[There are other contexts it can be used in program construction, but those are not relevant here\]
|
|
Q: I know that `foldr/build` fusion is [not always safe](http://www.haskell.org/haskellwiki/Correctness_of_short_cut_fusion#In_the_presence_of_seq) in the presence of `seq` (and `pseq`, strict fields, bang patterns, etc.). What exactly do I need to know about this when writing functions I want GHC to fuse safely? \[There are other contexts it can be used in program construction, but those are not relevant here\]
|
|
|
|
|
|
|
|
|
|
A: The type checker will take care of a lot of things for you; your only job is to be careful about how the function you pass to `build` (or `augment`) uses its arguments or things constructed from its arguments.
|
|
A: The type checker will take care of a lot of things for you; your only job is to be careful about how the function you pass to `build` (or `augment`) uses its arguments or things constructed from its arguments.
|
... | @@ -84,7 +84,7 @@ Guess: it may be that there isn't enough opportunity for inlining to do anything |
... | @@ -84,7 +84,7 @@ Guess: it may be that there isn't enough opportunity for inlining to do anything |
|
Q: Why does `repeat` fuse, but not `cycle`?
|
|
Q: Why does `repeat` fuse, but not `cycle`?
|
|
|
|
|
|
|
|
|
|
A: See [\#9398](https://gitlab.haskell.org//ghc/ghc/issues/9398). This seems almost to work out, but then it doesn't quite—things that are unboxed when the current implementation is used aren't, and it can be very bad.
|
|
A: See [\#9398](https://gitlab.haskell.org/ghc/ghc/issues/9398). This seems almost to work out, but then it doesn't quite—things that are unboxed when the current implementation is used aren't, and it can be very bad.
|
|
|
|
|
|
|
|
|
|
Q: Why does making one thing fuse sometimes make something else not fuse?
|
|
Q: Why does making one thing fuse sometimes make something else not fuse?
|
... | | ... | |