Re: [Haskell-cafe] Long pauses / idle time in a Haskell TCP server

2012-10-09 Thread Alex Iliev
Thanks for the tip Jamie! Setting NODELAY on the *client* resolved the
problem; setting it on the server (both sockets) didn't make a difference.
I'll see if I can figure out more about how this was going wrong - I did
check the network traffic and the delay was at the server. But now I have a
good setup to work with further.

I did have your code from github, but from a while back, not long after you
posted 0.2.2 to Hackage. I tinkered it a fair amount - stuff like where
queues and worker threads are used, there are lots of options with that,
especially given that thread creation is cheap so one doesn't necessarily
need to use thread pools like in some other languages. Now I can play with
those variations without distraction from long pauses. And I'll grab your
latest from github and try that out.

Thanks!

Alex


On Mon, Oct 8, 2012 at 6:41 PM, Jamie Turner ja...@bu.mp wrote:

  I'm seeing long pauses in a server based on the 'scalable-server'
  package from Hackage, version 0.2.2 [1]. It normally performs very
  well, about 100-150 micro-secs client latency over the loopback
  interface, but a fair number of requests are much slower, 38-40
  milli-secs, making the mean latency and throughput quite bad.

 Hi Alex--author of scalable-server here.

 38ms sounds like Nagle's algorithm.
 (http://en.wikipedia.org/wiki/Nagle's_algorithm)  In short, the socket
 is waiting on sending a small amount of data to see if the application
 wants to send more data.  If so, the kernel can repack the data
 together so that it all can be switched in one TCP packet.

 You need to set NoDelay (TCP_NODELAY) if you want to disable this
 behavior; scalable-server doesn't currently have a flag to configure
 this, but I'm open to pull requests!

 (Also, are you using hackage scalable-server, or the new scalable
 server based on conduit on github?  I'd recommend switching to the
 github version if not.  A few key bugs exist in the older
 implementation.)

  - Jamie

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


[Haskell-cafe] Type of scramblings

2012-10-09 Thread Roman Cheplyaka
I am reading through Oleg's Eliminating translucent existentials[1].

[1]: http://okmij.org/ftp/Computation/Existentials.html#eliminating-translucent

He draws a distinction between
  
  forall a . [a] - [a]

and

  forall a . [a]^n - [a]

as types of scramblings. This is something I'm struggling to understand.

First of all, I think here we're talking about total functions, otherwise
there's no point in introducing dependent types.

There are of course more total functions of type `[a]^n - [a]` than of type
`[a] - [a]`, in the sense that any term of the latter type can be assigned the
former type. But, on the other hand, any total function `f :: [a]^n - [a]`
has an equivalent total function

  g :: [a] - [a]
  g xs | length xs == n = f xs
   | otherwise = xs

(The condition `length xs == n` can be replaced by a similar condition that also
works for infinite lists.)

The functions `f` and `g` are equivalent in the sense that for any list `xs` of
length `n` `f xs === g xs`. Thus, even though it seems that we allow more total
functions by replacing `[a]` with `[a]^n`, that doesn't buy us any additional
expressiveness.

What am I missing?

Roman

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


Re: [Haskell-cafe] ANN: cabal-install-1.16.0 (and Cabal-1.16.0.1)

2012-10-09 Thread Herbert Valerio Riedel
Johan Tibell johan.tib...@gmail.com writes:

 I'll make a bugfix release for cabal-install and Cabal in a few days
 to include fixes to issues people found so far. If everyone who had
 some problem related to the latest release could please post it here
 so I can make sure that we include a fix for them. If you've already
 reported it elsewhere, please bring it up here anyway to make sure I
 don't miss it.

btw, what about Cabal being agnostic to some recent GHC language
extensions, i.e.:

 https://github.com/haskell/cabal/issues/1050 

is that one eligible for a point release?


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


Re: [Haskell-cafe] 64-bit vs 32-bit haskell platform on Mac: misleading notice on Platform website?

2012-10-09 Thread Christiaan Baaij
I've filed a bug report: http://hackage.haskell.org/trac/ghc/ticket/7314

My only problem is that I don't have OS X 10.8 installed on my machine.
I'm running OS X 10.6, and am not inclined to upgrade.
So providing feedback on the questions related to the bug report will be hard 
and/or take some time.

-- Christiaan

On Oct 8, 2012, at 4:25 PM, Johan Tibell wrote:

 Could you please file a bug report at:
 
 http://hackage.haskell.org/trac/ghc/
 
 Thanks!


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


[Haskell-cafe] problem with cabal-install-1.16.0 and Cabal-1.16.0.1 on Haskell Platform for OS X

2012-10-09 Thread Derrell Piper
Hi,

New Haskell user here.  I have the latest Haskell Platform 2012.2.0.0 for Mac 
OS X, 64 bit installed.  I have not installed any additional packages.  Believe 
me, the Prelude hurts enough.  Anyways, seeing the big update to cabal, I 
decided to install it and did a: 

cabal install cabal-install-1.16.0 Cabal-1.16.0.1

...per the announcement.  The installation seemingly went well (log attached) 
but I'm left with a symlink farm that's still pointing at the old version.  NB: 
I did the installation in my own account (ddp), not via sudo which looks like 
what was probably expected given the ownerships I do see.  Here's what I'm left 
with:

% which cabal
/usr/bin/cabal
% ls -la /usr/bin/cabal
lrwxr-xr-x  1 root  wheel  - 26 Oct  8 16:42 /usr/bin/cabal - 
/Library/Haskell/bin/cabal
% ls -la /Library/Haskell/bin/cabal*
lrwxr-xr-x  1 ddp   wheel  -   10 Oct  8 16:42 /Library/Haskell/bin/cabal - 
cabal.wrap
lrwxr-xr-x  1 ddp   wheel  -   37 Oct  8 16:42 /Library/Haskell/bin/cabal.real 
- ../lib/cabal-install-0.14.0/bin/cabal
-rwxr-xr-x  1 root  admin  - 4197 May 27 12:37 /Library/Haskell/bin/cabal.wrap

I find that it actually installed itself here:

% ls -la ~/Library/Haskell/bin/cabal*
lrwxr-xr-x  1 ddp  staff  - 47 Oct  8 20:45 
/Users/ddp/Library/Haskell/bin/cabal - 
../ghc-7.4.1/lib/cabal-install-1.16.0/bin/cabal

So I guess my questions are:

1) did I miss some step along the way?
2) what's the correct way to fix this?  Just change the cabal.real symlink to 
point to where it actually is?
3) which, if any, directories should I have in my PATH in general: 
/Library/Haskell/bin, ~/Library/Haskell/bin, neither or both?

