I understand what splitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type]) does. It's a reverse of mkTyConApp :: TyCon -> [Type] -> Type.
I don't really understand what splitTyConApp_upTo does. There wasn't reverse for previous -> Maybe (... (TyCon, [Type]) (probably because we need use givens?), nor current
splitTyConApp_upTo :: TyConSubst -> Type -> Maybe (NonEmpty (TyCon, [Type], [Coercion]))
Like splitTyConApp_maybe, but taking Given constraints into account.
Alongside the TyCon and its arguments, also returns a list of coercions that embody the Givens that we depended on.
So I ask for an example of what splitTyConApp_upTo does (especailly when splitTyConApp_maybe would fail)`, and maybe even for an morallly an inverse function to make it even more obvious.
I'm working on updating a plugin using splitTyConApp_upTo, and I cannot judge what I should do with coercions, if anything.
I understand what
splitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type])does. It's a reverse ofmkTyConApp :: TyCon -> [Type] -> Type.I don't really understand what
splitTyConApp_upTodoes. There wasn't reverse for previous-> Maybe (... (TyCon, [Type])(probably because we need use givens?), nor currentSo I ask for an example of what
splitTyConApp_upTodoes (especailly whensplitTyConApp_maybewould fail)`, and maybe even for an morallly an inverse function to make it even more obvious.I'm working on updating a plugin using
splitTyConApp_upTo, and I cannot judge what I should do with coercions, if anything.