@@ -186,27 +186,27 @@ convertRecSel se re =
186
186
-- It's important that we use everthingBut here, because if we used everything we would
187
187
-- get duplicates for every case that occures inside a HsExpanded expression.
188
188
collectRecordSelectors :: GenericQ [RecordSelectorExpr ]
189
- collectRecordSelectors = everythingBut (<>) (first maybeToList . (( Nothing , False ) `mkQ` getRecSels) )
189
+ collectRecordSelectors = everythingBut (<>) (( [] , False ) `mkQ` getRecSels)
190
190
191
- getRecSels :: LHsExpr (GhcPass 'Renamed) -> (Maybe RecordSelectorExpr , Bool )
191
+ getRecSels :: LHsExpr (GhcPass 'Renamed) -> ([ RecordSelectorExpr ] , Bool )
192
192
-- When we stumble upon an occurance of HsExpanded, we only want to follow one branch
193
- -- we do this here, by explicitly returning an occurance from traversing the original branch,
193
+ -- we do this here, by explicitly returning occurances from traversing the original branch,
194
194
-- and returning True, which keeps syb from implicitly continuing to traverse.
195
- getRecSels (unLoc -> XExpr (HsExpanded a _)) = (listToMaybe $ collectRecordSelectors a, True )
195
+ getRecSels (unLoc -> XExpr (HsExpanded a _)) = (collectRecordSelectors a, True )
196
196
#if __GLASGOW_HASKELL__ >= 903
197
197
-- applied record selection: "field record" or "field (record)" or "field field.record"
198
198
getRecSels e@ (unLoc -> HsApp _ se@ (unLoc -> HsRecSel _ _) re) =
199
- (listToMaybe [ RecordSelectorExpr (realSrcSpanToRange realSpan') se re | RealSrcSpan realSpan' _ <- [ getLoc e ]], False )
199
+ ( [ RecordSelectorExpr (realSrcSpanToRange realSpan') se re | RealSrcSpan realSpan' _ <- [ getLoc e ]], False )
200
200
-- Record selection where the field is being applied with the "$" operator: "field $ record"
201
201
getRecSels e@ (unLoc -> OpApp _ se@ (unLoc -> HsRecSel _ _) (unLoc -> HsVar _ (unLoc -> d)) re)
202
- | d == dollarName = (listToMaybe [ RecordSelectorExpr (realSrcSpanToRange realSpan') se re | RealSrcSpan realSpan' _ <- [ getLoc e ]], False )
202
+ | d == dollarName = ( [ RecordSelectorExpr (realSrcSpanToRange realSpan') se re | RealSrcSpan realSpan' _ <- [ getLoc e ]], False )
203
203
#else
204
204
getRecSels e@ (unLoc -> HsApp _ se@ (unLoc -> HsRecFld _ _) re) =
205
- (listToMaybe [ RecordSelectorExpr (realSrcSpanToRange realSpan') se re | RealSrcSpan realSpan' _ <- [ getLoc e ]], False )
205
+ ( [ RecordSelectorExpr (realSrcSpanToRange realSpan') se re | RealSrcSpan realSpan' _ <- [ getLoc e ]], False )
206
206
getRecSels e@ (unLoc -> OpApp _ se@ (unLoc -> HsRecFld _ _) (unLoc -> HsVar _ (unLoc -> d)) re)
207
- | d == dollarName = (listToMaybe [ RecordSelectorExpr (realSrcSpanToRange realSpan') se re | RealSrcSpan realSpan' _ <- [ getLoc e ]], False )
207
+ | d == dollarName = ( [ RecordSelectorExpr (realSrcSpanToRange realSpan') se re | RealSrcSpan realSpan' _ <- [ getLoc e ]], False )
208
208
#endif
209
- getRecSels _ = (Nothing , False )
209
+ getRecSels _ = ([] , False )
210
210
211
211
collectRecSelResult :: MonadIO m => IdeState -> NormalizedFilePath -> ExceptT String m CollectRecordSelectorsResult
212
212
collectRecSelResult ideState =
0 commit comments