Re: [Haskell-cafe] Tool to brute-force test against hackage libraries to determine lower bounds?

2011-11-09 Thread Ryan Newton
>
> What about dependency interactions? If you depend on foo and bar there
> might be versions of foo and bar that don't build together that you might
> not discover by varying their versions independently.
>

Indeed.  But assuming for a moment that foo & bar have correctly specified
their own dependency bounds won't the constraint solver make up for some of
this deficiency?  I.e. you specify too low a version for foo but the range
gets further restricted by cabal's constraint solver and you end up ok?

I proposed the greedy approach just because I think given current compile
times it wouldn't be possible to try all combinations ;-). **

Though I suppose a decent heuristic would compute the total # of
combinations and -- if it is manageable -- do them all.  If not, either
resort to greedy/independent testing or bring out the more complex
strategies for sampling the version space...

But enough idle speculation!  I know people have studied this problem in
earnest and I haven't read any of that.

-Ryan

** P.S. If one could carefully control how the compiler output is managed I
guess you could cut way down on the number of actual module compilations to
explore a given set of combinations.  (A particular module should only need
to be compiled once for each unique combination of its own dependencies
present in the set of combinations being examined, right?)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Haskell Weekly News: Issue 207

2011-11-09 Thread Daniel Santa Cruz
Welcome to issue 207 of the HWN, a newsletter covering developments in
the Haskell community. This release covers the week of October 30 to
November 05, 2011.

You can find the HTML version of this issue at:
http://contemplatecode.blogspot.com/2011/11/haskell-weekly-news-issue-207.html

New and Updated Projects

   * hierarchical-clustering-diagrams (Felipe Almeida Lessa; 0.1)
 Library to draw diagrams of dendrograms.
 [1] http://goo.gl/7deyG

   * websockets (Jasper Van der Jeugt; 0.4.0.0) Major re-write to the
 library with support for multiple versions of the protocol.
 [2] http://goo.gl/i6bVr

   * cereal (Trevor Elliott; 0.3.4.0) Provides support for IEEE754
 encoded Float/Double values.
 [3] http://goo.gl/GwZk8

Quotes of the Week

   * wyfrn: whats broken? my brain or ghci?

   * dons: Being really mean to your software, and following up when it
 breaks, makes it a lot better. But you have to be really, really
 mean.

   * hpc: and when you want to get really ridiculous, agda has universe
 polymorphism, which is when you don't know how high up the tower of
 turtles you have managed to climb

Top Reddit Stories

   * Quick and dirty reinversion of control.
 Domain: blog.sigfpe.com, Score: 59, Comments: 7
 On Reddit: [4] http://goo.gl/J2oon
 Original: [5] http://goo.gl/pQYGA

   * Running a Startup on Haskell [Presentation]
 Domain: infoq.com, Score: 57, Comments: 12
 On Reddit: [6] http://goo.gl/uqfqN
 Original: [7] http://goo.gl/QMu5c

   * LLVM patch is merged for inclusion in LLVM 3.0 release | GHC on ARM
 Domain: ghcarm.wordpress.com, Score: 48, Comments: 2
 On Reddit: [8] http://goo.gl/UNRN6
 Original: [9] http://goo.gl/h6q7I

   * Thunks and lazy blackholes: an introduction to GHC at runtime
 Domain: mainisusuallyafunction.blogspot.com, Score: 39, Comments: 0
 On Reddit: [10] http://goo.gl/nQN3U
 Original: [11] http://goo.gl/HqKaL

   * GHC feature request: warn about unused constraints -- "I think
this could make for a nice project for someone wanting to dig into
hacking on GHC"
 Domain: byorgey.wordpress.com, Score: 34, Comments: 16
 On Reddit: [12] http://goo.gl/MIMCN
 Original: [13] http://goo.gl/GPt0B

   * Haskell Implementors Workshop 2011 Videos Online!
 Domain: neilmitchell.blogspot.com, Score: 31, Comments: 3
 On Reddit: [14] http://goo.gl/MqszQ
 Original: [15] http://goo.gl/LUsFe

   * What Constraints Entail, Part 1
 Domain: comonad.com, Score: 29, Comments: 0
 On Reddit: [16] http://goo.gl/Tt41V
 Original: [17] http://goo.gl/SdGdm

   * [Newbie]: Haskell code is really slow compared to same code in
Python. Can anyone help me find what the problem is ?
 Domain: self.haskell, Score: 29, Comments: 51
 On Reddit: [18] http://goo.gl/15bb8
 Original: [19] http://goo.gl/15bb8

   * Please help me gather information about Haskell installations on Macs
 Domain: gist.github.com, Score: 26, Comments: 14
 On Reddit: [20] http://goo.gl/Yfc32
 Original: [21] http://goo.gl/xQACw

   * Why learning Functional Programming (and Haskell in particular) can be hard
 Domain: harishankar.org, Score: 25, Comments: 46
 On Reddit: [22] http://goo.gl/8Xb3V
 Original: [23] http://goo.gl/FKlcj

   * How do you write nontrivial tests in QuickCheck?
 Domain: self.haskell, Score: 23, Comments: 15
 On Reddit: [24] http://goo.gl/FL6jh
 Original: [25] http://goo.gl/FL6jh

