Skip to content

Commit

Permalink
attempt fixing exactprint <9.10
Browse files Browse the repository at this point in the history
  • Loading branch information
wz1000 committed Jun 12, 2024
1 parent 8267cad commit efad46c
Showing 1 changed file with 1 addition and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,17 +213,7 @@ toCodeAction3 get f = ExceptT . ReaderT $ \caa -> get caa >>= flip runReaderT ca

-- | this instance returns a delta AST, useful for exactprint transforms
instance ToCodeAction r => ToCodeAction (ParsedSource -> r) where
#if !MIN_VERSION_ghc(9,3,0)
toCodeAction f = ExceptT . ReaderT $ \caa@CodeActionArgs {caaAnnSource = x} ->
x >>= \case
Just s -> flip runReaderT caa . runExceptT . toCodeAction $ f s
_ -> pure $ Right []
#else
toCodeAction f = ExceptT . ReaderT $ \caa@CodeActionArgs {caaParsedModule = x} ->
x >>= \case
Just s -> flip runReaderT caa . runExceptT . toCodeAction . f . pm_parsed_source $ s
_ -> pure $ Right []
#endif
toCodeAction = toCodeAction2 caaAnnSource

instance ToCodeAction r => ToCodeAction (ExportsMap -> r) where
toCodeAction = toCodeAction3 caaExportsMap
Expand Down

0 comments on commit efad46c

Please sign in to comment.