[Haskell-cafe] Re: Designing an object model in Haskell (RESOLVED)
John Ky
newhoggy at gmail.com
Wed Dec 13 22:13:56 EST 2006
Hi all,
I'm now using existential types. I avoided learning about them because the
name sounded so highly technical and obscure it did not occur to me they
could be related to OO.
Thanks,
-John
On 12/7/06, John Ky <newhoggy at gmail.com> wrote:
>
> Hi,
>
> I've got an object model that I have a difficult time conceptualising how
> it might look like in Haskell:
>
> class Element { }
>
> class Inline : Element { }
>
> class ParentInline : Inline {
> List<Inline> children;
> }
>
> class Bold : ParentInline { }
> class Underline : ParentInline { }
>
> class Link : ParentInline {
> String link;
> }
>
> class Text : Inline {
> String text;
> }
>
> class Block : Element { }
>
> class Paragraph : Block {
> List<Inline> paragraph;
> }
>
> class Heading : Block {
> List<Inline> heading;
> }
>
> class Document : Element {
> List<Block> blocks;
> }
>
> How best to represent this OO data model in Haskell?
>
> Thanks
>
> -John
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20061214/4ded244b/attachment.htm
More information about the Haskell-Cafe
mailing list