Try.Purescript.org does not work with the homepage example

Hi

How come the code on the official Purescript page does not work in http://try.purescript.org/ ?

If I clear the input and put:

    module Main where

    import Prelude
    import Effect.Console (log)

    greet :: String -> String
    greet name = "Hello, " <> name <> "!"

    main = log (greet "World")

I get

Error 1 of 1

  Unknown module Effect.Console

But if I do

module Main where

import Prelude
import Control.Monad.Eff.Console (log)
import TryPureScript

greet :: String -> String
greet name = "Hello " <> name <> "!"

main = render =<< withConsole do
  log $ show $ greet "ppq"

I get

"Hello ppq!"

Is it just running with an older version? Is the homepage out of date or the try.purescript site?

try.purescript.org is the one which is out of date: it is running a compiler in the v0.11.x series (can’t remember exactly which one), which is quite old now, since we are currently gearing up for v0.14.0. We are currently working on getting try.purescript.org updated, I am hoping to have it done over the next week or two.

2 Likes

Also, if you’re learning PureScript for the first time, please use the updated version of the PureScript by Example book here: https://book.purescript.org/

Hey @JordanMartinez thanks for the book link, and the awesome resource you have authored

Actually I have been reading the updated version of the book directly from the repo - I opened an issue about Ch. 2 here :blush:

@hdgarrood oh great, thanks for this

I am building a little webapp with a Purescript frontend, I’ll share it once is done (is really a toy project to intro myself to the lang…so be gentle :smiley: )

2 Likes