Closed snowleopard closed 3 years ago
I just hand-checked it to be sure: it works :tada: You understood everything correctly, fusing happens as expected. GHC is impressive!
@nobrakal Great, many thanks for double-checking! That's a very nice example of graph fusion in action :)
Implementing
induce
asinduce p = induceJust . fmap (\a -> if p a then Just a else Nothing)
seems to pass inspection tests. My understanding is that this meansfmap
fuses nicely with theinduceJust
, and so using this simpler definition comes at no runtime cost.@nobrakal Could you have a look?