
19 Jan
2005
19 Jan
'05
8:31 a.m.
I may have got this wrong, but I think you can do named instances without any extensions, by using datatypes and fundeps: data Instance0 data Instance1 instance0 :: Instance0 instance0 = undefined instance1 :: Instance1 instance1 = undefined class Named a b | a -> b test :: a -> b -> b instance Named Instance0 Int test _ a = a + a instance Named Instance1 Float test _ a = a * a test instance0 1 test instance1 1.5 Keean. Benjamin Franksen wrote:
You will probably find this paper interesting: Wolfram Kahl and Jan Scheffczyk: "Named Instances for Haskell Type Classes", http://www.informatik.uni-bonn.de/~ralf/hw2001/4.pdf