parse :: Monad m
      => Loc
      -> P.Parser a
      -> String
      -> m a
parse loc p input = let
  fileName = loc_filename loc
  (line,column) = loc_start loc
  in case P.parse p fileName line column input of
       Left err -> unsafePerformIO $ fail $ show err
       Right x  -> return x
parse :: Monad m
      => Loc
      -> P.Parser a
      -> String
      -> m a
parse loc p input = let
  fileName = loc_filename loc
  (line,column) = loc_start loc
  in case P.parse p fileName line column input of
       Left err -> unsafePerformIO $ fail $ show err
       Right x  -> return x
parse loc p input = let
  fileName = loc_filename loc
  (line,column) = loc_start loc
  in case P.parse p fileName line column input of
       Left err -> unsafePerformIO $ fail $ show err
       Right x  -> return x