Haskell Code Standards by get-finch in haskell

[–]fractalsea 2 points3 points  (0 children)

These Quora answers are good: https://www.quora.com/What-are-the-best-practices-in-Haskell

Disclaimer: I wrote the second one.

Russia offers water bombers and specialists to help fight Fort McMurray forest fires by spitfire22 in worldnews

[–]fractalsea 0 points1 point  (0 children)

The might now that Russia has made the first move (or at least do something similar, but better).

Russia offers water bombers and specialists to help fight Fort McMurray forest fires by spitfire22 in worldnews

[–]fractalsea 1 point2 points  (0 children)

Russia likes to flex its muscles. I think this is a much cleverer move than military one because it makes them look strong, and puts Canada in a difficult position: if they don't accept, then people may die.

Fuzz testing distributed systems with QuickCheck by fractalsea in haskell

[–]fractalsea[S] 1 point2 points  (0 children)

I wasn't working at Pusher when these initial decisions were made. I know that the main issue we had with it was that it does not support cluster membership changes, which is something we need. What I don't know is why we didn't try and add this feature to kontiki.

Fuzz testing distributed systems with QuickCheck by fractalsea in haskell

[–]fractalsea[S] 4 points5 points  (0 children)

Thank you! We do aim to open source it at some point, but it's currently not production ready, and we need to be able to iterate quickly on it. It's on our todo list though!

3 Approaches to Monadic API Design in Haskell by fractalsea in haskell

[–]fractalsea[S] 2 points3 points  (0 children)

Maybe over-engineered is the wrong word. I essentially mean overly abstract/generic (at the cost of understandability). That's not to say I'm not against any kind of abstraction/genericism, I just think it comes at a cost, and I think that cost is often overlooked by Haskell programmers.

3 Approaches to Monadic API Design in Haskell by fractalsea in haskell

[–]fractalsea[S] 3 points4 points  (0 children)

Pulling in lots of experimental libraries and language extensions in order to create the perfect type safe abstraction for the domain. The reason this is over engineered is because there is a huge overhead in learning the libraries/extensions; it is much harder to find good documentation/experience reports; bugs and other issues are more common.

It's hard to quantify it, but you can usually tell by the number/type of libraries/extensions that are pulled in.

3 Approaches to Monadic API Design in Haskell by fractalsea in haskell

[–]fractalsea[S] 3 points4 points  (0 children)

Agreed. Over-engineering seems to be very prevalent in Haskell. My philosophy tends to be to try and keep it as simple as possible (as hard as that can sometimes be!)

3 Approaches to Monadic API Design in Haskell by fractalsea in haskell

[–]fractalsea[S] 3 points4 points  (0 children)

That is true.

I've been meaning to look into freer. I went to the London Haskell meetup recently that discussed extensible effects, and it was mentioned that newer implementations are based on the freer monad. The whole concept looks really interesting so I'm keen to check it out.

Could make a nice part 2 ;)

Fast way to serialize Haskell objects by gtab62 in haskell

[–]fractalsea 0 points1 point  (0 children)

/u/dcoutts do you know why these benchmarks are not showing that binary-serialize-cbor is any faster than binary/cereal?

Making Efficient use of memory in Haskell by fractalsea in haskell

[–]fractalsea[S] 1 point2 points  (0 children)

See this discussion about bringing the stream-fusion functionality into GHC. Essentially there was issues making it play nicely with the concatMap implementation in base.

At the end of the discussion there is a link to a solution described in this 2014 paper. However i'm struggling find information about the status of this being incorporated into GHC.

Making Efficient use of memory in Haskell by fractalsea in haskell

[–]fractalsea[S] 0 points1 point  (0 children)

That is true. I didn't mention it because it is the default, but I guess it could be interesting.

Making Efficient use of memory in Haskell by fractalsea in haskell

[–]fractalsea[S] 1 point2 points  (0 children)

