Re: [Haskell-cafe] Grok Monad Transformers - some help needed

2012-01-02 Thread Steve Horne
On 02/01/2012 06:12, Arseniy Alekseyev wrote: I don't know what to actually do with this after putting it in a *.lhs file. You can :load *.lhs into ghci the same way you load .hs-files. I swear I tried this before, but now it suddenly works. Must be the chaos of stupid random assumptions

[Haskell-cafe] How to split this string.

2012-01-02 Thread max
I want to write a function whose behavior is as follows: foo string1\nstring2\r\nstring3\nstring4 = [string1, string2\r\nstring3, string4] Note the sequence \r\n, which is ignored. How can I do this? ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] How to split this string.

2012-01-02 Thread Yves Parès
Doesn't the function lines handle different line-endings? (In the Prelude and in Data.List) If not, doing this with parsec would be easy (yet maybe slightly overkill...) 2012/1/2 max m...@mtw.ru I want to write a function whose behavior is as follows: foo

Re: [Haskell-cafe] How to split this string.

2012-01-02 Thread max
В Mon, 2 Jan 2012 10:45:18 +0100 Yves Parès limestr...@gmail.com пишет: Prelude lines string1\nstring2\r\nstring3\nstring4 [string1,string2\r,string3,string4] Doesn't the function lines handle different line-endings? (In the Prelude and in Data.List) If not, doing this with parsec would be

Re: [Haskell-cafe] How to split this string.

2012-01-02 Thread Simon Hengel
Doesn't the function lines handle different line-endings? (In the Prelude and in Data.List) It does not ignore \r\n. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] On the purity of Haskell

2012-01-02 Thread Jerzy Karczmarczuk
Conal Elliott cites Steve Horne: I look at this World parameter as purely hypothetical, a trick used to gain an intuition. Whereas Jerzy (I think) uses it to claim Haskell is referentially transparent - those differing x and y values come from different worlds, or different

[Haskell-cafe] Dutch FP day 2012, January 6; ; reminder, and happy new year to all of you

2012-01-02 Thread S D Swierstra
We are happy to announce that the next Dutch functional programming day will take place on January 6, 2012, at the university campus de Uithof of Utrecht University. The program, participants registered thus far, and further details can be found at:

Re: [Haskell-cafe] How to split this string.

2012-01-02 Thread Christian Maeder
Am 02.01.2012 10:44, schrieb max: I want to write a function whose behavior is as follows: foo string1\nstring2\r\nstring3\nstring4 = [string1, string2\r\nstring3, string4] Note the sequence \r\n, which is ignored. How can I do this? replace the sequence by something unique first, i.e. a

Re: [Haskell-cafe] On the purity of Haskell

2012-01-02 Thread David Sabel
A perhaps acceptable notion of the property we want (purity etc.) is that all the extensions of the purely functional core language of Haskell (say the lazy lambda calculus extended with data constructors, etc) are _conservative_, that is all the equations that hold in the pure core language

Re: [Haskell-cafe] How to split this string.

2012-01-02 Thread Steve Horne
On 02/01/2012 09:44, max wrote: I want to write a function whose behavior is as follows: foo string1\nstring2\r\nstring3\nstring4 = [string1, string2\r\nstring3, string4] Note the sequence \r\n, which is ignored. How can I do this? Doing it probably the hard way (and getting it wrong) looks

Re: [Haskell-cafe] How to split this string.

2012-01-02 Thread Anupam Jain
On Mon, Jan 2, 2012 at 3:14 PM, max m...@mtw.ru wrote: I want to write a function whose behavior is as follows: foo string1\nstring2\r\nstring3\nstring4 = [string1, string2\r\nstring3, string4] Note the sequence \r\n, which is ignored. How can I do this? Here's a simple way (may not be the

Re: [Haskell-cafe] How to split this string.

2012-01-02 Thread emacsray
On Mon, Jan 02, 2012 at 12:44:23PM +0300, max wrote: I want to write a function whose behavior is as follows: foo string1\nstring2\r\nstring3\nstring4 = [string1, string2\r\nstring3, string4] Note the sequence \r\n, which is ignored. How can I do this?

Re: [Haskell-cafe] On the purity of Haskell

2012-01-02 Thread Steve Horne
On 02/01/2012 10:03, Jerzy Karczmarczuk wrote: But I disagree quite strongly with the idea of /World parameter as purely hypothetical, a trick used to gain an intuition/. I mentioned the language Clean (no reaction, seems that Haskellians continue to ignore it...) I don't know about others,

