[Haskell-beginners] calling inpure functions from pure code

Alexander Batischev eual.jp at gmail.com
Fri Oct 12 16:07:18 CEST 2012


Hi,

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
>   where
>   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
"umbrella".

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.

-- 
Regards,
Alexander Batischev

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
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://www.haskell.org/pipermail/beginners/attachments/20121012/8c4e37b6/attachment.pgp>


More information about the Beginners mailing list