seq as type class method

Henning Thielemann lemming at henning-thielemann.de
Mon Nov 9 08:56:12 EST 2009


Roman Leshchinskiy schrieb:
> On 06/11/2009, at 09:50, Henning Thielemann wrote:
> 
>> Actually in stream-fusion:Data.Stream I found such a class, called
>> Unlifted. How about moving this into a separate package?
>>
>>
>> class Unlifted a where
>>
>>  -- | This expose function needs to be called in folds/loops that consume
>>  -- streams to expose the structure of the stream state to the simplifier
>>  -- In particular, to SpecConstr.
>>  --
>>  expose :: a -> b -> b
>>  expose = seq
>>
>>  -- | This makes GHC's optimiser happier; it sometimes produces really
>> bad
>>  -- code for single-method dictionaries
>>  --
>>  unlifted_dummy :: a
>>  unlifted_dummy = error "unlifted_dummy"
> 
> This class serves as a vehicle for performing certain black magic
> rituals which (usually) help SpecConstr destroy evil artifacts
> introduced by stream fusion. In particular, expose is *not* seq; it is
> essentially deepSeq.

Mysteriously it seems there is also no deepseq package on Hackage ...
only a DeepSeq module as part of HXT.

Ok, there is Control.Parallel.Strategies.rnf, but I do not see, why deep
strictness should be bound to the parallelism package (that is probably
not as portable as a deep strictness package).

http://www.haskell.org/pipermail/haskell-cafe/2006-October/019026.html



More information about the Libraries mailing list