|
#5913: Type class dictionary call loops at runtime
------------------------------+--------------------------------------------- Reporter: mnislaih | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.4.1 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Runtime crash | Testcase: Blockedby: | Blocking: Related: | ------------------------------+--------------------------------------------- The following code works fine in 7.0.3 but fails with <loop> in 7.2.x and 7.4.1 : {{{ {-# LANGUAGE UndecidableInstances #-} class L0 a where l0 :: a -> a class L0 a => L1 a where l1 :: a -> a class L1 a => L2 a where l2 :: a -> a data Worksfine = Worksfine deriving Show instance L0 Worksfine where l0 = id instance L1 Worksfine where l1 = l2 instance {- undecidable -} L1 Worksfine => L2 Worksfine where l2 = l0 data WorksfineToo = WorksfineToo deriving Show instance L0 WorksfineToo where l0 = id instance {- undecidable -} L2 WorksfineToo => L1 WorksfineToo where l1 = l2 instance {- undecidable -} L1 WorksfineToo => L2 WorksfineToo where l2 = id -- l1 LoopsAtRuntime = <loop> -- l2 LoopsAtRuntime = <loop> data LoopsAtRuntime = LoopsAtRuntime deriving Show instance L0 LoopsAtRuntime where l0 = id instance {- undecidable -} L2 LoopsAtRuntime => L1 LoopsAtRuntime where l1 = l2 instance {- undecidable -} L1 LoopsAtRuntime => L2 LoopsAtRuntime where l2 = l0 main = do print (l1 WorksfineToo) print (l2 WorksfineToo) print (l1 LoopsAtRuntime) print (l2 LoopsAtRuntime) }}} -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5913> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
#5913: Type class dictionary call loops at runtime
------------------------------+--------------------------------------------- Reporter: mnislaih | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.4.1 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Runtime crash | Testcase: Blockedby: | Blocking: Related: | ------------------------------+--------------------------------------------- Description changed by mnislaih: Old description: > The following code works fine in 7.0.3 but fails with <loop> in 7.2.x and > 7.4.1 : > {{{ > {-# LANGUAGE UndecidableInstances #-} > > class L0 a where l0 :: a -> a > class L0 a => L1 a where l1 :: a -> a > class L1 a => L2 a where l2 :: a -> a > > data Worksfine = Worksfine deriving Show > instance L0 Worksfine where l0 = id > instance L1 Worksfine where l1 = l2 > instance {- undecidable -} L1 Worksfine => L2 Worksfine where l2 = l0 > > data WorksfineToo = WorksfineToo deriving Show > instance L0 WorksfineToo where l0 = > id > instance {- undecidable -} L2 WorksfineToo => L1 WorksfineToo where l1 = > l2 > instance {- undecidable -} L1 WorksfineToo => L2 WorksfineToo where l2 = > id > > -- l1 LoopsAtRuntime = <loop> > -- l2 LoopsAtRuntime = <loop> > data LoopsAtRuntime = LoopsAtRuntime deriving Show > instance L0 LoopsAtRuntime where > l0 = id > instance {- undecidable -} L2 LoopsAtRuntime => L1 LoopsAtRuntime where > l1 = l2 > instance {- undecidable -} L1 LoopsAtRuntime => L2 LoopsAtRuntime where > l2 = l0 > > main = do > print (l1 WorksfineToo) > print (l2 WorksfineToo) > print (l1 LoopsAtRuntime) > print (l2 LoopsAtRuntime) > }}} New description: The following code works fine in 7.0.3 but crashes at runtime with <loop> in 7.2.x and 7.4.1 : {{{ {-# LANGUAGE UndecidableInstances #-} class L0 a where l0 :: a -> a class L0 a => L1 a where l1 :: a -> a class L1 a => L2 a where l2 :: a -> a data Worksfine = Worksfine deriving Show instance L0 Worksfine where l0 = id instance L1 Worksfine where l1 = l2 instance {- undecidable -} L1 Worksfine => L2 Worksfine where l2 = l0 data WorksfineToo = WorksfineToo deriving Show instance L0 WorksfineToo where l0 = id instance {- undecidable -} L2 WorksfineToo => L1 WorksfineToo where l1 = l2 instance {- undecidable -} L1 WorksfineToo => L2 WorksfineToo where l2 = id -- l1 LoopsAtRuntime = <loop> -- l2 LoopsAtRuntime = <loop> data LoopsAtRuntime = LoopsAtRuntime deriving Show instance L0 LoopsAtRuntime where l0 = id instance {- undecidable -} L2 LoopsAtRuntime => L1 LoopsAtRuntime where l1 = l2 instance {- undecidable -} L1 LoopsAtRuntime => L2 LoopsAtRuntime where l2 = l0 main = do print (l1 WorksfineToo) print (l2 WorksfineToo) print (l1 LoopsAtRuntime) print (l2 LoopsAtRuntime) }}} -- -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5913#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#5913: Type class dictionary call loops at runtime
------------------------------+--------------------------------------------- Reporter: mnislaih | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.4.1 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Runtime crash | Testcase: Blockedby: | Blocking: Related: | ------------------------------+--------------------------------------------- Changes (by baramoglo): * cc: emax@… (added) -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5913#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#5913: Type class dictionary call loops at runtime
---------------------------------+------------------------------------------ Reporter: mnislaih | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.4.1 Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Runtime crash Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Changes (by simonpj): * difficulty: => Unknown Comment: I think this is another example of #5751. I know how to fix it but am hoping to wait until after the Haskell Symposium deadline (2 June). -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5913#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#5913: Type class dictionary call loops at runtime
---------------------------------+------------------------------------------ Reporter: mnislaih | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.6.1 Component: Compiler | Version: 7.4.1 Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Runtime crash Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Changes (by pcapriotti): * milestone: => 7.6.1 -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5913#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#5913: Type class dictionary call loops at runtime
-----------------------------------------+---------------------------------- Reporter: mnislaih | Owner: Type: bug | Status: closed Priority: normal | Milestone: 7.6.2 Component: Compiler | Version: 7.4.1 Resolution: fixed | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Runtime crash | Difficulty: Unknown Testcase: typecheck/should_run/T5913 | Blockedby: Blocking: | Related: -----------------------------------------+---------------------------------- Changes (by simonpj): * status: new => closed * testcase: => typecheck/should_run/T5913 * resolution: => fixed Comment: Fixed by the silent-superclass patch. {{{ commit aa1e0976055e89ee20cb4c393ee05a33d670bc5d Author: Simon Peyton Jones <[hidden email]> Date: Sun May 27 22:31:43 2012 +0100 Add silent superclass parameters (again) Silent superclass parameters solve the problem that the superclasses of a dicionary construction can easily turn out to be (wrongly) bottom. The problem and solution are described in Note [Silent superclass arguments] in TcInstDcls }}} -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5913#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
| Powered by Nabble | Edit this page |
