On Sunday 01 August 2010 10:52:48 am Felipe Lessa wrote: > On Sun, Aug 1, 2010 at 11:29 AM, Nicolas Pouillard > > <[email protected]> wrote: > > Finally maybe we can simply forbidden the forcing of function (as we do > > with Eq). The few cases where it does matter will rescue to > > unsafeSeqFunction. > > What's the problem with > > class Eval a where > seq :: a -> t -> t > > instance Eval b => Eval (a -> b) where > seq f = seq (f undefined) > > It would reduce at least to WHNF as unsafeSeq would. Does it compute > more than WHNF? > > Hmmm, I see, if we had > > f :: Int -> Int > f _ = undefined > > Then my seq above would diverge while unsafeSeq wouldn't. Perhaps > that instance would be a good compromise if we insist in not using > 'unsafeSeq' to define it.
It also diverges for every strict function f. seq id x = seq (id undefined) x = seq undefined x = undefined -- Dan _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
