Re: [Haskell-cafe] scheduling an alarm

2010-01-28 Thread Ketil Malde
Brian Denheyer bri...@aracnet.com writes: doEvent f usDelay = forkIO $ threadDelay usDelay doEvent f usDelay f There's a missing 'do' here, right? Infinite loop? yes, that is what you wanted. Memory gobbling? Why would you think that? Why would I think that ? doEvent f

Re: [Haskell-cafe] Linguistic hair-splitting

2010-01-28 Thread Ketil Malde
Daniel Fischer daniel.is.fisc...@web.de writes: It has been known to call such things 'computations', I think actions has been used, too, but perhaps mostly for things in IO and similar monads? as opposed to 'values', and even to separate the categories of types and expressions which

Re: [Haskell-cafe] scheduling an alarm

2010-01-28 Thread Thomas DuBuisson
Brian Denheyer bri...@aracnet.com writes: doEvent f usDelay = forkIO $ threadDelay usDelay doEvent f usDelay f There's a missing 'do' here, right? Yes - I said that in a later e-mail but it doesn't fix me violating my own peeve about non-functional code snippits on -cafe.

RE: [Haskell-cafe] ANNOUNCE: ThreadScope 0.1

2010-01-28 Thread Satnam Singh
Johan, Thanks for the (mostly) positive news about ThreadScope on Mac OS-X: that's great news. I plan to add a few more Save As... image options in ThreadScope 0.2 plus the ability to turn transparency on/off for PNG files. So hopefully one of the Save As formats might work. I don't think it

[Haskell-cafe] OT: Literature on translation of lambda calculus to combinators

2010-01-28 Thread Dušan Kolář
Dear cafe, Could anyone provide a link to some paper/book (electronic version of both preferred, even if not free) that describes an algorithm of translation of untyped lambda calculus expression to a set of combinators? Preferably SKI or BCKW. I'm either feeding google with wrong question

Re: [Haskell-cafe] OT: Literature on translation of lambda calculus to combinators

2010-01-28 Thread Max Bolingbroke
See, for example, slide 119 and onwards in the slides at http://www.cl.cam.ac.uk/teaching/0809/FFuncProg/FoFP_2009_slides.pdf The slides covers SKI and BCSKI. Cheers, Max 2010/1/28 Dušan Kolář ko...@fit.vutbr.cz: Dear cafe,  Could anyone provide a link to some paper/book (electronic version

Re: [Haskell-cafe] OT: Literature on translation of lambda calculus to combinators

2010-01-28 Thread Serguey Zefirov
Also see http://www.haskell.org/haskellwiki/Super_combinator Wiki page. Fixed set of combinators gives you complexity of translation that is more than linear of the length of lambda expression. The length of output string is O(3^length(lambdaExpression)) for SK combinator pair. 2010/1/28 Dušan

Re: [Haskell-cafe] scheduling an alarm

2010-01-28 Thread Ketil Malde
Thomas DuBuisson thomas.dubuis...@gmail.com writes: Yes - I said that in a later e-mail but it doesn't fix me violating my own peeve about non-functional code snippits on -cafe. I guess we're spoiled by the type checker catching all our mistakes. Since I recently discovered the new and

Re: [Haskell-cafe] OT: Literature on translation of lambda calculus to combinators

2010-01-28 Thread Stephen Tetley
Hi Dušan The Ester shell written in Clean compiles via the SKI combinators. It is describe in the paper - 'A Functional Shell that Operates on Typed and Compiled Applications' by Arjen van Weelden and Rinus Plasmeijer which is available here:

[Haskell-cafe] Re: Why no merge and listDiff?

2010-01-28 Thread Heinrich Apfelmus
Will Ness wrote: Heinrich Apfelmus writes: (Just for historical reference, credit for the data structure that works with infinite merges goes to Dave Bayer, I merely contributed the mnemonic aid of interpreting it in terms of VIPs.) yes, yes, my bad. GMANE is very unreliable at presenting

[Haskell-cafe] UTF-16 to UTF-8

2010-01-28 Thread Günther Schmidt
Hi, is there a library which converts from utf-16 to utf-8? Günther ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] UTF-16 to UTF-8

2010-01-28 Thread Miguel Mitrofanov
iconv? Günther Schmidt wrote: Hi, is there a library which converts from utf-16 to utf-8? Günther ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] UTF-16 to UTF-8

2010-01-28 Thread Ivan Lazar Miljenovic
Günther Schmidt gue.schm...@web.de writes: is there a library which converts from utf-16 to utf-8? The text library can (you can also choose between big and little endian UTF-16). Günther ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Map unionWith generalization

2010-01-28 Thread Hans Aberg
On 28 Jan 2010, at 03:09, Twan van Laarhoven wrote: For example, in Map String Integer (sparse representation of monomials) compute the minimum value of all associative pairs with the same key (the gcd); if only one key is present, the absent should be treated as having value 0. So

Re: [Haskell-cafe] UTF-16 to UTF-8

2010-01-28 Thread Günther Schmidt
Hi Ivan, thanks for the tip, but how do I use the library? I can't really make out how to feed it UTF-16 and get String (UTF-8) back. Günther BTW: I need this function because I'm using HDBC-ODBC with MS Access and in MS Access apparently every string is in UTF-16. Am 28.01.10 12:47,

Re[2]: [Haskell-cafe] UTF-16 to UTF-8

2010-01-28 Thread Bulat Ziganshin
Hello Gunther, Thursday, January 28, 2010, 4:07:07 PM, you wrote: thanks for the tip, but how do I use the library? I can't really make out how to feed it UTF-16 and get String (UTF-8) back. Haskell String type isn't UTF-8 encoded. it's [Char] where Char is in UCS-4 aka UTF-32 :) BTW: I

Re: [Haskell-cafe] UTF-16 to UTF-8

2010-01-28 Thread Ivan Lazar Miljenovic
Günther Schmidt gue.schm...@web.de writes: thanks for the tip, but how do I use the library? I can't really make out how to feed it UTF-16 and get String (UTF-8) back. One way (probably not very efficient): import Data.Text.Encoding convert :: Bytestring - Bytestring convert = encodeUtf8 .

Re: Re[2]: [Haskell-cafe] UTF-16 to UTF-8

2010-01-28 Thread Johan Tibell
2010/1/28 Bulat Ziganshin bulat.zigans...@gmail.com Hello Gunther, Thursday, January 28, 2010, 4:07:07 PM, you wrote: thanks for the tip, but how do I use the library? I can't really make out how to feed it UTF-16 and get String (UTF-8) back. Haskell String type isn't UTF-8 encoded.

Re[4]: [Haskell-cafe] UTF-16 to UTF-8

2010-01-28 Thread Bulat Ziganshin
Hello Johan, Thursday, January 28, 2010, 4:20:48 PM, you wrote: Haskell String type isn't UTF-8 encoded. it's [Char] where Char is in UCS-4 aka UTF-32 :) That's not quite correct. [Char] is a sequence of Unicode code points, UTF-32 is one possible encoding of those code points. The

Re: [Haskell-cafe] OT: Literature on translation of lambda calculus to combinators

2010-01-28 Thread Job Vranish
There is a nice simple algorithm on wikipedia: http://en.wikipedia.org/wiki/Combinatory_logic (for both SKI and BCKW) translated to haskell: -- The anoying thing about the algorithm is that it is difficult to separate the SKI and LC expression types -- it's easiest to just combine them. data

Re: [Haskell-cafe] ghc-core 0.5 build fails

2010-01-28 Thread Brian Denheyer
On Wed, 27 Jan 2010 23:10:29 -0800 Don Stewart d...@galois.com wrote: briand: Hi all, ghc-core.hs:263:13: Not in scope: data constructor `C.ExitException' Looks like this comes from the base control.exception ? When I go to the web page for control.exception, there is no

Re: [Haskell-cafe] Linguistic hair-splitting

2010-01-28 Thread Daniel Fischer
Am Donnerstag 28 Januar 2010 09:14:38 schrieb Ketil Malde: Daniel Fischer daniel.is.fisc...@web.de writes: It has been known to call such things 'computations', I think actions has been used, too, but perhaps mostly for things in IO and similar monads? as opposed to 'values', and even to

Re: [Haskell-cafe] scheduling an alarm

2010-01-28 Thread Neil Brown
Brian Denheyer wrote: On Tue, 26 Jan 2010 22:41:44 -0800 Thomas DuBuisson thomas.dubuis...@gmail.com wrote: doEvent f usDelay = forkIO $ threadDelay usDelay doEvent f usDelay f Are you sure that's right ? It seems to be a memory-gobbling infinite loop... Why

Re: [Haskell-cafe] OT: Literature on translation of lambda calculus to combinators

2010-01-28 Thread Felipe Lessa
On Thu, Jan 28, 2010 at 09:23:23AM -0500, Job Vranish wrote: -- The anoying thing about the algorithm is that it is difficult to separate the SKI and LC expression types -- it's easiest to just combine them. Why is it difficult? -- Felipe. ___

Re: [Haskell-cafe] OT: Literature on translation of lambda calculus to combinators

2010-01-28 Thread Job Vranish
Why is it difficult? Ideally we'd like the type of convert to be something like: convert :: LambdaExpr - SKIExpr but this breaks in several places, such as the nested converts in the RHS of the rule: convert (Lambda x (Lambda y e)) | occursFree x e = convert (Lambda x (convert (Lambda y e)))

Re: [Haskell-cafe] Linguistic hair-splitting

2010-01-28 Thread Donn Cave
Quoth Daniel Fischer daniel.is.fisc...@web.de, Am Donnerstag 28 Januar 2010 09:14:38 schrieb Ketil Malde: Daniel Fischer daniel.is.fisc...@web.de writes: As usual, that only works part of the time. [1,4,15,3,7] is not a computation, it's a list of numbers. A plain and simple everyday value.

Re: [Haskell-cafe] ANNOUNCE: ThreadScope 0.1

2010-01-28 Thread Thomas DuBuisson
To install on ghc-6.12.1 I had to modify the .cabal to accept containers package version 0.3 (I already had the gtk2hs installed). It works fine at first glance, will use it more. - containers = 0.2 0.3 +containers = 0.2 0.4 Cheers, Thomas On Wed, Jan

[Haskell-cafe] big problems with MS Access backends

2010-01-28 Thread Günther Schmidt
Hi, I need to use MS Access as a DB-backend. To make it not too easy there are tables with Umlaut Strings in some of the columns. Using HDBC-ODBC the Umlauts get merely garbled, I believe because MS-Access delivers in some sort of UTF-16 and HDBC-ODBC seems to manage that fine safe for the

[Haskell-cafe] Very imperfect hash function

2010-01-28 Thread Steve Schafer
I'm looking for some algorithmic suggestions: I have a set of several hundred key/value pairs. The keys are 32-bit integers, and are all distinct. The values are also integers, but the number of values is small (only six in my current problem). So, obviously, several keys map to the same value.

Re: [Haskell-cafe] ANN: bindings-DSL 1.0.4 (Category: FFI)

2010-01-28 Thread Lars Viklund
On Sat, Jan 23, 2010 at 01:02:07AM -0200, Maurí­cio CA wrote: bindings-DSL is a mature and well documented preprocessor domain specific language you can use to generate bindings to a C API. It's based on functionality provided by hsc2hs. These are links to Hackage page and documentation:

[Haskell-cafe] Re: Very imperfect hash function

2010-01-28 Thread Maciej Piechotka
On Thu, 2010-01-28 at 14:07 -0500, Steve Schafer wrote: I'm looking for some algorithmic suggestions: I have a set of several hundred key/value pairs. The keys are 32-bit integers, and are all distinct. The values are also integers, but the number of values is small (only six in my current

Re: [Haskell-cafe] Very imperfect hash function

2010-01-28 Thread Hans Aberg
On 28 Jan 2010, at 20:07, Steve Schafer wrote: The data are currently in a large lookup table. To save space, I'd like to convert that into a sort of hash function: hash :: key - value My question is this: Is there any kind of generic approach that can make use of the knowledge about the

[Haskell-cafe] Hierachical abstraction

2010-01-28 Thread Andrew Coppin
OK, this is going to be a long one... Let's start with parsers. A monadic parser library (e.g., Parsec) gives you a set of primitive parsers. It also supplies functions to construct more complex commonly-used parsers. And then it provides functions for constructing even more complex parsers.

Re: [Haskell-cafe] Hierachical abstraction

2010-01-28 Thread Luke Palmer
On Thu, Jan 28, 2010 at 12:42 PM, Andrew Coppin andrewcop...@btinternet.com wrote: I wonder if you can make a parser combinator library which is *not* monadic? And, if you could, in what way would that limit the kinds of things you can parse? Absolutely! I believe both Applicatives and Arrows

Re: [Haskell-cafe] Hierachical abstraction

2010-01-28 Thread Sebastian Fischer
On Jan 28, 2010, at 9:31 PM, Luke Palmer wrote: I don't remember the name, but there is a technique where you compose the features you want and then take its fixed point to get your AST. Did you think of Data types à la carte by Wouter Swierstra?

[Haskell-cafe] Re: ANN: bindings-DSL 1.0.4 (Category: FFI)

2010-01-28 Thread Maurí­cio CA
http://hackage.haskell.org/package/bindings-DSL http://bitbucket.org/mauricio/bindings-dsl The only thing I've missed for now is a #ccall equivalence for stdcall functions, I hacked one up myself and called it #stdcall, but it would be nice to have in the package proper if possible.

Re: [Haskell-cafe] Re: ANN: bindings-DSL 1.0.4 (Category: FFI)

2010-01-28 Thread Lars Viklund
On Thu, Jan 28, 2010 at 09:36:42PM -0200, Maurí­cio CA wrote: The only thing I've missed for now is a #ccall equivalence for stdcall functions, I hacked one up myself and called it #stdcall, but it would be nice to have in the package proper if possible. Here is my attempt. I added

Re: [Haskell-cafe] Hierachical abstraction

2010-01-28 Thread Nils Anders Danielsson
On 2010-01-28 20:31, Luke Palmer wrote: I could be mistaken, but at least there are both Applicative and Arrow parser libraries. I don't know how to classify the language that they parse -- it is not strictly context-free. It corresponds roughly to context-free where certain types of infinite

Re: [Haskell-cafe] Hierachical abstraction

2010-01-28 Thread Edward Kmett
Luke pretty much nailed the summary of what you can parse using Applicative means. I tend to consider them codata CFGs, because they can have infinite breadth and depth. However, a 'codata CFG' can handle a much larger class of languages than CFGs. To that end, it is interesting to consider that

Re: [Haskell-cafe] Hierachical abstraction

2010-01-28 Thread Edward Kmett
On Thu, Jan 28, 2010 at 7:58 PM, Nils Anders Danielsson n...@cs.nott.ac.uk wrote: If the token set is finite you don't get any expressive advantage from a monadic parser combinator library (in a lazy setting): you can parse any decidable language using a simple library with an applicative

[Haskell-cafe] Re: ANN: bindings-DSL 1.0.4 (Category: FFI)

2010-01-28 Thread Maurí­cio CA
Here is my attempt. I added #callconv macro, that accepts a calling convention parameter. The lines below are now equivalent. Builds fine here and looks reasonably fine. Okay. Package uploaded, documentation updated. Best, Maurício ___

Re: [Haskell-cafe] Non-termination of type-checking

2010-01-28 Thread Ryan Ingram
But your example uses a recursive type; the interesting bit about this example is that there is no recursive types or function, and yet we can encode this loop. -- ryan On Wed, Jan 27, 2010 at 4:49 PM, Matthew Brecknell matt...@brecknell.net wrote: Ryan Ingram wrote: The compiler doesn't

[Haskell-cafe] Could not find module `Text.Regex'

2010-01-28 Thread zaxis
import Text.Regex date_by_ntday dateStr ntday = do let [y,m,d] = map (\x - read x::Int) $ splitRegex (mkRegex -) dateStr %ghc --version The Glorious Glasgow Haskell Compilation System, version 6.12.1 Which package(s) do i need to use Text.Regex ? Sincerely! - fac n = foldr

[Haskell-cafe] Re: Could not find module `Text.Regex'

2010-01-28 Thread Lee Houghton
On 29/01/2010 03:51, zaxis wrote: import Text.Regex date_by_ntday dateStr ntday = do let [y,m,d] = map (\x - read x::Int) $ splitRegex (mkRegex -) dateStr %ghc --version The Glorious Glasgow Haskell Compilation System, version 6.12.1 Which package(s) do i need to use

Re: [Haskell-cafe] Could not find module `Text.Regex'

2010-01-28 Thread Don Stewart
z_axis: import Text.Regex date_by_ntday dateStr ntday = do let [y,m,d] = map (\x - read x::Int) $ splitRegex (mkRegex -) dateStr %ghc --version The Glorious Glasgow Haskell Compilation System, version 6.12.1 Which package(s) do i need to use Text.Regex ? In general,

[Haskell-cafe] Re: Non-termination of type-checking

2010-01-28 Thread oleg
Here is a bit more simplified version of the example. The example has no value level recursion and no overt recursive types, and no impredicative polymorphism. The key is the observation, made earlier, that two types c (c ()) and R (c ()) unify when c = R. Although the GADTs R c below is