Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does (== " ") mean, in Haskell?

To the vultures who might say "Look it up in your textbook", or "Hoogle it", I did.

I came across the statement

recipe = (== "000001")

It looks like some sort of boolean to me but I'm not sure. I've tried testing it in different ways in GHCi but I couldn't figure out anything that works. Can someone explain what it means, and this question will be a result the next time someone Googles Haskell (==" ")

like image 204
CodyBugstein Avatar asked Feb 13 '13 23:02

CodyBugstein


People also ask

What do colons mean in Haskell?

In Haskell, the colon operator is used to create lists (we'll talk more about this soon). This right-hand side says that the value of makeList is the element 1 stuck on to the beginning of the value of makeList .

What does double colon mean in Haskell?

It means has type, so run has type Int -> Int -> Int.

What does -> mean in Haskell?

(->) is often called the "function arrow" or "function type constructor", and while it does have some special syntax, there's not that much special about it. It's essentially an infix type operator. Give it two types, and it gives you the type of functions between those types.

What does period mean in Haskell?

"The period is a function composition operator. In general terms, where f and g are functions, (f . g) x means the same as f (g x).


1 Answers

It's a section. It's equivalent to recipe = \x -> x == "000001" (which in turn is the same as recipe x = x == "000001").

like image 101
Cat Plus Plus Avatar answered Oct 13 '22 17:10

Cat Plus Plus