[Haskell-cafe] Re: Proper way to write this

Max Vasin max.vasin at gmail.com
Tue Dec 27 14:12:31 EST 2005


Pupeno wrote:
> On Monday 26 December 2005 02:41, Donn Cave wrote:
> 
>>I don't think it will be too much worse.  I would not try to
>>combine the struct updates, in the "both" case -- it doesn't buy
>>you anything, and pulls you into duplication you don't want.
> 
> What about this
> 
> runDaytimeServer :: DaytimeServer -> IO DaytimeServer
> runDaytimeServer dts = do
>   dts' <- runStreamDaytimeServer dts
>   dts' <- runDgramDaytimeServer dts'
>   return dts'

runDaytimeServer dts
   = runStreamDaytimeServer dts >>= runDgramDaytimeServer

Don't write

a <- foo
return a

write

foo

instead.

--
WBR,
Max Vasin.



More information about the Haskell-Cafe mailing list