[GHC] #8459: Role of TExp

#8459: Role of TExp -------------------------------------------+------------------------------- Reporter: monoidal | Owner: monoidal Type: bug | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 7.7 Keywords: | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Easy (less than 1 hour) | Type of failure: Other Blocked By: | Test Case: Related Tickets: | Blocking: -------------------------------------------+------------------------------- We've got `type role TExp phantom` where `TExp` is typed TH expression. As far as I understand, it should be representational, like `Ptr` is. I will change it soon unless someone objects. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8459 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8459: Role of TExp -------------------------------+------------------------------------------- Reporter: monoidal | Owner: monoidal Type: bug | Status: new Priority: normal | Milestone: Component: Template | Version: 7.7 Haskell | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Easy (less than 1 hour) Unknown/Multiple | Blocked By: Type of failure: Other | Related Tickets: Test Case: | Blocking: | -------------------------------+------------------------------------------- Comment (by goldfire): I would say it should be nominal, not representational. After all, an expression that produces an `Int` is '''not''' the same as an expression that produces an `Age`. Thanks for noticing this! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8459#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8459: Role of TExp -------------------------------+------------------------------------------- Reporter: monoidal | Owner: monoidal Type: bug | Status: new Priority: normal | Milestone: Component: Template | Version: 7.7 Haskell | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Easy (less than 1 hour) Unknown/Multiple | Blocked By: Type of failure: Other | Related Tickets: Test Case: | Blocking: | -------------------------------+------------------------------------------- Comment (by simonpj): Richard is right. Consider {{{ e :: TExp Age e = MkAge 3 foo = $(coerce e) + 4::Int }}} The splice will evaluate to `(MkAge 3)` and you can't add that to `4::Int`. So you can't `coerce` a `(TExp Age)` to a `(TExp Int)`. Nominal! I'll change it, via a role signature in `TH.Syntax`. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8459#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8459: Role of TExp
-------------------------------+-------------------------------------------
Reporter: monoidal | Owner: monoidal
Type: bug | Status: closed
Priority: normal | Milestone:
Component: Template | Version: 7.7
Haskell | Keywords:
Resolution: fixed | Architecture: Unknown/Multiple
Operating System: | Difficulty: Easy (less than 1 hour)
Unknown/Multiple | Blocked By:
Type of failure: Other | Related Tickets:
Test Case: |
Blocking: |
-------------------------------+-------------------------------------------
Changes (by simonpj):
* status: new => closed
* resolution: => fixed
Comment:
Fixed by this patch to `template-haskell`
{{{
commit 46f8016024d3b5bf427848543d57fe45a946d971
Author: Simon Peyton Jones
participants (1)
-
GHC