Re: [Haskell-cafe] How to determine correct dependency versions for a library?

2012-11-12 Thread Erik Hesselink
tl;dr: Breakages without upper bounds are annoying and hard to solve for
package consumers. With upper bounds, and especially with sandboxes,
breakage is almost non-existent.

I don't see how things break with upper bounds, at least in the presence of
sandboxes. If all packages involved follow the PVP, a build that worked
once, will always work. Cabal 0.10 and older had problems here, but 0.14
and later will always find a solution to the dependencies if there is one
(if you set max-backjumps high enough).

Without sandboxes, cabal might have to reinstall a package with different
dependencies, breaking other packages. It will currently warn against this.
Future versions will hopefully tell you about the sandboxing features that
can also be used to avoid this.

In contrast, without upper bounds a packages is almost sure to fail to
compile at some point. A user will then get compile errors outside his own
code, somewhere in the middle of his dependency chain. Depending on his
expertise, this will be either hard or impossible to fix. In particular, it
is not clear that too lenient dependencies are the problem, and if it is
clear, you do not know which ones.

So I still see this as a tradeoff between the interests of package
developers/maintainers (upper bounds give more testing/release work, and
also, they want to use the latest versions) versus package users/companies
(who want a build to work, but often don't care about the bleeding edge).

Personnaly, I fall in both groups, and have experienced both problems. At
Silk, we have (internal) packages with huge dependency chains (we depend on
both happstack and snap). With cabal 0.10, this was a nightmare. Since
0.14, we've had no breakages, except from packages that do not specify
upper bounds! We're fairly up-to-date with GHC versions: we're on 7.4 now,
but with no immediate plans to switch to 7.6. Switching to a new GHC
version is a bit of work, but we can decide when to do the work. Without
upper bounds, our builds can break at any moment, and we have to fix it
then and there to be able to continue working.

If you do have to use the bleeding edge (or a packages uses really outdated
dependencies) you can also use sandboxes to your advantage. Just 'cabal
unpack' the problematic package, change the dependencies and add the
resulting source package to your sandbox. This is what we do when we test
out a new GHC version. We also try to contribute fixes back upstream.

This is why I ask for people to specify upper bounds. They mean that
packages keep working, and they prevent users from getting
incomprehensible, badly timed build failures.

Erik


On Sat, Nov 10, 2012 at 5:16 PM, Roman Cheplyaka r...@ro-che.info wrote:

 * Erik Hesselink hessel...@gmail.com [2012-11-10 16:40:30+0100]
  On Fri, Nov 9, 2012 at 5:52 PM, Roman Cheplyaka r...@ro-che.info
 wrote:
 
   * Janek S. fremenz...@poczta.onet.pl [2012-11-09 17:15:26+0100]
but I am aware that if the library were to be released on Hackage I
would have to supply version numbers in the dependencies. The
 question
is how to determine proper version numbers?
  
   With the current state of affairs, your best bet is not to specify any
   version bounds, or specify only lower ones.
  
   Upper version bounds much more often break things that fix things.
  
 
  I'd like to ask people not to do this. What you're doing then is moving
 the
  burden from the maintainer (who has to test with new versions and relax
  dependencies) to the users of the library (who will be faced with
 breakages
  when new incompatible dependencies are released).

 The trouble is, when things break, they break either way — so I simply
 propose to reduce the probability of things breaking.

 I know, I know, the theory is that Cabal magically installs the right
 versions for you. However, in practice it often can't do that due to
 various reasons (base libraries, package reinstalls etc.)

 I'm not trying to shift the burden from the maintainer — I simply know
 from experience that maintainers are not nearly as quick and responsible
 as would be required for such scheme to work, so as a *user* I'd prefer
 that they omit upper bounds — at least until the --ignore-constraints
 option is implemented.
 (https://github.com/haskell/cabal/issues/949)

 Roman

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


Re: [Haskell-cafe] Hard drive thrashing with modern controllers

2012-11-12 Thread Ketil Malde
timothyho...@seznam.cz writes:

 import Control.Monad
 foo = do
   forever $ writeFile filename.foo Hello world!

I could be wrong, but I suspect this is unlikely to result in (hardly)
any disk operations at all, as long as there is _any_ write caching in
the system.

 will that destroy those sectors of my SSD after the rated 3000 write cycles?

The SSD firmware will even this out by shuffling around the exact flash
blocks that are used, so that's 3K write cycles for each block, spread
out over hundreds of thousands of blocks - so your SSD should survive
perhaps a billion writes in total.

 The reason I ask, is that I have a program here where I would like to save a
 set of files after every change/operation and I'm wondering if I should 
 check if the files I'm saving have actually changed or if this will be 
 handled by the OS...

Unless the loss of a file would be crucial, I wouldn't worry about it.
If/when you wear out the SSD, a replacement will probably be a trivial
cost.

-k

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


Re: [Haskell-cafe] GHC for mobile devices?

2012-11-12 Thread Ivan Perez
I found [1] a few months ago. It outputs Java bytecode, so it should work
on android. Given that Android development in java is very well supported
in eclipse, you might want to use haskell/frege only for the internals of
your program and keep coding your interface in Java.

[1] http://code.google.com/p/frege/

On 10 November 2012 01:51, Andrew Pennebaker andrew.penneba...@gmail.comwrote:

 I'd love to use Haskell directly for making mobiles apps. How can we make
 this happen, porting GHC to Android, iOS, and Windows Phone?

 --
 Cheers,

 Andrew Pennebaker
 www.yellosoft.us

 ___
 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] Motion to unify all the string data types

2012-11-12 Thread Francesco Mazzoli
At Mon, 12 Nov 2012 11:21:42 +0800,
John Lato wrote:
 Speaking as the ListLike maintainer, I'd like this too.  But it's difficult to
 do so without sacrificing performance.  In some cases, sacrificing *a lot* of
 performance.  So they have to be class members.
 
 However, there's no reason ListLike has to remain a single monolithic class.
 I'd prefer an API that's split up into several classes, as was done in Edison.
 Then 'ListLike' itself would just be a type synonym, or possibly a small type
 class with the appropriate superclasses.

Interesting.  Are we sure that we can't convince GHC to inline the functions
with enough pragmas?

 However this seems like a lot of work for relatively little payoff, which
 makes it a low priority for me.

Fair enough.

 The community's view on newtypes is funny.  On the one hand, I see all the
 time the claim Just use a newtype wrapper to write instances for ...
 (e.g. the recent suggestion of 'instance Num a = Num (a,a)'.  On the other,
 nobody actually seems to want to use these newtype wrappers.  Maybe it
 clutters the code?  I don't know.
 
 I couldn't think of a better way to implement this functionality, patches
 would be gratefully accepted.  Anyway, you really shouldn't use these wrappers
 unless you're using a ByteString to represent ASCII text.  Which you shouldn't
 be doing anyway.  If you're using a ByteString to represent a sequence of
 bytes, you needn't ever encounter CharString.

Well newtypes are good, the problem is that either you use well accepted ones
(e.g. the `Sum' and `Product' in base) or otherwise it's not worth it, because
people are going to unpack them and use their owns.  What I would do is simply
define those instances in separate modules.

 Given that text and vector are both in the Haskell Platform, I wouldn't object
 to these instances being rolled into the main ListLike package.  Any comments
 on this?

I think it's much better, especially for Text, since if you use ListLike you are
probably using it with Text (at least in my experience).  Not a big deal anyway.

Francesco.

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


Re: [Haskell-cafe] Motion to unify all the string data types

2012-11-12 Thread Francesco Mazzoli
At Mon, 12 Nov 2012 10:26:01 +,
Francesco Mazzoli wrote:
 Interesting.  Are we sure that we can't convince GHC to inline the functions
 with enough pragmas?

Inline and SPECIALIZE :).

Francesco.

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


[Haskell-cafe] how to inject another source into conduit

2012-11-12 Thread Alexander V Vershilov
Hello.

I have problems with writing next code (using network-conduit)

slightly simplified version:

 app ad = appSource ad $$ sink
   where 
 cMap = M.fromList [ (upload, cmdUpload), (download, cmdDownload) ]
 sink = takeLine = \c - case c of Just run - run ; Nothing - return ()
 cmdUpload = {- ... -} CB.sinkFile path
 cmdDownload = do
 {- code here -}
 CB.sourceFile path $$ appSink ad  -- this will not work because of 
   -- type error

And I'm catching cannot construct the infinite type.

I've found an example in [1], but it's not exactly solves my problem, as all
the logic is inside conduit, and it will break upload function.

[1] http://www.yesodweb.com/blog/2012/06/conduit-0-5

--
Alexander Vershilov


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


Re: [Haskell-cafe] GHC for mobile devices?

2012-11-12 Thread Luke Iannini
Hi All,

https://github.com/ghc-ios/ghc/wiki explains how to get Stephen
Blackheath's GHC fork for iOS running — it's a bumpy road (cleanups
are underway) but I've got Cloud Haskell, ObjectiveHaskell, LevelDB
and my own libraries running wonderfully on my iPad.

I just updated the wiki with a few tweaks for Mountain Lion and Xcode 4.5.2.

Cheers
Luke

On Mon, Nov 12, 2012 at 1:41 AM, Ivan Perez
ivanperezdoming...@gmail.com wrote:

 I found [1] a few months ago. It outputs Java bytecode, so it should work on
 android. Given that Android development in java is very well supported in
 eclipse, you might want to use haskell/frege only for the internals of your
 program and keep coding your interface in Java.

 [1] http://code.google.com/p/frege/

 On 10 November 2012 01:51, Andrew Pennebaker andrew.penneba...@gmail.com
 wrote:

 I'd love to use Haskell directly for making mobiles apps. How can we make
 this happen, porting GHC to Android, iOS, and Windows Phone?

 --
 Cheers,

 Andrew Pennebaker
 www.yellosoft.us

 ___
 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


Re: [Haskell-cafe] ANN: fixed-vector

2012-11-12 Thread Aleksey Khudyakov
 I have a lot of one-off code where I've defined these myself. Is it
 possible to e.g. define vectors in R^2 and R^3, and write the p-norm
 functions only once?


Yes. it's possible.

 {-# LANGUAGE TypeFamilies #-}
 {-# LANGUAGE FlexibleInstances #-}
 {-# LANGUAGE MultiParamTypeClasses #-}
 import Data.Vector.Fixed as V
 import Data.Vector.Fixed.Internal
 -- ^^^ Needed for Fun /will be reexported from Data.Vector.Fixed
 import Data.Vector.Fixed.Unboxed

First we need to define data types and instances. It's possible to use
vectors from library

 data Vec2D a = Vec2D a a

 type instance Dim Vec2D = S (S Z)

 instance Vector Vec2D a where
   inspect (Vec2D x y) (Fun f) = f x y
   construct = Fun Vec2D


 data Vec3D a = Vec3D a a a

 type instance Dim Vec3D = S (S (S Z))

 instance Vector Vec3D a where
   inspect (Vec3D x y z) (Fun f) = f x y z
   construct = Fun Vec3D


Now we can define generic p-norm. Maybe you had something different in
mind but still it's function which will work with any vector of fixed
length.

 pNorm :: (Vector v a, Floating a) = a - v a - a
 pNorm p = (** recip p) . V.sum . V.map ((** p) . abs)

We will get folloiwng in GHCi:

*Main pNorm 1 $ Vec2D 1 2 :: Double
3.0
*Main pNorm 1 $ Vec3D 1 2 3 :: Double
6.0

It's possible to avoid defining data types and use generic vectors
from library. Vec2 is synonym to Data.Vector.Fixed.Unboxed.Vec (S (S Z))

*Main pNorm 2 (vec $ con | 1 | 2 :: Vec2 Double)
2.23606797749979

At the moment their construction is a bit cumbersome
so used replicate to illustrate other vector sizes.

*Main pNorm 1 (V.replicate 1 :: Vec2 Double)
2.0
*Main pNorm 1 (V.replicate 1 :: Vec (S (S (S Z))) Double)
3.0
*Main pNorm 1 (V.replicate 1 :: Vec (S (S (S (S Z Double)
4.0

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


Re: [Haskell-cafe] JavaScript (SpiderMonkey, V8, etc) embedded in GHC?

2012-11-12 Thread Bob Hutchison

On 2012-11-10, at 2:39 PM, Simon Hengel s...@typeful.net wrote:

 Hi,
 
 I've looked around with no success… this surprises me actually. Has
 anyone embedded SpiderMonkey, V8, or any other relatively decent
 JavaScript interpreters in GHC (using the FFI)?
 
 I just started something [1].
 
 Cheers,
 Simon
 
 [1] https://github.com/sol/v8

Nice! Thanks! I'll have a go with it today or tomorrow.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Strange behavior with listArray

2012-11-12 Thread Alex Stangl
On Mon, Nov 12, 2012 at 08:36:49AM +0100, Bas van Dijk wrote:
 On 12 November 2012 04:50, Alex Stangl a...@stangl.us wrote:
  I'm stymied trying to figure out why the program below blows up with
  loop when I use f 0
 If you replace the a!0 in f by its value 0, f is equivalent to:
 
 f k = if k  0
 then f 0
 else 0 : f 1
 
 Do you see the loop now?

I realize it loops/recurses, just like h does, or any instance
of building lazy infinite data structures. It works fine when you
only extract a finite number of elements from the infinite structure.
It's not clear why that is not happening here, as if there is a failure
of laziness.  f 0 should effectively yield [0, 0, ...], correct?


 Maybe you meant f to be:
 
 f k = if k  0
 then f (a!k)
 else 0 : f 1

Actually it was that way in the original program. I switched it to 0
the process of trying to distill it down to a simplest test. Either
way yield the same result, loop. If you take the array reference
out, this code works fine, as it obviously should. But with the array
reference intact, it appears listArray isn't accessing the list lazily
enough.

Thanks,

Alex

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


Re: [Haskell-cafe] Strange behavior with listArray

2012-11-12 Thread Daniel Fischer
On Montag, 12. November 2012, 08:36:49, Bas van Dijk wrote:
 On 12 November 2012 04:50, Alex Stangl a...@stangl.us wrote:
  I'm stymied trying to figure out why the program below blows up with
  loop when I use f 0
 
 If you replace the a!0 in f by its value 0, f is equivalent to:
 
 f k = if k  0
 then f 0
 else 0 : f 1
 
 Do you see the loop now?

I see no loop in that, and ghci doesn't either:

Prelude let f :: Int - [Int]; f k = if k  0 then f 0 else 0 : f 1
Prelude take 5 $ f 1
[0,0,0,0,0]

and if you use (f 0) instead of (f (a!0)) there, it works.

 
 Maybe you meant f to be:
 
 f k = if k  0
 then f (a!k)
 else 0 : f 1

Loops too.

The problem, Alex, is that

f k = if k  0
then f (a!0)
else 0 : f 1

is strict, it needs to know the value of (a!0) to decide which branch to take. 
But the construction of the array a needs to know how long the list (0 : f 0) 
is (well, if it's at least four elements long) before it can return the array. 
So there the cat eats its own tail, f needs to know (a part of) a before it 
can proceed, but a needs to know more of f to return than it does.

g and h  are not strict, they simply let the construction write thunks into 
the array elements, and those can then later be evaluated after the 
construction of a has returned.

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


Re: [Haskell-cafe] Strange behavior with listArray

2012-11-12 Thread Bas van Dijk
On 12 November 2012 14:52, Daniel Fischer
daniel.is.fisc...@googlemail.com wrote:
 I see no loop in that, and ghci doesn't either:

Oops you're right of course.

Bas

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


Re: [Haskell-cafe] How to determine correct dependency versions for a library?

2012-11-12 Thread Johan Tibell
On Mon, Nov 12, 2012 at 1:06 AM, Erik Hesselink hessel...@gmail.com wrote:

 tl;dr: Breakages without upper bounds are annoying and hard to solve for
 package consumers. With upper bounds, and especially with sandboxes,
 breakage is almost non-existent.

 I don't see how things break with upper bounds, at least in the presence
 of sandboxes. If all packages involved follow the PVP, a build that worked
 once, will always work. Cabal 0.10 and older had problems here, but 0.14
 and later will always find a solution to the dependencies if there is one
 (if you set max-backjumps high enough).


The breakage people are talking about with regards to upper bounds is
that every time a new version of a dependency comes out, packages with
upper bounds can't compile with it, even if they would without the upper
bound. For example, the version number of base is bumped with almost every
GHC release, yet almost no packages would actually break to the changes
that caused that major version number to go up.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] how to inject another source into conduit

2012-11-12 Thread Michael Snoyman
I don't think there's enough information in the snippet you've given to
determine what the problem is. And in general, it's a good idea to include
the actual error message from the compiler.


On Mon, Nov 12, 2012 at 5:02 AM, Alexander V Vershilov 
alexander.vershi...@gmail.com wrote:

 Hello.

 I have problems with writing next code (using network-conduit)

 slightly simplified version:

  app ad = appSource ad $$ sink
where
  cMap = M.fromList [ (upload, cmdUpload), (download, cmdDownload)
 ]
  sink = takeLine = \c - case c of Just run - run ; Nothing -
 return ()
  cmdUpload = {- ... -} CB.sinkFile path
  cmdDownload = do
  {- code here -}
  CB.sourceFile path $$ appSink ad  -- this will not work because
 of
-- type error

 And I'm catching cannot construct the infinite type.

 I've found an example in [1], but it's not exactly solves my problem, as
 all
 the logic is inside conduit, and it will break upload function.

 [1] http://www.yesodweb.com/blog/2012/06/conduit-0-5

 --
 Alexander Vershilov

 ___
 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] Quickcheck

2012-11-12 Thread graham
Hi, 

Trying to find some good docs on QuickCheck, if anyone has one ?

Been scanning what I can find, but a question.

What would be the best way to generate two different/distinct integers ?

Use arbitrary ( if so do you have an example ) or a conditional on the
property.

Though I read the later can reduce passing test count.

Thanks
Graham

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


Re: [Haskell-cafe] How to determine correct dependency versions for a library?

2012-11-12 Thread Erik Hesselink
On Mon, Nov 12, 2012 at 5:13 PM, Johan Tibell johan.tib...@gmail.comwrote:

 On Mon, Nov 12, 2012 at 1:06 AM, Erik Hesselink hessel...@gmail.comwrote:

 tl;dr: Breakages without upper bounds are annoying and hard to solve for
 package consumers. With upper bounds, and especially with sandboxes,
 breakage is almost non-existent.

 I don't see how things break with upper bounds, at least in the presence
 of sandboxes. If all packages involved follow the PVP, a build that worked
 once, will always work. Cabal 0.10 and older had problems here, but 0.14
 and later will always find a solution to the dependencies if there is one
 (if you set max-backjumps high enough).


 The breakage people are talking about with regards to upper bounds is
 that every time a new version of a dependency comes out, packages with
 upper bounds can't compile with it, even if they would without the upper
 bound. For example, the version number of base is bumped with almost every
 GHC release, yet almost no packages would actually break to the changes
 that caused that major version number to go up.


Yes, this is why I talk about living on the bleeding edge, and shifting the
burden from package maintainers to package users.

And I believe the last base changes included a change to 'catch' which
would have broken a lot of packages. The Num changes also caused a lot of
code changes, and there were probably more I don't remember.

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


Re: [Haskell-cafe] Strange behavior with listArray

2012-11-12 Thread Alex Stangl
On Mon, Nov 12, 2012 at 02:52:28PM +0100, Daniel Fischer wrote:
 The problem, Alex, is that
 
 f k = if k  0
 then f (a!0)
 else 0 : f 1
 
 is strict, it needs to know the value of (a!0) to decide which branch to 
 take. 
 But the construction of the array a needs to know how long the list (0 : f 0) 
 is (well, if it's at least four elements long) before it can return the 
 array. 
 So there the cat eats its own tail, f needs to know (a part of) a before it 
 can proceed, but a needs to know more of f to return than it does.
 
 g and h  are not strict, they simply let the construction write thunks into 
 the array elements, and those can then later be evaluated after the 
 construction of a has returned.

Thanks for the thoughtful, detailed answer. If you have a function like
f that has conditional logic, and accesses earlier elements in the list
stream, can this be memoized? It appears that constructing an array via
array or listArray won't work, nor does an IntMap. I can layer my list
index [1] on top to speed up the list access, but this isn't as good as
using an array.

Thanks,

Alex

[1] http://github.com/astangl/list-index
 

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


Re: [Haskell-cafe] Hard drive thrashing with modern controllers

2012-11-12 Thread Brandon Allbery
On Mon, Nov 12, 2012 at 4:21 AM, Ketil Malde ke...@malde.org wrote:

 timothyho...@seznam.cz writes:
  import Control.Monad
  foo = do
forever $ writeFile filename.foo Hello world!

 I could be wrong, but I suspect this is unlikely to result in (hardly)
 any disk operations at all, as long as there is _any_ write caching in
 the system.


Maybe no data blocks, but the metadata will be updated.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix/linux, openafs, kerberos, infrastructure  http://sinenomine.net
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Quickcheck

2012-11-12 Thread Simon Hengel
On Mon, Nov 12, 2012 at 07:21:06PM +, gra...@fatlazycat.com wrote:
 Hi, 
 
 Trying to find some good docs on QuickCheck, if anyone has one ?
 
 Been scanning what I can find, but a question.
 
 What would be the best way to generate two different/distinct integers ?

I would use Quickcheck's implication operator here:

quickCheck $ \x y - x /= (y :: Int) == ...

Cheers,
Simon

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


Re: [Haskell-cafe] curl package broken in Windows

2012-11-12 Thread Iavor Diatchki
Hi,

the curl binding certainly needs some love---if anyone has the time to fix
it up and maintain it, help would be most appreciated.  There is a repo for
it over here: https://github.com/GaloisInc/curl which is the most up-to
date version I know of, but since the last commit there seems to be from 4
years ago, I'm not going to bet that there aren't any additional fixes
floating around.  (cc-ing Don, who is listed as the maintainer, but I'm not
sure if he has time to deal with curl right now)

-Iavor



On Sun, Nov 11, 2012 at 3:34 PM, Erik de Castro Lopo
mle...@mega-nerd.comwrote:

 Kevin Cantu wrote:

  With the curl package on Hackage, I merely need an SSL enabled version
  of libcurl, and every Linux distro I've tried this on has several
  variations of such a package.  (You have a choice of OpenSSL or
  GNUTLS, for example.)

 I tried the CURL bindings on Linux some time ago and I personally
 found the thing pretty much un-usable. The API was incomplete,
 inconsistent and way too close to the C API.

 However, I have had much better luck with Michael Snoyman's http-conduit
 package, which being pure Haskell (ie no C) should be much easier to
 install on windows.

 Erik
 --
 --
 Erik de Castro Lopo
 http://www.mega-nerd.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] curl package broken in Windows

2012-11-12 Thread Iustin Pop
On Mon, Nov 12, 2012 at 01:48:23PM -0800, Iavor Diatchki wrote:
 Hi,
 
 the curl binding certainly needs some love---if anyone has the time to fix
 it up and maintain it, help would be most appreciated.  There is a repo for
 it over here: https://github.com/GaloisInc/curl which is the most up-to
 date version I know of, but since the last commit there seems to be from 4
 years ago, I'm not going to bet that there aren't any additional fixes
 floating around.  (cc-ing Don, who is listed as the maintainer, but I'm not
 sure if he has time to deal with curl right now)

I've tried to contact Don multiple times over the past month with offers
of whatever help I can give, but I heard nothing back.

I didn't know about the github repo (it's not listed on the hackage
page), so thanks a lot for that info, I'll try to send some merge
requests and file bugs (there is a least one critical bug w.r.t. SSL
usage on Linux and another small-impact bug with cookie jars usage).

iustin, who uses curl and _really_ wants to see it improved

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


Re: [Haskell-cafe] Quickcheck

2012-11-12 Thread Iustin Pop
On Mon, Nov 12, 2012 at 10:14:30PM +0100, Simon Hengel wrote:
 On Mon, Nov 12, 2012 at 07:21:06PM +, gra...@fatlazycat.com wrote:
  Hi, 
  
  Trying to find some good docs on QuickCheck, if anyone has one ?
  
  Been scanning what I can find, but a question.
  
  What would be the best way to generate two different/distinct integers ?
 
 I would use Quickcheck's implication operator here:
 
 quickCheck $ \x y - x /= (y :: Int) == ...

That's good, but it only eliminates test cases after they have been
generated. A slightly better (IMHO) version is to generate correct
values in the first place:

prop_Test :: Property
prop_Test =
  forAll (arbitrary::Gen Int) $ \x -
  forAll (arbitrary `suchThat` (/= x)) $ \y -
  …

regards,
iustin

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


Re: [Haskell-cafe] curl package broken in Windows

2012-11-12 Thread Iustin Pop
On Mon, Nov 12, 2012 at 10:57:25PM +0100, Iustin Pop wrote:
 On Mon, Nov 12, 2012 at 01:48:23PM -0800, Iavor Diatchki wrote:
  Hi,
  
  the curl binding certainly needs some love---if anyone has the time to fix
  it up and maintain it, help would be most appreciated.  There is a repo for
  it over here: https://github.com/GaloisInc/curl which is the most up-to
  date version I know of, but since the last commit there seems to be from 4
  years ago, I'm not going to bet that there aren't any additional fixes
  floating around.  (cc-ing Don, who is listed as the maintainer, but I'm not
  sure if he has time to deal with curl right now)
 
 I've tried to contact Don multiple times over the past month with offers
 of whatever help I can give, but I heard nothing back.
 
 I didn't know about the github repo (it's not listed on the hackage
 page), so thanks a lot for that info, I'll try to send some merge
 requests and file bugs (there is a least one critical bug w.r.t. SSL
 usage on Linux and another small-impact bug with cookie jars usage).

Hmm, checking again, the github repo is at version 1.3.5 (April 2009),
whereas hackage is at version 1.3.7 (uploaded in May 2011).

Still hunting for a correct upstream project page or tracker…

regards,
iustin

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


[Haskell-cafe] Reminder and Forward: Wednesday 14 November 2012 NYHUG Inaugural Meetup: Ozgun Ataman on Practical Data Processing and Gershom Bazerman on Putting Cloud Haskell to Work

2012-11-12 Thread Jay Sulzberger

Below is a version of the announcement sent to the haskell-cafe
and the haskell mailing lists by Gershom Bazerman on 9 October 2012.

oo--JS.


blockquote
  what=official New York Haskell Users Group announcement

  rsvp=Yes, see below.

  more=http://en.wikipedia.org/wiki/Haskell_%28programming_language%29
[page was last modified on 11 November 2012 at 00:56]
http://www.haskell.org/haskellwiki/Haskell
http://www.reddit.com/r/haskell
http://www.aosabook.org/en/ghc.html

http://en.wikipedia.org/wiki/Type_inference
[page was last modified on 15 September 2012 at 15:37]
http://en.wikipedia.org/wiki/Hindley%E2%80%93Milner
[page was last modified on 9 October 2012 at 17:40]
http://www.users.waitrose.com/~hindley/

http://www.cs.ru.nl/~henk/

http://www.usingz.com/

http://en.wikipedia.org/wiki/Curry-Howard
[page was last modified on 14 September 2012 at 22:01]
http://www.paultaylor.eu/stable/prot.pdf

ftp://ftp.cs.cmu.edu/usr/rwh/www/home/courses/logic/www/handouts/curry-howard.pdf
http://www.students.science.uu.nl/~3448584/TypeSystems.pdf


http://www.math.ias.edu/~vladimir/Site3/Univalent_Foundations_files/2011_Goteborg.pdf


http://math.andrej.com/2012/11/08/how-to-implement-dependent-type-theory-i/

http://math.andrej.com/2012/11/11/how-to-implement-dependent-type-theory-ii/
http://math.andrej.com/2012/10/03/am-i-a-constructive-mathematician/;

  exclamation-of-old-lisper-upon-first-seeing-curry-howard-theorem: But this
is clearly wrong!  Look I have a function string-length which has type
String-Int, but 'String-Int' is not a theorem of any usual 
intuitionistic
propositional logic.

  insight-of-newbie-coming-to-haskell-from-lisp: Lisp's now buried background
would require, if a student of Lisp were to ask for an outline of this
background, a book of perhaps a hundred pages.
Haskell, and more generally, all the New Crazy Types programming 
systems,
would require three hundred pages.

  edits=some adventitious markup and some blank space removed

 Subject: Wednesday 14 November, NY Haskell Inaugural Meetup: Practical Data 
Processing _and_ Putting Cloud Haskell to Work
 Date:  Fri, 12 Oct 2012 18:05:02 -0400
 From:  Gershom B gersh...@gmail.com
 To:l...@lispnyc.org

 ==
 What:   New York Haskell Users Group Meeting
 When:  Wednesday, November 14, 2012
  7 PM - 9 PM
 Where: Pivotal Labs, 841 Broadway, 8th floor
   (Just south of Union Square)
   http://maps.google.com/maps?q=841+Broadway,+New+York

 RSVP:   http://www.meetup.com/NY-Haskell/
 ==

 * 7 PM - Practical Data Processing With Haskell

 * 8 PM - Putting Cloud Haskell to Work for Distributed Computing

 
--

 7 PM - Practical Data Processing With Haskell:
 Ozgun Ataman will give an introductory talk on Haskell, diving right
 in with how you can start using Haskell for practical data
 manipulation tasks today. You'll be introduced to a typical setup for
 Haskell development and given a demonstration of how a common data
 format (CSV, JSON, etc.) can be parsed, processed and finally output
 using Haskell. The talk will include a small actual Haskell program to
 be modified live and some commentary around using Haskell in practical
 applications.

 8 PM - Putting Cloud Haskell to Work for Distributed Computing:
 Gershom Bazerman will give an overview of the new distributed-process
 library that implements Cloud Haskell, providing computation across
 heterogeneous nodes through a message passing interface. He will
 discuss what this new tool provides out of the box, and what you'll
 have to bring to the table. The talk will include some code samples
 using the new library, as well as some experience about what it's like
 to use Haskell for distributed computing in the real world.

 Speaker Biographies: Ozgun Ataman is the founder of Soostone, a
 management consulting and analytics company built on Haskell. He is
 the author of many open-source Haskell libraries, and is a contributor
 to the Snap web framework. Gershom Bazerman is a developer at SP
 Capital IQ. He is most well known in the Haskell community as the
 author of the JMacro library for programmatic generation of
 JavaScript, and for one well-received April fools joke.

 
--

 We're kicking off the New York Haskell Users Group with two great
 talks, one for people just getting started and one for those with some
 experience already. Both should be accessible and enjoyable no matter
 how much (or little) you already know. Food and refreshments will be
 provided, courtesy of 

Re: [Haskell-cafe] curl package broken in Windows

2012-11-12 Thread Iavor Diatchki
Hi,

Ok, there were only minor differences between the repo and the version on
hackage so I imported the changes into the repo, which should now be the
same as version 1.3.7 on hackage.
Please feel free to submit merge requestsall the folks I know who
worked on this originally are busy with other stuff, so we really need
someone who's using the library to help.

Thanks!
-Iavor



On Mon, Nov 12, 2012 at 2:06 PM, Iustin Pop iu...@k1024.org wrote:

 On Mon, Nov 12, 2012 at 10:57:25PM +0100, Iustin Pop wrote:
  On Mon, Nov 12, 2012 at 01:48:23PM -0800, Iavor Diatchki wrote:
   Hi,
  
   the curl binding certainly needs some love---if anyone has the time to
 fix
   it up and maintain it, help would be most appreciated.  There is a
 repo for
   it over here: https://github.com/GaloisInc/curl which is the most
 up-to
   date version I know of, but since the last commit there seems to be
 from 4
   years ago, I'm not going to bet that there aren't any additional fixes
   floating around.  (cc-ing Don, who is listed as the maintainer, but
 I'm not
   sure if he has time to deal with curl right now)
 
  I've tried to contact Don multiple times over the past month with offers
  of whatever help I can give, but I heard nothing back.
 
  I didn't know about the github repo (it's not listed on the hackage
  page), so thanks a lot for that info, I'll try to send some merge
  requests and file bugs (there is a least one critical bug w.r.t. SSL
  usage on Linux and another small-impact bug with cookie jars usage).

 Hmm, checking again, the github repo is at version 1.3.5 (April 2009),
 whereas hackage is at version 1.3.7 (uploaded in May 2011).

 Still hunting for a correct upstream project page or tracker…

 regards,
 iustin

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


Re: [Haskell-cafe] How to determine correct dependency versions for a library?

2012-11-12 Thread eyal.lo...@gmail.com
Especially in the case of base, not sure how upper bounds help at all:

If incompatible, you break with or without upper bounds. Actually getting 
errors related to Num instances is more informative IMO. 
If compatible, you just get false negatives and errors. 
In either case cabal can't install an older base to make the build work, so 
what do you gain? ___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] curl package broken in Windows

2012-11-12 Thread Michael Orlitzky
On 11/12/12 17:43, Iavor Diatchki wrote:
 Hi,
 
 Ok, there were only minor differences between the repo and the version
 on hackage so I imported the changes into the repo, which should now be
 the same as version 1.3.7 on hackage.
 Please feel free to submit merge requestsall the folks I know who
 worked on this originally are busy with other stuff, so we really need
 someone who's using the library to help.
 

I reported this a while ago, and Iustin gave an awesome explanation of
the problem:

http://haskell.1045720.n5.nabble.com/Network-Curl-cookie-jar-madness-td5716344.html

I've since switched to http-conduit for that project but it would be
nice to have curl working anyway because it requires less thinking. If
someone's going to maintain it, then consider this a bug report!

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


Re: [Haskell-cafe] ANN: fixed-vector

2012-11-12 Thread Michael Orlitzky
On 11/12/12 01:57, Carter Schonwald wrote:
 Michael, I think that calls for a type-class! 
 (though I imagine theres a slicker way of writing it)
 

I'm already using typeclasses, but there's still a bit of boilerplate. I
could probably think of something more clever myself, but like I said,
these are just one-off experiments, and I'm lazy. So I'm hoping
fixed-vector will do it for me!


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


Re: [Haskell-cafe] ANN: fixed-vector

2012-11-12 Thread Michael Orlitzky
On 11/12/12 07:05, Aleksey Khudyakov wrote:
 I have a lot of one-off code where I've defined these myself. Is it
 possible to e.g. define vectors in R^2 and R^3, and write the p-norm
 functions only once?

 
 Yes. it's possible.
 
 {-# LANGUAGE TypeFamilies #-}
 {-# LANGUAGE FlexibleInstances #-}
 {-# LANGUAGE MultiParamTypeClasses #-}
 import Data.Vector.Fixed as V
 import Data.Vector.Fixed.Internal
 -- ^^^ Needed for Fun /will be reexported from Data.Vector.Fixed
 import Data.Vector.Fixed.Unboxed
 
 First we need to define data types and instances. It's possible to use
 vectors from library
 
 ...

Thanks, this looks like exactly what I need. I'll try to replace my R^2
and R^3 implementations the next time I do my homework before the last
minute.

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


Re: [Haskell-cafe] JavaScript (SpiderMonkey, V8, etc) embedded in GHC?

2012-11-12 Thread Simon Hengel
 Out of curiosity: wouldn't it make more sense to focus on the
 other direction (calling Haskell from V8)? Roughly like:

I guess it really depends what you are after.  If you want to cabalize
existing JS libs, then I think bindings to V8 make perfect sense ;)

Cheers,
Simon

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