On Wed, 2007-02-07 at 11:49 -0500, Jacques Carette wrote: > skaller wrote:
[incremental vs. wholistic instance definition] > > You can't do this in Felix .. and it is *already > > annoying*. > This aspect of "already annoying" only gets worse when the hierarchy > gets bigger. The Haskell experience indicates that it is important to > get this right. [rant follows .. just thinking aloud..] This is a standard problem with any modular construction IMHO. The standard solution is structural typing, that is, setwise combination of elements. The problem with this solution is cost of analysis, particularly the incomprehensibility of error diagnostics. [And more, see next section] > > In Felix you actually have to instantiate > > Foo, Bar AND FooBar (well you should have to!!): > > > If Foo and Bar are disjoint, and FooBar is defined as their disjoint > union, then I disagree, you should not have to. This should be treated > as user-friendly syntactic sugar. Instances have to be definitive because typing is nominal. There is also a hidden reason why this *ought* to be the case, wrapped up in the idea of nominal types: semantics. typeclass A .. typeclass B .. typeclass AB1 { inherit A; inherit B; axiom a1; } typeclass AB2 { ... axiom a2; } Same sets of functions here .. but the type classes are quite distinct because they have distinct axioms. We do not want AB1 and AB2 to be automatically instantiated from A and B because whilst AB1 might obey the axioms, AB2 may not. I'm concerned the typeclass alias proposal is just too weak: if you're going to introduce typeclass combinators the ones to consider should probably be: + | * | -> as usual .. :) This is also a problem with ML modules IMHO. Felix once had ML style functors (dropped because I got it wrong). It also sported modular products (tuples, pairs of modules) so that, for example a bifunctor could be represented as a functor of a single tupled argument. -- John Skaller <skaller at users dot sf dot net> Felix, successor to C++: http://felix.sf.net ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language