Library name choice for network accept loop module under development

I am working on a library module to implement a network accept loop with graceful shutdown. (See http://code.catdancer.ws/acceptloop/) This code is tricky to get right, so if I am successful, it will be useful to projects such as web or database servers which accept network connections and would like to be able to restart gracefully without dropping or losing connections. Is "Network.AcceptLoop" a good name for this module in the hierarchical library namespace?

haskell:
I am working on a library module to implement a network accept loop with graceful shutdown. (See http://code.catdancer.ws/acceptloop/)
This code is tricky to get right, so if I am successful, it will be useful to projects such as web or database servers which accept network connections and would like to be able to restart gracefully without dropping or losing connections.
Is "Network.AcceptLoop" a good name for this module in the hierarchical library namespace?
I'd suggest not using CamelCase names in modules -- there are a few in the base libs, but not many. So Network.Accept perhaps. Accept (Loop) doesn't seem terribly intuitive, perhaps something like: Network.Resumable or something similar, emphasising the non-dropping aspect? Thanks for contributing this! -- Don

I'm using Set for algorithms which work this way: while the set is non-empty choose an element from the set do something with that element remove the element and some more that depend on it However when I code this with Set.null and Set.findMin, I run into the same trouble like with List.null and List.head, namely Set.findMin is a partial function. I like to have a function like choose :: Set a -> Maybe a choose set = toMaybe (not (Set.null set)) (Set.findMin set) toMaybe :: Bool -> a -> Maybe a toMaybe False _ = Nothing toMaybe True x = Just x in Data.Set. Opinions?

I wanted to add some note about which set is subtracted from the other one. I remember that there was some discussion about a wiki for library documentation ...

On 12/11/06, Henning Thielemann
Opinions?
Well, you can do this in your code, no? It seems kind of silly to wrap
it up in a Maybe when the resulting code will case on it. Calling code
frequently has:
if Set.null set then
...
else
... (Set.findMin set) ...
--
Taral

On Mon, 11 Dec 2006, Taral wrote:
On 12/11/06, Henning Thielemann
wrote: Opinions?
Well, you can do this in your code, no? It seems kind of silly to wrap it up in a Maybe when the resulting code will case on it.
No, I do 'maybe'. I don't want to repeat the discussion about fromJust and head: http://www.haskell.org/pipermail/haskell-cafe/2006-November/019553.html

You can try Data.Set.minView.
http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Set.html
Cheers,
JP.
On 12/11/06, Henning Thielemann
I'm using Set for algorithms which work this way: while the set is non-empty choose an element from the set do something with that element remove the element and some more that depend on it
However when I code this with Set.null and Set.findMin, I run into the same trouble like with List.null and List.head, namely Set.findMin is a partial function. I like to have a function like choose :: Set a -> Maybe a choose set = toMaybe (not (Set.null set)) (Set.findMin set)
toMaybe :: Bool -> a -> Maybe a toMaybe False _ = Nothing toMaybe True x = Just x
in Data.Set.
Opinions? _______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries

On Mon, 11 Dec 2006, Jean-Philippe Bernardy wrote:
You can try Data.Set.minView. http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Set.html
Seems to be new in GHC-6.6 over GHC-6.4. I suspect that not really monadic behaviour is needed in minView, but only the fail method, isn't it? Confusing.

On 12/11/06, Henning Thielemann
On Mon, 11 Dec 2006, Jean-Philippe Bernardy wrote:
You can try Data.Set.minView. http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Set.html
Seems to be new in GHC-6.6 over GHC-6.4.
True, though "base 2.0" is more accurate, in light of the recent fuss on the subject.
I suspect that not really monadic behaviour is needed in minView, but only the fail method, isn't it? Confusing.
Indeed. This is standard style in many modules however. (And an argument for the resurrection of MonadZero.) Cheers, JP.
participants (5)
-
Cat Dancer
-
dons@cse.unsw.edu.au
-
Henning Thielemann
-
Jean-Philippe Bernardy
-
Taral