Haskell: composing function with two floating arguments fails

后端 未结 3 645
别那么骄傲
别那么骄傲 2020-12-10 17:36

I am trying to compose a function of type (Floating a) => a -> a -> a with a function of type (Floating a) => a -> a to obtain a fun

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-10 18:04

       \x y -> test2 (test1 x y)
    == \x y -> test2 ((test1 x) y)
    == \x y -> (test2 . (test1 x)) y
    == \x -> test2 . (test1 x)
    == \x -> (test2 .) (test1 x)
    == \x -> ((test2 .) . test1) x
    == (test2 .) . test1
    

    These two things are not like each other.

       test2 . test1
    == \x -> (test2 . test1) x
    == \x -> test2 (test1 x)
    == \x y -> (test2 (test1 x)) y
    == \x y -> test2 (test1 x) y
    

提交回复
热议问题