Total Haskell noob here. I have a simple function, and a main. I don’t have any idea what this error means:
Couldn't match expected type `IO t0' with actual type `Bool'
In the expression: main
When checking the type of the function `main'
when compiling the code:
is_instructor :: String -> Bool
is_instructor "Jeremy Erickson" = True
is_instructor x = False
main :: Bool
main = is_instructor "foo"
mainis the thing that gets called when you run your programme. It is expected that a programme does in some way interact with the outside world (read input, print output, such things), therefore it’s reasonable that amainshould have the typeIO something. For reasons of type safety and simplicity, that is a requirement in Haskell, likemainin Java must have typepublic static void main(String[] arrgh).You probably wanted you value to be printed, so
would be what you want.