News aggregator

Haskell Data.Vector, huge memory leak

haskell-cafe - 2 hours 50 min ago
Hi, I am trying to make a basic 2D engine with haskell and the SDL1.2 bindings (for fun, I am just learning). Ideally the world is to be procedurally generated, chunk by chunk, allowing free exploration. Right now my chunk is composed of 200*200 tiles which I represent using a type: Mat [Tile] = Vec.Vector (Vec.Vector [Tile]) and these functions: fromMat :: [[a]] -> Mat a fromMat xs = Vec.fromList [Vec.fromList xs' | xs' <- xs] (§) :: Mat a -> (Int, Int) -> a v § (r, c) = (v Vec.! r) Vec.! c I am using cyclic list of tiles in order to allow for sprite animation, and later for dynamic behaviour. Each frame of the game loop, the program reads the part of the vector relevant to the current camera position, display the corresponding tiles and return a new vector in which every of these cyclic lists has been replaced by it's tail. Here is the code responsible for this: applyTileMat :: Chunk -> SDL.Surface -> SDL.Surface -> IO Chunk applyTileMat ch src dest = let m = chLand $! ch (x,y) = chPos
Categories: Offsite Discussion

ANN: exference: a different djinn

haskell-cafe - 6 hours 26 min ago
Hello folks, Exference[1] is a Haskell tool for generating expressions from a type, e.g. Input: (Show b) => (a -> b) -> [a] -> [String] Output: \ b -> fmap (\ g -> show (b g)) In contrast to Djinn, the well known tool with the same general purpose, Exference supports a larger subset of the haskell type system - most prominently type classes. (Djinn's environment many contain type classes, but using them in queries will not really work.) This comes at a cost, however: Exference makes no promise regarding termination. Where Djinn tells you "there are no solutions", Exference will keep trying, sometimes aborting a non-ending search with "i could not find any solutions". See [2] for a report about the implementation, capabilities and limitations. [1] https://github.com/lspitzner/exference [2] https://github.com/lspitzner/exference/raw/master/exference.pdf Lennart
Categories: Offsite Discussion

Maintainship of edit-distance and lattices

libraries list - 8 hours 41 min ago
Hi, I’d like to help with maintaining of mentioned packages: - http://hackage.haskell.org/package/edit-distance <http://hackage.haskell.org/package/edit-distance> - http://hackage.haskell.org/package/lattices <http://hackage.haskell.org/package/lattices> Max doesn’t seem to be active on GitHub, there are - a PR to edit-distance fixing the build on GHC 7.10, open for 26 days: https://github.com/batterseapower/edit-distance/pull/3 <https://github.com/batterseapower/edit-distance/pull/3> - a PR to lattices opened at Jan 8 2015 (open for over 3 months already) https://github.com/batterseapower/lattices/pull/3 <https://github.com/batterseapower/lattices/pull/3> I could take over the maintainership of the packages, if Max doesn’t respond in two weeks - Oleg Grenrus _______________________________________________ Libraries mailing list Libraries< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Categories: Offsite Discussion

Philip Wadler: Bright Club

Planet Haskell - 9 hours 4 min ago

I'm performing at Bright Club, Edinburgh, Tuesday 28 April at The Stand. Doors open 7:30, show begins 8:30. See you there! Details, tickets £5.
Categories: Offsite Blogs

Function hanging in infinite input

haskell-cafe - 9 hours 14 min ago
Hello all, I was trying to implement >>= (tBind) on my "Temporal" data type and found that it hangs on an operation like takeInitialPart $ infiniteTemporal >>= (\x -> finiteTemporal) I am pretty sure the result is well defined and by no means infinite. Also the code works on finite Temporals. How does one address such problems? I attach the relevant pieces of code, in case someone would be so kind and inspect or run it. Feel free to point out any flaws as I might be completely off-track. If you call ex10 in GHCI, you get no result. The line marked with "< here" is executed over and over, but apparently without contributing to the result. The debugger shows, that "hd" does have a correct, finite value each time and that "tpr" is consumed as expected.
Categories: Offsite Discussion

Providing non-overloaded names

Haskell on Reddit - 11 hours 26 min ago

If a type is an instance of a common typeclass, is there a good reason to also provide an explicitly named value or function?

For example: for ParsecT, Parsec provides parserBind, parserReturn, parsecMap, parserFail, and more. These duplicate the Monad methods, and some other functions duplicate the MonadPlus and Alternative methods. Is there a good reason to do this?

submitted by massysett
[link] [5 comments]
Categories: Incoming News

Summer Plans with Haskell (no internship)

Haskell on Reddit - 13 hours 20 min ago

Hey guys! I'm new to this subreddit. I have recently gotten into Haskell, and I'm loving it so far. The functional paradigm is a really fun way to reason about programming.

So, like the title says, this summer I do not have an internship lined up, so my plan is to do a lot of personal projects, post a lot on github, contribute to open source projects, and possibly attend tech meetups to network. As such, I should probably learn as much as I can this summer, right?

I really want to get good at Haskell, though, like really really good. And functional programming in general. My question is, if I spend all of my summer doing Haskell, getting good at it and doing a lot of good work with it, would I have a shot at getting interviews for places that use functional programming, even if I don't have too much experience with other languages?

Either way, I will probably dabble in more popular languages like Scala, Erlang, F#, etc, but as of now I'm making haskell a priority. Should I split the time more evenly, or will learning haskell pay more dividends when it comes to being a better programmer, and still not hurt my chances of getting interviews at places whose stack is heavily functional based?

Thanks for reading!

submitted by uncountableB
[link] [3 comments]
Categories: Incoming News

Using protocol buffers in ghc 7.10

Haskell on Reddit - 13 hours 46 min ago

I'm starting out in Haskell and trying to build something that requires reading protocol buffers in ghc 7.10. I'm using 7.10 because it's the latest and I don't want to learn old stuff that I have to later unlearn and it's what I have on my Linux distro (Arch Linux). Is there a package for reading protocol buffers that I can use?

protocol-buffers: Build errors when I try to cabal install it.

protobuf: I can't get code to work that's modeled after the first example in the hackage docs. I get a parse error on the part where I express the field tag. (http://hackage.haskell.org/package/protobuf-0.2.0.4/docs/Data-ProtocolBuffers.html)

protobuf-native: Seems to require interfacing with C++. I'm not sure whether I'm ready for that.

submitted by Syncopat3d
[link] [4 comments]
Categories: Incoming News

Joachim Breitner: Fifth place in Godingame World Cup

Planet Haskell - 14 hours 33 min ago

Last evening, Codingame held a “Programming World Cup” titled “There is no Spoon”. The format is that within four hours, you get to write a program that solves a given task. Submissions are first rated by completeness (there are 13 test inputs that you can check your code again, and further hidden tests that will only be checked after submission) and then by time of submission. You can only submit your code once.

What I like about Codingame is that they support a great number of programming languages in their Web-“IDE”, including Haskell. I had nothing better to do yesterday, so I joined. I was aiming for a good position in the Haskell-specific ranking.

After nearly two hours my code completed all the visible test cases and I submitted. I figured that this was a reasonable time to do so, as it was half-time and there are supposed to be two challenges. I turned out that the first, quite small task, which felt like a warm-up or qualification puzzle, was the first of those two, and that therefore I was done, and indeed the 5th fastest to complete a 100% solution! With only less than 5 minutes difference to the 3rd, money-winning place – if I had known I had such a chance, I had started on time...

Having submitted the highest ranked Haskell code, I will get a T-Shirt. I also defended Haskell’s reputation as an efficient programming language, ranked third in the contest, after C++ (rank 1) and Java (rank 2), but before PHP (9), C# (10) and Python (11), listing only those that had a 100% solution.

The task, solving a Bridges puzzle, did not feel like a great fit for Haskell at first. I was juggling Data.Maps around where otherwise I’d simple attach attributes to object, and a recursive function simulated nothing but a plain loop. But it played off the moment I had to implement guessing parts of the solution, trying what happens and backtracking when it did not work: With all state in parameters and pure code it was very simple to get a complete solution.

My code is of course not very polished, and having the main loop live in the IO monad just to be able to print diagnostic commands is a bit ugly.

The next, Lord of the Ring-themed world cup will be on June 27th. Maybe we will see more than 18 Haskell entries then?

Categories: Offsite Blogs

503 on upload to Hackage?

haskell-cafe - 15 hours 39 min ago
Yesterday and today I made a few releases of a package to Hackage. On each upload I get a 503 error. This is the text: ~~~ Error 503 backend read error backend read error Guru Mediation: Details: cache-fra1229-FRA 1430030130 1668038750 Varnish cache server ~~~ I'm guessing this isn't expected behaviour. Has anyone else seen this? /M
Categories: Offsite Discussion

Why do packages need to be precompiled?

Haskell on Reddit - 18 hours 30 min ago

It seems to me that many of the problems with cabal are due to precompiling packages, because, as far as I can see, Haskell never guarantees ABI compatibility.

Why, then, are packages precompiled, instead of coherently building all the modules used from source when the program is compiled?

submitted by 1-05457
[link] [8 comments]
Categories: Incoming News

20k /r/haskell subscribers. Nice!

Haskell on Reddit - 19 hours 51 min ago

Pretty cool that we made it to 20k readers. That makes /r/haskell the 7th largest language community on reddit. Not bad for an obscure academic language ;)

https://www.reddit.com/r/programming/wiki/faq#wiki_what_language_reddits_are_there.3F

submitted by dons
[link] [44 comments]
Categories: Incoming News

something went wrong

del.icio.us/haskell - 22 hours 34 min ago
Categories: Offsite Blogs

Coplanarity or Colinearity [Was: low-cost matrixrank?]

haskell-cafe - Sat, 04/25/2015 - 2:53pm
Well, none of the suggested solutions for computing the rank of a matrix really suited my needs, as dragging in something like BLAS introduce more cost than just integrating the bed-and-breakfast library into my own library. So let me try a different track. My real problem is that I've got a list of points in R3 and want to decide if they determine a plane, meaning they are coplanar but not colinear. Similarly, given a list of points in R2, I want to verify that they aren't colinear. Both of these can be done by converting the list of points to a matrix and finding the rank of the matrix, but I only use the rank function in the definitions of colinear and coplanar. Maybe there's an easier way to tackle the underlying problems. Anyone got a suggestion for such? _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

GHCi shows result of (IO a) only if (a) is in classShow

haskell-cafe - Sat, 04/25/2015 - 1:21pm
I wrote a parser and it took me a while to realize why GHCi suddenly did not show any result nor an error message anymore. My parsing function has type (IO Expression), Expression is in class Show. After changing the parser to (IO Declaration), it did not show anything anymore, because Declaration was not in class Show. When I typed (parseFile "input.txt" >>= print), I got the error message and understood what was going on. But for I while I was really confused what's happening. Just wanted to share this. Best, Daniel
Categories: Offsite Discussion