ndmitchell / record-dot-preprocessor

A preprocessor for a Haskell record syntax using dot
Other
129 stars 19 forks source link

Avoid rewriting quasiquoted strings #38

Closed GambolingPangolin closed 3 years ago

GambolingPangolin commented 3 years ago

Problem

I ran into trouble when using the preprocessor on a file with quasi-quoted content. Here is a minimal plausible example where this comes up:

module Lib where

import Database.PostgreSQL.Simple (Query)
import Database.PostgreSQL.Simple.SqlQQ (sql)

someQuery :: Query
someQuery = [sql| SELECT some_table.some_column FROM some_table |]

In this situation, the preprocessor should not rewrite the query.

Solution

I added a special case to the edit function to look out for a parenthesized expression of a certain form and place them in the output stream unchanged. I do not use the plugin and did not touch it.

ndmitchell commented 3 years ago

Thanks! Would a release be useful to you?

ndmitchell commented 3 years ago

I just released 0.2.8, which has this change in it.

GambolingPangolin commented 3 years ago

Thanks for making a release right away! That will indeed be helpful.