Thanks,

Derrell

Installation log:

fluffy512% cabal --version
cabal-install version 0.14.0
using version 1.14.0 of the Cabal library 
fluffy513% cabal update
Downloading the latest package list from hackage.haskell.org
Note: there is a new version of cabal-install available.
To upgrade, run: cabal install cabal-install
fluffy514% cabal install cabal-install-1.16.0 Cabal-1.16.0.1
Resolving dependencies...
[ 1 of 65] Compiling Distribution.Compat.Exception ( 
/var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/Distribution/Compat/Exception.hs,
 
/var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/dist/setup/Distribution/Compat/Exception.o
 )
[ 2 of 65] Compiling Distribution.Compat.TempFile ( 
/var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/Distribution/Compat/TempFile.hs,
 
/var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/dist/setup/Distribution/Compat/TempFile.o
 )
[ 3 of 65] Compiling Distribution.Compat.CopyFile ( 
/var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/Distribution/Compat/CopyFile.hs,
 
/var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/dist/setup/Distribution/Compat/CopyFile.o
 )
[ 4 of 65] Compiling Distribution.GetOpt ( 
/var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/Distribution/GetOpt.hs,
 
/var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/dist/setup/Distribution/GetOpt.o
 )
[ 5 of 65] Compiling Distribution.Compat.ReadP ( 
/var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/Distribution/Compat/ReadP.hs,
 
/var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/dist/setup/Distribution/Compat/ReadP.o
 )