Top StackOverflow Questions

   * Calling Haskell from Java with C in between
 votes: 14, answers: 1
 Read on SO: [26] http://goo.gl/RyN00

   * Is “List” specially handled in Haskell's pattern matching?
 votes: 14, answers: 5
 Read on SO: [27] http://goo.gl/y3hdi

   * Why does this simple use of the State monad cause a stack overflow?
 votes: 12, answers: 1
 Read on SO: [28] http://goo.gl/bLlnX

   * Why does this Haskell code not terminate?
 votes: 10, answers: 4
 Read on SO: [29] http://goo.gl/LStfr

   * Is it possible to make a type an instance of a class if its type
parameters are in the wrong order?
 votes: 10, answers: 4
 Read on SO: [30] http://goo.gl/aRh0b

   * How to make a type with restrictions
 votes: 9, answers: 3
 Read on SO: [31] http://goo.gl/SRTfY

   * Desugaring do-notation for Monads
 votes: 9, answers: 1
 Read on SO: [32] http://goo.gl/CqoQF

   * Equation from “Programming Pearls” - can somebody explain me?
 votes: 8, answers: 1
 Read on SO: [33] http://goo.gl/kUr67

   * ADT names. What is `Left a`, and then what is `a`, in Haskell?
 votes: 8, answers: 2
 Read on SO: [34] http://goo.gl/IVoN0

   * Why are boxed vectors so slow?
 votes: 8, answers: 1
 Read on SO: [35] http://goo.gl/4RrQX

Until next time,
Daniel Santa Cruz

References

   1. http://permalink.gmane.org/gmane.comp.lang.haskell.bio/156
   2. http://permalink.gmane.org/gmane.comp.lang.haskell.web/2204
   3. http:

Re: [Haskell-cafe] Tool to brute-force test against hackage libraries to determine lower bounds?

2011-11-09 Thread Johan Tibell
On Wed, Nov 9, 2011 at 3:58 PM, Ryan Newton  wrote:

> I don't know about you, but I personally haven't found the time to cast
> back in time for each of my package's dependencies to find a true lower
> bound version.
>
> Do we have any tools that would do the following?
>
>- ask Hackage for the available versions of package foo
>- use cabal-dev to build your package against foo-X.Y.Z forall {X,Y,Z}
>(but leaving other packages unconstrained)
>- report successes and failures, including last failure before the
>present version (and therefore lower bound, exclusive)
>
> What about dependency interactions? If you depend on foo and bar there
might be versions of foo and bar that don't build together that you might
not discover by varying their versions independently.


>
>
> Johan, would it make any sense to extend your Jenkins setup to do this?
>

If someone came up with a recipe, sure. It might be a bit CPU intensive for
my little VPS though.

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


[Haskell-cafe] Tool to brute-force test against hackage libraries to determine lower bounds?

2011-11-09 Thread Ryan Newton
I don't know about you, but I personally haven't found the time to cast
back in time for each of my package's dependencies to find a true lower
bound version.

Do we have any tools that would do the following?

   - ask Hackage for the available versions of package foo
   - use cabal-dev to build your package against foo-X.Y.Z forall {X,Y,Z}
   (but leaving other packages unconstrained)
   - report successes and failures, including last failure before the
   present version (and therefore lower bound, exclusive)

Johan, would it make any sense to extend your Jenkins setup to do this?

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


Re: [Haskell-cafe] Data.Vector.Unboxed

2011-11-09 Thread Bas van Dijk
On 9 November 2011 22:33, kaffeepause73  wrote:
> Repa is indeed very Interesting, but I have changing vector length in the
> second dimension and later on only want to generate Data on demand. If I use
> Matrices, I will use loads of space for no reason.

Even if it is possible to create an unboxed vector of unboxed vectors,
if the inner unboxed vectors have variable lengths as you require,
indexing will become O(n) instead of O(1) because you need to traverse
the inner unboxed vectors and check their length to find the desired
index. I'm not sure that's what you want.

> Seems like sticking to Boxed Vector for now is best Choice for me.

Yes your second alternative: a boxed vector of unboxed vectors seems
to do what you want.

> isn't data.vector also providing multidimensional arrays?

I don't think so. All indexing functions get a single Int argument. Of
course it's easy to build a layer on top that adds more dimensions.

> So is Repa just another Version of Data.Vector or is it building another 
> level on top.

The latter, repa provides a layer on top of vector.

Note that you can also convert Vectors to repa Arrays using:

fromVector :: Shape sh => sh -> Vector a -> Array sh a

I believe its O(1).

> And when to use best which of the two ?

I guess when your vectors are multi-dimensional and you want to
benefit from parallelism you should use repa instead of vector.

