Learning Haskell is killing me. If I am going to write a function that takes an array of arrays of order-able elements, and outputs the same thing, how do I do that?
I try:
main = testfn [[1],[2]]
testfn :: (Ord a) => [[a]] -> [[a]]
testfn x = x
But the message I get is:
Couldn’t match expected type ‘IO t0’ with actual type ‘[[a0]]’ In the
expression: main When checking the type of the function ‘main’
Your problem here is that
mainmust be of a type of the formIO a(you can see this in the error – GHC is expecting main’s inferred type[[a0]]to match againstIO t0). Heremainhas type[[Int]]. You can easily fix this by simply printing the result: