
Am 10/29/2013 11:06 PM, schrieb Christopher Done:
On 29 October 2013 22:36, martin
mailto:martin.drautzburg@web.de> wrote: is there a way to determine types of symbols which are not toplevel but inside a function?
Not at present without transformation. There are two reasonably reliable approaches:
Insert noisy holes/make intentional type errors: http://ghc.haskell.org/trac/ghc/wiki/Holes#Insertingdeliberatetypeerrors
Implicit parameters: http://ghc.haskell.org/trac/ghc/wiki/Holes#Implicitparameters
Holes will land in GHC to support this explicitly. I don't know what version of GHC has/will have this.
Alternatively, you can use ghc-mod (https://github.com/kazu-yamamoto/ghc-mod) which, if you can get it to work, can tell you the types of sub-expressions.
Lastly, the next version of the FP Complete IDE gives you types of sub-expressions just by clicking on them or selecting them out of the box.
Thanks, that helps. Related questions: how can I figure out the type (using holes) for the symbol left of the <- in a do expression? I mean other than: main = do x <- getChar::undefined return () Couldn't match type `undefined' with `IO Char' And how about plain lambdas. This works f = \x -> (x::undefined)+1 Couldn't match type `t' with `undefined' but what if x does not appear on the right side?