Questions tagged [ghci]

GHCi is the interactive environment (REPL) for the Glasgow Haskell Compiler.

GHCi is the interactive environment (REPL) for the Glasgow Haskell Compiler and GHCi is one of the main tools used to develope, test and debug Haskell.

Typically, ghci-tag is associated with questions

  • different use cases of ghci, how it works
  • ghci environment settings, tuning
  • customization of ghci environment, scripting
  • how ghci can be used with other tools
  • development of the ghci

There is Haskell-wiki that describes the basic use and customization of GHCi.

1069 questions
0
votes
2 answers

2D haskell tuple index

I have the following tuple representing a 2D matrix in Haskell let a =[(1,2,3),(4,5,6),(7,8,9)] How can I access each index individually? (e.g. a[1][1], a[0][1] etc.) Is there a better way to interpret 2D arrays in haskell?
user1730250
  • 582
  • 2
  • 9
  • 26
0
votes
1 answer

Haskell, my "Knights_tour" approach stops working when I change from 61 to 63 moves

I'm new in the Haskell world, and probably my question is a silly one, but I just can't understand the behavior of ghci or ghc in this situation. I tried to solve the old "Knights_Tour" problem from 99-questions on haskell.org, and the solution I…
0
votes
2 answers

how to write numbers in lambda using ghci

I am new to Haskell, using Ghci. I have a function, called three, that I want to write as let three = \x->(\y->(x(x(x y)))) OK, this works, but when I try three (2+) 4 It does not work. Instead, I get some "cannot construct infinite type"…
Sumit
  • 1
0
votes
1 answer

Calling "gnuplot" from within ghci corrupts the terminal. Is it possible to restore it?

For example, see this session: Prelude> import System.Process Prelude System.Process> system "gnuplot filename.gnu" Prelude System.Process> Now, whenever I type at the terminal, nothing appears. (Strangely, input is still being read in like…
Mike Izbicki
  • 6,286
  • 1
  • 23
  • 53
0
votes
1 answer

Could we have a briefer :info output in ghci?

Is there a reason why the output of :info in ghci is listing the type name after every class it belongs to? For example Prelude> :info Int` prints ... instance Bounded Int -- Defined in `GHC.Enum' instance Enum Int -- Defined in…
acorello
  • 4,473
  • 4
  • 31
  • 46
0
votes
1 answer

Cabal IPPrint package fails to build

I am trying to get this coloured ghci prompt to work. I am getting the following error which I suspect is due to cabal not updating the right package. Anyone has any idea? ; cabal install IPPrint [...] System/Unix/Chroot.hs:23:49: Module…
Sardathrion - against SE abuse
  • 17,269
  • 27
  • 101
  • 156
0
votes
1 answer

Haskell ghci command line. return value overwrite last prompt

I installed ghci on Max OSX. But everytime, the return value overwrite my last ghci prompt. See below. Falseghci>null[1,2,3] Luke_ghci> "False" over write my last line ghci prompt. (should be Luke_ghci) So weird. How to solve it? Thanks.
David Degea
  • 1,378
  • 2
  • 12
  • 18
-1
votes
1 answer

why i got error while launching stack build?

I am new in haskell programming. For my university project our teacher send us the project and ask us to run these command : "stack init" then "stack build" when i am running stack build a got this error : Project.cabal was modified manually.…
-1
votes
1 answer

using zipWith with your custom function?

How can i use zipWith with my own functions? I want to add square of numbers from two lists. Until now i have this: zipWith' :: (a -> b -> c) -> [a] -> [b] -> [c] zipWith' _ [] _ = [] zipWith' _ _ [] = [] zipWith' f (x:xs) (y:ys) = f x y :…
-1
votes
2 answers

How to get a list of tuples and create a list of tuples with lists inside of them

My goal is to take an input like: [(8, P1), (8, P2), (10, P3)] And turn it into something like: [(8, [P1, P2]), (10, P3)] Given that numbers like 8 and 10 are the datatype Time (wrapping and Int) and P1 and P2 are the datatypes Person (which wraps…
guib
  • 115
  • 5
-1
votes
1 answer

How to change a variable's value in GHCI debugger?

Is it possible to change a variable's value in GHCI debugger? If yes, please show me how?
user1532146
  • 184
  • 2
  • 14
-1
votes
2 answers

How to best workaround Haskell 8.03 GHCI getLabelBc: Ran out of labels?

What is the cause of this error and how can I get around it? I have reduced the size of the static data as a workaround but is there any way to create static data in haskell that does not run into this error? Basically I want to create large lists…
h4ck3rm1k3
  • 2,060
  • 22
  • 33
-1
votes
1 answer

How the input should go inside the ghci interpreter?

I'm trying a program from this tutorial. The program goes like this: type Name = String type PriceInCents = Int type ShoppingListItem = (Name, PriceInCents) type ShoppingList = [ShoppingListItem] shoppingList :: ShoppingList shoppingList = […
Mel
  • 111
  • 1
  • 12
-1
votes
1 answer

Haskell returning incorrect result

Possible Duplicate: Haskell: Unexpected output for expression [0, 0.1 .. 1] In Haskell, does anyone know the reason for the following result? Prelude Data.List> map (\x -> x - 0.1)…
Longshanks
  • 309
  • 2
  • 11
-1
votes
1 answer

Haskell importing Modules

I need to import Data.Char into my .hs file, in order to run the script in GHCi. When I just add "import Data.Char" the console seems to complain and gives me parse error. How do I do that properly? I know its probably very simple, but I could not…
foFox
  • 1,124
  • 1
  • 14
  • 24
1 2 3
71
72