What does :: (double colon) stand for in Haskell?

后端 未结 3 398
闹比i
闹比i 2020-12-13 17:38

I see and use the :: symbols everywhere but still don\'t know what the :: symbol means when programming in Haskell, e.g.

r         


        
3条回答
  •  心在旅途
    2020-12-13 17:56

    When you have a big scary-looking typechecking error, you can (temporarily) wrap parts of your code in (myexpression :: MyType) to explicitly state to the compiler which type you're expecting myexpression to have. This will often help the compiler give you better error messages.

提交回复
热议问题