The excellent PureScript book explains that
fullName :: forall r. Record (firstName :: String, lastName :: String | r) -> String
fullName person = person.firstName <> " " <> person.lastName
and then compares the Eff
monad
import Prelude
import Control.Monad.Eff.Random (random)
import Control.Monad.Eff.Console (logShow)
main :: forall eff. Eff (console :: CONSOLE, random :: RANDOM | eff) Unit
main = do
n <- random
logShow n
My question is:
Why doesn't the signature of main
contain a ->
before Unit i.e.
main :: forall eff. Eff (console :: CONSOLE, random :: RANDOM | eff) -> Unit
This would make it similar to the -> String
as in the signature of fullName
An excerpt from the same chapter(emphasis mine):
main is a computation with side-effects, which can be run in any environment which supports random number generation and console IO, and any other types of side effect, and which returns a value of type Unit
.
Eff
is# ! -> * -> *
? – Chris Martin