please, I need tree datat structure as in Haskell or Elm
type Node a
= Node Id a (List (Node a))
in nim, wrongly
type
AstNode* = object
kind*: AST_KIND
flags*: int
lineno*: int
children*: AstNode
How write it in Nim? Thanks
Like this:
type
AstKind* = enum
Id, List
AstNode* = ref object
kind*: AstKind
flags*: int
lineno*: int
children*: AstNode
This is analogous to your Haskell snippet:
type
AstNode[T] = ref object
value: T
children: seq[AstNode[T]]