[Haskell-cafe] Dynamic typing of polymorphic functions

2007-12-19 Thread Alfonso Acosta
Hi all, As some of you might remember I'm working on a EDSL which models process networks (A process can simply be viewed as a box which has a number of input and output signals and makes computations over them). A simple example of the processes implemented is MapSY, which is similar to

[Haskell-cafe] [HXT] Simple question

2007-12-19 Thread Fernand
Hi, I'm using HXT (7.4) with GHC to make some XML transformations (BTW, congratulations to the maintainers of that package for their impressive work). Everything works fine except for the fact that all the nodes « this /this » (that is, a space (an XML text node whose contents are a single

Re: [Haskell-cafe] Is StateT what I need?

2007-12-19 Thread Andre Nathan
On Wed, 2007-12-19 at 02:45 +0100, Daniel Fischer wrote: I believe instead of return $ foldr... you should use evalStateT $ foldM (flip buildTree) Map.empty entries This seems to have done it: evalStateT $ (foldM (flip buildTree) Map.empty entries)) Map.empty (the second argument to

Re: [Haskell-cafe] Is StateT what I need?

2007-12-19 Thread Stuart Cook
On Dec 19, 2007 11:28 AM, Andre Nathan [EMAIL PROTECTED] wrote: I guess I could do away with StateT and just pass the PsMap around as a parameter, but I guess that wouldn't be the haskell way... I wouldn't say that. Manual state-passing is a perfectly legitimate technique, and can be clearer in

Re: [Haskell-cafe] [HXT] Simple question

2007-12-19 Thread Fernand
Miguel Mitrofanov a écrit : Seems rather strange for me, I've just installed HXT and got this: Prelude Text.XML.HXT.Arrow runX $ readString [(a_validate,0)] this /this writeDocumentToString [] [?xml version=\1.0\ encoding=\UTF-8\?\nthis /this] Everything works fine except for the fact

Re: [Haskell-cafe] Creating a type for a subset of the integers

2007-12-19 Thread Derek Elkins
On Tue, 2007-12-18 at 23:04 -0800, Don Stewart wrote: jules: Brad Larsen wrote: Hi there list, How would one go about creating a new type for a subset of the integers, for (contrived) example just the even integers? I was thinking of making a new type newtype EvenInt =

Re: [Haskell-cafe] [HXT] Simple question

2007-12-19 Thread Miguel Mitrofanov
Hmmm, with 'readString ... this /this' everything works fine, but with 'readString ... itemsthis /this/items' it doesn't. Seems to be a bug in HXT. But if I try the same with my XML file, my empty nodes are folded. I suppose this comes from the Ctrl-M at the end of the lines. See the

Re: [Haskell-cafe] Is StateT what I need?

2007-12-19 Thread Tommy McGuire
Andre Nathan wrote: I think my code is a bit too long and that probably makes it hard for someone to help... Does anyone know of good example code using StateT for keeping a global state other than the one at the Simple StateT use page on the wiki? The one I have used is All About Monads:

[Haskell-cafe] DSL question -- was: New slogan for haskell.org

2007-12-19 Thread Steve Lihn
Thanks for the explanation on DSL. It helped me understand how Haskell works compared to other popular languages out there. It is a programming methodology change. Or what is called paradigm change on how to design a software with Haskell. Haskell has its general-purpose features. Yet its

Re: [Haskell-cafe] DSL question -- was: New slogan for haskell.org

2007-12-19 Thread Mattias Bengtsson
On Wed, 2007-12-19 at 13:03 -0500, Steve Lihn wrote: [snip] I do come aross a question while reading the DSL page on Wikipedia. http://en.wikipedia.org/wiki/Domain-specific_programming_language In the Disadvantage section (near the end), there is an item -- hard or impossible to debug. Can

Re: [Haskell-cafe] Is StateT what I need?

2007-12-19 Thread Andre Nathan
On Wed, 2007-12-19 at 17:54 -0600, Tommy McGuire wrote: (Note: I haven't gotten to it in the revisions following the comments I received here and there are many things that need work. The notes are incoherent, it's more Pascallish than Haskell, and there are no guarantees that it won't

[Haskell-cafe] How to make Prelude.read: no parse more verbose ...

2007-12-19 Thread Georg Sauthoff
Hi, I try to debug some existing Haskell-Code. Out of the blue I get a 'progname: Prelude.read: no parse' error message from GHC. Great. Well, the code includes # grep '\read\' *| wc -l 23 (sic!) calls to the read fn. Well, how do I compile a Haskell program in such a way, that I get a

[Haskell-cafe] Re: DSL question -- was: New slogan for haskell.org

2007-12-19 Thread Brandon S. Allbery KF8NH
On Dec 19, 2007, at 13:03 , Steve Lihn wrote: In the Disadvantage section (near the end), there is an item -- hard or impossible to debug. Can anybody explain why or what it means? And how does it apply to Haskell? In the general case, you would need to design into your DSL both ability to

Re: [Haskell-cafe] How to make Prelude.read: no parse more verbose ...

2007-12-19 Thread Brandon S. Allbery KF8NH
On Dec 19, 2007, at 11:53 , Georg Sauthoff wrote: I try to debug some existing Haskell-Code. Out of the blue I get a 'progname: Prelude.read: no parse' error message from GHC. If you can install GHC 6.8.x, you can use ghci's interactive debugger. See

[Haskell-cafe] Knowledge

2007-12-19 Thread jlw501
I'm new to functional programming and Haskell and I love its expressive ability! I've been trying to formalize the following function for time. Given people and a piece of information, can all people know the same thing? Anyway, this is just a bit of fun... but can anyone help me reduce it or

Re: [Haskell-cafe] How to make Prelude.read: no parse more verbose ...

2007-12-19 Thread Ketil Malde
Georg Sauthoff [EMAIL PROTECTED] writes: Well, how do I compile a Haskell program in such a way, that I get a useful error message from read? I mean, like the filename/linenumber of the calling expression for starters. It's dirty, it's mean, but you can use CPP. (On one line, and with ghc

Re: [Haskell-cafe] Dynamic typing of polymorphic functions

2007-12-19 Thread Neil Mitchell
Hi OK, If you managed to read until this point, you might have noticed that, due to the monomorphism restriction implied by Data.Typeable, it is impossible to build polymorphic processes. Tom Shackell had similar issues with passing code around at runtime. As a result Yhc contains the

Re: [Haskell-cafe] DSL question -- was: New slogan for haskell.org

2007-12-19 Thread Bill Wood
On Wed, 2007-12-19 at 13:03 -0500, Steve Lihn wrote: . . . In the Disadvantage section (near the end), there is an item -- hard or impossible to debug. Can anybody explain why or what it means? And how does it apply to Haskell? Lisp has long been touted as a good language for developing a

Re: [Haskell-cafe] How to make Prelude.read: no parse more verbose ...

2007-12-19 Thread Neil Mitchell
Hi Well, how do I compile a Haskell program in such a way, that I get a useful error message from read? I mean, like the filename/linenumber of the calling expression for starters. I use the Safe library to do this sort of stuff: http://www-users.cs.york.ac.uk/~ndm/safe/ You can call

[Haskell-cafe] ANN: SearchPath v0.9

2007-12-19 Thread Alex Jacobson
SearchPath v0.9 does recursive module chasing accross the internet using a combination of mapfiles you provide and the default map file, caching the downloaded modules in a local directory. Searchpath can handle modules in module hierarchies based at a URLs, in tgz archives accessible via URL,

Re: [Haskell-cafe] How to make Prelude.read: no parse more verbose ...

2007-12-19 Thread Jeff Polakow
Hello, You can also just use reads which returns a list of (partial) parses. -Jeff [EMAIL PROTECTED] wrote on 12/19/2007 03:17:39 PM: Hi Well, how do I compile a Haskell program in such a way, that I get a useful error message from read? I mean, like the filename/linenumber of

Re: [Haskell-cafe] Dynamic typing of polymorphic functions

2007-12-19 Thread Alfonso Acosta
On Dec 19, 2007 9:13 PM, Neil Mitchell [EMAIL PROTECTED] wrote: OK, If you managed to read until this point, you might have noticed that, due to the monomorphism restriction implied by Data.Typeable, it is impossible to build polymorphic processes. Tom Shackell had similar issues with

Re: [Haskell-cafe] Knowledge

2007-12-19 Thread Luke Palmer
On Dec 19, 2007 7:26 PM, jlw501 [EMAIL PROTECTED] wrote: I'm new to functional programming and Haskell and I love its expressive ability! I've been trying to formalize the following function for time. Given people and a piece of information, can all people know the same thing? Anyway, this is

Re: [Haskell-cafe] Knowledge

2007-12-19 Thread Neil Mitchell
Hi contains :: Eq a = [a]-a-Bool contains [] e = False contains (x:xs) e = if x==e then True else contains xs e contains = flip elem And even if not using the elem function, the expression: if x==e then True else contains xs e can be written as: x==e || contains xs e Thanks Neil

Re: [Haskell-cafe] Knowledge

2007-12-19 Thread jlw501
Just to clarify, this is a little gag almost. It just demonstrates the problem of understanding knowledge as discussed by philosophers. perfectcomm is undefined as it is unknown if you can perfectly pass on your intention to another person. Likewise, it is unknown if you can express your

Re: [Haskell-cafe] Knowledge

2007-12-19 Thread jlw501
The main observation I've made it when playing with the values of knowing the self and perfect communication, nothing else becomes undefined if just perfect communication is true, it is still depended on knowing the self if you can have knowledge. Makes sense. jlw501 wrote: Just to clarify,

Re: [Haskell-cafe] How to make Prelude.read: no parse more verbose ...

2007-12-19 Thread Don Stewart
g_sauthoff: Hi, I try to debug some existing Haskell-Code. Out of the blue I get a 'progname: Prelude.read: no parse' error message from GHC. Great. Well, the code includes # grep '\read\' *| wc -l 23 (sic!) calls to the read fn. Well, how do I compile a Haskell program in

Re: [Haskell-cafe] New to Haskell

2007-12-19 Thread John Meacham
On Tue, Dec 18, 2007 at 01:58:00PM +0300, Miguel Mitrofanov wrote: I just want the sistem to be able to print one of these expressions ! Its this too much to ask ? Yes, 'cause it means you want to embed almost all source code into the compiled program. So ? So, I don't know any

Re: [Haskell-cafe] New to Haskell

2007-12-19 Thread Jake McArthur
On Dec 19, 2007, at 6:25 PM, John Meacham wrote: On Tue, Dec 18, 2007 at 01:58:00PM +0300, Miguel Mitrofanov wrote: I just want the sistem to be able to print one of these expressions ! Its this too much to ask ? Yes, 'cause it means you want to embed almost all source code into the

Re: [Haskell-cafe] New to Haskell

2007-12-19 Thread Luke Palmer
On Dec 20, 2007 1:23 AM, Jake McArthur [EMAIL PROTECTED] wrote: On Dec 19, 2007, at 6:25 PM, John Meacham wrote: On Tue, Dec 18, 2007 at 01:58:00PM +0300, Miguel Mitrofanov wrote: I just want the sistem to be able to print one of these expressions ! Its this too much to ask ? Yes,

Re: [Haskell-cafe] New to Haskell

2007-12-19 Thread Alex Queiroz
Hallo, On Dec 19, 2007 9:25 PM, John Meacham [EMAIL PROTECTED] wrote: Actually, it is a pretty fundamental feature of the lisp-derived languages that they can self modify their own source, and hence keep their own source representation all the way through runtime. This is not actually

FFI question -- was: [Haskell-cafe] New slogan for haskell.org

2007-12-19 Thread Steve Lihn
On Dec 11, 2007 11:16 PM, Don Stewart [EMAIL PROTECTED] wrote: 2. It offers strong support for integration with other languages and tools (FFI? Is the support strong?) 2. The FFI in Haskell is perhaps the most powerful out there. You can import C or export Haskell to C

Re: FFI question -- was: [Haskell-cafe] New slogan for haskell.org

2007-12-19 Thread Don Stewart
stevelihn: On Dec 11, 2007 11:16 PM, Don Stewart [EMAIL PROTECTED] wrote: 2. It offers strong support for integration with other languages and tools (FFI? Is the support strong?) 2. The FFI in Haskell is perhaps the most powerful out there. You can import C or

Re: FFI question -- was: [Haskell-cafe] New slogan for haskell.org

2007-12-19 Thread Duncan Coutts
On Wed, 2007-12-19 at 19:07 -0800, Don Stewart wrote: There are three approaches, depending on the size of your project. Write your ow FFI decls manually. - Good when you have a small job - and the C types are simple - example: strlen Use

[Haskell-cafe] Re: [xmonad] Re: XMonad.Layout.NoBorders

2007-12-19 Thread gwern0
On 2007.12.19 10:57:33 -0500, David Roundy [EMAIL PROTECTED] scribbled 0.3K characters: No, I don't have time. And I'm not sure why one would want no borders on floating windows... David Perhaps I don't fully understand the issues, but wouldn't such a thing be nice for things like MPlayer?

Re: [Haskell-cafe] Re: MonadFix

2007-12-19 Thread Albert Y. C. Lai
Joost Behrends wrote: @Daniel: no, this doesn't solve the stack problem. These are the primefactors of 2^120+1: [97,257,673,394783681,4278255361,46908728641]. oddFactors k n | otherwise = oddFactors (k+2) n could eventually push 394783681-673 function calls onto the stack before finding the