haskeline

cabal-install-0.10.2 failed during the building phase

╄→гoц情女王★ 提交于 2020-01-14 05:55:28
问题 I was trying to install haskeline, it's my first time installing using cabal, and here is what I got. What should I do? . sudo cabal install haskeline Password: Config file /Users/arie/.cabal/config not found. Writing default configuration to /Users/arie/.cabal/config Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal update' to download it. cabal: There is no package named haskeline . sudo cabal update Downloading the latest package list from hackage.haskell.org

Haskell Best Practise: Early termination in Haskeline

孤街醉人 提交于 2019-12-23 09:47:29
问题 I am using the Haskeline package and I want to get three strings in a row from the command line before I do anything and I have come up with what seems to be a neat solution to me. But I am sure that there might be a better way to do it. I am looking for best practices while using the Haskeline package. Please evaluate the merits of the following example code: import System.Console.Haskeline import Control.Monad.Trans import Control.Monad.Maybe import Data.Maybe import Control.Monad main ::

unwrap getInputLine result from Input

旧巷老猫 提交于 2019-12-11 04:44:56
问题 I'm getting a result from getInputline , whose type is: (MonadException m) => IO String -> InputT m (Maybe String) I'd like to get just the Maybe String part. I'm well aware that in general there is no way to strip a monad, as explained in this answer (and other answers in the same question). However, since I'm doing it inside an InputT , I guess it's possible, as proposed here. However, I can't just use liftIO , as the answer suggests, since the IO is inside a StateT . loop :: Counter ->

“readline” (or “haskeline”) for Curry?

寵の児 提交于 2019-12-11 02:48:47
问题 What's the most practical way to write a program in Curry programming language that would have a console UI with decent line editing? Actually, I need to pass a string as a suggestion for the user's input, then let the user edit it in the console, and receive his edited variant back, process it (w.r.t. to the current state of the process), then loop. I like readline-like/haskeline-like editing. (And BTW haskeline in its latest version (0.6.4.0) has exactly the API for what I want: read a line

Perform simple IO in Haskeline, inside InputT monad, without having to resort to unsafePerformIO

為{幸葍}努か 提交于 2019-12-04 03:13:21
问题 Given the proof of concept code below I'd like to be able to somehow perform my foo function with the ability to output the string Paul! and the possibility of getting its return value inside the InputT monad-transformer without using unsafePerformIO to remove the IO wrapper after runExceptT . import Control.Monad.Except import System.IO.Unsafe (unsafePerformIO) import System.Console.Haskeline type ErrorWithIO = ExceptT String IO foo :: String -> ErrorWithIO String foo "paul" = do liftIO $

Perform simple IO in Haskeline, inside InputT monad, without having to resort to unsafePerformIO

我的梦境 提交于 2019-12-01 17:42:03
Given the proof of concept code below I'd like to be able to somehow perform my foo function with the ability to output the string Paul! and the possibility of getting its return value inside the InputT monad-transformer without using unsafePerformIO to remove the IO wrapper after runExceptT . import Control.Monad.Except import System.IO.Unsafe (unsafePerformIO) import System.Console.Haskeline type ErrorWithIO = ExceptT String IO foo :: String -> ErrorWithIO String foo "paul" = do liftIO $ putStrLn "Paul!" return "OK!" foo _ = throwError "ERROR!" runRepl :: IO () runRepl = runInputT