Re: [Haskell-cafe] llvm on macos
Dominic Steinitz dominic at steinitz.org writes: Thanks for all the help everyone :-) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] llvm on macos
Thank you both. I seem to be running LLVM 3.2 so I am a bit puzzled by the warning. Is it because I am running ghc 7.6.2? Dominics-MacBook-Pro:Laplace dom$ brew versions llvm 3.2 git checkout 40e9b90 /usr/local/Library/Formula/llvm.rb 3.1 git checkout 7d15192 /usr/local/Library/Formula/llvm.rb 3.0 git checkout 8022bf4 /usr/local/Library/Formula/llvm.rb 2.9 git checkout 471288b /usr/local/Library/Formula/llvm.rb 2.8 git checkout 1fb85ef /usr/local/Library/Formula/llvm.rb 2.7 git checkout d0efd9e /usr/local/Library/Formula/llvm.rb 2.6 git checkout 6ae3b89 /usr/local/Library/Formula/llvm.rb Dominics-MacBook-Pro:Laplace dom$ llc --version LLVM (http://llvm.org/): LLVM version 3.2svn Optimized build with assertions. Built Dec 22 2012 (01:03:07). Default target: x86_64-apple-darwin12.3.0 Host CPU: core-avx-i Registered Targets: x86- 32-bit X86: Pentium-Pro and above x86-64 - 64-bit X86: EM64T and AMD64 Dominics-MacBook-Pro:Laplace dom$ opt --version LLVM (http://llvm.org/): LLVM version 3.2svn Optimized build with assertions. Built Dec 22 2012 (01:03:07). Default target: x86_64-apple-darwin12.3.0 Host CPU: core-avx-i Dominics-MacBook-Pro:Laplace dom$ ghc --version The Glorious Glasgow Haskell Compilation System, version 7.6.2 Dominic Steinitz domi...@steinitz.org http://idontgetoutmuch.wordpress.com On 10 Aug 2013, at 18:41, Ozgur Akgun ozgurak...@gmail.com wrote: Hi. On 10 August 2013 18:20, Brandon Allbery allber...@gmail.com wrote: There may be some support for requesting specific versions from Homebrew. Try `brew versions llvm`. Then, you'll need to run the git checkout command in `brew --prefix` directory. I am using llvm 3.2 because I had a few ghc related problems with llvm 3.3. Never had any problems with 3.2 though. Hope this helps, Ozgur ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] llvm on macos
I am trying to use llvm but am being told I don't have llvm installed. Dominics-MacBook-Pro:Laplace dom$ ghc src-repa/Main.hs -rtsopts -threaded -eventlog -Odph -fllvm -optlo-O3 -fno-liberate-case -isrc-repa [1 of 3] Compiling SolverStencil( src-repa/SolverStencil.hs, src-repa/SolverStencil.o ) Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package pretty-1.1.1.0 ... linking ... done. Loading package array-0.4.0.1 ... linking ... done. Loading package deepseq-1.3.0.1 ... linking ... done. Loading package containers-0.5.0.0 ... linking ... done. Loading package old-locale-1.0.0.5 ... linking ... done. Loading package time-1.4.0.1 ... linking ... done. Loading package random-1.0.1.1 ... linking ... done. Loading package template-haskell ... linking ... done. Loading package QuickCheck-2.5.1.1 ... linking ... done. Loading package bytestring-0.10.0.2 ... linking ... done. Loading package primitive-0.5.0.1 ... linking ... done. Loading package vector-0.10.0.1 ... linking ... done. Loading package repa-3.2.3.1 ... linking ... done. no location info: Warning: Couldn't figure out LLVM version! Make sure you have installed LLVM ghc: could not execute: opt The ghc documentation (http://www.haskell.org/ghc/docs/7.6.1/html/users_guide/code-generators.html) says that llvm and clang are installed by default for 10.6 and later. I am on 10.8.3. Indeed Dominics-MacBook-Pro:Laplace dom$ llvm- llvm-cpp-4.2 llvm-g++ llvm-g++-4.2 llvm-gcc llvm-gcc-4.2 And Dominics-MacBook-Pro:Laplace dom$ clang clangclang++ But ghc-info tells me Dominics-MacBook-Pro:Laplace dom$ ghc --info [(Project name,The Glorious Glasgow Haskell Compilation System) ,(GCC extra via C opts, -fwrapv) ,(C compiler command,/usr/bin/gcc) ,(C compiler flags, -m64 -fno-stack-protector -m64) ,(ar command,/usr/bin/ar) ,(ar flags,clqs) ,(ar supports at file,@ArSupportsAtFile@) ,(touch command,touch) ,(dllwrap command,/bin/false) ,(windres command,/bin/false) ,(perl command,/usr/bin/perl) ,(target os,OSDarwin) ,(target arch,ArchX86_64) ,(target word size,8) ,(target has GNU nonexec stack,False) ,(target has .ident directive,True) ,(target has subsections via symbols,True) ,(LLVM llc command,llc) ,(LLVM opt command,opt) ,(Project version,7.6.2) ,(Booter version,7.4.2) ,(Stage,2) ,(Build platform,x86_64-apple-darwin) ,(Host platform,x86_64-apple-darwin) ,(Target platform,x86_64-apple-darwin) ,(Have interpreter,YES) ,(Object splitting supported,YES) ,(Have native code generator,YES) ,(Support SMP,YES) ,(Unregisterised,NO) ,(Tables next to code,YES) ,(RTS ways,l debug thr thr_debug thr_l thr_p dyn debug_dyn thr_dyn thr_debug_dyn) ,(Leading underscore,YES) ,(Debug on,False) ,(LibDir,/usr/local/lib/ghc-7.6.2) ,(Global Package DB,/usr/local/lib/ghc-7.6.2/package.conf.d) ,(Gcc Linker flags,[\-m64\]) ,(Ld Linker flags,[\-arch\,\x86_64\]) ] But I don't have either llc or opt Dominics-MacBook-Pro:Laplace dom$ llc -bash: llc: command not found Dominics-MacBook-Pro:Laplace dom$ opt -bash: opt: command not found Dominics-MacBook-Pro:Laplace dom$ What is the solution? Thanks, Dominic Steinitz domi...@steinitz.org http://idontgetoutmuch.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] llvm on macos
Thank you very much. I used Homebrew. Now I can compile albeit with a warning. I have yet to try running it. Loading package repa-3.2.3.1 ... linking ... done. You are using a new version of LLVM that hasn't been tested yet! We will try though... Dominic Steinitz domi...@steinitz.org http://idontgetoutmuch.wordpress.com On 10 Aug 2013, at 16:36, Brandon Allbery allber...@gmail.com wrote: On Sat, Aug 10, 2013 at 7:39 AM, Dominic Steinitz domi...@steinitz.org wrote: no location info: Warning: Couldn't figure out LLVM version! Make sure you have installed LLVM ghc: could not execute: opt The ghc documentation (http://www.haskell.org/ghc/docs/7.6.1/html/users_guide/code-generators.html) says that llvm and clang are installed by default for 10.6 and later. I am on 10.8.3. Apple *still* doesn't ship a full LLVM for some reason. I installed one via MacPorts; Homebrew also has it. Maybe if enough people file bugs with Apple, they'll start providing the whole thing instead of just the parts they use in Xcode. :/ -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [haskell.org Google Summer of Code 2013] Approved Projects
I will certainly volunteer (to mentor) next year if I feel I can add value. Dominic Steinitz domi...@steinitz.org http://idontgetoutmuch.wordpress.com On 2 Jun 2013, at 17:23, Edward Kmett ekm...@gmail.com wrote: Public good is a nebulous concept, but it is something that each of the folks who sign up as mentors judges independently when they are rating the projects and talking about them. Most of the folks who are offering to mentor have been involved in the community for quite some time and have a pretty good overview of what is going on, and what are currently active pain points. With 25 mentors we get a pretty good cross section of the community. We aren't really able to canvas outside of the mentor group during the approval process by google's guidelines, since we shouldn't leak information about unaccepted projects. Something like that uservoice site might be used to gauge public opinion of general ideas before the proposals start coming in, but in the end students write the proposals we get, so the things we would have polled about are inevitably not quite what we're rating anyways. We rarely get something that is just cut and pasted from the ideas list. Consequently a generic rating that doesn't take into consideration the actual proposal isn't worth a whole lot, beyond giving students an idea of what might be a successful proposal. There is a lot of variability in the ratings for projects based simply on what we know about the student, how clear the proposal is, and how achievable his or her particular goals are. In practice, we've been able to make sure that a couple of slots go to separable tasks in projects like cabal, haddock, and ghc that benefit everyone and that exceptional one-off projects don't get shut out completely just by asking each mentor to rate all of the projects, even the ones they aren't interested in mentoring, and from the discussions between the mentors and between the mentors and students that ensue within melange. My main advice is that if you want to get involved in the process, the easiest way to peel back the curtain is to volunteer to mentor! We're generally quite open to adding new voices to the discussion. -Edward On Sun, Jun 2, 2013 at 10:14 AM, Dominic Steinitz domi...@steinitz.org wrote: Hi Edward, Thanks for this comprehensive answer (and also thanks to participants in the follow-up dissuasion). How is the public good determined? (sounds rather Benthamite). I would have been disappointed if charts using diagrams had not been selected yet I don't recall being canvassed. Sorry to sound picky. I think from what you say that in this particular year it was obvious which projects should be selected; in future it may not be. I think an acceptable reason would be there was only one user who wanted it. Maybe we should use something like: https://www.uservoice.com. Sadly it seems this requires payment but there may be a free equivalent Dominic Steinitz domi...@steinitz.org http://idontgetoutmuch.wordpress.com On 28 May 2013, at 16:11, Edward Kmett ekm...@gmail.com wrote: Hi Dominic, The proposal is admittedly rather unfortunately opaque. The parts I can shed light on: Students come up with proposals with the help of the community and then submit them to google-melange.com. A bunch of folks from the haskell community sign up as potential mentors, vote on and discuss the proposals. (We had ~25 candidate mentors and ~20 proposals this year). The student application template contains a number of desirable criteria for a successful summer of code application, which is shown on the google-melange website under our organization -- an old version is available http://hackage.haskell.org/trac/summer-of-code/wiki/StudApply2012 contains Once we have the proposals in hand, and some initial ranking, we ask google for slots. Allocation is based on past performance, arcane community parameters that only they know, mentor ratio, etc. This should be our largest year in the program, despite the fact that in general organizations have been getting fewer slots as more organizations join, so we're apparently doing rather well. In general we do try to select projects that maximize the public good. Most of the time this can almost be done by just straight cut off based on the average score. There is some special casing for duplicate applications between different students and where students have submitted multiple applications we can have some flexibility in how to apply them. This year we also received an extra couple of special-purpose darcs slots from Google in exchange for continuing to act as an umbrella organization over darcs at the request of the administrator of the program at Google. In previous years I had requested an extra slot for them, this year the request came in the other direction. We do inevitably
Re: [Haskell-cafe] [haskell.org Google Summer of Code 2013] Approved Projects
Hi Edward, Thanks for this comprehensive answer (and also thanks to participants in the follow-up dissuasion). How is the public good determined? (sounds rather Benthamite). I would have been disappointed if charts using diagrams had not been selected yet I don't recall being canvassed. Sorry to sound picky. I think from what you say that in this particular year it was obvious which projects should be selected; in future it may not be. I think an acceptable reason would be there was only one user who wanted it. Maybe we should use something like: https://www.uservoice.com. Sadly it seems this requires payment but there may be a free equivalent Dominic Steinitz domi...@steinitz.org http://idontgetoutmuch.wordpress.com On 28 May 2013, at 16:11, Edward Kmett ekm...@gmail.com wrote: Hi Dominic, The proposal is admittedly rather unfortunately opaque. The parts I can shed light on: Students come up with proposals with the help of the community and then submit them to google-melange.com. A bunch of folks from the haskell community sign up as potential mentors, vote on and discuss the proposals. (We had ~25 candidate mentors and ~20 proposals this year). The student application template contains a number of desirable criteria for a successful summer of code application, which is shown on the google-melange website under our organization -- an old version is available http://hackage.haskell.org/trac/summer-of-code/wiki/StudApply2012 contains Once we have the proposals in hand, and some initial ranking, we ask google for slots. Allocation is based on past performance, arcane community parameters that only they know, mentor ratio, etc. This should be our largest year in the program, despite the fact that in general organizations have been getting fewer slots as more organizations join, so we're apparently doing rather well. In general we do try to select projects that maximize the public good. Most of the time this can almost be done by just straight cut off based on the average score. There is some special casing for duplicate applications between different students and where students have submitted multiple applications we can have some flexibility in how to apply them. This year we also received an extra couple of special-purpose darcs slots from Google in exchange for continuing to act as an umbrella organization over darcs at the request of the administrator of the program at Google. In previous years I had requested an extra slot for them, this year the request came in the other direction. We do inevitably get more good proposals than we get slots. This year we could have easily used another 3-4 slots to good effect. The main part I can't shed light on: Google requests that the final vote tallies remain private. This is done so that students who put in proposals to a high volume orgs and don't get accepted, or who are new to the process and don't quite catch all the rules, don't wind up with any sort of publicly visible black mark. This unfortunately means, that we can't really show the unaccepted proposals with information about how to avoid getting your proposal rejected. I hope that helps. If you have any more questions or if my answer didn't suffice please feel free to follow up! -Edward Kmett On Tue, May 28, 2013 at 6:52 AM, Dominic Steinitz domi...@steinitz.org wrote: Hi Edward, Although the project I am interested in (as a user) has been accepted :-), I can't help feeling the selection process is a bit opaque. Is it documented somewhere and I just missed it? Apologies if I did. BTW I appreciate all the hard work that goes into the selection process. Dominic Steinitz domi...@steinitz.org http://idontgetoutmuch.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [haskell.org Google Summer of Code 2013] Approved Projects
Hi Edward, Although the project I am interested in (as a user) has been accepted :-), I can't help feeling the selection process is a bit opaque. Is it documented somewhere and I just missed it? Apologies if I did. BTW I appreciate all the hard work that goes into the selection process. Dominic Steinitz domi...@steinitz.org http://idontgetoutmuch.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] What is the process for GSOC?
How is it decided which Haskell projects get chosen? Do we discuss them here and take a collective view? Thanks, Dominic. PS I should point out I have an interest in the proposal to port charts to use diagrams (http://www.google-melange.com/gsoc/proposal/review/google/gsoc2013/jbracker/1) i.e. I'd really like this as a user. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Automated Differentiation Type Question
Can anyone tell me why I get a type error with testGrad2? What are my options? Clearly I would like to be able find the gradient of my cost function for different sets of observations. Thanks, Dominic. {-# LANGUAGE NoMonomorphismRestriction #-} import Numeric.AD default() costFn :: Floating a = [a] - [[a]] - [a] - a costFn ys xss thetas = (/ (2*m)) $ sum $ map (^ (2 :: Int)) $ zipWith (\y xs - costFnAux y xs thetas) ys xss where m = fromIntegral $ length xss costFnAux :: Floating a = a - [a] - [a] - a costFnAux y xs thetas = y - head thetas - sum (zipWith (*) xs (tail thetas)) ys :: Floating a = [a] ys = [1.0, 2.0, 3.0] xss :: Floating a = [[a]] xss = [[1.0], [2.0], [3.0]] thetas :: Floating a = [a] thetas = [0.0, 1.0] test :: Floating a = a test = costFn ys xss thetas testGrad0 = grad (costFn ys xss) testGrad1 :: Floating a = [a] - [[a]] - [a] - [a] testGrad1 ys xss = grad (costFn (undefined :: Floating a = [a]) (undefined :: Floating a = [[a]])) testGrad2 :: Floating a = [a] - [[a]] - [a] - [a] testGrad2 ys xss = grad (costFn ys xss) [1 of 1] Compiling Main ( /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs, interpreted ) /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:33:33: Could not deduce (a ~ ad-3.4:Numeric.AD.Internal.Types.AD s a) from the context (Floating a) bound by the type signature for testGrad2 :: Floating a = [a] - [[a]] - [a] - [a] at /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:32:14-53 or from (Numeric.AD.Internal.Classes.Mode s) bound by a type expected by the context: Numeric.AD.Internal.Classes.Mode s = [ad-3.4:Numeric.AD.Internal.Types.AD s a] - ad-3.4:Numeric.AD.Internal.Types.AD s a at /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:33:20-39 `a' is a rigid type variable bound by the type signature for testGrad2 :: Floating a = [a] - [[a]] - [a] - [a] at /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:32:14 Expected type: [ad-3.4:Numeric.AD.Internal.Types.AD s a] Actual type: [a] In the first argument of `costFn', namely `ys' In the first argument of `grad', namely `(costFn ys xss)' In the expression: grad (costFn ys xss) /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:33:36: Could not deduce (a ~ ad-3.4:Numeric.AD.Internal.Types.AD s a) from the context (Floating a) bound by the type signature for testGrad2 :: Floating a = [a] - [[a]] - [a] - [a] at /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:32:14-53 or from (Numeric.AD.Internal.Classes.Mode s) bound by a type expected by the context: Numeric.AD.Internal.Classes.Mode s = [ad-3.4:Numeric.AD.Internal.Types.AD s a] - ad-3.4:Numeric.AD.Internal.Types.AD s a at /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:33:20-39 `a' is a rigid type variable bound by the type signature for testGrad2 :: Floating a = [a] - [[a]] - [a] - [a] at /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:32:14 Expected type: [[ad-3.4:Numeric.AD.Internal.Types.AD s a]] Actual type: [[a]] In the second argument of `costFn', namely `xss' In the first argument of `grad', namely `(costFn ys xss)' In the expression: grad (costFn ys xss) Failed, modules loaded: none. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Automated Differentiation Type Question
Answering my own question, what I needed was: testGrad2 :: (Fractional a, Num a) = (forall s . Mode s = [AD s a]) - (forall s . Mode s = [[AD s a]]) - [a] - [a] testGrad2 ys xss = grad (costFn ys xss) On 23 Apr 2013, at 10:44, Dominic Steinitz domi...@steinitz.org wrote: Can anyone tell me why I get a type error with testGrad2? What are my options? Clearly I would like to be able find the gradient of my cost function for different sets of observations. Thanks, Dominic. {-# LANGUAGE NoMonomorphismRestriction #-} import Numeric.AD default() costFn :: Floating a = [a] - [[a]] - [a] - a costFn ys xss thetas = (/ (2*m)) $ sum $ map (^ (2 :: Int)) $ zipWith (\y xs - costFnAux y xs thetas) ys xss where m = fromIntegral $ length xss costFnAux :: Floating a = a - [a] - [a] - a costFnAux y xs thetas = y - head thetas - sum (zipWith (*) xs (tail thetas)) ys :: Floating a = [a] ys = [1.0, 2.0, 3.0] xss :: Floating a = [[a]] xss = [[1.0], [2.0], [3.0]] thetas :: Floating a = [a] thetas = [0.0, 1.0] test :: Floating a = a test = costFn ys xss thetas testGrad0 = grad (costFn ys xss) testGrad1 :: Floating a = [a] - [[a]] - [a] - [a] testGrad1 ys xss = grad (costFn (undefined :: Floating a = [a]) (undefined :: Floating a = [[a]])) testGrad2 :: Floating a = [a] - [[a]] - [a] - [a] testGrad2 ys xss = grad (costFn ys xss) [1 of 1] Compiling Main ( /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs, interpreted ) /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:33:33: Could not deduce (a ~ ad-3.4:Numeric.AD.Internal.Types.AD s a) from the context (Floating a) bound by the type signature for testGrad2 :: Floating a = [a] - [[a]] - [a] - [a] at /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:32:14-53 or from (Numeric.AD.Internal.Classes.Mode s) bound by a type expected by the context: Numeric.AD.Internal.Classes.Mode s = [ad-3.4:Numeric.AD.Internal.Types.AD s a] - ad-3.4:Numeric.AD.Internal.Types.AD s a at /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:33:20-39 `a' is a rigid type variable bound by the type signature for testGrad2 :: Floating a = [a] - [[a]] - [a] - [a] at /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:32:14 Expected type: [ad-3.4:Numeric.AD.Internal.Types.AD s a] Actual type: [a] In the first argument of `costFn', namely `ys' In the first argument of `grad', namely `(costFn ys xss)' In the expression: grad (costFn ys xss) /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:33:36: Could not deduce (a ~ ad-3.4:Numeric.AD.Internal.Types.AD s a) from the context (Floating a) bound by the type signature for testGrad2 :: Floating a = [a] - [[a]] - [a] - [a] at /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:32:14-53 or from (Numeric.AD.Internal.Classes.Mode s) bound by a type expected by the context: Numeric.AD.Internal.Classes.Mode s = [ad-3.4:Numeric.AD.Internal.Types.AD s a] - ad-3.4:Numeric.AD.Internal.Types.AD s a at /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:33:20-39 `a' is a rigid type variable bound by the type signature for testGrad2 :: Floating a = [a] - [[a]] - [a] - [a] at /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:32:14 Expected type: [[ad-3.4:Numeric.AD.Internal.Types.AD s a]] Actual type: [[a]] In the second argument of `costFn', namely `xss' In the first argument of `grad', namely `(costFn ys xss)' In the expression: grad (costFn ys xss) Failed, modules loaded: none. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Automated Differentiation of Matrices (hmatrix)
Hi Edward, Thanks for the response. For now I don't need the performance for now but it's good to know these developments are in the pipeline. I'm not wedded to hmatrix. I think I could use repa or yarr just as easily; I just haven't investigated. Dominic. On 9 Apr 2013, at 23:03, Edward Kmett ekm...@gmail.com wrote: hmatrix and ad don't (currently) mix. The problem is that hmatrix uses a packed structure that can't hold any of the AD mode variants we have as an Element. =( I've been working with Alex Lang to explore in ad 4.0 ways that we can support monomorphic AD modes and still present largely the same API. We've seen a number of performance gains off of this refactoring already, but it doesn't go far enough to address what you need. A goal a bit farther out is to support AD on vector/matrix operations, but it is a much bigger refactoring than the one currently in the pipeline. =/ To support automatic differentiation on vector-based operations in a form that works with standard BLAS-like storage like the packed matrix rep used in hmatrix we need to convert from a 'matrix of AD variables' to an 'AD mode over of matrices'. This is similar to the difference between a matrix of complex numbers and a real matrix plus an imaginary matrix. This is a long term goal, but not one you're likely to see support for out of 'ad' in the short term. I can't build AD on hmatrix itself due in part to licensing restrictions and differing underlying storage requirements, so there are a lot of little issues in making that latter vision a reality. -Edward On Tue, Apr 9, 2013 at 10:46 AM, Dominic Steinitz domi...@steinitz.org wrote: Hi Cafe, Suppose I want to find the grad of a function then it's easy I just use http://hackage.haskell.org/package/ad-3.4: import Numeric.AD import Data.Foldable (Foldable) import Data.Traversable (Traversable) data MyMatrix a = MyMatrix (a, a) deriving (Show, Functor, Foldable, Traversable) f :: Floating a = MyMatrix a - a f (MyMatrix (x, y)) = exp $ negate $ (x^2 + y^2) / 2.0 main :: IO () main = do putStrLn $ show $ f $ MyMatrix (0.0, 0.0) putStrLn $ show $ grad f $ MyMatrix (0.0, 0.0) But now suppose I am doing some matrix calculations http://hackage.haskell.org/package/hmatrix-0.14.1.0 and I want to find the grad of a function of a matrix: import Numeric.AD import Numeric.LinearAlgebra import Data.Foldable (Foldable) import Data.Traversable (Traversable) g :: (Element a, Floating a) = Matrix a - a g m = exp $ negate $ (x^2 + y^2) / 2.0 where r = (toLists m)!!0 x = r!!0 y = r!!1 main :: IO () main = do putStrLn $ show $ g $ (1 2) ([0.0, 0.0] :: [Double]) putStrLn $ show $ grad g $ (1 2) ([0.0, 0.0] :: [Double]) Then I am in trouble: /Users/dom/Dropbox/Private/Whales/MyAD.hs:24:21: No instance for (Traversable Matrix) arising from a use of `grad' Possible fix: add an instance declaration for (Traversable Matrix) In the expression: grad g In the second argument of `($)', namely `grad g $ (1 2) ([0.0, 0.0] :: [Double])' In the second argument of `($)', namely `show $ grad g $ (1 2) ([0.0, 0.0] :: [Double])' /Users/dom/Dropbox/Private/Whales/MyAD.hs:24:26: Could not deduce (Element (ad-3.4:Numeric.AD.Internal.Types.AD s Double)) arising from a use of `g' from the context (Numeric.AD.Internal.Classes.Mode s) bound by a type expected by the context: Numeric.AD.Internal.Classes.Mode s = Matrix (ad-3.4:Numeric.AD.Internal.Types.AD s Double) - ad-3.4:Numeric.AD.Internal.Types.AD s Double at /Users/dom/Dropbox/Private/Whales/MyAD.hs:24:21-26 Possible fix: add an instance declaration for (Element (ad-3.4:Numeric.AD.Internal.Types.AD s Double)) In the first argument of `grad', namely `g' In the expression: grad g In the second argument of `($)', namely `grad g $ (1 2) ([0.0, 0.0] :: [Double])' What are my options here? Clearly I can convert my matrix into a list (which is traversable), find the grad and convert it back into a matrix but given I am doing numerical calculations and speed is an important factor, this seems undesirable. I think I would have the same problem with: http://hackage.haskell.org/package/repa http://hackage.haskell.org/package/yarr-1.3.1 although I haven'¯t checked. Thanks, Dominic. ___ 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] Automated Differentiation of Matrices (hmatrix)
Hi Edward, I see now that the issues are deeper than performance. I took another package that supports matrix operations: repa. data MyMatrix a = MyMatrix { myRows :: Int , myCols :: Int , myElts :: [a] } deriving (Show, Functor, Foldable, Traversable) f (MyMatrix r c es) = sum es g (MyMatrix r c es) = head $ toList $ sumS $ sumS n where n = fromListUnboxed (Z :. r :. c) es I can take the grad of f but not of g even though they are the same function: *Main :t grad f grad f :: Num a = MyMatrix a - MyMatrix a *Main :t grad g interactive:1:6: Could not deduce (repa-3.2.3.1:Data.Array.Repa.Eval.Elt.Elt (ad-3.4:Numeric.AD.Internal.Types.AD s a)) arising from a use of `g' from the context (Num a) bound by the inferred type of it :: Num a = MyMatrix a - MyMatrix a at Top level or from (Numeric.AD.Internal.Classes.Mode s) bound by a type expected by the context: Numeric.AD.Internal.Classes.Mode s = MyMatrix (ad-3.4:Numeric.AD.Internal.Types.AD s a) - ad-3.4:Numeric.AD.Internal.Types.AD s a at interactive:1:1-6 Possible fix: add an instance declaration for (repa-3.2.3.1:Data.Array.Repa.Eval.Elt.Elt (ad-3.4:Numeric.AD.Internal.Types.AD s a)) In the first argument of `grad', namely `g' In the expression: grad g 2. By monomorphic, do you mean that I can do: g :: MyMatrix Double - Double g (MyMatrix r c es) = head $ toList $ sumS $ sumS n where n = fromListUnboxed (Z :. r :. c) es but not get a type error as I currently do: *Main :t grad g interactive:1:6: Couldn't match type `Double' with `ad-3.4:Numeric.AD.Internal.Types.AD s a0' Expected type: MyMatrix (ad-3.4:Numeric.AD.Internal.Types.AD s a0) - ad-3.4:Numeric.AD.Internal.Types.AD s a0 Actual type: MyMatrix Double - Double In the first argument of `grad', namely `g' In the expression: grad g If so that would help as at least I could then convert between e.g. repa and structures that ad can play with. Of course, better would be that I could just apply ad to e.g. repa. Dominic. On 9 Apr 2013, at 23:03, Edward Kmett ekm...@gmail.com wrote: hmatrix and ad don't (currently) mix. The problem is that hmatrix uses a packed structure that can't hold any of the AD mode variants we have as an Element. =( I've been working with Alex Lang to explore in ad 4.0 ways that we can support monomorphic AD modes and still present largely the same API. We've seen a number of performance gains off of this refactoring already, but it doesn't go far enough to address what you need. A goal a bit farther out is to support AD on vector/matrix operations, but it is a much bigger refactoring than the one currently in the pipeline. =/ To support automatic differentiation on vector-based operations in a form that works with standard BLAS-like storage like the packed matrix rep used in hmatrix we need to convert from a 'matrix of AD variables' to an 'AD mode over of matrices'. This is similar to the difference between a matrix of complex numbers and a real matrix plus an imaginary matrix. This is a long term goal, but not one you're likely to see support for out of 'ad' in the short term. I can't build AD on hmatrix itself due in part to licensing restrictions and differing underlying storage requirements, so there are a lot of little issues in making that latter vision a reality. -Edward On Tue, Apr 9, 2013 at 10:46 AM, Dominic Steinitz domi...@steinitz.org wrote: Hi Cafe, Suppose I want to find the grad of a function then it's easy I just use http://hackage.haskell.org/package/ad-3.4: import Numeric.AD import Data.Foldable (Foldable) import Data.Traversable (Traversable) data MyMatrix a = MyMatrix (a, a) deriving (Show, Functor, Foldable, Traversable) f :: Floating a = MyMatrix a - a f (MyMatrix (x, y)) = exp $ negate $ (x^2 + y^2) / 2.0 main :: IO () main = do putStrLn $ show $ f $ MyMatrix (0.0, 0.0) putStrLn $ show $ grad f $ MyMatrix (0.0, 0.0) But now suppose I am doing some matrix calculations http://hackage.haskell.org/package/hmatrix-0.14.1.0 and I want to find the grad of a function of a matrix: import Numeric.AD import Numeric.LinearAlgebra import Data.Foldable (Foldable) import Data.Traversable (Traversable) g :: (Element a, Floating a) = Matrix a - a g m = exp $ negate $ (x^2 + y^2) / 2.0 where r = (toLists m)!!0 x = r!!0 y = r!!1 main :: IO () main = do putStrLn $ show $ g $ (1 2) ([0.0, 0.0] :: [Double]) putStrLn $ show $ grad g $ (1 2) ([0.0, 0.0] :: [Double]) Then I am in trouble: /Users/dom/Dropbox/Private/Whales/MyAD.hs:24:21: No instance for (Traversable Matrix) arising from a use of `grad' Possible fix: add
[Haskell-cafe] Automated Differentiation of Matrices (hmatrix)
Hi Cafe, Suppose I want to find the grad of a function then it's easy I just use http://hackage.haskell.org/package/ad-3.4: import Numeric.AD import Data.Foldable (Foldable) import Data.Traversable (Traversable) data MyMatrix a = MyMatrix (a, a) deriving (Show, Functor, Foldable, Traversable) f :: Floating a = MyMatrix a - a f (MyMatrix (x, y)) = exp $ negate $ (x^2 + y^2) / 2.0 main :: IO () main = do putStrLn $ show $ f $ MyMatrix (0.0, 0.0) putStrLn $ show $ grad f $ MyMatrix (0.0, 0.0) But now suppose I am doing some matrix calculations http://hackage.haskell.org/package/hmatrix-0.14.1.0 and I want to find the grad of a function of a matrix: import Numeric.AD import Numeric.LinearAlgebra import Data.Foldable (Foldable) import Data.Traversable (Traversable) g :: (Element a, Floating a) = Matrix a - a g m = exp $ negate $ (x^2 + y^2) / 2.0 where r = (toLists m)!!0 x = r!!0 y = r!!1 main :: IO () main = do putStrLn $ show $ g $ (1 2) ([0.0, 0.0] :: [Double]) putStrLn $ show $ grad g $ (1 2) ([0.0, 0.0] :: [Double]) Then I am in trouble: /Users/dom/Dropbox/Private/Whales/MyAD.hs:24:21: No instance for (Traversable Matrix) arising from a use of `grad' Possible fix: add an instance declaration for (Traversable Matrix) In the expression: grad g In the second argument of `($)', namely `grad g $ (1 2) ([0.0, 0.0] :: [Double])' In the second argument of `($)', namely `show $ grad g $ (1 2) ([0.0, 0.0] :: [Double])' /Users/dom/Dropbox/Private/Whales/MyAD.hs:24:26: Could not deduce (Element (ad-3.4:Numeric.AD.Internal.Types.AD s Double)) arising from a use of `g' from the context (Numeric.AD.Internal.Classes.Mode s) bound by a type expected by the context: Numeric.AD.Internal.Classes.Mode s = Matrix (ad-3.4:Numeric.AD.Internal.Types.AD s Double) - ad-3.4:Numeric.AD.Internal.Types.AD s Double at /Users/dom/Dropbox/Private/Whales/MyAD.hs:24:21-26 Possible fix: add an instance declaration for (Element (ad-3.4:Numeric.AD.Internal.Types.AD s Double)) In the first argument of `grad', namely `g' In the expression: grad g In the second argument of `($)', namely `grad g $ (1 2) ([0.0, 0.0] :: [Double])' What are my options here? Clearly I can convert my matrix into a list (which is traversable), find the grad and convert it back into a matrix but given I am doing numerical calculations and speed is an important factor, this seems undesirable. I think I would have the same problem with: http://hackage.haskell.org/package/repa http://hackage.haskell.org/package/yarr-1.3.1 although I haven'¯t checked. Thanks, Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Threadscope 0.2.2 goes in segmentation fault on Mac Os X 10.8.3
Cool! Works for me. Many thanks, Dominic On 3 Apr 2013, at 12:40, Edsko de Vries edskodevr...@gmail.com wrote: I provide a ThreadScope binary on my site (http://www.edsko.net/2013/01/24/threadscope-0-2-2/) which runs fine for me on 10.8.3. -E On Mon, Apr 1, 2013 at 8:01 AM, Dominic Steinitz domi...@steinitz.org wrote: Alfredo Di Napoli alfredo.dinapoli at gmail.com writes: Said that,has someone had any luck in running Threadscope on Mac OS X 10.8 at all? Thanks, A. I think I have encountered the same problem: https://groups.google.com/d/msg/parallel-haskell/-lhrgNN8elw/KzqLM9BzoJwJ In my experience, anything that uses gtk is a problem on a MAC. I still intend to do some analysis *not* using threadscope but using event-logs directly but that is at least a few weeks away. Dominic. ___ 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] Threadscope 0.2.2 goes in segmentation fault on Mac Os X 10.8.3
Alfredo Di Napoli alfredo.dinapoli at gmail.com writes: Said that,has someone had any luck in running Threadscope on Mac OS X 10.8 at all? Thanks, A. I think I have encountered the same problem: https://groups.google.com/d/msg/parallel-haskell/-lhrgNN8elw/KzqLM9BzoJwJ In my experience, anything that uses gtk is a problem on a MAC. I still intend to do some analysis *not* using threadscope but using event-logs directly but that is at least a few weeks away. Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Optimization flag changing result of code execution
Aleksey Khudyakov alexey.skladnoy at gmail.com writes: I've tried to run you program and I've got approximately same results regardless of optimization level. Which versions of GHC, mwc-random, vector and primitive do you use? By approximate do you mean you are getting Monte Carlo noise or Floating Point noise? If the latter then that's reasonable; if the former then that's worrying. Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Repa: traverse delayed array multiple times
Andrey Yankin yankin013 at gmail.com writes: Greetings to all! repa?I wrote this rough sketch that shows what I am into. Apparently, program is severely slow. I think reason is:Every time an element is requested from a delayed array it is calculated anew, which means that delayed arrays are inefficient when the data is needed multiple times(http://www.haskell.org/haskellwiki/Numeric_Haskell:_A_Repa_Tutorial).I started diving into Guiding Parallel Array Fusion with Indexed Types mentioned there. Is it a right place to find any answer to my question? It's certainly possible to do this in repa. As I understand it, that is pretty much what repa is for. I'm not sure about your explanation for the slowdown although it sounds plausible. I amended your code slightly and it runs pretty quickly for me using my 2 processors! updater :: Source r Int = Array r DIM2 Int - Array D DIM2 Int updater a = traverse a id step updaterM :: Monad m = Int - Array U DIM2 Int - m (Array U DIM2 Int) updaterM n = foldr (=) return (replicate n (computeP . updater)) and replace g - computeP $ accumulate n grid :: IO (Array U DIM2 Int) by g - updaterM n grid BTW I think you can use stencils for what you are doing (I assume it is some sort of relaxation method) as the coefficients are constant. I think this should speed things up further as you won't be testing the boundary conditions on every loop. Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Large, numerical calculations in Haskell
Emil Hedevang emilhedevang at gmail.com writes: Hi Haskell Cafe, I need to perform very large numerical computations requiring tens of GB of memory. The computations consist essentially of generation of random numbers and discrete convolutions of large arrays of random numbers with somewhat smaller kernel arrays. Should I use Haskell and call some C libraries when necessary? Should I just write everything in C? Or should I use e.g. Chapel (chapel.cray.com)? Hi Emil, The first place I would look would be repa http://repa.ouroborus.net/. IIRC it supports discrete convolutions and repa folks seem quite responsive. Dominic. PS I am planning to use repa to solve PDEs and address, at least partially, the curse of dimensionality with it. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [repa] beginner questions
Dmitry Malikov malikov.d.y at gmail.com writes: Playing around with repa arrays and got some questions. 1) How I can get list of indexes of array that suffice some predicate? a1 AUnboxed (Z :. 3) (fromList [False,False,True]) it :: Array U (Z :. Int) Bool Indexes of element that satisfying specific predicate could be obtained like that: (\a p → Data.List.map (subtract 1 . snd) $ filter (p . fst) $ zip (toList a) [1..]) a1 (== False) [0,1] Looks ugly. How REPA users used to do filtering like that without converting to list? I hope someone will correct me if I am wrong and furthermore I was not entirely clear what you were trying to do but it seems to me that if you want to filter out an unknown number of elements from a collection then repa is the wrong abstraction to use. You can however filter out a known number of elements e.g. xs = Repa.fromListUnboxed (Z :. 3) [1, 2, 3] removeOne ix xs = Repa.fromFunction (Z :. dx - 1) (\(Z :. jx) - xs ! (Z :. f jx)) where Z :. dx = Repa.extent xs f jx | jx ix = jx | otherwise = jx + 1 test = Repa.computeP $ removeOne 1 xs :: IO (Array U DIM1 Float) Does that help? Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] not enough fusion?
Duncan Coutts duncan.coutts at googlemail.com writes: This could in principle be fixed with an arity raising transformation, Do you have a reference to arity raising transformations? Thanks, Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Problem Installing ad (Automatic Differentiation) Package
Hi, I was trying to install ad (Automatic Differentiation) but got the following error. I guess the answer is to upgrade my ghc (perhaps someone could confirm) but I am using the Haskell Platform and would rather stick with that. I see from http://hackage.haskell.org/platform/ that the next release is due out in May. Will that be early May? in which case I may well wait a week or will it be late May? in which case I might bite the bullet and upgrade my ghc. Thanks, Dominic Building template-haskell-2.7.0.0... [1 of 7] Compiling Language.Haskell.TH.Syntax.Internals ( Language/Haskell/TH/Syntax/Internals.hs, dist/build/Language/Haskell/TH/Syntax/Internals.o ) [2 of 7] Compiling Language.Haskell.TH.Syntax ( Language/Haskell/TH/Syntax.hs, dist/build/Language/Haskell/TH/Syntax.o ) [3 of 7] Compiling Language.Haskell.TH.PprLib ( Language/Haskell/TH/PprLib.hs, dist/build/Language/Haskell/TH/PprLib.o ) Language/Haskell/TH/PprLib.hs:55:10: Illegal instance declaration for `Show Doc' (All instance types must be of the form (T t1 ... tn) where T is not a synonym. Use -XTypeSynonymInstances if you want to disable this.) In the instance declaration for `Show Doc' Updating documentation index /Users/Test/Library/Haskell/doc/index.html cabal: Error: some packages failed to install: ad-1.3.0.1 depends on template-haskell-2.7.0.0 which failed to install. template-haskell-2.7.0.0 failed during the building phase. The exception was: ExitFailure 1 The Glorious Glasgow Haskell Compilation System, version 7.0.3 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Installing REPA
On 07/04/2012 11:14, Ben Lippmeier wrote: On 07/04/2012, at 9:33 AM, Chris Wong wrote: On Sat, Apr 7, 2012 at 2:02 AM, Dominic Steinitz idontgetoutm...@googlemail.com wrote: Hi, I'm trying to install REPA but getting the following. Do I just install base? Or is it more complicated than that? Thanks, Dominic. I think the easiest solution is to just use an older version of Repa. According to Hackage, the latest one that works with base 4.3 is Repa 2.1.1.3: $ cabal install repa==2.1.1.3 I've just pushed Repa 3 onto Hackage, which has a much better API than the older versions, and solves several code fusion problems. However, you'll need to upgrade to GHC 7.4 to use it. GHC 7.0.3 is two major releases behind the current version. Ben. Hi Ben, Chris and Others, Thanks for your replies and suggestions. All I want to do is invert (well solve actually) a tridiagonal matrix so upgrading ghc from the version that comes with the platform seems a bit overkill. I think I will go with Chris' suggestion for now and maybe upgrade ghc (and REPA) when I am feeling braver. Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] GHCi runtime linker: fatal error (was Installing REPA)
On 07/04/2012 15:42, Dominic Steinitz wrote: On 07/04/2012 11:14, Ben Lippmeier wrote: On 07/04/2012, at 9:33 AM, Chris Wong wrote: On Sat, Apr 7, 2012 at 2:02 AM, Dominic Steinitz idontgetoutm...@googlemail.com wrote: Hi, I'm trying to install REPA but getting the following. Do I just install base? Or is it more complicated than that? Thanks, Dominic. I think the easiest solution is to just use an older version of Repa. According to Hackage, the latest one that works with base 4.3 is Repa 2.1.1.3: $ cabal install repa==2.1.1.3 I've just pushed Repa 3 onto Hackage, which has a much better API than the older versions, and solves several code fusion problems. However, you'll need to upgrade to GHC 7.4 to use it. GHC 7.0.3 is two major releases behind the current version. Ben. Hi Ben, Chris and Others, Thanks for your replies and suggestions. All I want to do is invert (well solve actually) a tridiagonal matrix so upgrading ghc from the version that comes with the platform seems a bit overkill. I think I will go with Chris' suggestion for now and maybe upgrade ghc (and REPA) when I am feeling braver. Dominic. Sadly I now get this when trying to mulitply two matrices. Is this because I have two copies of Primitive? I thought Cabal was supposed to protect me from this sort of occurrence. Does anyone have any suggestions on how to solve this? Tests-MacBook-Pro:PDE Test$ ghc-pkg list | grep -i prim WARNING: there are broken packages. Run 'ghc-pkg check' for more details. ghc-prim-0.2.0.0 primitive-0.3.1 primitive-0.4.0.1 *Main mmMult xx xx Loading package primitive-0.4.0.1 ... GHCi runtime linker: fatal error: I found a duplicate definition for symbol _memcpy_off whilst processing object file /Users/Test/Library/Haskell/ghc-7.0.3/lib/primitive-0.4.0.1/lib/HSprimitive-0.4.0.1.o This could be caused by: * Loading two different object files which export the same symbol * Specifying the same object file twice on the GHCi command line * An incorrect `package.conf' entry, causing some object to be loaded twice. GHCi cannot safely continue in this situation. Exiting now. Sorry. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Installing REPA
Hi, I'm trying to install REPA but getting the following. Do I just install base? Or is it more complicated than that? Thanks, Dominic. Tests-MacBook-Pro:PDE Test$ cabal install repa Resolving dependencies... cabal: cannot configure repa-2.2.0.1. It requires base ==4.4.* For the dependency on base ==4.4.* there are these packages: base-4.4.0.0 and base-4.4.1.0. However none of them are available. base-4.4.0.0 was excluded because of the top level dependency base -any base-4.4.1.0 was excluded because of the top level dependency base -any Tests-MacBook-Pro:PDE Test$ cabal --version cabal-install version 0.10.2 using version 1.10.1.0 of the Cabal library Tests-MacBook-Pro:PDE Test$ Tests-MacBook-Pro:PDE Test$ ghc --version The Glorious Glasgow Haskell Compilation System, version 7.0.3 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Codec.Crypto.RSA question
Charles-Pierre Astolfi cpa at crans.org writes: Hi -cafe, I have a question about Codec.Crypto.RSA: how to enforce that (informally) decrypt . encrypt = id Consider this code: That's certainly what I would expect and one of the unit tests that comes with http://hackage.haskell.org/packages/archive/Crypto/4.2.2/doc/html/Codec-Encryption-RSA.html checks for this. I wasn't able to get you code to compile so I couldn't investigate further. Maybe you could post a fully compiling example? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Haddock Problem
Does anyone have any suggestions or do I have to start building haddock myself? Ok I built it from source rather than using the Haskell Platform exe and it now works. Perhaps the packager of the Haskell Platform for Windows could take a look at why the binary is behaving as it does? Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Haddock Problem
malcolm.wallace malcolm.wallace at me.com writes: I haven't been following closely, but how did you install haddock? From a binary dist? Is it possible that one of the Windows binary dists has a baked-in location for something on the E: drive, which existed on the packager's machine but not on the final installed machine? We are on the Haskell Platform 2010.1.0.0 and haddock comes as a .exe with it. Does anyone have any suggestions or do I have to start building haddock myself? Thanks, Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Haddock Problem
David Waern david.waern at gmail.com writes: I think using --optghc=-package-conf is the correct way to point to another package DB, so I'll look into why it doesn't work. Perhaps another line of attack would be to see why haddock thinks I have an E: drive? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Haddock Problem
..\ThirdParty\Haskell_Platform\2010.1.0.0\bin\haddock.exe BackendC\Core.hs haddock.exe: can't find a package database at E:\ghc\ghc-6.12.1lib\package.conf.d But if I do haddock --help there is no option to set the package database and I don't even have an E: drive. I'm on windows in case that wasn't obvious and we have a custom package database which we point e.g. ghc and cabal at. Can someone tell me what I am doing wrong? Many thanks, Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Haddock Problem
Try --optghc=-package-conf --optghc=file, to point Haddock at the custom DB. Hi David, Thanks for the quick response. No dice I am afraid. Dominic. BTW this (using optghc) used to work on previous versions of haddock (iirc 2.4 and 2.5). ..\ThirdParty\Haskell_Platform\2010.1.0.0\bin\haddock.exe --optghc=-package-conf --optghc=c:\p4wksp\steinitd_fpf_exdate_ws\FPF_Dev.br\ThirdParty\haskell _packages\fpf.package.conf backendc\PAD2C.hs haddock.exe: can't find a package database at E:\ghc\ghc-6.12.1 \lib\package.conf.d ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Haddock Problem
David Waern david.waern at gmail.com writes: 2010/6/14 David Waern david.waern at gmail.com: OK, it seems like the path from the ghc-paths package overrided what you specified. I'm not sure this will work, but you could try: haddock -B c:\p4wksp\steinitd_fpf_exdate_ws\FPF_Dev.br\ThirdParty\haskell_packages\fpf.pack age.conf Sorry, that should be haddock -B c:\p4wksp\steinitd_fpf_exdate_ws\FPF_Dev.br\ThirdParty\haskell_packages David Better but no cigar. ..\ThirdParty\Haskell_Platform\2010.1.0.0\bin\haddock.exe -B c:\p4wksp\steinitd_fpf_exdate_ws\FPF_Dev.br\ThirdParty\haskell_packages\fpf.pack age.conf backendc\PAD2C.hs haddock.exe: can't find a package database at C:\p4wksp\steinitd_fpf_exdate_ws\FPF_Dev.br\ThirdParty\haskell_packages\fpf.pack age.conf\package.conf.d And indeed I do not have a directory called package.conf.d. So I created one and copied our custom package databse into it but still no luck: ..\ThirdParty\Haskell_Platform\2010.1.0.0\bin\haddock.exe -B c:\p4wksp\steinitd_fpf_exdate_ws\FPF_Dev.br\ThirdParty\haskell_packages backendc\PAD2C.hs haddock: internal Haddock or GHC error: C:\p4wksp\steinitd_fpf_exdate_ws\FPF_Dev.br\ThirdParty\haskell_packages\package. conf.d\package.cache: openBinaryFile: does not exist (No such file or directory) I'm not what this file is. Is it the same as the index file that cabal uses? Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Linguistic hair-splitting
wren ng thornton wren at freegeek.org writes: or whatever). Haskell and similar languages choose a particular set of coercions to Nice explanation. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Category Theory woes
Mark Spezzano mark.spezzano at chariot.net.au writes: Maybe there are books on Discrete maths or Algebra or Set Theory that deal more with Hom Sets and Hom Functions? Googling haskell category theory I got: http://en.wikibooks.org/wiki/Haskell/Category_theory http://www.haskell.org/haskellwiki/Category_theory and many others. The latter has a list of books. Perhaps people could update with books they are familiar with and add comments? Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: (liftM join .) . mapM
Stephen Tetley stephen.tetley at gmail.com writes: -- | Compose an arity 1 function with an arity 2 function. -- B1 - blackbird oo :: (c - d) - (a - b - c) - a - b - d oo f g = (f .) . g Extending the arity works quite nicely too: -- | Compose an arity 1 function with an arity 3 function. -- B2 - bunting ooo :: (d - e) - (a - b - c - d) - a - b - c - e ooo f g = ((f .) .) . g And oo = (.).(.) and ooo = (.).(.).(.) There was a suggestion a few years back to standardise these as I recall something like: $0 = $ $1 = . $2 = (.).(.) and so on but nothing came of it. Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ForSyDe (parameterized-data) fails to build
I'm not sure how actively this is maintained or used but I couldn't get it to build. Downloading parameterized-data-0.1.3... Configuring parameterized-data-0.1.3... Preprocessing library parameterized-data-0.1.3... Building parameterized-data-0.1.3... src\Data\Param\FSVec.hs:1:46: Warning: -XPatternSignatures is deprecated: use -XScopedTypeVariables or pragma {-# LANGUAGE Sco pedTypeVariables#-} instead src\Data\Param\FSVec.hs:462:0: warning: no newline at end of file [1 of 2] Compiling Data.Param.FSVec ( src\Data\Param\FSVec.hs, dist\build\Data\Param\FSVec.o ) src\Data\Param\FSVec.hs:103:22: Couldn't match expected type `t - ExpQ' against inferred type `FSVec s a1' In the expression: (readFSVec str) (lift :: (Nat s, Lift a) = FSVec s a - ExpQ) In the expression: ((readFSVec str) (lift :: (Nat s, Lift a) = FSVec s a - ExpQ), undefined) In the definition of `parseFSVecExp': parseFSVecExp str = ((readFSVec str) (lift :: (Nat s, Lift a) = FSVec s a - ExpQ), undefined) cabal.exe: Error: some packages failed to install: ForSyDe-3.0 depends on parameterized-data-0.1.3 which failed to install. parameterized-data-0.1.3 failed during the building phase. The exception was: exit: ExitFailure 1 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: haskell-src-exts Question
Niklas Broberg niklas.broberg at gmail.com writes: please? http://trac.haskell.org/haskell-src-exts Niklas, I'd love to raise a bug for it but unfortunately I can't log on to trac. I don't understand why but none of my colleagues can log on either. It's been a long standing issue. I presume it's to do with our proxy but we can log on to lots of other sites. Perhaps you could cut and paste the email I sent? Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: haskell-src-exts Question
Dominic Steinitz dominic at steinitz.org writes: Niklas Broberg niklas.broberg at gmail.com writes: please? http://trac.haskell.org/haskell-src-exts Niklas, I'd love to raise a bug for it but unfortunately I can't log on to Good news. Although I couldn't logon as guest, I've created an account and can logon as that. I'll create the ticket now. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] haskell-src-exts Question
I've been generating Haskell using haskell-src-exts but the prettyprinter isn't producing what I would expect. I would expect parse . prettyPrint == id i.e. the AST should be unchanged if you prettyprint it then parse it. Here's an example generated expression: App (App (Var (UnQual (Ident pay))) (Var (UnQual (Ident tPD (App (Var (UnQual (Ident a))) (InfixApp (App (Var (UnQual (Ident length))) (Var (UnQual (Ident tOD (QVarOp (UnQual (Symbol +))) (Lit (Int (-1) Here's what prettyPrint produces: pay tPD a length tOD + -1 Parsing it gives this (i.e. not the expression I first thought of): InfixApp (App (App (App (App (Var (UnQual (Ident pay))) (Var (UnQual (Ident tPD (Var (UnQual (Ident a (Var (UnQual (Ident length (Var (UnQual (Ident tOD (QVarOp (UnQual (Symbol +))) (NegApp (Lit (Int 1))) I would have expected the prettyprinter to produce this: pay tPD (a (length tOD + -1)) Do I have to write my own prettyprinter? Do I have to put in explicit parentheses? The latter seems unsatisfactory as my generated AST is unambiguous and bracketing ought to be part of the prettyprinter. The former would be quite a lot of code as there are many cases to consider. Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Haddock : parse error on input `{-# UNPACK'
Erik de Castro Lopo mle+hs at mega-nerd.com writes: Dominic Steinitz wrote: Erik de Castro Lopo mle+hs at mega-nerd.com writes: src/Data/Binary/Strict/IncrementalGet.hs:106:11: parse error on input `{-# UNPACK' This is a haddock error and I presume a bug in haddock. Well I raised a bug here: http://trac.haskell.org/haddock/ticket/109 Thats actually not the problem. I'm trying to build a debian package for this thing and this haddock problem is preventing that. Erik This seems to be the problem: http://hackage.haskell.org/trac/hackage/ticket/230. There's obviously a work round for it as the haddock for the binary package builds (e.g. http://hackage.haskell.org/packages/archive/binary/0.5.0.1/doc/html/Data-Binary-Get.html) but I don't know what it is. What's even more frustrating is one of the authors of has tried: #ifndef __HADDOCK__ -- | The parse state data S = S {-# UNPACK #-} !BL.ByteString -- ^ input {-# UNPACK #-} !Int -- ^ bytes read {-# UNPACK #-} ![B.ByteString] {-# UNPACK #-} !Int -- ^ the failure depth #endif and haddock ignores this. And the binary package just has this (no ifdefs!): -- Our internal buffer type data Buffer = Buffer {-# UNPACK #-} !(ForeignPtr Word8) {-# UNPACK #-} !Int-- offset {-# UNPACK #-} !Int-- used bytes {-# UNPACK #-} !Int-- length left Perhaps one of the authors of binary can tell us their secret of success? Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Haddock : parse error on input `{-# UNPACK'
Dominic Steinitz dominic at steinitz.org writes: Erik de Castro Lopo mle+hs at mega-nerd.com writes: Dominic Steinitz wrote: Erik de Castro Lopo mle+hs at mega-nerd.com writes: src/Data/Binary/Strict/IncrementalGet.hs:106:11: parse error on input `{-# UNPACK' This is a haddock error and I presume a bug in haddock. Well I raised a bug here: http://trac.haskell.org/haddock/ticket/109 Ha! It's yet another of haddock's quirks. If I replace -- ^ by -- then haddock accepts {-#. I'll update the ticket you created. -- | The parse state data S = S {-# UNPACK #-} !BL.ByteString -- ^ input {-# UNPACK #-} !Int -- ^ bytes read {-# UNPACK #-} ![B.ByteString] {-# UNPACK #-} !Int -- ^ the failure depth -- | The parse state data S = S {-# UNPACK #-} !BL.ByteString -- input {-# UNPACK #-} !Int -- bytes read {-# UNPACK #-} ![B.ByteString] {-# UNPACK #-} !Int -- the failure depth Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Haddock : parse error on input `{-# UNPACK'
Erik de Castro Lopo mle+hs at mega-nerd.com writes: src/Data/Binary/Strict/IncrementalGet.hs:106:11: parse error on input `{-# UNPACK' Is this a bug? Is there any way to work around it? This is a haddock error and I presume a bug in haddock. I don't know whether cabal installs things if haddock fails. You could do ghc-pkg list and see what's there. If it didn't install then you can install by hand: 1. Extract the sources and in that directory: 2. runghc Setup.lhs configure 3. runghc Setup.lhs build 4. runghc Setup.lhs install You might want to do configure with --user - that's what cabal defaults to. Dominic ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal, Time GHC 6.10.2
Duncan Coutts wrote: On Sun, 2009-05-17 at 09:17 +0100, Dominic Steinitz wrote: I get d...@linux-6ofq:~/asn1 runghc Setup.hs configure Configuring PER-0.0.20... Setup.hs: At least the following dependencies are missing: time -any -any but I have time d...@linux-6ofq:~/asn1 ghc-pkg list | grep time old-locale-1.0.0.1, old-time-1.0.0.2, packedstring-0.1.0.1, time-1.1.2.4 I think I can see why cabal isn't finding it: ghc-pkg dump --global | grep time-1.1.2.4 finds nothing and I believe that is what cabal uses to find things. The default for runghc Setup.hs configure is --global, but the default for cabal configure is --user. So if you're using the cabal program to install packages, then you can also us it to configure other packages. If for you need to use the runghc Setup.hs interface (e.g. in some system build scripts) and you want it to pick up packages from the user package db then use the --user flag. If you're constantly having to use the runghc Setup.hs interface and doing per-user installs is a pain then you can set the default for the cabal program to be global installs in the cabal config file (~/.cabal/config). I'll add this issue to the FAQ, it come up enough. If anyone else reading would like to eliminate this FAQ, then implementing this ticket is the answer: suggest use of --user if configure fails with missing deps that are in the user db http://hackage.haskell.org/trac/hackage/ticket/384 Duncan Duncan, Thanks very much. I'm happy to update the FAQ this weekend unless you have already done it. Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] HPC Website FAQ
There's a nice website for HPC but it looks a bit out of date. http://projects.unsafeperformio.com/hpc/ I wanted to send a patch to the FAQ for using HPC with .lhs files (you have to run ghc -E to generate .hs files and strip some of the the lines ghc generates: {-# LINE 1 ASNTYPE.lhs #-} #line 1 ASNTYPE.lhs). Would it be possible for the author of HPC to make the website into a darcs repo so that we send in patches? Apparently the Cabal website is managed like that and it sounds like a good way of doing things in general to me. Thanks, Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Cabal, Time GHC 6.10.2
I get d...@linux-6ofq:~/asn1 runghc Setup.hs configure Configuring PER-0.0.20... Setup.hs: At least the following dependencies are missing: time -any -any but I have time d...@linux-6ofq:~/asn1 ghc-pkg list | grep time old-locale-1.0.0.1, old-time-1.0.0.2, packedstring-0.1.0.1, time-1.1.2.4 I think I can see why cabal isn't finding it: ghc-pkg dump --global | grep time-1.1.2.4 finds nothing and I believe that is what cabal uses to find things. What's not clear is what I do to fix things. Go back to 6.10.1? Thanks, Dominic. d...@linux-6ofq:~/asn1 ghc --version The Glorious Glasgow Haskell Compilation System, version 6.10.2 d...@linux-6ofq:~/asn1 ghc-pkg --version GHC package manager version 6.10.2 Here's my .cabal file. Name:PER Version: 0.0.20 License: BSD3 Author: Dominic Steinitz Maintainer: dominic.stein...@blueyonder.co.uk Copyright: Dominic Steinitz 2003 - 2009 Stability: Alpha Category:Language Homepage:http://www.haskell.org/asn1 Synopsis:ASN.1 PER support for Haskell Description: A formal and executable specification of the Packed Encoding Rules (PER) for ASN.1 build-depends: binary-strict == 0.4.2, bytestring, mtl, containers, time, pretty, base build-type: custom Exposed-Modules: Language.ASN1.PER.Integer Language.ASN1.PER.GenerateC Executable: PERTest Main-Is: PERTest.hs ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Problems with Haskell Program Coverage
Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk writes: Dominic Steinitz dominic.steinitz at blueyonder.co.uk wrote: I want to use hpc to check that the ASN.1 library tests cover all the code. When I run it with a set of tests that I *know* don't test certain things, it reports that they have been covered i.e. there are not coloured in the markup that hpc produces. I would have expected a lot of yellow. The record of coverage is cumulative across multiple runs. Is it possible that you did not remove an old .tix file before running the tests? Thanks for your reply I was beginning to worry I might be the only person trying to use this. I've done a bit of investigation and it seems there are at least two problems: 1. I have literate haskell files (.lhs). 2. Even if I run them through the pre-processor (ghc -E) they still don't work but if I manually remove these lines (which seem to get inserted by the pre-processor) {-# LINE 1 ASNTYPE.lhs #-} #line 1 ASNTYPE.lhs then it does actually work. It looks like a bug to me. I guess I should report it on the ghc trac. I still have a problem with another project which doesn't use literate haskell but does require the use of -cpp and has got #ifdef's. I haven't got to the bottom of it yet but I'm suspicious that lines starting with # cause hpc to misbehave. It's strange that hpc should behave like this as I would have thought it wouldn't care about hs / lhs and # as ghc would have done some of its standard processing before hpc got engaged. Dominic. hpc_index.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Problems with Haskell Program Coverage
I want to use hpc to check that the ASN.1 library tests cover all the code. When I run it with a set of tests that I *know* don't test certain things, it reports that they have been covered i.e. there are not coloured in the markup that hpc produces. I would have expected a lot of yellow. It seems to work ok on small amounts of code so I'm not clear what I'm doing wrong. I'd be happy to provide the .tix file or put the .html files somewhere if that would be helpful. Here's what I use: ghc -o NewTest NewTest.hs -fhpc --make NewTest hpc markup NewTest Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: how to link to external documentation with haddock ?
minh thu noteed at gmail.com writes: http://www.haskell.org/haskellwiki/Haddock/FAQ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Low-level networking [Haskell not ready for Foo]
John Goerzen jgoerzen at complete.org writes: Any idea how I get Haskell to send ICMP ECHO packets? (And, obviously, receive the replies.) SocketType claims to support Raw, which I think is the conventional means for doing this. Whether all the infrastructure for that is there, I don't know. I have never worked with raw sockets though, so I may be leading you down a dark mugger-laden alley here Here's an example of a Haskell version of ping, now sadly bit-rotted. Dominic. http://haskell.org/networktools/src/ping/test.hs http://haskell.org/networktools/src/ping/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: pbkdf2 on hackage Re: Re[2]: [Haskell-cafe] Password hashing
Thomas Hartman wrote: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/PBKDF2 Since no one took up my code review request I just did the best I Also I'm open to folding this into a more established crypto package if there are any takers... psst, dominic. I've now had chance to review this and it looks a reasonable function to include in the package. I'd love a patch. First a few comments: 1. Experience has taught me that you need a few tests against known test vectors. If you look in the crypto package you will see there are several such test programs. You could either create your own or add to e.g. SymmetricTest (probably easiest). pbkdf2' :: ([Word8] - [Word8] - [Word8]) - Integer - Integer - Integer - Password - Salt - HashedPass 2. Any reason for the arguments being in a different order to that in the spec? -- The spec says -- Here, INT (i) is a four-octet encoding of the integer i, most significant octet first. -- I'm reading from the right... is this the right thing? 3. I don't know but some known test vectors will almost certainly flush this out. toWord8s x = L.unpack . encode $ x 4. Is there a guarantee that encode (I assume from Binary) does what is required? I think you are guaranteed that encode . decode == id but I don't know if any guarantee is made about the actual encoding (I haven't checked by the way). --intToFourWord8s :: Integer - [Word8] intToFourWord8s i = let w8s = toWord8s $ i in drop (length w8s -4) w8s 5. This looks slightly suspicious. It won't work in general. I assume you are sure that it is only ever used for the correctly sized Integers? Thanks for your contribution, Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Control.Exception Funny
I'm probably doing something wrong but this example doesn't compile for me under ghc 6.10.1 (http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Exception.html#4): catch (openFile f ReadMode) (\e - hPutStr stderr (Couldn't open ++f++: ++ show e)) Run.hs:77:24: Couldn't match expected type `Handle' against inferred type `()' Expected type: IO Handle Inferred type: IO () In the expression: hPutStr stderr (Couldn't open ++ d ++ : ++ show e) In the second argument of `CE.catch', namely `(\ e - hPutStr stderr (Couldn't open ++ d ++ : ++ show e))' Fair enough because openFile returns a Handle and hPutStr returns () so they don't match as the compiler says. CE.catch :: (CE.Exception e) = IO a - (e - IO a) - IO a So if I fix the example thus: foo d = CE.catch (openFile d ReadMode return ()) (\e - hPutStr stderr (Couldn't open ++ d ++: ++ show e)) I get Run.hs:70:8: Ambiguous type variable `e' in the constraint: `CE.Exception e' arising from a use of `CE.catch' at Run.hs:(70,8)-(71,78) Probable fix: add a type signature that fixes these type variable(s) Now I think I never used to get this under 6.8.2 but I don't easily have a 6.8.2 to try it out on. Doing what the compiler suggests doesn't work for obvious reasons: foo :: CE.Exception e = FilePath - IO () foo d = CE.catch (openFile d ReadMode return ()) (\e - hPutStr stderr (Couldn't open ++ d ++: ++ show e)) Run.hs:69:0: Ambiguous constraint `CE.Exception e' At least one of the forall'd type variables mentioned by the constraint must be reachable from the type after the '=' In the type signature for `foo': foo :: (CE.Exception e) = FilePath - IO () There seems to be a ticket for it (http://hackage.haskell.org/trac/ghc/ticket/2819) but this doesn't give a suggested example that compiles. Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Control.Exception Funny
Claus Reinke wrote: btw, if your handler cannot return the same type as your action, is this the right place to catch the exceptions? That was an example, the real code looks something like this: do d - getCurrentDirectory t - getCurrentTime let u = asn1c. ++ show (utctDay t) ++ . ++ show (utctDayTime t) createDirectory u setCurrentDirectory u CE.catch (do writeASN1AndC (genFile . asn1) (genFile . c) ty val runCommands [(asn1c ++ ++ asn1cOptions ++ ++ skeletons ++ ++ (genFile . asn1), Failure in asn1c)] d - getCurrentDirectory fs - getDirectoryContents d let cFiles = case os of mingw32 - (genFile . c):(name . c):(cFiles' [converter-sample.c] .c.lnk fs) _ - (genFile . c):(name . c):(cFiles' [genFile . c, name . c, converter-sample . c] .c fs) putStrLn (show cFiles) putStrLn (show (map compile cFiles)) runCommands (map compile cFiles) putStrLn (linker ++ ++ linkerOut genFile ++ ++ (* . objectSuffix)) runCommands [ (linker ++ ++ linkerOut genFile ++ ++ (* . objectSuffix), Failure linking), ((executable genFile) ++ ++ (genFile . per), Failure executing) ] readGen (genFile . per) ty) (\e - hPutStrLn stderr (Problem with generating / compiling\n ++ show e)) setCurrentDirectory d Your suggestion: you'll see 'IOException' listed, so 'show (e::IOException)' might do what you want. works perfectly. Thanks very much, Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: pbkdf2 on hackage Re: Re[2]: [Haskell-cafe] Password hashing
Thomas Hartman wrote: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/PBKDF2 Since no one took up my code review request I just did the best I could and uploaded to hackage. There were indeed some mistakes in my initial post, fixed now. (Code review is still wished, though!) Alas, documentation doesn't build with hackage, altough it does for me locally. (Seems like almost everything I do these days -- what am I doing wrong?!) Also I'm open to folding this into a more established crypto package if there are any takers... psst, dominic. I'd be happy to do so. In fact, I have another contribution which I need to work on so maybe now is a good time to roll my sleeves up. I haven't been following the thread on this. Could you give me some references? I assume it's a perfectly good cryptographic function, then it would be very helpful for me if you created a patch against the crypto repository. Also, dominic, shouldn't your crypto package be added to category Cryptography (a cabal file change) so it lists aside the other crypto packages? Yes good point - something else that needs doing. I've created the first ticket in the trac http://trac.haskell.org/crypto/ticket/1 If there are any crypto gurus who can code-review this I would be much obliged, and when I'm confident enough that this does the right thing I'll put it up on hackage. I don't do much crypto so this *definitely* needs a review before it becomes a library? It depends what you are going to use it for. I've put a big disclaimer on the crypto library because there are all sorts of attacks I've not checked it's proof against (e.g. who knows how long keys are kept in memory by a runtime system). You'd probably have to put in quite a lot of work researching how e.g. this is done in other implementations and seeing how the equivalent protection could be implemented in Haskell. 2008/11/26 John Meacham [EMAIL PROTECTED]: What you are using there is not a salt, but rather a secret key. The important thing about a salt is that it is different for _every user_. and you actually store the salt unhashed along with the hash. (it is not secret information). A salt protects against a dictionary attack, for instance, you might have a dictionary of hash's and the common passwords they go to but if you add a 32 bit salt, you would need 2^32 entries for each dictionary word, making such an attack unworkable. You can also trivially tell if two users have the _same_ password just by comparing the hashes without a salt. John is right but it still doesn't stop you publishing your function which someone can then use as John describes. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Need machine for DPH benchmarking
we, the DPH team, are at the moment in the very unfortunate situation of not having a proper machine for running our benchmarks on. Could a kind soul maybe give us (i.e., me) access to a quadcore or 2xquadcore x86 Linux or OS X machine? I only need to build ghc on it and run small benchmarks which never take more than a couple of minutes, maybe once every couple of days or so. We do need to use all cores, though, so no other CPU-intensive processes can be running during benchmarking. This is only for a week or two, until we get our own machine. We would be eternally grateful and won't forget you when DPH takes over the world. Roman Roman, Graeme can set you up on an 8 core machine if you email him. Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Building QuickCheck 2 Under GHC 6.10.1
Having been a happy user of QuickCheck 2 for many years, I now find it won't build under ghc 6.10.1. Before I investigate further, has anyone encountered this problem and has a fix? Thanks, Dominic. C:\Users\Dom\QuickCheckSetup build Preprocessing library QuickCheck-2.0... Building QuickCheck-2.0... [2 of 9] Compiling Test.QuickCheck.Exception ( Test\QuickCheck\Exception.hs, dis t\build\Test\QuickCheck\Exception.o ) Test\QuickCheck\Exception.hs:12:31: Class `Exception' used as a type In the type `Exception' In the type `Either Exception a' In the type `IO (Either Exception a)' Test\QuickCheck\Exception.hs:15:36: Class `Exception' used as a type In the type `Exception' In the type `Either Exception a' In the type `IO (Either Exception a)' ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Exporting a Type Class for Type Signatures
In the crypto package, I have two functions encrypt :: AESKey a = a - Word128 - Word128 decrypt :: AESKey a = a - Word128 - Word128 which are exported. I also have class (Bits a, Integral a) = AESKey a instance AESKey Word128 instance AESKey Word192 instance AESKey Word256 unexported which stops you using invalid keys. Someone has asked me to export AESKey as they want to write an explicit type signature for a function they are creating e.g. foo :: AESKey a = a - Word128 - Word128 foo x y = encrypt x y but this generates an error. Is there a way of allowing someone to use AESKey in a type signature but not allow them to declare new instances? Thanks, Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Problems with strictness analysis?
wren ng thornton wren at freegeek.org writes: [snick] isum 0 s = s isum n s = isum (n-1) (s+n) This is tail recursive, and will be optimized to an iterative loop; [snick] In terms of having a compiler 'smart enough', it's not clear that functions of this sort ought to be inferred strict simply because the accumulator is ultimately returned to the caller. Consider for example: I thought this was strict as Luke Palmer has already pointed out. My understanding is that a compiler may be able to infer it is strict and then perform eager evaluation. f 0 xs = xs f n xs = f (n-1) (replicate n n ++ xs) Since (++) can indeed return partial answers, it's fine for the accumulator to be lazy. Indeed, making it strict harms performance significantly. Another example is when the accumulator is a function, as Can this function be strict if (++)isn't? And if it isn't strict, why would it make sense to evaluate it eagerly? Dominic. PS This subject seems to come up often enough to be worth a wiki entry (maybe there already is one). I think we should also be careful with terminology (as Luke Palmer and David Menendez have pointed out. Maybe that could be included in the wiki entry. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Darcs / Git
Not really a Haskell question but I'm not sure where else to go. What's the preferred method of converting a darcs repository to git? And is there a way of converting from git to darcs? The reason I ask is that my colleague cannot get darcs to work on his Windows box. Thanks, Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Health effects
Adrian Neumann aneumann at inf.fu-berlin.de writes: I often wonder how many cuts you need to divide a steak in n pieces. You can obviously get n pieces with (sqrt n) cuts by cutting a grid. But I'm sure some smart mathematician thought of a (log n) way. You might try the ham sandwich theorem http://en.wikipedia.org/wiki/Ham_sandwich_theorem as an hors d'oeuvre. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: control-timeout with gtk
Adam Langley agl at imperialviolet.org writes: be removed. Anyone who wants to maintain any of them should grab it now. The repos are all at http://darcs.imperialviolet.org On the chopping block: binary-strict Adam, I don't particularly want to maintain this as I have negative amounts of free time but I'll look after it as best I can if no-one else is in a position to pick it up. Dominic ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Best book/tutorial on category theory and its applications
fero frantisek.kocun at gmail.com writes: What do you think about Categories and Computer Science (Cambridge Computer Science Texts) at http://www.amazon.com/Categories-Computer-Science-Cambridge- Texts/dp/0521422264/ref=si3_rdr_bb_product ? I couldn't see monads or the Yoneda lemma in the index. As a Haskell programmer, the lack of the former might be a concern; the latter is a standard result. Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Swapping Monads
I have a solution so this is for interest only. It is not normally the case that two monads compose to give another monad. Monad transformers capture when this is possible. However, when there is a swap function satisfying some commutative diagrams then it can be proved that the monads compose to produce a monad. Is there such a swap function in a library? I had a look in the comprehensive category-extra package but couldn't find anything. Here's two possible implementations. Big caveat: I haven't proved that these satisfy the commutative diagrams but I am confident that they will. Option 1 define swap :: (Functor m, Monad m) = Either String (m a) - m (Either String a) swap (Left s) = return (Left s) swap (Right x) = fmap Right x Option 2 use Traversable (EvilTerran's suggestion) instance F.Foldable (Either String) where foldMap f (Left s) = mempty foldMap f (Right x) = f x instance T.Traversable (Either String) where traverse f (Left s) = pure (Left s) traverse f (Right x) = Right $ f x and now you can use T.sequence to swap the monads around. For further information see Composing Monads by Mark Jones and Luc Duponcheel and Toposes, Triples and Theories by Barr Wells (Section 9.2). Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Compiling large code with old machine
Samuel Silva silva.samuel at gmail.com writes: Hello I'm using GHC to compile around 700K of Haskell Code generated by HaXml. How I compile this code. My machine is Windows-XP(512MB RAM, 1.5GHz) running GHC-6.8.2. Samuel, You may not want to take this approach. I'm assuming you are generating haskell types from a (large) DTD. I went this way (admittedly quite a few years ago) for svg. In the end it was much easier to hand generate a few combinators to produced the svg. I don't know what your application is but it may worth thinking about an alternative to 700k loc. Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Bit Streams
OK, so today I tried to write my first program using the Binary library. And I've hit a snag: It appears the library will only handle data that is byte-aligned. So if I try to write three Bool values, it uses three bytes, not three bits. Before I sit down and spend 3 months designing my own library from scratch, does anybody know of an existing library that allows you to do what Binary does, but with single-bit precision? [I presume Binary is byte-aligned for efficiency...] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-strict ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Bit Streams
Don Stewart wrote: dominic.steinitz: OK, so today I tried to write my first program using the Binary library. And I've hit a snag: It appears the library will only handle data that is byte-aligned. So if I try to write three Bool values, it uses three bytes, not three bits. Before I sit down and spend 3 months designing my own library from scratch, does anybody know of an existing library that allows you to do what Binary does, but with single-bit precision? [I presume Binary is byte-aligned for efficiency...] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-strict The bitsyntax library perhaps? or a StateT over Binary for carrying arround the bit packet to write. -- Don The vagaries of gmane have made it appear that I asked the question. In fact, Andrew Coppin asked the question and I responded with a pointer to the library Adam Langley pulled together. Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Mersenne Build Problem
Bertram Felgenhauer bertram.felgenhauer at googlemail.com writes: The missing symbols are inlined functions. ghc 6.9 doesn't include the header files anymore when compiling via C. (The solution is to create C wrappers around those functions. I guess I'll whip up a patch.) Bertram, Thanks. That's done the trick. I tried 0.1.1 and it works with 6.8 and 0.1.2 works with 6.9. It certainly is a lot faster than system.random. Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Mersenne Build Problem
I'm getting errors (see below) trying to build the tests in http://hackage.haskell.org/cgi-bin/hackage-scripts/package/mersenne-random-0.1.1 I built the package itself using ./Setup configure -f use_sse2 I thought I had an intel core duo (also see below). I think I may be missing a library but I'm not sure which one. Thanks, Dominic. [EMAIL PROTECTED]:~/mersenne-random-0.1.1 cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 15 model name : Intel(R) Core(TM)2 Duo CPU E4500 @ 2.20GHz stepping: 13 cpu MHz : 1200.000 cache size : 2048 KB physical id : 0 siblings: 2 core id : 0 cpu cores : 2 fdiv_bug: no hlt_bug : no f00f_bug: no coma_bug: no fpu : yes fpu_exception : yes cpuid level : 10 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm constant_tsc pni monitor ds_cpl est tm2 ssse3 cx16 xtpr lahf_lm bogomips: 4392.14 clflush size: 64 processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 15 model name : Intel(R) Core(TM)2 Duo CPU E4500 @ 2.20GHz stepping: 13 cpu MHz : 1200.000 cache size : 2048 KB physical id : 0 siblings: 2 core id : 1 cpu cores : 2 fdiv_bug: no hlt_bug : no f00f_bug: no coma_bug: no fpu : yes fpu_exception : yes cpuid level : 10 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm constant_tsc pni monitor ds_cpl est tm2 ssse3 cx16 xtpr lahf_lm bogomips: 4388.99 clflush size: 64 [EMAIL PROTECTED]:~/mersenne-random-0.1.1/tests make ghc -O2 -ddump-simpl-stats -no-recomp Unit.hs --make [1 of 1] Compiling Main ( Unit.hs, Unit.o ) FloatOut stats: 154 Lets floated to top level; 35 Lets floated elsewhere; from 40 Lambda groups FloatOut stats: 133 Lets floated to top level; 14 Lets floated elsewhere; from 34 Lambda groups Grand total simplifier statistics Total ticks: 8378 2022 PreInlineUnconditionally 1760 PostInlineUnconditionally 991 UnfoldingDone 132 RuleFired 1 *# 15 +# 25 ++ 1 # 3 ==#-case 2 SC:a0 1 SC:a_s2sW0 1 SPEC GHC.Num.- 2 SPEC GHC.Real.$p1Integral 2 SPEC GHC.Real.$p1Real 2 SPEC GHC.Real.$p2Real 3 SPEC Main.speed 3 SPEC System.Random.random 1 eftInt 9 fold/build 14 foldr/app 1 fromIntegral/Word-Int 1 int2Double# 1 int2Word# 3 map 2 mapList 1 minimumInt 2 remInt# 2 take 2 takeList 17 unpack 6 unpack-append 9 unpack-list 212 LetFloatFromLet 1 EtaReduction 2874 BetaReduction 27 CaseOfCase 341 KnownBranch 3 CaseElim 2 CaseIdentity 13 FillInCaseDefault 22 SimplifierDone Linking Unit ... Unit.o: In function `s4Da_info': (.text+0x1b21): undefined reference to `genrand_real2' Unit.o: In function `s4RA_info': (.text+0x3e75): undefined reference to `genrand_real2' Unit.o: In function `s4S4_info': (.text+0x3f61): undefined reference to `genrand_real2' Unit.o: In function `s5su_info': (.text+0x40bc): undefined reference to `genrand_real2' /usr/local/lib/mersenne-random-0.1.1/ghc-6.9.20080517/libHSmersenne-random-0.1.1.a(Mersenne.o): In function `mersennezmrandomzm0zi1zi1_SystemziRandomziMersenne_zdwa2_info': ghc13223_0.hc:(.text+0x1a3): undefined reference to `gen_rand64_mix' /usr/local/lib/mersenne-random-0.1.1/ghc-6.9.20080517/libHSmersenne-random-0.1.1.a(Mersenne.o): In function `s2J1_info': ghc13223_0.hc:(.text+0x91d): undefined reference to `gen_rand64_mix' /usr/local/lib/mersenne-random-0.1.1/ghc-6.9.20080517/libHSmersenne-random-0.1.1.a(Mersenne.o): In function `s2JZ_info': ghc13223_0.hc:(.text+0xb3d): undefined reference to `genrand_real2' /usr/local/lib/mersenne-random-0.1.1/ghc-6.9.20080517/libHSmersenne-random-0.1.1.a(Mersenne.o): In function `s2LJ_info': ghc13223_0.hc:(.text+0xf8d): undefined reference to `gen_rand64_mix' /usr/local/lib/mersenne-random-0.1.1/ghc-6.9.20080517/libHSmersenne-random-0.1.1.a(Mersenne.o): In function `s35i_info': ghc13223_0.hc:(.text+0x1397): undefined reference to `genrand_real2' /usr/local/lib/mersenne-random-0.1.1/ghc-6.9.20080517/libHSmersenne-random-0.1.1.a(Mersenne.o): In function `s36A_info': ghc13223_0.hc:(.text+0x1517): undefined reference to `gen_rand64_mix' collect2: ld returned 1 exit status make: *** [all] Error 1 ___ Haskell-Cafe mailing
[Haskell-cafe] Re: Couple of formal questions
Creighton Hogg wchogg at gmail.com writes: Where could I find a proof that the initial algebras final coalgebras of CPO coincide? I saw this referenced in the Bananas.. paper as a fact, but am not sure where this comes from Creighton, As promised and I hope this is what you were after. Dominic. http://idontgetoutmuch.wordpress.com/2008/05/12/isomorphic-types/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Couple of formal questions
Creighton Hogg wchogg at gmail.com writes: between well-founded recursion well-founded(?) corecursion?Where could I find a proof that the initial algebras final coalgebras of CPO coincide? I Creighton, I started putting something together here. I'm not sure if it's what you are after and in any event it will now have to wait until the weekend. Dominic. http://idontgetoutmuch.wordpress.com/2008/05/12/isomorphic-types/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Haddock Help Required
David Waern david.waern at gmail.com writes: 2008/3/24, Dominic Steinitz dominic.steinitz at blueyonder.co.uk: What should I be using for the file name for the read-interface option in haddock? You must use a file that is on your own hard drive and that is generated with version 2.0 of Haddock, since that is what you're using. The interface file format was changed in Haddock 2.0 due its use of GHC data types, so you can't use 0.x interface files. You need to generate base.haddock with Haddock 2.0. One way to do that, is to make sure Haddock 2.0 is installed, then get the GHC 6.8.2 sources (with core libs) and build that with Haddock docs enabled. Hope this helps, David Thanks I've done this [EMAIL PROTECTED]:~/asn15/asn1 haddock -v -html -o hdoc Pretty.hs -B /usr/lib/ghc-6.8.2 --optghc=-fglasgow-exts --read-interface=http://www.haskell.org/ghc/docs/6.8.2/html/libraries/base,/home/dom/ghc-6.8.2/libraries/base/dist/doc/html/base/base.haddock but now when I click on e.g. Integer I get directed to http://www.haskell.org/ghc/docs/6.8.2/html/libraries/base/GHC-Num.html#t%3AInteger which doesn't exist. Integer actually exists in http://www.haskell.org/ghc/docs/6.8.2/html/libraries/base/Prelude.html#t%3AInteger What do I need to do to get haddock to point at the right links? Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Haddock Help Required
What should I be using for the file name for the read-interface option in haddock? Trying to use the file on www.haskell.org gives this: [EMAIL PROTECTED]:~/asn15/asn1 haddock -html -o hdoc Pretty.hs -B /usr/lib/ghc-6.8.2 --optghc=-fglasgow-exts --read-interface=http://www.haskell.org/ghc/docs/latest/html/libraries/base,http://www.haskell.org/ghc/docs/latest/html/libraries/base/base.haddock haddock: internal Haddock or GHC error: http://www.haskell.org/ghc/docs/latest/html/libraries/base/base.haddock: openBinaryFile: does not exist (No such file or directory) But if I download the file and try and use it locally, I get this [EMAIL PROTECTED]:~/asn15/asn1 haddock -v -html -o hdoc Pretty.hs -B /usr/lib/ghc-6.8.2 --optghc=-fglasgow-exts --read-interface=http://www.haskell.org/ghc/docs/latest/html/libraries/base,base.haddock Warning: Cannot read base.haddock: Magic number mismatch: couldn't load interface file: base.haddock Skipping this interface. Warning: main:Language.ASN1: could not find link destinations for: GHC.Enum.Enum GHC.Base.Eq GHC.Base.Ord GHC.Show.Show GHC.Num.Integer Language.ASN1.ComponentIndex Language.ASN1.Tagged GHC.Base.String Data.Maybe.Maybe Language.ASN1.Octet Data.Map.Map Warning: main:Pretty: could not find link destinations for: Text.PrettyPrint.HughesPJ.Doc Pretty.Pretty Pretty.PrettyVal Warning: main:ConstrainedType: could not find link destinations for: Data.Maybe.Maybe GHC.Base.Bool GHC.Num.Integer Pretty.Pretty Pretty.PrettyVal GHC.Base.String GHC.Base.Eq GHC.Show.Show GHC.Base.Int GHC.Word.Word8 GHC.Base.Ord Data.Monoid.Monoid Data.Binary.Strict.BitPut.BitPut GHC.Real.Integral Control.Monad.State.Class.MonadState Data.ByteString.Internal.ByteString Control.Monad.Error.Class.MonadError GHC.Base.Char Data.Binary.Strict.BitGet.BitGet Any help would be appreciated. Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Opening Windows .lnk Files
Does anyone know how to do this? If I open a file on Windows e.g. asn_application.h.lnk then I get the link data rather than the data in the linked file. Thanks, Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Opening Windows .lnk Files
Neil Mitchell wrote: Hi Drop into the command line, rename the file from foo.lnk to foo.txt, using ren foo.lnk foo.txt, then open foo.txt. It's a chunk of binary goop, so will likely not be much use. There is a COM class for editing shortcut files (IShellLink), which I've used before from C code. See http://darcs.haskell.org/hugs98/src/winhugs/installer/ShellCode.cpp, in particular the CreateShortcut function. Thanks Neil Neil, Thanks but following a discussion on #haskell, it's all beginning to sound a bit hard. Somehow I thought it would be easy. I know where the real files are so I'll just set a directory as a parameter, strip off the .lnk from the name and use that + the directory to manipulate them. Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Functional programmer's intuition for adjunctions?
Well, we have at least one very useful example of adjunction. It's called curry. See, if X is some arbitrary type, you can define This adjunction is the one that makes a category cartesian closed. Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Graphical graph reduction
About 7 years ago such a tool existed: http://www.cs.kent.ac.uk/people/staff/cr3/toolbox/haskell/GHood/ I don't know if Claus is around. Perhaps he could give you more information. Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Broken http://darcs.haskell.org/darcsweb/?
I'm getting errors when I click on any of the links. I'm not sure who administers the site. IOError Python 2.4.4: /usr/bin/python Wed Feb 20 11:41:13 2008 A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred. /srv/darcsweb/darcsweb.cgi 2248 url_request.sort() 2249 cache = Cache(config.cachedir, url_request) 2250 if cache.open(): 2251 # we have a hit, dump and run 2252 cache.dump() cache = __main__.Cache instance, cache.open = bound method Cache.open of __main__.Cache instance /srv/darcsweb/darcsweb.cgi in open(self=__main__.Cache instance) 466 pid = str(os.getpid()) 467 fname = self.basedir + '/.' + self.fname + '-' + pid 468 self.file = open(fname, 'w') 469 self.mode = 'w' 470 self = __main__.Cache instance, self.file = None, builtin open = type 'file', fname = '/tmp/darcsweb-cache/.3647210cedbbeff551e4ffe8dac1328a00518335-30974' IOError: [Errno 2] No such file or directory: '/tmp/darcsweb-cache/.3647210cedbbeff551e4ffe8dac1328a00518335-30974' args = (2, 'No such file or directory') errno = 2 filename = '/tmp/darcsweb-cache/.3647210cedbbeff551e4ffe8dac1328a00518335-30974' strerror = 'No such file or directory' ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)
Look at http://sneezy.cs.nott.ac.uk/fun/feb-07/jeremy-slides.pdf and http://article.gmane.org/gmane.comp.lang.haskell.cafe/27062 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: anybody can tell me the pronuncation of
I didn't know Haskell was an English name. There's a Haskell playing for England at Twickenham on Saturday. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: ANN: A triple of new packages for talking tothe outside world
Adam Langley agl at imperialviolet.org writes: BitGet is just an API RFC at the moment, so I'm just describing it here - not trying to justify it. In BitGet there's getAsWord[8|16|32|64] which take a number of bits ($n$) and returns the next $n$ bits in the bottom of a Word$x$. Thus, getAsWord8 is what you call getBits and, if you had a 48 bit number, you could use getAsWord64 and the bottom 48-bits of the resulting Word64 would be what you want. Equally, asking for more than $x$ bits when calling getAsWord$x$ is a mistake, however I don't check for it in the interest of speed. There are also get[Left|Right]ByteString which return the next $n$ bits in a ByteString of Word8's. The padding is either at the end of the last byte (left aligned) or at the beginning of the first byte (right aligned). Ok so I should be doing something like this. I'm not clear what happens if you are reading from a socket and not all the input has arrived but I'll think about that over the weekend. Another thought: could e.g. getRightByteString be in the IO monad and then I don't have to run the Get(?) monad? Or is that a really stupid question? Dominic. import qualified Data.ByteString as B import Data.Word import IO import qualified Data.Binary.Strict.BitGet as BG test = do h - openFile foobarbaz ReadMode b - B.hGetContents h let ebms = test2 b case ebms of Left s- return s Right bms - return (concat ((map (show . B.unpack) bms))) test1 = do bm1 - BG.getRightByteString 2 bm2 - BG.getRightByteString 2 return [bm1,bm2] test2 bs = BG.runBitGet bs test1 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: ANN: A triple of new packages for talking tothe outside world
Adam Langley agl at imperialviolet.org writes: On Jan 10, 2008 10:45 AM, Don Stewart dons at galois.com wrote: That's pretty much what we envisaged as the approach to take. Monad transformers adding some bit-buffer state over Get/Put. For anyone who's still reading this thread... I've just uploaded[1] binary-strict 0.2.1 which includes Data.Binary.Strict.BitGet - a Get like monad which works by the bit. I'm afraid that Haddock 2 is choaking on {-# UNPACK #-}, so I don't have the HTML documentation to point to. (And I thought that Haddock 2 was going to fix all those parsing issues :( - hopefully I'm just doing something stupid). [1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-strict-0.2.1 AGL Thanks for taking the time on this. The old NewBinary had NewBinary.Binary.getBits :: NewBinary.Binary.BinHandle - Int - IO GHC.Word.Word8 which allowed you to do things like tlv_ bin = do tagValueVal - getBits bin 5 tagConstructionVal - getBits bin 1 tagTypeVal - getBits bin 2 I'm sure I'm wrong but putting bits into [Bool] doesn't look very efficient. Of course, NewBinary didn't address what happened for n = 8. Some possibilities are a) not allowing more than 8 b) returning [Word8] or c) (which I thought was where we'd go) a ByteString with some sort of padding. Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: Haskell Cryptographic Library 4.1.0
I'd like to announce the release of a new version of the library following various contributions (contributors are bcc'd). Additions include: BubbleBabble, TEA, HMAC and more large word support. It no longer includes Base64. This is provided by http://hackage.haskell.org/cgi-bin/hackage-scripts/package/dataenc-0.10.1. Many thanks to all contributors. Dominic. PS I always mention this but the library really needs to be reviewed holistically and possibly restructured given the advent of bytestrings. If anyone would like to volunteer to do this or take over as library maintainer, please let me know. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: ANN: A triple of new packages for talking to the outside world
Adam Langley agl at imperialviolet.org writes: But if this is useful to you, make any requests. I'll (hopefully) do them, clean it up and push a new release of binary-strict. How difficult would it be to have a getBits functions as well as a getBytes? That would allow me drop the dependency on NewBinary in the ASN.1 package. Thanks, Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: ANN: A triple of new packages for talking tothe outside world
Duncan Coutts duncan.coutts at worc.ox.ac.uk writes: On Wed, 2008-01-09 at 09:26 +, Dominic Steinitz wrote: Adam Langley agl at imperialviolet.org writes: But if this is useful to you, make any requests. I'll (hopefully) do them, clean it up and push a new release of binary-strict. How difficult would it be to have a getBits functions as well as a getBytes? That would allow me drop the dependency on NewBinary in the ASN.1 package. The difficulty is in deciding what the api should be. Does it give you a real bitstream or only a byte aligned one? If I ask for 3 bits then 15 bytes what does it do? Does it assume I meant 3 bits, then pad to the next byte boundary and get 15 bytes, or does it mean get 15 bytes but at this 3 bit shift offset? Duncan I'd suggest an aligned and unaligned api. So the aligned api would get 3 bits and the 15 bytes would start from the next byte boundary. The unaligned api would get 3 bits and the 15 bytes (=15 x 8 bits) would finish still with an offset of 3. Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Basic question concerning the category Hask (was: concerning data constructors)
Jonathan Cast jonathanccast at fastmail.fm writes: Extensionality is a key part of the definition of all of these constructions. The categorical rules are designed to require, in concrete categories, that the range of the two injections into a coproduct form a partition of the coproduct, the surjective pairing law (fst x, snd x) = x holds, and the eta reduction law (\ x - f x) = f holds. Haskell flaunts all three; while some categories have few enough morphisms to get away with this (at least some times), Hask is not one of them. That interpretation is not something that is essential in the notion of category, only in certain specific examples of categories that you know. I understand category theory. I also know that the definitions used are chosen to get Set `right', which means extensionality in that case, and are then extended uniformly across all categories. This has the effect of requiring similar constructions to those in Set in other concrete categories. Referring to my copy of Sheaves in Geometry and Logic, Moerdijk and Mac Lane state that in 1963 Lawvere embarked on the daring project of a purely categorical foundation of all mathematics. Did he fail? I'm probably misunderstanding what you are saying here but I didn't think you needed sets to define categories; in fact Set is a topos which has far more structure than a category. Can you be clearer what you mean by extensionality in this context? And how it relates to Set? On a broader note, I'm pleased that this discussion is taking place and I wish someone would actually write a wiki page on why Haskell isn't a nicely behaved category and what problems this causes / doesn't cause. I wish I had time. Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Foldable Rose Trees
I've been trying to re-label nodes in a rose tree without re-inventing wheels (although I'm beginning to wish I had). I've got as far as this but haven't yet cracked the general case for Traversable. Any help would be much appreciated. Thanks, Dominic. *Main let (p,_) = runState (unwrapMonad (traverse (\x - WrapMonad update) (Rose' 3 [Rose' 5 [Rose' 11 [Rose' 19 []], Rose' 13 [], Rose' 17[]], Rose' 7 []]))) 0 in p Rose' 0 [Rose' 1 [Rose' 2 [Rose' 3 []],Rose' 4 [],Rose' 5 []],Rose' 6 []] import Control.Applicative import Data.Foldable import Data.Traversable import Data.Monoid import Control.Monad.State update :: MonadState Int m = m Int update = do x - get put (x + 1) return x data Rose' a = Rose' a [Rose' a] deriving Show instance Functor Rose' where fmap f (Rose' x rs) = Rose' (f x) (map (fmap f) rs) instance Foldable Rose' where foldMap f (Rose' x rs) = f x `mappend` (mconcat (map (foldMap f) rs)) instance Traversable Rose' where traverse f (Rose' x []) = Rose' $ f x * pure [] traverse f (Rose' x [x0]) = Rose' $ f x * (pure (\x - [x]) * traverse f x0) traverse f (Rose' x [x0,x1]) = Rose' $ f x * (pure (\x y - x:y:[]) * traverse f x0 * traverse f x1) traverse f (Rose' x [x0,x1,x2]) = Rose' $ f x * (pure (\x y z - x:y:z:[]) * traverse f x0 * traverse f x1 * traverse f x2) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Foldable Rose Trees
Solution 1) Data.Tree is already an instance of Traversable. :) Yes it's all there but I would have missed the fun of trying to do it myself ;-) Plus the data structure I actually want to re-label isn't quite a rose tree. Solution 2) The key observation is that you the instances for rose trees can/should be bootstrapped from corresponding instances for lists []. With this, we have instance Functor Rose' where fmap f (Rose' x rs) = Rose' (f x) (map (fmap f) rs) fmap f (Rose' x rs) = Rose' (f x) (fmap (fmap f) rs) (fmap instead of map to highlight the general structure) instance Foldable Rose' where foldMap f (Rose' x rs) = f x `mappend` (mconcat (map (foldMap f) rs)) foldMap f (Rose' x rs) = f x `mappend` (foldMap (foldMap f) rs) Interesting - I hadn't twigged that they were the same modulo instantiation for []. ((.).(.)) mconcat map :: forall a b. (Monoid b) = (a - b) - [a] - b *Main :t foldMap foldMap :: forall a m (t :: * - *). (Monoid m, Foldable t) = (a - m) - t a - m instance Traversable Rose' where traverse f (Rose' x []) = Rose' $ f x * pure [] traverse f (Rose' x [x0]) = Rose' $ f x * (pure (\x - [x]) * traverse f x0) traverse f (Rose' x [x0,x1]) = Rose' $ f x * (pure (\x y - x:y:[]) * traverse f x0 * traverse f x1) traverse f (Rose' x [x0,x1,x2]) = Rose' $ f x * (pure (\x y z - x:y:z:[]) * traverse f x0 * traverse f x1 * traverse f x2) traverse f (Rose' x xs) = Rose' $ f x * traverse (traverse f) xs And then this becomes something you might guess. *Main let (p,_) = runState (unwrapMonad (traverse (\x - WrapMonad update) (Rose' 3 [Rose' 5 [Rose' 11 [Rose' 19 []], Rose' 13 [], Rose' 17[]], Rose' 7 []]))) 0 in p Rose' 0 [Rose' 1 [Rose' 2 [Rose' 3 []],Rose' 4 [],Rose' 5 []],Rose' 6 []] This can be made shorter: Data.Traversable.mapM m = unwrapMonad . traverse . (\x - WrapMonad (m x)) Your help as ever is excellent. Many thanks, Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Questions about the Functor class and it's use in Data types à la carte
keep in mind that Haskell composition (.) is not really composition in the category-theoretic sense, because it adds extra laziness. Use this Do you have a counter-example of (.) not being function composition in the categorical sense? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Questions about the Functor class and it's use in Data types à la carte
Do you have a counter-example of (.) not being function composition in the categorical sense? Let bot be the function defined by bot :: alpha - beta bot = bot By definition, (.) = \ f - \ g - \ x - f (g x) Then bot . id = ((\ f - \ g - \ x - f (g x)) bot) id = (\ g - \ x - bot (g x)) id = \ x - bot (g x) I didn't follow the reduction here. Shouldn't id replace g everywhere? This would give = \x - bot x and by eta reduction = bot which /= bot since (seq bot () = bot) but (seq (\ x - M) () = ()) regardless of what expression we substitute for M. Why is seq introduced? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Questions about the Functor class and it's use in Data types à la carte
Roberto Zunino wrote: Dominic Steinitz wrote: This would give = \x - bot x and by eta reduction This is the point: eta does not hold if seq exists. undefined `seq` 1 == undefined (\x - undefined x) `seq` 1 == 1 Ok I've never used seq and I've never used unsavePerformIO. Provided my program doesn't contain these then can I assume that eta reduction holds and that (.) is categorical composition? The (.) does not form a category argument should be something like: id . undefined == (\x - id (undefined x)) /= undefined where the last inequation is due to the presence of seq. That is, without seq, there is no way to distinguish between undefined and (const undefined), so you could use a semantic domain where they coincide. In that case, eta does hold. It would be a pretty odd semantic domain where 1 == undefined. Or perhaps, I should say not a very useful one. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Questions about the Functor class and it's use in Data types à la carte
Jonathan Cast wrote: On 16 Dec 2007, at 3:21 AM, Dominic Steinitz wrote: Do you have a counter-example of (.) not being function composition in the categorical sense? Let bot be the function defined by bot :: alpha - beta bot = bot By definition, (.) = \ f - \ g - \ x - f (g x) Then bot . id = ((\ f - \ g - \ x - f (g x)) bot) id = (\ g - \ x - bot (g x)) id = \ x - bot (g x) I didn't follow the reduction here. Shouldn't id replace g everywhere? Yes, sorry. This would give = \x - bot x and by eta reduction This is the point --- by the existence of seq, eta reduction is unsound in Haskell. Am I correct in assuming that if my program doesn't contain seq then I can reason using eta reduction? Why is seq introduced? Waiting for computers to get fast enough to run Haskell got old. I'm guessing you were not being entirely serious here but I think that's a good answer. Oh, you mean here? Equality (=) for pickier Haskellers always means Leibnitz' equality: Given x, y :: alpha x = y if and only if for all functions f :: alpha - (), f x = f y f ranges over all functions definable in Haskell, (for some version of the standard), and since Haskell 98 defined seq, the domain of f includes (`seq` ()). So since bot and (\ x - bot x) give different results when handed to (`seq` ()), they must be different. The `equational reasoning' taught in functional programming courses is unsound, for this reason. It manages to work as long as everything terminates, but if you want to get picky you can find flaws in it (and you need to get picky to justify extensions to things like infinite lists). Reasoning as though you were in a category with a bottom should be ok as long as seq isn't present? I'm recalling a paper by Freyd on CPO categories which I can't lay my hands on at the moment or find via a search engine. I suspect Haskell (without seq) is pretty close to a CPO category. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] A Random Question
I need to generate distinct arbitrary values for my quickcheck tests and they don't have to be arbitrary (although that doesn't matter). No problem I thought, I'll create my own random number generator (which will not be random at all) and use choose :: forall a. (Random a) = (a, a) - Gen a Here's my code: import Test.QuickCheck import System.Random data MyGen = MyGen Int deriving (Eq, Show) myNext :: MyGen - (Int, MyGen) myNext (MyGen s1) = (s1, MyGen (s1 + 1)) -- Assume we will never need this mySplit :: MyGen - (MyGen, MyGen) mySplit = error No split for predictable random generator myGenRange :: MyGen - (Int, Int) myGenRange (MyGen s1) = (s1, s1) instance RandomGen MyGen where next = myNext split= mySplit genRange = myGenRange data Foo = Foo Int deriving (Eq, Show) myRandomR :: (Foo, Foo) - MyGen - (Foo, MyGen) myRandomR (Foo lo, Foo hi) g = let (n, g') = next g in (Foo n, g') instance Random Foo where randomR = myRandomR random = undefined But I get Supply.hs:33:13: Couldn't match expected type `g' against inferred type `MyGen' `g' is a rigid type variable bound by the type signature for `randomR' at no location info Expected type: (Foo, Foo) - g - (Foo, g) Inferred type: (Foo, Foo) - MyGen - (Foo, MyGen) In the expression: myRandomR In the definition of `randomR': randomR = myRandomR Failed, modules loaded: none. I have two questions: 1. Why can't I instantiate a type class with any function I like provided it fits the type signature? 2. Is this the right approach to generating predictable arbitrary values? Are there others? Thanks, Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] A Random Question
What do you need, i.e., what meaning do you attribute to the words predictable and arbitrary? Apologies - I didn't explain my problem clearly. I want to say something like: instance Arbitrary Foo where arbitrary = choose (Foo 1, Foo 5) but the random values are generated by my own random number generator not the standard one. Does that make sense? The reason I'm trying to do this is I am generating random test data but some of it needs to be predictable. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] A Random Question
Paul Johnson wrote: Dominic Steinitz wrote: Unfortunately for your purpose you would need: *generate* :: (RandomGen g) = Int http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Int.html#t%3AInt - g - Gen http://www.haskell.org/ghc/docs/latest/html/libraries/QuickCheck/Test-QuickCheck.html#t%3AGen a - a Thanks - rather what I thought. This seems to do the trick using a state monad but it doesn't look pretty. import Test.QuickCheck import Control.Monad.State data Baz = Baz String Int deriving (Eq, Show) g :: MonadState Int m = m (Gen Int) g = do x - get put (x + 1) return (return x) f :: MonadState Int m = Int - m (Gen [Baz]) f 0 = return (return []) f n = do x - g xs - f (n - 1) let z = do u - x us - xs v - arbitrary return ((Baz (t ++ (show u)) v):us) return z *Main let (q,p) = runState (f 10) 1 in sample q [Baz t1 (-1),Baz t2 0,Baz t3 0,Baz t4 (-1),Baz t5 1,Baz t6 1,Baz t7 1,Baz t8 1,Baz t9 1,Baz t10 1] [Baz t1 0,Baz t2 2,Baz t3 (-2),Baz t4 (-2),Baz t5 (-1),Baz t6 0,Baz t7 1,Baz t8 2,Baz t9 (-2),Baz t10 (-2)] This gives me what I wanted: distinct (and in this case predictable) names and random values. Take a look at SmallCheck. It might be more suited to your requirement anyway. I will do so now. Thanks, Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: MD5?
Neil Mitchell ndmitchell at gmail.com writes: Hi The final alternative is that I just call MD5SUM.EXE from my Haskell program and try to parse the output. But that strikes me as rather messy. Messy, but I don't see any disadvantage to doing it this way - if you can control that the MD5SUM program is installed alongside your code. Of course, there is the standard Crypto library for Haskell, http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Crypto-3.0.3 - either: 1) it goes fast enough 2) it goes too slow and someone should make it go faster Either way, it should go fast enough as soon as someone needs it to go faster. Thanks Neil Of course the code in the Crypto library isn't fast enough. I maintain the package but at the moment I don't have any time to do anything with it. If anyone wants to send me patches, I will happily apply them. I did have a quick look a Thomas DuBuisson's code and it looks like a change to the API. If there is going to be change to this then I think it ought to go via the libraries change process. I recall that someone improved the performance of SHA-1 as well but again I haven't had time to do anything with it. If anyone wants to take over the care and nurture of the Crypto library then they are most welcome and I would be very grateful. Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Function composition
Look at the type of (.).(.).(.) Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: The Exp - Term a problem (again), how to dynamically create (polymorphic) typed terms in Haskell ??
Did you look at Ralf Hinze's paper Fun with Phantom Types? Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Extract source code from literate Haskell (LHS) files
Peter Verswyvelen bf3 at telenet.be writes: to do manually, but does a command line tool exist for extracting source code from literate Haskell files? Thanks, Peter lhs2tex will do this for you. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Very crazy
Andrew Coppin andrewcoppin at btinternet.com writes: I just found it rather surprising. Every time *I* try to compose with functions of more than 1 argument, the type checker complains. Specifically, suppose you have foo = f3 . f2 . f1 Assuming those are all 1-argument functions, it works great. But if f1 is a *two* argument function (like map is), the type checker refuses to allow it, and I have to rewrite it as foo x y = f3 $ f2 $ f1 x y Look at the type of (.).(.) which should tell you how to compose functions with more than one variable. Mind you, I don't think it improves readability. Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Library Process (was Building production stable software in Haskell)
This discussion has sparked a question in my mind: What is the process for the inclusion of modules / packages in ghc, hugs and other compilers interpreters? I thought the master plan was that less would come with the compiler / interpreter and the user would install packages using cabal. I was thus mildly surprised earlier this year to find e.g. data.bytestring was included with ghc. Now that I look at the haddock, it says this is a base package but doesn't say anything about its status. On the other hand, there are lots of modules that are base packages that are experimental. Should something experimental be a base package? And shouldn't all modules that are base packages declare their status? Perhaps these are questions for the libraries mailing list but I thought I'd start here. Yours confused of Kingston. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Sequencing Operations in a Monad
If you arrange the types to try to do all the operations inside the IO monad you can't chain together more than 1 binary operation. eg. do S - A + B Z - Q * S vs do S - Q * (A + B) Are there any suggestions for this dilemma? Am I using the wrong monad for this task? I'm not sure if this is what you are asking but isn't liftM2 or some variant what you need? Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ICMP in Haskell (was Elevator pitch for Haskell)
Does it enable you to, say, send raw ICMP packets? AFAIK, Haskell supports TCP, and nothing else. (A while back I wanted to write an automated pinging program. But the only way I could figure out how to do it is to call the OS ping utility and attempt to parse what it writes to stdout. Oh, did I mention that's different on WinNT, WinXP and UNIX?) Andrew, I thought this was relatively straightforward. Look in http://www.haskell.org/networktools/src for multi-threaded versions. Beware I wrote ping and traceroute about 5 years ago. They're pretty much straight from Stevens' book. On the other hand, I quite liked this: sequenceWhile_ :: Monad m = (a - Bool) - [m a] - m () sequenceWhile_ p [] = return () sequenceWhile_ p (x:xs) = x = \c - if (p c) then sequenceWhile_ p xs else return () I'd forgotten about them and I'm not particularly proud of them. I guess I could put them in hackage so that they are at least a starting point for someone. Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe