-
Notifications
You must be signed in to change notification settings - Fork 63
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
Draft: Change API to emit multiple ComponentOptions if available #304
Conversation
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.
horror vacui 👍
eab203d
to
5ba89dd
Compare
What are the semantics of the provided data LoadResult =
{ loadComponent :: Maybe ComponentOptions,
, componentDependencies :: Maybe (NonEmpty ComponentOptions)
} intended semantics: it is possible to extract component dependencies and load these immediately, but we were unable to load the component the file target is part of. Opinions? |
i like the precision of the new data type and it can be extended if we find out other nuances |
73b4f97
to
556d09d
Compare
src/HIE/Bios/Types.hs
Outdated
type LoadResult = LoadResult' ComponentOptions | ||
|
||
data LoadResult' a = LoadResult | ||
{ loadResultComponent :: Maybe a | ||
-- ^ Component options for the FilePath that produced this 'LoadResult'. | ||
-- See 'CradleAction.runCradle' for information on how to produce a 'LoadResult'. | ||
-- | ||
-- This field can be 'Nothing' to indicate that loading partially failed. | ||
, loadResultDependencies :: [a] | ||
-- ^ Direct or indirect dependencies from the component from above. | ||
-- Indirect means that it is not required that 'ComponentOptions' in this list | ||
-- are required dependencies of 'loadResultComponent'. It is specifically allowed | ||
-- to list 'ComponentOptions' that have no relation with 'loadResultComponent'. | ||
-- | ||
-- Example: | ||
-- | ||
-- Assume we load an executable component, then its options must be located | ||
-- in 'loadResultComponent', additionally it is possible to list other | ||
-- executable component's options in 'loadResultDependencies'. | ||
} deriving (Eq, Ord, Show, Functor, Foldable, Traversable) |
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.
I honestly don't really like this naming. Signatures be like: CradleLoadResult LoadResult
. Seems really redundant
pattern Main :: a -> LoadResult' a | ||
pattern Main opts <- (loadResultComponent -> Just opts) |
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.
We can have more of these such as:
Deps :: [a] -> LoadResult' a
MainAndDeps :: a -> [a] -> LoadResult' a
for typesafe pattern matching.
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.
Well, if we need patterns, we might just introduce a more elaborated datatype
556d09d
to
8fd241a
Compare
@fendor hi! any chance to get this merged to make progress in enable rename plugin in hls? |
It is right now still kind of a WIP. Do you have opinions on naming? |
-- Indirect means that it is not required that 'ComponentOptions' in this list | ||
-- are required dependencies of 'loadResultComponent'. It is specifically allowed |
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.
The sentence makes no sense, what I mean is, that items here are either local dependencies in some form, or completely independent but can be loaded, too.
It might still be important to have some kind of order on them.
8fd241a
to
c3ba11b
Compare
|
||
-- | Record for expressing successful loading. | ||
-- Can express partial success. | ||
data LoadResult' a = LoadResult |
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.
What about somethin like
data ComponentInfo = ComponentInfo
{ componentOptions :: Maybe a
componentDependencies: [a]
}
It would be generic enough to allow add more component information afterwards
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.
Hm, maybe we can drop the prefix somehow to be less "Component"-y? However, since the record field prefix will probably still be required, probably pointless.
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.
yeah, Info
sounds good too, maybe too generic but whatever
What's the status of this? |
It is on hold because it is semi-blocked on haskell/cabal#7500 to get reliably the build-info location. Technically, it is not blocked, the API could be changed without cabal support, but then we have a slightly harder time to test the implementation. Also, if there is no cabal or stack support for it, I see barely an incentive to implement it, currently. |
Superseded by #409 |
Introduce API changes necessary for #301
This PR can be merged before #301, and released, then HLS can be updated for the new API.