Re: [Haskell-cafe] enumerators: exception that can't be catched

2013-08-27 Thread Ben Doyle
This is partially guesswork, but the code to catchWSError looks dubious:

catchWsError :: WebSockets p a

 - (SomeException - WebSockets p a) -
WebSockets p a  catchWsError act c = WebSockets $ do  env - ask
   let it  = peelWebSockets env $ act  cit = peelWebSockets
env . c  lift $ it `E.catchError` citwhere  peelWebSockets
env = flip runReaderT env . unWebSockets


Look at `cit`. It runs the recovery function, then hands the
underlying Iteratee the existing environment. That's fine if `act` is
at fault, but there are Iteratee- and IO-ish things in
WebSocketsEnv---if one of `envSink` or `envSendBuilder` is causing the
exception, it'll just get re-thrown after `E.catchError`. (I think.
That's the guesswork part.)

So check how `envSendBuilder` is built up, and see if there's a way it
could throw an exception on client disconnect.



On Tue, Aug 27, 2013 at 10:28 AM, Yuras Shumovich shumovi...@gmail.comwrote:

 Hello,

 I'm debugging an issue in websockets package,
 https://github.com/jaspervdj/websockets/issues/42

 I'm not familiar with enumerator package (websockets are based on it),
 so I'm looking for help. The exception is throws inside enumSocket
 enumerator using
 throwError (
 http://hackage.haskell.org/packages/archive/network-enumerator/0.1.5/doc/html/src/Network-Socket-Enumerator.html#enumSocket),
  but I can't catch it with catchError. It is propagated to run
 function:
interactive: recv: resource vanished (Connection reset by peer)

 The question is: how is it possible? could it be a bug in enumerator
 package?

 Thanks,
 Yuras


 ___
 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] GHC flags: optghc

2013-08-24 Thread Ben Doyle
That's not a GHC flag; it's a haddock flag. Haddock (which, in case you're
not familiar with it, is a program to generate documentation from Haskell
source code) uses GHC, and the `optghc` flag lets you pass options to GHC
when you invoke Haddock. See [the Haddock docs of the 6.12 era][1], on page
3.

It's also entirely possible that some program besides Haddock uses a flag
of the same name (for the same purpose, one would hope).

[1]: http://www.haskell.org/ghc/docs/6.12.3/haddock.pdf




2013/8/23 jabolo...@google.com

 Hi,

 I am using GHC version 6.12.1.
 What is optghc ?

 I can't find that information anywhere...

 Thanks,
 Jose

 --
 Jose Antonio Lopes
 Ganeti Engineering
 Google Germany GmbH
 Dienerstr. 12, 80331, München

 Registergericht und -nummer: Hamburg, HRB 86891
 Sitz der Gesellschaft: Hamburg
 Geschäftsführer: Graham Law, Christine Elizabeth Flores
 Steuernummer: 48/725/00206
 Umsatzsteueridentifikationsnummer: DE813741370

 ___
 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] Teaching FP with Haskell

2013-05-21 Thread Ben Doyle
Helium seems interesting, but the code is a little stale, no? The last
updates seem to be from 2008-2009. I couldn't get it to build with ghc
7.6.3, not that I tried too terribly hard.


On Tue, May 21, 2013 at 6:07 AM, Andrew Butterfield 
andrew.butterfi...@scss.tcd.ie wrote:

 Rustom,
  you should look at Helium
   - http://www.cs.uu.nl/wiki/bin/view/Helium/WebHome


 Andrew.

 On 21 May 2013, at 10:55, Rustom Mody wrote:

 We are offering a MOOC on haskell :

 https://moocfellowship.org/submissions/the-dance-of-functional-programming-languaging-with-haskell-and-python

 Full Announcement on beginners list :
 http://www.haskell.org/pipermail/beginners/2013-May/012013.html

 One question that I have been grappling with in this regard:
 How to run ghc in lightweight/beginner mode?

 2 examples of what I mean:

 1. gofer used to come with an alternative standard prelude -- 'simple.pre'
 Using this, gofer would show many of the type-class based errors as
 simple (non-type-class based) errors.
 This was very useful for us teachers to help noobs start off without
 intimidating them.
 2. Racket comes with a couple of levels.  The easier numbers were not
 completely consistent with scheme semantics, but
 was gentle to beginners

 Any thoughts/inputs on this will be welcomed

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


 
 Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204
 Lero@TCD, Head of Foundations  Methods Research Group
 Director of Teaching and Learning - Undergraduate,
 School of Computer Science and Statistics,
 Room G.39, O'Reilly Institute, Trinity College, University of Dublin
   http://www.scss.tcd.ie/Andrew.Butterfield/
 


 ___
 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] Backward compatibility

2013-05-04 Thread Ben Doyle
You might want to check out
FPCompletehttps://www.fpcomplete.com/page/about-us,
if you haven't already. They're far more focused on making it easy for
organizations to adopt Haskell than the community can be. As they say: Where
the open-source process is not sufficient to meet commercial adoption
needs, we provide the missing pieces.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Backward compatibility

2013-05-04 Thread Ben Doyle
 What pray tell are those missing pieces? Aren't they mostly building a
browser based ide  plus doing training courses ?

Sure, and I believe they plan to have that browser-based IDE talk to a
virtual server, with a compiler and set of libraries they maintain. That'd
solve Adrian's problems, no? So long as he can bring himself to use Yesod
over WASH?

