Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use appropriate number types #366

Merged
merged 4 commits into from
Nov 7, 2021
Merged

Conversation

michaelpj
Copy link
Collaborator

This ensures that we use either:

  • Int32
  • Word32
  • Float

In particular, this gets us:

Rather than use newtypes, we just use the existing appropriate Haskell
numeric types for bounded integers.

Fixes #354.

NOTE: I also bumped the lsp-types major version, since this is a type-representation change.

@jneira
Copy link
Member

jneira commented Nov 6, 2021

Many thanks for fixing this. Would need it some work to adapt clients (like hls)? could we do something here to make easier the upgrade?

@michaelpj
Copy link
Collaborator Author

Yeah, it'll require some changes, but just a scattering of fromIntegral. I don't know of a way to avoid that, unfortunately: ultimately we are changing the representation of the types.

@@ -1,6 +1,7 @@
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed? There is no other changes in the module

-- might contain the index of the change that failed. This property is
-- only available if the client signals a `failureHandling` strategy
-- in its client capabilities.
, _failedChange :: Maybe Word32
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a not related change, maybe it worths to note it as a separate commit or in another way

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops thanks, just a small thing I noticed we missed!

@@ -7,6 +7,9 @@
{-# OPTIONS_GHC -fno-warn-orphans #-}
-- For the use of MarkedString
{-# OPTIONS_GHC -fno-warn-deprecations #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More pragmas with no module changes, maybe they are needed for upstream changes?

Copy link
Member

@jneira jneira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, many thanks for fixing that

This ensures that we use either:
- `Int32`
- `Word32`
- `Float`

In particular, this gets us:
- Appropriate `Bounded` instances (see the original issue
haskell/haskell-language-server#2169).
- More picky `aeson` instances for the bounded types.

Rather than use newtypes, we just use the existing appropriate Haskell
numeric types for bounded integers.

Fixes haskell#354.
Just a small missing field.
Since type representations changed.
@michaelpj michaelpj merged commit bf95cd9 into haskell:master Nov 7, 2021
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.

Provide newtype wrappers for new number types of lsp spec 3.16
2 participants