Re: [Haskell-cafe] handling multiple versions of a data structure

2010-12-20 Thread Jeremy Shaw
Hello, I'm not sure off-hand.. I think it would involve some hackery. How long do you want to keep support for the old Show format around? If you just want to convert some data you have right now, then you could write some code that uses the old Show based code to read in the old data and write

Re: [Haskell-cafe] handling multiple versions of a data structure

2010-12-19 Thread Dmitry V'yal
On 17.12.2010 01:09, Jeremy Shaw wrote: Hello, You should use happstack-data for this (you do not need the other happstack components to use happstack-data)*. It was created to solve this exact problem. happstack-data builds on type of the 'binary' library and adds versioned data types and

Re: [Haskell-cafe] handling multiple versions of a data structure

2010-12-18 Thread Jeremy Shaw
Nice. Do you think there is any reason we would not be able to / want to use it with happstack ? I would love happstack-data to 'go away' and just use some library from hackage which does the same thing. - jeremy On Dec 17, 2010, at 3:57 AM, Erik Hesselink wrote: I've recently been

Re: [Haskell-cafe] handling multiple versions of a data structure

2010-12-18 Thread Erik Hesselink
No, I don't think so. It uses some extensions, but happstack-data already does, so that shouldn't be a problem. We don't have a releasable library yet, but when we do, it will have a versioned binary implementation, just like happstack-data does now. Perhaps even binary compatible with it, though

Re: [Haskell-cafe] handling multiple versions of a data structure

2010-12-17 Thread Erik Hesselink
I've recently been playing with code for versioning data types. It's based on happstacks implementation, but uses type families to make it more modular. I've got some proof of concept code on github [1]. We're also writing a small library based on this at typLAB, which we'll probably release as

[Haskell-cafe] handling multiple versions of a data structure

2010-12-16 Thread Dmitry V'yal
Greetings, while developing my neural net simulator I stumbled upon a problem. I have a data type NeuralNet and use Show and Read instances for saving and loading configurations. As time passed, I changed the data type, so the program can no longer load files saved in previous versions. I

Re: [Haskell-cafe] handling multiple versions of a data structure

2010-12-16 Thread Daniel Peebles
I haven't tested this idea, but it occurred to me that this might be a good place for data families: data Z = Z newtype S n = S n -- Some nastiness to avoid having to see into the future? type family Pred n :: * type instance Pred (S n) = n type instance Pred Z = Z class MyDataClass ver where

Re: [Haskell-cafe] handling multiple versions of a data structure

2010-12-16 Thread Antoine Latter
On Thu, Dec 16, 2010 at 12:56 PM, Daniel Peebles pumpkin...@gmail.com wrote: I haven't tested this idea, but it occurred to me that this might be a good place for data families: data Z = Z newtype S n = S n -- Some nastiness to avoid having to see into the future? type family Pred n :: *

Re: [Haskell-cafe] handling multiple versions of a data structure

2010-12-16 Thread Jeremy Shaw
Hello, You should use happstack-data for this (you do not need the other happstack components to use happstack-data)*. It was created to solve this exact problem. happstack-data builds on type of the 'binary' library and adds versioned data types and automatic version migration. You

Re: [Haskell-cafe] handling multiple versions of a data structure

2010-12-16 Thread Daniel Peebles
Have you considered moving these packages that are unrelated to web development into a separate namespace? I know that I never considered looking under the happstack namespace simply because I never do webapps. On Thu, Dec 16, 2010 at 5:09 PM, Jeremy Shaw jer...@n-heptane.com wrote: Hello,

Re: [Haskell-cafe] handling multiple versions of a data structure

2010-12-16 Thread Sterling Clover
On Dec 16, 2010, at 5:48 PM, Daniel Peebles wrote: Have you considered moving these packages that are unrelated to web development into a separate namespace? I know that I never considered looking under the happstack namespace simply because I never do webapps. On Thu, Dec 16, 2010 at

Re: [Haskell-cafe] handling multiple versions of a data structure

2010-12-16 Thread Jeremy Shaw
On Dec 16, 2010, at 4:48 PM, Daniel Peebles wrote: Have you considered moving these packages that are unrelated to web development into a separate namespace? I know that I never considered looking under the happstack namespace simply because I never do webapps. Yes. I have been wanting