Cheers,

Bas

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


Re: [Haskell-cafe] "Bounds checking" pragma?

2011-11-09 Thread Daniel Fischer
On Thursday 10 November 2011, 00:35:07, Artyom Kazak wrote:
> Hello!
> 
> The (!) operator is short and nice. Unfortunately, when doing heavy
> computing, we have to use "unsafeAt" instead. It looks ugly and it is
> ugly, also.
> 
> Some compilers for imperative languages like Free Pascal have an option
> to turn on/off bounds checking for arrays. Wouldn't it be nice to have
> such option in GHC? Is it possible?
> 
> There is a problem: Haskell has a lot of array libraries. The only
> solution I see is a new FLAG pragma:
> 
>   (!) :: Array i a -> i -> a
>  --definition
> 
>  {-# FLAG "boundsCheck" (!) = unsafeAt #-}

There's a problem here, unsafeAt uses an Int index into the array, while 
(!) uses the declared index type. Even skipping the bounds check, you'd 
still have to calculate the Int index for the replacement of (!).

> 
> It is similar to RULES pragma, but only fires when flag is set. To set
> the flag you need to complile with option -flags="boundsCheck". Also,
> the mantainers of vector library, bytestring library, repa library and
> so on will have to include such pragmas in their code.
> 
> I don't know about C++ preprocessor, though. Maybe this is already
> solvable with #define's...

#ifdef OMIT_BOUNDS_CHECK
{-# RULES
"ArrayIndex"  arr ! i = unsafeAt arr (unsafeIndex (bounds arr) i) 
 #-}
#endif

> 
> Anyway, I have to say it once again: unsafeAt is ugly and Haskell is
> beautiful. Why high-performance code should be ugly?

(?) = unsafeAt


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


[Haskell-cafe] haskell/clojure job opprtunity

2011-11-09 Thread Vagif Verdi
Hello.
My company is looking to hire a haskell developer. South California
(San Dimas), full time job, local only (no telecommute)

We use yesod (haskell web framework) for internal web application and
web services, and compojure (clojure web framework) for customer
facing web site.

All development will be ether with haskell (if libraries permit) or
clojure on JVM.

If interested please contact me.

Regards,
Vagif Verdi

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


Re: [Haskell-cafe] "Bounds checking" pragma?

2011-11-09 Thread Joachim Breitner
Hi,

Am Donnerstag, den 10.11.2011, 01:35 +0200 schrieb Artyom Kazak:
> Anyway, I have to say it once again: unsafeAt is ugly and Haskell is  
> beautiful. Why high-performance code should be ugly?

It does not have to be ugly. Just write
(!!) = unsafeAt
in some common module of yours, and you have a nice fast array access.

I don’t think a flag would be very helpful, because you might have some
places where you want the safe access, and others where you know that it
is safe to skip the check.

Greetings,
Joachim

-- 
Joachim "nomeata" Breitner
  m...@joachim-breitner.de  |  nome...@debian.org  |  GPG: 0x4743206C
  xmpp: nome...@joachim-breitner.de | http://www.joachim-breitner.de/



signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] "Bounds checking" pragma?

2011-11-09 Thread Artyom Kazak

Hello!

The (!) operator is short and nice. Unfortunately, when doing heavy  
computing, we have to use "unsafeAt" instead. It looks ugly and it is  
ugly, also.


Some compilers for imperative languages like Free Pascal have an option to  
turn on/off bounds checking for arrays. Wouldn't it be nice to have such  
option in GHC? Is it possible?


There is a problem: Haskell has a lot of array libraries. The only  
solution I see is a new FLAG pragma:


(!) :: Array i a -> i -> a
--definition

{-# FLAG "boundsCheck" (!) = unsafeAt #-}

It is similar to RULES pragma, but only fires when flag is set. To set the  
flag you need to complile with option -flags="boundsCheck". Also, the  
mantainers of vector library, bytestring library, repa library and so on  
will have to include such pragmas in their code.


I don't know about C++ preprocessor, though. Maybe this is already  
solvable with #define's...


Anyway, I have to say it once again: unsafeAt is ugly and Haskell is  
beautiful. Why high-performance code should be ugly?


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


Re: [Haskell-cafe] Data.Vector.Unboxed

2011-11-09 Thread kaffeepause73
Thanks for the replies. - Looks like there's not a straight forward way and
I'm not yet on a level 
and don't have the time to make fancy wrappers or instances.

Repa is indeed very Interesting, but I have changing vector length in the
second dimension and later on only want to generate Data on demand. If I use
Matrices, I will use loads of space for no reason.

Seems like sticking to Boxed Vector for now is best Choice for me. 

But another question here  - isn't data.vector also providing
multidimensional arrays? So is Repa just another Version of Data.Vector or
is it building another level on top. -- And when to use best which of the
two ?   

Cheers Phil


--
View this message in context: 
http://haskell.1045720.n5.nabble.com/Data-Vector-Unboxed-tp4977289p4979201.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

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


Re: [Haskell-cafe] Easiest to use NoSQL storage with Haskell?

2011-11-09 Thread Alberto G. Corona
TCache manages persistent data trough STM references called DBRefs
that are very similar to TVars, but with  added user-configurable
persistence. Very intuitive to use.

2011/11/9 Bas van Dijk :
> On 9 November 2011 19:50, dokondr  wrote:
>> On Wed, Nov 9, 2011 at 8:41 PM, Bas van Dijk  wrote:
>>>
>>> On 9 November 2011 11:59, dokondr  wrote:
>>> > What  Haskell package to work with NoSQL storage is both mature and
>>> > easiest
>>> > to use?
>>> > I need persistent storage for simple key/value lists (not complex JSON
>>> > docs).
>>>
>>> If your data fits in RAM then acid-state is also an option:
>>>
>>> http://hackage.haskell.org/package/acid-state
>>>
>>> It's used as the storage library for the new hackage server.
>>>
>>
>> I need to share data across processes running both on the same node or
>> different nodes. Every process has its own memory space.
>> Can acid-state memory be shared between several system processes?
>>
>
> I believe so:
>
> http://hackage.haskell.org/packages/archive/acid-state/0.6.0/doc/html/Data-Acid-Remote.html
>
> but maybe David can tell you more about that.
>
> Cheers,
>
> Bas
>
> ___
> 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] Haskell Platform for OSX ?

2011-11-09 Thread Rogan Creswick
On Wed, Nov 9, 2011 at 3:37 AM, dokondr  wrote:
>
> In case I upgrade to the latest Haskell Platform, what will happen to
> packages already installed  in my ~/.cabal folder? Some of these are quite
> old and most probably will be incompatible with GHC 7
> Does upgrade process remove old  and create anew ~/.cabal folder?
>

The compiled packages are stored in a directory that is specific to
the version of GHC that was used to build them, so you don't need to
worry about that.

Indeed, you can switch between GHCs (eg: by tweaking your $PATH, or
using a tool like virthualenv) as much as you want and they won't
interfere with most packages. (There may be issues with respect to
/executables/ but that /should/ also be OK.  Executables and cabal are
a whole different problem, but most of the time things work out.)

--Rogan

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


Re: [Haskell-cafe] Symbol collisions with -fhpc

2011-11-09 Thread Michael Orlitzky
On 11/08/11 22:33, Jason Dagit wrote:
> On Tue, Nov 8, 2011 at 9:40 AM, Michael Orlitzky  wrote:
>> Does anyone know what causes these? This used to work, like, a month
>> ago. It builds fine without the -fhpc.
> 
> What has changed in that time?  New Ghc?  New updates from your OS?
> New code in your project?  Because it builds fine without -fhpc it
> sounds like a ghc bug.
> 
> What version of ghc and on what OS?  Is this 64 bit or 32bit?
> 
> Basically, I think we need more information to be helpful.
> 

Gentoo, amd64. Happens on at least two different machines. There have
been plenty of code changes since it worked last, but no OS/GHC updates.
If I check out a revision from last month, it compiles.

*shrug*

$ ghc -v
Glasgow Haskell Compiler, Version 7.2.1, stage 2 booted by GHC version 7.2.1
Using binary package database:
/usr/lib64/ghc-7.2.1/package.conf.d/package.cache
Using binary package database:
/home/mjo/.ghc/x86_64-linux-7.2.1/package.conf.d/package.cache
hiding package time-1.1.2.0 to avoid conflict with later version
time-1.2.0.5
hiding package Cabal-1.11.1.20110721 to avoid conflict with later
version Cabal-1.12.0
wired-in package ghc-prim mapped to
ghc-prim-0.2.0.0-ecbedc87f49c27f03f71d60d1f66a3f5
wired-in package integer-gmp mapped to
integer-gmp-0.3.0.0-750d9a09d190332c9f798272235395cb
wired-in package base mapped to
base-4.4.0.0-2247d6528c0406cfbae549d8aa2b3bc5
wired-in package rts mapped to builtin_rts
wired-in package template-haskell mapped to
template-haskell-2.6.0.0-2150e2669e8f89e9f639db3b2ec85a00
wired-in package dph-seq not found.
wired-in package dph-par not found.
Hsc static flags: -static
*** Deleting temp files:
Deleting:
*** Deleting temp dirs:
Deleting:
ghc: no input files
Usage: For basic information, try the `--help' option.

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


Re: [Haskell-cafe] Haskell Platform for OSX ?

2011-11-09 Thread Albert Y. C. Lai

On 11-11-09 06:37 AM, dokondr wrote:

In case I upgrade to the latest Haskell Platform, what will happen to
packages already installed  in my ~/.cabal folder? Some of these are
quite old and most probably will be incompatible with GHC 7
Does upgrade process remove old  and create anew ~/.cabal folder?


Every GHC version ignores libs built by other GHC versions.

In short see ~/.ghc

In long see my http://www.vex.net/~trebla/haskell/sicp.xhtml

~/.cabal is hardly the whole story or the major story. More people need 
to learn that.


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


Re: [Haskell-cafe] Easiest to use NoSQL storage with Haskell?

2011-11-09 Thread Bas van Dijk
On 9 November 2011 19:50, dokondr  wrote:
> On Wed, Nov 9, 2011 at 8:41 PM, Bas van Dijk  wrote:
>>
>> On 9 November 2011 11:59, dokondr  wrote:
>> > What  Haskell package to work with NoSQL storage is both mature and
>> > easiest
>> > to use?
>> > I need persistent storage for simple key/value lists (not complex JSON
>> > docs).
>>
>> If your data fits in RAM then acid-state is also an option:
>>
>> http://hackage.haskell.org/package/acid-state
>>
>> It's used as the storage library for the new hackage server.
>>
>
> I need to share data across processes running both on the same node or
> different nodes. Every process has its own memory space.
> Can acid-state memory be shared between several system processes?
>

I believe so:

http://hackage.haskell.org/packages/archive/acid-state/0.6.0/doc/html/Data-Acid-Remote.html

but maybe David can tell you more about that.

Cheers,

Bas

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


Re: [Haskell-cafe] Easiest to use NoSQL storage with Haskell?

2011-11-09 Thread dokondr
On Wed, Nov 9, 2011 at 8:41 PM, Bas van Dijk  wrote:

> On 9 November 2011 11:59, dokondr  wrote:
> > What  Haskell package to work with NoSQL storage is both mature and
> easiest
> > to use?
> > I need persistent storage for simple key/value lists (not complex JSON
> > docs).
>
> If your data fits in RAM then acid-state is also an option:
>
> http://hackage.haskell.org/package/acid-state
>
> It's used as the storage library for the new hackage server.
>
>
I need to share data across processes running both on the same node or
different nodes. Every process has its own memory space.
Can acid-state memory be shared between several system processes?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Easiest to use NoSQL storage with Haskell?

2011-11-09 Thread Bas van Dijk
On 9 November 2011 11:59, dokondr  wrote:
> What  Haskell package to work with NoSQL storage is both mature and easiest
> to use?
> I need persistent storage for simple key/value lists (not complex JSON
> docs).

If your data fits in RAM then acid-state is also an option:

http://hackage.haskell.org/package/acid-state

It's used as the storage library for the new hackage server.

Bas

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


Re: [Haskell-cafe] Easiest to use NoSQL storage with Haskell?

2011-11-09 Thread dokondr
On Wed, Nov 9, 2011 at 5:46 PM, Daniel Schoepe  wrote:

> On Wed, 9 Nov 2011 13:59:46 +0300, dokondr  wrote:
> > Hi,
> > What  Haskell package to work with NoSQL storage is both mature and
> easiest
> > to use?
> > I need persistent storage for simple key/value lists (not complex JSON
> > docs).
> > CouchDB and Cassandra seems to be overkill for my needs. What about Riak,
> > MongoDB,  Voldemort, etc. ?
>
> persistent (part of yesod, but useable without other yesod libraries) is
> quite pleasant to use and supports MongoDB:
>
> http://hackage.haskell.org/package/persistent-0.6.4
> http://hackage.haskell.org/package/persistent-mongoDB-0.6.3
>
> Cheers,
> Daniel
>

I am wondering if Database.Persist can work with key/value storage such as
Riak or SimpleDB where records are lists of key/value pairs and any two
lists can have different keys?
Is simple implementation of 'persistent'  based on files with key/value
records possible?
For example 'persistent' based on KyotoCabinet package?
(http://hackage.haskell.org/package/KyotoCabinet)


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


Re: [Haskell-cafe] Depth first search

2011-11-09 Thread mukesh tiwari
Thank you David.I really liked the idea
>let vsx = dfs' g x (x : vis) in
>dfs' g v vsx
I am trying to grasp it. I wrote the stack based dfs which seems to
work.

import Data.List
import Data.Array
import Control.Monad

type Node = Int
type Graph = Array Int [  Node  ]

buildGraph :: ( Int , Int ) -> [ ( Node , Node ) ] -> Bool ->  Graph
buildGraph bnds xs f
 | f =  accumArray ( flip (:) ) []  bnds xs  --direct graph a->b
 | otherwise = accumArray ( flip (:) ) []  bnds xss where   --indirect
a ->b and b -> a
xss =  foldr ( \ ( x , y ) b -> ( y , x ) : b ) xs xs


dfsSearch :: Graph ->  [ Node ] -> [ Node ] -> [ Node ]
dfsSearch _ [] vis = vis
dfsSearch g  ( top : stack ) vis
| elem top  vis = dfsSearch g  stack vis
| otherwise = dfsSearch g  ( ( g ! top ) ++ stack ) ( top :
vis )

ghci>let g = buildGraph  ( 0 , 5 ) [ ( 0 , 1 ) , ( 0 , 2 ) , ( 0 ,
3 ) , (0 , 4 ) ] False
ghci>dfsSearch g [0] []
[1,2,3,4,0]
ghci>let g = buildGraph  ( 0 , 5 ) [ ( 0 , 1 ) , ( 0 , 2 ) , ( 0 ,
3 ) , (0 , 4 ) ] True
ghci>dfsSearch g [0] []
[1,2,3,4,0]
ghci>dfsSearch g [1] []
[1]
ghci>dfsSearch g [2] []
[2]
ghci>let g = buildGraph  ( 0 , 5 ) [ ( 0 , 1 ) , ( 0 , 2 ) , ( 0 ,
3 ) , (0 , 4 ) ] False
ghci>g
array (0,5) [(0,[4,3,2,1]),(1,[0]),(2,[0]),(3,[0]),(4,[0]),(5,[])]
ghci>let g = buildGraph  ( 0 , 5 ) [ ( 0 , 1 ) , ( 0 , 2 ) , ( 3 ,
4 ) , (4 , 5 ) ] False
ghci>g
array (0,5) [(0,[2,1]),(1,[0]),(2,[0]),(3,[4]),(4,[5,3]),(5,[4])]
ghci>dfsSearch g [0] []
[1,2,0]
ghci>dfsSearch g [1] []
[2,0,1]
ghci>dfsSearch g [2] []
[1,0,2]
ghci>dfsSearch g [3] []
[5,4,3]
ghci>dfsSearch g [4] []
[3,5,4]

In this dfs , I am returning list of elements in visited in last to
first order.

Regards
Mukesh Tiwari

On Nov 9, 5:08 am, David Barbour  wrote:
> Major error is in the line of code: `| otherwise =  dfs' g y ( v : vis )`
>
> You need something closer to:
>    let vsx = dfs' g x (x : vis) in
>    dfs' g v vsx
>
> That is, first visit everything you can reach from x, then backtrack to add
> anything else you can reach from v. This implementation will forget which
> nodes you've already visited from v, though that might not be a big issue.
> If you want to fix it, separate the `list = g ! v` into the caller, rather
> than the callee, such that there are two lists at `dfs'` - a to-visit list
> and a visited list.
>
> This fixes a few minor errors (you did not define y, and you added `v` to
> the visitors list).
>
> Also, fix dfsSearch:
>   dfsSearch g v = reverse $ dfs' g v [v]
>
> That is, add the node you're starting with to those you've already visited,
> and since you're adding to the front of the list the element visited last,
> you may wish to fix that.
>
> Order in this case is [0,4,3,2,1] due to the order from buildGraph.
>
> On Tue, Nov 8, 2011 at 1:04 PM, mukesh tiwari
> wrote:
>
>
>
>
>
>
>
> > Hello all
> > I am trying to implement depth search in Haskell.  My issue here is kind
> > of backtracking.  Haskell code for depth first search
>
> > import Data.List
> > import Data.Array
> > import Control.Monad
>
> > type Node = Int
> > type Graph = Array Int [  Node  ]
>
> > dfs' ::  Graph -> Node -> [ Node ] -> [ Node ]
> > dfs' g v vis = dfsfun lst where
> > lst = g ! v
> > dfsfun [] = vis
> > dfsfun ( x : xs )
> >   | elem x vis = dfsfun xs
> >   | otherwise =  dfs' g y ( v : vis )
>
> > --set the flag true if the graph is direct otherwise false
> > buildGraph :: ( Int , Int ) -> [ ( Node , Node ) ] -> Bool ->  Graph
> > buildGraph bnds xs f
> >  | f =  accumArray ( flip (:) ) []  bnds xs  --direct graph a->b
> >  | otherwise = accumArray ( flip (:) ) []  bnds xss where   --indirect a
> > -> b and b -> a
> > xss =  foldr ( \ ( x , y ) b -> ( y , x ) : b ) xs xs
>
> > dfsSearch :: Graph -> Int -> [ Node ]
> > dfsSearch g v = dfs' g v []
>
> > Lets create a indirect graph
> > ghci>let g = buildGraph  ( 0 , 5 ) [ ( 0 , 1 ) , ( 0 , 2 ) , ( 0 , 3 ) , (
> > 0 , 4 ) ] False
> > ghci>g
> > array (0,5) [(0,[4,3,2,1]),(1,[0]),(2,[0]),(3,[0]),(4,[0]),(5,[])]
>
> > ghci>dfsSearch g 0
> > [0]
> > Here  I am getting only 0 but  it should return [ 0 , 1 , 2 , 3 , 4 ] .
> > What is happening here when i am passing  0 as root node to function , at
> > first level i get
> >  lst = [ 4 , 3, 2, 1 ]  . First element of this list is 4 so 0 is added to
> > vis list and now 4 is passed to dfs' as parent. When it goes down , we get
> > lst = [0] and since 0 is member of vis list so it returns the vis as result
> > .  When we write dfs in c/c++ then it returns to calling function and again
> > loops through remaining element which i am not able visualize in Haskell.
> >  Could some one please help me how to solve this issue .
>
> > Regards
> > Mukesh Tiwari
>
> > ___
> > Haskell-Cafe mailing list
> > haskell-c...@haskell.org
> >http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
>
> ___
> Haskell-Cafe mailing list
> Haskell-C...@haskell.orghttp://w

Re: [Haskell-cafe] Easiest to use NoSQL storage with Haskell?

2011-11-09 Thread Daniel Schoepe
On Wed, 9 Nov 2011 13:59:46 +0300, dokondr  wrote:
> Hi,
> What  Haskell package to work with NoSQL storage is both mature and easiest
> to use?
> I need persistent storage for simple key/value lists (not complex JSON
> docs).
> CouchDB and Cassandra seems to be overkill for my needs. What about Riak,
> MongoDB,  Voldemort, etc. ?

persistent (part of yesod, but useable without other yesod libraries) is
quite pleasant to use and supports MongoDB:

http://hackage.haskell.org/package/persistent-0.6.4
http://hackage.haskell.org/package/persistent-mongoDB-0.6.3

Cheers,
Daniel


pgpOrSLejqLG4.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Data.Vector.Unboxed

2011-11-09 Thread Bas van Dijk
On 9 November 2011 10:56, kaffeepause73  wrote:
> Is it possible to create an unboxed vector of unboxed vector ? :

Why do you want to do this?

If you want multi-dimensional unboxed arrays you could try out repa:

http://www.haskell.org/haskellwiki/Numeric_Haskell:_A_Repa_Tutorial

(I believe it uses unboxed Vectors internally).

Bas

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


Re: [Haskell-cafe] A Brazilian community for Haskell

2011-11-09 Thread João Paulo Pizani Flor
Very nice initiative Giovanni, I've already subscribed to everything! :)

Let's now see how many we are, perhaps work together on some documentation... :D


João Paulo Pizani Flor
joaopiz...@gmail.com
Computer Science - UFSC



On Tue, Nov 8, 2011 at 3:06 PM, Giovanni Tirloni  wrote:
> Hello,
>
>  To gather all Haskellers in Brazil, a new mailing list has been created:
>
>    http://projects.haskell.org/cgi-bin/mailman/listinfo/haskell-br
>
>  There is also the #haskell-br channel on Freenode as well as Twitter and
> Google+ feeds to keep everybody updated on recent activities.
>
>  More information at:  http://www.haskell-br.org/
>
> []'s
> --
> Giovanni
>
>
> ___
> 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] Data.Vector.Unboxed

