@@ -109,17 +109,17 @@ server bundled externs initEnv port = do
109109 search = fst . TS. typeSearch (Just [] ) initEnv (P. emptyCheckState initEnv)
110110 results = nubBy ((==) `on` fst ) $ do
111111 elab <- elabs
112- let strictMatches = search (replaceTypeVariablesAndDesugar (\ nm s -> P. Skolem nm s (P. SkolemScope 0 ) Nothing ) elab)
113- flexMatches = search (replaceTypeVariablesAndDesugar (const P. TUnknown ) elab)
112+ let strictMatches = search (replaceTypeVariablesAndDesugar (\ nm s -> P. Skolem P. NullSourceAnn nm s (P. SkolemScope 0 )) elab)
113+ flexMatches = search (replaceTypeVariablesAndDesugar (const ( P. TUnknown P. NullSourceAnn ) ) elab)
114114 take 50 (strictMatches ++ flexMatches)
115115 Scotty. json $ A. object [ " results" .= [ P. showQualified id k
116116 | (k, _) <- take 50 results
117117 ]
118118 ]
119119
120- lookupAllConstructors :: P. Environment -> P. Type -> [P. Type ]
120+ lookupAllConstructors :: P. Environment -> P. SourceType -> [P. SourceType ]
121121lookupAllConstructors env = P. everywhereOnTypesM $ \ case
122- P. TypeConstructor (P. Qualified Nothing tyCon) -> P. TypeConstructor <$> lookupConstructor env tyCon
122+ P. TypeConstructor ann (P. Qualified Nothing tyCon) -> P. TypeConstructor ann <$> lookupConstructor env tyCon
123123 other -> pure other
124124 where
125125 lookupConstructor :: P. Environment -> P. ProperName 'P.TypeName -> [P. Qualified (P. ProperName 'P.TypeName )]
@@ -132,11 +132,11 @@ lookupAllConstructors env = P.everywhereOnTypesM $ \case
132132-- | (Consistently) replace unqualified type constructors and type variables with unknowns.
133133--
134134-- Also remove the @ParensInType@ Constructor (we need to deal with type operators later at some point).
135- replaceTypeVariablesAndDesugar :: (Text -> Int -> P. Type ) -> P. Type -> P. Type
135+ replaceTypeVariablesAndDesugar :: (Text -> Int -> P. SourceType ) -> P. SourceType -> P. SourceType
136136replaceTypeVariablesAndDesugar f ty = State. evalState (P. everywhereOnTypesM go ty) (0 , M. empty) where
137137 go = \ case
138- P. ParensInType ty -> pure ty
139- P. TypeVar s -> do
138+ P. ParensInType _ ty -> pure ty
139+ P. TypeVar _ s -> do
140140 (next, m) <- State. get
141141 case M. lookup s m of
142142 Nothing -> do
@@ -146,7 +146,7 @@ replaceTypeVariablesAndDesugar f ty = State.evalState (P.everywhereOnTypesM go t
146146 Just ty -> pure ty
147147 other -> pure other
148148
149- tryParseType :: Text -> Maybe P. Type
149+ tryParseType :: Text -> Maybe P. SourceType
150150tryParseType = hush (P. lex " " ) >=> hush (P. runTokenParser " " (P. parsePolyType <* Parsec. eof))
151151 where
152152 hush f = either (const Nothing ) Just . f
0 commit comments