[Haskell-cafe] Types in bounds

Johannes Waldmann waldmann at imn.htwk-leipzig.de
Mon Sep 1 05:47:41 EDT 2008


> Lets imagine I want a type for a point like:
> type Point = (Int, Int)
> But what, if I can predict that the X and Y values are in a range between 0 and 100?

1. this only works with "dependent types", which Haskell does not have -
by design (type inference/checking would be undecidable).
It works in Coq, PVS etc. but there the programmer has to help
the type checker (i.e. attach a proof that the type is correct)

2. using "type" (instead of "data") is generally a bad idea.

J.W.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 257 bytes
Desc: OpenPGP digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20080901/7d452515/signature.bin


More information about the Haskell-Cafe mailing list