diff options
author | Richard Eisenberg <rae@richarde.dev> | 2022-02-07 21:37:10 +0000 |
---|---|---|
committer | Richard Eisenberg <rae@richarde.dev> | 2022-02-07 21:37:10 +0000 |
commit | 50d3a2f997f312b75e7295ea708fde73d0b77411 (patch) | |
tree | 7f257b1df0adb345759b54b159fc260f43873b31 | |
parent | ff867c460db9cfc43f5697c8e582f8c1ea4bd572 (diff) | |
download | haskell-50d3a2f997f312b75e7295ea708fde73d0b77411.tar.gz |
Document that reifyRoles includes kind parameterswip/T21056
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) |