[ 6 of 65] Compiling Distribution.Text ( 
/var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/Distribution/Text.hs,
 
/var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/dist/setup/Distribution/Text.o
 )
[ 7 of 65] Compiling Distribution.Version ( 
/var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/Distribution/Version.hs,
 
/var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/dist/setup/Distribution/Version.o
 )
[ 8 of 65] Compiling Language.Haskell.Extension ( 
/var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/Language/Haskell/Extension.hs,
 
/var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/dist/setup/Language/Haskell/Extension.o
 )
[ 9 of 65] Compiling Distribution.TestSuite ( 
/var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/Distribution/TestSuite.hs,
 
/var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/dist/setup/Distribution/TestSuite.o
 )
[10 of 65] Compiling Distribution.System ( 
/var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/Distribution/System.hs,
 
/var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/dist/setup/Distribution/System.o
 )
[11 of 65] Compiling 

Re: [Haskell-cafe] problem with cabal-install-1.16.0 and Cabal-1.16.0.1 on Haskell Platform for OS X

2012-10-09 Thread Johan Tibell
Hi,

Thanks for the detailed problem description. I've CCed Mark Lentczner,
who designed the directory layout for the Haskell Platform on OS X.
Hopefully he'll be able to tell you what to do.

On Tue, Oct 9, 2012 at 8:31 AM, Derrell Piper d...@electric-loft.org wrote:
 Hi,

 New Haskell user here.  I have the latest Haskell Platform 2012.2.0.0 for Mac 
 OS X, 64 bit installed.  I have not installed any additional packages.  
 Believe me, the Prelude hurts enough.  Anyways, seeing the big update to 
 cabal, I decided to install it and did a:

 cabal install cabal-install-1.16.0 Cabal-1.16.0.1

 ...per the announcement.  The installation seemingly went well (log attached) 
 but I'm left with a symlink farm that's still pointing at the old version.  
 NB: I did the installation in my own account (ddp), not via sudo which looks 
 like what was probably expected given the ownerships I do see.  Here's what 
 I'm left with:

 % which cabal
 /usr/bin/cabal
 % ls -la /usr/bin/cabal
 lrwxr-xr-x  1 root  wheel  - 26 Oct  8 16:42 /usr/bin/cabal - 
 /Library/Haskell/bin/cabal
 % ls -la /Library/Haskell/bin/cabal*
 lrwxr-xr-x  1 ddp   wheel  -   10 Oct  8 16:42 /Library/Haskell/bin/cabal - 
 cabal.wrap
 lrwxr-xr-x  1 ddp   wheel  -   37 Oct  8 16:42 
 /Library/Haskell/bin/cabal.real - ../lib/cabal-install-0.14.0/bin/cabal
 -rwxr-xr-x  1 root  admin  - 4197 May 27 12:37 /Library/Haskell/bin/cabal.wrap

 I find that it actually installed itself here:

 % ls -la ~/Library/Haskell/bin/cabal*
 lrwxr-xr-x  1 ddp  staff  - 47 Oct  8 20:45 
 /Users/ddp/Library/Haskell/bin/cabal - 
 ../ghc-7.4.1/lib/cabal-install-1.16.0/bin/cabal

 So I guess my questions are:

 1) did I miss some step along the way?
 2) what's the correct way to fix this?  Just change the cabal.real symlink to 
 point to where it actually is?
 3) which, if any, directories should I have in my PATH in general: 
 /Library/Haskell/bin, ~/Library/Haskell/bin, neither or both?

 Thanks,

 Derrell

 Installation log:

 fluffy512% cabal --version
 cabal-install version 0.14.0
 using version 1.14.0 of the Cabal library
 fluffy513% cabal update
 Downloading the latest package list from hackage.haskell.org
 Note: there is a new version of cabal-install available.
 To upgrade, run: cabal install cabal-install
 fluffy514% cabal install cabal-install-1.16.0 Cabal-1.16.0.1
 Resolving dependencies...
 [ 1 of 65] Compiling Distribution.Compat.Exception ( 
 /var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/Distribution/Compat/Exception.hs,
  
 /var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/dist/setup/Distribution/Compat/Exception.o
  )
 [ 2 of 65] Compiling Distribution.Compat.TempFile ( 
 /var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/Distribution/Compat/TempFile.hs,
  
 /var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/dist/setup/Distribution/Compat/TempFile.o
  )
 [ 3 of 65] Compiling Distribution.Compat.CopyFile ( 
 /var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/Distribution/Compat/CopyFile.hs,
  
 /var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/dist/setup/Distribution/Compat/CopyFile.o
  )
 [ 4 of 65] Compiling Distribution.GetOpt ( 
 /var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/Distribution/GetOpt.hs,
  
 /var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/dist/setup/Distribution/GetOpt.o
  )
 [ 5 of 65] Compiling Distribution.Compat.ReadP ( 
 /var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/Distribution/Compat/ReadP.hs,
  
 /var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/dist/setup/Distribution/Compat/ReadP.o
  )
 [ 6 of 65] Compiling Distribution.Text ( 
 /var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/Distribution/Text.hs,
  
 /var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/dist/setup/Distribution/Text.o
  )
 [ 7 of 65] Compiling Distribution.Version ( 
 /var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/Distribution/Version.hs,
  
 /var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/dist/setup/Distribution/Version.o
  )
 [ 8 of 65] Compiling Language.Haskell.Extension ( 
 /var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/Language/Haskell/Extension.hs,
  
 /var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/dist/setup/Language/Haskell/Extension.o
  )
 [ 9 of 65] Compiling Distribution.TestSuite ( 
 /var/folders/sm/f2yb5sp11490bcy5k6t46v20gn/T/Cabal-1.16.0.1-48304/Cabal-1.16.0.1/Distribution/TestSuite.hs,
  
 

Re: [Haskell-cafe] Ordering of BigFloats in numbers-3000.0.0.0

2012-10-09 Thread Chaddaï Fouché
On Sun, Oct 7, 2012 at 8:00 PM, Michael Orlitzky mich...@orlitzky.com wrote:
 I'm trying to use,

   http://hackage.haskell.org/package/numbers-3000.0.0.0

 to get better precision for free out of some numerical code. I ran
 into an issue pretty quickly, though. In Data.Number.BigFloat, we have,

   data BigFloat e = BF (Fixed e) Integer
 deriving (Eq, Ord)

 and the derived Ord is obviously incorrect:

   Prelude Data.Number.BigFloat let x = 0.1 :: BigFloat Prec50
   Prelude Data.Number.BigFloat let y = 0.02 :: BigFloat Prec50
   Prelude Data.Number.BigFloat x  y
   True


That's pretty strange since the derived Ord should be the same as
Fixed Ord, which itself is just a newtype over Rational (and 1%10 
2%100 == False), did you try to convert those BigFloat back to
Rational to see if they're still correct ? That may be worse than a
misbehaving Ord instance.

-- 
Jedaï

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


Re: [Haskell-cafe] Ordering of BigFloats in numbers-3000.0.0.0

2012-10-09 Thread Michael Orlitzky
On 10/09/2012 12:29 PM, Chaddaï Fouché wrote:
 On Sun, Oct 7, 2012 at 8:00 PM, Michael Orlitzky mich...@orlitzky.com wrote:
 I'm trying to use,

   http://hackage.haskell.org/package/numbers-3000.0.0.0

 to get better precision for free out of some numerical code. I ran
 into an issue pretty quickly, though. In Data.Number.BigFloat, we have,

   data BigFloat e = BF (Fixed e) Integer
 deriving (Eq, Ord)

 and the derived Ord is obviously incorrect:

   Prelude Data.Number.BigFloat let x = 0.1 :: BigFloat Prec50
   Prelude Data.Number.BigFloat let y = 0.02 :: BigFloat Prec50
   Prelude Data.Number.BigFloat x  y
   True

 
 That's pretty strange since the derived Ord should be the same as
 Fixed Ord, which itself is just a newtype over Rational (and 1%10 
 2%100 == False), did you try to convert those BigFloat back to
 Rational to see if they're still correct ? That may be worse than a
 misbehaving Ord instance.
 

The BigFloat constructor doesn't do what you think it does... I chose a
bad spot to snip the comments:

  -- This representation is stupid, two Integers makes more sense,
  -- but is more work.
  -- | Floating point number where the precision is determined by the
  --   type /e/.
  data BigFloat e = BF (Fixed e) Integer
deriving (Eq)

If it was two Integers, I think it would be more clear that this is what
will happen:

  *Data.Number.BigFloat let x = 0.1 :: BigFloat Prec50
  *Data.Number.BigFloat let y = 0.02 :: BigFloat Prec50
  *Data.Number.BigFloat let BF m1 e1 = x
  *Data.Number.BigFloat let BF m2 e2 = y
  *Data.Number.BigFloat (m1,e1)
  (1.00,-1)
  *Data.Number.BigFloat (m2,e2)
  (2.00,-2)

The fast way to compare them would be to check the mantissa/exponent
directly, but toRational works just fine. I made a pull request
yesterday that compares them as rationals.

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


Re: [Haskell-cafe] total Data.Map.! function

2012-10-09 Thread Henning Thielemann


Hi Joachim,


On Wed, 5 Oct 2012, Joachim Breitner wrote:


On Wed, 3 Oct 2012, Henning Thielemann wrote:

I wondered whether there is a brilliant typing technique that makes 
Data.Map.! a total function. That is, is it possible to give (!) a 
type, such that m!k expects a proof that the key k is actually present 
in the dictionary m? How can I provide the proof that k is in m?
 Same question for 'lab' (import Data.Graph.Inductive(lab)). That is, 
can there be a totalLab, with (totalLab gr = fromJust . lab gr) that 
expects a proof that the node Id is actually contained in a graph?


I think it is possible to do this using the same trick that ST is using, 
i.e. rank 2 types. The problem is that this code is likely to be 
unwieldy to use, as the variable needs to change with every change to 
the map – but I guess if you create your map once and then use it in 
various places without modification, this can actually work.


 Thank you for your detailed answer! I thought about such a tagging method 
but was missing your idea of updating tags of existing keys in order to 
reflect the knowledge about newly added keys.
 Your solution will certainly work for the set of methods you have 
implemented. All of your methods extend the set of keys or preserve it. 
But what about deletion? The certificate that key k is contained in a Map 
must be invalidated by the deletion of k. How could I add this to your 
approach?
 Maybe I should track the operations applied to the keys of a map and 
provide algebraic simplifications, like so:


   insert ::
  Ord k =
  Tagged s k - v - Tagged m (Map k v) -
  Tagged (Insert s m) (Map k v)

   lookup ::
  Ord k =
  Tagged s k - Tagged (Insert s m) (Map k v) - v

   -- * example simplifications

   commuteInsert ::
  Tagged (Insert s0 (Insert s1 m)) (Map k v) -
  Tagged (Insert s1 (Insert s0 m)) (Map k v)

   simplifyInsertInsert ::
  Tagged (Insert s (Insert s m)) (Map k v) -
  Tagged (Insert s m) (Map k v)

   simplifyInsertDelete ::
  Tagged (Insert s (Delete s m)) (Map k v) -
  Tagged (Insert s m) (Map k v)

   simplifyDeleteInsert ::
  Tagged (Delete s (Insert s m)) (Map k v) -
  Tagged (Delete s m) (Map k v)


   example =
  lookup k0 $ commuteInsert $
  insert k1 for $ insert k0 bar m


 I also thought about something like the exceptions trick. That is, a 
context like


   (ContainsKeyA k, ContainsKeyB k) = Map k x

 might tell that certain keys are in the Map. However, this would not only 
mean that I need a type class for every insertion, it would also not work 
reliably for deletion. If keyA = keyB, then deletion of keyA must also 
remove the ContainsKeyB constraint. :-(


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


[Haskell-cafe] OpenGL library will not load into GHCi 7.6.1 on Win7 x86-64

2012-10-09 Thread Dan Haraj
This is a regression of some sort since the library operates fine within
GHCi for previous versions of GHC. I don't know whether it is a problem
with GHCi, the OpenGL library, or some third party. This is the error
encountered when a module that uses OpenGL tries to load:

Prelude Main main
Loading package OpenGLRaw-1.2.0.0 ... linking ... ghc.exe: unable to load
package `OpenGLRaw-1.2.0.0'
Prelude Main :q
Leaving GHCi.
interactive: C:\...\OpenGLRaw-1.2.0.0\ghc-7.6.1\HSOpenGLRaw-1.2.0.0.o:
unknown symbol `__imp_wglGetProcAddress'

I have very little of an idea of what's going on here. It would be rather
painful to debug this myself so any insight is appreciated.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: New York Haskell Users Group -- First Meeting on Wed., Nov 14.

2012-10-09 Thread Gershom B
The (arguably) greatest city in the U.S. now (finally) has a users
group for (unarguably) the greatest programming language anywhere.
We're very happy to announce the inaugural meeting of the New York
Haskell Users Group. We intend this group to be welcoming to new
developers, but with enough substance to keep old Haskell hands
interested and amused. If you're in the area but can't make it, you
can join the meetup regardless at http://www.meetup.com/NY-Haskell/ to
stay informed of future events. We plan to have a mix of talks and
experience reports at all levels, so if you will be passing through
town and might have something to say, let us know!

Two Haskell Talks:
Practical Data Processing With Haskell _and_ Putting Cloud Haskell to Work

Wednesday, November 14, 2012
7:00 PM To 9:00 PM

Pivotal Labs, 841 Broadway New York, NY

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

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 the generosity of Pivotal Labs, and after the
talks, we're planning to keep the discussion going over food and drink
at a nearby establishment.

7pm - 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.

8pm - 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
managment 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.

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


Re: [Haskell-cafe] OpenGL library will not load into GHCi 7.6.1 on Win7 x86-64

2012-10-09 Thread Jason Dagit
On Tue, Oct 9, 2012 at 1:55 PM, Dan Haraj devha...@gmail.com wrote:

 This is a regression of some sort since the library operates fine within
 GHCi for previous versions of GHC. I don't know whether it is a problem
 with GHCi, the OpenGL library, or some third party. This is the error
 encountered when a module that uses OpenGL tries to load:

 Prelude Main main
 Loading package OpenGLRaw-1.2.0.0 ... linking ... ghc.exe: unable to load
 package `OpenGLRaw-1.2.0.0'
 Prelude Main :q
 Leaving GHCi.
 interactive: C:\...\OpenGLRaw-1.2.0.0\ghc-7.6.1\HSOpenGLRaw-1.2.0.0.o:
 unknown symbol `__imp_wglGetProcAddress'

 I have very little of an idea of what's going on here. It would be rather
 painful to debug this myself so any insight is appreciated.


I don't know the solution or the culprit, but normally that symbol is
defined in opengl32.lib/dll and the OpenGLRaw cabal file mentions it as an
extra library.

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


Re: [Haskell-cafe] object file cannot be loaded.

2012-10-09 Thread Magicloud Magiclouds
Seems like an issue with fedora17's ld. I altered it with ld.gold. Working.

On Tue, Oct 9, 2012 at 7:33 AM, Magicloud Magiclouds
magicloud.magiclo...@gmail.com wrote:
 Could anyone help me on this?

 On Sun, Oct 7, 2012 at 10:34 AM, Magicloud Magiclouds
 magicloud.magiclo...@gmail.com wrote:
 There is none

 On Sun, Oct 7, 2012 at 4:27 AM, Thomas Schilling
 nomin...@googlemail.com wrote:
 Does `ghc-pkg check` report any issues?

 On 6 October 2012 15:24, Magicloud Magiclouds
 magicloud.magiclo...@gmail.com wrote:
 Hi,
   I am installing postgres hackage (cannot remember the exact name
 right now). When it compiling the template haskell part I got the
 following error message.
   I tried to clear all user space hackages. Not helping.

 Loading package text-0.11.2.3 ... linking ... ghc:
 /home/magicloud/.cabal/lib/text-0.11.2.3/ghc-7.6.1/HStext-0.11.2.3.o:
 unknown symbol 
 `bytestringzm0zi10zi0zi1_DataziByteStringziInternal_PS_con_info'
 ghc: unable to load package `text-0.11.2.3'
 --
 竹密岂妨流水过
 山高哪阻野云飞

 And for G+, please use magiclouds#gmail.com.

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



 --
 Push the envelope. Watch it bend.



 --
 竹密岂妨流水过
 山高哪阻野云飞

 And for G+, please use magiclouds#gmail.com.



 --
 竹密岂妨流水过
 山高哪阻野云飞

 And for G+, please use magiclouds#gmail.com.



-- 
竹密岂妨流水过
山高哪阻野云飞

And for G+, please use magiclouds#gmail.com.

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


Re: [Haskell-cafe] Ordering of BigFloats in numbers-3000.0.0.0

2012-10-09 Thread Carter Schonwald
you should probably file a ticket on the DanBurton repo if he's the one
doing the uploading
 :-)


On Tue, Oct 9, 2012 at 12:55 PM, Michael Orlitzky mich...@orlitzky.comwrote:

 On 10/09/2012 12:29 PM, Chaddaï Fouché wrote:
  On Sun, Oct 7, 2012 at 8:00 PM, Michael Orlitzky mich...@orlitzky.com
 wrote:
  I'm trying to use,
 
http://hackage.haskell.org/package/numbers-3000.0.0.0
 
  to get better precision for free out of some numerical code. I ran
  into an issue pretty quickly, though. In Data.Number.BigFloat, we have,
 
data BigFloat e = BF (Fixed e) Integer
  deriving (Eq, Ord)
 
  and the derived Ord is obviously incorrect:
 
Prelude Data.Number.BigFloat let x = 0.1 :: BigFloat Prec50
Prelude Data.Number.BigFloat let y = 0.02 :: BigFloat Prec50
Prelude Data.Number.BigFloat x  y
True
 
 
  That's pretty strange since the derived Ord should be the same as
  Fixed Ord, which itself is just a newtype over Rational (and 1%10 
  2%100 == False), did you try to convert those BigFloat back to
  Rational to see if they're still correct ? That may be worse than a
  misbehaving Ord instance.
 

 The BigFloat constructor doesn't do what you think it does... I chose a
 bad spot to snip the comments:

   -- This representation is stupid, two Integers makes more sense,
   -- but is more work.
   -- | Floating point number where the precision is determined by the
   --   type /e/.
   data BigFloat e = BF (Fixed e) Integer
 deriving (Eq)

 If it was two Integers, I think it would be more clear that this is what
 will happen:

   *Data.Number.BigFloat let x = 0.1 :: BigFloat Prec50
   *Data.Number.BigFloat let y = 0.02 :: BigFloat Prec50
   *Data.Number.BigFloat let BF m1 e1 = x
   *Data.Number.BigFloat let BF m2 e2 = y
   *Data.Number.BigFloat (m1,e1)
   (1.00,-1)
   *Data.Number.BigFloat (m2,e2)
   (2.00,-2)

 The fast way to compare them would be to check the mantissa/exponent
 directly, but toRational works just fine. I made a pull request
 yesterday that compares them as rationals.

 ___
 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