[clean-list] Parsing: to drill or not to drill, that is the question

metaperl metaperl at gmail.com
Thu Aug 28 16:30:31 MEST 2008


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.



More information about the clean-list mailing list