
On Fri, 2011-12-23 at 01:29 +0400, MigMit wrote:
Отправлено с iPad
22.12.2011, в 23:56, Conor McBride
написал(а): I'd be glad if "pure" meant "total", but partiality were an effect supported by the run-time system. Then we could choose to restrict ourselves, but we wouldn't be restricted by the language.
I second that. Having a special "partiality" monad would be nice. However, I'm not certain as to how it would interact with recursion — if f is a total function, fix f could be (and almost certainly would be) a possibly undiefined value. So, fix should have type "(a -> a) -> Partial a"; that's OK, but implicit uses of fix (I mean let statements) would be quite different.
IIRC in ML-derived languages there is difference between let and let rec. All implicit fix can be changed into explicit so I imagine that: let rec f x = x -- a -> Partial a let g x = x -- a -> a Regards