On Sun, 2007-07-08 at 13:11 -0400, Sandro Magi wrote:
> I'm just looking into Felix, and noticed that it supports type classes
> and modules. Are the modules like ML modules? If so, I was wondering
> whether you were aware of the paper "Modular Type Classes", where type
> classes are derived as a restricted use of ML modules:
>
> http://www.cse.unsw.edu.au/~chak/papers/DHC07.html
Yes, i've read it. Felix has modules, but at present no
modular functors. Modules are basically just namespaces
at present. Also, there are no separate interfaces:
there are private symbols which aren't accessible to the
public, but you can't abstract a function in a module
by constraining it to a more abstract signature, as
you can in Ocaml or ML.
Actually I'm looking to unify modules, typeclasses and
OO classes into a single construction -- C++ pretty much
has that already. Felix 3 kinds have stronger semantics,
but the distinction is unpleasant.
> Might help simplify the compiler. Also, the reference manual does not
> describe the module or type class language; is there are any reference
> on those I can browse?
Nope, haven't got around to writing it yet. Look in
library directory:
lib/flx_tclass.flxh // typeclasses
lib/flx_ctypes.flxh // instances for C data types
* Typeclasses support multiple type arguments.
* Typeclasses can have virtual (specialisable) functions
and procedures
* Default definitions are allowed.
* non virtual private helpers are allowed for the defaults
* public non-virtuals are allowed (available in all instances)
* axioms, reductions, and lemmas are allowed, to specify
semantics. reductions are axioms of the form a => b which
tell the compiler to rewrite terms matching a to b.
Lemmas are propositions which can be proven by a theorem
prover without help. Felix generates a *.why file, which
can be fed to Ergo, or some other prover via Why.
This work is unfinished.
* you can open a typeclass:
open Eq[int];
or pass to a function:
fun f[t where Eq[t]] (x:t, y:t)=> x == y;
// fun eq(x,y) written x == y, available
// from typeclass Eq
which is just the same as opening it in the function,
except it looks nice (part of the interface).
Haskell would write this
f: Eq t => t -> t -> bool
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language