Quick code style question: Wild card binders

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Quick code style question: Wild card binders

Joachim Breitner-2
Hi,

both work, so it is a matter of style, and I?m not sure which one is
better style: If I generate a Case where the case binder is not used,
should I
 * use the wildcard binder (mkWildCase), to be explicit about the fact
   fact that the wildcard binder is unused, or should I
 * generate a new Unique and a new Id nevertheless, because wildCard is
   bad?

Thanks,
Joachim

--
Joachim ?nomeata? Breitner
  mail at joachim-breitner.de ? http://www.joachim-breitner.de/
  Jabber: nomeata at joachim-breitner.de  ? GPG-Key: 0x4743206C
  Debian Developer: nomeata at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20140114/8ac04890/attachment.sig>

Reply | Threaded
Open this post in threaded view
|

Quick code style question: Wild card binders

Joachim Breitner-2
Hi,

Am Dienstag, den 14.01.2014, 08:57 +0000 schrieb Joachim Breitner:
> both work, so it is a matter of style, and I?m not sure which one is
> better style: If I generate a Case where the case binder is not used,
> should I
>  * use the wildcard binder (mkWildCase), to be explicit about the fact
>    fact that the wildcard binder is unused, or should I
>  * generate a new Unique and a new Id nevertheless, because wildCard is
>    bad?

here I is what I learned from SPJ: If I have access to a monad, better
use a unique. Even if the case binder is not used _now_ when I generate
the code, later simplifier phases might attempt to make use of it.

If I had not access to a monad, then using the wild binder is ok if I
have control over the body and its free variables.

Greetings,
Joachim

--
Joachim ?nomeata? Breitner
  mail at joachim-breitner.de ? http://www.joachim-breitner.de/
  Jabber: nomeata at joachim-breitner.de  ? GPG-Key: 0x4743206C
  Debian Developer: nomeata at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20140114/a117d62b/attachment.sig>