[Haskell-cafe] Applying a Dynamic function to a container of Dynamics

Alfonso Acosta alfonso.acosta at gmail.com
Fri Dec 21 06:24:52 EST 2007


Hi all,

dynApp allows to apply a Dynamic function to a Dynamic argument:

dynApp :: Dynamic -> Dynamic -> Dynamic

I don't seem to find a way (without modifying Data.Dynamic itself) to
code this function

import Data.Typeable
import Data.Dynamic
import Data.Foldable

dynApp1 :: (Typeable1 container, Foldable container) => Dynamic ->
container Dynamic -> Dynamic
dynApp1
               f    -- originally of type :: container a -> b
              val --- all its values _must_ have type :: b
-- I get stuck when trying to transform val to type Dynamic (transform
:: container Dynamic -> Dynamic)  in order to apply f

nor even the more concrete case of lists

dynAppList ::  Dynamic -> [Dynamic] -> Dynamic


Any suggestions?

Thanks,

Fons


More information about the Haskell-Cafe mailing list