Discussion: name for reversing fromList in Data.Sequence

wren romano wren at community.haskell.org
Mon Sep 5 18:56:26 UTC 2016


On Thu, Sep 1, 2016 at 12:51 PM, John Wiegley <johnw at newartisans.com> wrote:
>>>>>> "DF" == David Feuer <david.feuer at gmail.com> writes:
> DF> I'd like to add a function
> DF> fromListReversing :: [a] -> Seq a
>
> Hi David,
>
> Perhaps rather than proliferating the libraries with fused compositions that
> are faster than their composites via (.), we could defer things like this to
> REWRITE rules.

Supposing we do have the rewrite rules, what exactly are we going to
rewrite them *to*? the fused function still needs a name... And, as
David mentions, there's the fragility problem: so even if users by and
large rely on the rewrite rules, it's still nice to be able to
directly invoke the fused version if desired. Usually for this sort of
thing I like to define the fused function, perhaps only exported from
an Foo.Internal module, and then use rules to rewrite things into the
fused form.

-- 
Live well,
~wren


More information about the Libraries mailing list