[Haskell-cafe] Re: Haskell DLL crashes Excel
Nikunj, The symptoms that you describe hint at some incorrect pointer handling. I believe the culprit is that pesky BSTR. I will try to dig up the code that I wrote a while ago to pass a BSTR to Haskell. Meanwhile, another hint. The GHC FAQ 1.4.1 says: "For utterly horrible reasons, programs that use more than 128Mb of heap won't work when compiled dynamically on Windows (they should be fine statically compiled)." (See http://haskell.org/haskellwiki/GHC:FAQ#My_program_that_uses_a_really_large_heap_crashes_on_Windows.) I have no clue what those horrible reasons might be, but you can limit the heap used by the Haskell DLL by setting the environment variable GHCRTS=-M128m Regards, Cyril ___ | From: Gupta, Nikunj (London) [mailto:[EMAIL PROTECTED] | Sent: 25 September 2006 10:31 | To: Simon Peyton-Jones | Subject: RE: [Haskell-cafe] Haskell DLL crashes Excel | | Hello Simon, | | Nice to hear from you. I haven't really been working with Haskell but I | posted the message to that list since that was the only list I was able | to locate even remotely referring to the problem I was facing. | I have a c++ code which I try to compile as a dll. When debugging the | code works fine but as soon as I compile it for release and launch an | independent process not attached to VC++ it crashes. Do you have any | suggestions with regards to the project settings that might be causing | the same. | | Any sort of help would be much appreciated | Regards | Nikunj ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Is Haskell a 5GL?
On Mon, 2006-09-25 at 22:22 +0200, Christoph Herrmann wrote: . . . > What Prolog really provides concerning automatic problem solving > is little: equation solving in term algebra; you can simulate that > in Haskell without much effort. On the other hand, I saw Haskell > classified as a 3GL. The problem is that Haskell often exposes > the algorithmic structure. What people often forget is that Prolog > programs in non-trivial situations are likely to fail if you do > not prescribe the evaluation order, by features like the cut which > destroy the declarative semantics. People also forget that arithmetic > constraints in Prolog have to be directed (input/output variables), > no difference to Haskell. I spent some time working on a large Prolog application where performance was critical, and it became obvious that when a Prolog program is tuned by removing non-determinism it moves towards a functional program. Any real (non-textbook example) Prolog program has to expose algorithmic details simply because the programmer must a) make decisions and b) express them. I think you're right that Haskell should be in the same bag as Prolog. -- Bill Wood ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Writing forum software in Haskell
Hi, Am Sonntag, den 24.09.2006, 13:02 +0100 schrieb David House: > * What would be a compulsory feature list? Stating the obvious: Haskell Syntax Highlighting (I didn't see it mentioned before, but that might be because of malaria) Greetings, Joachim -- Joachim "nomeata" Breitner mail: [EMAIL PROTECTED] | ICQ# 74513189 | GPG-Key: 4743206C JID: [EMAIL PROTECTED] | http://www.joachim-breitner.de/ Debian Developer: [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Is Haskell a 5GL?
Max Vasin wrote: "Ch" == Ch A Herrmann <[EMAIL PROTECTED]> writes: it's a BottomthGL language :) Ch> That's a religious statement. I was looking for some strong Ch> arguments for the nonbelievers that Haskell is a 5GL. But what about nonbelievers in language classification by generation? As already mentioned you can write algorithms in Haskell (3GL), embed a DSL in it and write a program in that DSL or in several DSLs (4GL). AFAIK Mathematica is not a logic programming language, thus all its features can be implemented in Haskell as library, will be Haskell a 5GL in this case I'm looking for an honest classification. The aim of the GLs is, as I think, the degree of abstraction. The question is, how much *intelligence* provided by preprocessing, libraries etc. is permitted. Personally, I think Haskell should be a 5GL because Prolog is a 5GL. What Prolog really provides concerning automatic problem solving is little: equation solving in term algebra; you can simulate that in Haskell without much effort. On the other hand, I saw Haskell classified as a 3GL. The problem is that Haskell often exposes the algorithmic structure. What people often forget is that Prolog programs in non-trivial situations are likely to fail if you do not prescribe the evaluation order, by features like the cut which destroy the declarative semantics. People also forget that arithmetic constraints in Prolog have to be directed (input/output variables), no difference to Haskell. My argumentation is: Prolog is a 5GL & Haskell is more abstract than Prolog => Haskell is a 5GL Some of the language features in Haskell that contribute to this abstraction are: laziness, pattern matching with guards, list comprehensions, type classes Please note that this is not a philosophic discussion. If Haskell is a 3GL, than it is at the same level with Java and since Java is more common, people think they should always use Java. Haskell as a 5GL will tell people: this is a language in which you can solve problems simpler and safer and it will encourage people to try to solve problems instead of resigning due to the complexity of the problem. Cheers -- Christoph ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Is Haskell a 5GL?
> "Ch" == Ch A Herrmann <[EMAIL PROTECTED]> writes: >it's a BottomthGL language :) >> >> Ch> That's a religious statement. I was looking for some strong Ch> arguments for the nonbelievers that Haskell is a 5GL. But what about nonbelievers in language classification by generation? As already mentioned you can write algorithms in Haskell (3GL), embed a DSL in it and write a program in that DSL or in several DSLs (4GL). AFAIK Mathematica is not a logic programming language, thus all its features can be implemented in Haskell as library, will be Haskell a 5GL in this case? -- WBR, Max Vasin. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Writing forum software in Haskell
On 9/25/06, Brian Smith <[EMAIL PROTECTED]> wrote: On 9/24/06, David House <[EMAIL PROTECTED]> wrote: > Hi all. > > The recent thread on email vs. forums inspired a bit of interest to > get some forum software on haskell.org. Were we to go ahead with this, > I think it'd be great to have this software written in Haskell itself. If you were to write all-new software, then I suggest: * Haskell.org single-sign-on: One username/password combination that is valid across all Haskell.org services (wiki, forums, mailing lists, CVS, etc.) Any chance of using OpenID for the single-sign on? There currently does not exist a haskell library for OpenID but one definitely needs to be written in my opinion. OpenID was designed exactly for this purpose. Jason ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] job writing security software in Haskell
Planning Systems, Inc. has a job opportunity for Haskell programmers. My synopsis is below, and the official description is at http://www.plansys.com/careers/job_details.cfm?JobID=28 Write Haskell code for a US government contractor. Projects include a high-assurance authorization system build around Soutei: http://okmij.org/ftp/Prolog/#Soutei Job is located in Monterey, CA, Slidell, LA, or Portsmouth, VA; working remotely is probably not an option. US citizenship required. Desirable experience: - Haskell - Logic programming - Formal methods - Network security - Web services I welcome you to ask me for more information, and please pass this along to Haskellers looking for a job who can meet the citizenship and (re-)location requirements. Andrew ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is Haskell a 5GL?
On Mon, 2006-09-25 at 16:50 +0200, Jerzy Karczmarczuk wrote: . . . > (For the CDC mainframes the assembly language was called Compass > [Comprehensive Assembler]. It was a 7648764GL. You could program > in it almost like in Lisp thanks to some very exquisite macros, > and add another set of macros which performed some type checking > and optimized the register allocation. People who used it got > famous (as M. Veltman, Nobel prize in physics), or got mad.) And there was something exquisitely perverse about writing Compass programs as Fortran subroutines so you could avoid writing IO in Peripheral Processor code. -- Bill Wood ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Writing forum software in Haskell
On 9/24/06, David House <[EMAIL PROTECTED]> wrote: Hi all.The recent thread on email vs. forums inspired a bit of interest toget some forum software on haskell.org. Were we to go ahead with this,I think it'd be great to have this software written in Haskell itself. If you were to write all-new software, then I suggest:* Haskell.org single-sign-on: One username/password combination that is valid across all Haskell.org services (wiki, forums, mailing lists, CVS, etc.)* A forum-like interface to the existing mailing lists: Instead of building full-blown forum, why not create a web interface that nicely organizes the archives of the existing mailing lists into a forum-like interface. Then, add a mechanism for sending messages to those mailing lists through a forum-like posting interface (using username/password), which would result in a message being sent to the mailing lists. A lot of existing Haskell users are content with the mailing lists, I believe. Forums are not going to add a lot of value to the existing users. So, unless there is some gateway between the existing mailing lists and the forums, you should expect that most experienced Haskellers would likely ignore the forums altogether. That would make the forums less than useful, if questions were being asked in the forums that can only be answered by people that are exclusively using the mailing lists. Regards,Brian ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is Haskell a 5GL?
Bulat Ziganshin wrote: Hello Ch., Monday, September 25, 2006, 5:14:15 PM, you wrote: do you think that Haskell is a 3GL (third generation language) or a 5GL or it's a BottomthGL language :) That's a religious statement. I was looking for some strong arguments for the nonbelievers that Haskell is a 5GL. Cheers -- Christoph ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is Haskell a 5GL?
Hello Ch., Monday, September 25, 2006, 5:14:15 PM, you wrote: > do you think that Haskell is a 3GL (third generation language) or a 5GL or it's a BottomthGL language :) -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is Haskell a 5GL?
Alex Queiroz wrote: On 9/25/06, Ch. A. Herrmann <[EMAIL PROTECTED]> wrote: Henning Thielemann wrote: > assembly language (Assembler ist deutsch :-) for mysterious reasons it entered the English world. 'Assembly' is a language. 'Assembler' is a program. All this is absolutely essential for the progress of Humanity... But, anyway, "Assembler" was the official name of the assembly language of IBM 360/370 if I am not mistaken. And I believe that it infiltrated die Deutsche Sprache therefrom. Good followers of Konrad Duden called a compiler: Uebersetzer, so perhaps the assemblers had here and there some Wagnerian names as well... (For the CDC mainframes the assembly language was called Compass [Comprehensive Assembler]. It was a 7648764GL. You could program in it almost like in Lisp thanks to some very exquisite macros, and add another set of macros which performed some type checking and optimized the register allocation. People who used it got famous (as M. Veltman, Nobel prize in physics), or got mad.) OK, who next?... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: [Haskell] MR details (was: Implicit type of numeric constants)
Bernie Pope answered: > > 1. Why do the rules of the monomorphism restriction explicitly mention > >*simple* pattern bindings? > >Where is the difference, especially as there is a translation to > >simple pattern bindings? > >Why should > > > >p | "a"=="b" = 2 > > | otherwise = 3 > > > >be treated different than > > > >p = if "a"=="b" then 2 else 3 > > > They are the same (both are simple pattern bindings). The report says > in section 4.4.3.2 that the first can be translated into the second. Indeed, I meant to allude to this translation. > A simple pattern binding is one where the lhs is a variable only. That's consistent with the second reason for rule one of the MR. However, the mentioned section 4.4.3.2 defines it differently: A simple pattern binding has form p = e. And if there is any doubt about what p stands for, it goes on: The pattern p ... Contrasting to that: The general form of a pattern binding is p match, where a match is the same structure as for function bindings above; in other words, a pattern binding is: p| g1= e1 | g2= e2 ... | gm= em where { decls } So according to this definition, a pattern binding is simple iff there are no guards (unless they are in the expression). Also the translation to a "simple pattern binding" only gets rid of guards. So there seems to be an error in the report, which can be fixed by either redefining "simple pattern binding", or using a differnet description in the MR. Bye Christian Sievers ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Is Haskell a 5GL?
> "Ch" == Ch A Herrmann <[EMAIL PROTECTED]> writes: Ch> Hi, Hello, >> I'd say very strong, lots of times a "where" is used thats making >> use of laziness. Ch> I don't agree: "where" is often only used to program in a top-down Ch> style I would say in a "more declarative" style, the "where" is closer to thinking of the program as a set of equations (as opposed to "let"). -- WBR, Max Vasin. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is Haskell a 5GL?
Hallo, On 9/25/06, Ch. A. Herrmann <[EMAIL PROTECTED]> wrote: Hi, Henning Thielemann wrote: > assembly language (Assembler ist deutsch :-) for mysterious reasons it entered the English world. 'Assembly' is a language. 'Assembler' is a program. -- -alex http://www.ventonegro.org/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is Haskell a 5GL?
Hi, Henning Thielemann wrote: assembly language (Assembler ist deutsch :-) for mysterious reasons it entered the English world. 3GLs: programming based on algorithms (C, Java, ...) 4GSs: domain-specific languages (SQL,...) 5GLs: automatic problem solving (Mathematica, Prolog,...) and/or visual programming (Visual Basic,...) Visual Basic and Computer Algebra Systems in the same generation? Ok, let Visual Basic be a 3GL. Haskell's laziness would in principle permit programming in a style akin to Prolog, e.g., for parser combinators. The question is: how strong is the influence of laziness in everyday Haskell programming? Actually, laziness allows me to formulate algorithms that look more like the specification of the problem than the solution. That would be a 4GL. E.g., I can formulate the solution of a differential equation in terms of a power series or time series in that way. However I have to put some effort into formulating it in a way that works. That's kind of developing an algorithm. -- Christoph ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is Haskell a 5GL?
Hi, and/or visual programming (Visual Basic,...) I can only assume you are a) joking a bit, yes , or b) not a visual basic user. also true While Visual Basic is a much insulted language, I have a soft spot for it. However, its not a Visual programming language - its a language which happens to have a GUI API and a bit of IDE support. Its resolutely a 3GL, roughly akin to Java, in my opinion. I'd agree but I found the info in the web The question is: how strong is the influence of laziness in everyday Haskell programming? I'd say very strong, lots of times a "where" is used thats making use of laziness. I don't agree: "where" is often only used to program in a top-down style Cheers -- Christoph ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is Haskell a 5GL?
On Mon, 25 Sep 2006, Ch. A. Herrmann wrote: > Dear Haskellers, > > do you think that Haskell is a 3GL (third generation language) or a 5GL or > that the hierarchy of programming language generations is useless? > I see a problem if the potential of a language is evaluated according to > the generation it belongs to. > > 1GLs: machine languages > 2GLs: assembler languages assembly language (Assembler ist deutsch :-) > 3GLs: programming based on algorithms (C, Java, ...) > 4GSs: domain-specific languages (SQL,...) > 5GLs: automatic problem solving (Mathematica, Prolog,...) > and/or visual programming (Visual Basic,...) Visual Basic and Computer Algebra Systems in the same generation? > Haskell's laziness would in principle permit programming in a style > akin to Prolog, e.g., for parser combinators. > The question is: how strong is the influence of laziness in everyday > Haskell programming? Actually, laziness allows me to formulate algorithms that look more like the specification of the problem than the solution. E.g., I can formulate the solution of a differential equation in terms of a power series or time series in that way. However I have to put some effort into formulating it in a way that works. E.g. I'm only able to solve such equations if it is possible to express the second derivative in terms of the first and the zeroth one. Computer algebra systems are essentially better here. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is Haskell a 5GL?
Hi, 3GLs: programming based on algorithms (C, Java, ...) There are algorithms in Haskell 4GSs: domain-specific languages (SQL,...) There are plenty of domain specific languages in Haskell, I'd call Parsec one of them 5GLs: automatic problem solving (Mathematica, Prolog,...) I wouldn't say it "automatically" solves the problems. But I would say that the high degree of abstraction and compositionality afforded by a pure language means that its easy to reuse other peoples solutions, which I guess is having it automatically solved. and/or visual programming (Visual Basic,...) I can only assume you are a) joking, or b) not a visual basic user. While Visual Basic is a much insulted language, I have a soft spot for it. However, its not a Visual programming language - its a language which happens to have a GUI API and a bit of IDE support. Its resolutely a 3GL, roughly akin to Java, in my opinion. The question is: how strong is the influence of laziness in everyday Haskell programming? I'd say very strong, lots of times a "where" is used thats making use of laziness. Thanks Neil ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Is Haskell a 5GL?
Dear Haskellers, do you think that Haskell is a 3GL (third generation language) or a 5GL or that the hierarchy of programming language generations is useless? I see a problem if the potential of a language is evaluated according to the generation it belongs to. 1GLs: machine languages 2GLs: assembler languages 3GLs: programming based on algorithms (C, Java, ...) 4GSs: domain-specific languages (SQL,...) 5GLs: automatic problem solving (Mathematica, Prolog,...) and/or visual programming (Visual Basic,...) Haskell's laziness would in principle permit programming in a style akin to Prolog, e.g., for parser combinators. The question is: how strong is the influence of laziness in everyday Haskell programming? Cheers -- Christoph ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell DLL crashes Excel
I don't think GHC is to blame in this case. If you follow all the API (ABI) guidelines for building XLLs things work fine. But there's a lot of things to get right. -- Lennart On Sep 25, 2006, at 05:16 , Simon Peyton-Jones wrote: Andreas, Nikunj, and others I don't have any experience of using GHC to build XLLs, or getting VBA to call Haskell via a DLL. However, this is something we'd like to be easy and reliable using GHC. If any of you are experts on the VBA/DLL side of the question, and can figure out what we should do to make GHC do the Right Thing, we're all ears. Meanwhile, why not document whatever you learn (even if it's provisional) on the GHC wiki? http://haskell.org/haskellwiki/GHC/Using_the_FFI That would help others. Simon | -Original Message- | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of | Andreas Marth | Sent: 22 September 2006 10:21 | To: haskell-cafe@haskell.org | Subject: [Haskell-cafe] Haskell DLL crashes Excel | | Hi everybody! | | As you might now already know I try to let VBA call Haskell via a DLL. The | function returns a String. Everything works fine now if I call the function | only once. If I call it more often Excel crashes soon. Does any body have | any idea what is going wrong or how I can find out. (I am a medium skilled | Haskell user but no VBA programmer.) | | My code for Haskell (Calculate.hs): | | module Calculate where | | import Foreign.C.String (CString, peekCString, newCString) | import Data.Word (Word8, Word16, Word32) | import Data.Bits (shiftR, (.&.)) | import Foreign.Marshal.Array (newArray) | import Foreign.Ptr (Ptr, plusPtr) | | type BSTR8 = Ptr Word8 | | createBSTR8 :: String -> IO BSTR8 | createBSTR8 s = do |let | len :: Word32 = fromIntegral (length s) | low_l :: Word8 = fromIntegral (len .&. 0x) | low_h :: Word8 = fromIntegral (shiftR len 8 .&. 0x) | high_l :: Word8 = fromIntegral (shiftR len 16 .&. 0x) | high_h :: Word8 = fromIntegral (shiftR len 24 .&. 0x) |arr <- newArray ([low_l,low_h,high_l,high_h] ++ map (fromIntegral . | fromEnum) s ++ [0]) |return $! plusPtr arr 4 | | | testL :: Int -> CString -> IO BSTR8 | testL n cs = do s <- peekCString cs | createBSTR8 $ concat $ take n $ repeat s | | foreign export stdcall testL :: Int -> CString -> IO BSTR8 | ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: [Haskell] BitSyntax for Haskell
On 23.09 15:00, Adam Langley wrote: > Erlang's bit syntax[1] is a great for building and breaking up binary > structures. I've knocked up something similar (although a little > clumsy) for Haskell: > > http://www.imperialviolet.org/binary/bitsyntax/ > http://www.imperialviolet.org/binary/bitsyntax/BitSyntax.hs > > I'm sure that this isn't the best possible way to do this, but it > suffices at this stage for many problems. This looks very nice. Here are some feature wishes: BitBlock: add a way to encode length prefixed ByteStrings. For the decoding part: * Provide a monadic interface * Add a test part to ReadType: Test :: ReadType a -> (a -> Bool) -> ReadType Test (or a -> m ()) in the monadic case. * Add a way to limit the size of a LengthPrefixed: e.g. [Unsigned 4, LengthPrefixed] is very unsafe, the app should have a way to control the maximum length. - Einar Karttunen ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
RE: [Haskell-cafe] Haskell DLL crashes Excel
Andreas, Nikunj, and others I don't have any experience of using GHC to build XLLs, or getting VBA to call Haskell via a DLL. However, this is something we'd like to be easy and reliable using GHC. If any of you are experts on the VBA/DLL side of the question, and can figure out what we should do to make GHC do the Right Thing, we're all ears. Meanwhile, why not document whatever you learn (even if it's provisional) on the GHC wiki? http://haskell.org/haskellwiki/GHC/Using_the_FFI That would help others. Simon | -Original Message- | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of | Andreas Marth | Sent: 22 September 2006 10:21 | To: haskell-cafe@haskell.org | Subject: [Haskell-cafe] Haskell DLL crashes Excel | | Hi everybody! | | As you might now already know I try to let VBA call Haskell via a DLL. The | function returns a String. Everything works fine now if I call the function | only once. If I call it more often Excel crashes soon. Does any body have | any idea what is going wrong or how I can find out. (I am a medium skilled | Haskell user but no VBA programmer.) | | My code for Haskell (Calculate.hs): | | module Calculate where | | import Foreign.C.String (CString, peekCString, newCString) | import Data.Word (Word8, Word16, Word32) | import Data.Bits (shiftR, (.&.)) | import Foreign.Marshal.Array (newArray) | import Foreign.Ptr (Ptr, plusPtr) | | type BSTR8 = Ptr Word8 | | createBSTR8 :: String -> IO BSTR8 | createBSTR8 s = do |let | len :: Word32 = fromIntegral (length s) | low_l :: Word8 = fromIntegral (len .&. 0x) | low_h :: Word8 = fromIntegral (shiftR len 8 .&. 0x) | high_l :: Word8 = fromIntegral (shiftR len 16 .&. 0x) | high_h :: Word8 = fromIntegral (shiftR len 24 .&. 0x) |arr <- newArray ([low_l,low_h,high_l,high_h] ++ map (fromIntegral . | fromEnum) s ++ [0]) |return $! plusPtr arr 4 | | | testL :: Int -> CString -> IO BSTR8 | testL n cs = do s <- peekCString cs | createBSTR8 $ concat $ take n $ repeat s | | foreign export stdcall testL :: Int -> CString -> IO BSTR8 | ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
RE: [Haskell-cafe] System threads?
| I'm working on a project for which the solution is highly | parallelizable. I've been writing it so far for GHC as a single-threaded | app. I'd like to be able to split the job into multiple pieces, and | spawn different system threads for each piece, so they will run on | separate CPUs. Either each thread needs to write to the same IO handle, | or else the results need to be collected when the threads are merged, so | the results can all be printed. GHC 6.6 (release candidate available) supports parallel execution on SMP machines. http://www.haskell.org/ghc/dist/current/docs/users_guide/sec-using-smp.h tml Garbage collection is not parallelised yet, something we plan to fix this autumn. If you want a distributed memory machine (e.g. cluster of boxes) then you may want GPH, http://www.macs.hw.ac.uk/~dsg/gph/ although it's based on an older version of GHC. Simon | -Original Message- | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lyle | Kopnicky | Sent: 20 September 2006 03:46 | To: haskell-cafe@haskell.org | Subject: [Haskell-cafe] System threads? | | Hi folks, | | I'm working on a project for which the solution is highly | parallelizable. I've been writing it so far for GHC as a single-threaded | app. I'd like to be able to split the job into multiple pieces, and | spawn different system threads for each piece, so they will run on | separate CPUs. Either each thread needs to write to the same IO handle, | or else the results need to be collected when the threads are merged, so | the results can all be printed. | | I'm working on Linux. What's the easiest way to accomplish this? Glasgow | Parallel Haskell? Is there a Posix.Threads library? I understand that | Haskell threads (Control.Concurrent) all run in one system thread, so | would not take advantage of SMP. | | I suppose in the worst case I can write a shell program that divides up | the problem, runs several worker processes to output intermediate | results to files, then combines the results to the desired filehandle. | | Thanks, | Lyle | ___ | Haskell-Cafe mailing list | Haskell-Cafe@haskell.org | http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Writing forum software in Haskell
David House wrote: > * What would be a compulsory feature list? Ability to subscribe to forums by email and to post/followup by email. Alternatively, or in addition, a two-way NNTP gateway. (If you want us forum-allergic to participate in the discussions there, that is.) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe