<div dir="ltr">For the "consistency" you want, `data Oneple a = T a` is the best you can do in Haskell.<div><br></div><div>T(CustId 47) is just one character off from what you actually want to write: (Cust 47). And I presume you want the "extra bottom" that comes with this, as opposed to just treating values as their own one-tuples.</div>
<div><br></div><div>I imagine you could write some fancy hack that uses the type system to automatically promote values to Oneples of the given value when an "expected: Oneple Foo, actual: Foo" error occurs. But this would not be very useful in general.</div>
<div><br></div><div>An uglier option:</div><div><br></div><div>type Oneple a = (a, ())</div><div><br></div></div><div class="gmail_extra"><br clear="all"><div>-- Dan Burton</div>
<br><br><div class="gmail_quote">On Thu, Aug 15, 2013 at 7:05 PM, Ivan Lazar Miljenovic <span dir="ltr"><<a href="mailto:ivan.miljenovic@gmail.com" target="_blank">ivan.miljenovic@gmail.com</a>></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 16 August 2013 11:35, AntC <<a href="mailto:anthony_clayden@clear.net.nz">anthony_clayden@clear.net.nz</a>> wrote:<br>
> There's an annoying inconsistency:<br>
><br>
> (CustId 47, CustName "Fred", Gender Male) -- threeple<br>
> (CustId 47, CustName "Fred) -- twople<br>
> -- (CustId 47) -- oneple not!<br>
> () -- nople<br>
><br>
> (That is, it's annoying if you're trying to make typeclass instances for<br>
> extensible/contractable tuples. Yes, I know I could use HLists.)<br>
><br>
> I'm not happy with either approach I've tried:<br>
><br>
> data Oneple a = Oneple a -- (or newtype)<br>
> (Oneple $ CustId 47) -- too verbose<br>
><br>
> type Oneple a = [a]<br>
> [CustId 47] -- at least looks bracket-y<br>
><br>
> What do you do?<br>
<br>
</div><a href="http://hackage.haskell.org/package/OneTuple" target="_blank">http://hackage.haskell.org/package/OneTuple</a> :p<br>
<br>
If you really wanted some form of parentheses you could possibly use<br>
quasiquoting for it...<br>
<div class="im HOEnZb"><br>
><br>
> AntC<br>
><br>
><br>
><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>
<br>
<br>
<br>
</div><span class="HOEnZb"><font color="#888888">--<br>
Ivan Lazar Miljenovic<br>
<a href="mailto:Ivan.Miljenovic@gmail.com">Ivan.Miljenovic@gmail.com</a><br>
<a href="http://IvanMiljenovic.wordpress.com" target="_blank">http://IvanMiljenovic.wordpress.com</a><br>
</font></span><div class="HOEnZb"><div class="h5"><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>
</div></div></blockquote></div><br></div>