[Haskell-cafe] Displaying infered type signature of
'offside'functions
Antoine Latter
aslatter at gmail.com
Sun Apr 29 20:03:32 EDT 2007
This looks like a good place to ask a question that's been bugging me for a
bit:
I've had cases in my own code where I can't seem to create a type annotation
for an "inner" declaration that the type-checker likes. Here's a toy
example:
In the following code:
> applyfunc :: (a -> b -> c) -> a -> b -> c
> applyfunc f x y = doit y where
> doit = f x
What type annotation can I successfully apply to the function "doit"?
Thanks,
Antoine
On 4/29/07, Claus Reinke <claus.reinke at talk21.com> wrote:
>
> >On 28/04/07, Georg Sauthoff <g_sauthoff at web.de> wrote:
> >> Well, I mention this, because I would like to integrate some
> >> lookup feature (for type signatures) into vim (if it doesn't
> >> exist yet).
> >
> >It's worth pointing out that Emacs's haskell-mode already has this.
>
> as do many Vim Haskell modes. for instance, in my own, there are
>
> _t : show type for id under cursor
> _T : add type declaration for id under cursor before current line
> _si : show info for id under cursor
> CTRL-] : jump to definition of id under cursor
>
> '_t' and '_T' use (cached) output from GHCi :browse for the current
> and imported modules, '_si' calls GHCi :info, CTRL-] uses the tags
> file generated by 'ghc -e :ctags <current>' (which is mapped to '_ct').
>
> see http://www.cs.kent.ac.uk/people/staff/cr3/toolbox/haskell/Vim/
> for more info, a tour, and the scripts.
>
> >I did forget to mention that this won't help with your 'offside'
> >functions, though.
>
> that, indeed, is the point. if it is reasonably easy to get that
> information,
> without internal identifiers or non-source constructs, and with correct
> associations to source code positions, it would be a useful addition to
> editor bindings.
>
> it would perhaps be nice to have a wiki page collecting Haskell IDE
> features that have been implemented in at least one of the many tools,
> so that everybody can try to implement a similar feature set for their
> own editor/ide?
>
> there are features that depend on individual preferences, such as
> indentation, and there are obvious features that everybody wants,
> such as those above, but often, someone somewhere hacks up a
> little trick that makes Haskell hacking life a lot easier.
>
> here is a near trivial example from my vimrc file (not even Haskell-
> specific):
>
> map ,{ c{}<esc>P%
> map ,( c()<esc>P%
> map ,[ c[]<esc>P%
>
> this allows me to insert parens by highlighting the part to be enclosed
> (*).
>
> similarly, the emacs modes have a command to align patterns in
> the middle of adjacent lines, such as '=', '::', which is different from
> indent, and sounds potentially quite useful, to align multiple equations
> and their type declaration, so i've started to reproduce that for vim.
>
> claus
>
> (*) ',(' is mapped to: replace (c) highlighted, insert '()', escape to
> command mode (<esc>), paste cut buffer before current pos
> (P), jump to matching paren (%). so i just highlight an expr and
> hit ',(' to put it in parens, or ',[' to wrap it into a list, etc.
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070429/8a7750de/attachment.htm
More information about the Haskell-Cafe
mailing list