about summary refs log tree commit diff
path: root/third_party/bazel/rules_haskell/tests/binary-with-plugin/Plugin.hs
blob: 3827bb799215892c3d38f2fce894006013f75954 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module Plugin (plugin) where

import Control.Monad (when)
import GhcPlugins
import System.Process (readProcess)

plugin :: Plugin
plugin = defaultPlugin { installCoreToDos = install }

install :: [CommandLineOption] -> [CoreToDo] -> CoreM [CoreToDo]
install [arg] todo = do
  when ('$' `elem` arg) $
    fail "Make variable not expanded."
  _ <- liftIO $ readProcess arg [] ""
  return todo