Re: [Haskell-cafe] Locking, unsafePerformIO and bolt-on thread safety.

2011-05-10 Thread Erik Hesselink
My first thought was to create all of the lookup table lazily, and
create a pure top level binding for it. Something like:

lookupTable :: [Int]
lookupTable = map (\x - unsafePerformIO (create_lookup_table x) `seq` x) [1..]

Then on a calculation you would index into this list and pass the
result as the last argument to perform_math. However, I'm not sure how
evaluation of thunks works with multiple threads; it might be possible
that this will occasionally execute create_lookup_table twice. I found
this paper [1] which suggests (in 3.5) that it does indeed, and they
suggest a primitive (justOnce :: a - a) to prevent it. So I guess
this won't work, unless things have changed since 2005.

Erik

[1] 
http://research.microsoft.com/en-us/um/people/simonpj/papers/parallel/multiproc.pdf

On Tue, May 10, 2011 at 02:45, Jason Dusek jason.du...@gmail.com wrote:
  A friend is making bindings to a C library that offers some
  fast math operations. The normal way to use the library is
  like this:

    int a = ...; int b = ...; int c = ...; int d = ...;
    int x                    =  ...;
    int m, n;
    create_lookup_table(x);
    m                        =  perform_math(a, b, x);
    n                        =  perform_math(c, d, x);

  We see that the lookup table for x must be created before we
  can perform math in the field/ring/what-have-you defined by x.
  Once we have created the table, though, we're done.

  My friend would like to create a pure interface to this
  library. One thought was to write an interface to perform_math
  that checked if the table was created, created it if not, and
  did all this while locking an MVar so that no other instance
  could be called at the same time, trashing the table. Doing
  this behind unsafePerformIO would seem to be the ticket.

  We end up with an implementation like this:

    module FastMath where

    import Control.Concurrent
    import Foreign
    import Foreign.C


    foreign import ccall create_lookup_table :: CInt - IO ()
    foreign import ccall perform_math :: CInt - CInt - CInt - IO CInt

    masterLock               =  unsafePeformIO (newMVar [CInt])

    safe_perform_math a b x  =  do
      list                  -  takeMVar masterLock
      toPut                 -  if not (x `elem` list)
                                  then do create_lookup_table x
                                          return (x:list)
                                  else    return list
      result                -  perform_math a b x
      putMVar masterLock toPut
      return result

    performMath a b x = unsafePerformIO (safe_perform_math a b x)

  This does not compile but I think it gets the point across. Is
  this approach safe? The unsafePerformIO in conjunction with
  locking has me worried.

 --
 Jason Dusek
 ()  ascii ribbon campaign - against html e-mail
 /\  www.asciiribbon.org   - against proprietary attachments

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Template Haskell reified type.

2011-05-10 Thread Simon Peyton-Jones
Can you give a concrete example?  There is code in GHC that is supposed to 
produce TupleT and ListT!

Simon

| -Original Message-
| From: haskell-cafe-boun...@haskell.org 
[mailto:haskell-cafe-boun...@haskell.org] On
| Behalf Of Serguey Zefirov
| Sent: 09 May 2011 14:43
| To: haskell
| Subject: [Haskell-cafe] Template Haskell reified type.
| 
| Language.Haskell.TH.Type contains, among others, two constructors:
| TupleT Int and ListT.
| 
| I can safely construct types using them, but reification returns ConT
| GHC.Tuple.(,) and ConT GHC.Types.[] respectively.
| 
| This is not fair asymmetry, I think.
| 
| Also, it took purity from one of my functions while I debugged that
| problem. I had to make it into Q monad. ;)
| 
| ___
| Haskell-Cafe mailing list
| Haskell-Cafe@haskell.org
| http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Template Haskell reified type.

2011-05-10 Thread Serguey Zefirov
I turned out that it is in ghc 6.12.

The same code in ghc 7.0.1 works just fine, Reification produces
TupleT and ListT. I just rechecked it.

I forgot that I use 6.12. Sorry about that.

