>>>>> "Pedro" == Pedro Baltazar Vasconcelos <[EMAIL PROTECTED]> writes:

Pedro> On Wed, 17 Jan 2007 16:57:54 +0300
Pedro> Max Vasin <[EMAIL PROTECTED]> wrote:

> It does not enforce presence of required fields at type level. Also it
>> does not enforce that fields pages and year are Int. And I want
>> to move as much checks to compile time as possible.

Pedro> You can combine the two solutions: a product-type of
Pedro> required fields plus list of optional fields. You're right
Pedro> that you lose the typing constraints on fields. I probabily
Pedro> woudn't bother, but you might be able to recover that with
Pedro> the type-classes or GADTs (?).

I have only a very basic understading of what GADTs are :-(

Pedro> But more important: it sounds to me like you have two
Pedro> conflicting requirements: one the one hand you want to have
Pedro> required fields (presumability those that were not Maybe
Pedro> types) but on the other hand you want an "empty" book
Pedro> (i.e. with "" for title, etc.).

I want to get as strict type checking as possible while writing as
little code handling Book as possible. The empty value is needed only
to start with when analising external represenation. And as suggested
by Colin DeVilbiss and Henning Thielemann it will be better to use
undefined for required fields.

-- 
WBR,
Max Vasin.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to