Skip to content

Files

Latest commit

080eace · Aug 12, 2022

History

History

HeterogenousArrayLog

README.md

HeterogenousArrayLog

This recipe demonstrates how to create a heterogenous array and process its elements.

PureScript arrays are homogeneous, meaning that all values must have the same type. If you want to store values with different types in the same array (i.e. a heterogeneous array), you should wrap all the types you wish to store in either a sum type or a Variant. This recipe demonstrates both strategies.

Expected Behavior:

Prints the following:

---- Using Sum Type ----
["a String value","4","true","false","82.4"]

---- Using Variant Type ----
["a String value","4","true","false","82.4"]