[Haskell-beginners] Type Class Woes ..

Patrick LeBoutillier patrick.leboutillier at gmail.com
Sun Aug 30 08:32:56 EDT 2009


Hi,

volume :: Fruit FruitType -> Double
> volume F{radius=r,len=l,fType=Orange} = (4.0/3.0) * pi * r * r * r
>

> volume F{radius=r,len=l,fType=Apple}  = (4.0/3.0) * pi * r * r * r
> volume F{radius=r,len=l,fType=Banana} = pi * (r * r) * l
> volume F{radius=r,len=l,fType=Watermelon} = (4.0/3.0) * pi * (2.0 * r)
>                                                         * l * (0.5 * l)


Can anyone explain the above pattern matching syntax? I've never seen it
before...


Thanks,

Patrick


-- 
=====================
Patrick LeBoutillier
Rosemère, Québec, Canada
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20090830/a967a563/attachment.html


More information about the Beginners mailing list