summaryrefslogtreecommitdiff
path: root/compiler/simplCore/CoreMonad.hs-boot
blob: 206675e5e2b11563921a545547c28698ad7b71c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
-- Created this hs-boot file to remove circular dependencies from the use of
-- Plugins. Plugins needs CoreToDo and CoreM types to define core-to-core
-- transformations.
-- However CoreMonad does much more than defining these, and because Plugins are
-- activated in various modules, the imports become circular. To solve this I
-- extracted CoreToDo and CoreM into this file.
-- I needed to write the whole definition of these types, otherwise it created
-- a data-newtype conflict.

module CoreMonad ( CoreToDo, CoreM ) where

import GhcPrelude

import IOEnv ( IOEnv )
import UniqSupply ( UniqSupply )

newtype CoreState = CoreState {
        cs_uniq_supply :: UniqSupply
}

type CoreIOEnv = IOEnv CoreReader

data CoreReader

newtype CoreWriter = CoreWriter {
        cw_simpl_count :: SimplCount
}

data SimplCount

newtype CoreM a
          = CoreM { unCoreM :: CoreState
                                 -> CoreIOEnv (a, CoreState, CoreWriter) }

instance Monad CoreM

data CoreToDo