Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#10104 closed bug (fixed)

Show '#' on unboxed literals

Reported by: thomie Owned by:
Priority: normal Milestone: 8.0.1
Component: Compiler Version: 7.8.4
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: deriving/should_run/T10104
Blocked By: Blocking:
Related Tickets: #8274 Differential Rev(s): Phab:D672
Wiki Page:

Description

Currently, unboxed literals are shown in the same way as boxed literals (without #):

Prelude> :set -XMagicHash
Prelude> :m GHC.Prim
Prelude GHC.Prim> data T = MkT Int# deriving Show
Prelude GHC.Prim> MkT 3#
MkT 3

It would be nice if this would show MkT 3# instead. I have a patch.

Change History (6)

comment:1 Changed 5 years ago by thomie

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

Also handle Char#, Word#, Float# and Double#. And don't show superfluous parenthesis around negative unboxed literals.

For reference: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/syntax-extns.html#magic-hash

comment:2 Changed 5 years ago by thomie

Test Case: deriving/should_run/T10104

comment:3 Changed 5 years ago by Austin Seipp <austin@…>

In 47175e06ff8364c732607e3d76ef3b7b80d57f1c/ghc:

Show '#' on unboxed literals

Test Plan: deriving/should_run/T10104

Reviewers: austin, jstolarek

Reviewed By: austin, jstolarek

Subscribers: thomie

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

GHC Trac Issues: #10104

comment:4 Changed 5 years ago by thoughtpolice

Resolution: fixed
Status: patchclosed
Type: feature requestbug

Merged, thanks!

comment:5 Changed 5 years ago by Austin Seipp <austin@…>

In 89458eba5721de1b6b3378415f26e110bab8cc0f/ghc:

Pretty-print # on unboxed literals in core

Summary:
Ticket #10104 dealt with showing the '#'s on types with unboxed fields. This
commit pretty prints the '#'s on unboxed literals in core output.

Test Plan: simplCore/should_compile/T8274

Reviewers: jstolarek, simonpj, austin

Reviewed By: simonpj, austin

Subscribers: simonpj, thomie

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

GHC Trac Issues: #8274

comment:6 Changed 4 years ago by thoughtpolice

Milestone: 7.12.18.0.1

Milestone renamed

Note: See TracTickets for help on using tickets.