What does the / = operator mean in Haskell?

I read. Teach you in Haskell , which contains 5 /= 5 . I'm not sure what that means. Does the first expression have 5 / 5 = 5 ? But then it should not be True .

+6
source share
3 answers

This means that it is not equal. So 5 /= 5 is false since 5 == 5 is true.

x /= y = not (x == y)

As suggested, it resembles the mathematical symbol "β‰ " (/ =), the opposite of "=" (==).

+12
source

The == operator means "equal."

The /= operator means not equal.

It should resemble the mathematical symbol "β‰ " (ie, an equal sign with a diagonal line through it).

+12
source

This is a non-equal operator.

Different languages ​​use, for example != , <> Etc .... and Haskell uses /= ;)

Using :t , you can specify the type:

 > :t (/=) (/=) :: Eq a => a -> a -> Bool 
+4
source

All Articles