dependent type query
Hal Daume III
hdaume@ISI.EDU
Fri, 18 Jan 2002 12:01:39 -0800 (PST)
Suppose I have the following definition:
class MyClass f a | a -> f, f -> a where ...
I want to write a data type:
data (MyClass f a) => MyData f = MyData (f, a)
But this doesn't seem to be valid because "a" isn't in scope. But a is
uniquely determined by f. What gives?
Furthermore, I can't even write:
data (MyClass f a) => MyData2 f = MyData2 f
This makes no sense to me whatsoever. This problem can the thwarted by
moving the contraint to only the function definitions, but for MyData
itself, it's really a hassle.
Please could someone explain what's going on?
--
Hal Daume III
"Computer science is no more about computers | hdaume@isi.edu
than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume