Skip to content

Remove runtime overhead of typeclass instances with no dictionary #2768

Description

@doolse

With the new Union typeclass which exists purely for proof at compile time as it has no functions, it would be nice if when it was used as a constraint the runtime didn't have to pass a dictionary in for it.

I understand that might be a difficult thing to change but what might be more feasible is to remove the overhead of creating blank dictionaries from the dictionaries of other constraints. E.g.

class MergeDefaults (o :: # Type) (mr :: # Type) (mo :: # Type)
instance mergeInstance :: (Union o m mo, Union m r mr, Subrow r o) => MergeDefaults o mr mo

Currently whenever it's used generate something along the lines of:

Data_Record.mergeInstance({})({})(Data_Record.subrow({}))

which could be optimised simply to {}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions