Re: [Haskell-cafe] Value-weak hash tables in Haskell ?

2013-08-10 Thread Alessandro Vermeulen
There is supposed to be some weak hash map implementation somewhere.

However, if you can't find it you can easily create it yourself. However, you 
will need to use the map in IO so I suggest that you use the hashtables[1] 
package in combination with the weak pointers mentioned by Erik.

- Alessandro

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

On 10 aug. 2013, at 21:08, Erik Hesselink hessel...@gmail.com wrote:

 I'm not sure, but there are weak pointer [0], though I have never used them.
 
 Erik
 
 [0] 
 http://www.haskell.org/ghc/docs/latest/html/libraries/base/System-Mem-Weak.html
 
 On Sat, Aug 10, 2013 at 7:13 PM, Aleksey Uymanov s9gf4...@gmail.com wrote:
 Hello, haskellers.
 
 Is there any package implementing magic hash tables weak in value? I
 mean when the value is garbage collected, then this key+value
 authomatically removes from the hash table.
 
 --
 Aleksey Uymanov s9gf4...@gmail.com
 
 ___
 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
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Is inspectable recursion in Arrows possible?

2012-10-01 Thread Alessandro Vermeulen
Dear all,

I am trying to find a way to translate normal recursive notation such
as the |fib| function below to an arrow, retaining as much of the
structure of the recursive notation as possible. In addition I would
like to inspect the arrow. For this I created a datatype containing a
constructor for each Arrow{..} class:

Fib:
 fib 0 = 0
 fib 1 = 1
 fib n = fib (n-2) + fib (n-1)

My R datatype, the instances for this datatype consist of the mapping
to the appropriate constructor:

 data R x y where
   -- Category
   Id   :: R a a
   Comp :: R b c- R a b  - R a c
   -- Arrow
   Arr  :: (a - b) - R a b
   Split:: R b c- R b' c'- R (b,b') (c,c')
   Cache:: (a - a - Bool) - R a a
   -- ArrowChoice
   Choice   :: R b c - R b' c' - R (Either b b') (Either c c')
   -- ArrowLoop
   Loop :: R (b, d) (c, d)  - R b c
   -- ArrowApply
   Apply:: R (R b c, b) c

Translating the |fib| function from above first resulted in the
following definition. It is not allowed however due to the proc n on
the RHS of the declaration for |fibz|. I know that the grammar of the
Arrow Notation prevents this, but what is the underlying reason for
this?

 fib' :: (ArrowChoice r, ArrowLoop r) = r Int Int
 fib' = proc x - do
   rec fibz - proc n - case n of
   0  - returnA - 0
   1  - returnA - 1
   n' - do l - fibz - (n'-2)
r - fibz - (n'-1)
returnA - (l+r)
   fibz - x

Rewriting the function above to use a let statement compiles. However,
here my second problem arises. I want to be able to inspect the
recursion where it happens. However, in this case |fibz| is an
infinite tree. I would like to capture the recursion into fibz, I
hoped the rec would help me with that in combination with |loop| but
maybe I am wrong?

 fib'' :: (ArrowChoice r, ArrowLoop r, ArrowApply r) = r Int Int
 fib'' = proc x - do
   let fibz = proc n - case n of
   0  - returnA - 0
   1  - returnA - 1
   n' - do l - fibz - (n'-2)
r - fibz - (n'-1)
returnA - (l+r)
   fibz - x

Basically, is it possible to observe this kind of recursion? (Perhaps
even within the boundaries of Arrow Notation) I could perhaps add
another constructor like fix.

Any thoughts on this?

Cheers,
Alessandro Vermeulen

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


Re: [Haskell-cafe] Connecting Travis CI and hackage

2012-07-10 Thread Alessandro Vermeulen
You have full internet access on the Travis machines. The problem is that
you only have the data from your public repo. So you could upload the
package through the command line with cabal. But that means storing your
credentials in the public repository, which is a bad idea obviously.

In short: contact the people from Travis and they will be happy to help
you. Maybe you can store some environment variables in your account that
are made available for the build script.

- Alessandro
On Jul 8, 2012 7:28 PM, Dmitry Malikov malikov@gmail.com wrote:

  But in the meantime, regarding what you suggest here, couldn't be done
 through tags rather than branches? Tagging a release version could trigger
 testing and, if testing runs fine, upload to hackage.
 Testing should be done on travis virtual machine. So this question is not
 about `when' or `where from' new release should be generated. It's about
 how uploading the new package to hackage could be done from the travis
 machine.

 --
 Best regards,
 dmitry malikov
 !


 __**_
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://www.haskell.org/mailman/listinfo/haskell-cafe

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


[Haskell-cafe] lhs2tex-hl 1.4.3 released

2011-10-14 Thread Alessandro Vermeulen
Dear all,

I've uploaded a new version of lhs2tex-hl [1] to hackage [2]. It includes:

1. It now builds on GHC 7.2.x
2. You can list the LaTeX commands you have to implement (with a default 
implementation) with lhs2TeX-hl --action=ListCommands
3. Binary operators should now be typeset correctly.

What does it do? It generates formatting statement for highlighting your 
Haskell code in your lhs2TeX compatible documents. Generate a fmt file with

 lhs2TeX-hl -o file.fmt file.lhs

and add the following to your lhs file:

%include file.fmt

Have fun

With kind regards,
Alessandro Vermeulen

[1] https://github.com/spockz/lhs2texhl
[2] http://hackage.haskell.org/package/lhs2TeX-hl___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe