Skip to content

Puzzling error message: No instance for ?Generic s? #160

@ddssff

Description

@ddssff

I sometimes get error messages that resemble GHC missing instance messages but I don't understand what they actually mean. For example, the declaration

import Control.Lens (ReifiedLens(Lens))
foo :: HasPosition i s t a b => ReifiedLens s t a b
foo = Lens (position0 @i)

Gives this error:

src/Data/Generics/Product/Positions.hs:109:18: error:
    * | No instance for ?Generic s?
      |   arising from a generic lens focusing on the field at
      |   position ?i? of type ?a? in ?s?
      
    * In the first argument of `Lens', namely `position0'
      In the expression: Lens (position0 @i)
      In an equation for `foo': foo = Lens (position0 @i)

Could someone explain what this question mark bracketing means? There is already a Generic constraint on s.

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