How to fix the code OAI-bot made?

I asked Open AI bot to make a simple page in halogen instead of the module TryPurescript using as base my page..

Here is the new version made by AI bot.
Result three errors.

I think this shall fix one error:

import Halogen.HTML  as HH

This could fix another error:

import Halogen.Aff.Driver as HA

The last error remains. What should be done for it?

Unknown data constructor *Nothing*

Note, here is the new fixed code containing the last error only.

It’s just missing
import Data.Maybe (Maybe(..))
But then that reveals new errors.

Some of this might be easier to paste into an IDE instead of TryPurescript, since an IDE will be able to fix missing imports for you automatically, but maybe you are wanting to avoid the trouble of setting up an IDE?

Thanks for reply. Yes, Maybe is needed of course.
I’m way too lazy to configure an IDE for myself, as beginner just trying to do some tiny codes for fun.

I wonder, is there any simple alternative for huge Halogen library to use html and css?

When I continue learning PureScript, I must anyway use kind of interactive codes too and then It’s necessary to use halogen again. A good start is the simplest possible code, the PureScript example of counter with buttons and it may be easily extended .

If you’re looking for something simple to start with perhaps you can check out purescript-web-* packages on Pursuit and try out examples in Purescript Cookbook.

1 Like

Cookbook is good as it has often own versions for use in <try.purescript> and in node (or in browser-console).

Pursuit is needed in my case mainly as searching the right packages for new importable modules but Pursuit has seldom any examples of using the functions, just the head annotations which are often hard to understand. I’ll anyway search on Pursuit with purescript-web-*

P.S. From now on, I shall not give anymore links to my stuff in GH allthough it’s especially usefull just if used in connection to <try.purescript>. The reason: two from three of my yesterday posts were flagged as spam, and I don’t know, why!
My conclusion - maybe, because I have sent as beginner more than two links on the same day or in this discussion chain or because the links point to my GH account.

In future posts, I’ll just copy my own source codes instead of links.That means a little bit longer posts in future :slight_smile:
Well, this may be my last posting in this forum. If that is so, Ill stop learning PS and return to the other forum for FP language which I have used before - Elm.

1 Like

Discourse did flag your posts as a relatively new user sharing links to the same domain. But I’ve approved them and you should be good!

2 Likes