diff options
author | Richard Eisenberg <rae@richarde.dev> | 2022-02-07 21:37:10 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-02-08 10:42:41 -0500 |
commit | b33f0cfabfcace98bb8b77a5bce6c6efba076cf6 (patch) | |
tree | a09e0945786e5229bfef5a4d463f7c3520f16323 | |
parent | 3320ab409939b5450f130edc9f882bde2970e0ff (diff) | |
download | haskell-b33f0cfabfcace98bb8b77a5bce6c6efba076cf6.tar.gz |
Document that reifyRoles includes kind parameters
Close #21056
-rw-r--r-- | libraries/template-haskell/Language/Haskell/TH/Syntax.hs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs index 7446297762..dd2bcd068c 100644 --- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs +++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs @@ -653,9 +653,21 @@ declaration group. See the documentation for 'newDeclarationGroup' for more deta reifyInstances :: Name -> [Type] -> Q [InstanceDec] reifyInstances cls tys = Q (qReifyInstances cls tys) -{- | @reifyRoles nm@ returns the list of roles associated with the parameters of +{- | @reifyRoles nm@ returns the list of roles associated with the parameters +(both visible and invisible) of the tycon @nm@. Fails if @nm@ cannot be found or is not a tycon. The returned list should never contain 'InferR'. + +An invisible parameter to a tycon is often a kind parameter. For example, if +we have + +@ +type Proxy :: forall k. k -> Type +data Proxy a = MkProxy +@ + +and @reifyRoles Proxy@, we will get @['NominalR', 'PhantomR']@. The 'NominalR' is +the role of the invisible @k@ parameter. Kind parameters are always nominal. -} reifyRoles :: Name -> Q [Role] reifyRoles nm = Q (qReifyRoles nm) |