Proposal: making inits and tails less strict

Bas van Dijk v.dijk.bas at gmail.com
Fri Mar 18 09:06:02 CET 2011


On 17 March 2011 21:09, Don Stewart <dons00 at gmail.com> wrote:
> Could the strictness properties be stated in the specification (i.e.
> include some QuickCheck properties that define the strictness)

Good point. I will add the following strictness properties to the docs:

inits ⊥ = [] : ⊥
tails ⊥ = ⊥ : ⊥

I'm not sure if we should add QC properties to the docs but we can have:

prop_lazyInits xs = head (inits xs) == []

prop_isConsTails xs = case tails xs of
                        []  → False
                        _:_ → True

Bas



More information about the Libraries mailing list