Skip to content

Commit d38f8f0

Browse files
committed
wip
1 parent 227c147 commit d38f8f0

File tree

5 files changed

+64
-0
lines changed

5 files changed

+64
-0
lines changed

cabal.project

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ packages: cardano-constitution
2727
plutus-metatheory
2828
plutus-tx
2929
plutus-tx-plugin
30+
plutus-profiled-plugin-test
3031
doc/docusaurus/docusaurus-examples.cabal
3132

3233
-- We never, ever, want this.

nix/shell.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ let
159159
quick-shell = project.projectVariants.${ghc}.shellFor {
160160
name = "plutus-shell-${ghc}";
161161
tools = { cabal = "latest"; };
162+
buildInputs = [
163+
pkgs.git
164+
];
162165
withHoogle = false;
163166
shellHook = ''
164167
${locale-archive-hook}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{-# OPTIONS_GHC -fplugin=SimplePlugin #-}
2+
3+
module Main where
4+
5+
import Control.Concurrent
6+
7+
main :: IO ()
8+
main = do
9+
let getBool = do
10+
threadDelay 1000000
11+
return False
12+
b <-
13+
{-# SCC "YYYYYYYYYYYYYY" #-}
14+
getBool
15+
putStrLn ("I got a bool from the main module -> " ++ show b)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
cabal-version: 3.0
2+
name: plutus-profiled-plugin-test
3+
version: 0.1.0.0
4+
build-type: Simple
5+
synopsis: Minimal GHC plugin and test executable
6+
category: Development
7+
8+
library
9+
hs-source-dirs: src
10+
exposed-modules: SimplePlugin
11+
build-depends:
12+
, base >=4.9 && <5
13+
, ghc
14+
15+
default-language: Haskell2010
16+
17+
executable simple-plugin-test
18+
main-is: Main.hs
19+
hs-source-dirs: app
20+
ghc-options: -threaded -rtsopts -with-rtsopts=-N
21+
build-depends:
22+
, base >=4.9 && <5
23+
, plutus-profiled-plugin-test
24+
25+
default-language: Haskell2010
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module SimplePlugin (plugin) where
2+
3+
import Control.Concurrent
4+
import GHC.Plugins
5+
6+
-- | A very simple GHC plugin that just logs a message during compilation.
7+
plugin :: Plugin
8+
plugin =
9+
defaultPlugin
10+
{ installCoreToDos = \_ todos -> do
11+
let getBool = do
12+
liftIO $ threadDelay 1000000
13+
return True
14+
b <-
15+
{-# SCC "XXXXXXXXXXXXXX" #-}
16+
getBool
17+
putMsgS ("I got a bool from the plugin -> " ++ show b)
18+
pure todos
19+
, pluginRecompile = purePlugin
20+
}

0 commit comments

Comments
 (0)