3 ms·
It's all imperative code. Would someone who really knew Haskell write it differently?
by skybrian 16y ago
It's all imperative code. Would someone who really knew Haskell write it differently?
- jmillikin 16y agoHaskell works well for both declarative and imperative styles. I would make some small changes ('forever' instead of explicit recursion, less duplicate code in handlers), but it would be basically the same.
- pchickey 16y agoThere are a few Haskell web frameworks out there which take advantage of advanced Haskell features. The Snap framework is based on Iteratees, a fairly recent abstraction developed for Haskell IO. The source code is readable, though you want to make sure you understand iteratees first. https://github.com/snapframework/snap-core/tree/master/src/Snap https://github.com/snapframework/snap-core/tree/master/src/S... http://okmij.org/ftp/Streams.html http://okmij.org/ftp/Streams.html
- merijnv 16y agoDon't fix what ain't broke. The more I grok Haskell the more I believe its not only a solid functional language but also my favorite imperative language... Based on what usage/performance you expect you could maybe take a different approach, but for a simple and general TCP server example I don't see a reason to do anything different except maybe minor style details...