<div>Hey Carter,<br></div><div><br></div><div>I really appreciate the reply. This is exactly the type of feedback that I find very helpful, as it helps me become a better Haskell programmer. To address your points:<br></div><div><br></div><div>1. Great catch about making a copy of the input. I didn't notice the potential for space leaks here, but what you're saying makes total sense. I just added a call to <span style="font-family: menlo, consolas, courier new, monospace, sans-serif;">Data.Text.copy</span> around the inputs of the validation functions, so that should mitigate this risk. I released this as <span style="font-family: menlo, consolas, courier new, monospace, sans-serif;">isbn-1.1.0.1</span> on Hackage: <a href="https://hackage.haskell.org/package/isbn-1.1.0.1">https://hackage.haskell.org/package/isbn-1.1.0.1</a><br></div><div><br></div><div>2. In terms of the changing the internal representation of <span style="font-family: menlo, consolas, courier new, monospace, sans-serif;">ISBN</span> to be something other than <span style="font-family: menlo, consolas, courier new, monospace, sans-serif;">Text</span>, this is definitely something I'm open to, since it's not that hard to think of a situation where someone is working with a large number of ISBNs and space use matters. I like your suggestion to use <span style="font-family: menlo, consolas, courier new, monospace, sans-serif;">Word64</span>, but this would be the first time I have worked with <span style="font-family: menlo, consolas, courier new, monospace, sans-serif;">Word64</span> in this manner, so I'll have to look into it a bit more. I did also receive some other feedback from someone else about the exact same thing. I incorporated your feedback and the other feedback into an issue in the GitHub repo if you'd like to take share your thoughts: <a href="https://github.com/charukiewicz/hs-isbn/issues/2">https://github.com/charukiewicz/hs-isbn/issues/2</a><br></div><div><br></div><div>Thanks again,<br></div><div><br></div><div>Christian</div><div class="protonmail_signature_block protonmail_signature_block-empty"><div class="protonmail_signature_block-user protonmail_signature_block-empty"><br></div><div class="protonmail_signature_block-proton protonmail_signature_block-empty"><br></div></div><div><br></div><div>‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐<br></div><div> On Thursday, July 30, 2020 9:04 AM, Carter Schonwald <carter.schonwald@gmail.com> wrote:<br></div><div> <br></div><blockquote class="protonmail_quote" type="cite"><div dir="ltr"><div>cool! Thanks for sharing!<br></div><div>(i mean, who doesn't like to read a good book!)<br></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<br></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!<br></div><div><br></div><div>point being ... it seems like could embed them (with a teeny bit of work) as follows<br></div><div><br></div><div>data ISBN = <br></div><div>     IsIBSN10 ISBN10 <br></div><div>     | isISBN13 ISBN13<br></div><div><br></div><div>newtype ISBN10 = ISBN10 Word64<br></div><div>newtype ISBN13 = ISBN13 Word64<br></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 :) <br></div><div>then a teeny bit of work to do the right "right" ords and shows etc on this rep etc<br></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)<br></div><div><br></div><div>and again, thanks for sharing this! <br></div><div>-Carter<br></div><div><br></div></div><div><br></div><div class="gmail_quote"><div dir="ltr">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"><div>Hello Haskell Cafe,<br></div><div> <br></div><div> I wanted to share my first ever Haskell package: isbn<br></div><div> <br></div><div> <a href="https://hackage.haskell.org/package/isbn" rel="noreferrer" target="_blank">https://hackage.haskell.org/package/isbn</a><br></div><div> <br></div><div> 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></div><div> <br></div><div> 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></div><div> <br></div><div> Thank you,<br></div><div> <br></div><div> Christian Charukiewicz<br></div><div> _______________________________________________<br></div><div> Haskell-Cafe mailing list<br></div><div> To (un)subscribe, modify options or view archives go to:<br></div><div> <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></div><div> Only members subscribed via the mailman list are allowed to post.<br></div></blockquote></div></blockquote><div><br></div>