From b0f442b78a6b2c7d8978ae958bcadcc23ff82199 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Fri, 8 Mar 2024 05:00:53 +0100 Subject: chore: use `${{..}}` for impure interpolation --- test/Main.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/Main.hs b/test/Main.hs index 71723c3..e00ccf6 100644 --- a/test/Main.hs +++ b/test/Main.hs @@ -1,8 +1,10 @@ {-# LANGUAGE BlockArguments #-} +{-# LANGUAGE PartialTypeSignatures #-} {-# LANGUAGE QuasiQuotes #-} module Main (main) where +import Control.Monad.Reader import Data.ByteString.Char8 qualified as B import Data.ByteString.Lazy.Char8 qualified as LB import Data.Text qualified as T @@ -41,7 +43,9 @@ main = hspec do it "interpolates expressions" do (`shouldBe` "1") =<< let x = 1 :: Int in [sh|echo -n '#{show x}'|] it "interpolates monadic expressions" do - (`shouldBe` "1") =<< let x = 1 :: Int in [sh|echo -n '#{pure @IO x}'|] + (`shouldBe` "1") =<< let x = 1 :: Int in [sh|echo -n '#{{pure @IO x}}'|] + it "interpolates monadic expressions" do + (`shouldBe` "1") =<< runReaderT [sh|echo -n '#{{asks fst}}'|] (1 :: Int, 2 :: Int) it "preserves argument order" do (`shouldBe` "1 2") =<< let x = "1"; y = "2" in [sh|echo -n '#{x}' '#{y}'|] describe "quoting" do -- cgit v1.2.3