From: Alain Frisch <alain@frisch.fr>
To: Dario Teixeira <darioteixeira@yahoo.com>
Cc: Francisco Jos? Valverde Albacete <fva@tsc.uc3m.es>,
caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Smells like duck-typing
Date: Wed, 17 Oct 2007 22:20:04 +0200 [thread overview]
Message-ID: <47166E74.40306@frisch.fr> (raw)
In-Reply-To: <706529.26231.qm@web54607.mail.re2.yahoo.com>
Dario Teixeira wrote:
>> To me your problems looks like a good candidate for XML-modelling and
>> reusing all the tools for working in XML. The more so because XML was
>> made... exactly for that! Why don't you give it at least a somewhat
>> serious thought?
>
> Hi,
>
> You mean like CDuce and/or OCamlduce?
I'm not particularly encouraging the use of OCamlduce here, but FWIW, a
solution would look like:
type title = {{ { title=Latin1 ..} }}
type intro = {{ { intro=Latin1 ..} }}
type blurb_t = {{ { id=Int .. } ++ title ++ intro }}
type fresh_t = {{ { body=Latin1 .. } ++ title ++ intro }}
type full_t = {{ blurb_t & fresh_t }} (* intersection type *)
let print_metadata s =
Printf.printf "%d: %s\n" {:s.id:} {:s.title:}
If you're ok duplicating fields, the type definitions can be simplified:
type blurb_t = {{ {id=Int title=Latin1 intro=Latin1 ..} }}
type fresh_t = {{ {body=Latin1 title=Latin1 intro=Latin1 ..} }}
type full_t = {{ {id=Int body=Latin1 title=Latin1 intro=Latin1 ..} }}
-- Alain
next prev parent reply other threads:[~2007-10-17 20:22 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <47161E3B.3060704@tsc.uc3m.es>
2007-10-17 15:01 ` Dario Teixeira
2007-10-17 20:20 ` Alain Frisch [this message]
2007-10-17 13:35 Dario Teixeira
2007-10-17 14:13 ` [Caml-list] " Arnaud Spiwack
2007-10-17 14:47 ` Dario Teixeira
2007-10-17 14:25 ` Daniel Bünzli
2007-10-17 15:03 ` skaller
2007-10-17 15:13 ` Dario Teixeira
2007-10-17 15:25 ` Arnaud Spiwack
2007-10-17 15:32 ` Daniel Bünzli
2007-10-17 16:21 ` Chris King
2007-10-18 7:28 ` Stefano Zacchiroli
2007-10-17 16:57 ` skaller
2007-10-17 16:52 ` skaller
2007-10-17 16:59 ` Robert Fischer
2007-10-17 14:33 ` Chris King
2007-10-17 14:59 ` Dario Teixeira
2007-10-17 15:24 ` Vincent Aravantinos
2007-10-17 19:59 ` Richard Jones
2007-10-17 20:24 ` Dario Teixeira
2007-10-18 7:37 ` Stefano Zacchiroli
2007-10-18 10:31 ` Dario Teixeira
2007-10-18 10:37 ` Stefano Zacchiroli
2007-10-18 13:28 ` Robert Fischer
2007-10-18 14:10 ` Dario Teixeira
2007-10-18 14:18 ` Brian Hurt
2007-10-18 14:29 ` Arnaud Spiwack
2007-10-18 14:45 ` Brian Hurt
2007-10-18 15:02 ` Arnaud Spiwack
2007-10-18 15:07 ` Robert Fischer
2007-10-18 15:14 ` Arnaud Spiwack
2007-10-18 16:39 ` skaller
2007-10-18 16:49 ` Arnaud Spiwack
2007-10-18 17:47 ` skaller
2007-10-18 19:55 ` Robert Fischer
2007-10-18 16:22 ` skaller
2007-10-18 16:30 ` Dario Teixeira
2007-10-18 14:58 ` Robert Fischer
2007-10-18 15:11 ` William D. Neumann
2007-10-18 15:47 ` Loup Vaillant
2007-10-18 16:08 ` William D. Neumann
2007-10-19 13:08 ` Ed Keith
2007-10-18 16:24 ` Dario Teixeira
2007-10-18 16:35 ` Vincent Aravantinos
2007-10-18 16:43 ` Brian Hurt
2007-10-18 17:04 ` William D. Neumann
2007-10-18 17:05 ` Dario Teixeira
2007-10-18 17:22 ` Brian Hurt
2007-10-18 17:58 ` Dario Teixeira
2007-10-18 15:42 ` Vincent Aravantinos
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47166E74.40306@frisch.fr \
--to=alain@frisch.fr \
--cc=caml-list@yquem.inria.fr \
--cc=darioteixeira@yahoo.com \
--cc=fva@tsc.uc3m.es \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox