See:
    
    
    type
      HNil = object
      HCons[H, T] = ref object
        head: H
        tail: T
    
    let hNil = HNil()
    
    proc cons[H; T](hd: H; tl: HCons): auto =
      HCons[H, T](head: hd, tail: tl)
    
    proc cons[H](hd: H; tl: HNil): auto =
      HCons[H, void](head: hd, tail: tl) # line 216
    
    template `<>`(hd, tl: untyped): untyped = cons(hd, tl)
    
    proc printAll(n: HNil) =
      discard
    
    proc printAll[H; T](hl: HCons[H, T]) =
      echo hl.head
      printAll(hl.tail)
    
    let l = "hi" <> (2 <> hNil)
    printAll(l)
    
    
    Run

main.nim(216, 32) Error: undeclared field: 'tail'

Reply via email to