Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#8100 closed feature request (fixed)

Standalone deriving using template haskell

Reported by: acube Owned by: goldfire
Priority: normal Milestone:
Component: Template Haskell Version:
Keywords: Cc: vogt.adam@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: th/T8100
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D439
Wiki Page:

Description

Currently, there seems to be no support for standalone deriving in TemplateHaskell:

Prelude Data.Typeable Language.Haskell.TH> :set -XStandaloneDeriving 
Prelude Data.Typeable Language.Haskell.TH> data Weird a (b :: * -> * -> *) c = Weird
Prelude Data.Typeable Language.Haskell.TH> runQ $ [d| deriving instance Typeable Weird |]
[]

Use case:

The library typeable-th can already generate Typeable instances using TH for GHC 7.4 and 7.6. To add support for GHC 7.8 in a way that the user doesn't have to care about the version, there has to be a way to make Typeable instances via TH in GHC 7.8. This is currently impossible, but with StandaloneDeriving support for TH, it would be possible.

Change History (14)

comment:1 Changed 6 years ago by aavogt

Cc: vogt.adam@… added

comment:2 Changed 6 years ago by goldfire

At the least, if this remains unimplemented, quoting a use of standalone deriving should result in an error, instead of silent ignoring.

comment:3 Changed 5 years ago by dmcclean

I second the request for an error message if you quote one. The current behavior had me baffled for a while.

comment:4 Changed 5 years ago by simonpj

Since TH syntax can't represent the declaration it's bizarre that it's accepted.

But it wouldn't be hard to implement. Any volunteers?

Simon

comment:5 Changed 5 years ago by goldfire

Owner: set to goldfire

I'll move this from my local, unpublicized, unofficial set of tickets I plan to address to my official set of tickets I plan to address.

comment:6 Changed 5 years ago by GregWeber

I am willing to help test this out. Need it for the persistent library.

comment:7 Changed 5 years ago by goldfire

See Design/TemplateHaskellGADTs for a related change to the Dec type I'd like feedback on.

comment:8 Changed 5 years ago by goldfire

Differential Rev(s): Phab:D439
Status: newpatch

comment:9 Changed 5 years ago by Richard Eisenberg <eir@…>

comment:10 Changed 5 years ago by Richard Eisenberg <eir@…>

In 4ac9e902327683ba032df5fb0e92a80c7b7fccd4/ghc:

Fix #8100, by adding StandaloneDerivD to TH's Dec type.

comment:11 Changed 5 years ago by goldfire

Resolution: fixed
Status: patchclosed
Test Case: th/T8100

comment:12 Changed 5 years ago by Richard Eisenberg <eir@…>

In 786b62aa57e4dcc528e2da2f7d0451ab834d655a/ghc:

Add release notes for #8100, #9527, and #9064.

comment:13 Changed 5 years ago by vxanica

Will it be merged into next release?

comment:14 in reply to:  13 Changed 5 years ago by simonpj

Replying to vxanica:

Will it be merged into next release?

For 7.10, yes certainly.

Simon

Note: See TracTickets for help on using tickets.