OK, I'll try to get to the SYB3 paper at some point. For now I'll just
add to my knowledge that UndecidableInstances allows you to create
non-terminating dictionaries in addition to the well-known risk of
making the type checker loop.
Thanks!
/ Emil
Simon Peyton-Jones skrev:
It's a
On Fri, Jan 22, 2010 at 12:24:37PM +0100, Emil Axelsson wrote:
Consider the following program:
{-# LANGUAGE FlexibleInstances, OverlappingInstances, UndecidableInstances
#-}
class B a = A a
instance A Int
class Eq a = B a
instance (A a, Eq a) = B a
[...]
Although I don't know all
Ross Paterson r...@soi.city.ac.uk writes:
I'm afraid you voided the warranty when you used UndecidableInstances.
I like this term of phrase. Maybe it should be used in the actual
documentation? ;-)
--
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
Ross Paterson skrev:
On Fri, Jan 22, 2010 at 12:24:37PM +0100, Emil Axelsson wrote:
Consider the following program:
{-# LANGUAGE FlexibleInstances, OverlappingInstances, UndecidableInstances #-}
class B a = A a
instance A Int
class Eq a = B a
instance (A a, Eq a) = B a
[...]
Although I
It's a feature!
You have
* B is a superclass of A
* Eq is a superclass of B
So every A dictionary has a B dictionary inside it, and every B dictionary has
an Eq dictionary inside it.
Now, your instance declaration
instance (A a, Eq a) = B a
says if you give me an A dictionary and
Here's the relevant core for this file (GHC 6.10.4, so I'm a bit out of date):
Rec {
$dB_rh6 :: Undec.B GHC.Types.Int
[GlobalId]
[]
$dB_rh6 = $dB_rh6
end Rec }
Undec.test :: GHC.Bool.Bool
[GlobalId]
[]
Undec.test =
GHC.Classes.==
@ GHC.Types.Int
($dB_rh6
`cast` ((Undec.:Co:TB)