[darcs-users] DrHaskell report for darcs

Gwern Branwen gwern0 at gmail.com
Fri Dec 19 16:04:26 UTC 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Also Neil, I'm wondering how Dr. Haskell handles under-use of library
functions. For example, in the darcs codebase there's about 13
examples of this pattern/idiom:
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEAREKAAYFAklLxggACgkQvpDo5Pfl1oLFSQCeKB1APgoby30Gg0+GTinAhNzU
Hm4AnR+HB1h0i7SqiiIS40nUKO6ZYE0s
=Q8WT
-----END PGP SIGNATURE-----


> if foo then do stuff
>                 moreStuff
>                 lastOfTheStuff
> else return ()

Which is less clear than using Control.Monad.when to write:

> when foo $ do stuff
>               moreStuff
>               lastOfTheStuff

(when packages up the 'if foo then bar else return ()' pattern.)

This specific example didn't appear in the report, so obviously Dr.
Haskell doesn't completely handle it. Would one have to add some
heuristic "Warning: use of 'else return ()' should probably be
replaced with 'when'"?

--
gwern


More information about the darcs-users mailing list