Re: [Haskell-cafe] Partial statical linking
libgmp and libffi are external libraries not associated with Haskell, so I don't think -static (which is for Haskell libraries) applies to them. You'll have the same problem with any other sort of library of this type, like libdl and friends ;-) Edward Excerpts from Jason Dusek's message of Sat Nov 26 01:59:18 -0500 2011: Some time ago, I wrote to this list about making shared libraries with GHC, in such a way that the RTS was linked and ready to go. Recently, I've been looking a similar but, in a sense, opposite problem: linking Haskell executables with some of their non-Haskell dependencies, for distribution. I tried passing a few different sets of options to the linker through GHC, with -optl: -optl'-Wl,-r' -optl'-Wl,-r,-dy' -optl'-Wl,-static,-lffi,-lgmp,-dy' None of these had the desired effect. In the end, running GHC with -v and carefully editing the linker line produced the desired change (I have linked to and provided the diff below). The effect -optl seems to be to introduce options in the linker line just before -lHSrtsmain, which would seem to prevent one from linking libffi and libgmp differently. Is editing and storing away the linker script the best option at present for partially static linking? -- Jason Dusek () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments https://github.com/solidsnack/arx/commit/90ec5efdb0e991344aa9a4ad29456d466e022c3e #@@ -122,10 +122,8 @@ # -lHSarray-0.3.0.2 \ # -lHSbase-4.3.1.0 \ # -lHSinteger-gmp-0.2.0.3 \ #- -lgmp \ # -lHSghc-prim-0.2.0.0 \ # -lHSrts \ #- -lffi \ # -lm \ # -lrt \ # -ldl \ #@@ -136,4 +134,7 @@ # -lgcc_s --no-as-needed \ # /usr/lib/gcc/x86_64-linux-gnu/4.6.1/crtend.o \ # /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu/crtn.o \ #+ -static \ #+ -lgmp \ #+ -lffi \ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Munich December Haskell Meeting
Dear all, on our last meeting, we decided to set up a doodle poll to determine the date of our December's get-together: http://www.doodle.com/x6x4sgnemc35myq3 If you want to join, vote! There are also new dates available for next year's meetings (with rotating week-days): http://www.haskell-munich.de/dates Have a nice December, 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] ANNOUNCE: data-timeout - 64-bit timeouts of nanosecond precision
Hi. I grew up tired of counting milliseconds, so I wrote a small library[1] that allows me to specify time units for timeouts and convert between them. The library also provides wrapped versions of 'timeout' and 'threadDelay' functions: threadDelay $ 1 # Minute + 30 # Second Nanosecond precision seems to be enough for RTS and POSIX calls and it also provides a good range for 64-bit representation: maxBound :: Timeout 30500 w 3 d 23 h 34 m 33 s 709 ms 551 us 615 ns One thing that might disappoint some people is that I chose unsigned underlying type (Word64), which means that infinite timeouts cannot be represented. I think negative timeouts essentially are performance warts (a way of packing `Maybe Word63` into Word64) that muddle equality and I recommend using `Maybe Timeout` whenever timeout is optional. [1] http://hackage.haskell.org/package/data-timeout ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] List fusion of nested lists
Dear Cafe, I’m trying to exploit list fusion as provided by GHC (build/foldr). One function that I want to get fusable is this, it splits a list of integeres into maximal monotonous subsequences: streaks :: [Integer] - [[Integer]] streaks [] = [] streaks (x:xs) = let (this,rest) = oneStreak (x:xs) in this:streaks rest oneStreak :: [Integer] - ([Integer], [Integer]) oneStreak [x] = ([x],[]) oneStreak l@(x:y:_) = splitWhile2 (\a b - a `compare` b == x `compare` y) l splitWhile2 :: (Integer - Integer - Bool) - [Integer] - ([Integer], [Integer]) splitWhile2 p [x] = ([x],[]) splitWhile2 p (x:y:xs) | p x y = let (s,r) = splitWhile2 p (y:xs) in (x:s,r) | otherwise = ([x],y:xs) Now I’d like to implement streaks in terms of build and foldr such that it is subject to list fusion. Especially, when used in concatMap (streaks . func) :: [X] - [[Integer]] where func :: X - [Integer] is implemented with buildr, this should ideally remove all intermediate lists. Can this be done with list fusion at all? How would I go about it? If the above example is too complicated, known how it would work for Data.List.group would help me already a lot. Greetings, Joachim -- Joachim nomeata Breitner m...@joachim-breitner.de | nome...@debian.org | GPG: 0x4743206C xmpp: nome...@joachim-breitner.de | http://www.joachim-breitner.de/ signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] List fusion of nested lists
Hi, Am Donnerstag, den 01.12.2011, 11:28 +0100 schrieb Joachim Breitner: Now I’d like to implement streaks in terms of build and foldr such that it is subject to list fusion. one half of the task is quite doable: streaks' :: [Integer] - [[Integer]] streaks' xs = foldr streaksF [] xs streaksF :: Integer - [[Integer]] - [[Integer]] streaksF i [] = [[i]] streaksF i ([x]:ys) = [i,x]:ys streaksF i ((x1:x2:xs):ys) = if i `compare` x1 == x1 `compare` x2 then (i:x1:x2:xs):ys else [i]:(x1:x2:xs):ys so I can make streaks a somewhat well-behaving consumer. The task to create the lists using build remains. (The function only works correctly on lists where no two adjacent elements are the same, and it behaves differently than the code in the first mail on [2,1,2]; it builds [[2],[1,2]] instead of [[2,1],2]. That is ok for my purposes.) Greetings, Joachim -- Joachim nomeata Breitner m...@joachim-breitner.de | nome...@debian.org | GPG: 0x4743206C xmpp: nome...@joachim-breitner.de | http://www.joachim-breitner.de/ signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] List fusion of nested lists
Hi again, Am Donnerstag, den 01.12.2011, 11:38 +0100 schrieb Joachim Breitner: Am Donnerstag, den 01.12.2011, 11:28 +0100 schrieb Joachim Breitner: Now I’d like to implement streaks in terms of build and foldr such that it is subject to list fusion. one half of the task is quite doable: streaks' :: [Integer] - [[Integer]] streaks' xs = foldr streaksF [] xs streaksF :: Integer - [[Integer]] - [[Integer]] streaksF i [] = [[i]] streaksF i ([x]:ys) = [i,x]:ys streaksF i ((x1:x2:xs):ys) = if i `compare` x1 == x1 `compare` x2 then (i:x1:x2:xs):ys else [i]:(x1:x2:xs):ys so I can make streaks a somewhat well-behaving consumer. The task to create the lists using build remains. isn’t it always nice how posting questions help you think differently about the problem? Here is the next step in the construction; ensure that at least the outer list is subject to list fusion: streaks'' :: [Integer] - [[Integer]] streaks'' xs = build $ \c n - uncurry c $ foldr (streaksF' c) ([],n) xs streaksF' :: ([Integer] - b - b) - Integer - ([Integer],b) - ([Integer],b) streaksF' c i ([],ys) = ([i],ys) streaksF' c i ([x],ys) = ([i,x],ys) streaksF' c i ((x1:x2:xs),ys) = if i `compare` x1 == x1 `compare` x2 then (i:x1:x2:xs, ys) else ([i], (x1:x2:xs) `c` ys) It seems that the next steps are: 1. Add information to the accumulator of the foldr that carries the information that is currently obtained by pattern matching (as we cannot look a fusioned list any more). 2. Somehow replace the : and [] of the inner list by the functions given by build. But have doubts that this is possible, these can only be used inside the argument of build. Greetings, Joachim -- Joachim Breitner e-Mail: m...@joachim-breitner.de Homepage: http://www.joachim-breitner.de Jabber-ID: nome...@joachim-breitner.de signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Ann: Netwire 3.0.0
Hello there, Netwire 3.0.0 is out: http://hackage.haskell.org/package/netwire Overview Netwire is a library for high performance functional reactive programming, which calls its signal functions 'wires'. It solves the classic problems of FRP through a number of simple concepts: * It is based on an automaton arrow (similar to Yampa), so performance problems like time leaks become local. Getting high FRP performance is the art of writing good primitive automata, which is simple enough. * Wire inhibition (ArrowZero), combination (ArrowPlus) and choice (ArrowChoice) make switching combinators entirely obsolete. * Events are based on inhibition, so non-happened events take no CPU time. * Very simple internal representation: Writing custom primitive wires is easy. Since Netwire is developed mainly with libraries in mind, its internals are exposed entirely. If you need a wire that is not predefined, just write an addon. * Finally Netwire comes with a large set of predefined wires. This new version comes along with a major API change (hence the new major version number) -- hopefully the last one. The main change is that the Wire type is now a data family. This gives the flexibility of Netwire 2 with the high performance of Netwire 1. We are back to 600k FPS now for moderately complicated wires. =) Changes --- Major changes and new features include: * Wire is now a data family. Most wire features are now addons through type classes, and every arrow can provide its own version of them, which is optimized for their respective internal representation. Mainly you get back the high performance monad-based wires from Netwire 1. * Nondeterministic wires (see below). * New wire transformers for supplying a clock, concurrent wires, and memoization/caching. * Improved ArrowLoop instance: Inhibition is now allowed inside of 'rec', as long as it doesn't break data dependencies. If it does, you get a useful error message now instead of a fatal pattern match failure. Minor changes: * Measuring FPS without disturbing performance: avgFpsInt. * The 'execute' wire is back. * More convenient wire stepping and testing functions. * Often you don't care about an event's value: gotEvent. Nondeterministic wires -- Now that Wire is a data family, you can have efficient nondeterministic wires by using a Kleisli-wrapped logic monad as the base arrow: import Control.Monad.Logic type MyWire = Wire e (Kleisli (LogicT IO)) Now you can use branching in a MyWire computation: x - swallow branch - [1..100] This will split the wire session into 101 branches at the first instant (it will always branch into a single inhibiting wire). Suppose you have an HTTP bot. You can now read URLs from a file and branch into an own wire for each URL: url - swallow (branch execute) - fmap lines (readFile urls.txt) quitWith myBot - url Performance --- Netwire 3 easily outperforms Netwire 2 by a factor of 10-30. Usually you will work with wire arrows on top of a Kleisli arrow. Now that Wire is a data family you can have an efficient representation of that, which gets along entirely without the Kleisli constructor wrapping. Now the main bottleneck is the monadic actions performed. This is very satisfactory. Greets, Ertugrul -- nightmare = unsafePerformIO (getWrongWife = sex) http://ertes.de/ signature.asc Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Program used for debugging
Hey, What do you mostly use for debugging? Simple calls to Debug.Trace.trace? Hpc? Hood? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Program used for debugging
On 2 December 2011 01:10, Yves Parès limestr...@gmail.com wrote: Hey, What do you mostly use for debugging? Simple calls to Debug.Trace.trace? Hpc? Hood? trace and ghci. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Poll: Do you want a mascot?
Yes On 23/11/11 19:11, heathmatlock wrote: Question: Do you want a mascot? Answers: Yes No -- This is an attempt to figure out if this idea is going anywhere. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- PMatos ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Partial statical linking
Please note that when we build with in-tree GMP, we statically link it into libHSinteger-GMP.a. Also, again only with in-tree, we patch it first to use our allocator. Both of these things are to make life easier for users creating hybrid Haskell/C executables who need to use GMP from the C side, which is possible only by linking in a second copy of it. The typical trick to force GHC to statically link a C library is to give the full path to the .a of it as one of the object files in the GHC invocation that does the final linking. This means you don't need any -l or -L flags pertaining to that library. Some libraries are very particular about the order you list them in when doing this, but I don't really understand the issues there. You usually will also have to chase dependencies by hand and list them in the same fashion. Good luck! Sent from my iPhone On Dec 1, 2011, at 3:08 AM, Edward Z. Yang ezy...@mit.edu wrote: libgmp and libffi are external libraries not associated with Haskell, so I don't think -static (which is for Haskell libraries) applies to them. You'll have the same problem with any other sort of library of this type, like libdl and friends ;-) Edward Excerpts from Jason Dusek's message of Sat Nov 26 01:59:18 -0500 2011: Some time ago, I wrote to this list about making shared libraries with GHC, in such a way that the RTS was linked and ready to go. Recently, I've been looking a similar but, in a sense, opposite problem: linking Haskell executables with some of their non-Haskell dependencies, for distribution. I tried passing a few different sets of options to the linker through GHC, with -optl: -optl'-Wl,-r' -optl'-Wl,-r,-dy' -optl'-Wl,-static,-lffi,-lgmp,-dy' None of these had the desired effect. In the end, running GHC with -v and carefully editing the linker line produced the desired change (I have linked to and provided the diff below). The effect -optl seems to be to introduce options in the linker line just before -lHSrtsmain, which would seem to prevent one from linking libffi and libgmp differently. Is editing and storing away the linker script the best option at present for partially static linking? -- Jason Dusek () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments https://github.com/solidsnack/arx/commit/90ec5efdb0e991344aa9a4ad29456d466e022c3e #@@ -122,10 +122,8 @@ # -lHSarray-0.3.0.2 \ # -lHSbase-4.3.1.0 \ # -lHSinteger-gmp-0.2.0.3 \ #- -lgmp \ # -lHSghc-prim-0.2.0.0 \ # -lHSrts \ #- -lffi \ # -lm \ # -lrt \ # -ldl \ #@@ -136,4 +134,7 @@ # -lgcc_s --no-as-needed \ # /usr/lib/gcc/x86_64-linux-gnu/4.6.1/crtend.o \ # /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu/crtn.o \ #+ -static \ #+ -lgmp \ #+ -lffi \ ___ 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] Program used for debugging
On 1 Dec 2011, at 14:10, Yves Parès wrote: Hey, What do you mostly use for debugging? Simple calls to Debug.Trace.trace? Hpc? Hood? Debug.Trace, with some short helpers so dbg x= x displays the value of x, provided x is in Show import Debug.Trace dbg msg x = dbgsh show msg x dbgsh sh msg x = trace (msg++sh x) x cdbg p msg x | p x= dbg msg x | otherwise = x -- if you want to tailor the show: class Dshow t where dshow :: t - String ddbg msg x = dbgsh dshow msg x ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204 Lero@TCD, Head of Foundations Methods Research Group Director of Teaching and Learning - Undergraduate, School of Computer Science and Statistics, Room G.39, O'Reilly Institute, Trinity College, University of Dublin http://www.scss.tcd.ie/Andrew.Butterfield/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How to get a file path to the program invoked?
Hi, When my program starts it needs to know a complete path to the directory from which it was invoked. In terms of standard shell (sh) I need the Haskell function that will do equivalent to: #!/bin/sh path=$(dirname $0) How to get this path in Haskell? getProgName :: IO String defined System.Environment only returns a file name of the program without its full path. Thanks! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Poll: Do you want a mascot?
Yes. On Thu, Dec 1, 2011 at 9:39 AM, Paulo J. Matos pa...@matos-sorge.comwrote: Yes On 23/11/11 19:11, heathmatlock wrote: Question: Do you want a mascot? Answers: Yes No -- This is an attempt to figure out if this idea is going anywhere. __**_ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://www.haskell.org/mailman/listinfo/haskell-cafe -- PMatos __**_ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://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] How to get a file path to the program invoked?
How to get this path in Haskell? Maybe FindBin or executable-path work. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Hackage down!
Hi everybody, Is hackage.haskell.org down? I'm trying to access it but no answer, no ping response (timeout) , nothing. Is somebody else facing the same problem? Cheers, Edgar Gomes ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to get a file path to the program invoked?
On Thu, Dec 1, 2011 at 2:12 PM, dokondr doko...@gmail.com wrote: Hi, When my program starts it needs to know a complete path to the directory from which it was invoked. In terms of standard shell (sh) I need the Haskell function that will do equivalent to: #!/bin/sh path=$(dirname $0) How to get this path in Haskell? If I understand you correctly, you want takeDirectory `fmap` getProgName where import System.FilePath (takeDirectory) Cheers, -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hackage down!
Yep, same here. - Chris ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hackage down!
And, amusingly, http://downforeveryoneorjustme.com/ is also down, having exceeded its Google App Engine quota. [ But the similarly named .org site still works, and confirms that hackage is down. ] Regards, Malcolm ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to get a file path to the program invoked?
How to get this path in Haskell? If I understand you correctly, you want takeDirectory `fmap` getProgName I think getProgName does not give you the full path, but only the program name. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to get a file path to the program invoked?
On Thu, Dec 1, 2011 at 3:41 PM, Simon Hengel simon.hen...@wiktory.org wrote: How to get this path in Haskell? If I understand you correctly, you want takeDirectory `fmap` getProgName I think getProgName does not give you the full path, but only the program name. Neither does $0, does it? It depends on how the program is called. You can always use System.Directory.getCurrentDirectory with System.FilePath.{isRelative,replaceDirectory} if you somehow need the full path. Note, however, that not even this is generally guaranteed to be correct. Cheers, -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to get a file path to the program invoked?
On Thu, Dec 01, 2011 at 03:53:37PM -0200, Felipe Almeida Lessa wrote: On Thu, Dec 1, 2011 at 3:41 PM, Simon Hengel simon.hen...@wiktory.org wrote: How to get this path in Haskell? If I understand you correctly, you want takeDirectory `fmap` getProgName I think getProgName does not give you the full path, but only the program name. Neither does $0, does it? It depends on how the program is called. $0 depend everything you need to find your program (say, the relative or absolute path used), but getProgName does not. Here is an example: ./foo/foo Here $0 will be ./foo/foo, but getProgName will be foo. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to get a file path to the program invoked?
On Thu, Dec 01, 2011 at 07:02:09PM +0100, Simon Hengel wrote: On Thu, Dec 01, 2011 at 03:53:37PM -0200, Felipe Almeida Lessa wrote: On Thu, Dec 1, 2011 at 3:41 PM, Simon Hengel simon.hen...@wiktory.org wrote: How to get this path in Haskell? If I understand you correctly, you want takeDirectory `fmap` getProgName I think getProgName does not give you the full path, but only the program name. Neither does $0, does it? It depends on how the program is called. $0 depend everything you need to find your program (say, the relative or absolute path used), but getProgName does not. Here is an example: ./foo/foo Here $0 will be ./foo/foo, but getProgName will be foo. s/depend/contains ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to get a file path to the program invoked?
System.Directory.getCurrentDirectory does not solve the problem. System.Directory.getCurrentDirectory returns the directory *from which* the program was called, also called working directory. The directory *from which* the program was called is not the same that the directory *where the program executable is*, which my program needs to know. For example: /opt/myApp/test/myProg - is a program One may call it in many ways: 1) cd /opt/myApp/test/ ./myProg Current or working directory: ./ or: 2) cd /usr/local /opt/myApp/test/myProg Current or working directory: /usr/local On the contrary, standard shell variable $0 - contains a full path to the program location in the directory structure, no matter from what directory the program was called. How to find this path using GHC libraries? On Thu, Dec 1, 2011 at 8:53 PM, Felipe Almeida Lessa felipe.le...@gmail.com wrote: Neither does $0, does it? It depends on how the program is called. You can always use System.Directory.getCurrentDirectory with System.FilePath.{isRelative,replaceDirectory} if you somehow need the full path. Note, however, that not even this is generally guaranteed to be correct. Cheers, -- Felipe. -- All the best, Dmitri O. Kondratiev This is what keeps me going: discovery doko...@gmail.com http://sites.google.com/site/dokondr/welcome ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hackage down!
Does anyone know of a hackage mirror? It now occurs to me I should have a local mirror, it's that essential. On Thu, Dec 1, 2011 at 9:24 AM, Malcolm Wallace malcolm.wall...@me.com wrote: And, amusingly, http://downforeveryoneorjustme.com/ is also down, having exceeded its Google App Engine quota. [ But the similarly named .org site still works, and confirms that hackage is down. ] Regards, Malcolm ___ 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] How to get a file path to the program invoked?
To be precise, $0 always contains the path to the program called. You are right, this path will change depending on location from which the program was called. So $0 is OK for my case, while current directory is unrelated. Try this: #!/bin/sh echo Arg 0: $0 echo All Parameters: [$@] Again, any way to get the same functionality in GHC? On Thu, Dec 1, 2011 at 10:32 PM, Giovanni Tirloni gtirl...@sysdroid.comwrote: On Thu, Dec 1, 2011 at 5:26 PM, dokondr doko...@gmail.com wrote: On the contrary, standard shell variable $0 - contains a full path to the program location in the directory structure, no matter from what directory the program was called. Are you sure? $ zero.sh ./zero.sh $ ./zero.sh ./zero.sh $ /home/gtirloni/zero.sh /home/gtirloni/zero.sh -- Giovanni ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hackage down!
Is the list the right place to ask about this? I was trying to access Hackage today too, and didn't know who to let know about the problem. amindfv / Tom On Thu, Dec 1, 2011 at 11:59 AM, Edgar Gomes Araujo talktoed...@gmail.comwrote: Hi everybody, Is hackage.haskell.org down? I'm trying to access it but no answer, no ping response (timeout) , nothing. Is somebody else facing the same problem? Cheers, Edgar Gomes ___ 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] Hackage down!
Mirroring is a key feature of Hackage 2. But, Hackage 2 needs more love before it can be released. More lovers would make it go faster though! - jeremy On Thu, Dec 1, 2011 at 1:36 PM, Michael Litchard mich...@schmong.org wrote: Does anyone know of a hackage mirror? It now occurs to me I should have a local mirror, it's that essential. On Thu, Dec 1, 2011 at 9:24 AM, Malcolm Wallace malcolm.wall...@me.com wrote: And, amusingly, http://downforeveryoneorjustme.com/ is also down, having exceeded its Google App Engine quota. [ But the similarly named .org site still works, and confirms that hackage is down. ] Regards, Malcolm ___ 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 mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to get a file path to the program invoked?
On Thu, Dec 1, 2011 at 14:26, dokondr doko...@gmail.com wrote: On the contrary, standard shell variable $0 - contains a full path to the program location in the directory structure, no matter from what directory the program was called If the shell found it by $PATH search, $0 will be simply the program name with no directory and you will have to repeat the PATH search yourself. (And the pathological case: the user did PATH=something yourprog, where something does not contain the directory holding yourprog.) There is no 100% reliable way to get the executable without using something like /proc/self/exe (only on Linux). -- brandon s allbery allber...@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to get a file path to the program invoked?
dokondr doko...@gmail.com writes: Hi, When my program starts it needs to know a complete path to the directory from which it was invoked. In terms of standard shell (sh) I need the Haskell function that will do equivalent to: #!/bin/sh path=$(dirname $0) How to get this path in Haskell? getProgName :: IO String defined System.Environment only returns a file name of the program without its full path. Thanks! http://hackage.haskell.org/package/system-argv0-0.1 -- cheers! lelf xmpp:ni...@jabber.ru ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to get a file path to the program invoked?
On 01.12.2011 23:47, dokondr wrote: To be precise, $0 always contains the path to the program called. You are right, this path will change depending on location from which the program was called. So $0 is OK for my case, while current directory is unrelated. Actually it contains whatever was passed to exec. By convention this is program name but it could be anything #include stdio.h #include unistd.h int main(int argc, char** argv) { if( argc != 1 ) { printf(%i: %s\n, argc, argv[0] ); } else { execl(./argv,Random junk,,0); } return 0; } $ gcc argv.c -o argv ./argv 2: Random junk Try this: #!/bin/sh echo Arg 0: $0 echo All Parameters: [$@] Again, any way to get the same functionality in GHC? getArgs and getProgName should do the trick http://hackage.haskell.org/packages/archive/base/latest/doc/html/System-Environment.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to get a file path to the program invoked?
Anton Nikishaev anton@gmail.com writes: dokondr doko...@gmail.com writes: Hi, When my program starts it needs to know a complete path to the directory from which it was invoked. In terms of standard shell (sh) I need the Haskell function that will do equivalent to: #!/bin/sh path=$(dirname $0) How to get this path in Haskell? getProgName :: IO String defined System.Environment only returns a file name of the program without its full path. Thanks! http://hackage.haskell.org/package/system-argv0-0.1 (which is argv[0], and surely it's not always the “complete path to the directory from which it was invoked”. $0 is not either.) -- lelf xmpp:ni...@jabber.ru ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] List Fusion of concatMap
Hi, Am Donnerstag, den 01.12.2011, 21:44 +0100 schrieb Joachim Breitner: Does ghc treat list comprehensions differently here? I could answer this by looking at compiler/deSugar/DsListComp.lhs in the GHC source: List comprehensions may be desugared in one of two ways: ``ordinary'' (as you would expect if you read SLPJ's book) and ``with foldr/build turned on'' (if you read Gill {\em et al.}'s paper on the subject). (and indeed the translation depends on the flags) and later on: @dfListComp@ are the rules used with foldr/build turned on: TE[ e | ]c n = c e n TE[ e | b , q ] c n = if b then TE[ e | q ] c n else n TE[ e | p - l , q ] c n = let f = \ x b - case x of p - TE[ e | q ] c b _ - b in foldr f n l So I could manually rewrite func3 to: func4 :: Int - Bool func4 k = any (5) (build (\c n - foldr (\x b - case x of m - foldr (\x' b' - case x' of i - c i b' ) b [1..m] ) n [1..k] )) {-# NOINLINE func4 #-} and get identical core output. Having a case expression does not matter in this case, because the code does all calculations completely with unboxed integers anyways, so this can be written as follows, with still identical core: func5 :: Int - Bool func5 k = any (5) (build (\c n - foldr (\x b - foldr c b [1..x]) n [1..k] )) {-# NOINLINE func5 #-} This would motivate the following definition for a fusionable concatMap, going via list comprehensions and their translation to ideal list fusion consumers/producers: concatMap f xs == [ y | x - xs, y - f x ] == build (\c n - foldr (\x b - foldr c b (f x)) n xs) And indeed, adding {-# RULES myConcatMap forall f xs . concatMap f xs = build (\c n - foldr (\x b - foldr c b (f x)) n xs) #-} to my file finally makes func1 behave the way I want it to, i.e. exactly the same core as the list comprehension variant, and no lists at all, only unboxed integers. Now I guess there is a reason why concatMap is not defined this way. But what is it? Greetings, Joachim -- Joachim nomeata Breitner m...@joachim-breitner.de | nome...@debian.org | GPG: 0x4743206C xmpp: nome...@joachim-breitner.de | http://www.joachim-breitner.de/ signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to get a file path to the program invoked?
Balazs, thanks! It's great that these packages exist! On Thu, Dec 1, 2011 at 11:17 PM, Balazs Komuves bkomu...@gmail.com wrote: Hello, I'm not subscribed to haskell cafe, but I browse the archives sometimes. As Simon Hengel wrote there, there are two packages on Hackage trying to solve this exact problem (since GHC and the standard library does not provide the necessary information): http://hackage.haskell.org/package/executable-path http://hackage.haskell.org/package/FindBin (Hackage is down at the moment, so I'm not completely sure about the second link). I'm the author of the first one. Balazs ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] List Fusion of concatMap
Hi, Am Donnerstag, den 01.12.2011, 22:16 +0100 schrieb Joachim Breitner: This would motivate the following definition for a fusionable concatMap, going via list comprehensions and their translation to ideal list fusion consumers/producers: concatMap f xs == [ y | x - xs, y - f x ] == build (\c n - foldr (\x b - foldr c b (f x)) n xs) And indeed, adding {-# RULES myConcatMap forall f xs . concatMap f xs = build (\c n - foldr (\x b - foldr c b (f x)) n xs) #-} to my file finally makes func1 behave the way I want it to, i.e. exactly the same core as the list comprehension variant, and no lists at all, only unboxed integers. Now I guess there is a reason why concatMap is not defined this way. But what is it? I further tired to investigate where func2 (using concat (map ..)) goes wrong, after all, we have this rule for concat: forall xs. concat xs = build (\c n - foldr (\x y - foldr c y x) n xs) which is pretty close to what I am proposing for concatMap above. I used ghc -dverbose-core2core -ddump-rule-firings, but it seems that this output is not complete; e.g. at some point, RULES eftInt[~1] forall x y. eftInt x y = build (\ c n - eftIntFB c n x y) fires, but the output does not mention it. Anyway, I tried to reconstruct what is happening in better readable terms: We begin with func2 as given: func2 k = any (5) (concat (map (\m - [1..m]) [1..k])) rule map func2 k = any (5) (concat (build (\c n - foldr (mapFB c (\m - [1..m])) n [1..k]))) rule concat func2 k = any (5) (build (\c n - foldr (\x y - foldr c y x) n (build (\c n - foldr (mapFB c (\m - [1..m])) n [1..k] rule fold/build func2 k = any (5) (build (\c n - (\c n - foldr (mapFB c (\m - [1..m])) n [1..k]) (\x y - foldr c y x) n)) rule any/build func2 k = (\c n - (\c n - foldr (mapFB c (\m - [1..m])) n [1..k]) (\x y - foldr c y x) n) ((||) . (5)) False rule eftInt func2 k = (\c n - (\c n - foldr (mapFB c (\m - [1..m])) n (build (\c n - eftIntFB c n 1 k))) (\x y - foldr c y x) k) ((||) . (5)) False rule fold/build func2 k = (\c n - (\c n - (\c n - eftIntFB c n 1 k) (mapFB c (\m - [1..m])) n) (\x y - foldr c y x) n) ((||) . (5)) False beta-reduction func2 k = eftIntFB (mapFB (\x y - foldr ((||) . (5)) y x) (\m - [1..m])) False 1 k At this point, if the definition of mapFB would be inlined, we could continue successfully as follows. This is not what is happening, but I am not sure why: func2 k = eftIntFB (\x ys - (\x y - foldr ((||) . (5)) y x) ((\m - [1..m]) x) ys) False 1 k beta-reduction func2 k = eftIntFB (\m ys - (foldr ((||) . (5)) ys [1..m])) False 1 k rule eftInt func2 k = eftIntFB (\m ys - (foldr ((||) . (5)) ys (build (\c n - eftIntFB c n 1 m False 1 k rule fold/build func2 k = eftIntFB (\m ys - (eftIntFB ((||) . (5)) ys 1 m)) False 1 k completely deforested code. What do you think? Can the list fusion rules be improved so that they can catch these cases as well? Greetings, Joachim -- Joachim nomeata Breitner m...@joachim-breitner.de | nome...@debian.org | GPG: 0x4743206C xmpp: nome...@joachim-breitner.de | http://www.joachim-breitner.de/ signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Using QuickCheck to test against a database
Hi! I've just spent my evening trying to use QuickCheck properties to test the database accessing functions in a project I'm working on at the moment. I've got some stuff that's working, and I wanted to see what the cafe thought about it, and if anyone had any suggestions or critiscm that can help me make it even better! I got here by trying to figure out how I want to test my application. At first I saw 2 options: use a test database and assume it exists, or have each test setup the data it needs. I like the latter more, because it minimises dependence on the outside world. So I got down to writing some HUnit tests and then had a wave of inspiration... what if I didn't even define the data, but let QuickCheck do that for me? Here's what I came up with - note the code here is somewhat paraphrased for brevity: data DBState a = DBState { initDb :: IO () , entity :: a } This type stores an action that initialises the database with enough data such that it contains whatever 'entity' is. For example, 'DBState Person' knows how to insert a specific person into the database, and carries along an in-memory log. Continuing with the Person idea, I then went and made an Arbitrary instance for DBState Person: instance Arbitrary (DBState Person) where arbitrary = do l - Person $ arbitrary `suchThat` (not . null) return $ DBState (void $ insertPerson l) p where insertPerson p = doSql INSERT INTO person (name) VALUES (?) [ personName p l ] Then it's just a case of defining some properties: prop_allPersons = monadicIO $ do dbState - pick arbitrary :: Gen [Person] fetched - run $ initDb `mapM` dbState findAllPersons assert $ fetched `eqSet` (entity `map` dbState) where eqSet a b = all (`elem` a) b all (`elem` b) a Voila! For any database, 'findAllPersons' returns all persons. Now... onto my own critiscisms with this. Firstly, way too much boiler plate. You have to remember to apply all of the states of your arbitrary instances, which is a pain, and guaranteed to be missed. At first I thought DBState looks like it's basically a writer/IO monad, but then I couldn't actually figure out the monoid to write to. In this case it's just [Person], but in more complex property we might need 2 types of entities (for example, to ensure a join worked correctly) which makes this list heterogenous. Secondly, the initDb action is sensitive to the order actions are sequenced. Presumably, I want to test against a database that's as accurate to production as possible, which means I want foreign keys enabled. If things are initialized in the wrong order, it violates the foreign key constraint, and it's a burden if people have to determine the correct order. One solution here is to make use of deferrable constraints, but support for these is flakey at best (and it doesn't work for bracketting tests with BEGIN; ROLLBACK). These problems just make the properties harder, but they don't seem to impede the quality or usefulness of the tests. I really want to make this work, because the idea of it is quite beautiful to me. Though that might be partly because this is my first time really using QuickCheck, so I'm getting the oh wow this is swt effect at the same time ;) Would love to hear peoples thoughts! - Ollie ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Using QuickCheck to test against a database
Hi! This looks cool indeed. On 2 December 2011 00:02, Oliver Charles haskell-c...@ocharles.org.ukwrote: [snip] You have to remember to apply all of the states of your arbitrary instances, which is a pain, and guaranteed to be missed. Why can't you define a helper function which runs the initDb action while picking the entity? Something like: pickDB = do DBState act e - pick arbitrary; act; return e (placing calls to monadicIO and run appropriately, I am not familiar enough with the monadic API) Secondly, the initDb action is sensitive to the order actions are sequenced. Do you mean with respect to other initDb actions? Why is this? I thought you were using QuickCheck in order not to assume things about the state of the DB and that the necessary state is prepared solely by running the initDb action. Is this not the case then? Cheers, Ozgur ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Using QuickCheck to test against a database
Secondly, the initDb action is sensitive to the order actions are sequenced. Do you mean with respect to other initDb actions? Why is this? I thought you were using QuickCheck in order not to assume things about the state of the DB and that the necessary state is prepared solely by running the initDb action. Is this not the case then? The initDb action is sensitive to the order in which *it* sequences things. With fk constraints there is a dependecy tree which must be respected. At least that's what I understood. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] could not create compact unwind
I just did cabal install cabal-install on a Mac running Mac OS 10.6.8 and got the eventual response [44 of 44] Compiling Main ( Main.hs, dist/build/cabal/cabal-tmp/Main.o ) Linking dist/build/cabal/cabal ... ld: warning: could not create compact unwind for .LFB3: non-standard register 5 being saved in prolog Installing executable(s) in /home/cshome/o/ok/.cabal/bin I also had this problem today: m% cabal install quickcheck Resolving dependencies... cabal: dependencies conflict: ghc-6.12.3 requires pretty ==1.0.1.2 however pretty-1.0.1.2 was excluded because ghc-6.12.3 requires pretty ==1.0.1.1 What's the procedure for wiping everything out and starting again? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] could not create compact unwind
The 'could not create compact unwind' message is a known (and still outstanding) linking issue on OS X. It should be harmless - it refers to the fact that OS X 10.6 uses compact unwind info for exceptions instead of DWARF unwind information, when possible. The exact cause isn't (yet) known. Generally this just means that the exception information falls back to being DWARF-based. If you want to blow away all your local packages, say: $ rm -rf ~/.ghc Note that will blow away every local package for every GHC version. If you have multiple versions installed, you should look in that directory first and then blow away the appropriate subdirectory (named something like 'arch-darwin-ghc-ver'.) On Thu, Dec 1, 2011 at 7:07 PM, Richard O'Keefe o...@cs.otago.ac.nz wrote: I just did cabal install cabal-install on a Mac running Mac OS 10.6.8 and got the eventual response [44 of 44] Compiling Main ( Main.hs, dist/build/cabal/cabal-tmp/Main.o ) Linking dist/build/cabal/cabal ... ld: warning: could not create compact unwind for .LFB3: non-standard register 5 being saved in prolog Installing executable(s) in /home/cshome/o/ok/.cabal/bin I also had this problem today: m% cabal install quickcheck Resolving dependencies... cabal: dependencies conflict: ghc-6.12.3 requires pretty ==1.0.1.2 however pretty-1.0.1.2 was excluded because ghc-6.12.3 requires pretty ==1.0.1.1 What's the procedure for wiping everything out and starting again? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Regards, Austin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] PLPV 2012: Call for participation
Call for Participation == PLPV 2012 The Sixth ACM SIGPLAN Workshop Programming Languages meets Program Verification 24th January, 2012 Philadelphia, USA (Affiliated with POPL 2012) http://research.microsoft.com/en-us/um/people/nswamy/plpv12 You are cordially invited to PLPV 2012. The goal of PLPV is to foster and stimulate research at the intersection of programming languages and program verification, by bringing together experts from diverse areas like types, contracts, interactive theorem proving, model checking and program analysis. Work in this area typically attempts to reduce the burden of program verification by taking advantage of particular semantic or structural properties of the programming language. Examples include dependently typed programming languages, which leverage a language's type system to specify and check richer than usual specifications or extended static checking systems which incorporate contracts with either static or dynamic contract checking. Registration To register for PLPV 2012, please follow the instructions at: https://regmaster3.com/2012conf/POPL12/register.php The early registration deadline is December 24, 2011. Hotel Information = PLPV will be co-located with POPL at the Sheraton Society Hill Hotel in Philadelphia. Please visit POPL's web site to make reservations at the special conference rate. Program === Session 1: 9:00am-10:00am LTL types FRP: Linear-time Temporal Logic Propositions as Types, Proofs as Functional Reactive Programs Alan Jeffrey A Hoare Calculus for the Verification of Synchronous Languages Manuel Gesell and Klaus Schneider Session 2: 10:30am-12:00pm Invited talk: Could We Verify an Information-flow Computer? Benjamin C. Pierce University of Pennsylvania Lunch: 12:00pm-2:00pm (not provided) Session 3: 2:00pm-3:30pm Reflexive Toolbox for Regular Expression Matching Vladimir Komendantsky Formal Network Packet Processing with Minimal Fuss: Invertible Syntax Descriptions at Work Reynald Affeldt, David Nowak and Yutaka Oiwa The VerCors project - setting up basecamp Afshin Amighi, Stefan Blom, Marieke Huisman and Marina Zaharieva-Stojanovski Session 4: 4:00pm-5:00pm Dependent Interoperability Peter-Michael Osera, Vilhelm Sjoberg and Steve Zdancewic. Equational Reasoning about Programs with General Recursion and Call-by-value Semantics Garrin Kimmell, Aaron Stump, Harley Eades, Peng Fu, Tim Sheard, Stephanie Weirich, Chris Casinghino, Vilhelm Sjoberg, Nathan Collins and Ki Yung Ahn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe