Re: [Haskell-cafe] Construction of short vectors

2010-06-28 Thread Jake McArthur
On Sun, Jun 27, 2010 at 4:44 PM, Alexey Khudyakov alexey.sklad...@gmail.com wrote: Dependent types would be nice but there isn't anything usable out there. Newtype wrapper parametrized by type level number works fine so far. If you interested sources are available here:

Re: [Haskell-cafe] Construction of short vectors

2010-06-28 Thread Alexey Khudyakov
On Mon, Jun 28, 2010 at 7:02 PM, Jake McArthur jake.mcart...@gmail.com wrote: On Sun, Jun 27, 2010 at 4:44 PM, Alexey Khudyakov alexey.sklad...@gmail.com wrote: Dependent types would be nice but there isn't anything usable out there. Newtype wrapper parametrized by type level number works fine

Re: [Haskell-cafe] Construction of short vectors

2010-06-27 Thread Alexey Khudyakov
On Fri, 25 Jun 2010 18:30:06 -0300 Felipe Lessa felipe.le...@gmail.com wrote: On Fri, Jun 25, 2010 at 12:41:48AM +0400, Alexey Khudyakov wrote: Then constructor like one below arise naturally. And I don't know how to write them properly. It's possible to use fromList but then list could

Re: [Haskell-cafe] Construction of short vectors

2010-06-27 Thread Roman Leshchinskiy
On 25/06/2010, at 06:41, Alexey Khudyakov wrote: Then constructor like one below arise naturally. And I don't know how to write them properly. It's possible to use fromList but then list could be allocated which is obviously wasteful. vector2 :: Double - Double - Vec2D vector2 x y = ...

Re: [Haskell-cafe] Construction of short vectors

2010-06-27 Thread Alexey Khudyakov
On Sun, 27 Jun 2010 19:55:21 +1000 Roman Leshchinskiy r...@cse.unsw.edu.au wrote: On 25/06/2010, at 06:41, Alexey Khudyakov wrote: Then constructor like one below arise naturally. And I don't know how to write them properly. It's possible to use fromList but then list could be

Re: [Haskell-cafe] Construction of short vectors

2010-06-27 Thread Alexander Solla
On Jun 27, 2010, at 12:29 PM, Alexey Khudyakov wrote: This is of course faster but what I really want is vectors with length parametrized by type. This way I can write generic code. Uniform representation is requirement for that. You're going to need dependent types, or a similar

Re: [Haskell-cafe] Construction of short vectors

2010-06-27 Thread Alexey Khudyakov
On Mon, Jun 28, 2010 at 12:00 AM, Alexander Solla a...@2piix.com wrote: On Jun 27, 2010, at 12:29 PM, Alexey Khudyakov wrote: This is of course faster but what I really want is vectors with length parametrized by type. This way I can write generic code. Uniform representation is requirement

Re: [Haskell-cafe] Construction of short vectors

2010-06-25 Thread Felipe Lessa
On Fri, Jun 25, 2010 at 12:41:48AM +0400, Alexey Khudyakov wrote: Then constructor like one below arise naturally. And I don't know how to write them properly. It's possible to use fromList but then list could be allocated which is obviously wasteful. Did you see the generated core? I think

[Haskell-cafe] Construction of short vectors

2010-06-24 Thread Alexey Khudyakov
Hello, cafe I have question about vector package. Currently I'm playing with data types which are isomorphic to vectors of fixed length. Think about vector in N-dimensional space, list of parameters to function R^n → R, set of measurements with uncertainties, etc. They have different semantics