Re: [Haskell-cafe] Are there arithmetic composition of functions?
At present we can easily express different flavors of conjunction, but expressing disjunction is hard. Disjunction is not particularly difficult. See, for example, http://okmij.org/ftp/Haskell/TTypeable/TTypeable.hs and search for ORELSE. The code demonstrates higher-order type-level programming (for example, higher-order function Member with the equality predicate as the argument). The file implements closed-world negation for type predicates. See http://okmij.org/ftp/Haskell/typeEQ.html for explanations. Incidentally, one application of that machinery is precisely your original problem. The code http://okmij.org/ftp/Haskell/TTypeable/NotAFunctionT.hs implements vector spaces as function spaces, so you can use the same operation + :: Vspace v = v - v - v to add arguments of the type (Num n =n), Num n = a - n, Num n = a - b - n, etc. (there is also a scalar-vector multiplication). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Un-memoization
On Mar 22, 2012 2:56 AM, Victor Miller victorsmil...@gmail.com wrote: I was writing a Haskell program which builds a large labeled binary tree and then does some processing of it, which is fold-like. In the actual application that I have in mind the tree will be *huge*. If the whole tree is kept in memory it would probably take up 100's of gigabytes. Because of the pattern of processing the tree, it occurred to me that it might be better (cause much less paging) if some large subtrees could be replaced by thunks which can either recalculate the subtree as needed, This sounds like weak references (warning this is tricky stuff), http://www.haskell.org/ghc/docs/7.0.2/html/libraries/base-4.3.1.0/System-Mem-Weak.html or write out the subtree, get rid of the references to it (so it can be garbage collected) and then read back in (perhaps in pieces) as needed. This could be fairly cleanly expressed monadically. So does anyone know if someone has created something like this? Victor ___ 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
[Haskell-cafe] Munich Haskell Meeting
Dear all, once again, it's time for our monthly Haskell get-together in Munich. On Wed, 28 Feb 2012, at 19h30, we will meet at Cafe Puck (near the universities). Everybody is invited. If you plan to join, please go to: http://www.haskell-munich.de/dates and add yourself. This will help to reserve tables. Have a nice time until Wednesday, Heinrich -- -- hoerde...@funktional.info www.funktional.info -- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Regarding Haskell FFI for C/C++ (Passing of String)
Hi, I have just started learning Haskell FFI. I am trying to send a string from hastell to a C function. For this, I am required to convert the haskell string to byte string. I have two methods to achieve this task. Both are listed below: 1) import Foreign.C.String let arg1 = map castCharToCChar Hello :: [CChar] 2) import qualified Data.ByteString.Char8 as B f = B.pack Hello I just wanted to know the optimal way to achieve this task. Please suggest the optimal way of doing this. If there is any other way, please share it. Also, please suggest me any good tutorial to start with Haskell FFI for C/C++. Thank you very much. Regards, Rajendra ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Regarding Haskell FFI for C/C++ (Passing of String)
This joins the question I asked two days ago here. (See http://haskell.1045720.n5.nabble.com/Quickest-way-to-pass-Text-to-C-code-td5582223.html ) Hope that helps. Le 22 mars 2012 15:10, rajendra prasad rajendradpra...@gmail.com a écrit : Hi, I have just started learning Haskell FFI. I am trying to send a string from hastell to a C function. For this, I am required to convert the haskell string to byte string. I have two methods to achieve this task. Both are listed below: 1) import Foreign.C.String let arg1 = map castCharToCChar Hello :: [CChar] 2) import qualified Data.ByteString.Char8 as B f = B.pack Hello I just wanted to know the optimal way to achieve this task. Please suggest the optimal way of doing this. If there is any other way, please share it. Also, please suggest me any good tutorial to start with Haskell FFI for C/C++. Thank you very much. Regards, Rajendra ___ 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] Regarding Haskell FFI for C/C++ (Passing of String)
(Sorry for the double post) Forget about ByteString.Char8: it doesn't handle unicode as it truncates characters. Going from String to bytestring is easy thanks to the utf8-string ( http://hackage.haskell.org/packages/archive/utf8-string/0.3.7/doc/html/Codec-Binary-UTF8-String.html) package and pack function from Data.ByteString(.Lazy). And if you want to convert your String directly to a CString (a Ptr CChar) you better use Foreign.C.String.withCString. Le 22 mars 2012 15:17, Yves Parès yves.pa...@gmail.com a écrit : This joins the question I asked two days ago here. (See http://haskell.1045720.n5.nabble.com/Quickest-way-to-pass-Text-to-C-code-td5582223.html ) Hope that helps. Le 22 mars 2012 15:10, rajendra prasad rajendradpra...@gmail.com a écrit : Hi, I have just started learning Haskell FFI. I am trying to send a string from hastell to a C function. For this, I am required to convert the haskell string to byte string. I have two methods to achieve this task. Both are listed below: 1) import Foreign.C.String let arg1 = map castCharToCChar Hello :: [CChar] 2) import qualified Data.ByteString.Char8 as B f = B.pack Hello I just wanted to know the optimal way to achieve this task. Please suggest the optimal way of doing this. If there is any other way, please share it. Also, please suggest me any good tutorial to start with Haskell FFI for C/C++. Thank you very much. Regards, Rajendra ___ 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
[Haskell-cafe] Puzzled about inlining and specialise inline under ghc -O2
Dear Haskell-Cafe, I'm computing a histogram of a bunch of symbols with up to 8 bits of information each, stored in a unboxed vector of Word8. The histogram is represented as an unboxed vector of Int with size 2^bits. I compute the histogram by folding an increment function. The problem: depending on what types and what annotations I give to the increment and histogram function (see below), the GC gets through a different amount of memory. I'm using GHC 7.0.3 and -O2. I'd like to better understand how and why the optimisation does/doesn't kick in. Here are the functions with the most generic types I can think of: import qualified Data.Vector.Unboxed as UV import qualified Data.Vector.Unboxed.Mutable as UMV import Control.Monad.Primitive (PrimMonad, PrimState) increment :: (PrimMonad m, UMV.Unbox a, Num a, Integral b) = UMV.MVector (PrimState m) a - b - m (UMV.MVector (PrimState m) a) increment v x = do n - UMV.read v (fromIntegral x) UMV.write v (fromIntegral x) (n+1) return v histogram :: (Integral a, UMV.Unbox a) = Int - UV.Vector a - UV.Vector Int histogram bitsPerSym v = runST $ do a - UMV.replicate (2^bitsPerSym) (0::Int) a' - UV.foldM' increment a v UV.unsafeFreeze a' Running my test load, I get: total alloc = 33,206,568 bytes Looking at the core, ghc is not specialising the functions, even if I tell it to inline them. So let's brutally change the types to be as specific as I need for my application: increment :: UMV.MVector s Int - Word8 - ST s (UMV.MVector s Int) histogram :: Int - UV.Vector Word8 - UV.Vector Int result: total alloc = 19,581,152 bytes and if I put INLINE pragmas for both functions: 16,952,512 bytes I should be able to achieve the same effect with SPECIALISE INLINE pragmas, right? Let's try that: {-# SPECIALISE INLINE increment :: UMV.MVector s Int - Word8 - ST s (UMV.MVector s Int) #-} {-# SPECIALISE INLINE histogram :: Int - UV.Vector Word8 - UV.Vector Int #-} result: 33,139,856 bytes (GHC can't figure out application of the first rule, giving: Warning: RULE left-hand side too complicated to desugar) So unfortunately my most generic form won't work here, I need to specialise increment to be in ST (which sucks, because I want it to work for both IO and ST): increment :: (UMV.Unbox a, Num a, Integral b) = UMV.MVector s a - b - ST s (UMV.MVector s a) {-# SPECIALISE INLINE increment :: UMV.MVector s Int - Word8 - ST s (UMV.MVector s Int) #-} result: 17,016,192 bytes This is very close to the most specific function instantiations and INLINE, but: - I've lost being generic between ST and IO - it's still a little bigger than the specific instances + INLINE So my questions are: what is going on? Can I have genericity between ST and IO while keeping the low GC usage? How come SPECIALISE INLINE does not give the same result as specific instances + INLINE? Obviously, for this example, I don't really *need* increment to work inside IO, since I'm using runST... but I want to understand what is going on. Profiling Haskell performance and memory usage has always been difficult for me. Much thanks in advance, Rafal Kolanski. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Open-source projects for beginning Haskell students?
serialhex wrote: On Sat, Mar 17, 2012 at 11:01 AM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: The task is to implement a small audio synthesizer in Haskell. seriously?!?! i'm not in his class, but i'm game! i learn better when i'm working on something interesting, and i want to make my (currently pretty pathetic) haskell better and i *LOOOE* audio! a haskell-based synth (or series of synths) would be really spiffy! what do i have to know / learn / do? Well, it's up to you, really. You need to learn a bit how audio synthesis works, for instance starting with the following links. http://www.acoustics.salford.ac.uk/acoustics_info/sound_synthesis/ http://en.wikibooks.org/wiki/Sound_Synthesis_Theory http://en.wikipedia.org/wiki/Category:Sound_synthesis_types Then, it's best to learn by programming various wave forms yourself and playing around with them. I just finished implementing the necessary Haskell backend for playing raw audio data. You can find it here: http://hackage.haskell.org/package/tomato-rubato-openal The testSine function demonstrates how it works. Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] haskell-platform vs macports
I assume that many haskell users out there on macs who are also users of macports, and I bet they've hit this same issue that I've hit numerous times. The problem is that there are 2 incompatible versions of libiconv -- one that ships with the mac, and one that's built with macports and that many macports-compiled libraries depend on. Work-arounds have been documented in numerous places (notably here: http://blog.omega-prime.co.uk/?p=96), but if you are trying to link with a macports-compiled libraries that depends on /opt/local/lib/libiconv.2.dylib, your only alternative seems to be building ghc from source in order to avoid the incompatibility. I hit this problem while trying to build a foreign-function interface to libarchive. So I built ghc from scratch -- in fact I built the whole haskell-platform. This was relatively painless, and fixed the libiconv problem. However, it brings me to the real point of my message, which is that the version of haskell-platform available via macports is way out of date (2009.2.0.2 http://www.macports.org/ports.php?by=namesubstr=haskell-platform). I'm wondering whether the haskell-platform team has considered maintaining a macports version of the haskell-platform for us mac users in addition to the binary install that's available now. This would avoid the incompatibilities such as this nagging one with libiconv. Perhaps it's just a matter of maintaining template versions of the port files? Warren Undefined symbols for architecture x86_64: _locale_charset, referenced from: _localeEncoding in libHSbase-4.3.1.0.a(PrelIOUtils.o) _iconv_close, referenced from: _hs_iconv_close in libHSbase-4.3.1.0.a(iconv.o) (maybe you meant: _hs_iconv_close) _iconv, referenced from: _hs_iconv in libHSbase-4.3.1.0.a(iconv.o) (maybe you meant: _hs_iconv, _hs_iconv_open , _hs_iconv_close ) _iconv_open, referenced from: _hs_iconv_open in libHSbase-4.3.1.0.a(iconv.o) (maybe you meant: _hs_iconv_open) ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status cabal: Error: some packages failed to install: Libarchive-0.1 failed during the building phase. The exception was: ExitFailure 1 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Open-source projects for beginning Haskell students?
If you want to do Haskell audio synthesis, you could also use hsc3 (good start here: http://slavepianos.org/rd/ut/hsc3-texts/). With hsc3 you can start on serious audio synthesis with only a few lines of Haskell. In my opinion it could use a much larger community. Tom On 3/22/12, Heinrich Apfelmus apfel...@quantentunnel.de wrote: serialhex wrote: On Sat, Mar 17, 2012 at 11:01 AM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: The task is to implement a small audio synthesizer in Haskell. seriously?!?! i'm not in his class, but i'm game! i learn better when i'm working on something interesting, and i want to make my (currently pretty pathetic) haskell better and i *LOOOE* audio! a haskell-based synth (or series of synths) would be really spiffy! what do i have to know / learn / do? Well, it's up to you, really. You need to learn a bit how audio synthesis works, for instance starting with the following links. http://www.acoustics.salford.ac.uk/acoustics_info/sound_synthesis/ http://en.wikibooks.org/wiki/Sound_Synthesis_Theory http://en.wikipedia.org/wiki/Category:Sound_synthesis_types Then, it's best to learn by programming various wave forms yourself and playing around with them. I just finished implementing the necessary Haskell backend for playing raw audio data. You can find it here: http://hackage.haskell.org/package/tomato-rubato-openal The testSine function demonstrates how it works. Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com ___ 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] Open-source projects for beginning Haskell students?
Sorry; make that http://slavepianos.org/rd/ut/hsc3-texts/hsc3-tutorial.html On 3/22/12, Tom Murphy amin...@gmail.com wrote: If you want to do Haskell audio synthesis, you could also use hsc3 (good start here: http://slavepianos.org/rd/ut/hsc3-texts/). With hsc3 you can start on serious audio synthesis with only a few lines of Haskell. In my opinion it could use a much larger community. Tom On 3/22/12, Heinrich Apfelmus apfel...@quantentunnel.de wrote: serialhex wrote: On Sat, Mar 17, 2012 at 11:01 AM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: The task is to implement a small audio synthesizer in Haskell. seriously?!?! i'm not in his class, but i'm game! i learn better when i'm working on something interesting, and i want to make my (currently pretty pathetic) haskell better and i *LOOOE* audio! a haskell-based synth (or series of synths) would be really spiffy! what do i have to know / learn / do? Well, it's up to you, really. You need to learn a bit how audio synthesis works, for instance starting with the following links. http://www.acoustics.salford.ac.uk/acoustics_info/sound_synthesis/ http://en.wikibooks.org/wiki/Sound_Synthesis_Theory http://en.wikipedia.org/wiki/Category:Sound_synthesis_types Then, it's best to learn by programming various wave forms yourself and playing around with them. I just finished implementing the necessary Haskell backend for playing raw audio data. You can find it here: http://hackage.haskell.org/package/tomato-rubato-openal The testSine function demonstrates how it works. Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com ___ 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] Un-memoization
Hi Victor There was a paper at one of the early PADL conferences describing out-out-core data structures in Ocaml. I've never seen anyone following up this work, possibly because RAM has got so cheap in the last decade. If you have such large trees you may find the paper interesting. Although the authors used Caml they did use monads. Tyng-Ruey Chuang and Shin-Cheng Mu, Out-of-core functional programming with type-based primitives, The paper seems to be on Citeseer. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] good lightweight web-framework like sinatra?
Try Miku. https://github.com/nfjinjing/miku some oddnesses around redefining (-) (I guess Jinjing Wang doesn't like the way $ looks?) but you don't need to import the Air.Light stuff. Otherwise more or less a straight port of sinatra, and you can run it on heroku... mark On Wed, Mar 21, 2012 at 1:45 PM, serialhex serial...@gmail.com wrote: i'm looking for something lightweight, that dosnt need it's own server, can easily run on cgi on an apache with minimal work, and dosn't have many dependancies. i was looking at yesod, but it is bigger than i need for my site (at this point) and would take too much work to get running on my webhost. though i am looking forward to learning it and using it in the future, i just need something that will play nicely with apache cgi... justin p.s. if anyone is interested to know i'm using nearlyfreespeach.net as my host... haskell is one of the many languages they support via cgi, but, at the moment, it is kind of difficult to get yesod or rails or the like to work on it... :-/ -- * The wise man said: Never argue with an idiot. They bring you down to their level and beat you with experience. * As a programmer, it is your job to put yourself out of business. What you do today can be automated tomorrow. ~Doug McIlroy No snowflake in an avalanche ever feels responsible. --- CFO: “What happens if we train people and they leave?” CTO: “What if we don’t and they stay?” ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- A UNIX signature isn't a return address, it's the ASCII equivalent of a black velvet clown painting. It's a rectangle of carets surrounding a quote from a literary giant of weeniedom like Heinlein or Dr. Who. -- Chris Maeda ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] [ANNOUNCE] vector-conduit
I've released a small (one-module) library [1] inspired by functions in Data.Conduit.List like sourceList, consumeList, and take. The most recent (by a few days) depends on conduit-0.3.*, but vector-conduit-0.2.1.0 depends on conduit-0.2.*. Notably, however, the two have different APIs (0.3 has an API more consistent with other vector operations). Use of any versions below 0.2.1 is discouraged as consumeVector is notably less efficient since in those versions it relies on a dlist. This should be useful for replacing consumeList with consumeVector, since consumeVector is much more efficient for reading in a large amount of values with, at this point, very little code overhead for using a Vector rather than a list. The library uses Data.Vector.Generic so unboxed, boxed, immutable, and mutable vectors are all supported, along with conduits for converting between mutable and immutable. [1] http://hackage.haskell.org/package/vector-conduit-0.3.0.0 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [ANNOUNCE] vector-conduit
Nice package! An idea for sourceVector is to use the streaming interface [1]. It would be nice if GHC could fuse the array with sourceVector, avoiding to produce the array in the first place, but I'm not going to hold my breath =). Cheers, [1] http://hackage.haskell.org/packages/archive/vector/0.9.1/doc/html/Data-Vector-Generic.html#v:stream -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [ANNOUNCE] vector-conduit
On Thu, Mar 22, 2012 at 06:16:39PM -0300, Felipe Almeida Lessa wrote: From: Felipe Almeida Lessa felipe.le...@gmail.com To: Jared Hance jaredha...@gmail.com Cc: haskell-cafe@haskell.org Date: Thu, 22 Mar 2012 18:16:39 -0300 Subject: Re: [Haskell-cafe] [ANNOUNCE] vector-conduit Nice package! An idea for sourceVector is to use the streaming interface [1]. It would be nice if GHC could fuse the array with sourceVector, avoiding to produce the array in the first place, but I'm not going to hold my breath =). I looked over it and decided to simply go with head/tail (not sure why I used the index thing... head/tail is so much more functional). That should still get some fusion benefit, right, since it all uses streams under the hood? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Open-source projects for beginning Haskell students?
giving a real-time audio synthesizer in the style of functional reactive programming. you know about yampasynth right? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [ANNOUNCE] vector-conduit
On Thu, Mar 22, 2012 at 8:03 PM, Jared Hance jaredha...@gmail.com wrote: I looked over it and decided to simply go with head/tail (not sure why I used the index thing... head/tail is so much more functional). That should still get some fusion benefit, right, since it all uses streams under the hood? I'm almost sure that it won't fuse using head and tail, but YMMV. Cheers, -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] haskell-platform vs macports
If you're not otherwise attached to MacPorts, you might want to check out Homebrew [1]. Its integration with the rest of OS X is generally more smoothly and I haven't come across any missing packages yet. [1]: http://mxcl.github.com/homebrew/ On 22 March 2012 16:34, Warren Harris warrensomeb...@gmail.com wrote: I assume that many haskell users out there on macs who are also users of macports, and I bet they've hit this same issue that I've hit numerous times. The problem is that there are 2 incompatible versions of libiconv -- one that ships with the mac, and one that's built with macports and that many macports-compiled libraries depend on. Work-arounds have been documented in numerous places (notably here: http://blog.omega-prime.co.uk/?p=96), but if you are trying to link with a macports-compiled libraries that depends on /opt/local/lib/libiconv.2.dylib, your only alternative seems to be building ghc from source in order to avoid the incompatibility. I hit this problem while trying to build a foreign-function interface to libarchive. So I built ghc from scratch -- in fact I built the whole haskell-platform. This was relatively painless, and fixed the libiconv problem. However, it brings me to the real point of my message, which is that the version of haskell-platform available via macports is way out of date (2009.2.0.2 http://www.macports.org/ports.php?by=namesubstr=haskell-platform). I'm wondering whether the haskell-platform team has considered maintaining a macports version of the haskell-platform for us mac users in addition to the binary install that's available now. This would avoid the incompatibilities such as this nagging one with libiconv. Perhaps it's just a matter of maintaining template versions of the port files? Warren Undefined symbols for architecture x86_64: _locale_charset, referenced from: _localeEncoding in libHSbase-4.3.1.0.a(PrelIOUtils.o) _iconv_close, referenced from: _hs_iconv_close in libHSbase-4.3.1.0.a(iconv.o) (maybe you meant: _hs_iconv_close) _iconv, referenced from: _hs_iconv in libHSbase-4.3.1.0.a(iconv.o) (maybe you meant: _hs_iconv, _hs_iconv_open , _hs_iconv_close ) _iconv_open, referenced from: _hs_iconv_open in libHSbase-4.3.1.0.a(iconv.o) (maybe you meant: _hs_iconv_open) ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status cabal: Error: some packages failed to install: Libarchive-0.1 failed during the building phase. The exception was: ExitFailure 1 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Push the envelope. Watch it bend. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] haskell-platform vs macports
Thomas, Thanks for the recommendation. I tried installing with homebrew, and it went fairly smoothly. Only 12 minutes to build haskell-platform, as opposed to the 11 hours to run port upgrade outdated yesterday! I did have to get help on one thing though. Although the mac ships with libarchive.dylib, it doesn't have archive.h. In order to install that, the following steps are necessary, since the libarchive package is otherwise blacklisted: brew tap homebrew/dupes brew install `brew --prefix`/Library/Formula/libarchive.rb Warren On Mar 22, 2012, at 3:31 PM, Thomas Schilling wrote: If you're not otherwise attached to MacPorts, you might want to check out Homebrew [1]. Its integration with the rest of OS X is generally more smoothly and I haven't come across any missing packages yet. [1]: http://mxcl.github.com/homebrew/ On 22 March 2012 16:34, Warren Harris warrensomeb...@gmail.com wrote: I assume that many haskell users out there on macs who are also users of macports, and I bet they've hit this same issue that I've hit numerous times. The problem is that there are 2 incompatible versions of libiconv -- one that ships with the mac, and one that's built with macports and that many macports-compiled libraries depend on. Work-arounds have been documented in numerous places (notably here: http://blog.omega-prime.co.uk/?p=96), but if you are trying to link with a macports-compiled libraries that depends on /opt/local/lib/libiconv.2.dylib, your only alternative seems to be building ghc from source in order to avoid the incompatibility. I hit this problem while trying to build a foreign-function interface to libarchive. So I built ghc from scratch -- in fact I built the whole haskell-platform. This was relatively painless, and fixed the libiconv problem. However, it brings me to the real point of my message, which is that the version of haskell-platform available via macports is way out of date (2009.2.0.2 http://www.macports.org/ports.php?by=namesubstr=haskell-platform). I'm wondering whether the haskell-platform team has considered maintaining a macports version of the haskell-platform for us mac users in addition to the binary install that's available now. This would avoid the incompatibilities such as this nagging one with libiconv. Perhaps it's just a matter of maintaining template versions of the port files? Warren Undefined symbols for architecture x86_64: _locale_charset, referenced from: _localeEncoding in libHSbase-4.3.1.0.a(PrelIOUtils.o) _iconv_close, referenced from: _hs_iconv_close in libHSbase-4.3.1.0.a(iconv.o) (maybe you meant: _hs_iconv_close) _iconv, referenced from: _hs_iconv in libHSbase-4.3.1.0.a(iconv.o) (maybe you meant: _hs_iconv, _hs_iconv_open , _hs_iconv_close ) _iconv_open, referenced from: _hs_iconv_open in libHSbase-4.3.1.0.a(iconv.o) (maybe you meant: _hs_iconv_open) ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status cabal: Error: some packages failed to install: Libarchive-0.1 failed during the building phase. The exception was: ExitFailure 1 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Push the envelope. Watch it bend. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [ANNOUNCE] vector-conduit
On Thu, Mar 22, 2012 at 07:31:18PM -0300, Felipe Almeida Lessa wrote: From: Felipe Almeida Lessa felipe.le...@gmail.com To: haskell-cafe@haskell.org Date: Thu, 22 Mar 2012 19:31:18 -0300 Subject: Re: [Haskell-cafe] [ANNOUNCE] vector-conduit On Thu, Mar 22, 2012 at 8:03 PM, Jared Hance jaredha...@gmail.com wrote: I looked over it and decided to simply go with head/tail (not sure why I used the index thing... head/tail is so much more functional). That should still get some fusion benefit, right, since it all uses streams under the hood? I'm almost sure that it won't fuse using head and tail, but YMMV. Okay then. I just implemented the stream version; its at the git repository but I probably won't release for a few more days since I want to expand the testsuite. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] good lightweight web-framework like sinatra?
On 23 March 2012 04:55, Mark Wotton mwot...@gmail.com wrote: Try Miku. https://github.com/nfjinjing/miku some oddnesses around redefining (-) (I guess Jinjing Wang doesn't like the way $ looks?) but you don't need to import the Air.Light stuff. Otherwise more or less a straight port of sinatra, and you can run it on heroku... Hi Mark, Is it possible to use Miku without hack2-handler-snap-server? Conrad. mark On Wed, Mar 21, 2012 at 1:45 PM, serialhex serial...@gmail.com wrote: i'm looking for something lightweight, that dosnt need it's own server, can easily run on cgi on an apache with minimal work, and dosn't have many dependancies. i was looking at yesod, but it is bigger than i need for my site (at this point) and would take too much work to get running on my webhost. though i am looking forward to learning it and using it in the future, i just need something that will play nicely with apache cgi... justin p.s. if anyone is interested to know i'm using nearlyfreespeach.net as my host... haskell is one of the many languages they support via cgi, but, at the moment, it is kind of difficult to get yesod or rails or the like to work on it... :-/ -- * The wise man said: Never argue with an idiot. They bring you down to their level and beat you with experience. * As a programmer, it is your job to put yourself out of business. What you do today can be automated tomorrow. ~Doug McIlroy No snowflake in an avalanche ever feels responsible. --- CFO: “What happens if we train people and they leave?” CTO: “What if we don’t and they stay?” ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- A UNIX signature isn't a return address, it's the ASCII equivalent of a black velvet clown painting. It's a rectangle of carets surrounding a quote from a literary giant of weeniedom like Heinlein or Dr. Who. -- Chris Maeda ___ 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
[Haskell-cafe] Parallelism causes space leaks
Hi, For the code below, where it says HERE in comments, if I remove the part after `using` the code works fine. However, with this version it causes a Stack space overflow (if allowed uses GBs of memory). You just need to input a file with around 1M lines each having something like Int Value: 3 @x. What is wrong with adding the parList to this code? (Same thing happens for parMap, and parListChunk, etc) Yavuz import System.IO import System.Environment import System.IO.Error import Control.Parallel import Control.Parallel.Strategies import Control.Monad import Data.Binary as DB import Data.Binary.Put import Data.Word import Data.Maybe import qualified Data.ByteString.Lazy as B import Text.Regex.TDFA import Text.Regex.Base.Context main = do { args - getArgs; x - getLines (head args); mapM_ writeMaybeIntBinary ((map perLineOperator x) `using` parList rdeepseq); -- HERE return (); } writeMaybeIntBinary :: Maybe Word32 - IO () writeMaybeIntBinary Nothing = return (); writeMaybeIntBinary (Just intB) = do { B.hPut stdout (runPut (putWord32host intB));}; getLines :: FilePath - IO [String] getLines = liftM lines . readFile perLineOperator :: String - Maybe Word32 perLineOperator line = let { getIntStr :: String - String; getIntStr = ; getIntStr line = let { matches = (line =~ Int Value: (-?[0-9]*) .* :: [[String]]); } in if matches == [] then else (last (head matches)); } in let { intStr = (getIntStr line); } in if intStr == then Nothing else Just (read intStr :: Word32) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe