git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Use monad-unify 0.2.0
4cbe6e3Phil Freeman
purescript.cabal+1−1
@@ -1,5 +1,5 @@
1name: purescript
1name: purescript
2−version: 0.3.8
2+version: 0.3.8.1
3cabal-version: >=1.8
3cabal-version: >=1.8
4build-type: Simple
4build-type: Simple
5license: MIT
5license: MIT
src/Language/PureScript/Kinds.hs+2−2
@@ -18,7 +18,7 @@ module Language.PureScript.Kinds where
18
18
19import Data.Data
19import Data.Data
20
20
21−import Control.Monad.Unify (TypedUnknown(..))
21+import Control.Monad.Unify (Unknown)
22
22
23-- |
23-- |
24-- The data type of kinds
24-- The data type of kinds
@@ -27,7 +27,7 @@ data Kind
27 -- |
27 -- |
28 -- Unification variable of type Kind
28 -- Unification variable of type Kind
29 --
29 --
30− = KUnknown (TypedUnknown Kind)
30+ = KUnknown Unknown
31 -- |
31 -- |
32 -- The kind of types
32 -- The kind of types
33 --
33 --
src/Language/PureScript/Pretty/Kinds.hs+1−1
@@ -31,7 +31,7 @@ typeLiterals = mkPattern match
31 where
31 where
32 match Star = Just "*"
32 match Star = Just "*"
33 match Bang = Just "!"
33 match Bang = Just "!"
34− match (KUnknown (TypedUnknown (Unknown u))) = Just $ 'u' : show u
34+ match (KUnknown (Unknown u)) = Just $ 'u' : show u
35 match _ = Nothing
35 match _ = Nothing
36
36
37matchRow :: Pattern () Kind ((), Kind)
37matchRow :: Pattern () Kind ((), Kind)
src/Language/PureScript/Pretty/Types.hs+2−2
@@ -35,7 +35,7 @@ typeLiterals = mkPattern match
35 match (TypeVar var) = Just var
35 match (TypeVar var) = Just var
36 match (TypeApp arr ty) | arr == tyArray = Just $ "[" ++ prettyPrintType ty ++ "]"
36 match (TypeApp arr ty) | arr == tyArray = Just $ "[" ++ prettyPrintType ty ++ "]"
37 match (TypeConstructor ctor) = Just $ show ctor
37 match (TypeConstructor ctor) = Just $ show ctor
38− match (TUnknown (TypedUnknown (Unknown u))) = Just $ 'u' : show u
38+ match (TUnknown (Unknown u)) = Just $ 'u' : show u
39 match (Skolem s) = Just $ 's' : show s
39 match (Skolem s) = Just $ 's' : show s
40 match (ConstrainedType deps ty) = Just $ "(" ++ intercalate "," (map (\(pn, ty') -> show pn ++ " (" ++ prettyPrintType ty' ++ ")") deps) ++ ") => " ++ prettyPrintType ty
40 match (ConstrainedType deps ty) = Just $ "(" ++ intercalate "," (map (\(pn, ty') -> show pn ++ " (" ++ prettyPrintType ty' ++ ")") deps) ++ ") => " ++ prettyPrintType ty
41 match (SaturatedTypeSynonym name args) = Just $ show name ++ "<" ++ intercalate "," (map prettyPrintType args) ++ ">"
41 match (SaturatedTypeSynonym name args) = Just $ show name ++ "<" ++ intercalate "," (map prettyPrintType args) ++ ">"
@@ -54,7 +54,7 @@ prettyPrintRow = (\(tys, rest) -> intercalate ", " (map (uncurry nameAndTypeToPs
54 nameAndTypeToPs name ty = name ++ " :: " ++ prettyPrintType ty
54 nameAndTypeToPs name ty = name ++ " :: " ++ prettyPrintType ty
55 tailToPs :: Type -> String
55 tailToPs :: Type -> String
56 tailToPs REmpty = ""
56 tailToPs REmpty = ""
57− tailToPs (TUnknown (TypedUnknown (Unknown u))) = " | u" ++ show u
57+ tailToPs (TUnknown (Unknown u)) = " | u" ++ show u
58 tailToPs (TypeVar var) = " | " ++ var
58 tailToPs (TypeVar var) = " | " ++ var
59 tailToPs (Skolem s) = " | s" ++ show s
59 tailToPs (Skolem s) = " | s" ++ show s
60 tailToPs _ = error "Invalid row tail"
60 tailToPs _ = error "Invalid row tail"
src/Language/PureScript/TypeChecker/Kinds.hs+28−22
@@ -38,37 +38,43 @@ import Control.Applicative
38
38
39import qualified Data.Map as M
39import qualified Data.Map as M
40
40
41−instance Unifiable Check Kind where
41+instance Partial Kind where
42 unknown = KUnknown
42 unknown = KUnknown
43 isUnknown (KUnknown u) = Just u
43 isUnknown (KUnknown u) = Just u
44 isUnknown _ = Nothing
44 isUnknown _ = Nothing
45+
46+instance Unifiable Check Kind where
45− KUnknown u1 ?= KUnknown u2 | u1 == u2 = return ()
47+ KUnknown u1 =?= KUnknown u2 | u1 == u2 = return ()
46− KUnknown u ?= k = replace u k
48+ KUnknown u =?= k = u =:= k
47− k ?= KUnknown u = replace u k
49+ k =?= KUnknown u = u =:= k
48− Star ?= Star = return ()
50+ Star =?= Star = return ()
49− Bang ?= Bang = return ()
51+ Bang =?= Bang = return ()
50− Row k1 ?= Row k2 = k1 ?= k2
52+ Row k1 =?= Row k2 = k1 =?= k2
51− FunKind k1 k2 ?= FunKind k3 k4 = do
53+ FunKind k1 k2 =?= FunKind k3 k4 = do
52− k1 ?= k3
54+ k1 =?= k3
53− k2 ?= k4
55+ k2 =?= k4
54− k1 ?= k2 = UnifyT . lift . throwError $ "Cannot unify " ++ prettyPrintKind k1 ++ " with " ++ prettyPrintKind k2 ++ "."
56+ k1 =?= k2 = UnifyT . lift . throwError $ "Cannot unify " ++ prettyPrintKind k1 ++ " with " ++ prettyPrintKind k2 ++ "."
55
57
56-- |
58-- |
57-- Infer the kind of a single type
59-- Infer the kind of a single type
58--
60--
59kindOf :: ModuleName -> Type -> Check Kind
61kindOf :: ModuleName -> Type -> Check Kind
60−kindOf moduleName ty = liftUnify $ starIfUnknown <$> infer ty
62+kindOf moduleName ty = fmap tidyUp . liftUnify $ starIfUnknown <$> infer ty
63+ where
64+ tidyUp (k, sub) = sub $? k
61
65
62-- |
66-- |
63-- Infer the kind of a type constructor with a collection of arguments and a collection of associated data constructors
67-- Infer the kind of a type constructor with a collection of arguments and a collection of associated data constructors
64--
68--
65kindsOf :: ModuleName -> ProperName -> [String] -> [Type] -> Check Kind
69kindsOf :: ModuleName -> ProperName -> [String] -> [Type] -> Check Kind
66−kindsOf moduleName name args ts = fmap starIfUnknown . liftUnify $ do
70+kindsOf moduleName name args ts = fmap tidyUp . liftUnify $ do
67 tyCon <- fresh
71 tyCon <- fresh
68 kargs <- replicateM (length args) fresh
72 kargs <- replicateM (length args) fresh
69 let dict = (name, tyCon) : zip (map ProperName args) kargs
73 let dict = (name, tyCon) : zip (map ProperName args) kargs
70 bindLocalTypeVariables moduleName dict $
74 bindLocalTypeVariables moduleName dict $
71 solveTypes ts kargs tyCon
75 solveTypes ts kargs tyCon
76+ where
77+ tidyUp (k, sub) = sub $? k
72
78
73-- |
79-- |
74-- Simultaneously infer the kinds of several mutually recursive type constructors
80-- Simultaneously infer the kinds of several mutually recursive type constructors
@@ -93,16 +99,16 @@ kindsOfAll moduleName syns tys = fmap tidyUp . liftUnify $ do
93 solveTypes [ty] kargs synVar) synVars syns
99 solveTypes [ty] kargs synVar) synVars syns
94 return (syn_ks, data_ks)
100 return (syn_ks, data_ks)
95 where
101 where
96− tidyUp (ks1, ks2) = (map starIfUnknown ks1, map starIfUnknown ks2)
102+ tidyUp ((ks1, ks2), sub) = (map (starIfUnknown . (sub $?)) ks1, map (starIfUnknown . (sub $?)) ks2)
97
103
98-- |
104-- |
99-- Solve the set of kind constraints associated with the data constructors for a type constructor
105-- Solve the set of kind constraints associated with the data constructors for a type constructor
100--
106--
101−solveTypes :: [Type] -> [Kind] -> Kind -> UnifyT Check Kind
107+solveTypes :: [Type] -> [Kind] -> Kind -> UnifyT Kind Check Kind
102solveTypes ts kargs tyCon = do
108solveTypes ts kargs tyCon = do
103 ks <- mapM infer ts
109 ks <- mapM infer ts
104− tyCon ?= foldr FunKind Star kargs
110+ tyCon =?= foldr FunKind Star kargs
105− forM_ ks $ \k -> k ?= Star
111+ forM_ ks $ \k -> k =?= Star
106 return tyCon
112 return tyCon
107
113
108-- |
114-- |
@@ -116,10 +122,10 @@ starIfUnknown k = k
116-- |
122-- |
117-- Infer a kind for a type
123-- Infer a kind for a type
118--
124--
119−infer :: Type -> UnifyT Check Kind
125+infer :: Type -> UnifyT Kind Check Kind
120infer (Object row) = do
126infer (Object row) = do
121 k <- infer row
127 k <- infer row
122− k ?= Row Star
128+ k =?= Row Star
123 return Star
129 return Star
124infer (TypeVar v) = do
130infer (TypeVar v) = do
125 Just moduleName <- checkCurrentModule <$> get
131 Just moduleName <- checkCurrentModule <$> get
@@ -134,7 +140,7 @@ infer (TypeApp t1 t2) = do
134 k0 <- fresh
140 k0 <- fresh
135 k1 <- infer t1
141 k1 <- infer t1
136 k2 <- infer t2
142 k2 <- infer t2
137− k1 ?= FunKind k2 k0
143+ k1 =?= FunKind k2 k0
138 return k0
144 return k0
139infer (ForAll ident ty) = do
145infer (ForAll ident ty) = do
140 k <- fresh
146 k <- fresh
@@ -146,11 +152,11 @@ infer REmpty = do
146infer (RCons _ ty row) = do
152infer (RCons _ ty row) = do
147 k1 <- infer ty
153 k1 <- infer ty
148 k2 <- infer row
154 k2 <- infer row
149− k2 ?= Row k1
155+ k2 =?= Row k1
150 return $ Row k1
156 return $ Row k1
151infer (ConstrainedType deps ty) = do
157infer (ConstrainedType deps ty) = do
152 mapM_ (infer . snd) deps
158 mapM_ (infer . snd) deps
153 k <- infer ty
159 k <- infer ty
154− k ?= Star
160+ k =?= Star
155 return Star
161 return Star
156infer _ = error "Invalid argument to infer"
162infer _ = error "Invalid argument to infer"
src/Language/PureScript/TypeChecker/Monad.hs+4−4
@@ -210,7 +210,7 @@ canonicalizeType _ _ (Qualified (Just mn) nm) = (mn, nm)
210canonicalizeType mn env (Qualified Nothing nm) = case (mn, nm) `M.lookup` types env of
210canonicalizeType mn env (Qualified Nothing nm) = case (mn, nm) `M.lookup` types env of
211 Just (_, DataAlias mn' pn') -> (mn', pn')
211 Just (_, DataAlias mn' pn') -> (mn', pn')
212 _ -> (mn, nm)
212 _ -> (mn, nm)
213−
213+
214-- |
214-- |
215-- Canonicalize a data constructor by resolving any aliases introduced by module imports
215-- Canonicalize a data constructor by resolving any aliases introduced by module imports
216--
216--
@@ -299,13 +299,13 @@ freshDictionaryName = do
299-- |
299-- |
300-- Lift a computation in the @Check@ monad into the substitution monad.
300-- Lift a computation in the @Check@ monad into the substitution monad.
301--
301--
302−liftCheck :: Check a -> UnifyT Check a
302+liftCheck :: Check a -> UnifyT t Check a
303liftCheck = UnifyT . lift . lift
303liftCheck = UnifyT . lift . lift
304
304
305-- |
305-- |
306-- Run a computation in the substitution monad, generating a return value and the final substitution.
306-- Run a computation in the substitution monad, generating a return value and the final substitution.
307--
307--
308−liftUnify :: (Data a) => UnifyT Check a -> Check a
308+liftUnify :: (Partial t) => UnifyT t Check a -> Check (a, Substitution t)
309liftUnify unify = do
309liftUnify unify = do
310 st <- get
310 st <- get
311 e <- runUnify (defaultUnifyState { unifyNextVar = checkNextVar st }) unify
311 e <- runUnify (defaultUnifyState { unifyNextVar = checkNextVar st }) unify
@@ -313,7 +313,7 @@ liftUnify unify = do
313 Left err -> throwError err
313 Left err -> throwError err
314 Right (a, ust) -> do
314 Right (a, ust) -> do
315 modify $ \st -> st { checkNextVar = unifyNextVar ust }
315 modify $ \st -> st { checkNextVar = unifyNextVar ust }
316− return $ runSubstitution (unifyCurrentSubstitution ust) a
316+ return (a, unifyCurrentSubstitution ust)
317
317
318-- |
318-- |
319-- Replace any unqualified names in a type wit their qualified versionss
319-- Replace any unqualified names in a type wit their qualified versionss
src/Language/PureScript/TypeChecker/Types.hs+63−59
@@ -67,22 +67,24 @@ import Control.Arrow (Arrow(..))
67import qualified Data.Map as M
67import qualified Data.Map as M
68import Data.Function (on)
68import Data.Function (on)
69
69
70−instance Unifiable Check Type where
70+instance Partial Type where
71 unknown = TUnknown
71 unknown = TUnknown
72 isUnknown (TUnknown u) = Just u
72 isUnknown (TUnknown u) = Just u
73 isUnknown _ = Nothing
73 isUnknown _ = Nothing
74+
75+instance Unifiable Check Type where
74− (?=) = unifyTypes
76+ (=?=) = unifyTypes
75
77
76-- |
78-- |
77-- Unify two types, updating the current substitution
79-- Unify two types, updating the current substitution
78--
80--
79−unifyTypes :: Type -> Type -> UnifyT Check ()
81+unifyTypes :: Type -> Type -> UnifyT Type Check ()
80unifyTypes t1 t2 = rethrow (\e -> "Error unifying type " ++ prettyPrintType t1 ++ " with type " ++ prettyPrintType t2 ++ ":\n" ++ e) $ do
82unifyTypes t1 t2 = rethrow (\e -> "Error unifying type " ++ prettyPrintType t1 ++ " with type " ++ prettyPrintType t2 ++ ":\n" ++ e) $ do
81 unifyTypes' t1 t2
83 unifyTypes' t1 t2
82 where
84 where
83 unifyTypes' (TUnknown u1) (TUnknown u2) | u1 == u2 = return ()
85 unifyTypes' (TUnknown u1) (TUnknown u2) | u1 == u2 = return ()
84− unifyTypes' (TUnknown u) t = replace u t
86+ unifyTypes' (TUnknown u) t = u =:= t
85− unifyTypes' t (TUnknown u) = replace u t
87+ unifyTypes' t (TUnknown u) = u =:= t
86 unifyTypes' (SaturatedTypeSynonym name args) ty = do
88 unifyTypes' (SaturatedTypeSynonym name args) ty = do
87 ty1 <- expandTypeSynonym name args
89 ty1 <- expandTypeSynonym name args
88 ty1 `unifyTypes` ty
90 ty1 `unifyTypes` ty
@@ -95,7 +97,7 @@ unifyTypes t1 t2 = rethrow (\e -> "Error unifying type " ++ prettyPrintType t1 +
95 sk <- skolemize ident ty1
97 sk <- skolemize ident ty1
96 sk `unifyTypes` ty2
98 sk `unifyTypes` ty2
97 unifyTypes' ty f@(ForAll _ _) = f `unifyTypes` ty
99 unifyTypes' ty f@(ForAll _ _) = f `unifyTypes` ty
98− unifyTypes' (Object row1) (Object row2) = row1 ?= row2
100+ unifyTypes' (Object row1) (Object row2) = row1 =?= row2
99 unifyTypes' (TypeVar v1) (TypeVar v2) | v1 == v2 = return ()
101 unifyTypes' (TypeVar v1) (TypeVar v2) | v1 == v2 = return ()
100 unifyTypes' (TypeConstructor c1) (TypeConstructor c2) = do
102 unifyTypes' (TypeConstructor c1) (TypeConstructor c2) = do
101 env <- getEnv
103 env <- getEnv
@@ -118,7 +120,7 @@ unifyTypes t1 t2 = rethrow (\e -> "Error unifying type " ++ prettyPrintType t1 +
118-- trailing row unification variable, if appropriate, otherwise leftover labels result in a unification
120-- trailing row unification variable, if appropriate, otherwise leftover labels result in a unification
119-- error.
121-- error.
120--
122--
121−unifyRows :: Type -> Type -> UnifyT Check ()
123+unifyRows :: Type -> Type -> UnifyT Type Check ()
122unifyRows r1 r2 =
124unifyRows r1 r2 =
123 let
125 let
124 (s1, r1') = rowToList r1
126 (s1, r1') = rowToList r1
@@ -127,17 +129,17 @@ unifyRows r1 r2 =
127 sd1 = [ (name, t1) | (name, t1) <- s1, name `notElem` map fst s2 ]
129 sd1 = [ (name, t1) | (name, t1) <- s1, name `notElem` map fst s2 ]
128 sd2 = [ (name, t2) | (name, t2) <- s2, name `notElem` map fst s1 ]
130 sd2 = [ (name, t2) | (name, t2) <- s2, name `notElem` map fst s1 ]
129 in do
131 in do
130− forM_ int (uncurry (?=))
132+ forM_ int (uncurry (=?=))
131 unifyRows' sd1 r1' sd2 r2'
133 unifyRows' sd1 r1' sd2 r2'
132 where
134 where
133− unifyRows' :: [(String, Type)] -> Type -> [(String, Type)] -> Type -> UnifyT Check ()
135+ unifyRows' :: [(String, Type)] -> Type -> [(String, Type)] -> Type -> UnifyT Type Check ()
134− unifyRows' [] (TUnknown u) sd r = replace u (rowFromList (sd, r))
136+ unifyRows' [] (TUnknown u) sd r = u =:= rowFromList (sd, r)
135− unifyRows' sd r [] (TUnknown u) = replace u (rowFromList (sd, r))
137+ unifyRows' sd r [] (TUnknown u) = u =:= rowFromList (sd, r)
136 unifyRows' ((name, ty):row) r others u@(TUnknown un) = do
138 unifyRows' ((name, ty):row) r others u@(TUnknown un) = do
137 occursCheck un ty
139 occursCheck un ty
138 forM_ row $ \(_, t) -> occursCheck un t
140 forM_ row $ \(_, t) -> occursCheck un t
139 u' <- fresh
141 u' <- fresh
140− u ?= RCons name ty u'
142+ u =?= RCons name ty u'
141 unifyRows' row r others u'
143 unifyRows' row r others u'
142 unifyRows' [] REmpty [] REmpty = return ()
144 unifyRows' [] REmpty [] REmpty = return ()
143 unifyRows' [] (TypeVar v1) [] (TypeVar v2) | v1 == v2 = return ()
145 unifyRows' [] (TypeVar v1) [] (TypeVar v2) | v1 == v2 = return ()
@@ -156,7 +158,7 @@ typeConstructorsAreEqual env moduleName = (==) `on` canonicalizeType moduleName
156--
158--
157typesOf :: ModuleName -> [(Ident, Value)] -> Check [(Ident, (Value, Type))]
159typesOf :: ModuleName -> [(Ident, Value)] -> Check [(Ident, (Value, Type))]
158typesOf moduleName vals = do
160typesOf moduleName vals = do
159− tys <- liftUnify $ do
161+ tys <- fmap tidyUp . liftUnify $ do
160 let es = map isTyped vals
162 let es = map isTyped vals
161 typed = filter (isJust . snd . snd) es
163 typed = filter (isJust . snd . snd) es
162 untyped = filter (isNothing . snd . snd) es
164 untyped = filter (isNothing . snd . snd) es
@@ -174,11 +176,11 @@ typesOf moduleName vals = do
174 return (ident, (val', ty'))
176 return (ident, (val', ty'))
175 (ident, (val, Nothing)) -> do
177 (ident, (val, Nothing)) -> do
176 TypedValue _ val' ty <- bindNames dict $ infer val
178 TypedValue _ val' ty <- bindNames dict $ infer val
177− ty ?= fromMaybe (error "name not found in dictionary") (lookup ident untypedDict)
179+ ty =?= fromMaybe (error "name not found in dictionary") (lookup ident untypedDict)
178 return (ident, (val', ty))
180 return (ident, (val', ty))
179 when (moduleName == ModuleName (ProperName "Main") && fst e == Ident "main") $ do
181 when (moduleName == ModuleName (ProperName "Main") && fst e == Ident "main") $ do
180 [eff, a] <- replicateM 2 fresh
182 [eff, a] <- replicateM 2 fresh
181− ty ?= TypeApp (TypeApp (TypeConstructor (Qualified (Just (ModuleName (ProperName "Eff"))) (ProperName "Eff"))) eff) a
183+ ty =?= TypeApp (TypeApp (TypeConstructor (Qualified (Just (ModuleName (ProperName "Eff"))) (ProperName "Eff"))) eff) a
182 escapeCheck val ty
184 escapeCheck val ty
183 return triple
185 return triple
184 forM_ tys $ skolemEscapeCheck . snd . snd
186 forM_ tys $ skolemEscapeCheck . snd . snd
@@ -186,6 +188,8 @@ typesOf moduleName vals = do
186 val' <- replaceTypeClassDictionaries moduleName val
188 val' <- replaceTypeClassDictionaries moduleName val
187 return (ident, (overTypes (desaturateAllTypeSynonyms . setifyAll) $ val'
189 return (ident, (overTypes (desaturateAllTypeSynonyms . setifyAll) $ val'
188 , varIfUnknown . desaturateAllTypeSynonyms . setifyAll $ ty))
190 , varIfUnknown . desaturateAllTypeSynonyms . setifyAll $ ty))
191+ where
192+ tidyUp (ts, sub) = map (\(i, (val, ty)) -> (i, (overTypes (sub $?) val, sub $? ty))) ts
189
193
190-- |
194-- |
191-- Check if a value contains a type annotation
195-- Check if a value contains a type annotation
@@ -257,14 +261,14 @@ typeHeadsAreEqual _ _ _ _ = Nothing
257-- |
261-- |
258-- Ensure unsolved unification variables do not escape
262-- Ensure unsolved unification variables do not escape
259--
263--
260−escapeCheck :: Value -> Type -> UnifyT Check ()
264+escapeCheck :: Value -> Type -> UnifyT Type Check ()
261escapeCheck value ty = do
265escapeCheck value ty = do
262 subst <- unifyCurrentSubstitution <$> UnifyT get
266 subst <- unifyCurrentSubstitution <$> UnifyT get
263− let visibleUnknowns = nub $ unknowns $ runSubstitution subst ty
267+ let visibleUnknowns = nub $ unknowns $ subst $? ty
264 let allUnknowns = findAllTypes value
268 let allUnknowns = findAllTypes value
265 forM_ allUnknowns $ \t -> do
269 forM_ allUnknowns $ \t -> do
266− let unsolvedUnknowns = nub . unknowns $ runSubstitution subst t
270+ let unsolvedUnknowns = nub . unknowns $ subst $? t
267− guardWith ("Escape check fails" ++ show ( runSubstitution subst ty, runSubstitution subst t)) $ null $ unsolvedUnknowns \\ visibleUnknowns
271+ guardWith ("Escape check fails" ++ show (subst $? ty, subst $? t)) $ null $ unsolvedUnknowns \\ visibleUnknowns
268
272
269-- |
273-- |
270-- Find all type annotations occuring inside a value
274-- Find all type annotations occuring inside a value
@@ -308,7 +312,7 @@ varIfUnknown ty =
308 toName = (:) 't' . show
312 toName = (:) 't' . show
309 ty' = everywhere (mkT typeToVar) $ ty
313 ty' = everywhere (mkT typeToVar) $ ty
310 typeToVar :: Type -> Type
314 typeToVar :: Type -> Type
311− typeToVar (TUnknown (TypedUnknown (Unknown u))) = TypeVar (toName u)
315+ typeToVar (TUnknown (Unknown u)) = TypeVar (toName u)
312 typeToVar t = t
316 typeToVar t = t
313 in mkForAll (sort . map (toName . runUnknown) $ unks) ty'
317 in mkForAll (sort . map (toName . runUnknown) $ unks) ty'
314
318
@@ -321,14 +325,14 @@ replaceAllTypeVars = foldl' (\f (name, ty) -> replaceTypeVars name ty . f) id
321-- |
325-- |
322-- Replace named type variables with new unification variables
326-- Replace named type variables with new unification variables
323--
327--
324−replaceAllVarsWithUnknowns :: Type -> UnifyT Check Type
328+replaceAllVarsWithUnknowns :: Type -> UnifyT Type Check Type
325replaceAllVarsWithUnknowns (ForAll ident ty) = replaceVarWithUnknown ident ty >>= replaceAllVarsWithUnknowns
329replaceAllVarsWithUnknowns (ForAll ident ty) = replaceVarWithUnknown ident ty >>= replaceAllVarsWithUnknowns
326replaceAllVarsWithUnknowns ty = return ty
330replaceAllVarsWithUnknowns ty = return ty
327
331
328-- |
332-- |
329-- Replace a single type variable with a new unification variable
333-- Replace a single type variable with a new unification variable
330--
334--
331−replaceVarWithUnknown :: String -> Type -> UnifyT Check Type
335+replaceVarWithUnknown :: String -> Type -> UnifyT Type Check Type
332replaceVarWithUnknown ident ty = do
336replaceVarWithUnknown ident ty = do
333 tu <- fresh
337 tu <- fresh
334 return $ replaceTypeVars ident tu $ ty
338 return $ replaceTypeVars ident tu $ ty
@@ -356,7 +360,7 @@ desaturateAllTypeSynonyms = everywhere (mkT replaceSaturatedTypeSynonym)
356-- |
360-- |
357-- Replace a type synonym and its arguments with the aliased type
361-- Replace a type synonym and its arguments with the aliased type
358--
362--
359−expandTypeSynonym :: Qualified ProperName -> [Type] -> UnifyT Check Type
363+expandTypeSynonym :: Qualified ProperName -> [Type] -> UnifyT Type Check Type
360expandTypeSynonym name args = do
364expandTypeSynonym name args = do
361 env <- getEnv
365 env <- getEnv
362 Just moduleName <- checkCurrentModule <$> get
366 Just moduleName <- checkCurrentModule <$> get
@@ -373,20 +377,20 @@ ensureNoDuplicateProperties ps = guardWith "Duplicate property names" $ length (
373-- |
377-- |
374-- Infer a type for a value, rethrowing any error to provide a more useful error message
378-- Infer a type for a value, rethrowing any error to provide a more useful error message
375--
379--
376−infer :: Value -> UnifyT Check Value
380+infer :: Value -> UnifyT Type Check Value
377infer val = rethrow (\e -> "Error inferring type of term " ++ prettyPrintValue val ++ ":\n" ++ e) $ infer' val
381infer val = rethrow (\e -> "Error inferring type of term " ++ prettyPrintValue val ++ ":\n" ++ e) $ infer' val
378
382
379-- |
383-- |
380-- Infer a type for a value
384-- Infer a type for a value
381--
385--
382−infer' :: Value -> UnifyT Check Value
386+infer' :: Value -> UnifyT Type Check Value
383infer' v@(NumericLiteral _) = return $ TypedValue True v tyNumber
387infer' v@(NumericLiteral _) = return $ TypedValue True v tyNumber
384infer' v@(StringLiteral _) = return $ TypedValue True v tyString
388infer' v@(StringLiteral _) = return $ TypedValue True v tyString
385infer' v@(BooleanLiteral _) = return $ TypedValue True v tyBoolean
389infer' v@(BooleanLiteral _) = return $ TypedValue True v tyBoolean
386infer' (ArrayLiteral vals) = do
390infer' (ArrayLiteral vals) = do
387 ts <- mapM infer vals
391 ts <- mapM infer vals
388 els <- fresh
392 els <- fresh
389− forM_ ts $ \(TypedValue _ _ t) -> els ?= TypeApp tyArray t
393+ forM_ ts $ \(TypedValue _ _ t) -> els =?= TypeApp tyArray t
390 return $ TypedValue True (ArrayLiteral ts) els
394 return $ TypedValue True (ArrayLiteral ts) els
391infer' (ObjectLiteral ps) = do
395infer' (ObjectLiteral ps) = do
392 ensureNoDuplicateProperties ps
396 ensureNoDuplicateProperties ps
@@ -454,7 +458,7 @@ infer' (IfThenElse cond th el) = do
454 cond' <- check cond tyBoolean
458 cond' <- check cond tyBoolean
455 v2@(TypedValue _ _ t2) <- infer th
459 v2@(TypedValue _ _ t2) <- infer th
456 v3@(TypedValue _ _ t3) <- infer el
460 v3@(TypedValue _ _ t3) <- infer el
457− t2 ?= t3
461+ t2 =?= t3
458 return $ TypedValue True (IfThenElse cond' v2 v3) t2
462 return $ TypedValue True (IfThenElse cond' v2 v3) t2
459infer' (TypedValue checkType val ty) = do
463infer' (TypedValue checkType val ty) = do
460 Just moduleName <- checkCurrentModule <$> get
464 Just moduleName <- checkCurrentModule <$> get
@@ -468,7 +472,7 @@ infer' _ = error "Invalid argument to infer"
468-- |
472-- |
469-- Infer the type of a property inside a record with a given type
473-- Infer the type of a property inside a record with a given type
470--
474--
471−inferProperty :: Type -> String -> UnifyT Check (Maybe Type)
475+inferProperty :: Type -> String -> UnifyT Type Check (Maybe Type)
472inferProperty (Object row) prop = do
476inferProperty (Object row) prop = do
473 let (props, _) = rowToList row
477 let (props, _) = rowToList row
474 return $ lookup prop props
478 return $ lookup prop props
@@ -483,11 +487,11 @@ inferProperty _ _ = return Nothing
483-- |
487-- |
484-- Infer the types of variables brought into scope by a binder
488-- Infer the types of variables brought into scope by a binder
485--
489--
486−inferBinder :: Type -> Binder -> UnifyT Check (M.Map Ident Type)
490+inferBinder :: Type -> Binder -> UnifyT Type Check (M.Map Ident Type)
487inferBinder _ NullBinder = return M.empty
491inferBinder _ NullBinder = return M.empty
488−inferBinder val (StringBinder _) = val ?= tyString >> return M.empty
492+inferBinder val (StringBinder _) = val =?= tyString >> return M.empty
489−inferBinder val (NumberBinder _) = val ?= tyNumber >> return M.empty
493+inferBinder val (NumberBinder _) = val =?= tyNumber >> return M.empty
490−inferBinder val (BooleanBinder _) = val ?= tyBoolean >> return M.empty
494+inferBinder val (BooleanBinder _) = val =?= tyBoolean >> return M.empty
491inferBinder val (VarBinder name) = return $ M.singleton name val
495inferBinder val (VarBinder name) = return $ M.singleton name val
492inferBinder val (NullaryBinder ctor) = do
496inferBinder val (NullaryBinder ctor) = do
493 env <- getEnv
497 env <- getEnv
@@ -513,11 +517,11 @@ inferBinder val (ObjectBinder props) = do
513 row <- fresh
517 row <- fresh
514 rest <- fresh
518 rest <- fresh
515 m1 <- inferRowProperties row rest props
519 m1 <- inferRowProperties row rest props
516− val ?= Object row
520+ val =?= Object row
517 return m1
521 return m1
518 where
522 where
519− inferRowProperties :: Type -> Type -> [(String, Binder)] -> UnifyT Check (M.Map Ident Type)
523+ inferRowProperties :: Type -> Type -> [(String, Binder)] -> UnifyT Type Check (M.Map Ident Type)
520− inferRowProperties nrow row [] = nrow ?= row >> return M.empty
524+ inferRowProperties nrow row [] = nrow =?= row >> return M.empty
521 inferRowProperties nrow row ((name, binder):binders) = do
525 inferRowProperties nrow row ((name, binder):binders) = do
522 propTy <- fresh
526 propTy <- fresh
523 m1 <- inferBinder propTy binder
527 m1 <- inferBinder propTy binder
@@ -526,13 +530,13 @@ inferBinder val (ObjectBinder props) = do
526inferBinder val (ArrayBinder binders) = do
530inferBinder val (ArrayBinder binders) = do
527 el <- fresh
531 el <- fresh
528 m1 <- M.unions <$> mapM (inferBinder el) binders
532 m1 <- M.unions <$> mapM (inferBinder el) binders
529− val ?= TypeApp tyArray el
533+ val =?= TypeApp tyArray el
530 return m1
534 return m1
531inferBinder val (ConsBinder headBinder tailBinder) = do
535inferBinder val (ConsBinder headBinder tailBinder) = do
532 el <- fresh
536 el <- fresh
533 m1 <- inferBinder el headBinder
537 m1 <- inferBinder el headBinder
534 m2 <- inferBinder val tailBinder
538 m2 <- inferBinder val tailBinder
535− val ?= TypeApp tyArray el
539+ val =?= TypeApp tyArray el
536 return $ m1 `M.union` m2
540 return $ m1 `M.union` m2
537inferBinder val (NamedBinder name binder) = do
541inferBinder val (NamedBinder name binder) = do
538 m <- inferBinder val binder
542 m <- inferBinder val binder
@@ -541,7 +545,7 @@ inferBinder val (NamedBinder name binder) = do
541-- |
545-- |
542-- Check the types of the return values in a set of binders in a case statement
546-- Check the types of the return values in a set of binders in a case statement
543--
547--
544−checkBinders :: [Type] -> Type -> [([Binder], Maybe Guard, Value)] -> UnifyT Check [([Binder], Maybe Guard, Value)]
548+checkBinders :: [Type] -> Type -> [([Binder], Maybe Guard, Value)] -> UnifyT Type Check [([Binder], Maybe Guard, Value)]
545checkBinders _ _ [] = return []
549checkBinders _ _ [] = return []
546checkBinders nvals ret ((binders, grd, val):bs) = do
550checkBinders nvals ret ((binders, grd, val):bs) = do
547 Just moduleName <- checkCurrentModule <$> get
551 Just moduleName <- checkCurrentModule <$> get
@@ -559,7 +563,7 @@ checkBinders nvals ret ((binders, grd, val):bs) = do
559-- |
563-- |
560-- Check that a local variable name is not already used
564-- Check that a local variable name is not already used
561--
565--
562−assignVariable :: Ident -> UnifyT Check ()
566+assignVariable :: Ident -> UnifyT Type Check ()
563assignVariable name = do
567assignVariable name = do
564 env <- checkEnv <$> get
568 env <- checkEnv <$> get
565 Just moduleName <- checkCurrentModule <$> get
569 Just moduleName <- checkCurrentModule <$> get
@@ -571,7 +575,7 @@ assignVariable name = do
571-- Check the type of the return values of a statement, returning whether or not the statement returns on
575-- Check the type of the return values of a statement, returning whether or not the statement returns on
572-- all code paths
576-- all code paths
573--
577--
574−checkStatement :: M.Map Ident Type -> Type -> Statement -> UnifyT Check (Bool, M.Map Ident Type, Statement)
578+checkStatement :: M.Map Ident Type -> Type -> Statement -> UnifyT Type Check (Bool, M.Map Ident Type, Statement)
575checkStatement mass _ (VariableIntroduction name val) = do
579checkStatement mass _ (VariableIntroduction name val) = do
576 assignVariable name
580 assignVariable name
577 val'@(TypedValue _ _ t) <- infer val
581 val'@(TypedValue _ _ t) <- infer val
@@ -580,7 +584,7 @@ checkStatement mass _ (Assignment ident val) = do
580 val'@(TypedValue _ _ t) <- infer val
584 val'@(TypedValue _ _ t) <- infer val
581 case M.lookup ident mass of
585 case M.lookup ident mass of
582 Nothing -> throwError $ "No local variable with name " ++ show ident
586 Nothing -> throwError $ "No local variable with name " ++ show ident
583− Just ty -> do t ?= ty
587+ Just ty -> do t =?= ty
584 return (False, mass, Assignment ident val')
588 return (False, mass, Assignment ident val')
585checkStatement mass ret (While val inner) = do
589checkStatement mass ret (While val inner) = do
586 val' <- check val tyBoolean
590 val' <- check val tyBoolean
@@ -603,7 +607,7 @@ checkStatement mass ret (Return val) = do
603-- |
607-- |
604-- Check the type of an if-then-else statement
608-- Check the type of an if-then-else statement
605--
609--
606−checkIfStatement :: M.Map Ident Type -> Type -> IfStatement -> UnifyT Check (Bool, IfStatement)
610+checkIfStatement :: M.Map Ident Type -> Type -> IfStatement -> UnifyT Type Check (Bool, IfStatement)
607checkIfStatement mass ret (IfStatement val thens Nothing) = do
611checkIfStatement mass ret (IfStatement val thens Nothing) = do
608 val' <- check val tyBoolean
612 val' <- check val tyBoolean
609 (_, _, thens') <- checkBlock mass ret thens
613 (_, _, thens') <- checkBlock mass ret thens
@@ -617,7 +621,7 @@ checkIfStatement mass ret (IfStatement val thens (Just elses)) = do
617-- |
621-- |
618-- Check the type of an else statement
622-- Check the type of an else statement
619--
623--
620−checkElseStatement :: M.Map Ident Type -> Type -> ElseStatement -> UnifyT Check (Bool, ElseStatement)
624+checkElseStatement :: M.Map Ident Type -> Type -> ElseStatement -> UnifyT Type Check (Bool, ElseStatement)
621checkElseStatement mass ret (Else elses) = do
625checkElseStatement mass ret (Else elses) = do
622 (allCodePathsReturn, _, elses') <- checkBlock mass ret elses
626 (allCodePathsReturn, _, elses') <- checkBlock mass ret elses
623 return (allCodePathsReturn, Else elses')
627 return (allCodePathsReturn, Else elses')
@@ -626,7 +630,7 @@ checkElseStatement mass ret (ElseIf ifst) = (id *** ElseIf) <$> checkIfStatement
626-- |
630-- |
627-- Check the type of the return value of a block of statements
631-- Check the type of the return value of a block of statements
628--
632--
629−checkBlock :: M.Map Ident Type -> Type -> [Statement] -> UnifyT Check (Bool, M.Map Ident Type, [Statement])
633+checkBlock :: M.Map Ident Type -> Type -> [Statement] -> UnifyT Type Check (Bool, M.Map Ident Type, [Statement])
630checkBlock mass _ [] = return (False, mass, [])
634checkBlock mass _ [] = return (False, mass, [])
631checkBlock mass ret (s:ss) = do
635checkBlock mass ret (s:ss) = do
632 Just moduleName <- checkCurrentModule <$> get
636 Just moduleName <- checkCurrentModule <$> get
@@ -641,7 +645,7 @@ checkBlock mass ret (s:ss) = do
641-- |
645-- |
642-- Skolemize a type variable by replacing its instances with fresh skolem constants
646-- Skolemize a type variable by replacing its instances with fresh skolem constants
643--
647--
644−skolemize :: String -> Type -> UnifyT Check Type
648+skolemize :: String -> Type -> UnifyT Type Check Type
645skolemize ident ty = do
649skolemize ident ty = do
646 tsk <- Skolem . runUnknown <$> fresh'
650 tsk <- Skolem . runUnknown <$> fresh'
647 return $ replaceTypeVars ident tsk ty
651 return $ replaceTypeVars ident tsk ty
@@ -649,7 +653,7 @@ skolemize ident ty = do
649-- |
653-- |
650-- Check the type of a value, rethrowing errors to provide a better error message
654-- Check the type of a value, rethrowing errors to provide a better error message
651--
655--
652−check :: Value -> Type -> UnifyT Check Value
656+check :: Value -> Type -> UnifyT Type Check Value
653check val ty = rethrow errorMessage $ check' val ty
657check val ty = rethrow errorMessage $ check' val ty
654 where
658 where
655 errorMessage msg =
659 errorMessage msg =
@@ -663,7 +667,7 @@ check val ty = rethrow errorMessage $ check' val ty
663-- |
667-- |
664-- Check the type of a value
668-- Check the type of a value
665--
669--
666−check' :: Value -> Type -> UnifyT Check Value
670+check' :: Value -> Type -> UnifyT Type Check Value
667check' val (ForAll idents ty) = do
671check' val (ForAll idents ty) = do
668 sk <- skolemize idents ty
672 sk <- skolemize idents ty
669 check val sk
673 check val sk
@@ -682,7 +686,7 @@ check' val u@(TUnknown _) = do
682 val'@(TypedValue _ _ ty) <- infer val
686 val'@(TypedValue _ _ ty) <- infer val
683 -- Don't unify an unknown with an inferred polytype
687 -- Don't unify an unknown with an inferred polytype
684 ty' <- replaceAllVarsWithUnknowns ty
688 ty' <- replaceAllVarsWithUnknowns ty
685− ty' ?= u
689+ ty' =?= u
686 return val'
690 return val'
687check' v@(NumericLiteral _) t | t == tyNumber = return v
691check' v@(NumericLiteral _) t | t == tyNumber = return v
688check' v@(StringLiteral _) t | t == tyString = return v
692check' v@(StringLiteral _) t | t == tyString = return v
@@ -765,10 +769,10 @@ check' val ty = throwError $ prettyPrintValue val ++ " does not have type " ++ p
765--
769--
766-- The @lax@ parameter controls whether or not every record member has to be provided. For object updates, this is not the case.
770-- The @lax@ parameter controls whether or not every record member has to be provided. For object updates, this is not the case.
767--
771--
768−checkProperties :: [(String, Value)] -> Type -> Bool -> UnifyT Check [(String, Value)]
772+checkProperties :: [(String, Value)] -> Type -> Bool -> UnifyT Type Check [(String, Value)]
769checkProperties ps row lax = let (ts, r') = rowToList row in go ps ts r' where
773checkProperties ps row lax = let (ts, r') = rowToList row in go ps ts r' where
770 go [] [] REmpty = return []
774 go [] [] REmpty = return []
771− go [] [] u@(TUnknown _) = do u ?= REmpty
775+ go [] [] u@(TUnknown _) = do u =?= REmpty
772 return []
776 return []
773 go [] [] (Skolem _) | lax = return []
777 go [] [] (Skolem _) | lax = return []
774 go [] ((p, _): _) _ | lax = return []
778 go [] ((p, _): _) _ | lax = return []
@@ -777,7 +781,7 @@ checkProperties ps row lax = let (ts, r') = rowToList row in go ps ts r' where
777 go ((p,v):ps') [] u@(TUnknown _) = do
781 go ((p,v):ps') [] u@(TUnknown _) = do
778 v'@(TypedValue _ _ ty) <- infer v
782 v'@(TypedValue _ _ ty) <- infer v
779 rest <- fresh
783 rest <- fresh
780− u ?= RCons p ty rest
784+ u =?= RCons p ty rest
781 ps'' <- go ps' [] rest
785 ps'' <- go ps' [] rest
782 return $ (p, v') : ps''
786 return $ (p, v') : ps''
783 go ((p,v):ps') ts r =
787 go ((p,v):ps') ts r =
@@ -785,7 +789,7 @@ checkProperties ps row lax = let (ts, r') = rowToList row in go ps ts r' where
785 Nothing -> do
789 Nothing -> do
786 v'@(TypedValue _ _ ty) <- infer v
790 v'@(TypedValue _ _ ty) <- infer v
787 rest <- fresh
791 rest <- fresh
788− r ?= RCons p ty rest
792+ r =?= RCons p ty rest
789 ps'' <- go ps' ts rest
793 ps'' <- go ps' ts rest
790 return $ (p, v') : ps''
794 return $ (p, v') : ps''
791 Just ty -> do
795 Just ty -> do
@@ -797,7 +801,7 @@ checkProperties ps row lax = let (ts, r') = rowToList row in go ps ts r' where
797-- |
801-- |
798-- Check the type of a function application, rethrowing errors to provide a better error message
802-- Check the type of a function application, rethrowing errors to provide a better error message
799--
803--
800−checkFunctionApplication :: Value -> Type -> Value -> Type -> UnifyT Check Value
804+checkFunctionApplication :: Value -> Type -> Value -> Type -> UnifyT Type Check Value
801checkFunctionApplication fn fnTy arg ret = rethrow errorMessage $ checkFunctionApplication' fn fnTy arg ret
805checkFunctionApplication fn fnTy arg ret = rethrow errorMessage $ checkFunctionApplication' fn fnTy arg ret
802 where
806 where
803 errorMessage msg = "Error applying function of type "
807 errorMessage msg = "Error applying function of type "
@@ -808,9 +812,9 @@ checkFunctionApplication fn fnTy arg ret = rethrow errorMessage $ checkFunctionA
808-- |
812-- |
809-- Check the type of a function application
813-- Check the type of a function application
810--
814--
811−checkFunctionApplication' :: Value -> Type -> Value -> Type -> UnifyT Check Value
815+checkFunctionApplication' :: Value -> Type -> Value -> Type -> UnifyT Type Check Value
812checkFunctionApplication' fn (TypeApp (TypeApp tyFunction' argTy) retTy) arg ret = do
816checkFunctionApplication' fn (TypeApp (TypeApp tyFunction' argTy) retTy) arg ret = do
813− tyFunction' ?= tyFunction
817+ tyFunction' =?= tyFunction
814 arg' <- check arg argTy
818 arg' <- check arg argTy
815 _ <- subsumes Nothing retTy ret
819 _ <- subsumes Nothing retTy ret
816 return $ App fn arg'
820 return $ App fn arg'
@@ -822,7 +826,7 @@ checkFunctionApplication' fn u@(TUnknown _) arg ret = do
822 TypedValue _ v t <- infer arg
826 TypedValue _ v t <- infer arg
823 TypedValue True v <$> replaceAllVarsWithUnknowns t
827 TypedValue True v <$> replaceAllVarsWithUnknowns t
824 let ty = (\(TypedValue _ _ t) -> t) arg'
828 let ty = (\(TypedValue _ _ t) -> t) arg'
825− u ?= function ty ret
829+ u =?= function ty ret
826 return $ App fn arg'
830 return $ App fn arg'
827checkFunctionApplication' fn (SaturatedTypeSynonym name tyArgs) arg ret = do
831checkFunctionApplication' fn (SaturatedTypeSynonym name tyArgs) arg ret = do
828 ty <- expandTypeSynonym name tyArgs
832 ty <- expandTypeSynonym name tyArgs
@@ -840,7 +844,7 @@ checkFunctionApplication' _ fnTy arg ret = throwError $ "Applying a function of
840-- |
844-- |
841-- Check whether one type subsumes another, rethrowing errors to provide a better error message
845-- Check whether one type subsumes another, rethrowing errors to provide a better error message
842--
846--
843−subsumes :: Maybe Value -> Type -> Type -> UnifyT Check (Maybe Value)
847+subsumes :: Maybe Value -> Type -> Type -> UnifyT Type Check (Maybe Value)
844subsumes val ty1 ty2 = rethrow errorMessage $ subsumes' val ty1 ty2
848subsumes val ty1 ty2 = rethrow errorMessage $ subsumes' val ty1 ty2
845 where
849 where
846 errorMessage msg = "Error checking that type "
850 errorMessage msg = "Error checking that type "
@@ -852,7 +856,7 @@ subsumes val ty1 ty2 = rethrow errorMessage $ subsumes' val ty1 ty2
852-- |
856-- |
853-- Check whether one type subsumes another
857-- Check whether one type subsumes another
854--
858--
855−subsumes' :: Maybe Value -> Type -> Type -> UnifyT Check (Maybe Value)
859+subsumes' :: Maybe Value -> Type -> Type -> UnifyT Type Check (Maybe Value)
856subsumes' val (ForAll ident ty1) ty2 = do
860subsumes' val (ForAll ident ty1) ty2 = do
857 replaced <- replaceVarWithUnknown ident ty1
861 replaced <- replaceVarWithUnknown ident ty1
858 subsumes val replaced ty2
862 subsumes val replaced ty2
@@ -873,6 +877,6 @@ subsumes' (Just val) (ConstrainedType constraints ty1) ty2 = do
873 _ <- subsumes' Nothing ty1 ty2
877 _ <- subsumes' Nothing ty1 ty2
874 return . Just $ foldl App val (map (flip TypeClassDictionary dicts) (qualifyAllUnqualifiedNames moduleName env constraints))
878 return . Just $ foldl App val (map (flip TypeClassDictionary dicts) (qualifyAllUnqualifiedNames moduleName env constraints))
875subsumes' val ty1 ty2 = do
879subsumes' val ty1 ty2 = do
876− ty1 ?= ty2
880+ ty1 =?= ty2
877 return val
881 return val
878
882
src/Language/PureScript/Types.hs+1−1
@@ -31,7 +31,7 @@ data Type
31 -- |
31 -- |
32 -- A unification variable of type Type
32 -- A unification variable of type Type
33 --
33 --
34− = TUnknown (TypedUnknown Type)
34+ = TUnknown Unknown
35 -- |
35 -- |
36 -- Javascript numbers
36 -- Javascript numbers
37 --
37 --