[Haskell-beginners] How to nest arbitrary things

Frerich Raabe raabe at froglogic.com
Mon Dec 21 13:54:32 UTC 2015


On 2015-12-21 14:51, Imants Cekusins wrote:
>>  trucks
>         containing boxes
>                 containing parcels
>                         containing cans
> 
> 
> .. or try this type:
> 
> data Item a = Truck a [Item] | Box a [Item] | Parcel a [Item] | Can a [Item]

I guess you'd need that type if you want to be able to express

   
http://i.telegraph.co.uk/multimedia/archive/01845/truck-on-truck-on-_1845173i.jpg

-- 
Frerich Raabe - raabe at froglogic.com
www.froglogic.com - Multi-Platform GUI Testing


More information about the Beginners mailing list