# Motoko compiler bug # polymorphic recursion

**URL:** <https://forum.dfinity.org/t/motoko-compiler-bug-polymorphic-recursion/15290>\
**Category:** Language Support\
**Tags:** Motoko\
**Created:** [September 5, 2022, 12:16pm UTC](https://forum.dfinity.org/t/motoko-compiler-bug-polymorphic-recursion/15290 "2022-09-05T12:16:48Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![infu](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/infu/32/11321_2.png) [@infu](https://forum.dfinity.org/u/infu)\
**Post date:** [September 10, 2022, 10:21am UTC](https://forum.dfinity.org/t/motoko-compiler-bug-polymorphic-recursion/15290/13 "2022-09-10T10:21:38Z")

</div>

I got to this, which is actually looking pretty simple/good and is the closest to chaining interface I could get.

Working code:

```auto
let ob = Observable<Nat>( func (subscriber) {
    subscriber.next(3);
    subscriber.next(5);
    subscriber.next(12);
});

pipe3(
    ob,
    map( func (val : Nat) : Nat16 {
         Nat16.fromNat(val + 10)
    }),
    map( func (val : Nat16) : Nat {
         Nat16.toNat(val + 30)
    })
).subscribe( {
    next = func (v) {
    Debug.print("next " # debug_show(v));
    }
});

```

```auto
Output:
next 43
next 45
next 52

```

Module here [Attempt to implement ReactiveX in Motoko with "chaining" · GitHub](https://gist.github.com/infu/8a015965bbc882fa6ecdc204d8dbdb8f)

Pipe function is outside of the class and you need to change its name whenever you add more parameters pipe2, pipe3, pipe4, etc.

---

_[View the full topic](https://forum.dfinity.org/t/motoko-compiler-bug-polymorphic-recursion/15290)._
