Skip to content

Updates for GHC 8.6.4#3560

Merged
hdgarrood merged 8 commits intopurescript:masterfrom
kritzcreek:ghc-8.6.4
Mar 31, 2019
Merged

Updates for GHC 8.6.4#3560
hdgarrood merged 8 commits intopurescript:masterfrom
kritzcreek:ghc-8.6.4

Conversation

@kritzcreek
Copy link
Copy Markdown
Member

@kritzcreek kritzcreek commented Mar 12, 2019

Having to propagate the MonadFail's this far is a bit unfortunate but I figured I wouldn't do any refactoring and just do the dumbest updates possible for now.

EDIT:

The network updates broke the networking code in Command.Ide, I'll look into that.

@hdgarrood
Copy link
Copy Markdown
Contributor

At least for the docs stuff, I wasn't intending to use MonadFail (in fact I think it's a huge antipattern), so unless there's a particular reason we want to update to GHC 8.6.x very soon, I'd rather refactor so that these sorts of changes won't be necessary and then upgrade; does that sound okay?

@kritzcreek
Copy link
Copy Markdown
Member Author

@hdgarrood For sure! I don't intend on making changes in that area anymore and you've got push permissions for this branch, so knock yourself out :)

@hdgarrood
Copy link
Copy Markdown
Contributor

Ah I see: most of the MonadFail constraints are actually arising from inside the type checker, and they're just propagating out to everywhere else.

Since most of them seem to be due to pattern matches like

  expr@(TypedValue _ value ty) <- infer ...

how do we feel about having infer return something like

data InferredValue = InferredValue
  { inferredCheck :: Bool
  , inferredValue :: Expr
  , inferredType :: Type
  , inferredExpr :: Expr
  }

where the inferredExpr field is always a TypedValue whose fields are the same as the other three fields? Then we can replace the above with

  InferredValue _ value ty expr <- infer ...

and we can recover the current infer with fmap inferredExpr . infer.

@hdgarrood
Copy link
Copy Markdown
Contributor

Actually how about we just set -XNoMonadFailDesugaring for now (which is the same as what we have now), and refactor so that we aren't using fail in a later PR? If we want, we could put it off until we upgrade to GHC 8.8 (at the latest).

@kritzcreek
Copy link
Copy Markdown
Member Author

I guess I'd be fine with setting that flag. We could also just make a function that does that pattern match and throws an internal error when it fails (as that's essentially the behaviour we've got right now).

@hdgarrood
Copy link
Copy Markdown
Contributor

Yep, that should be fine too. I think I prefer the InferredValue approach though, since the compiler can help you avoid making mistakes that way.

@kritzcreek
Copy link
Copy Markdown
Member Author

Looks good to me! Sorry for not getting to this myself.

@hdgarrood
Copy link
Copy Markdown
Contributor

No worries at all :)

@hdgarrood hdgarrood merged commit fe4a131 into purescript:master Mar 31, 2019
@kritzcreek kritzcreek deleted the ghc-8.6.4 branch March 31, 2019 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants