[Haskell-beginners] How to nest arbitrary things

Kim-Ee Yeoh ky3 at atamo.com
Mon Dec 21 13:58:38 UTC 2015


On Mon, Dec 21, 2015 at 8:51 PM, Imants Cekusins <imantc at gmail.com> wrote:

data Item a = Truck a [Item] | Box a [Item] | Parcel a [Item] | Can a [Item]


A cardinal rule of FP data modelling is to avoid the hazards of junk,
a.k.a. make the meaningless unspeakable.

Here an Item could be a Can that contains a Parcel that contains a Box that
in turn has a Truck inside.

What will Item-processing functions do with this Item?

Garbage In Garbage Out.

-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20151221/6e098f31/attachment.html>


More information about the Beginners mailing list