[Haskell-cafe] Re: iterative algorithms: how to do it in Haskell?
yumagene at gmail.com
Mon Aug 21 04:42:17 EDT 2006
Lennart and all,
On 8/19/06, Lennart Augustsson <lennart at augustsson.net> wrote:
> There are much better ways than storing strings on the stack.
> Like using a data type with constructors for the different types that
> you can store.
> -- Lennart
Off topic, but .... this is important info for me!
Okay then, by doing that you can define a new type that "encodes" the
other types.. such that you can actually end up storing the different
types such as Int, Integer,Real, String, etc into a list ..... using
this new type to so that even though you are in effect storing
differing types to a list.. they are actually of the same type and
thus legal... without doing an explicit bunch of "read"/"show"
combinations.. to actually convert.. .... like Num for example... and
being able to use +,* on any of the numeric types... but can you have
a list of type [Num] ?? I thought that it had to be the base types of
Int, Integer, Float, Double etc.. No?
More information about the Haskell-Cafe