Open
Description
Description
Attempt to use -XOverloadedRecordDot
inside the interpolation would cause an error, because foo.bar
is parsed as foo . bar
To Reproduce
{-# LANGUAGE QuasiQuotes, TemplateHaskell, OverloadedRecordDot, NoFieldSelectors #-}
module Main where
import Text.Interpolation.Nyan
import Data.Text (Text)
main :: IO ()
main = pure ()
data X = MkX { field :: Int }
foo :: X -> Text
foo x = [int|| X is #{x.field} |]
This would cause an error:
• Variable not in scope: field :: a0 -> b0
If you try to remove -XNoFieldSelectors
, then there would be an error about types mismatch
• Couldn't match expected type ‘Int -> c0’ with actual type ‘X’
• In the first argument of ‘(.)’, namely ‘x’
Expected behavior
Successful compilation, like in foo x = let f = x.field in [int|| X is #{f} |]