-- | -- Module : Fusion.Plugin.Types -- Copyright : (c) 2020 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) -- | 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 (Fuse -> Fuse -> Bool (Fuse -> Fuse -> Bool) -> (Fuse -> Fuse -> Bool) -> Eq Fuse forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a $c== :: Fuse -> Fuse -> Bool == :: Fuse -> Fuse -> Bool $c/= :: Fuse -> Fuse -> Bool /= :: Fuse -> Fuse -> Bool Eq, Typeable Fuse Typeable Fuse -> (forall (c :: * -> *). (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Fuse -> c Fuse) -> (forall (c :: * -> *). (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Fuse) -> (Fuse -> Constr) -> (Fuse -> DataType) -> (forall (t :: * -> *) (c :: * -> *). Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Fuse)) -> (forall (t :: * -> * -> *) (c :: * -> *). Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Fuse)) -> ((forall b. Data b => b -> b) -> Fuse -> Fuse) -> (forall r r'. (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Fuse -> r) -> (forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Fuse -> r) -> (forall u. (forall d. Data d => d -> u) -> Fuse -> [u]) -> (forall u. Int -> (forall d. Data d => d -> u) -> Fuse -> u) -> (forall (m :: * -> *). Monad m => (forall d. Data d => d -> m d) -> Fuse -> m Fuse) -> (forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> Fuse -> m Fuse) -> (forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> Fuse -> m Fuse) -> Data Fuse Fuse -> Constr Fuse -> DataType (forall b. Data b => b -> b) -> Fuse -> Fuse forall a. Typeable a -> (forall (c :: * -> *). (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> a -> c a) -> (forall (c :: * -> *). (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c a) -> (a -> Constr) -> (a -> DataType) -> (forall (t :: * -> *) (c :: * -> *). Typeable t => (forall d. Data d => c (t d)) -> Maybe (c a)) -> (forall (t :: * -> * -> *) (c :: * -> *). Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a)) -> ((forall b. Data b => b -> b) -> a -> a) -> (forall r r'. (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r) -> (forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r) -> (forall u. (forall d. Data d => d -> u) -> a -> [u]) -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u) -> (forall (m :: * -> *). Monad m => (forall d. Data d => d -> m d) -> a -> m a) -> (forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> a -> m a) -> (forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> a -> m a) -> Data a forall u. Int -> (forall d. Data d => d -> u) -> Fuse -> u forall u. (forall d. Data d => d -> u) -> Fuse -> [u] forall r r'. (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Fuse -> r forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Fuse -> r forall (m :: * -> *). Monad m => (forall d. Data d => d -> m d) -> Fuse -> m Fuse forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> Fuse -> m Fuse forall (c :: * -> *). (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Fuse forall (c :: * -> *). (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Fuse -> c Fuse forall (t :: * -> *) (c :: * -> *). Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Fuse) forall (t :: * -> * -> *) (c :: * -> *). Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Fuse) $cgfoldl :: forall (c :: * -> *). (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Fuse -> c Fuse gfoldl :: forall (c :: * -> *). (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Fuse -> c Fuse $cgunfold :: forall (c :: * -> *). (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Fuse gunfold :: forall (c :: * -> *). (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Fuse $ctoConstr :: Fuse -> Constr toConstr :: Fuse -> Constr $cdataTypeOf :: Fuse -> DataType dataTypeOf :: Fuse -> DataType $cdataCast1 :: forall (t :: * -> *) (c :: * -> *). Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Fuse) dataCast1 :: forall (t :: * -> *) (c :: * -> *). Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Fuse) $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *). Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Fuse) dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *). Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Fuse) $cgmapT :: (forall b. Data b => b -> b) -> Fuse -> Fuse gmapT :: (forall b. Data b => b -> b) -> Fuse -> Fuse $cgmapQl :: forall r r'. (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Fuse -> r gmapQl :: forall r r'. (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Fuse -> r $cgmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Fuse -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Fuse -> r $cgmapQ :: forall u. (forall d. Data d => d -> u) -> Fuse -> [u] gmapQ :: forall u. (forall d. Data d => d -> u) -> Fuse -> [u] $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Fuse -> u gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Fuse -> u $cgmapM :: forall (m :: * -> *). Monad m => (forall d. Data d => d -> m d) -> Fuse -> m Fuse gmapM :: forall (m :: * -> *). Monad m => (forall d. Data d => d -> m d) -> Fuse -> m Fuse $cgmapMp :: forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> Fuse -> m Fuse gmapMp :: forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> Fuse -> m Fuse $cgmapMo :: forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> Fuse -> m Fuse gmapMo :: forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> Fuse -> m Fuse Data)