3 ms·
When writing OCaml, if I'm unsure of the type I set the type to some impossible value, compile it, and the compiler tells me what the type really is.
by rwmj 7y ago
When writing OCaml, if I'm unsure of the type I set the type to some impossible value, compile it, and the compiler tells me what the type really is.
- hnra 7y agoI Haskell you simply put a "_" in the annotation and the compiler suggests the correct type.
- dllthomas 7y agoYou can also do this with values, asking "what goes here?" - it's great.
- andrepd 7y agoAlternatively, merlin can tell you the type of the expression under your cursor, besides also flagging type mismatches like your situation.