Opened 2 years ago

Closed 2 years ago

#6066 closed bug (duplicate)

Constraint Kinds don't work with Template Haskell

Reported by: sseverance Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.4.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

If I have a record with a constraint kind that has multiple constraints such as:

type MyConstraint a = (Show a, Eq a, Typeable a)
data MyConstraint a => MyType a =  MyType {
  someField :: a
}

If I try to use template haskell on the type (in my case mkLabels from fclabels) you get the following error: Can't represent tuple predicates in Template Haskell: MyConstraint? a

Complete Repro Case:

{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DatatypeContexts #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE TemplateHaskell #-}

import Data.Label
import Data.Typeable

type MyConstraint a = (Show a, Eq a, Typeable a)

data MyConstraint a => MyType a = MyType {
  myField :: a
} deriving (Show, Eq)

mkLabels [''MyType]

Change History (2)

comment:1 Changed 2 years ago by dreixel

Maybe this is also fixed with the patches for #5612?

comment:2 Changed 2 years ago by sseverance

  • Resolution set to duplicate
  • Status changed from new to closed

It would appear so. I have marked as duplicate.

Note: See TracTickets for help on using tickets.