<div dir="ltr">cool! Thanks for sharing!<div>(i mean, who doesn't like to read a good book!)</div><div><br></div><div>Question: would it be worth considering  internally having the digits be stored as half bytes for space usage? eg ISBN10 -> use ~ 5 bytes, and ISBN13 be ~ 7 bytes  (this could be within a word64 as a tiny 8 slot array, OR  or any sort of vector/array datatype)? (or instead of a decimal binary rep, pack it into a word64 as the number itself for either?) Granted this would complicate some of the internals engineering a teeny bit</div><div><br></div><div>it looks like, in the current code, if there's  no hyphens, it'll keep the input text value as the internal rep, *which can cause space leaks* if it's a slice of a much larger text input you otherwise do not intend to retain.  When it generates its own text string, well...  the text package uses utf16 (aka 2 bytes per character for valid ascii) as the internal rep, so the buffer representation  will occupy 10 * 2 bytes  or 13* 2bytes, so 20-26 bytes within the buffer, ignoring the extra word or two of indexing/offsets!</div><div><br></div><div>point being ... it seems like could embed them (with a teeny bit of work) as follows</div><div><br></div><div>data ISBN = </div><div>     IsIBSN10 ISBN10 </div><div>     | isISBN13 ISBN13</div><div><br></div><div>newtype ISBN10 = ISBN10 Word64</div><div>newtype ISBN13 = ISBN13 Word64</div><div><br></div><div>and then i'd probably be inclined to do use Data.Bits and do the "word 64 as a 16 slot array of  word4's," which would also support the base 11 digit at the end encoding constraint, since word4 == base 16 :) </div><div>then a teeny bit of work to do the right "right" ords and shows etc on this rep etc</div><div><br></div><div>i hope the design i'm pointing out makes sense for you (and if i'm not being clear, please holler and i'll try to help)</div><div><br></div><div>and again, thanks for sharing this! </div><div>-Carter</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 29, 2020 at 1:39 PM Christian Charukiewicz via Haskell-Cafe <<a href="mailto:haskell-cafe@haskell.org">haskell-cafe@haskell.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello Haskell Cafe,<br>
<br>
I wanted to share my first ever Haskell package: isbn<br>
<br>
<a href="https://hackage.haskell.org/package/isbn" rel="noreferrer" target="_blank">https://hackage.haskell.org/package/isbn</a><br>
<br>
The package is motivated by my need to validate ISBNs (the unique identifier associated with every book published since 1970) in a Haskell application I am building. I published isbn as a back in May but yesterday I made some improvements the API and I think it is now ready to share as v1.1.0.0.<br>
<br>
I have been using Haskell commercially for a few years, and have made several contributions to various packages, but as mentioned, this is my first time authoring and publishing a package. If anyone has any feedback, I would be happy to hear it.<br>
<br>
Thank you,<br>
<br>
Christian Charukiewicz<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div>