[Haskell-cafe] modelling C in Haskell ..

Thomas Davie tom.davie at gmail.com
Fri May 30 02:52:26 EDT 2008


Yes, you must write them seperately as something like

data A = A Int B
data B = B1 Int
        | B2 Int Int

one of the many wonders of Haskell -- it encourages you to split up  
your code into nice small chunks.

Bob

On 30 May 2008, at 08:46, Galchin, Vasili wrote:

> Hello,
>
>      I don't want to write kludgy Haskell code!
>
> typedef struct blah
> {
>        int val1;
>
>        union {
>
>            int  val2;
>
>            struct {
>
>                  int val3;
>
>                  int val4;
>            }
>        }
> }    C_type;
>
> question: in Haskell, can I embed definition of the "union" inside  
> of the C typedef, i.e. recursion definition? Or must I have a  
> separate definition for the "union" which I "instantiate" inside the  
> Haskell "typedef", i.e. Haskell "data"?
>
> Kind regards, Vasili
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list