Prelude function suggestions
Tomasz Zielonka
t.zielonka at students.mimuw.edu.pl
Thu Jul 29 12:40:05 EDT 2004
On Thu, Jul 29, 2004 at 06:29:52PM +0200, Henning Thielemann wrote:
> Say, you have some stop condition that you want to use in connection with
> unfoldr:
>
> unfoldr (\n -> toMaybe (n<10) (n,n+1)) 0
How about using MonadPlus instance for Maybe? It seems a bit clearer to
me.
unfoldr (\n -> guard (n<10) >> return (n,n+1)) 0
Best regards,
Tom
--
.signature: Too many levels of symbolic links
More information about the Libraries
mailing list