News aggregator

Exciting new opportunity at CyLab/Carnegie Mellon University!

Haskell on Reddit - Wed, 06/25/2014 - 1:07pm

We're looking for talented hackers who are interested in security research. The projects involve exploitation, defense, and malware analysis. We are seeking someone with a strong background in reversing and writing exploits against program binaries. Compiler knowledge a big plus. We write our code in OCaml and C, but experience with any functional programming language such as Haskell, SML, Clojure is welcomed. This position focuses on improving our current infrastructure for automatic exploit generation and will help with the development of a fully automated system that plays in computer security tournaments such as “Capture the Flag”. The system will compete in real-time to find vulnerabilities, exploit adversaries, and generate and deploy security patches. Responsibilities include program analysis for x86 code in an OCaml infrastructure and development of new features through data-driven iterations.

The position is at Carnegie Mellon University in CyLab with Prof. David Brumley. You'd also be working with PhD students and undergrads. For more information on these security projects, visit If interested, please click here

This full time staff position at Carnegie Mellon University comes with excellent benefits such as free tuition benefits, numerous medical & dental plans, free public transportation, 8% contribution to a retirement account, generous paid time off (PTO), and a great work environment. You can get more information here

Carnegie Mellon University is an EEO/Affirmative Action Employer – M/F/Disability/Veteran

submitted by cmu-recruiting
[link] [comment]
Categories: Incoming News

[learn] Reasoning about time and space complexity

Haskell on Reddit - Wed, 06/25/2014 - 12:03pm

I'm trying to figure out what can be said mathematically about the time and space complexity of lazy programs. Here's what I know so far:

  • If we look at whole programs, then the time complexity of lazy evaluation is asymptotically at least as good as eager evaluation, but space complexity might be worse.

  • If we look at individual functions in a lazy language, things are less clear. Some functions, like quicksort, seem to have a well-defined time and space complexity, which is roughly "how much time and space this function would use if both the arguments and the result were fully evaluated", assuming that both are finite. But that definition is not enough to analyze some uses of these functions, like implementing quickselect in terms of quicksort. And it doesn't seem to work for functions that are intended to deal with infinite data structures, like repeat. Time is just as problematic as space in this regard.

  • Okasaki's book has a nice approach to analyzing some lazy data structures, though it doesn't seem to generalize to everything you can write in a lazy language.

The question is, where should I look next? How do people analyze the time and space complexity of functions in a lazy language, both in theory and in practice?

submitted by want_to_want
[link] [9 comments]
Categories: Incoming News

accessing a ByteArray from FFI

haskell-cafe - Wed, 06/25/2014 - 11:58am
Hello, I want to access the contents of a Data.Vector.Primitive from FFI. I came up with the following so far: {-# LANGUAGE ForeignFunctionInterface #-} module FFIExample (exampleFn) where import Control.Monad.Primitive (touch) import Control.Monad.ST (runST) import Data.Primitive.Addr (Addr(..)) import Data.Primitive.ByteArray (mutableByteArrayContents) import qualified Data.Vector.Primitive as P import qualified Data.Vector.Primitive.Mutable as PM import GHC.Ptr (Ptr(..), plusPtr) import Data.Word (Word64) foreign import ccall unsafe "my_external_fn" myExternalFn :: Ptr Word64 -> Int -> Int exampleFn :: P.Vector Word64 -> Int exampleFn v = runST $ do   PM.MVector off len mba <- P.unsafeThaw v   let ptr = case mutableByteArrayContents mba of         Addr addr -> Ptr addr `plusPtr` off       result = myExternalFn ptr len   result `seq` touch mba   return result This seems to work, but I have questions that I haven't been able to find the answers to on my own: 1. Is this actually OK to do?
Categories: Offsite Discussion

Quantification in Instance Contexts

haskell-cafe - Wed, 06/25/2014 - 10:46am
Hi Cafe, I'm playing around with simple logic-programming at the type level. For instance, encoding trees: Now the following obviously doesn't work (never mind for now that 'Path' needs a recursive definition, and that this is really just 'Grandchild'): Because 'b' is ambiguous. Fair enough. But I can't directly use a fundep, because 'b' *is* in fact ambiguous. What I want to tell the compiler is that it's really okay, since the RHS side (and any possible 'where' expressions) doesn't depend on what is instantiated for 'b'. I know I could switch to a class 'Children a bs bool' and encode all children of as a type-level list, and then have a fundep between 'a' and 'bs'. That's not a *bad* solution: it does give a good sense of the intention. But it's not very extensible; really I'd rather be using something like 'forall' - something, I would guess, along the lines of: That, however, fails with: Malformed instance head: (forall b. (Child a b TrueT, Child b c
Categories: Offsite Discussion

Algorithm critique requested

Haskell on Reddit - Wed, 06/25/2014 - 10:16am

A while back I had a job interview where I had to write a function that would test if a string was a palindrome. I was able to pick whichever language I wanted (from a list).

I started thinking about how it would be easy to express this algorithm in haskell, so this morning I decided to try it out.

I've been learning about haskell off and on for about a year, but haven't really implemented anything too significant, so I wanted to get some input on this, if anyone is interested in taking a look.

palindrome :: Eq a => [a] -> Bool palindrome [] = True palindrome (x:[]) = True palindrome (x:_:y:[]) = x == y palindrome xs | head xs /= last xs = False | head xs == last xs = palindrome $ stripFirstAndLast xs where stripFirstAndLast ys = tail $ reverse $ tail $ reverse ys

If you want syntax highlighting:

submitted by zexperiment
[link] [7 comments]
Categories: Incoming News

Monad laws

haskell-cafe - Wed, 06/25/2014 - 4:54am
Hello, You guys have been great taking my questions. Thank you. Now I have another one :) What can go wrong if I make an Monad instance but don't follow Monad rules (identity and associativity)? Sure it would be misleading for someone using the non-conforming class. They may make code that assume those laws, although they don't hold. However, could it make the compiler generate bad code or some standard functions to behave badly or even break? []'s Rafael _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >
Categories: Offsite Discussion

[learn] I don't understand this syntax error

Haskell on Reddit - Tue, 06/24/2014 - 11:43pm

I can't figure out why I'm told

Not in scope: ‘answer’


guessGame :: (RandomGen g) => g -> Int -> Int -> Int -> InputT IO () guessGame gen low high guesses = do let (answer, gen1) = randomR (low, high) gen loop 5 where loop n = do guess <- getInputLine $ "Guess the number: " ++ show low ++ ", " ++ show high case guess of Just g -> if (read g) == answer then return () else loopagain Nothing -> return () where loopagain = if n > 0 then loop (n - 1) else return ()

Isn't 'loop' a closure whose environment contains 'answer'?

submitted by ignorantone
[link] [7 comments]
Categories: Incoming News

Darcs: darcs news #104

Planet Haskell - Tue, 06/24/2014 - 10:59pm
News and discussions
  1. Google Summer of Code 2013 has begun! BSRK and José will post updates on their blogs:
Issues resolved (8)
issue2163 Radoslav Dorcik
issue2227 Ganesh Sittampalam
issue2248 Ganesh Sittampalam
issue2250 BSRK Aditya
issue2311 Sebastian Fischer
issue2312 Sebastian Fischer
issue2320 Jose Luis Neder
issue2321 Jose Luis Neder
Patches applied (20)
See darcs wiki entry for details.
Categories: Offsite Blogs

Darcs: darcs news #105

Planet Haskell - Tue, 06/24/2014 - 10:58pm
News and discussions
  1. This year's Google Summer of Code projects brought a lot of improvements to darcs and its ecosystem!
  2. Gian Piero Carrubba asked why adjacent hunks could not commute:
  3. We listed the changes that occurred between version 2.8.4 and the current development branch into a 2.10 release page:
Issues resolved (8)
issue346 Jose Luis Neder
issue1828 Guillaume Hoffmann
issue2181 Guillaume Hoffmann
issue2309 Owen Stephens
issue2313 Jose Luis Neder
issue2334 Guillaume Hoffmann
issue2343 Jose Luis Neder
issue2347 Guillaume Hoffmann
Patches applied (39)
See darcs wiki entry for details.
Categories: Offsite Blogs

Darcs: Darcs News #106

Planet Haskell - Tue, 06/24/2014 - 10:58pm
News and discussions
  1. Darcs is participating once again to the Google Summer of Code, through the umbrella organization Deadline for student application is Friday 21st:
  2. It is now possible to donate stock to darcs through the Software Freedom Conservancy organization. Donations by Paypal, Flattr, checks and wire transfer are still possible:
  3. Dan Licata wrote a presentation about Darcs as a higher inductive type:
  4. Darcs now directly provides import and export commands with Git. This code was adapted from Petr Rockai's darcs-fastconvert, with some changes by Owen Stephen from his Summer of Code project "darcs-bridge":
Issues resolved (6)
issue642 Jose Luis Neder
issue2209 Jose Luis Neder
issue2319 Guillaume Hoffmann
issue2332 Guillaume Hoffmann
issue2335 Guillaume Hoffmann
issue2348 Ryan
Patches applied (34)
See darcs wiki entry for details.
Categories: Offsite Blogs

Darcs: Darcs News #107

Planet Haskell - Tue, 06/24/2014 - 10:57pm
News and discussions
  1. Darcs has received two grants from the Google Summer of Code program, as part of the umbrella organization Alejandro Gadea will work on history reordering:
  2. Marcio Diaz will work on the cache system:
  3. Repository cloning to remote ssh hosts has been present for years as darcs put. This feature has now a more efficient implementation:
Issues resolved (11)
issue851 Dan Frumin
issue1066 Guillaume Hoffmann
issue1268 Guillaume Hoffmann
issue1416 Ale Gadea
issue1987 Marcio Diaz
issue2263 Ale Gadea
issue2345 Dan Frumin
issue2357 Dan Frumin
issue2365 Guillaume Hoffmann
issue2367 Guillaume Hoffmann
issue2379 Guillaume Hoffmann
Patches applied (41)
See darcs wiki entry for details.
Categories: Offsite Blogs

Darcs: Darcs News #108

Planet Haskell - Tue, 06/24/2014 - 10:57pm
News and discussions
  1. We have a few updates from the Google Summer of Code projects. Alejandro Gadea about history reordering:
  2. Marcio Diaz about the cache system:
  3. Incremental fast-export is now provided to ease maintenance of git mirrors:
Issues resolved (8)
issue2244 Ale Gadea
issue2314 Benjamin Franksen
issue2361 Ale Gadea
issue2364 Sergei Trofimovich
issue2364 Sergei Trofimovich
issue2388 Owen Stephens
issue2394 Guillaume Hoffmann
issue2396 Guillaume Hoffmann
Patches applied (39)See darcs wiki entry for details.
Categories: Offsite Blogs

HSpec vs Doctest for TDD

haskell-cafe - Tue, 06/24/2014 - 9:55pm
Hi all, I'm a huge fan of TDD (Test-Driven Development) et I used to use tools such as RSpec (Ruby). So naturally, I looked to HSpec, but it seems not idiomatic in Haskell. I have a bunch of questions: - Do you do TDD? - Which tools do you use? - Is doctest "better" (in some senses) than HSpec? Why? - Are HSpec and Doctest complementary? If so, in which case do you use one or another? - Is there some Haskell-specific good practices do to TDD? Thanks in advance for your lights. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >
Categories: Offsite Discussion

SCSS 2014: Deadline extension

General haskell list - Tue, 06/24/2014 - 6:07pm
[Please post - apologies for multiple copies.] Deadline Extension ================================================ SCSS 2014 Symbolic Computation in Software Science 6th International Symposium Gammarth, La Marsa, Tunisia, December 7-11, 2014 ================================================ Important Dates --------------- July 7, 2014: Abstract submission deadline (extended) July 14, 2014: Paper submission deadline (extended) August 25, 2014: Notification September 22, 2014: Camera-ready copy deadline December 7-11, 2014: SCSS 2014 in Gammarth Scope -------- The purpose of SCSS 2014 is to promote research on theoretical and practical aspects of symbolic computation in software science. The symposium provides a forum for active dialog between researchers from several fields of computer algebra, algebraic geometry, algorithmic combinatorics, computational logic, and software analysis and verification. SCSS 2014 solicits both regular and tool papers on
Categories: Incoming News

Need help - my haskell code is over 50 times slower than equivalent perl implementation

haskell-cafe - Tue, 06/24/2014 - 5:08pm
Dear cafe, I have created a reproducible app here - Essentially I am trying to open a number of files and printing out their sized by reading them in and computing it's length. I have the equivalent perl program also there. I'd appreciate it very much if someone could take a look at my Haskell implementation and point out what I am doing wrong. Since it's over 50 times slower than the perl code, I assume I am doing something obviously incorrect. Regards, Kashyap _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >
Categories: Offsite Discussion

What's your favorite response to the "show me the magic" question when it comes to Haskell?

Haskell on Reddit - Tue, 06/24/2014 - 2:34pm

Most everyone I talk to about haskell is already a programmer with their own favorite languages. What are some small, interesting/amazing things I can show people on a whiteboard to explain the power of haskell?

I'm looking (vaguely) for examples somewhat like 2.3 and 3.3 from here, or maybe like these examples I found. But, I'm hoping to find examples that can be given more on the fly, and at a somewhat high-language level to "evangelize" with, for lack of a better term.

Ideally the examples would be plain word examples that could be scratched out on a whiteboard impromptu. So for the above I might describe it something along the lines of "you could write out the sheep linage as "sheep, dad, dad's mom" ... etc. But if one of the sheep didn't have a parent, the entire chain would return "nothing". However in haskell you can write out monads to simplify the entire thing down to "grandma = sheep's mom's mom" and it takes care of all the possible lack of parents because of the monad class ... etc."

I realize haskell's true power comes from the paradigm shift you experience when programming, and from other things that are not as easy to explain, especially briefly or high-level, but rather have to be somewhat experienced on your own. That being said, can you guys think of any examples, even so?

submitted by thang1thang2
[link] [69 comments]
Categories: Incoming News