change of strictness in zipWith
Roman Cheplyaka
roma at ro-che.info
Fri Jan 2 09:55:48 UTC 2015
This is a big deal. That's a very common pattern.
On 02/01/15 11:50, Henning Thielemann wrote:
>
> $ ghci-7.8.4 -Wall
> Prelude> zipWith (==) "" undefined
> []
>
> $ ghci-7.10.0.20141227 -Wall
> Prelude> zipWith (==) "" undefined
> *** Exception: Prelude.undefined
>
>
> I found the difference because my mapAdjacent function uses 'tail' in
> the second argument of 'zipWith':
>
> mapAdjacent :: (a -> a -> b) -> [a] -> [b]
> mapAdjacent f xs = zipWith f xs (tail xs)
>
>
> I get:
>
> $ ghci-7.10.0.20141227 -Wall
> *Prelude> Data.List.HT.mapAdjacent (==) ([] :: [Int])
> *** Exception: Prelude.tail: empty list
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>
More information about the Libraries
mailing list