Re: [Haskell-cafe] What is a number. (Was: Num instances for 2-dimensional types)

2009-10-06 Thread Jason Dagit
On Mon, Oct 5, 2009 at 11:02 AM, Sönke Hahn sh...@cs.tu-berlin.de wrote: On 5 Oct 2009, at 21:06, Lennart Augustsson wrote: OK, just pairs have no arithmetic, but one way of defining arithmetic is to treat the pairs as complex numbers. Or as mantissa and exponent. Or as something

Re: [Haskell-cafe] Re: Haskell Platform - changing the global install dir

2009-10-06 Thread Paul Moore
2009/10/6 Mikhail Glushenkov the.dead.shall.r...@gmail.com: Hi Paul, Paul Moore p.f.moore at gmail.com writes: Is there a way I could have specified that I want the global install directory in D:\Apps\Haskell? I guess I could hack my cabal\config file (and presumably change PATH) but that

Re: [Haskell-cafe] Generalizing IO

2009-10-06 Thread Gregory Crosswhite
It isn't clear what it is that you are trying to generalize the code to do. If you are trying to generalize it to work with an arbitrary input/output stream of lines, then unless you are doing arbitrary I/O it seems to me that all of these instance declarations are overkill. All that you

Re: [Haskell-cafe] Generalizing IO

2009-10-06 Thread Gregory Crosswhite
Oh, and I just thought of one more approach: class StreamMonad m where fetchLine = m sendLine = String - m () instance StreamMonad IO where fetchLine = getLine sendLine = putLine fetchLineFromStream = lift fetchLine sendLineToStream = lift . sendLine type

Re: [Haskell-cafe] Re: Haskell Platform - changing the global install dir

2009-10-06 Thread Mikhail Glushenkov
Hi Paul, On Tue, Oct 6, 2009 at 9:11 AM, Paul Moore p.f.mo...@gmail.com The ugliness (a bad word, I agree) was the need to change multiple items - (at least) 2 places in the config file and (presumably) the PATH entry. Is that all I need to change? I'm not a Cabal expert, but it looks like

Re: [Haskell-cafe] Re: Haskell Platform - changing the global install dir

2009-10-06 Thread Paul Moore
2009/10/6 Mikhail Glushenkov the.dead.shall.r...@gmail.com: Hi Paul, On Tue, Oct 6, 2009 at 9:11 AM, Paul Moore p.f.mo...@gmail.com The ugliness (a bad word, I agree) was the need to change multiple items - (at least) 2 places in the config file and (presumably) the PATH entry. Is that all

Re: [Haskell-cafe] Re: Curried function terminology

2009-10-06 Thread David Virebayre
On Mon, Oct 5, 2009 at 11:52 AM, Jon Fairbairn jon.fairba...@cl.cam.ac.uk wrote: [1] A pet peeve of mine is x supports y being used backwards (as in our application supports windows Vista, which would only make sense if it were something like a system tool that stopped Vista crashing. (Not a

[Haskell-cafe] Re: Curried function terminology

2009-10-06 Thread Jon Fairbairn
David Virebayre dav.vire+hask...@gmail.com writes: On Mon, Oct 5, 2009 at 11:52 AM, Jon Fairbairn jon.fairba...@cl.cam.ac.uk wrote: [1] A pet peeve of mine is x supports y being used backwards (as in our application supports windows Vista, which would only make sense if it were something

Re: [Haskell-cafe] What is a number. (Was: Num instances for 2-dimensional types)

2009-10-06 Thread Henning Thielemann
On Mon, 5 Oct 2009, Jason Dagit wrote: 2. How can i use numeric literals to construct values, whose types are not in the Num class? Numeric literals are treated as Integer or Rational, and are then converted with the function fromInteger or fromRational, respectively, to the required type.

Re: [Haskell-cafe] Re: Haskell Platform - changing the global install dir

2009-10-06 Thread Paul Moore
2009/10/6 Mikhail Glushenkov the.dead.shall.r...@gmail.com: Hi Paul, Paul Moore p.f.moore at gmail.com writes: Is there a way I could have specified that I want the global install directory in D:\Apps\Haskell? I guess I could hack my cabal\config file (and presumably change PATH) but that

Re: [Haskell-cafe] Re: Haskell Platform - changing the global install dir

2009-10-06 Thread Bertram Felgenhauer
Paul Moore wrote: grep global -A7 D:\Documents and Settings\uk03306\Application Data\cabal\config install-dirs global -- prefix: D:\\Apps\\Haskell\\Cabal ^^^ You should remove the '-- '. Lines beginning with '--' are comments. So this line has no effect. HTH, Bertram

Re: [Haskell-cafe] I/O Haskell question

2009-10-06 Thread Brandon S. Allbery KF8NH
On Oct 5, 2009, at 17:45 , Terry Hayes wrote: I found the handling of (IO t) by the interpreter (GHCI in my case) to be somewhat confusing. As pointed out below, I can type: readFile bla :: IO String and GHCI happily displays the contents of the file. However neither of the

Re: [Haskell-cafe] Generalizing IO

2009-10-06 Thread Floptical Logic
class StreamMonad m where        fetchLine = m        sendLine = String - m () instance StreamMonad IO where        fetchLine = getLine        sendLine = putLine fetchLineFromStream = lift fetchLine sendLineToStream = lift . sendLine This approach makes more sense to me. The equivalent

Re: [Haskell-cafe] Re: Haskell Platform - changing the global install dir

2009-10-06 Thread Paul Moore
2009/10/6 Bertram Felgenhauer bertram.felgenha...@googlemail.com: Paul Moore wrote: grep global -A7 D:\Documents and Settings\uk03306\Application Data\cabal\config install-dirs global   -- prefix: D:\\Apps\\Haskell\\Cabal    ^^^ You should remove the '-- '. Lines beginning with '--' are

[Haskell-cafe] ANNOUNCE: Graphalyze-0.8.0.0 and SourceGraph-0.5.5.0

2009-10-06 Thread Ivan Lazar Miljenovic
To keep Joe Fredette happy [1] this time, I've combined these two announcements into one. [1] http://sequence.complete.org/hwn/20091003 I'm pleased to announce the latest versions of Graphalyze [2] and SourceGraph [3]. The only change to Graphalyze has been the addition of Legend support

[Haskell-cafe] dsl and gui toolkit

2009-10-06 Thread Andrew U. Frank
thanks for the connection to the gui runner - it is interesting and worthwile, but a different approach. my approach is strictly declarative and does not describe sequences of process. it describes screens and links operations to buttons. then it takes inputs from the screen and runs the

Re: [Haskell-cafe] Generalizing IO

2009-10-06 Thread Gregory Crosswhite
Putting a constraint on the MonadIO class actually makes your code less general rather than more since it prevents your code from ever being used in a purely functional setting. If you leave out this constraint, you can actually turn your code into a pure function by doing things like

Re: [Haskell-cafe] dsl and gui toolkit

2009-10-06 Thread John A. De Goes
This is the right approach to a GUI toolkit. Note that personally, I believe the details of the presentation should be separate from Haskell, stored in a separate file that is machine- friendly, so designers can work in concert and in parallel with developers. Regards, John A. De Goes

[Haskell-cafe] Calling Haskell from C, Linking with gcc?

2009-10-06 Thread John Velman
I think if I knew which libraries to add to the gcc link, I could make this work, but can't seem to find out from the documentation. Here are more specifics: I'd like to build a Cocoa program on OS X with the Aqua user interface using Xcode, but using a Haskell module with functions accessed

Re: [Haskell-cafe] dsl and gui toolkit

2009-10-06 Thread Colin Paul Adams
John == John A De Goes j...@n-brain.net writes: John This is the right approach to a GUI toolkit. John Note that personally, I believe the details of the John presentation should be separate from Haskell, stored in a John separate file that is machine- friendly, so designers can

Re: [Haskell-cafe] dsl and gui toolkit

2009-10-06 Thread John A. De Goes
CSS is a good start by it's beset by all the problems of a 1st generation presentation language, and is not particularly machine- friendly. Regards, John A. De Goes N-Brain, Inc. The Evolution of Collaboration http://www.n-brain.net|877-376-2724 x 101 On Oct 6, 2009, at 10:44 AM,

Re: [Haskell-cafe] dsl and gui toolkit

2009-10-06 Thread Deniz Dogan
2009/10/6 John A. De Goes j...@n-brain.net: CSS is a good start by it's beset by all the problems of a 1st generation presentation language, and is not particularly machine-friendly. I think CSS is neat for websites, but I'm not so sure about using it in normal applications. -- Deniz Dogan

Re: [Haskell-cafe] Calling Haskell from C, Linking with gcc?

2009-10-06 Thread Thomas DuBuisson
Generally you should be able to tell which library you're missing based on the names of the undefined symbols. Have you link in... libgmp.a? libm.a? libc.a? What are the missing symbols? Thomas On Tue, Oct 6, 2009 at 9:44 AM, John Velman vel...@cox.net wrote: I think if I knew which libraries

Re: [Haskell-cafe] What is a number. (Was: Num instances for 2-dimensional types)

2009-10-06 Thread Iavor Diatchki
Hi, On Tue, Oct 6, 2009 at 2:37 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: Numeric literals are treated as Integer or Rational, and are then converted with the function fromInteger or fromRational, respectively, to the required type. Whatever fromInteger function is in scope,

[Haskell-cafe] Snow Leopard, gtk2hs

2009-10-06 Thread Arne Dehli Halvorsen
This may be a little off-topic, but if someone could help me, I'd be grateful.I am trying to get to a working gtk2hs environment in MacOSX Snow Leopard I have a Macbook Pro 2.1 with Snow Leopard. While I had Leopard, I had the Haskell Platform installed, and it worked fine. I also had the

Re: [Haskell-cafe] Snow Leopard, gtk2hs

2009-10-06 Thread Gregory Collins
Arne Dehli Halvorsen arne@gmail.com writes: This may be a little off-topic, but if someone could help me, I'd be grateful. I am trying to get to a working gtk2hs environment in MacOSX Snow Leopard Have you patched: /usr/bin/ghc /usr/bin/ghci /usr/bin/runhaskell /usr/bin/runghc

Re: [Haskell-cafe] Calling Haskell from C, Linking with gcc?

2009-10-06 Thread John Velman
On Tue, Oct 06, 2009 at 09:48:44AM -0700, Thomas DuBuisson wrote: Thanks, Thomas. Linking in only libffi.a, libgmp.a, I get (for example, there are many more) missing: _newCAF _base_GHCziBase_plusInt_closure _base_GHCziList_zzipWith_info _base_GHCziList_lvl5_closure by also linking

Re: [Haskell-cafe] Calling Haskell from C, Linking with gcc?

2009-10-06 Thread Thomas DuBuisson
You are missind libHSbase. Try, for example: locate libHSbase-3.0.1.0.a and link that in. Thomas On Tue, Oct 6, 2009 at 11:51 AM, John Velman vel...@cox.net wrote: On Tue, Oct 06, 2009 at 09:48:44AM -0700, Thomas DuBuisson wrote: Thanks, Thomas. Linking in only libffi.a, libgmp.a, I

Re: [Haskell-cafe] Calling Haskell from C, Linking with gcc?

2009-10-06 Thread Gregory Collins
John Velman vel...@cox.net writes: On Tue, Oct 06, 2009 at 09:48:44AM -0700, Thomas DuBuisson wrote: Thanks, Thomas. Linking in only libffi.a, libgmp.a, I get (for example, there are many more) missing: _newCAF _base_GHCziBase_plusInt_closure _base_GHCziList_zzipWith_info

Re: [Haskell-cafe] Snow Leopard, gtk2hs

2009-10-06 Thread Arne Dehli Halvorsen
On Tue, Oct 6, 2009 at 8:49 PM, Gregory Collins g...@gregorycollins.netwrote: Arne Dehli Halvorsen arne@gmail.com writes: This may be a little off-topic, but if someone could help me, I'd be grateful. I am trying to get to a working gtk2hs environment in MacOSX Snow Leopard Have you

[Haskell-cafe] Cabal - how do I remove a package?

2009-10-06 Thread Paul Moore
As it says in the subject, how do I remove a package that I installed (with the --user flag) via cabal? Come to that, how do I list the packages I've installed via cabal? cabal list --installed includes all the GHC standard library (which I didn't install) and it doesn't seem to support a --user

Re: [Haskell-cafe] Cabal - how do I remove a package?

2009-10-06 Thread John Van Enk
you want: ghc-pkg unregister [package name] and ghc-pkg list /jve On Tue, Oct 6, 2009 at 3:52 PM, Paul Moore p.f.mo...@gmail.com wrote: As it says in the subject, how do I remove a package that I installed (with the --user flag) via cabal? Come to that, how do I list the packages I've

Re: [Haskell-cafe] Cabal - how do I remove a package?

2009-10-06 Thread Paul Moore
2009/10/6 John Van Enk vane...@gmail.com: you want: ghc-pkg unregister [package name] and ghc-pkg list Thanks. I wouldn't have found that by myself. Unfortunately, having issued ghc-pkg unregister mersenne-random-1.0 I still see the code present: dir

Re: [Haskell-cafe] Snow Leopard, gtk2hs

2009-10-06 Thread Gregory Collins
Arne Dehli Halvorsen arne@gmail.com writes: On Tue, Oct 6, 2009 at 8:49 PM, Gregory Collins g...@gregorycollins.net wrote: Arne Dehli Halvorsen arne@gmail.com writes: This may be a little off-topic, but if someone could help me, I'd be grateful. I am trying to

Re: [Haskell-cafe] better way to do this?

2009-10-06 Thread Michael P Mossey
Duncan Coutts wrote: So you end up with pure functions like: shuffle :: RandomGen g = g - [x] - [x] Thanks for the help, Duncan. I'm confused on one point. Don't you always need the new state of the generator back? So wouldn't this need to be: shuffle :: RandomGen g = g - [x] - (g,[x])

Re: [Haskell-cafe] Cabal - how do I remove a package?

2009-10-06 Thread John Van Enk
Are you actually trying to remove the bits from the hard drive, or is that something to fix a different problem you're having. If it's a different problem, perhaps you could ask that as well? On Tue, Oct 6, 2009 at 4:04 PM, Paul Moore p.f.mo...@gmail.com wrote: 2009/10/6 John Van Enk

Re: [Haskell-cafe] Snow Leopard, gtk2hs

2009-10-06 Thread Arne Dehli Halvorsen
On Tue, Oct 6, 2009 at 10:09 PM, Gregory Collins g...@gregorycollins.netwrote: Arne Dehli Halvorsen arne@gmail.com writes: On Tue, Oct 6, 2009 at 8:49 PM, Gregory Collins g...@gregorycollins.net wrote: hsc2hs was new to me, the others were ok. It didn't help, though. Sorry to

Re: [Haskell-cafe] Cabal - how do I remove a package?

2009-10-06 Thread Paul Moore
2009/10/6 John Van Enk vane...@gmail.com: Are you actually trying to remove the bits from the hard drive, or is that something to fix a different problem you're having. If it's a different problem, perhaps you could ask that as well? Yes, I'm trying to remove the bits from the disk. I did a

Re: [Haskell-cafe] Cabal - how do I remove a package?

2009-10-06 Thread Peter Robinson
2009/10/6 Paul Moore p.f.mo...@gmail.com: 2009/10/6 John Van Enk vane...@gmail.com: Are you actually trying to remove the bits from the hard drive, or is that something to fix a different problem you're having. If it's a different problem, perhaps you could ask that as well? Yes, I'm trying

Re: [Haskell-cafe] Cabal - how do I remove a package?

2009-10-06 Thread Paul Moore
2009/10/6 Peter Robinson thaldy...@gmail.com: 2009/10/6 Paul Moore p.f.mo...@gmail.com: 2009/10/6 John Van Enk vane...@gmail.com: Are you actually trying to remove the bits from the hard drive, or is that something to fix a different problem you're having. If it's a different problem, perhaps

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-06 Thread Richard O'Keefe
On Oct 6, 2009, at 3:49 AM, Lennart Augustsson wrote: But complex numbers are just pairs of numbers. So pairs of numbers can obviously be numbers then. The basic problem here is that pairs of numbers can be made to fit into the Haskell framework with more than one semantics. For example,

Re: [Haskell-cafe] Calling Haskell from C, Linking with gcc?

2009-10-06 Thread John Velman
Thanks, Gregory. I did something like that. In particular, I did find . -name lib*.a | xargs nm ~/develop/haskellLibInfo/libInfo Then I used the output from the build results file to look for stuff in the libInfo file (using mac_vim). In this way I cut the number of undefined references down

Re: [Haskell-cafe] Calling Haskell from C, Linking with gcc?

2009-10-06 Thread Brandon S. Allbery KF8NH
On Oct 6, 2009, at 19:20 , John Velman wrote: HSghc-prim-0.1.0.0.o, HSinteger-0.1.0.1.o, libffi.a, libgmp.a, libHSbase-3.0.3.1.a, libHSbase-3.0.3.1_p.a, libHSbase-4.1.0.0.a, libHSghc-prim-0.1.0.0_p.a, libHSrts.a Note that library order matters; libgmp.a should probably be

Re: [Haskell-cafe] better way to do this?

2009-10-06 Thread Felipe Lessa
On Mon, Oct 05, 2009 at 07:24:00AM -0700, Michael Mossey wrote: If I understand correctly, this works because IO is an instance of Applicative, correct? I wonder if any of the random monads are instances of Applicative. If they aren't then that's a bug in the library :). Every monad can be

Fwd: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-06 Thread Alberto G. Corona
Why? real numbers, complex nuimbers, n-dimensional spaces have well defined + and * operations (vectorial product in the latter case). even algebraic expressions like: data Expr = Var String | Number Integer | Sin Expr | Cos Expr can be instances of Num and express certain simplification rules

[Haskell-cafe] Creating an alias for a function

2009-10-06 Thread michael rice
How do I create an alias for a function, like giving CAR the same functionality as HEAD. I know I can do it by creating a definition (see below), but is there a better way, like Scheme's (define head car) car ::  [a] - a car x = head x The reason for doing this is to more closely mirror

Re: [Haskell-cafe] Creating an alias for a function

2009-10-06 Thread Alex Queiroz
Hallo, On Tue, Oct 6, 2009 at 11:01 PM, michael rice nowg...@yahoo.com wrote: How do I create an alias for a function, like giving CAR the same functionality as HEAD. I know I can do it by creating a definition (see below), but is there a better way, like Scheme's (define head car) car

Re: [Haskell-cafe] Creating an alias for a function

2009-10-06 Thread Ross Mellgren
car = head letting the compiler infer the type, or car :: [a] - a car = head for the explicit version. -Ross On Oct 6, 2009, at 10:01 PM, michael rice wrote: How do I create an alias for a function, like giving CAR the same functionality as HEAD. I know I can do it by creating a

Re: [Haskell-cafe] Creating an alias for a function

2009-10-06 Thread Joe Fredette
Well, you can drop the arguments entirely, and let the type be inferred to get car = head which is pretty nice. You could use an INLINE hint to make the compiler replace it before compilation, though I don't think it would change performance much... /Joe On Oct 6, 2009, at 10:01

Re: [Haskell-cafe] Creating an alias for a function

2009-10-06 Thread Gregory Crosswhite
Michael, You can define a function without listing some or all of its arguments by specifying it in terms of another function. So all you really need to write is, e.g., car = head cdr = tail cadr = car . cdr caddr = car . cadr cadar = car . cdr . car etc... On Oct 6, 2009, at 7:01 PM,

Re: [Haskell-cafe] Snow Leopard, gtk2hs

2009-10-06 Thread David Menendez
On Tue, Oct 6, 2009 at 2:49 PM, Gregory Collins g...@gregorycollins.net wrote: Arne Dehli Halvorsen arne@gmail.com writes: This may be a little off-topic, but if someone could help me, I'd be grateful. I am trying to get to a working gtk2hs environment in MacOSX Snow Leopard Have you

Re: [Haskell-cafe] Creating an alias for a function

2009-10-06 Thread michael rice
Thanks all! There's ALWAYS seems to be a neat way to do what's needed with Haskell. Michael --- On Tue, 10/6/09, Joe Fredette jfred...@gmail.com wrote: From: Joe Fredette jfred...@gmail.com Subject: Re: [Haskell-cafe] Creating an alias for a function To: michael rice nowg...@yahoo.com Cc:

Re: [Haskell-cafe] dsl and gui toolkit

2009-10-06 Thread Richard O'Keefe
On Oct 7, 2009, at 5:47 AM, John A. De Goes wrote: CSS is a good start by it's beset by all the problems of a 1st generation presentation language, and is not particularly machine- friendly. Considering that CSS is _at least_ a 2nd generation language (it was preceded by DSSSL), that's

Re: [Haskell-cafe] Network.Curl and posting XML data

2009-10-06 Thread Erik de Castro Lopo
Dmitry Olshansky wrote: Hi, Erik, Did you try Network.HTTP? Is it not enough? Apparently not. Now I need to do a post to a HTTPS server and Network.HTTP does not seem to support HTTPS. Is that really right? Erik -- --

[Haskell-cafe] Fast times at Inferable-but-not-Checkable High.

2009-10-06 Thread Joe Fredette
So, I've been fiddling with an utterly random idea. What if I had a class: class Hom a b where data Rep a b hm :: Rep a b - b im :: a - Rep a b That is, all types that have some conversion between them (an isomorphism originally, then I thought

Re: [Haskell-cafe] better way to do this?

2009-10-06 Thread Michael P Mossey
Michael P Mossey wrote: Also note that I added the Random class constraint to 'shuffle'. I haven't tested this but it might be necessary. Or not? Okay I figured this part out too. The members of the list you are shuffling have no class constraint on them because the 'shuffle' function is not