2011/5/10 Simon Peyton-Jones simo...@microsoft.com:
 Can you give a concrete example?  There is code in GHC that is supposed to 
 produce TupleT and ListT!

 Simon

 | -Original Message-
 | From: haskell-cafe-boun...@haskell.org 
 [mailto:haskell-cafe-boun...@haskell.org] On
 | Behalf Of Serguey Zefirov
 | Sent: 09 May 2011 14:43
 | To: haskell
 | Subject: [Haskell-cafe] Template Haskell reified type.
 |
 | Language.Haskell.TH.Type contains, among others, two constructors:
 | TupleT Int and ListT.
 |
 | I can safely construct types using them, but reification returns ConT
 | GHC.Tuple.(,) and ConT GHC.Types.[] respectively.
 |
 | This is not fair asymmetry, I think.
 |
 | Also, it took purity from one of my functions while I debugged that
 | problem. I had to make it into Q monad. ;)
 |
 | ___
 | Haskell-Cafe mailing list
 | Haskell-Cafe@haskell.org
 | http://www.haskell.org/mailman/listinfo/haskell-cafe



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Those damned parentheses

2011-05-10 Thread Yitzchak Gale
Eitan Goldshtrom wrote:
 f p = putStrLn $ (show (Main.id p)) ++  - message received

Brandon S Allbery KF8NH wrote:
 f p = putStrLn $ (show $ Main.id p) ++  = message received

wren ng thornton w...@freegeek.org wrote:
    f p = putStrLn $ show (Main.id p) ++  - message received
    f p = putStrLn $ (show . Main.id) p ++  - message received
    f p = putStrLn $ ((show . Main.id) p) ++  - message received
    f p = putStrLn $ (show . Main.id $ p) ++  - message received
    f p = putStrLn ((show . Main.id $ p) ++  - message received)
 etc.

I think the clearest way to write it is:

f = putStrLn . (++  - message received) . show . Main.id

Not because it happens to be point-free, but because it is
the combinator approach. You apply functions one after
the other, each with its own simple meaning and purpose.

If I were to describe to someone in words what this
function does, I would say something like: Apply Main.id,
turn it into a string, tack a message onto the end, and
print it. So why not write it that way in Haskell?

One of the nicest features of Haskell is that the
combinator approach is often so natural.

Regards,
Yitz

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Those damned parentheses

2011-05-10 Thread Andrew Butterfield

On 10 May 2011, at 08:30, Yitzchak Gale wrote:

 
 If I were to describe to someone in words what this
 function does, I would say something like: Apply Main.id,
 turn it into a string, tack a message onto the end, and
 print it. So why not write it that way in Haskell?

Why not indeed ?

(--) = flip (.)

f = Main.id -- show -- (++  = message received) -- putStrLn

;-)


 
 One of the nicest features of Haskell is that the
 combinator approach is often so natural.

:-) :-)

 
 Regards,
 Yitz
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204
Foundations and Methods Research Group Director.
School of Computer Science and Statistics,
Room F.13, O'Reilly Institute, Trinity College, University of Dublin
http://www.cs.tcd.ie/Andrew.Butterfield/


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Crypto-api performance

2011-05-10 Thread Johan Brinch
On Tue, May 3, 2011 at 22:05, Johan Brinch brin...@gmail.com wrote:
 Does anyone have experience with the crypto-api package?

 It seems to define a nice common API for block ciphers, hash functions
 and prng's. However, I get very low performance using it.

 I ran its benchmark on a NOP block cipher, where encryptBlock k = id,
 and it's still very slow.

 After expanded the included block cipher benchmark (which uses ECB) to
 include CBC and CTR I got the following:
 ECB: 30 MB/s -- somewhat slow
 CBC: 12 MB/s -- very slow
 CTR: 4 MB/s -- why is adding a counter so bad?

 Have anyone else benchmarked this and if so with what results?
 Are there any other high level crypto API?


 Here's my benchmark code for CTR (easily modified to use ECB/CBC):
 https://gist.github.com/954093

 And here's my patched Benchmark/Crypto.hs:
 https://gist.github.com/954099


 Package in question:
 http://hackage.haskell.org/package/crypto-api


Would there be anything wrong / really ugly in simply pushing those
small bottlenecks into C code?
Stuff like xor'ing two bytestrings or generating a block of
incremental IV's (for CTR mode)?

-- 
Johan Brinch

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Those damned parentheses

2011-05-10 Thread Roel van Dijk
On 10 May 2011 09:47, Andrew Butterfield andrew.butterfi...@cs.tcd.ie wrote:
 Why not indeed ?
 (--) = flip (.)
 f = Main.id -- show -- (++  = message received) -- putStrLn

-- () :: Category cat = cat a b - cat b c - cat a c

import Control.Category ( () )
f = Main.id  show  (++  - message received)  putStrLn

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Those damned parentheses

2011-05-10 Thread Yitzchak Gale
Andrew Butterfield wrote:
 Why not indeed ?

Roel van Dijk wrote:
 import Control.Category ( () )
 f = Main.id  show  (++  - message received)  putStrLn

Indeed, I agree. I sometimes do that, too, when I want to
emphasize the idea of applying tools one after the other.

But most often I just use traditional function composition
notation. That reminds us of the connection with mathematical
functions. It also raises less eyebrows when other people read
my code and see

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] An update on ICFP'11 in Tokyo (September 18-24, 2011)

2011-05-10 Thread Wouter Swierstra
Given the fairly recent severe earthquake and tsunami in Japan, you
may wonder how this affects the preparations for ICFP'11 in Tokyo.

Luckily, Tokyo was significantly less affected by these saddening
events than the regions further north.  In fact, the situation in
Tokyo is almost back to normal, after only two months, with another
four months until ICFP.  Moreover, all major embassies have in the
meantime lifted their travel advisories for the Tokyo metropolitan
region (while they still maintain active advisories for some other
regions.)

Our local organisational team has completed major parts of the
preparations and recently summarised the most important facts on a
local information page for ICFP'11:

 http://www.biglab.org/icfp11local/index.html

The main conference site is at

 http://www.icfpconference.org/icfp2011/

We are looking forward to seeing you in Tokyo in September!

Manuel Chakravarty
Zhenjiang Hu
(General Chairs of ICFP'11)

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Those damned parentheses

2011-05-10 Thread Yitzchak Gale
Andrew Butterfield wrote:
 Why not indeed ?

Roel van Dijk wrote:
 import Control.Category ( () )
 f = Main.id  show  (++  - message received)  putStrLn

Indeed, I agree. I sometimes do that, too, when I want to
emphasize the idea of applying tools one after the other.

But most often I just use traditional function composition
notation. That reminds us of the connection with mathematical
functions. It also raises less eyebrows when other people read
my code - some people immediately panic when they see an
import from Control.Category or Control.Arrow. :)

Regards,
Yitz

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Hackage build failure

2011-05-10 Thread Jonas Almström Duregård
Hi,

Is there something wrong with the Hackage build system?
It fails to build BNFC-meta: http://hackage.haskell.org/package/BNFC-meta

It complains about a missing dep even though it (the dependency) has
been built successfully. Also the dependencies are exactly the same as
in the previous version (which configures fine but fails to build
because of some bug in HsColor).

Regards
Jonas

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Crypto-api performance

2011-05-10 Thread Jesper Louis Andersen
On Tue, May 10, 2011 at 09:47, Johan Brinch brin...@gmail.com wrote:

 Stuff like xor'ing two bytestrings or generating a block of
 incremental IV's (for CTR mode)?

I don't particularly like the notion of XOR on a bytestring. The
bytestring is not a number and it does not make much sense to bitwise
xor such a string. I'd rather have a type specifically tailored for
doing crypto-style computations and then use it. Such that the
underlying implementation can be repa, bytestring,
supermegavectorizationistic, or something completely different.

-- 
J.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [Haskell] ANN: syntactic-0.1

2011-05-10 Thread Emil Axelsson

2011-05-10 15:31, Heinrich Apfelmus skrev:

I'm also unhappy about some of the boilerplate. For instance, have a
look at the function  goE  in  compileAccumB  (line 210), it's just a
generic applicative traversal through the data type.


Most likely, this boilerplate could be simplified using syntactic.


Hm, does the boilerplate get removed or only simplified? I was hoping
that one could use a completely generic traversal; but is that actually
the case?


I was using careful wording :) I think the traversal can be completely 
generic. But syntactic brings its own (constant) overhead, so I felt the 
word remove might be too strong.





On closer inspection, I'm discovering another issue, namely the need for
the  Typeable  class. This is quite unfortunate, because it would mean
that I won't be able to make an API built on type classes like Functor
or Applicative. Some discussion on that can be found at the end of

http://apfelmus.nfshost.com/blog/2011/04/24-frp-push-driven-sharing.html


Hm... The only reason (afair) for having Typeable constraints in the 
tree was that my code motion transform (not yet released) needs to move 
around nodes in a way that the type checker is not happy with. But as 
long as my algorithm is correct, the type casts will actually always 
succeed. So it might be possible to use unsafeCoerce directly and get 
rid of Typeable. There might also be ways to make Typeable optional...


I will look into this.




So, it looks like I can't make use of  syntactic  at the moment. Then
again, my library is probably one of the strongest tests of expressivity
for  endeavors like  syntactic , so that's fine. Another example of
similar difficulty would be D. Swierstra's recent parser/grammar
combinators that can handle left-recursive grammars. Once  syntactic
can deal with those, you're the king! :)


Thanks for the tip! It would be interesting to try out these libraries 
for real, if only for the sake of getting to know the practical limits 
of syntactic. But my focus is currently on the Feldspar implementation, 
so I probably won't have time for things like this in a (long) while.


/ Emil

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Hackage build failure

2011-05-10 Thread Ross Paterson
On Tue, May 10, 2011 at 10:46:53AM +0200, Jonas Almström Duregård wrote:
 Is there something wrong with the Hackage build system?
 It fails to build BNFC-meta: http://hackage.haskell.org/package/BNFC-meta
 
 It complains about a missing dep even though it (the dependency) has
 been built successfully. Also the dependencies are exactly the same as
 in the previous version (which configures fine but fails to build
 because of some bug in HsColor).

happy-meta is one of those packages that won't build again after you
clean them (it has files under dist/build to work around a bug in Happy).
Fixed now.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Those damned parentheses

2011-05-10 Thread Andrew Coppin

On 10/05/2011 08:30 AM, Yitzchak Gale wrote:


I think the clearest way to write it is:

f = putStrLn . (++  - message received) . show . Main.id


You're serious??


If I were to describe to someone in words what this
function does, I would say something like: Apply Main.id,
turn it into a string, tack a message onto the end, and
print it. So why not write it that way in Haskell?


Hmm, I suppose.

OTOH, this breaks if you want to insert several items into a string. For 
example,


  f x y z = putStrLn (X =  ++ show x ++ , Y =  ++ show y ++ , Z = 
 ++ show z)


(Fortunately, here a simple call to ($) will fix you up nicely.)

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Crypto-api performance

2011-05-10 Thread Johan Brinch
On Tue, May 10, 2011 at 11:14, Jesper Louis Andersen
jesper.louis.ander...@gmail.com wrote:
 On Tue, May 10, 2011 at 09:47, Johan Brinch brin...@gmail.com wrote:

 Stuff like xor'ing two bytestrings or generating a block of
 incremental IV's (for CTR mode)?

 I don't particularly like the notion of XOR on a bytestring. The
 bytestring is not a number and it does not make much sense to bitwise
 xor such a string. I'd rather have a type specifically tailored for
 doing crypto-style computations and then use it. Such that the
 underlying implementation can be repa, bytestring,
 supermegavectorizationistic, or something completely different.


Well, the need for extracting the underlying char pointer to call the
c function does limit possible abstraction of the data structure
somewhat. Of course, one could make a type class providing unpack/pack
functions for extracting the pointer and rebuilting the Haskell value.

Of course, this was never meant as part as anything, but a low level
crypto lib for high level crypto libs to use. It's not meant for
regular usage.


-- 
Johan Brinch

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Asynchronous Arrows need Type Specialization - Help!

2011-05-10 Thread Adam Megacz

Responding to a very stale thread here...


Scott Turner 2hask...@pkturner.org writes:
 And indeed, a channel carrying a sum type corresponds much more
 closely to a pair of channels than does a channel carrying pairs.

I certainly agree with the slogan a stream of pairs is not the same as
a pair of streams.  However I don't think sums are correct either --
if you have backpressure the behavior is very different.

Suppose I have two incoming streams, one of type A and one of type B,
and (for simplicity) the producers providing these streams do not
communicate with each other in any way.  I can decide not to consume any
values of type B until I receive at least one value of type A.

Now replace my pair of streams with a single stream of (Either A B).  In
order to consume a (Left A) I might have to consume a bunch of (Right
B)'s first; the fact that I have consumed them can be detected by the
B-producer and may influence its behavior in a manner I did not intend.
Even if this is acceptable, there's another problem: I need an unbounded
amount of storage for all those B's -- so this solution won't work in
any sort of hardware design or embedded situation.


Paul L nine...@gmail.com writes:
 Peter Gammie suggested use of Adam Megacz's Generalized Arrows, which
 would avoid this problem by use of an opaque product type that can
 only be converted to a pair by an explicit operation (i.e. 'synch :: a
 (b**c) (b,c)' for opaque product type (**)). I'm still debating
 whether to take this approach.

Yes, this is one of the situations where you need the generalized part
of generalized arrows; see the blurb in the first paragraph on page 6 [1].

If you look at the corresponding multi-level language, the type of
synch's input (pair-of-streams) is additive conjunction [2] and its
output type (stream-of-pairs) is multiplicative conjunction; both of
these are distinct from Fudgets' additive disjunction (stream-of-sums).
Sadly GHC does not support substructural types, so there's little chance
of these sorts of things being supported in the GHC-based flattener.

  - a

[1] http://arxiv.org/abs/1007.2885

[2] http://en.wikipedia.org/wiki/Linear_logic#The_resource_interpretation


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Cairo package broken on Windows, or am I cooking it wrong?

2011-05-10 Thread Eugene Kirpichov
Hello,

After a moderate struggle with getting gtk2hs to install on Windows, I
tried to install Chart and got a linker message saying
_cairo_image_surface_get_data was missing.
After another struggle I figured that if I launch ghci -lcairo-2 then
everything works fine.

I tried patching cairo.cabal by adding this line:

extra-libraries: cairo-2

and reinstalling cairo. This helped, I could install Chart without problems.

My question is:
Should this line be added to cairo.cabal, or should everything have
worked fine in some other magical way, but did not, because of some
other error?
How can I diagnose what's wrong?

How is cabal install generally supposed to find that a dll is
needed, if I don't write it down in the extra-libraries field?

-- 
Eugene Kirpichov
Principal Engineer, Mirantis Inc. http://www.mirantis.com/
Editor, http://fprog.ru/

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Work on Collections Processing Arrows?

2011-05-10 Thread Adam Megacz

David Barbour dmbarb...@gmail.com writes:
 I've a preliminary model, using Adam Megacz's Generalized Arrows, of
 the form:

Hey, neat.  Actually, this sounds more like the generalized arrow
version of arrowized FRP's switch and par (Section 2.6 of [1]).  I'd
been meaning to figure out the GArrow version of those but never got
around to it.


 ArrowApply would give me a dynamic amount of processing, but seems
 excessively expressive.

Yes, that's overkill and would rule out the applications where
implementing ArrowApply is impossible.


 class (GArrow a (**) u c) = GArrowMap a (**) u c where
mapA :: a d r - a (c d) (c r)

 class (GArrow a (**) u) = GArrowUnion a (**) u c where
union :: a ((c r) ** (c r)) (c r)

 class (GArrowMap a (**) u c) = GArrowJoin a (**) u c where
join :: a d (c r) - a (c d) (c r)

I like these; I think you're on the right track.  The last one reminds
me of concatMap.


 class (GArrowDrop a (**) u) = GArrowMap_ a (**) u c where
mapA_ :: a d u - a (c d) u

I don't think you want to ask for a GArrowDrop instance here -- if
you've got that, you might as well just ignore the argument and say:

 mapA_ = \x - ga_drop

Perhaps what you want is

 gac_drop :: a (c u) u

... which is a bit like ga_cancell and ga_cancelr, but for a whole
collection rather than one input at a time.

By the way, I've started [2] using type families for the aggregate
GArrow classes like GArrowSTLC.  This greatly reduces the syntactic
noise in the types -- you only have one type parameter instead of four.
The price is that a single type can't be an instance of these classes in
more than one way (see Section 3.6.1 of [3] for why this is important).

I tend to think of type classes in terms of dictionary-passing (like in
Coq), so I often get myself into trouble in situations where I know
which dictionary to pass, but can't get Haskell's instance inference to
do what I want.  I welcome suggestions on ways to improve the
user-friendliness of the GArrow classes -- there are probably a bunch of
cool Haskell type class tricks I ought to be using but don't know about.


 In my own case, 'c' might be representing an asynchronous or
 distributed, reactive collection, so the ability to restrict
 expressiveness is important for performance.

Certainly.  The multiplicative disjunction [4] of linear logic is the
binary version of this: (A \bindnasrepma B) is sort of like an A and a
B in geographically distant locations; if you have a (Int \bindnasrepma
Int) you have two Int's, but in order to (for example) add them together
you must use some sort of communication primitive to get them both to
the same place.

It sounds like you want a sort of collection version of multiplicative
disjunction.  I bet Data Paralell Haskell's parallel array type-former
(([::]) :: * - *) would be an instance of this class.

  - a


[1] http://dx.doi.org/10.1145/581690.581695

[2] http://git.megacz.com/?p=ghc-base.git;a=commitdiff;h=47c002441ab30c48

[3] http://arxiv.org/pdf/1007.2885v2

[4] http://en.wikipedia.org/wiki/Linear_logic#The_resource_interpretation


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] parsing currency amounts with parsec

2011-05-10 Thread Roman Cheplyaka
* Eric Rasmussen ericrasmus...@gmail.com [2011-05-09 15:07:57-0700]
 Hi everyone,
 
 I am relatively new to Haskell and Parsec, and I couldn't find any articles
 on parsing numbers in the following format:

You could read hledger[1] sources for inspiration: it's written in
Haskell and contains some (quite generic) currency parsing.

[1]: http://hledger.org/

-- 
Roman I. Cheplyaka :: http://ro-che.info/
Don't worry what people think, they don't do it very often.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Proposal to incorporate Haskell.org

2011-05-10 Thread Don Stewart
Hello everyone.

The haskell.org committee[1], in the interest of the long-term stability
of the open source Haskell community infrastructure, has decided to
incorporate haskell.org as a legal entity. This email outlines our
recommendation, and seeks input from the community on this decision.

The committee's proposal is that haskell.org incorporate as an entity
under the Software Freedom Conservancy umbrella organization (the same group
that Darcs joined recently):

http://sfconservancy.org/

If we proceed with this move, haskell.org will be a legal entity, and
registered as a non-profit, allowing us to more directly accept
(US tax-deductible) donations, and to invest in assets that benefit the
Haskell open source community.

We welcome your feedback on the proposal attached below.

-- Don Stewart (on behalf of the Haskell.org committee)





= A proposal for the incorporation of Haskell.org =

In recent years, haskell.org has started to receive assets, e.g. money from
Google Summer Of Code, donations for Hackathons, and a Sparc machine for use in
GHC development. We have also started spending this money: in particular, on
hosting haskell.org itself. There is also interest in running fundraising
drives for specific things such as Hackathon sponsorship and hosting fees.

However, haskell.org doesn't currently exist as a legal entity, meaning that
these assets have had to be held on our behalf by other entities, such as
Galois and various universities. This leads to tricky situations, with no-one
being sure who should decide how the haskell.org assets can be used.

To solve these problems, we propose that haskell.org applies to become a member
project of the Software Freedom Conservancy (SFC)
http://conservancy.softwarefreedom.org/. The SFC is a non-profit organization
that provides free financial and administrative services to open source
projects. Additionally, it has 501(c)(3) status, meaning donations from the US
are tax-deductible. The SFC would hold haskell.org's money and other assets,
and would be able to accept donations on behalf of haskell.org.

The haskell.org committee, as described here [2], will make decisions on
spending assets and other decisions related to governing the non-profit.


Before proceeding, we are inviting input from the community in the form
of specific objections or queries regarding the plan.

We've tried to answer some of the most likely questions:

Q: Does this mean that my Haskell project must now be covered by a
 copyleft licence such as GPL?
A: No, but Haskell projects using haskell.org resource should use an
Open Source licence
 http://www.opensource.org/licenses/alphabetical.

Q: Will it still be possible to use community.h.o to host
 non-open-source material, such as academic papers?
A: An overall minority of such content, as is the current situation, is
not a problem.

Q: Will it still be possible to have job ads on the haskell.org mailing
lists and website?
A: Yes.

Q: Will this affect our ability to host the Haskell Symposium
http://www.haskell.org/haskell-symposium/  and Industrial Haskell
Grouphttp://industry.haskell.org/  webpages within haskell.org?
A: No.

Q: What will be the relationship between haskell.org and other
organizations such as the Haskell Symposium and Industrial Haskell
Group?
A: Those organisations will continue to exist as separate entities.

Q: If an umbrella non-profit organisation The Haskell Foundation was
created, would haskell.org be able to join it?
A: Yes. It's likely that in such a scenario, the Haskell Foundation
would become the owner of the haskell.org domain name, with the cost
divided between the members. The entity that is part of the SFC would
be renamed community.haskell.org in order to avoid confusion.

[1]: http://www.haskell.org/haskellwiki/Haskell.org_committee
[2]: http://www.haskell.org/haskellwiki/Haskell.org_committee#Operation

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Modeling the performance of a non-trivial software app

2011-05-10 Thread C K Kashyap
Hi,
I was wondering if it would be a good idea to model a software app's
performance using Haskell. The idea is a little abstract in my mind right
now. I'll try and illustrate it with an example - Let's say, I want to model
a web app - to, model it, I could think of the following entities -

1. One or more clients and as many connections (essentially bandwidth of
each connection)
2. A Load balancer ( and bandwidths to the webservers)
3. Bunch of webservers (and bandwidths to the database server)
4. A database server

Using the model, I could generate performance characteristics and figure out
if database is the bottleneck or not ... if so, what level of  sharding
would be useful etc

Is there already a wheel I am trying to re-invent? Has anyone attempted
this?

Regards,
kashyap
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Proposal to incorporate Haskell.org

2011-05-10 Thread Tom Murphy
 Q: Does this mean that my Haskell project must now be covered by a
  copyleft licence such as GPL?
 A: No, but Haskell projects using haskell.org resource should use an
 Open Source licence
  http://www.opensource.org/licenses/alphabetical.


Should == must?
Would this apply to everything on Hackage?

Thanks for clarifying,
Tom

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Modeling the performance of a non-trivial software app

2011-05-10 Thread David Sorokin

On 05/11/2011 07:55 AM, C K Kashyap wrote:

Hi,
I was wondering if it would be a good idea to model a software app's 
performance using Haskell. The idea is a little abstract in my mind 
right now. I'll try and illustrate it with an example - Let's say, I 
want to model a web app - to, model it, I could think of the following 
entities -


1. One or more clients and as many connections (essentially bandwidth 
of each connection)

2. A Load balancer ( and bandwidths to the webservers)
3. Bunch of webservers (and bandwidths to the database server)
4. A database server

Using the model, I could generate performance characteristics and 
figure out if database is the bottleneck or not ... if so, what level 
of  sharding would be useful etc


Is there already a wheel I am trying to re-invent? Has anyone 
attempted this?


Regards,
kashyap


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Sometimes it is possible to write the corresponded model. Then the model 
can be simulated to receive the performance characteristics. Much 
depends on that how precise the model is. The keywords are Discrete 
Event Simulation (DES) and Theory of Queue. It may require some maths.


I wrote a small library called Aivika[1]. Perhaps it might be helpful.

David

[1]http://hackage.haskell.org/package/aivika

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Proposal to incorporate Haskell.org

2011-05-10 Thread Antoine Latter
On Tue, May 10, 2011 at 5:44 PM, Don Stewart don...@gmail.com wrote:
 Hello everyone.

 The haskell.org committee[1], in the interest of the long-term stability
 of the open source Haskell community infrastructure, has decided to
 incorporate haskell.org as a legal entity. This email outlines our
 recommendation, and seeks input from the community on this decision.

 The committee's proposal is that haskell.org incorporate as an entity
 under the Software Freedom Conservancy umbrella organization (the same group
 that Darcs joined recently):

    http://sfconservancy.org/

 If we proceed with this move, haskell.org will be a legal entity, and
 registered as a non-profit, allowing us to more directly accept
 (US tax-deductible) donations, and to invest in assets that benefit the
 Haskell open source community.

 We welcome your feedback on the proposal attached below.

 -- Don Stewart (on behalf of the Haskell.org committee)



Keeping -cafe and committee@ on the CC list.

Joining the SFC looks like a good alternative to full-on
incorporation, and having some sort of legal cover for operations
involving money and ownership of infrastructure looks like a good
idea.

Which assets would move over to the SFC? The domain name? Any sort of
hosting could then be leased by the SFC to whomever is doing this now.
I'm a bit fuzzy here.

They look pretty flexible, and are open to some, none, or all of a
project's assets being in the name of the SFC.

Antoine




 

 = A proposal for the incorporation of Haskell.org =

 In recent years, haskell.org has started to receive assets, e.g. money from
 Google Summer Of Code, donations for Hackathons, and a Sparc machine for use 
 in
 GHC development. We have also started spending this money: in particular, on
 hosting haskell.org itself. There is also interest in running fundraising
 drives for specific things such as Hackathon sponsorship and hosting fees.

 However, haskell.org doesn't currently exist as a legal entity, meaning that
 these assets have had to be held on our behalf by other entities, such as
 Galois and various universities. This leads to tricky situations, with no-one
 being sure who should decide how the haskell.org assets can be used.

 To solve these problems, we propose that haskell.org applies to become a 
 member
 project of the Software Freedom Conservancy (SFC)
 http://conservancy.softwarefreedom.org/. The SFC is a non-profit 
 organization
 that provides free financial and administrative services to open source
 projects. Additionally, it has 501(c)(3) status, meaning donations from the US
 are tax-deductible. The SFC would hold haskell.org's money and other assets,
 and would be able to accept donations on behalf of haskell.org.

 The haskell.org committee, as described here [2], will make decisions on
 spending assets and other decisions related to governing the non-profit.


 Before proceeding, we are inviting input from the community in the form
 of specific objections or queries regarding the plan.

 We've tried to answer some of the most likely questions:

 Q: Does this mean that my Haskell project must now be covered by a
     copyleft licence such as GPL?
 A: No, but Haskell projects using haskell.org resource should use an
    Open Source licence
     http://www.opensource.org/licenses/alphabetical.

 Q: Will it still be possible to use community.h.o to host
     non-open-source material, such as academic papers?
 A: An overall minority of such content, as is the current situation, is
    not a problem.

 Q: Will it still be possible to have job ads on the haskell.org mailing
    lists and website?
 A: Yes.

 Q: Will this affect our ability to host the Haskell Symposium
    http://www.haskell.org/haskell-symposium/  and Industrial Haskell
    Grouphttp://industry.haskell.org/  webpages within haskell.org?
 A: No.

 Q: What will be the relationship between haskell.org and other
    organizations such as the Haskell Symposium and Industrial Haskell
    Group?
 A: Those organisations will continue to exist as separate entities.

 Q: If an umbrella non-profit organisation The Haskell Foundation was
    created, would haskell.org be able to join it?
 A: Yes. It's likely that in such a scenario, the Haskell Foundation
    would become the owner of the haskell.org domain name, with the cost
    divided between the members. The entity that is part of the SFC would
    be renamed community.haskell.org in order to avoid confusion.

 [1]: http://www.haskell.org/haskellwiki/Haskell.org_committee
 [2]: http://www.haskell.org/haskellwiki/Haskell.org_committee#Operation

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Modeling the performance of a non-trivial software app

2011-05-10 Thread C K Kashyap

 Sometimes it is possible to write the corresponded model. Then the model
 can be simulated to receive the performance characteristics. Much depends on
 that how precise the model is. The keywords are Discrete Event Simulation
 (DES) and Theory of Queue. It may require some maths.

 I wrote a small library called Aivika[1]. Perhaps it might be helpful.

 David

 [1]http://hackage.haskell.org/package/aivika

  Thanks David,
I'll check out DES and Aivika.
Regards,
Kashyap
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe