3 ms·
Haskell has a more liberal structure than the languages early LP research focused on, but it's still not as flexible as a LP file. All exports must be before im
by jmillikin 17y ago
Haskell has a more liberal structure than the languages early LP research focused on, but it's still not as flexible as a LP file. All exports must be before imports, which must be before definitions; modules can't be interleaved; when pattern matching, all patterns must be on consecutive lines.
I've found the usefulness of LP to be directly related to (1) how large a particular library is and (2) how much original thought went into it. Most of my Haskell libraries, so far, are relatively small -- a few hundred lines, at most. Furthermore, many are bindings to C libraries -- GNU SASL, CPython, YAJL -- and there's not much complex code involved. For Haskell, the tipping point seems to be around 1000 LOC for "native" code.
dbus-core is just over 2500 LOC, and is a reasonably complete implementation of DBus in pure Haskell. Using literate programming (specifically, NoWeb) has been tremendously helpful. It's the only library I use LP for, but that's only because it's the largest I've written in Haskell.
Notably, another of my libraries (network-protocol-xmpp) is approaching the 1000 LOC mark, and I've noticed some problems keeping track of the code. I plan to convert it to LP / NoWeb after the next release.
If you have any large, complex libraries, I highly recommend at least experimenting with LP. It's relatively easy to convert existing libraries to LP, and because NoWeb is so flexible, you can convert them a little bit at a time as you become more comfortable with the tools.