2011-11-09 Thread Tom Nielsen
Hi,

I don't know about Unboxed, but you can define a newtype wrapper
around Data.Vector.Storable that includes the size as a type-level
natural.

i.e.

data Z
data S n

newtype Vec n a = Vec (Vector a)

Then you can define a storable instance for Storable a => Vec n a, and
thus you can define a storable vector for Vec n a.

Not that you need something like this because storable instances must
have fixed size. I don't know if this is also true for Unbox.

I've done this using lists as the underlying container inside the
typed vectors, but you could use Data.Vector.Storable instead with
minimal effort:

https://github.com/glutamate/space/blob/master/VectorsL.hs

Tom



On Wed, Nov 9, 2011 at 9:56 AM, kaffeepause73  wrote:
> Hello,
>
> quick question about unboxed Vectors :
>
> Is it possible to create an unboxed vector of unboxed vector ? :
>
>> import qualified Data.Vector.Unboxed as V
>> type UnboxedNestedVextor =  V.Vector (V.Vector Int)
>
> Alternatively I would have to use:
>
>> import qualified Data.Vector.Unboxed as V
>> import qualified Data.Vector as VB
>
> type UnboxedNestedVextor =  VB.Vector (V.Vector Int)
>
> Is there a rule of thumb how much quicker Unboxed Vectors are ?
>
> Cheers Phil
>
>
> --
> View this message in context: 
> http://haskell.1045720.n5.nabble.com/Data-Vector-Unboxed-tp4977289p4977289.html
> Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.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


Re: [Haskell-cafe] Haskell Platform for OSX ?

2011-11-09 Thread dokondr
On Wed, Nov 9, 2011 at 2:11 PM, Giovanni Tirloni wrote:

> I meant install new packages through cabal under a different username. The
> cabal repo should be localized unless you specify --global
>
> Please see Rogan's suggestions.
>
>
Thanks for your help!
In case I upgrade to the latest Haskell Platform, what will happen to
packages already installed  in my ~/.cabal folder? Some of these are quite
old and most probably will be incompatible with GHC 7
Does upgrade process remove old  and create anew ~/.cabal folder?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] memorize function with number parameterized types in GHC

2011-11-09 Thread Bin Jin
Hi, Oleg
Thanks for your time and your brilliant code. I think this problem is
solved.
Best wishes to you

Regards
Bin

On Wed, Nov 9, 2011 at 2:05 PM,  wrote:

>p2num :: Dep a b
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell Platform for OSX ?

2011-11-09 Thread Giovanni Tirloni
On Wed, Nov 9, 2011 at 8:26 AM, dokondr  wrote:

>
>
> On Wed, Nov 9, 2011 at 3:48 AM, Rogan Creswick  wrote:
>
>> On Tue, Nov 8, 2011 at 4:30 PM, Giovanni Tirloni 
>> wrote:
>> >> 3) How to install it into a separate location so it would not ruin my
>> >> current platform?
>> >
>> >  You can install it under a different username.
>>
>
> Haskell Platform (HP) is installed for *all* users in one location at OSX:
>  /Library/Frameworks/GHC.framework/Versions/
> total 8
> drwxrwxr-x  4 root  admin  136 21 feb  2011 .
> drwxrwxr-x  5 root  admin  170 21 feb  2011 ..
> drwxrwxr-x  4 root  admin  136 11 jun  2010 612
> lrwxr-xr-x  1 user  staff3 21 фев  2011 Current -> 612
>
> 1) How different username will help here?
>

