1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
3module Optimize.Environment
8 , getTailCall, setTailCall
12import qualified Control.Monad.State as State
13import qualified Data.Text as Text
14import Data.Text (Text)
16import qualified AST.Module.Name as ModuleName
17import qualified Optimize.DecisionTree as DT
24run :: DT.VariantDict -> ModuleName.Canonical -> Optimizer a -> a
25run variantDict home optimizer =
26 State.evalState optimizer (Env False 0 variantDict home)
30 { _hasTailCall :: Bool
32 , _variantDict :: DT.VariantDict
33 , _home :: ModuleName.Canonical
37getVariantDict :: Optimizer DT.VariantDict
39 State.gets _variantDict
42getHome :: Optimizer ModuleName.Canonical
47getTailCall :: Optimizer Bool
49 State.gets _hasTailCall
52setTailCall :: Bool -> Optimizer ()
55 State.put (env { _hasTailCall = bool })
58freshName :: Optimizer Text
60 do (Env htc uid vd home) <- State.get
61 State.put (Env htc (uid + 1) vd home)
62 return (Text.append "_p" (Text.pack (show uid)))
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list