It's not going to except that. This is what I'm thinking about:
    
    
    type
      HListKind* = enum hkNil, hkCons
      HList[H, T] = ref object of RootObj
        case kind*: HListKind
        of hkCons:
          head: H
          tail: T
        of hkNil:
          discard
    
    let hNil* = HList[void, void](kind: hkNil)
    
    proc cons[H; T; S](hd: H; tl: HList[T, S]): auto =
      HList[H, T](kind: hkCons, head: hd, tail: tl)
    
    template `<>`(hd, tl: untyped): untyped = cons(hd, tl)
    
    proc printAll[H; T](hl: HList[H, T]) =
      case hl.kind:
      of hkNil: discard
      of hkCons:
        echo hl.head
        printAll(hl.tail)
    
    let l = "hi" <> (2 <> hNil)
    printAll(l)
    
    
    Run

Reply via email to