Re: [Haskell-cafe] How to split this string.

2012-01-02 Thread Yves Parès
Okay, so it doesn't handle different line-endings. I have a more general solution (statefulSplit) http://hpaste.org/55980 I cannot test it as I don't have an interpreter at hand, but if someone has, I'd be glad to have comments. (It might be more readable by using the State monad) 2012/1/2 max

Re: [Haskell-cafe] How to split this string.

2012-01-02 Thread Jon Fairbairn
max m...@mtw.ru writes: I want to write a function whose behavior is as follows: foo string1\nstring2\r\nstring3\nstring4 = [string1, string2\r\nstring3, string4] Note the sequence \r\n, which is ignored. How can I do this? cabal install split then do something like import Data.List

Re: [Haskell-cafe] How to split this string.

2012-01-02 Thread emacsray
On Mon, Jan 02, 2012 at 12:44:23PM +0300, max wrote: I want to write a function whose behavior is as follows: foo string1\nstring2\r\nstring3\nstring4 = [string1, string2\r\nstring3, string4] Note the sequence \r\n, which is ignored. How can I do this?

Re: [Haskell-cafe] Grok Monad Transformers - some help needed

2012-01-02 Thread Brandon Allbery
On Mon, Jan 2, 2012 at 03:32, Steve Horne sh006d3...@blueyonder.co.ukwrote: BTW - interesting how the signatures of test1 and test2 are reported - I hadn't realised monad transformers were relevant there. Of course it does seem a bit silly to implement both StateT and State when StateT can

Re: [Haskell-cafe] How to split this string.

2012-01-02 Thread max
В Mon, 02 Jan 2012 11:12:49 + Jon Fairbairn jon.fairba...@cl.cam.ac.uk пишет: max m...@mtw.ru writes: I want to write a function whose behavior is as follows: foo string1\nstring2\r\nstring3\nstring4 = [string1, string2\r\nstring3, string4] Note the sequence \r\n, which is

Re: [Haskell-cafe] How to split this string.

2012-01-02 Thread Felipe Almeida Lessa
On Mon, Jan 2, 2012 at 10:12 AM, max m...@mtw.ru wrote: This is the simplest solution of the proposed, in my opinion. Thank you very much. Better yet, don't use String and use Text. Then you just need T.splitOn \r\n [1]. Cheers, [1]

Re: [Haskell-cafe] How to split this string.

2012-01-02 Thread Anupam Jain
On Mon, Jan 2, 2012 at 5:52 PM, Felipe Almeida Lessa felipe.le...@gmail.com wrote: On Mon, Jan 2, 2012 at 10:12 AM, max m...@mtw.ru wrote: This is the simplest solution of the proposed, in my opinion. Thank you very much. Better yet, don't use String and use Text.  Then you just need

Re: [Haskell-cafe] space-efficient, composable list transformers [was: Re: Reifying case expressions]

2012-01-02 Thread Heinrich Apfelmus
Sebastian Fischer wrote: Your `ListTo` type achieves space efficiency for Applicative composition of list functions by executing them in lock-step. Because of the additional laziness provided by the `Fmap` constructor, compositions like interpret a . interpret b can also be executed in

[Haskell-cafe] Experiments in Haskell Packaging

2012-01-02 Thread Chris Dornan
Hi All, The http://justhub.org Haskell distribution for Enterprize Linux (RHEL/CentOS 5 6) is now live. The distribution deviates from current practice. When you upgrade to a new Platform from justhub.org you add the new platform to your Haskell infrastructure rather than replacing the old

[Haskell-cafe] proxy settings with simpleHttp

2012-01-02 Thread hanjoosten
Hi, I am fiddling around with the package http-enumerator to download web pages. I was used to `simpleHttp` do do that. However, I would like to infuence the proxy settings, because sometimes I am behind a firewall. Is there a simple way to do this? Thanks! Han. -- View this message in

Re: [Haskell-cafe] proxy settings with simpleHttp

2012-01-02 Thread Michael Snoyman
On Mon, Jan 2, 2012 at 6:31 PM, hanjoosten han.joos...@atos.net wrote: Hi, I am fiddling around with the package http-enumerator to download web pages. I was used to `simpleHttp` do do that. However, I would like to infuence the proxy settings, because sometimes I am behind a firewall. Is

[Haskell-cafe] Experiments in Haskell Packaging

2012-01-02 Thread Chris Dornan
[I am sorry for if get two copies of this -- no sign of the first copy.] The justhub.org Haskell distribution for Enterprise Linux (RHEL/CentOS 5 6) is now live. The distribution deviates from current practice. When you upgrade to a new Haskell Platform you add the new platform to your Haskell

