I'm doing a haskell assignment for school. I want to make a function called MapTuple, wich maps a function with a tuple as its arguments for an array of tuple. Im declaring it on the following way:
MapTuple :: [(a,b)] -> (a -> b) -> [b]
the way i want to use the function is as follows.
MapTuple :: [(Int, String)] -> (Int -> String) -> [String]
problem however is that I get the following error when compiling:
Invalid type signature: MapTuple :: ([(a, b)]) -> (a -> b) -> [b] Should be of form ::
What am I doing wrong?
Thanks a lot for helping me in advance!
Haskell has a naming convention that's actually part of the language
So you need to change MapTuple
to mapTuple
As for what a constructor is,
data Foo = ThisIsAConstructor
It's basically a function that returns a Foo
.