[Haskell-cafe] Re: How to decide if a number is an integer?
Hi, Here is an example: let l = fun num in if isIntegral l then l else 0 How to do the isIntegral thing? On Tue, Sep 29, 2009 at 1:58 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi, In other weak-type language, `round i == i` would work. But in haskell, what should I do? Thanks. -- 竹密岂妨流水过 山高哪阻野云飞 -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: How to decide if a number is an integer?
Magicloud, There are numerous ways to construct such a function. Hoogling (Fractional a, Integral b) = a - b brings up a host of functions that would be of use here in combination with fromIntegral. Thomas On Mon, Sep 28, 2009 at 11:11 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi, Here is an example: let l = fun num in if isIntegral l then l else 0 How to do the isIntegral thing? On Tue, Sep 29, 2009 at 1:58 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi, In other weak-type language, `round i == i` would work. But in haskell, what should I do? Thanks. -- 竹密岂妨流水过 山高哪阻野云飞 -- 竹密岂妨流水过 山高哪阻野云飞 ___ 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 decide if a number is an integer?
Use properFraction: http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v%3AproperFraction Hi, In other weak-type language, `round i == i` would work. But in haskell, what should I do? Thanks. -- 竹å¯å²å¦¨æµæ°´è¿ å±±é«åªé»éäºé£ ___ 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 decide if a number is an integer?
It never matches to (_, 0.0) I mean case properFraction l of (_, 0) - l _ - 0 -- always goes here. On Tue, Sep 29, 2009 at 2:18 PM, Jimmy Hartzell j...@shareyourgifts.net wrote: Use properFraction: http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v%3AproperFraction Hi, In other weak-type language, `round i == i` would work. But in haskell, what should I do? Thanks. -- 竹密岂妨流水过 山高哪阻野云飞 ___ 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] Comments requested: succ Java
On Mon, Sep 28, 2009 at 4:13 PM, John A. De Goes j...@n-brain.net wrote: If you have counterexamples, then perhaps you can name them. I'm looking for Java shops with 5+ developers and code bases of 100k converting over to Haskell. I don't know _any such shop_ that has switched to Haskell, and I doubt any exist, but I'd be delighted to learn I'm wrong. Let me ask you this question: how long would it take you to get an HTML/CSS, W3 compliant browser in Haskell? Or how about a peer-to-peer networking system with seamless scaling and automatic failover? How about a scalable BigTable implementation? In Java, the answer to these questions -- and just about any others you can think of -- is a few minutes, because the code has already been written. Well, as far as browser goes, this is a start: http://github.com/snoyberg/hack-handler-webkit. It may not be written in pure Haskell, but then again I'm not sure if there are any fully W3 compliant browsers *not* written in C++. Michael ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to decide if a number is an integer?
On Mon, Sep 28, 2009 at 11:35 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: It never matches to (_, 0.0) I mean case properFraction l of (_, 0) - l _ - 0 -- always goes here. Odd, it works fine for me. f x = case properFraction x of (_,0) - True _ - False *Main f 5 True *Main f 5.5 False *Main f 4.0 True *Main f 4.0001 False Thomas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to decide if a number is an integer?
$ ghci Prelude let isInteger' l = case properFraction l of { (_,0) - 1; _ - 0 } Prelude isInteger' 2.0 1 Prelude isInteger' 1.9 0 Do you really get 1? For what input types/values? Although I would write: isInteger = (== 0) . snd . properFraction It never matches to (_, 0.0) I mean case properFraction l of (_, 0) - l _ - 0 -- always goes here. On Tue, Sep 29, 2009 at 2:18 PM, Jimmy Hartzell j...@shareyourgifts.net wrote: Use properFraction: http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v%3AproperFraction Hi,  In other weak-type language, `round i == i` would work. But in haskell, what should I do? Thanks. -- 竹å¯å²å¦¨æµæ°´è¿ å±±é«åªé»éäºé£ ___ 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 decide if a number is an integer?
The original code is givenSum num = map (\a - let l = (sqrt $ fromIntegral (a * a + 2 + 2 * num)) - (fromIntegral a) in case properFraction l of (_, 0) - True _ - False ) $ take num [1..] :t l is (Floating a) = a Well, in ghci *Main givenSum 10 [False,False,False,False,False,False,False,False,False,False] On Tue, Sep 29, 2009 at 2:45 PM, Thomas DuBuisson thomas.dubuis...@gmail.com wrote: On Mon, Sep 28, 2009 at 11:35 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: It never matches to (_, 0.0) I mean case properFraction l of (_, 0) - l _ - 0 -- always goes here. Odd, it works fine for me. f x = case properFraction x of (_,0) - True _ - False *Main f 5 True *Main f 5.5 False *Main f 4.0 True *Main f 4.0001 False Thomas -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Comments requested: succ Java
Michael == Michael Snoyman mich...@snoyman.com writes: Michael not be written in pure Haskell, but then again I'm not Michael sure if there are any fully W3 compliant browsers *not* Michael written in C++. I'm not sure if there are any fully W3 compliant browsers. How could there be? It would mean consistent W3C recommendations. -- Colin Adams Preston Lancashire ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to decide if a number is an integer?
Unless I missed something, the function in question is: sqrt (a * a + 2 + 2 * num) - fromIntegral a where num = 10 1 - sqrt (1 * 1 + 2 + 2 * 10) - 1 - sqrt (1 + 2 + 20) - 1 - sqrt (23) - 1 - 3.79x the fractional will only ever come from the sqrt function. Do any of the following actually look like square values to you? 26 31 38 47 58 71 86 103 122 IMO, the code works and your expectations are a bit off. Thomas On Mon, Sep 28, 2009 at 11:54 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: The original code is givenSum num = map (\a - let l = (sqrt $ fromIntegral (a * a + 2 + 2 * num)) - (fromIntegral a) in case properFraction l of (_, 0) - True _ - False ) $ take num [1..] :t l is (Floating a) = a Well, in ghci *Main givenSum 10 [False,False,False,False,False,False,False,False,False,False] On Tue, Sep 29, 2009 at 2:45 PM, Thomas DuBuisson thomas.dubuis...@gmail.com wrote: On Mon, Sep 28, 2009 at 11:35 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: It never matches to (_, 0.0) I mean case properFraction l of (_, 0) - l _ - 0 -- always goes here. Odd, it works fine for me. f x = case properFraction x of (_,0) - True _ - False *Main f 5 True *Main f 5.5 False *Main f 4.0 True *Main f 4.0001 False Thomas -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to decide if a number is an integer?
Did you test the properFraction-based code in isolation? If code is broken, it's important to figure out which part of it is broken. Also, this function is not divided into constituent parts, but is a long unruly mess. Dividing it into parts would make it much much more readable, and you would then be able to test the parts individually. Jimmy The original code is givenSum num = map (\a - let l = (sqrt $ fromIntegral (a * a + 2 + 2 * num)) - (fromIntegral a) in case properFraction l of (_, 0) - True _ - False ) $ take num [1..] :t l is (Floating a) = a Well, in ghci *Main givenSum 10 [False,False,False,False,False,False,False,False,False,False] On Tue, Sep 29, 2009 at 2:45 PM, Thomas DuBuisson thomas.dubuis...@gmail.com wrote: On Mon, Sep 28, 2009 at 11:35 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: It never matches to (_, 0.0) I mean case properFraction l of  (_, 0) - l  _ - 0 -- always goes here. Odd, it works fine for me. f x =     case properFraction x of         (_,0) - True         _   - False *Main f 5 True *Main f 5.5 False *Main f 4.0 True *Main f 4.0001 False Thomas -- 竹å¯å²å¦¨æµæ°´è¿ å±±é«åªé»éäºé£ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to decide if a number is an integer?
Of course them are not. But that is why I need the detector 2009/9/29 Thomas DuBuisson thomas.dubuis...@gmail.com: Unless I missed something, the function in question is: sqrt (a * a + 2 + 2 * num) - fromIntegral a where num = 10 1 - sqrt (1 * 1 + 2 + 2 * 10) - 1 - sqrt (1 + 2 + 20) - 1 - sqrt (23) - 1 - 3.79x the fractional will only ever come from the sqrt function. Do any of the following actually look like square values to you? 26 31 38 47 58 71 86 103 122 IMO, the code works and your expectations are a bit off. Thomas On Mon, Sep 28, 2009 at 11:54 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: The original code is givenSum num = map (\a - let l = (sqrt $ fromIntegral (a * a + 2 + 2 * num)) - (fromIntegral a) in case properFraction l of (_, 0) - True _ - False ) $ take num [1..] :t l is (Floating a) = a Well, in ghci *Main givenSum 10 [False,False,False,False,False,False,False,False,False,False] On Tue, Sep 29, 2009 at 2:45 PM, Thomas DuBuisson thomas.dubuis...@gmail.com wrote: On Mon, Sep 28, 2009 at 11:35 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: It never matches to (_, 0.0) I mean case properFraction l of (_, 0) - l _ - 0 -- always goes here. Odd, it works fine for me. f x = case properFraction x of (_,0) - True _ - False *Main f 5 True *Main f 5.5 False *Main f 4.0 True *Main f 4.0001 False Thomas -- 竹密岂妨流水过 山高哪阻野云飞 -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to decide if a number is an integer?
The properFaction part is correct. So I posted the whole code, since isInteger should accept any reasonable incoming types. Well, in this one situation, it does not. And I cannot figure out why On Tue, Sep 29, 2009 at 3:07 PM, Jimmy Hartzell j...@shareyourgifts.net wrote: Did you test the properFraction-based code in isolation? If code is broken, it's important to figure out which part of it is broken. Also, this function is not divided into constituent parts, but is a long unruly mess. Dividing it into parts would make it much much more readable, and you would then be able to test the parts individually. Jimmy The original code is givenSum num = map (\a - let l = (sqrt $ fromIntegral (a * a + 2 + 2 * num)) - (fromIntegral a) in case properFraction l of (_, 0) - True _ - False ) $ take num [1..] :t l is (Floating a) = a Well, in ghci *Main givenSum 10 [False,False,False,False,False,False,False,False,False,False] On Tue, Sep 29, 2009 at 2:45 PM, Thomas DuBuisson thomas.dubuis...@gmail.com wrote: On Mon, Sep 28, 2009 at 11:35 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: It never matches to (_, 0.0) I mean case properFraction l of (_, 0) - l _ - 0 -- always goes here. Odd, it works fine for me. f x = case properFraction x of (_,0) - True _ - False *Main f 5 True *Main f 5.5 False *Main f 4.0 True *Main f 4.0001 False Thomas -- 竹密岂妨流水过 山高哪阻野云飞 -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to decide if a number is an integer?
On Tue, Sep 29, 2009 at 9:13 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: The properFaction part is correct. So I posted the whole code, since isInteger should accept any reasonable incoming types. Well, in this one situation, it does not. And I cannot figure out why Floating point gives a lot of small errors, so maybe you shouldn't test your fractional part to be = 0, but you should test it to be close enough. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] So I wrote this performance measurement library thingy
Which I will not blather on too long about here, but point you at a blog posting instead: http://www.serpentine.com/blog/2009/09/29/criterion-a-new-benchmarking-library-for-haskell/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to decide if a number is an integer?
*Should* isInteger be returning True for any numbers generated by this code? If so, can you simplify this test down to that example, so that it's obvious what the test should do, and that it's not doing it (if it in fact is not doing as it should)? In any case, it would help to divide this block of code into more manageable pieces. isInteger should have the type Fractional a = a - Boolean. The properFaction part is correct. So I posted the whole code, since isInteger should accept any reasonable incoming types. Well, in this one situation, it does not. And I cannot figure out why On Tue, Sep 29, 2009 at 3:07 PM, Jimmy Hartzell j...@shareyourgifts.net wrote: Did you test the properFraction-based code in isolation? If code is broken, it's important to figure out which part of it is broken. Also, this function is not divided into constituent parts, but is a long unruly mess. Dividing it into parts would make it much much more readable, and you would then be able to test the parts individually. Jimmy The original code is givenSum num = map (\a -            let l = (sqrt $ fromIntegral (a * a + 2 + 2 * num)) - (fromIntegral a) in            case properFraction l of             (_, 0) -              True             _ -              False           ) $ take num [1..] :t l is (Floating a) = a Well, in ghci *Main givenSum 10 [False,False,False,False,False,False,False,False,False,False] On Tue, Sep 29, 2009 at 2:45 PM, Thomas DuBuisson thomas.dubuis...@gmail.com wrote: On Mon, Sep 28, 2009 at 11:35 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: It never matches to (_, 0.0) I mean case properFraction l of  (_, 0) - l  _ - 0 -- always goes here. Odd, it works fine for me. f x =     case properFraction x of         (_,0) - True         _   - False *Main f 5 True *Main f 5.5 False *Main f 4.0 True *Main f 4.0001 False Thomas -- 竹å¯å²å¦¨æµæ°´è¿ å±±é«åªé»éäºé£ -- 竹å¯å²å¦¨æµæ°´è¿ å±±é«åªé»éäºé£ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: graphviz-2999.6.0.0
I'm pleased to announce version 2999.6.0.0 [1] of the graphviz library, which provides bindings to the GraphViz [2] suite of tools for drawing graphs. [1] http://hackage.haskell.org/package/graphviz-2999.6.0.0 [2] http://www.graphviz.org/ Changes since the previous version are: * Remove some Shape aliases and change capitalisation of others. * Properly parse and print IDs of clusters. * Allow NodeCluster values have node types different from the LNode they come from. Since the node type is only used for passing to the function to create the appropriate Attributes for that node, this can mean avoiding having to apply a transformation function before getting the attributes if you have a composite type for node value/cluster. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Strong duck typing / structural subtyping / type class aliases / ??? in Haskell
Alp Mestan wrote: Indeed, OCaml has stuctural polymorphism, it's a wonderful feature. *# let f myobj = myobj#foo Hi !;; val f : foo : string - 'a; .. - 'a = fun* And Haskell has that too: -- This is how we define labels. data Field1 deriving Typeable; field1 = proxy::Proxy Field1 -- This is how record selection looks like. foo f = f # field1 The inferred type of foo is *OCamlTutorial :t foo foo :: (HasField (Proxy Field1) r v) = r - v It doesn't seem too different from the OCaml's type; the type variable r acts as a row type. The quoted example is the first from many others described in http://darcs.haskell.org/OOHaskell/OCamlTutorial.hs The file quotes at length OCaml's Object tutorial and then demonstrates how the OCaml code can be written in Haskell. When it comes to objects, structural subtyping, width and depth subtyping, etc., Haskell does not seem to miss match compared to OCaml. In contrast, Haskell has a few advantages when it comes to coercions (one does not have to specify the type to coerce to, as Haskell can figure that out). The other files in that directory give many more example of encoding C++, Eiffel, OCaml patterns. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: Graphalyze-0.7.0.0
Graphalyze [1] is a library for using graph-theoretic techniques to analyse the relationships inherent within discrete data. It was originally written for my Honours thesis [2] last year, and I have now started updating it. [1] http://hackage.haskell.org/package/Graphalyze [2] http://ivanmiljenovic.wordpress.com/2008/11/03/graph-theoretic-analysis-of-relationships-within-discrete-data/ Graphalyze provides helper functions to import discrete data, analyse it using various algorithms (a dodgy term, I know, but I couldn't think of a better one) and then create a report with the results. The main changes since the previous version are: * The ability to have graphs with edge labels. * More of a focus on applying changes to the overall information state of the data rather than just extracting the graph and applying a function to it. * Usage of the updated features in the graphviz library (http://hackage.haskell.org/package/graphviz) to visualise graphs. Changes to come: * Re-do the reporting framework to use more of a pretty-printing approach and make it more customisable. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] i am missing something really trivial with parsec
number = do { num - natural ; return $ num } main = do txt - hGetContents stdin print $ parse number stdin txt why doesn't that work? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: Graphalyze-0.7.0.0
Ivan, could you please mention some examples of things you can do with the library here in the mailing list? I am intrigued by the idea. 2009/9/29 Ivan Lazar Miljenovic ivan.miljeno...@gmail.com: Graphalyze [1] is a library for using graph-theoretic techniques to analyse the relationships inherent within discrete data. It was originally written for my Honours thesis [2] last year, and I have now started updating it. [1] http://hackage.haskell.org/package/Graphalyze [2] http://ivanmiljenovic.wordpress.com/2008/11/03/graph-theoretic-analysis-of-relationships-within-discrete-data/ Graphalyze provides helper functions to import discrete data, analyse it using various algorithms (a dodgy term, I know, but I couldn't think of a better one) and then create a report with the results. The main changes since the previous version are: * The ability to have graphs with edge labels. * More of a focus on applying changes to the overall information state of the data rather than just extracting the graph and applying a function to it. * Usage of the updated features in the graphviz library (http://hackage.haskell.org/package/graphviz) to visualise graphs. Changes to come: * Re-do the reporting framework to use more of a pretty-printing approach and make it more customisable. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Eugene Kirpichov Web IR developer, market.yandex.ru ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] So I wrote this performance measurement library thingy
Hi Bryan looks great. The examples directory mentioned in the README, however, does not seem to be included in the package updated to hackage (though is available in darcs). This might be a bit confusing for new users. Regards, titto 2009/9/29 Bryan O'Sullivan b...@serpentine.com: Which I will not blather on too long about here, but point you at a blog posting instead: http://www.serpentine.com/blog/2009/09/29/criterion-a-new-benchmarking-library-for-haskell/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Pasqualino Titto Assini, Ph.D. http://quicquid.org/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: SourceGraph-0.5.0.0
SourceGraph [1] is a tool to statically analyse your Haskell code by applying graph-theoretic techniques on the call graph. It utilised the Graphalyze [2] library to do so, both of which were originally written as part of my Honours thesis last year [3]. [1] http://hackage.haskell.org/package/SourceGraph [2] http://hackage.haskell.org/package/Graphalyze [3] http://ivanmiljenovic.wordpress.com/2008/11/03/graph-theoretic-analysis-of-relationships-within-discrete-data/ I have been meaning to update SourceGraph since last year, but was waiting for improvements to the graphviz [4] library first. Now that these are done and I have fewer excuses, I've started to improve upon it. [4] http://hackage.haskell.org/package/graphviz When I first released SourceGraph last year, several people (e.g. Gwern) wanted support for CPP and command-line options. Unfortunately, I haven't yet gotten around to that; what I have done is added support for type classes and data structures, something I originally said I wasn't going to do. This support isn't perfect, especially when dealing with type classes from outside the scope of the code base, but in most cases works (except that the virtual instance functions don't always get positioned in the correct spots for some reason). The produced graphs are now also much prettier, with various colours and shapes being used. The useful features that SourceGraph offers include: * Visualisation of each module, the relations between modules and the entire code base. * Finds functions that are exported from a module that isn't in exposed in the .cabal file. * Alternate module splits. Please note that SourceGraph is _not_ a refactoring tool: it is designed to give you the programmer more information about what is in your code. I'd appreciate it if people could give SourceGraph a whirl and at least check how well the conversion from Haskell code to the graph is, as I'm not that sure how well I've converted haskel-src-ext's [5] internal state to SourceGraph's state. Please note that there are already various aspects that I know don't work properly; these can be found in the ParsingProblems.txt file (KnownProblems.txt contains other non-parsing problems that I'm aware of). In particular, TH, etc. aren't supported. [5] http://hackage.haskell.org/package/haskell-src-exts-1.1.4 To use SourceGraph after it's been installed, at a prompt do the following: SourceGraph path/to/project.cabal The resulting report will then be found in a directory called SourceGraph in the same directory as the cabal file. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Strong duck typing / structural subtyping / type class aliases / ??? in Haskell
I had never seen this work, it's just awesome ! And it only needs few Haskell extensions. Is this work deeply documented somewhere except in research papers ? If not, it could be worth doing, IMO. On Tue, Sep 29, 2009 at 9:37 AM, o...@okmij.org wrote: Alp Mestan wrote: Indeed, OCaml has stuctural polymorphism, it's a wonderful feature. *# let f myobj = myobj#foo Hi !;; val f : foo : string - 'a; .. - 'a = fun* And Haskell has that too: -- This is how we define labels. data Field1 deriving Typeable; field1 = proxy::Proxy Field1 -- This is how record selection looks like. foo f = f # field1 The inferred type of foo is *OCamlTutorial :t foo foo :: (HasField (Proxy Field1) r v) = r - v It doesn't seem too different from the OCaml's type; the type variable r acts as a row type. The quoted example is the first from many others described in http://darcs.haskell.org/OOHaskell/OCamlTutorial.hs The file quotes at length OCaml's Object tutorial and then demonstrates how the OCaml code can be written in Haskell. When it comes to objects, structural subtyping, width and depth subtyping, etc., Haskell does not seem to miss match compared to OCaml. In contrast, Haskell has a few advantages when it comes to coercions (one does not have to specify the type to coerce to, as Haskell can figure that out). The other files in that directory give many more example of encoding C++, Eiffel, OCaml patterns. -- Alp Mestan http://blog.mestan.fr/ http://alp.developpez.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: Graphalyze-0.7.0.0
Eugene Kirpichov ekirpic...@gmail.com writes: Ivan, could you please mention some examples of things you can do with the library here in the mailing list? I am intrigued by the idea. Couldn't you wait until you read my announcement email for SourceGraph? :p Other ideas I had for this kind of analysis: * Examine the internal structure of a company/department/etc. in terms of the employee hierarchy. * Who-knows-who: analyse address books (whether it's traditional, email, Facebook, etc.); this is related to the six-degree problem. 2009/9/29 Ivan Lazar Miljenovic ivan.miljeno...@gmail.com: Graphalyze [1] is a library for using graph-theoretic techniques to analyse the relationships inherent within discrete data. It was originally written for my Honours thesis [2] last year, and I have now started updating it. [1] http://hackage.haskell.org/package/Graphalyze [2] http://ivanmiljenovic.wordpress.com/2008/11/03/graph-theoretic-analysis-of-relationships-within-discrete-data/ Graphalyze provides helper functions to import discrete data, analyse it using various algorithms (a dodgy term, I know, but I couldn't think of a better one) and then create a report with the results. The main changes since the previous version are: * The ability to have graphs with edge labels. * More of a focus on applying changes to the overall information state of the data rather than just extracting the graph and applying a function to it. * Usage of the updated features in the graphviz library (http://hackage.haskell.org/package/graphviz) to visualise graphs. Changes to come: * Re-do the reporting framework to use more of a pretty-printing approach and make it more customisable. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] unicode text libraries, and the winner is ...
By unanimous opinion the text library is the man. Thanks to all who answered. titto ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Instances for Data.Text
2009/9/29 Paulo Tanimoto tanim...@arizona.edu: Hi Bryan and others, On Mon, Sep 28, 2009 at 5:29 PM, Bryan O'Sullivan b...@serpentine.com wrote: bytestring predates the other two libraries by several years. The underlying stream type for uvector and text are almost the same, so they could in principle be merged. There's a fair amount of duplication there, but uvector is in some ways more complicated and in others much less thorough than text. Merging them would be a lot of work! If I may free-ride on this thread: how should one go about deriving a Data.Binary instance for text? It looks like doing it efficiently would require using some parts of the internal module that are not exposed, am I correct? I've been using encodeUtf8, but that doesn't feel right. I don't know what to do, hopefully I'm missing something simple. This is a good point, I also need to make Data.Text an instance of a few basic classes and I am not sure that I did it correctly. So far I have: import Data.Text instance Binary Text where put = put . encodeUtf8 get = liftM decodeUtf8 get -- DOUBT: Is this correct also for Data.Text.Lazy ? instance NFData Text instance Serial Text where -- DOUBT: is this efficient? series d = [T.pack (series d :: String)] -- DOUBT: how to define this coseries rs = error coseries More in general: what is the right policy for instances definition? Should the library author provide them, at least for the most common and appropriate classes (at the cost of adding some additional dependencies) ? Should they go in a separate package? Should the Haskell Platform team provide some guidance on this point to library authors? titto ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] i am missing something really trivial with parsec
I don't know, but: number -- definition = do { num - natural ; return $ num } -- desugar = natural = \num - return $ num -- apply ($) = natural = \num - return num -- eta elimination (f == \x - f x) = natural = return -- monad law = natural (modulo monomorphism restriction, since number doesn't take any arguments and doesn't have a type signature) -- ryan On Tue, Sep 29, 2009 at 12:54 AM, Anatoly Yakovenko aeyakove...@gmail.comwrote: number = do { num - natural ; return $ num } main = do txt - hGetContents stdin print $ parse number stdin txt why doesn't that work? ___ 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 decide if a number is an integer?
Resolved. As Thomas said, mixing up sure is a bad thing. But then I have to name so many meanless (at least I think) computing process On Tue, Sep 29, 2009 at 3:32 PM, Jimmy Hartzell j...@shareyourgifts.net wrote: *Should* isInteger be returning True for any numbers generated by this code? If so, can you simplify this test down to that example, so that it's obvious what the test should do, and that it's not doing it (if it in fact is not doing as it should)? In any case, it would help to divide this block of code into more manageable pieces. isInteger should have the type Fractional a = a - Boolean. The properFaction part is correct. So I posted the whole code, since isInteger should accept any reasonable incoming types. Well, in this one situation, it does not. And I cannot figure out why On Tue, Sep 29, 2009 at 3:07 PM, Jimmy Hartzell j...@shareyourgifts.net wrote: Did you test the properFraction-based code in isolation? If code is broken, it's important to figure out which part of it is broken. Also, this function is not divided into constituent parts, but is a long unruly mess. Dividing it into parts would make it much much more readable, and you would then be able to test the parts individually. Jimmy The original code is givenSum num = map (\a - let l = (sqrt $ fromIntegral (a * a + 2 + 2 * num)) - (fromIntegral a) in case properFraction l of (_, 0) - True _ - False ) $ take num [1..] :t l is (Floating a) = a Well, in ghci *Main givenSum 10 [False,False,False,False,False,False,False,False,False,False] On Tue, Sep 29, 2009 at 2:45 PM, Thomas DuBuisson thomas.dubuis...@gmail.com wrote: On Mon, Sep 28, 2009 at 11:35 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: It never matches to (_, 0.0) I mean case properFraction l of (_, 0) - l _ - 0 -- always goes here. Odd, it works fine for me. f x = case properFraction x of (_,0) - True _ - False *Main f 5 True *Main f 5.5 False *Main f 4.0 True *Main f 4.0001 False Thomas -- 竹密岂妨流水过 山高哪阻野云飞 -- 竹密岂妨流水过 山高哪阻野云飞 -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] unicode text libraries
Johan Tibell johan.tib...@gmail.com writes: I agree with Don. Also, I don't think that a Unicode type should mention what encoding it uses as it's an implementation detail. Right. I see from the documentation that it uses Word16s (and presumably the utf-16 encoding). Out of curiosity, why was this particular encoding chosen, as opposed to utf-8 or utf-32/ucs-4? Any benchmarks or other information? -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] ANNOUNCE: SourceGraph-0.5.0.0
Ivan == Ivan Lazar Miljenovic ivan.miljeno...@gmail.com writes: Ivan I'd appreciate it if people could give SourceGraph a whirl Fails to install (Linux x86_64): Data/Graph/Analysis/Utils.hs:207:43: Ambiguous occurrence `dotizeGraph' It could refer to either `Data.Graph.Analysis.Utils.dotizeGraph', defined at Data/Graph/Analysis/Utils.hs:199:0 or `Data.GraphViz.dotizeGraph', imported from Data.GraphViz at Data/Graph/Analysis/Utils.hs:81:0-19 Data/Graph/Analysis/Utils.hs:220:18: Not in scope: data constructor `PointList' cabal: Error: some packages failed to install: Graphalyze-0.5 failed during the building phase. The exception was: exit: ExitFailure 1 SourceGraph-0.3 depends on Graphalyze-0.5 which failed to install. -- Colin Adams Preston Lancashire ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Haskell Weekly News: Issue 131 - Semptember 25, 2009
On Sat, 26 Sep 2009 09:18:01 -0700 (PDT), Joe Fredette jfred...@gmail.com wrote: * ksf: (But if (on the other hand)) (I think only a number in general (whether it be five or a hundred)) (this thought is rather the representation of a method (whereby a multiplicity (for instance a thousand) may be represented (in an image in conformity with a certain concept)) than the image itself. * dekudekuplex: (Unfortunately (unless intentional)) the preceding (by ksf (in the Quotes of the Week section)) quote had mismatched (one too many opening) parentheses (although it was still funny (even though it could have been edited (to make the parentheses match (even though that is not an important issue. -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 Furuike ya, kawazu tobikomu mizu no oto. -- Matsuo Basho^ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Market Place for Haskell development teams?
These problems are critical -- but not hopeless, I think: (1) A simple technical matter, any average Haskell programmer (including myself...) can build a platform, e.g. in Happstack or the like, to clear this up (given you want to do this in Haskell ;-). (4) This is a special one, which I have pondered on some time ago. The customers' main concern seems to be will this company still support me in n years?? o if the project is interesting enough, I see hope there might be some academic unit willing to partake in this, as I have heard enough complaint of not having enough examples to demonstrate business relevance to students. Normally, the customer should have no problem in believing an academic unit and its interests to last some time. o I would propose to pick up the insourcing concept -- as, what I can confirm by my own teaching experiences, it sometimes is easier to introduce Haskell to beginners (once the do have sufficient OS experience) then to people who already are adherents of some other language. Ok, we might need some more introductory literature etc. (3) Yes, there seem to be lots of people organized at a smaller level than what I described -- groups of one or very few members, working on a limited time range. Yesterday, I would have written there should be remarkable interest in greater projects, but, due to the poor resonance to my mail, I feel wary to do so now. (3)(2) Such a reserved reaction might indicate many Haskellers are not motivated by the money but by the fame, and -- as the lively succJava thread shows -- what could be greater fame (besides the evaluation of 42) than stealing the Java etc. community just another attractive project? ;-)) Do I go wrong in saying there's a good deal of competitive spirit in the Haskell community interesting in taking claims away of other programming cultures which have grown saturated over the years? And, isn't the this *Haskeller bonus* indicating that doing the step to larger project should not be as hard as for others? A remaining issue might be a need for some facility to find cooperations and realize synergies -- see (1). Enough blah-blah. I got one email response (not posted to here) of a highly qualified Haskeller whom I could name two projects which might have interested him in his proximity, 80 miles and 75 miles away (and I do not have so many...). My learning is that a communication platform in this concern might be interesting to at least some of us. There are larger projects possible -- if we pick them up. All the best, Nick John A. De Goes wrote: It's very difficult to find information on: 1. How many Haskell developers are out there; 2. What a typical salary is for a Haskell developer; 3. Whether or not the skills of a typical Haskell developer scale to large applications (most Haskell developers are hobby Haskellers and have only written tiny to small Haskell apps); 4. How many shops are capable of handling Haskell development maintenance. These are the kinds of information one needs to make an informed decision about whether to introduce Haskell into the workplace. Regards, John A. De Goes N-Brain, Inc. The Evolution of Collaboration http://www.n-brain.net|877-376-2724 x 101 On Sep 28, 2009, at 7:01 AM, Jörg Roman Rudnick wrote: In the last months, I made the experience it seems difficult to find commercial Haskell developer teams to take responsibility for projects in the range of $ 10.000 - 100.000. The Industrial Haskell Group does not seem to be the appropriate place for this, while harvesting Haskell team at general market places appears to be tedious. I would be very interested in others' experiences, and inhowfar my opinion is shared that there should be a demand for such a market place, for developer teams as well as those sympathizing with introducing Haskell somewhere. Nick ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org mailto:Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to decide if a number is an integer?
On Tue, Sep 29, 2009 at 2:30 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Resolved. As Thomas said, mixing up sure is a bad thing. But then I have to name so many meanless (at least I think) computing process That is the primary challenge of writing readable code: identifying the meaningful parts. You can separate out a function into its parts in many, many ways, but only a few of them will have parts that are comprehensible in isolation. Your original question asked how to decide if a number is an integer. Surely you would have loved it if isInteger were a library function. It has a nice, simple meaning, that is completely independent of what the surrounding code is doing. It is pretty easy to name. These things often line up. They indicate that the function is most easily understood outside of its context, as an atomic building block. It is an ideal candidate for a small function. An example of a bad constituent function from your example would be this one: huh a = fromIntegral (a * a + 2 + 2 * a) What does it mean, why are you doing it? It would be absurd to ask for this as a library function in any library. Who knows what it could possibly be named, except something inane like doArithmetic. This function is most easily understood in its context; the function that is trying to find integral values of this expression. Spending a lot of time and thought about how to break up your functions in the most understandable way will make you a better engineer. In fact, it's a quality I find missing in many professional programmers... unfortunately. Luke ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: SourceGraph-0.5.0.0
Colin Paul Adams co...@colina.demon.co.uk writes: Compare the version in the subject to the version you're trying to install... Ivan == Ivan Lazar Miljenovic ivan.miljeno...@gmail.com writes: Ivan I'd appreciate it if people could give SourceGraph a whirl Fails to install (Linux x86_64): Data/Graph/Analysis/Utils.hs:207:43: Ambiguous occurrence `dotizeGraph' It could refer to either `Data.Graph.Analysis.Utils.dotizeGraph', defined at Data/Graph/Analysis/Utils.hs:199:0 or `Data.GraphViz.dotizeGraph', imported from Data.GraphViz at Data/Graph/Analysis/Utils.hs:81:0-19 Data/Graph/Analysis/Utils.hs:220:18: Not in scope: data constructor `PointList' cabal: Error: some packages failed to install: Graphalyze-0.5 failed during the building phase. The exception was: exit: ExitFailure 1 SourceGraph-0.3 depends on Graphalyze-0.5 which failed to install. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] unicode text libraries
On Tue, 2009-09-29 at 10:48 +0200, Ketil Malde wrote: Johan Tibell johan.tib...@gmail.com writes: I agree with Don. Also, I don't think that a Unicode type should mention what encoding it uses as it's an implementation detail. Right. I see from the documentation that it uses Word16s (and presumably the utf-16 encoding). Out of curiosity, why was this particular encoding chosen, as opposed to utf-8 or utf-32/ucs-4? Any benchmarks or other information? Yes, the choice was based on benchmarks. All three (UTF-8,16,32) were implemented and benchmarked. You can read about the details in Tom Harper's MSc thesis. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: SourceGraph-0.5.0.0
Ivan == Ivan Lazar Miljenovic ivan.miljeno...@gmail.com writes: Ivan Colin Paul Adams co...@colina.demon.co.uk writes: Compare Ivan the version in the subject to the version you're trying to Ivan install... You are right. i forgot to do a cabal update first. -- Colin Adams Preston Lancashire ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Doing people's homework?
On 29 Sep 2009, at 03:19, Casey Hawthorne wrote: If you do a student's homework, you are cheating that student out of an education. He/She may realize that t late in the future. -- Regards, Casey I'm not sure I agree with that. If they're old enough to be doing Haskell homework then they're old enough to make their own decisions and take the consequences of that. As they might say in Calvinist Scotland, Let the child play with the knife, they'll soon learn :) Personally, I tend to find exercises without access to the answers a poor way to learn. You'll learn more from a well crafted example than you ever will by struggling at something yourself. Regards Iain ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Market Place for Haskell development teams?
Some thoughs: Most successful languages spread because they are part of a platform which solves an IT problem. C was part of Unix, both brougth CPU independence when this was necessary. Java is part of the Java platform, that brougth OS independence and interoperability at the right time. .Download-execution on the client was also a reason for the initial success of Java in the Internet era. Javascript is part of the web browser. The .NET languages are part of NET. Rubi and Pyton came with libraries targeted to Rapid development of Internet applications. What is the vehicle that haskell can use to enter the mainstream?. I think that the mere interest of the ideas in the language is not enough. Many people will play with Haskell in the spare time, and many of them will be permitted to develop some non critical applications at work. But that is all. Java was not designed for the Internet but it was re-targeted to it because some needed features where already implemented in Java. Maybe something like that will happen to Haskell. I think that all the current niches are filled, but new niches are coming. specially with higher level programming that is made on top of current sorware software infrastructure such are BPM, workflows, more flexible scientific applicatins, creation of models in business intelligence, as part of ERPs,.Data mining too. And higuer levels of netwrok communications( for example, Google Wave robots) etc. About the last point, sometimes a basically identical infrastructure is re-engineered to a higher level, and a new language takes over. For example, the architecture of many Internet applications in the 80s was client-server based, where C, C++ was the king. This was substituted by the web architecture with Java because Java was involved in the gradual change by filling the holes of the new architecture. It could be that in a few years, instead of Web sites people could develop interoperable gadgets for aggregators such are netvibes or IGoogle or, even more radical, robots and gadgets in google Wave. Anyway, for sure, people will think and develop at a higher level. Financial applications are an example of higher level programming where tasks usually performed by humans are now automatized and there is no or few traditions about that. The need to think at a higher level without being worried by side effects and other details are specially needed in such kind of areas. That's where haskell could have its own niche. Regards 2009/9/29 Jörg Roman Rudnick joerg.rudn...@t-online.de These problems are critical -- but not hopeless, I think: (1) A simple technical matter, any average Haskell programmer (including myself...) can build a platform, e.g. in Happstack or the like, to clear this up (given you want to do this in Haskell ;-). (4) This is a special one, which I have pondered on some time ago. The customers' main concern seems to be will this company still support me in n years?? o if the project is interesting enough, I see hope there might be some academic unit willing to partake in this, as I have heard enough complaint of not having enough examples to demonstrate business relevance to students. Normally, the customer should have no problem in believing an academic unit and its interests to last some time. o I would propose to pick up the insourcing concept -- as, what I can confirm by my own teaching experiences, it sometimes is easier to introduce Haskell to beginners (once the do have sufficient OS experience) then to people who already are adherents of some other language. Ok, we might need some more introductory literature etc. (3) Yes, there seem to be lots of people organized at a smaller level than what I described -- groups of one or very few members, working on a limited time range. Yesterday, I would have written there should be remarkable interest in greater projects, but, due to the poor resonance to my mail, I feel wary to do so now. (3)(2) Such a reserved reaction might indicate many Haskellers are not motivated by the money but by the fame, and -- as the lively succJava thread shows -- what could be greater fame (besides the evaluation of 42) than stealing the Java etc. community just another attractive project? ;-)) Do I go wrong in saying there's a good deal of competitive spirit in the Haskell community interesting in taking claims away of other programming cultures which have grown saturated over the years? And, isn't the this *Haskeller bonus* indicating that doing the step to larger project should not be as hard as for others? A remaining issue might be a need for some facility to find cooperations and realize synergies -- see (1). Enough blah-blah. I got one email response (not posted to here) of a highly qualified Haskeller whom I could name two projects which might have interested him in his proximity, 80 miles and 75 miles away (and I do not have so many...). My learning is that a communication
Re: [Haskell-cafe] How to decide if a number is an integer?
Am Dienstag 29 September 2009 09:02:19 schrieb Thomas DuBuisson: Unless I missed something, the function in question is: sqrt (a * a + 2 + 2 * num) - fromIntegral a where num = 10 1 - sqrt (1 * 1 + 2 + 2 * 10) - 1 - sqrt (1 + 2 + 20) - 1 - sqrt (23) - 1 - 3.79x the fractional will only ever come from the sqrt function. Do any of the following actually look like square values to you? 26 31 38 47 58 71 86 103 122 IMO, the code works and your expectations are a bit off. Quite. *MMlouds givenSum 11 [True,False,False,False,True,False,False,False,False,False,False] The code tests whether a*a+2*(num+1) is a square, equivalently, whether there's a b such that 2*(num+1) == b^2 - a^2 Now, the difference of two squares is either odd or a multiple of 4. 2*(num+1) is never odd, so it must be a multiple of 4, i.e. num must be odd for any number of the form a^2 + 2*(num+1) to be a square. isIntegral x = snd (properFraction x) == 0 works for rational x and for small enough doubles/floats, but beware: *MMlouds [n | n - [1 .. 100], not $ isIntegral (sqrt $ 4^n+222)] [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29] Thomas On Mon, Sep 28, 2009 at 11:54 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: *Main givenSum 10 [False,False,False,False,False,False,False,False,False,False] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
RE: [Haskell-cafe] Re: A thought about liberating Haskell's syntax
Type splices are implemented in the upcoming GHC 6.10. Simon | -Original Message- | From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org] On | Behalf Of George Pollard | Sent: 16 September 2009 13:45 | To: Haskell Café | Subject: [Haskell-cafe] Re: A thought about liberating Haskell's syntax | | Also (sorry for the triple-post!) I noticed that in the TH | documentation, it says: | | Type splices are not implemented, and neither are pattern splices | | This means, while we could write a preprocessor that would give us, e.g.: | | x :: Set Int | x = {1,2,3,4} | | We cannot splice in the right places to allow: | | x :: {Int} | x = {1,2,3,4} | | isSetEmpty :: {a} → Bool | isSetEmpty {} = True | isSetEmpty _ = False | ___ | 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] Doing people's homework?
Am Dienstag 29 September 2009 13:04:38 schrieb Iain Barnett: Personally, I tend to find exercises without access to the answers a poor way to learn. You'll learn more from a well crafted example than you ever will by struggling at something yourself. I sort of disagree. You'll learn more if you can read a well crafted example *after* you've struggled to get something good on your own. If you start inspecting an example before you've spent considerable effort understanding the matter on your own, you're likely to miss some important things. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Problems with Language.Haskell.Interpreter and errors
Hi, The API of Language.Haskell.Interpreter says, that 'runInterpreter' runInterpreter :: (MonadCatchIO m, Functor m) = InterpreterT m a - m (Either InterpreterError a) returns 'Left' in case of errors and 'GhcExceptions from the underlying GHC API are caught and rethrown as this'. What kind of errors do a generate here, why are they not caught by runInterpreter and how can I catch them? I assumed to get a 'Left InterpreterError' from the first and an error in MonadCatchIO in the second. :m +Language.Haskell.Interpreter let estr1 = let lst [a] = a; lst _ = error \foo\ in lst [] let estr1 = let lst [a] = a; in lst [] runInterpreter (setImportsQ [(Prelude, Nothing)] eval estr1 ) Right *** Exception: foo runInterpreter ( eval estr2) Right *** Exception: interactive:1:101-111: Non-exhaustive patterns in function lst Thanks a lot ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Doing people's homework?
On 29 Sep 2009, at 12:48, Daniel Fischer wrote: Am Dienstag 29 September 2009 13:04:38 schrieb Iain Barnett: Personally, I tend to find exercises without access to the answers a poor way to learn. You'll learn more from a well crafted example than you ever will by struggling at something yourself. I sort of disagree. You'll learn more if you can read a well crafted example *after* you've struggled to get something good on your own. If you start inspecting an example before you've spent considerable effort understanding the matter on your own, you're likely to miss some important things. So, if I was trying to come up with a solution to a problem that possibly has multiple solutions, like building an engine for a car, I would do better if I hadn't seen a (well crafted) working engine by someone else than if I had? If effort is there, then give me the example any time, because insight will be quicker. If you're going to be lazy then it doesn't matter either way. Regards, Iain ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: A thought about liberating Haskell's syntax
Hmm... Simon, was it a typo? Is it 6.10.x or 6.12? Regards, Rafael 2009/9/29 Simon Peyton-Jones simo...@microsoft.com Type splices are implemented in the upcoming GHC 6.10. Simon | -Original Message- | From: haskell-cafe-boun...@haskell.org [mailto: haskell-cafe-boun...@haskell.org] On | Behalf Of George Pollard | Sent: 16 September 2009 13:45 | To: Haskell Café | Subject: [Haskell-cafe] Re: A thought about liberating Haskell's syntax | | Also (sorry for the triple-post!) I noticed that in the TH | documentation, it says: | | Type splices are not implemented, and neither are pattern splices | | This means, while we could write a preprocessor that would give us, e.g.: | | x :: Set Int | x = {1,2,3,4} | | We cannot splice in the right places to allow: | | x :: {Int} | x = {1,2,3,4} | | isSetEmpty :: {a} → Bool | isSetEmpty {} = True | isSetEmpty _ = False | ___ | 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 -- Rafael Gustavo da Cunha Pereira Pinto ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
RE: [Haskell-cafe] Re: A thought about liberating Haskell's syntax
sorry – 6.12 From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org] On Behalf Of Rafael Gustavo da Cunha Pereira Pinto Sent: 29 September 2009 13:59 To: Simon Peyton-Jones Cc: Haskell Café Subject: Re: [Haskell-cafe] Re: A thought about liberating Haskell's syntax Hmm... Simon, was it a typo? Is it 6.10.x or 6.12? Regards, Rafael 2009/9/29 Simon Peyton-Jones simo...@microsoft.commailto:simo...@microsoft.com Type splices are implemented in the upcoming GHC 6.10. Simon | -Original Message- | From: haskell-cafe-boun...@haskell.orgmailto:haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.orgmailto:haskell-cafe-boun...@haskell.org] On | Behalf Of George Pollard | Sent: 16 September 2009 13:45 | To: Haskell Café | Subject: [Haskell-cafe] Re: A thought about liberating Haskell's syntax | | Also (sorry for the triple-post!) I noticed that in the TH | documentation, it says: | | Type splices are not implemented, and neither are pattern splices | | This means, while we could write a preprocessor that would give us, e.g.: | | x :: Set Int | x = {1,2,3,4} | | We cannot splice in the right places to allow: | | x :: {Int} | x = {1,2,3,4} | | isSetEmpty :: {a} → Bool | isSetEmpty {} = True | isSetEmpty _ = False | ___ | Haskell-Cafe mailing list | Haskell-Cafe@haskell.orgmailto:Haskell-Cafe@haskell.org | http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.orgmailto:Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Rafael Gustavo da Cunha Pereira Pinto ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Doing people's homework?
If you do a student's homework, you are cheating that student out of an education. Personally, I tend to find exercises without access to the answers a poor way to learn. You'll learn more from a well crafted example than you ever will by struggling at something yourself. In these lines, the homework policy could be extended to contain great solutions to all typical homework tasks. Teachers could build on that by instructing students to study and use such solutions to solve other tasks. Bonus could be given to students who could find even better solutions than those in the page, maybe with exponencial prizes like Knuth's checks :) Best, Maurício ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Comments requested: succ Java
You misunderstood my point. The browser, BigTable clone, and peer-to- peer networking libraries are starting points for applications -- ones that I've actually needed at various points in my career. You can grab them and start developing with them in a few minutes. If you want these components (or 100 others) in Haskell, you're going to have to write them yourself (at a cost of several to dozens of man years), or at least write sucky imperative wrappers around existing C libraries, compile those libraries, develop a cross-platform build process, be prepared to fix bugs in multiple languages, etc. Hackage is great, except when it's not, which is most of the time. No one's bit off the really big projects. In fact, they get voted down on the Reddit Haskell proposals, because somehow really practical software like an AMQP client isn't cool enough. Haskell's great for small applications that don't need specialized libraries (and apparently, for small segments of the financial industry). For other applications, it usually cannot compete economically with other, vastly technically inferior languages like Java. Regards, John A. De Goes N-Brain, Inc. The Evolution of Collaboration http://www.n-brain.net|877-376-2724 x 101 On Sep 28, 2009, at 10:56 AM, Curt Sampson wrote: Ok, my last post on this for real this time. On 2009-09-28 08:13 -0600 (Mon), John A. De Goes wrote: Let me ask you this question: how long would it take you to get an HTML/CSS, W3 compliant browser in Haskell? A long time. On the other hand, by grabbing a copy of Mozilla, I'll have one far faster than you'll have yours in Java, mine will work a lot better, run more quickly, and work better with most sites. While I advocate using Haskell, I don't advocate being silly. (Incidently, I have direct experience with an almost exactly parallel situation. I replaced a system that was thousands of lines of difficult-to-maintain Java code with a few hundred lines of Haskell that feed Microsoft Excel. The user is very pleased that he can now can do far more extensive tweaking of the UI himself, including major features he never had at all before, such as real-time graphing of the data.) Or how about a peer-to-peer networking system with seamless scaling and automatic failover? Can you give me an example of a real-life system using this you've set up in a few minutes? My experience building systems with similar things (the very mature and proven MogileFS suite of tools) has been that the libraries were nice, but did not solve the majority, or even a large minority, of the problem. Libraries are _everything_. In many cases, they can increase your effective budget by 10x or even 100x. Or the other way around, as I've seen by ripping out thousands of lines of Hibernate code, and all of the work done to adapt a system to that model, and replace it with a few hundred lines of SQL and JDBC calls. That library has probably wasted more man-years than anything else I've seen in the Java world. cjs -- Curt Sampson c...@starling-software.com+81 90 7737 2974 Functional programming in all senses of the word: http://www.starling-software.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Comments requested: succ Java
John A. De Goes wrote: write them yourself (at a cost of several to dozens of man years), Is that right? -- Tony Morris http://tmorris.net/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Comments requested: succ Java
It's the early adopters who develop the first libraries that pull in ever wider audiences. Yes, the early adopters are drawn by the syntax of the language, but commercial adoption doesn't come until it's economically competitive to do so. And that doesn't happen until the library market is booming and/or they can seamlessly reuse existing assets (that's what the JVM languages discovered: if you allow people to use what they already have, in a seamless fashion, incrementally building new stuff using the new language, then you can dramatically shorten the time between early adoption and mass adoption). Regards, John A. De Goes N-Brain, Inc. The Evolution of Collaboration http://www.n-brain.net|877-376-2724 x 101 On Sep 28, 2009, at 11:01 AM, Jason Dusek wrote: 2009/09/28 John A. De Goes j...@n-brain.net: Libraries are _everything_... Not exactly. Python would never have gotten a foothold over Perl, nor Java over C, if cleaner language semantics weren't enough for some shops or certain applications. -- Jason Dusek ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Market Place for Haskell development teams?
If there is demand for shops to work on smaller jobs in haskell then I think a having a more specific marketplace/communication platform for haskell work would be very helpful. If there is a perceived demand, supply will soon follow. - Job On Tue, Sep 29, 2009 at 5:48 AM, Jörg Roman Rudnick joerg.rudn...@t-online.de wrote: These problems are critical -- but not hopeless, I think: (1) A simple technical matter, any average Haskell programmer (including myself...) can build a platform, e.g. in Happstack or the like, to clear this up (given you want to do this in Haskell ;-). (4) This is a special one, which I have pondered on some time ago. The customers' main concern seems to be will this company still support me in n years?? o if the project is interesting enough, I see hope there might be some academic unit willing to partake in this, as I have heard enough complaint of not having enough examples to demonstrate business relevance to students. Normally, the customer should have no problem in believing an academic unit and its interests to last some time. o I would propose to pick up the insourcing concept -- as, what I can confirm by my own teaching experiences, it sometimes is easier to introduce Haskell to beginners (once the do have sufficient OS experience) then to people who already are adherents of some other language. Ok, we might need some more introductory literature etc. (3) Yes, there seem to be lots of people organized at a smaller level than what I described -- groups of one or very few members, working on a limited time range. Yesterday, I would have written there should be remarkable interest in greater projects, but, due to the poor resonance to my mail, I feel wary to do so now. (3)(2) Such a reserved reaction might indicate many Haskellers are not motivated by the money but by the fame, and -- as the lively succJava thread shows -- what could be greater fame (besides the evaluation of 42) than stealing the Java etc. community just another attractive project? ;-)) Do I go wrong in saying there's a good deal of competitive spirit in the Haskell community interesting in taking claims away of other programming cultures which have grown saturated over the years? And, isn't the this *Haskeller bonus* indicating that doing the step to larger project should not be as hard as for others? A remaining issue might be a need for some facility to find cooperations and realize synergies -- see (1). Enough blah-blah. I got one email response (not posted to here) of a highly qualified Haskeller whom I could name two projects which might have interested him in his proximity, 80 miles and 75 miles away (and I do not have so many...). My learning is that a communication platform in this concern might be interesting to at least some of us. There are larger projects possible -- if we pick them up. All the best, Nick John A. De Goes wrote: It's very difficult to find information on: 1. How many Haskell developers are out there; 2. What a typical salary is for a Haskell developer; 3. Whether or not the skills of a typical Haskell developer scale to large applications (most Haskell developers are hobby Haskellers and have only written tiny to small Haskell apps); 4. How many shops are capable of handling Haskell development maintenance. These are the kinds of information one needs to make an informed decision about whether to introduce Haskell into the workplace. Regards, John A. De Goes N-Brain, Inc. The Evolution of Collaboration http://www.n-brain.net|877-376-2724 x 101 On Sep 28, 2009, at 7:01 AM, Jörg Roman Rudnick wrote: In the last months, I made the experience it seems difficult to find commercial Haskell developer teams to take responsibility for projects in the range of $ 10.000 - 100.000. The Industrial Haskell Group does not seem to be the appropriate place for this, while harvesting Haskell team at general market places appears to be tedious. I would be very interested in others' experiences, and inhowfar my opinion is shared that there should be a demand for such a market place, for developer teams as well as those sympathizing with introducing Haskell somewhere. Nick ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- ___ Haskell-Cafe mailing listhaskell-c...@haskell.orghttp://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Problems with Language.Haskell.Interpreter and errors
On Sep 29, 2009, at 8:56 AM, Martin Hofmann wrote: Hi, The API of Language.Haskell.Interpreter says, that 'runInterpreter' runInterpreter :: (MonadCatchIO m, Functor m) = InterpreterT m a - m (Either InterpreterError a) returns 'Left' in case of errors and 'GhcExceptions from the underlying GHC API are caught and rethrown as this'. What kind of errors do a generate here, why are they not caught by runInterpreter and how can I catch them? I assumed to get a 'Left InterpreterError' from the first and an error in MonadCatchIO in the second. :m +Language.Haskell.Interpreter let estr1 = let lst [a] = a; lst _ = error \foo\ in lst [] let estr1 = let lst [a] = a; in lst [] runInterpreter (setImportsQ [(Prelude, Nothing)] eval estr1 ) Right *** Exception: foo runInterpreter ( eval estr2) Right *** Exception: interactive:1:101-111: Non-exhaustive patterns in function lst Thanks a lot InterpreterErrors are those that prevent your to-be-interpreted code from compiling/typechecking. In this case, estr1 is interpreted just fine; but the interpreted value is an exception. So I think Ritght... is ok. You ought to be able to add a Control.Monad.CatchIO.catch clause to your interpreter to catch this kind of errors, if you want. I just tried it and failed, though, so this is probably a bug. I'll try to track it down in more detail. Thanks for the report! Daniel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: SourceGraph-0.5.0.0
Looks very nice! One thing I noticed are a bunch of escaped newlines somehow ending up in the report: Class: Num\nData: Bit, Class: Num They appear each time a class is displayed. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Writing tool question (may be out of scope here)
Saul Malesac wrote: Excuse me if that is out of subject here, but does anyone know which tool/writing framework was used to write the Real world Haskell book ? I'm wondering, in particular, about the capability to write/edit/publish it online while allowing people to leave comments, then have a paperback/PDF version. This might be what you're looking for: http://www.realworldhaskell.org/blog/2008/02/10/about-our-comment-system/ A pity the web interface wasn't written in Haskell. ;) Regards, apfelmus -- http://apfelmus.nfshost.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Ghci dynamic linking (Was: C++ libraries and GHCI)
Hi all, I would really appreciate if anyone could give a look to the following problem. Thanks in advance!!! Paolo -- Forwarded message -- From: Paolo Losi paolo.l...@gmail.com Date: Mon, Sep 14, 2009 at 10:33 AM Subject: C++ libraries and GHCI To: glasgow-haskell-us...@haskell.org Hi all, I'm working on a tentative implementation of haskell binding to libsvm [1]: http://hackage.haskell.org/package/HSvm The package includes libsvm C++ sources. While it works perfectly with ghc --make (try to install the package and compile http://bitbucket.org/pao/hsvm/raw/6cf7ca91f1e5/test/test.hs), it fails with ghci: (hsvm)(env)pa...@moltrasio:~/trash$ ghci test.hs GHCi, version 6.10.4: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer ... linking ... done. Loading package base ... linking ... done. Ok, modules loaded: Main. Prelude Main main Loading package syb ... linking ... done. Loading package array-0.2.0.0 ... linking ... done. Loading package containers-0.2.0.1 ... linking ... done. Loading package HSvm-0.1.0.2.89 ... linking ... interactive: /home/paolo/trash/hsvm/lib/HSvm-0.1.0.2.89/ghc-6.10.4/HSHSvm-0.1.0.2.89.o: unknown symbol `_ZTV6Kernel' ghc: unable to load package `HSvm-0.1.0.2.89' Please note that the symbol is available in libHSHSvm-0.1.0.2.89.a $ nm HSHSvm-0.1.0.2.89.o |grep _ZTV6Kernel V _ZTV6Kernel $ nm libHSHSvm-0.1.0.2.89.a |grep _ZTV6Kernel V _ZTV6Kernel Can anyone give a look to the problem? Thanks Paolo [1] http://www.csie.ntu.edu.tw/~cjlin/libsvm/ -- Paolo Losi e-mail: pa...@enuan.com mob: +39 348 7705261 ENUAN Srl Via XX Settembre, 12 - 29100 Piacenza ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Writing tool question (may be out of scope here)
Perfect ! I've missed this. Thank you very much. 2009/9/29 Heinrich Apfelmus apfel...@quantentunnel.de: Saul Malesac wrote: Excuse me if that is out of subject here, but does anyone know which tool/writing framework was used to write the Real world Haskell book ? I'm wondering, in particular, about the capability to write/edit/publish it online while allowing people to leave comments, then have a paperback/PDF version. This might be what you're looking for: http://www.realworldhaskell.org/blog/2008/02/10/about-our-comment-system/ A pity the web interface wasn't written in Haskell. ;) Regards, apfelmus -- http://apfelmus.nfshost.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Saul ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cal, Clojure, Groovy, Haskell, OCaml, etc.
Don, On Mon, Sep 28, 2009 at 11:52 PM, Don Stewart d...@galois.com wrote: brad.larsen: On Mon, Sep 28, 2009 at 11:11 PM, Hong Yang hyang...@gmail.com wrote: [...] Maybe later on we can add an Example section to Description, Synopsis, and Documentation sections produced by Haddock. Also, having a section for comments is helpful. This is the case especially when there are several similar packages coexisting, comments can help people choose which one to use. Thanks, Hong [...] +1 I'd like to see people writing comparative reviews of libraries in each category, and publishing those reviews online. -- Don If there were a comments section for the packages on Hackage, it would lower the barrier to entry for writing such comparisons. :-) It takes a good chunk of time to write up a detailed, informative blog post, with performance measurements, etc. for competing packages. Many people do not have the time to do an in-depth review of a package; I am grateful when people do take the time to such reviews. If there were a comments or review section on Hackage (a la CPAN), I imagine that more people would provide feedback. Another issue with the published package comparisons is an indexing problem. At present, the only way for potential users of a package to find reviews is through actively searching for them via Google or asking other Haskellers. With a comments area for a package, one could link to an off-site, in-depth review. Sincerely, Brad ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Instances for Data.Text
Hi Titto, On Tue, Sep 29, 2009 at 3:15 AM, Pasqualino Titto Assini tittoass...@gmail.com wrote: More in general: what is the right policy for instances definition? Should the library author provide them, at least for the most common and appropriate classes (at the cost of adding some additional dependencies) ? Should they go in a separate package? Should the Haskell Platform team provide some guidance on this point to library authors? titto Thanks for changing the subject, I forgot to do that. I have a similar derivation for a Data.Binary instance, but after looking at Text.Internal, I got the impression that it wasn't as efficient as it could be. But yes, in general this boils down to your questions. I do remember someone asking a similar question perhaps a year or so ago. Now that we have Haskell Platform, does that change anything? In particular, I believe Data.Binary is proposed for inclusion in the platform. Regards, Paulo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Market Place for Haskell development teams?
On 2009-09-29 13:18 +0200 (Tue), Alberto G. Corona wrote: Java is part of the Java platform, that brought OS independence and interoperability at the right time. .Download-execution on the client was also a reason for the initial success of Java in the Internet era. I was a die-hard Java hacker from 1999 until some undetermined time in the early-to-mid-2000s. (I abandoned it more or less completely sometime around late 2005, if I recall correctly.) This may be somewhat anecdotal evidence, but I disagree with both of your statements here. I've rarely known anybody to use Java cross-platform in a non-trival way, barring a few major GUI-centric projects such as Eclipse. (I've far more cross-platform use of Haskell than Java myself.) And I know of nobody who did anything serious with download-execution of Java. As an example, Amazon and Google are two fairly large companies that use Java extensively in their operations, and neither of them make any significant use of the cross-platform or download-execution abilities of it. They'd do just as well with a language that had a single compiler producing only Unix binaries. Rubi and Python came with libraries targeted to Rapid development of Internet applications. No, neither originally came with that. Python has never been a big language for web applications (though it's had a few outstanding successes). It has been the source of some very good ideas in the web application framework area (Django introduced some great ideas that were, at best, exceedingly rare when it came out), but those haven't really caught on. (RoR is still missing a lot of wonderful stuff from Django. Heck, even my sad Ruby web framework QWeb has more in certain respects.) Ruby on Rails arrived more than a decade after Ruby was developed, and while it's increased the popularity of the language, that's little to do with Ruby itself. RoR was well described by someone as the bastard spawn of a PHP programmer and a Web designer. I posit that it's slightly better than PHP, yet still very accessible to PHP programmers is the main reason for its popularity. What is the vehicle that haskell can use to enter the mainstream?. That may be the wrong question. Avoid success at all costs still rings true to me. A year or so ago I seemed like one of the few on the haskell-libraries list voting in favour of fixing API problems in libraries, rather than etching in stone those problems in the name of backwards compatibility so that we could become more popular. Do you really want, in 2020, to look back at the 2010 revision of the Haskell standard and think, we entrenched things that for a decade everybody agreed was dumb? I can tell you, even when you're a Java enthusiast, there's nothing more depressing than looking at java.util.Date and thinking, That should have been immutable, but it's going to be mutable for the rest of eternity. We will never fix that. But let's try this again: What is the vehicle that haskell can use to enter the mainstream?. Become more stupid. Is that a better answer? I'm not just a geek; I do marketing too (this is what happens when you start your own company), and if you asked me, using the utmost of my technical knowledge and marketing skills, to make Haskell popular, this is what I'd recommend. (I suppose it's a sign of my professionalism that to do this would nearly break my heart, but if you wanted me to tell you the best way to do this, and I couldn't tell you to get lost, that's what I'd say.) Many people will play with Haskell in the spare time, and many of them will be permitted to develop some non critical applications at work. But that is all. Hm. So I suppose that this options trading system I'm working on, which is the sole way our business makes money and is entirely written in Haskell, doesn't actually exist. I think that all the current niches are filled, but new niches are coming. Haskell already has a good niche. In fact, a brilliant one. We have a whole bunch of academics doing truly wonderful stuff (imagine the world without monads!--thank you Philip Wadler (and Eugenio Moggi)) that the rest of us (relatively) dumb idiots can use to make our lives better. We've got several very good implementations of the language, one of which is a truly shit-hot compiler[1]. And we can use that to do commercial applications quite comfortably[2]. My personal opinion is, yes, let's let Haskell stick to the niche where it's great, but it changes so fast that it's scary to everybody else. To echo Paul Graham, I'm extremely happy to see my competition use Java. [1] Like that's so important. Ruby's standard implementation to this day is an interpreter that implements all the popular extensions and has a reasonably decent FFI. In Haskell-land, we call that Hugs. It's only because we have GHC as well that we can look down on Hugs; in the Ruby (and Python, and PHP) worlds, they're saying that interpreters are just fine for all sorts of enterprise
Re: [Haskell-cafe] Doing people's homework?
On 2009-09-29 13:47 +0100 (Tue), Iain Barnett wrote: So, if I was trying to come up with a solution to a problem that possibly has multiple solutions, like building an engine for a car, I would do better if I hadn't seen a (well crafted) working engine by someone else than if I had? Yes, because the work you'd done thinking about it would give you a better understanding of the problem, even if the answer you'd come up with was completely wrong. That said, learning from the good example afterwards is without question extremely valuable. If effort is there, then give me the example any time, because insight will be quicker. Actually, I find that for many problems there is no quick insight. The true understanding of the problem comes with struggling with it, rather than mastering it. cjs -- Curt Sampson c...@starling-software.com+81 90 7737 2974 Functional programming in all senses of the word: http://www.starling-software.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Doing people's homework?
Iain Barnett wrote: So, if I was trying to come up with a solution to a problem that possibly has multiple solutions, like building an engine for a car, I would do better if I hadn't seen a (well crafted) working engine by someone else than if I had? If effort is there, then give me the example any time, because insight will be quicker. If you're going to be lazy then it doesn't matter either way. This could be a question of learning styles. You wrote If the effort is there... so I assume that means you have a way of putting effort into understanding an engine design, even if you have never seen an engine design before. Furthermore you have some way of digesting and transforming that knowledge so you can make new designs rather than be a slave to imitation. I definitely cannot do this very well. I learn much faster by struggling with a problem so I learn where the problem is---what is the key thing I'm trying to do, and why do my efforts seem to fall short? Why do I feel confused? And THEN looking at the answer to get that aha! moment. This is especially nice in learning Haskell because solutions tend to be elegant and contain deep insights. Isn't there some saying like: See and remember for a day. Do and remember for a lifetime. In struggling to answer, a student is not simpling doing the problem, but is actually doing part of the thinking that led to the creation of Haskell. They are retracing problems and alternative solutions that are in some way related to the history of computer science. Mike ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Doing people's homework?
Am Dienstag 29 September 2009 14:47:27 schrieb Iain Barnett: On 29 Sep 2009, at 12:48, Daniel Fischer wrote: Am Dienstag 29 September 2009 13:04:38 schrieb Iain Barnett: Personally, I tend to find exercises without access to the answers a poor way to learn. You'll learn more from a well crafted example than you ever will by struggling at something yourself. I sort of disagree. You'll learn more if you can read a well crafted example *after* you've struggled to get something good on your own. If you start inspecting an example before you've spent considerable effort understanding the matter on your own, you're likely to miss some important things. So, if I was trying to come up with a solution to a problem that possibly has multiple solutions, like building an engine for a car, I would do better if I hadn't seen a (well crafted) working engine by someone else than if I had? I thought we were talking about homework for a school/university course. I tacitly assumed that the principles and some examples would have previously been given in the lectures. Then you're given the homework exercise to build upon those to solve a bigger task. If effort is there, then give me the example any time, because insight will be quicker. But it will be deeper if you explored the matter first without your vision constrained by the example. If you're going to be lazy then it doesn't matter either way. True. Regards, Iain ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Instances for Data.Text
On Tue, Sep 29, 2009 at 1:15 AM, Pasqualino Titto Assini tittoass...@gmail.com wrote: This is a good point, I also need to make Data.Text an instance of a few basic classes and I am not sure that I did it correctly. So far I have: import Data.Text instance Binary Text where put = put . encodeUtf8 get = liftM decodeUtf8 get Well, independent of the implementation (yours seems fine, by the way), we can't have Platform packages depend on non-Platform packages. The text library isn't in a position to make it ready for inclusion there yet, but it's getting close, and it might even get there before binary. So it's no problem to write an NFData instance, but a Binary instance would be an issue. -- DOUBT: Is this correct also for Data.Text.Lazy ? instance NFData Text instance Serial Text where -- DOUBT: is this efficient? series d = [T.pack (series d :: String)] -- DOUBT: how to define this coseries rs = error coseries What's Serial? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to decide if a number is an integer?
On Tue, 29 Sep 2009, Magicloud Magiclouds wrote: Hi, In other weak-type language, `round i == i` would work. But in haskell, what should I do? Thanks. Am I right, that you want to check whether a number is a square number? http://www.haskell.org/haskellwiki/Generic_number_type#isSquare ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: atom-0.1.1
Atom is a Haskell DSL for designing hard real-time embedded applications. At Eaton, we use it for automotive control systems. An Atom description is composed of a set of guarded atomic actions that operate on a global program state. Atom makes it easy to manage program concurrency without the need for mutex locking and run-time task scheduling. As such, Atom can eliminate the need and overhead of an RTOS, which traditionally serves these functions. This release includes several improvements to C code generation, including a simplified rule scheduler that consumes less memory and execution time. It also ships with a new unit testing framework that allows the use of assertions and functional coverage points to assist with program verification. http://hackage.haskell.org/package/atom ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Instances for Data.Text
instance Serial Text where -- DOUBT: is this efficient? series d = [T.pack (series d :: String)] -- DOUBT: how to define this coseries rs = error coseries What's Serial? The class used in SmallCheck, similar to the Arbitrary class used by QuickCheck. Regards, Malcolm ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Type synonyms vs standard types
Hi everyone, Dumb question about declaring a function and type synonyms. There are to different declarations of the same function: attrNames :: String - AttrDict - [String] attrNames :: AttrClass - AttrDict - AttrNames First gives you the idea about exact types it expects (except AttrDict for which user has to take a look into the docs or sources) while the second one gives you the idea about meaning of parameters. Both reasons make sense. The question is when which one should be used? I'm using type synonyms everywhere and possibly without too much reasons... Maybe I should stop doing it? :) Cheers, Oleksandr. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Exciting job opportunity
Principal investment firm based in Manhattan is looking for an outstanding software developer to maintain and develop proprietary accounting and portfolio management systems. Job duties will include coding projects as well as management of outsourced system maintenance. Candidates should have at least a bachelor’s degree in computer science from a top university and impeccable coding style. The majority of the programming is done in JAVA at present, so candidates must have extensive experience with JAVA and related technologies but we are always experimenting with the most exciting technologies (e.g. Haskell) and you will be given freedom in choosing suitable programming languages and technologies. Experience working with SQL is a must and familiarity with functional programming is a plus. We are looking for a candidate who shows strong analytical, organizational, and communication skills. Attention to detail is essential. We are a growth oriented firm that values people who take a craftsman’s pride in their work. Candidates must have a desire to constantly improve one's knowledge of programming and the financial markets. A true love of building quality software and a team spirit is strongly recommended. Background in accounting is not necessary but is definitely a plus. This is a high-impact, high-visibility job opportunity where successful candidates will be entrusted with a lot of responsibility for products that have a direct effect on the PL of the firm and influences our workflow. Please send your CV and cover letter to recruitm...@karamaan.com, thank you. -- View this message in context: http://www.nabble.com/Exciting-job-opportunity-tp25667801p25667801.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] double colon equal
Hi, is there anyone can tell me what does the ::= mean?And what does the code below mean? expr ::= expr addop term | term Thank you in advance! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] double colon equal
google://BNF 2009/9/29 xu zhang douy...@gmail.com: Hi, is there anyone can tell me what does the ::= mean? And what does the code below mean? expr ::= expr addop term | term Thank you in advance! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Eugene Kirpichov Web IR developer, market.yandex.ru ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] suggestion for hslogger
Hello, I have a program that does a lot of unicode manipulation. I'd like to use hslogger to log various operations. However, since hslogger uses System.IO.putX, the unicode comes out mangled. I hacked the source to use System.IO.UTF8 instead, but it would be nice if that was an option so I don't have to rehack the code whenever there is a new release. Thanks! Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Type synonyms vs standard types
On Tue, Sep 29, 2009 at 7:40 PM, Olex P hoknam...@gmail.com wrote: Hi everyone, Dumb question about declaring a function and type synonyms. There are to different declarations of the same function: attrNames :: String - AttrDict - [String] attrNames :: AttrClass - AttrDict - AttrNames First gives you the idea about exact types it expects (except AttrDict for which user has to take a look into the docs or sources) while the second one gives you the idea about meaning of parameters. Both reasons make sense. The question is when which one should be used? I'm using type synonyms everywhere and possibly without too much reasons... Maybe I should stop doing it? :) I like type synonyms. You can always look up what the type synonym boils down to, while the reverse cannot be done. Of course, some Haddock markup can also solve the problem. Michael ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] double colon equal
That expression below Is a part of a Grammar in BNF. It means that an expression is form by an expression, an add operation and a Term or simply just a Term... -Original Message- From: xu zhang douy...@gmail.com Date: Tue, 29 Sep 2009 14:15:48 To: haskell-cafe@haskell.org Subject: [Haskell-cafe] double colon equal ___ 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] Cal, Clojure, Groovy, Haskell, OCaml, etc.
On Mon, Sep 28, 2009 at 9:50 PM, Hong Yang hyang...@gmail.com wrote: Good libraries are not enough for a language to go beyond mere existence. There must exist good documents, i.e., good tutorials, good books, and good explanations and examples in the libraries, etc, that are easy for people to learn and use. In my humble opinion, Haskell has a lot of libraries, but most of them offer few examples of how to use the modules. In this regards, Perl is much much better. This. As an experienced Pythonista but a beginning Haskeller, there is *no way* I would have been able to wrap my head around the basics of Haskell without the tutorage of Learn You A Haskell, Real World Haskell, and various smaller tutorials scattered around the Haskell wiki — but I still find the array of libraries confusing (just what comes with GHC — I'm not even talking about Hackage here), since the documentation seems to be quite terse compared to Python's docs. I'm getting better at reading the code directly, but I'm often at a loss for what a particular library is good for in the first place. The library documentation seems to assume a mathematical or (advanced) computer science background, and has no problem sending a reader off to see a journal paper for details — not exactly friendly to those who are trying their hardest to unlearn their imperative ways as it is. ;-) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cal, Clojure, Groovy, Haskell, OCaml, etc.
Tom Tobin wrote: This. As an experienced Pythonista but a beginning Haskeller, there is *no way* I would have been able to wrap my head around the basics of Haskell without the tutorage of Learn You A Haskell, Real World Haskell, and various smaller tutorials scattered around the Haskell wiki — but I still find the array of libraries confusing (just what comes with GHC — I'm not even talking about Hackage here), since the documentation seems to be quite terse compared to Python's docs. I'm getting better at reading the code directly, but I'm often at a loss for what a particular library is good for in the first place. The library documentation seems to assume a mathematical or (advanced) computer science background, and has no problem sending a reader off to see a journal paper for details — not exactly friendly to those who are trying their hardest to unlearn their imperative ways as it is. ;- While some of the stuff that comes with GHC is quite well documented, others are highly under-documented. (As an exercise, go count how many module descriptions say inspired by the paper by XXX at this URL...) Admittedly, the System.IO module probably isn't the place to explain what a monad is and write a full tutorial on using them. However, look at (say) Control.Concurrent.STM.TVar. In my copy (GHC 6.10.3) it lacks even type signatures, let alone actual descriptions. Similarly, Parsec has some lovely external documentation (unfortunately as a single giant HTML page), but the Haddock stuff is bare. Now, the operative question (and I'm sure we've debated this one before) is: how do we fix all this? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Library docs glitch
Andrew Coppin wrote: While some of the stuff that comes with GHC is quite well documented, others are highly under-documented. (As an exercise, go count how many module descriptions say inspired by the paper by XXX at this URL...) Somewhat related: If I click on Control.Monad.Error, I get... an error. File not found, to be exact. It seems that the Haddock page is expecting this module to be in doc/libraries/ghc-mtl, when it is in fact in doc/libraries/mtl. I don't know if this glitch is Windows-specific, but everything in the ghc-mtl package appears to be broken. (So... most of Control.Monad then.) I have GHC 6.10.3; is this already a known problem? Or is my installation broken somehow? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Debugging Haskell code
On Sun, Sep 27, 2009 at 12:50 PM, Paul Moore p.f.mo...@gmail.com wrote: The problem is that I have *no idea* how to begin debugging this. In C, Python, or any other imperative language, I'd put traces in, etc. But in Haskell, I don't even know where to start. One of the standard modules is Debug.Trace module, which does allow you to print information to the console. It just may come in an odd order and of course, it can change your program if you force evaluation. Under the covers it is really unsafePerformIO $ putStrLn msg, i.e., it just prints to the console. I've found that forcing a flush on the output stream can be useful too, so I've defined my own trace before too. There is also the GHC debugger, which is best described in the user manual - read the section there to learn more. If you hadn't already received help on the list, either of these could be used to narrow down where the crash is occurring. Justin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cal, Clojure, Groovy, Haskell, OCaml, etc.
On Tue, Sep 29, 2009 at 3:36 PM, Andrew Coppin andrewcop...@btinternet.com wrote: Tom Tobin wrote: This. As an experienced Pythonista but a beginning Haskeller, there is *no way* I would have been able to wrap my head around the basics of Haskell without the tutorage of Learn You A Haskell, Real World Haskell, and various smaller tutorials scattered around the Haskell wiki — but I still find the array of libraries confusing (just what comes with GHC — I'm not even talking about Hackage here), since the documentation seems to be quite terse compared to Python's docs. I'm getting better at reading the code directly, but I'm often at a loss for what a particular library is good for in the first place. The library documentation seems to assume a mathematical or (advanced) computer science background, and has no problem sending a reader off to see a journal paper for details — not exactly friendly to those who are trying their hardest to unlearn their imperative ways as it is. ;- While some of the stuff that comes with GHC is quite well documented, others are highly under-documented. (As an exercise, go count how many module descriptions say inspired by the paper by XXX at this URL...) Admittedly, the System.IO module probably isn't the place to explain what a monad is and write a full tutorial on using them. However, look at (say) Control.Concurrent.STM.TVar. In my copy (GHC 6.10.3) it lacks even type signatures, let alone actual descriptions. Similarly, Parsec has some lovely external documentation (unfortunately as a single giant HTML page), but the Haddock stuff is bare. Now, the operative question (and I'm sure we've debated this one before) is: how do we fix all this? As a Wikipedian, my knee-jerk answer is: lower entrance costs! Specifically, in the past I've tried to think of uses for Gitit beyond just the normal wiki stuff. One thing I came up with: - run a Gitit wiki on top of a copy of the base libraries' repos. The actual Haskell files will be displayed as highlighted articles; eg. here's a .lisp file displayed nicely: http://gitit.net/sudoku.lisp People will be able to log in and edit the docs as they please. Every week or so, the edits could be batched up by some sort of hook and emailed to the librar...@haskell.org ML; good edits get applied to the master repo, bad edits get ignored. Another hook periodically deletes patches that don't make it to the master repo. Thanks to the darcs backend and per-article editing, we can have the 'wiki' repo (with all the Front Pages and .conf files one wants for a nice wiki) follow the 'master' repo without running into conflicts. This is nice enough an idea, but we can go further. Even better would be haddocks rebuilt on every edit, so users can edit and see the results immediately*. (You can sort of approximate this locally by working on files in an editor, keeping a cabal-install looping, and refreshing in your browser.) I can't guarantee that this would get people to contribute tips, work-arounds, and examples to the docs, but it seems much more likely to encourage contributions than our current quite arcane system of hidden repos and obscure darcs sends to even more obscure mailing lists. (Wait, you want me to implement this idea instead of just throwing out suggestions? Maybe next week...) * It's not clear to me how to make the built haddocks immediately accessible to an editor of the .hs page. After all, half the point of using Gitit is that it can work with the original repo almost as-is. I have a crazy idea that the Haddock .html can be built and then moved to Talk:sudoku.lisp, but I've no idea whether this would work. I'm not sure Talk: pages of non-article files are even possible. -- gwern ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Type synonyms vs standard types
On Tue, Sep 29, 2009 at 11:40 AM, Olex P hoknam...@gmail.com wrote: Hi everyone, Dumb question about declaring a function and type synonyms. There are to different declarations of the same function: attrNames :: String - AttrDict - [String] attrNames :: AttrClass - AttrDict - AttrNames First gives you the idea about exact types it expects (except AttrDict for which user has to take a look into the docs or sources) while the second one gives you the idea about meaning of parameters. Both reasons make sense. The question is when which one should be used? I'm using type synonyms everywhere and possibly without too much reasons... Maybe I should stop doing it? :) I get the impression that it is still largely a matter of style, and the community hasn't reached a consensus. Personally, I don't usually use type synonyms for this purpose. The function name and type are usually enough. Eg in attrNames above it should be clear what's going on: you are taking one AttrDict and one String, so the String is probably a key into the dictionary. The return is a list of Strings, and your function is called attrNames, so it's probably a list of attr names. In the cases when it is not as obvious, I usually increase the level of abstraction (typechecked documentation) instead of introducing synonyms (un-typechecked documentation). Take for example the function which checks whether a point is inside a bounding box: insideBoundingBox :: Point - Point - Point - Bool I could use synonyms to rename those arguments: insideBoundingBox :: LowerLeftPoint - UpperRightPoint - Point - Bool But I would prefer to introduce a new abstraction: data BoundingBox = BoundingBox { lowerLeft :: Point, upperRight :: Point } insideBoundingBox :: BoundingBox - Point - Bool And now the roles of the arguments are clear again. Luke ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cal, Clojure, Groovy, Haskell, OCaml, etc.
Andrew Coppin andrewcop...@btinternet.com wrote: how do we fix all this? I think the key here is to reduce the cost of contribution to a minimum. Make it as easy as possible to contribute an example, or to fill in some missing documentation (and to find it later). Cabal and hackage have made it very easy to contribute and fetch packages and I think this is the primary reason why there are so many hackage packages. We need to make it even easier to contribute documentation. I think having some haddock/wiki system that allowed user contributions which could be displayed alongside the official package dos and an easy way for package maintainers to incorporate the user supplied documentation into the official package documentation would be very helpful. To sum up: 1. Make it stupidly easy to contribute documentation, notes, comments, examples 2. Make sure all of this good stuff can be easily accessed in one place. - Job On Tue, Sep 29, 2009 at 3:36 PM, Andrew Coppin andrewcop...@btinternet.comwrote: Tom Tobin wrote: This. As an experienced Pythonista but a beginning Haskeller, there is *no way* I would have been able to wrap my head around the basics of Haskell without the tutorage of Learn You A Haskell, Real World Haskell, and various smaller tutorials scattered around the Haskell wiki — but I still find the array of libraries confusing (just what comes with GHC — I'm not even talking about Hackage here), since the documentation seems to be quite terse compared to Python's docs. I'm getting better at reading the code directly, but I'm often at a loss for what a particular library is good for in the first place. The library documentation seems to assume a mathematical or (advanced) computer science background, and has no problem sending a reader off to see a journal paper for details — not exactly friendly to those who are trying their hardest to unlearn their imperative ways as it is. ;- While some of the stuff that comes with GHC is quite well documented, others are highly under-documented. (As an exercise, go count how many module descriptions say inspired by the paper by XXX at this URL...) Admittedly, the System.IO module probably isn't the place to explain what a monad is and write a full tutorial on using them. However, look at (say) Control.Concurrent.STM.TVar. In my copy (GHC 6.10.3) it lacks even type signatures, let alone actual descriptions. Similarly, Parsec has some lovely external documentation (unfortunately as a single giant HTML page), but the Haddock stuff is bare. Now, the operative question (and I'm sure we've debated this one before) is: how do we fix all this? ___ 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] Cal, Clojure, Groovy, Haskell, OCaml, etc.
korpios: On Mon, Sep 28, 2009 at 9:50 PM, Hong Yang hyang...@gmail.com wrote: Good libraries are not enough for a language to go beyond mere existence. There must exist good documents, i.e., good tutorials, good books, and good explanations and examples in the libraries, etc, that are easy for people to learn and use. In my humble opinion, Haskell has a lot of libraries, but most of them offer few examples of how to use the modules. In this regards, Perl is much much better. This. As an experienced Pythonista but a beginning Haskeller, there is *no way* I would have been able to wrap my head around the basics of Haskell without the tutorage of Learn You A Haskell, Real World Haskell, and various smaller tutorials scattered around the Haskell wiki — but I still find the array of libraries confusing (just what comes with GHC — I'm not even talking about Hackage here), since the What comes with GHC is the Haskell Platform these days. Actually, the other way around. GHC comes with the Haskell Platform. http://haskell.org/platform/ The contents of which are specified here: http://haskell.org/platform/contents.html -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Type synonyms vs standard types
This idea with new level of abstraction is good but in some cases it can make things overcomplicated / less efficient. Does that mean leave simple built-in types as is? But probably that's all is the matter of habit and style. Thanks guys On Tue, Sep 29, 2009 at 8:58 PM, Luke Palmer lrpal...@gmail.com wrote: On Tue, Sep 29, 2009 at 11:40 AM, Olex P hoknam...@gmail.com wrote: Hi everyone, Dumb question about declaring a function and type synonyms. There are to different declarations of the same function: attrNames :: String - AttrDict - [String] attrNames :: AttrClass - AttrDict - AttrNames First gives you the idea about exact types it expects (except AttrDict for which user has to take a look into the docs or sources) while the second one gives you the idea about meaning of parameters. Both reasons make sense. The question is when which one should be used? I'm using type synonyms everywhere and possibly without too much reasons... Maybe I should stop doing it? :) I get the impression that it is still largely a matter of style, and the community hasn't reached a consensus. Personally, I don't usually use type synonyms for this purpose. The function name and type are usually enough. Eg in attrNames above it should be clear what's going on: you are taking one AttrDict and one String, so the String is probably a key into the dictionary. The return is a list of Strings, and your function is called attrNames, so it's probably a list of attr names. In the cases when it is not as obvious, I usually increase the level of abstraction (typechecked documentation) instead of introducing synonyms (un-typechecked documentation). Take for example the function which checks whether a point is inside a bounding box: insideBoundingBox :: Point - Point - Point - Bool I could use synonyms to rename those arguments: insideBoundingBox :: LowerLeftPoint - UpperRightPoint - Point - Bool But I would prefer to introduce a new abstraction: data BoundingBox = BoundingBox { lowerLeft :: Point, upperRight :: Point } insideBoundingBox :: BoundingBox - Point - Bool And now the roles of the arguments are clear again. Luke ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cal, Clojure, Groovy, Haskell, OCaml, etc.
On Tue, Sep 29, 2009 at 3:16 PM, Don Stewart d...@galois.com wrote: korpios: wiki — but I still find the array of libraries confusing (just what comes with GHC — I'm not even talking about Hackage here), since the What comes with GHC is the Haskell Platform these days. Actually, the other way around. GHC comes with the Haskell Platform. http://haskell.org/platform/ The contents of which are specified here: http://haskell.org/platform/contents.html I'm talking about poking around here randomly: http://www.haskell.org/ghc/docs/latest/html/libraries/index.html ... and trying to figure out what a given library does — not for the sake of selecting it among other options (the Platform idea), but just as part of getting a grip on Haskell's standard library, as it were. Put another way, I'm doing the opposite of the Platform — instead of saying I have requirement X, what library would be the best match?, I'm asking Hmm, hello library Y, what could I use you for? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cal, Clojure, Groovy, Haskell, OCaml, etc.
korpios: On Tue, Sep 29, 2009 at 3:16 PM, Don Stewart d...@galois.com wrote: korpios: wiki — but I still find the array of libraries confusing (just what comes with GHC — I'm not even talking about Hackage here), since the What comes with GHC is the Haskell Platform these days. Actually, the other way around. GHC comes with the Haskell Platform. http://haskell.org/platform/ The contents of which are specified here: http://haskell.org/platform/contents.html I'm talking about poking around here randomly: http://www.haskell.org/ghc/docs/latest/html/libraries/index.html ... and trying to figure out what a given library does — not for the sake of selecting it among other options (the Platform idea), but just as part of getting a grip on Haskell's standard library, as it were. Put another way, I'm doing the opposite of the Platform — instead of saying I have requirement X, what library would be the best match?, I'm asking Hmm, hello library Y, what could I use you for? Oh, indeed. Starting with the aggregated package index is a difficult direction. You might instead want to look up those core packages on Hackage, and read their overview separately: [base] http://hackage.haskell.org/package/base [array] http://hackage.haskell.org/package/array [bytestring]http://hackage.haskell.org/package/bytestring [Cabal] http://hackage.haskell.org/package/Cabal [containers]http://hackage.haskell.org/package/containers [directory] http://hackage.haskell.org/package/directory [editline] http://hackage.haskell.org/package/editline [filepath] http://hackage.haskell.org/package/filepath [haskell98] http://hackage.haskell.org/package/haskell98 [hpc] http://hackage.haskell.org/package/hpc [old-locale]http://hackage.haskell.org/package/old-locale [old-time] http://hackage.haskell.org/package/old-time [packedstring] http://hackage.haskell.org/package/packedstring [pretty]http://hackage.haskell.org/package/pretty [process] http://hackage.haskell.org/package/process [random]http://hackage.haskell.org/package/random [syb] http://hackage.haskell.org/package/syb [template-haskell] http://hackage.haskell.org/package/template-haskel [unix] http://hackage.haskell.org/package/unix [win32] http://hackage.haskell.org/package/Win32 [cgi] http://hackage.haskell.org/package/cgi [fgl] http://hackage.haskell.org/package/fgl [parsec]http://hackage.haskell.org/package/parsec [GLUT] http://hackage.haskell.org/package/GLUT [haskell-src] http://hackage.haskell.org/package/haskell-src [html] http://hackage.haskell.org/package/html [HUnit] http://hackage.haskell.org/package/HUnit [mtl] http://hackage.haskell.org/package/mtl [network] http://hackage.haskell.org/package/network [OpenGL]http://hackage.haskell.org/package/OpenGL [parallel] http://hackage.haskell.org/package/parallel [QuickCheck]http://hackage.haskell.org/package/QuickCheck [regex-base]http://hackage.haskell.org/package/regex-base [regex-compat] http://hackage.haskell.org/package/regex-compat [regex-posix] http://hackage.haskell.org/package/regex-posix [stm] http://hackage.haskell.org/package/stm [time] http://hackage.haskell.org/package/time [xhtml] http://hackage.haskell.org/package/xhtml [zlib] http://hackage.haskell.org/package/zlib [HTTP] http://hackage.haskell.org/package/HTTP I'd welcome input on how to best present all this -- the Haskell Platform gives us a chance to package up the docs in a better format for consumption. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hackage bug? Autobuild failure on literate source with ignored code blocks.
On Mon, 2009-09-28 at 12:53 -0700, John Millikin wrote: In that case, I'll update my code and the wiki to use an alternative code style. Ok. On Mon, Sep 28, 2009 at 09:21, Duncan Coutts duncan.cou...@googlemail.com wrote: Your local Cabal version is older than the one Hackage is using and that older version lets haddock (ie ghc) do the pre-processing where as in the current version Cabal does the unlitting before running haddock. That explains the difference you observe. Since Hackage is using an unstable development build of Cabal, I'd like to force it to use a released version to prevent such an issue from occurring again. I've added the following line to my .cabal file: cabal-version: = 1.6 1.7 However, when testing with Cabal 1.7.3 (which is the version used by Hackage), I am warned that: - Warning: dbus-core.cabal: This package requires Cabal version: =1.6 1.7 Distribution quality errors: This package requires Cabal version: =1.6 1.7 Note: the public hackage server would reject this package. - Does this mean that it's impossible to require an earlier version of Cabal in Hackage-published packages? If so, the use of a development version of Cabal in the auto-build system seems unwise. There's two separate issues. One is whether the package is readable by the later Cabal versions and the other is if it can be built. The hackage server itself must be able to handle the .cabal file. If that .cabal file declares that it cannot be used with a later Cabal version then we cannot do that, and we cannot accept that package on hackage. We need to be able to use later versions of Cabal on hackage than are in general use so that we can add new QA checks etc. The auto-builder is a separate matter. It's widely acknowledged that using a single builder is not a good idea. The new server will allow there to be many build clients and they can run a variety of versions of Cabal. What we really want is to version the package spec separately from the default build system. Upper bounds on the package spec make no sense where as upper bounds on the build system version make some sense sometimes. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Type synonyms vs standard types
On Tue, Sep 29, 2009 at 2:21 PM, Olex P hoknam...@gmail.com wrote: This idea with new level of abstraction is good but in some cases it can make things overcomplicated / less efficient. Does that mean leave simple built-in types as is? But probably that's all is the matter of habit and style. Well as far as efficiency, these are typically micro-considerations -- you're talking in terms of cycles. Cross those bridges when you come to them. As with overcomplication, the story is the same as with all abstraction: it's a fine balance between how much work they are to declare, their cognitive benefit, and how many times they are used. Haskell has wonderfully lightweight declarations, so that trade-off favors the new abstraction much more quickly than in other languages. Luke ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Strong duck typing / structural subtyping / type class aliases / ??? in Haskell
Yes, the OOHaskell paper blew my mind too, but I still only understood half of it when reading it for the second time (especially the mfix thing was scary :-) Not giving up though ;-) But I wander if the error messages you would get from GHC make it easy to see what is going wrong. It would be great if a library author could somehow customize error reporting too, although I have no idea if that is possible. On Tue, Sep 29, 2009 at 10:03 AM, Alp Mestan a...@mestan.fr wrote: I had never seen this work, it's just awesome ! And it only needs few Haskell extensions. Is this work deeply documented somewhere except in research papers ? If not, it could be worth doing, IMO. On Tue, Sep 29, 2009 at 9:37 AM, o...@okmij.org wrote: Alp Mestan wrote: Indeed, OCaml has stuctural polymorphism, it's a wonderful feature. *# let f myobj = myobj#foo Hi !;; val f : foo : string - 'a; .. - 'a = fun* And Haskell has that too: -- This is how we define labels. data Field1 deriving Typeable; field1 = proxy::Proxy Field1 -- This is how record selection looks like. foo f = f # field1 The inferred type of foo is *OCamlTutorial :t foo foo :: (HasField (Proxy Field1) r v) = r - v It doesn't seem too different from the OCaml's type; the type variable r acts as a row type. The quoted example is the first from many others described in http://darcs.haskell.org/OOHaskell/OCamlTutorial.hs The file quotes at length OCaml's Object tutorial and then demonstrates how the OCaml code can be written in Haskell. When it comes to objects, structural subtyping, width and depth subtyping, etc., Haskell does not seem to miss match compared to OCaml. In contrast, Haskell has a few advantages when it comes to coercions (one does not have to specify the type to coerce to, as Haskell can figure that out). The other files in that directory give many more example of encoding C++, Eiffel, OCaml patterns. -- Alp Mestan http://blog.mestan.fr/ http://alp.developpez.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
Fwd: [Haskell-cafe] suggestion for hslogger
Forwarding on to the maintainer, in case he's not on the list. -- Forwarded message -- From: Sean McLaughlin sean...@gmail.com Date: Tue, Sep 29, 2009 at 1:31 PM Subject: [Haskell-cafe] suggestion for hslogger To: haskell-cafe@haskell.org Hello, I have a program that does a lot of unicode manipulation. I'd like to use hslogger to log various operations. However, since hslogger uses System.IO.putX, the unicode comes out mangled. I hacked the source to use System.IO.UTF8 instead, but it would be nice if that was an option so I don't have to rehack the code whenever there is a new release. Thanks! Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] type class question
dear haskellers -- i'm trying this question again, in haskell-cafe. i got some responses in haskell-beginners but am looking for more guidance. also, i understand this functionality is encapsulated in the Workflow module in hackage, but i'd like to understand this myself. this email is an (il)literate haskell file. suppose i have class of computations a - State s b. for concreteness, let's say i'm writing a library of on-line statistical summary functions, like {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances #-} module Foo where import Control.Monad import Control.Monad.State import Control.Monad.State.Class data RunningAverageState = S Double Int runningAverage :: Double - State RunningAverageState Double runningAverage v = do S sum count - get let nsum = sum + v ncount = count + 1 put $ S nsum ncount return $ nsum / (fromIntegral ncount) test = take 10 $ evalState (mapM runningAverage [1..]) $ S 0 0 test - [1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5] here on-line means that we may be taking data from an intermittant external source, e.g. a data generator IO [Double], say, and want to be able to feed the summarizer datum one-by-one, and produce intermediate summaries. also we may want to be able to serialize our computation state (with Data.Binary, say) so that we can resume data collection and summarization later. naturally i want to create some common higher order operations on these primitives, like applying them to a stream of data, or combining them in some way. it seems that one would want some kind of type class to define a common interface to them. class (MonadState s m) = Summarizer s m | m - s where initialState :: s runOne :: Double - m Double where initialize puts some intial state into the system, and runOne collects and summarizes the next piece of data. an instance for runningAverage would look like instance Summarizer RunningAverageState (State RunningAverageState) where initialState = S 0 0 runOne = runningAverage but how would i use this, e.g. --summarizeMany vs = last $ evalState (mapM runOne vs) initialState is not possible as it has an ambiguous type. 1) what am i doing wrong? what are the right type class and instance declarations? 2) is there a better way of expressing this kind of on-line calculation, perhaps in pure (non-monadic) functions? i tried mapAccumL, but was looking for something a little cleaner. best, ben ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Debugging Haskell code
On Sun, Sep 27, 2009 at 9:17 PM, Paul Moore p.f.mo...@gmail.com wrote: That's odd, it seems to be saying it's not installed at all! Hmm, no - I did a cabal install --user (because Vista doesn't let me do site-wide installs), looks like cabal list doesn't pick up user installs. Hmm, cabal install mersenne-random --user didn't do anything, but cabal install mersenne-random --user --reinstall did reinstall it, and now it seems to work. To find out what GHC picks up automatically: $ ghc-pkg list /home/dougal/lib/ghc-6.10.3/./package.conf: Cabal-1.6.0.3, HUnit-1.2.0.3, QuickCheck-1.2.0.0, array-0.2.0.0, base-3.0.3.1, base-4.1.0.0, bytestring-0.9.1.4, containers-0.2.0.1, directory-1.0.0.3, (dph-base-0.3), (dph-par-0.3), (dph-prim-interface-0.3), (dph-prim-par-0.3), (dph-prim-seq-0.3), (dph-seq-0.3), extensible-exceptions-0.1.1.0, filepath-1.1.0.2, (ghc-6.10.3), ghc-prim-0.1.0.0, haddock-2.4.2, haskell-src-1.0.1.3, haskell98-1.0.1.0, hpc-0.5.0.3, html-1.0.1.2, integer-0.1.0.1, mtl-1.1.0.2, network-2.2.1, old-locale-1.0.0.1, old-time-1.0.0.2, packedstring-0.1.0.1, parallel-1.1.0.1, parsec-2.1.0.1, pretty-1.0.1.0, process-1.0.1.1, random-1.0.0.1, regex-base-0.72.0.2, regex-compat-0.71.0.1, regex-posix-0.72.0.3, rts-1.0, stm-2.1.1.2, syb-0.1.0.1, template-haskell-2.3.0.1, time-1.1.3, unix-2.3.2.0, xhtml-3000.2.0.1 /home/dougal/.ghc/i386-linux-6.10.3/package.conf: HTTP-4000.0.4, X11-1.4.5, X11-xft-0.3, benchpress-0.2.2.3, cairo-0.10.1, colour-2.3.0, cpphs-1.9, darcs-2.2.1, data-default-0.2, diagrams-0.2, gd-3000.4.0, gio-0.10.1, glib-0.10.1, gtk-0.10.1, hashed-storage-0.3.7, haskeline-0.6.1.6, haskell-src-exts-1.1.4, hscolour-1.15, mmap-0.4.1, soegtk-0.10.1, split-0.1.1, svgcairo-0.10.1, tagsoup-0.6, terminfo-0.2.2.1, terminfo-0.3.0.2, uniplate-1.2.0.3, utf8-string-0.3.4, xmonad-0.8.1, xmonad-contrib-0.8.1, zlib-0.5.0.0, zlib-0.5.2.0 You should get everything hanging about, installed system-wide or in your home directory. I assume this works much the same for Windows. D ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Market Place for Haskell development teams?
Alberto G. Corona wrote: Most successful languages spread because they are part of a platform which solves an IT problem. C was part of Unix, both brougth CPU independence when this was necessary. Java is part of the Java platform, that brougth OS independence and interoperability at the right time. .Download-execution on the client was also a reason for the initial success of Java in the Internet era. Javascript is part of the web browser. The .NET languages are part of NET. Rubi and Pyton came with libraries targeted to Rapid development of Internet applications. What is the vehicle that haskell can use to enter the mainstream?. I think that the mere interest of the ideas in the language is not enough. Many people will play with Haskell in the spare time, and many of them will be permitted to develop some non critical applications at work. But that is all. Java was not designed for the Internet but it was re-targeted to it because some needed features where already implemented in Java. Maybe something like that will happen to Haskell. I think that all the current niches are filled, but new niches are coming. specially with higher level programming that is made on top of current sorware software infrastructure such are BPM, workflows, more flexible scientific applicatins, creation of models in business intelligence, as part of ERPs,.Data mining too. And higuer levels of netwrok communications( for example, Google Wave robots) etc. I see one additional driver: Once a programming language community grows saturated, its members tend to become fastidious, 'sales people' enter the scene -- look at such Java etc. programmers proud to tell how much money they are making. This impacts the goal structure, 'success' becomes more important than 'doing interesting work' -- in consequence the spectrum of engagement narrows. IMHO, many customers just aren't involved into the language issue, just wanting to get things done -- getting the better conditions, they would not hesitate to adopt Haskell. John Hudak (e.g. see his book) proposed Haskell to be appropriate for the niche of for multimedia programming -- in fact, nowadays Anygma.com (see www.nazooka.com) is active in exactly this field, some quote from their side being interesting. At least, it is quite funny that Haskell (together with Clean Mercury) after having long to struggle with exactly this issue, now can present the deepest understanding (by Monad Co.) of IO, concurrency, state stransitions and the like, so for the future, there might be a grain of truth in it. All the time, I am astound in how so few people achieve so much in producing Haskell code! Keeping in mind that there are lots of semiautomatic quality assurance techniques, for which -- though having weaknesses in IDE's and refactoring browsing (how about the Portland hackathon?) -- in some parts (e.g. QuickCheck) plays a leading role. To me, Haskell seems to have proved one very important thing: To have emancipated programming from the highly industrialized mass production process focused upon huge organization and their hierarchy pyramids (with, usually, the coder at its base). It emancipated code (== Haskell (, although not Coq)) to serve as highest level of intellectual presentation -- what I want to say is people have some joy in expressing their special knowledge in a Haskell library. I am very interested what will happen if the parcours of competition will change from massively repeated but principally simple processes (shops, business portals, communities, maybe even ERP...) to less repetitive structures -- and inhowfar non-functional programming will become a pain then -- is that what you mean? About the last point, sometimes a basically identical infrastructure is re-engineered to a higher level, and a new language takes over. For example, the architecture of many Internet applications in the 80s was client-server based, where C, C++ was the king. This was substituted by the web architecture with Java because Java was involved in the gradual change by filling the holes of the new architecture. It could be that in a few years, instead of Web sites people could develop interoperable gadgets for aggregators such are netvibes or IGoogle or, even more radical, robots and gadgets in google Wave. Anyway, for sure, people will think and develop at a higher level. Financial applications are an example of higher level programming where tasks usually performed by humans are now automatized and there is no or few traditions about that. The need to think at a higher level without being worried by side effects and other details are specially needed in such kind of areas. That's where haskell could have its own niche. This reminds me of the whole agent thing -- pretty much dominated by Java (e.g., Jade, Jason, Jack) nowadays --, for which I would bet lots things are done more straigthforward using Haskell --
[Haskell-cafe] I read somewhere that for 90% of a wide class of computing problems, you only need 10% of the source code in Haskell, that you would in an imperative language.
I read somewhere that for 90% of a wide class of computing problems, you only need 10% of the source code in Haskell, that you would in an imperative language. If this is true, it needs to be pushed. And if by changing a few lines of source code one can develop a whole family of similar applications, that needs to be pushed, also. :) -- Regards, Casey ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] I read somewhere that for 90% of a wide class of computing problems, you only need 10% of the source code in Haskell, that you would in an imperative language.
On Tue, Sep 29, 2009 at 5:24 PM, Casey Hawthorne cas...@istar.ca wrote: I read somewhere that for 90% of a wide class of computing problems, you only need 10% of the source code in Haskell, that you would in an imperative language. If this is true, it needs to be pushed. And if by changing a few lines of source code one can develop a whole family of similar applications, that needs to be pushed, also. If you look through the archives here and elsewhere on the net, I think you'll see that technical superiority isn't the driving force for language adoption. It can help, but other factors seem to play a more significant role, usually dependent on context in which the languages became popular. At times it can seem like luck, but then I'm reminded of what Louis Pasteur said about luck and prepared minds. It is good that you're talking about Haskell though. Continue to discuss it with your peers and show them fun and cool things you've written using Haskell. I think this is more compelling for the uninitiated than statements about perceived technical power of the language. I've heard people explain this as, showing is better than telling. Cheers, Jason ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Market Place for Haskell development teams?
SORRY... it's *far after midnight* here... of course: Paul Hudak: http://cs-www.cs.yale.edu/homes/hudak-paul/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] I read somewhere that for 90% of a wide class of computing problems, you only need 10% of the source code in Haskell, that you would in an imperative language.
On Tue, 29 Sep 2009 18:19:08 -0700, you wrote: On Tue, Sep 29, 2009 at 5:24 PM, Casey Hawthorne cas...@istar.ca wrote: I read somewhere that for 90% of a wide class of computing problems, you only need 10% of the source code in Haskell, that you would in an imperative language. If this is true, it needs to be pushed. And if by changing a few lines of source code one can develop a whole family of similar applications, that needs to be pushed, also. If you look through the archives here and elsewhere on the net, I think you'll see that technical superiority isn't the driving force for language adoption. It can help, but other factors seem to play a more significant role, usually dependent on context in which the languages became popular. At times it can seem like luck, but then I'm reminded of what Louis Pasteur said about luck and prepared minds. It is good that you're talking about Haskell though. Continue to discuss it with your peers and show them fun and cool things you've written using Haskell. I think this is more compelling for the uninitiated than statements about perceived technical power of the language. I've heard people explain this as, showing is better than telling. Cheers, Jason Hmmm! Like those people that are paid to go into coffee houses with some new technology, and then people see what they're doing and wander over and ask them questions about it. showing is better than telling. It's even being used by marketers/sellers. :) -- Regards, Casey ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] I read somewhere that for 90% of a wide class of computing problems, you only need 10% of the source code in Haskell, that you would in an imperative language.
We should have GHC 6.12 launch parties like the Windows 7 ones ;) (if you haven't seen it, and are feeling masochistic: http://www.youtube.com/watch?v=1cX4t5-YpHQ) Dan On Tue, Sep 29, 2009 at 9:36 PM, Casey Hawthorne cas...@istar.ca wrote: On Tue, 29 Sep 2009 18:19:08 -0700, you wrote: On Tue, Sep 29, 2009 at 5:24 PM, Casey Hawthorne cas...@istar.ca wrote: I read somewhere that for 90% of a wide class of computing problems, you only need 10% of the source code in Haskell, that you would in an imperative language. If this is true, it needs to be pushed. And if by changing a few lines of source code one can develop a whole family of similar applications, that needs to be pushed, also. If you look through the archives here and elsewhere on the net, I think you'll see that technical superiority isn't the driving force for language adoption. It can help, but other factors seem to play a more significant role, usually dependent on context in which the languages became popular. At times it can seem like luck, but then I'm reminded of what Louis Pasteur said about luck and prepared minds. It is good that you're talking about Haskell though. Continue to discuss it with your peers and show them fun and cool things you've written using Haskell. I think this is more compelling for the uninitiated than statements about perceived technical power of the language. I've heard people explain this as, showing is better than telling. Cheers, Jason Hmmm! Like those people that are paid to go into coffee houses with some new technology, and then people see what they're doing and wander over and ask them questions about it. showing is better than telling. It's even being used by marketers/sellers. :) -- Regards, Casey ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Problem with result-type context restrictions in typeclasses.
N.B. I'm a newbie to Haskell, and this problem is a bit complex, so bear with me. I'm using typeclasses to implement a sort of common interface for all things -- call them things of type 'Cls' -- that can be expected to implement a set of functions -- an 'interface' in OOP-speak. (Yes, yes, I'm aware that typeclasses are subtly different and far superior, but my Haskell-ese is still a bit rudimentary.) Essentially, I want to have a typeclass that expects its instances to have an accessor function that results in something that is an instance of another typeclass whose instances can perform some operation. The ghc type-checker doesn't seem to like my code, though, and I can't seem to figure out why. To make it concrete, I've typed up some dummy typeclasses and a dummy function that uses their instances to illustrate what I mean, as well as the form of the ghc(i) error. - BEGIN CODE -- class Cls c where foo :: (Bar b) = c - b class Bar b where toNum :: b - Int -- | One implementation of Cls data D = D {fu :: FU} data FU = FU {num :: Int} instance Cls D where foo = fu instance Bar FU where toNum f = (num f) + 47 -- | Another implementation of Cls data E = E {fi :: FI} data FI = FI {nuum :: Int} instance Cls E where foo = fi instance Bar FI where toNum f = (nuum f) + 100 -- | Yet another (this one re-uses FI) data F = F {fii :: FI} instance Cls F where foo = fii -- | And one last one, just to stress that -- I really need to implement multiple -- instances of Cls. data G = G {fuu :: FU} instance Cls G where foo = fuu -- | Good. Now, the function 'useThisStuff' need -- not know anything about it's payload -- other than that it its args are Cls's -- (hence they are foo'able things that -- can be used to construct an Int answer). useThisStuff :: (Cls x, Cls y) = x - y - Int useThisStuff x y = (toNum $ foo x) + (toNum $ foo y) - END CODE When I type this up in a file and try to load it in ghci, I get the following error message(s): - BEGIN ERROR MSG -- Prelude :load Typeclasses.hs [1 of 1] Compiling Typeclasses ( Typeclasses.hs, interpreted ) Typeclasses.hs:14:10: Couldn't match expected type `b' against inferred type `FU' `b' is a rigid type variable bound by the type signature for `foo' at Typeclasses.hs:4:16 Expected type: D - b Inferred type: D - FU In the expression: fu In the definition of `foo': foo = fu Typeclasses.hs:23:10: Couldn't match expected type `b' against inferred type `FI' `b' is a rigid type variable bound by the type signature for `foo' at Typeclasses.hs:4:16 Expected type: E - b Inferred type: E - FI In the expression: fi In the definition of `foo': foo = fi Typeclasses.hs:31:10: Couldn't match expected type `b' against inferred type `FI' `b' is a rigid type variable bound by the type signature for `foo' at Typeclasses.hs:4:16 Expected type: F - b Inferred type: F - FI In the expression: fii In the definition of `foo': foo = fii Typeclasses.hs:39:10: Couldn't match expected type `b' against inferred type `FU' `b' is a rigid type variable bound by the type signature for `foo' at Typeclasses.hs:4:16 Expected type: G - b Inferred type: G - FU In the expression: fuu In the definition of `foo': foo = fuu Failed, modules loaded: none. - END ERROR MSG It seems that ghc doesn't like the fact that I am saying 'foo' must return a class 'b' of typeclass 'Bar', while providing a function that returns a concrete data instance of 'Bar' (viz., FU or FI) later on when I implement 'foo' in each type classes. Repeated for convenience: class Cls c where foo :: (Bar b) = c - b ... -- (e.g.) data G = G {fuu :: FU} instance Cls G where foo = fuu Does anyone have any clue as to what I'm doing wrong (language extensions that I may need, etc.)? Is is because I'm using context restrictions on the *result* type of a typeclass method? I've written other typeclasses with methods that say, essentially: class A a where blah :: (MonadPlus m) = a - a - m a with no issues. The restriction there is not on the return type a, but rather on some monadic 'wrapper' around it. This may be why that code works. Please advise. Any help is greatly appreciated. --D.N. (Dennis) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Problem with result-type context restrictions in typeclasses.
Correction by the author: It seems that ghc doesn't like the fact that I am saying 'foo' must return a class 'b' of typeclass 'Bar', while providing a function that returns a concrete data instance of 'Bar' (viz., FU or FI) later on when I implement 'foo' in each type classes. Should read: It seems that ghc doesn't like the fact that I am saying 'foo' must return something of TYPE 'b' implementing typeclass 'Bar', while providing a function that returns a concrete data instance of 'Bar' (viz., FU or FI) later on when I implement 'foo' in each type classes. On Sep 29, 10:43 pm, DNM dnme...@gmail.com wrote: N.B. I'm a newbie to Haskell, and this problem is a bit complex, so bear with me. I'm using typeclasses to implement a sort of common interface for all things -- call them things of type 'Cls' -- that can be expected to implement a set of functions -- an 'interface' in OOP-speak. (Yes, yes, I'm aware that typeclasses are subtly different and far superior, but my Haskell-ese is still a bit rudimentary.) Essentially, I want to have a typeclass that expects its instances to have an accessor function that results in something that is an instance of another typeclass whose instances can perform some operation. The ghc type-checker doesn't seem to like my code, though, and I can't seem to figure out why. To make it concrete, I've typed up some dummy typeclasses and a dummy function that uses their instances to illustrate what I mean, as well as the form of the ghc(i) error. - BEGIN CODE -- class Cls c where foo :: (Bar b) = c - b class Bar b where toNum :: b - Int -- | One implementation of Cls data D = D {fu :: FU} data FU = FU {num :: Int} instance Cls D where foo = fu instance Bar FU where toNum f = (num f) + 47 -- | Another implementation of Cls data E = E {fi :: FI} data FI = FI {nuum :: Int} instance Cls E where foo = fi instance Bar FI where toNum f = (nuum f) + 100 -- | Yet another (this one re-uses FI) data F = F {fii :: FI} instance Cls F where foo = fii -- | And one last one, just to stress that -- I really need to implement multiple -- instances of Cls. data G = G {fuu :: FU} instance Cls G where foo = fuu -- | Good. Now, the function 'useThisStuff' need -- not know anything about it's payload -- other than that it its args are Cls's -- (hence they are foo'able things that -- can be used to construct an Int answer). useThisStuff :: (Cls x, Cls y) = x - y - Int useThisStuff x y = (toNum $ foo x) + (toNum $ foo y) - END CODE When I type this up in a file and try to load it in ghci, I get the following error message(s): - BEGIN ERROR MSG -- Prelude :load Typeclasses.hs [1 of 1] Compiling Typeclasses ( Typeclasses.hs, interpreted ) Typeclasses.hs:14:10: Couldn't match expected type `b' against inferred type `FU' `b' is a rigid type variable bound by the type signature for `foo' at Typeclasses.hs:4:16 Expected type: D - b Inferred type: D - FU In the expression: fu In the definition of `foo': foo = fu Typeclasses.hs:23:10: Couldn't match expected type `b' against inferred type `FI' `b' is a rigid type variable bound by the type signature for `foo' at Typeclasses.hs:4:16 Expected type: E - b Inferred type: E - FI In the expression: fi In the definition of `foo': foo = fi Typeclasses.hs:31:10: Couldn't match expected type `b' against inferred type `FI' `b' is a rigid type variable bound by the type signature for `foo' at Typeclasses.hs:4:16 Expected type: F - b Inferred type: F - FI In the expression: fii In the definition of `foo': foo = fii Typeclasses.hs:39:10: Couldn't match expected type `b' against inferred type `FU' `b' is a rigid type variable bound by the type signature for `foo' at Typeclasses.hs:4:16 Expected type: G - b Inferred type: G - FU In the expression: fuu In the definition of `foo': foo = fuu Failed, modules loaded: none. - END ERROR MSG It seems that ghc doesn't like the fact that I am saying 'foo' must return a class 'b' of typeclass 'Bar', while providing a function that returns a concrete data instance of 'Bar' (viz., FU or FI) later on when I implement 'foo' in each type classes. Repeated for convenience: class Cls c where foo :: (Bar b) = c - b ... -- (e.g.) data G = G {fuu :: FU} instance Cls G where foo = fuu Does anyone have any clue as to what I'm doing wrong (language extensions that I may need, etc.)? Is is because I'm using context restrictions on the *result* type of a typeclass method? I've written other typeclasses with methods that say, essentially: class A a where blah :: (MonadPlus m) = a - a -
Re: [Haskell-cafe] Re: Problem with result-type context restrictions in typeclasses.
In your class, you have: class Cls c where foo :: (Bar b) = c - b There's an implicit forall for b, meaning that the caller of the method gets to choose what it wants for b (as long as it's an instance of Bar). For you to be able to write such a method you'd need to write functions that can return any instance of Bar. One solution to this is to turn on the GHC extension -XTypeFamilies, and then modify your code as follows: class Cls c where type Ret c :: * -- or a better name foo :: c - Ret c instance Cls G where type Ret G = FU foo = fuu That should work (although I haven't tested it). What type families do in this case is allow you to write not only methods associated with typeclasses, but type functions associated with them too. In this case you can think of Ret as a function that takes a type (G in the instance above) and returns another type (FU). Each instance can define new mappings for Ret. Hope this helps! Dan On Tue, Sep 29, 2009 at 10:48 PM, DNM dnme...@gmail.com wrote: Correction by the author: It seems that ghc doesn't like the fact that I am saying 'foo' must return a class 'b' of typeclass 'Bar', while providing a function that returns a concrete data instance of 'Bar' (viz., FU or FI) later on when I implement 'foo' in each type classes. Should read: It seems that ghc doesn't like the fact that I am saying 'foo' must return something of TYPE 'b' implementing typeclass 'Bar', while providing a function that returns a concrete data instance of 'Bar' (viz., FU or FI) later on when I implement 'foo' in each type classes. On Sep 29, 10:43 pm, DNM dnme...@gmail.com wrote: N.B. I'm a newbie to Haskell, and this problem is a bit complex, so bear with me. I'm using typeclasses to implement a sort of common interface for all things -- call them things of type 'Cls' -- that can be expected to implement a set of functions -- an 'interface' in OOP-speak. (Yes, yes, I'm aware that typeclasses are subtly different and far superior, but my Haskell-ese is still a bit rudimentary.) Essentially, I want to have a typeclass that expects its instances to have an accessor function that results in something that is an instance of another typeclass whose instances can perform some operation. The ghc type-checker doesn't seem to like my code, though, and I can't seem to figure out why. To make it concrete, I've typed up some dummy typeclasses and a dummy function that uses their instances to illustrate what I mean, as well as the form of the ghc(i) error. - BEGIN CODE -- class Cls c where foo :: (Bar b) = c - b class Bar b where toNum :: b - Int -- | One implementation of Cls data D = D {fu :: FU} data FU = FU {num :: Int} instance Cls D where foo = fu instance Bar FU where toNum f = (num f) + 47 -- | Another implementation of Cls data E = E {fi :: FI} data FI = FI {nuum :: Int} instance Cls E where foo = fi instance Bar FI where toNum f = (nuum f) + 100 -- | Yet another (this one re-uses FI) data F = F {fii :: FI} instance Cls F where foo = fii -- | And one last one, just to stress that -- I really need to implement multiple -- instances of Cls. data G = G {fuu :: FU} instance Cls G where foo = fuu -- | Good. Now, the function 'useThisStuff' need -- not know anything about it's payload -- other than that it its args are Cls's -- (hence they are foo'able things that -- can be used to construct an Int answer). useThisStuff :: (Cls x, Cls y) = x - y - Int useThisStuff x y = (toNum $ foo x) + (toNum $ foo y) - END CODE When I type this up in a file and try to load it in ghci, I get the following error message(s): - BEGIN ERROR MSG -- Prelude :load Typeclasses.hs [1 of 1] Compiling Typeclasses ( Typeclasses.hs, interpreted ) Typeclasses.hs:14:10: Couldn't match expected type `b' against inferred type `FU' `b' is a rigid type variable bound by the type signature for `foo' at Typeclasses.hs:4:16 Expected type: D - b Inferred type: D - FU In the expression: fu In the definition of `foo': foo = fu Typeclasses.hs:23:10: Couldn't match expected type `b' against inferred type `FI' `b' is a rigid type variable bound by the type signature for `foo' at Typeclasses.hs:4:16 Expected type: E - b Inferred type: E - FI In the expression: fi In the definition of `foo': foo = fi Typeclasses.hs:31:10: Couldn't match expected type `b' against inferred type `FI' `b' is a rigid type variable bound by the type signature for `foo' at Typeclasses.hs:4:16 Expected type: F - b Inferred type: F - FI In the expression: fii In the definition of `foo': foo = fii Typeclasses.hs:39:10: Couldn't match expected type `b' against inferred type `FU'
[Haskell-cafe] ANNOUNCE: vty-ui 0.1
vty-ui is: An extensible library of user interface widgets for composing and laying out Vty user interfaces. This library provides a collection of widgets and a type class for rendering widgets to Vty Images. Get it from Hackage: http://hackage.haskell.org/package/vty-ui Or get the source with darcs: http://repos.codevine.org/vty-ui This package is motivated by the desire to create terminal user interfaces easily without having to worry about doing all of the structural book-keeping that so often comes with such an approach. Future releases will probably include more widget composition tools, more interesting widgets, and helper code for building interesting things. For now, the library contains some basic widgets (including horizontal and vertical box layout) and a List widget. See the vty-ui-demo program and source for an interactive demonstration of the available widgets. Future releases may also address performance, as I honestly don't have a very clear idea of how well my approach is going to scale for non-trivial interfaces. Please don't hesitate to send patches, feedback, and criticism directly to me at drcygnus AT gmail DOT com. Lastly, thanks a ton to the authors of Vty. It's a pleasure to use. Enjoy! -- Jonathan Daugherty ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe