Am Mittwoch, den 03.08.2016, 10:10 +0000 schrieb Ömer Sinan Ağacan: > I'm reading the code in WwLib that generates worker functions and I'm confused > about absent lets. Can anyone give an example function that has absent demand > > its argument even though the argument is syntactically used in the body?
here is a simple example:
printFst :: (a,b) -> IO () -- <U(U,A)>
printFst (a,b) = print a
callPrintFirst :: b -> IO () -- <A>
callPrintFirst b = printFst ("see it?", b)
> > I think we should add some examples to `Note [Absent errors]` in WwLib.hs.
*shrug* Not sure if it is worth it.
> One example came to my mind was something like
>
> f x = ... undefined x ...
>
> I'm guessing that if we were to generate a worker for this, we'd need to
> generate an absent let for x in the worker function. But "undefined" has a
> weird (polymorphic over both function and non-function types) type and I don't
> know what's the demand signature of it (maybe we should document this too), so
> I'm not sure.
undefined as signature "b", indicating „even if given no arguments, I
will bottom out“. The demand analyzer treats that as „<L,U>b“ if
necessary, i.e. if undefined is applied to an argument.
Greetings,
Joachim
--
Joachim “nomeata” Breitner
[email protected] • https://www.joachim-breitner.de/
XMPP: [email protected] • OpenPGP-Key: 0xF0FBF51F
Debian Developer: [email protected]
signature.asc
Description: This is a digitally signed message part
_______________________________________________ ghc-devs mailing list [email protected] http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
