fusion-plugin 0.1.1 → 0.2.0
raw patch · 6 files changed
+44/−54 lines, 6 filesdep +fusion-plugin-typesPVP ok
version bump matches the API change (PVP)
Dependencies added: fusion-plugin-types
API changes (from Hackage documentation)
- Fusion.Plugin.Types: Fuse :: Fuse
- Fusion.Plugin.Types: data Fuse
- Fusion.Plugin.Types: instance Data.Data.Data Fusion.Plugin.Types.Fuse
- Fusion.Plugin.Types: instance GHC.Classes.Eq Fusion.Plugin.Types.Fuse
- Fusion.Plugin.Types: instance Outputable.Outputable Fusion.Plugin.Types.Fuse
+ Fusion.Plugin: instance Outputable.Outputable Fusion.Plugin.Types.Fuse
Files
- CHANGELOG.md +7/−0
- README.md +15/−5
- fusion-plugin.cabal +11/−7
- src/Fusion/Plugin.hs +6/−0
- src/Fusion/Plugin/Types.hs +0/−42
- stack.yaml +5/−0
CHANGELOG.md view
@@ -1,3 +1,10 @@+## 0.2.0++### Breaking Change+- Fusion.Plugin.Types is no longer exported from this package. If you+ want to annotate the types in your library, use the package+ fusion-plugin-types.+ ## 0.1.1 ### Bug Fixes
README.md view
@@ -31,11 +31,14 @@ ## Solution -This plugin provides the programmer with a way to annotate certain types-using a `Fuse` pragma. 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 provides the programmer with a way to annotate certain+types using a `Fuse` pragma from the+[fusion-plugin-types](https://hackage.haskell.org/package/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. ## Using the plugin @@ -46,6 +49,13 @@ To use this plugin, add this package to your `build-depends` and pass the following to your ghc-options: `ghc-options: -O2 -fplugin=Fusion.Plugin`++## See also++If you are a library author looking to annotate the types, you need to+use the+[fusion-plugin-types](https://hackage.haskell.org/package/fusion-plugin-types)+package. ## Contributing
fusion-plugin.cabal view
@@ -1,14 +1,16 @@ cabal-version: 2.2 name: fusion-plugin-version: 0.1.1+version: 0.2.0 synopsis: GHC plugin to make stream fusion more predictable. description: This plugin provides the programmer with a way to annotate certain- types using a 'Fuse' pragma. 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+ types using a 'Fuse' pragma from the+ <https://hackage.haskell.org/package/fusion-plugin-types 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@@ -25,17 +27,19 @@ category: Development extra-source-files: CHANGELOG.md README.md+ stack.yaml source-repository head type: git location: https://github.com/composewell/fusion-plugin library- exposed-modules: Fusion.Plugin.Types- Fusion.Plugin+ exposed-modules: Fusion.Plugin build-depends: base >= 4.0 && < 5.0 , syb >= 0.7 && < 0.8 , ghc >= 7.10.3 && <= 8.8.2++ , fusion-plugin-types >= 0.1 && < 0.2 hs-source-dirs: src ghc-options: -Wall if impl(ghc >= 8.0)
src/Fusion/Plugin.hs view
@@ -32,6 +32,7 @@ -- At the right places, fusion can provide dramatic performance improvements -- (e.g. 10x) to the code. +{-# OPTIONS_GHC -fno-warn-orphans #-} {-# LANGUAGE CPP #-} module Fusion.Plugin@@ -52,6 +53,7 @@ import Control.Monad (when) import Data.Generics.Schemes (everywhere) import Data.Generics.Aliases (mkT)+import Outputable (Outputable(..), text) import qualified Data.List as DL @@ -330,3 +332,7 @@ plugin :: Plugin plugin = defaultPlugin {installCoreToDos = install}++-- Orphan instance for 'Fuse'+instance Outputable Fuse where+ ppr _ = text "Fuse"
− src/Fusion/Plugin/Types.hs
@@ -1,42 +0,0 @@--- |--- Module : Fusion.Plugin.Types--- Copyright : (c) 2019 Composewell Technologies------ License : BSD-3-Clause--- Maintainer : pranaysashank@composewell.com--- Stability : experimental--- Portability : GHC--{-# LANGUAGE DeriveDataTypeable #-}--module Fusion.Plugin.Types- ( Fuse (..)- )-where--import Data.Data (Data)-import Outputable (Outputable(..), text)---- | A GHC annotation to inform the plugin to aggressively inline join points--- that perform a case match on the constructors of the annotated type.--- Inlining enables case-of-case transformations that would potentially--- eliminate the constructors.------ This annotation is to be used on types whose constructors are known to be--- involved in case-of-case transformations enabling stream fusion via--- elimination of those constructors.------ It is advised to use unique types for intermediate stream state that is to--- be annotated with 'Fuse'. If the annotated type is also used for some--- other purpose this annotation may inline code that is not involved in stream--- fusion and should otherwise not be inlined.------ @--- {-\# ANN type Step Fuse #-}--- data Step s a = Yield a s | Skip s | Stop--- @-data Fuse = Fuse- deriving (Eq, Data)--instance Outputable Fuse where- ppr _ = text "Fuse"
+ stack.yaml view
@@ -0,0 +1,5 @@+resolver: lts-14.20+packages:+- '.'+extra-deps:+ - fusion-plugin-types-0.1.0