evilsoft / crocks

A collection of well known Algebraic Data Types for your utter enjoyment.
https://crocks.dev
ISC License
1.59k stars 102 forks source link

Fix Either constructor when called with object containing a circular reference #408

Closed jonwhelan closed 5 years ago

jonwhelan commented 5 years ago

Introduced in release 0.9.4 with commit https://github.com/evilsoft/crocks/commit/6bc5377cf4a47a927ff3fa407073d17aa3b0cdbe#diff-d70a7c87b679a4d796e121bd30e12fd1 the inspect function recursively stringifies objects which will blow the callstack when given an object containing a circular reference.

This bug is triggered when constructing an Either due to its inspect method being eagerly evaluated during construction.

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling cbb54e4cf32ffd45d0a2a2025f0d6783bf47783f on jonwhelan:bugfix-either-constructor into ed99fbf35ff8c693068e3a5bccca13c0e111409b on evilsoft:master.

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling cbb54e4cf32ffd45d0a2a2025f0d6783bf47783f on jonwhelan:bugfix-either-constructor into ed99fbf35ff8c693068e3a5bccca13c0e111409b on evilsoft:master.

evilsoft commented 5 years ago

Ohhh this is nice. 👀