
20 Mar
2006
20 Mar
'06
2:46 p.m.
Hi! I'm currently experimenting with a bibliography generation tool for LaTeX. It will (if it will be finished) use BibTeX databases but bibliography styles will be written in Haskell. I want styles to be able to transform database entries into some style specific data type, so I define
class DatabaseEntry e where entryLabel :: e -> String formatEntry :: e -> String compareEntries :: e -> e -> Ordering
Then I define
data Entry = forall a. (DatabaseEntry a) => Entry a
instance DatabaseEntry Entry where entryLabel (Entry e) = entryLabel e formatEntry (Entry e) = formatEntry e
How can I define compareEntries for this instance? -- WBR, Max Vasin.