-- | This module contains compatibility constructs to write type signatures across
--   multiple ghc-exactprint versions, accepting that anything more ambitious is
--   pretty much impossible with the GHC 9.2 redesign of ghc-exactprint
module Development.IDE.GHC.Compat.ExactPrint
    ( module ExactPrint
    , printA
    , transformA
    ) where

import           Language.Haskell.GHC.ExactPrint   as ExactPrint

printA :: (ExactPrint ast) => ast -> String
printA :: forall ast. ExactPrint ast => ast -> String
printA ast
ast = ast -> String
forall ast. ExactPrint ast => ast -> String
exactPrint ast
ast

transformA
  :: Monad m => ast1 -> (ast1 -> TransformT m ast2) -> m ast2
transformA :: forall (m :: * -> *) ast1 ast2.
Monad m =>
ast1 -> (ast1 -> TransformT m ast2) -> m ast2
transformA ast1
ast ast1 -> TransformT m ast2
f = do
  (ast2
ast',Int
_ ,[String]
_) <- Int -> TransformT m ast2 -> m (ast2, Int, [String])
forall (m :: * -> *) a.
Int -> TransformT m a -> m (a, Int, [String])
runTransformFromT Int
0 (ast1 -> TransformT m ast2
f ast1
ast)
  ast2 -> m ast2
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return (ast2 -> m ast2) -> ast2 -> m ast2
forall a b. (a -> b) -> a -> b
$ ast2
ast'