module Gradual.Types where


import qualified Language.Haskell.Liquid.UX.Config as C
import Language.Fixpoint.Types

import qualified Data.HashMap.Strict as M

data GConfig = GConfig {GConfig -> String
gtarget :: String, GConfig -> Int
depth :: Int, GConfig -> Int
pId :: Int, GConfig -> Int
pNumber :: Int}

defConfig :: GConfig
defConfig :: GConfig
defConfig = String -> Int -> Int -> Int -> GConfig
GConfig String
"" Int
0 Int
0 Int
0 

setPId :: GConfig -> Int -> GConfig
setPId :: GConfig -> Int -> GConfig
setPId GConfig
cfg Int
i = GConfig
cfg {pId :: Int
pId = Int
i}

makeGConfig :: C.Config -> GConfig
makeGConfig :: Config -> GConfig
makeGConfig Config
cfg = GConfig
defConfig {depth :: Int
depth = Config -> Int
C.gdepth Config
cfg, gtarget :: String
gtarget = [String] -> String
forall a. [a] -> a
head ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$ Config -> [String]
C.files Config
cfg}



type GSub a = M.HashMap KVar (a, Expr)
type GMap a = M.HashMap KVar (a, [Expr])
type GSpan  = M.HashMap KVar [(KVar, Maybe SrcSpan)] 

toGMap :: [(KVar, (a, [Expr]))] -> GMap a
toGMap :: [(KVar, (a, [Expr]))] -> GMap a
toGMap = [(KVar, (a, [Expr]))] -> GMap a
forall k v. (Eq k, Hashable k) => [(k, v)] -> HashMap k v
M.fromList 

fromGMap :: GMap a -> [(KVar, (a, [Expr]))]
fromGMap :: GMap a -> [(KVar, (a, [Expr]))]
fromGMap = GMap a -> [(KVar, (a, [Expr]))]
forall k v. HashMap k v -> [(k, v)]
M.toList


fromGSub :: GSub a -> [(KVar, (a, Expr))]
fromGSub :: GSub a -> [(KVar, (a, Expr))]
fromGSub = GSub a -> [(KVar, (a, Expr))]
forall k v. HashMap k v -> [(k, v)]
M.toList


removeInfo :: GMap a -> GMap ()
removeInfo :: GMap a -> GMap ()
removeInfo = ((a, [Expr]) -> ((), [Expr])) -> GMap a -> GMap ()
forall v1 v2 k. (v1 -> v2) -> HashMap k v1 -> HashMap k v2
M.map (\(a
_,[Expr]
x) -> ((),[Expr]
x))