1

Question :

Is it possible to run a program in Leksah and enter user input ? If yes, how ?

Reason for asking:

I tried two different ways to run a program in Leksah and enter user input and both ways failed:

First approach - running in normal mode (not GHCi) :

Simply writing to console works fine :

enter image description here

However, Leksah hangs when I try to run the following program, asking for input :

enter image description here

Second approach : using GHCi in Leksah.

Evaluating main2 works fine. Evaluating main hangs. It is not possible to enter input.

enter image description here

Any idea how one can enter user input when launching a program in Leksah ?

jhegedus
  • 20,244
  • 16
  • 99
  • 167

1 Answers1

3

I am afraid little has changed since the last time this came up. You can now make a GHCJS app and run it in the Out pane. It can include DOM input elements and handle DOM events. StdIn input is still unsupported.

Community
  • 1
  • 1
  • Many thanks ! Is there a workaround ? Perhaps running a GHCi in a terminal ? Or just running the executable from a terminal ? Is there a conflict between running an external GHCi + Leksah on the same project ? Is that problematic in some way or does that (GHCi in terminal + Leksah) work on the same cabal project just fine ? – jhegedus Jun 06 '15 at 07:46
  • @jhegedus Have you actually tried doing that? I imagine firing up a terminal, running ghci and seeing if you get any issues has a quicker turnaround time than asking people on the internet. – Cubic Jun 06 '15 at 08:00
  • @Cubic I don't know for sure what works and conflicts with Leksah and what not. I could keep playing around with it for hours, or just get a simple answer from an expert. This answer can also help other people facing the same problem. I consider your comment unconstructive and trolling. – jhegedus Jun 06 '15 at 08:12
  • There are a couple of work arounds described in the answers to the question I linked to. – Hamish Mackenzie Jun 06 '15 at 09:48
  • Thanks, I try, for now, I just use cabal repl. Seems to work fine, I hope it does not conflict with Leksah in some mysterious way behind the scenes. – jhegedus Jun 06 '15 at 19:36