Re: [Haskell-cafe] One-element tuple

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

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 La

Re: [Haskell-cafe] One-element tuple

2013-08-19 Thread AntC
> Mike Ledger 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 element tup

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" wrote: > On 20 August 2013 11:07, AntC wrote: > >> Daniel F gmail.com> writes: > >>

Re: [Haskell-cafe] One-element tuple

2013-08-19 Thread Ivan Lazar Miljenovic
On 20 August 2013 11:07, AntC wrote: >> Daniel F 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

Re: [Haskell-cafe] One-element tuple

2013-08-19 Thread AntC
> Daniel F 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 inconsistency

Re: [Haskell-cafe] One-element tuple

2013-08-19 Thread adam vogt
On Mon, Aug 19, 2013 at 5:40 AM, AntC 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: > > ((meth obj) (dou

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 wrote: > There's an annoying inconsistency: > > (CustId 47, CustName "Fred", Gender Male) -- threeple > (CustId 47, CustName "Fred

Re: [Haskell-cafe] One-element tuple

2013-08-19 Thread AntC
> Brent Yorgey 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 b

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 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-tuple

Re: [Haskell-cafe] One-element tuple

2013-08-15 Thread Ivan Lazar Miljenovic
On 16 August 2013 11:35, AntC wrote: > There's an annoying inconsistency: > > (CustId 47, CustName "Fred", Gender Male) -- threeple > (CustId 47, CustName "Fred)-- twople > -- (CustId 47)-- oneple not! > ()

[Haskell-cafe] One-element tuple

2013-08-15 Thread AntC
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 y