Re: [Haskell-cafe] How to split this string.

2012-01-02 Thread Markus Läll
String is really for small strings. Text is more efficent and also has more functionality, including most, if not all, of the functions defined for String. On Mon, Jan 2, 2012 at 3:12 PM, Anupam Jain ajn...@gmail.com wrote: On Mon, Jan 2, 2012 at 5:52 PM, Felipe Almeida Lessa

Re: [Haskell-cafe] space-efficient, composable list transformers [was: Re: Reifying case expressions]

2012-01-02 Thread Jan Christiansen
Hi, On Jan 2, 2012, at 2:34 PM, Heinrich Apfelmus wrote: Without an explicit guarantee that the function is incremental, we can't do anything here. But we can just add another constructor to that effect if we turn ListTo into a GADT: data ListTo a b where CaseOf :: b - (a

Re: [Haskell-cafe] On the purity of Haskell

2012-01-02 Thread Conal Elliott
On 2012/1/1 Ertugrul Söylemez e...@ertes.de wrote: Steve Horne sh006d3...@blueyonder.co.uk wrote: Of course even the bind operator arguably isn't primitive. We could translate to get rid of those too, and see what lies underneath. This is where we start seeing functions of type...

[Haskell-cafe] porting feed to xml-enumerator

2012-01-02 Thread Simon Michael
Hi Sigbjorn (and Don), I'm back for another reason. feed leaks and uses a lot of memory due to the xml package. Rather than fix xml I ported feed to xml-enumerator, which is used by yesod and more actively maintained than xml. This seems to have fixed the problem so I'm thinking of uploading

Re: [Haskell-cafe] porting feed to xml-enumerator

2012-01-02 Thread Michael Snoyman
If I may: I'm about to upload a new version of xml-enumerator that will state that it's officially deprecated in favor of xml-conduit. My guess is you'll be able to migrate to the latter by just changing the package name in your cabal file. On Mon, Jan 2, 2012 at 8:54 PM, Simon Michael

Re: [Haskell-cafe] porting feed to xml-enumerator

2012-01-02 Thread Aristid Breitkreuz
Hi Simon and all, You might want to consider using xml-conduit instead of xml-enumerator. Michael Snoyman has shifted his attention to this new alternative. Cheers, Aristid 2012/1/2 Simon Michael si...@joyful.com: Hi Sigbjorn (and Don), I'm back for another reason. feed leaks and uses a

Re: [Haskell-cafe] On the purity of Haskell

2012-01-02 Thread James Cook
On Jan 2, 2012, at 1:30 PM, Conal Elliott wrote: On 2012/1/1 Ertugrul Söylemez e...@ertes.de wrote: And that's fine, because IO is an embedded DSL. A better view of IO is a GADT like: data IO :: * - * where GetLine :: IO String PutStrLn :: String - IO () ...

[Haskell-cafe] More cabal install problems

2012-01-02 Thread Victor Miller
I've been trying to install threadscope on my macbook pro runing OSX 10.7 (Lion). This hasn't been easy. Thanks to help here, I finally got glib installed, but now one of the hangups is in installing the package gio. The following happens: Building gio-0.12.2... Building library... creating

Re: [Haskell-cafe] More cabal install problems

2012-01-02 Thread Brandon Allbery
On Mon, Jan 2, 2012 at 21:36, Victor Miller victorsmil...@gmail.com wrote: command line: cannot satisfy -package-id mtl-2.0.1.0-5b7a9cce5565d8cc8721ba4f95becf1b (use -v for more information) However, cabal list tells me: * mtl Synopsis: Monad classes, using functional dependencies

Re: [Haskell-cafe] More cabal install problems

2012-01-02 Thread Victor Miller
Brandon, Thanks again. That put me on the right track. When I did a ghc-pkg list it added a message saying that the cache was out of date and that I should run ghc-pkg recache. I did that and gio appears to installing. Victor On Mon, Jan 2, 2012 at 9:49 PM, Brandon Allbery

Re: [Haskell-cafe] Avoiding parametric function binding

2012-01-02 Thread Kevin Quick
On Sun, 01 Jan 2012 05:29:42 -0700, Sebastian Fischer fisc...@nii.ac.jp wrote: On Sat, Dec 31, 2011 at 4:09 PM, Kevin Quick qu...@sparq.org wrote: onVarElem :: forall a . (Show a) = (Maybe a - String) - Var - String The problem is the scope of the quantification of the type variable 'a'.