I just wrote constantWind to be working on a list of Char. Only after that I 
found out I wanted to combine it with parsers working on a list of [Char]. It 
shows that you can reuse the constantWind parser without having to re-engineer 
it to work on a list of [Char]. you could have done the latter also.
Erik Zuurbier

________________________________

Van: [EMAIL PROTECTED] namens metaperl
Verzonden: do 28-8-2008 16:30
Aan: [email protected]
Onderwerp: [clean-list] Parsing: to drill or not to drill, that is the question




surfaceWind is a parser engineered to operate on [Char]

however constantWind is a parser engineered to operate on Char... but it
then gets applied via drill to create a parser which operates on [Char]

Why would one be indirect and create a parser to operate on Char and then
apply 'drill' to get what you intended to use:

surfaceWind :: Parser [Char] SurfaceWind t
surfaceWind = "Surface Wind" :> p
where   p       = (word constantWind) <&> \surfaceWind -> <!?> (word
directionVariation)
                                                        (\dir2->{surfaceWind & 
direction=dir2}) // if found
                                                        surfaceWind             
                        // if nothing found

constantWind :: Parser Char SurfaceWind a
constantWind =  direction       <&> \dir         ->
                                speed           <&> \(u,spd) ->
                                gust u          <@  \g           -> 
{direction=dir,speed=spd,gust=g}

--
View this message in context: 
http://www.nabble.com/Parsing%3A-to-drill-or-not-to-drill%2C--that-is-the-question-tp19201847p19201847.html
Sent from the Clean mailing list archive at Nabble.com.

_______________________________________________
clean-list mailing list
[email protected]
http://mailman.science.ru.nl/mailman/listinfo/clean-list


_______________________________________________
clean-list mailing list
[email protected]
http://mailman.science.ru.nl/mailman/listinfo/clean-list

Reply via email to