Proposal: add unfoldr1 to the somewhere in base

wren romano winterkoninkje at gmail.com
Fri Aug 15 04:06:06 UTC 2014


On Fri, Aug 15, 2014 at 12:05 AM, wren romano <winterkoninkje at gmail.com> wrote:
>     unfoldr1 :: (b -> (a, Maybe b)) -> b -> [a]
>     unfoldr1 f = unfoldr (fmap f) . Just
>
> Note that unless unfoldr is inlined whenever its first argument is
> supplied, the use of (Maybe b) as the seed type means you'll get a lot
> more allocation and case analysis than in your direct definition.

i.e., using (Maybe b) as the type of the seed used by unfoldr

-- 
Live well,
~wren


More information about the Libraries mailing list