Skip to content

Invalid "duplicate instance" error

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 |]
Trac metadata
Trac field Value
Version 6.12.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information