Skip to content

LensFor: Couldn't match expected type p #659

@yaitskov

Description

@yaitskov

After upgrading GHC version from 8.10.7 to 9.2.4 following snippets fails:

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE MonoLocalBinds #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-}

module Foo where

data Foo f = Foo  { fooInt :: C f Int }  deriving (Generic, Beamable)

module Bar where
{-# LANGUAGE ImpredicativeTypes #-}
{-# OPTIONS_GHC -Wno-missing-signatures #-}

import Database.Beam (LensFor (LensFor), TableLens (TableLens), dbLenses, tableLenses)
import Foo

Foo  (LensFor x)  = tableLenses

Couldn't match expected type ‘p’
              with actual type ‘microlens-0.4.12.0:Lens.Micro.Type.Lens'
                                  (Foo f1)
                                  (Database.Beam.Schema.Tables.Columnar
                                     f1 ghc-prim-0.8.0:GHC.Types.Int)’
  Cannot equate type variable ‘p’
  with a type involving polytypes:
    microlens-0.4.12.0:Lens.Micro.Type.Lens'
      (Foo f1)
      (Database.Beam.Schema.Tables.Columnar
         f1 ghc-prim-0.8.0:GHC.Types.Int)
  ‘p’ is a rigid type variable bound by
    the inferred type of x :: p
    at /home/dan/pro/Bar.hs:10:1-29
• In the pattern: LensFor x
  In the pattern: Foo (LensFor x)
  In a pattern binding: Foo (LensFor x) = tableLensestypecheck(-Wdeferred-type-errors)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions