on master help sign in
Carry aliases entirely through type inference
commit53565e2cae6786411e1ab0a5f05274da8345c62c authorEvan Czaplicki <info@elm-lang.org> dateMon 9 Jun 2014, 09:01 (12 years ago) parentc051175
1 file changed+3−3
compiler/Type/State.hs+3−3
compiler/Type/State.hs+3−3
@@ -1,7 +1,7 @@
11{-# OPTIONS_GHC -W #-}
22module Type.State where
33
4−import Control.Applicative ((<$>),(<*>), Applicative)
4+import Control.Applicative ( (<$>), (<*>), Applicative, (<|>) )
55import Control.Monad.State
66import qualified Data.Map as Map
77import qualified Data.Traversable as Traversable
@@ -104,8 +104,8 @@ introduce variable = do
104104flatten :: Type -> StateT SolverState IO Variable
105105flatten term =
106106 case term of
107− VarN alias v -> do
108− liftIO $ UF.modifyDescriptor v $ \desc -> desc { alias = alias }
107+ VarN maybeAlias v -> do
108+ liftIO $ UF.modifyDescriptor v $ \desc -> desc { alias = maybeAlias <|> alias desc }
109109 return v
110110 TermN alias t -> do
111111 flatStructure <- traverseTerm flatten t