Re: [Haskell-cafe] Problems translating Conor McBride's talk into Haskell + DataKind + KindPoly

2012-10-26 Thread José Pedro Magalhães
Hi, Please use GHC 7.6 for experimenting with PolyKinds/DataKinds; the implementation in 7.4 was not fully complete. Your code compiles fine in 7.6. Cheers, Pedro On Fri, Oct 26, 2012 at 3:10 AM, Ahn, Ki Yung kya...@gmail.com wrote: Promotion works for user defined lists such as data List

Re: [Haskell-cafe] Type-directed functions with data kinds

2012-10-26 Thread Adam Gundry
Hi Paul, On 25/10/12 16:22, Paul Visschers wrote: Hello everyone, I've been playing around with the data kinds extension to implement vectors that have a known length at compile time. Some simple code to illustrate: [...] In this code I have defined a repeat function that works in a

[Haskell-cafe] Munich Haskell Meeting

2012-10-26 Thread Heinrich Hördegen
Dear all, next Monday, 29th of October, our monthly Haskell Meeting will take place at 19h30 at Cafe Puck. Everybody interested in functional programming is wellcome. Please go to http://www.haskell-munich.de/dates for more information and push the button, if you intend to join. With hope

[Haskell-cafe] ANNOUNCE: pretty-tree

2012-10-26 Thread Ivan Lazar Miljenovic
For a project I'm working on, I got sick of writing out trees by hand. Data.Tree has a drawTree function, but whilst it's better than nothing, I prefer a more top-down traditional approach to drawing trees. So I wrote a package to do just that: http://hackage.haskell.org/package/pretty-tree (I

Re: [Haskell-cafe] ANNOUNCE: pretty-tree

2012-10-26 Thread Alfredo Di Napoli
The idea is pretty good, although I suggest you make clickable the Haddock's link to modules, because I had to navigate the source in order to find some application as well as nice tree visualizations :) Cheers, A. On 26 October 2012 14:58, Ivan Lazar Miljenovic ivan.miljeno...@gmail.comwrote:

Re: [Haskell-cafe] Sparse records/ADTs

2012-10-26 Thread Jon Fairbairn
Twan van Laarhoven twa...@gmail.com writes: On 24/10/12 12:08, Jon Fairbairn wrote: Is there a convenient way of handling a data structure with lots of fields of different types that may or may not be filled in? Not sure about convenience, but here is a type safe solution with O(log n)

Re: [Haskell-cafe] Sparse records/ADTs

2012-10-26 Thread Yuri de Wit
Would this be relevant? https://github.com/jonsterling/Data.Records On Fri, Oct 26, 2012 at 11:17 AM, Jon Fairbairn jon.fairba...@cl.cam.ac.ukwrote: Twan van Laarhoven twa...@gmail.com writes: On 24/10/12 12:08, Jon Fairbairn wrote: Is there a convenient way of handling a data

[Haskell-cafe] foldr (.) id

2012-10-26 Thread Greg Fitzgerald
Hi Haskellers, I've recently found myself using the expression: foldr (.) id to compose a list (or Foldable) of functions. It's especially useful when I need to map a function over the list before composing. Does this function, or the more general foldr fmap id, defined in a library anywhere?

Re: [Haskell-cafe] foldr (.) id

2012-10-26 Thread John Wiegley
Greg Fitzgerald gari...@gmail.com writes: I've recently found myself using the expression: foldr (.) id to compose a list (or Foldable) of functions. You want the Endo monoid: ghci appEndo (Endo (+ 10) Endo (+ 20)) $ 3 33 John ___

Re: [Haskell-cafe] foldr (.) id

2012-10-26 Thread Thiago Negri
Can you please show some examples where it might be useful? I miss the point. Thanks, Thiago. 2012/10/26 John Wiegley jo...@newartisans.com: Greg Fitzgerald gari...@gmail.com writes: I've recently found myself using the expression: foldr (.) id to compose a list (or Foldable) of functions.

Re: [Haskell-cafe] ANNOUNCE: pretty-tree

2012-10-26 Thread Ivan Lazar Miljenovic
Which links _aren't_ clickable? If you mean the one to diagrams-contrib, since it isn't imported I can't link to that module directly. One thing I just realised: compared to drawTrees, drawVerticalTree reverses the direction of sub-trees (in that it isn't just equivalent to rotating it clockwise

[Haskell-cafe] [Off-topic] How unimportant it is whether submarines can swim (EWD1056)

2012-10-26 Thread Henk-Jan van Tuyl
L.S., I thought you might be interested to know, that I have translated one of prof. Edsger W. Dijkstra's writings to English[0]. I will submit this translation to the E. W. Dijkstra Archive of the University of Texas[1]. Some of the highlights: - can submarines swim? - redefining

Re: [Haskell-cafe] foldr (.) id

2012-10-26 Thread John Wiegley
Thiago Negri evoh...@gmail.com writes: Can you please show some examples where it might be useful? I miss the point. I guess if he already has a list of functions, Endo won't help. Endo just lets you treat functions as monoids, so you can foldMap, etc. In that case, foldr (.) id is pretty

Re: [Haskell-cafe] foldr (.) id

2012-10-26 Thread Greg Fitzgerald
Hmm, neato. but didn't make life any easier! Data.Monoid (appEndo . mconcat . map Endo) [(+10), (+20)] 3 33 Data.Monoid (foldr (.) id) [(+10), (+20)] 3 33 I had hoped for something like: mconcat [(+10), (+20)] 3 But I suppose that's nonsense, considering this works: mconcat [(++10),

Re: [Haskell-cafe] foldr (.) id

2012-10-26 Thread Greg Fitzgerald
sorry for the buggy code let parseOrIgnore p s = either (const s) id $ parse p s let parseAllOrIgnore = compose . map parseOrIgnore [p1, p2, p3] parseAllOrIgnore abbbcccbbba On Fri, Oct 26, 2012 at 2:11 PM, Greg Fitzgerald gari...@gmail.com wrote: Hmm, neato. but didn't make life any

Re: [Haskell-cafe] ANNOUNCE: pretty-tree

2012-10-26 Thread Roman Cheplyaka
I think Alfredo meant the link to module's haddock which had not been generated when you sent out the announcement. Roman * Ivan Lazar Miljenovic ivan.miljeno...@gmail.com [2012-10-27 07:37:10+1100] Which links _aren't_ clickable? If you mean the one to diagrams-contrib, since it isn't

Re: [Haskell-cafe] [Off-topic] How unimportant it is whether submarines can swim (EWD1056)

2012-10-26 Thread Gwern Branwen
On Fri, Oct 26, 2012 at 4:51 PM, Henk-Jan van Tuyl hjgt...@chello.nl wrote: L.S., I thought you might be interested to know, that I have translated one of prof. Edsger W. Dijkstra's writings to English[0]. I will submit this translation to the E. W. Dijkstra Archive of the University of

Re: [Haskell-cafe] ANNOUNCE: pretty-tree

2012-10-26 Thread Levent Erkok
Iavor's pretty-show package is quite handy for these kind of tasks as well. Highly recommended: http://hackage.haskell.org/package/pretty-show Since Iavor package is not tree-centric, it'll probably not generate as nice output as you can for real tree-like-data. However, since it works on

Re: [Haskell-cafe] foldr (.) id

2012-10-26 Thread Nick Vanderweit
Funny, I was thinking this morning about using something like this to convert to/from Church numerals: church n = foldl (.) id . replicate n unchurch f = f succ 0 I think it's a nice pattern. Nick On Friday, October 26, 2012 11:41:18 AM Greg Fitzgerald wrote: Hi Haskellers, I've recently

Re: [Haskell-cafe] foldr (.) id

2012-10-26 Thread Tony Morris
It's the Endo monoid. ? :t ala Endo foldMap -- see newtype package ala Endo foldMap :: Foldable t = t (a - a) - a - a ? ala Endo foldMap [(+1), (*2)] 8 17 ? :i ala ala :: (Newtype n o, Newtype n' o') = (o - n) - ((o - n) - b - n') - b - o' -- Defined in Control.Newtype On 27/10/12