<div dir="ltr">Might <a href="https://hackage.haskell.org/package/validated-literals">https://hackage.haskell.org/package/validated-literals</a> be of interest?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Dec 8, 2023 at 2:13 PM Viktor Dukhovni <<a href="mailto:ietf-dane@dukhovni.org">ietf-dane@dukhovni.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">On Fri, Dec 08, 2023 at 04:50:58PM +0100, Max Ulidtko wrote:<br>
<br>
> And overall, to zoom out of "XY Problem" pitfalls: am I missing a neater way<br>
> to have "partial" IsString instances, those that can reject some literals at<br>
> compile-time?<br>
> <br>
> Having this code work is the goal:<br>
> <br>
> text1, text2 :: NonEmptyText<br>
> text1 = "hello, types"<br>
> text2 = "" -- compile error<br>
<br>
Is at TH splice too cumbersome? <br>
<br>
text1, text2 :: NonEmptyText<br>
text1 = $$(neTxt "hello, types")<br>
text = $$(neTxt "") -- compile error<br>
<br>
I am validating DNS domain name literals at compile time, where checks<br>
include full DNS syntax validation with no empty labels, no labels<br>
longer than 63 bytes, and overall wire length at most 255 bytes.<br>
<br>
<a href="https://github.com/dnsbase/dnsbase/blob/548270f2e575949592ca3f1e40c58edc450bd0c3/internal/Net/DNSBase/Internal/Domain.hs#L249-L267" rel="noreferrer" target="_blank">https://github.com/dnsbase/dnsbase/blob/548270f2e575949592ca3f1e40c58edc450bd0c3/internal/Net/DNSBase/Internal/Domain.hs#L249-L267</a><br>
<br>
-- <br>
Viktor.<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><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>brandon s allbery kf8nh</div><div><a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a></div></div></div></div></div>