Q:

Guess the input of a function?

I have this body of a function which is 
x = \y -> [(:), y]

I guessed that the type would be 
x :: (a -> [a] -> [a]) -> [a -> [a] -> [a]]

because the function takes an input y and produces a [(:), y] where y equals y and then we have function (:) again which expects an element of type a and a list [] to do the prepend. 
But I am unable to guess what input should be given to make it work? 
I tried x 2 [3]
or x 2 []
or x 2 [[3]]
Thanks

A:

As was said in the comments by melpomene, the easiest way to have something of the same type as (:) is to use (:) itself:
> :t x (:)
x (:) :: [a -> [a] -> [a]]

What else could we use? Let's write out (:) in full:
f x xs = (:) x xs = x : xs

This suggest some other possibilities:
twice x xs = x : x : xs

ntimes n x xs | n <= 0 = xs
              | otherwise = x : ntimes (n-1) x xs

mapping f x xs = f x : xs

filtering p x xs | p x = x : xs
                 | otherwise = xs

etc.:
> :t x twice
x twice :: [a -> [a] -> [a]]

> :t x (ntimes 33)
x (ntimes 33) :: [a -> [a] -> [a]]

> :t x (mapping sqrt)
x (mapping sqrt) :: Floating a => [a -> [a] -> [a]]

> :t x (filtering even)
x (filtering even) :: Integral a => [a -> [a] -> [a]]

The last two are interesting. Though their types are "narrower" in a sense than an unconstrained (:), they are nevertheless allowed to unify with it:
> :t [(:), mapping sqrt]
[(:), mapping sqrt] :: Floating a => [a -> [a] -> [a]]

> :t (:)
(:) :: a -> [a] -> [a]

(edit:) As pointed out in the comments by melpomene, there's even take that can be used there as well:
> :t x take
x take :: [Int -> [Int] -> [Int]]

so the type of (:) is allowed to get even more specialized with this one.
This tells us that (:) :: a -> [a] -> [a] is a fully polymorphic type, so we shouldn't be thinking about (:) as one "thing", but rather as one "definition", capable of adjusting and fitting in in multiple situations, or uses. Indeed (:) (5 :: Int) has the more specialized type
> :t (:) (5 :: Int)
(:) (5 :: Int) :: [Int] -> [Int]

just as it ought to have. Here the type of (:) was specialized by an argument it is applied to. In x, this is done by putting (:) into the same list with some other function.

