On Wed, Jul 11, 2007 at 05:45:40PM +0000, Claude Heiland-Allen wrote:
> Hi people,
>
> I'm embedding Haskell into a C program with a "stateful objects with 
> message passing" paradigm [0].  I want to make "boxes" with useful 
> functions, then connect them together within the C program.  I know how to 
> build a working version using Data.Dynamic, but that loses polymorphism 
> [1].
>
> Say I have 3 boxes:
>
> Box 1:  [1,2,5,3]        :: [Float]
> Box 2:  reverse          :: [a] -> [a]
> Box 3:  putStrLn . show  :: (Show b) => b -> IO ()
>
> I wonder, is it possible to create these boxes separately at runtime (each 
> box being compiled/loaded separately with hsplugins), then connect them 
> together like {Box 1}=>{Box 2}=>{Box 3} (with a wrapping layer doing 
> appropriate type checking/error reporting), or does the whole thing need to 
> be compiled statically to generate specialized variants of the polymorphic 
> functions?  As hinted in #haskell :
>
> <quicksilver> ClaudiusMaximus: I don't think anything will allow you to 
> pass around polymorphic values. They're an illusion of the type-checker, in 
> a sense.

There is nothing intrinsically impossible with a Data.Dynamic like
interface for polytypic values.  Good luck writing toDyn and fromDyn
without compiler support, however.

Stefan

Attachment: signature.asc
Description: Digital signature

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

Reply via email to