
On Mar 15, 2014, at 0:36 , Robert Vollmert
My problem is how I should deal with these intermediate types that vary based on the input. My current approach below has parsing and printing functions, and then one big function that strings the matching parsers and printers together.
Just wanted to report that I’ve solved this well enough for now. The basic approach looks like: type Parsers a b = … type Printers a b = … type Handler c = forall a b. Parsers a b -> Printers a b -> c compose :: Tag -> Handler c -> c compose Tag1 h = h parsers1 printers1 compose Tag2 h = h parsers2 printers2 … (where type parameters a b differ for the different tags) Then I can define different handlers for different ways of stringing together parsers and printers. I’d still love to know if this is the “right” way to do this… Or if what I’m doing has a name? Cheers Rob