[Haskell-cafe] Re: Closest analog to popen()

2005-04-13 Thread Peter Simons
Dimitry Golubovsky writes: Does there exist any analog of popen in the standard Haskell libraries? Maybe System.Process.runInteractiveCommand is what you need? http://haskell.org/ghc/docs/latest/html/libraries/base/System.Process.html Peter ___

Re: [Haskell-cafe] Binary file r/w example

2005-04-13 Thread Cale Gibbard
Ptr is defined in the FFI, which is documented here: http://www.cse.unsw.edu.au/~chak/haskell/ffi/ and also in the GHC documentation: http://www.haskell.org/ghc/docs/latest/html/libraries/base/Foreign.Ptr.html I haven't done much binary IO, so I'll let someone else handle that, but there are

Re: [Haskell-cafe] Installing and running QuickCheck

2005-04-13 Thread adam
Hi Daniel, Yes, importing Data.Char worked, but revealed other problems. Now I get the following. ERROR C:\Program Files\Hugs98\libraries\QuickCheck.hs:161 - Undefined variable fromInt Monad This, however, I have seen before, and it has to do with different versions of Prelude, where fromInt

[Haskell-cafe] [Q] A typing problem

2005-04-13 Thread Didier Verna
Hi ! I'm trying to write a function that combines folding and mapping. This function would take two arguments (a folding function and a mapping function), and would return a function of one argument (a list of 'a''s) returning a 'a'. The idea is to write something like sumsquare =

Re: [Haskell-cafe] [Q] A typing problem

2005-04-13 Thread Henning Thielemann
On Wed, 13 Apr 2005, Didier Verna wrote: I'm trying to write a function that combines folding and mapping. This function would take two arguments (a folding function and a mapping function), and would return a function of one argument (a list of 'a''s) returning a 'a'. The idea is to write

[Haskell-cafe] foldr1 min [(maxBound::Int)%1,1 % 2]

2005-04-13 Thread Bo Herlin
Hi How come foldr1 min [(maxBound::Int) % 1,1 % 2] 2147483647 % 1 but foldr1 min [2147483647 % 1,1 % 2] 1 % 2 Why??? /Bo Herlin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] foldr1 min [(maxBound::Int)%1,1 % 2]

2005-04-13 Thread Henning Thielemann
On Wed, 13 Apr 2005, Bo Herlin wrote: Hi How come foldr1 min [(maxBound::Int) % 1,1 % 2] 2147483647 % 1 I guess that foldr1 min == minimum but foldr1 min [2147483647 % 1,1 % 2] 1 % 2 Why??? The first one certainly causes an overflow with machine word Ints whereas 2147483647 is an Integer and

Re: [Haskell-cafe] foldr1 min [(maxBound::Int)%1,1 % 2]

2005-04-13 Thread Cale Gibbard
Hmm... let a = (maxBound :: Int)%1 in 1 a a 1/2 == True From the Ord instance for Ratio a (x:%y) (x':%y') = x * y' x' * y So the comparison for 1 a looks like 1 * 1 (maxBound :: Int) * 1 which is true. And the comparison for a 1/2 looks like (maxBound :: Int) * 2 1 * 1 == -2 1

Re: [Haskell-cafe] [Q] A typing problem

2005-04-13 Thread Claus Reinke
I'm trying to write a function that combines folding and mapping a map is a fold:) idList = foldr (:) [] map f = foldr ((:) . f) [] foldmap :: (b - b - b) - (a - b) - [a] - b foldmap f m = foldr1 f . map m alternatively, and dealing with empty lists as well foldmap op n f = foldr (op . f) n

[Haskell-cafe] Passing Constructors as arguments

2005-04-13 Thread Ralph Hodgson
I am learning Haskell and have set a small exercise for myself on a frames and slots program. Would appreciate some help on how to pass constructors of data structures as arguments to a function. Thanks, -- Ralph __ A Frames test module Frames where Define frame slots:

Re: [Haskell-cafe] foldr1 min [(maxBound::Int)%1,1 % 2]

2005-04-13 Thread Bo Herlin
Hmm, too simple :-P ...Thanks Henning Thielemann wrote: On Wed, 13 Apr 2005, Bo Herlin wrote: Hi How come foldr1 min [(maxBound::Int) % 1,1 % 2] 2147483647 % 1 I guess that foldr1 min == minimum but foldr1 min [2147483647 % 1,1 % 2] 1 % 2 Why??? The first one certainly causes an overflow

Re: [Haskell-cafe] foldr1 min [(maxBound::Int)%1,1 % 2]

2005-04-13 Thread Bo Herlin
Yep, got it, Thanks! Cale Gibbard wrote: Hmm... let a = (maxBound :: Int)%1 in 1 a a 1/2 == True From the Ord instance for Ratio a (x:%y) (x':%y') = x * y' x' * y So the comparison for 1 a looks like 1 * 1 (maxBound :: Int) * 1 which is true. And the comparison for a 1/2 looks like

Re: [Haskell-cafe] Passing Constructors as arguments

2005-04-13 Thread Daniel Fischer
Am Mittwoch, 13. April 2005 15:43 schrieb Ralph Hodgson: I am learning Haskell and have set a small exercise for myself on a frames and slots program. Would appreciate some help on how to pass constructors of data structures as arguments to a function. Thanks, -- Ralph snip Now I need a

Re: [Haskell-cafe] [Q] A typing problem

2005-04-13 Thread Didier Verna
Henning Thielemann [EMAIL PROTECTED] wrote: Do you mean foldmap :: (b - b - b) - (a - b) - [a] - b foldmap f m = foldr1 f . map m But of course ! Thanks :-) -- Didier Verna, [EMAIL PROTECTED], http://www.lrde.epita.fr/~didier EPITA / LRDE, 14-16 rue Voltaire Tel.+33 (1) 44 08 01

Re: [Haskell-cafe] Passing Constructors as arguments

2005-04-13 Thread Pierre Barbier de Reuille
I don't really understand what you want to achieve : constructors are functions, thus first class objects ... I suppose you want a destructor, ie a function extracting the first name from a property for example. You may want to have a look there : http://haskell.org/hawiki/DecoratingStructures

Re: [Haskell-cafe] Passing Constructors as arguments

2005-04-13 Thread Ralph Hodgson
Thanks for your help Daniel - I am clarifying my message Daniel Fischer wrote: Am Mittwoch, 13. April 2005 15:43 schrieb Ralph Hodgson: I am learning Haskell and have set a small exercise for myself on a frames and slots program. Would appreciate some help on how to pass constructors of data

Re: [Haskell-cafe] Passing Constructors as arguments

2005-04-13 Thread Daniel Fischer
Am Mittwoch, 13. April 2005 17:14 schrieben Sie: Thanks for your help Daniel - I am clarifying my message I would like to see an example of passing constructors as arguments. I am still getting familiar with constructs like: getProperty ( a - b) - [ContactProperty] - b I am not sure how

Re: [Haskell-cafe] Re: Closest analog to popen()

2005-04-13 Thread Dimitry Golubovsky
Peter Simons wrote: Dimitry Golubovsky writes: Does there exist any analog of popen in the standard Haskell libraries? Maybe System.Process.runInteractiveCommand is what you need? http://haskell.org/ghc/docs/latest/html/libraries/base/System.Process.html Is this available only in 6.4? In 6.2.2