Skip to content
This repository was archived by the owner on Oct 5, 2022. It is now read-only.
This repository was archived by the owner on Oct 5, 2022. It is now read-only.

Repl inputs not being written to its history #62

@freeman42x

Description

@freeman42x

This happens on v0.7.13 also.

How to reproduce:

module Ch13 where

import Control.Monad
import System.IO (hSetBuffering, stdout, BufferMode(..))
import System.Exit (exitSuccess)
import Data.Char (isLetter, toLower)

-- Madam I’m Adam,

palindrome :: IO ()
palindrome = do
  hSetBuffering stdout NoBuffering
  forever $ do
    line <- getLine
    if isPalindrome line
      then do
        putStrLn "It's a palindrome!"
        exitSuccess
      else putStrLn "Nope!"

isPalindrome :: String -> Bool
isPalindrome s = sm == reverse sm
  where
    sm = toLower <$> filter isLetter s

Load the module in the repl with :l
Type palindrome and
Type anything. Whatever you typed will not be written to the REPL history. If the Interrupts current computation button is pressed then the strings typed will appear in the history.

Expected behavior (repl run from terminal):

*Ch13> palindrome
qwe
Nope!
nqwejbqwe
Nope!
Madam I'm Adam
It's a palindrome!
*** Exception: ExitSuccess

Extra note, when interrupting, in the Repl tab it is printed:

Interrupted.
Variable not in scope: quehquehiquehiwe

So it appears that the Repl was treating the palindrome program input as input to the Repl itself and there was no variable named quehquehiquehiwe

This works as intended if run directly from GHCI.

Ref: #61

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions