I was thinking more along type classes….and then I was going to throw some spanners in the works….

 


From: Ryan Ingram [mailto:ryani.spam@gmail.com]
Sent: 02 January 2008 17:41
To: Nicholls, Mark
Cc: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] Is there anyone out there who can translate C# generics into Haskell?

 

Of course it depends what's inside the braces, and what you want to do with it, but I'd be inclined to do something like this:

 

1) data IX a = IX { constructor :: Int -> a, ... }

2) data IX a b = IX { constructor :: Int -> b, func :: a -> b, ... }

3) data IX a b = IX { iy :: IY a, ... }

4) data IX a b = IX { iz :: IZ b, iy :: IY a, ... }

 

Can you specify more clearly what the goal of the conversion is?  If you want "OO" style behavior the thing that is most important is existential quantification.

 

  -- ryan

 

On 1/2/08, Nicholls, Mark <Nicholls.Mark@mtvne.com> wrote:

I'm trying to translate some standard C# constucts into Haskell... some
of this seems easy....

Specifically

1)

Interface IX
{
}

2)

Interface IX<A>
{
}

3)

Interface IX<A>
       Where A : IY
{
}

4)

Interface IX<A> : IZ
       Where A : IY
{
}


I can take a punt at the first 2....but then it all falls apart
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe