[GHC] #10252: Abstract newtype in hs-boot

#10252: Abstract newtype in hs-boot -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.11 Component: Compiler | Operating System: Unknown/Multiple (Type checker) | Type of failure: None/Unknown Keywords: backpack | Blocked By: Architecture: | Related Tickets: Unknown/Multiple | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Currently, the following syntax is not supported in an `hs-boot` file: {{{ module A where newtype F }}} This functionality would be pretty useful, since often the RHS of a newtype is intended to be abstract, and would be a pain to place in the boot file. This is also useful for Backpack. It's a bit hard for me to tell what this should do under the hood: we would have newtypes without the coercions. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10252 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10252: Abstract newtype in hs-boot -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler (Type | Version: 7.11 checker) | Keywords: backpack Resolution: worksforme | Architecture: Operating System: Unknown/Multiple | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by ezyang): * status: new => closed * resolution: => worksforme Comment: Actually, the `data` keyword seems to work fine here. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10252#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10252: Abstract newtype in hs-boot -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler (Type | Version: 7.11 checker) | Keywords: backpack Resolution: worksforme | Architecture: Operating System: Unknown/Multiple | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by goldfire): This scares me. `data` and `newtype` are different! After a quick ponder, I don't see damage that can be caused by abusing this. But, if we ever had representational type families (where `type instance RepF Int = Bool` would be used to reduce `RepF Age` to `Bool`), this would be a disaster. I can't seem to find a ticket requesting representational matching for type families (or classes, or data families), but the idea has come up. (See some wonderings in this direction in #9112, for example.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10252#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10252: Abstract newtype in hs-boot -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler (Type | Version: 7.11 checker) | Keywords: backpack Resolution: worksforme | Architecture: Operating System: Unknown/Multiple | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by rwbarton): You already can define instances of a data family that are newtypes, isn't this sort of like a special case of that? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10252#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10252: Abstract newtype in hs-boot -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler (Type | Version: 7.11 checker) | Keywords: backpack Resolution: worksforme | Architecture: Operating System: Unknown/Multiple | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by goldfire): Hmmm... I guess so. It means that we can't tell whether something is a `data` or a `newtype` right away. This throws out the idea of representational matching, for better or worse. Good point. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10252#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC