News aggregator

Creating a list with do notation

haskell-cafe - Fri, 01/23/2015 - 6:04am
List is a monad, does that mean i can create a list with do notation? My intuition led me to believe this would work: main = do x <- return $ do 1 2 3 print (x :: [Int]) However it didn't. Is this possible? _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

Distributed memoizing computation of complicated functions?

Haskell on Reddit - Fri, 01/23/2015 - 3:58am

I'm thinking of building a system that essentially computes the values of certain complicated functions for certain input values. (I'm using the term 'function' in the general mathematical sense.) I'm new to Haskell but the strong typing, type inference and functional nature of Haskell prompted me to think it might be the right tool. I'm seeking advice on which aspects of Haskell or which libraries might be useful for building this.

The features of the function computation that I want to perform are:

  1. I'm computing values of some 'ultimate' function for certain input values. The output value of the function is generally structured numeric data, e.g. a 2D matrix with labeled columns together with a few scalars, but it could also be as simple as a simple scalar.

  2. The 'ultimate' function is defined in terms of other functions, which in turn can be defined in terms of other functions. There is no direct or indirect recursion in the function definitions. Each of these functions, including the 'ultimate' function, can be realized by running some executable binary with certain inputs, or using some matrix library to perform some matrix operations. There are functions that are not defined in terms of other functions and they are computed by running some executable binary with corresponding input parameters over some pre-existing, fixed, large, dataset.

  3. For example, with ultimate function F_0 defined as: F_0(x, y, z) = E(F_1(x, y), F_2(y, z)), the computation of F_0(x, y, z) will involve computing F_1(x, y) and F_2(y, z), and then E using their outputs as input. E is computed using an external program that is given the output of F_1 and F_2. F_1 and F_2 in turn, can be defined in terms of other functions.

  4. The output of some non-ultimate function computation could be used multiple times in the entire computation, so for performance they need to be memoized. Due to the data volume, they don't fit in memory and have to be stored on secondary storage as files or in a database. Even the function values for the ultimate function can be memoized so that after an initial computation, future queries will just be lookups.

  5. I want to compute the function values in a distributed fashion maximizing utility of the processor cores. I might even want to distribute the computation across machines, but that's not as important for now.

  6. For certain functions, it is cheaper to compute the function values for multiple similar inputs together. E.g. if X is represented by many bytes of data, it may be cheaper to compute E(0, X), E(1, X), ..., E(n, X) together instead of separately because reading X is expensive.

  7. If F_i(x, y) is defined in terms of F_j(x), F_i(x, y) cannot be computed until the value of F_j(x) has been computed and memoized. Hence, some sort of scheduling of the function computation is necessary that has dependency logic, and for acceptable performance, it may have to consider Point 6.

  8. Changing the definition of the functions should be relatively easy and not involve big code changes that take a long time.

What could be some useful ways to think of the design for this system? I already have a way to do this in Python but every time I change the definitions I need to spend a lot of time making Python code changes. In the existing system, there is already a way to store and retrieve the results of function computation. Essentially, I compute hash keys from function input arguments and store the function values in the filesystem or in a database under those keys.

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

www.google.co.uk

del.icio.us/haskell - Fri, 01/23/2015 - 3:20am
Categories: Offsite Blogs

New release of SBV (v4.0)

Haskell on Reddit - Fri, 01/23/2015 - 12:51am
Categories: Incoming News

Is `cabal update` using the best way of fetching packages list?

Haskell on Reddit - Fri, 01/23/2015 - 12:22am

AFAIK, updating package list with cabal is just downloading the whole 00-index.tar.gz file, which usually takes minutes or so here. Is it so wise for cabal to download them all in every update?

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

Frames Tutorial

Haskell on Reddit - Thu, 01/22/2015 - 11:29pm
Categories: Incoming News

hs-fltk build fails

haskell-cafe - Thu, 01/22/2015 - 10:41pm
I am building with " cabal sandbox init ; cabal install hs-fltk ". Logs attached. Any advice? Regards, Jeremy Henty package: hs-fltk-0.2.5 os: linux arch: i386 compiler: ghc-7.8.4 client: cabal-install-1.22.0.0 dependencies: base-4.7.0.2 install-outcome: BuildFailed docs-outcome: NotTried tests-outcome: NotTried package: hs-fltk-0.2.5 os: linux arch: i386 compiler: ghc-7.8.4 client: cabal-install-1.22.0.0 dependencies: base-4.7.0.2 install-outcome: BuildFailed docs-outcome: NotTried tests-outcome: NotTried package: hs-fltk-0.2.5 os: linux arch: i386 compiler: ghc-7.8.4 client: cabal-install-1.22.0.0 dependencies: base-4.7.0.2 install-outcome: BuildFailed docs-outcome: NotTried tests-outcome: NotTried Configuring hs-fltk-0.2.5... Building hs-fltk-0.2.5... Preprocessing library hs-fltk-0.2.5... [ 1 of 12] Compiling Graphics.UI.FLTK.Widget ( src/Graphics/UI/FLTK/Widget.hs, dist/dist-sandbox-7ea82ab6/build/Graphics/UI/FLTK/Widget.o ) src/Graphics/UI/FLTK/Widget.hs:20:1: Warning: The import of ‘
Categories: Offsite Discussion

