* Please a simple Camlp5 example
@ 2008-02-28 15:47 Fabrice Marchant
2008-02-28 17:15 ` [Caml-list] " Richard Jones
0 siblings, 1 reply; 2+ messages in thread
From: Fabrice Marchant @ 2008-02-28 15:47 UTC (permalink / raw)
To: caml-list
Hi !
Aware that this belongs to beginners-list, I first posted there
three weeks ago, but without any answer :
I bet this kind of code should be rather common :
let string_of_piece_type = function
King -> "King"
| Queen -> "Queen"
| Rook -> "Rook"
| Bishop -> "Bishop"
| Knight -> "Knight"
| Pawn -> "Pawn"
Please have you got an example where the macro helps to implement such kind of "string_of_type" function ?
Thanks,
Fabrice
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Caml-list] Please a simple Camlp5 example
2008-02-28 15:47 Please a simple Camlp5 example Fabrice Marchant
@ 2008-02-28 17:15 ` Richard Jones
0 siblings, 0 replies; 2+ messages in thread
From: Richard Jones @ 2008-02-28 17:15 UTC (permalink / raw)
To: Fabrice Marchant; +Cc: caml-list
On Thu, Feb 28, 2008 at 04:47:37PM +0100, Fabrice Marchant wrote:
>
> Hi !
>
> Aware that this belongs to beginners-list, I first posted there
> three weeks ago, but without any answer :
>
> I bet this kind of code should be rather common :
>
> let string_of_piece_type = function
> King -> "King"
> | Queen -> "Queen"
> | Rook -> "Rook"
> | Bishop -> "Bishop"
> | Knight -> "Knight"
> | Pawn -> "Pawn"
>
> Please have you got an example where the macro helps to implement such kind of "string_of_type" function ?
You probably want to look at deriving (http://code.google.com/p/deriving/)
or tywith (http://www.seedwiki.com/wiki/shifting_focus/tywith) which
can generate these functions automatically.
Rich.
--
Richard Jones
Red Hat
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-02-28 17:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-28 15:47 Please a simple Camlp5 example Fabrice Marchant
2008-02-28 17:15 ` [Caml-list] " Richard Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox