Re: [Haskell-cafe] Data creation pattern?

2010-05-13 Thread Stephen Tetley
Hi Eugene You don't need to supply all the arguments to a constructor at once: makeWithOne :: String - (String - String - Object) makeWithOne s1 = \s2 s3 - Object s1 s2 s3 -- or even: -- makeWithOne s1 = Object s1 This builds a higher-order function that can be applied later to two Strings to

Re: [Haskell-cafe] Data creation pattern?

2010-05-13 Thread Eugeny N Dzhurinsky
On Thu, May 13, 2010 at 04:43:26PM +0100, Stephen Tetley wrote: Hi Eugene You don't need to supply all the arguments to a constructor at once: makeWithOne :: String - (String - String - Object) makeWithOne s1 = \s2 s3 - Object s1 s2 s3 -- or even: -- makeWithOne s1 = Object s1 This

Re: [Haskell-cafe] Data creation pattern?

2010-05-13 Thread Stephen Tetley
Hi Eugene Is something like this close to what you want: For example this builds an object with ordered strings... makeOrdered :: String - String - String - Object makeOrdered a b c = let (s,t,u) = sort3 (a,b,c) in Object s t u Alternatively you could build the with the Strings as they appear

Re: [Haskell-cafe] Data creation pattern?

2010-05-13 Thread Stephen Tetley
On 13 May 2010 19:14, Stephen Tetley stephen.tet...@gmail.com wrote: Hi Eugene Hi Eugeny Whoops - apologies for the the name change... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Data creation pattern?

2010-05-13 Thread Steffen Schuldenzucker
Hi. Stephen Tetley wrote: Hi Eugene Is something like this close to what you want: For example this builds an object with ordered strings... makeOrdered :: String - String - String - Object makeOrdered a b c = let (s,t,u) = sort3 (a,b,c) in Object s t u Or just: makeOrdered a b c = let

Re: [Haskell-cafe] Data creation pattern?

2010-05-13 Thread Stephen Tetley
On 13 May 2010 19:24, Steffen Schuldenzucker sschuldenzuc...@uni-bonn.de wrote: Or just: makeOrdered a b c = let (s:t:u:_) = sort [a, b, c] in Object s t u Hi Steffen True - but it does include a partial pattern (that will always match in this case, of course).

Re: [Haskell-cafe] Data creation pattern?

2010-05-13 Thread Eugeny N Dzhurinsky
On Thu, May 13, 2010 at 07:15:22PM +0100, Stephen Tetley wrote: On 13 May 2010 19:14, Stephen Tetley stephen.tet...@gmail.com wrote: Hi Eugene Hi Eugeny Whoops - apologies for the the name change... In fact it doesn't make any difference, so both these names are equal :) -- Eugene

Re: [Haskell-cafe] Data creation pattern?

2010-05-13 Thread Eugeny N Dzhurinsky
On Thu, May 13, 2010 at 07:14:25PM +0100, Stephen Tetley wrote: Hi Eugene Is something like this close to what you want: Not really. First of all, there're many properties, not 3. So it may end up with plenty of support (boilerplate) code. Also, names of these parameters are not sortable. Of

Re: [Haskell-cafe] Data creation pattern?

2010-05-13 Thread Daniel Fischer
On Thursday 13 May 2010 20:43:44, Eugeny N Dzhurinsky wrote: On Thu, May 13, 2010 at 07:14:25PM +0100, Stephen Tetley wrote: Hi Eugene Is something like this close to what you want: Not really. First of all, there're many properties, not 3. So it may end up with plenty of support

Re: [Haskell-cafe] Data creation pattern?

2010-05-13 Thread Eugeny N Dzhurinsky
On Thu, May 13, 2010 at 09:03:48PM +0200, Daniel Fischer wrote: so if it is possible to have partially initialized objects in Haskell, If the fields aren't strict, there's no problem having ... Wow! Thank you, that's it :) -- Eugene Dzhurinsky pgpPXFjii1ixC.pgp Description: PGP signature