First, thanks to those who responded to my request RE vectors.
I looked at the stuff suggested, very instructional. I realized
however that all I really wanted was to instanciate Num a => Num [a],
so I just did it, in only a few lines. I dont know why I just didnt
do it :)
Second, I have to ask again about Existential types. These beasties I
just cant figure out. Why are they usefull??? Do you really need them?
Every single example I have seen so far I could do it just as clearly
without , but I have only seen simple examples. Here is one so
you know what I am talking about: (From Laufer (1995)):
> class State a where
> value :: a-> Int
> data STREAM = (State a) => Stream a (a -> a)
Ok, so fine, but cant I instead of the above
define a STREAM as (for example)
> type STREAM = (STREAM, Int)
> makeSTREAM :: (State a) => a -> (a->a) -> STREAM
> makeSTREAM start next = (makeSTREAM (next start) next, value start)
I guess what I am trying to say is that since the existentially
quantified type must be hidden, why not just hide it at teh start?
Can I allways do it? Is this somehow related to deMorgans law
or something? Or is there a truly convincing example out there?
+++++++++++++++++++++++++++++++++++++++++++++++++
Ron Legere -- http://www.its.caltech.edu/~legere
Caltech Quantum Optics
MC 12-33
Pasadena CA 91125
626-395-8343
FAX: 626-793-9506
+++++++++++++++++++++++++++++++++++++++++++++++++