How can I add a parameter to this list ?
putIntoList :: a -> [a]
putIntoList = ?
CodePudding user response:
Add to what list? Your type only specifies one parameter, and a list result. You thus do not add to a list, but rather create a new list from a given value:
putIntoList :: a -> [a] -- type
putIntoList = \a -> [a] -- value
is the only thing it can do. Or actually,
putIntoList :: a -> [a] -- type
putIntoList = \a -> [a,a,a] -- value
is another possibility. Or any number of repetitions of the same value, which we got as a parameter to this function.
There's thus one more possibility (besides returning an error):
putIntoList :: a -> [a]
putIntoList = \a -> [ ....
Do finish this definition.