Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/PyF/Internal/Meta.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module PyF.Internal.Meta (toExp, baseDynFlags, toName) where
import qualified Data.List.NonEmpty as NE

#if MIN_VERSION_ghc(9,2,0)
import GHC.Hs.Type (HsWildCardBndrs (..), HsType (..), HsSigType(HsSig), sig_body)
import GHC.Hs.Type (HsWildCardBndrs (..), HsType (..), HsIPName(HsIPName), HsSigType(HsSig), sig_body)
#elif MIN_VERSION_ghc(9,0,0)
import GHC.Hs.Type (HsWildCardBndrs (..), HsType (..), HsImplicitBndrs(HsIB), hsib_body)
#elif MIN_VERSION_ghc(8,10,0)
Expand Down Expand Up @@ -167,7 +167,11 @@ toExp _ (Expr.HsUnboundVar _ n) = TH.UnboundVarE (TH.mkName . occNa
toExp _ (Expr.HsUnboundVar _ n) = TH.UnboundVarE (TH.mkName . occNameString . Expr.unboundVarOcc $ n)
#endif

toExp _ Expr.HsIPVar {} = noTH "toExp" "HsIPVar"
#if MIN_VERSION_ghc(8,8,0)
toExp _ (Expr.HsIPVar _ (HsIPName x)) = TH.ImplicitParamVarE (unpackFS x)
#else
toExp _ Expr.HsIPVar {} = noTH "toExp" "upgrade to ghc>=8.8 for ImplicitParamsVarE"
#endif
toExp _ (Expr.HsLit _ l) = TH.LitE (toLit l)
toExp _ (Expr.HsOverLit _ OverLit {ol_val}) = TH.LitE (toLit' ol_val)
toExp d (Expr.HsApp _ e1 e2) = TH.AppE (toExp d . unLoc $ e1) (toExp d . unLoc $ e2)
Expand Down Expand Up @@ -299,8 +303,10 @@ toExp dynFlags e = todo "toExp" (showSDoc dynFlags . ppr $ e)
todo :: (HasCallStack, Show e) => String -> e -> a
todo fun thing = error . concat $ [moduleName, ".", fun, ": not implemented: ", show thing, "Please open an issue at https://github.com/guibou/PyF/issues"]

#if !MIN_VERSION_ghc(8,8,0)
noTH :: (HasCallStack, Show e) => String -> e -> a
noTH fun thing = error . concat $ [moduleName, ".", fun, ": no TemplateHaskell for: ", show thing, "Please open an issue at https://github.com/guibou/PyF/issues"]
#endif

moduleName :: String
moduleName = "PyF.Internal.Meta"
Expand Down