Proposal: Strict scanl, scanl1 and mapAccumL

Herbert Valerio Riedel hvr at gnu.org
Thu Nov 15 16:29:10 CET 2012


Henning Thielemann <lemming at henning-thielemann.de> writes:

[...]

>> force :: WHNFData a => a -> a
>> force x = x `seq` x
>
> Does this function do something?

if 'seq' adheres to the Haskell reports definition, that is

 seq ⊥ b  =  ⊥
 seq a b  =  b, if a ≠ ⊥ 

'seq a a' and 'a' must be equivalent, and thus 'force' has to be
equivalent to a type-specialized 'id', i.e.

 force :: WHNFData a => a -> a
 force x = x




More information about the Libraries mailing list