If in Haskell I had a tuple:
x = (1, 2)
I could use fst x to retrieve 1 and snd x to retrieve 2
I was wondering, if I had a triple:
y = (1, 2, 3)
is there a similar function I could use?
You need to write your own extractor functions:
extractFirst :: (a, b, c) -> a
extractFirst (a,_,_) = a
The fst
and snd
functions are only applicable for a tuple i.e (a, b)
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