Source location for a type definition from utop












1















In utop, can I get the source location for the definition of the type, say, result ?



utop # #show_type result;;
type nonrec ('a, 'b) result = ('a, 'b) result = Ok of 'a | Error of 'b


(defined in pervasives



Result type
type ('a, 'b) result =
| Ok of 'a
| Error of 'b
Since 4.03.0


but I am not sure how to get that info systematically)










share|improve this question

























  • The least you'd need for this to work is to compile OCaml with the -g (debug) flag. This will add source information in the compiled binaries. But even then, I'm not sure utop knows how to use such information.

    – Richard-Degenne
    Nov 14 '18 at 16:57






  • 1





    Not really an answer to your question, but do you know you can get this information using merlin with emacs, Vi or VisualStudio ?

    – Julien
    Nov 15 '18 at 12:40






  • 1





    as well as other editors, see github.com/ocaml/merlin

    – Julien
    Nov 15 '18 at 12:49











  • May be that is the best answer. I tend to be fearful of too much editor integration out of experience of haskell tooling being brittle, but merlin seems really sturdy and emacs mode is a joy. Do you use utop from the editor integration mostly ?

    – nicolas
    Nov 15 '18 at 13:26








  • 1





    I had trouble integrating utop with tuareg mode, probably due to an emacs init files cluttered with legacy tuareg-mode tweaks, so I use the standard REPL. But really, I use less and less the REPL as tuareg-mode+merlin gives me the type of everything, and tells me if it compiles or not, which is most of the time what I used the REPL for.

    – Julien
    Nov 15 '18 at 14:36


















1















In utop, can I get the source location for the definition of the type, say, result ?



utop # #show_type result;;
type nonrec ('a, 'b) result = ('a, 'b) result = Ok of 'a | Error of 'b


(defined in pervasives



Result type
type ('a, 'b) result =
| Ok of 'a
| Error of 'b
Since 4.03.0


but I am not sure how to get that info systematically)










share|improve this question

























  • The least you'd need for this to work is to compile OCaml with the -g (debug) flag. This will add source information in the compiled binaries. But even then, I'm not sure utop knows how to use such information.

    – Richard-Degenne
    Nov 14 '18 at 16:57






  • 1





    Not really an answer to your question, but do you know you can get this information using merlin with emacs, Vi or VisualStudio ?

    – Julien
    Nov 15 '18 at 12:40






  • 1





    as well as other editors, see github.com/ocaml/merlin

    – Julien
    Nov 15 '18 at 12:49











  • May be that is the best answer. I tend to be fearful of too much editor integration out of experience of haskell tooling being brittle, but merlin seems really sturdy and emacs mode is a joy. Do you use utop from the editor integration mostly ?

    – nicolas
    Nov 15 '18 at 13:26








  • 1





    I had trouble integrating utop with tuareg mode, probably due to an emacs init files cluttered with legacy tuareg-mode tweaks, so I use the standard REPL. But really, I use less and less the REPL as tuareg-mode+merlin gives me the type of everything, and tells me if it compiles or not, which is most of the time what I used the REPL for.

    – Julien
    Nov 15 '18 at 14:36
















1












1








1








In utop, can I get the source location for the definition of the type, say, result ?



utop # #show_type result;;
type nonrec ('a, 'b) result = ('a, 'b) result = Ok of 'a | Error of 'b


(defined in pervasives



Result type
type ('a, 'b) result =
| Ok of 'a
| Error of 'b
Since 4.03.0


but I am not sure how to get that info systematically)










share|improve this question
















In utop, can I get the source location for the definition of the type, say, result ?



utop # #show_type result;;
type nonrec ('a, 'b) result = ('a, 'b) result = Ok of 'a | Error of 'b


(defined in pervasives



Result type
type ('a, 'b) result =
| Ok of 'a
| Error of 'b
Since 4.03.0


but I am not sure how to get that info systematically)







ocaml utop






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 14:33







nicolas

















asked Nov 14 '18 at 14:28









nicolasnicolas

4,07622660




