Perhaps the following code will fit your purpose:
main :: IO ()
main = do
file <- readFile "c:/myfile.txt"
word <- getWordIO file
getWordIO :: String -> IO String
getWordIO word = return (getWord word)
Where getWord is the same you defined. You can also try:
main :: IO ()
main = readFi
use unsafePerformIO (that's this year's April fools' joke :-).
Do a Google on "Monads Haskell" and you will find plenty of answers; in
short you should "bind" the result of readFile using (>>=) : IO a -> (a ->
IO b) -> IO b.
Erik
- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL
I am a bit confused by your response Mieszko. What I am looking to do is have a
function say called
ConvertString :: IO String -> String
or something like that. Not sure if your examples achieve this. I want to take the
IO String and be able to use it as a String somehow. My problem is I
I am new to the list and to Haskell, and would appreciate any help anyone can give
me on a problem I am having. I am using Hugs98 in case that matters.
My question involved reading from a file. I used the line:
readFile "c:/myfile.txt"
To read my file and this works fine. I now want
> I don't seem to be able have multiple modules in one file (at least
> for hugs and ghc).
As far as I know, the only compiler that ever supported this was the
Yale compiler (which is no longer maintained and probably hard to track
down).
The current trend is to put each module in a file by
> I need a class tree for haskell. where can i find it?
I'm interpreting this as you want a picture showing how the standard Haskell
classes relate to each other.
And my answer is to scroll 1/4 - 1/3 of the way down this page looking for a big
picture.
http://haskell.org/onlinereport/basic
> I'm new in ffi stuff and tools like greencard.
> Everything was working ok, until I wanted to:
>
> translate a haskell recursive data type(list,trees,etc) into
> a corresponding C type and back again.
>
> How can I do this?
If you want to see how to convert Haskell lists into arrays, look at th
Experimenting recently with some quantum problems I've
decided that it's time to add some long overdue
algorithmic support for module QuantumVector.
So here are two new modules added to our collection:
http://www.numeric-quest.com/haskell/LinearAlgorithms.
> Do you know roughly how small nhc98 can get?
> Even if a 16-bit system is impossible, having a small 32-bit Haskell
> could be of interest in other connections.
The executable for a "hello world" type program currently comes out
at about 115kb code size when compiled with nhc98. We have done
Malcolm Wallace wrote:
>
> > There is nhc98, of course, but it is somewhat bulky for the purposes I
> > have in mind. I am looking for something small that would compile to
> > 16-bit code that would run in 64K code + 64K data.
>
> It's a shame that nhc98 doesn't fit your requirements, since it
> There is nhc98, of course, but it is somewhat bulky for the purposes I
> have in mind. I am looking for something small that would compile to
> 16-bit code that would run in 64K code + 64K data.
It's a shame that nhc98 doesn't fit your requirements, since it is
specifically designed for creati
11 matches
Mail list logo