[Haskell-cafe] Recursive timezone-loading function
gale at sefer.org
Thu Nov 29 23:28:45 CET 2012
David Thomas wrote:
> A small bit of code, but seems likely to be useful enough that I figured I
> should share.
Thanks for sharing this!
> 1) Does this already exist somewhere I missed?
I haven't seen it anywhere.
> 2) It seems silly to make this its own library
- any suggestions where it could be added?
If you feel it is appropriate, I would be willing to add it
to timezone-olson. Does anyone else have an opinion
3) Is the traverse-a-directory-and-populate-a-map
pattern one worth abstracting? If so, where should that go?
I think the proper abstraction would be a more
general fold or traversal over a directory structure.
Some languages have something like that (e.g.,
os.walk in Python). But look how simply it worked
out for you in Haskell - perhaps that's why there
doesn't seem to be a standard function for this
anywhere. That said, it might be interesting to
have this as a lens-package-style traversal.
4) Presently, it's a static cache entirely pre-loaded.
This seems fine, as it's not a terribly huge amount
of data, but it's worth noting.
Yes. The total amount of timezone data in the world
is likely to continue increasing at a significantly
slower rate than Moore's law.
5) Any comments on the code generally?
I like your code. I'm not sure how well this
brute-force mapM recursion would scale over
a timezone directory structure with, say, millions
of nodes. But that's not the use case here at all.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe