News aggregator

The tar package needs some love

Haskell on Reddit - Thu, 09/17/2015 - 12:16pm
Categories: Incoming News

test socket buffer full

haskell-cafe - Thu, 09/17/2015 - 10:50am
Hi haskellers I´m implementing a form of intelligent streaming among nodes so that a process could know if there are bottlenecks on sending/receiving data so the process can increase or decrease the number of worker threads, for example. For this purpose, I planned to use hPutBufNonBlocking and hGetBufNonBlocking to detect when the buffer is full, using block buffering. I created hPutStrLn' that tries to write the entire string in the buffer. if it does not fit, the process would be notified in a state variable, then it would do a flush of the buffer and the rest of the string would be sent with hPutBuf. Doing some tinkering here and there It came up to be this: hPutStrLn' h str= do let bs< at >(PS ps s l) = BS.pack $ str ++ "\n" n <- withForeignPtr ps $ \p-> hPutBufNonBlocking h (p `plusPtr` s) l when( n < l) $ do error "BUFFER FULLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL" hFlush h withForeignPtr ps $ \p -> hPutBuf h ( p `plusPtr` (n * sizeOf 'x' ) ) (l - n) return () The error condition is the o
Categories: Offsite Discussion

Coroutines with async and await syntax (Python 3.5)

Lambda the Ultimate - Thu, 09/17/2015 - 10:08am

With Python 3.5 released, the thing that drew my attention is the support for asynchronous programming through PEP 0492 -- Coroutines with async and await syntax, which added awaitable objects, coroutine functions, asynchronous iteration, and asynchronous context managers. I found the mailing list discussions (look both above and below) particularly helpful in understanding what exactly is going on.

Categories: Offsite Discussion

GSoC Retrospective

haskell-cafe - Thu, 09/17/2015 - 9:13am
In past years, Gwern did an outstanding job of summarising the GSoC proposals and how well they had done: <> Here are the proposals for this year. Perhaps students or their mentors could comment on how successful their projects have been? I realise this is a very poor substitute for Gwen’s analyses but it would better than nothing. A Strict language pragma for GHC - Adam Sandberg Eriksson <> STM Data Structures Implementation <> - Alex Semin Implementation of Layered Gramamar of Graphics <> - chinu <> Implementing Version Comparison for Cabal Packages - Craig Roche <> Improving Hackage Discoverability <> - D. Zack Garza <> Darcsden improvements <htt
Categories: Offsite Discussion

Proper way for library writers to handle errors

Haskell on Reddit - Thu, 09/17/2015 - 8:30am

