codesnippets:equivalentfunctioncompositions
This is an old revision of the document!
Equivalent function compositions
- example
- code:
main :: IO () main = do print $ f f1 f2 f3 6.4 print $ f' f1 f2 f3 6.4 print $ f'' f1 f2 f3 6.4 f :: ((Integer -> String) -> Double -> [String]) -> (Int -> String) -> (Integer -> Int) -> Double -> [String] f f1' f2' f3' x' = f1' (f2' . f3') x' f' :: ((Integer -> String) -> Double -> [String]) -> (Int -> String) -> (Integer -> Int) -> Double -> [String] f' f1' f2' f3' = f1' (f2' . f3') f'' :: ((Integer -> String) -> Double -> [String]) -> (Int -> String) -> (Integer -> Int) -> Double -> [String] f'' f1' f2' = f1' . (f2' . ) f1 :: (Integer -> String) -> Double -> [String] -- (a -> c) -> x -> r f1 fx nd = [(fx (floor nd))] f2 :: (Int -> String) -- (b -> c) f2 n = replicate n 'x' f3 :: (Integer -> Int) -- (a -> b) f3 n = fromIntegral n
You could leave a comment if you were logged in.
codesnippets/equivalentfunctioncompositions.1619882937.txt.gz · Last modified: (external edit)