4,07622660













  • The least you'd need for this to work is to compile OCaml with the -g (debug) flag. This will add source information in the compiled binaries. But even then, I'm not sure utop knows how to use such information.

    – Richard-Degenne
    Nov 14 '18 at 16:57






  • 1





    Not really an answer to your question, but do you know you can get this information using merlin with emacs, Vi or VisualStudio ?

    – Julien
    Nov 15 '18 at 12:40






  • 1





    as well as other editors, see github.com/ocaml/merlin

    – Julien
    Nov 15 '18 at 12:49











  • May be that is the best answer. I tend to be fearful of too much editor integration out of experience of haskell tooling being brittle, but merlin seems really sturdy and emacs mode is a joy. Do you use utop from the editor integration mostly ?

    – nicolas
    Nov 15 '18 at 13:26








  • 1





    I had trouble integrating utop with tuareg mode, probably due to an emacs init files cluttered with legacy tuareg-mode tweaks, so I use the standard REPL. But really, I use less and less the REPL as tuareg-mode+merlin gives me the type of everything, and tells me if it compiles or not, which is most of the time what I used the REPL for.

    – Julien
    Nov 15 '18 at 14:36





















  • The least you'd need for this to work is to compile OCaml with the -g (debug) flag. This will add source information in the compiled binaries. But even then, I'm not sure utop knows how to use such information.

    – Richard-Degenne
    Nov 14 '18 at 16:57






  • 1





    Not really an answer to your question, but do you know you can get this information using merlin with emacs, Vi or VisualStudio ?

    – Julien
    Nov 15 '18 at 12:40






  • 1





    as well as other editors, see github.com/ocaml/merlin

    – Julien
    Nov 15 '18 at 12:49











  • May be that is the best answer. I tend to be fearful of too much editor integration out of experience of haskell tooling being brittle, but merlin seems really sturdy and emacs mode is a joy. Do you use utop from the editor integration mostly ?

    – nicolas
    Nov 15 '18 at 13:26








  • 1





    I had trouble integrating utop with tuareg mode, probably due to an emacs init files cluttered with legacy tuareg-mode tweaks, so I use the standard REPL. But really, I use less and less the REPL as tuareg-mode+merlin gives me the type of everything, and tells me if it compiles or not, which is most of the time what I used the REPL for.

    – Julien
    Nov 15 '18 at 14:36



















The least you'd need for this to work is to compile OCaml with the -g (debug) flag. This will add source information in the compiled binaries. But even then, I'm not sure utop knows how to use such information.

– Richard-Degenne
Nov 14 '18 at 16:57





The least you'd need for this to work is to compile OCaml with the -g (debug) flag. This will add source information in the compiled binaries. But even then, I'm not sure utop knows how to use such information.

– Richard-Degenne
Nov 14 '18 at 16:57




1




1





Not really an answer to your question, but do you know you can get this information using merlin with emacs, Vi or VisualStudio ?

– Julien
Nov 15 '18 at 12:40





Not really an answer to your question, but do you know you can get this information using merlin with emacs, Vi or VisualStudio ?

– Julien
Nov 15 '18 at 12:40




1




1





as well as other editors, see github.com/ocaml/merlin

– Julien
Nov 15 '18 at 12:49





as well as other editors, see github.com/ocaml/merlin

– Julien
Nov 15 '18 at 12:49













May be that is the best answer. I tend to be fearful of too much editor integration out of experience of haskell tooling being brittle, but merlin seems really sturdy and emacs mode is a joy. Do you use utop from the editor integration mostly ?

– nicolas
Nov 15 '18 at 13:26







May be that is the best answer. I tend to be fearful of too much editor integration out of experience of haskell tooling being brittle, but merlin seems really sturdy and emacs mode is a joy. Do you use utop from the editor integration mostly ?

– nicolas
Nov 15 '18 at 13:26






1




1





I had trouble integrating utop with tuareg mode, probably due to an emacs init files cluttered with legacy tuareg-mode tweaks, so I use the standard REPL. But really, I use less and less the REPL as tuareg-mode+merlin gives me the type of everything, and tells me if it compiles or not, which is most of the time what I used the REPL for.

– Julien
Nov 15 '18 at 14:36







I had trouble integrating utop with tuareg mode, probably due to an emacs init files cluttered with legacy tuareg-mode tweaks, so I use the standard REPL. But really, I use less and less the REPL as tuareg-mode+merlin gives me the type of everything, and tells me if it compiles or not, which is most of the time what I used the REPL for.

– Julien
Nov 15 '18 at 14:36














0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53302521%2fsource-location-for-a-type-definition-from-utop%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53302521%2fsource-location-for-a-type-definition-from-utop%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Bressuire

Vorschmack

Quarantine