Skip to content

What does splitTyConApp_upTo do? Documentation is unclear. #14

@phadej

Description

@phadej

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions