Re: [Haskell-cafe] One-element tuple

2013-08-20 Thread AntC
adam vogt vogt.adam at gmail.com writes: This preprocessor I just threw together doesn't seem to suffers from those issues http://lpaste.net/91967. This kind of approach probably might let you steal T(..) while still allowing `T (..)' to refer to whatever is the original, though I think

Re: [Haskell-cafe] One-element tuple

2013-08-19 Thread AntC
Brent Yorgey byorgey at seas.upenn.edu writes: data Oneple a = Oneple a -- (or newtype) (Oneple $ CustId 47) -- too verbose This is what the OneTuple package is for: Thank you Brent, and Ivan made the same suggestion. Apart from

Re: [Haskell-cafe] One-element tuple

2013-08-19 Thread Daniel F
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_clay...@clear.net.nz wrote: There's an annoying inconsistency: (CustId 47, CustName Fred, Gender Male) -- threeple

Re: [Haskell-cafe] One-element tuple

2013-08-19 Thread adam vogt
On Mon, Aug 19, 2013 at 5:40 AM, AntC anthony_clay...@clear.net.nz wrote: ... Would double-parens be too wild an idea?: ... ((CustId 47)) `extend` (CustName Fred, Gender Male) f ((CustId x)) = ... instance C ((CustId Int)) ... We'd have to avoid the double parens as in:

Re: [Haskell-cafe] One-element tuple

2013-08-19 Thread AntC
Daniel F difrumin at gmail.com writes: Can you please elaborate why this inconsistency is annoying and what's the use of OneTuple? Genuine question, Hi Daniel, the main annoyance is the verbosity (of using a data type and constructor), and that it no longer looks like a tuple. The

Re: [Haskell-cafe] One-element tuple

2013-08-19 Thread Ivan Lazar Miljenovic
On 20 August 2013 11:07, AntC anthony_clay...@clear.net.nz wrote: Daniel F difrumin at gmail.com writes: Can you please elaborate why this inconsistency is annoying and what's the use of OneTuple? Genuine question, Hi Daniel, the main annoyance is the verbosity (of using a data type and

Re: [Haskell-cafe] One-element tuple

2013-08-19 Thread Mike Ledger
It seems to me that this is Identity given a different name. A bonus of using Identity is that it won't introduce any new packages to the majority of installations. On 20/08/2013 1:17 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 20 August 2013 11:07, AntC

Re: [Haskell-cafe] One-element tuple

2013-08-19 Thread AntC
Mike Ledger eleventynine at gmail.com writes: It seems to me that this is Identity given a different name. A bonus of using Identity is that it won't introduce any new packages to the majority of installations. On 20/08/2013 1:17 PM, Ivan Lazar Miljenovic wrote: ... isn't a single

Re: [Haskell-cafe] One-element tuple

2013-08-19 Thread Chris Wong
It seems to me that this is Identity given a different name. Close. But Identity is declared using newtype (just like monad transformers), whereas OneTuple is declared with data (like the other tuples). This may or may not matter, depending on your use case. On 20/08/2013 1:17 PM, Ivan Lazar

Re: [Haskell-cafe] One-element tuple

2013-08-16 Thread Brent Yorgey
On Fri, Aug 16, 2013 at 01:35:22AM +, AntC wrote: There's an annoying inconsistency: (CustId 47, CustName Fred, Gender Male) -- threeple (CustId 47, CustName Fred)-- twople -- (CustId 47)-- oneple not! ()

Re: [Haskell-cafe] One-element tuple

2013-08-15 Thread Ivan Lazar Miljenovic
On 16 August 2013 11:35, AntC anthony_clay...@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! ()

Re: [Haskell-cafe] One-element tuple

2013-08-15 Thread Dan Burton
For the consistency you want, `data Oneple a = T a` is the best you can do in Haskell. 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.