News aggregator

Exceptions with Context Re: Proposal: Add exception info

libraries list - Wed, 04/22/2015 - 3:23am
hrm, i like this proposal more, and it seems like with some fleshing out it can be strictly more extensible yet backwards compatible than michael's I'll need to mull it a bit more before I cast my vote, but this seems to sketch out a design that provides the same information, but in a more extensible/backwards compatible fashion (at least in a first cut of thinking about it) (i'm splitting this into a new thread so the discussions dont get mixed up) On Tue, Apr 21, 2015 at 9:40 PM, davean <davean< at >> wrote: _______________________________________________ Libraries mailing list Libraries< at >
Categories: Offsite Discussion

Proposal: add alterLookupWithKey to Data.Map.Lazy (containers)

libraries list - Tue, 04/21/2015 - 10:23pm
Github issue: Summary: add alterLookupWithKey :: Ord k => (k -> Maybe a -> Maybe a) -> k -> Map k a -> (Maybe a, Map k a) function to Data.Map.Lazy. Details: implement alterLookupWithKey function which takes an update function, key and map, allowing to insert, delete or update a value in a Map and return updated map with a new value. Motivations: For insert/update/delete: same as for alter :: Ord k => (Maybe a -> Maybe a) -> k -> Map k a -> Map k a - it allows to perform insert/update/delete within single lookup. For returning updated value: same as for *LookupWithKey functions - in case of update we mind be interested in the updated value. For a "key" parameter: hornestly, don't know. *LookupWithKey functions are having (k -> .. ) -> k -> <a> -> Map k a -> (Maybe a, Map k a) signatures, but I don't see any reason to pass the key to the update function, because we always can capture the key in a closure if we whant to. The only reason is to respect exist
Categories: Offsite Discussion

Beautiful Code, Compelling Evidence: OpenGL, Cairo tutorial - still up-to-date?

Haskell on Reddit - Tue, 04/21/2015 - 8:43pm

I came across this beautiful tutorial -

I noticed though it's about 7 years old now and things have moved pretty fast as far as opengl standards, opengl tooling in haskell, haskell practices, and data science since then.

Is there an updated equivalent of this tutorial? Is anything there obviously out of date now?

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

Extended Deadline - SBLP 2015

General haskell list - Tue, 04/21/2015 - 7:42pm
CALL FOR PAPERS SBLP 2015 *** EXTENDED DEADLINE *** 19th Brazilian Symposium on Programming Languages 24-25 September 2015 Belo Horizonte, Brazil +++++++++++++++++++++++++++++++++++++++++++++++++++ IMPORTANT DATES Abstract submission (extended): 27 April, 2015 Paper submission (extended): 4 May, 2015 Author notification: 18 June, 2015 Camera ready deadline: 2 July 2015 INTRODUCTION The Brazilian Symposium on Programming Languages is a well-established symposium which provides a venue for researchers and practitioners interested in the fundamental principles and innovations in the design and implementation of programming languages and systems. SBLP 2015 is part of 6th Brazilian Conference on Software: Theory and Practice, CBSoft 2015, that will be held in Belo Horizonte, Minas Gerais, Brazil, from September 21st to September 26th, 2015. SBLP dates are Thursday 24th and Friday 25th of September. Authors are invited to submit original research on any relevant topic which c
Categories: Incoming News

Looking for Senior Software Engineers

haskell-cafe - Tue, 04/21/2015 - 6:01pm
Dear Haskellers, There are two senior software engineer openings at, a Haskell and NixOS based company located in Manhattan NY. Here are the job postings. Professional Haskell experience is not required. Provided you have experience maintaining and developing web services, this is your chance to become a professional Haskeller (if you're not one already). Relocation will be provided, but remote is not an option. Please send your resumes to jobs< at > if you are interested. Sincerely, Jonathan Fischoff VP of Engineering at _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >
Categories: Offsite Discussion

GHC 7.10 and memory usage

Haskell on Reddit - Tue, 04/21/2015 - 5:48pm

I have the impression that my programs are using more memory since I changed to GHC 7.10. Just now a program that used to run normally took all of my RAM. Did anyone have this experience also?

submitted by guaraqe
[link] [29 comments]
Categories: Incoming News

Mark Jason Dominus: Another use for strace (isatty)

Planet Haskell - Tue, 04/21/2015 - 4:41pm

(This is a followup to an earlier article describing an interesting use of strace.)

A while back I was writing a talk about Unix internals and I wanted to discuss how the ls command does a different display when talking to a terminal than otherwise:

ls to a terminal

ls not to a terminal

How does ls know when it is talking to a terminal? I expect that is uses the standard POSIX function isatty. But how does isatty find out?

I had written down my guess. Had I been programming in C, without isatty, I would have written something like this:

@statinfo = stat STDOUT; if ( $statinfo[2] & 0060000 == 0020000 && ($statinfo[6] & 0xff) == 5) { say "Terminal" } else { say "Not a terminal" }

(This is Perl, written as if it were C.) It uses fstat (exposed in Perl as stat) to get the mode bits ($statinfo[2]) of the inode attached to STDOUT, and then it masks out the bits the determine if the inode is a character device file. If so, $statinfo[6] is the major and minor device numbers; if the major number (low byte) is equal to the magic number 5, the device is a terminal device. On my current computers the magic number is actually 136. Obviously this magic number is nonportable. You may hear people claim that those bit operations are also nonportable. I believe that claim is mistaken.

The analogous code using isatty is:

use POSIX 'isatty'; if (isatty(STDOUT)) { say "Terminal" } else { say "Not a terminal" }

Is isatty doing what I wrote above? Or something else?

Let's use strace to find out. Here's our test script:

% perl -MPOSIX=isatty -le 'print STDERR isatty(STDOUT) ? "terminal" : "nonterminal"' terminal % perl -MPOSIX=isatty -le 'print STDERR isatty(STDOUT) ? "terminal" : "nonterminal"' > /dev/null nonterminal

Now we use strace:

% strace -o /tmp/isatty perl -MPOSIX=isatty -le 'print STDERR isatty(STDOUT) ? "terminal" : "nonterminal"' > /dev/null nonterminal % less /tmp/isatty

We expect to see a long startup as Perl gets loaded and initialized, then whatever isatty is doing, the write of nonterminal, and then a short teardown, so we start searching at the end and quickly discover, a couple of screens up:

ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7ffea6840a58) = -1 ENOTTY (Inappropriate ioctl for device) write(2, "nonterminal", 11) = 11 write(2, "\n", 1) = 1

My guess about fstat was totally wrong! The actual method is that isatty makes an ioctl call; this is a device-driver-specific command. The TCGETS parameter says what command is, in this case “get the terminal configuration”. If you do this on a non-device, or a non-terminal device, the call fails with the error ENOTTY. When the ioctl call fails, you know you don't have a terminal. If you do have a terminal, the TCGETS command has no effects, because it is a passive read of the terminal state. Here's the successful call:

ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0 write(2, "terminal", 8) = 8 write(2, "\n", 1) = 1

The B38400 opost… stuff is the terminal configuration; 38400 is the baud rate.

(In the past the explanatory text for ENOTTY was the mystifying “Not a typewriter”, even more mystifying because it tended to pop up when you didn't expect it. Apparently Linux has revised the message to the possibly less mystifying “Inappropriate ioctl for device”.

(SNDCTL_TMR_TIMEBASE is mentioned because apparently someone decided to give their SNDCTL_TMR_TIMEBASE operation, whatever that is, the same numeric code as TCGETS, and strace isn't sure which one is being requested. It's possible that if we figured out which device was expecting SNDCTL_TMR_TIMEBASE, and redirected standard output to that device, that isatty would erroneously claim that it was a terminal.)

[ Addendum 20150415: Paul Bolle has found that the SNDCTL_TMR_TIMEBASE pertains to the old and possibly deprecated OSS (Open Sound System) It is conceivable that isatty would yield the wrong answer when pointed at the OSS /dev/dsp or /dev/audio device or similar. If anyone is running OSS and willing to give it a try, please contact me at ]

Categories: Offsite Blogs

Passing functions of type (Num a) => (a->a->a)

Haskell on Reddit - Tue, 04/21/2015 - 4:33pm

I'm writing a scheme interpreter I'm trying to write a function that will do the type coercion when adding and subtracting. Currently I have functions like the "add" for almost every operation.

I would like to write a generic function that will accept a function like (+) and some Numbers which are either a INTs or DOUBLEs and then applies the function once the numbers have been converted.

data Number = INT Int | DOUBLE Double add :: Number -> Number -> Number add (INT a) (INT b) = (INT (a + b)) add (INT a) (DOUBLE b) = (DOUBLE ((fromIntegral a) + b)) add (DOUBLE a) (INT b) = (DOUBLE (a + (fromIntegral b))) add (DOUBLE a) (DOUBLE b) = (DOUBLE (a + b)) coercion :: (Num a) => (a -> a -> a) -> Number -> Number -> Number coercion f (INT a) (INT b) = (INT (f a b)) coercion f (INT a) (DOUBLE b) = (DOUBLE (f (fromIntegral a) b)) coercion f (DOUBLE a) (INT b) = (DOUBLE (f a (fromIntegral b))) coercion f (DOUBLE a) (DOUBLE b) = (DOUBLE (f a b))

GHC complains that it cannot deduce that (f a b) is the right type to fit into INT or DOUBLE's type constructor.

Why does it work if I hard code (+) into a function like add but not when I pass a function of the same type like with coercion?

Thanks for taking the time to read through this!

[EDIT]: Fixed typos in the declaration of Numbers

submitted by JD95
[link] [15 comments]
Categories: Incoming News

A post on /r/haskelltil turned into a discussion about the newbie-friendliness of Haskell documentation

Haskell on Reddit - Tue, 04/21/2015 - 4:25pm

There was a (small) consensus that it should be moved here. Here's the link, but to make things easier I've reproduced the full comment thread (actually in comments), starting with my initial post (right here).

Endo, "The monoid of endomorphisms under composition," is just a newtype for (a -> a) -- | The monoid of endomorphisms under composition. newtype Endo a = Endo { appEndo :: a -> a } deriving (Generic) instance Monoid (Endo a) where mempty = Endo id Endo f `mappend` Endo g = Endo (f . g)

Haskell documentation is frequently a lot scarier than it needs to be. :)

submitted by tejon
[link] [26 comments]
Categories: Incoming News

ANN: Upload agentx,Library for write extensible SNMP agents.

haskell-cafe - Tue, 04/21/2015 - 1:46pm
Can be useful for create monitoring tools. Usage example in docs. get, set, walk, context is work. Bulk work as simple get. Tables don't work, Indexes don't work.
Categories: Offsite Discussion

is haskell good for anything besides

Haskell on Reddit - Tue, 04/21/2015 - 12:51pm

making the Fibonacci sequence?

submitted by patriceonealfan
[link] [19 comments]
Categories: Incoming News

How to use an crypto with hackage cereal?

haskell-cafe - Tue, 04/21/2015 - 10:22am
Hi, I am trying to work with some binary data that encrypted by field instead of the result of serialization. I'd like to use Data.Serialize to wrap the data structure. But I could not figure out how to apply an runtime specified cipher method to the bytestring. Any idea? Or I should use totally other solution? Thanks.
Categories: Offsite Discussion

AI4FM 2015: Call for Short Contributions

General haskell list - Tue, 04/21/2015 - 9:57am
------------------------------------------------- AI4FM 2015 - the 6th International Workshop on the use of AI in Formal Methods Edinburgh, 1st September, 2015 In association with AVoCS 2015 ------------------------------------------------- --- First Call for Contributions --- Important Dates --------------- Submission deadline: 1st August, 2015 Notification of acceptance: 10th August, 2015 Final version due: 21st August, 2015 Workshop: 1st September, 2015 General --------------- This workshop will bring together researchers from formal methods, automated reasoning and AI; it will address the issue of how AI can be used to support the formal software development process, including requirement analysis, modelling and proof. Previous AI4FM workshops have included a mix of industrial and academic participants and we anticipate attracting a similarly diverse audience. Rigorous software development using formal methods allows th
Categories: Incoming News

Dimitri Sabadie: Losing our privacy

Planet Haskell - Tue, 04/21/2015 - 6:46am
Big brother of NSA

On the 19th of March 2015, a law was introduced in France. That law was entitled “loi du renseignement” and was presented in regard of what happened in the Charlie Hebdo awful week. The main idea of the law is to put peole on wire so that terrorist activities could be spotted and dismantled.

That law will be voted and apply on the the 5th of May 2015.

Although such a law sounds great for counter-terrorism, it has several major issues people should be aware of.

You’re on wire

Every people – in France and abroad as well of course – could be on wire. The French government might have access to whatever you do with your internet connection. Crypto-analysts working for the goverment will read dozens of thousands of messages from individuals. They’ll know where you go to and where you go from – think of your smartphone’s GPS capabilities. They’ll know which pictures you take, how much time you spend in your bathroom. They’ll even be able to read your e-mails if they want to.

Of course, most people “just don’t care”. “Why should I care that the government knows the litter brand I bought to my cat? I don’t give a damned heck as long as they catch bad people”. That’s a point, but that’s also being blind. Digital communication is not only about yourself. It’s about people. It’s about you and your friends. You, and your contacts. You can’t choose for them whether they’d like people to watch over their shoulders every now and then. If the government has access to your private data, it has access to your friends’ and contacts’ data as well. Not giving a damned heck is being selfish.

You’ll be violated

Then comes the issue with what the law is. It gives the government the right to spy on masses. They could even sell the data they collect. As a counter argument, the “Commission de contrôle des techniques de renseignement” – which French stands for “Control commission of intelligence techniques” – was created. That committe is there to watch the government and ensure it doesn’t go out of control and doesn’t violate people’s rights. The issue with that is that our prime minister has the right to ignore the committee’s decision. If the committee says “Wait a minute. You don’t have the right to gather those information without asking for M. Dupont’s approval”, the prime minister may answer back “Well, fuck off. I will and you can’t stop me”. And the sad truth is that… yeah, with that law, the prime minister and their team has the right to ignore the committee’s decision.

The committee then has no point. It just gives an opinion. Not a veto. What would happen if a terrorist hacked into your computer. Would you go to jail because the prime minister would have stated you were a terrorist? Damn me if I know.

We’re going to lose a right

French people will lose a very important right: the right to privacy. It’ll be sacrificied without your opinion for counter-terrorism, giving the government a power it shouldn’t have. You thought the NSA was/is wrong? Sure it is. But when the NSA watches over American and worldwide people, it is illegal whereas when the French government watches over French and worldwide people, it is legal. That makes the French government way worse than the NSA to me.

I think the first thing I’ll do will be to revoke my French VPS subscription to move it out of France, in a country in which people still have privacy. Keep your communication encrypted as much as possible (ssh and so on). And as a bad joke, don’t leave your camera in your bedroom. You might be spied on by Manuel Valls while having sex with your girlfriend.

Categories: Offsite Blogs

Purpose of Data.Vector.Mixed

Haskell on Reddit - Tue, 04/21/2015 - 6:20am
Categories: Incoming News

Data.Tree traversals

libraries list - Tue, 04/21/2015 - 4:20am
Data.Tree makes Tree into a Traversable in only one way: depth-first. It seems to me that we should have a newtype to traverse in breadth-first order. David Feuer _______________________________________________ Libraries mailing list Libraries< at >
Categories: Offsite Discussion