Opened 7 years ago

Closed 4 years ago

#4170 closed bug (fixed)

Invalid "duplicate instance" error

Reported by: verdelyi Owned by:
Priority: low Milestone: 7.6.2
Component: Template Haskell Version: 6.12.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: th/T4170
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

Test case:

{-# LANGUAGE TemplateHaskell #-}

import Language.Haskell.TH

class LOL a

lol :: Q [Dec]
lol = [d|
    instance LOL Int
    |]

instance LOL Int

Error:

duplicateinstance.hs:9:13:
    Duplicate instance declarations:
      instance LOL Int -- Defined at duplicateinstance.hs:9:13-19
      instance LOL Int -- Defined at duplicateinstance.hs:12:9-15
    In the Template Haskell quotation
      [d| 
          instance LOL Int where |]
    In the expression:
        [d| 
            instance LOL Int where |]
    In the definition of `lol':
        lol = [d| 
                  instance LOL Int where |]

Change History (8)

comment:1 Changed 7 years ago by Ashley Yakeley

This just bit me too. I need this because I need a way to let the programmer tell my stuff about existing instances, since there's currently no way to query the "instance environment".

comment:2 Changed 7 years ago by simonpj

See #4230 for a more global discussion

Simon

comment:3 Changed 7 years ago by igloo

Blocked By: 4230 added

comment:4 Changed 7 years ago by igloo

Component: CompilerTemplate Haskell
Milestone: 6.16.1

comment:5 Changed 5 years ago by igloo

Milestone: 7.4.17.6.1
Priority: normallow

comment:6 Changed 5 years ago by igloo

Milestone: 7.6.17.6.2

comment:7 Changed 4 years ago by Krzysztof Gogolewski <krz.gogolewski@…>

In e595c81ee0951f17d34b918123dfa7711710fe89/testsuite:

Add tests for new TH #4124, #4128, #4170, #4364, #6062

comment:8 Changed 4 years ago by monoidal

Blocked By: 4230 removed
difficulty: Unknown
Resolution: fixed
Status: newclosed
Test Case: th/T4170

This is now fixed thanks to new TH. Woo hoo!

Note: See TracTickets for help on using tickets.