128

I'm trying to enable XRankNTypes in GHCi. How do I do this?

Matt Fenwick
  • 48,199
  • 22
  • 128
  • 192

1 Answers1

186

:set -XRankNTypes. The -X part is a compiler switch, by the way, extension is called just RankNTypes.

Cat Plus Plus
  • 125,936
  • 27
  • 200
  • 224
  • 49
    Note that after typing `:set -X` in GHCi you'll actually get tab completion for available extensions, which is handy when you can't remember where they decided to use abbreviations ("MultiParam") or acronyms ("GADT") rather than spelling things out in full ("MonomorphismRestriction")... – C. A. McCann Sep 25 '12 at 14:26
  • 2
    And if you, a beginning Haskell programmer, don't also get such tab completion in your editor of choice then fix up you programming environment! – Thomas M. DuBuisson Sep 25 '12 at 14:47
  • @ThomasM.DuBuisson -- are you referring to autocompletion within one's text editor? If so, do you know if this is possible with vim? – identity Sep 25 '12 at 15:43
  • @identity I use neocomplcache, neco-ghc, ghcmod-vim, and vim2hs for my vim+Haskell needs. When I type something like `run`, I get a list of possible completions popping up (in a particular project that imports cereal) such as `run{Get,Put}{,Lazy}`, `runPutM`, etc. – Thomas M. DuBuisson Sep 25 '12 at 16:28
  • @ThomasM.DuBuisson Thank you. I just tried all of those out now, on Windows. It seems neco-ghc fails completely for me, making my environment nigh unusable. vim2hs doesn't work very well either, and while I'm certain this can all be fixed, it'll probably take too much time and hassle to be worth it. – identity Sep 26 '12 at 16:29
  • @identity: neco-ghc and ghcmod-vim work fine for me on Windows. Did you install ghcmod? – Cat Plus Plus Sep 26 '12 at 17:33
  • There is actually an opportunity for improving error messages here. Instead of e.g. ` Illegal tuple section: use TupleSections` a better message would be ` Illegal tuple section: use :set -XTupleSections to enable the TupleSections language extension'. – michid Jun 21 '19 at 08:37