Survival of generic-classes in ghc

Dylan Thurston dpt@math.harvard.edu
Wed, 20 Feb 2002 21:35:05 -0500


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

On Wed, Feb 20, 2002 at 01:15:36PM -0800, Simon Peyton-Jones wrote:
> Another possiblity would be to make the ConCls class look like this
> 	class ConCls c where
>  	  name :: String
> 	  arity :: Int=20
> 	  ...etc...
>=20
> Now we'd have to give an explicit type argument at the call site:
>=20
>       show {| Constr c t |} (Con x) =3D (name {| c |}) ++ show x
>=20
> I quite like the thought of being able to supply explicit type
> arguments....
> but I don't konw how to speak about the order of type parameters.
> What order does map takes its two type parameters in?

Sorry, this seems like a non-sequitur to me?

'map' has type '(a->b) -> [a] -> [b]'; supplying explicit type
parameters would mean giving values to 'a' and 'b'.  If I wanted to
propose notation for this, I would suggest, e.g.,
  (map :: (String -> Int) -> [String] -> [Int]) length ["Hello", "World"]

'name' (above) has type 'String'; the '{| c |}' is not providing a type
parameter in the same sense.

What am I missing?

Best,
	Dylan

--eRtJSFbw+EEWtPj3
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8dFzZVeybfhaa3tcRAvGUAJ4pk/quXp+gMJaSxK8LLmdszIk4SQCcC3Ks
yJeap3R0NXrMAf71jhA4KoE=
=ee6g
-----END PGP SIGNATURE-----

--eRtJSFbw+EEWtPj3--