Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
14 lines (10 sloc) 386 Bytes
data FuncRec = FuncRec {
name :: String, calc :: Int -> Int, namedCalc :: Int -> (String, Int)
}
mkFuncRec :: String -> (Int -> Int) -> FuncRec
mkFuncRec name calcfunc = FuncRec {
name = name, calc = calcfunc,
namedCalc = \x -> (name, calcfunc x)
}
plus5 = mkFuncRec "plus5" (+ 5)
always0 = mkFuncRec "always0" $ const 0