[mercury-users] importing submodules

Ralph Becket rafe at cs.mu.OZ.AU
Mon Dec 2 12:36:36 AEDT 2002


Michael Day, Monday,  2 December 2002:
> 
> So this is basically the importer of back_end telling back_end which
> module *it* should import?

Pretty much, although you're not restricted to a single level of
parameterisation.

> Is there any advantage over using a back_end(T) type where T must be an
> instance of a particular type class? It seems that the module argument
> approach would only be superior when there was no module-specific state to
> be passed around, which would rarely be the case.

One advantage is that you don't need to put type class constraints all
over your code.

The ML family of languages has been very slow to adopt type classes
largely because their module system gives them much of the power of
type classes with none of the pain.  Sometimes (the ML people would
claim "many times") it's the best way to solve a particular problem.

- Ralph
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list