Re: [Haskell-cafe] OS swapping and haskell data structures

2007-08-08 Thread Ketil Malde
On Tue, 2007-07-31 at 22:45 -0700, Alex Jacobson wrote: If you create a Data.Map or Data.Set larger than fits in physical memory, will OS level swapping enable your app to behave reasonably or will things just die catastrophically as you hit a memory limit? It will die (catastrophically or

[Haskell-cafe] Re: monad subexpressions

2007-08-08 Thread apfelmus
Bulat Ziganshin wrote: apfelmus wrote: avoid the small layer of imperative code, of course. But the more you treat imperative code as somewhat pure, the greater the danger that the purely functional logic will be buried inside a mess of imperative code. In other words, the goal is exactly to

[Haskell-cafe] Bug in GHCi?

2007-08-08 Thread Dusan Kolar
Hello all, Maybe this is a wrong place to report, but I have repeatedly performed funny calculation in GHCi with strange time report. The version of GHCi is: ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.6, for Haskell 98. / /_\\/ __ / /___|

Re: [Haskell-cafe] Using haskell with emacs

2007-08-08 Thread Paulo J. Matos
Thank you all for your references and tips, I'll be using them. :-) On 06/08/2007, Jules Bean [EMAIL PROTECTED] wrote: Thomas Schilling wrote: On 6 aug 2007, at 22.11, Paulo J. Matos wrote: If you're used to Slime+Paredit, then there isn't something really comparable, but you get some

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-08 Thread Bulat Ziganshin
Hello apfelmus, Wednesday, August 8, 2007, 11:33:41 AM, you wrote: it's point of view of theoretical purist. i consider Haskell as language for real world apps and need to write imperative code appears independently of our wishes. in paricular, it's required to write very efficient code, to

[Haskell-cafe] Re: default for quotRem in terms of divMod?

2007-08-08 Thread Christian Maeder
Isaac Dupree wrote: In class Integral, divMod has a default in terms of quotRem. (quot,rem,div,mod all have defaults as the both-function they're part of.) I'm sure divMod is more natural than quotRem to implement for some types... so why doesn't quotRem have a default in terms of divMod? it

Re: [Haskell-cafe] FW: RE Monad Description For Imperative Programmer

2007-08-08 Thread Kim-Ee Yeoh
Claus Reinke wrote: there is usually a way to interpret monadic structures built in this way (a 'run' operation of some kind). The run operation of type (m a - a) is the (comonadic) coreturn. Many monads are almost comonads too, for a meaning of almost to be made precise. Claus Reinke

Re: [Haskell-cafe] Sudoku Solver

2007-08-08 Thread ajb
G'day all. Quoting Vimal [EMAIL PROTECTED]: Well, Dancing Links (DLX) is just a data structure + few techniques to help with the backtrack, after modeling Sudoku as a contraint satisfaction problem. DLX is one realisation of an algorithm which works on boolean matrices. It's a pointer-based

[Haskell-cafe] mutually recursive types

2007-08-08 Thread rodrigo.bonifacio
Hi, I am learning the haskell programming language and had tried to define the following types: type Scenario = (String, String, [Step]) type Step = (String, Scenario, String, String, String) Notice that Scenario depends on a list of steps and Step has a dependence with scenario. I know that

[Haskell-cafe] Re: mutually recursive types

2007-08-08 Thread Jon Fairbairn
rodrigo.bonifacio [EMAIL PROTECTED] writes: Hi, I am learning the haskell programming language and had tried to define the following types: type Scenario = (String, String, [Step]) type Step = (String, Scenario, String, String, String) data Scenario = Scenario String String [Step] data

[Haskell-cafe] Language support for imperative code. Was: Re: monad subexpressions

2007-08-08 Thread Brian Hulley
apfelmus wrote: However, most genuinely imperative things are often just a building block for a higher level functional model. The ByteString library is a good example: the interface is purely functional, the internals are explicit memory control. It's a bad idea to let the internal memory

Re: [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-08 Thread Kim-Ee Yeoh
Seth Gordon wrote: Functors are a generalization from lists to things that can be mapped over in general, and then monads are a generalization of functors. Way to go! That way lies true co/monadic enlightenment. Put another way, monads are no more about (only) IO/sequencing than fmap is

[Haskell-cafe] Newbie question (again!) about phantom types

2007-08-08 Thread peterv
I’m having difficulty to understand what phantom types are good for. Is this just for improving runtime performance? I read the wiki, and it says this is useful if you want to increase the type-safety of your code, but the code below does not give a compiler error for the function test1, I get a

Re: [Haskell-cafe] mutually recursive types

2007-08-08 Thread Tillmann Rendel
Rodrigo wrote: type Scenario = (String, String, [Step]) type Step = (String, Scenario, String, String, String) Recursive types are not supported by type-declarations. use data declarations instead: data Scenario = Scenario String String [Step] data Step = Step String Scenario String

Re: [Haskell-cafe] mutually recursive types

2007-08-08 Thread Brent Yorgey
Notice that Scenario depends on a list of steps and Step has a dependence with scenario. I know that this is a kind of bad smell in Haskell, are there any pattern or language idiom to deal with cyclical dependences? Just a little something to add, this is not a bad smell at all... in

Re: [Haskell-cafe] Language support for imperative code. Was: Re: monad subexpressions

2007-08-08 Thread Martin Percossi
Brian Hulley wrote: hidden away in the definition of their API function to create a label, is a call to (ref 0) ;-) The equivalent implementation in Haskell would completely destroy all hope of using this in a pure context and force all use of the API into the IO monad. Really? I would

Re: [Haskell-cafe] Newbie question (again!) about phantom types

2007-08-08 Thread Tillmann Rendel
peterv wrote: I’m having difficulty to understand what phantom types are good for. I read the wiki, and it says this is useful if you want to increase the type-safety of your code, but the code below does not give a compiler error for the function test1, I get a runtime error, just like test2.

Re: [Haskell-cafe] Newbie question (again!) about phantom types

2007-08-08 Thread Arie Peterson
I’m having difficulty to understand what phantom types are good for. Is this just for improving runtime performance? No. As the wiki says, you can use them to add static guarantees. I read the wiki, and it says this is useful if you want to increase the type-safety of your code, but the

Re: [Haskell-cafe] Newbie question (again!) about phantom types

2007-08-08 Thread David F. Place
On Aug 8, 2007, at 11:16 AM, peterv wrote: I’m having difficulty to understand what phantom types are good for. Is this just for improving runtime performance? I found phantom types to be useful in the implementation of bit-wise set operations. You can find the code Edison:

[Haskell-cafe] Re: Using haskell with emacs

2007-08-08 Thread Stefan Monnier
C-c C-b ... when pressed for the first time this will start an interpreter (ghci or hugs most of the time), when pressed with a running interpreter it'll switch to that buffer. C-c C-l ... Load the current file into the editor. There is no function-wise compilation. More generally, in

Re: [Haskell-cafe] Re: Using haskell with emacs

2007-08-08 Thread Andrew Wagner
I've removed it from the next release of haskell-mode, so if you need it, please explain why. So C-c C-l is the preferred method for re-loading? I don't know enough about the details to know if :l and :r do exactly the same things in ghci. ___

Re: [Haskell-cafe] Language support for imperative code. Was: Re: monad subexpressions

2007-08-08 Thread Hugh Perkins
On 8/8/07, Brian Hulley [EMAIL PROTECTED] wrote: In contrast, all the pure functional GUIs that I've seen are just wrappers around someone else's imperative code, and moreover, they exchange the simplicity of the object oriented imperative API for a veritable mindstorm of unbelievably heavy,

[Haskell-cafe] Re: Using haskell with emacs

2007-08-08 Thread Stefan Monnier
I've removed it from the next release of haskell-mode, so if you need it, please explain why. So C-c C-l is the preferred method for re-loading? Yes. I don't know enough about the details to know if :l and :r do exactly the same things in ghci. I don't either. But experimentation

Re: [Haskell-cafe] Language support for imperative code. Was: Re: monad subexpressions

2007-08-08 Thread Corey O'Connor
On 8/8/07, Brian Hulley [EMAIL PROTECTED] wrote: Regarding the quote above, if the API must hide explicit memory control from the user the only way I can see of doing this would be to use (unsafePerformIO), which really is unsafe since Haskell relies on the fact that mutable operations can't

Re: [Haskell-cafe] Language support for imperative code. Was: Re: monad subexpressions

2007-08-08 Thread Brian Hulley
Martin Percossi wrote: Brian Hulley wrote: hidden away in the definition of their API function to create a label, is a call to (ref 0) ;-) The equivalent implementation in Haskell would completely destroy all hope of using this in a pure context and force all use of the API into the IO

Re: [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-08 Thread Seth Gordon
Kim-Ee Yeoh wrote: Seth Gordon wrote: Functors are a generalization from lists to things that can be mapped over in general, and then monads are a generalization of functors. Way to go! That way lies true co/monadic enlightenment. I feel like I still don't understand comonads. Maybe I

Re: [Haskell-cafe] Re: Using haskell with emacs

2007-08-08 Thread Stefan O'Rear
On Wed, Aug 08, 2007 at 12:57:51PM -0400, Stefan Monnier wrote: I've removed it from the next release of haskell-mode, so if you need it, please explain why. So C-c C-l is the preferred method for re-loading? Yes. I don't know enough about the details to know if :l and :r do exactly

Re: [Haskell-cafe] Language support for imperative code. Was: Re: monad subexpressions

2007-08-08 Thread Brian Hulley
Hugh Perkins wrote: On 8/8/07, *Brian Hulley* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: In contrast, all the pure functional GUIs that I've seen... In defense of Haskell (wow!), note that imperative languages are not without problems in GUIs. In a multithreaded environment, If

[Haskell-cafe] Defining new operators

2007-08-08 Thread rodrigo.bonifacio
Hello, I have created the following function: dist :: String - [[String]] - [[String]] dist x y = [ x:e | e-y ] eg.: dist 1M [[], [2M], [2M, 3M]] = [[1M],[1M,2M],[1M,2M, 3M]] How can I create an operator that perform the same function as dist? I want to write something like: 1M ++ [[],

RE: [Haskell-cafe] Newbie question (again!) about phantom types

2007-08-08 Thread peterv
Thanks, that is a much clearer explanation than http://en.wikibooks.org/wiki/Haskell/Phantom_types Peter -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Arie Peterson Sent: Wednesday, August 08, 2007 5:59 PM To: haskell-cafe@haskell.org Subject: Re:

RE: [Haskell-cafe] a regressive view of support for imperative programming in Haskell

2007-08-08 Thread Philippa Cowderoy
On Wed, 8 Aug 2007, peterv wrote: PS: It would be very nice for beginners to have a special tool / text editor that allows you see the desugared form of monads and other constructs. An editor that can be configured to display various inferred details, annotations and desugarings in the

Re: [Haskell-cafe] a regressive view of support for imperative programming in Haskell

2007-08-08 Thread Donn Cave
On Wed, 8 Aug 2007, Paul Hudak wrote: ... Well, you could argue, monad syntax is what really made Haskell become more accepted by the masses, and you may be right (although perhaps Simon's extraordinary performance at OSCOM is more of what we need). On the other hand, if we give imperative

Re: [Haskell-cafe] a regressive view of support for imperative programming in Haskell

2007-08-08 Thread Hugh Perkins
On 8/9/07, peterv [EMAIL PROTECTED] wrote: IMHO and being a newbie having 20 years of professional C/C++/C# experience but hardly any Haskell experience, I agree with this… I find the monad syntax very confusing, because it looks so much like imperative code, but it isn't. Personally I also

Re: [Haskell-cafe] Re: Using haskell with emacs

2007-08-08 Thread Jeff Polakow
Hello, :r is also *much* faster in general; :l reloads all modules from scratch, while :r only reloads the modules that have changed. :r also doesn't seem check the import declarations for changes. For example, if I add a new import statement to my file, without adding code which uses the

re: [Haskell-cafe] Pure functional GUI (was a regressive view of support for imperativeprogramming in Haskell)

2007-08-08 Thread Peter Verswyvelen
As a newbie (okay I will not write this again, you all know I'm a newbie by now ;-), I don't understood what the problem of a pure functional GUI is. To me, having an imperative background, a graphical application is just a big tree of data that evolves when events from the OS come in. (this

re: [Haskell-cafe] Pure functional GUI (was a regressive view of support for imperativeprogramming in Haskell)

2007-08-08 Thread Duncan Coutts
On Wed, 2007-08-08 at 19:14 +, Peter Verswyvelen wrote: So could you please tell me more about the problem with pure functional GUIs and why this is not part of the Haskell library? I mean a GUI library completely written in Haskell, not wrapping a popular library. Partly because just

Re: [Haskell-cafe] Pure functional GUI (was

2007-08-08 Thread Peter Verswyvelen
Well, if you want to make it as big as QT, yes. But even just a simple purely functionaly GUI framework that is part of the library would be nice, because right now it gives the impression it cannot be done in Haskell... E.g. Concurrent Clean seems to have a simple UI library. -

Re: [Haskell-cafe] a regressive view of support for imperative programming in Haskell

2007-08-08 Thread David Roundy
On Wed, Aug 08, 2007 at 02:20:39PM -0400, Paul Hudak wrote: All of the recent talk of support for imperative programming in Haskell makes me really nervous. To be honest, I've always been a bit uncomfortable even with monad syntax. Instead of: do x - cmd1 y - cmd2 ...

Re: [Haskell-cafe] Pure functional GUI (was a regressive view of support for imperativeprogramming in Haskell)

2007-08-08 Thread David F. Place
On Aug 8, 2007, at 3:14 PM, Peter Verswyvelen wrote: So could you please tell me more about the problem with pure functional GUIs and why this is not part of the Haskell library? I mean a GUI library completely written in Haskell, not wrapping a popular library. I had quite a lot of

[Haskell-cafe] Using HList Records

2007-08-08 Thread Rahul Kapoor
Using The Darcs version of HList (http://darcs.haskell.org/HList/), I can do simple things with (H)lists just fine, so --angus = Key 42 -- .*. Name Angus -- .*. Cow -- .*. Price 75.5 -- .*. HNil --main = putStrLn (show angus) works, On the other hand examples from the HList

Re: [Haskell-cafe] a regressive view of support for imperative programming in Haskell

2007-08-08 Thread Brian Hulley
Paul Hudak wrote: All of the recent talk of support for imperative programming in Haskell makes me really nervous ... if we give imperative programmers the tools to do all the things they are used to doing in C++, then we will be depriving them of the joys of programming in the

Re: [Haskell-cafe] Pure functional GUI (was

2007-08-08 Thread Marc Weber
On Wed, Aug 08, 2007 at 08:22:41PM +, Peter Verswyvelen wrote: Well, if you want to make it as big as QT, yes. But even just a simple purely functionaly GUI framework that is part of the library would be nice, because right now it gives the impression it cannot be done in Haskell...

Re: [Haskell-cafe] Pure functional GUI (was

2007-08-08 Thread Hugh Perkins
To be fair, GTK is pretty standard. This is so even for big name gc'd imperative languages such as C#. Sure, you can use Windows.Forms in C#, but you often wouldnt, because of the patent burden. Also, gtk in partnership with glade rocks! How easy is gtk to use from haskell by the way? In gc'd

Re: [Haskell-cafe] a regressive view of support for imperative programming in Haskell

2007-08-08 Thread Michael Vanier
I can't agree with your point about Haskell being (just) a prototype language (assuming that's what you meant). If that's the case, it won't last very long. Languages need to be something you can write real, practical applications in. Fortunately, Haskell isn't just a prototype language. I'm

Re: [Haskell-cafe] Language support for imperative code. Was: Re: monad subexpressions

2007-08-08 Thread Donald Bruce Stewart
brianh: Hugh Perkins wrote: On 8/8/07, *Brian Hulley* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: In contrast, all the pure functional GUIs that I've seen... In defense of Haskell (wow!), note that imperative languages are not without problems in GUIs. In a multithreaded

Re: [Haskell-cafe] Pure functional GUI (was

2007-08-08 Thread Marc Weber
Other question on using gtk from haskell: how easy is it to integrate with glade? ie, can we directly bind glade form elements to haskell variables? How easy is it to bind events to glade form elements from within Haskell? Download the source and have a look at the demo/glade

Re: [Haskell-cafe] a regressive view of support for imperative programming in Haskell

2007-08-08 Thread ok
On 9 Aug 2007, at 8:41 am, David Roundy wrote: I may be stating the obvious here, but I strongly prefer the do syntax. It's nice to know the other also, but the combination of do +indenting makes complicated code much clearer than the nested parentheses that would be required with purely =

Re: [Haskell-cafe] Pure functional GUI (was

2007-08-08 Thread Hugh Perkins
On 8/9/07, Marc Weber [EMAIL PROTECTED] wrote: -- load up the glade file dialogXmlM - xmlNew simple.glade let dialogXml = case dialogXmlM of (Just dialogXml) - dialogXml Nothing - error can't find the glade file \simple.glade\ \

Re: [Haskell-cafe] a regressive view of support for imperative programming in Haskell

2007-08-08 Thread Hugh Perkins
On 8/9/07, ok [EMAIL PROTECTED] wrote: We get extra , =, \, -, and in tokens, but no new parentheses. Yes exactly. It's the = and that gets rid of the parentheses, and reverses the order of the operations. I cant remember where I saw this, but somewhere there is a monad tutorial that starts

Re[2]: [Haskell-cafe] Pure functional GUI (was a regressive view of support for imperativeprogramming in Haskell)

2007-08-08 Thread Bulat Ziganshin
Hello Peter, Wednesday, August 8, 2007, 11:14:37 PM, you wrote: To me, having an imperative background, a graphical application is just a big tree of data that evolves when events from the OS come in. (this data is NOT per se the data for the GUI element; instead use the

Re: [Haskell-cafe] a regressive view of support for imperative programming in Haskell

2007-08-08 Thread Bulat Ziganshin
Hello Paul, Wednesday, August 8, 2007, 10:20:39 PM, you wrote: we need).  On the other hand, if we give imperative programmers the tools to do all the things they are used to doing in C++, then we will be depriving them of the joys of programming in the Functional Way.  How many times have

Re[2]: [Haskell-cafe] Pure functional GUI (was

2007-08-08 Thread Bulat Ziganshin
Hello Hugh, Thursday, August 9, 2007, 4:59:04 AM, you wrote: How easy is gtk to use from haskell by the way?  In gc'd imperative languages, typically only one thread is allowed to communicate with the GUI, and you need to set up a whole bunch of message-parsing stuff to communicate with