Re: Strict Haskell debate

2006-02-17 Thread Andy Gill


On Feb 17, 2006, at 3:30 PM, Ashley Yakeley wrote:


Andy Gill wrote:
I'd like to see a way of enforcing return strictness, that is  
where you

have confidence that what a function is returning is fully evaluated.
Imagine a function hstrict;
 hstrict :: a - a


Is this like deepseq, that strictly evaluates internal structure  
using seq?


yes. it is.




With hstrict you can write functions in the style.
fun f a b c = hstrict $ 
  where
...
...


But surely fun can return the unevaluated thunk (hstrict x)? Since  
hstrict has not yet been called, it can't do its strictifying  
magic, whatever that is.




No. hstrict will always be called before returning. Evaluation does
not return thunks, they get created by lets/where (at the core level),
not by function application/evaluation.

Andy Gill

___
Haskell-prime mailing list
Haskell-prime@haskell.org
http://haskell.org/mailman/listinfo/haskell-prime


Re: the MPTC Dilemma (please solve)

2006-02-17 Thread Ross Paterson
Martin Sulzmann [EMAIL PROTECTED] writes:
 - There's a class of MPTC/FD programs which enjoy sound, complete
   and decidable type inference. See Result 1 below. I believe that
   hugs and ghc faithfully implement this class.
   Unfortunately, for advanced type class acrobats this class of
   programs is too restrictive.

Not just them: monad transformers also fall foul of these restrictions.
The restrictions can be relaxed to accomodate them (as you do with the
Zip class), but the rules become more complicated.

 Result2:
 Assuming we can guarantee termination, then type inference
 is complete if we can satisfy
- the Bound Variable Condition,
- the Weak Coverage Condition, 
- the Consistency Condition, and
- and FDs are full.
 Effectively, the above says that type inference is sound,
 complete but semi-decidable. That is, we're complete
 if each each inference goal terminates.

I think that this is a little stronger than Theorem 2 from the paper,
which assumes that the CHR derived from the instances is terminating.
If termination is obtained via a depth limit (as in hugs -98 and ghc
-fallow-undecidable-instances), it is conceivable that for a particular
goal, one strategy might run into the limit and fail, while a different
strategy might reach success in fewer steps.

___
Haskell-prime mailing list
Haskell-prime@haskell.org
http://haskell.org/mailman/listinfo/haskell-prime