Ticket #5821 (new bug)

Opened 4 months ago

Last modified 4 months ago

SPECIALISE fails with a cryptic warning

Reported by: rl Owned by:
Priority: normal Milestone: 7.6.1
Component: Compiler Version: 7.5
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect warning at compile-time Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

Example:

type family T a
type instance T Int = Bool

foo :: Num a => a -> T a
foo = undefined

{-# SPECIALISE foo :: Int -> Bool #-}

GHC produces this warning:

    RULE left-hand side too complicated to desugar
      case cobox of _ { GHC.Types.Eq# cobox ->
      (foo @ Int $dNum)
      `cast` (<Int> -> cobox :: (Int -> T Int) ~# (Int -> Bool))
      }

Given that rewrite rules don't reliably work in the presence of type families, I somewhat suspect that GHC won't be able to generate a sensible specialisation here but it should produce a better diagnostic.

Change History

Changed 4 months ago by igloo

  • difficulty set to Unknown
  • milestone set to 7.6.1
Note: See TracTickets for help on using tickets.