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 (==" ")
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 .
It means has type, so run has type Int -> Int -> Int.
(->) 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.
"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).
It's a section. It's equivalent to recipe = \x -> x == "000001"
(which in turn is the same as recipe x = x == "000001"
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With