Skip to content

Latest commit

 

History

History

HeterogenousArrayLog

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

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"]