[Haskell-beginners] FlexibleInstances

Brent Yorgey byorgey at seas.upenn.edu
Mon Nov 25 10:43:20 UTC 2013


On Sun, Nov 24, 2013 at 10:02:21PM +0000, AntC wrote:
> > Emanuel Koczwara <poczta <at> emanuelkoczwara.pl> writes:
> 
> He Emanuel, you're doing well. 
> Hardly anyone these days sticks to Haskell 98;
> and really there's no need to.
> (What you're trying to do can be achieved with H98,
>  but would need some not-so-user-friendly coding.)
> 
> > 
> >   I want to enable "instance [Char] where..." but disable "instance [a] 
> where...". Is it possible?
> > 
> 
> Yes, you're almost there.
> You do need FlexibleInstances to be able to put [Char].
> 
> To ban [a], you need to ban overlapping instances.
> {-# LANGUAGE NoOverlappingInstances #-}
> 
> (Usually overlapping instances is on by default.)

No, it's not.

-Brent


More information about the Beginners mailing list