Skip to content

Commit

Permalink
Move PlutusTx.Plugin:defer-errors into modules
Browse files Browse the repository at this point in the history
This is only needed for HLS to not choke on the plutus-tx plugin. As we
recently removed the hydra-development flag and enabled it on package
level, we moved this further "down" into each affected module and this
makes Haddock pick it up correctly.
  • Loading branch information
ch1bo committed Nov 6, 2023
1 parent 8fc75af commit 0a26696
Show file tree
Hide file tree
Showing 15 changed files with 9 additions and 29 deletions.
1 change: 0 additions & 1 deletion autotest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ FLAGS=$(echo "
-XViewPatterns
-fno-ignore-interface-pragmas
-fno-omit-interface-pragmas
-fplugin-opt PlutusTx.Plugin:defer-errors
-fobject-code
-Wall
-Wcompat
Expand Down
9 changes: 0 additions & 9 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@ package *
tests: True
benchmarks: True

package hydra-plutus
haddock-options: "--optghc=-fplugin-opt PlutusTx.Plugin:defer-errors"

package plutus-cbor
haddock-options: "--optghc=-fplugin-opt PlutusTx.Plugin:defer-errors"

package plutus-merkle-tree
haddock-options: "--optghc=-fplugin-opt PlutusTx.Plugin:defer-errors"

-- Fix compilation of strict-containers (see also nix/hydra/project.nix)
package strict-containers
ghc-options: "-Wno-noncanonical-monad-instances"
Expand Down
2 changes: 0 additions & 2 deletions hydra-node/hydra-node.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,6 @@ benchmark tx-cost

ghc-options: -threaded -rtsopts

ghc-options: -fplugin-opt PlutusTx.Plugin:defer-errors

benchmark micro
import: project-config
hs-source-dirs: bench/micro-bench
Expand Down
2 changes: 2 additions & 0 deletions hydra-plutus-extras/src/Hydra/Plutus/Extras.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# OPTIONS_GHC -fno-specialize #-}

module Hydra.Plutus.Extras (
module Hydra.Plutus.Extras,
module Hydra.Plutus.Extras.Time,
Expand Down
2 changes: 0 additions & 2 deletions hydra-plutus/hydra-plutus.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ library
, template-haskell
, time

ghc-options: -fplugin-opt PlutusTx.Plugin:defer-errors

test-suite tests
import: project-config
ghc-options: -threaded -rtsopts -with-rtsopts=-N
Expand Down
1 change: 1 addition & 0 deletions hydra-plutus/src/Hydra/Contract/Commit.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-specialize #-}
{-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:defer-errors #-}
-- Avoid trace calls to be optimized away when inlining functions.
{-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:no-simplifier-inline #-}
-- Plutus core version to compile to. In babbage era, that is Cardano protocol
Expand Down
1 change: 1 addition & 0 deletions hydra-plutus/src/Hydra/Contract/Hash.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-specialize #-}
{-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:defer-errors #-}
-- Plutus core version to compile to. In babbage era, that is Cardano protocol
-- version 7 and 8, only plutus-core version 1.0.0 is available.
{-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:target-version=1.0.0 #-}
Expand Down
1 change: 1 addition & 0 deletions hydra-plutus/src/Hydra/Contract/Head.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-specialize #-}
{-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:defer-errors #-}
-- Avoid trace calls to be optimized away when inlining functions.
{-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:no-simplifier-inline #-}
-- Plutus core version to compile to. In babbage era, that is Cardano protocol
Expand Down
1 change: 1 addition & 0 deletions hydra-plutus/src/Hydra/Contract/HeadTokens.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-specialize #-}
{-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:defer-errors #-}
-- Avoid trace calls to be optimized away when inlining functions.
{-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:no-simplifier-inline #-}
-- Plutus core version to compile to. In babbage era, that is Cardano protocol
Expand Down
1 change: 1 addition & 0 deletions hydra-plutus/src/Hydra/Contract/Initial.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-specialize #-}
{-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:defer-errors #-}
-- Avoid trace calls to be optimized away when inlining functions.
{-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:no-simplifier-inline #-}
-- Plutus core version to compile to. In babbage era, that is Cardano protocol
Expand Down
9 changes: 0 additions & 9 deletions nix/hydra/project.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,13 @@ let

modules = [{
packages = {

# Strip debugging symbols from exes (smaller closures)
hydra-node.dontStrip = false;
hydra-tui.dontStrip = false;
hydraw.dontStrip = false;

# Avoid plutus-tx errors in haddock (see also cabal.project)
hydra-plutus.setupHaddockFlags = [ "--ghc-options='-fplugin-opt PlutusTx.Plugin:defer-errors'" ];

plutus-merkle-tree.setupHaddockFlags = [ "--ghc-options='-fplugin-opt PlutusTx.Plugin:defer-errors'" ];
plutus-cbor.setupHaddockFlags = [ "--ghc-options='-fplugin-opt PlutusTx.Plugin:defer-errors'" ];

# Fix compliation of strict-containers (see also cabal.project)
strict-containers.ghcOptions = [ "-Wno-noncanonical-monad-instances" ];

# XXX: Could not figure out where to make this flag ^^^ effective in the haddock build
strict-containers.doHaddock = false;

Expand All @@ -86,7 +78,6 @@ let
hydraw.ghcOptions = [ "-Werror" ];
plutus-cbor.ghcOptions = [ "-Werror" ];
plutus-merkle-tree.ghcOptions = [ "-Werror" ];

};
}
({ lib, config, ... }:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-specialize #-}
{-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:defer-errors #-}
-- Plutus core version to compile to. Cardano protocol version 8 is only
-- supporting plutus-core version 1.0.0.
{-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:target-version=1.0.0 #-}
Expand Down
2 changes: 0 additions & 2 deletions plutus-cbor/plutus-cbor.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,4 @@ executable encoding-cost
, QuickCheck
, scientific

ghc-options: -fplugin-opt PlutusTx.Plugin:defer-errors

ghc-options: -threaded -rtsopts
1 change: 1 addition & 0 deletions plutus-merkle-tree/bench/Validators.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-specialize #-}
{-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:defer-errors #-}
-- Plutus core version to compile to. Cardano protocol version 8 is only
-- supporting plutus-core version 1.0.0.
{-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:target-version=1.0.0 #-}
Expand Down
4 changes: 0 additions & 4 deletions plutus-merkle-tree/plutus-merkle-tree.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ library
, plutus-tx
, text

ghc-options: -fplugin-opt PlutusTx.Plugin:defer-errors

test-suite tests
import: project-config
type: exitcode-stdio-1.0
Expand Down Expand Up @@ -92,5 +90,3 @@ benchmark on-chain-cost
, plutus-tx
, plutus-tx-plugin
, QuickCheck

ghc-options: -fplugin-opt PlutusTx.Plugin:defer-errors

0 comments on commit 0a26696

Please sign in to comment.