[GHC] #13859: Bad error message when compacting a Compact#

#13859: Bad error message when compacting a Compact# -------------------------------------+------------------------------------- Reporter: andrewthad | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 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: -------------------------------------+------------------------------------- When I run this: {{{ main :: IO () main = do cpt@(Compact cpt# _ _) <- compact (55 :: Int) _ <- compactAdd cpt (MyCompact cpt#) return () data MyCompact = MyCompact Compact# }}} I get this error message: {{{ compaction failed: cannot compact mutable objects }}} This error message is misleading. I don't really know if it makes sense to allow a `Compact#` to be stored in a compact region, but if someone tries to do it, I would rather the error say: {{{ cannot compact Compact# values }}} Or something like that. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13859 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13859: Bad error message when compacting a Compact# -------------------------------------+------------------------------------- Reporter: andrewthad | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 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 bgamari): There are a whole lot of cases to which this objection applies; see `Compact.cmm` around line 120. Perhaps we should just replace the word "mutable" in the error message with the closure type name? It's perhaps a bit more cryptic but less misleading, in general I think it would be nice if we could just make the type checking a bit more precise, turning most of these errors into more comprehensible compile-time errors. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13859#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13859: Bad error message when compacting a Compact# -------------------------------------+------------------------------------- Reporter: andrewthad | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 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 andrewthad): Providing the closure type name would help me out a lot. I'm actually now in another situation where I'm getting the "cannot compact mutable objects" message, and it's difficult to track down what it actually is that's causing the problem. Granted, this is only happening because I'm trying to do things that you aren't really supposed to do with compact heap. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13859#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13859: Bad error message when compacting a Compact# -------------------------------------+------------------------------------- Reporter: andrewthad | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 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 ezyang): I guess we should actually implement the "Compactable" type class, that will solve this problem once and for all. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13859#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13859: Bad error message when compacting a Compact# -------------------------------------+------------------------------------- Reporter: andrewthad | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 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 andrewthad): The `Compactable` class would be nice for most users, and provided that the instances are generated by GHC (like Typeable and Coercible). Also in my situation, it would still be nice to get a better runtime error since I'm doing dangerous stuff by thawing arrays on the compact heap. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13859#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC