-- | -- 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"