This repository has been archived by the owner on Oct 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 207
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Enables to use imports of constructors
fendor
force-pushed
the
hsimport-support-constructors
branch
from
June 4, 2019 11:26
8e2a1ab
to
cd3494c
Compare
fendor
force-pushed
the
hsimport-support-constructors
branch
from
June 4, 2019 11:29
cd3494c
to
07822b4
Compare
lorenzo
approved these changes
Jun 4, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
fendor
force-pushed
the
hsimport-support-constructors
branch
from
June 4, 2019 17:17
061853d
to
25cb238
Compare
Example of what will be possible now: {-# LANGUAGE NoImplicitPrelude #-}
import System.IO (IO)
-- | Main entry point to the program
main :: IO ()
main =
when True
$ hPutStrLn stdout
$ fromMaybe "Good night, World!" (Just "Hello, World!") Only using Code Actions, this can be turned into: {-# LANGUAGE NoImplicitPrelude #-}
import System.IO (IO, hPutStrLn, stdout)
import Prelude (Bool(..))
import Control.Monad (when)
import Data.Maybe (fromMaybe, Maybe(Just))
import Data.Function (($))
-- | Main entry point to the program
main :: IO ()
main =
when True
$ hPutStrLn stdout
$ fromMaybe "Good night, World!" (Just "Hello, World!") Of course, this will be documented via a test. |
fendor
changed the title
WIP: Import of data constructors
Improve import action of hsimport
Jun 4, 2019
fendor
force-pushed
the
hsimport-support-constructors
branch
4 times, most recently
from
June 4, 2019 22:23
8f18e45
to
9e82f6d
Compare
fendor
force-pushed
the
hsimport-support-constructors
branch
from
June 4, 2019 22:39
9e82f6d
to
8e24b12
Compare
@bubba, would you mind taking a look at the tests again? I can run them, but I dont know how to solve the issue. The test case worked when executing each code action manually. |
lukel97
reviewed
Jun 4, 2019
@fendor sure thing! This looks really cool, so I was planning on trying it out anyway :) |
lorenzo
reviewed
Jun 5, 2019
lukel97
approved these changes
Jun 8, 2019
Currently, it seems like import actions for tpyes do not work at all. I would like to take a look at it, before this is merged. |
lorenzo
reviewed
Jun 10, 2019
This was referenced Jun 13, 2019
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Current implementation of the hsimport plugin can not deal with constructors, e.g. trying to import
Null
fromData.Aeson
will wrongly try to importData.Aeson (Null)
instead of the correctData.Aeson (Value(Null))
. This pr aims to change that, while also preparing the implementation of #1191.Clones the API of HsImport with small adaptations for our use case, e.g. currently no support for qualified imports.
This pr also fixes the import of operators.