Re: [Haskell-cafe] Installation of Haskell Platform on CentOS 5.5
Tristan Ravitch travi...@cs.wisc.edu writes: The ghc7 binaries are compiled against a newer version of glibc than is available on RHEL/CentOS. It works fine if you compile ghc7 from source yourself (you can use 6.12 for that). Did it? I tried to do that, but I got errors about needing -fPIC. I tried to mess with CFLAGS, but couldn't make it work out. According to somebody on #haskell (I apologize for forgetting whom), the problem was really a too old GCC version. -k -- If I haven't seen further, it is by standing in the footprints of giants ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Installation of Haskell Platform on CentOS 5.5
*** GHC 7 The ghc7 binaries are compiled against a newer version of glibc than is available on RHEL/CentOS. It works fine if you compile ghc7 from source yourself (you can use 6.12 for that). | Did it? I tried to do that, but I got errors about needing -fPIC. I | tried to mess with CFLAGS, but couldn't make it work out. According to | somebody on #haskell (I apologize for forgetting whom), the problem was | really a too old GCC version. It's a shame it's so hard to setup Haskell on CentOS. I guess compiling GHC 7 from source takes a lot of time (?). It would be nice to know if anyone at all has managed. *** HASKELL PLATFORM Building /usr/haskell-platform-2010.2.0.0/bin/ghc --make Setup -o Setup -package Cabal-1.8.0.6 Linking Setup ... collect2: ld terminated with signal 15 [Terminated] Error: Compiling the Setup script failed make: *** [build.stamp] Error 2 Does anyone know why the Haskell Platform won't install though? 2010.2.0.0 should work with GHC 6.12. The collect2: ld error message above gives no meaning to me. Has anyone succeeded installing the Haskell Platform on CentOS 5.5? [k] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] order of arguments matters
Why does only tr2 work, although the only difference between tr1 and tr2 is the order of arguments? import Data.Tree (Tree(..)) data Type a where Tree:: Type a - Type (Tree a) Int :: Type Int String :: Type String type Traversal1 = forall a.a - Type a - a type Traversal2 = forall a.Type a - a - a tr1 :: Traversal1 tr1 (Node _ (t:_)) (Tree Int) = Node 1 [t] tr1 n Int = n+n tr1 s String = s++s tr2 :: Traversal2 tr2 (Tree Int) (Node _ (t:_)) = Node 1 [t] tr2 Int n = n+n tr2 String s = s++s Couldn't match expected type `a' against inferred type `Tree Int' `a' is a rigid type variable bound by the type signature for `tr1' at tratest.hs:9:25 In the pattern: Node _ (t : _) In the definition of `tr1': tr1 (Node _ (t : _)) (Tree Int) = Node 1 [t] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Installation of Haskell Platform on CentOS 5.5
*** CABAL By the way, I encounter the same error when trying to install Cabal manually: [1 of 1] Compiling Main ( Setup.lhs, Setup.o ) Linking Setup ... collect2: ld terminated with signal 15 [Terminated] Error during cabal-install bootstrap: Compiling the Setup script failed [k] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] tplot and splot - analyst's swiss army knifes for visualizing log files
Hello Ferenc, Thank you for reporting the bug - it's very curious, I will look into it in the nearest couple of days. Could you please send me privately the actual input file on which the program crashes? I have added a downloadable link to the presentation to all places where the slideshare link was present (finally making some use of my hosting...). Here it is: http://jkff.info/presentations/two-visualization-tools.pdf 2011/3/17 Ferenc Wagner wf...@niif.hu: Eugene Kirpichov ekirpic...@gmail.com writes: 2010/12/17 Henning Thielemann schlepp...@henning-thielemann.de: Eugene Kirpichov schrieb: I've published a large presentation about two Haskell-based tools of mine - tplot and splot. Their motto is visualize system behavior from logs with a shell one-liner. Based on my experience, they usually seem to live up to this motto. http://www.slideshare.net/jkff/two-visualization-tools [attention attractor: the presentation has *really a lot* of pictures] ... and complete TeX code attached! :-) However can I also view a simple PDF document of the presentation? You can download the PDF here - http://www.slideshare.net/jkff/two-visualization-tools/download (however one has to be logged in to Slideshare, for example with a facebook acct., for this link to work) Just in case, I'm also attaching a PDF of the current version to this email, but visiting the link is preferable, since I'll be updating the contents. Please, if at all possible, link an up-to-date downloadable PDF from the documentation (http://hackage.haskell.org/package/timeplot) or from the homepage (http://haskell.org/haskellwiki/Timeplot) to make our life easier! Anyway, your tools look very interesting, I gave tplot a shot. Unfortunately, I hit various strange failures: $ head -4 or.log Mar 8 18:55:11 =overrun 1 Mar 8 18:55:13 =overrun 6 Mar 8 18:55:15 =overrun 13 Mar 8 18:55:16 =overrun 3 $ wc -l or.log 466 or.log $ ls -l or.log overruns466.log lrwxrwxrwx 1 wferi wferi 15 Mar 17 14:45 or.log - overruns466.log -rw-rw-r-- 1 wferi wferi 12587 Mar 17 14:35 overruns466.log $ tplot -if or.log -tf 'date %b %e %T' -o overruns.png -k 'overrun' 'sum 10' This worked just fine. However, when given the same file with a longer name, tplot does not terminate: $ tplot -if overruns466.log -tf 'date %b %e %T' -o overruns.png -k 'overrun' 'sum 10' ^C while doing the same the other way around still works: $ cat overruns466.log | tplot -if - -tf 'date %b %e %T' -o overruns.png -k 'overrun' 'sum 10' Choosing any other extension (svg, pdf or ps) also results in nontermination (or at least unbearable runtime and memory consumption). Adding a simple no-op statement, like: diff -ur ../timeplot-0.2.19/Tools/TimePlot.hs ./Tools/TimePlot.hs --- ../timeplot-0.2.19/Tools/TimePlot.hs 2011-03-09 11:36:24.0 +0100 +++ ./Tools/TimePlot.hs 2011-03-17 16:42:57.247625607 +0100 @@ -627,6 +627,7 @@ when (null args || args == [--help]) $ showHelp exitSuccess case (readConf args) of Conf conf - do + putStr let render = case (outFormat conf) of { PNG - \c w h f - const () `fmap` renderableToPNGFile c w h f; PDF - renderableToPDFFile ; also results in nontermination, even in the previously working case. Something is clearly wrong here, seemingly in the runtime IO system. -- Thanks, Feri. GHC 6.12.1 Chart-0.14 bytestring-0.9.1.5 bytestring-lexing-0.2.1 cairo-0.11.0 colour-2.3.1 containers-0.3.0.0 data-accessor-0.2.1.3 data-accessor-template-0.2.1.7 haskell98-1.0.1.1 regex-tdfa-1.1.4 strptime-1.0.1 time-1.1.4 -- Eugene Kirpichov Principal Engineer, Mirantis Inc. http://www.mirantis.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] DSL for task dependencies
I've always liked the semantics of Unity - they seem the right sort of thing to construct such a system on - they also permit concepts such as partial completion and recovery from failure. Used to use this as one of the concurrency models I taught - see http://www.amazon.com/Parallel-Program-Design-Mani-Chandy/dp/0201058669 . It is one of those friday afternoon thoughts about constructing distributed, fault tolerant systems that have formal semantics, can have a rich set of pre/post conditions so that 'average joe' could write script-lets in it and it could take over the monitoring and (normal) fault management of some of our distributed systems. On 18 Mar 2011, at 04:43, Conal Elliott wrote: Speaking of which, for a while now I've been interested in designs of make-like systems that have precise simple (denotational) semantics with pleasant properties. What Peter Landin called denotative (as opposed to functional-looking but semantically ill- defined or intractable). Norman Ramsey (cc'd) pointed me to the Vesta system from DEC SRC. If anyone knows of other related experiments, I'd appreciate hearing. - Conal On Thu, Mar 17, 2011 at 1:31 PM, David Peixotto d...@rice.edu wrote: Hi Serge, You may be thinking of the Shake DSL presented by Neil Mitchell at last years Haskell Implementers Workshop. Slides and video are available from: http://haskell.org/haskellwiki/HaskellImplementorsWorkshop/2010 Max Bolingbroke has an open source implementation available here: https://github.com/batterseapower/openshake Hope that helps. -David On Mar 17, 2011, at 3:00 PM, Serge Le Huitouze wrote: Hi Haskellers! I think I remember reading a blog post or web page describing a EDSL to describe tasks and their dependencies a la make. Can anyone point me to such published material? Thanks in advance. --serge ___ 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] order of arguments matters
I believe this is caused by type equalities that are introduced by the Type a argument. In tr2 you get something like a ~ Int or a ~ String, allowing the function to type check. In tr1 that equality is never introduced so the type checker thinks a and Int are distinct types. But I'm sure someone else can provide a better (more correct) explanation. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Data constructor synonyms
Hello! Assume I have a type MyType with the constructor GeneralConstructor: data MyType = GeneralConstructor [Double] but I also want to have a separate name for special case of this constructor: SpecialConstructor Double so SpecialConstructor a = GeneralConstructor (a:[]) that is SpecialConstructor 5 was exactly the same as GeneralConstructor [5]. And for example instead of writing GeneralConstructor [0] I would like to use constructor Zero. It's all just for convenience. How can I achieve this? Well, of course I always can use sed to replace SpecialConstructor 5 with GeneralConstructor [5] in program sources, but it's not convenient. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] order of arguments matters
I checked out the GHC documentation on the GADTs extension [1]: The key point about GADTs is that pattern matching causes type refinement. So in tr2 (Tree Int) (Node _ (t:_)) = Node 1 [t] the 'a' in 'Type a' is refined to 'Type (Tree a)'. But in tr1 (Node _ (t:_)) (Tree Int) = Node 1 [t] you want to generalise the type 'Tree a' to 'Type (Tree a)', which is not possible. 1 - http://www.haskell.org/ghc/docs/7.0-latest/html/users_guide/data-type-extensions.html#gadt ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Data constructor synonyms
Remember that constructors are functions, except that you can't pattern match against them. data MyType = GeneralConstructor [Double] -- GeneralConstructor :: [Double] - MyType Note the lower case character, just a plain function: specialConstructor :: Double - MyType specialConstructor a = GeneralConstructor (a:[]) zero :: MyType zero = GeneralConstructor [0] The downside is that you can't pattern-match against these functions. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] tplot and splot - analyst's swiss army knifes for visualizing log files
Eugene Kirpichov ekirpic...@gmail.com writes: 2011/3/17 Ferenc Wagner wf...@niif.hu: Eugene Kirpichov ekirpic...@gmail.com writes: 2010/12/17 Henning Thielemann schlepp...@henning-thielemann.de: Eugene Kirpichov schrieb: I've published a large presentation about two Haskell-based tools of mine - tplot and splot. Their motto is visualize system behavior from logs with a shell one-liner. Based on my experience, they usually seem to live up to this motto. http://www.slideshare.net/jkff/two-visualization-tools [attention attractor: the presentation has *really a lot* of pictures] ... and complete TeX code attached! :-) However can I also view a simple PDF document of the presentation? You can download the PDF here - http://www.slideshare.net/jkff/two-visualization-tools/download (however one has to be logged in to Slideshare, for example with a facebook acct., for this link to work) Just in case, I'm also attaching a PDF of the current version to this email, but visiting the link is preferable, since I'll be updating the contents. Please, if at all possible, link an up-to-date downloadable PDF from the documentation (http://hackage.haskell.org/package/timeplot) or from the homepage (http://haskell.org/haskellwiki/Timeplot) to make our life easier! Anyway, your tools look very interesting, I gave tplot a shot. Unfortunately, I hit various strange failures: $ head -4 or.log Mar 8 18:55:11 =overrun 1 Mar 8 18:55:13 =overrun 6 Mar 8 18:55:15 =overrun 13 Mar 8 18:55:16 =overrun 3 $ wc -l or.log 466 or.log $ ls -l or.log overruns466.log lrwxrwxrwx 1 wferi wferi 15 Mar 17 14:45 or.log - overruns466.log -rw-rw-r-- 1 wferi wferi 12587 Mar 17 14:35 overruns466.log $ tplot -if or.log -tf 'date %b %e %T' -o overruns.png -k 'overrun' 'sum 10' This worked just fine. However, when given the same file with a longer name, tplot does not terminate: $ tplot -if overruns466.log -tf 'date %b %e %T' -o overruns.png -k 'overrun' 'sum 10' ^C while doing the same the other way around still works: $ cat overruns466.log | tplot -if - -tf 'date %b %e %T' -o overruns.png -k 'overrun' 'sum 10' Choosing any other extension (svg, pdf or ps) also results in nontermination (or at least unbearable runtime and memory consumption). Adding a simple no-op statement, like: diff -ur ../timeplot-0.2.19/Tools/TimePlot.hs ./Tools/TimePlot.hs --- ../timeplot-0.2.19/Tools/TimePlot.hs 2011-03-09 11:36:24.0 +0100 +++ ./Tools/TimePlot.hs 2011-03-17 16:42:57.247625607 +0100 @@ -627,6 +627,7 @@ when (null args || args == [--help]) $ showHelp exitSuccess case (readConf args) of Conf conf - do + putStr let render = case (outFormat conf) of { PNG - \c w h f - const () `fmap` renderableToPNGFile c w h f; PDF - renderableToPDFFile ; also results in nontermination, even in the previously working case. Something is clearly wrong here, seemingly in the runtime IO system. [...] Thank you for reporting the bug - it's very curious, I will look into it in the nearest couple of days. Great, thanks! Could you please send me privately the actual input file on which the program crashes? Well, it compresses to 1511 bytes, so I risk attaching it here for simplicity. I have added a downloadable link to the presentation to all places where the slideshare link was present (finally making some use of my hosting...). Here it is: http://jkff.info/presentations/two-visualization-tools.pdf Wonderful, thanks a lot! -- Regards, Feri. overruns466.log.gz Description: Binary data ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Could not deduce ... using functional dependencies with GHC7
Hi, can you elaborate a bit? What is Id and what is (Sig id) and IdSig in your example? Can you reproduce an example that you believe should compile but doesn't? thanks d- -Original Message- From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org] On Behalf Of JP Moresmau Sent: 16 March 2011 21:46 To: Haskell Cafe Subject: [Haskell-cafe] Could not deduce ... using functional dependencies with GHC7 Hello, when moving to GHC7 a body of code that I'm not immensely familiar with, I got an error compiling with GHC 7.0.2. Can somebody kindly explain to me what it means and how to get around it? This is in the scion code base so is using some GHC types. I have a class with a functional dependency (I think :-p): class Search id a | a - id where search :: (SrcSpan - Bool) - SrcSpan - a - SearchResults id And some instances, notably: instance Search Id Id where search _ _ i = only (FoundId i) And the error occurs on another instance: instance (Search id id) = Search id (Sig id) where search p s (IdSig i) = search p s i ... other cases here, that work The error is: Could not deduce (id ~ Id) from the context (Search id id) bound by the instance declaration at lib\Scion\Inspect\Find.hs:477:10-45 `id' is a rigid type variable bound by the instance declaration at lib\Scion\Inspect\Find.hs:477:18 When using functional dependencies to combine Search Id Id, arising from the dependency `a - id' in the instance declaration at lib\Scion\Inspect\Find.hs:183:10 Search id Id, arising from a use of `search' at lib\Scion\Inspect\Find.hs:479:32-37 In the expression: search p s i In an equation for `search': search p s (IdSig i) = search p s i If I replace the call to search with the actual implementation of search for Id, it compiles, so at some level the code makes sense. I much prefer when error messages end with Possible fix:...! Thanks! -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Could not deduce ... using functional dependencies with GHC7
These are GHC types, but here is a self-contained example: {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances #-} data Id=Id String data Result id =ResultId Id | ResultGen id data Sig id=IdSig Id | SigGen id class Search id a | a - id where search :: a - Result id instance Search Id Id where search i = ResultId i instance (Search id id) = Search id (Sig id) where search (SigGen g) = search g search (IdSig i)= search i The last line fails. I don't understand why this doesn't compile. Thanks, JP On Fri, Mar 18, 2011 at 12:56 PM, Dimitrios Vytiniotis dimit...@microsoft.com wrote: Hi, can you elaborate a bit? What is Id and what is (Sig id) and IdSig in your example? Can you reproduce an example that you believe should compile but doesn't? thanks d- -Original Message- From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org] On Behalf Of JP Moresmau Sent: 16 March 2011 21:46 To: Haskell Cafe Subject: [Haskell-cafe] Could not deduce ... using functional dependencies with GHC7 Hello, when moving to GHC7 a body of code that I'm not immensely familiar with, I got an error compiling with GHC 7.0.2. Can somebody kindly explain to me what it means and how to get around it? This is in the scion code base so is using some GHC types. I have a class with a functional dependency (I think :-p): class Search id a | a - id where search :: (SrcSpan - Bool) - SrcSpan - a - SearchResults id And some instances, notably: instance Search Id Id where search _ _ i = only (FoundId i) And the error occurs on another instance: instance (Search id id) = Search id (Sig id) where search p s (IdSig i) = search p s i ... other cases here, that work The error is: Could not deduce (id ~ Id) from the context (Search id id) bound by the instance declaration at lib\Scion\Inspect\Find.hs:477:10-45 `id' is a rigid type variable bound by the instance declaration at lib\Scion\Inspect\Find.hs:477:18 When using functional dependencies to combine Search Id Id, arising from the dependency `a - id' in the instance declaration at lib\Scion\Inspect\Find.hs:183:10 Search id Id, arising from a use of `search' at lib\Scion\Inspect\Find.hs:479:32-37 In the expression: search p s i In an equation for `search': search p s (IdSig i) = search p s i If I replace the call to search with the actual implementation of search for Id, it compiles, so at some level the code makes sense. I much prefer when error messages end with Possible fix:...! Thanks! -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Could not deduce ... using functional dependencies with GHC7
On Fri, Mar 18, 2011 at 13:35, JP Moresmau wrote: These are GHC types, but here is a self-contained example: {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances #-} data Id=Id String data Result id =ResultId Id | ResultGen id data Sig id=IdSig Id | SigGen id class Search id a | a - id where search :: a - Result id instance Search Id Id where search i = ResultId i instance (Search id id) = Search id (Sig id) where search (SigGen g) = search g search (IdSig i)= search i The last line fails. I don't understand why this doesn't compile. This doesn't even work in GHC 6.12.3. The search call in the second case, IdSig, restricts the result to Result Id, which is less polymorphic than Result id. Either of the following are valid: instance Search Id (Sig Id) where search (SigGen g) = search g search (IdSig i)= search i instance (Search id id) = Search id (Sig id) where search (SigGen g) = search g Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Could not deduce ... using functional dependencies with GHC7
On Friday 18 March 2011 13:35:22, JP Moresmau wrote: These are GHC types, but here is a self-contained example: {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances #-} data Id=Id String data Result id =ResultId Id | ResultGen id data Sig id=IdSig Id | SigGen id class Search id a | a - id where search :: a - Result id instance Search Id Id where search i = ResultId i instance (Search id id) = Search id (Sig id) where search (SigGen g) = search g search (IdSig i)= search i The last line fails. I don't understand why this doesn't compile. In (IdSig i), i has type Id, hence search i :: Result Id but you want something of type `Result id'. Fortunately it's easy to transform, since search i is a ResultId, so instance (Search id id) = Search id (Sig id) where search (SigGen g) = search g search (IdSig i)= case search i of ResultId y - ResultId y _ - error foo compiles (and probably does what you want). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Data constructor synonyms
18.03.2011, 14:22, Roel van Dijk vandijk.r...@gmail.com;: Remember that constructors are functions, except that you can't pattern match against them. .. The downside is that you can't pattern-match against these functions. The thing is that I need pattern matching, just functions won't do. Anyway, a new question arose. If I have already declared a type, can I add new constructors to it from other modules? Maybe there are some GHC extensions to solve both these problems. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Could not deduce ... using functional dependencies with GHC7
Thanks to you all, I think I understand better. instance Search Id Id where search _ _ i = only (FoundId i) Is too restrictive on the first type, so declaring instead: instance Search id Id where search _ _ i = only (FoundId i) Fixed the issue!! Now the initial id is not Id and everybody is happy (and the code still seems to work as intended) thanks again JP On Fri, Mar 18, 2011 at 2:17 PM, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: On Friday 18 March 2011 13:35:22, JP Moresmau wrote: These are GHC types, but here is a self-contained example: {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances #-} data Id=Id String data Result id =ResultId Id | ResultGen id data Sig id=IdSig Id | SigGen id class Search id a | a - id where search :: a - Result id instance Search Id Id where search i = ResultId i instance (Search id id) = Search id (Sig id) where search (SigGen g) = search g search (IdSig i) = search i The last line fails. I don't understand why this doesn't compile. In (IdSig i), i has type Id, hence search i :: Result Id but you want something of type `Result id'. Fortunately it's easy to transform, since search i is a ResultId, so instance (Search id id) = Search id (Sig id) where search (SigGen g) = search g search (IdSig i) = case search i of ResultId y - ResultId y _ - error foo compiles (and probably does what you want). -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Data constructor synonyms
On 18 March 2011 13:31, Grigory Sarnitskiy sargrig...@ya.ru wrote: Anyway, a new question arose. If I have already declared a type, can I add new constructors to it from other modules? Maybe there are some GHC extensions to solve both these problems. no can do. There are ways to encode extensible types (e.g the finally tagless sytle), but on balance you are better to design extensibility for functions - easy to add more functions - than make your code much more complicated so it can be extensible for types. Parser combinators and pretty print combinators are great and largely simple examples of extensibility with functions. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Data constructor synonyms
Remember that constructors are functions, except that you can't pattern match against them. .. The downside is that you can't pattern-match against these functions. The thing is that I need pattern matching, just functions won't do. It's only a preprocessor, but Conor's she allows pattern synonyms: http://personal.cis.strath.ac.uk/~conor/pub/she Anyway, a new question arose. If I have already declared a type, can I add new constructors to it from other modules? Again, not within Haskell itself. she also has a feature that allows something like this. There are various other techniques or proposals. For example: http://www.cs.ru.nl/~wouters/Publications/DataTypesALaCarte.pdf http://people.cs.uu.nl/andres/OpenDatatypes.html Cheers, Andres ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Data constructor synonyms
You are better to use simple typeclasses. It depends on what you are trying to do, but when I want an open type, I use classes + type families. 2011/3/18 Stephen Tetley stephen.tet...@gmail.com On 18 March 2011 13:31, Grigory Sarnitskiy sargrig...@ya.ru wrote: Anyway, a new question arose. If I have already declared a type, can I add new constructors to it from other modules? Maybe there are some GHC extensions to solve both these problems. no can do. There are ways to encode extensible types (e.g the finally tagless sytle), but on balance you are better to design extensibility for functions - easy to add more functions - than make your code much more complicated so it can be extensible for types. Parser combinators and pretty print combinators are great and largely simple examples of extensibility with functions. ___ 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] Could not deduce ... using functional dependencies with GHC7
On Friday 18 March 2011 14:40:40, JP Moresmau wrote: Thanks to you all, I think I understand better. instance Search Id Id where search _ _ i = only (FoundId i) Is too restrictive on the first type, so declaring instead: instance Search id Id where search _ _ i = only (FoundId i) Not sure what GHC does with that, but at least in spirit that violates the FunDep of class Search id a | a - id where ... Even if it works now, it may well not work in the future. I'd go for a more stable solution respecting the intent of FunDeps (i.e. there should only be one type t with an instance Search t Id). Fixed the issue!! Now the initial id is not Id and everybody is happy (and the code still seems to work as intended) thanks again JP ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] trac.haskell.org problem
I've tried to send the verification e-mail from trac.haskell.org to three different e-mail accounts in the last 24 hours. None arrived. Note that I'm not trying to create a new account, I'm trying to verify my e-mail address in order to edit the Wiki pages of my projects. Can anybody else confirm this problem? Ah, I suppose that's to do with the trac server itself, that's beyond me. Moving to café: Does anyone know what's up with trac.haskell.org not sending out verification emails? Cheers, /Niklas From: Jurriaan Hage [jur at cs.uu.nl] Sent: Monday, February 28, 2011 8:41 AM To: Niklas Broberg Subject: Re: Again a question about haskell-src-exts. On Feb 28, 2011, at 8:39 AM, Niklas Broberg wrote: I suppose I do - to the extend I can. What's the issue? :-) The system does not send out verification e-mails, so I can not really register completely and submit new issues. I have tried it with two different e-mail accounts, and somebody else has tried too. They also do not show up in spam folders. Jur ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Installation of Haskell Platform on CentOS 5.5
On Fri, Mar 18, 2011 at 08:23:10AM +0100, Ketil Malde wrote: Tristan Ravitch travi...@cs.wisc.edu writes: The ghc7 binaries are compiled against a newer version of glibc than is available on RHEL/CentOS. It works fine if you compile ghc7 from source yourself (you can use 6.12 for that). Did it? I tried to do that, but I got errors about needing -fPIC. I tried to mess with CFLAGS, but couldn't make it work out. According to somebody on #haskell (I apologize for forgetting whom), the problem was really a too old GCC version. Now that you mention it, I did have to switch to a newer gcc for the x86_64 build. I ended up using 4.5. That part is annoying; I wasn't able to coax the default 4.1.2+patches into generating correct position-independent code either. signature.asc Description: Digital signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Could not deduce ... using functional dependencies with GHC7
Hi, that's a bug in GHC---it erroneously accepts polymorphic instances which violate the FD of a class. -Iavor On Fri, Mar 18, 2011 at 7:08 AM, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: On Friday 18 March 2011 14:40:40, JP Moresmau wrote: Thanks to you all, I think I understand better. instance Search Id Id where search _ _ i = only (FoundId i) Is too restrictive on the first type, so declaring instead: instance Search id Id where search _ _ i = only (FoundId i) Not sure what GHC does with that, but at least in spirit that violates the FunDep of class Search id a | a - id where ... Even if it works now, it may well not work in the future. I'd go for a more stable solution respecting the intent of FunDeps (i.e. there should only be one type t with an instance Search t Id). Fixed the issue!! Now the initial id is not Id and everybody is happy (and the code still seems to work as intended) thanks again JP ___ 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] Installation of Haskell Platform on CentOS 5.5
I have 7.0.2 building from source, using a binary version of GHC 6.12.3, and the GCC 4.4 (gcc44 package from CentOS). GCC 4.1(gcc package) that ships with CentOS 5.5. gave me the relocation error already detailed at the bottom of http://hackage.haskell.org/trac/ghc/wiki/Building/Troubleshooting. It would be really neat to have CentOS supported out of the gate, rather than having to install a bootstrapping ghc, to then compile latest ghc, to finally compile latest haskell-platform. Does anyone know of a trusted third-party repo that packages ghc or even better, the haskell-platform for CentOS? I found (http://pkgs.org/centos-5-rhel-5/nogin-random-x86_64/) but I know nothing about who is packaging them. cheers, -kirk On Fri, Mar 18, 2011 at 7:40 AM, Tristan Ravitch travi...@cs.wisc.eduwrote: On Fri, Mar 18, 2011 at 08:23:10AM +0100, Ketil Malde wrote: Tristan Ravitch travi...@cs.wisc.edu writes: The ghc7 binaries are compiled against a newer version of glibc than is available on RHEL/CentOS. It works fine if you compile ghc7 from source yourself (you can use 6.12 for that). Did it? I tried to do that, but I got errors about needing -fPIC. I tried to mess with CFLAGS, but couldn't make it work out. According to somebody on #haskell (I apologize for forgetting whom), the problem was really a too old GCC version. Now that you mention it, I did have to switch to a newer gcc for the x86_64 build. I ended up using 4.5. That part is annoying; I wasn't able to coax the default 4.1.2+patches into generating correct position-independent code either. -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk2DbucACgkQJklRJNuIcWQWjACfcn8B8FFUA0gEMsny2fnGIMoq wTkAn3O2Qh+0MkJ8uWS3uy4gz1A3xqgj =cDjP -END PGP SIGNATURE- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- ⑆gmail.com⑆necrobious⑈ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Wanted: composoable parsers from haskell-src-exts
On Thu, Mar 17, 2011 at 10:58 PM, Niklas Broberg niklas.brob...@gmail.comwrote: I already export a partial parser for top-of-file pragmas, I see. What I don't see is how such a parser would return the rest of input. Hmm. I see. And I see that you are correct in not seeing it, since it appears it cannot be done with Happy, which I believed. It would then be down to the parser/lexer to pass on unconsumed input, which seems a daunting and disruptive task, seeing how the lexer typically would tokenize some input in advance before the parser discovers that it cannot consume what has been lexed... Hmm. I think this is actually doable, although not necessarily easy, using a technique due to Oleg. He has used delimited continuations to take ordinary parsers and make them incremental. Dan Doel has experimented with applying the technique to Parsec parsers with some success. I think choosing the right parser monad in Happy can make this work. Reference to Oleg's technique: http://okmij.org/ftp/continuations/differentiating-parsers.html Cheers, Josef ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Cabal test interface, what/where is it?
After upgrading to ghc7 and Cabal 1.10 I get the following message when running 'Setup configure' on one of my packages: Setup.hs:3:1: Warning: In the use of `runTests' (imported from Distribution.Simple, but defined in Distribution.Simple.UserHooks): Deprecated: Please use the new testing interface instead! I usually turn to the Cabal docs at [1], but the new testing interface isn't mentioned. Looking through the haddock API reference doesn't offer any obvious pointers. So, where should I turn to get rid of the warning? /M [1] http://www.haskell.org/ghc/docs/latest/html/Cabal/ -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: mag...@therning.org jabber: mag...@therning.org twitter: magthe http://therning.org/magnus I invented the term Object-Oriented, and I can tell you I did not have C++ in mind. -- Alan Kay pgpKs4FTI3uwt.pgp Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal test interface, what/where is it?
Hello, the following URL contains some useful information: http://www.haskell.org/cabal/release/cabal-1.10.1.0/doc/users-guide/#test-suites Hope this helps, JP On Fri, Mar 18, 2011 at 8:37 PM, Magnus Therning mag...@therning.org wrote: After upgrading to ghc7 and Cabal 1.10 I get the following message when running 'Setup configure' on one of my packages: Setup.hs:3:1: Warning: In the use of `runTests' (imported from Distribution.Simple, but defined in Distribution.Simple.UserHooks): Deprecated: Please use the new testing interface instead! I usually turn to the Cabal docs at [1], but the new testing interface isn't mentioned. Looking through the haddock API reference doesn't offer any obvious pointers. So, where should I turn to get rid of the warning? /M [1] http://www.haskell.org/ghc/docs/latest/html/Cabal/ -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: mag...@therning.org jabber: mag...@therning.org twitter: magthe http://therning.org/magnus I invented the term Object-Oriented, and I can tell you I did not have C++ in mind. -- Alan Kay ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Wanted: composoable parsers from haskell-src-exts
Although this may need a bit of work you might take the parsing code form the Utrecht Haskell Compiler (http://www.cs.uu.nl/wiki/bin/view/UHC/Download), which uses the uulib parser combinators. They are top-down parsers, and thus can be used to parse any prefix given a specific parser, i.e. given the non-terminal which describes the prefix. The UHC contains a separate scanner, since the layout rule makes scannerless parsing very complicated. The uulib should be easily replaced with the newer uu-parsing lib, but this may again a bit of some work. This latter library is more easily adapted, and has less complicated internals. Doaitse On 14 mrt 2011, at 18:55, J. Waldmann wrote: Hi. I want to use parsers from haskell-src-exts as sub-parsers, which does not seem to work since they insist on consuming the input completely. I would need them to parse a maximal prefix, and return the (unconsumed) rest of input as well (cf. http://hackage.haskell.org/packages/archive/parsec/3.1.1/doc/html/Text-Parsec-Prim.html#v:getInput ) I figure that happy has the %partial directive for that, but the description http://www.haskell.org/happy/doc/html/sec-directives.html#sec-partial-parsers does not really tell me how to obtain the rest of the input. Any hints (or code samples) appreciated. Thanks - J.W. ___ 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] Cabal test interface, what/where is it?
On Fri, Mar 18, 2011 at 09:35:51PM +0100, JP Moresmau wrote: Hello, the following URL contains some useful information: http://www.haskell.org/cabal/release/cabal-1.10.1.0/doc/users-guide/#test-suites Hope this helps, That answered some questions, and I know have my test building again. Without warnings :-) However, I can't seem to get the test's sources included in the tar-ball created by 'sdist'. Is there some trick to it? /M -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: mag...@therning.org jabber: mag...@therning.org twitter: magthe http://therning.org/magnus I invented the term Object-Oriented, and I can tell you I did not have C++ in mind. -- Alan Kay pgpptU1fevFRY.pgp Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal test interface, what/where is it?
On Friday 18 March 2011 21:51:27, Magnus Therning wrote: However, I can't seem to get the test's sources included in the tar-ball created by 'sdist'. Is there some trick to it? extra-source-files? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal test interface, what/where is it?
On Fri, Mar 18, 2011 at 10:13:21PM +0100, Daniel Fischer wrote: On Friday 18 March 2011 21:51:27, Magnus Therning wrote: However, I can't seem to get the test's sources included in the tar-ball created by 'sdist'. Is there some trick to it? extra-source-files? That field can't be used in a test-suite section. Furthermore, not even the file mentioned in the 'main-is' field is included in the source tar-ball. /M -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: mag...@therning.org jabber: mag...@therning.org twitter: magthe http://therning.org/magnus Perl is another example of filling a tiny, short-term need, and then being a real problem in the longer term. -- Alan Kay pgp9RusdycND8.pgp Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal test interface, what/where is it?
On Fri, 18 Mar 2011, Magnus Therning wrote: On Fri, Mar 18, 2011 at 10:13:21PM +0100, Daniel Fischer wrote: On Friday 18 March 2011 21:51:27, Magnus Therning wrote: However, I can't seem to get the test's sources included in the tar-ball created by 'sdist'. Is there some trick to it? extra-source-files? That field can't be used in a test-suite section. Furthermore, not even the file mentioned in the 'main-is' field is included in the source tar-ball. Extra-Source-Files can be used in the main section (even before Library). However, if files mentioned in test-suite are not included in the tarball, this is certainly a bug. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How to use roots package?
Hi Café! roots (http://hackage.haskell.org/package/roots) is a package to solve equations like f(x)==0. In RootFinder class there is an 'defaultNSteps' value, which is used as maximal count of iterations functions like findRoot and traceRoot can make. By default it is 250, but sometimes it's not enough. How can I use another value instead of 250? Should I write my own RootFinder instance, or findRoot function? Thanks in advance. — Artyom. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal test interface, what/where is it?
On Fri, Mar 18, 2011 at 3:51 PM, Magnus Therning mag...@therning.org wrote: On Fri, Mar 18, 2011 at 09:35:51PM +0100, JP Moresmau wrote: Hello, the following URL contains some useful information: http://www.haskell.org/cabal/release/cabal-1.10.1.0/doc/users-guide/#test-suites Hope this helps, That answered some questions, and I know have my test building again. Without warnings :-) However, I can't seem to get the test's sources included in the tar-ball created by 'sdist'. Is there some trick to it? This is a known bug. A patch is available, so it should be fixed in the next version. -- Thomas Tuegel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to use roots package?
On Fri, Mar 18, 2011 at 6:39 PM, Artyom Kazak artyom.ka...@gmail.com wrote: Hi Café! roots (http://hackage.haskell.org/package/roots) is a package to solve equations like f(x)==0. In RootFinder class there is an 'defaultNSteps' value, which is used as maximal count of iterations functions like findRoot and traceRoot can make. By default it is 250, but sometimes it's not enough. How can I use another value instead of 250? Should I write my own RootFinder instance, or findRoot function? Either choice looks like it would work fine - however using a newtype wrapper around an existing instance of FindRoot would have the least amount of code duplication, I think. I recommend contacting the maintainer of the package about getting their input, and about solving the problem in the package itself. Antoine Thanks in advance. — Artyom. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to use roots package?
On Mar 18, 2011, at 7:39 PM, Artyom Kazak wrote: Hi Café! roots (http://hackage.haskell.org/package/roots) is a package to solve equations like f(x)==0. In RootFinder class there is an 'defaultNSteps' value, which is used as maximal count of iterations functions like findRoot and traceRoot can make. By default it is 250, but sometimes it's not enough. How can I use another value instead of 250? Should I write my own RootFinder instance, or findRoot function? Those are both options, as is to simply restart findRoot if it returns a 'Left' vaule. I personally would incline toward a custom driver function (findRoot). I should probably add one to the library that accepts a step limit and/or one that just iterates until convergence. I'm curious, though - what sort of functions are you using, and what root finding algorithm, that it takes that long to converge? And are you sure that it ever does, if it were allowed to run longer? Typically, for functions on Double, if an algorithm fails to converge within around 50 steps it's fairly likely that it never will - especially with an algorithm like bisection or Brent's method. If you're using a higher precision type, then I probably need to change the default iteration limit to something more suited to the function type. -- James ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Installation of Haskell Platform on CentOS 5.5
-- collect2: ld terminated with signal 15 // PROBLEM SOLVED -- *** HASKELL PLATFORM Building /usr/haskell-platform-2010.2.0.0/bin/ghc --make Setup -o Setup -package Cabal-1.8.0.6 Linking Setup ... collect2: ld terminated with signal 15 [Terminated] Error: Compiling the Setup script failed make: *** [build.stamp] Error 2 *** CABAL [1 of 1] Compiling Main ( Setup.lhs, Setup.o ) Linking Setup ... collect2: ld terminated with signal 15 [Terminated] Error during cabal-install bootstrap: Compiling the Setup script failed ** UPDATE // collect2: ld problem solved : caused by lack of RAM ** It seems like the problems described above was caused by the system running out of memory. Initially I had only 512 MB of RAM on my server, but after an upgrade to 2 GB RAM the installation went fine without any problems at all. I realised this running top and seeing all the memory being consumed by GHC. I ran into a couple of new problems trying to install the Platform, so I have not fully succeeded yet, but I am a lot closer... (Note: I also installed GCC 4.4 (as mentioned by Mr Peterson) before I retried installing Cabal and the Haskell Platform , but I do not think that affected the build / compile process at all, since GHC and not GCC is used here. And GCC 4.4 is also installed next to 4.1 that presumably would be used by default (or am I wrong about this?)) [k] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Missing e-mail @haskell-cafe
I've sent an e-mail to Haskell Café this morning about my troubles with Trac confirmation e-mails. The e-mail must have reached the server, because it showed up in the mailing list archive: http://www.haskell.org/pipermail/haskell-cafe/2011-March/090311.html This other archive, however, doesn't list it: http://www.mail-archive.com/haskell-cafe@haskell.org/ I thereby infer that the message was never forwarded to the mailing list. Is that correct, and does anybody have a clue why? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Missing e-mail @haskell-cafe
On Fri, Mar 18, 2011 at 9:22 PM, Mario Blažević blama...@acanac.net wrote: I've sent an e-mail to Haskell Café this morning about my troubles with Trac confirmation e-mails. The e-mail must have reached the server, because it showed up in the mailing list archive: http://www.haskell.org/pipermail/haskell-cafe/2011-March/090311.html This other archive, however, doesn't list it: http://www.mail-archive.com/haskell-cafe@haskell.org/ I thereby infer that the message was never forwarded to the mailing list. Is that correct, and does anybody have a clue why? I got the message delivered to me with the rest of list traffic. ___ 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