@@ -1,6 +1,23 @@
1{-# OPTIONS_GHC -Wall #-}
1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
2{-# LANGUAGE OverloadedStrings #-}
3−module Type.Type where
3+module Type.Type
5import Control.Monad (when)
22import Control.Monad (when)
6import Control.Monad.State.Strict (StateT, liftIO)
23import Control.Monad.State.Strict (StateT, liftIO)
@@ -13,9 +30,6 @@ import Data.Text (Text)
14import qualified AST.Type as T
31import qualified AST.Type as T
15import qualified AST.Variable as Var
32import qualified AST.Variable as Var
16−import qualified Reporting.Annotation as A
17−import qualified Reporting.Error.Type as Error
18−import qualified Reporting.Region as R
19import qualified Type.UnionFind as UF
33import qualified Type.UnionFind as UF
@@ -104,31 +118,6 @@ getVarNamesMark =
113− | CEqual Error.Hint R.Region Type Type
115− | CLet [Scheme] Constraint
116− | CInstance R.Region SchemeName Type
119−type SchemeName = Text
124− { _rigidQuantifiers :: [Variable]
125− , _flexibleQuantifiers :: [Variable]
126− , _constraint :: Constraint
127− , _header :: Map.Map Text (A.Located Type)
132-- TYPE HELPERS
121-- TYPE HELPERS
@@ -181,49 +170,6 @@ toSuper name =
184−-- CONSTRAINT HELPERS
187−monoscheme :: Map.Map Text (A.Located Type) -> Scheme
189− Scheme [] [] CTrue headers
195−(/\) :: Constraint -> Constraint -> Constraint
203−-- ex qs constraint == exists qs. constraint
204−ex :: [Variable] -> Constraint -> Constraint
206− CLet [Scheme [] fqs constraint Map.empty] CTrue
209−forall :: [Variable] -> Constraint -> Constraint
210−forall rqs constraint =
211− CLet [Scheme rqs [] constraint Map.empty] CTrue
214−exists :: (Type -> IO Constraint) -> IO Constraint
216− do v <- mkVar Nothing
217− ex [v] <$> f (VarN v)
220−existsNumber :: (Type -> IO Constraint) -> IO Constraint
222− do v <- mkVar (Just Number)
223− ex [v] <$> f (VarN v)
227-- CONVERT TO SOURCE TYPES
173-- CONVERT TO SOURCE TYPES