[Haskell-cafe] Re: Literate programming

2010-06-13 Thread Gour
On Sat, 12 Jun 2010 17:10:07 -0400 aditya == aditya siram aditya.si...@gmail.com wrote: aditya Unfortunately literate programming doesn't really have the tool aditya support yet. I use emacs for Haskell development and loading aditya Haskell code in to the REPL will be an issue if you're editing

[Haskell-cafe] Harder than you'd think

2010-06-13 Thread Andrew Coppin
So the other day I was writing some code, and I ended up wanting to have a collection of data indexed in more than one way. In other words, I wanted fast lookup with several different keys. Initially I built something using two Data.Map objects to represent the two lookup keys, but then I

Re: [Haskell-cafe] Harder than you'd think

2010-06-13 Thread Felipe Lessa
On Sun, Jun 13, 2010 at 01:09:24PM +0100, Andrew Coppin wrote: Does anybody have a less-insane way of doing this? Did you take a look at happstack-ixset[1]? [1] http://hackage.haskell.org/package/happstack-ixset -- Felipe. ___ Haskell-Cafe mailing

Re: [Haskell-cafe] Harder than you'd think

2010-06-13 Thread Marc Weber
What I ended up writing is this: http://www.hpaste.org/fastcgi/hpaste.fcgi/view?id=25782 lookup :: KeyID - Key - Container - Maybe Value Does anybody have a less-insane way of doing this? Sure: type MyMap = Map (KeyID, Key) Value Don't use multiple keys. Put the keys into a tuple and

Re: [Haskell-cafe] Harder than you'd think

2010-06-13 Thread Andrew Coppin
Felipe Lessa wrote: On Sun, Jun 13, 2010 at 01:09:24PM +0100, Andrew Coppin wrote: Does anybody have a less-insane way of doing this? Did you take a look at happstack-ixset[1]? No. I'll take a look at it. (From the looks of it, it seems to be using TH and/or run-time checks to

Re: [Haskell-cafe] Harder than you'd think

2010-06-13 Thread Peter Robinson
On 13 June 2010 15:23, Andrew Coppin andrewcop...@btinternet.com wrote: Felipe Lessa wrote: On Sun, Jun 13, 2010 at 01:09:24PM +0100, Andrew Coppin wrote: Does anybody have a less-insane way of doing this? Did you take a look at happstack-ixset[1]? No. I'll take a look at it. (From

Re: [Haskell-cafe] Harder than you'd think

2010-06-13 Thread Andrew Coppin
Marc Weber wrote: Does anybody have a less-insane way of doing this? Sure: type MyMap = Map (KeyID, Key) Value Don't use multiple keys. Put the keys into a tuple and use that as key. Let me know whether this is what you were looking for. Trouble is, this requires you to have

Re: [Haskell-cafe] Harder than you'd think

2010-06-13 Thread Andrew Coppin
Philippa Cowderoy wrote: On 13/06/2010 14:52, Andrew Coppin wrote: Marc Weber wrote: Does anybody have a less-insane way of doing this? Sure: type MyMap = Map (KeyID, Key) Value Don't use multiple keys. Put the keys into a tuple and use that as key. Let me know whether this is what you

Re: [Haskell-cafe] Difficulties with tagless - create primitives or compose them

2010-06-13 Thread Jacques Carette
Excellent answer! Splitting the Symantics class into pieces is one of the techniques that we didn't need for solving the original problem (tagless partial evaluation without resorting to fancy types) that set us on this track. Which is too bad, because it would have made a nice addition. The

[Haskell-cafe] Re: Difficulties with tagless - create primitives or compose them

2010-06-13 Thread Günther Schmidt
Dear Jacques, I have recently found something new that might also prove to be useful for EDSLs. http://blog.sigfpe.com/2009/05/three-projections-of-doctor-futamura.html Dan's blog post doesn't give any code or implementation but in a way it tackles the same problem, and since you also

[Haskell-cafe] Re: Harder than you'd think

2010-06-13 Thread Heinrich Apfelmus
Marc Weber wrote: Andrew Coppin wrote: What I ended up writing is this: http://www.hpaste.org/fastcgi/hpaste.fcgi/view?id=25782 lookup :: KeyID - Key - Container - Maybe Value Does anybody have a less-insane way of doing this? Sure: type MyMap = Map (KeyID, Key) Value Don't

[Haskell-cafe] Graph type

2010-06-13 Thread C K Kashyap
Hi, I am trying to write a routine that would generate a graph - where each vertex would be a string. type Graph v = [(v,[v])] -- list of tuples of vertices and adjacent vertices list addEdgeToGraph :: Graph - String - String - Graph I am having trouble coming up with the body of this function

Re: [Haskell-cafe] Harder than you'd think

2010-06-13 Thread Jeremy Shaw
Hello, My idea for solving this problem was to try to use something similar to a kd-tree. I have a proof of concept for 2 keys here: http://src.seereason.com/haskell-kdmap/ But, to extend it to an arbitrary number of keys may need template haskell. The basic concept is to build a

Re: [Haskell-cafe] Harder than you'd think

2010-06-13 Thread Marc Weber
Excerpts from Jeremy Shaw's message of Sun Jun 13 19:16:02 +0200 2010: Hello, My idea for solving this problem was to try to use something similar to a kd-tree. I have a proof of concept for 2 keys here: http://src.seereason.com/haskell-kdmap/ But, to extend it to an arbitrary number

Re: [Haskell-cafe] Graph type

2010-06-13 Thread Roman Cheplyaka
* C K Kashyap ckkash...@gmail.com [2010-06-13 22:45:44+0530] Hi, I am trying to write a routine that would generate a graph - where each vertex would be a string. type Graph v = [(v,[v])] -- list of tuples of vertices and adjacent vertices list addEdgeToGraph :: Graph - String - String

[Haskell-cafe] Announce: Properties-0.0.2

2010-06-13 Thread Alberto G. Corona
http://hackage.haskell.org/package/properties-0.0.2 http://hackage.haskell.org/package/properties-0.0.2Properties can use QuickCheck properties in the same way than assertions are used, for causal debugging of real programs. It also add an human readable structure for grouping properties for

[Haskell-cafe] How to browse code written by others

2010-06-13 Thread Martin Drautzburg
Hello all, I need your advice about how to browse code which was written by someone else (Paul Hudak's Euterpea, to be precise, apx. 1 LOC). I had set some hopes on leksah, and it indeed shows me the interfaces, but I have not yet convinced it to show me more than that. I ran haddock over

Re: [Haskell-cafe] How to browse code written by others

2010-06-13 Thread Stephen Tetley
Hi Martin With Haddock you can also make the highlighted source as per docs hosted on Hackage. Install hscolour, then when you invoke haddock on the cabal file add the --hyperlink-source flag. No hyperlinks in the source though, just colourization. Thomas Hallgren had another source-to-html tool

Re: [Haskell-cafe] How to browse code written by others

2010-06-13 Thread Marc Weber
Excerpts from Martin Drautzburg's message of Sun Jun 13 22:32:18 +0200 2010: Anyways, how do you guys do it, i.e. how to you dive into non-trivial foreign code? I use Vim and tag files generated by Vim. Using gnu idutils or such you can find any occurences of words very fast in large code

[Haskell-cafe] parsec: how to get end location

2010-06-13 Thread Roman Cheplyaka
Suppose I have some parser 'p'. I want to parse it as well as get its span in the text. So I could write \begin{code] pWithLocation = do loc_start - getPosition pval - p loc_end - getPosition return (pval,loc_start,loc_end) \end{code} except that loc_end gives me the location _after_

Re: [Haskell-cafe] parsec: how to get end location

2010-06-13 Thread Antoine Latter
On Sun, Jun 13, 2010 at 4:17 PM, Roman Cheplyaka r...@ro-che.info wrote: Suppose I have some parser 'p'. I want to parse it as well as get its span in the text. So I could write \begin{code] pWithLocation = do  loc_start - getPosition  pval - p  loc_end - getPosition  return

Re: [Haskell-cafe] parsec: how to get end location

2010-06-13 Thread Roman Cheplyaka
* Antoine Latter aslat...@gmail.com [2010-06-13 16:47:28-0500] On Sun, Jun 13, 2010 at 4:17 PM, Roman Cheplyaka r...@ro-che.info wrote: Suppose I have some parser 'p'. I want to parse it as well as get its span in the text. So I could write \begin{code] pWithLocation = do  loc_start -

Re: [Haskell-cafe] parsec: how to get end location

2010-06-13 Thread David Virebayre
On Mon, Jun 14, 2010 at 12:10 AM, Roman Cheplyaka r...@ro-che.info wrote: Of course most parsers don't consume trailing newlines. But I was writing general function to use in many places in the code which would recover the end location. In most cases it just subtracts 1 from the column number,

Re: [Haskell-cafe] Graph type

2010-06-13 Thread C K Kashyap
I love this list ... thanks Roman. I take it that there is nothing obviously inefficient about this approach to graph - as in the graph type. On Mon, Jun 14, 2010 at 12:02 AM, Roman Cheplyaka r...@ro-che.info wrote: * C K Kashyap ckkash...@gmail.com [2010-06-13 22:45:44+0530] Hi, I am

Re: [Haskell-cafe] Graph type

2010-06-13 Thread Ivan Lazar Miljenovic
C K Kashyap ckkash...@gmail.com writes: I love this list ... thanks Roman. I take it that there is nothing obviously inefficient about this approach to graph - as in the graph type. Sure there is (using p = |V|, q = |E|): * Finding a particular node is O(p). * Adding an edge to an already

Re: [Haskell-cafe] Graph type

2010-06-13 Thread C K Kashyap
Thanks Roman. I think I'll try out Data.Graph in that case. On Mon, Jun 14, 2010 at 8:53 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: C K Kashyap ckkash...@gmail.com writes: I love this list ... thanks Roman. I take it that there is nothing obviously inefficient about this

[Haskell-cafe] Mining Twitter data in Haskell and Clojure

2010-06-13 Thread braver
I'm computing a communication graph from Twitter data and then scan it daily to allocate social capital to nodes behaving in a good karmic manner. The graph is culled from 100 million tweets and has about 3 million nodes. First I wrote the simulation of the 35 days of data in Clojure and then

[Haskell-cafe] learning advanced haskell

2010-06-13 Thread Aran Donohue
Hi Cafe, I've been doing Haskell for a few months, and I've written some mid-sized programs and many small ones. I've read lots of documentation and many papers, but I'm having difficulty making the jump into some of the advanced concepts I've read about. How do people build intuitions for

Re: [Haskell-cafe] Mining Twitter data in Haskell and Clojure

2010-06-13 Thread Don Stewart
deliverable: I'm computing a communication graph from Twitter data and then scan it daily to allocate social capital to nodes behaving in a good karmic manner. The graph is culled from 100 million tweets and has about 3 million nodes. First I wrote the simulation of the 35 days of data in