Hello,
I've a data type:
data SomeData =
SomeData {
int1 :: Int,
int2 :: Int
}
class SomeClass where
infix 1 `i_`
i_ :: SomeData - Int - SomeData
infix 1 `_i`
_i :: SomeData - Int - SomeData
instance SomeClass
Hello,
I have two txt file,and i want to mix the two files line by line, e.g.
$ cat url1.txt
url1_1.line
url1_2.line
$ cat url2.txt
url2_1.line
url2_2.line
and i want this file as result:
$ cat aha.txt
url1_1.line
url2_1.line
url1_2.line
url2_2.line
i first write
On Wed, 2005-07-20 at 00:21 +0200, yin wrote:
Dinh Tien Tuan Anh wrote:
Hi,
Could anyone explain for me why its not possible to return a primitive
type (such as Integer, String) while doing some IO actions ?
e.g: foo :: IO() - String
What does it have to do with lazy evalution
Ben,
thanks for your clever questions.
Let's look at a little GHC 6.4 demo.
{-# OPTIONS -fglasgow-exts #-}
import Data.Generics
main = do
print $ toConstr () == toConstr ()
print $ toConstr (5::Int) == toConstr ()
print $ toConstr (\(x::Int)
Sun Yi Ming wrote:
Hello,
Hello,
this works fine, but i think if the two file are very big, and the
readFile will consume too many mem.so i need to read the file line by
line but stunned by the loop in IO Monad:
main = do h1 - openFile url1.txt ReadMode
h2 - openFile url2.txt ReadMode
On Wed, Jul 20, 2005 at 02:27:36PM +0800, Sun Yi Ming wrote:
Hello,
I have two txt file,and i want to mix the two files line by line, e.g.
$ cat url1.txt
url1_1.line
url1_2.line
$ cat url2.txt
url2_1.line
url2_2.line
and i want this file as result:
$ cat aha.txt
Am Montag, 18. Juli 2005 18:46 schrieb yin:
[...]
ld-options: -L/usr/lib -Wl -rpath /usr/lib -lSDL
This looks a bit suspicious: The syntax for ld options is -rpath DIR, so the
option for gcc should be -Wl,-rpath,DIR. Ugly, but I didn't invent
that. :-) Furthermore, I've never seen a
On Wed, 2005-07-20 at 14:27 +0800, Sun Yi Ming wrote:
[snip]
i first write this snippet of code:
---
import System.IO
mix :: [a] - [a] - [a]
mix [] ys = ys
mix xs [] = xs
mix (x:xs) (y:ys) = [x,y] ++ mix xs ys
f1 = do contents1 - readFile url1.txt
contents2 - readFile
To get exact fractions, use the Ratio module (import Ratio) and the
Rational type which is defined there.
Thanks dude, it works
The code you wrote below has a serious style problem that I thought
I'd point out: you shouldn't use the IO monad for pure functions.
I've never known that,
On Wed, 2005-07-20 at 11:43 +0200, yin wrote:
hello,
how do I convert an Word32 (or WordXYZ) to Int, or Integer, or Float,
...? The Int conversion is the priority.
Thanks.
Matej 'Yin' Gagyi
fromIntegral to convert to an instance of Integral, such as Int, Integer
etc
Cheers,
Bernie.
On Wed, 20 Jul 2005, Sun Yi Ming wrote:
mix :: [a] - [a] - [a]
mix [] ys = ys
mix xs [] = xs
mix (x:xs) (y:ys) = [x,y] ++ mix xs ys
mix xs ys = concat (Data.List.transpose [xs,ys])
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Arthur van Leeuwen [EMAIL PROTECTED] worte:
Ah, but this is exactly where lazyness wins bigtime: a smart
implementation
of readFile will lazily read the actual file for as far as needed. Thus,
reading with readFile will not read the entire file into memory at once.
What will happen is that
Bernard Pope wrote:
On Wed, 2005-07-20 at 11:43 +0200, yin wrote:
how do I convert an Word32 (or WordXYZ) to Int, or Integer, or Float,
...? The Int conversion is the priority.
fromIntegral to convert to an instance of Integral, such as Int, Integer
etc
Thank you, but how to Work32 -
On 7/20/05, Sven Panne [EMAIL PROTECTED] wrote:
Am Montag, 18. Juli 2005 18:46 schrieb yin:
[...]
ld-options: -L/usr/lib -Wl -rpath /usr/lib -lSDL
This looks a bit suspicious: The syntax for ld options is -rpath DIR, so the
option for gcc should be -Wl,-rpath,DIR. Ugly, but I didn't
On 18 July 2005 15:19, Bayley, Alistair wrote:
Not a taker (yet - where can I find information about non-lazy
implementation of non-strict languages? From Google so far:
speculative evaluation (Eager Haskell), call-by-name vs call-by-need.)
Wikipedia frustratingly hints that other
Hi,
I need to parse a file in this format:
float float float
float float float
Each row has 3-columns of floating procision number divided by white
space. The number of lines is undefined. I use (lines (readFile ...))
to read the file.
Thnks.
Matej 'Yin' Gagyi
On Wed, 20 Jul 2005, yin wrote:
Bernard Pope wrote:
On Wed, 2005-07-20 at 11:43 +0200, yin wrote:
how do I convert an Word32 (or WordXYZ) to Int, or Integer, or Float,
...? The Int conversion is the priority.
fromIntegral to convert to an instance of Integral, such as Int, Integer
From: John Goerzen [mailto:[EMAIL PROTECTED]
How would I make this sort of system play nice with Haskell threads?
Also, the brief FFI docs that I've found don't really explain
callbacks
in FFI very well to me. Are there any other resources on
this anywhere?
This might help:
Hello yin,
Wednesday, July 20, 2005, 1:18:25 AM, you wrote:
y data SomeData =
y SomeData {
y int1 :: Int,
y int2 :: Int
y }
y class SomeClass where
yinfix 1 `i_`
yi_ :: SomeData - Int - SomeData
yinfix 1 `_i`
y_i
Hello Alberto,
Tuesday, July 19, 2005, 5:11:27 PM, you wrote:
AR Hello Bulat, thanks a lot for your message, the RULES pragma is just what we
AR need!
AR However, in some initial experiments I have observed some strange behavior.
AR For instance, in the following program:
1) there is no
On 20 July 2005 14:35, John Goerzen wrote:
I'm looking at packaging an event-driven console widget set (CDK) for
Haskell using FFI. I know that other event-driven widget sets have
Haskell bindings, but I'm not quite sure how to make everything play
nice with forkIO.
These systems
On Wed, Jul 20, 2005 at 04:10:38PM +0100, Simon Marlow wrote:
On 20 July 2005 14:35, John Goerzen wrote:
These systems generally have some sort of an opaque main loop,
implemented in C. This loop would usually never return, or perhaps
only return once the UI is destroyed.
Is the library
On 20 July 2005 16:23, John Goerzen wrote:
On Wed, Jul 20, 2005 at 04:10:38PM +0100, Simon Marlow wrote:
On 20 July 2005 14:35, John Goerzen wrote:
These systems generally have some sort of an opaque main loop,
implemented in C. This loop would usually never return, or perhaps
only return
I need to parse a file in this format:
float float float
float float float
Each row has 3-columns of floating procision number divided by white
space. The number of lines is undefined. I use (lines (readFile ...))
to read the file.
Text.ParserCombinators.Parsec sounds perfect, no?
On Wed, 20 Jul 2005, Jake Luck wrote:
I need to parse a file in this format:
float float float
float float float
Each row has 3-columns of floating procision number divided by white
space. The number of lines is undefined. I use (lines (readFile ...))
to read the file.
How about this?
instance Show Process where
show Stop = Stop
show (Prefix l p) = concat [(, l, -, show p, )]
show (External p q) = concat [(, show p, [] , show q, )]
Hope that helps,
Bryn
Andy Gimblett wrote:
A small stylistic question: what's the best way to build strings
On 7/20/05, Andy Gimblett [EMAIL PROTECTED] wrote:
A small stylistic question: what's the best way to build strings
containing other values? For example, I have:
data Process = Stop |
Prefix String Process |
External Process Process
instance Show Process
On Wed, Jul 20, 2005 at 07:00:22PM +0200, Lemmih wrote:
On 7/20/05, Andy Gimblett [EMAIL PROTECTED] wrote:
Is there a facility like this in Haskell? Or something else I should
be using, other than lots of ++ ?
There's Text.Printf:
Prelude Text.Printf printf (%s [] %s) hello world ::
On 2005-07-20, Simon Marlow [EMAIL PROTECTED] wrote:
This paper might help shed some light:
http://www.haskell.org/~simonmar/papers/conc-ffi.pdf
Forgot to reply to this. *Very helpful* link, I had always wondered
what the bound thread functions in Control.Concurrent were for :-)
So let me
There was a brief discussion on #haskell today about the Haskell
standard. I'd like to get opinions from more people, and ask if there
is any effort being done in this direction presently.
I think an updated standard is overdue. I find it difficult anymore to
write any but the most trivial of
John Goerzen writes:
There was a brief discussion on #haskell today about the Haskell
standard. I'd like to get opinions from more people, and ask if there
is any effort being done in this direction presently.
snip
I know that some people would like to hold off on such a process until
On 20-Jul-2005, David Barton [EMAIL PROTECTED] wrote:
I can contribute some experience from commercial standardization efforts.
ANSI, IEEE, and ISO standards require re-ballotting every five years,
otherwise the standards lapse. Reballotting may or may not be accompanied
by changes in the
32 matches
Mail list logo