Skip to content

Commit

Permalink
Merge pull request #39 from con-kitty/plugin/co
Browse files Browse the repository at this point in the history
Add mkPluginCo
  • Loading branch information
zliu41 authored Apr 13, 2022
2 parents 0ec71ef + df59fdc commit b566e08
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ghc/Categorifier/GHC/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module Categorifier.GHC.Core
funTy,
invisFunArg,
localId,
mkPluginCo,
properFunTy,
simplifyExpr,
simplifyExpr',
Expand Down Expand Up @@ -334,6 +335,12 @@ substExpr = CoreSubst.substExpr
substExpr = CoreSubst.substExpr (Utils.text "categorifier")
#endif

-- | Helper function for constructing a `Coercion.Coercion` whose provenance is
-- `TyCoRep.PluginProv`, which the plugin can use to cast one `Type.Type` to
-- another. The caller is responsible for making sure the `Coercion.Coercion` is valid.
mkPluginCo :: Coercion.Role -> Type.Type -> Type.Type -> Coercion.Coercion
mkPluginCo role ty1 ty2 = Coercion.mkUnivCo (TyCoRep.PluginProv "Categorifier") role ty1 ty2

-- | Generic wrapper to make a pretty printer that's less ... pretty (and more useful for people
-- looking at the code).
newtype Unpretty a = Unpretty a
Expand Down

0 comments on commit b566e08

Please sign in to comment.