[Haskell-cafe] DSL for data definition (e.g. compiling Haskell type defs into Google's protocol buffers type defs)

2011-10-04 Thread Karel Gardas
Hello, I'm trying to find out if it's possible to use Haskell data type definition capability to define types and compile defined types into other languages, for example into Google's protocol buffers data definition language. So basically speaking I'm thinking about using Haskell sub-set

Re: [Haskell-cafe] DSL for data definition (e.g. compiling Haskell type defs into Google's protocol buffers type defs)

2011-10-04 Thread Edward Z. Yang
Just making sure: have you looked at the Data.Data module yet? Edward Excerpts from Karel Gardas's message of Tue Oct 04 12:02:34 -0400 2011: Hello, I'm trying to find out if it's possible to use Haskell data type definition capability to define types and compile defined types into

Re: [Haskell-cafe] DSL for data definition (e.g. compiling Haskell type defs into Google's protocol buffers type defs)

2011-10-04 Thread José Pedro Magalhães
Hi Karel, You can use SYB's toConstr/dataTypeOf [1] to obtain information about the name of the constructor and datatype. Alternatively, you can also use the new generic programming framework of ghc-7.2 [2]. Cheers, Pedro [1]

Re: [Haskell-cafe] DSL for data definition (e.g. compiling Haskell type defs into Google's protocol buffers type defs)

2011-10-04 Thread Ryan Newton
An interesting and semi-related project was just presented at ICFP by Kathleen Fisher. It's called Forest and uses template haskell to create schema's for FileStores from Haskell definitions. But they're not plain-old-haskell type definitions... -Ryan On Tue, Oct 4, 2011 at 12:11 PM, Edward

Re: [Haskell-cafe] DSL for data definition (e.g. compiling Haskell type defs into Google's protocol buffers type defs)

2011-10-04 Thread Stephen Tetley
On 4 October 2011 17:02, Karel Gardas karel.gar...@centrum.cz wrote: Hello, [SNIP] So basically speaking I'm thinking about using Haskell sub-set as a data-definition DSL together with some functions which will generate some code based on supplied defined data types. ... This seems

Re: [Haskell-cafe] DSL for data definition (e.g. compiling Haskell type defs into Google's protocol buffers type defs)

2011-10-04 Thread Karel Gardas
Hello, thanks a lot to Edward, Jose, Ryan and Stephen for fast reply in this thread. I see I've not been that precise in specification of what I need exactly so I need to add this: I've changed a little bit definition of person to: data PersonType = Person { id :: Int ,

Re: [Haskell-cafe] DSL for data definition (e.g. compiling Haskell type defs into Google's protocol buffers type defs)

2011-10-04 Thread Karel Gardas
Forgotten note: GHC's Generics as described here: http://haskell.org/ghc/docs/latest/html/libraries/ghc-prim-0.2.0.0/GHC-Generics.html#t:Datatype -- is not yet clear to me, I'm searching for more information about this in the meantime... Karel On 10/ 4/11 08:33 PM, Karel Gardas wrote:

Re: [Haskell-cafe] DSL for data definition (e.g. compiling Haskell type defs into Google's protocol buffers type defs)

2011-10-04 Thread Antoine Latter
On Tue, Oct 4, 2011 at 1:33 PM, Karel Gardas karel.gar...@centrum.cz wrote: Hello, thanks a lot to Edward, Jose, Ryan and Stephen for fast reply in this thread. I see I've not been that precise in specification of what I need exactly so I need to add this: I've changed a little bit

Re: [Haskell-cafe] DSL for data definition (e.g. compiling Haskell type defs into Google's protocol buffers type defs)

2011-10-04 Thread Erik Hesselink
On Tue, Oct 4, 2011 at 20:33, Karel Gardas karel.gar...@centrum.cz wrote: data PersonType = Person {        id :: Int        , name :: String        , email :: Maybe String        }        deriving (Show, Data, Typeable) so I have `PersonType' as type constructor and Person as value

Re: [Haskell-cafe] DSL for data definition (e.g. compiling Haskell type defs into Google's protocol buffers type defs)

2011-10-04 Thread wren ng thornton
On 10/4/11 12:02 PM, Karel Gardas wrote: Hello, I'm trying to find out if it's possible to use Haskell data type definition capability to define types and compile defined types into other languages, for example into Google's protocol buffers data definition language. So basically speaking I'm