I meant install new packages through cabal under a different username. The
cabal repo should be localized unless you specify --global

Please see Rogan's suggestions.



> 2) Is there any way to see what packages HP includes without actually
> installing it? Some online document listing HP packages?
>

http://hackage.haskell.org/platform/contents.html
http://lambda.haskell.org/hp-tmp/docs/2011.2.0.0/start.html

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


[Haskell-cafe] Easiest to use NoSQL storage with Haskell?

2011-11-09 Thread dokondr
Hi,
What  Haskell package to work with NoSQL storage is both mature and easiest
to use?
I need persistent storage for simple key/value lists (not complex JSON
docs).
CouchDB and Cassandra seems to be overkill for my needs. What about Riak,
MongoDB,  Voldemort, etc. ?

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


Re: [Haskell-cafe] Haskell Platform for OSX ?

2011-11-09 Thread dokondr
On Wed, Nov 9, 2011 at 3:48 AM, Rogan Creswick  wrote:

> On Tue, Nov 8, 2011 at 4:30 PM, Giovanni Tirloni 
> wrote:
> >> 3) How to install it into a separate location so it would not ruin my
> >> current platform?
> >
> >  You can install it under a different username.
>

Haskell Platform (HP) is installed for *all* users in one location at OSX:
 /Library/Frameworks/GHC.framework/Versions/
