literal default value for an unknown type

Dylan Thurston dpt@math.harvard.edu
Wed, 9 Jul 2003 01:25:21 -0400


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

On Tue, Jul 08, 2003 at 10:19:49PM -0400, Derek Elkins wrote:
> On Tue, 8 Jul 2003 23:16:33 -0300
> "Andre W B Furtado" <andrefurtado@ieg.com.br> wrote:
>=20
> > Is it possible replace the question mark in the following code in
> > order to make defaultMyType return a "don't care" value for b?
> >=20
> > data MyType t =3D MyType { a :: Int, b :: t}
> >=20
> > defaultMyType :: MyType
> > defaultMyType =3D MyType {a =3D 0, b =3D ?}
> >=20
>=20
> First you do need the type parameter (:: MyType t).

Maybe what's wanted is this?

defaultMyType :: MyType a
defaultMyTpe =3D MyType {a =3D 0, b =3D undefined}

Peace,
	Dylan

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/C6dBVeybfhaa3tcRAqzPAJ92OoTTNoGhdShbMjmK3UdISAZipgCgmumK
QWHXSYU7MWdp398SlJa6Sx8=
=gLoG
-----END PGP SIGNATURE-----

--k1lZvvs/B4yU6o8G--