I'm an intermediate Haskell programmer (if you measure by how long I've been using it, not necessarily by skill :-) ).
I often feel like a newbie.
In looking through the Haskell Gloss sourcecode I found some syntax I'm not familiar with.
I constructed an MWE below. 'test' is the function in question.
I looked up the list of Haskell operators and it says that '<-' is only used in list comprehensions and inside a do block. This seems like neither.
It doesn't seem like a Guard since they use '=' signs not '<-'.
It works, but what syntax is this?
Thanks in advance
module Main where
data Point = P Float Float
test :: Point -> Point -> Float
test pA pB
| (P a b) <- pA
, (P c d) <- pB
= a + b + c + d
main :: IO()
main = do
let x = test (P 3 11) (P 20 8)
putStrLn $ show x
-- Yields 42.0