John Hughes wrote:
> ...
> >
> Indeed, error messages in common cases would be worsened significantly, 
> because as Ross says, common errors (such as forgetting a parameter in a 
> recursive call) would lead to legal definitions that cause a type error 
> when applied. Partly for this reason, OCaml permits recursion only in 
> object types, if I remember rightly, where it's most useful. In other 
> cases the occurs check is still used.
> 

Couldn't this be mitigated by requiring an explicit type annotation on the 
function being called
recursively? In other words infinite types are never silently inferred, but can 
only coincide with
explicit signatures.

So this is legal:

  type Fix s a = s a (Fix s a)

  fold :: Functor (s a) => (s a b -> b) -> Fix s a -> b
  fold f = f . fmap (fold f)

but this is not:

  fold f = f . fmap (fold f)


I guess it just seems that banning infinite types altogether is throwing the 
baby with the bath.



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to