On 12/13/06, Alfonso Acosta <[EMAIL PROTECTED]> wrote:
-- hd and id are (void *) in C and modelled as type parameters in Haskell data Descriptor id hd = Descriptor {uniqueID :: LadspaIndex, label :: String, properties :: LadspaProperties, name, maker, copyright :: String, portCount :: LadspaIndex, portDescriptors :: [PortDescriptor], portNames :: [String], portRangeHints :: [PortRangeHint], implementationData :: id, instantiate :: Descriptor id hd -> LadspaIndex -> Maybe hd,
Oh, LADSPA. Suddenly everything make so much more sense. First, the implementationData is useless to you. Put it in a closure when building this object: ladspa_descriptor = do ... let implementationData = ... return Descriptor { ... referencing implementationData ... } No need to export that to the user only to have them pass it back in. Second, you don't want the consumer to pick the hd type. If you're willing to accept extensions (I think you are), make it existential: data Descriptor = forall hd. Descriptor { ... } This will ensure that you can't pass the handles from one plugin to the methods of another. -- Taral <[EMAIL PROTECTED]> "You can't prove anything." -- Gödel's Incompetence Theorem _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe