Skip to content

Should injectReflexive be the first Inject instance? #43

@hdgarrood

Description

@hdgarrood

See discussion in purescript/documentation#211

With the current instance, we have:

> import Data.Either
> import Data.Either.Inject
> x = Left 0 :: Either Int String
> inj x :: Either Int String
Error found:
in module $PSCI
at <internal> line 0, column 0 - line 0, column 0

  No type class instance was found for
                                                 
    Data.Either.Inject.Inject (Either Int String)
                              String             
                                                 

while applying a function inj
  of type Inject t0 t1 => t0 -> t1
  to argument x
while checking that expression inj x
  has type Either Int String
in value declaration it

where t0 is an unknown type
      t1 is an unknown type

See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,
or to contribute content related to this error.

If being able to have inj specialise to the identity function is important, should injectReflexive go first? Alternatively, should we consider just dropping the instance?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions