From 22c04e631f92c8a9f7668aa45e6f793bb97d6102 Mon Sep 17 00:00:00 2001 From: TheMatten Date: Mon, 17 Jan 2022 00:11:45 +0100 Subject: [PATCH] Copy docs of effect constructors to functions --- src/Polysemy/Internal/TH/Effect.hs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Polysemy/Internal/TH/Effect.hs b/src/Polysemy/Internal/TH/Effect.hs index 8b22580..7d4e624 100644 --- a/src/Polysemy/Internal/TH/Effect.hs +++ b/src/Polysemy/Internal/TH/Effect.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE CPP, TemplateHaskell #-} {-# OPTIONS_HADDOCK not-home #-} @@ -31,6 +31,9 @@ module Polysemy.Internal.TH.Effect import Control.Monad import Language.Haskell.TH +#if __GLASGOW_HASKELL__ >= 902 +import Language.Haskell.TH.Syntax (addModFinalizer) +#endif import Language.Haskell.TH.Datatype import Polysemy.Internal.TH.Common @@ -152,7 +155,10 @@ genSig cli genDec :: Bool -> ConLiftInfo -> Q [Dec] genDec should_mk_sigs cli = do let fun_args_names = fst <$> cliFunArgs cli - +#if __GLASGOW_HASKELL__ >= 902 + doc <- getDoc $ DeclDoc $ cliConName cli + maybe (pure ()) (addModFinalizer . putDoc (DeclDoc $ cliFunName cli)) doc +#endif pure [ PragmaD $ InlineP (cliFunName cli) Inlinable ConLike AllPhases , FunD (cliFunName cli)