One option appears to be the use of a library like loc-th where you can, for example, write an error message with the line information:
{-# LANGUAGE TemplateHaskell #-}
-- app/Main.hs
module Main where
import Debug.Trace.LocationTH
main :: IO ()
main = do
$failure "Error"
putStrLn "Hello"
gives me
my-exe: app/Main.hs:10:5-12: Error
It also provides a string which one could look at, in order to determine the line number. However, I'd imagine that's a bit frowned upon, depending on your use-case. For example, I wouldn't want to see this method used to just log line numbers.
There's more on Haskell debugging techniques here.
Honestly, though, maybe this isn't the greatest idea. What are you planning on doing with the line number?