understanding syb boilerplate elimination
Posted
by Pradeep
on Stack Overflow
See other posts from Stack Overflow
or by Pradeep
Published on 2010-04-07T16:00:45Z
Indexed on
2010/04/07
16:03 UTC
Read the original article
Hit count: 201
In the example given in http://web.archive.org/web/20080622204226/http://www.cs.vu.nl/boilerplate/
-- Increase salary by percentage
increase :: Float -> Company -> Company
increase k = everywhere (mkT (incS k))
-- "interesting" code for increase
incS :: Float -> Salary -> Salary
incS k (S s) = S (s * (1+k))
how come increase function compiles without binding anything for the first Company mentioned in its type signature.
Is it something like assigning to a partial function? Why is it done like that?
© Stack Overflow or respective owner