Is there a reason this belongs under the Data. prefix? Why not break it out into Crypto, so future implementers of algorithms can also put their stuff under there. Everything at some level can be seen as Data, and it would be nice to start moving out of the overcrowded module hierarchy. <div>
<br><div><br><div class="gmail_quote">On Fri, Sep 3, 2010 at 1:59 AM, Thomas DuBuisson <span dir="ltr">&lt;<a href="mailto:thomas.dubuisson@gmail.com">thomas.dubuisson@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Thu, Sep 2, 2010 at 3:07 PM, Sebastian Fischer<br>
&lt;<a href="mailto:sebf@informatik.uni-kiel.de">sebf@informatik.uni-kiel.de</a>&gt; wrote:<br>
&gt;&gt;  data Key = Key {<br>
&gt;&gt;               encrypt   :: B.ByteString -&gt; B.ByteString,<br>
&gt;&gt;               decrypt   :: B.ByteString -&gt; B.ByteString,<br>
&gt;&gt;               keyLength :: BitLength,<br>
&gt;&gt;               serialize :: B.ByteString}<br>
&gt;&gt;<br>
&gt;&gt;  rsa :: RandomGen g =&gt; BitLength -&gt; g -&gt; ((Key,Key), g)<br>
<br>
</div>One reason against this is simply that all the other constructs<br>
(block/stream cipher, hashes) are classes, it would be odd for there<br>
to be a single exception.  A better reason is the data structure has<br>
no way to implement generateKeyPair.<br>
<div class="im"><br>
&gt; Why not use<br>
&gt;<br>
&gt;    generateKeypair :: MonadRandom m =&gt; BitLength -&gt; m (Maybe (p,p))<br>
<br>
</div>Because MonadRandom dictates mtl, and is heavier weight than a single<br>
class.  I was hoping to keep this agnostic (mtl is only required for<br>
testing or benchmarks in crypto-api).  If MR the more agreeable path<br>
then I&#39;ll do it, though this means I use the unholy &quot;fail&quot; function.<br>
Even if that&#39;s the case (and more people weighing in would help) I<br>
still want to include Data.Crypto.Random and welcome comments.<br>
<br>
Cheers,<br>
Thomas<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</blockquote></div><br></div></div>