[Haskell-cafe] seems like I'm on the wrong track

Gregg Reynolds dev at mobileink.com
Wed Dec 2 06:23:37 EST 2009

On Tue, Dec 1, 2009 at 7:01 PM, Michael P Mossey <mpm at alumni.caltech.edu> wrote:
> Perhaps someone could either (1) help me do what I'm trying to do, or (2)
> show me a better way.
> In this one example, in a OO way of thinking, I have data called
> AssignedNumbers that assigns integers to unique strings and keeps track of
> the used integers and next available integer (the choice of available
> integer could follow a number of conventions so I wanted to hide that in an
> ADT.) So it has an associated function:

What do the numbers and strings mean?  Can you use an algebraic type
instead of strings?  Do particular numbers have meaning or are they
just serial numbers?  Can you compute some sort of checksum for the
strings rather than rely on an external list of numbers?  If you must
have a list of numbers, can you embed it in a specialized string type,
so that numbers get assigned as a side-effect of string construction?
In other words, would it help to think more in terms of specific types
rather than generic numbers and strings?


More information about the Haskell-Cafe mailing list