[Haskell-cafe] One-element tuple

Daniel F difrumin at gmail.com
Mon Aug 19 12:42:25 CEST 2013


Can you please elaborate why this inconsistency is annoying and what's the
use of OneTuple?
Genuine question,
thanks.


On Fri, Aug 16, 2013 at 5:35 AM, AntC <anthony_clayden at clear.net.nz> wrote:

> There's an annoying inconsistency:
>
>     (CustId 47, CustName "Fred", Gender Male)  -- threeple
>     (CustId 47, CustName "Fred)                -- twople
> --  (CustId 47)                                -- oneple not!
>     ()                                         -- nople
>
> (That is, it's annoying if you're trying to make typeclass instances for
> extensible/contractable tuples. Yes, I know I could use HLists.)
>
> I'm not happy with either approach I've tried:
>
>     data Oneple a = Oneple a                   -- (or newtype)
>     (Oneple $ CustId 47)                       -- too verbose
>
>     type Oneple a = [a]
>     [CustId 47]                  -- at least looks bracket-y
>
> What do you do?
>
> AntC
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



-- 
Sincerely yours,
-- Daniil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130819/27375f21/attachment.htm>


More information about the Haskell-Cafe mailing list