Commit 2e2ed023 authored by Björn Peemöller 's avatar Björn Peemöller
Browse files

Removed redundant constraints to satisfy GHC 8.0

parent aa4329ae
......@@ -24,7 +24,7 @@ data ScopeEnv a b = ScopeEnv Level (LevelMap a b) [LevelMap a b]
deriving Show
-- |Returns an empty scope environment
new :: Ord a => ScopeEnv a b
new :: ScopeEnv a b
new = ScopeEnv 0 Map.empty []
-- |Inserts a value under a key into the environment of the current scope
......@@ -60,13 +60,13 @@ exists k = selectSE existsLev
-- Switches to the next scope (i.e. pushes the environment of the current
-- scope onto the top of an scope stack and increments the level counter)
beginScope :: Ord a => ScopeEnv a b -> ScopeEnv a b
beginScope :: ScopeEnv a b -> ScopeEnv a b
beginScope (ScopeEnv lev top [] ) = ScopeEnv (lev + 1) top [top]
beginScope (ScopeEnv lev top (l:ls)) = ScopeEnv (lev + 1) top (l:l:ls)
-- Switches to the previous scope (i.e. pops the environment from the top
-- of the scope stack and decrements the level counter)
endScope :: Ord a => ScopeEnv a b -> ScopeEnv a b
endScope :: ScopeEnv a b -> ScopeEnv a b
endScope (ScopeEnv _ top [] ) = ScopeEnv 0 top []
endScope (ScopeEnv lev top (_:ls)) = ScopeEnv (lev - 1) top ls
......@@ -81,13 +81,13 @@ endScopeUp (ScopeEnv lev top (l:l':ls)) = ScopeEnv (lev - 1) top
-- Return all (key, value) pairs from the environment of the current scope
-- which have been inserted in the current level
toLevelList :: Ord a => ScopeEnv a b -> [(a, b)]
toLevelList :: ScopeEnv a b -> [(a, b)]
toLevelList = selectSE toList
where toList lev local
= [ (k, v) | (k, (v, lev')) <- Map.toList local, lev' == lev ]
-- Return the current level
currentLevel :: Ord a => ScopeEnv a b -> Level
currentLevel :: ScopeEnv a b -> Level
currentLevel = selectSE const
-- ---------------------------------------------------------------------------
......
......@@ -29,11 +29,11 @@ data Subst a b = Subst Bool (Map.Map a b)
deriving Show
-- |Identity substitution
idSubst :: Ord a => Subst a b
idSubst :: Subst a b
idSubst = Subst False Map.empty
-- |Convert a substitution to a list of replacements
substToList :: Ord v => Subst v e -> [(v, e)]
substToList :: Subst v e -> [(v, e)]
substToList (Subst _ sigma) = Map.toList sigma
-- |Create a substitution for a single replacement
......@@ -88,7 +88,7 @@ unbindSubst v (Subst comp sigma) = Subst comp $ Map.delete v sigma
-- where subst' = if comp then subst (Subst comp sigma) else id
-- |Compose two substitutions
compose :: (Ord v, Show v ,Show e) => Subst v e -> Subst v e -> Subst v e
compose :: Ord v => Subst v e -> Subst v e -> Subst v e
compose sigma sigma' =
composed (foldr (uncurry bindSubst) sigma' (substToList sigma))
where composed (Subst _ sigma'') = Subst True sigma''
......
......@@ -78,7 +78,7 @@ emptyTopEnv :: TopEnv a
emptyTopEnv = TopEnv Map.empty
-- |Insert an 'Entity' into a 'TopEnv' as a predefined 'Entity'
predefTopEnv :: Entity a => QualIdent -> a -> TopEnv a -> TopEnv a
predefTopEnv :: QualIdent -> a -> TopEnv a -> TopEnv a
predefTopEnv k v (TopEnv env) = case Map.lookup k env of
Just _ -> internalError $ "TopEnv.predefTopEnv " ++ show k
Nothing -> TopEnv $ Map.insert k [(Import [], v)] env
......
......@@ -29,6 +29,7 @@ import Base.ScopeEnv (ScopeEnv)
import qualified Base.ScopeEnv as SE (new, insert, lookup, beginScope, endScope)
import Base.TopEnv (topEnvMap)
import Base.Types
import Base.Utils (concatMapM)
import Env.Interface
import Env.TypeConstructor (TCEnv, TypeInfo (..))
......@@ -182,9 +183,6 @@ trInterface (IL.Module mid imps decls) = do
(ifuncs ++ funcs) (iops ++ ops)
where extractMid (CS.IImportDecl _ mid1) = mid1
concatMapM :: (Functor m, Monad m) => (a -> m [b]) -> [a] -> m [b]
concatMapM act xs = concat <$> mapM act xs
trTypeDecl :: IL.Decl -> FlatState [TypeDecl]
trTypeDecl (IL.DataDecl qid arity cs) = ((:[]) <$>) $
Type <$> trTypeIdent qid
......
......@@ -357,7 +357,7 @@ writeAbstractCurry opts (env, mdl) = do
type Dump = (DumpLevel, CompilerEnv, String)
dumpWith :: (MonadIO m, Show a)
dumpWith :: MonadIO m
=> Options -> (a -> String) -> (a -> Doc) -> DumpLevel
-> CompEnv a -> m (CompEnv a)
dumpWith opts rawView view lvl res@(env, mdl) = do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment