News aggregator

Toy project: conditions

Haskell on Reddit - Wed, 03/18/2015 - 6:33am
Categories: Incoming News

ku-fpg/kansas-lava

del.icio.us/haskell - Wed, 03/18/2015 - 5:12am
Categories: Offsite Blogs

2-3 positions (Associate Professor / Lecturer) in Software Technology at Chalmers University of Technology in Sweden

Haskell on Reddit - Wed, 03/18/2015 - 4:40am

Chalmers University is advertising 2-3 positions in their division of Software Technology:

Associate Professor in Software Technology http://www.chalmers.se/en/about-chalmers/vacancies/Pages/default.aspx?rmpage=job&rmjob=p2896

Lecturer in Software Technology http://www.chalmers.se/en/about-chalmers/vacancies/Pages/default.aspx?rmpage=job&rmjob=p2899

Application deadline: 2015-04-06.

Please spread the word!

submitted by chalmers_job
[link] [comment]
Categories: Incoming News

Proposed significant breaking changes to Win32

libraries list - Wed, 03/18/2015 - 2:25am
There are some discussions going on in this issue: https://github.com/haskell/win32/issues/24 with proposals for extensive breaking changes to the Win32 library. Well over 100 functions would be involved. These changes would finally fix many long outstanding defects in the API, some of which make it impossible to use important Win32 functions in the way originally intended. I would generally support these proposals (after having seen that Neil supports them). But does anyone have any estimate of how much breakage it would cause on Hackage, or in the Windows builds of GHC? Thanks, Yitz
Categories: Offsite Discussion

FP Complete: Announcing executable-hash

Planet Haskell - Wed, 03/18/2015 - 2:00am

We're releasing a simple package called executable-hash, which provides the SHA1 hash of the program's executable. In order to avoid computing this hash at runtime, it may be inserted into the binary as a step after compilation.

Use Cases

Why might you want this? There are a couple clear usecases, and likely others exist:

  • Enabling protocols to ensure that different versions of the program don't attempt to communicate. Instead of hoping that the programs' implementation of the serialization and protocol match up, we can catch differing versions early, as part of the initial handshake. This was the motivating usecase for the package.

  • Allowing logs and bug reports to be tagged in a way that identifies the binary being used. One way to do this is to use the version number / git commit SHA. For example, this code captures this information by using git-embed and cabal-file-th. While this can be quite helpful, it isn't quite as precise as having a hash of the binary, identifying the exact version of the program, taking into account:

    • Working copy changes

    • Different dependency versions

    • Different compiler versions

    Note that since shared libraries are not directly included in the executable, differences in shared libraries do not affect the hash.

Implementation

The function for computing the executable hash is quite simple. Leveraging Crypto.Hash.SHA1.hash from cryptohash, and the getScriptPath from executable-path:

computeExecutableHash :: IO (Maybe BS.ByteString) computeExecutableHash = do sp <- getScriptPath case sp of Executable fp -> Just . hash <$> BS.readFile fp _ -> return Nothing

From this, we see that computeExecutableHash returns Nothing if the program hasn't been compiled to a binary (probably due to it being interpreted by ghci, runhaskell, or the GHC API).

Injecting the hash into the binary

If the package just consisted of the above definition, it probably wouldn't be worth announcing! The main nice feature of executable-hash is that it can utilize file-embed to insert the hash into the executable. This way, we don't need to compute it at runtime! This works by generating a ByteString constant in the code, which will also be present in the generated binary. As a step after compilation, we search for this constant and replace it with the executable's hash.

The executableHash function uses the injected hash if available, and otherwise computes it:

executableHash :: IO (Maybe BS.ByteString) executableHash = case injectedExecutableHash of Just x -> return (Just x) Nothing -> computeExecutableHash

Note that applications which rely on the hash being the actual SHA1 of the executable shouldn't use executableHash. This is because injecting the hash into the executable modifies its contents, and so modifies the SHA1 that would be computed for it.

See the doc for instructions on how to setup injection of the hash into the executable.

Categories: Offsite Blogs

Newbie at Haskell, need feedback

Haskell on Reddit - Tue, 03/17/2015 - 10:59pm

I wrote simple script making simple permutation-based encryption.

http://pastebin.com/ifEQ7vAW

Waiting for any suggestions.

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

linear: instance Additive (Point f) ??

haskell-cafe - Tue, 03/17/2015 - 10:47pm
Hi café, I'm in the middle of responding to https://github.com/goldfirere/units/pull/45 and trying to learn the `linear` package, which I have yet to use. I have what may be a basic question: why is there an `instance Additive f => Additive (Point f)` (in the Affine module)? It would seem that the whole point of Point is that it is *not* Additive. We don't want to add Points! Could someone enlighten me? Thanks! Richard PS: Of course, this instance is directly hurting my use of the package. But it is hurting my understanding of the package, because it disagrees with the mental model I've built up of the definitions.
Categories: Offsite Discussion

FRP library comparison (needs input)

Haskell on Reddit - Tue, 03/17/2015 - 10:22pm

It's easy to find a list of FRP packages, and not too hard to find brief comparisons two or three here or on Stack (usually a couple of years old); but despite people asking fairly often, a good comprehensive comparison is yet to arise.

I'm hoping to fix that, but I need some help from people who actually know what they're talking about. :) I'm only six months in to Haskell and fresh on this particular topic myself. But there's a need here, and I happen to know of a good tool to take a whack at it.

I've set up a topic on Slant.co and added what appear to be the current "live" FRP packages (six of them), plus a few bits of pro/con and descriptive info that I've been able to pick up (ones I feel I understand well enough to comfortably make statements about, heh). It's a pretty bare skeleton right now, and the listing is in no particular order (that's based on recommendations and there aren't any yet), but the format should be fairly self-explanatory, and it's all publicly editable.

The idea is that if anyone knows even a little bit about one library's benefits or drawbacks, it has a place to be shared here, and the pile will add up to something useful. And of course, anyone who knows a lot about several is strongly encouraged to drop by! Sources are a thing, and I've used them for my own entries since so far I'm only regurgitating information anyway, but they're not mandatory and unsourced is better than unshared; it can always be cleaned up later. I'll be keeping an eye on this, playing steward and janitor once there's enough there to need it.

Disclosure: I'm employed by Slant.co. But my interest here is personal, it just happens to be exactly the kind of thing Slant is for. :) And the upside is, I have access to some newer site features that are currently back-end only:

  • spec tables -- example here (top of each option) -- a better place for the little comments like "arrowized" and "pull-based" that are currently in option descriptions; I'd just like to see those made more complete and any other relevant stuff added before I set up the table.

  • question notes -- example here (just below page header) -- I could just copy in some of (and/or link to) the FRP haskell-wiki page, but it seems a bit dated, and has no descriptions of e.g. exactly what push- and pull-based imply. If anyone can suggest some good text that applies to the whole topic (specifically, how to decide which library is the best fit for personal workflow and/or the task domain) I've got a place to put it. Edit: Got some notes in place now, suggestions for improvement still welcome.

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

Complete list of generic libraries?

Haskell on Reddit - Tue, 03/17/2015 - 6:40pm

Since there aren't that many typeclasses with a generic implementation lying around, and considering how enourmously helpful those are, what do you think of making a list?

Every single generic I've seen so far has entered my toolbox and I think the community could benefit a lot from such a list.

submitted by notworkingatall_
[link] [1 comment]
Categories: Incoming News

extracting a single declaration using haskell-src-ext

haskell-cafe - Tue, 03/17/2015 - 5:12pm
G'day! Is there an easy way to extract a single declaration from an Haskell source file and print it with the original formatting? [I could live with pretty printing, but the default prettyPrint gives me a very strange formatting where something like: main = do putStrLn "Hello" becomes: main = do putStrLn "Hello"] The closest I've got is to parse the file with comments and then get inside Module ...decls and do printExact with an empty comment list for the decl I'm interested in. This gives me the original formatting and empty lines where comments were that I can then remove. But if there was anything already out there that just take a String for the toplevel I'm interested in and convert that only, I'd love to know. Thanks, Maurizio _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

Qualified names in TH?

glasgow-user - Tue, 03/17/2015 - 3:54am
I'm trying to write some Template Haskell code that (among other things) manipulates IntSets. So, for example, I'd like a splice to generate a call to Data.IntSet.fromList. However, I'm not sure how IntSet will be imported in the target module. Is there a way to resolve the fully qualified name (or similar) to a TH Name, without having to know how it's imported in the splicing module? (The obvious approach---mkName "Data.IntSet.fromList"---seems not to work in GHC 7.8.) Thanks! /g
Categories: Offsite Discussion

[PATCH] generalize filterM, mapAndUnzipM, zipWithM, zipWithM_, replicateM, replicateM_

glasgow-user - Tue, 03/17/2015 - 12:29am
--- libraries/base/Control/Monad.hs | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/libraries/base/Control/Monad.hs b/libraries/base/Control/Monad.hs index 6fa4a07..02eabd1 100644 --- a/libraries/base/Control/Monad.hs +++ b/libraries/base/Control/Monad.hs < at >< at > -75,9 +75,9 < at >< at > module Control.Monad , (<$!>) ) where -import Data.Foldable ( Foldable, sequence_, msum, mapM_, foldlM, forM_ ) -import Data.Functor ( void ) -import Data.Traversable ( forM, mapM, sequence ) +import Data.Functor ( void, (<$>) ) +import Data.Foldable ( Foldable, sequence_, sequenceA_, msum, mapM_, foldlM, forM_ ) +import Data.Traversable ( forM, mapM, traverse, sequence, sequenceA ) import GHC.Base hiding ( mapM, sequence ) import GHC.List ( zipWith, unzip, replicate ) < at >< at > -94,13 +94,8 < at >< at > guard False = empty -- | This generalizes the list-based 'filter' function. {-# INLINE filterM #-} -filterM :: (Monad m) => (a -> m Bool) -> [a] -> m [a] -filter
Categories: Offsite Discussion

-staticlib flag for building standalone static libraries producing very large libraries

glasgow-user - Sat, 03/07/2015 - 1:18pm
Hi all, Can anyone explain the following problem I'm having? I'm currently writing a game in Haskell. When I produce a plain old executable (for local testing) it's about 23M. However, when I create a static lib using the -staticlib flag it is 54M. Why the discrepancy? Sean _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
Categories: Offsite Discussion

New gtk2hs 0.12.4 release

gtk2hs - Wed, 11/21/2012 - 12:56pm

Thanks to John Lato and Duncan Coutts for the latest bugfix release! The latest packages should be buildable on GHC 7.6, and the cairo package should behave a bit nicer in ghci on Windows. Thanks to all!

~d

Categories: Incoming News