Re: idiom for different implementations of same idea

2002-08-02 Thread Hal Daume III
Hi, In similar situations, especially if there is more than one useful way to use the various parts of an algorithm, I used often prefer existentials: data Model = forall markup table alignments. Model { prepareData :: Data () - Data markup, initialize :: Data

Re: idiom for different implementations of same idea

2002-08-02 Thread Dr. Harald Holtmann
Von: Hal Daume III Hi, In similar situations, especially if there is more than one useful way to use the various parts of an algorithm, I used often prefer existentials: data Model = forall markup table alignments. Model { prepareData :: Data () - Data markup,

idiom for different implementations of same idea

2002-08-01 Thread Hal Daume III
Hi all, I'm looking for some advice on what's the cleanest way to implement something. The basic idea is that I have a task to solve, T. There are many steps to solving this task, but they can be broken down into a small list of elementary steps: - prepareData - initialize - doThingOne

Re: idiom for different implementations of same idea

2002-08-01 Thread Dylan Thurston
On Thu, Aug 01, 2002 at 02:34:00PM -0700, Hal Daume III wrote: ... Now, I want in my executable my user to be able to say -model=0 and so on in the command line and for it to use the appropriate model. Each of these models will go in a separate module. One way to do this would be to

Re: idiom for different implementations of same idea

2002-08-01 Thread Hal Daume III
One way to do this would be to import all of the models qualified and then if they choose Model0, pass to the go function Model0.prepareData, Model0.initialize, etc. This is fine, simple, good. But it doesn't enforce at all the types of the functions. I don't understand what you mean

idiom for different implementations of same idea

2002-08-01 Thread Tom Pledger
Hal Daume III writes: | Hi all, | | I'm looking for some advice on what's the cleanest way to implement | something. : | where the main driver does something like: | | prepareData | initialize | iterate until converged | doThingOne | doThingTwo | getResults | |

Re: idiom for different implementations of same idea

2002-08-01 Thread Dr. Harald Holtmann
Hal Daume III writes: Hi all, I'm looking for some advice on what's the cleanest way to implement something. The basic idea is that I have a task to solve, T. There are many steps to solving this task, but they can be broken down into a small list of elementary steps: - prepareData