[Haskell-cafe] Haskell Weekly News: Issue 218

2012-03-15 Thread Daniel Santa Cruz
Welcome to issue 218 of the HWN, an issue covering crowd-sourced bits of information about Haskell from around the web. This issue cover the weeks of February 26 to March 10, 2012. You can find the HTML version at: http://contemplatecode.blogspot.com/2012/03/haskell-weekly-news-issue-218.html Quo

Re: [Haskell-cafe] puzzling polymorphism behavior (7.0.3 windows)

2012-03-15 Thread Jake McArthur
Just a little more interesting information: This is why impure languages like OCaml have the value restriction. Haskell doesn't need it because it is pure, but of course unsafePerformIO thwarts that. On Mar 15, 2012 1:34 PM, "Tillmann Rendel" wrote: > Hi, > > this is one of the reasons why unsafe

Re: [Haskell-cafe] Trying to use more than one array in runSTUArray

2012-03-15 Thread Juan Miguel Vilar
El 15/03/12 19:53, Anthony Cowley escribió: On Thursday, March 15, 2012 at 2:27 PM, Juan Miguel Vilar wrote: Hello, café: I am trying to use more than one array with runSTUArray but I don't seem to be able to understand how it works. My first try is this: test1 n = runSTUArray $ do a <- newArr

Re: [Haskell-cafe] Trying to use more than one array in runSTUArray

2012-03-15 Thread Juan Miguel Vilar
El 15/03/12 20:07, Daniel Fischer escribió: On Thursday 15 March 2012, 19:53:56, Daniel Fischer wrote: On Thursday 15 March 2012, 19:27:18, Juan Miguel Vilar wrote: Hello, café: However, when I write test2 n = runSTUArray $ do let createArray v n = newArray (1, n) (v::Int)

Re: [Haskell-cafe] Trying to use more than one array in runSTUArray

2012-03-15 Thread Daniel Fischer
On Thursday 15 March 2012, 19:53:56, Daniel Fischer wrote: > On Thursday 15 March 2012, 19:27:18, Juan Miguel Vilar wrote: > > Hello, café: > > > However, when I write > > > > test2 n = runSTUArray $ do > > > > let createArray v n = newArray (1, n) (v::Int) > > Here you create a

Re: [Haskell-cafe] Trying to use more than one array in runSTUArray

2012-03-15 Thread Anthony Cowley
On Thursday, March 15, 2012 at 2:27 PM, Juan Miguel Vilar wrote: > Hello, café: > > I am trying to use more than one array with runSTUArray but I don't seem > to be able to understand how it works. My first try is this: > > test1 n = runSTUArray $ do > a <- newArray (1, n) (2::Int) > b <- newAr

Re: [Haskell-cafe] Trying to use more than one array in runSTUArray

2012-03-15 Thread Daniel Fischer
On Thursday 15 March 2012, 19:27:18, Juan Miguel Vilar wrote: > Hello, café: > > I am trying to use more than one array with runSTUArray but I don't seem > to be able to understand how it works. My first try is this: > > test1 n = runSTUArray $ do > a <- newArray (1, n) (2::Int) >

[Haskell-cafe] Trying to use more than one array in runSTUArray

2012-03-15 Thread Juan Miguel Vilar
Hello, café: I am trying to use more than one array with runSTUArray but I don't seem to be able to understand how it works. My first try is this: test1 n = runSTUArray $ do a <- newArray (1, n) (2::Int) b <- newArray (1, n) (3::Int) forM_ [1..n] $ \i -> do

Re: [Haskell-cafe] puzzling polymorphism behavior (7.0.3 windows)

2012-03-15 Thread Tillmann Rendel
Hi, this is one of the reasons why unsafePerformIO is not type-safe. Lets see what's going on by figuring out the types of the various definitions. cell = unsafePerformIO $ newIORef [] newIORef returns a cell which can hold values of the same type as its arguments. The type of the empty l

Re: [Haskell-cafe] puzzling polymorphism behavior (7.0.3 windows)

2012-03-15 Thread Никитин Лев
Maybe everytime you use 'cell' you tell haskell to create NEW cell. Try this: push' i cell = modifyIORef cell (++ [i]) main = do cell <- newIORef [] push' "x" cell {- push' 3 cell will be incorrect in this case -} push' "o" cell readIORef cell >>= return Why the original code pordu

[Haskell-cafe] puzzling polymorphism behavior (7.0.3 windows)

2012-03-15 Thread gladstein
Why does the following program compile and produce the results it does? It seems like 3 and "x" got interpreted as the same type, (). Thanks in advance for your help. import Data.IORef import System.IO.Unsafe cell = unsafePerformIO $ newIORef [] push i = modifyIORef cell (++ [i]) main = do pu

Re: [Haskell-cafe] HXT: how to get sibling element

2012-03-15 Thread Wilfried van Asten
ArrowNavigatableTree can also get a following sibling Axis: http://hackage.haskell.org/packages/archive/hxt/9.2.2/doc/html/Control-Arrow-ArrowNavigatableTree.html Wilfried 2012/3/15 Никитин Лев : > Oh, yes! > In this situation with so poor structured source I can try to use tagsoup. > (or I'll

Re: [Haskell-cafe] HXT: how to get sibling element

2012-03-15 Thread Никитин Лев
Oh, yes! In this situation with so poor structured source I can try to use tagsoup. (or I'll take a look at xml-conduit). Nevertheless for better undestanding HXT it will be interesting to solve this problem in HXT. Or is it impossible? 15.03.2012, 20:08, "Asten, W.G.G. van (Wilfried, Studen

[Haskell-cafe] HXT: how to get sibling element

2012-03-15 Thread Никитин Лев
I absolutly agree with you but unfortunetly, it is not my xml file.It is extraction from html page of public web server. I cannot to change format of this html page.Sorry. I had to explain it  in first letter. But than what about to get sibling text (geting sibling is an separate interesting tasks

Re: [Haskell-cafe] Functional programming podcast

2012-03-15 Thread serialhex
On Thu, Mar 15, 2012 at 6:53 AM, Christopher Done wrote: > On 15 March 2012 06:53, Clint Moore wrote: > > We're closing in on a month since this post. Did everyone decide to > > do their own thing, do nothing, or ? > > Ah, I'd been traveling after posting this and then settling back in > work, t

Re: [Haskell-cafe] HXT: how to get sibling element

2012-03-15 Thread Wilfried van Asten
I'm am not really familiar with XML parsing in Haskell, but I am wondering why, if you have an xml file, you not simply name the element after the type of contents: Some Story This story about.. Tom Smith Alternatively you could use the class or some type attribute to indicate

Re: [Haskell-cafe] Functional programming podcast

2012-03-15 Thread Christopher Done
On 15 March 2012 06:53, Clint Moore wrote: > We're closing in on a month since this post.  Did everyone decide to > do their own thing, do nothing, or ? Ah, I'd been traveling after posting this and then settling back in work, this remains on my TODO list in my organizer. I have no plans laid out

[Haskell-cafe] HXT: how to get sibling element

2012-03-15 Thread Никитин Лев
Hello, haskellers. Suppose we have this xml doc (maybe, little stupid): Some story Description: This story about... Author: Tom Smith In the end I whant to get list: [("Title", "Some story"), ("Description","This story about..."), ("Author", "Tom Smith")], or, maybe this: Book "Some st