Skip to content

Asking for the type of an expression #3

@chris-martin

Description

@chris-martin

We've already covered this once in using the REPL, but here's another quick way of asking for a type that's useful when you're using the text editor + ghcid setup.

If you don't know the type of some expression, leave an underscore (this is called a "hole") and the display in ghcid will tell you what type goes there.

loadConfig :: _
loadConfig = Data.Ini.readIniFile "config.ini"
    • Found type wildcard ‘_’
        standing for ‘IO (Either String Data.Ini.Ini)’

It's pretty magical that you can just type :: _ after an expression to make the type pop up in ghcid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good for new contributorsPull requests welcome!new exampleThis issue is about writing a new example program.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions