J126
J126

Reputation: 309

I Can't Stop Haskell From Listing Numbers

My question is simple. I told Haskell b = [1..]. I then typed b. Now Haskell is listing all the natural numbers. How do I stop it from doing that?

Upvotes: 15

Views: 930

Answers (1)

David Young
David Young

Reputation: 10793

It depends on the environment you're using, but try control-C. That should send an interrupt signal to GHCi. If you want to just get a certain number of elements from a list, you can use the take function: take 10 [1..].

Upvotes: 16

Related Questions