[jhc] Classes

John Meacham john at repetae.net
Mon Mar 10 16:03:37 EDT 2008


On Mon, Mar 10, 2008 at 01:50:09PM -0400, Samuel Bronson wrote:
> On 3/10/08, John Meacham <john at repetae.net> wrote:
> > instance Foo Char where
> >        foo c = ord c
> >
> > produces the following core
> >
> > Instance at .Main.Foo.foo.Prelude.Char :: Char -> Int
> > Instance at .Main.Foo.foo.Prelude.Char c = ord c
> >
> > {-# RULES "foo/char/instance"  Main.foo Char = Instance at .Main.Foo.foo.Prelude.Char #-}
> 
> Hmm. What should I name default implementations?

Those are named 'Instance at .Main.Foo.foo.default' and have the type
'forall a . a -> Int' . A default method
always exists, even if it is just an error saying no default method was
supplied. RULES are generated for the default methods as well in the
same fashion.

        John

-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the jhc mailing list