Re: [Haskell-cafe] Re: [Haskell] lazy constructors

2004-10-13 Thread Serge D. Mechveliani
I thank Jeremy Gibbons, Ben Rudiak-Gould, and other people, for their helpful explanations. On Wed, Oct 13, 2004 at 02:34:55PM +0100, Ben Rudiak-Gould wrote: > Serge D. Mechveliani wrote: > > > As the types are resolved before the computation, as the above > > program shows, how can addToSPai

Re: [Haskell-cafe] Re: [Haskell] lazy constructors

2004-10-13 Thread Ben Rudiak-Gould
Serge D. Mechveliani wrote: As the types are resolved before the computation, as the above program shows, how can addToSPair expect anything besides a string pair? Why tilda is not a default? Haskell pairs are "lifted", meaning that they also include an extra value (bottom) which doesn't match

Re: [Haskell-cafe] Re: [Haskell] lazy constructors

2004-10-13 Thread MR K P SCHUPKE
>addToSPair :: Char -> (String, String) -> (String, String) What about: addToSPair :: Char -> String -> String -> (String,String) so that the pattern match is: addToSPair c xs ys = (c:xs,ys) This is irrefutable? Keean. ___ Haskell-Cafe mail

[Haskell-cafe] Re: [Haskell] lazy constructors

2004-10-13 Thread Serge D. Mechveliani
On Wed, Oct 13, 2004 at 09:23:43AM +0100, MR K P SCHUPKE wrote: > You can only return a list of pair's lazily, not > a pair of lists. If the two strings are independant, then > generate each in a separate function, and pair off the > results lazily. No, I have several labeled fields in a record,

[Haskell-cafe] Re: [Haskell] lazy constructors

2004-10-13 Thread Serge D. Mechveliani
On Wed, Oct 13, 2004 at 10:06:44AM +0200, Sander Evers wrote: > > >Question 2 > >-- > >How to arrange the above `lazy' output? > > > > > Your function addToSPair > > addToSPair :: Char -> (String, String) -> (String, String) > addToSPairc (xs, ys) = (c:xs, ys) >

Re: [Haskell-cafe] RE: [Haskell] lazy constructors

2004-10-13 Thread MR K P SCHUPKE
>addToSPairc ~(xs, ys) =3D (c:xs, ys) I thought pattern bindings had an implicit "~"? Keean. ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] RE: [Haskell] lazy constructors

2004-10-13 Thread Simon Peyton-Jones
[I think this thread would be more appropriate on haskell-café, so I'm redirecting it] | addToSPair :: Char -> (String, String) -> (String, String) | addToSPairc (xs, ys) = (c:xs, ys) | | --- | | g1 is similar t