That pattern looks so familiar. :) Existential types seem to fit in to the type system really well so I never got why it is not part of the standard.

On Aug 12, 2012 10:36 AM, "Daniel Trstenjak" <daniel.trstenjak@gmail.com> wrote:

Hi Oleg,

On Sat, Aug 11, 2012 at 08:14:47AM -0000, oleg@okmij.org wrote:
> I'd like to point out that the only operation we can do on the first
> argument of MkFoo is to show to it. This is all we can ever do:
> we have no idea of its type but we know we can show it and get a
> String. Why not to apply show to start with (it won't be evaluated
> until required anyway)?

It's only a test case. The real thing is for a game and will be
something like:

class EntityT e where
   update      :: e -> e

   render      :: e -> IO ()

   handleEvent :: e -> Event -> e

   getBound    :: e -> Maybe Bound


data Entity = forall e. (EntityT e) => Entity e

data Level = Level {
   entities = [Entity],
   ...
   }


Greetings,
Daniel

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe