Re: [Haskell-cafe] Re: Designing an object model in Haskell (RESOLVED)

2006-12-14 Thread Bulat Ziganshin
Hello John,

Thursday, December 14, 2006, 6:13:56 AM, you wrote:

 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.

look at http://haskell.org/haskellwiki/OOP_vs_type_classes


-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

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


[Haskell-cafe] Re: Designing an object model in Haskell (RESOLVED)

2006-12-13 Thread John Ky

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 [EMAIL PROTECTED] 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 {
   ListInline children;
}

class Bold : ParentInline { }
class Underline : ParentInline { }

class Link : ParentInline {
   String link;
}

class Text : Inline {
   String text;
}

class Block : Element { }

class Paragraph : Block {
   ListInline paragraph;
}

class Heading : Block {
   ListInline heading;
}

class Document : Element {
   ListBlock blocks;
}

How best to represent this OO data model in Haskell?

Thanks

-John


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