-- A plugin that does nothing but tickle CoreM's writer.
plugin :: Plugin
plugin = defaultPlugin { installCoreToDos = install }
    where
        install :: [CommandLineOption] -> [CoreToDo] -> CoreM [CoreToDo]
        install _ todos = do
            reinitializeGlobals

            putMsgS "T7702Plugin"

            -- 1 million times, so the allocation in this plugin dominates allocation due
            -- to other compiler flags and the test framework can easily catch the difference
            -- can't use replicateM_ because it causes its own problems
            nothingX100000 ; nothingX100000 ; nothingX100000 ; nothingX100000 ; nothingX100000
            nothingX100000 ; nothingX100000 ; nothingX100000 ; nothingX100000 ; nothingX100000

            return todos

-- this will result in a call to plusWriter in CoreM's
-- >>= implementation, which was causing the space leak
plugin :: Plugin
plugin = defaultPlugin { installCoreToDos = install }
    where
        install :: [CommandLineOption] -> [CoreToDo] -> CoreM [CoreToDo]
        install _ todos = do
            reinitializeGlobals

            putMsgS "T7702Plugin"

            -- 1 million times, so the allocation in this plugin dominates allocation due
            -- to other compiler flags and the test framework can easily catch the difference
            -- can't use replicateM_ because it causes its own problems
            nothingX100000 ; nothingX100000 ; nothingX100000 ; nothingX100000 ; nothingX100000
            nothingX100000 ; nothingX100000 ; nothingX100000 ; nothingX100000 ; nothingX100000

            return todos

-- this will result in a call to plusWriter in CoreM's
-- >>= implementation, which was causing the space leak
plugin = defaultPlugin { installCoreToDos = install }
    where
        install :: [CommandLineOption] -> [CoreToDo] -> CoreM [CoreToDo]
        install _ todos = do
            reinitializeGlobals

            putMsgS "T7702Plugin"

            -- 1 million times, so the allocation in this plugin dominates allocation due
            -- to other compiler flags and the test framework can easily catch the difference
            -- can't use replicateM_ because it causes its own problems
            nothingX100000 ; nothingX100000 ; nothingX100000 ; nothingX100000 ; nothingX100000
            nothingX100000 ; nothingX100000 ; nothingX100000 ; nothingX100000 ; nothingX100000

            return todos

-- this will result in a call to plusWriter in CoreM's
-- >>= implementation, which was causing the space leak