Efficiency of equality in Haskell

前端 未结 3 1669

I\'ve got a function that takes data and either returns the same data or a slightly modified version.

I want to have my program do one thing if it changed or another thi

3条回答
  •  难免孤独
    2021-02-12 17:17

    I'm still a relative haskell noob, so take my answer with a gran of salt, and please forgive me if my answer isn't as direct as it should be!

    In Haskell, operators aren't special - they're just infix functions.

    You can look at the definition of the equality operator yourself in the standard prelude.

    Of course, it can be overloaded to work with whatever data type you've defined - but if you do the overloading, you'll know how efficient the implementation is.

    It might be helpful to know that you can use Hoogle to find the function definition you want. That's how I found the definition of the equality operator.

提交回复
热议问题