> Von: Hal Daume III > Hi, > > > In similar situations, especially if there is more than one > useful way to > > use the various parts of an algorithm, I used often prefer existentials: > > > > data Model = forall markup table alignments. Model > > { > > prepareData :: Data () -> Data markup, > > initialize :: Data markup -> ST s table, > > doThingOne :: Data markup -> table -> ST s alignments, > > doThingTwo :: Data markup -> alignments -> ST s table, > > getResults :: Data markup -> table -> alignments -> String > > } > > I like this a lot! The only problem is I don't think GHC does. It > complains: > > /nfs/isd/hdaume/projects/MESumm/new/Model.hs:13: > Can't combine named fields with locally-quantified type variables > In the declaration of data constructor Model > In the data type declaration for `Model' > > .... Yuck, now I remember this nasty problem, each time I stumble over it again... The solution is easy, but not very nice:
data Model = forall markup table alignments. Model (Data () -> Data markup) {- prepare -} (Data markup -> ST s table) {- init -} (Data markup -> table -> ST s alignments) {- ThingOne -} (Data markup -> alignments -> ST s table) {- ThingTwo -} (Data markup -> table -> alignments -> String) {- result -} I think the reason to go through such loops is that function like 'prepareData' are not typeable in the current type system. Perhaps one of the experts can tell us more? Regards, Harald _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell