Re: [Haskell-cafe] A Mascot
On Tue, Nov 15, 2011 at 08:18:04PM -0800, John Meacham wrote: People tend to concentrate on the lambda which cooresponds to the functional aspect of haskell when designing logos. Not nearly enough attention is paid to the other striking feature, the laziness. If we want to emphasize the lazyness, why not a sloth instead of a lamb? http://en.wikipedia.org/wiki/Sloth - is this cute or what ;-) jm2c. Unfortunatelly my drawing skills suck I am unable to come up with a concrete logo. But maybe somebody else is gifted to do so. Greetings Alex signature.asc Description: Digital signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Deduce problem.
From the code, I think it is what I want. But still, I need some time to understand it Anyway, thank you. On Thu, Nov 17, 2011 at 4:02 PM, o...@okmij.org wrote: Multi-parameter type classes are more flexible. Here is how you can write your old code: {-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-} class (ClassA a, ClassB b) = ClassC a b where from :: a - [b] to :: a - [b] data H = H class ClassA a where toInt :: a - Int class ClassB b where fromInt :: Int - b instance ClassB H where fromInt _ = H data Test = Test { m :: H } instance ClassA Test where toInt _ = 0 instance ClassC Test H where from = (:[]) . m to = (:[]) . m The constraints in the ClassC a b declaration specify that in all instances of ClassC, the type a must be in ClassA and the type b must be in ClassB. This is the case for the ClassC Test H instance. You can also specify that for some particular 'a' the function 'from' can produce the value of the type [b] for any b in ClassB. The caller will determine which b it wants. This is similar to your original intention, as I understand. instance ClassA Int where toInt = id instance ClassB b = ClassC Int b where from x = [fromInt x] t1:: [H] t1 = from (5::Int) -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] A Mascot
On Thu, Nov 17, 2011 at 10:28:47AM +0100, Alexander Bernauer wrote: On Tue, Nov 15, 2011 at 08:18:04PM -0800, John Meacham wrote: People tend to concentrate on the lambda which cooresponds to the functional aspect of haskell when designing logos. Not nearly enough attention is paid to the other striking feature, the laziness. If we want to emphasize the lazyness, why not a sloth instead of a lamb? http://en.wikipedia.org/wiki/Sloth - is this cute or what ;-) Sloths are not lazy, they are just slow. I doubt that's the impression we want to give of Haskell. =) -Brent ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is SmallCheck maintained?
On Mon, Nov 14, 2011 at 9:54 AM, Roman Cheplyaka r...@ro-che.info wrote: Hi Cafe, Does anyone currently work on Test.SmallCheck? I recall this being an unfortunate problem from the first release. As I recall the author was interested in getting the concept out there but had no motivation (or was it interest?) in keeping it alive as a project. Sounds to me like you should plan on taking over if no one objects. Good luck, Jason ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] A Mascot
On 16/11/2011 04:50 AM, heathmatlock wrote: On Tue, Nov 15, 2011 at 10:18 PM, John Meacham j...@repetae.net mailto:j...@repetae.net wrote: People tend to concentrate on the lambda which cooresponds to the functional aspect of haskell when designing logos. Not nearly enough attention is paid to the other striking feature, the laziness. The 'bottom' symbol _|_ should feature prominently. The two most defining features of haskell are that it is purely functional and _|_ inhabits every type. The combination of which is very powerful. John I would have to think about this a bit longer, but here's the symbol reworked onto the helmet: http://i.imgur.com/ZziGQ.png If you're going to draw a piece of graphics, why use ASCII workarounds like _|_, when you can use the real thing (i.e., ⊥)? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] A Mascot
On Thu, Nov 17, 2011 at 12:22 PM, Andrew Coppin andrewcop...@btinternet.com wrote: On 16/11/2011 04:50 AM, heathmatlock wrote: If you're going to draw a piece of graphics, why use ASCII workarounds like _|_, when you can use the real thing (i.e., ⊥)? Noted, will change. Are we going to have a contest for a mascot? -- Heath Matlock +1 256 274 4225 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ST not strict enough?
2011/11/16 Johan Tibell johan.tib...@gmail.com: On Wed, Nov 16, 2011 at 2:23 PM, Jason Dusek jason.du...@gmail.com wrote: Tried a modifySTRef' defined this way: modifySTRef' ref f = do val - (f $!!) $ readSTRef ref writeSTRef ref (val `seq` val) ...but there was no change in memory usage. Why not just modifySTRef :: STRef s a - (a - a) - ST s () modifySTRef ref f = do x - readSTRef ref writeSTRef ref $! f x (Note that I didn't check if modifySTRef was actually a problem in this case). I just didn't want to miss an opportunity to put in extra strictness annotations! School of redundancy school. -- Jason Dusek () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Superset of Haddock and Markdown
Hi all, I spent some time today documenting a library and the experience left me wanting a better markup language. In particular, Haddock lacks: * markup for bold text: bold text works better than italics for emphasis on computer monitors. * hyperlinks with anchor texts: having the actual URL rendered inline with text hurts readability. Could Haddock markup be extended to also include some Markdown features? The new features could be hidden behind a flag so old documentation doesn't get unwanted markup (e.g. if it uses *...* to not mean bold). P.S. This good make a good weekend hack that shouldn't be too difficult. -- Johan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ST not strict enough?
2011/11/16 Tristan Ravitch travi...@cs.wisc.edu: Have you tried building the vector using things besides write/ST? It might be a bit faster to use something like Vector.unfoldr or Vector.generateM and ByteString.index to build up a pure Vector. After that you could use Vector.unsafeThaw to convert that pure Vector into an MVector. I tried unfoldrN and, indeed, the memory usage has gone down. Residency seems to be 45K, regardless of input size; and the productivity is above 90% even for small (128K) inputs. Thanks for your suggestion. -- Jason Dusek () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Documenting strictness properties for Data.Map.Strict
Hi all, Data.Map is getting split into Data.Map.Lazy and Data.Map.Strict (with Data.Map re-exporting the lazy API). I want to better document the strictness properties of the two new modules. Right now the documentation for Data.Map.Strict reads: Strictness properties = * All functions are strict in both key and value arguments. Examples: insertWith (+) k undefined m == undefined delete undefined m == undefined * Keys and values are evaluated to WHNF before they are stored in the map. Examples: map (\ v - undefined) == undefined mapKeys (\ k - undefined) == undefined I'm not entirely happy with this formulation. I'm looking for something that's clear (i.e. precise and concise, without leaving out important information), assuming that the reader already knows how lazy evaluation works at a high level. Ideas? Cheers, Johan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Superset of Haddock and Markdown
On 18 November 2011 16:09, Johan Tibell johan.tib...@gmail.com wrote: Hi all, I spent some time today documenting a library and the experience left me wanting a better markup language. In particular, Haddock lacks: * markup for bold text: bold text works better than italics for emphasis on computer monitors. Even for the italics offered by /.../ would ideally be replaced, as too often people (including myself) forget to escape paths or when listing alternatives (e.g. foo/bar), leading to borked documentation. * hyperlinks with anchor texts: having the actual URL rendered inline with text hurts readability. Could Haddock markup be extended to also include some Markdown features? The new features could be hidden behind a flag so old documentation doesn't get unwanted markup (e.g. if it uses *...* to not mean bold). Wasn't there talk at one stage of integrating pandoc into haddock? -- 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] Documenting strictness properties for Data.Map.Strict
On Thu, Nov 17, 2011 at 9:21 PM, Johan Tibell johan.tib...@gmail.com wrote: I'm not entirely happy with this formulation. I'm looking for something that's clear (i.e. precise and concise, without leaving out important information), assuming that the reader already knows how lazy evaluation works at a high level. Ideas? This reads a bit better to me: Strictness properties = This module is strict in keys and values. In particular, * key and value function arguments passed to functions are evaluated to WHNF before the function body is evaluated, and * keys and values returned by high-order function arguments are evaluated to WHNF before they are inserted into the map. Here are some examples: insertWith (+) k undefined m == undefined delete undefined m == undefined map (\ v - undefined) == undefined mapKeys (\ k - undefined) == undefined Any ideas for further improvements? -- Johan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Documenting strictness properties for Data.Map.Strict
On 18 November 2011 16:44, Johan Tibell johan.tib...@gmail.com wrote: On Thu, Nov 17, 2011 at 9:21 PM, Johan Tibell johan.tib...@gmail.com wrote: I'm not entirely happy with this formulation. I'm looking for something that's clear (i.e. precise and concise, without leaving out important information), assuming that the reader already knows how lazy evaluation works at a high level. Ideas? This reads a bit better to me: Strictness properties = This module is strict in keys and values. In particular, * key and value function arguments passed to functions are evaluated to WHNF before the function body is evaluated, and * keys and values returned by high-order function arguments are evaluated to WHNF before they are inserted into the map. Here are some examples: insertWith (+) k undefined m == undefined delete undefined m == undefined map (\ v - undefined) == undefined mapKeys (\ k - undefined) == undefined Any ideas for further improvements? I think this is rather clear and to the point, maybe just re-word key and value function arguments passed to functions ... (maybe just key and value arguments ?) -- 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] Documenting strictness properties for Data.Map.Strict
Any ideas for further improvements? I feel like there should be a canonical what is WHNF page on haskell.org that docs like this can link to. Namely, what it is theoretically, what that means for various examples of thunks (i.e. show how a sample graph would get reduced), and what that means for programs (e.g. this builds up thunks, this doesn't). All this info is certainly available, but it seems to not be as easy as it should be to find, e.g. http://haskell.org/haskellwiki/Lazy_vs._non-strict says described WHNF... and, well, http://en.wikibooks.org/wiki/Haskell/Laziness#Thunks_and_Weak_head_normal_form is pretty good actually. Maybe the haskellwiki page should just link to that. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] A Mascot
Last time to upload images for a long time, the break is here and I have work to do! I got a bit tired of explaining that it's a lamb, and not something similar to a rat, so I made the face less abstract. My little niece liked it better than the old one for some reason. Here's some images I threw together, much more left to add to the environments: http://imgur.com/a/niiTF#0 Anywho, I'll quit spamming about the mascot until someone decides to create a poll. -- Heath Matlock +1 256 274 4225 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Can I have an alias for selector?
On 18 November 2011 18:16, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi, For example: data A = B { c :: Int }. Then I must use it this way (B 0) { c = 1 }. Anyway I could make it like (B 0) { d = 1 }? No, but you *can* write a function of type `B - Int - B' to do it for you. -- 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