[prev in list] [next in list] [prev in thread] [next in thread]
List: haskell-cafe
Subject: Re: [Haskell-cafe] Top Level etc.
From: Keean Schupke <k.schupke () imperial ! ac ! uk>
Date: 2005-01-19 13:31:48
Message-ID: 41EE6144.6090308 () imperial ! ac ! uk
[Download RAW message or body]
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
>
>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic