@@ -109,17 +109,17 @@ server bundled externs initEnv port = do
109
109
search = fst . TS. typeSearch (Just [] ) initEnv (P. emptyCheckState initEnv)
110
110
results = nubBy ((==) `on` fst ) $ do
111
111
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)
114
114
take 50 (strictMatches ++ flexMatches)
115
115
Scotty. json $ A. object [ " results" .= [ P. showQualified id k
116
116
| (k, _) <- take 50 results
117
117
]
118
118
]
119
119
120
- lookupAllConstructors :: P. Environment -> P. Type -> [P. Type ]
120
+ lookupAllConstructors :: P. Environment -> P. SourceType -> [P. SourceType ]
121
121
lookupAllConstructors 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
123
123
other -> pure other
124
124
where
125
125
lookupConstructor :: P. Environment -> P. ProperName 'P.TypeName -> [P. Qualified (P. ProperName 'P.TypeName )]
@@ -132,11 +132,11 @@ lookupAllConstructors env = P.everywhereOnTypesM $ \case
132
132
-- | (Consistently) replace unqualified type constructors and type variables with unknowns.
133
133
--
134
134
-- 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
136
136
replaceTypeVariablesAndDesugar f ty = State. evalState (P. everywhereOnTypesM go ty) (0 , M. empty) where
137
137
go = \ case
138
- P. ParensInType ty -> pure ty
139
- P. TypeVar s -> do
138
+ P. ParensInType _ ty -> pure ty
139
+ P. TypeVar _ s -> do
140
140
(next, m) <- State. get
141
141
case M. lookup s m of
142
142
Nothing -> do
@@ -146,7 +146,7 @@ replaceTypeVariablesAndDesugar f ty = State.evalState (P.everywhereOnTypesM go t
146
146
Just ty -> pure ty
147
147
other -> pure other
148
148
149
- tryParseType :: Text -> Maybe P. Type
149
+ tryParseType :: Text -> Maybe P. SourceType
150
150
tryParseType = hush (P. lex " " ) >=> hush (P. runTokenParser " " (P. parsePolyType <* Parsec. eof))
151
151
where
152
152
hush f = either (const Nothing ) Just . f
0 commit comments