Skip to content
This repository has been archived by the owner on Apr 25, 2020. It is now read-only.

Better library interface? #696

Open
lierdakil opened this issue Dec 7, 2015 · 8 comments
Open

Better library interface? #696

lierdakil opened this issue Dec 7, 2015 · 8 comments

Comments

@lierdakil
Copy link
Collaborator

So... I've been thinking about improving interactive interface, and I've got a question.

Are there any plans to make library interface more typeful? As it is, it mostly returns Strings and [String]s. While this is ok for raw terminal output, re-parsing e.g. error messages back into severity, point and message seems more than a bit weird, does it not? Besides, things like (Int, Int, Int, Int) just don't make sense to me.

Am I missing something? Or is it just a legacy thing?

@alanz
Copy link
Collaborator

alanz commented Dec 7, 2015

I would like to start seeing these kind of types coming back: https://github.com/haskell/haskell-ide-engine/blob/master/hie-plugin-api/Haskell/Ide/Engine/SemanticTypes.hs#L23

See also https://ghc.haskell.org/trac/ghc/ticket/8809, which will hopefully result in properly typed errors in time.

Also https://phabricator.haskell.org/D1240#46788

@lierdakil
Copy link
Collaborator Author

@alanz, in all honesty I would prefer SourcePoint { spLine :: Int, spCol :: Int } to (Int, Int). There are pros and cons to both approaches though.

@alanz
Copy link
Collaborator

alanz commented Dec 7, 2015

I am fine with TypeResult being updated to that, main point is that we are already starting to impose structure on results from ghc-mod, makes more sense for that to happen inside ghc-mod. For types that make sense, as you want.

@DanielG
Copy link
Owner

DanielG commented Dec 7, 2015

@lierdakil you have to think about where all these Strings are coming from. All ghc-mod does (for check for example) is intercept ghc's log messages throught withLogger and then spit that out later. So we just don't have the semantic information readily at hand.

Now of course we could parse ghc's log messages and expose a more useful representation but I think given that GHC HQ is working/thinking about adding more semantic info to the pretty printer this might be wasted effort.

@DanielG
Copy link
Owner

DanielG commented Dec 7, 2015

type of course is another matter entirely since we have a full Type AST in that case. If you want to clean that up or expose more of it feel free.

@alanz
Copy link
Collaborator

alanz commented Dec 7, 2015

If we coordinate things right, we can start the types off here, and migrate them into GHC in time, when that work actually happens.

@lierdakil
Copy link
Collaborator Author

@DanielG, at the very least GHC returns SrcSpan and Severity separate from actual message, does it not?

@DanielG
Copy link
Owner

DanielG commented Dec 9, 2015

Yeah you're right of course. Looks like I didn't read your question properly ;)

Anyways if you (or anyone else) feels like cleaning that up feel free.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants