1

Book "Type-driven Development with Idris" page 52 has

2.5 Summary ...

  • Function types have one or more input types and one output type.
  • The entry point to an Idris program is the main function, which must have type IO (), and be defined in the module Main.

The main function is defined as

main : IO ()

From my limited knowledge, without -> it is a variable rather than a function given that the summary states that a function must have at least one input.

I must miss something but why does the author call main, whose type has no arrows, a function?

In addition, can I call foo : Bar a function?

Gqqnbig
  • 5,845
  • 10
  • 45
  • 86
  • the first bullet point talks about function types, not functions. That then moves the question to "why isn't the type of the `main` function a function type"? I don't know, but I can well imagine he called it a function cos it's a function in C, Python, Java etc and he was used to calling it that. `main` is after all, being the program entrypoint, a bit special even in Idris, even if just in how it's used – joel Oct 19 '22 at 10:17

0 Answers0