我想对以下 do 表示法进行脱糖。但我不确定我是否做对了:
是:
quote = do
time <- qtime
qcomma
ask <- double
qcomma
bid <- double
qcomma
askVolume <- double
qcomma
bidVolume <- double
endOfLine
return $ Quote time ask bid askVolume bidVolume
和
quote = Quote <$> (qtime <* qcomma)
<*> (double <* qcomma)
<*> (double <* qcomma)
<*> (double <* qcomma)
<*> (double <* endOfLine)
相当于:
qtime >>= (\time -> qcomma)
>> double
>>= (\ ask -> qcomma)
>> double
>>= (\bid -> qcomma)
>> double
>>= (\askVolume -> qcomma)
>> double
>>= (\bidVolume -> endOfLine)
return (Quote time ask bid askVolume bidVolume )
任何帮助表示赞赏!