diff --git a/.ci/stack-8.10.7.yaml b/.ci/stack-8.10.7.yaml index 38c1d99ce2..7e2e22dce6 100644 --- a/.ci/stack-8.10.7.yaml +++ b/.ci/stack-8.10.7.yaml @@ -16,3 +16,4 @@ extra-deps: - doctest-parallel-0.2.1@sha256:c6c0d095dd6e0b8ce1bd9f6f5fc4e0cf5cf50b6895b557356ac41b8aa2947399,5631 - fakedata-1.0.2@sha256:37c93be9a81acbc9109e2c0b300a793d9c1f5ead1d34330d869d76568191f428,24593 - docopt-0.7.0.7@sha256:a3d2eac54cd77d8c0b306ff96fb57be55542f143d81766aa1ae51458ad790dbe,3655 +- prettyprinter-interp-0.2.0.0@sha256:45299b61bd6c27d594c1a72b5a8dd5734e791a59828725e4f4e420f3cc37232b,2016 diff --git a/.ci/stack-8.6.5.yaml b/.ci/stack-8.6.5.yaml index 9a2bf41a08..c8ced52053 100644 --- a/.ci/stack-8.6.5.yaml +++ b/.ci/stack-8.6.5.yaml @@ -28,3 +28,4 @@ extra-deps: - regex-tdfa-1.3.1.2@sha256:9bafdeace4742f553d22a3da008081ac09009b3b52d38a53ad76795dfd3f180a,6572 - regex-base-0.94.0.2@sha256:4ff4425c710cddf440dfbac6cd52310bb6b23e17902390ff71c9fc7eaafc4fcc,2643 - string-interpolate-0.3.1.2@sha256:4d0987f453c66040aa8e482fe28a7d3cdc9d8df01b698bc92f42a592cfb337db,4268 +- prettyprinter-interp-0.2.0.0@sha256:45299b61bd6c27d594c1a72b5a8dd5734e791a59828725e4f4e420f3cc37232b,2016 diff --git a/.ci/stack-8.8.4.yaml b/.ci/stack-8.8.4.yaml index e5366eecd4..8347f1a1dd 100644 --- a/.ci/stack-8.8.4.yaml +++ b/.ci/stack-8.8.4.yaml @@ -23,3 +23,4 @@ extra-deps: - lazysmallcheck-0.6@sha256:dac7a1e4877681f1260309e863e896674dd6efc1159897b7945893e693f2a6bc,1696 - docopt-0.7.0.7@sha256:a3d2eac54cd77d8c0b306ff96fb57be55542f143d81766aa1ae51458ad790dbe,3655 - string-interpolate-0.3.1.2@sha256:4d0987f453c66040aa8e482fe28a7d3cdc9d8df01b698bc92f42a592cfb337db,4268 +- prettyprinter-interp-0.2.0.0@sha256:45299b61bd6c27d594c1a72b5a8dd5734e791a59828725e4f4e420f3cc37232b,2016 diff --git a/.ci/stack-9.0.2.yaml b/.ci/stack-9.0.2.yaml index ad3dee1728..46713dd428 100644 --- a/.ci/stack-9.0.2.yaml +++ b/.ci/stack-9.0.2.yaml @@ -11,3 +11,6 @@ packages: - clash-ghc - clash-cores - tests + +extra-deps: +- prettyprinter-interp-0.2.0.0@sha256:45299b61bd6c27d594c1a72b5a8dd5734e791a59828725e4f4e420f3cc37232b,2016 diff --git a/.ci/stack-9.2.4.yaml b/.ci/stack-9.2.4.yaml index b8f529c8b3..242ffe566e 100644 --- a/.ci/stack-9.2.4.yaml +++ b/.ci/stack-9.2.4.yaml @@ -15,3 +15,4 @@ packages: extra-deps: - concurrent-supply-0.1.8@sha256:9373f4868ad28936a7b93781b214ef4afdeacf377ef4ac729583073491c9f9fb,1627 - hashable-1.3.5.0@sha256:3a2beeafb220f9de706568a7e4a5b3c762cc4c9f25c94d7ef795b8c2d6a691d7,4240 +- prettyprinter-interp-0.2.0.0@sha256:45299b61bd6c27d594c1a72b5a8dd5734e791a59828725e4f4e420f3cc37232b,2016 diff --git a/cabal.project b/cabal.project index 0de0d3fcf8..f7355aa552 100644 --- a/cabal.project +++ b/cabal.project @@ -16,7 +16,7 @@ write-ghc-environment-files: always -- index state, to go along with the cabal.project.freeze file. update the index -- state by running `cabal update` twice and looking at the index state it -- displays to you (as the second update will be a no-op) -index-state: 2022-12-23T12:46:44Z +index-state: 2023-02-25T00:27:36Z -- For some reason the `clash-testsuite` executable fails to run without -- this, as it cannot find the related library... diff --git a/clash-cores/clash-cores.cabal b/clash-cores/clash-cores.cabal index b3b7724b49..cfd856b297 100644 --- a/clash-cores/clash-cores.cabal +++ b/clash-cores/clash-cores.cabal @@ -111,6 +111,7 @@ library clash-lib, mtl >= 2.1.1 && < 2.3, prettyprinter >= 1.2.0.1 && < 1.8, + prettyprinter-interp ^>= 0.2, reducers >= 3.12.2 && < 4.0, text >= 1.2.2 && < 1.3 diff --git a/clash-cores/src/Clash/Cores/Xilinx/Floating/BlackBoxes.hs b/clash-cores/src/Clash/Cores/Xilinx/Floating/BlackBoxes.hs index d073e963b1..7e4eace4a0 100644 --- a/clash-cores/src/Clash/Cores/Xilinx/Floating/BlackBoxes.hs +++ b/clash-cores/src/Clash/Cores/Xilinx/Floating/BlackBoxes.hs @@ -24,7 +24,7 @@ import Prelude import Control.Monad.State (State) import Data.Maybe (isJust, fromJust) import Data.String (fromString, IsString) -import Data.String.Interpolate (i, __i) +import Prettyprinter.Interpolate (di, __di) import Clash.Backend (Backend) import Clash.Netlist.Types @@ -152,7 +152,7 @@ tclTemplate (HasCustom {..}) operType bbCtx prop (True, name, value) s = replicate 29 ' ' ++ name ++ ' ': value ++ " \\\n" ++ s - bbText = [i|namespace eval $tclIface { + bbText = [di|namespace eval $tclIface { variable api 1 variable scriptPurpose createIp variable ipName {#{compName}} @@ -193,7 +193,7 @@ fromUTclTemplate bbCtx (DataCon _ _ [Literal Nothing (BoolLit True)], _, _) -> "false" _ -> "true" - bbText = [__i| + bbText = [__di| namespace eval $tclIface { variable api 1 variable scriptPurpose createIp @@ -245,7 +245,7 @@ fromSTclTemplate bbCtx (DataCon _ _ [Literal Nothing (BoolLit True)], _, _) -> "false" _ -> "true" - bbText = [__i| + bbText = [__di| namespace eval $tclIface { variable api 1 variable scriptPurpose createIp @@ -296,7 +296,7 @@ compareTclTemplate bbCtx (DataCon _ _ [Literal Nothing (BoolLit True)], _, _) -> "false" _ -> "true" - bbText = [__i| + bbText = [__di| namespace eval $tclIface { variable api 1 variable scriptPurpose createIp diff --git a/clash-cores/src/Clash/Cores/Xilinx/Internal.hs b/clash-cores/src/Clash/Cores/Xilinx/Internal.hs index fdc1b12dde..1cd5ff5428 100644 --- a/clash-cores/src/Clash/Cores/Xilinx/Internal.hs +++ b/clash-cores/src/Clash/Cores/Xilinx/Internal.hs @@ -16,7 +16,6 @@ module Clash.Cores.Xilinx.Internal where import Prelude import Data.Maybe (catMaybes) -import Data.String.Interpolate (i, __i) import Data.Text (Text) import qualified Data.Text as Text #if MIN_VERSION_prettyprinter(1,7,0) @@ -29,6 +28,8 @@ import Data.Text.Prettyprint.Doc import Data.Text.Prettyprint.Doc.Extra (Doc) import GHC.Natural (Natural) import GHC.Stack (HasCallStack) +import Prettyprinter.Interpolate (di, __di) + import Clash.Netlist.Types (IdentifierText) type PropName = Text @@ -166,7 +167,7 @@ renderTcl = \case indent 2 "variable scriptPurpose multipleScripts" <> line <> rbrace <> line <> vsep ms where - rootSnippet = [__i| + rootSnippet = [__di| namespace eval $tclIface { variable api 1 |] @@ -176,7 +177,7 @@ renderTcl = \case indent 2 "return" <> line <> rbrace where -- \& is needed to prevent CPP from joining lines :-( - ipSnippet = [__i| + ipSnippet = [__di| variable scriptPurpose createIp variable ipName {#{moduleName}} proc createIp {ipName0 args} { @@ -208,5 +209,5 @@ renderTcl = \case ] renderMulti n p = - line <> [i|namespace eval ${tclIface}::multipleScripts::script#{n} {|] <> + line <> [di|namespace eval ${tclIface}::multipleScripts::script#{n} {|] <> line <> indent 2 (renderOne p) <> line <> rbrace diff --git a/clash-lib/clash-lib.cabal b/clash-lib/clash-lib.cabal index 9a1639a641..23d82cdf65 100644 --- a/clash-lib/clash-lib.cabal +++ b/clash-lib/clash-lib.cabal @@ -165,6 +165,7 @@ Library mtl >= 2.1.2 && < 2.3, ordered-containers >= 0.2 && < 0.3, prettyprinter >= 1.2.0.1 && < 1.8, + prettyprinter-interp ^>= 0.2, pretty-show >= 1.9 && < 2.0, primitive >= 0.5.0.1 && < 1.0, template-haskell >= 2.8.0.0 && < 2.19, diff --git a/clash-lib/src/Clash/Primitives/Intel/ClockGen.hs b/clash-lib/src/Clash/Primitives/Intel/ClockGen.hs index b14c261ca7..b4e0bdfca1 100644 --- a/clash-lib/src/Clash/Primitives/Intel/ClockGen.hs +++ b/clash-lib/src/Clash/Primitives/Intel/ClockGen.hs @@ -25,6 +25,7 @@ import Control.Monad.State import Data.Monoid (Ap(getAp)) import qualified Data.String.Interpolate as I import Data.Text.Prettyprint.Doc.Extra +import qualified Prettyprinter.Interpolate as I import qualified Data.Text as TextS import Data.Text.Extra (showt) @@ -176,7 +177,7 @@ altpllQsysTemplate bbCtx = case bbInputs bbCtx of -- "altpll" IP. Module parameters were then stripped on a trial-and-error -- basis to get a template that has the minimal number of parameters, but -- still has the desired, working, configuration. - bbText = [I.__i| + bbText = [I.__di| //archive/.tar.gz" }, "ghc-tcplugins-extra": { @@ -17,10 +17,10 @@ "homepage": null, "owner": "clash-lang", "repo": "ghc-tcplugins-extra", - "rev": "631facf6160f87e481c25ea76094c8a01d85f990", - "sha256": "0mhf86japnxrqahlj68w4s12lss637pi3xyysvaz0xrf4yr1wa1m", + "rev": "c2007b347c9cff4637709907010d309f68401f2a", + "sha256": "0q7c8kk58sg1xazcrmjch1h655jx2canrnfj7npinmm853rnnm8c", "type": "tarball", - "url": "https://github.com/clash-lang/ghc-tcplugins-extra/archive/631facf6160f87e481c25ea76094c8a01d85f990.tar.gz", + "url": "https://github.com/clash-lang/ghc-tcplugins-extra/archive/c2007b347c9cff4637709907010d309f68401f2a.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "ghc-typelits-extra": { @@ -29,10 +29,10 @@ "homepage": null, "owner": "clash-lang", "repo": "ghc-typelits-extra", - "rev": "fe80881503c8ba80c86f17fbdaf481dcd1304d44", - "sha256": "1vg9kj34iyjdbmvs71nr3jh11r963an1c8vcx4j1zr3w8h3sbjkj", + "rev": "d4a66e64944b7ab84d18450f2c9130a36e2c5917", + "sha256": "091kvzlpzhy6l0qcsk6gwksnlg53272xnzag1r1xxl825my6hcav", "type": "tarball", - "url": "https://github.com/clash-lang/ghc-typelits-extra/archive/fe80881503c8ba80c86f17fbdaf481dcd1304d44.tar.gz", + "url": "https://github.com/clash-lang/ghc-typelits-extra/archive/d4a66e64944b7ab84d18450f2c9130a36e2c5917.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "ghc-typelits-knownnat": { @@ -41,10 +41,10 @@ "homepage": null, "owner": "clash-lang", "repo": "ghc-typelits-knownnat", - "rev": "fb94131ac8beaf6167fc2cc5f94602cc881950df", - "sha256": "1mknsldr99qp4494vxqdjw0v97mzjhsmi3mfcp0h5qbdv11z1qhc", + "rev": "0cf1cc089db84431ecb54b5bfc6171375f1f6ec4", + "sha256": "0q13vh6d5l2nnhack47kfgkykb3x8lbsanpcd6158g5fbhjqvrlf", "type": "tarball", - "url": "https://github.com/clash-lang/ghc-typelits-knownnat/archive/fb94131ac8beaf6167fc2cc5f94602cc881950df.tar.gz", + "url": "https://github.com/clash-lang/ghc-typelits-knownnat/archive/0cf1cc089db84431ecb54b5bfc6171375f1f6ec4.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "ghc-typelits-natnormalise": { @@ -53,10 +53,10 @@ "homepage": null, "owner": "clash-lang", "repo": "ghc-typelits-natnormalise", - "rev": "48c69dfe3e7c523b1e5268008571fd17d89d2d58", - "sha256": "0r0ky6fcwpabj2kdb8yb8h4731vc06qz3gf89c44mjc042pnmd5q", + "rev": "f089f6bd91af2038cdc5b60f28d10bc8d1079a23", + "sha256": "18kc71gasmpqic0lxwhsian1j3a0i2zlbm09hhfi258ih9bi7dq8", "type": "tarball", - "url": "https://github.com/clash-lang/ghc-typelits-natnormalise/archive/48c69dfe3e7c523b1e5268008571fd17d89d2d58.tar.gz", + "url": "https://github.com/clash-lang/ghc-typelits-natnormalise/archive/f089f6bd91af2038cdc5b60f28d10bc8d1079a23.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "gitignore": { @@ -77,10 +77,10 @@ "homepage": "https://github.com/nmattia/niv", "owner": "nmattia", "repo": "niv", - "rev": "82e5cd1ad3c387863f0545d7591512e76ab0fc41", - "sha256": "090l219mzc0gi33i3psgph6s2pwsc8qy4lyrqjdj4qzkvmaj65a7", + "rev": "689d0e5539eddd0b0f566aee7bb18629eee7df74", + "sha256": "1rld3lk42l6b01f2gcrhq8qm9vry1awmfl29zmpiqda9dy89vbx0", "type": "tarball", - "url": "https://github.com/nmattia/niv/archive/82e5cd1ad3c387863f0545d7591512e76ab0fc41.tar.gz", + "url": "https://github.com/nmattia/niv/archive/689d0e5539eddd0b0f566aee7bb18629eee7df74.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "nixpkgs": { @@ -89,10 +89,22 @@ "homepage": null, "owner": "NixOS", "repo": "nixpkgs", - "rev": "3321eea12a97a31a04b419108564ca1b8cca193c", - "sha256": "12pil3zaq7ap9q9782zqxgbr1b8mwlnc0mwlbh0paacbgkgc3sbf", + "rev": "0874168639713f547c05947c76124f78441ea46c", + "sha256": "0gw5l5bj3zcgxhp7ki1jafy6sl5nk4vr43hal94lhi15kg2vfmfy", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/3321eea12a97a31a04b419108564ca1b8cca193c.tar.gz", + "url": "https://github.com/NixOS/nixpkgs/archive/0874168639713f547c05947c76124f78441ea46c.tar.gz", + "url_template": "https://github.com///archive/.tar.gz" + }, + "prettyprinter-interp": { + "branch": "main", + "description": "Efficient interpolation for Prettyprinter", + "homepage": null, + "owner": "DigitalBrains1", + "repo": "prettyprinter-interp", + "rev": "0a4056f3f22ca5c3baa28fa1ec3d1d0d9b6802dd", + "sha256": "0krn2bjdj01rxz1613w9qnhfdgr05r14hdf1rfg93qgfrnac9y2k", + "type": "tarball", + "url": "https://github.com/DigitalBrains1/prettyprinter-interp/archive/0a4056f3f22ca5c3baa28fa1ec3d1d0d9b6802dd.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "tasty-hedgehog": { diff --git a/stack.yaml b/stack.yaml index fe0f98dfc7..aa719a345c 100644 --- a/stack.yaml +++ b/stack.yaml @@ -12,3 +12,4 @@ packages: extra-deps: - ./clash-cosim +- prettyprinter-interp-0.2.0.0@sha256:45299b61bd6c27d594c1a72b5a8dd5734e791a59828725e4f4e420f3cc37232b,2016