#7658 closed feature request (wontfix)

Support empty record update syntax

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


Empty record update syntax would be useful for when you are changing phantom type parameters. It is currently explicitly disallowed, but it isn't clear if that is absolutely necessary to me.

data R phantom = C { a,b :: Int }

r ::  R Int 
r = C 1 2 

--This is OK
r1 :: R Char
r1 = r { a = a r } 

--Why not this?
r2 :: R Char
r2 = r {}

Change History (3)

comment:1 Changed 15 months ago by glguy

I guess this would cause a problem typing expressions like:

\x -> x{}

comment:2 Changed 15 months ago by monoidal

Shameless plug: Personally I like to allow changing phantom type parameters with the same mechanism as newtype coercions, described here and here.

comment:3 Changed 15 months ago by simonpj

  • Difficulty set to Unknown
  • Resolution set to wontfix
  • Status changed from new to closed

glguy is right: the typing of record updates currently depends critically on there being at least one field. What type would you infer for this?

f x = x {}

I agree about newtype wrapper. Very much on the radar.

Note: See TracTickets for help on using tickets.