codesnippets:equivalentfunctioncompositions
Equivalent function compositions
- assertion:
f1 (f2 . f3)equals(f1 . (f2 . )) f3- 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 f3 = (f1 . (f2 . )) f3 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.txt · Last modified: by 127.0.0.1
