[Haskell-cafe] How to read a file and return a String?

2013-09-04 Thread yi lu
I want to read a text file, and store it in a *String*. But readFile will
get *IO String*. I search with google and they tell me it is not
necessarily to do so. Can you explain to me why is this? Furthermore, How
to read a file and store it in a String?

In fact, I want to read a file and split it into *[String]* with
*lines*function. Here is what I have tried.
linkhttps://github.com/eccstartup/findDict/blob/master/src/Data/Dict/Utils.hsI
think I could directly operate on
*[String]*. But it is not true for me.


[1] http://www.haskell.org/hoogle/?hoogle=IO+String+-%3E+String


Yi Lu
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Can I use String without in ghci?

2013-09-01 Thread yi lu
I want to know if it is possible that I use strings without .

If I type
*Preludefoo bar*
which actually I mean
*Preludefoo bar*
However I don't want to type s.

I have noticed if *bar* is predefined or it is a number, it can be used as
arguments. But can other strings be used this way? Like in bash, we can use
*ping 127.0.0.1* where *127.0.0.1* is an argument.

If not, can *foo* be defined as a function so that it recognize arguments
like *bar* as *bar*?


Thanks,
Yi Lu
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] How can I use ghci more wisely?

2013-07-23 Thread yi lu
I am wondering how can I ask ghci to show an infinite list wisely.
When I type

*fst ([1..],[1..10])*

The result is what as you may guess

*1,2,3,4,...*(continues to show, cut now)

How could I may ghci show

*[1..]*

this wise way not the long long long list itself?

Yi
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe