Re: [Haskell-cafe] operations on lists with continuations

2011-03-02 Thread Stephen Tetley
Maybe you've invented the ApoPrelude? If I were doing it I'd probably code them in terms of an apomorphism - unfoldr with flush. Unlike regular unfoldr which discards the final state, an apomorphism uses the final state to produce the tail of the output list. See Jeremy Gibbons paper Streaming

[Haskell-cafe] Rank-2 types in classes

2011-03-02 Thread Yves Parès
Hello, I'm working on a library which aims to be a generic interface for 2D rendering. To do that, one of my goals is to enable each implementation of this interface to run in its own monad (most of the time an overlay to IO), thus giving me the following class class (Monad (IM i x)) = Impl i x

Re: [Haskell-cafe] Rank-2 types in classes

2011-03-02 Thread Max Bolingbroke
On 2 March 2011 09:11, Yves Parès limestr...@gmail.com wrote: class (forall x. Monad (IM i x)) = Impl i where     data IM i :: * - * - * But GHC forbids me to do so. The way I usually work around this is by doing something like the following pattern: {{{ class Monad1 m where return1 :: a

[Haskell-cafe] HDF5 binding (was: why is ghci trying to load hsc file ??)

2011-03-02 Thread Ferenc Wagner
bri...@aracnet.com writes: I worked out a small hdf5 binding using cabal and bindings-DSL and sqlite3 as my example. Hi, I just wanted to add that I also started an HDF5 binding recently (using hsc2hs only). It does more than enough for me ATM, so I don't develop it actively, but if you want

[Haskell-cafe] Idiomatic error handling in Haskell

2011-03-02 Thread Rouan van Dalen
There are quite a few exception handling mechanisms provided by Haskell, as can be seen from this post: http://www.randomhacks.net/articles/2007/03/10/haskell-8-ways-to-report-errors I would like to know what is the preferred Haskell mechanism for handling exceptions in the IO monad? I am not

Re: [Haskell-cafe] Rank-2 types in classes

2011-03-02 Thread Yves Parès
Thank you ! Is what I'm trying to do a common technique to type-ensure contexts or are there simpler methods? 2011/3/2 Max Bolingbroke batterseapo...@hotmail.com On 2 March 2011 09:11, Yves Parès limestr...@gmail.com wrote: class (forall x. Monad (IM i x)) = Impl i where data IM i ::

Re: [Haskell-cafe] Idiomatic error handling in Haskell

2011-03-02 Thread Henning Thielemann
On Wed, 2 Mar 2011, Rouan van Dalen wrote: I would like to know what is the preferred Haskell mechanism for handling exceptions in the IO monad? I am not concerned with mechanisms such as Maybe / Either, but would like to know about exception mechanisms inside the IO monad. The 2 I know

Re: [Haskell-cafe] HDF5 binding (was: why is ghci trying to load hsc file ??)

2011-03-02 Thread James Andrew Cook
What an interesting coincidence, that makes at least three of us. Apparently it's an idea whose time has come. Mine is also an incomplete low-level binding but is currently under semi-active development and I aim to make it cover the entire hdf5.h interface. If anyone is interested in it I've

[Haskell-cafe] Examples for the problem

2011-03-02 Thread Robert Clausecker
Thank you all for the responses. Here's an example: As I alrerady said, I tried to parse the MMIXAL assembly language. Each instruction has up to three operands, looking like this: @+4 (Jump for bytes forward) foo (the string foo '0'(1+2) etc. A string literal may contain anything

Re: [Haskell-cafe] Examples for the problem

2011-03-02 Thread Tillmann Rendel
Hi, Robert Clausecker wrote: Each instruction has up to three operands, looking like this: @+4 (Jump for bytes forward) foo (the string foo '0'(1+2) etc. A string literal may contain anything but a newline, (there are no escape codes or similar). But when I add a check for a

Re: [Haskell-cafe] Examples for the problem

2011-03-02 Thread Steve Schafer
On Wed, 2 Mar 2011 14:14:02 +0100, you wrote: Thank you all for the responses. Here's an example: As I alrerady said, I tried to parse the MMIXAL assembly language. Each instruction has up to three operands, looking like this: @+4 (Jump for bytes forward) foo (the string foo

Re: [Haskell-cafe] A practical Haskell puzzle

2011-03-02 Thread Yitzchak Gale
Thanks to everyone for the nice solutions to this puzzle, here and on reddit: http://www.reddit.com/r/haskell/comments/fu6el/a_practical_haskell_puzzle/ There were two basic approaches. One was to use GADTs and higher-rank types to reduce the amount of type trickery needed. One nice example is

Re: [Haskell-cafe] Examples for the problem

2011-03-02 Thread Stephen Tetley
Apologies if this has been answered already (I've got a bit lost with this thread), but the *try* here seems to be giving you precisely the behaviour you don't want. *try* means backtrack on failure, and try the next parser. So if you want ill formed strings to throw an error if they aren't

[Haskell-cafe] Where to put a library

2011-03-02 Thread Richard Senington
Hi all, I am working on ways to implement local search meta-heuristics in Haskell. I need various test problems to experiment on, and this has resulted in me building various file parsers and data structures for these. Currently I have versions for SAT, TSP and a couple of more private file

Re: [Haskell-cafe] Examples for the problem

2011-03-02 Thread Stephen Tetley
Actually this is stranger than I thought - from testing it seems like Attoparsec's (|) is different to Parsec's. From what I'm seeing Attoparsec appears to do a full back track for (|) regardless of whether the string lexer is wrapped in try, whereas Parsec needs try to backtrack. On 2 March 2011

Re: [Haskell-cafe] Examples for the problem

2011-03-02 Thread Carl Howells
Actually, It's not | that's different, it's the string combinator. In Parsec, string matches each character one at a time. If the match fails, any partial input it matched is consumed. In attoparsec, string matches either the entire thing or not, as a single step. If it fails to match, no input

[Haskell-cafe] type safe web forms at compile time Was: Re: Ur vs Haskell

2011-03-02 Thread Alberto G. Corona
Hi. Some time ago I forgot to forward this message to thie ur versus Haskell http://www.haskell.org/pipermail/haskell-cafe/2011-January/088060.htmldiscussion, (as usual) --- The most impressive feature (of ur) is the compile time checking of conformance between the form and the form results.

Re: [Haskell-cafe] type safe web forms at compile time Was: Re: Ur vs Haskell

2011-03-02 Thread Marc Weber
Excerpts from Alberto G. Corona's message of Wed Mar 02 20:53:28 + 2011: Some time ago I forgot to forward this message to thie ur versus Haskell http://www.haskell.org/pipermail/haskell-cafe/2011-January/088060.htmldiscussion, (as usual) --- The most impressive feature (of ur) is the

Re: [Haskell-cafe] type safe web forms at compile time Was: Re: Ur vs Haskell

2011-03-02 Thread Alberto G. Corona
WASH is full of wonderful ideas . packed in a not so wonderful syntax. It is worth to evolve it. WASH does force form safety in a similar way to Formlets http://hackage.haskell.org/package/formlets: because the form and the form read code are generated automatically by a class instance. So

Re: [Haskell-cafe] Where to put a library

2011-03-02 Thread Sebastian Fischer
Hi Richard, On Thu, Mar 3, 2011 at 1:46 AM, Richard Senington sc06...@leeds.ac.ukwrote: The file parsers are designed to process files coming out of the TSPLIB and SATLIB repositories. [...] Since these are all related I was going to try to put them together into a single library and post

Re: [Haskell-cafe] Rank-2 types in classes

2011-03-02 Thread Max Bolingbroke
2011/3/2 Yves Parès limestr...@gmail.com: Is what I'm trying to do a common technique to type-ensure contexts or are there simpler methods? I don't understand your problem well enough to be able to venture a solid opinion on this. Sorry! What you have detailed so far doesn't sound too complex,

Re: [Haskell-cafe] A practical Haskell puzzle

2011-03-02 Thread Yves Parès
Okay thanks I got the difference between both. The 'exists' syntax seems very useful. Is it planned to be added to GHC in a near future? 2011/2/28 Heinrich Apfelmus apfel...@quantentunnel.de Yves Parès wrote: takeC :: Int - Compoz a b - (exists c. Compoz a c) dropC :: Int - Compoz a b -

Re: [Haskell-cafe] Rank-2 types in classes

2011-03-02 Thread Edward Z. Yang
The trick is to write the rank-2 type in the function that runs the monad, and leave the typeclasses skolemized. Here's an example: -- | Typeclass for monads that write or read to a network. Useful -- if you define operations that need to work for all such monads. -- You're expected to put

Re: [Haskell-cafe] A practical Haskell puzzle

2011-03-02 Thread Brandon Moore
From: Yitzchak Gale g...@sefer.org To: haskell-cafe@haskell.org Cc: Heinrich Apfelmus apfel...@quantentunnel.de; Lennart Augustsson lennart.augusts...@gmail.com Sent: Wed, March 2, 2011 9:45:15 AM Subject: Re: [Haskell-cafe] A practical Haskell puzzle Thanks to everyone for the nice

[Haskell-cafe] Haskell Weekly News: Issue 171

2011-03-02 Thread Daniel Santa Cruz
Welcome to issue 171 of the HWN, a newsletter covering developments in the [1]Haskell community. This release covers the week of February 20 - 26, 2011 . Announcements Eric Kow [2]announced that the Darcs project is staring to organize the next hacking sprint, which will be most

[Haskell-cafe] Learn You a Haskell for Great Good - a few doubts

2011-03-02 Thread Karthick Gururaj
Hello, I'm learning Haskell from the extremely well written (and well illustrated as well!) tutorial - http://learnyouahaskell.com/chapters. I have couple of questions from my readings so far. In typeclasses - 101 (http://learnyouahaskell.com/types-and-typeclasses#typeclasses-101), there is a

Re: [Haskell-cafe] Learn You a Haskell for Great Good - a few doubts

2011-03-02 Thread Chris Smith
On Thu, 2011-03-03 at 11:39 +0530, Karthick Gururaj wrote: What is the () type? Does it refer to a tuple? How can tuple be ordered, let alone be enum'd? I tried: The () type is pronounced unit. It is a type with only 1 value, also called () and pronounced unit. Since it only has one possible

[Haskell-cafe] Learning list filtering using puzzles

2011-03-02 Thread Karthick Gururaj
Hi all, I'm very new to Haskell, having started earlier this week. This is my second attempt after two years :) Currently, I can do simple list processing/recursion/functions. I'm using GHC on Ubuntu. I decided to use puzzles as a way to explore list filtering. For example, while normal solution

[Haskell-cafe] Haskell IDE

2011-03-02 Thread Hauschild, Klaus (EXT)
Hi Haskellers, whats your Haskell IDE of choise? Currently I use leksah. Is the EclipseFP Plugin for Eclipse a real alternative? Thanks Klaus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Learn You a Haskell for Great Good - a few doubts

2011-03-02 Thread Karthick Gururaj
On Thu, Mar 3, 2011 at 11:48 AM, Chris Smith cdsm...@gmail.com wrote: On Thu, 2011-03-03 at 11:39 +0530, Karthick Gururaj wrote: What is the () type? Does it refer to a tuple? How can tuple be ordered, let alone be enum'd? I tried: The () type is pronounced unit.  It is a type with only 1

Re: [Haskell-cafe] Haskell IDE

2011-03-02 Thread Eugene Kirpichov
A year and something ago I used Leksah and I was reasonably satisfied with what it had to offer at that time. If I'm understanding correctly, it has been much improved since. However, now I actually use vim - but that's because I'm scared of trying to install Leksah on Windows (maybe it isn't

Re: [Haskell-cafe] Haskell IDE

2011-03-02 Thread JP Moresmau
On Thu, Mar 3, 2011 at 8:05 AM, Hauschild, Klaus (EXT) klaus.hauschild@siemens.com wrote: Hi Haskellers, whats your Haskell IDE of choise? Currently I use leksah. Is the EclipseFP Plugin for Eclipse a real alternative? Thanks Klaus Hello, I'm one of the maintainers of EclipseFP. It

Re: [Haskell-cafe] Learn You a Haskell for Great Good - a few doubts

2011-03-02 Thread Ivan Lazar Miljenovic
On 3 March 2011 17:59, Karthick Gururaj karthick.guru...@gmail.com wrote: On Thu, Mar 3, 2011 at 11:48 AM, Chris Smith cdsm...@gmail.com wrote: On Thu, 2011-03-03 at 11:39 +0530, Karthick Gururaj wrote: What is the () type? Does it refer to a tuple? How can tuple be ordered, let alone be

Re: [Haskell-cafe] Where to put a library

2011-03-02 Thread Malcolm Wallace
On 2 Mar 2011, at 22:38, Sebastian Fischer wrote: You could place the parsers under Text.TSPLIB Text.SATLIB Text Some other suggestions might be Codec.TSP Codec.SAT or FileFormat.TSP FileFormat.SAT Regards, Malcolm

Re: [Haskell-cafe] Learn You a Haskell for Great Good - a few doubts

2011-03-02 Thread Antti-Juhani Kaijanaho
On Thu, Mar 03, 2011 at 12:29:44PM +0530, Karthick Gururaj wrote: Thanks - is this the same unit that accompanies IO in IO () ? In any case, my question is answered since it is not a tuple. It can be viewed as the trivial 0-tuple. -- Antti-Juhani Kaijanaho, Jyväskylä, Finland