5 ms·
Type variables are not what you're thinking. add :: Int -> Int -> Int add a b = a + b add2 :: a -> a -> a add2 c d = c + d 1st function adds inte
by crimsonalucard 7y ago
Type variables are not what you're thinking.
add :: Int -> Int -> Int
add a b = a + b
add2 :: a -> a -> a
add2 c d = c + d
1st function adds integers.
2nd function adds anything that can be added.
For example:
add2 [1,2,3] [4,5,6]
evaluates to [1,2,3,4,5,6]
The 'a' in the second function is a type variable.