<div dir="auto">Hi devs,<div dir="auto"><br></div><div dir="auto">Is it possible to programmatically recover the role of a type variable?</div><div dir="auto"><br></div><div dir="auto">Or, possibly, a list of the roles of the type variables from left to right?</div><div dir="auto"><br></div><div dir="auto">For example, if i have:</div><div dir="auto"><br></div><div dir="auto">data Foo a = Foo (1)</div><div dir="auto">newtype Bar a b = Bar (a -> b) (1)</div><div dir="auto"><br></div><div dir="auto">Getting the role list of (1) would give me [Phantom], and (2) would give me [Representational, Representational].</div><div dir="auto"><br></div><div dir="auto">I know in compiler/types/TyCon.hs that TyCon has a list of Roles in it, but there doesn't seem to be any machinery available to do this in source haskell.</div><div dir="auto"><br></div><div dir="auto">Thanks</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div></div>