[Haskell-beginners] calling inpure functions from pure code
eual.jp at gmail.com
Fri Oct 12 16:07:18 CEST 2012
On Fri, Oct 12, 2012 at 03:28:39PM +0200, Emmanuel Touzery wrote:
> It annoys me that the first function returns "incomplete" objects...
> It somehow feels wrong.
Maybe you would feel better about it if you put both functions under one
"umbrella" function like this:
> parseProgramme = getDetails . getProgramme
> getProgramme = ...
> getDetails = ...
That way, your "incomplete" objects would never be exposed to "end user"
(even though it's just you). It also gives you an abstraction that may
gain you in a future when, say, you would want to fetch pictures as
well — it would be just a matter of adding one more function under the
Overall, splitting your algorithm into simple steps — steps that would
do just a part of work and return incomplete objects — is the way to go.
PGP key 356961A20C8BFD03
Fingerprint: CE6C 4307 9348 58E3 FD94 A00F 3569 61A2 0C8B FD03
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 836 bytes
Desc: Digital signature
More information about the Beginners