Opened 14 months ago

Closed 13 months ago

Last modified 7 weeks ago

#12478 closed feature request (fixed)

Template Haskell support for unboxed sums

Reported by: RyanGlScott Owned by:
Priority: normal Milestone: 8.2.1
Component: Template Haskell Version: 8.1
Keywords: TemplateHaskell, UnboxedSums Cc: osa1
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: th/T12478_{1,2,3,4}
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D2448, Phab:D2854
Wiki Page:

Description

Currently, you can't use unboxed sums with Template Haskell. This makes me sad.

Patch incoming.

Change History (6)

comment:1 Changed 14 months ago by RyanGlScott

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

comment:2 Changed 13 months ago by Ben Gamari <ben@…>

In 613d7455/ghc:

Template Haskell support for unboxed sums

This adds new constructors `UnboxedSumE`, `UnboxedSumT`, and
`UnboxedSumP` to represent unboxed sums in Template Haskell.

One thing you can't currently do is, e.g., `reify ''(#||#)`, since I
don't believe unboxed sum type/data constructors can be written in
prefix form.  I will look at fixing that as part of #12514.

Fixes #12478.

Test Plan: make test TEST=T12478_{1,2,3}

Reviewers: osa1, goldfire, austin, bgamari

Reviewed By: goldfire, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2448

GHC Trac Issues: #12478

comment:3 Changed 13 months ago by thomie

Resolution: fixed
Status: patchclosed
Test Case: th/T12478_{1,2,3,4}

comment:4 Changed 9 months ago by RyanGlScott

Differential Rev(s): Phab:D2448Phab:D2448, Phab:D2854

comment:5 Changed 9 months ago by Ryan Scott <ryan.gl.scott@…>

In b5d788aa/ghc:

Introduce unboxedSum{Data,Type}Name to template-haskell

Summary:
In D2448 (which introduced Template Haskell support for unboxed
sums), I neglected to add `unboxedSumDataName` and `unboxedSumTypeName`
functions, since there wasn't any way you could write unboxed sum data or type
constructors in prefix form to begin with (see #12514). But even if you can't
write these `Name`s directly in source code, it would still be nice to be able
to use these `Name`s in Template Haskell (for instance, to be able to treat
unboxed sum type constructors like any other type constructors).

Along the way, this uncovered a minor bug in `isBuiltInOcc_maybe` in
`TysWiredIn`, which was calculating the arity of unboxed sum data constructors
incorrectly.

Test Plan: make test TEST=T12478_5

Reviewers: osa1, goldfire, austin, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2854

GHC Trac Issues: #12478, #12514

comment:6 Changed 7 weeks ago by RyanGlScott

Keywords: UnboxedSums added
Note: See TracTickets for help on using tickets.