Skip to content

Commit

Permalink
Fix simple ghc api errors
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanCacqueray committed Jan 7, 2025
1 parent 753b248 commit 8ed2eff
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/Proto3/Suite/DotProto/Generate/Syntax.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import GHC.Types.Name.Occurrence (NameSpace, dataName, mkOccName, tcName, tvName
import GHC.Types.Name.Reader (mkRdrQual, mkRdrUnqual, rdrNameSpace)
import GHC.Types.SrcLoc (GenLocated(..), SrcSpan, generatedSrcSpan)

#if MIN_VERSION_ghc(9,10,0)
import GHC.Types.Basic (GenReason(OtherExpansion))
#endif
#if MIN_VERSION_ghc(9,8,0)
import Control.Arrow ((***))
import Data.Bool (bool)
Expand Down Expand Up @@ -293,8 +296,11 @@ apply f xs = mkHsApps f (map paren xs)

appAt :: HsExp -> HsType -> HsExp
appAt f t = noLocA (HsAppType synDef f
#if MIN_VERSION_ghc(9,10,0)
#else
#if MIN_VERSION_ghc(9,6,0)
synDef
#endif
#endif
(HsWC NoExtField (parenTy t)))

Expand Down Expand Up @@ -432,13 +438,21 @@ importDecl_ moduleName qualified maybeAs details = noLocA ImportDecl
}

ieName_ :: HsName -> HsImportSpec
#if MIN_VERSION_ghc(9,10,0)
ieName_ = noLocA . (\n -> IEVar synDef n Nothing) . noLocA . IEName
#else
ieName_ = noLocA . IEVar synDef . noLocA . IEName
#endif
#if MIN_VERSION_ghc(9,6,0)
synDef
#endif

ieNameAll_ :: HsName -> HsImportSpec
#if MIN_VERSION_ghc(9,10,0)
ieNameAll_ = noLocA . (\n -> IEThingAll synDef n Nothing) . noLocA . IEName
#else
ieNameAll_ = noLocA . IEThingAll synDef . noLocA . IEName
#endif
#if MIN_VERSION_ghc(9,6,0)
synDef
#endif
Expand Down Expand Up @@ -644,6 +658,9 @@ functionLike_ strictness name alts = noLocA $ mkFunBind generated name (map matc
where
generated :: Origin
generated = Generated
#if MIN_VERSION_ghc(9,10,0)
OtherExpansion
#endif
#if MIN_VERSION_ghc(9,8,0)
DoPmc
#endif
Expand Down Expand Up @@ -851,14 +868,19 @@ case_ e = noLocA . HsCase synDef e . mkMatchGroup generated
where
generated :: Origin
generated = Generated
#if MIN_VERSION_ghc(9,10,0)
OtherExpansion
#endif
#if MIN_VERSION_ghc(9,8,0)
DoPmc
#endif

-- | Simple let expression for ordinary bindings.
let_ :: [HsBind] -> HsExp -> HsExp
let_ locals e =
#if MIN_VERSION_ghc(9,4,0)
#if MIN_VERSION_ghc(9,10,0)
noLocA $ HsLet synDef binds e
#elif MIN_VERSION_ghc(9,4,0)
noLocA $ HsLet synDef synDef binds synDef e
#elif MIN_VERSION_ghc(9,2,0)
noLocA $ HsLet synDef binds e
Expand Down

0 comments on commit 8ed2eff

Please sign in to comment.