[GHC] #13853: TypeApplications and record syntax don't mix

#13853: TypeApplications and record syntax don't mix -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: feature | Status: new request | Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple TypeApplications | Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Let's fire up GHCi: {{{ $ ~/Software/ghc-8.2.0.20170507/bin/ghci GHCi, version 8.2.0.20170507: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /Users/rscott/.ghci λ> :set -XTypeApplications -fprint-explicit-foralls λ> import Data.Functor.Identity }}} I can use `TypeApplications` on `Identity` like so: {{{ λ> Identity @Int 42 Identity 42 }}} But not if I try to use record syntax: {{{ λ> Identity @Int { runIdentity = 42 } <interactive>:4:15: error: parse error on input ‘{’ λ> (Identity @Int) { runIdentity = 42 } <interactive>:7:1: error: • Couldn't match expected type ‘Identity a0’ with actual type ‘Int -> Identity Int’ • In the expression: (Identity @Int) {runIdentity = 42} In an equation for ‘it’: it = (Identity @Int) {runIdentity = 42} }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13853 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13853: TypeApplications and record syntax don't mix -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: | TypeApplications Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by RyanGlScott: @@ -24,7 +24,0 @@ - λ> (Identity @Int) { runIdentity = 42 } - - <interactive>:7:1: error: - • Couldn't match expected type ‘Identity a0’ - with actual type ‘Int -> Identity Int’ - • In the expression: (Identity @Int) {runIdentity = 42} - In an equation for ‘it’: it = (Identity @Int) {runIdentity = 42} New description: Let's fire up GHCi: {{{ $ ~/Software/ghc-8.2.0.20170507/bin/ghci GHCi, version 8.2.0.20170507: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /Users/rscott/.ghci λ> :set -XTypeApplications -fprint-explicit-foralls λ> import Data.Functor.Identity }}} I can use `TypeApplications` on `Identity` like so: {{{ λ> Identity @Int 42 Identity 42 }}} But not if I try to use record syntax: {{{ λ> Identity @Int { runIdentity = 42 } <interactive>:4:15: error: parse error on input ‘{’ }}} -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13853#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13853: TypeApplications and record syntax don't mix -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: | TypeApplications Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): Record-construction syntax is not a special application form, so I wouldn't expect this to work. Perhaps we can embellish record-construction to enable this syntax, but it would be a change to the grammar. This smells similar to #12363, asking for type application on infix operators. I think the next step here is a ghc-proposal. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13853#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13853: TypeApplications and record syntax don't mix -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: | TypeApplications Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Iceland_jack): Hm this is confusing {{{
Identity { runIdentity = 42 } Identity 42 (Identity) { runIdentity = 42 }
<interactive>:21:1: error: • Couldn't match expected type ‘Identity a1’ with actual type ‘a0 -> Identity a0’ • In the expression: (Identity) {runIdentity = 42} In an equation for ‘it’: it = (Identity) {runIdentity = 42} }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13853#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13853: TypeApplications and record syntax don't mix -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: | TypeApplications Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): comment:3 follows directly from the [https://www.haskell.org/onlinereport/haskell2010/haskellch3.html#x8-520003.1... Report]. Note that `(Identity {}) { runIdentity = 42 }` works: a record construction (with an empty field-list) followed by a record-update. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13853#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13853: TypeApplications and record syntax don't mix -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: | TypeApplications Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Iceland_jack): `Identity @Int {}` would work as well then? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13853#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13853: TypeApplications and record syntax don't mix -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: | TypeApplications Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): Assuming the proposal in this ticket were implemented, then yes, `Identity @Int {}` would be a perfectly cromulent thing to do. `Identity {}` is a record construction that doesn't specify any record names, so all fields would be initialized to `⊥`. So `Identity @Int {}` is essentially `Identity (⊥ :: Int)`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13853#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13853: TypeApplications and record syntax don't mix -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: wontfix | Keywords: | TypeApplications Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => closed * resolution: => wontfix Comment: I've lost interest in this ticket. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13853#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC