[Haskell-cafe] Functional dependencies and incoherent instances

Emil Axelsson emax at chalmers.se
Wed Oct 8 13:16:25 EDT 2008


I think the technique described at

   http://haskell.org/haskellwiki/GHC/AdvancedOverlap

may give you what you want. I've never tried it myself though.

/ Emil



Tobias Bexelius skrev:
> Yeah, I realized that.
> 
> But heres where I would like the undecidable incoherent instances to kick in, i.e. as long as I haven't got any NumVec instances GHC should be able to choose only one of the Mult instances. Or do I have too much faith in the -fallow-incoherent-instances flag now? :/
> 
> I would like to be able to write something like
>> instance (Vec a x, -Num (a x)) => Mult (a x) (a x) x where (*.) = dot
> where -Num (a x) means that (a x) must not be an instance of Num. Can I express this in some way?
> 
> Regards
> Tobias



More information about the Haskell-Cafe mailing list