total 8
drwxrwxr-x  4 root  admin  136 21 feb  2011 .
drwxrwxr-x  5 root  admin  170 21 feb  2011 ..
drwxrwxr-x  4 root  admin  136 11 jun  2010 612
lrwxr-xr-x  1 user  staff3 21 фев  2011 Current -> 612

1) How different username will help here?
2) Is there any way to see what packages HP includes without actually
installing it? Some online document listing HP packages?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Data.Vector.Unboxed

2011-11-09 Thread Ivan Lazar Miljenovic
On 9 November 2011 20:56, kaffeepause73  wrote:
> Hello,
>
> quick question about unboxed Vectors :
>
> Is it possible to create an unboxed vector of unboxed vector ? :
>
>> import qualified Data.Vector.Unboxed as V
>> type UnboxedNestedVextor =  V.Vector (V.Vector Int)

Only if you can define an Unbox instance for unboxed vectors (and I
don't know how feasible that is):
http://hackage.haskell.org/packages/archive/vector/0.9/doc/html/Data-Vector-Unboxed.html#t:Unbox

>
> Alternatively I would have to use:
>
>> import qualified Data.Vector.Unboxed as V
>> import qualified Data.Vector as VB
>
> type UnboxedNestedVextor =  VB.Vector (V.Vector Int)
>
> Is there a rule of thumb how much quicker Unboxed Vectors are ?
>
> Cheers Phil
>
>
> --
> View this message in context: 
> http://haskell.1045720.n5.nabble.com/Data-Vector-Unboxed-tp4977289p4977289.html
> Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com

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


[Haskell-cafe] Data.Vector.Unboxed

2011-11-09 Thread kaffeepause73
Hello, 

quick question about unboxed Vectors : 

Is it possible to create an unboxed vector of unboxed vector ? :  

> import qualified Data.Vector.Unboxed as V
> type UnboxedNestedVextor =  V.Vector (V.Vector Int)

Alternatively I would have to use: 

> import qualified Data.Vector.Unboxed as V
> import qualified Data.Vector as VB

type UnboxedNestedVextor =  VB.Vector (V.Vector Int)

Is there a rule of thumb how much quicker Unboxed Vectors are ?

Cheers Phil


--
View this message in context: 
http://haskell.1045720.n5.nabble.com/Data-Vector-Unboxed-tp4977289p4977289.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

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