{-# OPTIONS -fglasgow-exts #-}
module Paradise (tests) where
{-
This test runs the infamous PARADISE benchmark,
which is the HELLO WORLD example of generic programming,
i.e., the "increase salary" function is applied to
a typical company just as shown in the boilerplate paper.
-}
import Test.HUnit
import Data.Generics
import CompanyDatatypes
-- Increase salary by percentageincrease :: Float -> Company -> Companyincreasek = everywhere (mkT (incSk))
-- "interesting" code for increaseincS :: Float -> Salary -> SalaryincSk (Ss) = S (s* (1+k))
tests = increase0.1genCom~=?outputoutput = C [D"Research" (E (P"Laemmel""Amsterdam") (S8800.0)) [PU (E (P"Joost""Amsterdam") (S1100.0)),PU (E (P"Marlow""Cambridge") (S2200.0))],D"Strategy" (E (P"Blair""London") (S110000.0)) []]