<div dir="auto">In some respects, there’s another path: further generalizing overloaded lists with the right machinery for list syntax to support hlists and sized lists!</div><div dir="auto"><br></div><div dir="auto">I prototyped out a possible type class for this that predates pattern synonyms and I believe it could be made even nicer with pattern synonyms </div><div dir="auto"><br></div><div dir="auto"><div><a href="https://github.com/cartazio/HetList/blob/master/HetList.hs">https://github.com/cartazio/HetList/blob/master/HetList.hs</a></div><br></div><div dir="auto">Here’s the example code above!</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 13, 2022 at 8:06 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-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">On Thu, Jan 13, 2022 at 07:50:02PM -0500, Jeffrey Brown wrote:<br>
> You can get very close -- specifically, to within two extra characters --<br>
> to the brevity you're imagining without introducing any new extensions:<br>
> <br>
>     data Foo = Foo Int Int<br>
>       deriving (Show)<br>
> <br>
>     f :: (Int, Int) -> Foo<br>
>     f = uncurry Foo<br>
> <br>
>     g :: Int -> Int -> Foo<br>
>     g = Foo<br>
<br>
    {-# LANGUAGE PatternSynonyms #-}<br>
<br>
    pattern F :: Int -> Int -> Foo<br>
    pattern F f s = Foo f s<br>
<br>
Which abbreviates a frequently used constructor, and works in pattern<br>
matches too.<br>
<br>
    λ> case F 4 "2" of { F x y -> show x ++ y }<br>
    "42"<br>
<br>
But the original question is really about logical completeness of<br>
overloading primitives, not about work-arounds, so bottom line I too<br>
don't think that overloading tuples is justified, since this breaks<br>
extensibility if constructor type signatures later become ambiguous, I<br>
don't think the idea has sufficient merit.<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></div>