-- | Provides a version of 'Prelude.error' with call-site metadata.
error :: Q Exp
error = do
    loc <- location
    [e|(.) P.error (concat [$(stringE (loc_filename loc))
                           , ":"
                           , $(stringE . show . fst $ loc_start loc)
                           , ":"
                           , $(stringE . show . snd $ loc_start loc)
                           , ": "] ++)|]
error :: Q Exp
error = do
    loc <- location
    [e|(.) P.error (concat [$(stringE (loc_filename loc))
                           , ":"
                           , $(stringE . show . fst $ loc_start loc)
                           , ":"
                           , $(stringE . show . snd $ loc_start loc)
                           , ": "] ++)|]
error = do
    loc <- location
    [e|(.) P.error (concat [$(stringE (loc_filename loc))
                           , ":"
                           , $(stringE . show . fst $ loc_start loc)
                           , ":"
                           , $(stringE . show . snd $ loc_start loc)
                           , ": "] ++)|]