In writing library functions, what is the best way these days to let users handle errors how they want to? In times past you could simply use the much hated (for good reason) fail function and then the user could simply instantiate with the monad they wanted for the kind of error handling they required (e.g. if they didn't need to know why something failed they could use Maybe, they could use Either if they wanted the message or even IO if they wanted a crash).

But since the fail definition has been removed from the Either monad definition, this strategy doesn't work anymore. What is the correct way to do this now? Everything I've read seems to explain how to explicitly use different kinds of errors (e.g. EitherT, MaybeT and so on) but that's exactly what I don't want to do.

submitted by haskellUser
[link] [20 comments]
Categories: Incoming News

Discussion thread about stack

Haskell on Reddit - Thu, 09/17/2015 - 8:00am

I'm sure I'm not the only person who's noticed that discussions about the stack build tool seem to have permeated just about any discussion on this subreddit with even a tangential relation to package management or tooling. Personally, I love stack, and am happy to discuss it with others quite a bit.

That said, I think it's quite unhealthy for our community for many important topics to end up getting dwarfed in rehash of the same stack discussion/debate/flame war that we've seen so many times. The most recent example was stealing the focus from Duncan's important cabal talk, for a discussion that really is completely unrelated to what he was saying.

Here's my proposal: let's get it all out in this thread. If people bring up the stack topic in an unrelated context elsewhere, let's point them back to this thread. If we need to start a new thread in a few months (or even a few weeks) to "restart" the discussion, so be it.

And if we can try to avoid ad hominems and sensationalism in this thread, all the better.

Finally, just to clarify my point here: I'm not trying to stop new threads from appearing that mention stack directly (e.g., ghc-mod adding stack support). What I'm asking is that:

  1. Threads that really aren't about stack don't bring up "the stack debate"
  2. Threads that are about stack try to discuss new things, not discuss the exact same thing all over again (no point polluting that ghc-mod thread with a stack vs cabal debate, it's been done already)
submitted by snoyberg
[link] [281 comments]
Categories: Incoming News

[Haskell-cafe] GSoC Retrospective; tell r/haskell about your experience and projects

Haskell on Reddit - Thu, 09/17/2015 - 6:31am

There was recently a post, [Haskell-cafe] GSoC Retrospective; so I ask, "GSoC participants, how was your experience and what would you like to tell us about your results?"

submitted by rpglover64
[link] [6 comments]
Categories: Incoming News

good book to learn Haskell

Haskell on Reddit - Thu, 09/17/2015 - 5:50am


Because of the reccomendations of bitemyapp github page I tried to learn haskell by the Craft book.

The explanation was fine the only thing that makes my grazy was that a lot of exercises were written on a way that was not clear what was the meaning of the exercise.

Now I wonder.

Is there a book with a lot of exercises where I can learn Haskell.

I have looked at LYAH but there no exercises.


submitted by roelofwobben
[link] [18 comments]
Categories: Incoming News

Looking for better than Dragon Book

haskell-cafe - Thu, 09/17/2015 - 12:39am
I've got the Tiger Book, ML version, which I will use to help me implement Tiger in Haskell. Below is a class curriculum I've found. But besides the Tiger Book, it uses the Dragon Book. I know there are more modern books out there. Looking for suggestions as what might be a good fit. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >
Categories: Offsite Discussion

Ancient use of generators

Lambda the Ultimate - Wed, 09/16/2015 - 11:58pm

Guido van Rossum reminisces a bit about early discussions of generators in the Python community (read the other messages in the thread as well). I think we talked about the articles he mentions way back when. Earlier still, and beyond the discussion by Guido here, was Icon, a clever little language that I have a soft spot for. i don't think we ever fully assessed its influence on Python and other languages.

Categories: Offsite Discussion

Portable Efficient Assembly Code-generation in High-level Python

Lambda the Ultimate - Wed, 09/16/2015 - 6:53pm

PeachPy is a Python framework for writing high-performance assembly kernels.

PeachPy aims to simplify writing optimized assembly kernels while preserving all optimization opportunities of traditional assembly.

You can use the same code to generate assembly for Windows, Unix, and Golang assembly. The library handles the various ABIs automatically. I haven't seen this cool project before.

Among the cool features is the ability to invoke the generated assembly as regular Python functions. Nice.

Categories: Offsite Discussion

Is there a portable way to get file size?

Haskell on Reddit - Wed, 09/16/2015 - 6:05pm

Stack Overflow suggests to use System.Posix but after asking around it seems that Windows dropped support for that with 8.1.

I am imagining that the change happened in Windows 8.1 and a solved problem became unsolved, so how do I do this today? It seems like a relatively fundamental thing, so maybe it would make sense to have this kind of thing in the already portable System.Directory library which currently has things like getModificationTime anyway?

edit: looks like System.IO.hFileSize is what I was looking for. Seems obvious now :P And it appears to be O(1) and all, so hopefully next time I know where to look now :)

submitted by wheatBread
[link] [10 comments]
Categories: Incoming News

Simple question about blackholing

haskell-cafe - Wed, 09/16/2015 - 4:57pm
Hello, By all accounts I've found a thunk is blackholed by replacing its header with a (the) blackhole code pointer (or blackhole info pointer in the unregisterized case). My simple-minded question is how garbage collection can take place given that the layout of the payload is lost. Surely not a custom blackhole for each (statically defined) thunk? A list of blackholes maintained somewhere that the GC knows about? Thanks for any insight! Kei
Categories: Offsite Discussion

Trouble with "where" block during compilation

Haskell on Reddit - Wed, 09/16/2015 - 4:31pm

Recently I've been having some fun working through "Learn You a Haskell" and until now, every piece of code in the book has compiled without issue. But now, I've entered this code from the book:

initials :: String -> String -> String initials firstName lastName = [f] ++ ". " ++ [l] ++ "." where (f:_) = firstName (l:_) = lastName

and I get this error: "124:25: parse error on input ‘=’" (the line where the error is thrown is the last line of the code under the "where" block, "(l:_) = lastName." My syntax is exactly as in the book. What could be the problem here?

submitted by AlanMGodel
[link] [8 comments]
Categories: Incoming News

LVars & producer/consumer pattern

Haskell on Reddit - Wed, 09/16/2015 - 11:51am

I read part of this paper about LVars.

I don't understand the implementation on page 9. The code is supposed to call analyze on the elements added to analyzedSet as soon as they are added. Unfortunately, the machinery of how analyze is applied to the elements is hidden.

What I don't understand is what the threshold for the get is supposed to be to read the first element of the result.

In general, let's say N threads add elements to a set. The updates are monotonic, but how can I get the elements as they arrive? This would be non-deterministic by definition. That's the point of the producer/consumer pattern.

I'm missing something here...

submitted by Kiuhnm
[link] [2 comments]
Categories: Incoming News

Noob question involving data constructors

Haskell on Reddit - Wed, 09/16/2015 - 11:40am

How would I use an if statement to check if the given input (information) is in my Player data constructor? Such as...

data Player = playerA | playerB | playerC data playerInfo = playerInfo Player Int Int information = playerInfo playerA 10 10 newteam :: playerInfo -> Maybe playerInfo newteam (Info p x y) = if (check if p is in Player data constructor) then Just (playerInfo p x y) else Nothing submitted by kendrickisgoat
[link] [4 comments]
Categories: Incoming News