#11401 closed bug (fixed)

No match in record selector ctev_dest

Reported by: Lemming Owned by: goldfire
Priority: highest Milestone: 8.0.1
Component: Compiler Version: 8.0.1-rc1
Keywords: TypeInType Cc: ekmett, adamgundry
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: typecheck/should_compile/T11401
Blocked By: Blocking:
Related Tickets: #11523 Differential Rev(s):
Wiki Page:

Description (last modified by Lemming)

With the llvm-tf package I got the following problem:

$ cat RecordSelectorCtevDest.hs
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
module RecordSelectorCtevDest where

newtype Value a = Value a
newtype CodeGen r a = CodeGen a

bind :: CodeGen r a -> (a -> CodeGen r b) -> CodeGen r b
bind (CodeGen a) k = k a

   (f ~ CalledFunction g, r ~ CallerResult g, g ~ CallerFunction f r) =>
       CallArgs f g r where
   type CalledFunction g :: *
   type CallerResult g :: *
   type CallerFunction f r :: *
   call :: f -> g

instance CallArgs (IO a) (CodeGen r (Value a)) r where
   type CalledFunction (CodeGen r (Value a)) = IO a
   type CallerResult (CodeGen r (Value a)) = r
   type CallerFunction (IO a) r = CodeGen r (Value a)
   call = undefined

instance CallArgs b b' r => CallArgs (a -> b) (Value a -> b') r where
   type CalledFunction (Value a -> b') = a -> CalledFunction b'
   type CallerResult (Value a -> b') = CallerResult b'
   type CallerFunction (a -> b) r = Value a -> CallerFunction b r
   call = undefined

test :: IO a -> (a -> IO ()) -> CodeGen () (Value ())
test start stop  =  bind (call start) (call stop)

$ ghci- RecordSelectorCtevDest.hs 
GHCi, version http://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling RecordSelectorCtevDest ( RecordSelectorCtevDest.hs, interpreted )
*** Exception: No match in record selector ctev_dest

The problem disappears when I remove the 'r' parameter from CodeGen, CallArgs and CallerFunction and remove the CallerResult consequently.

Attachments (2)

RecordSelectorCtevDest.hs (1.3 KB) - added by Lemming 19 months ago.
Example module as file
T11401.patch (729 bytes) - added by adamgundry 17 months ago.
Patch against HEAD

Download all attachments as: .zip

Change History (16)

Changed 19 months ago by Lemming

Attachment: RecordSelectorCtevDest.hs added

Example module as file

comment:1 Changed 19 months ago by Lemming

Description: modified (diff)

comment:2 Changed 18 months ago by thomie

Milestone: 8.0.1
Priority: normalhighest

Regression from 7.10.3.

Assert failure in shortCutReduction in TcInteract.hs with devel2 build.

comment:3 Changed 18 months ago by goldfire

Keywords: TypeInType added

comment:4 Changed 18 months ago by bgamari

Owner: set to goldfire

comment:5 Changed 18 months ago by Lemming

With ghc- I get the same error at a different place. Maybe this allows me to extract a simpler example code. Are you interested?

comment:6 Changed 18 months ago by goldfire

Not if it's much trouble. I think this one should be easy to track down. But I have to finish #11471 first, as that's a larger change.

comment:7 Changed 18 months ago by ekmett

comment:8 Changed 17 months ago by ekmett

Cc: ekmett added

comment:9 Changed 17 months ago by adamgundry

Cc: adamgundry added

I've run into this as well. I'm attaching a trivial patch that fixes the bug and corrects a reference to a Note, but I don't know whether Richard's work will conflict with it or if a bigger change is in order.

Changed 17 months ago by adamgundry

Attachment: T11401.patch added

Patch against HEAD

comment:10 Changed 17 months ago by goldfire

I actually have a patch for this locally, but it's queued behind something larger. Thanks for taking a look, though!

comment:11 Changed 17 months ago by adamgundry

Thanks, I suspected as much which was why I didn't put this on Phab. The patch was mostly to unblock testing one of my projects, and I thought I should stick it here in case it could do the same for anyone else.

comment:12 Changed 17 months ago by Richard Eisenberg <eir@…>

In 35d37ff8/ghc:

Fix #11401.

This commit teaches shortCutReduction about Derived constraints.

[skip ci]

comment:13 Changed 17 months ago by goldfire

Status: newmerge
Test Case: typecheck/should_compile/T11401

comment:14 Changed 16 months ago by bgamari

Resolution: fixed
Status: mergeclosed
Note: See TracTickets for help on using tickets.