lambdatoast/elm.vim

Type inference

Closed this issue · 4 comments

It would be awesome to add an ability to see type of a particular expression

@gyzerok You might find this of use: https://github.com/ElmCast/elm-vim has this built in. Type :ElmShowDocs when over a token (e.g. Signal below) and you get lots of useful information:

screen shot 2016-02-08 at 2 18 44 am

Oh, sorry, I've mention ability to see this for my custom code.

search : String -> Query -> Effects (Maybe Response)
search endpoint query =
    let url = Http.url ("http://example.com" ++ endpoint)
            [ ( "key", "onlinedev" )
            , ( "q", query.q )
            , ( "region_id", "1" )
            ]
    in
        Http.get decode url
            |> Task.toMaybe -- Show me type here
            |> Effects.task

I'm talking not about Task.toMaybe docs but about concrete return type after execution of this line

Maybe next example would better show my idea

search endpoint query = -- :type = String -> Query -> Effects (Maybe Response)
    let url = Http.url ("http://example.com" ++ endpoint)
            [ ( "key", "onlinedev" )
            , ( "q", query.q )
            , ( "region_id", "1" )
            ]
    in
        Http.get decode url
            |> Task.toMaybe -- Show me type here
            |> Effects.task