Appropriate use of unsafePerformIO?

Haskell on Reddit - Thu, 01/22/2015 - 9:56pm

There's an interface I'm interested in supporting, which seems to me to sit in some weird middle-ground between pure and unpure interfaces.

I don't know of a better name so I'll call it a "consistent map" which stores key/value pairs. (The space of values is potentially much larger than the space of keys.) The consistent map has a pretty simple interface:

consistentMapStore :: Value -> Key consistentMapGet :: Key -> Value

It has a guarantee that consistentMapStore v always returns the same Key for identical values of v (as pure functions should).

It also has the guarantee that if k = consistentMapStore v then consistentMapGet k == v; however, this only holds for k that are obtained from consistentMapStore first. To call consistentMapGet otherwise results in undefined behavior.

One possible implementation of this would be to have

  • consistentMapStore v generate the key by a cryptographically secure hash of v and store (k, v) in a dictionary.

  • consistentMapGet k simply looks up the hash value in the dictionary.

Another possible implementation:

  • consistentMapStore v first checks is v is in the dictionary and if so returns the key; otherwise, it generates a previously-unused key k by incrementing a counter and then it stores (k , v) in the dictionary.

Anyway, it's pretty clear, I think, that you can't implement this without unsafePerformIO or friends, since it has to store the table. That said, it is still pure in the sense that (over the course of a single execution of your program) each function will always return the same value for the same input, provided the interface is used correctly.

So... I'm not really sure what my question here is, but I'm generally wondering about:

  • Does this concept have a name?
  • Is it possible to use unsafePerformIO to do this without my program exploding?
  • Are there any library implementations of this already?
  • From a theoretical perspective, would you call this "pure" or "unpure"?
  • Is there anything else interesting to say about this?
submitted by tjhance
[link] [15 comments]
Categories: Incoming News

ANN: git-monitor

glasgow-user - Thu, 01/22/2015 - 8:41pm
git-monitor auto-commits all changes to a Git working tree, within a special branch named "refs/snapshots/refs/heads/<branch>". It has no impact on the Git repository otherwise, and will not effect your real branches. It has the following features: - It is designed to be extremely resource efficient, both in CPU cost and memory. I wanted something I could run several instances of on my laptop, without paying much of a battery cost. This efficiency is achieved by using gitlib with the libgit2 backend. The current state of the working tree is maintained as a Git object in memory, and is updated in place before being written back out to disk. Thus, the amount of computation done remains minimal, as we do not need to rebuild the Git tree at each iteration (as "git-commit" would do). - Whenever git-monitor is exited and restarted, the previous snapshot "branch" is discarded. These are only intended to be viable during and between runs. - By having such a branch,
Categories: Offsite Discussion

FP Complete: Commercial Haskell Special Interest Group

Planet Haskell - Thu, 01/22/2015 - 4:00pm

At FP Complete, we’re constantly striving to improve the quality of the Haskell ecosystem, with a strong emphasis on making Haskell a viable tool for commercial users. Over the past few years we’ve spoken with many companies either currently using Haskell or considering doing so, worked with a number of customers in making Haskell a reality for their software projects, and released tooling and libraries to the community.

We’re also aware that we’re not the only company trying to make Haskell a success, and that others are working on similar projects to our own. We believe that there’s quite a lot of room to collaborate on identifying problems, discussing options, and creating solutions.

Together with a few other companies and individuals, we are happy to announce the launch of a Commercial Haskell Special Interest Group.

If you're interested in using Haskell in a commercial context, please join the mailing list. I know that we have some projects we think are worth immediate collaboration, and we'll kick off discussions on those after people have time to join the mailing list. And I'm sure many others have ideas too. I look forward to hearing them!

Categories: Offsite Blogs

IO Monad Considered Harmful

Haskell on Reddit - Thu, 01/22/2015 - 12:46pm
Categories: Incoming News

Haskell Weekly News: Issue 315

haskell-cafe - Thu, 01/22/2015 - 7:01am
Welcome to issue 315 of the HWN, an issue covering crowd-sourced bits of information about Haskell from around the web. This issue covers from January 4 to 17, 2015 Quotes of the Week * mpickering: When is the right time to use Data.ByteString.Char8? edwardk: mpickering: some time around 1980 * tpolecat: any lecture by conal elliott has that flavor. he is the bob ross of functional programming. Top Reddit Stories * Write You a Haskell Domain: dev.stephendiehl.com, Score: 280, Comments: 24 Original: [1] http://goo.gl/isSXWc On Reddit: [2] http://goo.gl/kOevyS * Announcing LTS Haskell 1.0 Domain: fpcomplete.com, Score: 87, Comments: 14 Original: [3] http://goo.gl/QW25bK On Reddit: [4] http://goo.gl/PlWgfm * MSFT open sources production serialization system written partially in Haskell Domain: blog.nullspace.io, Score: 83, Comments: 6 Original: [5] http://goo.gl/SDm7i1 On Reddit: [6] http://goo.gl/wljTKD * haskell-emacs - Write Ema
Categories: Offsite Discussion