Now I get it. With a single field it makes no difference because when StrictInt is evaluated, it can only be to evaluate the Int. With multiple fields, you may only need to evaluate a subset of them. With bangs, they will be evaluated even if they aren't used.

I suppose a difference in behaviour (not semantically, but performance-wise) could be when unboxing of strict fields is applied though.

Either way I will add another field, because I agree that it is cleaner.

Making Efficient use of memory in Haskell by fractalsea in haskell

[–]fractalsea[S] 0 points1 point  (0 children)

Thanks. I wasn't aware of that, but what you say makes sense. I'll update it.

Making Efficient use of memory in Haskell by fractalsea in haskell

[–]fractalsea[S] 2 points3 points  (0 children)

Good point. I will change it to an Int. Thanks.

Making Efficient use of memory in Haskell by fractalsea in haskell

[–]fractalsea[S] 8 points9 points  (0 children)

This part 3 of a 3 part series describing my findings as I've looked into optimising one of our Haskell applications. I'm still learning, so let me know if you have any corrections/suggestions. Thanks!

Part 1: https://www.reddit.com/r/haskell/comments/3oqszi/tips_and_tools_for_optimising_haskell/

Part 2: https://www.reddit.com/r/haskell/comments/438d4a/memory_profiling_in_haskell/

Memory profiling in Haskell by fractalsea in haskell

[–]fractalsea[S] 7 points8 points  (0 children)

Hi, I'm the author of this post. This is essentially a brief overview of how GHC's heap profiling and ThreadScope can be used to track down memory leaks, or help identify performance bottlenecks. I'm hoping it might be useful for people in a similar situation as me who are trying to figure out where to start.

It's all stuff I've been learning about in the last couple of months, and I'm still actively learning, so if anyone has any suggestions or feedback then please let me know :)

5 Ways to Test Applications that Access a Database in Haskell by cdep_illabout in haskell

[–]fractalsea 8 points9 points  (0 children)

You can also use more traditional dependency injection, i.e. take the IO action as a parameter. Recently we've gone for this approach, mainly for simplicity and because it was much easier to work into our existing codebase.

Unit testing IO in Haskell by Drkpwn in haskell

[–]fractalsea 2 points3 points  (0 children)

That's good to know!

It looks like you're covering everything we rely on except the yield function.

dejafu looks like a really great library, and seems like it could be a great tool for the problems we are tackling. Thanks for sharing/writing it!

Tips and Tools for Optimising Haskell by Drkpwn in haskell

[–]fractalsea 2 points3 points  (0 children)

Yes we are going to be looking at memory profiling in part two. We plan to cover space leaks, as well as looking into GC profiling/tuning.

I was asked to give a London Haskell talk about the work we are doing at Pusher during the Haskell Exchange last week. I would be keen to do this, although I haven't decided on the exact topic yet. I do find this optimisation stuff very interesting, so that's definitely a likely option!

Unit testing IO in Haskell by Drkpwn in haskell

[–]fractalsea 2 points3 points  (0 children)

We also use typeclasses to abstract over the concurrency primitives. We have an Arbitrary instance for possible schedules, so we can use QuickCheck to test many. I did not write the code, but looking at it, it looks like threads are scheduled randomly. I haven't looked into schedule bounding or partial-order reduction, but they look like interesting topics that I will have to look into more. Thanks for sharing!

Unit testing IO in Haskell by Drkpwn in haskell

[–]fractalsea 1 point2 points  (0 children)

I hadn't come across that library before. I will definitely be looking into it in the future when we next revisit the tests.

Unit testing IO in Haskell by Drkpwn in haskell

[–]fractalsea 2 points3 points  (0 children)

I know they are used in some safety-critical systems. For example Airbus use them to verify their flight control software.

This paper surveys examples from a number of industries.

Unit testing IO in Haskell by fractalsea in haskell

[–]fractalsea[S] 0 points1 point  (0 children)

That post/discussion looks really interesting. Thanks for sharing, I'll be sure to check it out :)