[GHC] #12980: Unlifted class method rejected

#12980: Unlifted class method rejected -------------------------------------+------------------------------------- Reporter: goldfire | Owner: goldfire Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- If I say {{{#!hs class C a where meth :: Array# a }}} I get {{{ • Expecting a lifted type, but ‘Array# a’ is unlifted • In the type signature: meth :: Array# a In the class declaration for ‘C’ }}} This definition looks OK to me. I don't see why we can't have an unlifted member of a class. (As @oerjan points out in comment:25:ticket:12708, we can't have a ''levity-polymorphic'' class member, but this is solidly levity- monomorphic.) I'm happy to lift this restriction in ongoing work in this area, but I wanted to double-check before doing so. For the record, the same error occurs even when the class has more than one member, so it's not the no-unlifted-newtypes restriction. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12980 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12980: Unlifted class method rejected -------------------------------------+------------------------------------- Reporter: goldfire | Owner: goldfire Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: 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 simonpj): Certainly should be ok for multi-method classes. I'm not quite sure about the single-method case, because of the interaction with newtypes -- but I think there's a case for using data types in the single-method case too. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12980#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12980: Unlifted class method rejected -------------------------------------+------------------------------------- Reporter: goldfire | Owner: goldfire Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: | LevityPolymorphism 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 simonpj): * keywords: => LevityPolymorphism -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12980#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12980: Unlifted class method rejected -------------------------------------+------------------------------------- Reporter: goldfire | Owner: goldfire Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: | LevityPolymorphism 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 oerjan): * cc: oerjan (added) Comment: Replying to [comment:1 simonpj]:
Certainly should be ok for multi-method classes. I'm not quite sure about the single-method case, because of the interaction with newtypes -- but I think there's a case for using data types in the single-method case too.
Alternatively, since fields cannot be levity-polymorphic (at least without extra indirection), you could restrict the newtype optimization to methods of kind `Type`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12980#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12980: Unlifted class method rejected -------------------------------------+------------------------------------- Reporter: goldfire | Owner: goldfire Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: | LevityPolymorphism 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 osa1): * cc: osa1 (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12980#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC