[Haskell] Passing typeclasses as parameters?

Ville Tirronen aleator at gmail.com
Fri Mar 14 08:06:38 EDT 2008


Hi all.

I managed to paint myself in a corner where I did this:

> data ShowDynamic = forall a . (Show a) => SD Dynamic a
> toShowDyn a = SD (toDyn a) a
> fromShowDyn (SD d a) = fromDynamic d

> instance Show ShowDynamic where ...

Then I began to wonder if there was any hack to do:

> data AnyDynamic X = forall a . (X a) => AD Dynamic a

which could be kinda neat, but I saw no obvious way to do this.
Ideas?


- Ville (bound to be slain by curiosity)


More information about the Haskell mailing list