Parsing failure on some type equality constructs #277

Open
opened 2020-01-31 17:00:06 +01:00 by hasufell · 1 comment
hasufell commented 2020-01-31 17:00:06 +01:00 (Migrated from github.com)
github_ :: ( MonadIO m
              , ParseResponse mt req, res ~ Either Error req,
                ro ~ 'RO)
           => (GenRequest mt ro req)
           -> ExceptT Error m req
github_ req = do
  ExceptT $ liftIO $ github' req

fails to be parsed/formatted with:

ERROR: brittany pretty printer returned syntactically invalid result.
ERROR: encountered unknown syntactical constructs:
HsOpTy{} at lib/GHup.hs:411:17-24
github_ :: ( MonadIO m
              , ParseResponse mt req, res ~ Either Error req, ro ~ 'RO)
           => (GenRequest mt ro req)
           -> ExceptT Error m req
github_ req = do
  ExceptT $ liftIO $ github' req

works fine. Both compile and are the same in GHC.

```hs github_ :: ( MonadIO m , ParseResponse mt req, res ~ Either Error req, ro ~ 'RO) => (GenRequest mt ro req) -> ExceptT Error m req github_ req = do ExceptT $ liftIO $ github' req ``` fails to be parsed/formatted with: ``` ERROR: brittany pretty printer returned syntactically invalid result. ERROR: encountered unknown syntactical constructs: HsOpTy{} at lib/GHup.hs:411:17-24 ``` ```hs github_ :: ( MonadIO m , ParseResponse mt req, res ~ Either Error req, ro ~ 'RO) => (GenRequest mt ro req) -> ExceptT Error m req github_ req = do ExceptT $ liftIO $ github' req ``` works fine. Both compile and are the same in GHC.
lspitzner commented 2020-01-31 17:28:08 +01:00 (Migrated from github.com)

Thanks for the report. I can reproduce. On master this is down to a warning by the power of the errors-fall-back-on-exactprint feature, but that simply leaves it non-reformatted.

It is possible to work around this by prefixing the (~), (in this case (~) ro 'RO) but that is a bit sad. Need to implement -XTypeOperator support, see #271.

Even though technically a duplicate, I'll leave this open because type equality might be a bit more common than other type operators. And maybe we can prioritise this over the full type operators; those might be a can of worms if we wish to support precedences.

Thanks for the report. I can reproduce. On master this is down to a warning by the power of the errors-fall-back-on-exactprint feature, but that simply leaves it non-reformatted. It is possible to work around this by prefixing the `(~)`, (in this case `(~) ro 'RO`) but that is a bit sad. Need to implement `-XTypeOperator` support, see #271. Even though technically a duplicate, I'll leave this open because type equality might be a bit more common than other type operators. And maybe we can prioritise this over the full type operators; those might be a can of worms if we wish to support precedences.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: hexagoxel/brittany#277
There is no content yet.