Ticket #7148 (new bug)

Opened 9 months ago

Last modified 7 months ago

generalized newtype and type families is unsound

Reported by: carter Owned by: simonpj
Priority: normal Milestone: 7.8.1
Component: Compiler (Type checker) Version: 7.6.1-rc1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

the code from  http://joyoftypes.blogspot.com/2012/08/generalizednewtypederiving-is.html type checks in the release candidate

also see discussion here  http://www.reddit.com/r/haskell/comments/y8kca/generalizednewtypederiving_is_very_very_unsafe/

(punch line: the generalized newtype deriving + type families or gadts allows users to write unsafeCoerce etc)

perhaps a simple near term solution is to have any module using generalized new type deriving be inferred to be unsafe by default?

Attachments

badUnsafeGADT.hs Download (0.8 KB) - added by carter 9 months ago.
the code for the bugs
badUnsafe.hs Download (0.7 KB) - added by carter 9 months ago.
the code for the type family version of the bug

Change History

Changed 9 months ago by carter

the code for the bugs

Changed 9 months ago by carter

the code for the type family version of the bug

Changed 9 months ago by carter

to clarify: tested code in ghci

Changed 9 months ago by simonpj

  • difficulty set to Unknown

See #1496.

Changed 8 months ago by dterei

GND isn't allowed in Safe modules, so yes it already causes code using it to be inferred Unsafe.

Changed 7 months ago by igloo

  • owner set to simonpj
  • component changed from Compiler to Compiler (Type checker)
  • milestone set to 7.8.1
Note: See TracTickets for help on using tickets.