Haskell version of HackerRank problem solution "NumberTheory/Restaurant"
getNumLoaves :: IO Int
getNumLoaves = readLn

parseInt :: String -&gt; Int
parseInt = read 


Theses functions are useless. It's useful when you're writing the code and it's not done yet, but Haskell can actually deduce the types based on what the other functions parameters type, like getLoafDimensions need an int, so readLn must return an int, otherwise it wouldn't compile

Your tuplefy function can be simplified by removing the case of, which is basically the same as this form of pattern matching

tuplefy :: [a] -&gt; (a, a)
tuplefy [a, b] = (a, b)
tuplefy _      = error "each line of input must consist of 2 integer values."


By the way, the error message is wrong, because that function can accept a list of any type

Both readLn and getLine are defined in the prelude, so you don't need to import them, so you don't need to import System.IO