[Haskell-beginners] Beginners Digest, Vol 30, Issue 17

Russ Abbott russ.abbott at gmail.com
Mon Dec 13 00:09:44 CET 2010


Is there no way to make the class approach (or something like it) work?
 That's how I would do it in Java--define the component as an interface as
far as the structure is concerned and then define the component itself to
implement the interface.
*
-- Russ*


On Sun, Dec 12, 2010 at 3:00 AM, <beginners-request at haskell.org> wrote:

> Send Beginners mailing list submissions to
>        beginners at haskell.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://www.haskell.org/mailman/listinfo/beginners
> or, via email, send a message with subject or body 'help' to
>        beginners-request at haskell.org
>
> You can reach the person managing the list at
>        beginners-owner at haskell.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Beginners digest..."
>
>
> Today's Topics:
>
>   1. Re:  Linking modules (Brent Yorgey)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sat, 11 Dec 2010 15:37:23 -0500
> From: Brent Yorgey <byorgey at seas.upenn.edu>
> Subject: Re: [Haskell-beginners] Linking modules
> To: beginners at haskell.org
> Message-ID: <20101211203723.GB9265 at seas.upenn.edu>
> Content-Type: text/plain; charset=iso-8859-1
>
> On Sat, Dec 11, 2010 at 08:56:23PM +0100, Chadda? Fouch? wrote:
> > On Sat, Dec 11, 2010 at 7:37 PM, Russ Abbott <russ.abbott at gmail.com>
> wrote:
> > > I have two modules Structure and Component. ?Module Structure defines
> > > ?? ? data Structure = Component ...
> > > Module Component defines
> > > ?? ?data Component = ...
> > > I would like Structure to import Component. ?But Component
> > > includes?functions?that take a Structure as an argument. So I have (or
> would
> > > like) something like this organization.
> > >
> > > [snip]
> > >
> > > The functions in Component are really very Component related and should
> not
> > > be moved to Structure. So how can I set up this circular relationship?
> >
> > GHC allows you to compile mutually recursive modules, see
> >
> http://www.haskell.org/ghc/docs/latest/html/users_guide/separate-compilation.html#mutual-recursion
> > for how to do it.
>
> Yes, this is possible, but it has always seemed sort of fragile and
> ugly to me.  Another suggestion is to put the definitions of the
> Structure and Component data types into a separate module called
> Types, and then import Types into both the Structure module (which
> defines functions over Structures) and the Component module (which
> defines functions over Components).  Then no circularity is needed.
>
> -Brent
>
>
>
> ------------------------------
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>
> End of Beginners Digest, Vol 30, Issue 17
> *****************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20101212/dc260cfc/attachment.htm>


More information about the Beginners mailing list