[Haskell-cafe] Cyclic data declarations

Bulat Ziganshin bulat.ziganshin at gmail.com
Sun Aug 2 01:46:47 EDT 2009

Hello Michal,

Sunday, August 2, 2009, 9:25:40 AM, you wrote:

> data Stmt = SIf Test [Stmt] [Stmt]   |   ...

> data Stmt = SIf Test Int Int   |   ...

data Stmt a = SIf Test [Stmt a] [Stmt a]   |   ...

where a will represent type of your statement. this may be read as
"IF statement with a left and right parts consisting of sequence of
statements returning a, have type a"

btw, you may need to use GADTs to implement more complex statement
types machinery, this is rather popular example in various GADT
papers, f.e. http://www.iai.uni-bonn.de/~ralf/publications/With.pdf

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com

More information about the Haskell-Cafe mailing list