Perhaps more importantly, they're well-spoken and business-savvy, and they
can persuasively promise that they'll make a risk-averse corporation's
(overblown) worries go away. If he's in a management battle, he ought to
know where to hire some mercenaries.



On Sat, May 4, 2013 at 2:03 PM, Carter Schonwald carter.schonw...@gmail.com
 wrote:

 What pray tell are those missing pieces? Aren't they mostly building a
 browser based ide plus doing training courses ?
 On May 4, 2013 1:42 PM, Ben Doyle benjamin.peter.do...@gmail.com
 wrote:

 You might want to check out 
 FPCompletehttps://www.fpcomplete.com/page/about-us,
 if you haven't already. They're far more focused on making it easy for
 organizations to adopt Haskell than the community can be. As they say: Where
 the open-source process is not sufficient to meet commercial adoption
 needs, we provide the missing pieces.

 ___
 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 build phase is very slow

2013-02-04 Thread Ben Doyle
yi is pretty heavy, as these things go. So it's not too surprising that
it's taking a while.

GHC does try to recompile as little as possible...but as little as
possible can be quite a lot. Inlining, and other optimizations GHC
performs, makes the recompilation checker's job tricky; see [1]. Generally
if you change a file you'll need to recompile its dependencies, and *their*
dependencies, and so on.

If you're coding along and just need a typecheck, ghci is your friend.
Specifically, the :reload command tends to be fast. (You'll need to :load
yourFile.hs the first time, of course.)

You might also see if yi's  -fhacking flag is helpful. It looks like it
might be relevant, though I don't know either yi or your use case well
enough to say for sure.

General advice on speeding compilation is here: [2]. Most of it isn't all
that relevant to you at the moment, since you're hacking on someone else's
package. But always good to know.

Best of luck,

Ben

[1]:
http://www.haskell.org/ghc/docs/latest/html/users_guide/separate-compilation.html#recomp
[2]:
http://www.haskell.org/ghc/docs/latest/html/users_guide/sooner-faster-quicker.html#sooner
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Undo records

2013-01-09 Thread Ben Doyle
I think acid-state (http://hackage.haskell.org/package/acid-state) might do
what you want, at least in broad strokes. It uses a durable transaction log
to store query and update events.

As far as I know, the interface to the library doesn't expose an
undo/rollback function, so you'd have a bit of work to do to extend it to
your use case. But the core functionality to make it possible should be
there.

Can you use ghc extensions aside from Template Haskell? Template Haskell
you can do without with acid-state, but without GADTs and so on you'll have
problems.

On Sun, Jan 6, 2013 at 12:01 PM, Casey Basichis caseybasic...@gmail.comwrote:

 Hi,

 I am still getting a hang of Haskell.  Sorry if the answer is obvious.

 What sorts of packages and approaches should I be looking at if I was
 looking to store something like an Undo stack into a database.

 Each table would refer to a function.
 Each records input and outputs would specify both a table ID and record
 ID.
 The records would also have a data and a Process ID to associate all
 functions to a specific process and give them an order.

 No records are ever deleted.  Rolling something back is instead a process
 of recreating a new, modified graph by taking the old graph from the
 database.

 I should note that while I can generate some of the boiler parts from
 template haskell in advance I'm ultimately using a stage 1 compiler with no
 GHCI o template haskell.

 Thanks,
 Casey

 --
 Casey James Basichis
 Composer - Cartoon Network
 http://www.caseyjamesbasichis.com
 caseybasic...@gmail.com
 310.387.7540

 ___
 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] Monads with The contexts?

2012-07-12 Thread Ben Doyle
On Thu, Jul 12, 2012 at 11:01 AM, Takayuki Muranushi muranu...@gmail.comwrote:

  sunPerMars :: [Double]
  sunPerMars = (/) $ sunMass * marsMass

 Sadly, this gives too many answers, and some of them are wrong because
 they assume different Earth mass in calculating Sun and Mars masses,
 which led to inconsistent calculation.


I think what you want to do is factor out the Earth's mass, and do your
division first:

 sunPerMars'' = (/) $ sunMassCoef * marsMassCoef

The mass of the earth cancels.

That gives a list of length 9, where your approach gave 16 distinct
results. But I think that's just floating point rounding noise. Try the
same monadic calculation with integers and ratios.

The moral? Using numbers in a physics calculation should be your last
resort ;)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Installing pandoc / json with ghc 6.12.1

2012-06-15 Thread Ben Doyle

 Am I doing something wrong here?


Well, you're using ghc-6.12 ... :-)

The most recent version of pandoc that Hackage claims to have built with
ghc 6.12 looks to be 1.6. Rolling back that far eliminates the json
dependency entirely, so I think it would solve your issue. Or you could use
the Pandoc in Debian stable, which appears to be 1.5.1.

A more recent ghc would probably also work, of course, but I imagine you're
trying the Debian stable version for a reason.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] mapping a concept to a type

2012-05-18 Thread Ben Doyle
I wonder if you want a typeclass here, rather than a type? A Normal Rule is
pretty much a State Transformer, while a Meta Rule seems like a
higher-order function on Normal Rules[*]. These are different kinds of
things --- and I say kind advisedly --- so perhaps better to define the
specific commonalities you need than to try to shoehorn them both into one
type.

[*]: Possibly related question: Can a Meta Rule depend upon an
implementation detail of a Normal rule? In other words, does
   rule1 g == rule2 g
imply
   myMetaRule rule1 == myMetaRule rule2

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