-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | GHC plugin to make stream fusion more predictable. -- -- This plugin provides the programmer with a way to annotate certain -- types using a Fuse pragma from the fusion-plugin-types -- package. The programmer would annotate the types that are to be -- eliminated by fusion. During the simplifier phase the plugin goes -- through the relevant bindings and if one of these types are found -- inside a binding then that binding is marked to be inlined -- irrespective of the size. -- -- This plugin was primarily motivated by streamly but it can be -- used in general. @package fusion-plugin @version 0.2.0 -- | Stream fusion depends on the GHC case-of-case transformations -- eliminating intermediate constructors. Case-of-case transformation in -- turn depends on inlining. During core-to-core transformations GHC may -- create several internal bindings (e.g. join points) which may not get -- inlined because their size is bigger than GHC's inlining threshold. -- Even though we know that after fusion the resulting code would be -- smaller and more efficient. The programmer cannot force inlining of -- these bindings as there is no way for the programmer to address these -- bindings at the source level because they are internal, generated -- during core-to-core transformations. As a result stream fusion fails -- unpredictably depending on whether GHC was able to inline the internal -- bindings or not. -- -- See GHC ticket #17075 for more details. -- -- This plugin provides the programmer with a way to annotate certain -- types using a custom Fuse annotation. The programmer would -- annotate the types that are to be eliminated by fusion via -- case-of-case transformations. During the simplifier phase the plugin -- goes through the relevant bindings and if one of these types are found -- inside a binding then that binding is marked to be inlined -- irrespective of the size. -- -- At the right places, fusion can provide dramatic performance -- improvements (e.g. 10x) to the code. module Fusion.Plugin plugin :: Plugin instance Outputable.Outputable Fusion.Plugin.Types.Fuse