{-# LANGUAGE CPP #-}
module Language.Haskell.TH.Compat where
import           Language.Haskell.TH

-- | Compatibility helper to create TySynInstD
mkTySynInstD :: Name -> [Type] -> Type -> Dec
mkTySynInstD :: Name -> [Type] -> Type -> Dec
mkTySynInstD tyConNm :: Name
tyConNm tyArgs :: [Type]
tyArgs rhs :: Type
rhs =
#if MIN_VERSION_template_haskell(2,15,0)
        TySynEqn -> Dec
TySynInstD (Maybe [TyVarBndr] -> Type -> Type -> TySynEqn
TySynEqn Maybe [TyVarBndr]
forall a. Maybe a
Nothing
                     ((Type -> Type -> Type) -> Type -> [Type] -> Type
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl Type -> Type -> Type
AppT (Name -> Type
ConT Name
tyConNm) [Type]
tyArgs)
                     Type
rhs)
#else
        TySynInstD tyConNm
                   (TySynEqn tyArgs
                             rhs)
#endif