Type design question

Dylan Thurston dpt@math.harvard.edu
Mon, 28 Jul 2003 11:03:17 -0400

Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Jul 28, 2003 at 03:42:11PM +0200, Konrad Hinsen wrote:
> On Friday 25 July 2003 21:48, Dylan Thurston wrote:
> > Another approach is to make Universe a multi-parameter type class:
> >
> > class (RealFrac a, Floating a) =3D> Universe u a | u -> a where
> >   distanceVector :: u -> Vector a -> Vector a -> Vector a
> > ...
> >
> > You need to use ghc with '-fglasgow-exts' for this.
> What is the general attitude in the Haskell community towards
> compiler-specific extensions? My past experience with Fortran and
> C/C++ tells me to stay away from them. Portability is an important
> criterion for me.

I think it depends on the extension.  I find multi-parameter type
classes genuinely very useful, and the functional dependencies
notation (the '| u -> a' above) has been around for a while and seems
to be becoming standard.  Hugs, for instance, implements these same
extensions, and it seems very likely to me to be part of the next
Haskell standard.  On the other hand, some ghc extensions, like
generic Haskell, seem much more preliminary to me; if you want
portable code, I would stay away from them.

There was some discussion earlier about formalising some of these
extensions.  As far as I know, the FFI is the only one for which this
has been completed; but I think multi-parameter type classes would be
a natural next choice.


Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.2.2 (GNU/Linux)