Commit c7749685 authored by simonpj's avatar simonpj
Browse files

Comments only

parent 3888ddc0
......@@ -5,13 +5,30 @@
-- GHC's typechecker loops when trying to type this, resulting in a
-- context stack overflow.
{- Maybe this should typecheck:
Given: Foo x y, Bar y z
Wanted: Foo x beta, Bar beta z
If we happened to process (Foo x beta) first we
might generate the extra equality beta~y, and we are good
If we process (Bar beta z) first, we end up in an infinite
loop, using the (Bar x z) instance repeatedly.
If instead we'd had
class (F x ~ y) => Foo x y where
type F x
foo :: x -> y
module ShouldCompile where
class Foo x y | x -> y where
foo :: x -> y
class Bar x y where
bar :: x -> y -> Int
class Bar x z where
bar :: x -> z -> Int
instance (Foo x y, Bar y z) => Bar x z where
bar x z = bar (foo x) z
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment